@inferencesh/sdk 0.22.1 → 0.24.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/CHANGELOG.md +26 -0
- package/dist/agent/actions.d.ts +2 -2
- package/dist/agent/actions.js +131 -28
- package/dist/agent/api.d.ts +4 -4
- package/dist/agent/api.js +6 -3
- package/dist/agent/context.d.ts +1 -1
- package/dist/agent/hooks.d.ts +2 -2
- package/dist/agent/hooks.js +1 -1
- package/dist/agent/index.d.ts +6 -6
- package/dist/agent/index.js +5 -5
- package/dist/agent/mcp-input.d.ts +1 -1
- package/dist/agent/provider.d.ts +1 -1
- package/dist/agent/provider.js +5 -5
- package/dist/agent/reducer.d.ts +1 -1
- package/dist/agent/reducer.js +2 -2
- package/dist/agent/types.d.ts +20 -7
- package/dist/api/agents.d.ts +16 -14
- package/dist/api/agents.js +63 -40
- package/dist/api/api-keys.d.ts +3 -3
- package/dist/api/apps.d.ts +4 -4
- package/dist/api/artifacts.d.ts +3 -3
- package/dist/api/chats.d.ts +4 -4
- package/dist/api/credentials.d.ts +3 -3
- package/dist/api/engines.d.ts +4 -4
- package/dist/api/files.d.ts +3 -3
- package/dist/api/flow-runs.d.ts +3 -3
- package/dist/api/flows.d.ts +4 -4
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +4 -4
- package/dist/api/knowledge.d.ts +4 -4
- package/dist/api/mcp-servers.d.ts +4 -4
- package/dist/api/projects.d.ts +4 -4
- package/dist/api/search.d.ts +3 -3
- package/dist/api/secrets.d.ts +3 -3
- package/dist/api/sessions.d.ts +3 -3
- package/dist/api/sockets.d.ts +6 -6
- package/dist/api/sockets.js +2 -2
- package/dist/api/tasks.d.ts +3 -3
- package/dist/api/tasks.js +4 -4
- package/dist/api/teams.d.ts +4 -4
- package/dist/api/write-bodies.d.ts +1 -1
- package/dist/delta.d.ts +1 -1
- package/dist/delta.js +1 -1
- package/dist/hook-builder.d.ts +1 -1
- package/dist/hook-builder.js +1 -1
- package/dist/http/client.d.ts +2 -2
- package/dist/http/client.js +2 -2
- package/dist/http/errors.d.ts +1 -1
- package/dist/http/index.d.ts +4 -4
- package/dist/http/index.js +4 -4
- package/dist/http/response.d.ts +1 -1
- package/dist/http/stream-until-terminal.d.ts +22 -8
- package/dist/http/stream-until-terminal.js +17 -9
- package/dist/http/streamable.d.ts +63 -7
- package/dist/http/streamable.js +277 -119
- package/dist/index.d.ts +65 -65
- package/dist/index.js +53 -53
- package/dist/live/schema.js +1 -1
- package/dist/live/session.d.ts +3 -3
- package/dist/live/session.js +2 -2
- package/dist/proxy/express.d.ts +1 -1
- package/dist/proxy/express.js +1 -1
- package/dist/proxy/hono.d.ts +1 -1
- package/dist/proxy/hono.js +1 -1
- package/dist/proxy/index.js +0 -2
- package/dist/proxy/nextjs.d.ts +3 -3
- package/dist/proxy/nextjs.js +2 -2
- package/dist/proxy/remix.d.ts +1 -1
- package/dist/proxy/remix.js +1 -1
- package/dist/proxy/svelte.d.ts +1 -1
- package/dist/proxy/svelte.js +1 -1
- package/dist/tool-builder.d.ts +1 -1
- package/dist/tool-builder.js +1 -1
- package/dist/types.d.ts +182 -41
- package/dist/types.js +33 -9
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -2
- package/package.json +2 -1
package/dist/types.d.ts
CHANGED
|
@@ -72,13 +72,21 @@ export interface SkillConfig {
|
|
|
72
72
|
preload?: boolean;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
* ContextField declares a context parameter expected by the agent.
|
|
75
|
+
* ContextField declares a context parameter expected by the agent. The
|
|
76
|
+
* agent's prompt names it with its description, and the agent writes
|
|
77
|
+
* {{context.NAME}} in a tool call's arguments for the server to fill in;
|
|
78
|
+
* it does not see the value unless InPrompt.
|
|
76
79
|
*/
|
|
77
80
|
export interface ContextField {
|
|
78
81
|
name: string;
|
|
79
82
|
description?: string;
|
|
80
83
|
required?: boolean;
|
|
81
84
|
default?: string;
|
|
85
|
+
/**
|
|
86
|
+
* InPrompt shows the value to the model too, in the system prompt,
|
|
87
|
+
* labeled as the caller's data and quoted.
|
|
88
|
+
*/
|
|
89
|
+
in_prompt?: boolean;
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
84
92
|
* AgentToolDTO for API responses
|
|
@@ -443,49 +451,68 @@ export interface ApiAppRunRequest {
|
|
|
443
451
|
metadata?: TaskMetadata;
|
|
444
452
|
}
|
|
445
453
|
/**
|
|
446
|
-
*
|
|
454
|
+
* MessageInput is a message a caller sends to an agent: its text and the
|
|
455
|
+
* files sent with it. The model, its settings, the system prompt, the tools
|
|
456
|
+
* and the history come from the agent and the chat. Every endpoint that
|
|
457
|
+
* takes a message decodes this type.
|
|
447
458
|
*/
|
|
448
|
-
export interface
|
|
449
|
-
|
|
450
|
-
agent?: string;
|
|
451
|
-
agent_config?: AgentConfigInput;
|
|
452
|
-
agent_name?: string;
|
|
453
|
-
input: LLMInput;
|
|
454
|
-
context?: {
|
|
455
|
-
[key: string]: string;
|
|
456
|
-
};
|
|
457
|
-
stream?: boolean;
|
|
459
|
+
export interface MessageInput {
|
|
460
|
+
text?: string;
|
|
458
461
|
/**
|
|
459
|
-
*
|
|
462
|
+
* Attachments are files uploaded with POST /files. Images reach the
|
|
463
|
+
* model as image input.
|
|
460
464
|
*/
|
|
461
|
-
|
|
465
|
+
attachments?: FileRef[];
|
|
466
|
+
/**
|
|
467
|
+
* Deprecated: send Attachments. Image URIs, read only when Attachments
|
|
468
|
+
* is empty.
|
|
469
|
+
*/
|
|
470
|
+
images?: string[];
|
|
471
|
+
/**
|
|
472
|
+
* Deprecated: send Attachments. File URIs, read only when Attachments
|
|
473
|
+
* is empty.
|
|
474
|
+
*/
|
|
475
|
+
files?: string[];
|
|
462
476
|
}
|
|
463
477
|
/**
|
|
464
|
-
*
|
|
478
|
+
* ApiAgentRunRequest is the request body of POST /agents/run and its aliases
|
|
479
|
+
* /agents/message and /agents/messages. It names the agent once: by ref
|
|
480
|
+
* (agent), by id (agent_id, with an optional agent_version_id), or by an
|
|
481
|
+
* ad-hoc agent_config; or names none and posts into chat_id's chat.
|
|
465
482
|
*/
|
|
466
|
-
export interface
|
|
483
|
+
export interface ApiAgentRunRequest {
|
|
467
484
|
chat_id?: string;
|
|
485
|
+
agent?: string;
|
|
486
|
+
/**
|
|
487
|
+
* AgentID names a stored agent by id; AgentVersionID pins one of its
|
|
488
|
+
* versions (full or short id), else the agent's current version runs.
|
|
489
|
+
*/
|
|
468
490
|
agent_id?: string;
|
|
469
491
|
agent_version_id?: string;
|
|
470
|
-
agent?: string;
|
|
471
|
-
tool_call_id?: string;
|
|
472
|
-
input: LLMInput;
|
|
473
|
-
channel_context?: ChannelContext;
|
|
474
492
|
agent_config?: AgentConfigInput;
|
|
475
493
|
agent_name?: string;
|
|
494
|
+
input: MessageInput;
|
|
476
495
|
context?: {
|
|
477
496
|
[key: string]: string;
|
|
478
497
|
};
|
|
498
|
+
stream?: boolean;
|
|
479
499
|
}
|
|
480
500
|
export interface CreateAgentMessageResponse {
|
|
481
501
|
user_message?: ChatMessageDTO;
|
|
482
502
|
assistant_message?: ChatMessageDTO;
|
|
483
503
|
}
|
|
484
504
|
/**
|
|
485
|
-
* ToolResultRequest
|
|
505
|
+
* ToolResultRequest is the body of POST /tools/{id}: a client's result for a
|
|
506
|
+
* tool call it ran.
|
|
486
507
|
*/
|
|
487
508
|
export interface ToolResultRequest {
|
|
488
509
|
result: string;
|
|
510
|
+
/**
|
|
511
|
+
* Attachments are files uploaded with POST /files, as in MessageInput.
|
|
512
|
+
* The tool message carries them; images reach the model as image input
|
|
513
|
+
* when it accepts images.
|
|
514
|
+
*/
|
|
515
|
+
attachments?: FileRef[];
|
|
489
516
|
}
|
|
490
517
|
/**
|
|
491
518
|
* PartialFile is the clean DTO version (no gorm tags).
|
|
@@ -863,7 +890,7 @@ export interface EstimateCostResponse {
|
|
|
863
890
|
/**
|
|
864
891
|
* Scope represents an API key permission scope string.
|
|
865
892
|
*/
|
|
866
|
-
export type Scope = "*" | "agents" | "apps" | "conversations" | "files" | "datastores" | "templates" | "flows" | "projects" | "teams" | "billing" | "artifacts" | "agents:read" | "agents:write" | "agents:execute" | "apps:read" | "apps:write" | "apps:execute" | "conversations:read" | "conversations:write" | "files:read" | "files:write" | "datastores:read" | "datastores:write" | "flows:read" | "flows:write" | "flows:execute" | "projects:read" | "projects:write" | "teams:read" | "teams:write" | "billing:read" | "billing:write" | "secrets:read" | "secrets:write" | "secrets:reveal" | "credentials:read" | "credentials:write" | "engines:read" | "engines:write" | "remotes:read" | "remotes:write" | "apikeys:read" | "apikeys:write" | "knowledge:read" | "knowledge:write" | "artifacts:read" | "artifacts:write" | "user:read" | "user:write" | "settings:read" | "settings:write" | "approvals:write" | "admin:read" | "admin:write" | "
|
|
893
|
+
export type Scope = "*" | "agents" | "apps" | "conversations" | "files" | "datastores" | "templates" | "flows" | "projects" | "teams" | "billing" | "artifacts" | "agents:read" | "agents:write" | "agents:execute" | "apps:read" | "apps:write" | "apps:execute" | "conversations:read" | "conversations:write" | "files:read" | "files:write" | "datastores:read" | "datastores:write" | "flows:read" | "flows:write" | "flows:execute" | "projects:read" | "projects:write" | "teams:read" | "teams:write" | "billing:read" | "billing:write" | "secrets:read" | "secrets:write" | "secrets:reveal" | "credentials:read" | "credentials:write" | "engines:read" | "engines:write" | "remotes:read" | "remotes:write" | "apikeys:read" | "apikeys:write" | "knowledge:read" | "knowledge:write" | "artifacts:read" | "artifacts:write" | "user:read" | "user:write" | "settings:read" | "settings:write" | "approvals:write" | "admin:read" | "admin:write" | "store:pricing" | "store:submit";
|
|
867
894
|
/**
|
|
868
895
|
* API Key Scopes - hierarchical permission system.
|
|
869
896
|
* Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
|
|
@@ -1158,17 +1185,22 @@ export declare const ScopeAdminRead: Scope;
|
|
|
1158
1185
|
*/
|
|
1159
1186
|
export declare const ScopeAdminWrite: Scope;
|
|
1160
1187
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1188
|
+
* ScopeStorePricing reads and changes store pricing: a version's terms,
|
|
1189
|
+
* its draft pricing (edit, evaluate, discard, publish, apply to the
|
|
1190
|
+
* listing) and the sample tasks drafts are evaluated against. Held only
|
|
1191
|
+
* in the platform's workspace (the system team), by its members, their
|
|
1192
|
+
* keys and runs, and its own keys.
|
|
1166
1193
|
*/
|
|
1167
|
-
export declare const
|
|
1194
|
+
export declare const ScopeStorePricing: Scope;
|
|
1195
|
+
/**
|
|
1196
|
+
* ScopeStoreSubmit submits a resource version to the store on its
|
|
1197
|
+
* publisher's behalf. Held like ScopeStorePricing.
|
|
1198
|
+
*/
|
|
1199
|
+
export declare const ScopeStoreSubmit: Scope;
|
|
1168
1200
|
/**
|
|
1169
1201
|
* ScopeGroup identifies a category of scopes for UI grouping
|
|
1170
1202
|
*/
|
|
1171
|
-
export type ScopeGroup = "agents" | "apps" | "conversations" | "files" | "datastores" | "flows" | "projects" | "teams" | "billing" | "secrets" | "credentials" | "engines" | "remotes" | "apikeys" | "knowledge" | "artifacts" | "user" | "settings" | "approvals" | "admin";
|
|
1203
|
+
export type ScopeGroup = "agents" | "apps" | "conversations" | "files" | "datastores" | "flows" | "projects" | "teams" | "billing" | "secrets" | "credentials" | "engines" | "remotes" | "apikeys" | "knowledge" | "artifacts" | "user" | "settings" | "approvals" | "admin" | "store";
|
|
1172
1204
|
export declare const ScopeGroupAgents: ScopeGroup;
|
|
1173
1205
|
export declare const ScopeGroupApps: ScopeGroup;
|
|
1174
1206
|
export declare const ScopeGroupConversations: ScopeGroup;
|
|
@@ -1189,6 +1221,7 @@ export declare const ScopeGroupUser: ScopeGroup;
|
|
|
1189
1221
|
export declare const ScopeGroupSettings: ScopeGroup;
|
|
1190
1222
|
export declare const ScopeGroupApprovals: ScopeGroup;
|
|
1191
1223
|
export declare const ScopeGroupAdmin: ScopeGroup;
|
|
1224
|
+
export declare const ScopeGroupStore: ScopeGroup;
|
|
1192
1225
|
/**
|
|
1193
1226
|
* ScopeDefinition describes a single scope for UI rendering
|
|
1194
1227
|
*/
|
|
@@ -1214,13 +1247,6 @@ export interface ScopeDefinition {
|
|
|
1214
1247
|
* apps, agents, flows).
|
|
1215
1248
|
*/
|
|
1216
1249
|
costs_credits?: boolean;
|
|
1217
|
-
/**
|
|
1218
|
-
* Automation: a narrow platform-administration scope that a workspace
|
|
1219
|
-
* key of the platform's automation account (the system team's service
|
|
1220
|
-
* account) may hold, minted by an admin with platform power and always
|
|
1221
|
-
* expiring. Every other key, token and app holds no admin scope.
|
|
1222
|
-
*/
|
|
1223
|
-
automation?: boolean;
|
|
1224
1250
|
}
|
|
1225
1251
|
/**
|
|
1226
1252
|
* ScopeGroupDefinition describes a group of scopes for UI rendering
|
|
@@ -1255,6 +1281,11 @@ export interface ScopesResponse {
|
|
|
1255
1281
|
* key or app is ever granted one.
|
|
1256
1282
|
*/
|
|
1257
1283
|
account_scopes: ScopeDefinition[];
|
|
1284
|
+
/**
|
|
1285
|
+
* AccountGroups are the groups AccountScopes fall in, so the page labels
|
|
1286
|
+
* them the way it labels Groups.
|
|
1287
|
+
*/
|
|
1288
|
+
account_groups: ScopeGroupDefinition[];
|
|
1258
1289
|
/**
|
|
1259
1290
|
* LoginPreset is what the device approval page preselects for
|
|
1260
1291
|
* `belt login`: the standard preset plus approvals:write (answering
|
|
@@ -1366,6 +1397,18 @@ export interface AppFunction {
|
|
|
1366
1397
|
* a stream function declares a socket parameter. Empty means run.
|
|
1367
1398
|
*/
|
|
1368
1399
|
kind?: FunctionKind;
|
|
1400
|
+
/**
|
|
1401
|
+
* Credentials the function needs at run time, declared on the function
|
|
1402
|
+
* in app code. Each must be covered by the app-wide list in inf.yml.
|
|
1403
|
+
* Empty means the function gets the app-wide list.
|
|
1404
|
+
*/
|
|
1405
|
+
credentials?: CredentialRequirement[];
|
|
1406
|
+
/**
|
|
1407
|
+
* Annotations are MCP tool hints (read-only, destructive, idempotent,
|
|
1408
|
+
* open-world) declared on the function. Hints only: nothing trusts
|
|
1409
|
+
* them for an unverified namespace.
|
|
1410
|
+
*/
|
|
1411
|
+
annotations?: ToolAnnotations;
|
|
1369
1412
|
}
|
|
1370
1413
|
/**
|
|
1371
1414
|
* AppImages holds developer-provided images for the app.
|
|
@@ -1531,6 +1574,28 @@ export interface AppVersionDTO extends BaseModelDTO {
|
|
|
1531
1574
|
*/
|
|
1532
1575
|
sandbox?: AppSandbox;
|
|
1533
1576
|
checksum?: string;
|
|
1577
|
+
/**
|
|
1578
|
+
* Warnings are what the deploy that created this version accepted but
|
|
1579
|
+
* the author should fix. Only the deploy's own response carries them.
|
|
1580
|
+
*/
|
|
1581
|
+
warnings?: DeployWarning[];
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* DeployWarning is something a deploy accepted but the author should fix:
|
|
1585
|
+
* the app works, but asks for more than it needs or says less than clients
|
|
1586
|
+
* use.
|
|
1587
|
+
*/
|
|
1588
|
+
export interface DeployWarning {
|
|
1589
|
+
/**
|
|
1590
|
+
* Code identifies the check: readonly_broad_credential,
|
|
1591
|
+
* unused_credential, missing_annotations.
|
|
1592
|
+
*/
|
|
1593
|
+
code: string;
|
|
1594
|
+
/**
|
|
1595
|
+
* Function is the function the warning is about, when it is about one.
|
|
1596
|
+
*/
|
|
1597
|
+
function?: string;
|
|
1598
|
+
message: string;
|
|
1534
1599
|
}
|
|
1535
1600
|
/**
|
|
1536
1601
|
* LicenseRecordDTO is the API response for a license record.
|
|
@@ -2843,8 +2908,9 @@ export declare const ErrorCodeFeatureNotAvailable: ErrorCode;
|
|
|
2843
2908
|
export declare const ErrorCodeEntitlementUnavailable: ErrorCode;
|
|
2844
2909
|
export declare const ErrorCodePaymentRequired: ErrorCode;
|
|
2845
2910
|
/**
|
|
2846
|
-
* ErrorCodePaymentMethodRequired (402):
|
|
2847
|
-
*
|
|
2911
|
+
* ErrorCodePaymentMethodRequired (402): the action needs a saved payment
|
|
2912
|
+
* method and the caller's team has none: a bounty program that requires
|
|
2913
|
+
* one, or a free app run without a balance. Meta is
|
|
2848
2914
|
* PaymentMethodRequiredMeta; clients send the user to BillingPage.
|
|
2849
2915
|
*/
|
|
2850
2916
|
export declare const ErrorCodePaymentMethodRequired: ErrorCode;
|
|
@@ -2921,9 +2987,10 @@ export interface ScopeRefusedMeta {
|
|
|
2921
2987
|
}
|
|
2922
2988
|
/**
|
|
2923
2989
|
* PaymentMethodRequiredMeta is the meta of a payment_method_required error.
|
|
2990
|
+
* BountyID is set when a bounty claim was refused.
|
|
2924
2991
|
*/
|
|
2925
2992
|
export interface PaymentMethodRequiredMeta {
|
|
2926
|
-
bounty_id
|
|
2993
|
+
bounty_id?: string;
|
|
2927
2994
|
billing_page: string;
|
|
2928
2995
|
}
|
|
2929
2996
|
/**
|
|
@@ -3778,6 +3845,21 @@ export interface ResourceContent {
|
|
|
3778
3845
|
[key: string]: any;
|
|
3779
3846
|
};
|
|
3780
3847
|
}
|
|
3848
|
+
/**
|
|
3849
|
+
* ToolAnnotations describes tool behavior so clients can make trust and UX
|
|
3850
|
+
* decisions (e.g., auto-approve read-only tools). All fields are optional hints.
|
|
3851
|
+
*/
|
|
3852
|
+
export interface ToolAnnotations {
|
|
3853
|
+
/**
|
|
3854
|
+
* Title is the human-readable name clients and the Claude directory show.
|
|
3855
|
+
* It repeats MCPTool.Title because some clients read only this one.
|
|
3856
|
+
*/
|
|
3857
|
+
title?: string;
|
|
3858
|
+
readOnlyHint?: boolean;
|
|
3859
|
+
destructiveHint?: boolean;
|
|
3860
|
+
idempotentHint?: boolean;
|
|
3861
|
+
openWorldHint?: boolean;
|
|
3862
|
+
}
|
|
3781
3863
|
/**
|
|
3782
3864
|
* ToolCallRequest represents a request to call a tool.
|
|
3783
3865
|
* InputResponses and RequestState are present on MRTR retries: the client is
|
|
@@ -5565,6 +5647,16 @@ export interface DecisionVisionInput extends DecisionInput {
|
|
|
5565
5647
|
*/
|
|
5566
5648
|
images?: string[];
|
|
5567
5649
|
}
|
|
5650
|
+
/**
|
|
5651
|
+
* DecisionVideoInput is the input of a decision model that also watches
|
|
5652
|
+
* videos: a DecisionVisionInput plus the videos the questions are about.
|
|
5653
|
+
*/
|
|
5654
|
+
export interface DecisionVideoInput extends DecisionVisionInput {
|
|
5655
|
+
/**
|
|
5656
|
+
* Videos are file URIs. Every question sees them, after the images.
|
|
5657
|
+
*/
|
|
5658
|
+
videos?: string[];
|
|
5659
|
+
}
|
|
5568
5660
|
/**
|
|
5569
5661
|
* DecisionChoiceAnswer is the answer to a choice question.
|
|
5570
5662
|
*/
|
|
@@ -6762,7 +6854,7 @@ export interface UtilityConfig {
|
|
|
6762
6854
|
* These are the backbone protocol events — every consumer (A2A, SDK, frontend)
|
|
6763
6855
|
* projects from this set.
|
|
6764
6856
|
*/
|
|
6765
|
-
export type AgentEventType = "run.started" | "run.state_changed" | "turn.started" | "turn.completed" | "content.delta" | "tool.started" | "tool.completed" | "approval.required" | "approval.resolved" | "hook.executed" | "usage.updated" | "context.compacted" | "error";
|
|
6857
|
+
export type AgentEventType = "run.started" | "run.state_changed" | "turn.started" | "turn.completed" | "content.delta" | "tool.started" | "tool.completed" | "approval.required" | "approval.resolved" | "hook.executed" | "usage.updated" | "context.updated" | "limits.updated" | "account.updated" | "context.compacted" | "error" | "subagent.started" | "subagent.updated" | "subagent.completed";
|
|
6766
6858
|
/**
|
|
6767
6859
|
* Run lifecycle
|
|
6768
6860
|
*/
|
|
@@ -6793,9 +6885,14 @@ export declare const AgentEventApprovalResolved: AgentEventType;
|
|
|
6793
6885
|
*/
|
|
6794
6886
|
export declare const AgentEventHookExecuted: AgentEventType;
|
|
6795
6887
|
/**
|
|
6796
|
-
* Usage
|
|
6888
|
+
* Usage: a turn's tokens (usage.updated), the context window's fill
|
|
6889
|
+
* (context.updated), the plan's rate limits (limits.updated) and the
|
|
6890
|
+
* account the agent runs as (account.updated).
|
|
6797
6891
|
*/
|
|
6798
6892
|
export declare const AgentEventUsageUpdated: AgentEventType;
|
|
6893
|
+
export declare const AgentEventContextUpdated: AgentEventType;
|
|
6894
|
+
export declare const AgentEventLimitsUpdated: AgentEventType;
|
|
6895
|
+
export declare const AgentEventAccountUpdated: AgentEventType;
|
|
6799
6896
|
/**
|
|
6800
6897
|
* Context management
|
|
6801
6898
|
*/
|
|
@@ -6840,6 +6937,10 @@ export interface TurnCompletedPayload {
|
|
|
6840
6937
|
export interface ContentDeltaPayload {
|
|
6841
6938
|
kind: ContentDeltaKind;
|
|
6842
6939
|
delta: string;
|
|
6940
|
+
/**
|
|
6941
|
+
* SubagentID is set on a subagent's own output (subagent_types.go).
|
|
6942
|
+
*/
|
|
6943
|
+
subagent_id?: string;
|
|
6843
6944
|
}
|
|
6844
6945
|
export type ContentDeltaKind = "text" | "reasoning";
|
|
6845
6946
|
export declare const ContentDeltaText: ContentDeltaKind;
|
|
@@ -6850,6 +6951,10 @@ export interface ToolStartedPayload {
|
|
|
6850
6951
|
tool_type?: ToolType;
|
|
6851
6952
|
display_name?: string;
|
|
6852
6953
|
arguments?: StringEncodedMap;
|
|
6954
|
+
/**
|
|
6955
|
+
* SubagentID is set on a subagent's own tool calls.
|
|
6956
|
+
*/
|
|
6957
|
+
subagent_id?: string;
|
|
6853
6958
|
}
|
|
6854
6959
|
export interface ToolCompletedPayload {
|
|
6855
6960
|
tool_invocation_id: string;
|
|
@@ -6857,12 +6962,21 @@ export interface ToolCompletedPayload {
|
|
|
6857
6962
|
status: ToolInvocationStatus;
|
|
6858
6963
|
result?: string;
|
|
6859
6964
|
duration_ms?: number;
|
|
6965
|
+
/**
|
|
6966
|
+
* SubagentID is set on a subagent's own tool calls.
|
|
6967
|
+
*/
|
|
6968
|
+
subagent_id?: string;
|
|
6860
6969
|
}
|
|
6861
6970
|
export interface ApprovalRequiredPayload {
|
|
6862
6971
|
tool_invocation_id: string;
|
|
6863
6972
|
tool_name: string;
|
|
6864
6973
|
arguments?: StringEncodedMap;
|
|
6865
6974
|
reason: InterruptReason;
|
|
6975
|
+
/**
|
|
6976
|
+
* SubagentID is set when a subagent asks: its tool call, not the
|
|
6977
|
+
* agent's.
|
|
6978
|
+
*/
|
|
6979
|
+
subagent_id?: string;
|
|
6866
6980
|
}
|
|
6867
6981
|
export interface ApprovalResolvedPayload {
|
|
6868
6982
|
tool_invocation_id: string;
|
|
@@ -6876,12 +6990,23 @@ export interface HookExecutedPayload {
|
|
|
6876
6990
|
reason?: string;
|
|
6877
6991
|
duration_ms?: number;
|
|
6878
6992
|
}
|
|
6993
|
+
/**
|
|
6994
|
+
* UsageUpdatedPayload is what one turn used, emitted once when the turn
|
|
6995
|
+
* ends. PromptTokens counts every input token, cached or not:
|
|
6996
|
+
* CachedInputTokens (read from a prompt cache) and CacheCreationTokens
|
|
6997
|
+
* (written to one) are parts of it. ReasoningTokens is part of
|
|
6998
|
+
* CompletionTokens. CostUSD is the agent's own figure, 0 when it reports
|
|
6999
|
+
* none.
|
|
7000
|
+
*/
|
|
6879
7001
|
export interface UsageUpdatedPayload {
|
|
6880
7002
|
prompt_tokens: number;
|
|
6881
7003
|
completion_tokens: number;
|
|
6882
7004
|
total_tokens: number;
|
|
7005
|
+
cached_input_tokens?: number;
|
|
7006
|
+
cache_creation_tokens?: number;
|
|
6883
7007
|
reasoning_tokens?: number;
|
|
6884
7008
|
cost_usd?: number;
|
|
7009
|
+
status?: TurnUsageStatus;
|
|
6885
7010
|
}
|
|
6886
7011
|
export interface ContextCompactedPayload {
|
|
6887
7012
|
before_tokens: number;
|
|
@@ -7095,6 +7220,9 @@ export interface ToolResultEventData {
|
|
|
7095
7220
|
export interface ErrorEventData {
|
|
7096
7221
|
error: string;
|
|
7097
7222
|
}
|
|
7223
|
+
export declare const AgentEventSubagentStarted: AgentEventType;
|
|
7224
|
+
export declare const AgentEventSubagentUpdated: AgentEventType;
|
|
7225
|
+
export declare const AgentEventSubagentCompleted: AgentEventType;
|
|
7098
7226
|
/**
|
|
7099
7227
|
* ToolInvocationStatus represents the execution status of a tool invocation
|
|
7100
7228
|
*/
|
|
@@ -7247,3 +7375,16 @@ export interface ToolParameterProperty {
|
|
|
7247
7375
|
items?: ToolParameterProperty;
|
|
7248
7376
|
required?: string[];
|
|
7249
7377
|
}
|
|
7378
|
+
/**
|
|
7379
|
+
* TurnUsageStatus says how much of a turn's usage the agent reported.
|
|
7380
|
+
*/
|
|
7381
|
+
export type TurnUsageStatus = "complete" | "partial";
|
|
7382
|
+
/**
|
|
7383
|
+
* TurnUsageComplete is the whole turn, as the agent counted it.
|
|
7384
|
+
*/
|
|
7385
|
+
export declare const TurnUsageComplete: TurnUsageStatus;
|
|
7386
|
+
/**
|
|
7387
|
+
* TurnUsagePartial is what was reported before the turn ended early
|
|
7388
|
+
* (interrupted, failed).
|
|
7389
|
+
*/
|
|
7390
|
+
export declare const TurnUsagePartial: TurnUsageStatus;
|
package/dist/types.js
CHANGED
|
@@ -309,13 +309,18 @@ export const ScopeAdminRead = "admin:read";
|
|
|
309
309
|
*/
|
|
310
310
|
export const ScopeAdminWrite = "admin:write";
|
|
311
311
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
312
|
+
* ScopeStorePricing reads and changes store pricing: a version's terms,
|
|
313
|
+
* its draft pricing (edit, evaluate, discard, publish, apply to the
|
|
314
|
+
* listing) and the sample tasks drafts are evaluated against. Held only
|
|
315
|
+
* in the platform's workspace (the system team), by its members, their
|
|
316
|
+
* keys and runs, and its own keys.
|
|
317
317
|
*/
|
|
318
|
-
export const
|
|
318
|
+
export const ScopeStorePricing = "store:pricing";
|
|
319
|
+
/**
|
|
320
|
+
* ScopeStoreSubmit submits a resource version to the store on its
|
|
321
|
+
* publisher's behalf. Held like ScopeStorePricing.
|
|
322
|
+
*/
|
|
323
|
+
export const ScopeStoreSubmit = "store:submit";
|
|
319
324
|
export const ScopeGroupAgents = "agents";
|
|
320
325
|
export const ScopeGroupApps = "apps";
|
|
321
326
|
export const ScopeGroupConversations = "conversations";
|
|
@@ -336,6 +341,7 @@ export const ScopeGroupUser = "user";
|
|
|
336
341
|
export const ScopeGroupSettings = "settings";
|
|
337
342
|
export const ScopeGroupApprovals = "approvals";
|
|
338
343
|
export const ScopeGroupAdmin = "admin";
|
|
344
|
+
export const ScopeGroupStore = "store";
|
|
339
345
|
/**
|
|
340
346
|
* AlwaysAllowScopeExact: this call exactly (each piece of the command,
|
|
341
347
|
* the file, the domain).
|
|
@@ -476,8 +482,9 @@ export const ErrorCodeFeatureNotAvailable = "feature_not_available";
|
|
|
476
482
|
export const ErrorCodeEntitlementUnavailable = "entitlement_unavailable";
|
|
477
483
|
export const ErrorCodePaymentRequired = "payment_required";
|
|
478
484
|
/**
|
|
479
|
-
* ErrorCodePaymentMethodRequired (402):
|
|
480
|
-
*
|
|
485
|
+
* ErrorCodePaymentMethodRequired (402): the action needs a saved payment
|
|
486
|
+
* method and the caller's team has none: a bounty program that requires
|
|
487
|
+
* one, or a free app run without a balance. Meta is
|
|
481
488
|
* PaymentMethodRequiredMeta; clients send the user to BillingPage.
|
|
482
489
|
*/
|
|
483
490
|
export const ErrorCodePaymentMethodRequired = "payment_method_required";
|
|
@@ -1474,9 +1481,14 @@ export const AgentEventApprovalResolved = "approval.resolved";
|
|
|
1474
1481
|
*/
|
|
1475
1482
|
export const AgentEventHookExecuted = "hook.executed";
|
|
1476
1483
|
/**
|
|
1477
|
-
* Usage
|
|
1484
|
+
* Usage: a turn's tokens (usage.updated), the context window's fill
|
|
1485
|
+
* (context.updated), the plan's rate limits (limits.updated) and the
|
|
1486
|
+
* account the agent runs as (account.updated).
|
|
1478
1487
|
*/
|
|
1479
1488
|
export const AgentEventUsageUpdated = "usage.updated";
|
|
1489
|
+
export const AgentEventContextUpdated = "context.updated";
|
|
1490
|
+
export const AgentEventLimitsUpdated = "limits.updated";
|
|
1491
|
+
export const AgentEventAccountUpdated = "account.updated";
|
|
1480
1492
|
/**
|
|
1481
1493
|
* Context management
|
|
1482
1494
|
*/
|
|
@@ -1541,6 +1553,9 @@ export const BuiltinHookBeltSuggest = "belt:suggest";
|
|
|
1541
1553
|
* compaction drops the turns it would have learned from.
|
|
1542
1554
|
*/
|
|
1543
1555
|
export const BuiltinHookBeltExtract = "belt:extract";
|
|
1556
|
+
export const AgentEventSubagentStarted = "subagent.started";
|
|
1557
|
+
export const AgentEventSubagentUpdated = "subagent.updated";
|
|
1558
|
+
export const AgentEventSubagentCompleted = "subagent.completed";
|
|
1544
1559
|
export const ToolInvocationStatusPending = "pending";
|
|
1545
1560
|
export const ToolInvocationStatusInProgress = "in_progress";
|
|
1546
1561
|
export const ToolInvocationStatusAwaitingInput = "awaiting_input";
|
|
@@ -1589,3 +1604,12 @@ export const ToolParamTypeArray = "array";
|
|
|
1589
1604
|
* Tool parameter types
|
|
1590
1605
|
*/
|
|
1591
1606
|
export const ToolParamTypeNull = "null";
|
|
1607
|
+
/**
|
|
1608
|
+
* TurnUsageComplete is the whole turn, as the agent counted it.
|
|
1609
|
+
*/
|
|
1610
|
+
export const TurnUsageComplete = "complete";
|
|
1611
|
+
/**
|
|
1612
|
+
* TurnUsagePartial is what was reported before the turn ended early
|
|
1613
|
+
* (interrupted, failed).
|
|
1614
|
+
*/
|
|
1615
|
+
export const TurnUsagePartial = "partial";
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Status utilities for handling both int and string-based status values.
|
|
3
3
|
* Provides future compatibility when API migrates from int to string status.
|
|
4
4
|
*/
|
|
5
|
-
import { TaskStatus } from './types';
|
|
6
|
-
import type { AgentRunState, ChatDTO, ChatMessageStatus } from './types';
|
|
5
|
+
import { TaskStatus } from './types.js';
|
|
6
|
+
import type { AgentRunState, ChatDTO, ChatMessageStatus } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Parse task status from int or string to TaskStatus number.
|
|
9
9
|
* Handles both current int-based API and future string-based API.
|
package/dist/utils.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Status utilities for handling both int and string-based status values.
|
|
3
3
|
* Provides future compatibility when API migrates from int to string status.
|
|
4
4
|
*/
|
|
5
|
-
import { InterruptReasonToolApproval, InterruptStatusPending } from './types';
|
|
6
|
-
import { TaskStatusUnknown, TaskStatusReceived, TaskStatusQueued, TaskStatusDispatched, TaskStatusPreparing, TaskStatusServing, TaskStatusSettingUp, TaskStatusRunning, TaskStatusCancelling, TaskStatusUploading, TaskStatusCompleted, TaskStatusFailed, TaskStatusCancelled, AgentRunStateWorking, AgentRunStateSubmitted, AgentRunStateInputRequired, AgentRunStateAuthRequired, AgentRunStateCompleted, AgentRunStateFailed, AgentRunStateCanceled, AgentRunStateRejected, ChatMessageStatusReady, ChatMessageStatusFailed, ChatMessageStatusCancelled, ChatStatusBusy, ChatStatusAwaitingInput, } from './types';
|
|
5
|
+
import { InterruptReasonToolApproval, InterruptStatusPending } from './types.js';
|
|
6
|
+
import { TaskStatusUnknown, TaskStatusReceived, TaskStatusQueued, TaskStatusDispatched, TaskStatusPreparing, TaskStatusServing, TaskStatusSettingUp, TaskStatusRunning, TaskStatusCancelling, TaskStatusUploading, TaskStatusCompleted, TaskStatusFailed, TaskStatusCancelled, AgentRunStateWorking, AgentRunStateSubmitted, AgentRunStateInputRequired, AgentRunStateAuthRequired, AgentRunStateCompleted, AgentRunStateFailed, AgentRunStateCanceled, AgentRunStateRejected, ChatMessageStatusReady, ChatMessageStatusFailed, ChatMessageStatusCancelled, ChatStatusBusy, ChatStatusAwaitingInput, } from './types.js';
|
|
7
7
|
/** Map string status names to TaskStatus values (for future string-based API) */
|
|
8
8
|
const STATUS_STRING_MAP = {
|
|
9
9
|
unknown: TaskStatusUnknown,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inferencesh/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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",
|
|
@@ -144,6 +144,7 @@
|
|
|
144
144
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
145
145
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
146
146
|
"clean": "rimraf dist coverage",
|
|
147
|
+
"check:exports": "node scripts/check-exports.mjs",
|
|
147
148
|
"example": "node examples/basic.js"
|
|
148
149
|
}
|
|
149
150
|
}
|