@nhtio/adk 0.1.0-master-16963fb8 → 0.1.0-master-eee043dc
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.
- package/CHANGELOG.md +87 -0
- package/batteries/llm/bedrock_converse/adapter.cjs +157 -16
- package/batteries/llm/bedrock_converse/adapter.cjs.map +1 -1
- package/batteries/llm/bedrock_converse/adapter.mjs +157 -16
- package/batteries/llm/bedrock_converse/adapter.mjs.map +1 -1
- package/batteries/llm/bedrock_converse.cjs +1 -1
- package/batteries/llm/bedrock_converse.mjs +1 -1
- package/batteries/llm/claude_code_cli/adapter.cjs +59 -18
- package/batteries/llm/claude_code_cli/adapter.cjs.map +1 -1
- package/batteries/llm/claude_code_cli/adapter.mjs +59 -18
- package/batteries/llm/claude_code_cli/adapter.mjs.map +1 -1
- package/batteries/llm/claude_code_cli/line_queue.d.ts +39 -0
- package/batteries/llm/claude_code_cli/message_id_state.d.ts +48 -0
- package/batteries/llm/claude_code_cli/types.d.ts +76 -0
- package/batteries/llm/claude_code_cli/validation.cjs +3 -0
- package/batteries/llm/claude_code_cli/validation.cjs.map +1 -1
- package/batteries/llm/claude_code_cli/validation.mjs +3 -0
- package/batteries/llm/claude_code_cli/validation.mjs.map +1 -1
- package/batteries/llm/claude_code_cli/wire.cjs.map +1 -1
- package/batteries/llm/claude_code_cli/wire.d.ts +45 -1
- package/batteries/llm/claude_code_cli/wire.mjs.map +1 -1
- package/batteries/llm/claude_code_cli/wrapper.d.ts +5 -4
- package/batteries/llm/gemini_generate_content/adapter.cjs +154 -13
- package/batteries/llm/gemini_generate_content/adapter.cjs.map +1 -1
- package/batteries/llm/gemini_generate_content/adapter.mjs +154 -13
- package/batteries/llm/gemini_generate_content/adapter.mjs.map +1 -1
- package/batteries/media/lint.cjs +1 -1
- package/batteries/media/lint.mjs +1 -1
- package/batteries/orchestration/executor.cjs +1 -1
- package/batteries/orchestration/executor.mjs +1 -1
- package/batteries/orchestration/forge.cjs +1 -1
- package/batteries/orchestration/forge.mjs +1 -1
- package/batteries/orchestration.cjs +5 -5
- package/batteries/orchestration.mjs +5 -5
- package/batteries/skills.cjs +1 -1
- package/batteries/skills.mjs +1 -1
- package/batteries/tools/scrapper.cjs +1 -1
- package/batteries/tools/scrapper.mjs +1 -1
- package/batteries/tools/searxng.cjs +1 -1
- package/batteries/tools/searxng.mjs +1 -1
- package/batteries/tools.cjs +2 -2
- package/batteries/tools.mjs +2 -2
- package/batteries/tts/native/adapter.cjs +1 -1
- package/batteries/tts/native/adapter.mjs +1 -1
- package/batteries/tts/native.cjs +1 -1
- package/batteries/tts/native.mjs +1 -1
- package/batteries/validation.cjs +1 -1
- package/batteries/validation.mjs +1 -1
- package/batteries/vector/chroma.cjs +1 -1
- package/batteries/vector/chroma.mjs +1 -1
- package/batteries/vector/clickhouse.cjs +1 -1
- package/batteries/vector/clickhouse.mjs +1 -1
- package/batteries/vector/cloudflare.cjs +1 -1
- package/batteries/vector/cloudflare.mjs +1 -1
- package/batteries/vector/conformance.cjs +59 -0
- package/batteries/vector/conformance.cjs.map +1 -1
- package/batteries/vector/conformance.mjs +59 -0
- package/batteries/vector/conformance.mjs.map +1 -1
- package/batteries/vector/couchbase.cjs +1 -1
- package/batteries/vector/couchbase.mjs +1 -1
- package/batteries/vector/duckdb.cjs +1 -1
- package/batteries/vector/duckdb.mjs +1 -1
- package/batteries/vector/elasticsearch.cjs +1 -1
- package/batteries/vector/elasticsearch.mjs +1 -1
- package/batteries/vector/hnswlib.cjs +1 -1
- package/batteries/vector/hnswlib.mjs +1 -1
- package/batteries/vector/in_memory.cjs +1 -1
- package/batteries/vector/in_memory.mjs +1 -1
- package/batteries/vector/lancedb.cjs +2 -2
- package/batteries/vector/lancedb.cjs.map +1 -1
- package/batteries/vector/lancedb.mjs +2 -2
- package/batteries/vector/lancedb.mjs.map +1 -1
- package/batteries/vector/mariadb.cjs +1 -1
- package/batteries/vector/mariadb.mjs +1 -1
- package/batteries/vector/milvus.cjs +1 -1
- package/batteries/vector/milvus.mjs +1 -1
- package/batteries/vector/opensearch.cjs +1 -1
- package/batteries/vector/opensearch.mjs +1 -1
- package/batteries/vector/oracle23ai.cjs +1 -1
- package/batteries/vector/oracle23ai.mjs +1 -1
- package/batteries/vector/orama.cjs +1 -1
- package/batteries/vector/orama.mjs +1 -1
- package/batteries/vector/pgvector.cjs +1 -1
- package/batteries/vector/pgvector.mjs +1 -1
- package/batteries/vector/pinecone.cjs +1 -1
- package/batteries/vector/pinecone.mjs +1 -1
- package/batteries/vector/qdrant.cjs +1 -1
- package/batteries/vector/qdrant.mjs +1 -1
- package/batteries/vector/redis.cjs +1 -1
- package/batteries/vector/redis.mjs +1 -1
- package/batteries/vector/s3vectors.cjs +1 -1
- package/batteries/vector/s3vectors.mjs +1 -1
- package/batteries/vector/sqlite_vec/index.d.ts +1 -1
- package/batteries/vector/sqlite_vec.cjs +20 -31
- package/batteries/vector/sqlite_vec.cjs.map +1 -1
- package/batteries/vector/sqlite_vec.mjs +20 -31
- package/batteries/vector/sqlite_vec.mjs.map +1 -1
- package/batteries/vector/typesense.cjs +1 -1
- package/batteries/vector/typesense.mjs +1 -1
- package/batteries/vector/vespa.cjs +1 -1
- package/batteries/vector/vespa.mjs +1 -1
- package/batteries/vector/weaviate.cjs +1 -1
- package/batteries/vector/weaviate.mjs +1 -1
- package/batteries/vector.cjs +1 -1
- package/batteries/vector.mjs +1 -1
- package/batteries.cjs +5 -5
- package/batteries.mjs +5 -5
- package/claude-code-cli-wrapper.cjs +104 -22
- package/claude-code-cli-wrapper.cjs.map +1 -1
- package/claude-code-cli-wrapper.mjs +104 -22
- package/claude-code-cli-wrapper.mjs.map +1 -1
- package/eslint/rules.cjs +1 -1
- package/eslint/rules.mjs +1 -1
- package/eslint.cjs +2 -2
- package/eslint.mjs +2 -2
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/mcp/adk-docs-corpus.json +1 -4
- package/package.json +458 -458
- package/{scrapper-DiQ5FfDL.mjs → scrapper-BCdUm8c8.mjs} +2 -2
- package/{scrapper-DiQ5FfDL.mjs.map → scrapper-BCdUm8c8.mjs.map} +1 -1
- package/{scrapper-B8xG9lTD.cjs → scrapper-DlfxIYIo.cjs} +2 -2
- package/{scrapper-B8xG9lTD.cjs.map → scrapper-DlfxIYIo.cjs.map} +1 -1
- package/{searxng-BFTJ6rTE.mjs → searxng-B-LdaVUP.mjs} +2 -2
- package/{searxng-BFTJ6rTE.mjs.map → searxng-B-LdaVUP.mjs.map} +1 -1
- package/{searxng-EJhWRnIE.cjs → searxng-BbDk6GON.cjs} +2 -2
- package/{searxng-EJhWRnIE.cjs.map → searxng-BbDk6GON.cjs.map} +1 -1
- package/server.json +2 -2
- package/skills/adk-assembly/SKILL.md +2 -2
|
@@ -14,6 +14,7 @@ import { validateOptions } from "./validation.mjs";
|
|
|
14
14
|
import { createNdjsonLineReader, encodeWrapperCommand } from "./wire.mjs";
|
|
15
15
|
import { defaultBuildClaudeCodeCliPrompt, defaultRenderClaudeCodeCliTimelineMessage, defaultRenderClaudeCodeCliToolCallResult } from "./helpers.mjs";
|
|
16
16
|
import { sha256 } from "js-sha256";
|
|
17
|
+
import { v6 } from "uuid";
|
|
17
18
|
//#region src/batteries/llm/claude_code_cli/adapter.ts
|
|
18
19
|
/**
|
|
19
20
|
* Cross-environment executor adapter that wraps the Claude Code CLI as a `DispatchExecutorFn`
|
|
@@ -568,9 +569,22 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
568
569
|
]);
|
|
569
570
|
}
|
|
570
571
|
const spoolStore = merged.spoolStore ?? new InMemorySpoolStore();
|
|
572
|
+
const wrapperExecPath = merged.wrapperExecPath ?? process.execPath;
|
|
573
|
+
const isElectronHost = process.versions.electron !== void 0;
|
|
574
|
+
const wantsElectronRunAsNode = (merged.autoDetectElectronHost ?? true) && isElectronHost;
|
|
575
|
+
const consumerOverridesElectronRunAsNode = merged.wrapperEnv !== void 0 && Object.prototype.hasOwnProperty.call(merged.wrapperEnv, "ELECTRON_RUN_AS_NODE");
|
|
576
|
+
const weInjectedElectronRunAsNode = wantsElectronRunAsNode && !consumerOverridesElectronRunAsNode;
|
|
577
|
+
const wrapperEnv = wantsElectronRunAsNode || merged.wrapperEnv !== void 0 ? {
|
|
578
|
+
...wantsElectronRunAsNode ? { ELECTRON_RUN_AS_NODE: "1" } : {},
|
|
579
|
+
...weInjectedElectronRunAsNode ? { ADK_CLAUDE_CODE_CLI_STRIP_RUN_AS_NODE_FROM_GRANDCHILD: "1" } : {},
|
|
580
|
+
...merged.wrapperEnv
|
|
581
|
+
} : void 0;
|
|
571
582
|
let child;
|
|
572
583
|
try {
|
|
573
|
-
child = execaFn(
|
|
584
|
+
child = execaFn(wrapperExecPath, [wrapperPath], wrapperEnv !== void 0 ? {
|
|
585
|
+
cleanup: true,
|
|
586
|
+
env: wrapperEnv
|
|
587
|
+
} : { cleanup: true });
|
|
574
588
|
} catch (err) {
|
|
575
589
|
ctx.nack(new E_CLAUDE_CODE_CLI_WRAPPER_SPAWN_ERROR([isError(err) ? err.message : String(err)]));
|
|
576
590
|
return;
|
|
@@ -585,10 +599,10 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
585
599
|
let idleTimer;
|
|
586
600
|
let settled = false;
|
|
587
601
|
let resolveIteration;
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
let sealedMessage = false;
|
|
602
|
+
const dispatchNonce = v6();
|
|
603
|
+
const messageState = /* @__PURE__ */ new Map();
|
|
591
604
|
let inFlightToolCalls = 0;
|
|
605
|
+
let grandchildPid;
|
|
592
606
|
const clearStartupTimer = () => {
|
|
593
607
|
if (startupTimer) clearTimeout(startupTimer);
|
|
594
608
|
startupTimer = void 0;
|
|
@@ -607,16 +621,24 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
607
621
|
};
|
|
608
622
|
const gracefulShutdown = async () => {
|
|
609
623
|
writeCommand({ type: "shutdown" });
|
|
610
|
-
|
|
611
|
-
const timer = setTimeout(resolve,
|
|
624
|
+
const waitForChildExit = (timeoutMs) => new Promise((resolve) => {
|
|
625
|
+
const timer = setTimeout(resolve, timeoutMs);
|
|
612
626
|
Promise.resolve(child).finally(() => {
|
|
613
627
|
clearTimeout(timer);
|
|
614
628
|
resolve();
|
|
615
629
|
}).catch(() => {});
|
|
616
630
|
});
|
|
631
|
+
await waitForChildExit(disposeGraceMs);
|
|
617
632
|
try {
|
|
618
633
|
child.kill("SIGTERM");
|
|
619
634
|
} catch {}
|
|
635
|
+
await waitForChildExit(disposeGraceMs);
|
|
636
|
+
try {
|
|
637
|
+
child.kill("SIGKILL");
|
|
638
|
+
} catch {}
|
|
639
|
+
if (typeof grandchildPid === "number" && child.exitCode === null) try {
|
|
640
|
+
process.kill(-grandchildPid, "SIGKILL");
|
|
641
|
+
} catch {}
|
|
620
642
|
};
|
|
621
643
|
const shutdownInBackground = () => {
|
|
622
644
|
gracefulShutdown().catch((err) => {
|
|
@@ -689,18 +711,23 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
689
711
|
});
|
|
690
712
|
}, streamIdleTimeoutMs);
|
|
691
713
|
};
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
|
|
714
|
+
const sealMessage = async (id) => {
|
|
715
|
+
if (id === void 0) return;
|
|
716
|
+
const entry = messageState.get(id);
|
|
717
|
+
if (entry === void 0 || entry.sealed) return;
|
|
718
|
+
entry.sealed = true;
|
|
695
719
|
await ctx.storeMessage(new Message({
|
|
696
|
-
id
|
|
720
|
+
id,
|
|
697
721
|
role: "assistant",
|
|
698
|
-
content:
|
|
722
|
+
content: entry.buffer,
|
|
699
723
|
identity: merged.selfIdentity ?? "assistant",
|
|
700
724
|
createdAt: nowIso(),
|
|
701
725
|
updatedAt: nowIso()
|
|
702
726
|
}));
|
|
703
727
|
};
|
|
728
|
+
const sealCurrentMessage = async () => {
|
|
729
|
+
for (const id of messageState.keys()) await sealMessage(id);
|
|
730
|
+
};
|
|
704
731
|
const handleToolCallRequest = async (requestId, toolName, rawArgs) => {
|
|
705
732
|
const tool = ctx.tools.get(toolName);
|
|
706
733
|
if (!tool) {
|
|
@@ -826,6 +853,14 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
826
853
|
});
|
|
827
854
|
return;
|
|
828
855
|
}
|
|
856
|
+
if (event.type === "grandchild_spawned") {
|
|
857
|
+
grandchildPid = event.pid;
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
if (event.type === "grandchild_exited") {
|
|
861
|
+
grandchildPid = void 0;
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
829
864
|
if (event.type === "init") {
|
|
830
865
|
sawInit = true;
|
|
831
866
|
maybeClearStartupTimer();
|
|
@@ -854,15 +889,21 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
854
889
|
return;
|
|
855
890
|
}
|
|
856
891
|
if (event.type === "message_delta") {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
892
|
+
const id = `${dispatchNonce}:message:${event.id}`;
|
|
893
|
+
const entry = messageState.get(id) ?? {
|
|
894
|
+
buffer: "",
|
|
895
|
+
sealed: false
|
|
896
|
+
};
|
|
897
|
+
entry.buffer += event.delta;
|
|
898
|
+
messageState.set(id, entry);
|
|
899
|
+
helpers.reportMessage(id, event.delta, { isComplete: event.isComplete });
|
|
900
|
+
if (event.isComplete) await sealMessage(id);
|
|
861
901
|
armIdleTimer();
|
|
862
902
|
return;
|
|
863
903
|
}
|
|
864
904
|
if (event.type === "thought_delta") {
|
|
865
|
-
|
|
905
|
+
const id = `${dispatchNonce}:thought:${event.id}`;
|
|
906
|
+
helpers.reportThought(id, event.delta, { isComplete: event.isComplete });
|
|
866
907
|
armIdleTimer();
|
|
867
908
|
return;
|
|
868
909
|
}
|
|
@@ -881,6 +922,8 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
881
922
|
sawTerminalEvent = true;
|
|
882
923
|
await sealCurrentMessage();
|
|
883
924
|
settleOnce(() => {
|
|
925
|
+
finish();
|
|
926
|
+
shutdownInBackground();
|
|
884
927
|
if (event.isError && event.subtype !== "error_max_turns") {
|
|
885
928
|
ctx.nack(new E_CLAUDE_CODE_CLI_TURN_FAILED([event.stopReason ?? "unknown", event.resultText ?? ""]));
|
|
886
929
|
return;
|
|
@@ -897,8 +940,6 @@ var ClaudeCodeCliAdapter = class ClaudeCodeCliAdapter {
|
|
|
897
940
|
});
|
|
898
941
|
if (merged.autoAck) ctx.ack();
|
|
899
942
|
});
|
|
900
|
-
await Promise.resolve(child).catch(() => void 0);
|
|
901
|
-
finish();
|
|
902
943
|
return;
|
|
903
944
|
}
|
|
904
945
|
if (event.type === "error") {
|