@inferencesh/sdk 0.5.19 → 0.6.1
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/api/agents.d.ts +3 -0
- package/dist/api/agents.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tool-builder.d.ts +10 -0
- package/dist/tool-builder.js +22 -1
- package/dist/types.d.ts +45 -2
- package/dist/types.js +1 -0
- package/package.json +1 -1
package/dist/api/agents.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface InternalToolDefinition {
|
|
|
13
13
|
export interface AgentOptions {
|
|
14
14
|
/** Optional name for the adhoc agent (used for deduplication and display) */
|
|
15
15
|
name?: string;
|
|
16
|
+
/** Per-chat context variables — resolved in call tool URL templates ({{context.X}}) */
|
|
17
|
+
context?: Record<string, string>;
|
|
16
18
|
}
|
|
17
19
|
export interface SendMessageOptions {
|
|
18
20
|
/** File attachments - Blob (will be uploaded) or FileDTO (already uploaded, has uri) */
|
|
@@ -46,6 +48,7 @@ export declare class Agent {
|
|
|
46
48
|
private readonly files;
|
|
47
49
|
private readonly config;
|
|
48
50
|
private readonly agentName;
|
|
51
|
+
private readonly context;
|
|
49
52
|
private chatId;
|
|
50
53
|
private stream;
|
|
51
54
|
private poller;
|
package/dist/api/agents.js
CHANGED
|
@@ -17,6 +17,7 @@ export class Agent {
|
|
|
17
17
|
this.files = files;
|
|
18
18
|
this.config = config;
|
|
19
19
|
this.agentName = options?.name;
|
|
20
|
+
this.context = options?.context;
|
|
20
21
|
}
|
|
21
22
|
/** Get current chat ID */
|
|
22
23
|
get currentChatId() {
|
|
@@ -53,12 +54,14 @@ export class Agent {
|
|
|
53
54
|
? {
|
|
54
55
|
chat_id: this.chatId,
|
|
55
56
|
agent: this.config,
|
|
57
|
+
context: this.context,
|
|
56
58
|
input: { text, images: imageUris, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
|
|
57
59
|
}
|
|
58
60
|
: {
|
|
59
61
|
chat_id: this.chatId,
|
|
60
62
|
agent_config: this.config,
|
|
61
63
|
agent_name: this.agentName ?? this.config.name,
|
|
64
|
+
context: this.context,
|
|
62
65
|
input: { text, images: imageUris, files: fileUris, role: 'user', context: [], system_prompt: '', context_size: 0 },
|
|
63
66
|
};
|
|
64
67
|
const useStream = options.stream ?? this.http.getStreamDefault();
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { ChatsAPI } from './api/chats';
|
|
|
12
12
|
export { FlowsAPI } from './api/flows';
|
|
13
13
|
export { FlowRunsAPI } from './api/flow-runs';
|
|
14
14
|
export { EnginesAPI } from './api/engines';
|
|
15
|
-
export { tool, appTool, agentTool, webhookTool, httpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
15
|
+
export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
16
16
|
export type { ClientTool, ClientToolHandler } from './tool-builder';
|
|
17
17
|
export { parseStatus, isTerminalStatus } from './utils';
|
|
18
18
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { FlowsAPI } from './api/flows';
|
|
|
17
17
|
export { FlowRunsAPI } from './api/flow-runs';
|
|
18
18
|
export { EnginesAPI } from './api/engines';
|
|
19
19
|
// Tool Builder (fluent API)
|
|
20
|
-
export { tool, appTool, agentTool, webhookTool, httpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
20
|
+
export { tool, appTool, agentTool, webhookTool, httpTool, callTool, mcpTool, internalTools, string, number, integer, boolean, enumOf, object, array, optional, } from './tool-builder';
|
|
21
21
|
// Status utilities (handle both int and string status values)
|
|
22
22
|
export { parseStatus, isTerminalStatus } from './utils';
|
|
23
23
|
// Types - includes TaskStatus constants and all DTOs
|
package/dist/tool-builder.d.ts
CHANGED
|
@@ -106,6 +106,16 @@ export declare const agentTool: (name: string, agentRef: string) => AgentToolBui
|
|
|
106
106
|
export declare const webhookTool: (name: string, url: string) => WebhookToolBuilder;
|
|
107
107
|
/** Create an HTTP tool with credential injection (replaces webhookTool for new code) */
|
|
108
108
|
export declare const httpTool: (name: string, url: string) => HTTPToolBuilder;
|
|
109
|
+
/** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
|
|
110
|
+
export declare const callTool: (name: string, url: string) => HTTPToolBuilder;
|
|
111
|
+
/** Create an MCP connector tool (calls a tool on a connected MCP server) */
|
|
112
|
+
export declare const mcpTool: (name: string, integrationId: string, toolName: string) => MCPToolBuilder;
|
|
113
|
+
declare class MCPToolBuilder extends ToolBuilder {
|
|
114
|
+
private integrationId;
|
|
115
|
+
private toolName;
|
|
116
|
+
constructor(name: string, integrationId: string, toolName: string);
|
|
117
|
+
build(): AgentTool;
|
|
118
|
+
}
|
|
109
119
|
declare class InternalToolsBuilder {
|
|
110
120
|
private config;
|
|
111
121
|
/** Enable plan tools (Create, Update, Load) */
|
package/dist/tool-builder.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool Builder - Fluent API for defining agent tools
|
|
3
3
|
*/
|
|
4
|
-
import { ToolTypeClient, ToolTypeApp, ToolTypeAgent, ToolTypeHook, ToolTypeHTTP } from './types';
|
|
4
|
+
import { ToolTypeClient, ToolTypeApp, ToolTypeAgent, ToolTypeHook, ToolTypeHTTP, ToolTypeMCP } from './types';
|
|
5
5
|
// =============================================================================
|
|
6
6
|
// Schema Builders
|
|
7
7
|
// =============================================================================
|
|
@@ -229,6 +229,27 @@ export const agentTool = (name, agentRef) => new AgentToolBuilder(name, agentRef
|
|
|
229
229
|
export const webhookTool = (name, url) => new WebhookToolBuilder(name, url);
|
|
230
230
|
/** Create an HTTP tool with credential injection (replaces webhookTool for new code) */
|
|
231
231
|
export const httpTool = (name, url) => new HTTPToolBuilder(name, url);
|
|
232
|
+
/** Create a call tool — makes authenticated HTTP requests. Preferred name for httpTool. */
|
|
233
|
+
export const callTool = (name, url) => new HTTPToolBuilder(name, url);
|
|
234
|
+
/** Create an MCP connector tool (calls a tool on a connected MCP server) */
|
|
235
|
+
export const mcpTool = (name, integrationId, toolName) => new MCPToolBuilder(name, integrationId, toolName);
|
|
236
|
+
class MCPToolBuilder extends ToolBuilder {
|
|
237
|
+
constructor(name, integrationId, toolName) {
|
|
238
|
+
super(name);
|
|
239
|
+
this.integrationId = integrationId;
|
|
240
|
+
this.toolName = toolName;
|
|
241
|
+
}
|
|
242
|
+
build() {
|
|
243
|
+
return {
|
|
244
|
+
name: this.name,
|
|
245
|
+
display_name: this.displayNameValue || this.name,
|
|
246
|
+
description: this.desc,
|
|
247
|
+
type: ToolTypeMCP,
|
|
248
|
+
require_approval: this.approval || undefined,
|
|
249
|
+
mcp: { integration_id: this.integrationId, tool_name: this.toolName },
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
232
253
|
// =============================================================================
|
|
233
254
|
// Internal Tools Builder
|
|
234
255
|
// =============================================================================
|
package/dist/types.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const ToolTypeApp: ToolType;
|
|
|
17
17
|
export declare const ToolTypeAgent: ToolType;
|
|
18
18
|
export declare const ToolTypeHook: ToolType;
|
|
19
19
|
export declare const ToolTypeHTTP: ToolType;
|
|
20
|
+
export declare const ToolTypeCall: ToolType;
|
|
20
21
|
export declare const ToolTypeMCP: ToolType;
|
|
21
22
|
export declare const ToolTypeClient: ToolType;
|
|
22
23
|
export declare const ToolTypeInternal: ToolType;
|
|
@@ -113,6 +114,11 @@ export interface ToolAuthConfig {
|
|
|
113
114
|
*/
|
|
114
115
|
header?: string;
|
|
115
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* CallToolConfig is the preferred name for HTTPToolConfig.
|
|
119
|
+
* "call" is the user-facing type; "http" is kept for backward compatibility.
|
|
120
|
+
*/
|
|
121
|
+
export type CallToolConfig = HTTPToolConfig;
|
|
116
122
|
/**
|
|
117
123
|
* HTTPToolConfig contains configuration for an authenticated HTTP tool
|
|
118
124
|
*/
|
|
@@ -158,6 +164,7 @@ export interface AgentTool {
|
|
|
158
164
|
agent?: AgentToolConfig;
|
|
159
165
|
hook?: HookToolConfig;
|
|
160
166
|
http?: HTTPToolConfig;
|
|
167
|
+
call?: CallToolConfig;
|
|
161
168
|
mcp?: MCPToolConfig;
|
|
162
169
|
client?: ClientToolConfig;
|
|
163
170
|
internal?: InternalToolConfig;
|
|
@@ -185,6 +192,7 @@ export interface AgentToolDTO {
|
|
|
185
192
|
agent?: AgentToolConfigDTO;
|
|
186
193
|
hook?: HookToolConfigDTO;
|
|
187
194
|
http?: HTTPToolConfigDTO;
|
|
195
|
+
call?: HTTPToolConfigDTO;
|
|
188
196
|
mcp?: MCPToolConfigDTO;
|
|
189
197
|
client?: ClientToolConfigDTO;
|
|
190
198
|
}
|
|
@@ -302,6 +310,17 @@ export interface SkillConfig {
|
|
|
302
310
|
version_id?: string;
|
|
303
311
|
url?: string;
|
|
304
312
|
content?: string;
|
|
313
|
+
preload?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* ContextField declares a context parameter expected by the agent.
|
|
317
|
+
* Context is caller-provided at chat creation, stored on Chat, and available in tool URL templates.
|
|
318
|
+
*/
|
|
319
|
+
export interface ContextField {
|
|
320
|
+
name: string;
|
|
321
|
+
description?: string;
|
|
322
|
+
required?: boolean;
|
|
323
|
+
default?: string;
|
|
305
324
|
}
|
|
306
325
|
/**
|
|
307
326
|
* AgentConfig contains the shared configuration fields for agent execution.
|
|
@@ -329,6 +348,10 @@ export interface AgentConfig {
|
|
|
329
348
|
* Skills available to this agent (loaded on-demand via skill_get tool)
|
|
330
349
|
*/
|
|
331
350
|
skills?: SkillConfig[];
|
|
351
|
+
/**
|
|
352
|
+
* Context declares expected context parameters (resolved in tool URL templates via {{context.X}})
|
|
353
|
+
*/
|
|
354
|
+
context?: ContextField[];
|
|
332
355
|
/**
|
|
333
356
|
* Internal tools configuration (plan, memory, widget, finish, skills)
|
|
334
357
|
*/
|
|
@@ -372,6 +395,10 @@ export interface AgentVersionDTO extends BaseModel, PermissionModelDTO {
|
|
|
372
395
|
* Skills available to this agent (loaded on-demand via skill_get tool)
|
|
373
396
|
*/
|
|
374
397
|
skills: SkillConfig[];
|
|
398
|
+
/**
|
|
399
|
+
* Context declarations
|
|
400
|
+
*/
|
|
401
|
+
context?: ContextField[];
|
|
375
402
|
/**
|
|
376
403
|
* Internal tools configuration (plan, memory, widget, finish, skills)
|
|
377
404
|
*/
|
|
@@ -483,6 +510,12 @@ export interface ApiAgentRunRequest {
|
|
|
483
510
|
* The message to send
|
|
484
511
|
*/
|
|
485
512
|
input: ChatTaskInput;
|
|
513
|
+
/**
|
|
514
|
+
* Context values for this chat session (used in tool URL templates)
|
|
515
|
+
*/
|
|
516
|
+
context?: {
|
|
517
|
+
[key: string]: string;
|
|
518
|
+
};
|
|
486
519
|
/**
|
|
487
520
|
* If true, returns SSE stream instead of JSON response
|
|
488
521
|
*/
|
|
@@ -515,6 +548,12 @@ export interface CreateAgentMessageRequest {
|
|
|
515
548
|
* Optional name for the adhoc agent (used for deduplication and display)
|
|
516
549
|
*/
|
|
517
550
|
agent_name?: string;
|
|
551
|
+
/**
|
|
552
|
+
* Context values for this chat session (used in tool URL templates)
|
|
553
|
+
*/
|
|
554
|
+
context?: {
|
|
555
|
+
[key: string]: string;
|
|
556
|
+
};
|
|
518
557
|
}
|
|
519
558
|
export interface CreateAgentMessageResponse {
|
|
520
559
|
user_message?: ChatMessageDTO;
|
|
@@ -966,7 +1005,7 @@ export interface App extends BaseModel, PermissionModel {
|
|
|
966
1005
|
}
|
|
967
1006
|
/**
|
|
968
1007
|
* AppPricing configures all pricing using CEL expressions
|
|
969
|
-
* Empty expressions use defaults. All values in
|
|
1008
|
+
* Empty expressions use defaults. All values in microcents (1 cent = 1,000,000; 1 dollar = 100,000,000)
|
|
970
1009
|
*/
|
|
971
1010
|
export interface AppPricing {
|
|
972
1011
|
prices: {
|
|
@@ -980,7 +1019,7 @@ export interface AppPricing {
|
|
|
980
1019
|
*/
|
|
981
1020
|
resource_expression: string;
|
|
982
1021
|
/**
|
|
983
|
-
* CEL expressions for each fee type (result in
|
|
1022
|
+
* CEL expressions for each fee type (result in microcents)
|
|
984
1023
|
* Available variables: inputs, outputs, prices, resource_fee, usage_seconds
|
|
985
1024
|
*/
|
|
986
1025
|
inference_expression: string;
|
|
@@ -1337,6 +1376,9 @@ export interface ChatDTO extends BaseModel, PermissionModelDTO {
|
|
|
1337
1376
|
children: (ChatDTO | undefined)[];
|
|
1338
1377
|
status: ChatStatus;
|
|
1339
1378
|
output?: any;
|
|
1379
|
+
context?: {
|
|
1380
|
+
[key: string]: string;
|
|
1381
|
+
};
|
|
1340
1382
|
/**
|
|
1341
1383
|
* Agent version reference
|
|
1342
1384
|
*/
|
|
@@ -1854,6 +1896,7 @@ export interface IntegrationDTO extends BaseModel, PermissionModelDTO {
|
|
|
1854
1896
|
auth: string;
|
|
1855
1897
|
status: string;
|
|
1856
1898
|
display_name: string;
|
|
1899
|
+
icon_url?: string;
|
|
1857
1900
|
scopes: StringSlice;
|
|
1858
1901
|
expires_at?: string;
|
|
1859
1902
|
service_account_email?: string;
|
package/dist/types.js
CHANGED
|
@@ -3,6 +3,7 @@ export const ToolTypeApp = "app"; // App tools - creates a Task
|
|
|
3
3
|
export const ToolTypeAgent = "agent"; // Sub-agent tools - creates a sub-Chat
|
|
4
4
|
export const ToolTypeHook = "hook"; // Webhook tools - HTTP POST to external URL (legacy)
|
|
5
5
|
export const ToolTypeHTTP = "http"; // HTTP tools - authenticated HTTP request/response
|
|
6
|
+
export const ToolTypeCall = "call"; // Call tools - authenticated HTTP request/response (preferred over "http")
|
|
6
7
|
export const ToolTypeMCP = "mcp"; // MCP tools - calls remote MCP server
|
|
7
8
|
export const ToolTypeClient = "client"; // Client tools - executed by frontend
|
|
8
9
|
export const ToolTypeInternal = "internal"; // Internal/built-in tools (plan, memory, widget, finish)
|