
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@orchard9ai/api-client
Advanced tools
TypeScript client library for Companion World API - Agent Hub integration
A TypeScript client library for the Companion World API, providing type-safe access to agent management endpoints.
npm install @orchard9ai/api-client
import { createCompanionWorldApiClient } from '@orchard9ai/api-client';
// Create client
const client = createCompanionWorldApiClient({
baseUrl: 'http://localhost:13240',
timeout: 10000
});
// List agents with filtering
const agents = await client.listAgents({
search: 'Alice',
gender: ['F'],
status: ['active'],
page: 1,
pageSize: 20
});
console.log(`Found ${agents.pagination.total} agents`);
interface CompanionWorldApiConfig {
baseUrl: string; // API base URL (e.g., 'http://localhost:13240')
timeout?: number; // Request timeout in milliseconds (default: no timeout)
headers?: Record<string, string>; // Additional headers
}
// Basic listing
const agents = await client.listAgents();
// With filtering and pagination
const filteredAgents = await client.listAgents({
page: 1,
pageSize: 50,
search: 'John',
gender: ['M', 'F'],
status: ['active'],
ageMin: 25,
ageMax: 65,
worlds: ['world-uuid-1', 'world-uuid-2']
});
const agent = await client.getAgent('agent-uuid');
console.log(`${agent.name} is ${agent.age} years old`);
console.log(`Bio: ${agent.bio}`);
console.log(`Traits: ${agent.personalityTraits?.join(', ')}`);
const media = await client.getAgentMedia('agent-uuid', {
page: 1,
pageSize: 20
});
media.media.forEach(item => {
console.log(`${item.title}: ${item.url}`);
});
const newMedia = await client.createAgentMedia('agent-uuid', {
title: 'Profile Photo',
type: 'image',
url: 'https://example.com/photo.jpg',
thumbnailUrl: 'https://example.com/photo-thumb.webp',
size: 245760,
metadata: {
description: 'Professional headshot',
tags: ['profile', 'professional'],
technical_info: {
resolution: '1920x1080',
format: 'JPEG'
}
}
});
const updatedMedia = await client.updateAgentMedia('agent-uuid', 'media-uuid', {
title: 'Updated Title',
metadata: {
description: 'Updated description',
tags: ['updated', 'profile']
}
});
await client.deleteAgentMedia('agent-uuid', 'media-uuid');
The library includes helper functions for common use cases:
import { CompanionWorldHelpers } from '@orchard9ai/api-client';
const helpers = new CompanionWorldHelpers(client);
// Search agents by name
const searchResults = await helpers.searchAgentsByName('Alice');
// Get all agents in a specific world
const worldAgents = await helpers.getAgentsInWorld('world-uuid');
// Filter by demographics
const youngAdults = await helpers.getAgentsByDemographics({
ageMin: 18,
ageMax: 35,
gender: ['F', 'M'],
status: ['active']
});
// Get all media for an agent (handles pagination automatically)
const allMedia = await helpers.getAllAgentMedia('agent-uuid');
The client throws CompanionWorldApiError
for API errors:
import { CompanionWorldApiError } from '@orchard9ai/api-client';
try {
const agent = await client.getAgent('invalid-uuid');
} catch (error) {
if (error instanceof CompanionWorldApiError) {
console.error(`API Error ${error.status}:`, error.data);
} else {
console.error('Unexpected error:', error);
}
}
All types are exported for use in your application:
import type {
AgentListResponse,
SimplifiedAgent,
AgentDetails,
AgentMedia,
CreateAgentMediaRequest,
UpdateAgentMediaRequest,
PaginationInfo,
MediaMetadata
} from '@orchard9ai/api-client';
You can provide your own HTTP client implementation:
import axios from 'axios';
import { CompanionWorldApiClient, HttpClient } from '@orchard9ai/api-client';
class AxiosHttpClient implements HttpClient {
constructor(private axios = axios.create()) {}
async get<T>(url: string): Promise<T> {
const response = await this.axios.get(url);
return response.data;
}
async post<T>(url: string, data?: any): Promise<T> {
const response = await this.axios.post(url, data);
return response.data;
}
async put<T>(url: string, data?: any): Promise<T> {
const response = await this.axios.put(url, data);
return response.data;
}
async delete<T>(url: string): Promise<T> {
const response = await this.axios.delete(url);
return response.data;
}
}
const client = new CompanionWorldApiClient(config, new AxiosHttpClient());
MIT
FAQs
TypeScript client library for Companion World API - Agent Hub integration
The npm package @orchard9ai/api-client receives a total of 0 weekly downloads. As such, @orchard9ai/api-client popularity was classified as not popular.
We found that @orchard9ai/api-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.