@agentknight/sdk 0.9.56 → 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.
@@ -1,26 +1,28 @@
1
1
  import {
2
2
  AgentSelectionSchema,
3
3
  assertSelectionSnapshotFits
4
- } from "./chunk-NTFNQYQ3.js";
4
+ } from "./chunk-FDUJP3WA.js";
5
5
  import {
6
6
  isResearchSessionId
7
- } from "./chunk-E7QL4CBT.js";
7
+ } from "./chunk-2MERNOK6.js";
8
8
  import {
9
9
  GroupChatError
10
- } from "./chunk-HFVA7ZOD.js";
10
+ } from "./chunk-X3ZG6WMN.js";
11
11
  import {
12
12
  AgentModelListingError,
13
13
  AgentSessionRenameError,
14
14
  CODING_AGENT_IDS,
15
- SessionOperationError,
16
15
  UnsupportedAgentOperationError,
17
16
  captureWorkbenchAccess,
18
17
  validateSessionName
19
- } from "./chunk-L3A736SO.js";
18
+ } from "./chunk-5DVJ7Y5W.js";
19
+ import {
20
+ SessionOperationError
21
+ } from "./chunk-3OIHMMDF.js";
20
22
  import {
21
23
  InteractionResponseSchema,
22
24
  SessionSummarySchema
23
- } from "./chunk-K5CMKBW6.js";
25
+ } from "./chunk-LO4ZRE77.js";
24
26
 
25
27
  // src/managed-agent-adapter.ts
26
28
  import { createHash, randomUUID } from "node:crypto";
@@ -164,6 +166,18 @@ var ManagedCodingAgentAdapter = class {
164
166
  queue: (id) => this.#withWorkbench(id, (runtime, native) => runtime.queue(native)),
165
167
  mutateQueue: (id, request) => this.#withWorkbench(id, (runtime, native) => runtime.mutateQueue(native, request)),
166
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),
175
+ analytics: (id, request) => this.#withWorkbench(id, (runtime, native) => {
176
+ if (runtime.analytics === void 0) {
177
+ throw new SessionOperationError("ANALYTICS_UNSUPPORTED", "This agent does not expose passive analytics");
178
+ }
179
+ return runtime.analytics(native, request);
180
+ }, false),
167
181
  compact: (id) => this.#withWorkbench(id, (runtime, native) => runtime.compact(native))
168
182
  };
169
183
  }
@@ -324,6 +338,14 @@ var ManagedCodingAgentAdapter = class {
324
338
  this.#inventoryChanged();
325
339
  }
326
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
+ }
327
349
  async runPeerTurn(id, prompt, options) {
328
350
  if (!this.#peerChatPreference) throw new Error("Peer chat is disabled");
329
351
  options.signal.throwIfAborted();
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-5J7BK2Y7.js";
3
+ } from "./chunk-NDEJOXSX.js";
4
4
  import {
5
5
  AgentSessionRenameError,
6
6
  UnsupportedAgentOperationError,
7
7
  validateSessionName
8
- } from "./chunk-L3A736SO.js";
8
+ } from "./chunk-5DVJ7Y5W.js";
9
+ import "./chunk-3OIHMMDF.js";
9
10
  import {
10
11
  InteractionRequestSchema,
11
12
  REASONING_EFFORTS,
12
13
  SESSION_TIMELINE_PAGE_SIZE
13
- } from "./chunk-K5CMKBW6.js";
14
+ } from "./chunk-LO4ZRE77.js";
14
15
 
15
16
  // src/pi-adapter.ts
16
17
  import { createHash as createHash2, randomUUID } from "node:crypto";
@@ -5,15 +5,16 @@ import {
5
5
  } from "./chunks/chunk-XPHAIOKN.js";
6
6
  import {
7
7
  AgentSelectionSchema
8
- } from "./chunks/chunk-NTFNQYQ3.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-L3A736SO.js";
16
- import "./chunks/chunk-K5CMKBW6.js";
15
+ } from "./chunks/chunk-5DVJ7Y5W.js";
16
+ import "./chunks/chunk-3OIHMMDF.js";
17
+ import "./chunks/chunk-LO4ZRE77.js";
17
18
  export {
18
19
  AgentSelectionSchema,
19
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,93 @@ 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>;
1562
+
1563
+ declare const SessionAnalyticsRequestSchema: z.ZodObject<{
1564
+ since: z.ZodISODateTime;
1565
+ until: z.ZodISODateTime;
1566
+ timeZone: z.ZodString;
1567
+ }, z.core.$strict>;
1568
+ declare const SessionAnalyticsResultSchema: z.ZodObject<{
1569
+ sampledAt: z.ZodISODateTime;
1570
+ days: z.ZodArray<z.ZodObject<{
1571
+ date: z.ZodString;
1572
+ messages: z.ZodNumber;
1573
+ models: z.ZodArray<z.ZodObject<{
1574
+ model: z.ZodString;
1575
+ calls: z.ZodNumber;
1576
+ inputTokens: z.ZodNumber;
1577
+ outputTokens: z.ZodNumber;
1578
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
1579
+ }, z.core.$strict>>;
1580
+ }, z.core.$strict>>;
1581
+ historyTruncated: z.ZodBoolean;
1582
+ usageTruncated: z.ZodBoolean;
1583
+ skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
1584
+ name: z.ZodString;
1585
+ description: z.ZodOptional<z.ZodString>;
1586
+ source: z.ZodString;
1587
+ enabled: z.ZodBoolean;
1588
+ userInvocable: z.ZodBoolean;
1589
+ commandName: z.ZodOptional<z.ZodString>;
1590
+ }, z.core.$strip>>>;
1591
+ skillsSampledAt: z.ZodOptional<z.ZodISODateTime>;
1592
+ userActivity: z.ZodOptional<z.ZodArray<z.ZodObject<{
1593
+ date: z.ZodString;
1594
+ messages: z.ZodNumber;
1595
+ keywords: z.ZodArray<z.ZodObject<{
1596
+ term: z.ZodString;
1597
+ messages: z.ZodNumber;
1598
+ }, z.core.$strict>>;
1599
+ keywordsTruncated: z.ZodBoolean;
1600
+ }, z.core.$strict>>>;
1601
+ coverage: z.ZodOptional<z.ZodObject<{
1602
+ recordingStartedAt: z.ZodISODateTime;
1603
+ usageObservedSince: z.ZodISODateTime;
1604
+ historyIndexedAt: z.ZodOptional<z.ZodISODateTime>;
1605
+ droppedEvents: z.ZodNumber;
1606
+ usageSource: z.ZodLiteral<"observed">;
1607
+ }, z.core.$strict>>;
1608
+ }, z.core.$strict>;
1609
+ type SessionAnalyticsRequest = z.infer<typeof SessionAnalyticsRequestSchema>;
1610
+ type SessionAnalyticsResult = z.infer<typeof SessionAnalyticsResultSchema>;
1445
1611
 
1446
1612
  declare const WorkbenchScheduleSnapshotSchema: z.ZodObject<{
1447
1613
  state: z.ZodEnum<{
@@ -1660,6 +1826,8 @@ interface WorkbenchSchedules {
1660
1826
  }
1661
1827
 
1662
1828
  interface WorkbenchRuntime {
1829
+ reasoning?(sessionId: string, request: WorkbenchReasoningRequest): Promise<WorkbenchReasoningPage>;
1830
+ analytics?(sessionId: string, request: SessionAnalyticsRequest): Promise<SessionAnalyticsResult>;
1663
1831
  readonly schedules?: WorkbenchSchedules;
1664
1832
  ask(sessionId: string, question: string): Promise<WorkbenchAskResult>;
1665
1833
  commands(sessionId: string): Promise<WorkbenchCommand[]>;
@@ -1765,6 +1933,7 @@ interface CodingAgentAdapter {
1765
1933
  listSessions(userId: string, machineId: string): Promise<SessionSummary[]>;
1766
1934
  getSessionDirectoryMetadata?(sessionId: string): Promise<{
1767
1935
  workingDirectory?: string;
1936
+ sessionStateDirectory?: string;
1768
1937
  } | undefined>;
1769
1938
  getSessionProjectIdentity?(sessionId: string): Promise<SessionGitProject | undefined>;
1770
1939
  listModels(sessionId?: string): Promise<AgentModelOption[]>;
@@ -1780,7 +1949,9 @@ interface CodingAgentAdapter {
1780
1949
  getSessionEnvironment(sessionId: string): Promise<SessionEnvironmentInfo>;
1781
1950
  createSession(options: AgentSessionCreateOptions): Promise<SessionSummary>;
1782
1951
  createGroupChat?(sourceSessionId: string, peerSessionId: string, requestId: string, assertAccess?: () => void): Promise<SessionSummary>;
1952
+ createEncryptedGroupChat?(sourceSessionId: string, request: EncryptedGroupCreate, assertAccess: () => void): Promise<SessionSummary>;
1783
1953
  runPeerTurn?(sessionId: string, prompt: string, options: PeerTurnOptions): Promise<string>;
1954
+ assertPeerSession?(sessionId: string): void;
1784
1955
  deleteSession?(sessionId: string): Promise<void>;
1785
1956
  renameSession?(sessionId: string, name: string, assertAccess?: () => void): Promise<string>;
1786
1957
  configureSession(sessionId: string, options: AgentSessionConfigureOptions): Promise<AgentSessionConfiguration>;
@@ -1854,6 +2025,7 @@ type CodingAgentConfig = {
1854
2025
  initialSelection?: AgentSelection;
1855
2026
  piDirectory?: string;
1856
2027
  codexCommand?: string;
2028
+ claudeCommand?: string;
1857
2029
  acp?: {
1858
2030
  command: string;
1859
2031
  args: string[];
@@ -1868,6 +2040,7 @@ type CodingAgentConfig = {
1868
2040
  command?: string;
1869
2041
  } | {
1870
2042
  kind: "claude";
2043
+ command?: string;
1871
2044
  } | {
1872
2045
  kind: "acp";
1873
2046
  command: string;
@@ -1926,13 +2099,14 @@ interface ContentCipherOptions {
1926
2099
  readonly randomBytes?: (size: number) => Buffer;
1927
2100
  readonly createMessageId?: () => string;
1928
2101
  readonly replayWindowMs?: number;
2102
+ readonly rejectReplayOverflow?: boolean;
1929
2103
  readonly processedMessages?: ReadonlyMap<string, number>;
1930
2104
  readonly persistProcessedMessages?: (processedMessages: ReadonlyMap<string, number>) => void;
1931
2105
  }
1932
2106
  declare function parseContentKey(encoded: string): ContentKeyMaterial;
1933
2107
  declare function generateContentKey(): ContentKeyMaterial;
1934
2108
  declare function loadOrCreateContentKey(dataDirectory: string): Promise<ContentKeyMaterial>;
1935
- declare function createPersistentContentCipher(dataDirectory: string, key: ContentKeyMaterial): Promise<ContentCipher>;
2109
+ declare function createPersistentContentCipher(dataDirectory: string, key: ContentKeyMaterial, options?: Pick<ContentCipherOptions, "rejectReplayOverflow">): Promise<ContentCipher>;
1936
2110
  declare class ContentCipher {
1937
2111
  #private;
1938
2112
  constructor(key: ContentKeyMaterial, options?: ContentCipherOptions);
@@ -1979,6 +2153,7 @@ declare const PeerChatRequestSchema: z.ZodObject<{
1979
2153
  targetMachineId: z.ZodString;
1980
2154
  targetSessionId: z.ZodString;
1981
2155
  prompt: z.ZodString;
2156
+ encryptedGroupId: z.ZodOptional<z.ZodUUID>;
1982
2157
  }, z.core.$strip>;
1983
2158
  type PeerChatRequest = z.infer<typeof PeerChatRequestSchema>;
1984
2159
  declare const PeerChatResultSchema: z.ZodObject<{
@@ -2092,6 +2267,7 @@ declare const UploaderConfigSchema: z.ZodObject<{
2092
2267
  direct: "direct";
2093
2268
  proxy: "proxy";
2094
2269
  }>>;
2270
+ clientVerifiedUploads: z.ZodDefault<z.ZodBoolean>;
2095
2271
  }, z.core.$strip>;
2096
2272
  type SessionImageUploaderConfig = z.input<typeof UploaderConfigSchema>;
2097
2273
  type Stage = "config" | "source" | "reserve" | "put" | "complete";