@xenosystem/agent-sdk 0.10.15 → 0.10.17

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 (47) hide show
  1. package/dist/artifacts/index.cjs +1 -1
  2. package/dist/artifacts/index.js +1 -1
  3. package/dist/automation/index.cjs +1 -1
  4. package/dist/automation/index.d.cts +11 -1
  5. package/dist/automation/index.d.ts +11 -1
  6. package/dist/automation/index.js +1 -1
  7. package/dist/control-plane/index.cjs +1 -1
  8. package/dist/control-plane/index.js +1 -1
  9. package/dist/electron/index.cjs +174 -174
  10. package/dist/electron/index.d.cts +24 -3
  11. package/dist/electron/index.d.ts +24 -3
  12. package/dist/electron/index.js +174 -174
  13. package/dist/electron/metafile-cjs.json +1 -1
  14. package/dist/electron/metafile-esm.json +1 -1
  15. package/dist/governance/index.d.cts +10 -1
  16. package/dist/governance/index.d.ts +10 -1
  17. package/dist/hosted/index.cjs +1 -1
  18. package/dist/hosted/index.js +1 -1
  19. package/dist/hosted/metafile-cjs.json +1 -1
  20. package/dist/hosted/metafile-esm.json +1 -1
  21. package/dist/index.cjs +347 -347
  22. package/dist/index.d.cts +78 -5
  23. package/dist/index.d.ts +78 -5
  24. package/dist/index.js +347 -347
  25. package/dist/mcp/index.d.cts +11 -1
  26. package/dist/mcp/index.d.ts +11 -1
  27. package/dist/metafile-cjs.json +1 -1
  28. package/dist/metafile-esm.json +1 -1
  29. package/dist/providers/index.d.cts +1 -0
  30. package/dist/providers/index.d.ts +1 -0
  31. package/dist/session/index.cjs +16 -16
  32. package/dist/session/index.d.cts +10 -1
  33. package/dist/session/index.d.ts +10 -1
  34. package/dist/session/index.js +14 -14
  35. package/dist/session/metafile-cjs.json +1 -1
  36. package/dist/session/metafile-esm.json +1 -1
  37. package/dist/skills/index.d.cts +11 -1
  38. package/dist/skills/index.d.ts +11 -1
  39. package/dist/ui/index.cjs +3 -3
  40. package/dist/ui/index.d.cts +10 -1
  41. package/dist/ui/index.d.ts +10 -1
  42. package/dist/ui/index.js +3 -3
  43. package/dist/ui/metafile-cjs.json +1 -1
  44. package/dist/ui/metafile-esm.json +1 -1
  45. package/dist/utils/index.d.cts +10 -1
  46. package/dist/utils/index.d.ts +10 -1
  47. package/package.json +1 -1
@@ -176,7 +176,16 @@ interface ResourceContentBlock {
176
176
  }
177
177
  type ToolAssistantContentBlock = TextBlock | ImageUrlBlock | ResourceContentBlock;
178
178
  type ToolResultContent = string | ToolAssistantContentBlock[];
179
- type ToolOperationState = "registered" | "starting" | "running_foreground" | "running_background" | "waiting_for_input" | "stalled" | "verifying" | "completed" | "failed" | "timed_out" | "cancelled" | "orphaned";
179
+ declare const TOOL_OPERATION_TERMINAL_STATES: readonly [
180
+ "completed",
181
+ "failed",
182
+ "timed_out",
183
+ "cancelled",
184
+ "outcome_unknown",
185
+ "orphaned"
186
+ ];
187
+ type ToolOperationTerminalState = (typeof TOOL_OPERATION_TERMINAL_STATES)[number];
188
+ type ToolOperationState = "registered" | "starting" | "running_foreground" | "running_background" | "waiting_for_input" | "stalled" | "verifying" | ToolOperationTerminalState;
180
189
  type ToolCompletionPolicy = "await" | "observe" | "detach";
181
190
  interface ExpectedOutputContract {
182
191
  path: string;
@@ -282,6 +291,7 @@ interface ToolPolicyProjection {
282
291
  interface RegisteredTool {
283
292
  definition: ToolDefinition;
284
293
  execute: ToolExecutor;
294
+ readOnly?: boolean;
285
295
  projectPolicyInput?: (input: Record<string, unknown>) => ToolPolicyProjection | {
286
296
  error: ToolResult;
287
297
  };
@@ -754,6 +764,7 @@ interface StreamResult {
754
764
  inputTokens: number;
755
765
  outputTokens: number;
756
766
  usageReported: boolean;
767
+ incompleteToolCallIds?: string[];
757
768
  }
758
769
  interface ApiRequestFailureDiagnostics {
759
770
  model: string;
@@ -785,6 +796,10 @@ interface LlmClientDeps {
785
796
  } | null>;
786
797
  readonly maxTokens: number;
787
798
  getApiRequestTimeoutMs(): number;
799
+ getStreamDeadlines?(): {
800
+ firstResponseMs?: number;
801
+ idleMs?: number;
802
+ };
788
803
  buildRuntimeSystemPrompt(): string;
789
804
  reportFailure(diagnostics: ApiRequestFailureDiagnostics): Promise<void>;
790
805
  }
@@ -831,8 +846,10 @@ declare class LlmClient {
831
846
  private static stripHtml;
832
847
  private static summarizeErrorBody;
833
848
  private authorizationHeaders;
834
- private createApiRequestSignal;
849
+ private createRequestDeadline;
850
+ private static normalizeRequestError;
835
851
  callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
852
+ private throwForErrorResponse;
836
853
  callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
837
854
  callOllama(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
838
855
  }
@@ -922,7 +939,7 @@ interface LLMProvider {
922
939
  }
923
940
  type QueryState = "idle" | "preparing" | "building_context" | "requesting_model" | "retrying" | "executing_tools" | "waiting_for_tool" | "evaluating_completion" | "finalizing" | "suspended" | "completed" | "failed" | "interrupted";
924
941
  type QueryWatchdogReason = "idle" | "lease" | "hard";
925
- type ToolOperationRuntimeEventType = "tool.operation.started" | "tool.operation.progress" | "tool.operation.promotion_requested" | "tool.operation.promoted" | "tool.operation.stalled" | "tool.operation.verifying" | "tool.operation.completed" | "tool.operation.failed" | "tool.operation.timed_out" | "tool.operation.cancelled";
942
+ type ToolOperationRuntimeEventType = "tool.operation.started" | "tool.operation.progress" | "tool.operation.promotion_requested" | "tool.operation.promoted" | "tool.operation.stalled" | "tool.operation.verifying" | "tool.operation.completed" | "tool.operation.failed" | "tool.operation.timed_out" | "tool.operation.cancelled" | "tool.operation.outcome_unknown";
926
943
  type XenoRuntimeEventType = "thread.started" | "turn.started" | "turn.completed" | "turn.failed" | "turn.interrupted" | "query.state" | "query.watchdog" | "provider.event" | "model.text.delta" | "context.pressure" | "context.injected" | "context.history.compacted" | "tool.started" | "tool.permission" | "tool.completed" | "tool.history.repaired" | "tool.failure_guard.tripped" | ToolOperationRuntimeEventType | "turn.suspended" | "turn.continuation_enqueued" | "turn.continuation_resumed" | "turn.continuation_exhausted" | "diff.completed";
927
944
  interface XenoRuntimeEventBase {
928
945
  id: string;
@@ -1441,6 +1458,9 @@ interface AgentLoopConfig {
1441
1458
  maxCompletionGuardReminders?: number;
1442
1459
  progressGuardEveryIterations?: number;
1443
1460
  apiRequestTimeoutMs?: number;
1461
+ apiFirstResponseTimeoutMs?: number;
1462
+ apiStreamIdleTimeoutMs?: number;
1463
+ streamAgentResponses?: boolean;
1444
1464
  queryIdleTimeoutMs?: number;
1445
1465
  queryLeaseTimeoutMs?: number;
1446
1466
  queryHardTimeoutMs?: number;
@@ -1564,6 +1584,7 @@ declare class AgentLoop {
1564
1584
  };
1565
1585
  createSoftBudgetCloudProvider(): LLMProvider;
1566
1586
  private callCloudWithOutputCap;
1587
+ private requestStreams;
1567
1588
  configureModelExecution(options: {
1568
1589
  provider?: LLMProvider;
1569
1590
  modelWorkAccounting?: ModelWorkAccounting;
@@ -176,7 +176,16 @@ interface ResourceContentBlock {
176
176
  }
177
177
  type ToolAssistantContentBlock = TextBlock | ImageUrlBlock | ResourceContentBlock;
178
178
  type ToolResultContent = string | ToolAssistantContentBlock[];
179
- type ToolOperationState = "registered" | "starting" | "running_foreground" | "running_background" | "waiting_for_input" | "stalled" | "verifying" | "completed" | "failed" | "timed_out" | "cancelled" | "orphaned";
179
+ declare const TOOL_OPERATION_TERMINAL_STATES: readonly [
180
+ "completed",
181
+ "failed",
182
+ "timed_out",
183
+ "cancelled",
184
+ "outcome_unknown",
185
+ "orphaned"
186
+ ];
187
+ type ToolOperationTerminalState = (typeof TOOL_OPERATION_TERMINAL_STATES)[number];
188
+ type ToolOperationState = "registered" | "starting" | "running_foreground" | "running_background" | "waiting_for_input" | "stalled" | "verifying" | ToolOperationTerminalState;
180
189
  type ToolCompletionPolicy = "await" | "observe" | "detach";
181
190
  interface ExpectedOutputContract {
182
191
  path: string;
@@ -282,6 +291,7 @@ interface ToolPolicyProjection {
282
291
  interface RegisteredTool {
283
292
  definition: ToolDefinition;
284
293
  execute: ToolExecutor;
294
+ readOnly?: boolean;
285
295
  projectPolicyInput?: (input: Record<string, unknown>) => ToolPolicyProjection | {
286
296
  error: ToolResult;
287
297
  };
@@ -754,6 +764,7 @@ interface StreamResult {
754
764
  inputTokens: number;
755
765
  outputTokens: number;
756
766
  usageReported: boolean;
767
+ incompleteToolCallIds?: string[];
757
768
  }
758
769
  interface ApiRequestFailureDiagnostics {
759
770
  model: string;
@@ -785,6 +796,10 @@ interface LlmClientDeps {
785
796
  } | null>;
786
797
  readonly maxTokens: number;
787
798
  getApiRequestTimeoutMs(): number;
799
+ getStreamDeadlines?(): {
800
+ firstResponseMs?: number;
801
+ idleMs?: number;
802
+ };
788
803
  buildRuntimeSystemPrompt(): string;
789
804
  reportFailure(diagnostics: ApiRequestFailureDiagnostics): Promise<void>;
790
805
  }
@@ -831,8 +846,10 @@ declare class LlmClient {
831
846
  private static stripHtml;
832
847
  private static summarizeErrorBody;
833
848
  private authorizationHeaders;
834
- private createApiRequestSignal;
849
+ private createRequestDeadline;
850
+ private static normalizeRequestError;
835
851
  callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
852
+ private throwForErrorResponse;
836
853
  callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal, maxOutputTokens?: number): Promise<StreamResult>;
837
854
  callOllama(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
838
855
  }
@@ -922,7 +939,7 @@ interface LLMProvider {
922
939
  }
923
940
  type QueryState = "idle" | "preparing" | "building_context" | "requesting_model" | "retrying" | "executing_tools" | "waiting_for_tool" | "evaluating_completion" | "finalizing" | "suspended" | "completed" | "failed" | "interrupted";
924
941
  type QueryWatchdogReason = "idle" | "lease" | "hard";
925
- type ToolOperationRuntimeEventType = "tool.operation.started" | "tool.operation.progress" | "tool.operation.promotion_requested" | "tool.operation.promoted" | "tool.operation.stalled" | "tool.operation.verifying" | "tool.operation.completed" | "tool.operation.failed" | "tool.operation.timed_out" | "tool.operation.cancelled";
942
+ type ToolOperationRuntimeEventType = "tool.operation.started" | "tool.operation.progress" | "tool.operation.promotion_requested" | "tool.operation.promoted" | "tool.operation.stalled" | "tool.operation.verifying" | "tool.operation.completed" | "tool.operation.failed" | "tool.operation.timed_out" | "tool.operation.cancelled" | "tool.operation.outcome_unknown";
926
943
  type XenoRuntimeEventType = "thread.started" | "turn.started" | "turn.completed" | "turn.failed" | "turn.interrupted" | "query.state" | "query.watchdog" | "provider.event" | "model.text.delta" | "context.pressure" | "context.injected" | "context.history.compacted" | "tool.started" | "tool.permission" | "tool.completed" | "tool.history.repaired" | "tool.failure_guard.tripped" | ToolOperationRuntimeEventType | "turn.suspended" | "turn.continuation_enqueued" | "turn.continuation_resumed" | "turn.continuation_exhausted" | "diff.completed";
927
944
  interface XenoRuntimeEventBase {
928
945
  id: string;
@@ -1441,6 +1458,9 @@ interface AgentLoopConfig {
1441
1458
  maxCompletionGuardReminders?: number;
1442
1459
  progressGuardEveryIterations?: number;
1443
1460
  apiRequestTimeoutMs?: number;
1461
+ apiFirstResponseTimeoutMs?: number;
1462
+ apiStreamIdleTimeoutMs?: number;
1463
+ streamAgentResponses?: boolean;
1444
1464
  queryIdleTimeoutMs?: number;
1445
1465
  queryLeaseTimeoutMs?: number;
1446
1466
  queryHardTimeoutMs?: number;
@@ -1564,6 +1584,7 @@ declare class AgentLoop {
1564
1584
  };
1565
1585
  createSoftBudgetCloudProvider(): LLMProvider;
1566
1586
  private callCloudWithOutputCap;
1587
+ private requestStreams;
1567
1588
  configureModelExecution(options: {
1568
1589
  provider?: LLMProvider;
1569
1590
  modelWorkAccounting?: ModelWorkAccounting;