@inferencesh/sdk 0.2.0 → 0.4.0

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/README.md CHANGED
@@ -218,7 +218,7 @@ await agent.sendMessage('What is the weather in Paris?', {
218
218
  | `sendMessage(text, options?)` | Send a message to the agent |
219
219
  | `getChat(chatId?)` | Get chat history |
220
220
  | `stopChat(chatId?)` | Stop current generation |
221
- | `submitToolResult(toolId, result)` | Submit result for a client tool |
221
+ | `submitToolResult(toolId, resultOrAction)` | Submit result for a client tool (string or {action, form_data}) |
222
222
  | `streamMessages(chatId?, options?)` | Stream message updates |
223
223
  | `streamChat(chatId?, options?)` | Stream chat updates |
224
224
  | `disconnect()` | Clean up streams |
package/dist/agent.d.ts CHANGED
@@ -3,26 +3,19 @@
3
3
  *
4
4
  * Chat with AI agents without UI dependencies.
5
5
  */
6
- import { ChatDTO, ChatMessageDTO, AgentTool, InternalToolsConfig } from './types';
6
+ import { ChatDTO, ChatMessageDTO, AgentRuntimeConfig } from './types';
7
7
  export interface AgentConfig {
8
8
  apiKey: string;
9
9
  baseUrl?: string;
10
10
  }
11
- /** Ad-hoc agent configuration (no saved template) */
12
- export interface AdHocAgentOptions {
13
- /** Core LLM app: namespace/name@shortid */
14
- coreApp: string;
15
- /** LLM parameters */
16
- coreAppInput?: Record<string, unknown>;
17
- /** Agent name */
18
- name?: string;
19
- /** System prompt */
20
- systemPrompt?: string;
21
- /** Tools */
22
- tools?: AgentTool[];
23
- /** Internal tools config */
24
- internalTools?: InternalToolsConfig;
25
- }
11
+ /**
12
+ * Ad-hoc agent configuration - extends AgentRuntimeConfig with core_app_ref required
13
+ * Uses Partial to make name/system_prompt optional for ad-hoc usage
14
+ */
15
+ export type AdHocAgentOptions = Partial<AgentRuntimeConfig> & {
16
+ /** Core LLM app ref: namespace/name@shortid (required for ad-hoc agents) */
17
+ core_app_ref: string;
18
+ };
26
19
  /** Template agent configuration */
27
20
  export interface TemplateAgentOptions {
28
21
  /** Agent reference: namespace/name@version (e.g., "my-org/assistant@abc123") */
@@ -58,8 +51,18 @@ export declare class Agent {
58
51
  getChat(chatId?: string): Promise<ChatDTO | null>;
59
52
  /** Stop the current chat generation */
60
53
  stopChat(): Promise<void>;
61
- /** Submit a tool result */
62
- submitToolResult(toolInvocationId: string, result: string): Promise<void>;
54
+ /**
55
+ * Submit a tool result
56
+ * @param toolInvocationId - The tool invocation ID
57
+ * @param resultOrAction - Either a raw result string, or an object with action and optional form_data (will be JSON-serialized)
58
+ */
59
+ submitToolResult(toolInvocationId: string, resultOrAction: string | {
60
+ action: {
61
+ type: string;
62
+ payload?: Record<string, unknown>;
63
+ };
64
+ form_data?: Record<string, unknown>;
65
+ }): Promise<void>;
63
66
  /** Stop streaming and cleanup */
64
67
  disconnect(): void;
65
68
  /** Reset the agent (start fresh chat) */
package/dist/agent.js CHANGED
@@ -27,7 +27,7 @@ class Agent {
27
27
  }
28
28
  /** Send a message to the agent */
29
29
  async sendMessage(text, options = {}) {
30
- const isAdHoc = 'coreApp' in this.options;
30
+ const isAdHoc = 'core_app_ref' in this.options;
31
31
  // Upload files if provided
32
32
  let imageUri;
33
33
  let fileUris;
@@ -42,22 +42,10 @@ class Agent {
42
42
  fileUris = others.map(f => f.uri);
43
43
  }
44
44
  // Both template and ad-hoc use /agents/run
45
+ const input = { text, image: imageUri, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 };
45
46
  const body = isAdHoc
46
- ? {
47
- chat_id: this.chatId,
48
- core_app: this.options.coreApp,
49
- core_app_input: this.options.coreAppInput,
50
- name: this.options.name,
51
- system_prompt: this.options.systemPrompt,
52
- tools: this.options.tools,
53
- internal_tools: this.options.internalTools,
54
- input: { text, image: imageUri, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
55
- }
56
- : {
57
- chat_id: this.chatId,
58
- agent: this.options.agent,
59
- input: { text, image: imageUri, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
60
- };
47
+ ? { chat_id: this.chatId, agent_config: this.options, input }
48
+ : { chat_id: this.chatId, agent: this.options.agent, input };
61
49
  const response = await this.request('post', '/agents/run', { data: body });
62
50
  // Update chat ID if new
63
51
  if (!this.chatId && response.assistant_message.chat_id) {
@@ -79,13 +67,17 @@ class Agent {
79
67
  return;
80
68
  await this.request('post', `/chats/${this.chatId}/stop`);
81
69
  }
82
- /** Submit a tool result */
83
- async submitToolResult(toolInvocationId, result) {
84
- if (!this.chatId)
85
- throw new Error('No active chat');
86
- await this.request('post', `/chats/${this.chatId}/tool-result`, {
87
- data: { tool_invocation_id: toolInvocationId, result },
88
- });
70
+ /**
71
+ * Submit a tool result
72
+ * @param toolInvocationId - The tool invocation ID
73
+ * @param resultOrAction - Either a raw result string, or an object with action and optional form_data (will be JSON-serialized)
74
+ */
75
+ async submitToolResult(toolInvocationId, resultOrAction) {
76
+ // Serialize widget actions to JSON string
77
+ const result = typeof resultOrAction === 'string'
78
+ ? resultOrAction
79
+ : JSON.stringify(resultOrAction);
80
+ await this.request('post', `/tools/${toolInvocationId}`, { data: { result } });
89
81
  }
90
82
  /** Stop streaming and cleanup */
91
83
  disconnect() {
package/dist/client.d.ts CHANGED
@@ -1,20 +1,13 @@
1
- import { ApiAppRunRequest, TaskDTO as Task, File, ChatDTO, ChatMessageDTO, AgentTool, InternalToolsConfig } from './types';
1
+ import { ApiAppRunRequest, TaskDTO as Task, File, ChatDTO, ChatMessageDTO, AgentRuntimeConfig } from './types';
2
2
  import { EventSource } from 'eventsource';
3
- /** Ad-hoc agent configuration (no saved template) */
4
- export interface AdHocAgentConfig {
5
- /** Core LLM app: namespace/name@shortid */
6
- coreApp: string;
7
- /** LLM parameters */
8
- coreAppInput?: Record<string, unknown>;
9
- /** Agent name */
10
- name?: string;
11
- /** System prompt */
12
- systemPrompt?: string;
13
- /** Tools */
14
- tools?: AgentTool[];
15
- /** Internal tools config */
16
- internalTools?: InternalToolsConfig;
17
- }
3
+ /**
4
+ * Ad-hoc agent configuration - extends AgentRuntimeConfig with core_app_ref required
5
+ * Uses Partial to make name/system_prompt optional for ad-hoc usage
6
+ */
7
+ export type AdHocAgentConfig = Partial<AgentRuntimeConfig> & {
8
+ /** Core LLM app ref: namespace/name@shortid (required for ad-hoc agents) */
9
+ core_app_ref: string;
10
+ };
18
11
  export interface SendMessageOptions {
19
12
  /** File attachments (Blob or base64 data URI) */
20
13
  files?: (Blob | string)[];
@@ -84,10 +77,10 @@ export declare class Inference {
84
77
  * @param options - Run options for waiting, updates, and reconnection
85
78
  * @returns The completed task result
86
79
  *
87
- * App reference format: `namespace/name@shortid` (version is required)
80
+ * App reference format: `namespace/name@shortid` or `namespace/name@shortid:function`
88
81
  *
89
- * The short ID ensures your code always runs the same version,
90
- * protecting against breaking changes from app updates.
82
+ * The short ID ensures your code always runs the same version.
83
+ * You can optionally specify a function name to run a specific entry point.
91
84
  *
92
85
  * @example
93
86
  * ```typescript
@@ -131,8 +124,8 @@ export declare class Inference {
131
124
  *
132
125
  * // Ad-hoc agent
133
126
  * const agent = client.agent({
134
- * coreApp: 'infsh/claude-sonnet-4@xyz789',
135
- * systemPrompt: 'You are a helpful assistant',
127
+ * core_app_ref: 'infsh/claude-sonnet-4@xyz789',
128
+ * system_prompt: 'You are a helpful assistant',
136
129
  * tools: [...]
137
130
  * })
138
131
  *
@@ -152,6 +145,7 @@ export declare class Agent {
152
145
  private readonly config;
153
146
  private chatId;
154
147
  private stream;
148
+ private dispatchedToolCalls;
155
149
  /** @internal */
156
150
  constructor(client: Inference, config: string | AdHocAgentConfig);
157
151
  /** Get current chat ID */
@@ -162,13 +156,24 @@ export declare class Agent {
162
156
  getChat(chatId?: string): Promise<ChatDTO | null>;
163
157
  /** Stop the current chat generation */
164
158
  stopChat(): Promise<void>;
165
- /** Submit a tool result */
166
- submitToolResult(toolInvocationId: string, result: string): Promise<void>;
159
+ /**
160
+ * Submit a tool result
161
+ * @param toolInvocationId - The tool invocation ID
162
+ * @param resultOrAction - Either a raw result string, or an object with action and optional form_data (will be JSON-serialized)
163
+ */
164
+ submitToolResult(toolInvocationId: string, resultOrAction: string | {
165
+ action: {
166
+ type: string;
167
+ payload?: Record<string, unknown>;
168
+ };
169
+ form_data?: Record<string, unknown>;
170
+ }): Promise<void>;
167
171
  /** Stop streaming and cleanup */
168
172
  disconnect(): void;
169
173
  /** Reset the agent (start fresh chat) */
170
174
  reset(): void;
171
- private startStreaming;
175
+ /** Stream events until chat becomes idle */
176
+ private streamUntilIdle;
172
177
  }
173
178
  /**
174
179
  * Factory function for creating an Inference client (lowercase for branding)
package/dist/client.js CHANGED
@@ -82,7 +82,13 @@ class Inference {
82
82
  }
83
83
  const apiResponse = data;
84
84
  if (!apiResponse?.success) {
85
- throw new errors_1.InferenceError(response.status, apiResponse?.error?.message || 'Request failed', responseText);
85
+ // Build a helpful error message
86
+ let errorMessage = apiResponse?.error?.message;
87
+ if (!errorMessage) {
88
+ // No error message provided - show the response for debugging
89
+ errorMessage = `Request failed (success=false). Response: ${responseText.slice(0, 500)}`;
90
+ }
91
+ throw new errors_1.InferenceError(response.status, errorMessage, responseText);
86
92
  }
87
93
  return apiResponse.data;
88
94
  }
@@ -150,10 +156,10 @@ class Inference {
150
156
  * @param options - Run options for waiting, updates, and reconnection
151
157
  * @returns The completed task result
152
158
  *
153
- * App reference format: `namespace/name@shortid` (version is required)
159
+ * App reference format: `namespace/name@shortid` or `namespace/name@shortid:function`
154
160
  *
155
- * The short ID ensures your code always runs the same version,
156
- * protecting against breaking changes from app updates.
161
+ * The short ID ensures your code always runs the same version.
162
+ * You can optionally specify a function name to run a specific entry point.
157
163
  *
158
164
  * @example
159
165
  * ```typescript
@@ -310,8 +316,8 @@ class Inference {
310
316
  *
311
317
  * // Ad-hoc agent
312
318
  * const agent = client.agent({
313
- * coreApp: 'infsh/claude-sonnet-4@xyz789',
314
- * systemPrompt: 'You are a helpful assistant',
319
+ * core_app_ref: 'infsh/claude-sonnet-4@xyz789',
320
+ * system_prompt: 'You are a helpful assistant',
315
321
  * tools: [...]
316
322
  * })
317
323
  *
@@ -337,6 +343,7 @@ class Agent {
337
343
  constructor(client, config) {
338
344
  this.chatId = null;
339
345
  this.stream = null;
346
+ this.dispatchedToolCalls = new Set();
340
347
  this.client = client;
341
348
  this.config = config;
342
349
  }
@@ -362,23 +369,23 @@ class Agent {
362
369
  const body = isTemplate
363
370
  ? {
364
371
  chat_id: this.chatId,
365
- agent: this.config,
372
+ agent_ref: this.config,
366
373
  input: { text, image: imageUri, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
367
374
  }
368
375
  : {
369
376
  chat_id: this.chatId,
370
- core_app: this.config.coreApp,
371
- core_app_input: this.config.coreAppInput,
372
- name: this.config.name,
373
- system_prompt: this.config.systemPrompt,
374
- tools: this.config.tools,
375
- internal_tools: this.config.internalTools,
377
+ agent_config: this.config,
376
378
  input: { text, image: imageUri, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
377
379
  };
378
380
  const response = await this.client._request('post', '/agents/run', { data: body });
379
- if (!this.chatId && response.assistant_message.chat_id) {
381
+ // Start streaming for new chats or continue existing stream
382
+ const isNewChat = !this.chatId && response.assistant_message.chat_id;
383
+ if (isNewChat) {
380
384
  this.chatId = response.assistant_message.chat_id;
381
- this.startStreaming(options);
385
+ }
386
+ // Wait for streaming to complete if callbacks are provided
387
+ if (options.onMessage || options.onChat || options.onToolCall) {
388
+ await this.streamUntilIdle(options);
382
389
  }
383
390
  return response.assistant_message;
384
391
  }
@@ -395,13 +402,17 @@ class Agent {
395
402
  return;
396
403
  await this.client._request('post', `/chats/${this.chatId}/stop`);
397
404
  }
398
- /** Submit a tool result */
399
- async submitToolResult(toolInvocationId, result) {
400
- if (!this.chatId)
401
- throw new Error('No active chat');
402
- await this.client._request('post', `/chats/${this.chatId}/tool-result`, {
403
- data: { tool_invocation_id: toolInvocationId, result },
404
- });
405
+ /**
406
+ * Submit a tool result
407
+ * @param toolInvocationId - The tool invocation ID
408
+ * @param resultOrAction - Either a raw result string, or an object with action and optional form_data (will be JSON-serialized)
409
+ */
410
+ async submitToolResult(toolInvocationId, resultOrAction) {
411
+ // Serialize widget actions to JSON string
412
+ const result = typeof resultOrAction === 'string'
413
+ ? resultOrAction
414
+ : JSON.stringify(resultOrAction);
415
+ await this.client._request('post', `/tools/${toolInvocationId}`, { data: { result } });
405
416
  }
406
417
  /** Stop streaming and cleanup */
407
418
  disconnect() {
@@ -412,32 +423,46 @@ class Agent {
412
423
  reset() {
413
424
  this.disconnect();
414
425
  this.chatId = null;
426
+ this.dispatchedToolCalls.clear();
415
427
  }
416
- startStreaming(options) {
428
+ /** Stream events until chat becomes idle */
429
+ streamUntilIdle(options) {
417
430
  if (!this.chatId)
418
- return;
419
- this.stream = new stream_1.StreamManager({
420
- createEventSource: async () => this.client._createEventSource(`/chats/${this.chatId}/stream`),
421
- autoReconnect: true,
422
- });
423
- this.stream.addEventListener('chats', (chat) => {
424
- options.onChat?.(chat);
425
- });
426
- this.stream.addEventListener('chat_messages', (message) => {
427
- options.onMessage?.(message);
428
- if (message.tool_invocations && options.onToolCall) {
429
- for (const inv of message.tool_invocations) {
430
- if (inv.type === types_1.ToolTypeClient && inv.status === types_1.ToolInvocationStatusAwaitingInput) {
431
- options.onToolCall({
432
- id: inv.id,
433
- name: inv.function?.name || '',
434
- args: inv.function?.arguments || {},
435
- });
431
+ return Promise.resolve();
432
+ return new Promise((resolve) => {
433
+ // Stop any existing stream
434
+ this.stream?.stop();
435
+ this.stream = new stream_1.StreamManager({
436
+ createEventSource: async () => this.client._createEventSource(`/chats/${this.chatId}/stream`),
437
+ autoReconnect: true,
438
+ });
439
+ this.stream.addEventListener('chats', (chat) => {
440
+ options.onChat?.(chat);
441
+ // Resolve when chat becomes idle (generation complete)
442
+ if (chat.status === 'idle') {
443
+ resolve();
444
+ }
445
+ });
446
+ this.stream.addEventListener('chat_messages', (message) => {
447
+ options.onMessage?.(message);
448
+ if (message.tool_invocations && options.onToolCall) {
449
+ for (const inv of message.tool_invocations) {
450
+ // Skip if already dispatched
451
+ if (this.dispatchedToolCalls.has(inv.id))
452
+ continue;
453
+ if (inv.type === types_1.ToolTypeClient && inv.status === types_1.ToolInvocationStatusAwaitingInput) {
454
+ this.dispatchedToolCalls.add(inv.id);
455
+ options.onToolCall({
456
+ id: inv.id,
457
+ name: inv.function?.name || '',
458
+ args: inv.function?.arguments || {},
459
+ });
460
+ }
436
461
  }
437
462
  }
438
- }
463
+ });
464
+ this.stream.connect();
439
465
  });
440
- this.stream.connect();
441
466
  }
442
467
  }
443
468
  exports.Agent = Agent;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Integration tests for @inferencesh/sdk
3
+ *
4
+ * These tests hit the real API and require INFERENCE_API_KEY to be set.
5
+ * Run with: npm run test:integration
6
+ *
7
+ * @jest-environment node
8
+ */
9
+ export {};
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /**
3
+ * Integration tests for @inferencesh/sdk
4
+ *
5
+ * These tests hit the real API and require INFERENCE_API_KEY to be set.
6
+ * Run with: npm run test:integration
7
+ *
8
+ * @jest-environment node
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ const client_1 = require("./client");
12
+ const types_1 = require("./types");
13
+ // Skip all tests if no API key is set
14
+ const API_KEY = process.env.INFERENCE_API_KEY;
15
+ const BASE_URL = process.env.INFERENCE_BASE_URL || 'https://api.inference.sh';
16
+ // Use a pinned app version that's known to work
17
+ const TEST_APP = 'infsh/text-templating@53bk0yzk';
18
+ const describeIfApiKey = API_KEY ? describe : describe.skip;
19
+ describeIfApiKey('Integration Tests', () => {
20
+ let client;
21
+ beforeAll(() => {
22
+ client = new client_1.Inference({
23
+ apiKey: API_KEY,
24
+ baseUrl: BASE_URL,
25
+ });
26
+ });
27
+ describe('Basic Run', () => {
28
+ it('should run a simple task and wait for completion', async () => {
29
+ const result = await client.run({
30
+ app: TEST_APP,
31
+ input: { template: 'Hello {1}!', strings: ['Jest'] },
32
+ });
33
+ expect(result).toBeDefined();
34
+ expect(result.id).toBeDefined();
35
+ expect(result.status).toBe(types_1.TaskStatusCompleted);
36
+ expect(result.output).toBeDefined();
37
+ }, 60000); // 60 second timeout for API call
38
+ });
39
+ describe('Run with Updates', () => {
40
+ it('should receive status updates during task execution', async () => {
41
+ const updates = [];
42
+ const result = await client.run({
43
+ app: TEST_APP,
44
+ input: { template: 'Testing {1}', strings: ['SDK'] },
45
+ }, {
46
+ onUpdate: (update) => {
47
+ updates.push(update.status);
48
+ },
49
+ });
50
+ expect(result.status).toBe(types_1.TaskStatusCompleted);
51
+ expect(updates.length).toBeGreaterThan(0);
52
+ }, 60000);
53
+ });
54
+ describe('Fire and Forget', () => {
55
+ it('should submit a task without waiting for completion', async () => {
56
+ const result = await client.run({
57
+ app: TEST_APP,
58
+ input: { template: '{1}', strings: ['Fire and forget'] },
59
+ }, { wait: false });
60
+ expect(result).toBeDefined();
61
+ expect(result.id).toBeDefined();
62
+ // Status should NOT be completed yet (task was just submitted)
63
+ expect(result.status).not.toBe(types_1.TaskStatusCompleted);
64
+ expect(result.status).not.toBe(types_1.TaskStatusFailed);
65
+ }, 30000);
66
+ });
67
+ describe('Factory Function', () => {
68
+ it('should work with lowercase inference() factory', async () => {
69
+ const factoryClient = (0, client_1.inference)({
70
+ apiKey: API_KEY,
71
+ baseUrl: BASE_URL,
72
+ });
73
+ const result = await factoryClient.run({
74
+ app: TEST_APP,
75
+ input: { template: '{1}', strings: ['Factory test'] },
76
+ }, { wait: false });
77
+ expect(result).toBeDefined();
78
+ expect(result.id).toBeDefined();
79
+ }, 30000);
80
+ });
81
+ describe('Error Handling', () => {
82
+ it('should throw an error for non-existent app', async () => {
83
+ await expect(client.run({
84
+ app: 'non-existent/app-that-does-not-exist@xyz123',
85
+ input: {},
86
+ }, { wait: false })).rejects.toThrow();
87
+ }, 30000);
88
+ });
89
+ });
90
+ // Add a simple test that always runs to ensure Jest doesn't complain about no tests
91
+ describe('Integration Test Setup', () => {
92
+ it('should have API key check', () => {
93
+ if (!API_KEY) {
94
+ console.log('⚠️ Skipping integration tests - INFERENCE_API_KEY not set');
95
+ }
96
+ expect(true).toBe(true);
97
+ });
98
+ });
@@ -95,15 +95,13 @@ class AppToolBuilder extends ToolBuilder {
95
95
  this.appRef = appRef;
96
96
  }
97
97
  build() {
98
- const [ns, rest] = this.appRef.split('/');
99
- const [appName, version] = rest?.split('@') || [];
100
98
  return {
101
99
  name: this.name,
102
100
  display_name: this.displayName || this.name,
103
101
  description: this.desc,
104
102
  type: types_1.ToolTypeApp,
105
103
  require_approval: this.approval || undefined,
106
- app: { id: `${ns}/${appName}`, version_id: version },
104
+ app: { ref: this.appRef },
107
105
  };
108
106
  }
109
107
  }
@@ -113,15 +111,13 @@ class AgentToolBuilder extends ToolBuilder {
113
111
  this.agentRef = agentRef;
114
112
  }
115
113
  build() {
116
- const [ns, rest] = this.agentRef.split('/');
117
- const [agentName, version] = rest?.split('@') || [];
118
114
  return {
119
115
  name: this.name,
120
116
  display_name: this.displayName || this.name,
121
117
  description: this.desc,
122
118
  type: types_1.ToolTypeAgent,
123
119
  require_approval: this.approval || undefined,
124
- agent: { id: `${ns}/${agentName}`, version_id: version },
120
+ agent: { ref: this.agentRef },
125
121
  };
126
122
  }
127
123
  }
@@ -169,12 +169,12 @@ describe('AppToolBuilder (appTool)', () => {
169
169
  .describe('Generate image')
170
170
  .build();
171
171
  expect(t.type).toBe(types_1.ToolTypeApp);
172
- expect(t.app).toEqual({ id: 'infsh/flux', version_id: 'v1.0' });
172
+ expect(t.app).toEqual({ ref: 'infsh/flux@v1.0' });
173
173
  expect(t.description).toBe('Generate image');
174
174
  });
175
175
  it('handles app reference with latest version', () => {
176
176
  const t = (0, tool_builder_1.appTool)('browse', 'my-org/browser@latest').build();
177
- expect(t.app).toEqual({ id: 'my-org/browser', version_id: 'latest' });
177
+ expect(t.app).toEqual({ ref: 'my-org/browser@latest' });
178
178
  });
179
179
  it('includes parameters', () => {
180
180
  const t = (0, tool_builder_1.appTool)('fetch', 'infsh/fetch@v1')
@@ -190,7 +190,7 @@ describe('AgentToolBuilder (agentTool)', () => {
190
190
  .describe('Research a topic')
191
191
  .build();
192
192
  expect(t.type).toBe(types_1.ToolTypeAgent);
193
- expect(t.agent).toEqual({ id: 'acme/researcher', version_id: 'v2' });
193
+ expect(t.agent).toEqual({ ref: 'acme/researcher@v2' });
194
194
  });
195
195
  it('supports display name and approval', () => {
196
196
  const t = (0, tool_builder_1.agentTool)('coder', 'infsh/code-agent@latest')
package/dist/types.d.ts CHANGED
@@ -20,10 +20,18 @@ export declare const ToolTypeInternal: ToolType;
20
20
  * AppToolConfig contains configuration for an app tool
21
21
  */
22
22
  export interface AppToolConfig {
23
- id: string;
23
+ /**
24
+ * Ref is the human-readable reference: "namespace/name@shortVersionId"
25
+ * This is what users specify in configs/SDKs
26
+ */
27
+ ref: string;
28
+ /**
29
+ * ID and VersionID are resolved full database UUIDs (populated at runtime)
30
+ */
31
+ id?: string;
24
32
  version_id?: string;
25
33
  /**
26
- * Resolved at runtime, not stored
34
+ * Resolved app object (populated at runtime)
27
35
  */
28
36
  app?: App;
29
37
  }
@@ -31,10 +39,18 @@ export interface AppToolConfig {
31
39
  * AgentToolConfig contains configuration for a sub-agent tool
32
40
  */
33
41
  export interface AgentToolConfig {
34
- id: string;
42
+ /**
43
+ * Ref is the human-readable reference: "namespace/name@shortVersionId"
44
+ * This is what users specify in configs/SDKs
45
+ */
46
+ ref: string;
47
+ /**
48
+ * ID and VersionID are resolved full database UUIDs (populated at runtime)
49
+ */
50
+ id?: string;
35
51
  version_id?: string;
36
52
  /**
37
- * Resolved at runtime, not stored
53
+ * Resolved agent object (populated at runtime)
38
54
  */
39
55
  agent?: Agent;
40
56
  }
@@ -73,6 +89,14 @@ export interface AgentTool {
73
89
  agent?: AgentToolConfig;
74
90
  hook?: HookToolConfig;
75
91
  client?: ClientToolConfig;
92
+ internal?: InternalToolConfig;
93
+ }
94
+ /**
95
+ * InternalToolConfig contains configuration for internal/built-in tools
96
+ */
97
+ export interface InternalToolConfig {
98
+ category: string;
99
+ operation: string;
76
100
  }
77
101
  /**
78
102
  * AgentToolDTO for API responses
@@ -92,12 +116,14 @@ export interface AgentToolDTO {
92
116
  client?: ClientToolConfigDTO;
93
117
  }
94
118
  export interface AppToolConfigDTO {
95
- id: string;
119
+ ref: string;
120
+ id?: string;
96
121
  version_id?: string;
97
122
  app?: AppDTO;
98
123
  }
99
124
  export interface AgentToolConfigDTO {
100
- id: string;
125
+ ref: string;
126
+ id?: string;
101
127
  version_id?: string;
102
128
  agent?: AgentDTO;
103
129
  }
@@ -210,7 +236,10 @@ export interface AgentRuntimeConfig {
210
236
  example_prompts?: string[];
211
237
  /**
212
238
  * Core LLM
239
+ * CoreAppRef is the user-facing ref (namespace/name@shortid) - used in ad-hoc configs
240
+ * CoreApp is the resolved config - populated by backend after resolving CoreAppRef
213
241
  */
242
+ core_app_ref?: string;
214
243
  core_app?: CoreAppConfig;
215
244
  core_app_input?: any;
216
245
  /**
@@ -237,6 +266,7 @@ export interface AgentRuntimeConfigDTO {
237
266
  description?: string;
238
267
  system_prompt: string;
239
268
  example_prompts?: string[];
269
+ core_app_ref?: string;
240
270
  core_app?: CoreAppConfigDTO;
241
271
  core_app_input?: any;
242
272
  tools?: (AgentToolDTO | undefined)[];
@@ -282,10 +312,6 @@ export interface ApiAppRunRequest {
282
312
  */
283
313
  stream?: boolean;
284
314
  }
285
- /**
286
- * ApiTaskRequest is an alias for ApiAppRunRequest (deprecated name)
287
- */
288
- export type ApiTaskRequest = ApiAppRunRequest;
289
315
  /**
290
316
  * ApiAgentRunRequest is the request body for /agents/run endpoint.
291
317
  * Supports both template agents and ad-hoc agents.
@@ -298,31 +324,15 @@ export interface ApiAgentRunRequest {
298
324
  /**
299
325
  * Template agent reference in format: namespace/name@shortid
300
326
  * Example: "my-org/assistant@abc123"
301
- * Use this OR core_app, not both
327
+ * Use this OR AgentConfig, not both
302
328
  */
303
329
  agent?: string;
304
330
  /**
305
- * Core LLM app reference for ad-hoc agents in format: namespace/name@shortid
306
- * Example: "infsh/claude-sonnet-4@1195p4sq"
307
- * Use this for ad-hoc agents (without a saved template)
308
- */
309
- core_app?: string;
310
- /**
311
- * LLM parameters for ad-hoc agents (temperature, top_p, context_size, etc.)
312
- */
313
- core_app_input?: any;
314
- /**
315
- * Agent configuration for ad-hoc agents
331
+ * Ad-hoc agent configuration
332
+ * For ad-hoc agents, set core_app_ref to the LLM app reference
333
+ * Example: { "core_app_ref": "infsh/claude-sonnet-4@abc123", "system_prompt": "..." }
316
334
  */
317
- name?: string;
318
- description?: string;
319
- system_prompt?: string;
320
- example_prompts?: string[];
321
- /**
322
- * Tools configuration for ad-hoc agents
323
- */
324
- tools?: (AgentTool | undefined)[];
325
- internal_tools?: InternalToolsConfig;
335
+ agent_config?: AgentRuntimeConfig;
326
336
  /**
327
337
  * The message to send
328
338
  */
@@ -332,10 +342,6 @@ export interface ApiAgentRunRequest {
332
342
  */
333
343
  stream?: boolean;
334
344
  }
335
- /**
336
- * ApiAgentMessageRequest is an alias for ApiAgentRunRequest (deprecated name)
337
- */
338
- export type ApiAgentMessageRequest = ApiAgentRunRequest;
339
345
  export interface CreateAgentMessageRequest {
340
346
  chat_id?: string;
341
347
  agent_id?: string;
@@ -350,21 +356,13 @@ export interface CreateAgentMessageRequest {
350
356
  */
351
357
  agent_config?: AgentRuntimeConfig;
352
358
  }
353
- export interface CreateChatMessageResponse {
359
+ export interface CreateAgentMessageResponse {
354
360
  user_message?: ChatMessageDTO;
355
361
  assistant_message?: ChatMessageDTO;
356
362
  }
357
363
  /**
358
- * WidgetActionRequest represents a user's response to a widget
359
- * Uses WidgetAction and WidgetFormData from chat.go
360
- */
361
- export interface WidgetActionRequest {
362
- action: WidgetAction;
363
- form_data?: WidgetFormData;
364
- }
365
- /**
366
- * ToolResultRequest represents a generic tool result callback
367
- * Used by hooks and other tools that expect an async callback
364
+ * ToolResultRequest represents a tool result submission
365
+ * For widget actions, clients should JSON-serialize { action, form_data } as the result string
368
366
  */
369
367
  export interface ToolResultRequest {
370
368
  result: string;
@@ -648,6 +646,16 @@ export interface AppVariant {
648
646
  };
649
647
  python: string;
650
648
  }
649
+ /**
650
+ * AppFunction represents a callable entry point within an app version.
651
+ * Each function has its own input/output schema while sharing the app's setup.
652
+ */
653
+ export interface AppFunction {
654
+ name: string;
655
+ description?: string;
656
+ input_schema: any;
657
+ output_schema: any;
658
+ }
651
659
  export interface AppVersion {
652
660
  BaseModel: BaseModel;
653
661
  /**
@@ -665,6 +673,15 @@ export interface AppVersion {
665
673
  setup_schema: any;
666
674
  input_schema: any;
667
675
  output_schema: any;
676
+ /**
677
+ * Functions contains the callable entry points for this app version.
678
+ * Each function has its own input/output schema. If nil/empty, the app uses legacy single-function mode
679
+ * with InputSchema/OutputSchema at the version level.
680
+ */
681
+ functions?: {
682
+ [key: string]: AppFunction;
683
+ };
684
+ default_function?: string;
668
685
  variants: {
669
686
  [key: string]: AppVariant;
670
687
  };
@@ -699,6 +716,10 @@ export interface AppVersionDTO extends BaseModel {
699
716
  setup_schema: any;
700
717
  input_schema: any;
701
718
  output_schema: any;
719
+ functions?: {
720
+ [key: string]: AppFunction;
721
+ };
722
+ default_function?: string;
702
723
  variants: {
703
724
  [key: string]: AppVariant;
704
725
  };
@@ -743,9 +764,7 @@ export interface PermissionModelDTO {
743
764
  export type ChatStatus = string;
744
765
  export declare const ChatStatusBusy: ChatStatus;
745
766
  export declare const ChatStatusIdle: ChatStatus;
746
- /**
747
- * ChatStatusWaitingInput ChatStatus = "waiting_input"
748
- */
767
+ export declare const ChatStatusAwaitingInput: ChatStatus;
749
768
  export declare const ChatStatusCompleted: ChatStatus;
750
769
  export interface IntegrationContext {
751
770
  integration_type?: IntegrationType;
@@ -757,6 +776,7 @@ export interface IntegrationContext {
757
776
  export interface ChatData {
758
777
  plan_steps: PlanStep[];
759
778
  memory: StringEncodedMap;
779
+ always_allowed_tools: string[];
760
780
  }
761
781
  /**
762
782
  * PlanStep represents a step in an agent's execution plan
@@ -781,6 +801,14 @@ export declare const ChatMessageRoleSystem: ChatMessageRole;
781
801
  export declare const ChatMessageRoleUser: ChatMessageRole;
782
802
  export declare const ChatMessageRoleAssistant: ChatMessageRole;
783
803
  export declare const ChatMessageRoleTool: ChatMessageRole;
804
+ /**
805
+ * ChatMessageStatus represents the lifecycle status of a chat message
806
+ */
807
+ export type ChatMessageStatus = string;
808
+ export declare const ChatMessageStatusPending: ChatMessageStatus;
809
+ export declare const ChatMessageStatusReady: ChatMessageStatus;
810
+ export declare const ChatMessageStatusFailed: ChatMessageStatus;
811
+ export declare const ChatMessageStatusCancelled: ChatMessageStatus;
784
812
  export type ChatMessageContentType = string;
785
813
  export declare const ChatMessageContentTypeText: ChatMessageContentType;
786
814
  export declare const ChatMessageContentTypeReasoning: ChatMessageContentType;
@@ -861,8 +889,8 @@ export interface ChatMessageDTO extends BaseModel, PermissionModelDTO {
861
889
  chat_id: string;
862
890
  chat?: ChatDTO;
863
891
  order: number;
892
+ status: ChatMessageStatus;
864
893
  task_id?: string;
865
- task_status?: TaskStatus;
866
894
  role: ChatMessageRole;
867
895
  content: ChatMessageContent[];
868
896
  tools?: Tool[];
@@ -992,6 +1020,7 @@ export interface FlowNodeData {
992
1020
  app?: AppDTO;
993
1021
  app_id: string;
994
1022
  app_version_id: string;
1023
+ function?: string;
995
1024
  infra: Infra;
996
1025
  workers: string[];
997
1026
  setup?: any;
@@ -1374,6 +1403,7 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
1374
1403
  app_version_id: string;
1375
1404
  app_version?: AppVersionDTO;
1376
1405
  app_variant: string;
1406
+ function: string;
1377
1407
  infra: Infra;
1378
1408
  workers: string[];
1379
1409
  flow_id?: string;
@@ -1722,6 +1752,7 @@ export interface User {
1722
1752
  default_team_id: string;
1723
1753
  role: Role;
1724
1754
  email: string;
1755
+ email_verified: boolean;
1725
1756
  name: string;
1726
1757
  full_name: string;
1727
1758
  avatar_url: string;
@@ -1845,9 +1876,3 @@ export interface Widget {
1845
1876
  children?: WidgetNode[];
1846
1877
  actions?: WidgetActionButton[];
1847
1878
  }
1848
- /**
1849
- * WidgetFormData represents the form data collected from widget inputs
1850
- */
1851
- export type WidgetFormData = {
1852
- [key: string]: any;
1853
- };
package/dist/types.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  // Code generated by tygo. DO NOT EDIT.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.EngineStatusRunning = exports.DeviceAuthStatusLoading = exports.DeviceAuthStatusInvalid = exports.DeviceAuthStatusValid = exports.DeviceAuthStatusDenied = exports.DeviceAuthStatusExpired = exports.DeviceAuthStatusApproved = exports.DeviceAuthStatusPending = exports.IntegrationTypeTelegram = exports.IntegrationTypeTeams = exports.IntegrationTypeDiscord = exports.IntegrationTypeSlack = exports.ChatMessageContentTypeTool = exports.ChatMessageContentTypeFile = exports.ChatMessageContentTypeImage = exports.ChatMessageContentTypeReasoning = exports.ChatMessageContentTypeText = exports.ChatMessageRoleTool = exports.ChatMessageRoleAssistant = exports.ChatMessageRoleUser = exports.ChatMessageRoleSystem = exports.PlanStepStatusCancelled = exports.PlanStepStatusCompleted = exports.PlanStepStatusInProgress = exports.PlanStepStatusPending = exports.ChatStatusCompleted = exports.ChatStatusIdle = exports.ChatStatusBusy = exports.VisibilityUnlisted = exports.VisibilityPublic = exports.VisibilityPrivate = exports.GPUTypeApple = exports.GPUTypeAMD = exports.GPUTypeNvidia = exports.GPUTypeIntel = exports.GPUTypeNone = exports.GPUTypeAny = exports.AppCategoryFlow = exports.AppCategoryOther = exports.AppCategory3D = exports.AppCategoryChat = exports.AppCategoryText = exports.AppCategoryAudio = exports.AppCategoryVideo = exports.AppCategoryImage = exports.ToolTypeInternal = exports.ToolTypeClient = exports.ToolTypeHook = exports.ToolTypeAgent = exports.ToolTypeApp = void 0;
5
- exports.TaskLogTypeServe = exports.TaskLogTypeRun = exports.TaskLogTypeBuild = exports.InfraPrivateFirst = exports.InfraCloud = exports.InfraPrivate = exports.TaskStatusCancelled = exports.TaskStatusFailed = exports.TaskStatusCompleted = exports.TaskStatusUploading = exports.TaskStatusRunning = exports.TaskStatusSettingUp = exports.TaskStatusServing = exports.TaskStatusPreparing = exports.TaskStatusScheduled = exports.TaskStatusQueued = exports.TaskStatusReceived = exports.TaskStatusUnknown = exports.InstanceStatusDeleted = exports.InstanceStatusActive = exports.InstanceStatusPending = exports.CloudShade = exports.CloudVultr = exports.CloudMassedCompute = exports.CloudDatacrunch = exports.CloudPaperspace = exports.CloudOblivus = exports.CloudJarvisLabs = exports.CloudLatitude = exports.CloudRunPod = exports.CloudTensorDock = exports.CloudLambdaLabs = exports.CloudAzure = exports.CloudAWS = exports.ContentUnrated = exports.ContentSelfHarm = exports.ContentDrugs = exports.ContentGore = exports.ContentViolenceGraphic = exports.ContentViolenceNonGraphic = exports.ContentSexualExplicit = exports.ContentSexualSuggestive = exports.ContentSafe = exports.ProjectTypeOther = exports.ProjectTypeFlow = exports.ProjectTypeApp = exports.ProjectTypeAgent = exports.EngineStatusStopped = exports.EngineStatusStopping = exports.EngineStatusPending = void 0;
6
- exports.WidgetNodeTypePlanList = exports.WidgetNodeTypeCol = exports.WidgetNodeTypeRow = exports.WidgetNodeTypeCheckbox = exports.WidgetNodeTypeSelect = exports.WidgetNodeTypeInput = exports.WidgetNodeTypeButton = exports.WidgetNodeTypeBadge = exports.WidgetNodeTypeImage = exports.WidgetNodeTypeMarkdown = exports.WidgetNodeTypeText = exports.RoleSystem = exports.RoleAdmin = exports.RoleUser = exports.RoleGuest = exports.VideoRes4K = exports.VideoRes1440P = exports.VideoRes1080P = exports.VideoRes720P = exports.VideoRes480P = exports.MetaItemTypeRaw = exports.MetaItemTypeAudio = exports.MetaItemTypeVideo = exports.MetaItemTypeImage = exports.MetaItemTypeText = exports.UsageEventResourceTierCloud = exports.UsageEventResourceTierPrivate = exports.PaymentRecordTypeAutoRecharge = exports.PaymentRecordTypeCheckout = exports.PaymentRecordStatusExpired = exports.PaymentRecordStatusFailed = exports.PaymentRecordStatusComplete = exports.PaymentRecordStatusPending = exports.TransactionTypeDebit = exports.TransactionTypeCredit = exports.ToolInvocationStatusCancelled = exports.ToolInvocationStatusFailed = exports.ToolInvocationStatusCompleted = exports.ToolInvocationStatusAwaitingApproval = exports.ToolInvocationStatusAwaitingInput = exports.ToolInvocationStatusInProgress = exports.ToolInvocationStatusPending = exports.TeamRoleMember = exports.TeamRoleAdmin = exports.TeamRoleOwner = exports.TeamTypeSystem = exports.TeamTypeTeam = exports.TeamTypePersonal = exports.TaskLogTypeTask = exports.TaskLogTypeSetup = void 0;
7
- exports.WidgetNodeTypeStatusBadge = exports.WidgetNodeTypeKeyValue = void 0;
4
+ exports.DeviceAuthStatusExpired = exports.DeviceAuthStatusApproved = exports.DeviceAuthStatusPending = exports.IntegrationTypeTelegram = exports.IntegrationTypeTeams = exports.IntegrationTypeDiscord = exports.IntegrationTypeSlack = exports.ChatMessageContentTypeTool = exports.ChatMessageContentTypeFile = exports.ChatMessageContentTypeImage = exports.ChatMessageContentTypeReasoning = exports.ChatMessageContentTypeText = exports.ChatMessageStatusCancelled = exports.ChatMessageStatusFailed = exports.ChatMessageStatusReady = exports.ChatMessageStatusPending = exports.ChatMessageRoleTool = exports.ChatMessageRoleAssistant = exports.ChatMessageRoleUser = exports.ChatMessageRoleSystem = exports.PlanStepStatusCancelled = exports.PlanStepStatusCompleted = exports.PlanStepStatusInProgress = exports.PlanStepStatusPending = exports.ChatStatusCompleted = exports.ChatStatusAwaitingInput = exports.ChatStatusIdle = exports.ChatStatusBusy = exports.VisibilityUnlisted = exports.VisibilityPublic = exports.VisibilityPrivate = exports.GPUTypeApple = exports.GPUTypeAMD = exports.GPUTypeNvidia = exports.GPUTypeIntel = exports.GPUTypeNone = exports.GPUTypeAny = exports.AppCategoryFlow = exports.AppCategoryOther = exports.AppCategory3D = exports.AppCategoryChat = exports.AppCategoryText = exports.AppCategoryAudio = exports.AppCategoryVideo = exports.AppCategoryImage = exports.ToolTypeInternal = exports.ToolTypeClient = exports.ToolTypeHook = exports.ToolTypeAgent = exports.ToolTypeApp = void 0;
5
+ exports.InfraPrivate = exports.TaskStatusCancelled = exports.TaskStatusFailed = exports.TaskStatusCompleted = exports.TaskStatusUploading = exports.TaskStatusRunning = exports.TaskStatusSettingUp = exports.TaskStatusServing = exports.TaskStatusPreparing = exports.TaskStatusScheduled = exports.TaskStatusQueued = exports.TaskStatusReceived = exports.TaskStatusUnknown = exports.InstanceStatusDeleted = exports.InstanceStatusActive = exports.InstanceStatusPending = exports.CloudShade = exports.CloudVultr = exports.CloudMassedCompute = exports.CloudDatacrunch = exports.CloudPaperspace = exports.CloudOblivus = exports.CloudJarvisLabs = exports.CloudLatitude = exports.CloudRunPod = exports.CloudTensorDock = exports.CloudLambdaLabs = exports.CloudAzure = exports.CloudAWS = exports.ContentUnrated = exports.ContentSelfHarm = exports.ContentDrugs = exports.ContentGore = exports.ContentViolenceGraphic = exports.ContentViolenceNonGraphic = exports.ContentSexualExplicit = exports.ContentSexualSuggestive = exports.ContentSafe = exports.ProjectTypeOther = exports.ProjectTypeFlow = exports.ProjectTypeApp = exports.ProjectTypeAgent = exports.EngineStatusStopped = exports.EngineStatusStopping = exports.EngineStatusPending = exports.EngineStatusRunning = exports.DeviceAuthStatusLoading = exports.DeviceAuthStatusInvalid = exports.DeviceAuthStatusValid = exports.DeviceAuthStatusDenied = void 0;
6
+ exports.WidgetNodeTypeInput = exports.WidgetNodeTypeButton = exports.WidgetNodeTypeBadge = exports.WidgetNodeTypeImage = exports.WidgetNodeTypeMarkdown = exports.WidgetNodeTypeText = exports.RoleSystem = exports.RoleAdmin = exports.RoleUser = exports.RoleGuest = exports.VideoRes4K = exports.VideoRes1440P = exports.VideoRes1080P = exports.VideoRes720P = exports.VideoRes480P = exports.MetaItemTypeRaw = exports.MetaItemTypeAudio = exports.MetaItemTypeVideo = exports.MetaItemTypeImage = exports.MetaItemTypeText = exports.UsageEventResourceTierCloud = exports.UsageEventResourceTierPrivate = exports.PaymentRecordTypeAutoRecharge = exports.PaymentRecordTypeCheckout = exports.PaymentRecordStatusExpired = exports.PaymentRecordStatusFailed = exports.PaymentRecordStatusComplete = exports.PaymentRecordStatusPending = exports.TransactionTypeDebit = exports.TransactionTypeCredit = exports.ToolInvocationStatusCancelled = exports.ToolInvocationStatusFailed = exports.ToolInvocationStatusCompleted = exports.ToolInvocationStatusAwaitingApproval = exports.ToolInvocationStatusAwaitingInput = exports.ToolInvocationStatusInProgress = exports.ToolInvocationStatusPending = exports.TeamRoleMember = exports.TeamRoleAdmin = exports.TeamRoleOwner = exports.TeamTypeSystem = exports.TeamTypeTeam = exports.TeamTypePersonal = exports.TaskLogTypeTask = exports.TaskLogTypeSetup = exports.TaskLogTypeServe = exports.TaskLogTypeRun = exports.TaskLogTypeBuild = exports.InfraPrivateFirst = exports.InfraCloud = void 0;
7
+ exports.WidgetNodeTypeStatusBadge = exports.WidgetNodeTypeKeyValue = exports.WidgetNodeTypePlanList = exports.WidgetNodeTypeCol = exports.WidgetNodeTypeRow = exports.WidgetNodeTypeCheckbox = exports.WidgetNodeTypeSelect = void 0;
8
8
  exports.ToolTypeApp = "app"; // App tools - creates a Task
9
9
  exports.ToolTypeAgent = "agent"; // Sub-agent tools - creates a sub-Chat
10
10
  exports.ToolTypeHook = "hook"; // Webhook tools - HTTP POST to external URL
@@ -29,9 +29,7 @@ exports.VisibilityPublic = "public";
29
29
  exports.VisibilityUnlisted = "unlisted";
30
30
  exports.ChatStatusBusy = "busy";
31
31
  exports.ChatStatusIdle = "idle";
32
- /**
33
- * ChatStatusWaitingInput ChatStatus = "waiting_input"
34
- */
32
+ exports.ChatStatusAwaitingInput = "awaiting_input";
35
33
  exports.ChatStatusCompleted = "completed";
36
34
  exports.PlanStepStatusPending = "pending";
37
35
  exports.PlanStepStatusInProgress = "in_progress";
@@ -41,6 +39,10 @@ exports.ChatMessageRoleSystem = "system";
41
39
  exports.ChatMessageRoleUser = "user";
42
40
  exports.ChatMessageRoleAssistant = "assistant";
43
41
  exports.ChatMessageRoleTool = "tool";
42
+ exports.ChatMessageStatusPending = "pending"; // Message is being generated
43
+ exports.ChatMessageStatusReady = "ready"; // Message complete, tools ready for execution
44
+ exports.ChatMessageStatusFailed = "failed"; // Message generation failed
45
+ exports.ChatMessageStatusCancelled = "cancelled"; // Message was cancelled
44
46
  exports.ChatMessageContentTypeText = "text";
45
47
  exports.ChatMessageContentTypeReasoning = "reasoning";
46
48
  exports.ChatMessageContentTypeImage = "image";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
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",
@@ -15,9 +15,11 @@
15
15
  "scripts": {
16
16
  "build": "tsc && npm run build:esm",
17
17
  "build:esm": "echo 'export * from \"./index.js\";' > dist/index.mjs",
18
- "test": "jest",
19
- "test:watch": "jest --watch",
20
- "test:coverage": "jest --coverage",
18
+ "test": "jest --testPathIgnorePatterns=integration",
19
+ "test:integration": "jest --testPathPattern=integration --testTimeout=120000 --runInBand",
20
+ "test:all": "jest --testTimeout=120000 --runInBand",
21
+ "test:watch": "jest --watch --testPathIgnorePatterns=integration",
22
+ "test:coverage": "jest --coverage --testPathIgnorePatterns=integration",
21
23
  "lint": "eslint src --ext .ts",
22
24
  "lint:fix": "eslint src --ext .ts --fix",
23
25
  "format": "prettier --write \"src/**/*.ts\"",