@inferencesh/sdk 0.4.15 → 0.4.19

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.
package/dist/client.d.ts CHANGED
@@ -111,11 +111,41 @@ export declare class Inference {
111
111
  run(params: ApiAppRunRequest, options?: RunOptions): Promise<Task>;
112
112
  uploadFile(data: string | Blob, options?: UploadFileOptions): Promise<File>;
113
113
  /**
114
- * Cancel a running task
115
- *
116
- * @param taskId - The ID of the task to cancel
117
- */
114
+ * Cancel a running task
115
+ *
116
+ * @param taskId - The ID of the task to cancel
117
+ */
118
118
  cancel(taskId: string): Promise<void>;
119
+ /**
120
+ * Get a task by ID
121
+ *
122
+ * @param taskId - The ID of the task to fetch
123
+ * @returns The task data
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * const task = await client.getTask('abc123');
128
+ * console.log(task.status, task.output);
129
+ * ```
130
+ */
131
+ getTask(taskId: string): Promise<Task>;
132
+ /**
133
+ * Create an EventSource for streaming task updates
134
+ *
135
+ * @param taskId - The ID of the task to stream
136
+ * @returns EventSource for SSE streaming
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const eventSource = client.streamTask('abc123');
141
+ * // Use with StreamManager for handling updates
142
+ * const manager = new StreamManager({
143
+ * createEventSource: () => client.streamTask(taskId),
144
+ * onData: (task) => console.log(task),
145
+ * });
146
+ * ```
147
+ */
148
+ streamTask(taskId: string): EventSource;
119
149
  /**
120
150
  * Create an agent for chat interactions
121
151
  *
package/dist/client.js CHANGED
@@ -342,13 +342,47 @@ class Inference {
342
342
  return file;
343
343
  }
344
344
  /**
345
- * Cancel a running task
346
- *
347
- * @param taskId - The ID of the task to cancel
348
- */
345
+ * Cancel a running task
346
+ *
347
+ * @param taskId - The ID of the task to cancel
348
+ */
349
349
  async cancel(taskId) {
350
350
  return this._request("post", `/tasks/${taskId}/cancel`);
351
351
  }
352
+ /**
353
+ * Get a task by ID
354
+ *
355
+ * @param taskId - The ID of the task to fetch
356
+ * @returns The task data
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * const task = await client.getTask('abc123');
361
+ * console.log(task.status, task.output);
362
+ * ```
363
+ */
364
+ async getTask(taskId) {
365
+ return this._request("get", `/tasks/${taskId}`);
366
+ }
367
+ /**
368
+ * Create an EventSource for streaming task updates
369
+ *
370
+ * @param taskId - The ID of the task to stream
371
+ * @returns EventSource for SSE streaming
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * const eventSource = client.streamTask('abc123');
376
+ * // Use with StreamManager for handling updates
377
+ * const manager = new StreamManager({
378
+ * createEventSource: () => client.streamTask(taskId),
379
+ * onData: (task) => console.log(task),
380
+ * });
381
+ * ```
382
+ */
383
+ streamTask(taskId) {
384
+ return this._createEventSource(`/tasks/${taskId}/stream`);
385
+ }
352
386
  /**
353
387
  * Create an agent for chat interactions
354
388
  *
@@ -38,7 +38,13 @@ declare class ClientToolBuilder extends ToolBuilder {
38
38
  }
39
39
  declare class AppToolBuilder extends ToolBuilder {
40
40
  private appRef;
41
+ private setupValues?;
42
+ private inputValues?;
41
43
  constructor(name: string, appRef: string);
44
+ /** Set one-time setup values (hidden from agent, passed on every call) */
45
+ setup(values: Record<string, unknown>): this;
46
+ /** Set default input values (agent can override these) */
47
+ input(values: Record<string, unknown>): this;
42
48
  build(): AgentTool;
43
49
  }
44
50
  declare class AgentToolBuilder extends ToolBuilder {
@@ -94,6 +94,16 @@ class AppToolBuilder extends ToolBuilder {
94
94
  super(name);
95
95
  this.appRef = appRef;
96
96
  }
97
+ /** Set one-time setup values (hidden from agent, passed on every call) */
98
+ setup(values) {
99
+ this.setupValues = values;
100
+ return this;
101
+ }
102
+ /** Set default input values (agent can override these) */
103
+ input(values) {
104
+ this.inputValues = values;
105
+ return this;
106
+ }
97
107
  build() {
98
108
  return {
99
109
  name: this.name,
@@ -101,7 +111,11 @@ class AppToolBuilder extends ToolBuilder {
101
111
  description: this.desc,
102
112
  type: types_1.ToolTypeApp,
103
113
  require_approval: this.approval || undefined,
104
- app: { ref: this.appRef },
114
+ app: {
115
+ ref: this.appRef,
116
+ setup: this.setupValues,
117
+ input: this.inputValues,
118
+ },
105
119
  };
106
120
  }
107
121
  }
package/dist/types.d.ts CHANGED
@@ -34,6 +34,11 @@ export interface AppToolConfig {
34
34
  * Resolved app object (populated at runtime)
35
35
  */
36
36
  app?: App;
37
+ /**
38
+ * Pre-configured values
39
+ */
40
+ setup?: any;
41
+ input?: any;
37
42
  }
38
43
  /**
39
44
  * AgentToolConfig contains configuration for a sub-agent tool
@@ -120,6 +125,11 @@ export interface AppToolConfigDTO {
120
125
  id?: string;
121
126
  version_id?: string;
122
127
  app?: AppDTO;
128
+ /**
129
+ * Pre-configured values
130
+ */
131
+ setup?: any;
132
+ input?: any;
123
133
  }
124
134
  export interface AgentToolConfigDTO {
125
135
  ref: string;
@@ -143,6 +153,14 @@ export interface ClientToolConfigDTO {
143
153
  export interface CoreAppConfig {
144
154
  id: string;
145
155
  version_id: string;
156
+ /**
157
+ * Setup values for the core app (one-time configuration)
158
+ */
159
+ setup?: any;
160
+ /**
161
+ * Input default values for the core app
162
+ */
163
+ input?: any;
146
164
  }
147
165
  /**
148
166
  * AgentImages contains display images for an agent (like AppImages)
@@ -196,7 +214,6 @@ export interface AgentConfig {
196
214
  */
197
215
  core_app_ref?: string;
198
216
  core_app?: CoreAppConfig;
199
- core_app_input?: any;
200
217
  /**
201
218
  * Tools (apps, agents, hooks, client tools)
202
219
  */
@@ -227,13 +244,20 @@ export interface CoreAppConfigDTO {
227
244
  id: string;
228
245
  version_id: string;
229
246
  app?: AppDTO;
247
+ /**
248
+ * Setup values for the core app (one-time configuration)
249
+ */
250
+ setup?: any;
251
+ /**
252
+ * Input default values for the core app
253
+ */
254
+ input?: any;
230
255
  }
231
256
  export interface AgentVersionDTO extends BaseModel, PermissionModelDTO {
232
257
  description: string;
233
258
  system_prompt: string;
234
259
  example_prompts: string[];
235
260
  core_app?: CoreAppConfigDTO;
236
- core_app_input?: any;
237
261
  /**
238
262
  * Unified tools array (apps, agents, hooks, client)
239
263
  */
@@ -843,7 +867,6 @@ export interface ChatTaskInput {
843
867
  role?: ChatMessageRole;
844
868
  text?: string;
845
869
  reasoning?: string;
846
- image?: string;
847
870
  images?: string[];
848
871
  files?: string[];
849
872
  tools?: Tool[];
@@ -853,9 +876,7 @@ export interface ChatTaskContextMessage {
853
876
  role: ChatMessageRole;
854
877
  text?: string;
855
878
  reasoning?: string;
856
- image?: string;
857
879
  images?: string[];
858
- file?: string;
859
880
  files?: string[];
860
881
  tools?: Tool[];
861
882
  tool_calls?: ToolCall[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.4.15",
3
+ "version": "0.4.19",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",