@agentknight/sdk 0.9.57 → 0.9.59

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 (23) hide show
  1. package/dist/chunks/{acp-adapter-WYDK3PLS.js → acp-adapter-OGD5QSNI.js} +4 -4
  2. package/dist/chunks/{chunk-WPVH7HKC.js → chunk-2MERNOK6.js} +1 -1
  3. package/dist/chunks/{chunk-7ZYBES47.js → chunk-3OIHMMDF.js} +1 -1
  4. package/dist/chunks/{chunk-3LEPYV7Y.js → chunk-5DVJ7Y5W.js} +2 -2
  5. package/dist/chunks/{chunk-USI66MEF.js → chunk-AREU4R62.js} +3 -2
  6. package/dist/chunks/{chunk-ZLKFFKAX.js → chunk-DP5KVGWF.js} +4 -3
  7. package/dist/chunks/{chunk-DAKDVZ7X.js → chunk-FDUJP3WA.js} +2 -2
  8. package/dist/chunks/{chunk-KBI5IWPR.js → chunk-LO4ZRE77.js} +747 -513
  9. package/dist/chunks/{chunk-OOCAIULD.js → chunk-LWJNDBIM.js} +431 -21
  10. package/dist/chunks/{chunk-IPJWNGNK.js → chunk-NDEJOXSX.js} +1 -1
  11. package/dist/chunks/{chunk-EDZPP6SJ.js → chunk-X3ZG6WMN.js} +2 -3
  12. package/dist/chunks/{chunk-LT5ULDVT.js → chunk-ZDKBJFA2.js} +1 -1
  13. package/dist/chunks/{claude-adapter-GCH36EZ6.js → claude-adapter-DGZBZSWJ.js} +209 -59
  14. package/dist/chunks/{codex-adapter-CXD4SVCE.js → codex-adapter-2W7RRER3.js} +4 -4
  15. package/dist/chunks/{copilot-adapter-SYFGOAGE.js → copilot-adapter-ZEHU6CFQ.js} +109 -14
  16. package/dist/chunks/{managed-agent-adapter-ODCNYYO6.js → managed-agent-adapter-CGJPJZ2Z.js} +20 -6
  17. package/dist/chunks/{pi-adapter-XLY46UDL.js → pi-adapter-WOVSWBGG.js} +4 -4
  18. package/dist/configuration.js +4 -4
  19. package/dist/index.d.ts +126 -1
  20. package/dist/index.js +1447 -562
  21. package/dist/runtime.js +2 -2
  22. package/dist/session-analytics-worker.js +162 -51
  23. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  AgentSelectionSchema,
3
3
  assertSelectionSnapshotFits
4
- } from "./chunk-DAKDVZ7X.js";
4
+ } from "./chunk-FDUJP3WA.js";
5
5
  import {
6
6
  isResearchSessionId
7
- } from "./chunk-WPVH7HKC.js";
7
+ } from "./chunk-2MERNOK6.js";
8
8
  import {
9
9
  GroupChatError
10
- } from "./chunk-EDZPP6SJ.js";
10
+ } from "./chunk-X3ZG6WMN.js";
11
11
  import {
12
12
  AgentModelListingError,
13
13
  AgentSessionRenameError,
@@ -15,14 +15,14 @@ import {
15
15
  UnsupportedAgentOperationError,
16
16
  captureWorkbenchAccess,
17
17
  validateSessionName
18
- } from "./chunk-3LEPYV7Y.js";
18
+ } from "./chunk-5DVJ7Y5W.js";
19
19
  import {
20
20
  SessionOperationError
21
- } from "./chunk-7ZYBES47.js";
21
+ } from "./chunk-3OIHMMDF.js";
22
22
  import {
23
23
  InteractionResponseSchema,
24
24
  SessionSummarySchema
25
- } from "./chunk-KBI5IWPR.js";
25
+ } from "./chunk-LO4ZRE77.js";
26
26
 
27
27
  // src/managed-agent-adapter.ts
28
28
  import { createHash, randomUUID } from "node:crypto";
@@ -166,6 +166,12 @@ var ManagedCodingAgentAdapter = class {
166
166
  queue: (id) => this.#withWorkbench(id, (runtime, native) => runtime.queue(native)),
167
167
  mutateQueue: (id, request) => this.#withWorkbench(id, (runtime, native) => runtime.mutateQueue(native, request)),
168
168
  insights: (id) => this.#withWorkbench(id, (runtime, native) => runtime.insights(native)),
169
+ reasoning: (id, request) => this.#withWorkbench(id, (runtime, native) => {
170
+ if (runtime.reasoning === void 0) {
171
+ throw new SessionOperationError("AGENT_OPERATION_UNSUPPORTED", "This agent does not expose thinking history");
172
+ }
173
+ return runtime.reasoning(native, request);
174
+ }, false),
169
175
  analytics: (id, request) => this.#withWorkbench(id, (runtime, native) => {
170
176
  if (runtime.analytics === void 0) {
171
177
  throw new SessionOperationError("ANALYTICS_UNSUPPORTED", "This agent does not expose passive analytics");
@@ -332,6 +338,14 @@ var ManagedCodingAgentAdapter = class {
332
338
  this.#inventoryChanged();
333
339
  }
334
340
  }
341
+ assertPeerSession(id) {
342
+ const route = this.#route(id);
343
+ if (!this.#peerChatPreference || route.provider.candidate.id !== "copilot" || route.runtime.runPeerTurn === void 0 || isResearchSessionId(route.nativeId) || route.provider.sessions.get(id)?.groupChat !== void 0) {
344
+ throw new UnsupportedAgentOperationError(route.provider.candidate.id, "peer session turns");
345
+ }
346
+ this.#assertRoute(route);
347
+ route.runtime.assertPeerSession?.(route.nativeId);
348
+ }
335
349
  async runPeerTurn(id, prompt, options) {
336
350
  if (!this.#peerChatPreference) throw new Error("Peer chat is disabled");
337
351
  options.signal.throwIfAborted();
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-IPJWNGNK.js";
3
+ } from "./chunk-NDEJOXSX.js";
4
4
  import {
5
5
  AgentSessionRenameError,
6
6
  UnsupportedAgentOperationError,
7
7
  validateSessionName
8
- } from "./chunk-3LEPYV7Y.js";
9
- import "./chunk-7ZYBES47.js";
8
+ } from "./chunk-5DVJ7Y5W.js";
9
+ import "./chunk-3OIHMMDF.js";
10
10
  import {
11
11
  InteractionRequestSchema,
12
12
  REASONING_EFFORTS,
13
13
  SESSION_TIMELINE_PAGE_SIZE
14
- } from "./chunk-KBI5IWPR.js";
14
+ } from "./chunk-LO4ZRE77.js";
15
15
 
16
16
  // src/pi-adapter.ts
17
17
  import { createHash as createHash2, randomUUID } from "node:crypto";
@@ -5,16 +5,16 @@ import {
5
5
  } from "./chunks/chunk-XPHAIOKN.js";
6
6
  import {
7
7
  AgentSelectionSchema
8
- } from "./chunks/chunk-DAKDVZ7X.js";
8
+ } from "./chunks/chunk-FDUJP3WA.js";
9
9
  import {
10
10
  SessionImageRelayUrlSchema,
11
11
  SessionImagesConfigSchema
12
12
  } from "./chunks/chunk-IJPJQF7S.js";
13
13
  import {
14
14
  CODING_AGENT_IDS
15
- } from "./chunks/chunk-3LEPYV7Y.js";
16
- import "./chunks/chunk-7ZYBES47.js";
17
- import "./chunks/chunk-KBI5IWPR.js";
15
+ } from "./chunks/chunk-5DVJ7Y5W.js";
16
+ import "./chunks/chunk-3OIHMMDF.js";
17
+ import "./chunks/chunk-LO4ZRE77.js";
18
18
  export {
19
19
  AgentSelectionSchema,
20
20
  CODING_AGENT_IDS,
package/dist/index.d.ts CHANGED
@@ -449,6 +449,7 @@ declare const A2aRelayRequestSchema: z.ZodObject<{
449
449
  endpointUrl: z.ZodURL;
450
450
  kind: z.ZodEnum<{
451
451
  card: "card";
452
+ encrypted: "encrypted";
452
453
  rpc: "rpc";
453
454
  }>;
454
455
  body: z.ZodString;
@@ -458,6 +459,7 @@ type A2aRelayRequest = z.infer<typeof A2aRelayRequestSchema>;
458
459
  declare const A2aRelayResponseSchema: z.ZodObject<{
459
460
  status: z.ZodNumber;
460
461
  body: z.ZodString;
462
+ encrypted: z.ZodOptional<z.ZodLiteral<true>>;
461
463
  }, z.core.$strict>;
462
464
  type A2aRelayResponse = z.infer<typeof A2aRelayResponseSchema>;
463
465
 
@@ -482,6 +484,14 @@ interface V2ServerToClientEvents {
482
484
  "protocol.error": (payload: ProtocolError) => void;
483
485
  }
484
486
 
487
+ declare const EncryptedGroupCreateSchema: z.ZodObject<{
488
+ groupId: z.ZodUUID;
489
+ peerMachineId: z.ZodString;
490
+ peerSessionId: z.ZodString;
491
+ peerTitle: z.ZodString;
492
+ }, z.core.$strict>;
493
+ type EncryptedGroupCreate = z.infer<typeof EncryptedGroupCreateSchema>;
494
+
485
495
  declare const SessionGitProjectSchema: z.ZodObject<{
486
496
  localRepositoryKey: z.ZodString;
487
497
  worktreeRoot: z.ZodString;
@@ -1431,9 +1441,78 @@ declare const WorkbenchInsightsSchema: z.ZodObject<{
1431
1441
  systemTokens: z.ZodOptional<z.ZodNumber>;
1432
1442
  conversationTokens: z.ZodOptional<z.ZodNumber>;
1433
1443
  toolTokens: z.ZodOptional<z.ZodNumber>;
1444
+ displayLimit: z.ZodOptional<z.ZodNumber>;
1445
+ compactionThreshold: z.ZodOptional<z.ZodNumber>;
1434
1446
  }, z.core.$strict>>;
1435
1447
  canCompact: z.ZodBoolean;
1436
1448
  compactUnavailableReason: z.ZodOptional<z.ZodString>;
1449
+ composition: z.ZodOptional<z.ZodArray<z.ZodObject<{
1450
+ kind: z.ZodString;
1451
+ count: z.ZodNumber;
1452
+ }, z.core.$strict>>>;
1453
+ sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
1454
+ id: z.ZodString;
1455
+ kind: z.ZodString;
1456
+ label: z.ZodString;
1457
+ tokens: z.ZodNumber;
1458
+ parentId: z.ZodOptional<z.ZodString>;
1459
+ }, z.core.$strict>>>;
1460
+ sourcesTruncated: z.ZodOptional<z.ZodBoolean>;
1461
+ heaviestMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
1462
+ id: z.ZodString;
1463
+ kind: z.ZodString;
1464
+ label: z.ZodString;
1465
+ tokens: z.ZodNumber;
1466
+ parentId: z.ZodOptional<z.ZodString>;
1467
+ }, z.core.$strict>>>;
1468
+ compactionCount: z.ZodOptional<z.ZodNumber>;
1469
+ telemetry: z.ZodOptional<z.ZodObject<{
1470
+ since: z.ZodISODateTime;
1471
+ observedSince: z.ZodISODateTime;
1472
+ dropped: z.ZodNumber;
1473
+ gapSince: z.ZodOptional<z.ZodISODateTime>;
1474
+ truncated: z.ZodBoolean;
1475
+ samples: z.ZodArray<z.ZodObject<{
1476
+ id: z.ZodString;
1477
+ timestamp: z.ZodISODateTime;
1478
+ tokens: z.ZodNumber;
1479
+ limit: z.ZodNumber;
1480
+ messages: z.ZodNumber;
1481
+ }, z.core.$strict>>;
1482
+ compactions: z.ZodArray<z.ZodObject<{
1483
+ id: z.ZodString;
1484
+ timestamp: z.ZodISODateTime;
1485
+ success: z.ZodBoolean;
1486
+ before: z.ZodOptional<z.ZodNumber>;
1487
+ after: z.ZodOptional<z.ZodNumber>;
1488
+ removed: z.ZodOptional<z.ZodNumber>;
1489
+ messagesRemoved: z.ZodOptional<z.ZodNumber>;
1490
+ trigger: z.ZodOptional<z.ZodString>;
1491
+ basis: z.ZodOptional<z.ZodString>;
1492
+ durationMs: z.ZodOptional<z.ZodNumber>;
1493
+ inputTokens: z.ZodOptional<z.ZodNumber>;
1494
+ outputTokens: z.ZodOptional<z.ZodNumber>;
1495
+ }, z.core.$strict>>;
1496
+ calls: z.ZodArray<z.ZodObject<{
1497
+ id: z.ZodString;
1498
+ timestamp: z.ZodISODateTime;
1499
+ model: z.ZodString;
1500
+ agentId: z.ZodOptional<z.ZodString>;
1501
+ input: z.ZodOptional<z.ZodNumber>;
1502
+ output: z.ZodOptional<z.ZodNumber>;
1503
+ cache: z.ZodOptional<z.ZodNumber>;
1504
+ requestBytes: z.ZodOptional<z.ZodNumber>;
1505
+ wireBytes: z.ZodOptional<z.ZodNumber>;
1506
+ durationMs: z.ZodOptional<z.ZodNumber>;
1507
+ firstOutputMs: z.ZodOptional<z.ZodNumber>;
1508
+ }, z.core.$strict>>;
1509
+ }, z.core.$strict>>;
1510
+ storage: z.ZodOptional<z.ZodObject<{
1511
+ bytes: z.ZodNumber;
1512
+ files: z.ZodNumber;
1513
+ sampledAt: z.ZodISODateTime;
1514
+ partial: z.ZodBoolean;
1515
+ }, z.core.$strict>>;
1437
1516
  }, z.core.$strict>;
1438
1517
  type WorkbenchInsights = z.infer<typeof WorkbenchInsightsSchema>;
1439
1518
  declare const WorkbenchCompactResultSchema: z.ZodObject<{
@@ -1442,6 +1521,44 @@ declare const WorkbenchCompactResultSchema: z.ZodObject<{
1442
1521
  messagesRemoved: z.ZodNumber;
1443
1522
  }, z.core.$strict>;
1444
1523
  type WorkbenchCompactResult = z.infer<typeof WorkbenchCompactResultSchema>;
1524
+ declare const WorkbenchReasoningRequestSchema: z.ZodObject<{
1525
+ cursor: z.ZodOptional<z.ZodString>;
1526
+ }, z.core.$strict>;
1527
+ declare const WorkbenchReasoningPageSchema: z.ZodObject<{
1528
+ blocks: z.ZodArray<z.ZodObject<{
1529
+ id: z.ZodString;
1530
+ timestamp: z.ZodISODateTime;
1531
+ agentId: z.ZodOptional<z.ZodString>;
1532
+ content: z.ZodString;
1533
+ truncated: z.ZodBoolean;
1534
+ }, z.core.$strict>>;
1535
+ cursor: z.ZodString;
1536
+ hasMore: z.ZodBoolean;
1537
+ nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
1538
+ id: z.ZodString;
1539
+ timestamp: z.ZodISODateTime;
1540
+ agentId: z.ZodOptional<z.ZodString>;
1541
+ content: z.ZodString;
1542
+ truncated: z.ZodBoolean;
1543
+ kind: z.ZodEnum<{
1544
+ compaction: "compaction";
1545
+ plan: "plan";
1546
+ rationale: "rationale";
1547
+ response: "response";
1548
+ subagent: "subagent";
1549
+ tool: "tool";
1550
+ }>;
1551
+ title: z.ZodString;
1552
+ status: z.ZodEnum<{
1553
+ completed: "completed";
1554
+ failed: "failed";
1555
+ recorded: "recorded";
1556
+ started: "started";
1557
+ }>;
1558
+ }, z.core.$strict>>>;
1559
+ }, z.core.$strict>;
1560
+ type WorkbenchReasoningRequest = z.infer<typeof WorkbenchReasoningRequestSchema>;
1561
+ type WorkbenchReasoningPage = z.infer<typeof WorkbenchReasoningPageSchema>;
1445
1562
 
1446
1563
  declare const SessionAnalyticsRequestSchema: z.ZodObject<{
1447
1564
  since: z.ZodISODateTime;
@@ -1709,6 +1826,7 @@ interface WorkbenchSchedules {
1709
1826
  }
1710
1827
 
1711
1828
  interface WorkbenchRuntime {
1829
+ reasoning?(sessionId: string, request: WorkbenchReasoningRequest): Promise<WorkbenchReasoningPage>;
1712
1830
  analytics?(sessionId: string, request: SessionAnalyticsRequest): Promise<SessionAnalyticsResult>;
1713
1831
  readonly schedules?: WorkbenchSchedules;
1714
1832
  ask(sessionId: string, question: string): Promise<WorkbenchAskResult>;
@@ -1815,6 +1933,7 @@ interface CodingAgentAdapter {
1815
1933
  listSessions(userId: string, machineId: string): Promise<SessionSummary[]>;
1816
1934
  getSessionDirectoryMetadata?(sessionId: string): Promise<{
1817
1935
  workingDirectory?: string;
1936
+ sessionStateDirectory?: string;
1818
1937
  } | undefined>;
1819
1938
  getSessionProjectIdentity?(sessionId: string): Promise<SessionGitProject | undefined>;
1820
1939
  listModels(sessionId?: string): Promise<AgentModelOption[]>;
@@ -1830,7 +1949,9 @@ interface CodingAgentAdapter {
1830
1949
  getSessionEnvironment(sessionId: string): Promise<SessionEnvironmentInfo>;
1831
1950
  createSession(options: AgentSessionCreateOptions): Promise<SessionSummary>;
1832
1951
  createGroupChat?(sourceSessionId: string, peerSessionId: string, requestId: string, assertAccess?: () => void): Promise<SessionSummary>;
1952
+ createEncryptedGroupChat?(sourceSessionId: string, request: EncryptedGroupCreate, assertAccess: () => void): Promise<SessionSummary>;
1833
1953
  runPeerTurn?(sessionId: string, prompt: string, options: PeerTurnOptions): Promise<string>;
1954
+ assertPeerSession?(sessionId: string): void;
1834
1955
  deleteSession?(sessionId: string): Promise<void>;
1835
1956
  renameSession?(sessionId: string, name: string, assertAccess?: () => void): Promise<string>;
1836
1957
  configureSession(sessionId: string, options: AgentSessionConfigureOptions): Promise<AgentSessionConfiguration>;
@@ -1904,6 +2025,7 @@ type CodingAgentConfig = {
1904
2025
  initialSelection?: AgentSelection;
1905
2026
  piDirectory?: string;
1906
2027
  codexCommand?: string;
2028
+ claudeCommand?: string;
1907
2029
  acp?: {
1908
2030
  command: string;
1909
2031
  args: string[];
@@ -1918,6 +2040,7 @@ type CodingAgentConfig = {
1918
2040
  command?: string;
1919
2041
  } | {
1920
2042
  kind: "claude";
2043
+ command?: string;
1921
2044
  } | {
1922
2045
  kind: "acp";
1923
2046
  command: string;
@@ -1976,13 +2099,14 @@ interface ContentCipherOptions {
1976
2099
  readonly randomBytes?: (size: number) => Buffer;
1977
2100
  readonly createMessageId?: () => string;
1978
2101
  readonly replayWindowMs?: number;
2102
+ readonly rejectReplayOverflow?: boolean;
1979
2103
  readonly processedMessages?: ReadonlyMap<string, number>;
1980
2104
  readonly persistProcessedMessages?: (processedMessages: ReadonlyMap<string, number>) => void;
1981
2105
  }
1982
2106
  declare function parseContentKey(encoded: string): ContentKeyMaterial;
1983
2107
  declare function generateContentKey(): ContentKeyMaterial;
1984
2108
  declare function loadOrCreateContentKey(dataDirectory: string): Promise<ContentKeyMaterial>;
1985
- declare function createPersistentContentCipher(dataDirectory: string, key: ContentKeyMaterial): Promise<ContentCipher>;
2109
+ declare function createPersistentContentCipher(dataDirectory: string, key: ContentKeyMaterial, options?: Pick<ContentCipherOptions, "rejectReplayOverflow">): Promise<ContentCipher>;
1986
2110
  declare class ContentCipher {
1987
2111
  #private;
1988
2112
  constructor(key: ContentKeyMaterial, options?: ContentCipherOptions);
@@ -2029,6 +2153,7 @@ declare const PeerChatRequestSchema: z.ZodObject<{
2029
2153
  targetMachineId: z.ZodString;
2030
2154
  targetSessionId: z.ZodString;
2031
2155
  prompt: z.ZodString;
2156
+ encryptedGroupId: z.ZodOptional<z.ZodUUID>;
2032
2157
  }, z.core.$strip>;
2033
2158
  type PeerChatRequest = z.infer<typeof PeerChatRequestSchema>;
2034
2159
  declare const PeerChatResultSchema: z.ZodObject<{