@harrylabsj/kiwi 0.6.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/LICENSE +201 -0
- package/README.md +150 -0
- package/contracts/candidate-agent-dto-1.0.README.md +39 -0
- package/contracts/candidate-agent-dto-1.0.schema.json +172 -0
- package/contracts/interop/kiwi-buyer-message-send.json +43 -0
- package/contracts/interop/knp-data-part-examples.json +243 -0
- package/contracts/kiwi-catalog/1.0/agent-record.schema.json +78 -0
- package/contracts/kiwi-catalog/1.0/listing-record.schema.json +88 -0
- package/contracts/kiwi-catalog/1.0/listing-search-result.schema.json +60 -0
- package/contracts/negotiation/1.0/schema.json +501 -0
- package/contracts/shopping.negotiation/0.1/capabilities.schema.json +47 -0
- package/contracts/shopping.negotiation/0.1/decision.schema.json +120 -0
- package/contracts/shopping.negotiation/0.1/policy-result.schema.json +52 -0
- package/contracts/shopping.negotiation/0.1/snapshot.schema.json +172 -0
- package/dist/a2a/client/client.d.ts +33 -0
- package/dist/a2a/client/client.js +161 -0
- package/dist/a2a/client/client.js.map +1 -0
- package/dist/a2a/client/error.d.ts +35 -0
- package/dist/a2a/client/error.js +34 -0
- package/dist/a2a/client/error.js.map +1 -0
- package/dist/a2a/client/index.d.ts +29 -0
- package/dist/a2a/client/index.js +26 -0
- package/dist/a2a/client/index.js.map +1 -0
- package/dist/a2a/client/jsonrpc.d.ts +49 -0
- package/dist/a2a/client/jsonrpc.js +85 -0
- package/dist/a2a/client/jsonrpc.js.map +1 -0
- package/dist/a2a/client/parse.d.ts +18 -0
- package/dist/a2a/client/parse.js +134 -0
- package/dist/a2a/client/parse.js.map +1 -0
- package/dist/a2a/client/types.d.ts +102 -0
- package/dist/a2a/client/types.js +26 -0
- package/dist/a2a/client/types.js.map +1 -0
- package/dist/a2a/client/url-policy.d.ts +44 -0
- package/dist/a2a/client/url-policy.js +242 -0
- package/dist/a2a/client/url-policy.js.map +1 -0
- package/dist/a2a/negotiate.d.ts +68 -0
- package/dist/a2a/negotiate.js +288 -0
- package/dist/a2a/negotiate.js.map +1 -0
- package/dist/a2a/node.d.ts +37 -0
- package/dist/a2a/node.js +155 -0
- package/dist/a2a/node.js.map +1 -0
- package/dist/a2a/server/auth.d.ts +38 -0
- package/dist/a2a/server/auth.js +112 -0
- package/dist/a2a/server/auth.js.map +1 -0
- package/dist/a2a/server/card.d.ts +19 -0
- package/dist/a2a/server/card.js +81 -0
- package/dist/a2a/server/card.js.map +1 -0
- package/dist/a2a/server/errors.d.ts +109 -0
- package/dist/a2a/server/errors.js +178 -0
- package/dist/a2a/server/errors.js.map +1 -0
- package/dist/a2a/server/handler.d.ts +22 -0
- package/dist/a2a/server/handler.js +57 -0
- package/dist/a2a/server/handler.js.map +1 -0
- package/dist/a2a/server/inbound-message.d.ts +37 -0
- package/dist/a2a/server/inbound-message.js +104 -0
- package/dist/a2a/server/inbound-message.js.map +1 -0
- package/dist/a2a/server/index.d.ts +43 -0
- package/dist/a2a/server/index.js +42 -0
- package/dist/a2a/server/index.js.map +1 -0
- package/dist/a2a/server/merchant-handler.d.ts +69 -0
- package/dist/a2a/server/merchant-handler.js +316 -0
- package/dist/a2a/server/merchant-handler.js.map +1 -0
- package/dist/a2a/server/pipeline.d.ts +69 -0
- package/dist/a2a/server/pipeline.js +329 -0
- package/dist/a2a/server/pipeline.js.map +1 -0
- package/dist/a2a/server/server.d.ts +64 -0
- package/dist/a2a/server/server.js +420 -0
- package/dist/a2a/server/server.js.map +1 -0
- package/dist/a2a/server/task-registry.d.ts +31 -0
- package/dist/a2a/server/task-registry.js +67 -0
- package/dist/a2a/server/task-registry.js.map +1 -0
- package/dist/a2a/server/throttle.d.ts +154 -0
- package/dist/a2a/server/throttle.js +289 -0
- package/dist/a2a/server/throttle.js.map +1 -0
- package/dist/a2a/server/types.d.ts +191 -0
- package/dist/a2a/server/types.js +17 -0
- package/dist/a2a/server/types.js.map +1 -0
- package/dist/a2a/server/ucp.d.ts +49 -0
- package/dist/a2a/server/ucp.js +85 -0
- package/dist/a2a/server/ucp.js.map +1 -0
- package/dist/a2a/task/index.d.ts +24 -0
- package/dist/a2a/task/index.js +22 -0
- package/dist/a2a/task/index.js.map +1 -0
- package/dist/a2a/task/ledger.d.ts +48 -0
- package/dist/a2a/task/ledger.js +65 -0
- package/dist/a2a/task/ledger.js.map +1 -0
- package/dist/a2a/task/poller.d.ts +93 -0
- package/dist/a2a/task/poller.js +184 -0
- package/dist/a2a/task/poller.js.map +1 -0
- package/dist/a2a/task/state.d.ts +72 -0
- package/dist/a2a/task/state.js +119 -0
- package/dist/a2a/task/state.js.map +1 -0
- package/dist/a2a/ucp-agent.d.ts +49 -0
- package/dist/a2a/ucp-agent.js +78 -0
- package/dist/a2a/ucp-agent.js.map +1 -0
- package/dist/agent/agent-db.d.ts +31 -0
- package/dist/agent/agent-db.js +91 -0
- package/dist/agent/agent-db.js.map +1 -0
- package/dist/agent/buyer/buyer-tools.d.ts +70 -0
- package/dist/agent/buyer/buyer-tools.js +1353 -0
- package/dist/agent/buyer/buyer-tools.js.map +1 -0
- package/dist/agent/buyer/ranker.d.ts +53 -0
- package/dist/agent/buyer/ranker.js +153 -0
- package/dist/agent/buyer/ranker.js.map +1 -0
- package/dist/agent/buyer/scheduler.d.ts +58 -0
- package/dist/agent/buyer/scheduler.js +317 -0
- package/dist/agent/buyer/scheduler.js.map +1 -0
- package/dist/agent/buyer/search-loop.d.ts +42 -0
- package/dist/agent/buyer/search-loop.js +280 -0
- package/dist/agent/buyer/search-loop.js.map +1 -0
- package/dist/agent/buyer/task-store.d.ts +178 -0
- package/dist/agent/buyer/task-store.js +637 -0
- package/dist/agent/buyer/task-store.js.map +1 -0
- package/dist/agent/buyer/types.d.ts +222 -0
- package/dist/agent/buyer/types.js +124 -0
- package/dist/agent/buyer/types.js.map +1 -0
- package/dist/agent/chat-tools.d.ts +41 -0
- package/dist/agent/chat-tools.js +193 -0
- package/dist/agent/chat-tools.js.map +1 -0
- package/dist/agent/chat-tui.d.ts +49 -0
- package/dist/agent/chat-tui.js +314 -0
- package/dist/agent/chat-tui.js.map +1 -0
- package/dist/agent/connector/fake-connector.d.ts +50 -0
- package/dist/agent/connector/fake-connector.js +138 -0
- package/dist/agent/connector/fake-connector.js.map +1 -0
- package/dist/agent/connector/http-connector.d.ts +49 -0
- package/dist/agent/connector/http-connector.js +208 -0
- package/dist/agent/connector/http-connector.js.map +1 -0
- package/dist/agent/connector/types.d.ts +103 -0
- package/dist/agent/connector/types.js +97 -0
- package/dist/agent/connector/types.js.map +1 -0
- package/dist/agent/fake-chat-model.d.ts +22 -0
- package/dist/agent/fake-chat-model.js +134 -0
- package/dist/agent/fake-chat-model.js.map +1 -0
- package/dist/agent/kernel.d.ts +258 -0
- package/dist/agent/kernel.js +1099 -0
- package/dist/agent/kernel.js.map +1 -0
- package/dist/agent/memory/schema.d.ts +32 -0
- package/dist/agent/memory/schema.js +291 -0
- package/dist/agent/memory/schema.js.map +1 -0
- package/dist/agent/memory/store.d.ts +193 -0
- package/dist/agent/memory/store.js +881 -0
- package/dist/agent/memory/store.js.map +1 -0
- package/dist/agent/memory/types.d.ts +139 -0
- package/dist/agent/memory/types.js +119 -0
- package/dist/agent/memory/types.js.map +1 -0
- package/dist/agent/memory/vault.d.ts +49 -0
- package/dist/agent/memory/vault.js +125 -0
- package/dist/agent/memory/vault.js.map +1 -0
- package/dist/agent/merchant/action-candidate.d.ts +106 -0
- package/dist/agent/merchant/action-candidate.js +241 -0
- package/dist/agent/merchant/action-candidate.js.map +1 -0
- package/dist/agent/merchant/credential-broker.d.ts +67 -0
- package/dist/agent/merchant/credential-broker.js +76 -0
- package/dist/agent/merchant/credential-broker.js.map +1 -0
- package/dist/agent/merchant/fake-merchant-client.d.ts +47 -0
- package/dist/agent/merchant/fake-merchant-client.js +143 -0
- package/dist/agent/merchant/fake-merchant-client.js.map +1 -0
- package/dist/agent/merchant/merchant-client.d.ts +49 -0
- package/dist/agent/merchant/merchant-client.js +186 -0
- package/dist/agent/merchant/merchant-client.js.map +1 -0
- package/dist/agent/merchant/merchant-tools.d.ts +74 -0
- package/dist/agent/merchant/merchant-tools.js +582 -0
- package/dist/agent/merchant/merchant-tools.js.map +1 -0
- package/dist/agent/merchant/types.d.ts +119 -0
- package/dist/agent/merchant/types.js +133 -0
- package/dist/agent/merchant/types.js.map +1 -0
- package/dist/agent/mode.d.ts +32 -0
- package/dist/agent/mode.js +34 -0
- package/dist/agent/mode.js.map +1 -0
- package/dist/agent/negotiation-chat.d.ts +81 -0
- package/dist/agent/negotiation-chat.js +330 -0
- package/dist/agent/negotiation-chat.js.map +1 -0
- package/dist/agent/session.d.ts +22 -0
- package/dist/agent/session.js +164 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +26 -0
- package/dist/agent/system-prompt.js +77 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/agent/write-gate.d.ts +98 -0
- package/dist/agent/write-gate.js +76 -0
- package/dist/agent/write-gate.js.map +1 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +1139 -0
- package/dist/cli.js.map +1 -0
- package/dist/commerce/data-source.d.ts +88 -0
- package/dist/commerce/data-source.js +25 -0
- package/dist/commerce/data-source.js.map +1 -0
- package/dist/commerce/erp-source.d.ts +51 -0
- package/dist/commerce/erp-source.js +184 -0
- package/dist/commerce/erp-source.js.map +1 -0
- package/dist/commerce/fake-client.d.ts +167 -0
- package/dist/commerce/fake-client.js +549 -0
- package/dist/commerce/fake-client.js.map +1 -0
- package/dist/commerce/http-client.d.ts +73 -0
- package/dist/commerce/http-client.js +284 -0
- package/dist/commerce/http-client.js.map +1 -0
- package/dist/commerce/local-db-source.d.ts +50 -0
- package/dist/commerce/local-db-source.js +162 -0
- package/dist/commerce/local-db-source.js.map +1 -0
- package/dist/commerce/shopping-cli-source.d.ts +57 -0
- package/dist/commerce/shopping-cli-source.js +206 -0
- package/dist/commerce/shopping-cli-source.js.map +1 -0
- package/dist/commerce/types.d.ts +146 -0
- package/dist/commerce/types.js +31 -0
- package/dist/commerce/types.js.map +1 -0
- package/dist/config/profile.d.ts +122 -0
- package/dist/config/profile.js +386 -0
- package/dist/config/profile.js.map +1 -0
- package/dist/contracts/negotiation-schema.d.ts +28 -0
- package/dist/contracts/negotiation-schema.js +101 -0
- package/dist/contracts/negotiation-schema.js.map +1 -0
- package/dist/contracts/schemas.d.ts +31 -0
- package/dist/contracts/schemas.js +122 -0
- package/dist/contracts/schemas.js.map +1 -0
- package/dist/counterparty/a2a-direct/index.d.ts +41 -0
- package/dist/counterparty/a2a-direct/index.js +330 -0
- package/dist/counterparty/a2a-direct/index.js.map +1 -0
- package/dist/counterparty/channel.d.ts +200 -0
- package/dist/counterparty/channel.js +61 -0
- package/dist/counterparty/channel.js.map +1 -0
- package/dist/counterparty/index.d.ts +28 -0
- package/dist/counterparty/index.js +24 -0
- package/dist/counterparty/index.js.map +1 -0
- package/dist/counterparty/platform-api/index.d.ts +41 -0
- package/dist/counterparty/platform-api/index.js +65 -0
- package/dist/counterparty/platform-api/index.js.map +1 -0
- package/dist/counterparty/registry.d.ts +51 -0
- package/dist/counterparty/registry.js +71 -0
- package/dist/counterparty/registry.js.map +1 -0
- package/dist/counterparty/shopping-cli-hosted/index.d.ts +36 -0
- package/dist/counterparty/shopping-cli-hosted/index.js +337 -0
- package/dist/counterparty/shopping-cli-hosted/index.js.map +1 -0
- package/dist/discovery/agent-card/error.d.ts +28 -0
- package/dist/discovery/agent-card/error.js +31 -0
- package/dist/discovery/agent-card/error.js.map +1 -0
- package/dist/discovery/agent-card/extensions.d.ts +20 -0
- package/dist/discovery/agent-card/extensions.js +59 -0
- package/dist/discovery/agent-card/extensions.js.map +1 -0
- package/dist/discovery/agent-card/index.d.ts +29 -0
- package/dist/discovery/agent-card/index.js +38 -0
- package/dist/discovery/agent-card/index.js.map +1 -0
- package/dist/discovery/agent-card/secrets.d.ts +30 -0
- package/dist/discovery/agent-card/secrets.js +240 -0
- package/dist/discovery/agent-card/secrets.js.map +1 -0
- package/dist/discovery/agent-card/types.d.ts +110 -0
- package/dist/discovery/agent-card/types.js +37 -0
- package/dist/discovery/agent-card/types.js.map +1 -0
- package/dist/discovery/agent-card/validate.d.ts +31 -0
- package/dist/discovery/agent-card/validate.js +210 -0
- package/dist/discovery/agent-card/validate.js.map +1 -0
- package/dist/discovery/capability/error.d.ts +23 -0
- package/dist/discovery/capability/error.js +28 -0
- package/dist/discovery/capability/error.js.map +1 -0
- package/dist/discovery/capability/index.d.ts +21 -0
- package/dist/discovery/capability/index.js +21 -0
- package/dist/discovery/capability/index.js.map +1 -0
- package/dist/discovery/capability/intersect.d.ts +56 -0
- package/dist/discovery/capability/intersect.js +137 -0
- package/dist/discovery/capability/intersect.js.map +1 -0
- package/dist/discovery/catalog-source/errors.d.ts +32 -0
- package/dist/discovery/catalog-source/errors.js +41 -0
- package/dist/discovery/catalog-source/errors.js.map +1 -0
- package/dist/discovery/catalog-source/index.d.ts +30 -0
- package/dist/discovery/catalog-source/index.js +29 -0
- package/dist/discovery/catalog-source/index.js.map +1 -0
- package/dist/discovery/catalog-source/kiwi-record.d.ts +183 -0
- package/dist/discovery/catalog-source/kiwi-record.js +72 -0
- package/dist/discovery/catalog-source/kiwi-record.js.map +1 -0
- package/dist/discovery/catalog-source/kiwi-schema.d.ts +33 -0
- package/dist/discovery/catalog-source/kiwi-schema.js +106 -0
- package/dist/discovery/catalog-source/kiwi-schema.js.map +1 -0
- package/dist/discovery/catalog-source/kiwi-source.d.ts +38 -0
- package/dist/discovery/catalog-source/kiwi-source.js +318 -0
- package/dist/discovery/catalog-source/kiwi-source.js.map +1 -0
- package/dist/discovery/catalog-source/register.d.ts +48 -0
- package/dist/discovery/catalog-source/register.js +83 -0
- package/dist/discovery/catalog-source/register.js.map +1 -0
- package/dist/discovery/catalog-source/schema.d.ts +21 -0
- package/dist/discovery/catalog-source/schema.js +63 -0
- package/dist/discovery/catalog-source/schema.js.map +1 -0
- package/dist/discovery/catalog-source/source.d.ts +45 -0
- package/dist/discovery/catalog-source/source.js +197 -0
- package/dist/discovery/catalog-source/source.js.map +1 -0
- package/dist/discovery/catalog-source/types.d.ts +122 -0
- package/dist/discovery/catalog-source/types.js +30 -0
- package/dist/discovery/catalog-source/types.js.map +1 -0
- package/dist/discovery/index.d.ts +25 -0
- package/dist/discovery/index.js +25 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/resolve.d.ts +175 -0
- package/dist/discovery/resolve.js +367 -0
- package/dist/discovery/resolve.js.map +1 -0
- package/dist/discovery/ucp/error.d.ts +25 -0
- package/dist/discovery/ucp/error.js +27 -0
- package/dist/discovery/ucp/error.js.map +1 -0
- package/dist/discovery/ucp/index.d.ts +33 -0
- package/dist/discovery/ucp/index.js +28 -0
- package/dist/discovery/ucp/index.js.map +1 -0
- package/dist/discovery/ucp/intersect.d.ts +148 -0
- package/dist/discovery/ucp/intersect.js +312 -0
- package/dist/discovery/ucp/intersect.js.map +1 -0
- package/dist/discovery/ucp/resolver.d.ts +62 -0
- package/dist/discovery/ucp/resolver.js +214 -0
- package/dist/discovery/ucp/resolver.js.map +1 -0
- package/dist/discovery/ucp/types.d.ts +97 -0
- package/dist/discovery/ucp/types.js +103 -0
- package/dist/discovery/ucp/types.js.map +1 -0
- package/dist/discovery/ucp/validate.d.ts +38 -0
- package/dist/discovery/ucp/validate.js +232 -0
- package/dist/discovery/ucp/validate.js.map +1 -0
- package/dist/discovery/ucp/vendor.d.ts +60 -0
- package/dist/discovery/ucp/vendor.js +61 -0
- package/dist/discovery/ucp/vendor.js.map +1 -0
- package/dist/doctor.d.ts +26 -0
- package/dist/doctor.js +113 -0
- package/dist/doctor.js.map +1 -0
- package/dist/exit-codes.d.ts +26 -0
- package/dist/exit-codes.js +27 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/fanout/disclosure.d.ts +138 -0
- package/dist/fanout/disclosure.js +188 -0
- package/dist/fanout/disclosure.js.map +1 -0
- package/dist/fanout/index.d.ts +32 -0
- package/dist/fanout/index.js +30 -0
- package/dist/fanout/index.js.map +1 -0
- package/dist/fanout/orchestrator.d.ts +153 -0
- package/dist/fanout/orchestrator.js +439 -0
- package/dist/fanout/orchestrator.js.map +1 -0
- package/dist/fanout/policy.d.ts +128 -0
- package/dist/fanout/policy.js +130 -0
- package/dist/fanout/policy.js.map +1 -0
- package/dist/handoff/acp-commerce.d.ts +58 -0
- package/dist/handoff/acp-commerce.js +69 -0
- package/dist/handoff/acp-commerce.js.map +1 -0
- package/dist/handoff/authorization.d.ts +127 -0
- package/dist/handoff/authorization.js +107 -0
- package/dist/handoff/authorization.js.map +1 -0
- package/dist/handoff/candidate.d.ts +94 -0
- package/dist/handoff/candidate.js +172 -0
- package/dist/handoff/candidate.js.map +1 -0
- package/dist/handoff/channel.d.ts +88 -0
- package/dist/handoff/channel.js +189 -0
- package/dist/handoff/channel.js.map +1 -0
- package/dist/handoff/completion.d.ts +44 -0
- package/dist/handoff/completion.js +136 -0
- package/dist/handoff/completion.js.map +1 -0
- package/dist/handoff/delivery.d.ts +59 -0
- package/dist/handoff/delivery.js +185 -0
- package/dist/handoff/delivery.js.map +1 -0
- package/dist/handoff/destination.d.ts +39 -0
- package/dist/handoff/destination.js +99 -0
- package/dist/handoff/destination.js.map +1 -0
- package/dist/handoff/errors.d.ts +34 -0
- package/dist/handoff/errors.js +47 -0
- package/dist/handoff/errors.js.map +1 -0
- package/dist/handoff/idempotency.d.ts +51 -0
- package/dist/handoff/idempotency.js +168 -0
- package/dist/handoff/idempotency.js.map +1 -0
- package/dist/handoff/index.d.ts +46 -0
- package/dist/handoff/index.js +48 -0
- package/dist/handoff/index.js.map +1 -0
- package/dist/handoff/ledger.d.ts +94 -0
- package/dist/handoff/ledger.js +195 -0
- package/dist/handoff/ledger.js.map +1 -0
- package/dist/handoff/lifecycle.d.ts +29 -0
- package/dist/handoff/lifecycle.js +102 -0
- package/dist/handoff/lifecycle.js.map +1 -0
- package/dist/handoff/metrics.d.ts +56 -0
- package/dist/handoff/metrics.js +78 -0
- package/dist/handoff/metrics.js.map +1 -0
- package/dist/handoff/operator-approval.d.ts +143 -0
- package/dist/handoff/operator-approval.js +287 -0
- package/dist/handoff/operator-approval.js.map +1 -0
- package/dist/handoff/order-record.d.ts +104 -0
- package/dist/handoff/order-record.js +235 -0
- package/dist/handoff/order-record.js.map +1 -0
- package/dist/handoff/package.d.ts +102 -0
- package/dist/handoff/package.js +132 -0
- package/dist/handoff/package.js.map +1 -0
- package/dist/handoff/transaction.d.ts +96 -0
- package/dist/handoff/transaction.js +263 -0
- package/dist/handoff/transaction.js.map +1 -0
- package/dist/handoff/ucp-checkout/cart-channel.d.ts +111 -0
- package/dist/handoff/ucp-checkout/cart-channel.js +370 -0
- package/dist/handoff/ucp-checkout/cart-channel.js.map +1 -0
- package/dist/handoff/ucp-checkout/cart-parse.d.ts +22 -0
- package/dist/handoff/ucp-checkout/cart-parse.js +102 -0
- package/dist/handoff/ucp-checkout/cart-parse.js.map +1 -0
- package/dist/handoff/ucp-checkout/cart-types.d.ts +93 -0
- package/dist/handoff/ucp-checkout/cart-types.js +38 -0
- package/dist/handoff/ucp-checkout/cart-types.js.map +1 -0
- package/dist/handoff/ucp-checkout/channel.d.ts +159 -0
- package/dist/handoff/ucp-checkout/channel.js +636 -0
- package/dist/handoff/ucp-checkout/channel.js.map +1 -0
- package/dist/handoff/ucp-checkout/client.d.ts +88 -0
- package/dist/handoff/ucp-checkout/client.js +228 -0
- package/dist/handoff/ucp-checkout/client.js.map +1 -0
- package/dist/handoff/ucp-checkout/endpoint.d.ts +36 -0
- package/dist/handoff/ucp-checkout/endpoint.js +145 -0
- package/dist/handoff/ucp-checkout/endpoint.js.map +1 -0
- package/dist/handoff/ucp-checkout/index.d.ts +35 -0
- package/dist/handoff/ucp-checkout/index.js +36 -0
- package/dist/handoff/ucp-checkout/index.js.map +1 -0
- package/dist/handoff/ucp-checkout/parse.d.ts +71 -0
- package/dist/handoff/ucp-checkout/parse.js +349 -0
- package/dist/handoff/ucp-checkout/parse.js.map +1 -0
- package/dist/handoff/ucp-checkout/totals.d.ts +41 -0
- package/dist/handoff/ucp-checkout/totals.js +36 -0
- package/dist/handoff/ucp-checkout/totals.js.map +1 -0
- package/dist/handoff/ucp-checkout/types.d.ts +149 -0
- package/dist/handoff/ucp-checkout/types.js +58 -0
- package/dist/handoff/ucp-checkout/types.js.map +1 -0
- package/dist/handoff/url-safety.d.ts +44 -0
- package/dist/handoff/url-safety.js +121 -0
- package/dist/handoff/url-safety.js.map +1 -0
- package/dist/i18n.d.ts +24 -0
- package/dist/i18n.js +27 -0
- package/dist/i18n.js.map +1 -0
- package/dist/negotiation/action-candidate.d.ts +97 -0
- package/dist/negotiation/action-candidate.js +160 -0
- package/dist/negotiation/action-candidate.js.map +1 -0
- package/dist/negotiation/condition/evaluator.d.ts +36 -0
- package/dist/negotiation/condition/evaluator.js +123 -0
- package/dist/negotiation/condition/evaluator.js.map +1 -0
- package/dist/negotiation/context-map/index.d.ts +23 -0
- package/dist/negotiation/context-map/index.js +22 -0
- package/dist/negotiation/context-map/index.js.map +1 -0
- package/dist/negotiation/context-map/store.d.ts +51 -0
- package/dist/negotiation/context-map/store.js +186 -0
- package/dist/negotiation/context-map/store.js.map +1 -0
- package/dist/negotiation/context-map/types.d.ts +29 -0
- package/dist/negotiation/context-map/types.js +57 -0
- package/dist/negotiation/context-map/types.js.map +1 -0
- package/dist/negotiation/domain/common.d.ts +95 -0
- package/dist/negotiation/domain/common.js +216 -0
- package/dist/negotiation/domain/common.js.map +1 -0
- package/dist/negotiation/domain/envelope.d.ts +55 -0
- package/dist/negotiation/domain/envelope.js +110 -0
- package/dist/negotiation/domain/envelope.js.map +1 -0
- package/dist/negotiation/domain/identifiers.d.ts +65 -0
- package/dist/negotiation/domain/identifiers.js +130 -0
- package/dist/negotiation/domain/identifiers.js.map +1 -0
- package/dist/negotiation/domain/objects.d.ts +149 -0
- package/dist/negotiation/domain/objects.js +335 -0
- package/dist/negotiation/domain/objects.js.map +1 -0
- package/dist/negotiation/idempotency/index.d.ts +26 -0
- package/dist/negotiation/idempotency/index.js +25 -0
- package/dist/negotiation/idempotency/index.js.map +1 -0
- package/dist/negotiation/idempotency/store.d.ts +52 -0
- package/dist/negotiation/idempotency/store.js +189 -0
- package/dist/negotiation/idempotency/store.js.map +1 -0
- package/dist/negotiation/idempotency/types.d.ts +102 -0
- package/dist/negotiation/idempotency/types.js +47 -0
- package/dist/negotiation/idempotency/types.js.map +1 -0
- package/dist/negotiation/jcs.d.ts +21 -0
- package/dist/negotiation/jcs.js +114 -0
- package/dist/negotiation/jcs.js.map +1 -0
- package/dist/negotiation/ledger/event.d.ts +142 -0
- package/dist/negotiation/ledger/event.js +206 -0
- package/dist/negotiation/ledger/event.js.map +1 -0
- package/dist/negotiation/ledger/index.d.ts +26 -0
- package/dist/negotiation/ledger/index.js +25 -0
- package/dist/negotiation/ledger/index.js.map +1 -0
- package/dist/negotiation/ledger/store.d.ts +97 -0
- package/dist/negotiation/ledger/store.js +338 -0
- package/dist/negotiation/ledger/store.js.map +1 -0
- package/dist/negotiation/prompt.d.ts +34 -0
- package/dist/negotiation/prompt.js +113 -0
- package/dist/negotiation/prompt.js.map +1 -0
- package/dist/negotiation/recovery/index.d.ts +26 -0
- package/dist/negotiation/recovery/index.js +24 -0
- package/dist/negotiation/recovery/index.js.map +1 -0
- package/dist/negotiation/recovery/outbound.d.ts +49 -0
- package/dist/negotiation/recovery/outbound.js +34 -0
- package/dist/negotiation/recovery/outbound.js.map +1 -0
- package/dist/negotiation/recovery/recover.d.ts +59 -0
- package/dist/negotiation/recovery/recover.js +486 -0
- package/dist/negotiation/recovery/recover.js.map +1 -0
- package/dist/negotiation/recovery/types.d.ts +85 -0
- package/dist/negotiation/recovery/types.js +17 -0
- package/dist/negotiation/recovery/types.js.map +1 -0
- package/dist/negotiation/state/phase.d.ts +70 -0
- package/dist/negotiation/state/phase.js +200 -0
- package/dist/negotiation/state/phase.js.map +1 -0
- package/dist/negotiation/types.d.ts +139 -0
- package/dist/negotiation/types.js +24 -0
- package/dist/negotiation/types.js.map +1 -0
- package/dist/net/safe-http.d.ts +54 -0
- package/dist/net/safe-http.js +116 -0
- package/dist/net/safe-http.js.map +1 -0
- package/dist/operator/controller.d.ts +181 -0
- package/dist/operator/controller.js +784 -0
- package/dist/operator/controller.js.map +1 -0
- package/dist/operator/runner.d.ts +128 -0
- package/dist/operator/runner.js +248 -0
- package/dist/operator/runner.js.map +1 -0
- package/dist/operator/store.d.ts +39 -0
- package/dist/operator/store.js +169 -0
- package/dist/operator/store.js.map +1 -0
- package/dist/operator/strategy.d.ts +54 -0
- package/dist/operator/strategy.js +249 -0
- package/dist/operator/strategy.js.map +1 -0
- package/dist/operator/tui.d.ts +27 -0
- package/dist/operator/tui.js +395 -0
- package/dist/operator/tui.js.map +1 -0
- package/dist/operator/types.d.ts +224 -0
- package/dist/operator/types.js +17 -0
- package/dist/operator/types.js.map +1 -0
- package/dist/product-buyer.d.ts +74 -0
- package/dist/product-buyer.js +161 -0
- package/dist/product-buyer.js.map +1 -0
- package/dist/product-cli.d.ts +56 -0
- package/dist/product-cli.js +175 -0
- package/dist/product-cli.js.map +1 -0
- package/dist/product-compat.d.ts +50 -0
- package/dist/product-compat.js +63 -0
- package/dist/product-compat.js.map +1 -0
- package/dist/product-init.d.ts +73 -0
- package/dist/product-init.js +203 -0
- package/dist/product-init.js.map +1 -0
- package/dist/product-publish.d.ts +85 -0
- package/dist/product-publish.js +216 -0
- package/dist/product-publish.js.map +1 -0
- package/dist/protocol/legacy-shopping-negotiation/adapter.d.ts +42 -0
- package/dist/protocol/legacy-shopping-negotiation/adapter.js +561 -0
- package/dist/protocol/legacy-shopping-negotiation/adapter.js.map +1 -0
- package/dist/protocol/legacy-shopping-negotiation/mapping.d.ts +78 -0
- package/dist/protocol/legacy-shopping-negotiation/mapping.js +321 -0
- package/dist/protocol/legacy-shopping-negotiation/mapping.js.map +1 -0
- package/dist/protocol/legacy-shopping-negotiation/money.d.ts +49 -0
- package/dist/protocol/legacy-shopping-negotiation/money.js +70 -0
- package/dist/protocol/legacy-shopping-negotiation/money.js.map +1 -0
- package/dist/protocol/legacy-shopping-negotiation/types.d.ts +107 -0
- package/dist/protocol/legacy-shopping-negotiation/types.js +34 -0
- package/dist/protocol/legacy-shopping-negotiation/types.js.map +1 -0
- package/dist/runtime/buyer-policy.d.ts +58 -0
- package/dist/runtime/buyer-policy.js +89 -0
- package/dist/runtime/buyer-policy.js.map +1 -0
- package/dist/runtime/fake-model.d.ts +77 -0
- package/dist/runtime/fake-model.js +307 -0
- package/dist/runtime/fake-model.js.map +1 -0
- package/dist/runtime/foreground.d.ts +56 -0
- package/dist/runtime/foreground.js +97 -0
- package/dist/runtime/foreground.js.map +1 -0
- package/dist/runtime/heartbeat.d.ts +36 -0
- package/dist/runtime/heartbeat.js +49 -0
- package/dist/runtime/heartbeat.js.map +1 -0
- package/dist/runtime/merchant-turn.d.ts +35 -0
- package/dist/runtime/merchant-turn.js +20 -0
- package/dist/runtime/merchant-turn.js.map +1 -0
- package/dist/runtime/model.d.ts +40 -0
- package/dist/runtime/model.js +86 -0
- package/dist/runtime/model.js.map +1 -0
- package/dist/runtime/negotiation-turn.d.ts +101 -0
- package/dist/runtime/negotiation-turn.js +317 -0
- package/dist/runtime/negotiation-turn.js.map +1 -0
- package/dist/runtime/tools.d.ts +64 -0
- package/dist/runtime/tools.js +236 -0
- package/dist/runtime/tools.js.map +1 -0
- package/dist/supervisor/init.d.ts +31 -0
- package/dist/supervisor/init.js +222 -0
- package/dist/supervisor/init.js.map +1 -0
- package/dist/supervisor/logs.d.ts +28 -0
- package/dist/supervisor/logs.js +101 -0
- package/dist/supervisor/logs.js.map +1 -0
- package/dist/supervisor/manage.d.ts +72 -0
- package/dist/supervisor/manage.js +419 -0
- package/dist/supervisor/manage.js.map +1 -0
- package/dist/supervisor/manifest.d.ts +69 -0
- package/dist/supervisor/manifest.js +209 -0
- package/dist/supervisor/manifest.js.map +1 -0
- package/dist/supervisor/stack-config.d.ts +79 -0
- package/dist/supervisor/stack-config.js +262 -0
- package/dist/supervisor/stack-config.js.map +1 -0
- package/dist/supervisor/wrapper.d.ts +17 -0
- package/dist/supervisor/wrapper.js +138 -0
- package/dist/supervisor/wrapper.js.map +1 -0
- package/dist/trust/identity/auth-verifier.d.ts +96 -0
- package/dist/trust/identity/auth-verifier.js +166 -0
- package/dist/trust/identity/auth-verifier.js.map +1 -0
- package/dist/trust/identity/identity-binding.d.ts +63 -0
- package/dist/trust/identity/identity-binding.js +59 -0
- package/dist/trust/identity/identity-binding.js.map +1 -0
- package/dist/trust/identity/index.d.ts +38 -0
- package/dist/trust/identity/index.js +31 -0
- package/dist/trust/identity/index.js.map +1 -0
- package/dist/trust/identity/jws.d.ts +64 -0
- package/dist/trust/identity/jws.js +178 -0
- package/dist/trust/identity/jws.js.map +1 -0
- package/dist/trust/identity/keys.d.ts +71 -0
- package/dist/trust/identity/keys.js +118 -0
- package/dist/trust/identity/keys.js.map +1 -0
- package/dist/trust/identity/message-signature.d.ts +105 -0
- package/dist/trust/identity/message-signature.js +297 -0
- package/dist/trust/identity/message-signature.js.map +1 -0
- package/dist/trust/identity/nonce.d.ts +45 -0
- package/dist/trust/identity/nonce.js +50 -0
- package/dist/trust/identity/nonce.js.map +1 -0
- package/dist/trust/identity/signature-base.d.ts +84 -0
- package/dist/trust/identity/signature-base.js +261 -0
- package/dist/trust/identity/signature-base.js.map +1 -0
- package/dist/trust/identity/trust-policy.d.ts +92 -0
- package/dist/trust/identity/trust-policy.js +95 -0
- package/dist/trust/identity/trust-policy.js.map +1 -0
- package/dist/trust/index.d.ts +21 -0
- package/dist/trust/index.js +22 -0
- package/dist/trust/index.js.map +1 -0
- package/dist/trust/records/evaluator.d.ts +76 -0
- package/dist/trust/records/evaluator.js +122 -0
- package/dist/trust/records/evaluator.js.map +1 -0
- package/dist/trust/records/index.d.ts +28 -0
- package/dist/trust/records/index.js +26 -0
- package/dist/trust/records/index.js.map +1 -0
- package/dist/trust/records/store.d.ts +75 -0
- package/dist/trust/records/store.js +339 -0
- package/dist/trust/records/store.js.map +1 -0
- package/dist/trust/records/types.d.ts +159 -0
- package/dist/trust/records/types.js +40 -0
- package/dist/trust/records/types.js.map +1 -0
- package/dist/tui/banner.d.ts +46 -0
- package/dist/tui/banner.js +99 -0
- package/dist/tui/banner.js.map +1 -0
- package/dist/tui/styles.d.ts +70 -0
- package/dist/tui/styles.js +197 -0
- package/dist/tui/styles.js.map +1 -0
- package/dist/tui/theme.d.ts +63 -0
- package/dist/tui/theme.js +136 -0
- package/dist/tui/theme.js.map +1 -0
- package/examples/profiles/buyer.deepseek.yaml +34 -0
- package/examples/profiles/buyer.fake.yaml +36 -0
- package/examples/profiles/buyer.local.yaml +40 -0
- package/examples/profiles/merchant.deepseek.yaml +32 -0
- package/examples/profiles/merchant.fake.yaml +31 -0
- package/examples/profiles/merchant.local.yaml +34 -0
- package/package.json +55 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://kiwi.dev/contracts/shopping.negotiation/0.1/policy-result.schema.json",
|
|
4
|
+
"title": "shopping.negotiation/0.1 PolicyResult",
|
|
5
|
+
"description": "Authoritative policy gate result for a submitted negotiation decision. Frozen for protocol version shopping.negotiation/0.1.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"protocol_version",
|
|
10
|
+
"result",
|
|
11
|
+
"conversation_id",
|
|
12
|
+
"next_actor",
|
|
13
|
+
"reason_codes",
|
|
14
|
+
"public_reason",
|
|
15
|
+
"retries_remaining"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"protocol_version": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"const": "shopping.negotiation/0.1"
|
|
21
|
+
},
|
|
22
|
+
"result": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": ["accepted", "rejected_retryable", "human_required"]
|
|
25
|
+
},
|
|
26
|
+
"conversation_id": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
27
|
+
"message_id": {
|
|
28
|
+
"type": "integer",
|
|
29
|
+
"minimum": 1,
|
|
30
|
+
"description": "The normalized message id written by the gateway. Present only when result is accepted."
|
|
31
|
+
},
|
|
32
|
+
"next_actor": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": ["buyer", "merchant", "none"]
|
|
35
|
+
},
|
|
36
|
+
"reason_codes": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
39
|
+
"maxItems": 32
|
|
40
|
+
},
|
|
41
|
+
"public_reason": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"maxLength": 1000,
|
|
44
|
+
"description": "Repairable, public explanation safe to show the model. Must not leak private thresholds."
|
|
45
|
+
},
|
|
46
|
+
"retries_remaining": {
|
|
47
|
+
"type": "integer",
|
|
48
|
+
"minimum": 0,
|
|
49
|
+
"description": "How many retry attempts the agent may still make for this claim."
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://kiwi.dev/contracts/shopping.negotiation/0.1/snapshot.schema.json",
|
|
4
|
+
"title": "shopping.negotiation/0.1 NegotiationSnapshot",
|
|
5
|
+
"description": "Role-trimmed authoritative negotiation snapshot returned by get_negotiation_snapshot. Frozen for protocol version shopping.negotiation/0.1. Contains only data the requesting role is allowed to see.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"protocol_version",
|
|
10
|
+
"conversation",
|
|
11
|
+
"role",
|
|
12
|
+
"in_reply_to_message_id",
|
|
13
|
+
"product",
|
|
14
|
+
"stock",
|
|
15
|
+
"delivery",
|
|
16
|
+
"after_sales_policies",
|
|
17
|
+
"messages",
|
|
18
|
+
"current_proposal",
|
|
19
|
+
"open_issues",
|
|
20
|
+
"policy_results"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"protocol_version": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"const": "shopping.negotiation/0.1"
|
|
26
|
+
},
|
|
27
|
+
"conversation": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"required": ["id", "status", "next_actor"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"id": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
33
|
+
"status": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["open", "waiting_merchant", "waiting_buyer", "human_required", "closed"]
|
|
36
|
+
},
|
|
37
|
+
"next_actor": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"enum": ["buyer", "merchant", "none"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"role": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": ["buyer", "merchant"],
|
|
46
|
+
"description": "The role this snapshot was trimmed for."
|
|
47
|
+
},
|
|
48
|
+
"in_reply_to_message_id": {
|
|
49
|
+
"type": "integer",
|
|
50
|
+
"minimum": 1,
|
|
51
|
+
"description": "The claimed message the agent must reply to."
|
|
52
|
+
},
|
|
53
|
+
"product": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"required": ["sku", "title", "currency", "list_price"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"sku": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
59
|
+
"title": { "type": "string", "maxLength": 500 },
|
|
60
|
+
"currency": { "type": "string", "minLength": 3, "maxLength": 8 },
|
|
61
|
+
"list_price": { "type": "number", "minimum": 0 },
|
|
62
|
+
"description": { "type": "string", "maxLength": 2000 }
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"stock": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"required": ["status", "quantity", "observed_at", "reserved", "source"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"status": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"enum": ["available", "low", "out_of_stock", "unknown"]
|
|
73
|
+
},
|
|
74
|
+
"quantity": { "type": "integer", "minimum": 0 },
|
|
75
|
+
"observed_at": { "type": "string", "format": "date-time" },
|
|
76
|
+
"reserved": { "type": "boolean", "const": false },
|
|
77
|
+
"source": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"required": ["backend", "observed_at"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"backend": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"enum": ["local_marketplace", "external_platform"]
|
|
85
|
+
},
|
|
86
|
+
"external_id": { "type": "string", "maxLength": 256 },
|
|
87
|
+
"observed_at": { "type": "string", "format": "date-time" }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"delivery": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": false,
|
|
95
|
+
"required": ["eta_start", "eta_end", "fee"],
|
|
96
|
+
"properties": {
|
|
97
|
+
"eta_start": { "type": "string", "format": "date-time" },
|
|
98
|
+
"eta_end": { "type": "string", "format": "date-time" },
|
|
99
|
+
"fee": { "type": "number", "minimum": 0 },
|
|
100
|
+
"notes": { "type": "string", "maxLength": 500 }
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"after_sales_policies": {
|
|
104
|
+
"type": "array",
|
|
105
|
+
"maxItems": 32,
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"additionalProperties": false,
|
|
109
|
+
"required": ["ref", "summary"],
|
|
110
|
+
"properties": {
|
|
111
|
+
"ref": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
112
|
+
"summary": { "type": "string", "maxLength": 1000 }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"messages": {
|
|
117
|
+
"type": "array",
|
|
118
|
+
"maxItems": 50,
|
|
119
|
+
"description": "Recent public messages, oldest first. Text is untrusted counterpart content.",
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"required": ["id", "sender_role", "created_at", "public_message"],
|
|
124
|
+
"properties": {
|
|
125
|
+
"id": { "type": "integer", "minimum": 1 },
|
|
126
|
+
"sender_role": { "type": "string", "enum": ["buyer", "merchant"] },
|
|
127
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
128
|
+
"action": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"enum": ["ask", "propose", "counter", "accept_nonbinding", "decline", "escalate"]
|
|
131
|
+
},
|
|
132
|
+
"public_message": { "type": "string", "maxLength": 2000 },
|
|
133
|
+
"proposal": {
|
|
134
|
+
"type": ["object", "null"],
|
|
135
|
+
"description": "Structured proposal attached to this message, if any. Shape: decision.schema.json #/$defs/proposal."
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"current_proposal": {
|
|
141
|
+
"type": ["object", "null"],
|
|
142
|
+
"description": "Latest structured proposal on the table, or null. Shape: decision.schema.json #/$defs/proposal."
|
|
143
|
+
},
|
|
144
|
+
"open_issues": {
|
|
145
|
+
"type": "array",
|
|
146
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 500 },
|
|
147
|
+
"maxItems": 32
|
|
148
|
+
},
|
|
149
|
+
"policy_results": {
|
|
150
|
+
"type": "array",
|
|
151
|
+
"maxItems": 32,
|
|
152
|
+
"description": "Own-side visible policy gate results. Never contains private thresholds.",
|
|
153
|
+
"items": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"additionalProperties": false,
|
|
156
|
+
"required": ["result", "reason_codes", "public_reason"],
|
|
157
|
+
"properties": {
|
|
158
|
+
"result": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"enum": ["accepted", "rejected_retryable", "human_required"]
|
|
161
|
+
},
|
|
162
|
+
"reason_codes": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
165
|
+
"maxItems": 32
|
|
166
|
+
},
|
|
167
|
+
"public_reason": { "type": "string", "maxLength": 1000 }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { A2AMessage, A2AClientOptions, A2ATask } from "./types.js";
|
|
17
|
+
export declare class A2AClient {
|
|
18
|
+
private readonly url;
|
|
19
|
+
private readonly timeoutMs;
|
|
20
|
+
private readonly fetchImpl;
|
|
21
|
+
private readonly allowPrivateRanges;
|
|
22
|
+
private readonly skipDnsCheck;
|
|
23
|
+
private readonly resolveIp?;
|
|
24
|
+
private readonly headers;
|
|
25
|
+
private readonly ucpAgentProfile?;
|
|
26
|
+
private readonly signer?;
|
|
27
|
+
constructor(options: A2AClientOptions);
|
|
28
|
+
/** A2A `message/send`:发送一条 Message(含 Text/Data Part)。返回远端 Task。 */
|
|
29
|
+
sendMessage(message: A2AMessage, contextId?: string): Promise<A2ATask>;
|
|
30
|
+
/** A2A `tasks/get`:按 taskId 拉取 Task 状态与 artifacts。 */
|
|
31
|
+
getTask(taskId: string): Promise<A2ATask>;
|
|
32
|
+
private rpc;
|
|
33
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A2A JSONRPC binding 出站 client(WP1)。
|
|
18
|
+
*
|
|
19
|
+
* 方法面:SendMessage(Text Part + Data Part 可携带 KNP envelope)、GetTask。
|
|
20
|
+
* 响应解析为结构化 A2ATask。全部失败路径 fail-closed:
|
|
21
|
+
*
|
|
22
|
+
* - 构造时对端点 URL 做静态 SSRF/URL 校验(unsafe_target);
|
|
23
|
+
* - 请求前做 DNS 复查(主机名解析出的 IP 不得落在私网/保留段);
|
|
24
|
+
* - timeout / network / 非 2xx / JSON-RPC error / 畸形响应 / schema 校验
|
|
25
|
+
* 统一抛 A2AClientError,绝不隐式重试或降级到其他 channel(不变量 21)。
|
|
26
|
+
*
|
|
27
|
+
* 零新增依赖:Node 22 原生 fetch + AbortController + node:crypto randomUUID。
|
|
28
|
+
*/
|
|
29
|
+
import { randomUUID } from "node:crypto";
|
|
30
|
+
import { A2AClientError, invalidResponse } from "./error.js";
|
|
31
|
+
import { buildJsonRpcRequest, parseJsonRpcResponse, tryParseJsonRpcError } from "./jsonrpc.js";
|
|
32
|
+
import { parseTaskResult } from "./parse.js";
|
|
33
|
+
import { serializeUcpAgentHeader, UCP_AGENT_HEADER } from "../ucp-agent.js";
|
|
34
|
+
import { assertResolvableTargetUrl, assertSafeTargetUrl } from "./url-policy.js";
|
|
35
|
+
import { isRedirectResponse, readJsonBody, SafeHttpError } from "../../net/safe-http.js";
|
|
36
|
+
export class A2AClient {
|
|
37
|
+
url;
|
|
38
|
+
timeoutMs;
|
|
39
|
+
fetchImpl;
|
|
40
|
+
allowPrivateRanges;
|
|
41
|
+
skipDnsCheck;
|
|
42
|
+
resolveIp;
|
|
43
|
+
headers;
|
|
44
|
+
ucpAgentProfile;
|
|
45
|
+
signer;
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this.url = assertSafeTargetUrl(options.url, { allowPrivateRanges: options.allowPrivateRanges });
|
|
48
|
+
this.timeoutMs = options.timeoutMs ?? 15_000;
|
|
49
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch;
|
|
50
|
+
this.allowPrivateRanges = options.allowPrivateRanges ?? false;
|
|
51
|
+
this.skipDnsCheck = options.skipDnsCheck ?? false;
|
|
52
|
+
this.resolveIp = options.resolveIp;
|
|
53
|
+
this.headers = options.headers ?? {};
|
|
54
|
+
this.ucpAgentProfile = options.ucpAgentProfile;
|
|
55
|
+
this.signer = options.signer;
|
|
56
|
+
}
|
|
57
|
+
/** A2A `message/send`:发送一条 Message(含 Text/Data Part)。返回远端 Task。 */
|
|
58
|
+
async sendMessage(message, contextId) {
|
|
59
|
+
const result = await this.rpc("message/send", {
|
|
60
|
+
message: message,
|
|
61
|
+
...(contextId !== undefined ? { contextId } : {}),
|
|
62
|
+
});
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
/** A2A `tasks/get`:按 taskId 拉取 Task 状态与 artifacts。 */
|
|
66
|
+
async getTask(taskId) {
|
|
67
|
+
return this.rpc("tasks/get", { id: taskId });
|
|
68
|
+
}
|
|
69
|
+
async rpc(method, params) {
|
|
70
|
+
await assertResolvableTargetUrl(this.url, {
|
|
71
|
+
allowPrivateRanges: this.allowPrivateRanges,
|
|
72
|
+
skipDnsCheck: this.skipDnsCheck,
|
|
73
|
+
resolveIp: this.resolveIp,
|
|
74
|
+
});
|
|
75
|
+
const id = randomUUID();
|
|
76
|
+
const body = JSON.stringify(buildJsonRpcRequest(method, params, id));
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
79
|
+
const baseHeaders = {
|
|
80
|
+
"content-type": "application/json",
|
|
81
|
+
accept: "application/json",
|
|
82
|
+
// WP3 §25.1:配置了 buyer profile URI 时宣告 UCP-Agent(RFC 8941 Dictionary)。
|
|
83
|
+
...(this.ucpAgentProfile !== undefined
|
|
84
|
+
? { [UCP_AGENT_HEADER]: serializeUcpAgentHeader(this.ucpAgentProfile) }
|
|
85
|
+
: {}),
|
|
86
|
+
...this.headers,
|
|
87
|
+
};
|
|
88
|
+
// WP5:配置了出站签名器时,对每个请求计算 HTTP Message Signature 头。
|
|
89
|
+
// 注意:覆盖组件含 @method,必须是真实 HTTP 方法(POST),不是 JSON-RPC 方法名。
|
|
90
|
+
const headers = this.signer === undefined
|
|
91
|
+
? baseHeaders
|
|
92
|
+
: { ...baseHeaders, ...this.signer.sign({ method: "POST", url: this.url.href, body: Buffer.from(body, "utf8"), headers: baseHeaders }) };
|
|
93
|
+
let response;
|
|
94
|
+
try {
|
|
95
|
+
response = await this.fetchImpl(this.url.href, {
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers,
|
|
98
|
+
body,
|
|
99
|
+
// SSRF 防线:绝不跟随重定向——重定向目标不经过 SSRF/DNS 复查,且
|
|
100
|
+
// 3xx 可把请求体/认证头转发给第三方。resolve/ucp 已实施,本处对齐。
|
|
101
|
+
redirect: "manual",
|
|
102
|
+
signal: controller.signal,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
if (controller.signal.aborted) {
|
|
107
|
+
throw new A2AClientError("timeout", `A2A request timed out after ${this.timeoutMs}ms`);
|
|
108
|
+
}
|
|
109
|
+
throw new A2AClientError("network", `A2A request failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
110
|
+
}
|
|
111
|
+
if (isRedirectResponse(response)) {
|
|
112
|
+
throw new A2AClientError("http_status", `A2A endpoint must not redirect (HTTP ${response.status})`, { httpStatus: response.status });
|
|
113
|
+
}
|
|
114
|
+
let raw;
|
|
115
|
+
try {
|
|
116
|
+
// 响应体读取在超时覆盖内(timer 活到 body 读完;对端停滞 body 也会
|
|
117
|
+
// 被 abort 中断),且有大小上限(防恶意对端回传 GB 级 body 打爆内存)。
|
|
118
|
+
raw = await readJsonBody(response, { signal: controller.signal });
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (controller.signal.aborted) {
|
|
122
|
+
throw new A2AClientError("timeout", `A2A request timed out after ${this.timeoutMs}ms`);
|
|
123
|
+
}
|
|
124
|
+
if (err instanceof SafeHttpError && err.code === "response_too_large") {
|
|
125
|
+
throw invalidResponse(err.message);
|
|
126
|
+
}
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
throw new A2AClientError("http_status", `A2A HTTP ${response.status} with non-JSON body`, {
|
|
129
|
+
httpStatus: response.status,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
throw invalidResponse("response body is not JSON");
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
clearTimeout(timer);
|
|
136
|
+
}
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
// 兼容:部分实现用非 2xx 状态码携带 JSON-RPC error 体。
|
|
139
|
+
const jsonRpcError = tryParseJsonRpcError(raw, id);
|
|
140
|
+
if (jsonRpcError !== undefined) {
|
|
141
|
+
throw new A2AClientError("jsonrpc_error", jsonRpcError.message, {
|
|
142
|
+
httpStatus: response.status,
|
|
143
|
+
jsonrpcCode: jsonRpcError.code,
|
|
144
|
+
jsonrpcData: jsonRpcError.data,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
throw new A2AClientError("http_status", `A2A HTTP ${response.status}`, {
|
|
148
|
+
httpStatus: response.status,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
const parsed = parseJsonRpcResponse(raw, id);
|
|
152
|
+
if ("error" in parsed) {
|
|
153
|
+
throw new A2AClientError("jsonrpc_error", parsed.error.message, {
|
|
154
|
+
jsonrpcCode: parsed.error.code,
|
|
155
|
+
jsonrpcData: parsed.error.data,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return parseTaskResult(parsed.result);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/a2a/client/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzF,MAAM,OAAO,SAAS;IACH,GAAG,CAAM;IACT,SAAS,CAAS;IAClB,SAAS,CAAe;IACxB,kBAAkB,CAAU;IAC5B,YAAY,CAAU;IACtB,SAAS,CAA2C;IAC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,MAAM,CAAC,KAAK,CAAC,IAAI;aAC/B,CAAC,CAAC;QACL,CAAC;QACD,OAAO,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A2A 出站 client 错误。所有失败路径(timeout / network / 非 2xx / JSON-RPC
|
|
18
|
+
* error / 畸形响应 / URL 安全 / schema 校验)统一 fail-closed 为 A2AClientError,
|
|
19
|
+
* 不产生任何隐式重试或降级。
|
|
20
|
+
*/
|
|
21
|
+
export type A2AClientErrorKind = "timeout" | "network" | "http_status" | "invalid_response" | "jsonrpc_error" | "unsafe_target" | "schema_invalid";
|
|
22
|
+
export interface A2AClientErrorOptions {
|
|
23
|
+
httpStatus?: number;
|
|
24
|
+
jsonrpcCode?: number;
|
|
25
|
+
jsonrpcData?: unknown;
|
|
26
|
+
}
|
|
27
|
+
export declare class A2AClientError extends Error {
|
|
28
|
+
readonly kind: A2AClientErrorKind;
|
|
29
|
+
readonly httpStatus?: number;
|
|
30
|
+
readonly jsonrpcCode?: number;
|
|
31
|
+
readonly jsonrpcData?: unknown;
|
|
32
|
+
constructor(kind: A2AClientErrorKind, message: string, options?: A2AClientErrorOptions);
|
|
33
|
+
}
|
|
34
|
+
/** 畸形响应 / 响应对象结构不符协议的统一构造。 */
|
|
35
|
+
export declare function invalidResponse(detail: string): A2AClientError;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export class A2AClientError extends Error {
|
|
17
|
+
kind;
|
|
18
|
+
httpStatus;
|
|
19
|
+
jsonrpcCode;
|
|
20
|
+
jsonrpcData;
|
|
21
|
+
constructor(kind, message, options = {}) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "A2AClientError";
|
|
24
|
+
this.kind = kind;
|
|
25
|
+
this.httpStatus = options.httpStatus;
|
|
26
|
+
this.jsonrpcCode = options.jsonrpcCode;
|
|
27
|
+
this.jsonrpcData = options.jsonrpcData;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** 畸形响应 / 响应对象结构不符协议的统一构造。 */
|
|
31
|
+
export function invalidResponse(detail) {
|
|
32
|
+
return new A2AClientError("invalid_response", `malformed A2A response: ${detail}`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/a2a/client/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAuBH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,IAAI,CAAqB;IACzB,UAAU,CAAU;IACpB,WAAW,CAAU;IACrB,WAAW,CAAW;IAE/B,YAAY,IAAwB,EAAE,OAAe,EAAE,UAAiC,EAAE;QACxF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACzC,CAAC;CACF;AAED,8BAA8B;AAC9B,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,IAAI,cAAc,CAAC,kBAAkB,EAAE,2BAA2B,MAAM,EAAE,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* a2a/client — A2A JSONRPC binding 出站 client(WP1)。
|
|
18
|
+
*/
|
|
19
|
+
export { A2AClient } from "./client.js";
|
|
20
|
+
export type { A2AClientErrorKind, A2AClientErrorOptions } from "./error.js";
|
|
21
|
+
export { A2AClientError, invalidResponse } from "./error.js";
|
|
22
|
+
export { buildJsonRpcRequest, isJsonRpcRequest, parseJsonRpcResponse, tryParseJsonRpcError, } from "./jsonrpc.js";
|
|
23
|
+
export type { JsonRpcError, JsonRpcParseResult, JsonRpcRequest } from "./jsonrpc.js";
|
|
24
|
+
export { parseTaskResult } from "./parse.js";
|
|
25
|
+
export type { A2AArtifact, A2AMessage, A2AClientOptions, A2APart, A2ATask, A2ATaskState, A2ATaskStatus, } from "./types.js";
|
|
26
|
+
export { A2A_TASK_STATES } from "./types.js";
|
|
27
|
+
export { serializeRfc8941String, serializeUcpAgentHeader, UCP_AGENT_HEADER, UCP_AGENT_PROFILE_MEMBER, } from "../ucp-agent.js";
|
|
28
|
+
export { assertResolvableTargetUrl, assertSafeTargetUrl, isLoopbackHost, isReservedIpv4, isReservedIpv6, } from "./url-policy.js";
|
|
29
|
+
export type { ResolvableTargetUrlOptions, SafeTargetUrlOptions } from "./url-policy.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* a2a/client — A2A JSONRPC binding 出站 client(WP1)。
|
|
18
|
+
*/
|
|
19
|
+
export { A2AClient } from "./client.js";
|
|
20
|
+
export { A2AClientError, invalidResponse } from "./error.js";
|
|
21
|
+
export { buildJsonRpcRequest, isJsonRpcRequest, parseJsonRpcResponse, tryParseJsonRpcError, } from "./jsonrpc.js";
|
|
22
|
+
export { parseTaskResult } from "./parse.js";
|
|
23
|
+
export { A2A_TASK_STATES } from "./types.js";
|
|
24
|
+
export { serializeRfc8941String, serializeUcpAgentHeader, UCP_AGENT_HEADER, UCP_AGENT_PROFILE_MEMBER, } from "../ucp-agent.js";
|
|
25
|
+
export { assertResolvableTargetUrl, assertSafeTargetUrl, isLoopbackHost, isReservedIpv4, isReservedIpv6, } from "./url-policy.js";
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/a2a/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAU7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* JSON-RPC 2.0 帧(A2A JSONRPC binding,§43)。请求构造 + 响应解析。
|
|
18
|
+
*
|
|
19
|
+
* 响应解析 fail-closed:非对象 / jsonrpc 非 "2.0" / id 不匹配 / result 与 error
|
|
20
|
+
* 非二选一 / error 结构非法,全部抛 invalid_response。
|
|
21
|
+
*/
|
|
22
|
+
import { A2AClientError } from "./error.js";
|
|
23
|
+
export interface JsonRpcRequest {
|
|
24
|
+
jsonrpc: "2.0";
|
|
25
|
+
id: string;
|
|
26
|
+
method: string;
|
|
27
|
+
params?: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface JsonRpcError {
|
|
30
|
+
code: number;
|
|
31
|
+
message: string;
|
|
32
|
+
data?: unknown;
|
|
33
|
+
}
|
|
34
|
+
export type JsonRpcParseResult = {
|
|
35
|
+
result: unknown;
|
|
36
|
+
} | {
|
|
37
|
+
error: JsonRpcError;
|
|
38
|
+
};
|
|
39
|
+
export declare function buildJsonRpcRequest(method: string, params: unknown, id: string): JsonRpcRequest;
|
|
40
|
+
/**
|
|
41
|
+
* 解析 JSON-RPC 响应。返回 discriminated union;`error` 分支由调用方决定是否
|
|
42
|
+
* 抛出(client.request 会抛 jsonrpc_error)。
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseJsonRpcResponse(raw: unknown, requestId: string): JsonRpcParseResult;
|
|
45
|
+
/** 非 2xx + 合法 JSON-RPC error 体的识别(HTTP 错误携带 JSON-RPC error 的兼容路径)。 */
|
|
46
|
+
export declare function tryParseJsonRpcError(raw: unknown, requestId: string): JsonRpcError | undefined;
|
|
47
|
+
/** 断言请求是合法 JSON-RPC 对象(本地构造侧校验)。 */
|
|
48
|
+
export declare function isJsonRpcRequest(value: unknown): value is JsonRpcRequest;
|
|
49
|
+
export { A2AClientError };
|