@inferencesh/sdk 0.4.24 → 0.4.25

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.
@@ -189,7 +189,7 @@ export class AgentsAPI {
189
189
  * Update an agent template
190
190
  */
191
191
  async update(agentId, data) {
192
- return this.http.request('put', `/agents/${agentId}`, { data });
192
+ return this.http.request('post', `/agents/${agentId}`, { data });
193
193
  }
194
194
  /**
195
195
  * Delete an agent template
@@ -219,7 +219,7 @@ export class AgentsAPI {
219
219
  * Update agent visibility
220
220
  */
221
221
  async updateVisibility(agentId, visibility) {
222
- return this.http.request('put', `/agents/${agentId}/visibility`, { data: { visibility } });
222
+ return this.http.request('post', `/agents/${agentId}/visibility`, { data: { visibility } });
223
223
  }
224
224
  /**
225
225
  * Get a specific agent version
package/dist/api/apps.js CHANGED
@@ -33,7 +33,7 @@ export class AppsAPI {
33
33
  * Update an app
34
34
  */
35
35
  async update(appId, data) {
36
- return this.http.request('put', `/apps/${appId}`, { data });
36
+ return this.http.request('post', `/apps/${appId}`, { data });
37
37
  }
38
38
  /**
39
39
  * Delete an app
@@ -63,7 +63,7 @@ export class AppsAPI {
63
63
  * Update app visibility
64
64
  */
65
65
  async updateVisibility(appId, visibility) {
66
- return this.http.request('put', `/apps/${appId}/visibility`, { data: { visibility } });
66
+ return this.http.request('post', `/apps/${appId}/visibility`, { data: { visibility } });
67
67
  }
68
68
  /**
69
69
  * Get an app by namespace and name (e.g., "inference/claude-haiku")
@@ -81,7 +81,7 @@ export class AppsAPI {
81
81
  * Save app license
82
82
  */
83
83
  async saveLicense(appId, license) {
84
- return this.http.request('put', `/apps/${appId}/license`, { data: { license } });
84
+ return this.http.request('post', `/apps/${appId}/license`, { data: { license } });
85
85
  }
86
86
  }
87
87
  export function createAppsAPI(http) {
package/dist/api/chats.js CHANGED
@@ -21,7 +21,7 @@ export class ChatsAPI {
21
21
  * Update a chat
22
22
  */
23
23
  async update(chatId, data) {
24
- return this.http.request('put', `/chats/${chatId}`, { data });
24
+ return this.http.request('post', `/chats/${chatId}`, { data });
25
25
  }
26
26
  /**
27
27
  * Delete a chat
@@ -33,7 +33,7 @@ export class EnginesAPI {
33
33
  * Update an engine
34
34
  */
35
35
  async update(engineId, data) {
36
- return this.http.request('put', `/engines/${engineId}`, { data });
36
+ return this.http.request('post', `/engines/${engineId}`, { data });
37
37
  }
38
38
  /**
39
39
  * Delete an engine
package/dist/api/flows.js CHANGED
@@ -27,7 +27,7 @@ export class FlowsAPI {
27
27
  * Update a flow
28
28
  */
29
29
  async update(flowId, data) {
30
- return this.http.request('put', `/flows/${flowId}`, { data });
30
+ return this.http.request('post', `/flows/${flowId}`, { data });
31
31
  }
32
32
  /**
33
33
  * Delete a flow
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from '../http/client';
2
- import { TaskDTO as Task, ApiAppRunRequest, CreateTaskRequest, CursorListRequest, CursorListResponse } from '../types';
2
+ import { TaskDTO as Task, ApiAppRunRequest, CursorListRequest, CursorListResponse } from '../types';
3
3
  export interface RunOptions {
4
4
  /** Callback for real-time status updates */
5
5
  onUpdate?: (update: Task) => void;
@@ -25,21 +25,17 @@ export declare class TasksAPI {
25
25
  */
26
26
  list(params?: Partial<CursorListRequest>): Promise<CursorListResponse<Task>>;
27
27
  /**
28
- * List featured tasks
28
+ * List featured tasks with cursor-based pagination
29
29
  */
30
- listFeatured(): Promise<Task[]>;
30
+ listFeatured(params?: Partial<CursorListRequest>): Promise<CursorListResponse<Task>>;
31
31
  /**
32
32
  * Get a task by ID
33
33
  */
34
34
  get(taskId: string): Promise<Task>;
35
35
  /**
36
- * Create a task directly
37
- * Accepts either simple format { app: string; input: unknown } or full CreateTaskRequest
36
+ * Create and run a task
38
37
  */
39
- create(data: CreateTaskRequest | {
40
- app: string;
41
- input: unknown;
42
- }): Promise<Task>;
38
+ create(data: ApiAppRunRequest): Promise<Task>;
43
39
  /**
44
40
  * Delete a task
45
41
  */
package/dist/api/tasks.js CHANGED
@@ -26,10 +26,10 @@ export class TasksAPI {
26
26
  return this.http.request('post', '/tasks/list', { data: params });
27
27
  }
28
28
  /**
29
- * List featured tasks
29
+ * List featured tasks with cursor-based pagination
30
30
  */
31
- async listFeatured() {
32
- return this.http.request('get', '/tasks/featured');
31
+ async listFeatured(params) {
32
+ return this.http.request('get', '/tasks/featured', { params });
33
33
  }
34
34
  /**
35
35
  * Get a task by ID
@@ -38,11 +38,10 @@ export class TasksAPI {
38
38
  return this.http.request('get', `/tasks/${taskId}`);
39
39
  }
40
40
  /**
41
- * Create a task directly
42
- * Accepts either simple format { app: string; input: unknown } or full CreateTaskRequest
41
+ * Create and run a task
43
42
  */
44
43
  async create(data) {
45
- return this.http.request('post', '/tasks', { data });
44
+ return this.http.request('post', '/apps/run', { data });
46
45
  }
47
46
  /**
48
47
  * Delete a task
@@ -128,13 +127,13 @@ export class TasksAPI {
128
127
  * Update task visibility
129
128
  */
130
129
  async updateVisibility(taskId, visibility) {
131
- return this.http.request('put', `/tasks/${taskId}/visibility`, { data: { visibility } });
130
+ return this.http.request('post', `/tasks/${taskId}/visibility`, { data: { visibility } });
132
131
  }
133
132
  /**
134
133
  * Feature/unfeature a task
135
134
  */
136
135
  async feature(taskId, featured) {
137
- return this.http.request('put', `/tasks/${taskId}/feature`, { data: { featured } });
136
+ return this.http.request('post', `/tasks/${taskId}/featured`, { data: { featured } });
138
137
  }
139
138
  }
140
139
  export function createTasksAPI(http) {
@@ -194,11 +194,11 @@ describe('namespaced APIs', () => {
194
194
  });
195
195
  const client = new Inference({ apiKey: 'test-api-key' });
196
196
  const result = await client.tasks.create({
197
- app_id: 'test-app',
197
+ app: 'test-org/test-app@v1',
198
198
  input: { message: 'hello world!' },
199
199
  });
200
200
  expect(result.id).toBe('task-123');
201
- expect(mockFetch).toHaveBeenCalledWith(expect.stringContaining('/tasks'), expect.objectContaining({ method: 'POST' }));
201
+ expect(mockFetch).toHaveBeenCalledWith(expect.stringContaining('/apps/run'), expect.objectContaining({ method: 'POST' }));
202
202
  });
203
203
  it('should get task via tasks.get()', async () => {
204
204
  const mockTask = { id: 'task-123', status: 7 };
package/dist/types.d.ts CHANGED
@@ -290,7 +290,9 @@ export interface APIError {
290
290
  }
291
291
  /**
292
292
  * ApiAppRunRequest is the request body for /apps/run endpoint.
293
- * Version pinning is required for stability.
293
+ * Supports two ways to specify the app:
294
+ * 1. App ref (recommended): "namespace/name@shortid" in the App field
295
+ * 2. Direct IDs: app_id + version_id fields (for internal platform use)
294
296
  */
295
297
  export interface ApiAppRunRequest {
296
298
  /**
@@ -298,11 +300,12 @@ export interface ApiAppRunRequest {
298
300
  * Example: "okaris/flux@abc1"
299
301
  * The short ID ensures your code always runs the same version.
300
302
  */
301
- app: string;
303
+ app?: string;
302
304
  /**
303
- * Deprecated: Use namespace/name@shortid format in App field instead.
305
+ * Alternative: specify app by ID (for internal use)
304
306
  */
305
- version?: string;
307
+ app_id?: string;
308
+ version_id?: string;
306
309
  infra?: Infra;
307
310
  workers?: string[];
308
311
  webhook?: string;
@@ -313,24 +316,6 @@ export interface ApiAppRunRequest {
313
316
  */
314
317
  stream?: boolean;
315
318
  }
316
- /**
317
- * CreateTaskRequest is the request body for creating a task via /tasks endpoint.
318
- * Used internally by the app.
319
- */
320
- export interface CreateTaskRequest {
321
- id?: string;
322
- app_id: string;
323
- version_id?: string;
324
- function?: string;
325
- infra?: Infra;
326
- workers?: string[];
327
- webhook?: string;
328
- setup?: unknown;
329
- input: unknown;
330
- flow_run_id?: string;
331
- chat_id?: string;
332
- graph_id?: string;
333
- }
334
319
  /**
335
320
  * ApiAgentRunRequest is the request body for /agents/run endpoint.
336
321
  * Supports both template agents and ad-hoc agents.
@@ -387,20 +372,6 @@ export interface CreateAgentMessageResponse {
387
372
  user_message?: ChatMessageDTO;
388
373
  assistant_message?: ChatMessageDTO;
389
374
  }
390
- /**
391
- * CreateAgentRequest is the request body for creating/updating agent templates.
392
- * For new agents, omit the id field. For updates, include the id.
393
- */
394
- export interface CreateAgentRequest {
395
- id?: string;
396
- name: string;
397
- images?: AgentImages;
398
- version: AgentConfig & {
399
- description?: string;
400
- system_prompt?: string;
401
- example_prompts?: string[];
402
- };
403
- }
404
375
  /**
405
376
  * ToolResultRequest represents a tool result submission
406
377
  * For widget actions, clients should JSON-serialize { action, form_data } as the result string
@@ -463,6 +434,27 @@ export interface CreateFlowRunRequest {
463
434
  flow: string;
464
435
  input: any;
465
436
  }
437
+ /**
438
+ * CreateAgentRequest is the request body for POST /agents
439
+ * For new agents: omit ID, backend generates it
440
+ * For new version of existing agent: include ID
441
+ */
442
+ export interface CreateAgentRequest {
443
+ /**
444
+ * Existing agent ID (if updating/versioning)
445
+ */
446
+ id?: string;
447
+ /**
448
+ * Agent metadata
449
+ */
450
+ name: string;
451
+ namespace?: string;
452
+ images?: AgentImages;
453
+ /**
454
+ * Version config (embedded - backend generates version ID, timestamps, etc)
455
+ */
456
+ version?: AgentConfig;
457
+ }
466
458
  /**
467
459
  * SDKTypes is a phantom struct that references types needed by the SDK.
468
460
  * This ensures the typegen traces these types without creating aliases.
@@ -975,74 +967,6 @@ export interface ChatMessageDTO extends BaseModel, PermissionModelDTO {
975
967
  tool_call_id?: string;
976
968
  tool_invocations?: ToolInvocationDTO[];
977
969
  }
978
- /**
979
- * GraphNodeType defines the type of graph node
980
- */
981
- export type GraphNodeType = string;
982
- export declare const GraphNodeTypeUnknown: GraphNodeType;
983
- export declare const GraphNodeTypeJoin: GraphNodeType;
984
- export declare const GraphNodeTypeSplit: GraphNodeType;
985
- export declare const GraphNodeTypeExecution: GraphNodeType;
986
- export declare const GraphNodeTypeResource: GraphNodeType;
987
- export declare const GraphNodeTypeApproval: GraphNodeType;
988
- export declare const GraphNodeTypeConditional: GraphNodeType;
989
- export declare const GraphNodeTypeFlowNode: GraphNodeType;
990
- /**
991
- * GraphNodeStatus defines the status of a graph node
992
- */
993
- export type GraphNodeStatus = string;
994
- export declare const GraphNodeStatusPending: GraphNodeStatus;
995
- export declare const GraphNodeStatusReady: GraphNodeStatus;
996
- export declare const GraphNodeStatusRunning: GraphNodeStatus;
997
- export declare const GraphNodeStatusCompleted: GraphNodeStatus;
998
- export declare const GraphNodeStatusFailed: GraphNodeStatus;
999
- export declare const GraphNodeStatusCancelled: GraphNodeStatus;
1000
- export declare const GraphNodeStatusSkipped: GraphNodeStatus;
1001
- export declare const GraphNodeStatusBlocked: GraphNodeStatus;
1002
- /**
1003
- * GraphEdgeType defines the type of edge relationship
1004
- */
1005
- export type GraphEdgeType = string;
1006
- export declare const GraphEdgeTypeDependency: GraphEdgeType;
1007
- export declare const GraphEdgeTypeFlow: GraphEdgeType;
1008
- export declare const GraphEdgeTypeConditional: GraphEdgeType;
1009
- export declare const GraphEdgeTypeExecution: GraphEdgeType;
1010
- /**
1011
- * GraphNodeDTO is the API representation of a graph node
1012
- */
1013
- export interface GraphNodeDTO extends BaseModel {
1014
- graph_id: string;
1015
- type: GraphNodeType;
1016
- label: string;
1017
- resource_id: string;
1018
- resource_type: string;
1019
- status: GraphNodeStatus;
1020
- metadata?: StringEncodedMap;
1021
- ready_at?: string;
1022
- started_at?: string;
1023
- completed_at?: string;
1024
- duration_ms?: number;
1025
- }
1026
- /**
1027
- * GraphEdgeDTO is the API representation of a graph edge
1028
- */
1029
- export interface GraphEdgeDTO extends BaseModel {
1030
- type: GraphEdgeType;
1031
- from_node: string;
1032
- to_node: string;
1033
- }
1034
- /**
1035
- * ChatTraceDTO is the trace response for chat observability
1036
- */
1037
- export interface ChatTraceDTO {
1038
- graph_id: string;
1039
- nodes: (GraphNodeDTO | undefined)[];
1040
- edges: (GraphEdgeDTO | undefined)[];
1041
- total_steps: number;
1042
- completed_steps: number;
1043
- running_steps: number;
1044
- failed_steps: number;
1045
- }
1046
970
  export type StringEncodedMap = {
1047
971
  [key: string]: any;
1048
972
  };
@@ -1397,6 +1321,74 @@ export interface FlowRunInput {
1397
1321
  Connection?: FlowNodeConnection;
1398
1322
  Value: any;
1399
1323
  }
1324
+ export type GraphNodeType = string;
1325
+ export declare const GraphNodeTypeUnknown: GraphNodeType;
1326
+ export declare const GraphNodeTypeJoin: GraphNodeType;
1327
+ export declare const GraphNodeTypeSplit: GraphNodeType;
1328
+ export declare const GraphNodeTypeExecution: GraphNodeType;
1329
+ export declare const GraphNodeTypeResource: GraphNodeType;
1330
+ export declare const GraphNodeTypeApproval: GraphNodeType;
1331
+ export declare const GraphNodeTypeConditional: GraphNodeType;
1332
+ export declare const GraphNodeTypeFlowNode: GraphNodeType;
1333
+ /**
1334
+ * GraphNodeStatus represents the status of a node
1335
+ */
1336
+ export type GraphNodeStatus = string;
1337
+ export declare const GraphNodeStatusPending: GraphNodeStatus;
1338
+ export declare const GraphNodeStatusReady: GraphNodeStatus;
1339
+ export declare const GraphNodeStatusRunning: GraphNodeStatus;
1340
+ export declare const GraphNodeStatusCompleted: GraphNodeStatus;
1341
+ export declare const GraphNodeStatusFailed: GraphNodeStatus;
1342
+ export declare const GraphNodeStatusCancelled: GraphNodeStatus;
1343
+ export declare const GraphNodeStatusSkipped: GraphNodeStatus;
1344
+ export declare const GraphNodeStatusBlocked: GraphNodeStatus;
1345
+ /**
1346
+ * GraphEdgeType defines the type of edge relationship
1347
+ */
1348
+ export type GraphEdgeType = string;
1349
+ export declare const GraphEdgeTypeDependency: GraphEdgeType;
1350
+ export declare const GraphEdgeTypeFlow: GraphEdgeType;
1351
+ export declare const GraphEdgeTypeConditional: GraphEdgeType;
1352
+ export declare const GraphEdgeTypeExecution: GraphEdgeType;
1353
+ /**
1354
+ * GraphNodeDTO is the API representation of a graph node
1355
+ */
1356
+ export interface GraphNodeDTO extends BaseModel {
1357
+ graph_id: string;
1358
+ type: GraphNodeType;
1359
+ label: string;
1360
+ resource_id: string;
1361
+ resource_type: string;
1362
+ status: GraphNodeStatus;
1363
+ metadata?: StringEncodedMap;
1364
+ ready_at?: string;
1365
+ started_at?: string;
1366
+ completed_at?: string;
1367
+ duration_ms?: number;
1368
+ }
1369
+ /**
1370
+ * GraphEdgeDTO is the API representation of a graph edge
1371
+ */
1372
+ export interface GraphEdgeDTO extends BaseModel {
1373
+ type: GraphEdgeType;
1374
+ from_node: string;
1375
+ to_node: string;
1376
+ }
1377
+ /**
1378
+ * ChatTraceDTO is the trace response for chat observability
1379
+ */
1380
+ export interface ChatTraceDTO {
1381
+ graph_id: string;
1382
+ nodes: (GraphNodeDTO | undefined)[];
1383
+ edges: (GraphEdgeDTO | undefined)[];
1384
+ /**
1385
+ * Summary stats
1386
+ */
1387
+ total_steps: number;
1388
+ completed_steps: number;
1389
+ running_steps: number;
1390
+ failed_steps: number;
1391
+ }
1400
1392
  /**
1401
1393
  * StringSlice is a custom type for storing string slices in the database
1402
1394
  */
@@ -2296,6 +2288,10 @@ export interface WidgetNode {
2296
2288
  min?: string;
2297
2289
  max?: string;
2298
2290
  clearable?: boolean;
2291
+ /**
2292
+ * Action handler for buttons (form data is collected locally and sent with action)
2293
+ */
2294
+ onClickAction?: WidgetAction;
2299
2295
  /**
2300
2296
  * Content props (Icon, Spacer, Divider, Chart)
2301
2297
  */
package/dist/types.js CHANGED
@@ -46,26 +46,6 @@ export const IntegrationTypeSlack = "slack";
46
46
  export const IntegrationTypeDiscord = "discord";
47
47
  export const IntegrationTypeTeams = "teams";
48
48
  export const IntegrationTypeTelegram = "telegram";
49
- export const GraphNodeTypeUnknown = "unknown";
50
- export const GraphNodeTypeJoin = "join";
51
- export const GraphNodeTypeSplit = "split";
52
- export const GraphNodeTypeExecution = "execution";
53
- export const GraphNodeTypeResource = "resource";
54
- export const GraphNodeTypeApproval = "approval";
55
- export const GraphNodeTypeConditional = "conditional";
56
- export const GraphNodeTypeFlowNode = "flow_node";
57
- export const GraphNodeStatusPending = "pending";
58
- export const GraphNodeStatusReady = "ready";
59
- export const GraphNodeStatusRunning = "running";
60
- export const GraphNodeStatusCompleted = "completed";
61
- export const GraphNodeStatusFailed = "failed";
62
- export const GraphNodeStatusCancelled = "cancelled";
63
- export const GraphNodeStatusSkipped = "skipped";
64
- export const GraphNodeStatusBlocked = "blocked";
65
- export const GraphEdgeTypeDependency = "dependency";
66
- export const GraphEdgeTypeFlow = "flow";
67
- export const GraphEdgeTypeConditional = "conditional";
68
- export const GraphEdgeTypeExecution = "execution";
69
49
  export const OpEqual = "eq";
70
50
  export const OpNotEqual = "neq";
71
51
  export const OpIn = "in";
@@ -105,6 +85,26 @@ export const FlowRunStatusRunning = 2; // 2
105
85
  export const FlowRunStatusCompleted = 3; // 3
106
86
  export const FlowRunStatusFailed = 4; // 4
107
87
  export const FlowRunStatusCancelled = 5; // 5
88
+ export const GraphNodeTypeUnknown = "unknown";
89
+ export const GraphNodeTypeJoin = "join";
90
+ export const GraphNodeTypeSplit = "split";
91
+ export const GraphNodeTypeExecution = "execution";
92
+ export const GraphNodeTypeResource = "resource";
93
+ export const GraphNodeTypeApproval = "approval";
94
+ export const GraphNodeTypeConditional = "conditional";
95
+ export const GraphNodeTypeFlowNode = "flow_node"; // Flow execution node
96
+ export const GraphNodeStatusPending = "pending";
97
+ export const GraphNodeStatusReady = "ready"; // Dependencies satisfied
98
+ export const GraphNodeStatusRunning = "running";
99
+ export const GraphNodeStatusCompleted = "completed";
100
+ export const GraphNodeStatusFailed = "failed";
101
+ export const GraphNodeStatusCancelled = "cancelled";
102
+ export const GraphNodeStatusSkipped = "skipped"; // Conditional branch not taken
103
+ export const GraphNodeStatusBlocked = "blocked"; // Dependency failed
104
+ export const GraphEdgeTypeDependency = "dependency"; // Blocking dependency
105
+ export const GraphEdgeTypeFlow = "flow"; // Non-blocking flow
106
+ export const GraphEdgeTypeConditional = "conditional"; // Conditional flow
107
+ export const GraphEdgeTypeExecution = "execution"; // Node → Resource execution link
108
108
  export const ProjectTypeAgent = "agent";
109
109
  export const ProjectTypeApp = "app";
110
110
  export const ProjectTypeFlow = "flow";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.4.24",
3
+ "version": "0.4.25",
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",