@inferencesh/sdk 0.5.19 → 0.6.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/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 +2 -0
- 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;
|
|
@@ -1854,6 +1855,7 @@ export interface IntegrationDTO extends BaseModel, PermissionModelDTO {
|
|
|
1854
1855
|
auth: string;
|
|
1855
1856
|
status: string;
|
|
1856
1857
|
display_name: string;
|
|
1858
|
+
icon_url?: string;
|
|
1857
1859
|
scopes: StringSlice;
|
|
1858
1860
|
expires_at?: string;
|
|
1859
1861
|
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 - alias for HTTP (preferred name)
|
|
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)
|