@xenosystem/agent-sdk 0.9.27 → 0.9.29

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 (58) hide show
  1. package/THIRD_PARTY_NOTICES.md +89 -0
  2. package/dist/artifacts/index.cjs +6 -6
  3. package/dist/artifacts/index.js +6 -6
  4. package/dist/artifacts/metafile-cjs.json +1 -1
  5. package/dist/artifacts/metafile-esm.json +1 -1
  6. package/dist/automation/index.cjs +1 -1
  7. package/dist/automation/index.js +1 -1
  8. package/dist/automation/metafile-cjs.json +1 -1
  9. package/dist/automation/metafile-esm.json +1 -1
  10. package/dist/control-plane/index.cjs +7 -7
  11. package/dist/control-plane/index.js +7 -7
  12. package/dist/control-plane/metafile-cjs.json +1 -1
  13. package/dist/control-plane/metafile-esm.json +1 -1
  14. package/dist/control-room/index.cjs +1 -1
  15. package/dist/control-room/index.d.cts +2 -1
  16. package/dist/control-room/index.d.ts +2 -1
  17. package/dist/control-room/index.js +1 -1
  18. package/dist/control-room/metafile-cjs.json +1 -1
  19. package/dist/control-room/metafile-esm.json +1 -1
  20. package/dist/coordination/index.cjs +2 -2
  21. package/dist/coordination/index.d.cts +70 -4
  22. package/dist/coordination/index.d.ts +70 -4
  23. package/dist/coordination/index.js +2 -2
  24. package/dist/coordination/metafile-cjs.json +1 -1
  25. package/dist/coordination/metafile-esm.json +1 -1
  26. package/dist/electron/index.cjs +151 -151
  27. package/dist/electron/index.d.cts +96 -0
  28. package/dist/electron/index.d.ts +96 -0
  29. package/dist/electron/index.js +152 -152
  30. package/dist/electron/metafile-cjs.json +1 -1
  31. package/dist/electron/metafile-esm.json +1 -1
  32. package/dist/hosted/metafile-cjs.json +1 -1
  33. package/dist/hosted/metafile-esm.json +1 -1
  34. package/dist/index.cjs +336 -336
  35. package/dist/index.d.cts +558 -366
  36. package/dist/index.d.ts +558 -366
  37. package/dist/index.js +339 -339
  38. package/dist/metafile-cjs.json +1 -1
  39. package/dist/metafile-esm.json +1 -1
  40. package/dist/providers/index.cjs +10 -10
  41. package/dist/providers/index.d.cts +15 -1
  42. package/dist/providers/index.d.ts +15 -1
  43. package/dist/providers/index.js +10 -10
  44. package/dist/providers/metafile-cjs.json +1 -1
  45. package/dist/providers/metafile-esm.json +1 -1
  46. package/dist/recipes/index.cjs +1 -1
  47. package/dist/recipes/index.js +2 -2
  48. package/dist/recipes/metafile-cjs.json +1 -1
  49. package/dist/recipes/metafile-esm.json +1 -1
  50. package/dist/research/metafile-cjs.json +1 -1
  51. package/dist/research/metafile-esm.json +1 -1
  52. package/dist/session/index.cjs +24 -24
  53. package/dist/session/index.d.cts +49 -1
  54. package/dist/session/index.d.ts +49 -1
  55. package/dist/session/index.js +24 -24
  56. package/dist/session/metafile-cjs.json +1 -1
  57. package/dist/session/metafile-esm.json +1 -1
  58. package/package.json +2 -1
@@ -394,6 +394,7 @@ interface SessionMeta {
394
394
  lastActivity: string;
395
395
  workingDirectory: string;
396
396
  model: string;
397
+ executionMode?: ExecutionMode;
397
398
  parentSession?: string;
398
399
  checkpoints: string[];
399
400
  messageCount: number;
@@ -758,6 +759,13 @@ interface LlmClientDeps {
758
759
  readonly localRuntimeProtocol?: "openai-chat" | "ollama-native";
759
760
  readonly localTransportLimits?: ProviderTransportLimits;
760
761
  readonly apiKey?: string;
762
+ authorizeRequest?(target: {
763
+ method: string;
764
+ url: string;
765
+ }): Promise<{
766
+ authorization: string;
767
+ dpop?: string;
768
+ } | null>;
761
769
  readonly maxTokens: number;
762
770
  getApiRequestTimeoutMs(): number;
763
771
  buildRuntimeSystemPrompt(): string;
@@ -804,6 +812,7 @@ declare class LlmClient {
804
812
  private static getHeaderValue;
805
813
  private static stripHtml;
806
814
  private static summarizeErrorBody;
815
+ private authorizationHeaders;
807
816
  private createApiRequestSignal;
808
817
  callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
809
818
  callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
@@ -1100,6 +1109,54 @@ declare class AuditLogger {
1100
1109
  exportJson(targetPath: string): Promise<number>;
1101
1110
  flush(): Promise<void>;
1102
1111
  }
1112
+ interface ToolContinuationGoal {
1113
+ sessionId: string;
1114
+ goalId: string;
1115
+ requestId: string;
1116
+ }
1117
+ interface TranscriptBytePageOptions {
1118
+ cursor?: string;
1119
+ maxBytes?: number;
1120
+ direction?: "forward" | "backward";
1121
+ }
1122
+ interface TranscriptBytePage {
1123
+ encoding: "base64";
1124
+ content: string;
1125
+ direction: "forward" | "backward";
1126
+ offset: number;
1127
+ bytesRead: number;
1128
+ totalBytes: number;
1129
+ transcriptVersion: string;
1130
+ nextCursor: string | null;
1131
+ }
1132
+ interface TranscriptRecordPageOptions {
1133
+ cursor?: string;
1134
+ maxBytes?: number;
1135
+ maxRecords?: number;
1136
+ }
1137
+ interface TranscriptPageRecord {
1138
+ offset: number;
1139
+ bytes: number;
1140
+ event: Readonly<Record<string, unknown>> & {
1141
+ id: string;
1142
+ timestamp: string;
1143
+ type: string;
1144
+ sequence: number;
1145
+ };
1146
+ }
1147
+ interface TranscriptRecordPage {
1148
+ cursor: string;
1149
+ records: TranscriptPageRecord[];
1150
+ issues: Array<{
1151
+ code: "invalid_record" | "record_exceeds_page_budget";
1152
+ offset: number;
1153
+ bytes: number;
1154
+ }>;
1155
+ bytesRead: number;
1156
+ totalBytes: number;
1157
+ transcriptVersion: string;
1158
+ nextCursor: string | null;
1159
+ }
1103
1160
  declare class TranscriptWriter {
1104
1161
  private sessionDir;
1105
1162
  private sessionId;
@@ -1121,6 +1178,8 @@ declare class TranscriptWriter {
1121
1178
  private resolveWorkspaceMarkdownPath;
1122
1179
  private appendMarkdownEvent;
1123
1180
  private buildMarkdownDocument;
1181
+ readBytePage(options?: TranscriptBytePageOptions): Promise<TranscriptBytePage | null>;
1182
+ readRecordPage(options?: TranscriptRecordPageOptions): Promise<TranscriptRecordPage | null>;
1124
1183
  read(options?: {
1125
1184
  types?: TranscriptEventType[];
1126
1185
  limit?: number;
@@ -1173,6 +1232,7 @@ interface SessionCreateOptions {
1173
1232
  parentSession?: string;
1174
1233
  workingDirectory: string;
1175
1234
  model: string;
1235
+ executionMode?: ExecutionMode;
1176
1236
  hostBinding?: AgentSessionHostBindingV1;
1177
1237
  }
1178
1238
  interface SessionResumeOptions {
@@ -1270,6 +1330,23 @@ interface CompletionGuard {
1270
1330
  evaluate(ctx: CompletionGuardEvaluationContext): CompletionGuardDecision | null | undefined | Promise<CompletionGuardDecision | null | undefined>;
1271
1331
  }
1272
1332
  type CompressionLLMFn = (systemPrompt: string, messages: Message[]) => Promise<string>;
1333
+ interface ModelWorkRequestIdentity {
1334
+ requestId: string;
1335
+ turnId: string;
1336
+ iteration: number;
1337
+ model: string;
1338
+ }
1339
+ type ModelWorkSettlement = ModelWorkRequestIdentity & ({
1340
+ status: "metered";
1341
+ inputTokens: number;
1342
+ outputTokens: number;
1343
+ } | {
1344
+ status: "unknown";
1345
+ });
1346
+ interface ModelWorkAccounting {
1347
+ admit(request: Readonly<ModelWorkRequestIdentity>, signal: AbortSignal): void | Promise<void>;
1348
+ settle(result: Readonly<ModelWorkSettlement>, signal: AbortSignal): void | Promise<void>;
1349
+ }
1273
1350
  interface ModeSwitchRequest {
1274
1351
  from: ExecutionMode;
1275
1352
  to: ExecutionMode;
@@ -1278,6 +1355,13 @@ interface ModeSwitchRequest {
1278
1355
  }
1279
1356
  interface AgentLoopConfig {
1280
1357
  apiKey?: string;
1358
+ authorizeRequest?(target: {
1359
+ method: string;
1360
+ url: string;
1361
+ }): Promise<{
1362
+ authorization: string;
1363
+ dpop?: string;
1364
+ } | null>;
1281
1365
  baseURL: string;
1282
1366
  ollamaBaseURL?: string;
1283
1367
  localRuntimeUrl?: string;
@@ -1292,6 +1376,7 @@ interface AgentLoopConfig {
1292
1376
  systemPrompt: string;
1293
1377
  requesterLabel?: string;
1294
1378
  ownerSessionId?: string;
1379
+ getOwnerSessionId?: () => string | undefined;
1295
1380
  executionMode?: ExecutionMode;
1296
1381
  permissionEngine: PermissionEngine;
1297
1382
  toolRegistry?: ToolRegistry;
@@ -1300,6 +1385,7 @@ interface AgentLoopConfig {
1300
1385
  onToolWillExecute?: (name: string, input: Record<string, unknown>) => void | Promise<void>;
1301
1386
  onToolEnd?: (name: string, result: ToolResult) => void;
1302
1387
  onIteration?: (iteration: number, totalTokens: number) => void;
1388
+ modelWorkAccounting?: ModelWorkAccounting;
1303
1389
  onError?: (error: Error, context: string) => void;
1304
1390
  onTranscriptError?: (error: Error, context: string) => void;
1305
1391
  onModeSwitchRequest?: (request: ModeSwitchRequest) => Promise<boolean>;
@@ -1383,12 +1469,16 @@ interface SessionIntegrationConfig {
1383
1469
  }
1384
1470
  interface AgentRunOptions {
1385
1471
  messageId?: string;
1472
+ goalTurn?: ToolContinuationGoal;
1473
+ continuationId?: string;
1386
1474
  }
1387
1475
  declare class AgentLoop {
1388
1476
  private config;
1389
1477
  private toolRegistry;
1390
1478
  private _messages;
1391
1479
  private totalInputTokens;
1480
+ private modelWorkAttemptedRequests;
1481
+ private modelWorkMeteredRequests;
1392
1482
  private totalOutputTokens;
1393
1483
  private lastRequestInputTokens;
1394
1484
  private pendingContextInjections;
@@ -1398,6 +1488,7 @@ declare class AgentLoop {
1398
1488
  private interruptionRequested;
1399
1489
  private currentTraceId;
1400
1490
  private lastRunTraceId;
1491
+ private currentOwnerSessionId;
1401
1492
  private lastRunTerminationInfo;
1402
1493
  private activeTaskPrompt;
1403
1494
  private activeToolPolicy;
@@ -1424,6 +1515,11 @@ declare class AgentLoop {
1424
1515
  output: number;
1425
1516
  total: number;
1426
1517
  };
1518
+ get modelWorkUsage(): {
1519
+ attemptedRequests: number;
1520
+ meteredRequests: number;
1521
+ coverageComplete: boolean;
1522
+ };
1427
1523
  get lastTraceId(): string | null;
1428
1524
  get lastRunTermination(): AgentRunTermination | null;
1429
1525
  get queryState(): QueryState;
@@ -394,6 +394,7 @@ interface SessionMeta {
394
394
  lastActivity: string;
395
395
  workingDirectory: string;
396
396
  model: string;
397
+ executionMode?: ExecutionMode;
397
398
  parentSession?: string;
398
399
  checkpoints: string[];
399
400
  messageCount: number;
@@ -758,6 +759,13 @@ interface LlmClientDeps {
758
759
  readonly localRuntimeProtocol?: "openai-chat" | "ollama-native";
759
760
  readonly localTransportLimits?: ProviderTransportLimits;
760
761
  readonly apiKey?: string;
762
+ authorizeRequest?(target: {
763
+ method: string;
764
+ url: string;
765
+ }): Promise<{
766
+ authorization: string;
767
+ dpop?: string;
768
+ } | null>;
761
769
  readonly maxTokens: number;
762
770
  getApiRequestTimeoutMs(): number;
763
771
  buildRuntimeSystemPrompt(): string;
@@ -804,6 +812,7 @@ declare class LlmClient {
804
812
  private static getHeaderValue;
805
813
  private static stripHtml;
806
814
  private static summarizeErrorBody;
815
+ private authorizationHeaders;
807
816
  private createApiRequestSignal;
808
817
  callChatCompletionsNonStream(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
809
818
  callChatCompletions(model: string, apiMessages: ApiMessage[], tools: ToolDefinition[], onText?: (text: string) => void, signal?: AbortSignal): Promise<StreamResult>;
@@ -1100,6 +1109,54 @@ declare class AuditLogger {
1100
1109
  exportJson(targetPath: string): Promise<number>;
1101
1110
  flush(): Promise<void>;
1102
1111
  }
1112
+ interface ToolContinuationGoal {
1113
+ sessionId: string;
1114
+ goalId: string;
1115
+ requestId: string;
1116
+ }
1117
+ interface TranscriptBytePageOptions {
1118
+ cursor?: string;
1119
+ maxBytes?: number;
1120
+ direction?: "forward" | "backward";
1121
+ }
1122
+ interface TranscriptBytePage {
1123
+ encoding: "base64";
1124
+ content: string;
1125
+ direction: "forward" | "backward";
1126
+ offset: number;
1127
+ bytesRead: number;
1128
+ totalBytes: number;
1129
+ transcriptVersion: string;
1130
+ nextCursor: string | null;
1131
+ }
1132
+ interface TranscriptRecordPageOptions {
1133
+ cursor?: string;
1134
+ maxBytes?: number;
1135
+ maxRecords?: number;
1136
+ }
1137
+ interface TranscriptPageRecord {
1138
+ offset: number;
1139
+ bytes: number;
1140
+ event: Readonly<Record<string, unknown>> & {
1141
+ id: string;
1142
+ timestamp: string;
1143
+ type: string;
1144
+ sequence: number;
1145
+ };
1146
+ }
1147
+ interface TranscriptRecordPage {
1148
+ cursor: string;
1149
+ records: TranscriptPageRecord[];
1150
+ issues: Array<{
1151
+ code: "invalid_record" | "record_exceeds_page_budget";
1152
+ offset: number;
1153
+ bytes: number;
1154
+ }>;
1155
+ bytesRead: number;
1156
+ totalBytes: number;
1157
+ transcriptVersion: string;
1158
+ nextCursor: string | null;
1159
+ }
1103
1160
  declare class TranscriptWriter {
1104
1161
  private sessionDir;
1105
1162
  private sessionId;
@@ -1121,6 +1178,8 @@ declare class TranscriptWriter {
1121
1178
  private resolveWorkspaceMarkdownPath;
1122
1179
  private appendMarkdownEvent;
1123
1180
  private buildMarkdownDocument;
1181
+ readBytePage(options?: TranscriptBytePageOptions): Promise<TranscriptBytePage | null>;
1182
+ readRecordPage(options?: TranscriptRecordPageOptions): Promise<TranscriptRecordPage | null>;
1124
1183
  read(options?: {
1125
1184
  types?: TranscriptEventType[];
1126
1185
  limit?: number;
@@ -1173,6 +1232,7 @@ interface SessionCreateOptions {
1173
1232
  parentSession?: string;
1174
1233
  workingDirectory: string;
1175
1234
  model: string;
1235
+ executionMode?: ExecutionMode;
1176
1236
  hostBinding?: AgentSessionHostBindingV1;
1177
1237
  }
1178
1238
  interface SessionResumeOptions {
@@ -1270,6 +1330,23 @@ interface CompletionGuard {
1270
1330
  evaluate(ctx: CompletionGuardEvaluationContext): CompletionGuardDecision | null | undefined | Promise<CompletionGuardDecision | null | undefined>;
1271
1331
  }
1272
1332
  type CompressionLLMFn = (systemPrompt: string, messages: Message[]) => Promise<string>;
1333
+ interface ModelWorkRequestIdentity {
1334
+ requestId: string;
1335
+ turnId: string;
1336
+ iteration: number;
1337
+ model: string;
1338
+ }
1339
+ type ModelWorkSettlement = ModelWorkRequestIdentity & ({
1340
+ status: "metered";
1341
+ inputTokens: number;
1342
+ outputTokens: number;
1343
+ } | {
1344
+ status: "unknown";
1345
+ });
1346
+ interface ModelWorkAccounting {
1347
+ admit(request: Readonly<ModelWorkRequestIdentity>, signal: AbortSignal): void | Promise<void>;
1348
+ settle(result: Readonly<ModelWorkSettlement>, signal: AbortSignal): void | Promise<void>;
1349
+ }
1273
1350
  interface ModeSwitchRequest {
1274
1351
  from: ExecutionMode;
1275
1352
  to: ExecutionMode;
@@ -1278,6 +1355,13 @@ interface ModeSwitchRequest {
1278
1355
  }
1279
1356
  interface AgentLoopConfig {
1280
1357
  apiKey?: string;
1358
+ authorizeRequest?(target: {
1359
+ method: string;
1360
+ url: string;
1361
+ }): Promise<{
1362
+ authorization: string;
1363
+ dpop?: string;
1364
+ } | null>;
1281
1365
  baseURL: string;
1282
1366
  ollamaBaseURL?: string;
1283
1367
  localRuntimeUrl?: string;
@@ -1292,6 +1376,7 @@ interface AgentLoopConfig {
1292
1376
  systemPrompt: string;
1293
1377
  requesterLabel?: string;
1294
1378
  ownerSessionId?: string;
1379
+ getOwnerSessionId?: () => string | undefined;
1295
1380
  executionMode?: ExecutionMode;
1296
1381
  permissionEngine: PermissionEngine;
1297
1382
  toolRegistry?: ToolRegistry;
@@ -1300,6 +1385,7 @@ interface AgentLoopConfig {
1300
1385
  onToolWillExecute?: (name: string, input: Record<string, unknown>) => void | Promise<void>;
1301
1386
  onToolEnd?: (name: string, result: ToolResult) => void;
1302
1387
  onIteration?: (iteration: number, totalTokens: number) => void;
1388
+ modelWorkAccounting?: ModelWorkAccounting;
1303
1389
  onError?: (error: Error, context: string) => void;
1304
1390
  onTranscriptError?: (error: Error, context: string) => void;
1305
1391
  onModeSwitchRequest?: (request: ModeSwitchRequest) => Promise<boolean>;
@@ -1383,12 +1469,16 @@ interface SessionIntegrationConfig {
1383
1469
  }
1384
1470
  interface AgentRunOptions {
1385
1471
  messageId?: string;
1472
+ goalTurn?: ToolContinuationGoal;
1473
+ continuationId?: string;
1386
1474
  }
1387
1475
  declare class AgentLoop {
1388
1476
  private config;
1389
1477
  private toolRegistry;
1390
1478
  private _messages;
1391
1479
  private totalInputTokens;
1480
+ private modelWorkAttemptedRequests;
1481
+ private modelWorkMeteredRequests;
1392
1482
  private totalOutputTokens;
1393
1483
  private lastRequestInputTokens;
1394
1484
  private pendingContextInjections;
@@ -1398,6 +1488,7 @@ declare class AgentLoop {
1398
1488
  private interruptionRequested;
1399
1489
  private currentTraceId;
1400
1490
  private lastRunTraceId;
1491
+ private currentOwnerSessionId;
1401
1492
  private lastRunTerminationInfo;
1402
1493
  private activeTaskPrompt;
1403
1494
  private activeToolPolicy;
@@ -1424,6 +1515,11 @@ declare class AgentLoop {
1424
1515
  output: number;
1425
1516
  total: number;
1426
1517
  };
1518
+ get modelWorkUsage(): {
1519
+ attemptedRequests: number;
1520
+ meteredRequests: number;
1521
+ coverageComplete: boolean;
1522
+ };
1427
1523
  get lastTraceId(): string | null;
1428
1524
  get lastRunTermination(): AgentRunTermination | null;
1429
1525
  get queryState(): QueryState;