@inferencesh/sdk 0.5.18 → 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.
@@ -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;
@@ -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
@@ -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) */
@@ -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;
@@ -395,6 +396,9 @@ export interface APIError {
395
396
  code: string;
396
397
  message: string;
397
398
  suggestions?: string[];
399
+ meta?: {
400
+ [key: string]: any;
401
+ };
398
402
  }
399
403
  /**
400
404
  * ApiAppRunRequest is the request body for /apps/run endpoint.
@@ -813,6 +817,12 @@ export interface IntegrationConnectResponse {
813
817
  * For service accounts - instructions
814
818
  */
815
819
  instructions?: string;
820
+ /**
821
+ * RequiresConfirmation — the connect was paused, user must acknowledge and retry with a flag.
822
+ */
823
+ requires_confirmation?: boolean;
824
+ confirmation_type?: string;
825
+ message?: string;
816
826
  }
817
827
  export interface ProjectCreateRequest {
818
828
  name: string;
@@ -955,6 +965,43 @@ export interface App extends BaseModel, PermissionModel {
955
965
  version_id: string;
956
966
  version?: AppVersion;
957
967
  }
968
+ /**
969
+ * AppPricing configures all pricing using CEL expressions
970
+ * Empty expressions use defaults. All values in nanocents (1 cent = 1,000,000,000)
971
+ */
972
+ export interface AppPricing {
973
+ prices: {
974
+ [key: string]: number;
975
+ };
976
+ upstream_pricing?: string;
977
+ /**
978
+ * Resource fee expression (compute cost)
979
+ * Available variables: resources (list of {name, price_per_second}), usage_seconds, prices
980
+ * Default: sum(resources.map(r, r.price_per_second)) * usage_seconds
981
+ */
982
+ resource_expression: string;
983
+ /**
984
+ * CEL expressions for each fee type (result in nanocents)
985
+ * Available variables: inputs, outputs, prices, resource_fee, usage_seconds
986
+ */
987
+ inference_expression: string;
988
+ royalty_expression: string;
989
+ partner_expression: string;
990
+ /**
991
+ * Total expression combines all fees (can apply weights/discounts)
992
+ * Available variables: inputs, outputs, prices, resource_fee, usage_seconds, inference_fee, royalty_fee, partner_fee
993
+ * Default: resource_fee + inference_fee + royalty_fee + partner_fee
994
+ */
995
+ total_expression: string;
996
+ description: string;
997
+ /**
998
+ * DescriptionRendered is the result of evaluating Description against the
999
+ * static prices map at save time. Frontends should display this rather than
1000
+ * the raw CEL source. Empty string means the description failed to render
1001
+ * (e.g. references variables outside `prices`).
1002
+ */
1003
+ description_rendered?: string;
1004
+ }
958
1005
  export interface AppGPUResource {
959
1006
  count: number;
960
1007
  vram: number;
@@ -1104,6 +1151,23 @@ export interface AppSession extends BaseModel, PermissionModel {
1104
1151
  worker?: WorkerState;
1105
1152
  task?: Task;
1106
1153
  }
1154
+ /**
1155
+ * PublicAppStoreDTO is a lean DTO for public app store display.
1156
+ */
1157
+ export interface PublicAppStoreDTO {
1158
+ id: string;
1159
+ category: string;
1160
+ subcategory?: string;
1161
+ tags?: string[];
1162
+ namespace: string;
1163
+ name: string;
1164
+ description: string;
1165
+ images: AppImages;
1166
+ is_featured: boolean;
1167
+ rank: number;
1168
+ has_approved_version: boolean;
1169
+ page_id?: string;
1170
+ }
1107
1171
  export interface BaseModel {
1108
1172
  id: string;
1109
1173
  short_id: string;
@@ -1791,6 +1855,7 @@ export interface IntegrationDTO extends BaseModel, PermissionModelDTO {
1791
1855
  auth: string;
1792
1856
  status: string;
1793
1857
  display_name: string;
1858
+ icon_url?: string;
1794
1859
  scopes: StringSlice;
1795
1860
  expires_at?: string;
1796
1861
  service_account_email?: string;
@@ -1813,6 +1878,73 @@ export interface KnowledgeFile {
1813
1878
  content?: string;
1814
1879
  }
1815
1880
  export type SkillFile = KnowledgeFile;
1881
+ export interface PublicSkillStoreDTO {
1882
+ id: string;
1883
+ category: string;
1884
+ tags?: string[];
1885
+ namespace: string;
1886
+ name: string;
1887
+ description: string;
1888
+ is_featured: boolean;
1889
+ rank: number;
1890
+ has_approved_version: boolean;
1891
+ }
1892
+ export type PageStatus = number;
1893
+ export declare const PageStatusUnknown: PageStatus;
1894
+ export declare const PageStatusDraft: PageStatus;
1895
+ export declare const PageStatusPublished: PageStatus;
1896
+ export declare const PageStatusArchived: PageStatus;
1897
+ export interface PageMetadata {
1898
+ title: string;
1899
+ description: string;
1900
+ image: string;
1901
+ tags: string[];
1902
+ /**
1903
+ * Docs-specific fields
1904
+ */
1905
+ order?: number;
1906
+ type?: string;
1907
+ icon?: string;
1908
+ hide_from_nav?: boolean;
1909
+ }
1910
+ /**
1911
+ * PageType represents the type of page content
1912
+ */
1913
+ export type PageType = string;
1914
+ export declare const PageTypeDoc: PageType;
1915
+ export declare const PageTypeBlog: PageType;
1916
+ export declare const PageTypePage: PageType;
1917
+ export interface PageDTO extends BaseModel, PermissionModelDTO {
1918
+ is_featured: boolean;
1919
+ title: string;
1920
+ content: string;
1921
+ excerpt: string;
1922
+ status: PageStatus;
1923
+ type: PageType;
1924
+ metadata: PageMetadata;
1925
+ slug: string;
1926
+ }
1927
+ /**
1928
+ * MenuItem represents an item in a menu (can be nested)
1929
+ */
1930
+ export interface MenuItem {
1931
+ id: string;
1932
+ label: string;
1933
+ slug?: string;
1934
+ page_id?: string;
1935
+ url?: string;
1936
+ icon?: string;
1937
+ order: number;
1938
+ is_group?: boolean;
1939
+ expanded?: boolean;
1940
+ children?: MenuItem[];
1941
+ }
1942
+ export interface MenuDTO extends BaseModel, PermissionModelDTO {
1943
+ name: string;
1944
+ slug: string;
1945
+ description: string;
1946
+ items: MenuItem[];
1947
+ }
1816
1948
  /**
1817
1949
  * ProjectType represents different types of projects
1818
1950
  */
@@ -2031,12 +2163,6 @@ export interface SystemInfo {
2031
2163
  hf_cache: HFCacheInfo;
2032
2164
  gpus: GPU[];
2033
2165
  }
2034
- export interface TelemetrySystemInfo {
2035
- cpus: CPU[];
2036
- ram: RAM;
2037
- gpus: GPU[];
2038
- volumes: Volume[];
2039
- }
2040
2166
  export interface Docker {
2041
2167
  binary_path: string;
2042
2168
  installed: boolean;
@@ -2216,7 +2342,6 @@ export interface Task extends BaseModel, PermissionModel {
2216
2342
  */
2217
2343
  events: TaskEvent[];
2218
2344
  logs: TaskLog[];
2219
- telemetry: TimescaleTask[];
2220
2345
  usage_events: (UsageEvent | undefined)[];
2221
2346
  /**
2222
2347
  * Secret refs for billing (tracks ownership to determine partner fee)
@@ -2291,27 +2416,18 @@ export interface TaskDTO extends BaseModel, PermissionModelDTO {
2291
2416
  rating: ContentRating;
2292
2417
  events: TaskEvent[];
2293
2418
  logs: TaskLog[];
2294
- telemetry: TimescaleTask[];
2295
2419
  usage_events: (UsageEvent | undefined)[];
2296
2420
  session_id?: string;
2297
2421
  session_timeout?: number;
2298
2422
  }
2299
- export interface TimescaleTask {
2300
- id: string;
2301
- timestamp: string;
2302
- task_id?: string;
2303
- task_seq: number;
2304
- app_id: string;
2305
- app_version_id: string;
2306
- engine_id: string;
2307
- engine_resources: TelemetrySystemInfo;
2308
- worker_id: string;
2309
- system_info: TelemetrySystemInfo;
2310
- }
2311
2423
  export type TeamType = string;
2312
2424
  export declare const TeamTypePersonal: TeamType;
2313
2425
  export declare const TeamTypeTeam: TeamType;
2314
2426
  export declare const TeamTypeSystem: TeamType;
2427
+ export type TeamStatus = string;
2428
+ export declare const TeamStatusActive: TeamStatus;
2429
+ export declare const TeamStatusSuspended: TeamStatus;
2430
+ export declare const TeamStatusTerminated: TeamStatus;
2315
2431
  export interface Team extends BaseModel {
2316
2432
  type: TeamType;
2317
2433
  username: string;
@@ -2327,6 +2443,7 @@ export interface Team extends BaseModel {
2327
2443
  * MaxConcurrency limits total active tasks for this team (0 = use default)
2328
2444
  */
2329
2445
  max_concurrency: number;
2446
+ status: TeamStatus;
2330
2447
  }
2331
2448
  export interface TeamDTO extends BaseModel {
2332
2449
  type: TeamType;
@@ -2336,6 +2453,7 @@ export interface TeamDTO extends BaseModel {
2336
2453
  email: string;
2337
2454
  setup_completed: boolean;
2338
2455
  max_concurrency: number;
2456
+ status: TeamStatus;
2339
2457
  }
2340
2458
  export type TeamRole = string;
2341
2459
  export declare const TeamRoleOwner: TeamRole;
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)
@@ -129,6 +130,13 @@ export const GraphEdgeTypeExecution = "execution"; // Node → Resource executio
129
130
  export const GraphEdgeTypeParent = "parent"; // Parent resource → child resource (e.g. skill fork)
130
131
  export const GraphEdgeTypeAncestor = "ancestor"; // Specific version → child resource (fork point)
131
132
  export const GraphEdgeTypeDuplicate = "duplicate"; // Skill → skill with identical content hash
133
+ export const PageStatusUnknown = 0; // 0
134
+ export const PageStatusDraft = 1; // 1
135
+ export const PageStatusPublished = 2; // 2
136
+ export const PageStatusArchived = 3; // 3
137
+ export const PageTypeDoc = "doc"; // Documentation page
138
+ export const PageTypeBlog = "blog"; // Blog post
139
+ export const PageTypePage = "page"; // Generic page/landing
132
140
  export const ProjectTypeAgent = "agent";
133
141
  export const ProjectTypeApp = "app";
134
142
  export const ProjectTypeFlow = "flow";
@@ -194,6 +202,9 @@ export const TaskLogTypeTask = 4;
194
202
  export const TeamTypePersonal = "personal";
195
203
  export const TeamTypeTeam = "team";
196
204
  export const TeamTypeSystem = "system";
205
+ export const TeamStatusActive = "active";
206
+ export const TeamStatusSuspended = "suspended";
207
+ export const TeamStatusTerminated = "terminated";
197
208
  export const TeamRoleOwner = "owner";
198
209
  export const TeamRoleAdmin = "admin";
199
210
  export const TeamRoleMember = "member";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.5.18",
3
+ "version": "0.6.0",
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",