@inferencesh/sdk 0.38.15 → 0.38.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,9 +98,13 @@ export declare class SkillsAPI {
98
98
  */
99
99
  download(namespace: string, name: string): Promise<Response<unknown>>;
100
100
  /**
101
- * Get skill content
101
+ * Get a skill's SKILL.md. The API answers with the markdown itself.
102
102
  */
103
- getContent(namespace: string, name: string): Promise<Response<unknown>>;
103
+ getContent(namespace: string, name: string): Promise<Response<string>>;
104
+ /**
105
+ * Get one of a skill's files by its path in the skill (e.g. "scripts/run.sh").
106
+ */
107
+ getFile(namespace: string, name: string, path: string): Promise<Response<string>>;
104
108
  /**
105
109
  * Transfer ownership
106
110
  */
@@ -139,10 +139,19 @@ export class SkillsAPI {
139
139
  return this.http.request('get', `/skills/${namespace}/${name}/download`);
140
140
  }
141
141
  /**
142
- * Get skill content
142
+ * Get a skill's SKILL.md. The API answers with the markdown itself.
143
143
  */
144
144
  async getContent(namespace, name) {
145
- return this.http.request('get', `/skills/${namespace}/${name}/content`);
145
+ const response = await this.http.fetch(`/skills/${namespace}/${name}/content`);
146
+ return { data: await response.text(), messages: [] };
147
+ }
148
+ /**
149
+ * Get one of a skill's files by its path in the skill (e.g. "scripts/run.sh").
150
+ */
151
+ async getFile(namespace, name, path) {
152
+ const filePath = path.split('/').map(encodeURIComponent).join('/');
153
+ const response = await this.http.fetch(`/skills/${namespace}/${name}/files/${filePath}`);
154
+ return { data: await response.text(), messages: [] };
146
155
  }
147
156
  /**
148
157
  * Transfer ownership
@@ -17,9 +17,12 @@ export declare class MCPServersAPI {
17
17
  */
18
18
  get(slug: string): Promise<Response<MCPServerDTO>>;
19
19
  /**
20
- * List tools for an MCP server
20
+ * List tools for an MCP server. The API answers from the catalogue it
21
+ * recorded within the hour; refresh asks the server again.
21
22
  */
22
- listTools(slug: string): Promise<Response<unknown[]>>;
23
+ listTools(slug: string, options?: {
24
+ refresh?: boolean;
25
+ }): Promise<Response<unknown[]>>;
23
26
  /**
24
27
  * Call a tool on an MCP server
25
28
  */
@@ -18,10 +18,11 @@ export class MCPServersAPI {
18
18
  return this.http.request('get', `/mcps/${slug}`);
19
19
  }
20
20
  /**
21
- * List tools for an MCP server
21
+ * List tools for an MCP server. The API answers from the catalogue it
22
+ * recorded within the hour; refresh asks the server again.
22
23
  */
23
- async listTools(slug) {
24
- return this.http.request('get', `/mcps/${slug}/tools`);
24
+ async listTools(slug, options) {
25
+ return this.http.request('get', `/mcps/${slug}/tools`, options?.refresh ? { params: { refresh: 1 } } : {});
25
26
  }
26
27
  /**
27
28
  * Call a tool on an MCP server
@@ -0,0 +1,38 @@
1
+ import { HttpClient } from '../http/client.js';
2
+ import type { Response } from '../http/response.js';
3
+ import type { PublicationCreateBody, PublicationUpdateBody } from './write-bodies.js';
4
+ import { PublicationDTO } from '../types.js';
5
+ /**
6
+ * Publications API
7
+ *
8
+ * A publication makes a resource (an agent) embeddable on other sites:
9
+ * which origins may embed it, its rate limit and its theme.
10
+ */
11
+ export declare class PublicationsAPI {
12
+ private readonly http;
13
+ constructor(http: HttpClient);
14
+ /**
15
+ * List a resource's publications
16
+ */
17
+ list(resourceType: string, resourceId: string): Promise<Response<PublicationDTO[]>>;
18
+ /**
19
+ * Get a publication by ID
20
+ */
21
+ get(id: string): Promise<Response<PublicationDTO>>;
22
+ /**
23
+ * Publish a resource
24
+ */
25
+ create(data: PublicationCreateBody): Promise<Response<PublicationDTO>>;
26
+ /**
27
+ * Write a publication's whole row: a field left out is cleared
28
+ */
29
+ update(id: string, data: PublicationUpdateBody): Promise<Response<PublicationDTO>>;
30
+ /**
31
+ * Write only the fields sent
32
+ */
33
+ patch(id: string, data: PublicationUpdateBody): Promise<Response<PublicationDTO>>;
34
+ /**
35
+ * Unpublish
36
+ */
37
+ delete(id: string): Promise<Response<void>>;
38
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Publications API
3
+ *
4
+ * A publication makes a resource (an agent) embeddable on other sites:
5
+ * which origins may embed it, its rate limit and its theme.
6
+ */
7
+ export class PublicationsAPI {
8
+ constructor(http) {
9
+ this.http = http;
10
+ }
11
+ /**
12
+ * List a resource's publications
13
+ */
14
+ async list(resourceType, resourceId) {
15
+ return this.http.request('get', '/publications', {
16
+ params: { resource_type: resourceType, resource_id: resourceId },
17
+ });
18
+ }
19
+ /**
20
+ * Get a publication by ID
21
+ */
22
+ async get(id) {
23
+ return this.http.request('get', `/publications/${id}`);
24
+ }
25
+ /**
26
+ * Publish a resource
27
+ */
28
+ async create(data) {
29
+ return this.http.request('post', '/publications', { data });
30
+ }
31
+ /**
32
+ * Write a publication's whole row: a field left out is cleared
33
+ */
34
+ async update(id, data) {
35
+ return this.http.request('put', `/publications/${id}`, { data });
36
+ }
37
+ /**
38
+ * Write only the fields sent
39
+ */
40
+ async patch(id, data) {
41
+ return this.http.request('patch', `/publications/${id}`, { data });
42
+ }
43
+ /**
44
+ * Unpublish
45
+ */
46
+ async delete(id) {
47
+ return this.http.request('delete', `/publications/${id}`);
48
+ }
49
+ }
@@ -0,0 +1,38 @@
1
+ import { HttpClient } from '../http/client.js';
2
+ import type { Response } from '../http/response.js';
3
+ import { CreateSandboxRequest, CursorListRequest, CursorListResponse, SandboxDTO } from '../types.js';
4
+ /**
5
+ * Sandboxes API
6
+ *
7
+ * A sandbox is a box on one of our engines that runs belt and connects back
8
+ * as a remote. The owner sets what it should be (running, stopped, deleted);
9
+ * start, stop and delete answer at once and the status follows.
10
+ */
11
+ export declare class SandboxesAPI {
12
+ private readonly http;
13
+ constructor(http: HttpClient);
14
+ /**
15
+ * List the caller's sandboxes with cursor-based pagination
16
+ */
17
+ list(params?: Partial<CursorListRequest>): Promise<Response<CursorListResponse<SandboxDTO>>>;
18
+ /**
19
+ * Get a sandbox by ID
20
+ */
21
+ get(id: string): Promise<Response<SandboxDTO>>;
22
+ /**
23
+ * Create a sandbox. Sizes left out take the defaults; it starts on its own.
24
+ */
25
+ create(data: CreateSandboxRequest): Promise<Response<SandboxDTO>>;
26
+ /**
27
+ * Start a stopped sandbox. Its disk is new; its remote is the same.
28
+ */
29
+ start(id: string): Promise<Response<SandboxDTO>>;
30
+ /**
31
+ * Stop a sandbox. The record and its remote stay.
32
+ */
33
+ stop(id: string): Promise<Response<SandboxDTO>>;
34
+ /**
35
+ * Stop a sandbox, then remove the record and its remote
36
+ */
37
+ delete(id: string): Promise<Response<void>>;
38
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Sandboxes API
3
+ *
4
+ * A sandbox is a box on one of our engines that runs belt and connects back
5
+ * as a remote. The owner sets what it should be (running, stopped, deleted);
6
+ * start, stop and delete answer at once and the status follows.
7
+ */
8
+ export class SandboxesAPI {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /**
13
+ * List the caller's sandboxes with cursor-based pagination
14
+ */
15
+ async list(params) {
16
+ return this.http.request('post', '/sandboxes/list', { data: params });
17
+ }
18
+ /**
19
+ * Get a sandbox by ID
20
+ */
21
+ async get(id) {
22
+ return this.http.request('get', `/sandboxes/${id}`);
23
+ }
24
+ /**
25
+ * Create a sandbox. Sizes left out take the defaults; it starts on its own.
26
+ */
27
+ async create(data) {
28
+ return this.http.request('post', '/sandboxes', { data });
29
+ }
30
+ /**
31
+ * Start a stopped sandbox. Its disk is new; its remote is the same.
32
+ */
33
+ async start(id) {
34
+ return this.http.request('post', `/sandboxes/${id}/start`);
35
+ }
36
+ /**
37
+ * Stop a sandbox. The record and its remote stay.
38
+ */
39
+ async stop(id) {
40
+ return this.http.request('post', `/sandboxes/${id}/stop`);
41
+ }
42
+ /**
43
+ * Stop a sandbox, then remove the record and its remote
44
+ */
45
+ async delete(id) {
46
+ return this.http.request('delete', `/sandboxes/${id}`);
47
+ }
48
+ }
@@ -15,7 +15,7 @@
15
15
  * chats, engines and teams send PATCH; apps.patch and flows.patch are the
16
16
  * partial siblings of the POST updates that also edit a version.
17
17
  */
18
- import type { AgentConfigInput, ResourceImages, AppDTO, ChatDTO, CredentialRequirements, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO, MCPServerDTO, ProjectDTO, TeamDTO, Visibility } from '../types.js';
18
+ import type { AgentConfigInput, ResourceImages, AppDTO, ChatDTO, CredentialRequirements, EngineDTO, FlowDTO, FlowVersionDTO, KnowledgeDTO, MCPServerDTO, ProjectDTO, PublicationDTO, TeamDTO, Visibility } from '../types.js';
19
19
  /**
20
20
  * POST /agents/{id}. Images, and a new version when `version` is set.
21
21
  * Visibility: `agents.updateVisibility`. Name, title, harness, placement:
@@ -121,3 +121,14 @@ export interface MCPServerUpdateBody {
121
121
  documentation_url?: string;
122
122
  credentials?: CredentialRequirements;
123
123
  }
124
+ /**
125
+ * POST /publications. What to publish (`resource_type`, e.g. "agent", and
126
+ * `resource_id`), where it may be embedded and how it looks. Namespace and
127
+ * name come from the resource; a new publication is enabled.
128
+ */
129
+ export type PublicationCreateBody = Pick<PublicationDTO, 'resource_type' | 'resource_id'> & Partial<Pick<PublicationDTO, 'title' | 'allowed_origins' | 'rate_limit_rpm' | 'theme' | 'label' | 'visibility'>>;
130
+ /**
131
+ * PUT /publications/{id} writes the whole row: a field left out is cleared.
132
+ * PATCH (`publications.patch`) writes only the fields sent.
133
+ */
134
+ export type PublicationUpdateBody = Partial<Pick<PublicationDTO, 'title' | 'allowed_origins' | 'rate_limit_rpm' | 'theme' | 'label' | 'enabled'>>;
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export { FlowRunsAPI } from './api/flow-runs.js';
18
18
  export { EnginesAPI } from './api/engines.js';
19
19
  export { KnowledgeAPI, SkillsAPI } from './api/knowledge.js';
20
20
  export { ArtifactsAPI } from './api/artifacts.js';
21
- export type { AgentUpdateBody, AppPatchBody, AppUpdateBody, ChatUpdateBody, EngineUpdateBody, FlowUpdateBody, FlowPatchBody, FlowViewportBody, ProjectWriteBody, ProjectCreateBody, ProjectUpdateBody, KnowledgeUpdateBody, TeamUpdateBody, MCPServerCreateBody, MCPServerUpdateBody, } from './api/write-bodies.js';
21
+ export type { AgentUpdateBody, AppPatchBody, AppUpdateBody, ChatUpdateBody, EngineUpdateBody, FlowUpdateBody, FlowPatchBody, FlowViewportBody, ProjectWriteBody, ProjectCreateBody, ProjectUpdateBody, KnowledgeUpdateBody, TeamUpdateBody, MCPServerCreateBody, MCPServerUpdateBody, PublicationCreateBody, PublicationUpdateBody, } from './api/write-bodies.js';
22
22
  export { TeamsAPI } from './api/teams.js';
23
23
  export { SecretsAPI } from './api/secrets.js';
24
24
  export { ApiKeysAPI } from './api/api-keys.js';
@@ -26,6 +26,8 @@ export { CredentialsAPI } from './api/credentials.js';
26
26
  export { SearchAPI } from './api/search.js';
27
27
  export { ProjectsAPI } from './api/projects.js';
28
28
  export { MCPServersAPI } from './api/mcp-servers.js';
29
+ export { SandboxesAPI } from './api/sandboxes.js';
30
+ export { PublicationsAPI } from './api/publications.js';
29
31
  export { LiveSession, accessUrl } from './live/session.js';
30
32
  export type { LiveState, LiveEnd, LiveHandlers, LiveSessionOptions, RealtimeOptions, LiveUpdate, WebSocketLike, WebSocketConstructor } from './live/session.js';
31
33
  export { STREAM_FORMAT, CLEAR_KEY, ERROR_KEY, REDIAL_CODES, RELAY_KEY } from './live/protocol.js';
@@ -62,6 +64,8 @@ import { CredentialsAPI } from './api/credentials.js';
62
64
  import { SearchAPI } from './api/search.js';
63
65
  import { ProjectsAPI } from './api/projects.js';
64
66
  import { MCPServersAPI } from './api/mcp-servers.js';
67
+ import { SandboxesAPI } from './api/sandboxes.js';
68
+ import { PublicationsAPI } from './api/publications.js';
65
69
  import { ApiAppRunRequest, TaskDTO as Task, AgentConfigInput as AgentConfig, FileDTO as File } from './types.js';
66
70
  export interface InferenceConfig {
67
71
  /** Your inference.sh API key (required unless using proxyUrl) */
@@ -118,6 +122,8 @@ export declare class Inference {
118
122
  readonly search: SearchAPI;
119
123
  readonly projects: ProjectsAPI;
120
124
  readonly mcpServers: MCPServersAPI;
125
+ readonly sandboxes: SandboxesAPI;
126
+ readonly publications: PublicationsAPI;
121
127
  readonly sockets: SocketsAPI;
122
128
  constructor(config: InferenceConfig | HttpClientConfig);
123
129
  /** @internal */
package/dist/index.js CHANGED
@@ -27,6 +27,8 @@ export { CredentialsAPI } from './api/credentials.js';
27
27
  export { SearchAPI } from './api/search.js';
28
28
  export { ProjectsAPI } from './api/projects.js';
29
29
  export { MCPServersAPI } from './api/mcp-servers.js';
30
+ export { SandboxesAPI } from './api/sandboxes.js';
31
+ export { PublicationsAPI } from './api/publications.js';
30
32
  // Live: the socket of a stream task and the live fields of its schemas
31
33
  export { LiveSession, accessUrl } from './live/session.js';
32
34
  export { STREAM_FORMAT, CLEAR_KEY, ERROR_KEY, REDIAL_CODES, RELAY_KEY } from './live/protocol.js';
@@ -64,6 +66,8 @@ import { CredentialsAPI } from './api/credentials.js';
64
66
  import { SearchAPI } from './api/search.js';
65
67
  import { ProjectsAPI } from './api/projects.js';
66
68
  import { MCPServersAPI } from './api/mcp-servers.js';
69
+ import { SandboxesAPI } from './api/sandboxes.js';
70
+ import { PublicationsAPI } from './api/publications.js';
67
71
  /**
68
72
  * Inference.sh SDK Client
69
73
  *
@@ -107,6 +111,8 @@ export class Inference {
107
111
  this.search = new SearchAPI(this.http);
108
112
  this.projects = new ProjectsAPI(this.http);
109
113
  this.mcpServers = new MCPServersAPI(this.http);
114
+ this.sandboxes = new SandboxesAPI(this.http);
115
+ this.publications = new PublicationsAPI(this.http);
110
116
  this.sockets = new SocketsAPI(this.http, this.tasks);
111
117
  }
112
118
  // Legacy methods for backward compatibility
package/dist/types.d.ts CHANGED
@@ -478,7 +478,6 @@ export interface ApiAppRunRequest {
478
478
  session?: string;
479
479
  session_timeout?: number;
480
480
  run_at?: string;
481
- metadata?: TaskMetadata;
482
481
  }
483
482
  /**
484
483
  * MessageInput is a message a caller sends to an agent: its text and the
@@ -909,6 +908,13 @@ export interface CredentialCompleteOAuthRequest {
909
908
  export interface CredentialConnectResponse {
910
909
  credential?: CredentialDTO;
911
910
  auth_url?: string;
911
+ /**
912
+ * ConnectURL is a short link on our app that sends the person who
913
+ * started this connect on to AuthURL. A client that does not finish the
914
+ * flow in its own browser tab (a CLI, an agent) shows this one: the
915
+ * app's callback completes only a flow its browser started.
916
+ */
917
+ connect_url?: string;
912
918
  state?: string;
913
919
  code_verifier?: string;
914
920
  instructions?: string;
@@ -5134,6 +5140,48 @@ export interface ProjectDTO extends BaseModelDTO, PermissionModelDTO {
5134
5140
  parent?: ProjectDTO;
5135
5141
  children: (ProjectDTO | undefined)[];
5136
5142
  }
5143
+ /**
5144
+ * PublicationThemeColors defines the core colors for one mode (light or dark).
5145
+ */
5146
+ export interface PublicationThemeColors {
5147
+ primary: string;
5148
+ secondary: string;
5149
+ background: string;
5150
+ text: string;
5151
+ border?: string;
5152
+ }
5153
+ /**
5154
+ * PublicationTheme defines branding colors for embedded UIs.
5155
+ */
5156
+ export interface PublicationTheme {
5157
+ light: PublicationThemeColors;
5158
+ dark?: PublicationThemeColors;
5159
+ }
5160
+ /**
5161
+ * PublicationDTO for API responses.
5162
+ */
5163
+ export interface PublicationDTO extends BaseModelDTO, PermissionModelDTO {
5164
+ resource_type: string;
5165
+ resource_id: string;
5166
+ namespace: string;
5167
+ name: string;
5168
+ /**
5169
+ * Title is the human-readable name; empty falls back to Name.
5170
+ */
5171
+ title: string;
5172
+ allowed_origins?: string[];
5173
+ rate_limit_rpm?: number;
5174
+ theme?: PublicationTheme;
5175
+ label?: string;
5176
+ enabled: boolean;
5177
+ /**
5178
+ * VisitorReads is the scope groups of the team's resources (knowledge,
5179
+ * artifacts, files, remotes) a visitor can ask the published agent's
5180
+ * current version to reach by id: what its built-in tools add to an
5181
+ * embed run. Empty when its tools reach only what it names itself.
5182
+ */
5183
+ visitor_reads: ScopeGroup[];
5184
+ }
5137
5185
  /**
5138
5186
  * AccessNoticeDTO is the redlist's notice to a restricted caller, as a
5139
5187
  * refusal's meta.notice and /me's access_notice carry it.
@@ -8799,20 +8847,6 @@ export declare const TaskLogTypeRun: TaskLogType;
8799
8847
  export declare const TaskLogTypeServe: TaskLogType;
8800
8848
  export declare const TaskLogTypeSetup: TaskLogType;
8801
8849
  export declare const TaskLogTypeTask: TaskLogType;
8802
- /**
8803
- * TaskAction defines an action to execute when a task reaches a specific status.
8804
- */
8805
- export interface TaskAction {
8806
- key: string;
8807
- on: string;
8808
- params?: any;
8809
- }
8810
- /**
8811
- * TaskMetadata holds optional metadata attached to a task.
8812
- */
8813
- export interface TaskMetadata {
8814
- action?: TaskAction;
8815
- }
8816
8850
  export type TeamType = "personal" | "team" | "system" | "org";
8817
8851
  export declare const TeamTypePersonal: TeamType;
8818
8852
  export declare const TeamTypeTeam: TeamType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.38.15",
3
+ "version": "0.38.16",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",