@agentknight/sdk 0.9.51 → 0.9.53

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,14 +1,14 @@
1
1
  import {
2
2
  AgentSessionRenameError,
3
3
  validateSessionName
4
- } from "./chunk-4XVACOU5.js";
4
+ } from "./chunk-ML6Q2MYH.js";
5
5
  import {
6
6
  ConversationItemSchema,
7
7
  GroupChatInfoSchema,
8
8
  GroupChatParticipantSchema,
9
9
  SESSION_TIMELINE_PAGE_SIZE,
10
10
  SessionSummarySchema
11
- } from "./chunk-BMMKEB6V.js";
11
+ } from "./chunk-UZFIXIAS.js";
12
12
 
13
13
  // src/group-chat.ts
14
14
  import { createHash, randomUUID } from "node:crypto";
@@ -3,18 +3,18 @@ import {
3
3
  } from "./chunk-T6226JFS.js";
4
4
  import {
5
5
  latestPreviewItems
6
- } from "./chunk-FEH4GODE.js";
6
+ } from "./chunk-2CNJAMAN.js";
7
7
  import {
8
8
  UnsupportedAgentOperationError,
9
9
  validateSessionName
10
- } from "./chunk-4XVACOU5.js";
10
+ } from "./chunk-ML6Q2MYH.js";
11
11
  import {
12
12
  ConversationItemSchema,
13
13
  InteractionRequestSchema,
14
14
  InteractionResponseSchema,
15
15
  SESSION_TIMELINE_PAGE_SIZE,
16
16
  SessionSummarySchema
17
- } from "./chunk-BMMKEB6V.js";
17
+ } from "./chunk-UZFIXIAS.js";
18
18
 
19
19
  // src/claude-adapter.ts
20
20
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-FEH4GODE.js";
3
+ } from "./chunk-2CNJAMAN.js";
4
4
  import {
5
5
  UnsupportedAgentOperationError
6
- } from "./chunk-4XVACOU5.js";
6
+ } from "./chunk-ML6Q2MYH.js";
7
7
  import {
8
8
  ConversationItemSchema,
9
9
  InteractionRequestSchema,
10
10
  SESSION_TIMELINE_PAGE_SIZE,
11
11
  SessionSummarySchema
12
- } from "./chunk-BMMKEB6V.js";
12
+ } from "./chunk-UZFIXIAS.js";
13
13
 
14
14
  // src/codex-adapter.ts
15
15
  import { randomUUID } from "node:crypto";
@@ -18,25 +18,25 @@ import {
18
18
  recordTimelineSyncDiagnostic,
19
19
  resolveGitProjectIdentity,
20
20
  sanitizeGitRemoteUrl
21
- } from "./chunk-ZVPUOCY5.js";
21
+ } from "./chunk-6YFGVYI5.js";
22
22
  import {
23
23
  assertMainSessionId,
24
24
  isResearchSessionId
25
- } from "./chunk-LDF3XNVN.js";
25
+ } from "./chunk-HJCNQM4M.js";
26
26
  import {
27
27
  GroupChatError,
28
28
  GroupChatMessageSchema,
29
29
  GroupChatRuntime
30
- } from "./chunk-UXIZLEZV.js";
30
+ } from "./chunk-XL6UB4C3.js";
31
31
  import {
32
32
  isContentfulAssistant
33
- } from "./chunk-FEH4GODE.js";
33
+ } from "./chunk-2CNJAMAN.js";
34
34
  import {
35
35
  AgentSessionRenameError,
36
36
  SessionOperationError,
37
37
  TimelinePageBudgetError,
38
38
  validateSessionName
39
- } from "./chunk-4XVACOU5.js";
39
+ } from "./chunk-ML6Q2MYH.js";
40
40
  import {
41
41
  ConversationItemSchema,
42
42
  CopilotModelOptionSchema,
@@ -57,7 +57,7 @@ import {
57
57
  WorkbenchScheduleEntrySchema,
58
58
  WorkbenchScheduleProposalSchema,
59
59
  WorkbenchScheduleSnapshotSchema
60
- } from "./chunk-BMMKEB6V.js";
60
+ } from "./chunk-UZFIXIAS.js";
61
61
 
62
62
  // src/copilot-adapter.ts
63
63
  import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  AgentSelectionSchema,
3
3
  assertSelectionSnapshotFits
4
- } from "./chunk-HHI2UYWK.js";
4
+ } from "./chunk-AAZH6QGV.js";
5
5
  import {
6
6
  isResearchSessionId
7
- } from "./chunk-LDF3XNVN.js";
7
+ } from "./chunk-HJCNQM4M.js";
8
8
  import {
9
9
  GroupChatError
10
- } from "./chunk-UXIZLEZV.js";
10
+ } from "./chunk-XL6UB4C3.js";
11
11
  import {
12
12
  AgentModelListingError,
13
13
  AgentSessionRenameError,
@@ -16,11 +16,11 @@ import {
16
16
  UnsupportedAgentOperationError,
17
17
  captureWorkbenchAccess,
18
18
  validateSessionName
19
- } from "./chunk-4XVACOU5.js";
19
+ } from "./chunk-ML6Q2MYH.js";
20
20
  import {
21
21
  InteractionResponseSchema,
22
22
  SessionSummarySchema
23
- } from "./chunk-BMMKEB6V.js";
23
+ } from "./chunk-UZFIXIAS.js";
24
24
 
25
25
  // src/managed-agent-adapter.ts
26
26
  import { createHash, randomUUID } from "node:crypto";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-FEH4GODE.js";
3
+ } from "./chunk-2CNJAMAN.js";
4
4
  import {
5
5
  AgentSessionRenameError,
6
6
  UnsupportedAgentOperationError,
7
7
  validateSessionName
8
- } from "./chunk-4XVACOU5.js";
8
+ } from "./chunk-ML6Q2MYH.js";
9
9
  import {
10
10
  InteractionRequestSchema,
11
11
  REASONING_EFFORTS,
12
12
  SESSION_TIMELINE_PAGE_SIZE
13
- } from "./chunk-BMMKEB6V.js";
13
+ } from "./chunk-UZFIXIAS.js";
14
14
 
15
15
  // src/pi-adapter.ts
16
16
  import { createHash as createHash2, randomUUID } from "node:crypto";
@@ -4,5 +4,4 @@ export { CODING_AGENT_IDS } from "./index.js";
4
4
  export { AgentSelectionSchema } from "./index.js";
5
5
  export type { AgentSelection, AgentSelectionProvider } from "./index.js";
6
6
  export { codingAgentPresentation } from "./index.js";
7
- export { LEGACY_CLIENT_STATE_DIRECTORY } from "./index.js";
8
7
  export { relayRequestToken } from "./index.js";
@@ -1,23 +1,21 @@
1
1
  import {
2
2
  DeviceIdentitySchema,
3
- LEGACY_CLIENT_STATE_DIRECTORY,
4
3
  SessionImageRelayUrlSchema,
5
4
  SessionImagesConfigSchema,
6
5
  codingAgentPresentation,
7
6
  relayRequestToken
8
- } from "./chunks/chunk-RPVK6HQV.js";
7
+ } from "./chunks/chunk-EFRYPUKX.js";
9
8
  import {
10
9
  AgentSelectionSchema
11
- } from "./chunks/chunk-HHI2UYWK.js";
10
+ } from "./chunks/chunk-AAZH6QGV.js";
12
11
  import {
13
12
  CODING_AGENT_IDS
14
- } from "./chunks/chunk-4XVACOU5.js";
15
- import "./chunks/chunk-BMMKEB6V.js";
13
+ } from "./chunks/chunk-ML6Q2MYH.js";
14
+ import "./chunks/chunk-UZFIXIAS.js";
16
15
  export {
17
16
  AgentSelectionSchema,
18
17
  CODING_AGENT_IDS,
19
18
  DeviceIdentitySchema,
20
- LEGACY_CLIENT_STATE_DIRECTORY,
21
19
  SessionImageRelayUrlSchema,
22
20
  SessionImagesConfigSchema,
23
21
  codingAgentPresentation,
package/dist/index.d.ts CHANGED
@@ -5,6 +5,14 @@ import { ManagerOptions, SocketOptions } from 'socket.io-client';
5
5
  declare const OperationAckSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
6
  ok: z.ZodLiteral<true>;
7
7
  capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ sessionImageStorage: z.ZodOptional<z.ZodObject<{
9
+ mode: z.ZodEnum<{
10
+ direct: "direct";
11
+ proxy: "proxy";
12
+ }>;
13
+ storageAccount: z.ZodString;
14
+ storageContainer: z.ZodString;
15
+ }, z.core.$strict>>;
8
16
  }, z.core.$strip>, z.ZodObject<{
9
17
  ok: z.ZodLiteral<false>;
10
18
  code: z.ZodString;
@@ -343,6 +351,14 @@ declare const MachineListResultSchema: z.ZodObject<{
343
351
  lastSeen: z.ZodNumber;
344
352
  }, z.core.$strip>]>>;
345
353
  relayCapabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
354
+ sessionImageStorage: z.ZodOptional<z.ZodObject<{
355
+ mode: z.ZodEnum<{
356
+ direct: "direct";
357
+ proxy: "proxy";
358
+ }>;
359
+ storageAccount: z.ZodString;
360
+ storageContainer: z.ZodString;
361
+ }, z.core.$strict>>;
346
362
  }, z.core.$strip>;
347
363
  type MachineListResult = z.infer<typeof MachineListResultSchema>;
348
364
 
@@ -474,6 +490,16 @@ declare const SessionGitProjectSchema: z.ZodObject<{
474
490
  }, z.core.$strict>;
475
491
  type SessionGitProject = z.infer<typeof SessionGitProjectSchema>;
476
492
 
493
+ declare const SessionImageStorageSchema: z.ZodObject<{
494
+ mode: z.ZodEnum<{
495
+ direct: "direct";
496
+ proxy: "proxy";
497
+ }>;
498
+ storageAccount: z.ZodString;
499
+ storageContainer: z.ZodString;
500
+ }, z.core.$strict>;
501
+ type SessionImageStorage = z.infer<typeof SessionImageStorageSchema>;
502
+
477
503
  declare const SessionImageCommitResultSchema: z.ZodObject<{
478
504
  imageId: z.ZodUUID;
479
505
  machineId: z.ZodString;
@@ -1864,6 +1890,7 @@ interface PcAgentConfig {
1864
1890
  timelineCompressionEnabled?: boolean;
1865
1891
  timelineIncrementalEnabled?: boolean;
1866
1892
  secureMessagePacketBudget?: number;
1893
+ sessionImagesEnabled?: boolean;
1867
1894
  /** Explicit consent: image bytes are readable by Relay and Azure storage, not end-to-end encrypted. */
1868
1895
  sessionImages?: z.infer<typeof SessionImagesConfigSchema>;
1869
1896
  }
@@ -2026,6 +2053,7 @@ interface Agent {
2026
2053
  readonly adapter: CodingAgentAdapter;
2027
2054
  readonly pairingProvider: PairingProvider;
2028
2055
  readonly relayRegistrationStatus: RelayRegistrationStatus;
2056
+ readonly sessionImageStorage: SessionImageStorage | undefined;
2029
2057
  readonly isStopping: boolean;
2030
2058
  readonly identityHash: string;
2031
2059
  start(): Promise<void>;
@@ -2044,6 +2072,7 @@ interface Agent {
2044
2072
  runLocalMutation<T>(operation: () => Promise<T>): Promise<T>;
2045
2073
  runPeerChat(request: PeerChatRequest, signal: AbortSignal): Promise<PeerChatResult>;
2046
2074
  setPeerChatEnabled(enabled: boolean): Promise<void>;
2075
+ setSessionImagesEnabled(enabled: boolean): Promise<void>;
2047
2076
  getStatus(): Promise<{
2048
2077
  state: "initialized" | "connecting" | "disconnected" | "ready" | "error" | "stopped";
2049
2078
  busy: boolean;
@@ -2059,6 +2088,10 @@ declare const UploaderConfigSchema: z.ZodObject<{
2059
2088
  machineId: z.ZodString;
2060
2089
  storageAccount: z.ZodString;
2061
2090
  storageContainer: z.ZodString;
2091
+ mode: z.ZodOptional<z.ZodEnum<{
2092
+ direct: "direct";
2093
+ proxy: "proxy";
2094
+ }>>;
2062
2095
  }, z.core.$strip>;
2063
2096
  type SessionImageUploaderConfig = z.input<typeof UploaderConfigSchema>;
2064
2097
  type Stage = "config" | "source" | "reserve" | "put" | "complete";
@@ -2089,7 +2122,17 @@ interface CodingAgentPresentation {
2089
2122
  }
2090
2123
  declare function codingAgentPresentation(agentId: string): CodingAgentPresentation;
2091
2124
 
2092
- declare const LEGACY_CLIENT_STATE_DIRECTORY: string;
2125
+ type PairingConfig = Pick<PcAgentConfig, "relayUrl" | "relayToken" | "relayAuthorization" | "userId">;
2126
+ declare class ApprovedPairingProvider extends CachedPairingProvider {
2127
+ private readonly config;
2128
+ private readonly identity;
2129
+ private readonly contentKey;
2130
+ constructor(config: PairingConfig, identity: DeviceIdentity, contentKey: ContentKeyMaterial);
2131
+ enableApproval(): Promise<void>;
2132
+ listClients(): Promise<MobileAuthorizationView[]>;
2133
+ decideClient(requestId: string, action: "approve" | "reject" | "revoke", expectedPublicKey: string): Promise<void>;
2134
+ private scope;
2135
+ }
2093
2136
 
2094
- export { AgentSelectionSchema, CODING_AGENT_IDS, CachedPairingProvider, ContentCipher, DataDirectoryLease, DeviceIdentitySchema, LEGACY_CLIENT_STATE_DIRECTORY, PEER_CHAT_TIMEOUT_MS, PeerChatRequestSchema, PeerChatResultSchema, SessionImageRelayUrlSchema, SessionImageUploadError, SessionImageUploader, SessionImagesConfigSchema, TimelinePageBudgetError, assertPiRuntimeSupported, buildPairingUri, codingAgentPresentation, createCodingAgentAdapter, createPersistentContentCipher, generateContentKey, initialize, loadOrCreateContentKey, parseContentKey, relayRequestToken, requestPairingUri, supportsAgentSelection };
2137
+ export { AgentSelectionSchema, ApprovedPairingProvider, CODING_AGENT_IDS, CachedPairingProvider, ContentCipher, DataDirectoryLease, DeviceIdentitySchema, PEER_CHAT_TIMEOUT_MS, PeerChatRequestSchema, PeerChatResultSchema, SessionImageRelayUrlSchema, SessionImageUploadError, SessionImageUploader, SessionImagesConfigSchema, TimelinePageBudgetError, assertPiRuntimeSupported, buildPairingUri, codingAgentPresentation, createCodingAgentAdapter, createPersistentContentCipher, generateContentKey, initialize, loadOrCreateContentKey, parseContentKey, relayRequestToken, requestPairingUri, supportsAgentSelection };
2095
2138
  export type { Agent, AgentSelection, AgentSelectionProvider, AgentSessionConfiguration, AgentSessionConfigureOptions, AgentSessionCreateOptions, CodingAgentAdapter, CodingAgentConfig, CodingAgentId, CodingAgentSessionCallbacks, ContentKeyMaterial, DeviceIdentity, InitializeOptions, PairingProvider, PairingTicket, PcAgentConfig, PeerChatRequest, PeerChatResult, RelayAccessToken, RelayAuthorization, RelayRegistrationStatus, RelaySocket, RelaySocketFactory, SelectableAgent, SessionImageUploadErrorCode, SessionImageUploaderConfig, TimelineImageProjection, TimelineReadOptions };
package/dist/index.js CHANGED
@@ -4,20 +4,19 @@ import {
4
4
  PeerChatRequestSchema,
5
5
  PeerChatResultSchema,
6
6
  validateDataDirectory
7
- } from "./chunks/chunk-SNKTDPG5.js";
7
+ } from "./chunks/chunk-6DYWE5PL.js";
8
8
  import {
9
9
  DeviceIdentitySchema,
10
- LEGACY_CLIENT_STATE_DIRECTORY,
11
10
  SessionImageRelayUrlSchema,
12
11
  SessionImagesConfigSchema,
13
12
  codingAgentPresentation,
14
13
  relayRequestToken
15
- } from "./chunks/chunk-RPVK6HQV.js";
14
+ } from "./chunks/chunk-EFRYPUKX.js";
16
15
  import {
17
16
  AgentSelectionSchema,
18
17
  assertSelectionSnapshotFits,
19
18
  supportsAgentSelection
20
- } from "./chunks/chunk-HHI2UYWK.js";
19
+ } from "./chunks/chunk-AAZH6QGV.js";
21
20
  import {
22
21
  ConversationNormalizer,
23
22
  LiveTimelineProjection,
@@ -39,11 +38,11 @@ import {
39
38
  resolveGitProjectIdentity,
40
39
  sessionRestoreFailure,
41
40
  validateOperationResponse
42
- } from "./chunks/chunk-ZVPUOCY5.js";
41
+ } from "./chunks/chunk-6YFGVYI5.js";
43
42
  import {
44
43
  GROUP_CHAT_MAX_TURNS,
45
44
  GroupChatError
46
- } from "./chunks/chunk-UXIZLEZV.js";
45
+ } from "./chunks/chunk-XL6UB4C3.js";
47
46
  import {
48
47
  detectClaude,
49
48
  detectCopilot,
@@ -54,7 +53,7 @@ import {
54
53
  assistantPreview,
55
54
  isContentfulAssistant,
56
55
  userPreview
57
- } from "./chunks/chunk-FEH4GODE.js";
56
+ } from "./chunks/chunk-2CNJAMAN.js";
58
57
  import {
59
58
  AgentModelListingError,
60
59
  AgentSessionRenameError,
@@ -65,7 +64,7 @@ import {
65
64
  UnsupportedAgentOperationError,
66
65
  captureResearchAccess,
67
66
  captureWorkbenchAccess
68
- } from "./chunks/chunk-4XVACOU5.js";
67
+ } from "./chunks/chunk-ML6Q2MYH.js";
69
68
  import {
70
69
  A2aRelayRequestSchema,
71
70
  A2aRelayResponseSchema,
@@ -101,6 +100,7 @@ import {
101
100
  PAIRING_URI_HOST,
102
101
  PAIRING_URI_SCHEME,
103
102
  PC_A2A_CAPABILITY,
103
+ PC_IMAGE_BLOB_POLICY_CAPABILITY,
104
104
  PC_PEER_CHAT_CAPABILITY,
105
105
  PROTOCOL_VERSION,
106
106
  PairingCreateResultSchema,
@@ -149,6 +149,7 @@ import {
149
149
  SESSION_IMAGE_API_PATH,
150
150
  SESSION_IMAGE_MAX_BYTES,
151
151
  SESSION_IMAGE_MAX_PIXELS,
152
+ SESSION_IMAGE_STORAGE_CAPABILITY,
152
153
  SESSION_LIST_UPDATES_CAPABILITY,
153
154
  SESSION_OPTIONS_PARTIAL_CAPABILITY,
154
155
  SESSION_OPTIONS_PROGRESSIVE_CAPABILITY,
@@ -187,6 +188,7 @@ import {
187
188
  SessionGitDiffResultDataSchema,
188
189
  SessionImageCommitResultSchema,
189
190
  SessionImageScopeSchema,
191
+ SessionImageStorageSchema,
190
192
  SessionImageUploadRequestSchema,
191
193
  SessionImageUploadResultSchema,
192
194
  SessionListRequestSchema,
@@ -206,6 +208,7 @@ import {
206
208
  SessionTimelinePageSchema,
207
209
  SessionWatchRequestSchema,
208
210
  SessionsSnapshotSchema,
211
+ TIMELINE_IMAGE_BLOB_CAPABILITY,
209
212
  TIMELINE_IMAGE_BLOB_OPERATION,
210
213
  TIMELINE_IMAGE_BLOB_VERSION,
211
214
  TIMELINE_IMAGE_CHUNK_BYTES,
@@ -254,7 +257,7 @@ import {
254
257
  sessionCommunicationError,
255
258
  sessionCommunicationOperationCapability,
256
259
  workbenchCapability
257
- } from "./chunks/chunk-BMMKEB6V.js";
260
+ } from "./chunks/chunk-UZFIXIAS.js";
258
261
 
259
262
  // src/initialize.ts
260
263
  import { createHash as createHash16 } from "node:crypto";
@@ -274,7 +277,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
274
277
  switch (engine.kind) {
275
278
  case "managed": {
276
279
  if (owner === void 0) throw new Error("Managed coding agents require the PC owner identity");
277
- const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-Q2YBBAWL.js");
280
+ const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-5TIM4PBR.js");
278
281
  return new ManagedCodingAgentAdapter({
279
282
  dataDirectory: config.dataDirectory,
280
283
  owner,
@@ -331,7 +334,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
331
334
  });
332
335
  }
333
336
  case "copilot": {
334
- const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-WJQ2XNI5.js");
337
+ const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-ZM7EUBZ5.js");
335
338
  if (owner !== void 0) {
336
339
  return new GithubCopilotAdapter(void 0, void 0, void 0, {
337
340
  dataDirectory: config.dataDirectory,
@@ -351,13 +354,13 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
351
354
  }
352
355
  case "pi": {
353
356
  assertPiRuntimeSupported();
354
- const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-YN44NYIN.js");
357
+ const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-NADD52CV.js");
355
358
  return new PiCodingAgentAdapter(
356
359
  engine.agentDirectory === void 0 ? {} : { agentDirectory: resolve(engine.agentDirectory) }
357
360
  );
358
361
  }
359
362
  case "codex": {
360
- const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-5OWQVTGF.js");
363
+ const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-44N7DBRH.js");
361
364
  return new CodexCodingAgentAdapter({
362
365
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
363
366
  ...owner === void 0 ? {} : { nativeSessionOwner: owner },
@@ -366,7 +369,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
366
369
  });
367
370
  }
368
371
  case "claude": {
369
- const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-2LMBCBBB.js");
372
+ const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-UWVOXYNG.js");
370
373
  return new ClaudeCodingAgentAdapter({
371
374
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
372
375
  ...owner === void 0 ? {} : { nativeSessionOwner: owner },
@@ -374,7 +377,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
374
377
  });
375
378
  }
376
379
  case "acp": {
377
- const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-GUM5LZFV.js");
380
+ const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-LJQBDWYK.js");
378
381
  return new AcpCodingAgentAdapter({
379
382
  command: engine.command,
380
383
  args: engine.args,
@@ -1941,7 +1944,7 @@ var privateNames = /* @__PURE__ */ new Set([
1941
1944
  ".docker",
1942
1945
  ".copilot",
1943
1946
  ".ak",
1944
- LEGACY_CLIENT_STATE_DIRECTORY,
1947
+ ".bluepaw",
1945
1948
  ".copilot-remote",
1946
1949
  ".agentknight",
1947
1950
  "session-state",
@@ -3693,7 +3696,8 @@ var UploaderConfigSchema = z5.object({
3693
3696
  userId: IdSchema.refine((value) => /^[\x20-\x7e]+$/u.test(value)),
3694
3697
  machineId: IdSchema,
3695
3698
  storageAccount: SessionImagesConfigSchema.shape.storageAccount,
3696
- storageContainer: SessionImagesConfigSchema.shape.storageContainer
3699
+ storageContainer: SessionImagesConfigSchema.shape.storageContainer,
3700
+ mode: SessionImageStorageSchema.shape.mode.optional()
3697
3701
  });
3698
3702
  function safeCause(error) {
3699
3703
  if (error instanceof SessionImageUploadError) return error;
@@ -3882,6 +3886,7 @@ var SessionImageUploader = class {
3882
3886
  return { authorization: `Bearer ${this.#config.relayToken}`, "x-agentknight-user-id": this.#config.userId };
3883
3887
  }
3884
3888
  #target(upload, sessionId) {
3889
+ assert(this.#config.mode === void 0 || upload.mode === this.#config.mode, "IMAGE_UPLOAD_TARGET_INVALID", "reserve");
3885
3890
  const now = Date.now();
3886
3891
  assert(Number.isSafeInteger(upload.uploadExpiresAt) && upload.uploadExpiresAt > now && upload.uploadExpiresAt <= now + MAX_GRANT_LIFETIME_MS, "IMAGE_UPLOAD_EXPIRED", "reserve");
3887
3892
  assert(
@@ -8222,13 +8227,7 @@ var PcAgent = class {
8222
8227
  })
8223
8228
  });
8224
8229
  const imageSettings = config.sessionImages === void 0 ? void 0 : SessionImagesConfigSchema.parse(config.sessionImages);
8225
- this.#imageBlob = imageSettings === void 0 ? void 0 : new TimelineImageBlobPublisher(this.#timelineIncremental.images, new SessionImageUploader({
8226
- relayUrl: config.relayUrl,
8227
- relayToken: config.relayToken,
8228
- userId: config.userId,
8229
- machineId: identity2.machineId,
8230
- ...imageSettings
8231
- }));
8230
+ this.#sessionImagesEnabled = config.sessionImagesEnabled ?? imageSettings !== void 0;
8232
8231
  const emit = (event, payload) => this.#emitSecure(event, payload);
8233
8232
  const handlerOptions = { adapter, config, machineId: identity2.machineId, logger, emit };
8234
8233
  this.#communication = new SessionCommunicationHandler({
@@ -8239,7 +8238,21 @@ var PcAgent = class {
8239
8238
  audience: this.#conversationAudience,
8240
8239
  metrics: this.#operationMetrics,
8241
8240
  incrementalOperations: this.#timelineIncremental.operations,
8242
- ...this.#imageBlob === void 0 ? {} : { imageBlob: this.#imageBlob },
8241
+ imageBlob: {
8242
+ publish: async (sessionId, sha256, assertCurrent) => {
8243
+ const publisher = this.#imageBlob;
8244
+ const revision = this.#imagePolicyRevision;
8245
+ const check = () => {
8246
+ assertCurrent();
8247
+ if (!this.sessionImageStorage || !this.#sessionImagesEnabled || publisher !== this.#imageBlob || revision !== this.#imagePolicyRevision) {
8248
+ throw new SessionImageUploadError("IMAGE_STORAGE_UNAVAILABLE", "source");
8249
+ }
8250
+ };
8251
+ check();
8252
+ if (publisher === void 0) throw new SessionImageUploadError("IMAGE_STORAGE_UNAVAILABLE", "source");
8253
+ return publisher.publish(sessionId, sha256, check);
8254
+ }
8255
+ },
8243
8256
  captureResearchAccess: (sessionId) => captureResearchAccess(adapter, sessionId),
8244
8257
  captureWorkbenchAccess: (sessionId) => captureWorkbenchAccess(adapter, sessionId),
8245
8258
  ...research === void 0 ? {} : { research },
@@ -8601,6 +8614,9 @@ var PcAgent = class {
8601
8614
  #conversationAudience = new ConversationAudience();
8602
8615
  #timelineIncremental;
8603
8616
  #imageBlob;
8617
+ #imageStorage;
8618
+ #sessionImagesEnabled;
8619
+ #imagePolicyRevision = 0;
8604
8620
  #pendingAcks = /* @__PURE__ */ new Set();
8605
8621
  #connectionGeneration = 0;
8606
8622
  #heartbeatTimer;
@@ -8751,6 +8767,20 @@ var PcAgent = class {
8751
8767
  this.#scheduleInventoryRefresh("peer-chat");
8752
8768
  }
8753
8769
  }
8770
+ get sessionImageStorage() {
8771
+ const pinned = this.config.sessionImages;
8772
+ if (pinned !== void 0 && (pinned.storageAccount !== this.#imageStorage?.storageAccount || pinned.storageContainer !== this.#imageStorage?.storageContainer)) return void 0;
8773
+ return this.#machineRegistered && this.#communicationNegotiated && !this.#stopping && this.config.relayAuthorization === void 0 && SessionImageRelayUrlSchema.safeParse(this.config.relayUrl).success ? this.#imageStorage : void 0;
8774
+ }
8775
+ async setSessionImagesEnabled(enabled) {
8776
+ if (enabled === this.#sessionImagesEnabled) return;
8777
+ if (enabled && this.sessionImageStorage === void 0) throw new Error("Relay image storage is unavailable.");
8778
+ this.#sessionImagesEnabled = enabled;
8779
+ this.#imagePolicyRevision += 1;
8780
+ this.#imageBlob?.reset();
8781
+ this.#inventory.invalidate();
8782
+ if (this.#machineRegistered) await this.#inventoryPublisher.request(void 0, true);
8783
+ }
8754
8784
  #sendPeerMessage(message) {
8755
8785
  if (!this.#peerTransportNegotiated || !this.#machineRegistered || !this.#socket.connected) {
8756
8786
  return Promise.reject(new Error("Peer channel is offline or unsupported; nothing will be queued."));
@@ -9003,6 +9033,8 @@ var PcAgent = class {
9003
9033
  this.#a2aNegotiated = false;
9004
9034
  this.#peerChat.reset(new Error("Relay disconnected; peer conversation will not be replayed."));
9005
9035
  this.#imageBlob?.reset();
9036
+ this.#imageStorage = void 0;
9037
+ this.#imagePolicyRevision += 1;
9006
9038
  this.#a2aServer.reset(new Error("Relay disconnected; A2A execution will not be replayed."));
9007
9039
  this.#conversationAudience.reset();
9008
9040
  this.#cancelSnapshotSync();
@@ -9266,6 +9298,19 @@ var PcAgent = class {
9266
9298
  if (!ack.ok) {
9267
9299
  throw new RelayRegistrationError(ack);
9268
9300
  }
9301
+ const storage = ack.sessionImageStorage === void 0 ? void 0 : SessionImageStorageSchema.parse(ack.sessionImageStorage);
9302
+ if (JSON.stringify(storage) !== JSON.stringify(this.#imageStorage)) {
9303
+ this.#imagePolicyRevision += 1;
9304
+ this.#imageBlob?.reset();
9305
+ this.#imageStorage = storage;
9306
+ this.#imageBlob = storage === void 0 || !SessionImageRelayUrlSchema.safeParse(this.config.relayUrl).success ? void 0 : new TimelineImageBlobPublisher(this.#timelineIncremental.images, new SessionImageUploader({
9307
+ relayUrl: this.config.relayUrl,
9308
+ relayToken: this.config.relayToken,
9309
+ userId: this.config.userId,
9310
+ machineId: this.identity.machineId,
9311
+ ...storage
9312
+ }));
9313
+ }
9269
9314
  this.#registrationCapabilities = JSON.stringify(hello.capabilities);
9270
9315
  this.#peerRegistrationRevision = peerRevision;
9271
9316
  this.#machineRegistered = true;
@@ -9294,11 +9339,13 @@ var PcAgent = class {
9294
9339
  return [
9295
9340
  ...this.adapter.agentId === "copilot" || this.adapter.agentId === "managed" ? [SESSION_AVATAR_PERSONA_CAPABILITY] : [],
9296
9341
  SESSION_COMMUNICATION_CAPABILITY,
9342
+ SESSION_IMAGE_STORAGE_CAPABILITY,
9343
+ ...this.#sessionImagesEnabled && this.sessionImageStorage !== void 0 ? [PC_IMAGE_BLOB_POLICY_CAPABILITY, TIMELINE_IMAGE_BLOB_CAPABILITY] : [],
9297
9344
  ...this.#peerChatEnabled && this.adapter.runPeerTurn !== void 0 ? [PC_PEER_CHAT_CAPABILITY] : [],
9298
9345
  ...this.adapter.runPeerTurn !== void 0 ? [PC_A2A_CAPABILITY] : [],
9299
9346
  SESSION_PROMPT_SUBMISSION_TIME_CAPABILITY,
9300
9347
  ...this.adapter.supportsAssistantPreview === true ? [SESSION_ASSISTANT_PREVIEW_CAPABILITY] : [],
9301
- ...this.#communication.capabilities,
9348
+ ...this.#communication.capabilities.filter((capability) => capability !== TIMELINE_IMAGE_BLOB_CAPABILITY),
9302
9349
  this.adapter.agentId === "managed" ? MANAGED_SESSION_SELECTION_CAPABILITY : `coding-agent:${this.adapter.agentId}`,
9303
9350
  ...this.adapter.supportsSessionListUpdates === true ? [SESSION_LIST_UPDATES_CAPABILITY] : [],
9304
9351
  ...this.adapter.supportsFileAttachments === true ? [SESSION_FILE_ATTACHMENTS_CAPABILITY] : [],
@@ -10976,9 +11023,10 @@ var ConfigSchema = z11.object({
10976
11023
  timelineCompressionEnabled: z11.boolean().optional(),
10977
11024
  timelineIncrementalEnabled: z11.boolean().optional(),
10978
11025
  secureMessagePacketBudget: z11.number().int().min(2048).max(SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH).optional(),
10979
- sessionImages: SessionImagesConfigSchema.optional()
11026
+ sessionImages: SessionImagesConfigSchema.optional(),
11027
+ sessionImagesEnabled: z11.boolean().optional()
10980
11028
  }).superRefine((config, context) => {
10981
- if (config.sessionImages !== void 0 && !SessionImageRelayUrlSchema.safeParse(config.relayUrl).success) {
11029
+ if ((config.sessionImages !== void 0 || config.sessionImagesEnabled === true) && !SessionImageRelayUrlSchema.safeParse(config.relayUrl).success) {
10982
11030
  context.addIssue({
10983
11031
  code: "custom",
10984
11032
  path: ["relayUrl"],
@@ -10987,7 +11035,7 @@ var ConfigSchema = z11.object({
10987
11035
  }
10988
11036
  });
10989
11037
  async function initialize(options) {
10990
- if (options.relayAuthorization !== void 0 && options.sessionImages !== void 0) {
11038
+ if (options.relayAuthorization !== void 0 && (options.sessionImages !== void 0 || options.sessionImagesEnabled === true)) {
10991
11039
  throw new Error("Session image storage does not support renewable Relay authorization.");
10992
11040
  }
10993
11041
  const dataDirectory = validateDataDirectory(options.dataDirectory);
@@ -11009,6 +11057,7 @@ async function initialize(options) {
11009
11057
  ...parsed.timelineIncrementalEnabled === void 0 ? {} : { timelineIncrementalEnabled: parsed.timelineIncrementalEnabled },
11010
11058
  ...parsed.secureMessagePacketBudget === void 0 ? {} : { secureMessagePacketBudget: parsed.secureMessagePacketBudget },
11011
11059
  ...parsed.sessionImages === void 0 ? {} : { sessionImages: parsed.sessionImages },
11060
+ ...parsed.sessionImagesEnabled === void 0 ? {} : { sessionImagesEnabled: parsed.sessionImagesEnabled },
11012
11061
  ...options.codingAgent === void 0 ? {} : { codingAgent: options.codingAgent }
11013
11062
  };
11014
11063
  const identity2 = DeviceIdentitySchema.parse(options.identity);
@@ -11135,12 +11184,12 @@ async function initialize(options) {
11135
11184
  }
11136
11185
  export {
11137
11186
  AgentSelectionSchema,
11187
+ ApprovedPairingProvider,
11138
11188
  CODING_AGENT_IDS,
11139
11189
  CachedPairingProvider,
11140
11190
  ContentCipher,
11141
11191
  DataDirectoryLease,
11142
11192
  DeviceIdentitySchema,
11143
- LEGACY_CLIENT_STATE_DIRECTORY,
11144
11193
  PEER_CHAT_TIMEOUT_MS,
11145
11194
  PeerChatRequestSchema,
11146
11195
  PeerChatResultSchema,
package/dist/runtime.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  PEER_CHAT_TIMEOUT_MS,
4
4
  PeerChatRequestSchema,
5
5
  PeerChatResultSchema
6
- } from "./chunks/chunk-SNKTDPG5.js";
7
- import "./chunks/chunk-BMMKEB6V.js";
6
+ } from "./chunks/chunk-6DYWE5PL.js";
7
+ import "./chunks/chunk-UZFIXIAS.js";
8
8
  export {
9
9
  DataDirectoryLease,
10
10
  PEER_CHAT_TIMEOUT_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentknight/sdk",
3
- "version": "0.9.51",
3
+ "version": "0.9.53",
4
4
  "description": "AgentKnight runtime SDK for local and remote coding sessions",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",