@agentknight/sdk 0.9.64 → 0.9.69

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 (29) hide show
  1. package/dist/chunks/{acp-adapter-MBYKOCA2.js → acp-adapter-VJ2OUSBS.js} +41 -4
  2. package/dist/chunks/{chunk-3AMFPDE5.js → chunk-2D34UDII.js} +4 -13
  3. package/dist/chunks/chunk-35OF2ZNS.js +275 -0
  4. package/dist/chunks/{chunk-A4YCCQ3I.js → chunk-5QYL6NKJ.js} +1 -1
  5. package/dist/chunks/chunk-ES2N66EH.js +109 -0
  6. package/dist/chunks/{chunk-P2PH5KMV.js → chunk-F5YCEWE4.js} +9 -0
  7. package/dist/chunks/{chunk-7CNBPLNE.js → chunk-IRYEOV62.js} +5 -2
  8. package/dist/chunks/{chunk-7OGTK7KB.js → chunk-J63A5OLO.js} +1 -1
  9. package/dist/chunks/chunk-LA6A4TUM.js +302 -0
  10. package/dist/chunks/{chunk-ZNQ2I5EF.js → chunk-LU73CEHE.js} +11 -132
  11. package/dist/chunks/chunk-MB34W52S.js +78 -0
  12. package/dist/chunks/{chunk-CHKNC6PD.js → chunk-MH7FDSTY.js} +1 -1
  13. package/dist/chunks/{chunk-ALUQLM54.js → chunk-Q5NNNSU2.js} +2 -2
  14. package/dist/chunks/chunk-UTF7KLMJ.js +11 -0
  15. package/dist/chunks/chunk-WAPJZKUK.js +115 -0
  16. package/dist/chunks/{chunk-SIFCCGXF.js → chunk-ZAU2MYQI.js} +2 -2
  17. package/dist/chunks/{claude-adapter-D3JWXMNX.js → claude-adapter-FZNLF5XN.js} +240 -27
  18. package/dist/chunks/{codex-adapter-655KHW7H.js → codex-adapter-5ZVOAT6O.js} +249 -66
  19. package/dist/chunks/{copilot-adapter-EZUXHBE3.js → copilot-adapter-V6RAQ4WK.js} +58 -149
  20. package/dist/chunks/{managed-agent-adapter-RIXRCURU.js → managed-agent-adapter-THUSTKRW.js} +35 -24
  21. package/dist/chunks/{pi-adapter-LAD5GOCP.js → pi-adapter-EHCSR5I2.js} +329 -54
  22. package/dist/configuration.js +4 -4
  23. package/dist/index.d.ts +15 -8
  24. package/dist/index.js +37 -35
  25. package/dist/runtime.js +2 -2
  26. package/dist/session-analytics-worker.js +6 -5
  27. package/package.json +3 -3
  28. package/dist/chunks/chunk-CM5LVXVL.js +0 -572
  29. package/dist/chunks/chunk-H4SHMWQ6.js +0 -48
@@ -5,16 +5,16 @@ import {
5
5
  } from "./chunks/chunk-VIWTNPVC.js";
6
6
  import {
7
7
  AgentSelectionSchema
8
- } from "./chunks/chunk-SIFCCGXF.js";
8
+ } from "./chunks/chunk-ZAU2MYQI.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-7CNBPLNE.js";
16
- import "./chunks/chunk-7OGTK7KB.js";
17
- import "./chunks/chunk-P2PH5KMV.js";
15
+ } from "./chunks/chunk-IRYEOV62.js";
16
+ import "./chunks/chunk-J63A5OLO.js";
17
+ import "./chunks/chunk-F5YCEWE4.js";
18
18
  export {
19
19
  AgentSelectionSchema,
20
20
  CODING_AGENT_IDS,
package/dist/index.d.ts CHANGED
@@ -528,6 +528,9 @@ declare const SessionSummarySchema: z.ZodObject<{
528
528
  machineId: z.ZodString;
529
529
  summary: z.ZodOptional<z.ZodString>;
530
530
  renameSupported: z.ZodOptional<z.ZodBoolean>;
531
+ deleteSupported: z.ZodOptional<z.ZodBoolean>;
532
+ imageAttachmentsSupported: z.ZodOptional<z.ZodBoolean>;
533
+ fileAttachmentsSupported: z.ZodOptional<z.ZodBoolean>;
531
534
  workingDirectory: z.ZodOptional<z.ZodString>;
532
535
  gitRoot: z.ZodOptional<z.ZodString>;
533
536
  repository: z.ZodOptional<z.ZodString>;
@@ -1925,6 +1928,16 @@ interface CodingAgentSessionCallbacks {
1925
1928
  readonly toolName: string;
1926
1929
  }): void;
1927
1930
  }
1931
+ interface AgentSessionCapabilities {
1932
+ readonly agentModes: readonly SessionAgentMode[];
1933
+ readonly supportsReasoningEffort: boolean;
1934
+ readonly supportsContextTier?: boolean;
1935
+ readonly supportsFileAttachments?: boolean;
1936
+ readonly supportsImageAttachments?: boolean;
1937
+ readonly supportsSessionDelete?: boolean;
1938
+ readonly agentName?: string;
1939
+ readonly supportsPlanRead?: boolean;
1940
+ }
1928
1941
  interface CodingAgentAdapter {
1929
1942
  readonly workbench?: WorkbenchRuntime;
1930
1943
  sessionPublicationSource?(sessionId: string): string;
@@ -1939,6 +1952,7 @@ interface CodingAgentAdapter {
1939
1952
  readonly supportsAssistantPreview?: boolean;
1940
1953
  readonly supportsSessionDelete?: boolean;
1941
1954
  readonly supportsFileAttachments?: boolean;
1955
+ readonly supportsImageAttachments?: boolean;
1942
1956
  readonly groupChatEnabled?: boolean;
1943
1957
  setGroupChatEnabled?(enabled: boolean): Promise<void>;
1944
1958
  setPeerChatEnabled?(enabled: boolean): Promise<void>;
@@ -1952,14 +1966,7 @@ interface CodingAgentAdapter {
1952
1966
  } | undefined>;
1953
1967
  getSessionProjectIdentity?(sessionId: string): Promise<SessionGitProject | undefined>;
1954
1968
  listModels(sessionId?: string): Promise<AgentModelOption[]>;
1955
- getSessionCapabilities?(sessionId?: string): {
1956
- readonly agentModes: readonly SessionAgentMode[];
1957
- readonly supportsReasoningEffort: boolean;
1958
- readonly supportsContextTier?: boolean;
1959
- readonly supportsFileAttachments?: boolean;
1960
- readonly agentName?: string;
1961
- readonly supportsPlanRead?: boolean;
1962
- };
1969
+ getSessionCapabilities?(sessionId?: string): AgentSessionCapabilities;
1963
1970
  isSessionVisible?(sessionId: string): boolean;
1964
1971
  getSessionConfiguration(sessionId: string): Promise<AgentSessionConfiguration>;
1965
1972
  getSessionEnvironment(sessionId: string): Promise<SessionEnvironmentInfo>;
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  PeerChatRequestSchema,
11
11
  PeerChatResultSchema,
12
12
  validateDataDirectory
13
- } from "./chunks/chunk-CHKNC6PD.js";
13
+ } from "./chunks/chunk-MH7FDSTY.js";
14
14
  import {
15
15
  DeviceIdentitySchema,
16
16
  codingAgentPresentation,
@@ -20,12 +20,11 @@ import {
20
20
  AgentSelectionSchema,
21
21
  assertSelectionSnapshotFits,
22
22
  supportsAgentSelection
23
- } from "./chunks/chunk-SIFCCGXF.js";
23
+ } from "./chunks/chunk-ZAU2MYQI.js";
24
24
  import {
25
25
  LiveTimelineProjection,
26
26
  OperationDiagnostics,
27
27
  OperationMetrics,
28
- PromptPreparationError,
29
28
  SessionDirectoryError,
30
29
  SessionDirectoryLister,
31
30
  SessionImageUploadError,
@@ -46,7 +45,7 @@ import {
46
45
  sessionRestoreFailure,
47
46
  sessionRootIdentity,
48
47
  validateOperationResponse
49
- } from "./chunks/chunk-3AMFPDE5.js";
48
+ } from "./chunks/chunk-2D34UDII.js";
50
49
  import {
51
50
  SessionImageRelayUrlSchema,
52
51
  SessionImagesConfigSchema
@@ -54,15 +53,19 @@ import {
54
53
  import {
55
54
  ConversationNormalizer,
56
55
  isDisplayableHumanMessage
57
- } from "./chunks/chunk-ZNQ2I5EF.js";
56
+ } from "./chunks/chunk-LU73CEHE.js";
58
57
  import {
59
58
  GroupChatError
60
- } from "./chunks/chunk-ALUQLM54.js";
59
+ } from "./chunks/chunk-Q5NNNSU2.js";
60
+ import {
61
+ PromptPreparationError
62
+ } from "./chunks/chunk-UTF7KLMJ.js";
61
63
  import {
62
64
  assistantPreview,
65
+ hasImageSignature,
63
66
  isContentfulAssistant,
64
67
  userPreview
65
- } from "./chunks/chunk-H4SHMWQ6.js";
68
+ } from "./chunks/chunk-WAPJZKUK.js";
66
69
  import {
67
70
  AgentModelListingError,
68
71
  AgentSessionRenameError,
@@ -72,11 +75,11 @@ import {
72
75
  captureResearchAccess,
73
76
  captureWorkbenchAccess,
74
77
  validateSessionName
75
- } from "./chunks/chunk-7CNBPLNE.js";
78
+ } from "./chunks/chunk-IRYEOV62.js";
76
79
  import {
77
80
  SessionOperationError,
78
81
  SessionOperations
79
- } from "./chunks/chunk-7OGTK7KB.js";
82
+ } from "./chunks/chunk-J63A5OLO.js";
80
83
  import {
81
84
  A2A_BODY_MAX_LENGTH,
82
85
  A2aRelayRequestSchema,
@@ -295,7 +298,7 @@ import {
295
298
  sessionCommunicationError,
296
299
  sessionCommunicationOperationCapability,
297
300
  workbenchCapability
298
- } from "./chunks/chunk-P2PH5KMV.js";
301
+ } from "./chunks/chunk-F5YCEWE4.js";
299
302
 
300
303
  // src/initialize.ts
301
304
  import { createHash as createHash18 } from "node:crypto";
@@ -315,7 +318,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
315
318
  switch (engine.kind) {
316
319
  case "managed": {
317
320
  if (owner === void 0) throw new Error("Managed coding agents require the PC owner identity");
318
- const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-RIXRCURU.js");
321
+ const { ManagedCodingAgentAdapter } = await import("./chunks/managed-agent-adapter-THUSTKRW.js");
319
322
  return new ManagedCodingAgentAdapter({
320
323
  dataDirectory: config.dataDirectory,
321
324
  owner,
@@ -378,7 +381,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
378
381
  });
379
382
  }
380
383
  case "copilot": {
381
- const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-EZUXHBE3.js");
384
+ const { GithubCopilotAdapter } = await import("./chunks/copilot-adapter-V6RAQ4WK.js");
382
385
  if (owner !== void 0) {
383
386
  return new GithubCopilotAdapter(
384
387
  void 0,
@@ -407,13 +410,13 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
407
410
  }
408
411
  case "pi": {
409
412
  assertPiRuntimeSupported();
410
- const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-LAD5GOCP.js");
413
+ const { PiCodingAgentAdapter } = await import("./chunks/pi-adapter-EHCSR5I2.js");
411
414
  return new PiCodingAgentAdapter(
412
415
  engine.agentDirectory === void 0 ? {} : { agentDirectory: resolve(engine.agentDirectory) }
413
416
  );
414
417
  }
415
418
  case "codex": {
416
- const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-655KHW7H.js");
419
+ const { CodexCodingAgentAdapter } = await import("./chunks/codex-adapter-5ZVOAT6O.js");
417
420
  return new CodexCodingAgentAdapter({
418
421
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
419
422
  ...owner === void 0 ? {} : { nativeSessionOwner: owner },
@@ -422,7 +425,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
422
425
  });
423
426
  }
424
427
  case "claude": {
425
- const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-D3JWXMNX.js");
428
+ const { ClaudeCodingAgentAdapter } = await import("./chunks/claude-adapter-FZNLF5XN.js");
426
429
  return new ClaudeCodingAgentAdapter({
427
430
  dataDirectory: resolve(config.dataDirectory, "coding-agents"),
428
431
  ...engine.command === void 0 ? {} : { command: engine.command },
@@ -431,7 +434,7 @@ async function createCodingAgentAdapter(config, onDiagnostic, owner) {
431
434
  });
432
435
  }
433
436
  case "acp": {
434
- const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-MBYKOCA2.js");
437
+ const { AcpCodingAgentAdapter } = await import("./chunks/acp-adapter-VJ2OUSBS.js");
435
438
  return new AcpCodingAgentAdapter({
436
439
  command: engine.command,
437
440
  args: engine.args,
@@ -3587,7 +3590,7 @@ var TimelineImageCache = class {
3587
3590
  if (attachment.kind !== "image" || attachment.data === void 0) return attachment;
3588
3591
  const parsed = ConversationAttachmentSchema.parse(attachment);
3589
3592
  const bytes = Buffer.from(attachment.data, "base64");
3590
- if (bytes.length !== parsed.byteLength || createHash5("sha256").update(bytes).digest("hex") !== parsed.sha256 || !hasSignature(bytes, parsed.mimeType)) {
3593
+ if (bytes.length !== parsed.byteLength || createHash5("sha256").update(bytes).digest("hex") !== parsed.sha256 || !hasImageSignature(bytes, parsed.mimeType)) {
3591
3594
  throw new TimelineAssetError("IMAGE_INVALID", "Image content does not match its metadata");
3592
3595
  }
3593
3596
  const key = JSON.stringify([sessionId, parsed.sha256]);
@@ -3606,20 +3609,6 @@ var TimelineImageCache = class {
3606
3609
  return { ...metadata, imageRef: "sha256" };
3607
3610
  }
3608
3611
  };
3609
- function hasSignature(bytes, mimeType) {
3610
- switch (mimeType) {
3611
- case "image/png":
3612
- return bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]));
3613
- case "image/jpeg":
3614
- return bytes.subarray(0, 3).equals(Buffer.from([255, 216, 255]));
3615
- case "image/gif":
3616
- return ["GIF87a", "GIF89a"].includes(bytes.subarray(0, 6).toString("ascii"));
3617
- case "image/webp":
3618
- return bytes.subarray(0, 4).toString("ascii") === "RIFF" && bytes.subarray(8, 12).toString("ascii") === "WEBP";
3619
- default:
3620
- return false;
3621
- }
3622
- }
3623
3612
 
3624
3613
  // src/service/requests/request-errors.ts
3625
3614
  function operationErrorCode(agentId, operation, error) {
@@ -5000,6 +4989,18 @@ var OperationDeduplicator = class {
5000
4989
  }
5001
4990
  };
5002
4991
 
4992
+ // src/service/inventory/session-controls.ts
4993
+ function withSessionControls(adapter, session) {
4994
+ const controls = adapter.getSessionCapabilities?.(session.sessionId) ?? adapter;
4995
+ const files = !session.groupChat && (controls.supportsFileAttachments ?? adapter.supportsFileAttachments) === true;
4996
+ return {
4997
+ ...session,
4998
+ fileAttachmentsSupported: files,
4999
+ imageAttachmentsSupported: !session.groupChat && (controls.supportsImageAttachments ?? adapter.supportsImageAttachments ?? files),
5000
+ deleteSupported: controls.supportsSessionDelete ?? adapter.supportsSessionDelete ?? adapter.deleteSession !== void 0
5001
+ };
5002
+ }
5003
+
5003
5004
  // src/service/requests/session-commands.ts
5004
5005
  var SessionCommandsHandler = class {
5005
5006
  constructor(options) {
@@ -5038,7 +5039,7 @@ var SessionCommandsHandler = class {
5038
5039
  ok: true,
5039
5040
  requestId: request2.requestId,
5040
5041
  machineId,
5041
- session,
5042
+ session: withSessionControls(adapter, session),
5042
5043
  modelId: request2.modelId,
5043
5044
  agentMode: request2.agentMode,
5044
5045
  ...request2.reasoningEffort === void 0 ? {} : { reasoningEffort: request2.reasoningEffort }
@@ -7017,7 +7018,7 @@ function encryptedGroupAdapter(inner, groups) {
7017
7018
  abortSession: (id) => groups.owns(id) ? groups.abort(id) : inner.abortSession(id),
7018
7019
  deleteSession: (id) => groups.owns(id) ? groups.delete(id) : inner.deleteSession?.(id) ?? Promise.reject(new Error("Session deletion is unsupported")),
7019
7020
  renameSession: (id, name, check) => groups.owns(id) ? groups.rename(id, name, check) : inner.renameSession?.(id, name, check) ?? Promise.reject(new Error("Session rename is unsupported")),
7020
- getSessionCapabilities: (id) => id !== void 0 && groups.owns(id) ? { agentModes: ["interactive"], supportsReasoningEffort: false, supportsFileAttachments: false, supportsPlanRead: false } : inner.getSessionCapabilities?.(id) ?? inner,
7021
+ getSessionCapabilities: (id) => id !== void 0 && groups.owns(id) ? { agentModes: ["interactive"], supportsReasoningEffort: false, supportsImageAttachments: false, supportsFileAttachments: false, supportsSessionDelete: true, supportsPlanRead: false } : inner.getSessionCapabilities?.(id) ?? inner,
7021
7022
  getSessionConfiguration: (id) => groups.owns(id) ? Promise.resolve({ agentMode: "interactive", reasoningEffort: "default" }) : inner.getSessionConfiguration(id),
7022
7023
  listModels: (id) => inner.listModels(id !== void 0 && groups.owns(id) ? groups.source(id) : id),
7023
7024
  configureSession: (id, options) => {
@@ -7651,7 +7652,8 @@ var SessionInventory = class {
7651
7652
  const sessions = await adapter.listSessions(userId, machineId);
7652
7653
  const visibleSessions = sessions.filter((session) => adapter.isSessionVisible?.(session.sessionId) !== false);
7653
7654
  const page = adapter.isSessionVisible !== void 0 && cursor === void 0 ? { sessions: visibleSessions, totalCount: visibleSessions.length, complete: true } : paginateSessions(visibleSessions, cursor);
7654
- if (adapter.isSessionVisible !== void 0) assertSelectionSnapshotFits(page.sessions);
7655
+ const published = page.sessions.map((session) => withSessionControls(adapter, session));
7656
+ if (adapter.isSessionVisible !== void 0) assertSelectionSnapshotFits(published);
7655
7657
  const snapshot = {
7656
7658
  userId,
7657
7659
  machineId,
@@ -7663,7 +7665,7 @@ var SessionInventory = class {
7663
7665
  complete: page.complete,
7664
7666
  totalCount: page.totalCount,
7665
7667
  ...page.nextCursor === void 0 ? {} : { nextCursor: page.nextCursor },
7666
- sessions: page.sessions
7668
+ sessions: published
7667
7669
  };
7668
7670
  this.#revisions.set(snapshot, revision);
7669
7671
  return snapshot;
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-CHKNC6PD.js";
7
- import "./chunks/chunk-P2PH5KMV.js";
6
+ } from "./chunks/chunk-MH7FDSTY.js";
7
+ import "./chunks/chunk-F5YCEWE4.js";
8
8
  export {
9
9
  DataDirectoryLease,
10
10
  PEER_CHAT_TIMEOUT_MS,
@@ -2,12 +2,13 @@ import {
2
2
  AnalyticsCommandSchema,
3
3
  AnalyticsEventSchema,
4
4
  openSessionEventLog
5
- } from "./chunks/chunk-CM5LVXVL.js";
6
- import "./chunks/chunk-ZNQ2I5EF.js";
7
- import "./chunks/chunk-H4SHMWQ6.js";
5
+ } from "./chunks/chunk-LA6A4TUM.js";
6
+ import "./chunks/chunk-LU73CEHE.js";
7
+ import "./chunks/chunk-35OF2ZNS.js";
8
+ import "./chunks/chunk-WAPJZKUK.js";
8
9
  import {
9
10
  SessionOperationError
10
- } from "./chunks/chunk-7OGTK7KB.js";
11
+ } from "./chunks/chunk-J63A5OLO.js";
11
12
  import {
12
13
  SessionAnalyticsResultSchema,
13
14
  SessionSkillInfoSchema,
@@ -15,7 +16,7 @@ import {
15
16
  WorkbenchContextSampleSchema,
16
17
  WorkbenchTelemetrySchema,
17
18
  WorkbenchUsageCallSchema
18
- } from "./chunks/chunk-P2PH5KMV.js";
19
+ } from "./chunks/chunk-F5YCEWE4.js";
19
20
 
20
21
  // src/session-analytics-worker.ts
21
22
  import { parentPort, workerData, isMainThread as isMainThread2 } from "node:worker_threads";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentknight/sdk",
3
- "version": "0.9.64",
3
+ "version": "0.9.69",
4
4
  "description": "AgentKnight runtime SDK for local and remote coding sessions",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -55,8 +55,8 @@
55
55
  "esbuild": "0.28.2",
56
56
  "rollup": "4.63.5",
57
57
  "rollup-plugin-dts": "6.5.1",
58
- "@agentknight/protocol": "0.1.0",
59
- "@agentknight/shared": "0.1.0"
58
+ "@agentknight/shared": "0.1.0",
59
+ "@agentknight/protocol": "0.1.0"
60
60
  },
61
61
  "optionalDependencies": {
62
62
  "@anthropic-ai/claude-agent-sdk": "0.3.310",