@inferencesh/sdk 0.22.0 → 0.23.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/agent/actions.d.ts +2 -2
  3. package/dist/agent/actions.js +93 -21
  4. package/dist/agent/api.d.ts +3 -3
  5. package/dist/agent/api.js +9 -7
  6. package/dist/agent/context.d.ts +1 -1
  7. package/dist/agent/hooks.d.ts +2 -2
  8. package/dist/agent/hooks.js +1 -1
  9. package/dist/agent/index.d.ts +6 -6
  10. package/dist/agent/index.js +5 -5
  11. package/dist/agent/mcp-input.d.ts +1 -1
  12. package/dist/agent/provider.d.ts +1 -1
  13. package/dist/agent/provider.js +5 -5
  14. package/dist/agent/reducer.d.ts +1 -1
  15. package/dist/agent/reducer.js +2 -2
  16. package/dist/agent/types.d.ts +5 -5
  17. package/dist/api/agents.d.ts +8 -10
  18. package/dist/api/agents.js +45 -34
  19. package/dist/api/api-keys.d.ts +3 -3
  20. package/dist/api/apps.d.ts +4 -4
  21. package/dist/api/artifacts.d.ts +3 -3
  22. package/dist/api/chats.d.ts +4 -4
  23. package/dist/api/credentials.d.ts +3 -3
  24. package/dist/api/engines.d.ts +4 -4
  25. package/dist/api/files.d.ts +3 -3
  26. package/dist/api/flow-runs.d.ts +3 -3
  27. package/dist/api/flows.d.ts +4 -4
  28. package/dist/api/index.d.ts +4 -4
  29. package/dist/api/index.js +4 -4
  30. package/dist/api/knowledge.d.ts +4 -4
  31. package/dist/api/mcp-servers.d.ts +4 -4
  32. package/dist/api/projects.d.ts +4 -4
  33. package/dist/api/search.d.ts +3 -3
  34. package/dist/api/secrets.d.ts +3 -3
  35. package/dist/api/sessions.d.ts +3 -3
  36. package/dist/api/sockets.d.ts +6 -6
  37. package/dist/api/sockets.js +2 -2
  38. package/dist/api/tasks.d.ts +3 -3
  39. package/dist/api/tasks.js +4 -4
  40. package/dist/api/teams.d.ts +4 -4
  41. package/dist/api/write-bodies.d.ts +1 -1
  42. package/dist/delta.d.ts +1 -1
  43. package/dist/delta.js +1 -1
  44. package/dist/hook-builder.d.ts +1 -1
  45. package/dist/hook-builder.js +1 -1
  46. package/dist/http/client.d.ts +2 -2
  47. package/dist/http/client.js +2 -2
  48. package/dist/http/errors.d.ts +1 -1
  49. package/dist/http/index.d.ts +4 -4
  50. package/dist/http/index.js +4 -4
  51. package/dist/http/response.d.ts +1 -1
  52. package/dist/http/stream-until-terminal.d.ts +22 -8
  53. package/dist/http/stream-until-terminal.js +17 -9
  54. package/dist/http/streamable.d.ts +63 -7
  55. package/dist/http/streamable.js +277 -119
  56. package/dist/index.d.ts +65 -65
  57. package/dist/index.js +53 -53
  58. package/dist/live/schema.js +1 -1
  59. package/dist/live/session.d.ts +3 -3
  60. package/dist/live/session.js +2 -2
  61. package/dist/proxy/express.d.ts +1 -1
  62. package/dist/proxy/express.js +1 -1
  63. package/dist/proxy/hono.d.ts +1 -1
  64. package/dist/proxy/hono.js +1 -1
  65. package/dist/proxy/index.js +0 -2
  66. package/dist/proxy/nextjs.d.ts +3 -3
  67. package/dist/proxy/nextjs.js +2 -2
  68. package/dist/proxy/remix.d.ts +1 -1
  69. package/dist/proxy/remix.js +1 -1
  70. package/dist/proxy/svelte.d.ts +1 -1
  71. package/dist/proxy/svelte.js +1 -1
  72. package/dist/tool-builder.d.ts +1 -1
  73. package/dist/tool-builder.js +1 -1
  74. package/dist/types.d.ts +164 -40
  75. package/dist/types.js +33 -9
  76. package/dist/utils.d.ts +2 -2
  77. package/dist/utils.js +2 -2
  78. 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,39 +451,51 @@ export interface ApiAppRunRequest {
443
451
  metadata?: TaskMetadata;
444
452
  }
445
453
  /**
446
- * ApiAgentRunRequest is the request body for /agents/run endpoint.
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 ApiAgentRunRequest {
449
- chat_id?: string;
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
- * ChannelContext is recorded on the chat the first time it is seen.
462
+ * Attachments are files uploaded with POST /files. Images reach the
463
+ * model as image input.
460
464
  */
461
- channel_context?: ChannelContext;
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
- * CreateAgentMessageRequest is the request for creating agent messages.
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 CreateAgentMessageRequest {
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;
@@ -863,7 +883,7 @@ export interface EstimateCostResponse {
863
883
  /**
864
884
  * Scope represents an API key permission scope string.
865
885
  */
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" | "admin:pricing";
886
+ 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
887
  /**
868
888
  * API Key Scopes - hierarchical permission system.
869
889
  * Resource-level scopes (e.g., "agents") imply all action-level scopes (e.g., "agents:read").
@@ -1158,17 +1178,22 @@ export declare const ScopeAdminRead: Scope;
1158
1178
  */
1159
1179
  export declare const ScopeAdminWrite: Scope;
1160
1180
  /**
1161
- * ScopeAdminPricing reads and changes store pricing: a version's
1162
- * terms, its draft pricing (edit, evaluate, discard, publish, apply to
1163
- * the listing) and the sample tasks drafts are evaluated against. Held
1164
- * by an admin's own sign-in with platform power, and by a key of the
1165
- * platform's automation account (ScopeDefinition.Automation).
1181
+ * ScopeStorePricing reads and changes store pricing: a version's terms,
1182
+ * its draft pricing (edit, evaluate, discard, publish, apply to the
1183
+ * listing) and the sample tasks drafts are evaluated against. Held only
1184
+ * in the platform's workspace (the system team), by its members, their
1185
+ * keys and runs, and its own keys.
1166
1186
  */
1167
- export declare const ScopeAdminPricing: Scope;
1187
+ export declare const ScopeStorePricing: Scope;
1188
+ /**
1189
+ * ScopeStoreSubmit submits a resource version to the store on its
1190
+ * publisher's behalf. Held like ScopeStorePricing.
1191
+ */
1192
+ export declare const ScopeStoreSubmit: Scope;
1168
1193
  /**
1169
1194
  * ScopeGroup identifies a category of scopes for UI grouping
1170
1195
  */
1171
- export type ScopeGroup = "agents" | "apps" | "conversations" | "files" | "datastores" | "flows" | "projects" | "teams" | "billing" | "secrets" | "credentials" | "engines" | "remotes" | "apikeys" | "knowledge" | "artifacts" | "user" | "settings" | "approvals" | "admin";
1196
+ 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
1197
  export declare const ScopeGroupAgents: ScopeGroup;
1173
1198
  export declare const ScopeGroupApps: ScopeGroup;
1174
1199
  export declare const ScopeGroupConversations: ScopeGroup;
@@ -1189,6 +1214,7 @@ export declare const ScopeGroupUser: ScopeGroup;
1189
1214
  export declare const ScopeGroupSettings: ScopeGroup;
1190
1215
  export declare const ScopeGroupApprovals: ScopeGroup;
1191
1216
  export declare const ScopeGroupAdmin: ScopeGroup;
1217
+ export declare const ScopeGroupStore: ScopeGroup;
1192
1218
  /**
1193
1219
  * ScopeDefinition describes a single scope for UI rendering
1194
1220
  */
@@ -1214,13 +1240,6 @@ export interface ScopeDefinition {
1214
1240
  * apps, agents, flows).
1215
1241
  */
1216
1242
  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
1243
  }
1225
1244
  /**
1226
1245
  * ScopeGroupDefinition describes a group of scopes for UI rendering
@@ -1255,6 +1274,11 @@ export interface ScopesResponse {
1255
1274
  * key or app is ever granted one.
1256
1275
  */
1257
1276
  account_scopes: ScopeDefinition[];
1277
+ /**
1278
+ * AccountGroups are the groups AccountScopes fall in, so the page labels
1279
+ * them the way it labels Groups.
1280
+ */
1281
+ account_groups: ScopeGroupDefinition[];
1258
1282
  /**
1259
1283
  * LoginPreset is what the device approval page preselects for
1260
1284
  * `belt login`: the standard preset plus approvals:write (answering
@@ -1366,6 +1390,18 @@ export interface AppFunction {
1366
1390
  * a stream function declares a socket parameter. Empty means run.
1367
1391
  */
1368
1392
  kind?: FunctionKind;
1393
+ /**
1394
+ * Credentials the function needs at run time, declared on the function
1395
+ * in app code. Each must be covered by the app-wide list in inf.yml.
1396
+ * Empty means the function gets the app-wide list.
1397
+ */
1398
+ credentials?: CredentialRequirement[];
1399
+ /**
1400
+ * Annotations are MCP tool hints (read-only, destructive, idempotent,
1401
+ * open-world) declared on the function. Hints only: nothing trusts
1402
+ * them for an unverified namespace.
1403
+ */
1404
+ annotations?: ToolAnnotations;
1369
1405
  }
1370
1406
  /**
1371
1407
  * AppImages holds developer-provided images for the app.
@@ -1531,6 +1567,28 @@ export interface AppVersionDTO extends BaseModelDTO {
1531
1567
  */
1532
1568
  sandbox?: AppSandbox;
1533
1569
  checksum?: string;
1570
+ /**
1571
+ * Warnings are what the deploy that created this version accepted but
1572
+ * the author should fix. Only the deploy's own response carries them.
1573
+ */
1574
+ warnings?: DeployWarning[];
1575
+ }
1576
+ /**
1577
+ * DeployWarning is something a deploy accepted but the author should fix:
1578
+ * the app works, but asks for more than it needs or says less than clients
1579
+ * use.
1580
+ */
1581
+ export interface DeployWarning {
1582
+ /**
1583
+ * Code identifies the check: readonly_broad_credential,
1584
+ * unused_credential, missing_annotations.
1585
+ */
1586
+ code: string;
1587
+ /**
1588
+ * Function is the function the warning is about, when it is about one.
1589
+ */
1590
+ function?: string;
1591
+ message: string;
1534
1592
  }
1535
1593
  /**
1536
1594
  * LicenseRecordDTO is the API response for a license record.
@@ -2843,8 +2901,9 @@ export declare const ErrorCodeFeatureNotAvailable: ErrorCode;
2843
2901
  export declare const ErrorCodeEntitlementUnavailable: ErrorCode;
2844
2902
  export declare const ErrorCodePaymentRequired: ErrorCode;
2845
2903
  /**
2846
- * ErrorCodePaymentMethodRequired (402): a bounty program requires a saved
2847
- * payment method and the caller's team has none. Meta is
2904
+ * ErrorCodePaymentMethodRequired (402): the action needs a saved payment
2905
+ * method and the caller's team has none: a bounty program that requires
2906
+ * one, or a free app run without a balance. Meta is
2848
2907
  * PaymentMethodRequiredMeta; clients send the user to BillingPage.
2849
2908
  */
2850
2909
  export declare const ErrorCodePaymentMethodRequired: ErrorCode;
@@ -2921,9 +2980,10 @@ export interface ScopeRefusedMeta {
2921
2980
  }
2922
2981
  /**
2923
2982
  * PaymentMethodRequiredMeta is the meta of a payment_method_required error.
2983
+ * BountyID is set when a bounty claim was refused.
2924
2984
  */
2925
2985
  export interface PaymentMethodRequiredMeta {
2926
- bounty_id: string;
2986
+ bounty_id?: string;
2927
2987
  billing_page: string;
2928
2988
  }
2929
2989
  /**
@@ -3778,6 +3838,21 @@ export interface ResourceContent {
3778
3838
  [key: string]: any;
3779
3839
  };
3780
3840
  }
3841
+ /**
3842
+ * ToolAnnotations describes tool behavior so clients can make trust and UX
3843
+ * decisions (e.g., auto-approve read-only tools). All fields are optional hints.
3844
+ */
3845
+ export interface ToolAnnotations {
3846
+ /**
3847
+ * Title is the human-readable name clients and the Claude directory show.
3848
+ * It repeats MCPTool.Title because some clients read only this one.
3849
+ */
3850
+ title?: string;
3851
+ readOnlyHint?: boolean;
3852
+ destructiveHint?: boolean;
3853
+ idempotentHint?: boolean;
3854
+ openWorldHint?: boolean;
3855
+ }
3781
3856
  /**
3782
3857
  * ToolCallRequest represents a request to call a tool.
3783
3858
  * InputResponses and RequestState are present on MRTR retries: the client is
@@ -6762,7 +6837,7 @@ export interface UtilityConfig {
6762
6837
  * These are the backbone protocol events — every consumer (A2A, SDK, frontend)
6763
6838
  * projects from this set.
6764
6839
  */
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";
6840
+ 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
6841
  /**
6767
6842
  * Run lifecycle
6768
6843
  */
@@ -6793,9 +6868,14 @@ export declare const AgentEventApprovalResolved: AgentEventType;
6793
6868
  */
6794
6869
  export declare const AgentEventHookExecuted: AgentEventType;
6795
6870
  /**
6796
- * Usage
6871
+ * Usage: a turn's tokens (usage.updated), the context window's fill
6872
+ * (context.updated), the plan's rate limits (limits.updated) and the
6873
+ * account the agent runs as (account.updated).
6797
6874
  */
6798
6875
  export declare const AgentEventUsageUpdated: AgentEventType;
6876
+ export declare const AgentEventContextUpdated: AgentEventType;
6877
+ export declare const AgentEventLimitsUpdated: AgentEventType;
6878
+ export declare const AgentEventAccountUpdated: AgentEventType;
6799
6879
  /**
6800
6880
  * Context management
6801
6881
  */
@@ -6840,6 +6920,10 @@ export interface TurnCompletedPayload {
6840
6920
  export interface ContentDeltaPayload {
6841
6921
  kind: ContentDeltaKind;
6842
6922
  delta: string;
6923
+ /**
6924
+ * SubagentID is set on a subagent's own output (subagent_types.go).
6925
+ */
6926
+ subagent_id?: string;
6843
6927
  }
6844
6928
  export type ContentDeltaKind = "text" | "reasoning";
6845
6929
  export declare const ContentDeltaText: ContentDeltaKind;
@@ -6850,6 +6934,10 @@ export interface ToolStartedPayload {
6850
6934
  tool_type?: ToolType;
6851
6935
  display_name?: string;
6852
6936
  arguments?: StringEncodedMap;
6937
+ /**
6938
+ * SubagentID is set on a subagent's own tool calls.
6939
+ */
6940
+ subagent_id?: string;
6853
6941
  }
6854
6942
  export interface ToolCompletedPayload {
6855
6943
  tool_invocation_id: string;
@@ -6857,12 +6945,21 @@ export interface ToolCompletedPayload {
6857
6945
  status: ToolInvocationStatus;
6858
6946
  result?: string;
6859
6947
  duration_ms?: number;
6948
+ /**
6949
+ * SubagentID is set on a subagent's own tool calls.
6950
+ */
6951
+ subagent_id?: string;
6860
6952
  }
6861
6953
  export interface ApprovalRequiredPayload {
6862
6954
  tool_invocation_id: string;
6863
6955
  tool_name: string;
6864
6956
  arguments?: StringEncodedMap;
6865
6957
  reason: InterruptReason;
6958
+ /**
6959
+ * SubagentID is set when a subagent asks: its tool call, not the
6960
+ * agent's.
6961
+ */
6962
+ subagent_id?: string;
6866
6963
  }
6867
6964
  export interface ApprovalResolvedPayload {
6868
6965
  tool_invocation_id: string;
@@ -6876,12 +6973,23 @@ export interface HookExecutedPayload {
6876
6973
  reason?: string;
6877
6974
  duration_ms?: number;
6878
6975
  }
6976
+ /**
6977
+ * UsageUpdatedPayload is what one turn used, emitted once when the turn
6978
+ * ends. PromptTokens counts every input token, cached or not:
6979
+ * CachedInputTokens (read from a prompt cache) and CacheCreationTokens
6980
+ * (written to one) are parts of it. ReasoningTokens is part of
6981
+ * CompletionTokens. CostUSD is the agent's own figure, 0 when it reports
6982
+ * none.
6983
+ */
6879
6984
  export interface UsageUpdatedPayload {
6880
6985
  prompt_tokens: number;
6881
6986
  completion_tokens: number;
6882
6987
  total_tokens: number;
6988
+ cached_input_tokens?: number;
6989
+ cache_creation_tokens?: number;
6883
6990
  reasoning_tokens?: number;
6884
6991
  cost_usd?: number;
6992
+ status?: TurnUsageStatus;
6885
6993
  }
6886
6994
  export interface ContextCompactedPayload {
6887
6995
  before_tokens: number;
@@ -7095,6 +7203,9 @@ export interface ToolResultEventData {
7095
7203
  export interface ErrorEventData {
7096
7204
  error: string;
7097
7205
  }
7206
+ export declare const AgentEventSubagentStarted: AgentEventType;
7207
+ export declare const AgentEventSubagentUpdated: AgentEventType;
7208
+ export declare const AgentEventSubagentCompleted: AgentEventType;
7098
7209
  /**
7099
7210
  * ToolInvocationStatus represents the execution status of a tool invocation
7100
7211
  */
@@ -7247,3 +7358,16 @@ export interface ToolParameterProperty {
7247
7358
  items?: ToolParameterProperty;
7248
7359
  required?: string[];
7249
7360
  }
7361
+ /**
7362
+ * TurnUsageStatus says how much of a turn's usage the agent reported.
7363
+ */
7364
+ export type TurnUsageStatus = "complete" | "partial";
7365
+ /**
7366
+ * TurnUsageComplete is the whole turn, as the agent counted it.
7367
+ */
7368
+ export declare const TurnUsageComplete: TurnUsageStatus;
7369
+ /**
7370
+ * TurnUsagePartial is what was reported before the turn ended early
7371
+ * (interrupted, failed).
7372
+ */
7373
+ 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
- * ScopeAdminPricing reads and changes store pricing: a version's
313
- * terms, its draft pricing (edit, evaluate, discard, publish, apply to
314
- * the listing) and the sample tasks drafts are evaluated against. Held
315
- * by an admin's own sign-in with platform power, and by a key of the
316
- * platform's automation account (ScopeDefinition.Automation).
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 ScopeAdminPricing = "admin:pricing";
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): a bounty program requires a saved
480
- * payment method and the caller's team has none. Meta is
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.22.0",
3
+ "version": "0.23.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
  }