@xrkseek/harness 0.4.3 → 0.4.5
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/a2a/README.md +43 -0
- package/node_modules/@xrkseek/a2a/dist/client.d.ts +35 -0
- package/node_modules/@xrkseek/a2a/dist/client.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/client.js +229 -0
- package/node_modules/@xrkseek/a2a/dist/client.js.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/inbound.d.ts +42 -0
- package/node_modules/@xrkseek/a2a/dist/inbound.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/inbound.js +263 -0
- package/node_modules/@xrkseek/a2a/dist/inbound.js.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/index.d.ts +6 -0
- package/node_modules/@xrkseek/a2a/dist/index.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/index.js +6 -0
- package/node_modules/@xrkseek/a2a/dist/index.js.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/peers.d.ts +25 -0
- package/node_modules/@xrkseek/a2a/dist/peers.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/peers.js +90 -0
- package/node_modules/@xrkseek/a2a/dist/peers.js.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/protocol.d.ts +45 -0
- package/node_modules/@xrkseek/a2a/dist/protocol.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/protocol.js +172 -0
- package/node_modules/@xrkseek/a2a/dist/protocol.js.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/tools.d.ts +10 -0
- package/node_modules/@xrkseek/a2a/dist/tools.d.ts.map +1 -0
- package/node_modules/@xrkseek/a2a/dist/tools.js +145 -0
- package/node_modules/@xrkseek/a2a/dist/tools.js.map +1 -0
- package/node_modules/@xrkseek/a2a/package.json +28 -0
- package/node_modules/@xrkseek/attachment/README.md +23 -17
- package/node_modules/@xrkseek/attachment/dist/image-tokens.d.ts +30 -0
- package/node_modules/@xrkseek/attachment/dist/image-tokens.d.ts.map +1 -0
- package/node_modules/@xrkseek/attachment/dist/image-tokens.js +142 -0
- package/node_modules/@xrkseek/attachment/dist/image-tokens.js.map +1 -0
- package/node_modules/@xrkseek/attachment/dist/index.d.ts +2 -0
- package/node_modules/@xrkseek/attachment/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/attachment/dist/index.js +2 -0
- package/node_modules/@xrkseek/attachment/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/attachment/dist/request-projection.d.ts +20 -0
- package/node_modules/@xrkseek/attachment/dist/request-projection.d.ts.map +1 -0
- package/node_modules/@xrkseek/attachment/dist/request-projection.js +49 -0
- package/node_modules/@xrkseek/attachment/dist/request-projection.js.map +1 -0
- package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts +2 -11
- package/node_modules/@xrkseek/attachment-local/dist/request-image.d.ts.map +1 -1
- package/node_modules/@xrkseek/attachment-local/dist/request-image.js +3 -29
- package/node_modules/@xrkseek/attachment-local/dist/request-image.js.map +1 -1
- package/node_modules/@xrkseek/checkpoint/README.md +4 -2
- package/node_modules/@xrkseek/checkpoint/dist/process-git.d.ts +6 -0
- package/node_modules/@xrkseek/checkpoint/dist/process-git.d.ts.map +1 -1
- package/node_modules/@xrkseek/checkpoint/dist/process-git.js +23 -1
- package/node_modules/@xrkseek/checkpoint/dist/process-git.js.map +1 -1
- package/node_modules/@xrkseek/checkpoint/dist/store.d.ts +30 -2
- package/node_modules/@xrkseek/checkpoint/dist/store.d.ts.map +1 -1
- package/node_modules/@xrkseek/checkpoint/dist/store.js +58 -15
- package/node_modules/@xrkseek/checkpoint/dist/store.js.map +1 -1
- package/node_modules/@xrkseek/checkpoint/dist/types.d.ts +14 -4
- package/node_modules/@xrkseek/checkpoint/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/checkpoint/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/checkpoint/package.json +4 -1
- package/node_modules/@xrkseek/context-fragments/dist/index.d.ts +14 -0
- package/node_modules/@xrkseek/context-fragments/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/context-fragments/dist/index.js +33 -0
- package/node_modules/@xrkseek/context-fragments/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-agent/dist/index.d.ts +7 -0
- package/node_modules/@xrkseek/core-agent/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent/dist/index.js +6 -0
- package/node_modules/@xrkseek/core-agent/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/compaction.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/compaction.js +1 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/compaction.js.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts +12 -0
- package/node_modules/@xrkseek/core-agent-loop/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js +95 -50
- package/node_modules/@xrkseek/core-agent-loop/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.d.ts +14 -0
- package/node_modules/@xrkseek/core-session/dist/compaction.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.js +41 -1
- package/node_modules/@xrkseek/core-session/dist/compaction.js.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.d.ts +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.js +1 -1
- package/node_modules/@xrkseek/core-session/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-session/package.json +1 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/index.js +1 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-system-prompt/dist/time-context.d.ts +22 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/time-context.d.ts.map +1 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/time-context.js +47 -0
- package/node_modules/@xrkseek/core-system-prompt/dist/time-context.js.map +1 -0
- package/node_modules/@xrkseek/core-tools/dist/definition.d.ts +14 -0
- package/node_modules/@xrkseek/core-tools/dist/definition.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/definition.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/index.d.ts +2 -2
- package/node_modules/@xrkseek/core-tools/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/index.js +1 -1
- package/node_modules/@xrkseek/core-tools/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/materialize.d.ts +9 -3
- package/node_modules/@xrkseek/core-tools/dist/materialize.d.ts.map +1 -1
- package/node_modules/@xrkseek/core-tools/dist/materialize.js +38 -8
- package/node_modules/@xrkseek/core-tools/dist/materialize.js.map +1 -1
- package/node_modules/@xrkseek/exec-computer-use/dist/format.d.ts +2 -0
- package/node_modules/@xrkseek/exec-computer-use/dist/format.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-computer-use/dist/format.js +4 -1
- package/node_modules/@xrkseek/exec-computer-use/dist/format.js.map +1 -1
- package/node_modules/@xrkseek/exec-environment/README.md +21 -0
- package/node_modules/@xrkseek/exec-environment/dist/http.d.ts +34 -0
- package/node_modules/@xrkseek/exec-environment/dist/http.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/http.js +259 -0
- package/node_modules/@xrkseek/exec-environment/dist/http.js.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/index.d.ts +5 -0
- package/node_modules/@xrkseek/exec-environment/dist/index.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/index.js +4 -0
- package/node_modules/@xrkseek/exec-environment/dist/index.js.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/local.d.ts +11 -0
- package/node_modules/@xrkseek/exec-environment/dist/local.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/local.js +30 -0
- package/node_modules/@xrkseek/exec-environment/dist/local.js.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/resolve.d.ts +23 -0
- package/node_modules/@xrkseek/exec-environment/dist/resolve.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/resolve.js +39 -0
- package/node_modules/@xrkseek/exec-environment/dist/resolve.js.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/types.d.ts +33 -0
- package/node_modules/@xrkseek/exec-environment/dist/types.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-environment/dist/types.js +9 -0
- package/node_modules/@xrkseek/exec-environment/dist/types.js.map +1 -0
- package/node_modules/@xrkseek/exec-environment/package.json +28 -0
- package/node_modules/@xrkseek/exec-fs/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-fs/dist/index.js +1 -0
- package/node_modules/@xrkseek/exec-fs/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-fs/dist/present.d.ts +5 -2
- package/node_modules/@xrkseek/exec-fs/dist/present.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-fs/dist/present.js +22 -4
- package/node_modules/@xrkseek/exec-fs/dist/present.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/README.md +6 -4
- package/node_modules/@xrkseek/exec-image-gen/dist/format.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/format.js +6 -3
- package/node_modules/@xrkseek/exec-image-gen/dist/format.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts +4 -2
- package/node_modules/@xrkseek/exec-image-gen/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/index.js +4 -2
- package/node_modules/@xrkseek/exec-image-gen/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/memory.d.ts +4 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/memory.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/memory.js +16 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/memory.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts +5 -2
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js +88 -38
- package/node_modules/@xrkseek/exec-image-gen/dist/openai-http.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/references.d.ts +21 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/references.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/references.js +145 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/references.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/schema.d.ts +15 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/schema.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/schema.js +67 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/schema.js.map +1 -0
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.d.ts +5 -2
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.js +38 -36
- package/node_modules/@xrkseek/exec-image-gen/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts +34 -2
- package/node_modules/@xrkseek/exec-image-gen/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.js +16 -1
- package/node_modules/@xrkseek/exec-image-gen/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/README.md +3 -2
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts +2 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.js +2 -1
- package/node_modules/@xrkseek/exec-memory/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/provider.d.ts +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/provider.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/resolve.d.ts +15 -4
- package/node_modules/@xrkseek/exec-memory/dist/resolve.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/resolve.js +13 -3
- package/node_modules/@xrkseek/exec-memory/dist/resolve.js.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/sqlite.d.ts +19 -0
- package/node_modules/@xrkseek/exec-memory/dist/sqlite.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/sqlite.js +190 -0
- package/node_modules/@xrkseek/exec-memory/dist/sqlite.js.map +1 -0
- package/node_modules/@xrkseek/exec-memory/dist/write-path.d.ts +21 -0
- package/node_modules/@xrkseek/exec-memory/dist/write-path.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-memory/dist/write-path.js +128 -25
- package/node_modules/@xrkseek/exec-memory/dist/write-path.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/README.md +27 -19
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts +16 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js +90 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/catalog.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/format.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/format.js +3 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/format.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts +5 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/index.js +5 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/memory.d.ts +3 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/memory.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/memory.js +45 -4
- package/node_modules/@xrkseek/exec-video-gen/dist/memory.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts +3 -6
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js +81 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/openai-http.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/references.d.ts +24 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/references.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/references.js +151 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/references.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/schema.d.ts +15 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/schema.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/schema.js +104 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/schema.js.map +1 -0
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.d.ts +4 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.js +99 -70
- package/node_modules/@xrkseek/exec-video-gen/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts +73 -2
- package/node_modules/@xrkseek/exec-video-gen/dist/types.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.js +20 -1
- package/node_modules/@xrkseek/exec-video-gen/dist/types.js.map +1 -1
- package/node_modules/@xrkseek/exec-web/README.md +2 -2
- package/node_modules/@xrkseek/exec-web/dist/browser-tools.d.ts +3 -0
- package/node_modules/@xrkseek/exec-web/dist/browser-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/browser-tools.js +3 -0
- package/node_modules/@xrkseek/exec-web/dist/browser-tools.js.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.d.ts +32 -0
- package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.d.ts.map +1 -0
- package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.js +141 -0
- package/node_modules/@xrkseek/exec-web/dist/browser-vault-tools.js.map +1 -0
- package/node_modules/@xrkseek/exec-web/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/exec-web/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/exec-web/dist/index.js +1 -0
- package/node_modules/@xrkseek/exec-web/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/llm-deepseek/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/index.js +2 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts +13 -3
- package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.d.ts.map +1 -1
- package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js +27 -4
- package/node_modules/@xrkseek/llm-deepseek/dist/request-policy.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/README.md +8 -8
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts +11 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/preset.js +11 -3
- package/node_modules/@xrkseek/preset-harness/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-harness/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-minimal/README.md +2 -2
- package/node_modules/@xrkseek/preset-minimal/dist/preset.js +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-minimal/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/preset-server/README.md +5 -5
- package/node_modules/@xrkseek/preset-server/dist/preset.d.ts.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/preset.js +3 -2
- package/node_modules/@xrkseek/preset-server/dist/preset.js.map +1 -1
- package/node_modules/@xrkseek/preset-server/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@xrkseek/protocol/dist/session-events.d.ts +9 -0
- package/node_modules/@xrkseek/protocol/dist/session-events.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/session-events.js.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/validate.d.ts.map +1 -1
- package/node_modules/@xrkseek/protocol/dist/validate.js +9 -0
- package/node_modules/@xrkseek/protocol/dist/validate.js.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/server-config/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/index.js +1 -0
- package/node_modules/@xrkseek/server-config/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-config/dist/json-text.d.ts +8 -0
- package/node_modules/@xrkseek/server-config/dist/json-text.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-config/dist/json-text.js +12 -0
- package/node_modules/@xrkseek/server-config/dist/json-text.js.map +1 -0
- package/node_modules/@xrkseek/server-cron/README.md +3 -2
- package/node_modules/@xrkseek/server-cron/dist/executions.d.ts +31 -0
- package/node_modules/@xrkseek/server-cron/dist/executions.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-cron/dist/executions.js +95 -0
- package/node_modules/@xrkseek/server-cron/dist/executions.js.map +1 -0
- package/node_modules/@xrkseek/server-cron/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/server-cron/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-cron/dist/index.js +6 -0
- package/node_modules/@xrkseek/server-cron/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-cron/dist/scheduler.d.ts +4 -0
- package/node_modules/@xrkseek/server-cron/dist/scheduler.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-cron/dist/scheduler.js +33 -24
- package/node_modules/@xrkseek/server-cron/dist/scheduler.js.map +1 -1
- package/node_modules/@xrkseek/server-cron/dist/tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-cron/dist/tools.js +44 -6
- package/node_modules/@xrkseek/server-cron/dist/tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/dispatch.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/dispatch.js +2 -0
- package/node_modules/@xrkseek/server-face/dist/dispatch.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.d.ts +37 -2
- package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.js +191 -28
- package/node_modules/@xrkseek/server-face/dist/external-agent-runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/handlers/worktree.d.ts +10 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/worktree.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/worktree.js +33 -0
- package/node_modules/@xrkseek/server-face/dist/handlers/worktree.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/host-open-path.d.ts +9 -0
- package/node_modules/@xrkseek/server-face/dist/host-open-path.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/host-open-path.js +13 -7
- package/node_modules/@xrkseek/server-face/dist/host-open-path.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.d.ts +2 -2
- package/node_modules/@xrkseek/server-face/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-provider-context.d.ts +2 -0
- package/node_modules/@xrkseek/server-face/dist/llm-provider-context.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-provider-context.js +13 -0
- package/node_modules/@xrkseek/server-face/dist/llm-provider-context.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-resolve.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/llm-resolve.js +3 -1
- package/node_modules/@xrkseek/server-face/dist/llm-resolve.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts +4 -0
- package/node_modules/@xrkseek/server-face/dist/model-catalog.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js +24 -5
- package/node_modules/@xrkseek/server-face/dist/model-catalog.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/presets-catalog.js +5 -5
- package/node_modules/@xrkseek/server-face/dist/presets-catalog.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/runtime.js +14 -2
- package/node_modules/@xrkseek/server-face/dist/runtime.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/select-session-model.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/select-session-model.js +8 -0
- package/node_modules/@xrkseek/server-face/dist/select-session-model.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-model-store.d.ts +11 -0
- package/node_modules/@xrkseek/server-face/dist/session-model-store.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/session-model-store.js +66 -0
- package/node_modules/@xrkseek/server-face/dist/session-model-store.js.map +1 -0
- package/node_modules/@xrkseek/server-face/dist/session-status.d.ts +64 -13
- package/node_modules/@xrkseek/server-face/dist/session-status.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/session-status.js +173 -5
- package/node_modules/@xrkseek/server-face/dist/session-status.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js +4 -5
- package/node_modules/@xrkseek/server-face/dist/settings-credentials.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js +36 -4
- package/node_modules/@xrkseek/server-face/dist/settings-schemas.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js +1 -1
- package/node_modules/@xrkseek/server-face/dist/subagent-tools.js.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.d.ts +15 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.js +35 -7
- package/node_modules/@xrkseek/server-face/dist/workspace-checkpoint.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.d.ts +11 -0
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.d.ts.map +1 -0
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js +22 -0
- package/node_modules/@xrkseek/server-host/dist/a2a-inbound-public.js.map +1 -0
- package/node_modules/@xrkseek/server-host/dist/index.d.ts +3 -0
- package/node_modules/@xrkseek/server-host/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/index.js +178 -48
- package/node_modules/@xrkseek/server-host/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/mcp-wire.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-host/dist/mcp-wire.js +3 -3
- package/node_modules/@xrkseek/server-host/dist/mcp-wire.js.map +1 -1
- package/node_modules/@xrkseek/server-host/package.json +2 -0
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.d.ts +2 -2
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.js +9 -4
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/embedded-vector-store.js.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.d.ts +37 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.d.ts.map +1 -1
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.js +125 -9
- package/node_modules/@xrkseek/server-http/dist/dsh-compat/memory-embeddings.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/index.d.ts +1 -0
- package/node_modules/@xrkseek/workspace/dist/index.d.ts.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/index.js +1 -0
- package/node_modules/@xrkseek/workspace/dist/index.js.map +1 -1
- package/node_modules/@xrkseek/workspace/dist/skill-curator.d.ts +46 -0
- package/node_modules/@xrkseek/workspace/dist/skill-curator.d.ts.map +1 -0
- package/node_modules/@xrkseek/workspace/dist/skill-curator.js +114 -0
- package/node_modules/@xrkseek/workspace/dist/skill-curator.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { A2A_PROTOCOL_VERSION, ROLE_AGENT, ROLE_USER, STATE_COMPLETED, STATE_REJECTED, TurnTracker, extractText, maxPingpongTurns, newContextId, newTaskId, persistMessage, textMessage, } from "./protocol.js";
|
|
3
|
+
function sendJson(res, status, body) {
|
|
4
|
+
const raw = JSON.stringify(body);
|
|
5
|
+
res.writeHead(status, {
|
|
6
|
+
"content-type": "application/json; charset=utf-8",
|
|
7
|
+
"cache-control": "no-store",
|
|
8
|
+
});
|
|
9
|
+
res.end(raw);
|
|
10
|
+
}
|
|
11
|
+
function readBody(req) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const chunks = [];
|
|
14
|
+
req.on("data", (c) => chunks.push(c));
|
|
15
|
+
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
|
|
16
|
+
req.on("error", reject);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function safeEqualToken(a, b) {
|
|
20
|
+
const ba = Buffer.from(a);
|
|
21
|
+
const bb = Buffer.from(b);
|
|
22
|
+
if (ba.length !== bb.length)
|
|
23
|
+
return false;
|
|
24
|
+
try {
|
|
25
|
+
return timingSafeEqual(ba, bb);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Parse `A2A_PEER_TOKENS=alice:tok1,bob:tok2` → name → token. */
|
|
32
|
+
export function parsePeerTokens(raw) {
|
|
33
|
+
const out = new Map();
|
|
34
|
+
if (!raw?.trim())
|
|
35
|
+
return out;
|
|
36
|
+
for (const part of raw.split(",")) {
|
|
37
|
+
const idx = part.indexOf(":");
|
|
38
|
+
if (idx <= 0)
|
|
39
|
+
continue;
|
|
40
|
+
const name = part.slice(0, idx).trim();
|
|
41
|
+
const token = part.slice(idx + 1).trim();
|
|
42
|
+
if (name && token)
|
|
43
|
+
out.set(name, token);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
export function buildA2aAgentCard(options) {
|
|
48
|
+
const iface = {
|
|
49
|
+
url: options.url,
|
|
50
|
+
protocolBinding: "JSONRPC",
|
|
51
|
+
protocolVersion: A2A_PROTOCOL_VERSION,
|
|
52
|
+
};
|
|
53
|
+
const card = {
|
|
54
|
+
name: options.name,
|
|
55
|
+
description: options.description,
|
|
56
|
+
url: options.url,
|
|
57
|
+
version: "1.0.0",
|
|
58
|
+
provider: { organization: "XRK Harness", url: options.url },
|
|
59
|
+
supportedInterfaces: [iface],
|
|
60
|
+
capabilities: {
|
|
61
|
+
streaming: false,
|
|
62
|
+
pushNotifications: false,
|
|
63
|
+
stateTransitionHistory: false,
|
|
64
|
+
extendedAgentCard: false,
|
|
65
|
+
},
|
|
66
|
+
defaultInputModes: ["text/plain"],
|
|
67
|
+
defaultOutputModes: ["text/plain"],
|
|
68
|
+
skills: [
|
|
69
|
+
{
|
|
70
|
+
id: "chat",
|
|
71
|
+
name: "chat",
|
|
72
|
+
description: "Send a text task to this XRK Host (message/send).",
|
|
73
|
+
tags: ["chat"],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
if (options.authRequired) {
|
|
78
|
+
card.securitySchemes = { bearer: { type: "http", scheme: "bearer" } };
|
|
79
|
+
card.security = [{ bearer: [] }];
|
|
80
|
+
}
|
|
81
|
+
return card;
|
|
82
|
+
}
|
|
83
|
+
function authorize(req, env) {
|
|
84
|
+
const bearer = env.XRK_A2A_BEARER_TOKEN?.trim() || env.A2A_BEARER_TOKEN?.trim();
|
|
85
|
+
const peers = parsePeerTokens(env.XRK_A2A_PEER_TOKENS?.trim() || env.A2A_PEER_TOKENS);
|
|
86
|
+
const authRequired = Boolean(bearer) || peers.size > 0;
|
|
87
|
+
if (!authRequired) {
|
|
88
|
+
return { ok: true, peer: `ip:${req.socket.remoteAddress ?? "local"}` };
|
|
89
|
+
}
|
|
90
|
+
const header = String(req.headers.authorization ?? "");
|
|
91
|
+
const m = /^Bearer\s+(\S+)/i.exec(header);
|
|
92
|
+
const token = m?.[1] ?? "";
|
|
93
|
+
if (!token) {
|
|
94
|
+
return {
|
|
95
|
+
ok: false,
|
|
96
|
+
status: 401,
|
|
97
|
+
error: {
|
|
98
|
+
jsonrpc: "2.0",
|
|
99
|
+
error: { code: -32050, message: "unauthorized" },
|
|
100
|
+
id: null,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
for (const [name, peerTok] of peers) {
|
|
105
|
+
if (safeEqualToken(token, peerTok)) {
|
|
106
|
+
return { ok: true, peer: name };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (bearer && safeEqualToken(token, bearer)) {
|
|
110
|
+
return { ok: true, peer: `ip:${req.socket.remoteAddress ?? "local"}` };
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
status: 401,
|
|
115
|
+
error: {
|
|
116
|
+
jsonrpc: "2.0",
|
|
117
|
+
error: { code: -32050, message: "unauthorized" },
|
|
118
|
+
id: null,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function handleMessageSend(params, peer, options, tracker) {
|
|
123
|
+
const message = (params.message ?? params);
|
|
124
|
+
const text = extractText(message).trim();
|
|
125
|
+
const contextId = String(message.contextId ?? params.contextId ?? "").trim() ||
|
|
126
|
+
newContextId();
|
|
127
|
+
const taskId = String(params.taskId ?? message.taskId ?? "").trim() || newTaskId();
|
|
128
|
+
const env = options.env ?? process.env;
|
|
129
|
+
const turns = tracker.track(contextId);
|
|
130
|
+
const cap = maxPingpongTurns(env);
|
|
131
|
+
if (turns > cap) {
|
|
132
|
+
return {
|
|
133
|
+
task: {
|
|
134
|
+
id: taskId,
|
|
135
|
+
contextId,
|
|
136
|
+
status: {
|
|
137
|
+
state: STATE_REJECTED,
|
|
138
|
+
message: textMessage(ROLE_AGENT, `rejected: pingpong turn cap ${cap} reached for context`, contextId),
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const persistOpts = options.conversationsRoot
|
|
144
|
+
? { root: options.conversationsRoot }
|
|
145
|
+
: undefined;
|
|
146
|
+
if (text) {
|
|
147
|
+
persistMessage(contextId, ROLE_USER, text, taskId, persistOpts);
|
|
148
|
+
}
|
|
149
|
+
let reply;
|
|
150
|
+
if (options.onMessage) {
|
|
151
|
+
reply = String(await options.onMessage({ text, contextId, taskId, peer })).trim();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
reply =
|
|
155
|
+
text.length > 0
|
|
156
|
+
? `A2A inbound accepted from ${peer}: ${text.slice(0, 400)}`
|
|
157
|
+
: `A2A inbound accepted from ${peer} (empty message)`;
|
|
158
|
+
}
|
|
159
|
+
persistMessage(contextId, ROLE_AGENT, reply, taskId, persistOpts);
|
|
160
|
+
return {
|
|
161
|
+
task: {
|
|
162
|
+
id: taskId,
|
|
163
|
+
contextId,
|
|
164
|
+
status: {
|
|
165
|
+
state: STATE_COMPLETED,
|
|
166
|
+
message: textMessage(ROLE_AGENT, reply, contextId),
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Claim A2A inbound paths. Returns true when the request was handled.
|
|
173
|
+
* Paths: `GET /.well-known/agent-card.json` · `GET /.well-known/agent.json` ·
|
|
174
|
+
* `POST /a2a` (JSON-RPC) · optional `GET /a2a/health`.
|
|
175
|
+
*/
|
|
176
|
+
export function createA2aInboundHandler(options) {
|
|
177
|
+
const env = options.env ?? process.env;
|
|
178
|
+
const tracker = options.turnTracker ?? new TurnTracker();
|
|
179
|
+
const name = options.name?.trim() || "XRK Harness";
|
|
180
|
+
const description = options.description?.trim() ||
|
|
181
|
+
"XRK Host A2A inbound (Agent Card + message/send). Face session injection optional.";
|
|
182
|
+
const authRequired = Boolean(env.XRK_A2A_BEARER_TOKEN?.trim() ||
|
|
183
|
+
env.A2A_BEARER_TOKEN?.trim() ||
|
|
184
|
+
env.XRK_A2A_PEER_TOKENS?.trim() ||
|
|
185
|
+
env.A2A_PEER_TOKENS?.trim());
|
|
186
|
+
const card = buildA2aAgentCard({
|
|
187
|
+
name,
|
|
188
|
+
url: options.url,
|
|
189
|
+
description,
|
|
190
|
+
authRequired,
|
|
191
|
+
});
|
|
192
|
+
return async (req, res) => {
|
|
193
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
194
|
+
const path = url.pathname;
|
|
195
|
+
const method = (req.method ?? "GET").toUpperCase();
|
|
196
|
+
if (method === "GET" &&
|
|
197
|
+
(path === "/.well-known/agent-card.json" ||
|
|
198
|
+
path === "/.well-known/agent.json")) {
|
|
199
|
+
sendJson(res, 200, card);
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
if (method === "GET" && path === "/a2a/health") {
|
|
203
|
+
sendJson(res, 200, {
|
|
204
|
+
ok: true,
|
|
205
|
+
protocol: A2A_PROTOCOL_VERSION,
|
|
206
|
+
authRequired,
|
|
207
|
+
});
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
if (method === "POST" && (path === "/a2a" || path === "/a2a/")) {
|
|
211
|
+
const auth = authorize(req, env);
|
|
212
|
+
if (!auth.ok) {
|
|
213
|
+
sendJson(res, auth.status, auth.error);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
let body;
|
|
217
|
+
try {
|
|
218
|
+
body = JSON.parse((await readBody(req)) || "{}");
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
sendJson(res, 400, {
|
|
222
|
+
jsonrpc: "2.0",
|
|
223
|
+
error: { code: -32700, message: "parse error" },
|
|
224
|
+
id: null,
|
|
225
|
+
});
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
const id = body.id ?? null;
|
|
229
|
+
const rpcMethod = String(body.method ?? "");
|
|
230
|
+
if (rpcMethod !== "message/send") {
|
|
231
|
+
sendJson(res, 200, {
|
|
232
|
+
jsonrpc: "2.0",
|
|
233
|
+
id,
|
|
234
|
+
error: {
|
|
235
|
+
code: -32601,
|
|
236
|
+
message: `method not found: ${rpcMethod || "(missing)"}`,
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
const params = body.params && typeof body.params === "object"
|
|
242
|
+
? body.params
|
|
243
|
+
: {};
|
|
244
|
+
try {
|
|
245
|
+
const result = await handleMessageSend(params, auth.peer, options, tracker);
|
|
246
|
+
sendJson(res, 200, { jsonrpc: "2.0", id, result });
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
sendJson(res, 200, {
|
|
250
|
+
jsonrpc: "2.0",
|
|
251
|
+
id,
|
|
252
|
+
error: {
|
|
253
|
+
code: -32000,
|
|
254
|
+
message: err instanceof Error ? err.message : String(err),
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
return false;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=inbound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbound.js","sourceRoot":"","sources":["../src/inbound.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,GACZ,MAAM,eAAe,CAAC;AAuBvB,SAAS,QAAQ,CACf,GAAmB,EACnB,MAAc,EACd,IAAa;IAEb,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE;QACpB,cAAc,EAAE,iCAAiC;QACjD,eAAe,EAAE,UAAU;KAC5B,CAAC,CAAC;IACH,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,GAAoB;IACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,C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,KAAK,QAAQ;gBAC5C,CAAC,CAAE,IAAI,CAAC,MAAkC;gBAC1C,CAAC,CAAC,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC,MAAM,EACN,IAAI,CAAC,IAAI,EACT,OAAO,EACP,OAAO,CACR,CAAC;gBACF,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE;oBACjB,OAAO,EAAE,KAAK;oBACd,EAAE;oBACF,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC,KAAK;wBACZ,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;qBAC1D;iBACF,CAAC,CAAC;YACL,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { A2A_PROTOCOL_VERSION, ROLE_USER, ROLE_AGENT, STATE_COMPLETED, STATE_INPUT_REQUIRED, STATE_REJECTED, TurnTracker, a2aConversationsDir, extractText, listPersistedContexts, loadConversation, maxPingpongTurns, newContextId, newTaskId, persistMessage, textMessage, unwrapSendMessageResponse, type PersistedA2aMessage, } from "./protocol.js";
|
|
2
|
+
export { loadA2aPeers, resolveA2aPeer, type A2aPeer, type A2aPeerAuth, type A2aPeerMap, } from "./peers.js";
|
|
3
|
+
export { A2aClient, createA2aClient, type A2aCallResult, type A2aClientOptions, } from "./client.js";
|
|
4
|
+
export { createA2aTools, type CreateA2aToolsOptions } from "./tools.js";
|
|
5
|
+
export { buildA2aAgentCard, createA2aInboundHandler, parsePeerTokens, type A2aInboundOptions, } from "./inbound.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { A2A_PROTOCOL_VERSION, ROLE_USER, ROLE_AGENT, STATE_COMPLETED, STATE_INPUT_REQUIRED, STATE_REJECTED, TurnTracker, a2aConversationsDir, extractText, listPersistedContexts, loadConversation, maxPingpongTurns, newContextId, newTaskId, persistMessage, textMessage, unwrapSendMessageResponse, } from "./protocol.js";
|
|
2
|
+
export { loadA2aPeers, resolveA2aPeer, } from "./peers.js";
|
|
3
|
+
export { A2aClient, createA2aClient, } from "./client.js";
|
|
4
|
+
export { createA2aTools } from "./tools.js";
|
|
5
|
+
export { buildA2aAgentCard, createA2aInboundHandler, parsePeerTokens, } from "./inbound.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,yBAAyB,GAE1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,YAAY,EACZ,cAAc,GAIf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,SAAS,EACT,eAAe,GAGhB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAA8B,MAAM,YAAY,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GAEhB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve configured A2A peers from env (`XRK_A2A_AGENTS` JSON) or a home file.
|
|
3
|
+
*/
|
|
4
|
+
export interface A2aPeerAuth {
|
|
5
|
+
readonly type?: string;
|
|
6
|
+
readonly token?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface A2aPeer {
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly auth?: A2aPeerAuth;
|
|
11
|
+
readonly timeout?: number;
|
|
12
|
+
readonly capabilities?: readonly string[];
|
|
13
|
+
readonly tenant?: string;
|
|
14
|
+
}
|
|
15
|
+
export type A2aPeerMap = Readonly<Record<string, A2aPeer>>;
|
|
16
|
+
/** Load peers from `XRK_A2A_AGENTS` or `{XRK_HOME}/a2a_agents.json`. */
|
|
17
|
+
export declare function loadA2aPeers(env?: NodeJS.ProcessEnv): A2aPeerMap;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a peer by configured name or accept a direct http(s) URL.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveA2aPeer(agent: string, peers?: A2aPeerMap): {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly peer: A2aPeer;
|
|
24
|
+
} | undefined;
|
|
25
|
+
//# sourceMappingURL=peers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peers.d.ts","sourceRoot":"","sources":["../src/peers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAuD3D,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,UAAU,CAmB7E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,UAA2B,GACjC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAShE"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve configured A2A peers from env (`XRK_A2A_AGENTS` JSON) or a home file.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { resolveXrkHome } from "@xrkseek/xrk-home-paths";
|
|
7
|
+
function parsePeersJson(raw) {
|
|
8
|
+
const parsed = JSON.parse(raw);
|
|
9
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
10
|
+
throw new Error("XRK_A2A_AGENTS must be a JSON object of name → peer");
|
|
11
|
+
}
|
|
12
|
+
const out = {};
|
|
13
|
+
for (const [name, value] of Object.entries(parsed)) {
|
|
14
|
+
if (!name.trim() || value === null || typeof value !== "object")
|
|
15
|
+
continue;
|
|
16
|
+
const rec = value;
|
|
17
|
+
const url = typeof rec.url === "string" ? rec.url.trim() : "";
|
|
18
|
+
if (!url)
|
|
19
|
+
continue;
|
|
20
|
+
let auth;
|
|
21
|
+
if (rec.auth !== null && typeof rec.auth === "object") {
|
|
22
|
+
const authRaw = rec.auth;
|
|
23
|
+
const type = typeof authRaw.type === "string" && authRaw.type.trim()
|
|
24
|
+
? authRaw.type.trim()
|
|
25
|
+
: undefined;
|
|
26
|
+
const token = typeof authRaw.token === "string" && authRaw.token.trim()
|
|
27
|
+
? authRaw.token.trim()
|
|
28
|
+
: undefined;
|
|
29
|
+
if (type !== undefined || token !== undefined) {
|
|
30
|
+
auth = {
|
|
31
|
+
...(type !== undefined ? { type } : {}),
|
|
32
|
+
...(token !== undefined ? { token } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const capabilities = Array.isArray(rec.capabilities)
|
|
37
|
+
? rec.capabilities.filter((c) => typeof c === "string")
|
|
38
|
+
: undefined;
|
|
39
|
+
const timeout = typeof rec.timeout === "number" ? rec.timeout : undefined;
|
|
40
|
+
const tenant = typeof rec.tenant === "string" && rec.tenant.trim()
|
|
41
|
+
? rec.tenant.trim()
|
|
42
|
+
: undefined;
|
|
43
|
+
out[name.trim()] = {
|
|
44
|
+
url,
|
|
45
|
+
...(timeout !== undefined ? { timeout } : {}),
|
|
46
|
+
...(tenant !== undefined ? { tenant } : {}),
|
|
47
|
+
...(capabilities !== undefined && capabilities.length > 0
|
|
48
|
+
? { capabilities }
|
|
49
|
+
: {}),
|
|
50
|
+
...(auth !== undefined ? { auth } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
/** Load peers from `XRK_A2A_AGENTS` or `{XRK_HOME}/a2a_agents.json`. */
|
|
56
|
+
export function loadA2aPeers(env = process.env) {
|
|
57
|
+
const inline = env.XRK_A2A_AGENTS?.trim();
|
|
58
|
+
if (inline) {
|
|
59
|
+
try {
|
|
60
|
+
return parsePeersJson(inline);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
throw new Error(`XRK_A2A_AGENTS: ${err instanceof Error ? err.message : String(err)}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const file = env.XRK_A2A_AGENTS_FILE?.trim() ||
|
|
67
|
+
path.join(resolveXrkHome(env), "a2a_agents.json");
|
|
68
|
+
try {
|
|
69
|
+
return parsePeersJson(readFileSync(file, "utf8"));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a peer by configured name or accept a direct http(s) URL.
|
|
77
|
+
*/
|
|
78
|
+
export function resolveA2aPeer(agent, peers = loadA2aPeers()) {
|
|
79
|
+
const key = agent.trim();
|
|
80
|
+
if (!key)
|
|
81
|
+
return undefined;
|
|
82
|
+
if (/^https?:\/\//i.test(key)) {
|
|
83
|
+
return { label: key, peer: { url: key } };
|
|
84
|
+
}
|
|
85
|
+
const peer = peers[key];
|
|
86
|
+
if (!peer?.url)
|
|
87
|
+
return undefined;
|
|
88
|
+
return { label: key, peer };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=peers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,QAAoB,YAAY,EAAE;IAElC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACzB,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IAC5C,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,IAAI,EAAE,GAAG;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A v1.0 wire helpers + conversation persistence + anti-loop turn tracker.
|
|
3
|
+
* Learned from Hermes `plugins/platforms/a2a/protocol.py` (stdlib-shaped).
|
|
4
|
+
*/
|
|
5
|
+
export declare const A2A_PROTOCOL_VERSION = "1.0";
|
|
6
|
+
export declare const ROLE_USER = "ROLE_USER";
|
|
7
|
+
export declare const ROLE_AGENT = "ROLE_AGENT";
|
|
8
|
+
export declare const STATE_COMPLETED = "TASK_STATE_COMPLETED";
|
|
9
|
+
export declare const STATE_INPUT_REQUIRED = "TASK_STATE_INPUT_REQUIRED";
|
|
10
|
+
export declare const STATE_REJECTED = "TASK_STATE_REJECTED";
|
|
11
|
+
export declare function newContextId(): string;
|
|
12
|
+
export declare function newTaskId(): string;
|
|
13
|
+
/** Anti-loop turn cap per context (`XRK_A2A_MAX_PINGPONG_TURNS`, hard max 20). */
|
|
14
|
+
export declare function maxPingpongTurns(env?: NodeJS.ProcessEnv): number;
|
|
15
|
+
export declare function textMessage(role: string, text: string, contextId?: string): Record<string, unknown>;
|
|
16
|
+
export declare function extractText(node: unknown): string;
|
|
17
|
+
export declare function unwrapSendMessageResponse(result: unknown): unknown;
|
|
18
|
+
export interface PersistedA2aMessage {
|
|
19
|
+
readonly ts: number;
|
|
20
|
+
readonly role: string;
|
|
21
|
+
readonly text: string;
|
|
22
|
+
readonly task_id: string;
|
|
23
|
+
}
|
|
24
|
+
/** Counts turns per context_id; beyond {@link maxPingpongTurns} callers should reject. */
|
|
25
|
+
export declare class TurnTracker {
|
|
26
|
+
private readonly turns;
|
|
27
|
+
track(contextId: string, now?: number): number;
|
|
28
|
+
reset(contextId: string): void;
|
|
29
|
+
peek(contextId: string): number;
|
|
30
|
+
}
|
|
31
|
+
export declare function a2aConversationsDir(env?: NodeJS.ProcessEnv): string;
|
|
32
|
+
/** Append one message to the context's on-disk log. Never throws. */
|
|
33
|
+
export declare function persistMessage(contextId: string, role: string, text: string, taskId?: string, options?: {
|
|
34
|
+
readonly root?: string;
|
|
35
|
+
readonly now?: number;
|
|
36
|
+
}): void;
|
|
37
|
+
/** Last `limit` messages for a context (empty if missing / unreadable). */
|
|
38
|
+
export declare function loadConversation(contextId: string, limit?: number, options?: {
|
|
39
|
+
readonly root?: string;
|
|
40
|
+
}): PersistedA2aMessage[];
|
|
41
|
+
/** Context ids that have persisted conversations. */
|
|
42
|
+
export declare function listPersistedContexts(options?: {
|
|
43
|
+
readonly root?: string;
|
|
44
|
+
}): string[];
|
|
45
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,eAAO,MAAM,eAAe,yBAAyB,CAAC;AACtD,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAChE,eAAO,MAAM,cAAc,wBAA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AAI,CAcN;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,SAAK,EACV,OAAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACvC,mBAAmB,EAAE,CAkBvB;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CACnC,OAAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACvC,MAAM,EAAE,CAUV"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A v1.0 wire helpers + conversation persistence + anti-loop turn tracker.
|
|
3
|
+
* Learned from Hermes `plugins/platforms/a2a/protocol.py` (stdlib-shaped).
|
|
4
|
+
*/
|
|
5
|
+
import { appendFileSync, mkdirSync, readdirSync, readFileSync } from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { resolveXrkHome } from "@xrkseek/xrk-home-paths";
|
|
9
|
+
export const A2A_PROTOCOL_VERSION = "1.0";
|
|
10
|
+
export const ROLE_USER = "ROLE_USER";
|
|
11
|
+
export const ROLE_AGENT = "ROLE_AGENT";
|
|
12
|
+
export const STATE_COMPLETED = "TASK_STATE_COMPLETED";
|
|
13
|
+
export const STATE_INPUT_REQUIRED = "TASK_STATE_INPUT_REQUIRED";
|
|
14
|
+
export const STATE_REJECTED = "TASK_STATE_REJECTED";
|
|
15
|
+
const DEFAULT_MAX_PINGPONG = 5;
|
|
16
|
+
const HARD_MAX_PINGPONG = 20;
|
|
17
|
+
const TURN_TTL_MS = 60 * 60 * 1000;
|
|
18
|
+
export function newContextId() {
|
|
19
|
+
return `ctx_${randomUUID().replace(/-/g, "")}`;
|
|
20
|
+
}
|
|
21
|
+
export function newTaskId() {
|
|
22
|
+
return `task_${randomUUID().replace(/-/g, "")}`;
|
|
23
|
+
}
|
|
24
|
+
function envInt(name, fallback, env) {
|
|
25
|
+
const raw = env[name]?.trim();
|
|
26
|
+
if (!raw)
|
|
27
|
+
return fallback;
|
|
28
|
+
const n = Number(raw);
|
|
29
|
+
return Number.isFinite(n) ? Math.trunc(n) : fallback;
|
|
30
|
+
}
|
|
31
|
+
/** Anti-loop turn cap per context (`XRK_A2A_MAX_PINGPONG_TURNS`, hard max 20). */
|
|
32
|
+
export function maxPingpongTurns(env = process.env) {
|
|
33
|
+
const v = envInt("XRK_A2A_MAX_PINGPONG_TURNS", DEFAULT_MAX_PINGPONG, env);
|
|
34
|
+
return Math.max(1, Math.min(v, HARD_MAX_PINGPONG));
|
|
35
|
+
}
|
|
36
|
+
export function textMessage(role, text, contextId = "") {
|
|
37
|
+
const msg = {
|
|
38
|
+
role,
|
|
39
|
+
parts: [{ text }],
|
|
40
|
+
messageId: `msg_${randomUUID().replace(/-/g, "")}`,
|
|
41
|
+
};
|
|
42
|
+
if (contextId)
|
|
43
|
+
msg.contextId = contextId;
|
|
44
|
+
return msg;
|
|
45
|
+
}
|
|
46
|
+
export function extractText(node) {
|
|
47
|
+
if (node === null || node === undefined)
|
|
48
|
+
return "";
|
|
49
|
+
if (typeof node === "string")
|
|
50
|
+
return node;
|
|
51
|
+
if (typeof node !== "object")
|
|
52
|
+
return String(node);
|
|
53
|
+
const rec = node;
|
|
54
|
+
if (typeof rec.text === "string")
|
|
55
|
+
return rec.text;
|
|
56
|
+
if (Array.isArray(rec.parts)) {
|
|
57
|
+
return rec.parts
|
|
58
|
+
.map((p) => extractText(p))
|
|
59
|
+
.filter(Boolean)
|
|
60
|
+
.join("\n");
|
|
61
|
+
}
|
|
62
|
+
if (rec.message)
|
|
63
|
+
return extractText(rec.message);
|
|
64
|
+
if (Array.isArray(rec.artifacts)) {
|
|
65
|
+
for (const a of rec.artifacts) {
|
|
66
|
+
const t = extractText(a);
|
|
67
|
+
if (t)
|
|
68
|
+
return t;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (rec.status && typeof rec.status === "object") {
|
|
72
|
+
return extractText(rec.status.message);
|
|
73
|
+
}
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
export function unwrapSendMessageResponse(result) {
|
|
77
|
+
if (result !== null && typeof result === "object") {
|
|
78
|
+
const rec = result;
|
|
79
|
+
if (rec.task && typeof rec.task === "object")
|
|
80
|
+
return rec.task;
|
|
81
|
+
if (rec.message && typeof rec.message === "object")
|
|
82
|
+
return rec.message;
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
/** Counts turns per context_id; beyond {@link maxPingpongTurns} callers should reject. */
|
|
87
|
+
export class TurnTracker {
|
|
88
|
+
turns = new Map();
|
|
89
|
+
track(contextId, now = Date.now()) {
|
|
90
|
+
for (const [cid, v] of this.turns) {
|
|
91
|
+
if (now - v.lastSeen > TURN_TTL_MS)
|
|
92
|
+
this.turns.delete(cid);
|
|
93
|
+
}
|
|
94
|
+
const prev = this.turns.get(contextId);
|
|
95
|
+
const count = (prev?.count ?? 0) + 1;
|
|
96
|
+
this.turns.set(contextId, { count, lastSeen: now });
|
|
97
|
+
return count;
|
|
98
|
+
}
|
|
99
|
+
reset(contextId) {
|
|
100
|
+
this.turns.delete(contextId);
|
|
101
|
+
}
|
|
102
|
+
peek(contextId) {
|
|
103
|
+
return this.turns.get(contextId)?.count ?? 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function a2aConversationsDir(env = process.env) {
|
|
107
|
+
const override = env.XRK_A2A_CONVERSATIONS_DIR?.trim();
|
|
108
|
+
if (override)
|
|
109
|
+
return path.resolve(override);
|
|
110
|
+
return path.join(resolveXrkHome(env), "a2a_conversations");
|
|
111
|
+
}
|
|
112
|
+
function convPath(contextId, root) {
|
|
113
|
+
const safe = [...(contextId || "default")]
|
|
114
|
+
.filter((c) => /[a-zA-Z0-9_-]/.test(c))
|
|
115
|
+
.join("") || "default";
|
|
116
|
+
return path.join(root, `${safe}.jsonl`);
|
|
117
|
+
}
|
|
118
|
+
/** Append one message to the context's on-disk log. Never throws. */
|
|
119
|
+
export function persistMessage(contextId, role, text, taskId = "", options = {}) {
|
|
120
|
+
try {
|
|
121
|
+
const root = options.root ?? a2aConversationsDir();
|
|
122
|
+
mkdirSync(root, { recursive: true });
|
|
123
|
+
const row = {
|
|
124
|
+
ts: options.now ?? Date.now() / 1000,
|
|
125
|
+
role,
|
|
126
|
+
text,
|
|
127
|
+
task_id: taskId,
|
|
128
|
+
};
|
|
129
|
+
appendFileSync(convPath(contextId, root), `${JSON.stringify(row)}\n`, "utf8");
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Persistence must not break the live call path.
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** Last `limit` messages for a context (empty if missing / unreadable). */
|
|
136
|
+
export function loadConversation(contextId, limit = 50, options = {}) {
|
|
137
|
+
try {
|
|
138
|
+
const root = options.root ?? a2aConversationsDir();
|
|
139
|
+
const raw = readFileSync(convPath(contextId, root), "utf8");
|
|
140
|
+
const out = [];
|
|
141
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
142
|
+
if (!line.trim())
|
|
143
|
+
continue;
|
|
144
|
+
try {
|
|
145
|
+
const entry = JSON.parse(line);
|
|
146
|
+
if (entry && typeof entry.text === "string")
|
|
147
|
+
out.push(entry);
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
/* skip corrupt line */
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return out.slice(-Math.max(1, limit));
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Context ids that have persisted conversations. */
|
|
160
|
+
export function listPersistedContexts(options = {}) {
|
|
161
|
+
try {
|
|
162
|
+
const root = options.root ?? a2aConversationsDir();
|
|
163
|
+
return readdirSync(root)
|
|
164
|
+
.filter((n) => n.endsWith(".jsonl"))
|
|
165
|
+
.map((n) => n.slice(0, -".jsonl".length))
|
|
166
|
+
.sort();
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=protocol.js.map
|