@agentknight/sdk 0.9.51 → 0.9.52

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";
@@ -8,11 +8,11 @@ import {
8
8
  } from "./chunks/chunk-RPVK6HQV.js";
9
9
  import {
10
10
  AgentSelectionSchema
11
- } from "./chunks/chunk-HHI2UYWK.js";
11
+ } from "./chunks/chunk-AAZH6QGV.js";
12
12
  import {
13
13
  CODING_AGENT_IDS
14
- } from "./chunks/chunk-4XVACOU5.js";
15
- import "./chunks/chunk-BMMKEB6V.js";
14
+ } from "./chunks/chunk-ML6Q2MYH.js";
15
+ import "./chunks/chunk-UZFIXIAS.js";
16
16
  export {
17
17
  AgentSelectionSchema,
18
18
  CODING_AGENT_IDS,
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,19 @@ interface CodingAgentPresentation {
2089
2122
  }
2090
2123
  declare function codingAgentPresentation(agentId: string): CodingAgentPresentation;
2091
2124
 
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
+ }
2136
+
2092
2137
  declare const LEGACY_CLIENT_STATE_DIRECTORY: string;
2093
2138
 
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 };
2139
+ export { AgentSelectionSchema, ApprovedPairingProvider, 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 };
2095
2140
  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,7 +4,7 @@ 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
10
  LEGACY_CLIENT_STATE_DIRECTORY,
@@ -17,7 +17,7 @@ import {
17
17
  AgentSelectionSchema,
18
18
  assertSelectionSnapshotFits,
19
19
  supportsAgentSelection
20
- } from "./chunks/chunk-HHI2UYWK.js";
20
+ } from "./chunks/chunk-AAZH6QGV.js";
21
21
  import {
22
22
  ConversationNormalizer,
23
23
  LiveTimelineProjection,
@@ -39,11 +39,11 @@ import {
39
39
  resolveGitProjectIdentity,
40
40
  sessionRestoreFailure,
41
41
  validateOperationResponse
42
- } from "./chunks/chunk-ZVPUOCY5.js";
42
+ } from "./chunks/chunk-6YFGVYI5.js";
43
43
  import {
44
44
  GROUP_CHAT_MAX_TURNS,
45
45
  GroupChatError
46
- } from "./chunks/chunk-UXIZLEZV.js";
46
+ } from "./chunks/chunk-XL6UB4C3.js";
47
47
  import {
48
48
  detectClaude,
49
49
  detectCopilot,
@@ -54,7 +54,7 @@ import {
54
54
  assistantPreview,
55
55
  isContentfulAssistant,
56
56
  userPreview
57
- } from "./chunks/chunk-FEH4GODE.js";
57
+ } from "./chunks/chunk-2CNJAMAN.js";
58
58
  import {
59
59
  AgentModelListingError,
60
60
  AgentSessionRenameError,
@@ -65,7 +65,7 @@ import {
65
65
  UnsupportedAgentOperationError,
66
66
  captureResearchAccess,
67
67
  captureWorkbenchAccess
68
- } from "./chunks/chunk-4XVACOU5.js";
68
+ } from "./chunks/chunk-ML6Q2MYH.js";
69
69
  import {
70
70
  A2aRelayRequestSchema,
71
71
  A2aRelayResponseSchema,
@@ -101,6 +101,7 @@ import {
101
101
  PAIRING_URI_HOST,
102
102
  PAIRING_URI_SCHEME,
103
103
  PC_A2A_CAPABILITY,
104
+ PC_IMAGE_BLOB_POLICY_CAPABILITY,
104
105
  PC_PEER_CHAT_CAPABILITY,
105
106
  PROTOCOL_VERSION,
106
107
  PairingCreateResultSchema,
@@ -149,6 +150,7 @@ import {
149
150
  SESSION_IMAGE_API_PATH,
150
151
  SESSION_IMAGE_MAX_BYTES,
151
152
  SESSION_IMAGE_MAX_PIXELS,
153
+ SESSION_IMAGE_STORAGE_CAPABILITY,
152
154
  SESSION_LIST_UPDATES_CAPABILITY,
153
155
  SESSION_OPTIONS_PARTIAL_CAPABILITY,
154
156
  SESSION_OPTIONS_PROGRESSIVE_CAPABILITY,
@@ -187,6 +189,7 @@ import {
187
189
  SessionGitDiffResultDataSchema,
188
190
  SessionImageCommitResultSchema,
189
191
  SessionImageScopeSchema,
192
+ SessionImageStorageSchema,
190
193
  SessionImageUploadRequestSchema,
191
194
  SessionImageUploadResultSchema,
192
195
  SessionListRequestSchema,
@@ -206,6 +209,7 @@ import {
206
209
  SessionTimelinePageSchema,
207
210
  SessionWatchRequestSchema,
208
211
  SessionsSnapshotSchema,
212
+ TIMELINE_IMAGE_BLOB_CAPABILITY,
209
213
  TIMELINE_IMAGE_BLOB_OPERATION,
210
214
  TIMELINE_IMAGE_BLOB_VERSION,
211
215
  TIMELINE_IMAGE_CHUNK_BYTES,
@@ -254,7 +258,7 @@ import {
254
258
  sessionCommunicationError,
255
259
  sessionCommunicationOperationCapability,
256
260
  workbenchCapability
257
- } from "./chunks/chunk-BMMKEB6V.js";
261
+ } from "./chunks/chunk-UZFIXIAS.js";
258
262
 
259
263
  // src/initialize.ts
260
264
  import { createHash as createHash16 } from "node:crypto";
@@ -274,7 +278,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
274
278
  switch (engine.kind) {
275
279
  case "managed": {
276
280
  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");
281
+ const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-5TIM4PBR.js");
278
282
  return new ManagedCodingAgentAdapter({
279
283
  dataDirectory: config.dataDirectory,
280
284
  owner,
@@ -331,7 +335,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
331
335
  });
332
336
  }
333
337
  case "copilot": {
334
- const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-WJQ2XNI5.js");
338
+ const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-ZM7EUBZ5.js");
335
339
  if (owner !== void 0) {
336
340
  return new GithubCopilotAdapter(void 0, void 0, void 0, {
337
341
  dataDirectory: config.dataDirectory,
@@ -351,13 +355,13 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
351
355
  }
352
356
  case "pi": {
353
357
  assertPiRuntimeSupported();
354
- const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-YN44NYIN.js");
358
+ const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-NADD52CV.js");
355
359
  return new PiCodingAgentAdapter(
356
360
  engine.agentDirectory === void 0 ? {} : { agentDirectory: resolve(engine.agentDirectory) }
357
361
  );
358
362
  }
359
363
  case "codex": {
360
- const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-5OWQVTGF.js");
364
+ const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-44N7DBRH.js");
361
365
  return new CodexCodingAgentAdapter({
362
366
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
363
367
  ...owner === void 0 ? {} : { nativeSessionOwner: owner },
@@ -366,7 +370,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
366
370
  });
367
371
  }
368
372
  case "claude": {
369
- const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-2LMBCBBB.js");
373
+ const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-UWVOXYNG.js");
370
374
  return new ClaudeCodingAgentAdapter({
371
375
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
372
376
  ...owner === void 0 ? {} : { nativeSessionOwner: owner },
@@ -374,7 +378,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
374
378
  });
375
379
  }
376
380
  case "acp": {
377
- const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-GUM5LZFV.js");
381
+ const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-LJQBDWYK.js");
378
382
  return new AcpCodingAgentAdapter({
379
383
  command: engine.command,
380
384
  args: engine.args,
@@ -3693,7 +3697,8 @@ var UploaderConfigSchema = z5.object({
3693
3697
  userId: IdSchema.refine((value) => /^[\x20-\x7e]+$/u.test(value)),
3694
3698
  machineId: IdSchema,
3695
3699
  storageAccount: SessionImagesConfigSchema.shape.storageAccount,
3696
- storageContainer: SessionImagesConfigSchema.shape.storageContainer
3700
+ storageContainer: SessionImagesConfigSchema.shape.storageContainer,
3701
+ mode: SessionImageStorageSchema.shape.mode.optional()
3697
3702
  });
3698
3703
  function safeCause(error) {
3699
3704
  if (error instanceof SessionImageUploadError) return error;
@@ -3882,6 +3887,7 @@ var SessionImageUploader = class {
3882
3887
  return { authorization: `Bearer ${this.#config.relayToken}`, "x-agentknight-user-id": this.#config.userId };
3883
3888
  }
3884
3889
  #target(upload, sessionId) {
3890
+ assert(this.#config.mode === void 0 || upload.mode === this.#config.mode, "IMAGE_UPLOAD_TARGET_INVALID", "reserve");
3885
3891
  const now = Date.now();
3886
3892
  assert(Number.isSafeInteger(upload.uploadExpiresAt) && upload.uploadExpiresAt > now && upload.uploadExpiresAt <= now + MAX_GRANT_LIFETIME_MS, "IMAGE_UPLOAD_EXPIRED", "reserve");
3887
3893
  assert(
@@ -8222,13 +8228,7 @@ var PcAgent = class {
8222
8228
  })
8223
8229
  });
8224
8230
  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
- }));
8231
+ this.#sessionImagesEnabled = config.sessionImagesEnabled ?? imageSettings !== void 0;
8232
8232
  const emit = (event, payload) => this.#emitSecure(event, payload);
8233
8233
  const handlerOptions = { adapter, config, machineId: identity2.machineId, logger, emit };
8234
8234
  this.#communication = new SessionCommunicationHandler({
@@ -8239,7 +8239,21 @@ var PcAgent = class {
8239
8239
  audience: this.#conversationAudience,
8240
8240
  metrics: this.#operationMetrics,
8241
8241
  incrementalOperations: this.#timelineIncremental.operations,
8242
- ...this.#imageBlob === void 0 ? {} : { imageBlob: this.#imageBlob },
8242
+ imageBlob: {
8243
+ publish: async (sessionId, sha256, assertCurrent) => {
8244
+ const publisher = this.#imageBlob;
8245
+ const revision = this.#imagePolicyRevision;
8246
+ const check = () => {
8247
+ assertCurrent();
8248
+ if (!this.sessionImageStorage || !this.#sessionImagesEnabled || publisher !== this.#imageBlob || revision !== this.#imagePolicyRevision) {
8249
+ throw new SessionImageUploadError("IMAGE_STORAGE_UNAVAILABLE", "source");
8250
+ }
8251
+ };
8252
+ check();
8253
+ if (publisher === void 0) throw new SessionImageUploadError("IMAGE_STORAGE_UNAVAILABLE", "source");
8254
+ return publisher.publish(sessionId, sha256, check);
8255
+ }
8256
+ },
8243
8257
  captureResearchAccess: (sessionId) => captureResearchAccess(adapter, sessionId),
8244
8258
  captureWorkbenchAccess: (sessionId) => captureWorkbenchAccess(adapter, sessionId),
8245
8259
  ...research === void 0 ? {} : { research },
@@ -8601,6 +8615,9 @@ var PcAgent = class {
8601
8615
  #conversationAudience = new ConversationAudience();
8602
8616
  #timelineIncremental;
8603
8617
  #imageBlob;
8618
+ #imageStorage;
8619
+ #sessionImagesEnabled;
8620
+ #imagePolicyRevision = 0;
8604
8621
  #pendingAcks = /* @__PURE__ */ new Set();
8605
8622
  #connectionGeneration = 0;
8606
8623
  #heartbeatTimer;
@@ -8751,6 +8768,20 @@ var PcAgent = class {
8751
8768
  this.#scheduleInventoryRefresh("peer-chat");
8752
8769
  }
8753
8770
  }
8771
+ get sessionImageStorage() {
8772
+ const pinned = this.config.sessionImages;
8773
+ if (pinned !== void 0 && (pinned.storageAccount !== this.#imageStorage?.storageAccount || pinned.storageContainer !== this.#imageStorage?.storageContainer)) return void 0;
8774
+ return this.#machineRegistered && this.#communicationNegotiated && !this.#stopping && this.config.relayAuthorization === void 0 && SessionImageRelayUrlSchema.safeParse(this.config.relayUrl).success ? this.#imageStorage : void 0;
8775
+ }
8776
+ async setSessionImagesEnabled(enabled) {
8777
+ if (enabled === this.#sessionImagesEnabled) return;
8778
+ if (enabled && this.sessionImageStorage === void 0) throw new Error("Relay image storage is unavailable.");
8779
+ this.#sessionImagesEnabled = enabled;
8780
+ this.#imagePolicyRevision += 1;
8781
+ this.#imageBlob?.reset();
8782
+ this.#inventory.invalidate();
8783
+ if (this.#machineRegistered) await this.#inventoryPublisher.request(void 0, true);
8784
+ }
8754
8785
  #sendPeerMessage(message) {
8755
8786
  if (!this.#peerTransportNegotiated || !this.#machineRegistered || !this.#socket.connected) {
8756
8787
  return Promise.reject(new Error("Peer channel is offline or unsupported; nothing will be queued."));
@@ -9003,6 +9034,8 @@ var PcAgent = class {
9003
9034
  this.#a2aNegotiated = false;
9004
9035
  this.#peerChat.reset(new Error("Relay disconnected; peer conversation will not be replayed."));
9005
9036
  this.#imageBlob?.reset();
9037
+ this.#imageStorage = void 0;
9038
+ this.#imagePolicyRevision += 1;
9006
9039
  this.#a2aServer.reset(new Error("Relay disconnected; A2A execution will not be replayed."));
9007
9040
  this.#conversationAudience.reset();
9008
9041
  this.#cancelSnapshotSync();
@@ -9266,6 +9299,19 @@ var PcAgent = class {
9266
9299
  if (!ack.ok) {
9267
9300
  throw new RelayRegistrationError(ack);
9268
9301
  }
9302
+ const storage = ack.sessionImageStorage === void 0 ? void 0 : SessionImageStorageSchema.parse(ack.sessionImageStorage);
9303
+ if (JSON.stringify(storage) !== JSON.stringify(this.#imageStorage)) {
9304
+ this.#imagePolicyRevision += 1;
9305
+ this.#imageBlob?.reset();
9306
+ this.#imageStorage = storage;
9307
+ this.#imageBlob = storage === void 0 || !SessionImageRelayUrlSchema.safeParse(this.config.relayUrl).success ? void 0 : new TimelineImageBlobPublisher(this.#timelineIncremental.images, new SessionImageUploader({
9308
+ relayUrl: this.config.relayUrl,
9309
+ relayToken: this.config.relayToken,
9310
+ userId: this.config.userId,
9311
+ machineId: this.identity.machineId,
9312
+ ...storage
9313
+ }));
9314
+ }
9269
9315
  this.#registrationCapabilities = JSON.stringify(hello.capabilities);
9270
9316
  this.#peerRegistrationRevision = peerRevision;
9271
9317
  this.#machineRegistered = true;
@@ -9294,11 +9340,13 @@ var PcAgent = class {
9294
9340
  return [
9295
9341
  ...this.adapter.agentId === "copilot" || this.adapter.agentId === "managed" ? [SESSION_AVATAR_PERSONA_CAPABILITY] : [],
9296
9342
  SESSION_COMMUNICATION_CAPABILITY,
9343
+ SESSION_IMAGE_STORAGE_CAPABILITY,
9344
+ ...this.#sessionImagesEnabled && this.sessionImageStorage !== void 0 ? [PC_IMAGE_BLOB_POLICY_CAPABILITY, TIMELINE_IMAGE_BLOB_CAPABILITY] : [],
9297
9345
  ...this.#peerChatEnabled && this.adapter.runPeerTurn !== void 0 ? [PC_PEER_CHAT_CAPABILITY] : [],
9298
9346
  ...this.adapter.runPeerTurn !== void 0 ? [PC_A2A_CAPABILITY] : [],
9299
9347
  SESSION_PROMPT_SUBMISSION_TIME_CAPABILITY,
9300
9348
  ...this.adapter.supportsAssistantPreview === true ? [SESSION_ASSISTANT_PREVIEW_CAPABILITY] : [],
9301
- ...this.#communication.capabilities,
9349
+ ...this.#communication.capabilities.filter((capability) => capability !== TIMELINE_IMAGE_BLOB_CAPABILITY),
9302
9350
  this.adapter.agentId === "managed" ? MANAGED_SESSION_SELECTION_CAPABILITY : `coding-agent:${this.adapter.agentId}`,
9303
9351
  ...this.adapter.supportsSessionListUpdates === true ? [SESSION_LIST_UPDATES_CAPABILITY] : [],
9304
9352
  ...this.adapter.supportsFileAttachments === true ? [SESSION_FILE_ATTACHMENTS_CAPABILITY] : [],
@@ -10976,9 +11024,10 @@ var ConfigSchema = z11.object({
10976
11024
  timelineCompressionEnabled: z11.boolean().optional(),
10977
11025
  timelineIncrementalEnabled: z11.boolean().optional(),
10978
11026
  secureMessagePacketBudget: z11.number().int().min(2048).max(SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH).optional(),
10979
- sessionImages: SessionImagesConfigSchema.optional()
11027
+ sessionImages: SessionImagesConfigSchema.optional(),
11028
+ sessionImagesEnabled: z11.boolean().optional()
10980
11029
  }).superRefine((config, context) => {
10981
- if (config.sessionImages !== void 0 && !SessionImageRelayUrlSchema.safeParse(config.relayUrl).success) {
11030
+ if ((config.sessionImages !== void 0 || config.sessionImagesEnabled === true) && !SessionImageRelayUrlSchema.safeParse(config.relayUrl).success) {
10982
11031
  context.addIssue({
10983
11032
  code: "custom",
10984
11033
  path: ["relayUrl"],
@@ -10987,7 +11036,7 @@ var ConfigSchema = z11.object({
10987
11036
  }
10988
11037
  });
10989
11038
  async function initialize(options) {
10990
- if (options.relayAuthorization !== void 0 && options.sessionImages !== void 0) {
11039
+ if (options.relayAuthorization !== void 0 && (options.sessionImages !== void 0 || options.sessionImagesEnabled === true)) {
10991
11040
  throw new Error("Session image storage does not support renewable Relay authorization.");
10992
11041
  }
10993
11042
  const dataDirectory = validateDataDirectory(options.dataDirectory);
@@ -11009,6 +11058,7 @@ async function initialize(options) {
11009
11058
  ...parsed.timelineIncrementalEnabled === void 0 ? {} : { timelineIncrementalEnabled: parsed.timelineIncrementalEnabled },
11010
11059
  ...parsed.secureMessagePacketBudget === void 0 ? {} : { secureMessagePacketBudget: parsed.secureMessagePacketBudget },
11011
11060
  ...parsed.sessionImages === void 0 ? {} : { sessionImages: parsed.sessionImages },
11061
+ ...parsed.sessionImagesEnabled === void 0 ? {} : { sessionImagesEnabled: parsed.sessionImagesEnabled },
11012
11062
  ...options.codingAgent === void 0 ? {} : { codingAgent: options.codingAgent }
11013
11063
  };
11014
11064
  const identity2 = DeviceIdentitySchema.parse(options.identity);
@@ -11135,6 +11185,7 @@ async function initialize(options) {
11135
11185
  }
11136
11186
  export {
11137
11187
  AgentSelectionSchema,
11188
+ ApprovedPairingProvider,
11138
11189
  CODING_AGENT_IDS,
11139
11190
  CachedPairingProvider,
11140
11191
  ContentCipher,
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.52",
4
4
  "description": "AgentKnight runtime SDK for local and remote coding sessions",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",