@nhtio/adk 1.20260924.0 → 1.20260928.0
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/artifact_methods-Cg0go7Q4.mjs +1 -0
- package/artifact_methods-CxeKTocm.cjs +1 -0
- package/batteries/artifacts/ecmascript.cjs +1 -1
- package/batteries/artifacts/ecmascript.mjs +1 -1
- package/batteries/artifacts/toon.cjs +1 -1
- package/batteries/artifacts/toon.mjs +1 -1
- package/batteries/artifacts/xml.cjs +1 -1
- package/batteries/artifacts/xml.mjs +1 -1
- package/batteries/artifacts/yaml.cjs +1 -1
- package/batteries/artifacts/yaml.mjs +1 -1
- package/batteries/artifacts.cjs +4 -4
- package/batteries/artifacts.mjs +4 -4
- package/batteries/dev-tools/forge.cjs +3 -3
- package/batteries/dev-tools/forge.mjs +3 -3
- package/batteries/dev-tools.cjs +3 -3
- package/batteries/dev-tools.mjs +3 -3
- package/batteries/encoding.cjs +7 -7
- package/batteries/encoding.mjs +7 -7
- package/batteries/generation/gemini/adapter.cjs +1 -1
- package/batteries/generation/gemini/adapter.mjs +1 -1
- package/batteries/generation/local_diffusion/adapter.cjs +1 -1
- package/batteries/generation/local_diffusion/adapter.mjs +1 -1
- package/batteries/generation/openai/adapter.cjs +1 -1
- package/batteries/generation/openai/adapter.mjs +1 -1
- package/batteries/llm/anthropic_messages/adapter.cjs +6 -6
- package/batteries/llm/anthropic_messages/adapter.mjs +6 -6
- package/batteries/llm/anthropic_messages/count_tokens.cjs +1 -1
- package/batteries/llm/anthropic_messages/count_tokens.mjs +1 -1
- package/batteries/llm/anthropic_messages/helpers.cjs +3 -3
- package/batteries/llm/anthropic_messages/helpers.mjs +3 -3
- package/batteries/llm/anthropic_messages/validation.cjs +2 -2
- package/batteries/llm/anthropic_messages/validation.mjs +2 -2
- package/batteries/llm/anthropic_messages.cjs +2 -2
- package/batteries/llm/anthropic_messages.mjs +2 -2
- package/batteries/llm/bedrock_converse/adapter.cjs +162 -21
- package/batteries/llm/bedrock_converse/adapter.cjs.map +1 -1
- package/batteries/llm/bedrock_converse/adapter.mjs +162 -21
- package/batteries/llm/bedrock_converse/adapter.mjs.map +1 -1
- package/batteries/llm/bedrock_converse/helpers.cjs +1 -1
- package/batteries/llm/bedrock_converse/helpers.mjs +1 -1
- package/batteries/llm/bedrock_converse/validation.cjs +2 -2
- package/batteries/llm/bedrock_converse/validation.mjs +2 -2
- package/batteries/llm/bedrock_converse.cjs +2 -2
- package/batteries/llm/bedrock_converse.mjs +2 -2
- package/batteries/llm/claude_code_cli/adapter.cjs +66 -25
- package/batteries/llm/claude_code_cli/adapter.cjs.map +1 -1
- package/batteries/llm/claude_code_cli/adapter.mjs +66 -25
- package/batteries/llm/claude_code_cli/adapter.mjs.map +1 -1
- package/batteries/llm/claude_code_cli/helpers.cjs +3 -3
- package/batteries/llm/claude_code_cli/helpers.mjs +3 -3
- 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 +5 -2
- package/batteries/llm/claude_code_cli/validation.cjs.map +1 -1
- package/batteries/llm/claude_code_cli/validation.mjs +5 -2
- 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/claude_code_cli.cjs +2 -2
- package/batteries/llm/claude_code_cli.mjs +2 -2
- package/batteries/llm/gemini_generate_content/adapter.cjs +160 -19
- package/batteries/llm/gemini_generate_content/adapter.cjs.map +1 -1
- package/batteries/llm/gemini_generate_content/adapter.mjs +160 -19
- package/batteries/llm/gemini_generate_content/adapter.mjs.map +1 -1
- package/batteries/llm/gemini_generate_content/helpers.cjs +1 -1
- package/batteries/llm/gemini_generate_content/helpers.mjs +1 -1
- package/batteries/llm/gemini_generate_content/validation.cjs +2 -2
- package/batteries/llm/gemini_generate_content/validation.mjs +2 -2
- package/batteries/llm/gemini_generate_content.cjs +1 -1
- package/batteries/llm/gemini_generate_content.mjs +1 -1
- package/batteries/llm/litert_lm/adapter.cjs +6 -6
- package/batteries/llm/litert_lm/adapter.mjs +6 -6
- package/batteries/llm/litert_lm/helpers.cjs +3 -3
- package/batteries/llm/litert_lm/helpers.mjs +3 -3
- package/batteries/llm/litert_lm/validation.cjs +2 -2
- package/batteries/llm/litert_lm/validation.mjs +2 -2
- package/batteries/llm/litert_lm.cjs +1 -1
- package/batteries/llm/litert_lm.mjs +1 -1
- package/batteries/llm/ollama/adapter.cjs +6 -6
- package/batteries/llm/ollama/adapter.mjs +6 -6
- package/batteries/llm/ollama/helpers.cjs +4 -4
- package/batteries/llm/ollama/helpers.mjs +4 -4
- package/batteries/llm/ollama/validation.cjs +2 -2
- package/batteries/llm/ollama/validation.mjs +2 -2
- package/batteries/llm/ollama.cjs +2 -2
- package/batteries/llm/ollama.mjs +2 -2
- package/batteries/llm/openai_chat_completions/adapter.cjs +6 -6
- package/batteries/llm/openai_chat_completions/adapter.mjs +6 -6
- package/batteries/llm/openai_chat_completions/helpers.cjs +4 -4
- package/batteries/llm/openai_chat_completions/helpers.mjs +4 -4
- package/batteries/llm/openai_chat_completions/validation.cjs +2 -2
- package/batteries/llm/openai_chat_completions/validation.mjs +2 -2
- package/batteries/llm/openai_chat_completions.cjs +2 -2
- package/batteries/llm/openai_chat_completions.mjs +2 -2
- package/batteries/llm/openai_responses/adapter.cjs +6 -6
- package/batteries/llm/openai_responses/adapter.mjs +6 -6
- package/batteries/llm/openai_responses/helpers.cjs +3 -3
- package/batteries/llm/openai_responses/helpers.mjs +3 -3
- package/batteries/llm/openai_responses/validation.cjs +2 -2
- package/batteries/llm/openai_responses/validation.mjs +2 -2
- package/batteries/llm/openai_responses.cjs +2 -2
- package/batteries/llm/openai_responses.mjs +2 -2
- package/batteries/llm/transformers_js/adapter.cjs +6 -6
- package/batteries/llm/transformers_js/adapter.mjs +6 -6
- package/batteries/llm/transformers_js/helpers.cjs +3 -3
- package/batteries/llm/transformers_js/helpers.mjs +3 -3
- package/batteries/llm/transformers_js/validation.cjs +2 -2
- package/batteries/llm/transformers_js/validation.mjs +2 -2
- package/batteries/llm/transformers_js.cjs +1 -1
- package/batteries/llm/transformers_js.mjs +1 -1
- package/batteries/llm/webllm_chat_completions/adapter.cjs +6 -6
- package/batteries/llm/webllm_chat_completions/adapter.mjs +6 -6
- package/batteries/llm/webllm_chat_completions/helpers.cjs +1 -1
- package/batteries/llm/webllm_chat_completions/helpers.mjs +1 -1
- package/batteries/llm/webllm_chat_completions/validation.cjs +2 -2
- package/batteries/llm/webllm_chat_completions/validation.mjs +2 -2
- package/batteries/llm/webllm_chat_completions.cjs +2 -2
- package/batteries/llm/webllm_chat_completions.mjs +2 -2
- package/batteries/llm.cjs +2 -2
- package/batteries/llm.mjs +2 -2
- package/batteries/media/forge.cjs +4 -4
- package/batteries/media/forge.mjs +4 -4
- package/batteries/media/lint.cjs +1 -1
- package/batteries/media/lint.mjs +1 -1
- package/batteries/orchestration/dispatch_reasoner.cjs +4 -4
- package/batteries/orchestration/dispatch_reasoner.mjs +4 -4
- package/batteries/orchestration/executor.cjs +2 -2
- package/batteries/orchestration/executor.mjs +2 -2
- package/batteries/orchestration/forge.cjs +4 -4
- package/batteries/orchestration/forge.mjs +4 -4
- package/batteries/orchestration/validation.cjs +2 -2
- package/batteries/orchestration/validation.mjs +2 -2
- package/batteries/orchestration.cjs +4 -4
- package/batteries/orchestration.mjs +4 -4
- package/batteries/sandbox/js.cjs +1 -1
- package/batteries/sandbox/js.mjs +1 -1
- package/batteries/sandbox/tools.cjs +1 -1
- package/batteries/sandbox/tools.mjs +1 -1
- package/batteries/sandbox.cjs +3 -3
- package/batteries/sandbox.mjs +3 -3
- package/batteries/skills.cjs +9 -9
- package/batteries/skills.mjs +9 -9
- package/batteries/tools/_shared.cjs +1 -1
- package/batteries/tools/_shared.mjs +1 -1
- package/batteries/tools/color.cjs +2 -2
- package/batteries/tools/color.mjs +2 -2
- package/batteries/tools/comparison.cjs +2 -2
- package/batteries/tools/comparison.mjs +2 -2
- package/batteries/tools/data_structure.cjs +2 -2
- package/batteries/tools/data_structure.mjs +2 -2
- package/batteries/tools/datetime_extended.cjs +3 -3
- package/batteries/tools/datetime_extended.mjs +3 -3
- package/batteries/tools/datetime_math.cjs +3 -3
- package/batteries/tools/datetime_math.mjs +3 -3
- package/batteries/tools/encoding.cjs +2 -2
- package/batteries/tools/encoding.mjs +2 -2
- package/batteries/tools/formatting.cjs +2 -2
- package/batteries/tools/formatting.mjs +2 -2
- package/batteries/tools/geo_basics.cjs +2 -2
- package/batteries/tools/geo_basics.mjs +2 -2
- package/batteries/tools/math.cjs +2 -2
- package/batteries/tools/math.mjs +2 -2
- package/batteries/tools/memory.cjs +5 -5
- package/batteries/tools/memory.mjs +5 -5
- package/batteries/tools/parsing.cjs +3 -3
- package/batteries/tools/parsing.mjs +3 -3
- package/batteries/tools/retrievables.cjs +5 -5
- package/batteries/tools/retrievables.mjs +5 -5
- 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/standing_instructions.cjs +3 -3
- package/batteries/tools/standing_instructions.mjs +3 -3
- package/batteries/tools/statistics.cjs +3 -3
- package/batteries/tools/statistics.mjs +3 -3
- package/batteries/tools/string_processing.cjs +2 -2
- package/batteries/tools/string_processing.mjs +2 -2
- package/batteries/tools/structured_data.cjs +2 -2
- package/batteries/tools/structured_data.mjs +2 -2
- package/batteries/tools/text_analysis.cjs +3 -3
- package/batteries/tools/text_analysis.mjs +3 -3
- package/batteries/tools/text_comparison.cjs +2 -2
- package/batteries/tools/text_comparison.mjs +2 -2
- package/batteries/tools/time.cjs +3 -3
- package/batteries/tools/time.mjs +3 -3
- package/batteries/tools/unit_conversion.cjs +2 -2
- package/batteries/tools/unit_conversion.mjs +2 -2
- package/batteries/tools.cjs +2 -2
- package/batteries/tools.mjs +2 -2
- package/batteries/validation.cjs +4 -4
- package/batteries/validation.mjs +4 -4
- 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/lancedb.cjs +1 -1
- package/batteries/vector/lancedb.cjs.map +1 -1
- package/batteries/vector/lancedb.mjs +1 -1
- package/batteries/vector/lancedb.mjs.map +1 -1
- package/batteries/vector/retrievable.cjs +1 -1
- package/batteries/vector/retrievable.mjs +1 -1
- package/batteries/vector/sqlite_vec/index.d.ts +1 -1
- package/batteries/vector/sqlite_vec.cjs +19 -30
- 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.cjs +4 -4
- package/batteries.mjs +4 -4
- package/{chat_common-B7fvGTKv.cjs → chat_common-CNayzS1V.cjs} +2 -2
- package/{chat_common-B7fvGTKv.cjs.map → chat_common-CNayzS1V.cjs.map} +1 -1
- package/{chat_common-CeoHwSsz.mjs → chat_common-DKw8FDol.mjs} +2 -2
- package/{chat_common-CeoHwSsz.mjs.map → chat_common-DKw8FDol.mjs.map} +1 -1
- 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/{common-7gCR3zQu.cjs → common-CqetsItm.cjs} +7 -7
- package/{common-7gCR3zQu.cjs.map → common-CqetsItm.cjs.map} +1 -1
- package/{common-B5maOoF_.mjs → common-oI1niK9Z.mjs} +7 -7
- package/{common-B5maOoF_.mjs.map → common-oI1niK9Z.mjs.map} +1 -1
- package/common.cjs +7 -7
- package/common.mjs +7 -7
- package/{dispatch_runner-DO7jo_gl.mjs → dispatch_runner-BZDXUe0G.mjs} +5 -5
- package/{dispatch_runner-DO7jo_gl.mjs.map → dispatch_runner-BZDXUe0G.mjs.map} +1 -1
- package/{dispatch_runner-FlriTyoq.cjs → dispatch_runner-DDUxXJC3.cjs} +5 -5
- package/{dispatch_runner-FlriTyoq.cjs.map → dispatch_runner-DDUxXJC3.cjs.map} +1 -1
- package/dispatch_runner.cjs +1 -1
- package/dispatch_runner.mjs +1 -1
- package/{ecmascript-bgwVyZG1.mjs → ecmascript-B9Z2C24U.mjs} +3 -3
- package/{ecmascript-bgwVyZG1.mjs.map → ecmascript-B9Z2C24U.mjs.map} +1 -1
- package/{ecmascript-BydSB03Y.cjs → ecmascript-BYfmjg7y.cjs} +3 -3
- package/{ecmascript-BydSB03Y.cjs.map → ecmascript-BYfmjg7y.cjs.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/exceptions.cjs +1 -1
- package/exceptions.mjs +1 -1
- package/forge.cjs +2 -2
- package/forge.mjs +2 -2
- package/guards.cjs +7 -7
- package/guards.mjs +7 -7
- package/{helpers-Dcp4CrOz.cjs → helpers-DPlh_7Bn.cjs} +3 -3
- package/{helpers-Dcp4CrOz.cjs.map → helpers-DPlh_7Bn.cjs.map} +1 -1
- package/{helpers-C1T0DV8Q.mjs → helpers-mbn_EsDV.mjs} +3 -3
- package/{helpers-C1T0DV8Q.mjs.map → helpers-mbn_EsDV.mjs.map} +1 -1
- package/index.cjs +11 -11
- package/index.mjs +11 -11
- package/mcp/adk-docs-corpus.json +2 -2
- package/package.json +425 -425
- package/{retrievable-BBwiACtw.cjs → retrievable-Bq-O3k6r.cjs} +3 -3
- package/{retrievable-BBwiACtw.cjs.map → retrievable-Bq-O3k6r.cjs.map} +1 -1
- package/{retrievable-CrGKx4sc.mjs → retrievable-CXTAUuuv.mjs} +3 -3
- package/{retrievable-CrGKx4sc.mjs.map → retrievable-CXTAUuuv.mjs.map} +1 -1
- package/{scrapper-BibKj8qE.cjs → scrapper-B8xG9lTD.cjs} +4 -4
- package/{scrapper-BibKj8qE.cjs.map → scrapper-B8xG9lTD.cjs.map} +1 -1
- package/{scrapper-_JzgbLG5.mjs → scrapper-DiQ5FfDL.mjs} +4 -4
- package/{scrapper-_JzgbLG5.mjs.map → scrapper-DiQ5FfDL.mjs.map} +1 -1
- package/{searxng-D-nA2gEI.mjs → searxng-BFTJ6rTE.mjs} +4 -4
- package/{searxng-D-nA2gEI.mjs.map → searxng-BFTJ6rTE.mjs.map} +1 -1
- package/{searxng-C6xrLW-v.cjs → searxng-EJhWRnIE.cjs} +4 -4
- package/{searxng-C6xrLW-v.cjs.map → searxng-EJhWRnIE.cjs.map} +1 -1
- package/server.json +2 -2
- package/skills/adk-assembly/SKILL.md +2 -2
- package/{spooled_artifact-BLgbGT8b.cjs → spooled_artifact---DmicFW.cjs} +384 -384
- package/spooled_artifact---DmicFW.cjs.map +1 -0
- package/{spooled_artifact-BkOe4-j-.mjs → spooled_artifact-Bw_7swIp.mjs} +385 -385
- package/spooled_artifact-Bw_7swIp.mjs.map +1 -0
- package/spooled_artifact.cjs +2 -2
- package/spooled_artifact.mjs +2 -2
- package/{spooled_markdown_artifact-8zdejfcJ.cjs → spooled_markdown_artifact-Rjzj-kyh.cjs} +3 -3
- package/{spooled_markdown_artifact-8zdejfcJ.cjs.map → spooled_markdown_artifact-Rjzj-kyh.cjs.map} +1 -1
- package/{spooled_markdown_artifact-Dnl-lCGv.mjs → spooled_markdown_artifact-vd6eNtIP.mjs} +3 -3
- package/{spooled_markdown_artifact-Dnl-lCGv.mjs.map → spooled_markdown_artifact-vd6eNtIP.mjs.map} +1 -1
- package/{thought-BrQt6HAb.mjs → thought-CxSaF6Xf.mjs} +3 -3
- package/{thought-BrQt6HAb.mjs.map → thought-CxSaF6Xf.mjs.map} +1 -1
- package/{thought-COeZTQ-B.cjs → thought-Dp3sMWW6.cjs} +3 -3
- package/{thought-COeZTQ-B.cjs.map → thought-Dp3sMWW6.cjs.map} +1 -1
- package/{tokenizable-DDIdXbJN.cjs → tokenizable-BcodRtoW.cjs} +29 -29
- package/{tokenizable-DDIdXbJN.cjs.map → tokenizable-BcodRtoW.cjs.map} +1 -1
- package/{tokenizable-xPXj1AQX.mjs → tokenizable-VB4Av8GF.mjs} +30 -30
- package/{tokenizable-xPXj1AQX.mjs.map → tokenizable-VB4Av8GF.mjs.map} +1 -1
- package/{tool_call-JbjeUpRK.cjs → tool_call-B9px4W9k.cjs} +4 -4
- package/{tool_call-JbjeUpRK.cjs.map → tool_call-B9px4W9k.cjs.map} +1 -1
- package/{tool_call-8crmZsO8.mjs → tool_call-Cfaj-6zK.mjs} +4 -4
- package/{tool_call-8crmZsO8.mjs.map → tool_call-Cfaj-6zK.mjs.map} +1 -1
- package/{tools-BC4NJqZD.mjs → tools-D0MBDh2R.mjs} +6 -6
- package/{tools-BC4NJqZD.mjs.map → tools-D0MBDh2R.mjs.map} +1 -1
- package/{tools-D4mdzi0a.cjs → tools-aNbi6JyA.cjs} +6 -6
- package/{tools-D4mdzi0a.cjs.map → tools-aNbi6JyA.cjs.map} +1 -1
- package/{toon-BA9Q7NHG.mjs → toon-BSTQnHed.mjs} +5 -5
- package/{toon-BA9Q7NHG.mjs.map → toon-BSTQnHed.mjs.map} +1 -1
- package/{toon-b-0pFKZ8.cjs → toon-DmLwZ6H1.cjs} +5 -5
- package/{toon-b-0pFKZ8.cjs.map → toon-DmLwZ6H1.cjs.map} +1 -1
- package/{turn_runner-BmVXcBZ2.mjs → turn_runner-BHHD6h77.mjs} +5 -5
- package/{turn_runner-BmVXcBZ2.mjs.map → turn_runner-BHHD6h77.mjs.map} +1 -1
- package/{turn_runner-DX-3s3ih.cjs → turn_runner-Dj7JsUTQ.cjs} +5 -5
- package/{turn_runner-DX-3s3ih.cjs.map → turn_runner-Dj7JsUTQ.cjs.map} +1 -1
- package/turn_runner.cjs +1 -1
- package/turn_runner.mjs +1 -1
- package/{xml-B1JIGLpU.mjs → xml-CYseDztH.mjs} +5 -5
- package/{xml-B1JIGLpU.mjs.map → xml-CYseDztH.mjs.map} +1 -1
- package/{xml-fvwTsoRv.cjs → xml-zJul8jMQ.cjs} +5 -5
- package/{xml-fvwTsoRv.cjs.map → xml-zJul8jMQ.cjs.map} +1 -1
- package/{yaml-1mP4uxdf.mjs → yaml-BPBoiOjx.mjs} +5 -5
- package/{yaml-1mP4uxdf.mjs.map → yaml-BPBoiOjx.mjs.map} +1 -1
- package/{yaml-DPUTumla.cjs → yaml-D0PzoRAr.cjs} +5 -5
- package/{yaml-DPUTumla.cjs.map → yaml-D0PzoRAr.cjs.map} +1 -1
- package/artifact_methods-7KatxCSd.cjs +0 -1
- package/artifact_methods-q52ETLwI.mjs +0 -1
- package/spooled_artifact-BLgbGT8b.cjs.map +0 -1
- package/spooled_artifact-BkOe4-j-.mjs.map +0 -1
|
@@ -1324,6 +1324,56 @@ var startMcpBridge = async (onToolCallRequest) => {
|
|
|
1324
1324
|
};
|
|
1325
1325
|
};
|
|
1326
1326
|
//#endregion
|
|
1327
|
+
//#region src/batteries/llm/claude_code_cli/line_queue.ts
|
|
1328
|
+
/**
|
|
1329
|
+
* Create a fresh, empty serial queue. `onError` is invoked (never thrown/rejected further) for
|
|
1330
|
+
* any task that rejects, so the queue's own tail promise stays perpetually resolved and later
|
|
1331
|
+
* tasks are never skipped.
|
|
1332
|
+
*/
|
|
1333
|
+
var createSerialQueue = (onError) => {
|
|
1334
|
+
let tail = Promise.resolve();
|
|
1335
|
+
return { enqueue: (task) => {
|
|
1336
|
+
tail = tail.then(task).catch(onError);
|
|
1337
|
+
} };
|
|
1338
|
+
};
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/batteries/llm/claude_code_cli/message_id_state.ts
|
|
1341
|
+
/** Fresh state for a new `startTurn` spawn. */
|
|
1342
|
+
var createMessageIdState = () => ({
|
|
1343
|
+
partialMessageId: void 0,
|
|
1344
|
+
messageIndex: 0
|
|
1345
|
+
});
|
|
1346
|
+
/**
|
|
1347
|
+
* Claim the wrapper-local id for a `stream_event` partial delta. Synchronously assigns
|
|
1348
|
+
* `partialMessageId` if this is the first delta seen for the in-progress message, so every
|
|
1349
|
+
* subsequent partial delta (and the eventual complete-message line) reuses the SAME id — call
|
|
1350
|
+
* this, and only this, before ever `await`-ing the corresponding `writeEvent`.
|
|
1351
|
+
*/
|
|
1352
|
+
var claimPartialDeltaId = (state) => {
|
|
1353
|
+
const id = state.partialMessageId ?? `message-${state.messageIndex}`;
|
|
1354
|
+
state.partialMessageId = id;
|
|
1355
|
+
return id;
|
|
1356
|
+
};
|
|
1357
|
+
/**
|
|
1358
|
+
* Claim the wrapper-local id for a complete (`assistant`/`user`) message line, and atomically
|
|
1359
|
+
* reset the state for whatever distinct message this SAME spawn may still emit next (text ->
|
|
1360
|
+
* tool_use -> more text all arrive within one spawn — issue #43, fix B). `hadPriorPartialDelta`
|
|
1361
|
+
* tells the caller whether a `stream_event` delta already carried this message's text (in which
|
|
1362
|
+
* case the complete line's own text must NOT be re-sent as the delta, or the adapter's per-id
|
|
1363
|
+
* accumulator would duplicate it) — matching the wrapper's pre-existing `partialMessageId ===
|
|
1364
|
+
* undefined ? text : ''` decision, now made in the same atomic step as the claim itself.
|
|
1365
|
+
*/
|
|
1366
|
+
var claimCompleteMessageId = (state) => {
|
|
1367
|
+
const id = state.partialMessageId ?? `message-${state.messageIndex}`;
|
|
1368
|
+
const hadPriorPartialDelta = state.partialMessageId !== void 0;
|
|
1369
|
+
state.partialMessageId = void 0;
|
|
1370
|
+
state.messageIndex += 1;
|
|
1371
|
+
return {
|
|
1372
|
+
id,
|
|
1373
|
+
hadPriorPartialDelta
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
//#endregion
|
|
1327
1377
|
//#region src/batteries/llm/claude_code_cli/cli_protocol.ts
|
|
1328
1378
|
/**
|
|
1329
1379
|
* Parse one already-newline-split `claude --output-format stream-json` line. Returns `undefined`
|
|
@@ -1373,19 +1423,40 @@ var extractMessageText = (line) => {
|
|
|
1373
1423
|
*
|
|
1374
1424
|
* @remarks
|
|
1375
1425
|
* Self-contained with respect to `@nhtio/adk/*` — no such imports anywhere in this file or its
|
|
1376
|
-
*
|
|
1377
|
-
* `@modelcontextprotocol/sdk`, and those
|
|
1378
|
-
* asset (see Decision C in the design notes) —
|
|
1379
|
-
*
|
|
1426
|
+
* five siblings (`wire.ts`, `cli_protocol.ts`, `mcp_bridge.ts`, `message_id_state.ts`,
|
|
1427
|
+
* `line_queue.ts`). Only `node:*` builtins, `@modelcontextprotocol/sdk`, and those five
|
|
1428
|
+
* battery-local modules. Ships as a sibling dist asset (see Decision C in the design notes) —
|
|
1429
|
+
* never imported as a library, only ever spawned by file path via
|
|
1430
|
+
* `execa(process.execPath, [wrapperPath])` from `adapter.ts`.
|
|
1380
1431
|
*
|
|
1381
1432
|
* Carries no `@module` JSDoc tag: it is invisible to the `@module`-tag scraper that builds the
|
|
1382
1433
|
* public `exports` map, and is added to `vite.config.mts`'s `build.lib.entry` as an explicit extra
|
|
1383
1434
|
* key instead, following the `mcp/server.ts` precedent for a non-consumer-facing standalone
|
|
1384
1435
|
* executable.
|
|
1385
1436
|
*/
|
|
1386
|
-
var
|
|
1387
|
-
|
|
1388
|
-
|
|
1437
|
+
var pendingWriteCount = 0;
|
|
1438
|
+
var pendingWritesSettled;
|
|
1439
|
+
var trackPendingWrite = (promise) => {
|
|
1440
|
+
pendingWriteCount += 1;
|
|
1441
|
+
const settle = () => {
|
|
1442
|
+
pendingWriteCount -= 1;
|
|
1443
|
+
if (pendingWriteCount === 0) pendingWritesSettled?.();
|
|
1444
|
+
};
|
|
1445
|
+
promise.then(settle, settle);
|
|
1446
|
+
return promise;
|
|
1447
|
+
};
|
|
1448
|
+
var waitForPendingWrites = () => {
|
|
1449
|
+
if (pendingWriteCount === 0) return Promise.resolve();
|
|
1450
|
+
return new Promise((resolve) => {
|
|
1451
|
+
pendingWritesSettled = resolve;
|
|
1452
|
+
});
|
|
1453
|
+
};
|
|
1454
|
+
var writeEvent = (event) => trackPendingWrite(new Promise((resolve) => {
|
|
1455
|
+
process.stdout.write(encodeWrapperEvent(event), (err) => {
|
|
1456
|
+
if (err && err.code !== "EPIPE") process.stderr.write(`[claude_code_cli wrapper] stdout write error: ${String(err)}\n`);
|
|
1457
|
+
resolve();
|
|
1458
|
+
});
|
|
1459
|
+
}));
|
|
1389
1460
|
var log = (level, kind, message, payload) => {
|
|
1390
1461
|
writeEvent({
|
|
1391
1462
|
type: "log",
|
|
@@ -1448,6 +1519,8 @@ var buildClaudeArgv = (cmd, bridgeUrl) => {
|
|
|
1448
1519
|
/** Build the grandchild's env: start from the ambient env, then explicitly delete-then-set every credential/behavior variable this command controls. */
|
|
1449
1520
|
var buildClaudeEnv = (cmd) => {
|
|
1450
1521
|
const env = { ...process.env };
|
|
1522
|
+
if (env.ADK_CLAUDE_CODE_CLI_STRIP_RUN_AS_NODE_FROM_GRANDCHILD !== void 0) delete env.ELECTRON_RUN_AS_NODE;
|
|
1523
|
+
delete env.ADK_CLAUDE_CODE_CLI_STRIP_RUN_AS_NODE_FROM_GRANDCHILD;
|
|
1451
1524
|
delete env.ANTHROPIC_API_KEY;
|
|
1452
1525
|
delete env.ANTHROPIC_AUTH_TOKEN;
|
|
1453
1526
|
delete env.ANTHROPIC_BASE_URL;
|
|
@@ -1465,6 +1538,10 @@ var buildClaudeEnv = (cmd) => {
|
|
|
1465
1538
|
return env;
|
|
1466
1539
|
};
|
|
1467
1540
|
var main = async () => {
|
|
1541
|
+
process.stdout.on("error", (err) => {
|
|
1542
|
+
if (err.code === "EPIPE") return;
|
|
1543
|
+
process.stderr.write(`[claude_code_cli wrapper] stdout stream error: ${String(err)}\n`);
|
|
1544
|
+
});
|
|
1468
1545
|
let bridge;
|
|
1469
1546
|
let grandchild;
|
|
1470
1547
|
let shuttingDown = false;
|
|
@@ -1519,8 +1596,10 @@ var main = async () => {
|
|
|
1519
1596
|
shuttingDown = true;
|
|
1520
1597
|
armBackstop();
|
|
1521
1598
|
await runShutdownSequence(disposeGraceMs);
|
|
1522
|
-
disarmBackstop();
|
|
1523
1599
|
process.exitCode = 0;
|
|
1600
|
+
await waitForPendingWrites();
|
|
1601
|
+
disarmBackstop();
|
|
1602
|
+
process.exit(0);
|
|
1524
1603
|
};
|
|
1525
1604
|
let handlingSignal = false;
|
|
1526
1605
|
const onSignal = () => {
|
|
@@ -1602,14 +1681,21 @@ var main = async () => {
|
|
|
1602
1681
|
"pipe"
|
|
1603
1682
|
]
|
|
1604
1683
|
});
|
|
1605
|
-
|
|
1684
|
+
if (typeof grandchild.pid === "number") writeEvent({
|
|
1685
|
+
type: "grandchild_spawned",
|
|
1686
|
+
pid: grandchild.pid
|
|
1687
|
+
});
|
|
1688
|
+
const messageIdState = createMessageIdState();
|
|
1689
|
+
const lineQueue = createSerialQueue((err) => {
|
|
1690
|
+
log("error", "stream-line-handler-error", "Error handling a Claude stream-json line.", { detail: err instanceof Error ? err.message : String(err) });
|
|
1691
|
+
});
|
|
1606
1692
|
const dispatchReader = createNdjsonLineReader((raw) => {
|
|
1607
1693
|
const line = parseClaudeStreamJsonLine(raw);
|
|
1608
1694
|
if (line === void 0) {
|
|
1609
1695
|
log("trace", "malformed-stream-json", "Failed to parse Claude stream-json line; skipping.", { linePreview: raw.slice(0, 256) });
|
|
1610
1696
|
return;
|
|
1611
1697
|
}
|
|
1612
|
-
handleClaudeLine(line);
|
|
1698
|
+
lineQueue.enqueue(() => handleClaudeLine(line));
|
|
1613
1699
|
return line;
|
|
1614
1700
|
});
|
|
1615
1701
|
grandchild.stdout?.on("data", (chunk) => {
|
|
@@ -1642,29 +1728,24 @@ var main = async () => {
|
|
|
1642
1728
|
if (line.type === "stream_event") {
|
|
1643
1729
|
if (line.parent_tool_use_id && command.forwardSubagentText !== true) return;
|
|
1644
1730
|
const delta = extractStreamEventTextDelta(line);
|
|
1645
|
-
if (delta !== void 0) {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
id,
|
|
1651
|
-
delta
|
|
1652
|
-
});
|
|
1653
|
-
}
|
|
1731
|
+
if (delta !== void 0) await writeEvent({
|
|
1732
|
+
type: "message_delta",
|
|
1733
|
+
id: claimPartialDeltaId(messageIdState),
|
|
1734
|
+
delta
|
|
1735
|
+
});
|
|
1654
1736
|
return;
|
|
1655
1737
|
}
|
|
1656
1738
|
if (line.type === "assistant" || line.type === "user") {
|
|
1657
1739
|
if (line.parent_tool_use_id && command.forwardSubagentText !== true) return;
|
|
1658
1740
|
const text = extractMessageText(line);
|
|
1659
1741
|
if (text.length > 0) {
|
|
1660
|
-
const id
|
|
1742
|
+
const { id, hadPriorPartialDelta } = claimCompleteMessageId(messageIdState);
|
|
1661
1743
|
await writeEvent({
|
|
1662
1744
|
type: "message_delta",
|
|
1663
1745
|
id,
|
|
1664
|
-
delta:
|
|
1746
|
+
delta: hadPriorPartialDelta ? "" : text,
|
|
1665
1747
|
isComplete: true
|
|
1666
1748
|
});
|
|
1667
|
-
partialMessageId = id;
|
|
1668
1749
|
}
|
|
1669
1750
|
return;
|
|
1670
1751
|
}
|
|
@@ -1692,6 +1773,7 @@ var main = async () => {
|
|
|
1692
1773
|
}).catch(() => {});
|
|
1693
1774
|
});
|
|
1694
1775
|
grandchild.on("exit", (code, signal) => {
|
|
1776
|
+
writeEvent({ type: "grandchild_exited" }).catch(() => {});
|
|
1695
1777
|
if (sawResult || shuttingDown) return;
|
|
1696
1778
|
writeEvent({
|
|
1697
1779
|
type: "error",
|