@agentknight/sdk 0.9.68 → 0.9.72

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 (30) hide show
  1. package/dist/chunks/{acp-adapter-RZX5SUB3.js → acp-adapter-PCNN2NAJ.js} +41 -4
  2. package/dist/chunks/{chunk-Y6NCJB55.js → chunk-23BKGY5J.js} +4 -4
  3. package/dist/chunks/{chunk-UHRUQM4D.js → chunk-2UHBY25U.js} +1 -1
  4. package/dist/chunks/{chunk-CFQQOAQV.js → chunk-36KL4FSH.js} +2 -2
  5. package/dist/chunks/{chunk-FY4XTWUF.js → chunk-5BDFZ3AS.js} +4 -13
  6. package/dist/chunks/{chunk-DWTXWVIA.js → chunk-5FJJZCP6.js} +683 -629
  7. package/dist/chunks/{chunk-B777YB6E.js → chunk-DXHAKWGO.js} +2 -2
  8. package/dist/chunks/{chunk-35OF2ZNS.js → chunk-E5VHBC55.js} +14 -0
  9. package/dist/chunks/{chunk-MB3H6HEI.js → chunk-FQ26TSDG.js} +2 -2
  10. package/dist/chunks/{chunk-Q5OUZJCZ.js → chunk-GRUDMHEJ.js} +1 -1
  11. package/dist/chunks/{chunk-AWVC5NX4.js → chunk-I42IONUU.js} +1 -1
  12. package/dist/chunks/{chunk-4XT65OSG.js → chunk-KPHWVNKP.js} +46 -3
  13. package/dist/chunks/{chunk-EDYVCZIR.js → chunk-PAJZL5ST.js} +7 -2
  14. package/dist/chunks/{chunk-LCA2MWOQ.js → chunk-TFUSRA2B.js} +2 -2
  15. package/dist/chunks/chunk-UTF7KLMJ.js +11 -0
  16. package/dist/chunks/chunk-VEJLENEQ.js +174 -0
  17. package/dist/chunks/chunk-VOR4AECB.js +78 -0
  18. package/dist/chunks/{claude-adapter-FQSQIYUY.js → claude-adapter-A4LPYQ2Z.js} +296 -223
  19. package/dist/chunks/{codex-adapter-TOXSRT2W.js → codex-adapter-AFGS7MPX.js} +249 -66
  20. package/dist/chunks/{copilot-adapter-KUCX7XQW.js → copilot-adapter-NXJTI2HY.js} +27 -70
  21. package/dist/chunks/{managed-agent-adapter-LGBRXDGP.js → managed-agent-adapter-4C2PWD4V.js} +9 -7
  22. package/dist/chunks/{pi-adapter-RXNZSE4F.js → pi-adapter-EZOIK5RA.js} +7 -9
  23. package/dist/configuration.js +4 -4
  24. package/dist/index.d.ts +153 -8
  25. package/dist/index.js +183 -57
  26. package/dist/runtime.js +2 -2
  27. package/dist/session-analytics-worker.js +6 -7
  28. package/package.json +2 -3
  29. package/dist/chunks/chunk-IXGVSREH.js +0 -48
  30. package/dist/chunks/chunk-T6226JFS.js +0 -55
@@ -1,16 +1,22 @@
1
+ import {
2
+ projectNativeImage
3
+ } from "./chunk-VOR4AECB.js";
4
+ import "./chunk-UTF7KLMJ.js";
5
+ import "./chunk-DXHAKWGO.js";
6
+ import "./chunk-E5VHBC55.js";
1
7
  import {
2
8
  latestPreviewItems
3
- } from "./chunk-IXGVSREH.js";
9
+ } from "./chunk-KPHWVNKP.js";
4
10
  import {
5
11
  UnsupportedAgentOperationError
6
- } from "./chunk-CFQQOAQV.js";
7
- import "./chunk-UHRUQM4D.js";
12
+ } from "./chunk-36KL4FSH.js";
13
+ import "./chunk-2UHBY25U.js";
8
14
  import {
9
15
  ConversationItemSchema,
10
16
  PromptImageAttachmentSchema,
11
17
  SESSION_TIMELINE_PAGE_SIZE,
12
18
  SessionSummarySchema
13
- } from "./chunk-DWTXWVIA.js";
19
+ } from "./chunk-5FJJZCP6.js";
14
20
 
15
21
  // src/acp-adapter.ts
16
22
  import { spawn } from "node:child_process";
@@ -131,6 +137,9 @@ var AcpCodingAgentAdapter = class {
131
137
  get supportsSessionDelete() {
132
138
  return this.#capabilities.sessionCapabilities?.delete != null;
133
139
  }
140
+ get supportsImageAttachments() {
141
+ return this.#capabilities.promptCapabilities?.image === true;
142
+ }
134
143
  async canUpgrade() {
135
144
  return this.#started && !this.#stopping && this.#fatalError === void 0 && this.#permissions.size === 0 && [...this.#sessions.values()].every((session) => session.active === void 0 && session.queue.length === 0 && session.loading === void 0 && !session.writeInProgress && session.persistenceError === void 0 && !session.items.some((item) => item.kind === "activity-group" && item.status === "running"));
136
145
  }
@@ -719,6 +728,10 @@ var AcpCodingAgentAdapter = class {
719
728
  const turnId = session.active?.id;
720
729
  if (!turnId) return;
721
730
  if (update.sessionUpdate === "agent_message_chunk") {
731
+ if (update.content.type === "image") {
732
+ this.#projectImage(session, turnId, update.messageId ?? "message", update.content);
733
+ return;
734
+ }
722
735
  if (update.content.type !== "text") {
723
736
  this.#notice(session, turnId, "warning", "Unsupported agent content", update.content.type);
724
737
  return;
@@ -757,6 +770,13 @@ var AcpCodingAgentAdapter = class {
757
770
  timestamp: step?.timestamp ?? previous?.timestamp ?? base.timestamp
758
771
  }]
759
772
  });
773
+ if (status === "completed") {
774
+ for (const block of update.content ?? []) {
775
+ if (block.type === "content" && block.content.type === "image") {
776
+ this.#projectImage(session, turnId, update.toolCallId, block.content);
777
+ }
778
+ }
779
+ }
760
780
  } else if (update.sessionUpdate === "plan") {
761
781
  const id = hash(`${session.summary.sessionId}:plan`);
762
782
  const previous = session.items.find((item) => item.id === id);
@@ -775,6 +795,23 @@ var AcpCodingAgentAdapter = class {
775
795
  });
776
796
  }
777
797
  }
798
+ #projectImage(session, turnId, source, image) {
799
+ const attachment = projectNativeImage(image.data, image.mimeType);
800
+ if (!attachment) {
801
+ this.#notice(session, turnId, "warning", "Unsupported agent image", "The image format or size is not supported");
802
+ return;
803
+ }
804
+ const id = hash(`${turnId}:image:${source}:${attachment.sha256}`);
805
+ if (session.items.some((item) => item.id === id)) return;
806
+ this.#upsert(session, {
807
+ ...this.#base(id, turnId),
808
+ kind: "assistant-message",
809
+ actor: "assistant",
810
+ content: "",
811
+ final: true,
812
+ attachments: [attachment]
813
+ });
814
+ }
778
815
  #permission(request, signal) {
779
816
  const session = this.#sessions.get(request.sessionId);
780
817
  if (!session?.active || session.active.cancelled || this.#stopping || signal.aborted) {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  ConversationNormalizer
3
- } from "./chunk-EDYVCZIR.js";
3
+ } from "./chunk-PAJZL5ST.js";
4
4
  import {
5
5
  resolveCopilotSessionDirectory
6
- } from "./chunk-35OF2ZNS.js";
6
+ } from "./chunk-E5VHBC55.js";
7
7
  import {
8
8
  isContentfulAssistant
9
- } from "./chunk-IXGVSREH.js";
9
+ } from "./chunk-KPHWVNKP.js";
10
10
  import {
11
11
  SessionAnalyticsRequestSchema,
12
12
  SessionTimelinePageSchema
13
- } from "./chunk-DWTXWVIA.js";
13
+ } from "./chunk-5FJJZCP6.js";
14
14
 
15
15
  // src/session-analytics-messages.ts
16
16
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SessionCommunicationDataSchema,
3
3
  WorkbenchOperationStatusSchema
4
- } from "./chunk-DWTXWVIA.js";
4
+ } from "./chunk-5FJJZCP6.js";
5
5
 
6
6
  // src/session-operations.ts
7
7
  import { createHash, randomUUID } from "node:crypto";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SessionOperationError
3
- } from "./chunk-UHRUQM4D.js";
3
+ } from "./chunk-2UHBY25U.js";
4
4
  import {
5
5
  SESSION_NAME_MAX_LENGTH,
6
6
  SessionNameSchema
7
- } from "./chunk-DWTXWVIA.js";
7
+ } from "./chunk-5FJJZCP6.js";
8
8
 
9
9
  // src/coding-agent-adapter.ts
10
10
  var CODING_AGENT_IDS = ["copilot", "pi", "codex", "claude", "acp"];
@@ -6,13 +6,13 @@ import {
6
6
  ConversationNormalizer,
7
7
  ConversationToolLifecycles,
8
8
  assistantMessageId
9
- } from "./chunk-EDYVCZIR.js";
9
+ } from "./chunk-PAJZL5ST.js";
10
10
  import {
11
11
  isContentfulAssistant
12
- } from "./chunk-IXGVSREH.js";
12
+ } from "./chunk-KPHWVNKP.js";
13
13
  import {
14
14
  SessionOperationError
15
- } from "./chunk-UHRUQM4D.js";
15
+ } from "./chunk-2UHBY25U.js";
16
16
  import {
17
17
  IdSchema,
18
18
  SESSION_DIRECTORY_LIST_OPERATION,
@@ -48,7 +48,7 @@ import {
48
48
  WorkbenchReasoningPageSchema,
49
49
  WorkbenchReasoningRequestSchema,
50
50
  isSafeSessionDirectoryPath
51
- } from "./chunk-DWTXWVIA.js";
51
+ } from "./chunk-5FJJZCP6.js";
52
52
 
53
53
  // src/session-image-uploader.ts
54
54
  import { createHash } from "node:crypto";
@@ -1611,14 +1611,6 @@ async function resolveGitProjectIdentity(workingDirectory, env = gitEnvironment(
1611
1611
  };
1612
1612
  }
1613
1613
 
1614
- // src/prompt-preparation-error.ts
1615
- var PromptPreparationError = class extends Error {
1616
- constructor(cause) {
1617
- super(cause instanceof Error ? cause.message : "Prompt preparation failed", { cause });
1618
- this.name = "PromptPreparationError";
1619
- }
1620
- };
1621
-
1622
1614
  // src/session-project-identity.ts
1623
1615
  import { realpath as realpath3, stat as stat2 } from "node:fs/promises";
1624
1616
  import { isAbsolute as isAbsolute3 } from "node:path";
@@ -2371,7 +2363,6 @@ export {
2371
2363
  sanitizeGitRemoteUrl,
2372
2364
  NotGitDirectoryError,
2373
2365
  resolveGitProjectIdentity,
2374
- PromptPreparationError,
2375
2366
  SESSION_PROJECT_IDENTITY_CONCURRENCY,
2376
2367
  SessionProjectIdentityError,
2377
2368
  SessionProjectIdentityReader,