@harrylabsj/kiwi 0.10.0 → 0.12.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/README.md +4 -1
- package/contracts/card-publication/0.1.2/request.schema.json +78 -0
- package/contracts/kiwi-contracts.lock.json +2 -2
- package/contracts/manifest.json +127 -1
- package/contracts/merchant-management/1.0/README.md +109 -0
- package/contracts/merchant-management/1.0/approval-decision.schema.json +16 -0
- package/contracts/merchant-management/1.0/approval-preview.schema.json +26 -0
- package/contracts/merchant-management/1.0/connector-delivery-manifest.schema.json +78 -0
- package/contracts/merchant-management/1.0/management-error.schema.json +30 -0
- package/contracts/merchant-management/1.0/operation-receipt.schema.json +28 -0
- package/contracts/merchant-management/1.0/runtime-management-descriptor.schema.json +33 -0
- package/contracts/merchant-management/1.0/runtime-status.schema.json +42 -0
- package/contracts/merchant-rfq/0.1.0/delivery-record.schema.json +206 -0
- package/contracts/merchant-rfq/0.1.0/fact-snapshot.schema.json +118 -0
- package/contracts/merchant-rfq/0.1.0/handoff-record.schema.json +251 -0
- package/contracts/merchant-rfq/0.1.0/pricing-input.schema.json +139 -0
- package/contracts/merchant-rfq/0.1.0/quote-revision.schema.json +153 -0
- package/contracts/merchant-rfq/0.1.0/release-request.schema.json +121 -0
- package/contracts/merchant-rfq/0.1.0/rfq-case.schema.json +357 -0
- package/contracts/merchant-rfq/0.1.0/source-record.schema.json +162 -0
- package/contracts/merchant-workbench/1.0/README.md +6 -0
- package/contracts/merchant-workbench/1.0/money.schema.json +19 -0
- package/contracts/merchant-workbench/1.0/problem.schema.json +73 -0
- package/contracts/runtime-binding/0.1.2/binding-request.schema.json +73 -0
- package/contracts/runtime-binding/0.1.2/claims.schema.json +100 -0
- package/contracts/runtime-binding/0.1.2/document.schema.json +163 -0
- package/contracts/vectors/binding-thumbprint.json +15 -0
- package/dist/a2a/node.d.ts +98 -2
- package/dist/a2a/node.js +252 -100
- package/dist/a2a/node.js.map +1 -1
- package/dist/a2a/server/errors.d.ts +8 -0
- package/dist/a2a/server/errors.js +8 -0
- package/dist/a2a/server/errors.js.map +1 -1
- package/dist/a2a/server/merchant-handler.d.ts +13 -0
- package/dist/a2a/server/merchant-handler.js +294 -47
- package/dist/a2a/server/merchant-handler.js.map +1 -1
- package/dist/a2a/server/pipeline.d.ts +15 -10
- package/dist/a2a/server/pipeline.js +49 -18
- package/dist/a2a/server/pipeline.js.map +1 -1
- package/dist/a2a/server/server.d.ts +20 -1
- package/dist/a2a/server/server.js +87 -13
- package/dist/a2a/server/server.js.map +1 -1
- package/dist/a2a/server/task-registry.d.ts +31 -11
- package/dist/a2a/server/task-registry.js +65 -20
- package/dist/a2a/server/task-registry.js.map +1 -1
- package/dist/a2a/server/types.d.ts +24 -0
- package/dist/a2a/signing-key.d.ts +6 -0
- package/dist/a2a/signing-key.js +12 -0
- package/dist/a2a/signing-key.js.map +1 -1
- package/dist/agent/buyer/buyer-tools.d.ts +2 -2
- package/dist/agent/buyer/buyer-tools.js +1 -1
- package/dist/agent/buyer/buyer-tools.js.map +1 -1
- package/dist/agent/chat-tools.d.ts +2 -11
- package/dist/agent/chat-tools.js.map +1 -1
- package/dist/agent/fake-chat-model.d.ts +3 -3
- package/dist/agent/fake-chat-model.js +3 -5
- package/dist/agent/fake-chat-model.js.map +1 -1
- package/dist/agent/host/web-renderer.d.ts +5 -0
- package/dist/agent/host/web-renderer.js +25 -6
- package/dist/agent/host/web-renderer.js.map +1 -1
- package/dist/agent/kernel-builder.js +4 -4
- package/dist/agent/kernel-builder.js.map +1 -1
- package/dist/agent/kernel.d.ts +15 -5
- package/dist/agent/kernel.js +149 -73
- package/dist/agent/kernel.js.map +1 -1
- package/dist/agent/kiwi-tool.d.ts +33 -0
- package/dist/agent/kiwi-tool.js +17 -0
- package/dist/agent/kiwi-tool.js.map +1 -0
- package/dist/agent/memory/schema.d.ts +1 -1
- package/dist/agent/memory/schema.js +190 -1
- package/dist/agent/memory/schema.js.map +1 -1
- package/dist/agent/memory/store.js +3 -1
- package/dist/agent/memory/store.js.map +1 -1
- package/dist/agent/merchant/action-candidate.d.ts +1 -0
- package/dist/agent/merchant/action-candidate.js +42 -24
- package/dist/agent/merchant/action-candidate.js.map +1 -1
- package/dist/agent/merchant/fake-merchant-client.d.ts +30 -1
- package/dist/agent/merchant/fake-merchant-client.js +151 -2
- package/dist/agent/merchant/fake-merchant-client.js.map +1 -1
- package/dist/agent/merchant/intelligence/default-backend.js +2 -2
- package/dist/agent/merchant/intelligence/default-backend.js.map +1 -1
- package/dist/agent/merchant/merchant-client.d.ts +38 -5
- package/dist/agent/merchant/merchant-client.js +103 -8
- package/dist/agent/merchant/merchant-client.js.map +1 -1
- package/dist/agent/merchant/merchant-tools.d.ts +2 -17
- package/dist/agent/merchant/merchant-tools.js.map +1 -1
- package/dist/agent/merchant/types.d.ts +107 -0
- package/dist/agent/merchant/types.js +69 -0
- package/dist/agent/merchant/types.js.map +1 -1
- package/dist/agent/negotiation-chat.d.ts +3 -2
- package/dist/agent/negotiation-chat.js.map +1 -1
- package/dist/agent/session.d.ts +15 -3
- package/dist/agent/session.js +114 -122
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/skills/tools.d.ts +2 -2
- package/dist/agent/skills/tools.js.map +1 -1
- package/dist/alerts/external-delivery.d.ts +78 -0
- package/dist/alerts/external-delivery.js +256 -0
- package/dist/alerts/external-delivery.js.map +1 -0
- package/dist/auth/app-oauth-callback.d.ts +38 -0
- package/dist/auth/app-oauth-callback.js +119 -0
- package/dist/auth/app-oauth-callback.js.map +1 -0
- package/dist/auth/merchant-oauth.js +15 -41
- package/dist/auth/merchant-oauth.js.map +1 -1
- package/dist/auth/merchant-pairing.d.ts +51 -0
- package/dist/auth/merchant-pairing.js +66 -16
- package/dist/auth/merchant-pairing.js.map +1 -1
- package/dist/auth/merchant-sessions.d.ts +7 -1
- package/dist/auth/merchant-sessions.js +25 -3
- package/dist/auth/merchant-sessions.js.map +1 -1
- package/dist/buyer-core/build-service.d.ts +3 -1
- package/dist/buyer-core/build-service.js +4 -1
- package/dist/buyer-core/build-service.js.map +1 -1
- package/dist/buyer-core/merchant-index.d.ts +20 -0
- package/dist/buyer-core/merchant-index.js +83 -12
- package/dist/buyer-core/merchant-index.js.map +1 -1
- package/dist/buyer-core/network-search.d.ts +92 -0
- package/dist/buyer-core/network-search.js +144 -0
- package/dist/buyer-core/network-search.js.map +1 -0
- package/dist/buyer-core/product-summary.d.ts +71 -0
- package/dist/buyer-core/product-summary.js +63 -0
- package/dist/buyer-core/product-summary.js.map +1 -0
- package/dist/buyer-core/service.d.ts +26 -0
- package/dist/buyer-core/service.js +38 -8
- package/dist/buyer-core/service.js.map +1 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +260 -274
- package/dist/cli.js.map +1 -1
- package/dist/cloud/binding/audit.d.ts +72 -0
- package/dist/cloud/binding/audit.js +137 -0
- package/dist/cloud/binding/audit.js.map +1 -0
- package/dist/cloud/binding/enrollment-challenge.d.ts +37 -0
- package/dist/cloud/binding/enrollment-challenge.js +153 -0
- package/dist/cloud/binding/enrollment-challenge.js.map +1 -0
- package/dist/cloud/binding/enrollment-heartbeat.d.ts +26 -0
- package/dist/cloud/binding/enrollment-heartbeat.js +146 -0
- package/dist/cloud/binding/enrollment-heartbeat.js.map +1 -0
- package/dist/cloud/binding/enrollment-key-recovery.d.ts +27 -0
- package/dist/cloud/binding/enrollment-key-recovery.js +127 -0
- package/dist/cloud/binding/enrollment-key-recovery.js.map +1 -0
- package/dist/cloud/binding/issuance.d.ts +76 -0
- package/dist/cloud/binding/issuance.js +121 -0
- package/dist/cloud/binding/issuance.js.map +1 -0
- package/dist/cloud/binding/proofs.d.ts +110 -0
- package/dist/cloud/binding/proofs.js +200 -0
- package/dist/cloud/binding/proofs.js.map +1 -0
- package/dist/cloud/binding/runtime-challenge.d.ts +48 -0
- package/dist/cloud/binding/runtime-challenge.js +185 -0
- package/dist/cloud/binding/runtime-challenge.js.map +1 -0
- package/dist/cloud/bootstrap.d.ts +63 -0
- package/dist/cloud/bootstrap.js +1161 -0
- package/dist/cloud/bootstrap.js.map +1 -0
- package/dist/cloud/catalog-client.d.ts +305 -0
- package/dist/cloud/catalog-client.js +962 -0
- package/dist/cloud/catalog-client.js.map +1 -0
- package/dist/cloud/config.d.ts +103 -0
- package/dist/cloud/config.js +274 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/http-router.d.ts +63 -0
- package/dist/cloud/http-router.js +135 -0
- package/dist/cloud/http-router.js.map +1 -0
- package/dist/cloud/listing-publisher.d.ts +45 -0
- package/dist/cloud/listing-publisher.js +244 -0
- package/dist/cloud/listing-publisher.js.map +1 -0
- package/dist/cloud/main.d.ts +16 -0
- package/dist/cloud/main.js +64 -0
- package/dist/cloud/main.js.map +1 -0
- package/dist/cloud/merchant-connect.d.ts +47 -0
- package/dist/cloud/merchant-connect.js +331 -0
- package/dist/cloud/merchant-connect.js.map +1 -0
- package/dist/cloud/merchant-identity.d.ts +14 -0
- package/dist/cloud/merchant-identity.js +76 -0
- package/dist/cloud/merchant-identity.js.map +1 -0
- package/dist/cloud/onboarding/catalog-pipeline.d.ts +135 -0
- package/dist/cloud/onboarding/catalog-pipeline.js +454 -0
- package/dist/cloud/onboarding/catalog-pipeline.js.map +1 -0
- package/dist/cloud/onboarding/local-fallback.d.ts +86 -0
- package/dist/cloud/onboarding/local-fallback.js +98 -0
- package/dist/cloud/onboarding/local-fallback.js.map +1 -0
- package/dist/cloud/onboarding/steps.d.ts +95 -0
- package/dist/cloud/onboarding/steps.js +175 -0
- package/dist/cloud/onboarding/steps.js.map +1 -0
- package/dist/cloud/onboarding/store.d.ts +136 -0
- package/dist/cloud/onboarding/store.js +472 -0
- package/dist/cloud/onboarding/store.js.map +1 -0
- package/dist/cloud/onboarding/types.d.ts +132 -0
- package/dist/cloud/onboarding/types.js +152 -0
- package/dist/cloud/onboarding/types.js.map +1 -0
- package/dist/cloud/product-import-tabular.d.ts +100 -0
- package/dist/cloud/product-import-tabular.js +1073 -0
- package/dist/cloud/product-import-tabular.js.map +1 -0
- package/dist/cloud/product-source.d.ts +104 -0
- package/dist/cloud/product-source.js +276 -0
- package/dist/cloud/product-source.js.map +1 -0
- package/dist/cloud/readiness.d.ts +49 -0
- package/dist/cloud/readiness.js +54 -0
- package/dist/cloud/readiness.js.map +1 -0
- package/dist/commerce/data-source.d.ts +5 -0
- package/dist/commerce/data-source.js.map +1 -1
- package/dist/config/profile.d.ts +4 -0
- package/dist/config/profile.js +14 -0
- package/dist/config/profile.js.map +1 -1
- package/dist/config/provider-kind.d.ts +26 -0
- package/dist/config/provider-kind.js +19 -0
- package/dist/config/provider-kind.js.map +1 -0
- package/dist/contracts/cloud-contracts.d.ts +23 -0
- package/dist/contracts/cloud-contracts.js +90 -0
- package/dist/contracts/cloud-contracts.js.map +1 -0
- package/dist/counterparty/a2a-direct/index.d.ts +3 -0
- package/dist/counterparty/a2a-direct/index.js +22 -6
- package/dist/counterparty/a2a-direct/index.js.map +1 -1
- package/dist/counterparty/registry.d.ts +2 -0
- package/dist/counterparty/registry.js +2 -0
- package/dist/counterparty/registry.js.map +1 -1
- package/dist/counterparty/shopping-cli-hosted/index.d.ts +3 -0
- package/dist/counterparty/shopping-cli-hosted/index.js +9 -2
- package/dist/counterparty/shopping-cli-hosted/index.js.map +1 -1
- package/dist/discovery/catalog-source/buyer-follows.js +2 -2
- package/dist/discovery/catalog-source/buyer-follows.js.map +1 -1
- package/dist/discovery/catalog-source/cloud-card.d.ts +184 -0
- package/dist/discovery/catalog-source/cloud-card.js +385 -0
- package/dist/discovery/catalog-source/cloud-card.js.map +1 -0
- package/dist/discovery/catalog-source/cloud-hosting.d.ts +71 -0
- package/dist/discovery/catalog-source/cloud-hosting.js +70 -0
- package/dist/discovery/catalog-source/cloud-hosting.js.map +1 -0
- package/dist/discovery/catalog-source/errors.d.ts +12 -2
- package/dist/discovery/catalog-source/errors.js +14 -1
- package/dist/discovery/catalog-source/errors.js.map +1 -1
- package/dist/discovery/catalog-source/index.d.ts +2 -0
- package/dist/discovery/catalog-source/index.js +2 -0
- package/dist/discovery/catalog-source/index.js.map +1 -1
- package/dist/discovery/catalog-source/kiwi-source.js +2 -2
- package/dist/discovery/catalog-source/kiwi-source.js.map +1 -1
- package/dist/discovery/catalog-source/merchant-publications.d.ts +2 -2
- package/dist/discovery/catalog-source/merchant-publications.js +10 -5
- package/dist/discovery/catalog-source/merchant-publications.js.map +1 -1
- package/dist/discovery/catalog-source/source.js +2 -2
- package/dist/discovery/catalog-source/source.js.map +1 -1
- package/dist/discovery/merchant-subscriptions.d.ts +45 -0
- package/dist/discovery/merchant-subscriptions.js +319 -0
- package/dist/discovery/merchant-subscriptions.js.map +1 -0
- package/dist/discovery/resolve.d.ts +38 -0
- package/dist/discovery/resolve.js +100 -7
- package/dist/discovery/resolve.js.map +1 -1
- package/dist/fanout/orchestrator.d.ts +2 -0
- package/dist/fanout/orchestrator.js +4 -1
- package/dist/fanout/orchestrator.js.map +1 -1
- package/dist/handoff/ledger.d.ts +1 -0
- package/dist/handoff/ledger.js +3 -0
- package/dist/handoff/ledger.js.map +1 -1
- package/dist/handoff/transaction.js +1 -1
- package/dist/handoff/transaction.js.map +1 -1
- package/dist/http/merchant-engagement-api.d.ts +10 -0
- package/dist/http/merchant-engagement-api.js +138 -0
- package/dist/http/merchant-engagement-api.js.map +1 -0
- package/dist/http/merchant-feed-api.d.ts +7 -0
- package/dist/http/merchant-feed-api.js +129 -0
- package/dist/http/merchant-feed-api.js.map +1 -0
- package/dist/http/merchant-follow-api.d.ts +15 -0
- package/dist/http/merchant-follow-api.js +192 -0
- package/dist/http/merchant-follow-api.js.map +1 -0
- package/dist/http/merchant-management/api.d.ts +258 -0
- package/dist/http/merchant-management/api.js +3022 -0
- package/dist/http/merchant-management/api.js.map +1 -0
- package/dist/http/merchant-management/draft-store.d.ts +51 -0
- package/dist/http/merchant-management/draft-store.js +95 -0
- package/dist/http/merchant-management/draft-store.js.map +1 -0
- package/dist/http/merchant-management/event-projection.d.ts +41 -0
- package/dist/http/merchant-management/event-projection.js +190 -0
- package/dist/http/merchant-management/event-projection.js.map +1 -0
- package/dist/http/merchant-management/operation-store.d.ts +97 -0
- package/dist/http/merchant-management/operation-store.js +252 -0
- package/dist/http/merchant-management/operation-store.js.map +1 -0
- package/dist/http/merchant-management/page.d.ts +29 -0
- package/dist/http/merchant-management/page.js +641 -0
- package/dist/http/merchant-management/page.js.map +1 -0
- package/dist/http/merchant-management/problem-client.d.ts +19 -0
- package/dist/http/merchant-management/problem-client.js +55 -0
- package/dist/http/merchant-management/problem-client.js.map +1 -0
- package/dist/http/merchant-management/problem.d.ts +74 -0
- package/dist/http/merchant-management/problem.js +112 -0
- package/dist/http/merchant-management/problem.js.map +1 -0
- package/dist/http/merchant-management/reconciliation-worker.d.ts +95 -0
- package/dist/http/merchant-management/reconciliation-worker.js +397 -0
- package/dist/http/merchant-management/reconciliation-worker.js.map +1 -0
- package/dist/http/merchant-management/service-state.d.ts +86 -0
- package/dist/http/merchant-management/service-state.js +217 -0
- package/dist/http/merchant-management/service-state.js.map +1 -0
- package/dist/http/merchant-management/trusted-page.d.ts +3 -0
- package/dist/http/merchant-management/trusted-page.js +73 -0
- package/dist/http/merchant-management/trusted-page.js.map +1 -0
- package/dist/http/merchant-management/webauthn-confirmation.d.ts +148 -0
- package/dist/http/merchant-management/webauthn-confirmation.js +517 -0
- package/dist/http/merchant-management/webauthn-confirmation.js.map +1 -0
- package/dist/http/merchant-privacy-api.d.ts +9 -0
- package/dist/http/merchant-privacy-api.js +96 -0
- package/dist/http/merchant-privacy-api.js.map +1 -0
- package/dist/mcp/merchant-rfq-resources.d.ts +37 -0
- package/dist/mcp/merchant-rfq-resources.js +132 -0
- package/dist/mcp/merchant-rfq-resources.js.map +1 -0
- package/dist/mcp/merchant-rfq-tools.d.ts +61 -0
- package/dist/mcp/merchant-rfq-tools.js +584 -0
- package/dist/mcp/merchant-rfq-tools.js.map +1 -0
- package/dist/mcp/merchant-runtime-assembly.d.ts +74 -0
- package/dist/mcp/merchant-runtime-assembly.js +476 -0
- package/dist/mcp/merchant-runtime-assembly.js.map +1 -0
- package/dist/mcp/merchant-server.d.ts +66 -1
- package/dist/mcp/merchant-server.js +260 -23
- package/dist/mcp/merchant-server.js.map +1 -1
- package/dist/mcp/tools.js +8 -2
- package/dist/mcp/tools.js.map +1 -1
- package/dist/merchant/application/actor.d.ts +85 -0
- package/dist/merchant/application/actor.js +162 -0
- package/dist/merchant/application/actor.js.map +1 -0
- package/dist/merchant/application/money.d.ts +35 -0
- package/dist/merchant/application/money.js +124 -0
- package/dist/merchant/application/money.js.map +1 -0
- package/dist/merchant/application/service.d.ts +228 -0
- package/dist/merchant/application/service.js +262 -0
- package/dist/merchant/application/service.js.map +1 -0
- package/dist/merchant/clock-safety.d.ts +50 -0
- package/dist/merchant/clock-safety.js +153 -0
- package/dist/merchant/clock-safety.js.map +1 -0
- package/dist/merchant/engagement-store.d.ts +32 -0
- package/dist/merchant/engagement-store.js +119 -0
- package/dist/merchant/engagement-store.js.map +1 -0
- package/dist/merchant/exact-product-executors.d.ts +11 -0
- package/dist/merchant/exact-product-executors.js +132 -0
- package/dist/merchant/exact-product-executors.js.map +1 -0
- package/dist/merchant/feed-executors.d.ts +17 -0
- package/dist/merchant/feed-executors.js +151 -0
- package/dist/merchant/feed-executors.js.map +1 -0
- package/dist/merchant/feed-store.d.ts +141 -0
- package/dist/merchant/feed-store.js +496 -0
- package/dist/merchant/feed-store.js.map +1 -0
- package/dist/merchant/follow-store.d.ts +66 -0
- package/dist/merchant/follow-store.js +295 -0
- package/dist/merchant/follow-store.js.map +1 -0
- package/dist/merchant/grant-executors.d.ts +11 -0
- package/dist/merchant/grant-executors.js +136 -0
- package/dist/merchant/grant-executors.js.map +1 -0
- package/dist/merchant/grant-store.d.ts +125 -0
- package/dist/merchant/grant-store.js +313 -0
- package/dist/merchant/grant-store.js.map +1 -0
- package/dist/merchant/inventory-executors.d.ts +47 -0
- package/dist/merchant/inventory-executors.js +91 -0
- package/dist/merchant/inventory-executors.js.map +1 -0
- package/dist/merchant/listing-executors.d.ts +51 -0
- package/dist/merchant/listing-executors.js +100 -0
- package/dist/merchant/listing-executors.js.map +1 -0
- package/dist/merchant/negotiation-observer.d.ts +92 -0
- package/dist/merchant/negotiation-observer.js +278 -0
- package/dist/merchant/negotiation-observer.js.map +1 -0
- package/dist/merchant/operation-receipts.d.ts +57 -0
- package/dist/merchant/operation-receipts.js +138 -0
- package/dist/merchant/operation-receipts.js.map +1 -0
- package/dist/merchant/operations-report.d.ts +85 -0
- package/dist/merchant/operations-report.js +227 -0
- package/dist/merchant/operations-report.js.map +1 -0
- package/dist/merchant/promotion-broadcast-recovery.d.ts +22 -0
- package/dist/merchant/promotion-broadcast-recovery.js +74 -0
- package/dist/merchant/promotion-broadcast-recovery.js.map +1 -0
- package/dist/merchant/promotion-broadcast-workflow.d.ts +42 -0
- package/dist/merchant/promotion-broadcast-workflow.js +171 -0
- package/dist/merchant/promotion-broadcast-workflow.js.map +1 -0
- package/dist/merchant/promotion-executors.d.ts +18 -0
- package/dist/merchant/promotion-executors.js +133 -0
- package/dist/merchant/promotion-executors.js.map +1 -0
- package/dist/merchant/promotion-store.d.ts +114 -0
- package/dist/merchant/promotion-store.js +325 -0
- package/dist/merchant/promotion-store.js.map +1 -0
- package/dist/merchant/promotion-time.d.ts +19 -0
- package/dist/merchant/promotion-time.js +162 -0
- package/dist/merchant/promotion-time.js.map +1 -0
- package/dist/merchant/quote-calculator.d.ts +32 -0
- package/dist/merchant/quote-calculator.js +70 -0
- package/dist/merchant/quote-calculator.js.map +1 -0
- package/dist/merchant/service-control-executors.d.ts +15 -0
- package/dist/merchant/service-control-executors.js +52 -0
- package/dist/merchant/service-control-executors.js.map +1 -0
- package/dist/merchant/stats-store.d.ts +5 -0
- package/dist/merchant/stats-store.js +18 -0
- package/dist/merchant/stats-store.js.map +1 -1
- package/dist/merchant/workbench-service.d.ts +1 -0
- package/dist/merchant/workbench-service.js +11 -1
- package/dist/merchant/workbench-service.js.map +1 -1
- package/dist/merchant-admin/pending-page.d.ts +104 -0
- package/dist/merchant-admin/pending-page.js +20 -0
- package/dist/merchant-admin/pending-page.js.map +1 -1
- package/dist/merchant-admin/rfq-page.d.ts +105 -0
- package/dist/merchant-admin/rfq-page.js +176 -0
- package/dist/merchant-admin/rfq-page.js.map +1 -0
- package/dist/merchant-core/commands.d.ts +27 -0
- package/dist/merchant-core/commands.js +90 -1
- package/dist/merchant-core/commands.js.map +1 -1
- package/dist/merchant-core/executor.d.ts +27 -3
- package/dist/merchant-core/executor.js +13 -4
- package/dist/merchant-core/executor.js.map +1 -1
- package/dist/merchant-core/rfq/artifacts.d.ts +78 -0
- package/dist/merchant-core/rfq/artifacts.js +219 -0
- package/dist/merchant-core/rfq/artifacts.js.map +1 -0
- package/dist/merchant-core/rfq/data-source-adapter.d.ts +49 -0
- package/dist/merchant-core/rfq/data-source-adapter.js +128 -0
- package/dist/merchant-core/rfq/data-source-adapter.js.map +1 -0
- package/dist/merchant-core/rfq/delivery.d.ts +43 -0
- package/dist/merchant-core/rfq/delivery.js +57 -0
- package/dist/merchant-core/rfq/delivery.js.map +1 -0
- package/dist/merchant-core/rfq/fact-resolver.d.ts +76 -0
- package/dist/merchant-core/rfq/fact-resolver.js +220 -0
- package/dist/merchant-core/rfq/fact-resolver.js.map +1 -0
- package/dist/merchant-core/rfq/handoff.d.ts +54 -0
- package/dist/merchant-core/rfq/handoff.js +71 -0
- package/dist/merchant-core/rfq/handoff.js.map +1 -0
- package/dist/merchant-core/rfq/policy.d.ts +77 -0
- package/dist/merchant-core/rfq/policy.js +104 -0
- package/dist/merchant-core/rfq/policy.js.map +1 -0
- package/dist/merchant-core/rfq/pricing.d.ts +48 -0
- package/dist/merchant-core/rfq/pricing.js +150 -0
- package/dist/merchant-core/rfq/pricing.js.map +1 -0
- package/dist/merchant-core/rfq/quote-revisions.d.ts +52 -0
- package/dist/merchant-core/rfq/quote-revisions.js +126 -0
- package/dist/merchant-core/rfq/quote-revisions.js.map +1 -0
- package/dist/merchant-core/rfq/release-coordinator.d.ts +99 -0
- package/dist/merchant-core/rfq/release-coordinator.js +355 -0
- package/dist/merchant-core/rfq/release-coordinator.js.map +1 -0
- package/dist/merchant-core/rfq/repository.d.ts +398 -0
- package/dist/merchant-core/rfq/repository.js +855 -0
- package/dist/merchant-core/rfq/repository.js.map +1 -0
- package/dist/merchant-core/rfq/service.d.ts +398 -0
- package/dist/merchant-core/rfq/service.js +1036 -0
- package/dist/merchant-core/rfq/service.js.map +1 -0
- package/dist/merchant-core/rfq/source-records.d.ts +97 -0
- package/dist/merchant-core/rfq/source-records.js +349 -0
- package/dist/merchant-core/rfq/source-records.js.map +1 -0
- package/dist/merchant-core/rfq/types.d.ts +197 -0
- package/dist/merchant-core/rfq/types.js +110 -0
- package/dist/merchant-core/rfq/types.js.map +1 -0
- package/dist/merchant-core/service.d.ts +118 -1
- package/dist/merchant-core/service.js +202 -7
- package/dist/merchant-core/service.js.map +1 -1
- package/dist/merchant-core/storage/clock-skew-alerts.d.ts +21 -0
- package/dist/merchant-core/storage/clock-skew-alerts.js +67 -0
- package/dist/merchant-core/storage/clock-skew-alerts.js.map +1 -0
- package/dist/merchant-core/storage/leased-job.d.ts +42 -0
- package/dist/merchant-core/storage/leased-job.js +38 -0
- package/dist/merchant-core/storage/leased-job.js.map +1 -0
- package/dist/merchant-core/storage/operation-lifecycle.d.ts +78 -0
- package/dist/merchant-core/storage/operation-lifecycle.js +111 -0
- package/dist/merchant-core/storage/operation-lifecycle.js.map +1 -0
- package/dist/merchant-core/storage/redact.d.ts +29 -0
- package/dist/merchant-core/storage/redact.js +34 -0
- package/dist/merchant-core/storage/redact.js.map +1 -0
- package/dist/merchant-core/storage/schema.d.ts +24 -0
- package/dist/merchant-core/storage/schema.js +22 -0
- package/dist/merchant-core/storage/schema.js.map +1 -0
- package/dist/merchant-core/storage/transaction.d.ts +47 -0
- package/dist/merchant-core/storage/transaction.js +28 -0
- package/dist/merchant-core/storage/transaction.js.map +1 -0
- package/dist/merchant-gateway/catalog-publications.d.ts +28 -0
- package/dist/merchant-gateway/catalog-publications.js +69 -0
- package/dist/merchant-gateway/catalog-publications.js.map +1 -1
- package/dist/merchant-gateway/catalog-tools.js +20 -0
- package/dist/merchant-gateway/catalog-tools.js.map +1 -1
- package/dist/merchant-gateway/entry-server.js +10 -0
- package/dist/merchant-gateway/entry-server.js.map +1 -1
- package/dist/negotiation/domain/objects.d.ts +7 -0
- package/dist/negotiation/domain/objects.js +8 -0
- package/dist/negotiation/domain/objects.js.map +1 -1
- package/dist/negotiation/idempotency/store.d.ts +23 -0
- package/dist/negotiation/idempotency/store.js +72 -1
- package/dist/negotiation/idempotency/store.js.map +1 -1
- package/dist/negotiation/idempotency/types.d.ts +16 -0
- package/dist/negotiation/idempotency/types.js +2 -0
- package/dist/negotiation/idempotency/types.js.map +1 -1
- package/dist/negotiation/lease/store.d.ts +18 -22
- package/dist/negotiation/lease/store.js +152 -88
- package/dist/negotiation/lease/store.js.map +1 -1
- package/dist/negotiation/ledger/event.d.ts +6 -0
- package/dist/negotiation/ledger/event.js +1 -0
- package/dist/negotiation/ledger/event.js.map +1 -1
- package/dist/negotiation/ledger/index.d.ts +4 -2
- package/dist/negotiation/ledger/index.js +1 -0
- package/dist/negotiation/ledger/index.js.map +1 -1
- package/dist/negotiation/ledger/payload-segments.d.ts +51 -0
- package/dist/negotiation/ledger/payload-segments.js +247 -0
- package/dist/negotiation/ledger/payload-segments.js.map +1 -0
- package/dist/negotiation/ledger/store.d.ts +34 -0
- package/dist/negotiation/ledger/store.js +162 -0
- package/dist/negotiation/ledger/store.js.map +1 -1
- package/dist/negotiation/recovery/recover.js +1 -1
- package/dist/negotiation/recovery/recover.js.map +1 -1
- package/dist/privacy/ledger-payload-deletion.d.ts +10 -0
- package/dist/privacy/ledger-payload-deletion.js +31 -0
- package/dist/privacy/ledger-payload-deletion.js.map +1 -0
- package/dist/privacy/local-backup-deletion.d.ts +13 -0
- package/dist/privacy/local-backup-deletion.js +115 -0
- package/dist/privacy/local-backup-deletion.js.map +1 -0
- package/dist/privacy/workbench-retention.d.ts +105 -0
- package/dist/privacy/workbench-retention.js +501 -0
- package/dist/privacy/workbench-retention.js.map +1 -0
- package/dist/product-cli.d.ts +2 -2
- package/dist/product-cli.js +24 -9
- package/dist/product-cli.js.map +1 -1
- package/dist/product-init.d.ts +4 -1
- package/dist/product-init.js +39 -11
- package/dist/product-init.js.map +1 -1
- package/dist/product-publish.d.ts +8 -2
- package/dist/product-publish.js +222 -142
- package/dist/product-publish.js.map +1 -1
- package/dist/runtime/fake-model.js +9 -3
- package/dist/runtime/fake-model.js.map +1 -1
- package/dist/runtime/model.d.ts +1 -1
- package/dist/runtime/model.js +3 -3
- package/dist/runtime/model.js.map +1 -1
- package/dist/trust/binding/claims.d.ts +92 -0
- package/dist/trust/binding/claims.js +175 -0
- package/dist/trust/binding/claims.js.map +1 -0
- package/dist/trust/binding/thumbprint.d.ts +35 -0
- package/dist/trust/binding/thumbprint.js +88 -0
- package/dist/trust/binding/thumbprint.js.map +1 -0
- package/dist/trust/binding/verify.d.ts +84 -0
- package/dist/trust/binding/verify.js +121 -0
- package/dist/trust/binding/verify.js.map +1 -0
- package/dist/trust/identity/auth-verifier.d.ts +9 -0
- package/dist/trust/identity/auth-verifier.js +10 -2
- package/dist/trust/identity/auth-verifier.js.map +1 -1
- package/dist/trust/identity/jws.d.ts +22 -1
- package/dist/trust/identity/jws.js +31 -2
- package/dist/trust/identity/jws.js.map +1 -1
- package/package.json +17 -6
- package/skills/kiwi-buyer/SKILL.md +33 -2
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
/** RFQ 业务错误(设计 v0.1.1 §11.3 错误码;MCP 层映射为带内错误)。 */
|
|
17
|
+
export type RfqErrorCode = "auth" | "forbidden" | "not_found" | "validation" | "unavailable" | "tenant_mismatch" | "needs_clarification" | "sku_ambiguous" | "source_unavailable" | "source_conflict" | "source_invalid" | "fact_stale" | "pricing_invalid" | "unsupported_term" | "policy_requires_review" | "version_conflict" | "approval_stale" | "idempotency_conflict" | "operation_unknown" | "case_closed" | "quote_expired";
|
|
18
|
+
export declare class RfqError extends Error {
|
|
19
|
+
readonly code: RfqErrorCode;
|
|
20
|
+
constructor(code: RfqErrorCode, message: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 规范化序列化(v0.1.1 §10.3)。数组保序;对象键 ASCII 且字典序排序;
|
|
24
|
+
* number 仅接受安全整数(浮点/非有限值拒绝——金额与数量绝不以浮点进入
|
|
25
|
+
* 摘要);undefined 键剔除(与既有 stableStringify 一致,重试幂等依赖它)。
|
|
26
|
+
*/
|
|
27
|
+
export declare function canonicalJson(value: unknown): string;
|
|
28
|
+
/** 规范化 JSON 的 sha256 内容摘要(sha256: 前缀,与既有 contentHash 同风格)。 */
|
|
29
|
+
export declare function rfqContentDigest(value: unknown): string;
|
|
30
|
+
export declare const RFQ_STAGES: readonly ["NEW", "NEEDS_CLARIFICATION", "READY", "PRICED", "CLOSED", "CANCELLED"];
|
|
31
|
+
export type RfqStage = (typeof RFQ_STAGES)[number];
|
|
32
|
+
export declare const QUOTE_STATUSES: readonly ["DRAFT", "VALIDATED", "PENDING_APPROVAL", "APPROVED", "EXPORTED", "REJECTED", "SUPERSEDED", "EXPIRED"];
|
|
33
|
+
export type QuoteStatus = (typeof QUOTE_STATUSES)[number];
|
|
34
|
+
/** 报价生命周期事件(rfq_quote_events 投影;当前状态 = 最新事件)。 */
|
|
35
|
+
export type QuoteEventKind = Exclude<QuoteStatus, "DRAFT">;
|
|
36
|
+
export declare const DELIVERY_STATUSES: readonly ["NOT_SENT", "REPORTED_SENT", "RECEIPT_VERIFIED", "DELIVERY_UNKNOWN"];
|
|
37
|
+
export type DeliveryStatus = (typeof DELIVERY_STATUSES)[number];
|
|
38
|
+
export declare const HANDOFF_STATUSES: readonly ["PACKET_READY", "OWNER_RECORDED", "TARGET_VERIFIED", "REJECTED", "UNKNOWN"];
|
|
39
|
+
export type HandoffStatus = (typeof HANDOFF_STATUSES)[number];
|
|
40
|
+
export interface RfqLine {
|
|
41
|
+
line_id: string;
|
|
42
|
+
/** 客户原始需求描述(未经模型改写)。 */
|
|
43
|
+
query: string;
|
|
44
|
+
sku: string | null;
|
|
45
|
+
quantity: number | null;
|
|
46
|
+
unit: string | null;
|
|
47
|
+
confirmation: "unconfirmed" | "confirmed";
|
|
48
|
+
/** 服务端验证过的具名确认引用(模型自报 human_confirmed 不作数)。 */
|
|
49
|
+
confirmation_ref: string | null;
|
|
50
|
+
evidence_source_ids: string[];
|
|
51
|
+
}
|
|
52
|
+
export interface RfqTerms {
|
|
53
|
+
currency: "CNY";
|
|
54
|
+
tax_basis: "UNKNOWN" | "INCLUSIVE" | "EXCLUSIVE";
|
|
55
|
+
tax_rate_bps: number | null;
|
|
56
|
+
shipping_known: boolean;
|
|
57
|
+
shipping_minor: number | null;
|
|
58
|
+
/** 已确认交期表达(原文口径;不做自然语言承诺扩展)。 */
|
|
59
|
+
delivery_date: string | null;
|
|
60
|
+
payment_terms: string | null;
|
|
61
|
+
}
|
|
62
|
+
/** 一版需求 revision 的规范字段(rfq_case_revisions.fields_json)。 */
|
|
63
|
+
export interface RfqCaseFields {
|
|
64
|
+
client_ref: string;
|
|
65
|
+
recipient_ref: string | null;
|
|
66
|
+
lines: RfqLine[];
|
|
67
|
+
terms: RfqTerms;
|
|
68
|
+
}
|
|
69
|
+
/** 规范字段缺口(view 级投影;NEEDS_CLARIFICATION 的依据)。 */
|
|
70
|
+
export interface RfqBlocker {
|
|
71
|
+
field: string;
|
|
72
|
+
reason: string;
|
|
73
|
+
}
|
|
74
|
+
/** 文本来源定位:Unicode code point 半开区间(不是 UTF-8 字节偏移)。 */
|
|
75
|
+
export interface TextSpanLocator {
|
|
76
|
+
kind: "text_span";
|
|
77
|
+
character_start: number;
|
|
78
|
+
character_end: number;
|
|
79
|
+
quote: string;
|
|
80
|
+
}
|
|
81
|
+
/** CSV 来源定位:1 起算数据行号 + 列名。 */
|
|
82
|
+
export interface CsvCellLocator {
|
|
83
|
+
kind: "csv_cell";
|
|
84
|
+
row_start: number;
|
|
85
|
+
row_end: number;
|
|
86
|
+
column: string;
|
|
87
|
+
}
|
|
88
|
+
export type SourceLocator = TextSpanLocator | CsvCellLocator;
|
|
89
|
+
export type FactAuthority = "LOCAL_AUTHORITATIVE" | "UPSTREAM_PROXY" | "READ_ONLY";
|
|
90
|
+
/** 单字段事实(对齐 fact-snapshot.schema.json:八字段全必填)。 */
|
|
91
|
+
export interface FactField {
|
|
92
|
+
field_path: string;
|
|
93
|
+
value: string | number | boolean | null;
|
|
94
|
+
authority: FactAuthority;
|
|
95
|
+
source: string;
|
|
96
|
+
/** 源版本;上游未提供时记 "unknown"(发布时按缺验证阻断,§6.3)。 */
|
|
97
|
+
source_version: string;
|
|
98
|
+
verified_at: string;
|
|
99
|
+
/** 快照内过期时点(verified_at + fresh_for_seconds;无阈值时 = fetched_at + rules 阈值)。 */
|
|
100
|
+
expires_at: string;
|
|
101
|
+
/** 可见性:进入模型工具结果的字段必须 model_public(§15.2)。 */
|
|
102
|
+
visibility: "model_public" | "operator_only";
|
|
103
|
+
}
|
|
104
|
+
export type TaxBasis = "EXCLUSIVE" | "INCLUSIVE";
|
|
105
|
+
export interface PricingLineInput {
|
|
106
|
+
line_id: string;
|
|
107
|
+
/** SKU / 单位为透传字段(供投影与策略使用,不参与算术)。 */
|
|
108
|
+
sku?: string;
|
|
109
|
+
unit?: string;
|
|
110
|
+
quantity: number;
|
|
111
|
+
unit_price_minor: number;
|
|
112
|
+
discount_minor: number;
|
|
113
|
+
tax_basis: TaxBasis;
|
|
114
|
+
tax_rate_bps: number;
|
|
115
|
+
/** 字段证据来源(pricing-input.schema.json 必填;持久化时由服务层填)。 */
|
|
116
|
+
evidence_source_ids?: string[];
|
|
117
|
+
}
|
|
118
|
+
export interface PricingShippingInput {
|
|
119
|
+
amount_minor: number;
|
|
120
|
+
tax_basis: TaxBasis;
|
|
121
|
+
tax_rate_bps: number;
|
|
122
|
+
/** 字段证据来源(pricing-input.schema.json 必填;持久化时由服务层填)。 */
|
|
123
|
+
evidence_source_ids?: string[];
|
|
124
|
+
}
|
|
125
|
+
/** PricingEngine 的纯函数输入(§7.4:不接受模型提交的最终金额)。 */
|
|
126
|
+
export interface PricingInput {
|
|
127
|
+
schema_version: "0.1.0";
|
|
128
|
+
currency: "CNY";
|
|
129
|
+
rounding: "HALF_UP_LINE";
|
|
130
|
+
lines: PricingLineInput[];
|
|
131
|
+
shipping: PricingShippingInput;
|
|
132
|
+
}
|
|
133
|
+
export interface PricingSplit {
|
|
134
|
+
net_minor: number;
|
|
135
|
+
tax_minor: number;
|
|
136
|
+
gross_minor: number;
|
|
137
|
+
}
|
|
138
|
+
export interface PricingResult {
|
|
139
|
+
lines: Array<PricingSplit & {
|
|
140
|
+
line_id: string;
|
|
141
|
+
}>;
|
|
142
|
+
shipping: PricingSplit;
|
|
143
|
+
totals: PricingSplit;
|
|
144
|
+
}
|
|
145
|
+
/** 客户投影(公开字段白名单;绝不包含成本/底价/内部备注)。 */
|
|
146
|
+
export interface PublicQuoteView {
|
|
147
|
+
quote_id: string;
|
|
148
|
+
revision: number;
|
|
149
|
+
case_id: string;
|
|
150
|
+
case_revision: number;
|
|
151
|
+
status: QuoteStatus;
|
|
152
|
+
recipient_ref: string;
|
|
153
|
+
client_ref: string;
|
|
154
|
+
currency: "CNY";
|
|
155
|
+
totals: PricingSplit;
|
|
156
|
+
lines: Array<{
|
|
157
|
+
line_id: string;
|
|
158
|
+
sku: string;
|
|
159
|
+
quantity: number;
|
|
160
|
+
unit: string;
|
|
161
|
+
unit_price_minor: number;
|
|
162
|
+
discount_minor: number;
|
|
163
|
+
tax_basis: TaxBasis;
|
|
164
|
+
tax_rate_bps: number;
|
|
165
|
+
}>;
|
|
166
|
+
shipping: {
|
|
167
|
+
amount_minor: number;
|
|
168
|
+
tax_basis: TaxBasis;
|
|
169
|
+
tax_rate_bps: number;
|
|
170
|
+
};
|
|
171
|
+
delivery_terms: string;
|
|
172
|
+
payment_terms: string;
|
|
173
|
+
valid_until: string;
|
|
174
|
+
/** 数据截至时间 + 产品边界(§14.2 客户文件必含)。 */
|
|
175
|
+
data_as_of: string;
|
|
176
|
+
nonbinding_execution_boundary: string;
|
|
177
|
+
}
|
|
178
|
+
/** 两版报价的字段级差异(§11.1 compare;只读)。 */
|
|
179
|
+
export interface QuoteDiff {
|
|
180
|
+
from: {
|
|
181
|
+
quote_id: string;
|
|
182
|
+
revision: number;
|
|
183
|
+
status: QuoteStatus;
|
|
184
|
+
};
|
|
185
|
+
to: {
|
|
186
|
+
quote_id: string;
|
|
187
|
+
revision: number;
|
|
188
|
+
status: QuoteStatus;
|
|
189
|
+
};
|
|
190
|
+
changed: Array<{
|
|
191
|
+
field: string;
|
|
192
|
+
from: unknown;
|
|
193
|
+
to: unknown;
|
|
194
|
+
}>;
|
|
195
|
+
from_invalid_reason?: string;
|
|
196
|
+
to_invalid_reason?: string;
|
|
197
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
* RFQ 工作台领域类型与序列化权威(询报价工作台设计 v0.1.1 §6/§8/§10.3)。
|
|
18
|
+
*
|
|
19
|
+
* 类型与 contracts/merchant-rfq/0.1.0/ 的八份 JSON Schema 对齐;schema 是
|
|
20
|
+
* 序列化权威,本文件类型经 tests/merchant-rfq 契约一致性测试维护。
|
|
21
|
+
*
|
|
22
|
+
* 内容摘要(rfq-canonical-json-v1):对象键限定 ASCII、按字典序排序、
|
|
23
|
+
* UTF-8、无多余空白、禁止浮点与非有限数值;字符串内容原样保存(不做
|
|
24
|
+
* 隐式 Unicode 归一)。它不是 KNP 的 JCS——禁止把此摘要替换现有 wire
|
|
25
|
+
* digest。对合法值与既有 contentHash 行为一致(契约测试覆盖)。
|
|
26
|
+
*/
|
|
27
|
+
import { createHash } from "node:crypto";
|
|
28
|
+
export class RfqError extends Error {
|
|
29
|
+
code;
|
|
30
|
+
constructor(code, message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = "RfqError";
|
|
33
|
+
this.code = code;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// rfq-canonical-json-v1
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
const ASCII_KEY = /^[\x20-\x7E]+$/;
|
|
40
|
+
/**
|
|
41
|
+
* 规范化序列化(v0.1.1 §10.3)。数组保序;对象键 ASCII 且字典序排序;
|
|
42
|
+
* number 仅接受安全整数(浮点/非有限值拒绝——金额与数量绝不以浮点进入
|
|
43
|
+
* 摘要);undefined 键剔除(与既有 stableStringify 一致,重试幂等依赖它)。
|
|
44
|
+
*/
|
|
45
|
+
export function canonicalJson(value) {
|
|
46
|
+
if (Array.isArray(value))
|
|
47
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
48
|
+
if (value !== null && typeof value === "object") {
|
|
49
|
+
const entries = Object.entries(value)
|
|
50
|
+
.filter(([, v]) => v !== undefined)
|
|
51
|
+
.map(([k, v]) => {
|
|
52
|
+
if (!ASCII_KEY.test(k)) {
|
|
53
|
+
throw new RfqError("validation", `rfq-canonical-json-v1:对象键必须为 ASCII(${k.slice(0, 8)}…)`);
|
|
54
|
+
}
|
|
55
|
+
return [k, v];
|
|
56
|
+
})
|
|
57
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
58
|
+
.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`);
|
|
59
|
+
return `{${entries.join(",")}}`;
|
|
60
|
+
}
|
|
61
|
+
if (typeof value === "number") {
|
|
62
|
+
if (!Number.isSafeInteger(value)) {
|
|
63
|
+
throw new RfqError("validation", "rfq-canonical-json-v1:禁止浮点与非有限数值");
|
|
64
|
+
}
|
|
65
|
+
return JSON.stringify(value);
|
|
66
|
+
}
|
|
67
|
+
if (typeof value === "bigint") {
|
|
68
|
+
throw new RfqError("validation", "rfq-canonical-json-v1:禁止 bigint(先转安全整数)");
|
|
69
|
+
}
|
|
70
|
+
return JSON.stringify(value) ?? "null";
|
|
71
|
+
}
|
|
72
|
+
/** 规范化 JSON 的 sha256 内容摘要(sha256: 前缀,与既有 contentHash 同风格)。 */
|
|
73
|
+
export function rfqContentDigest(value) {
|
|
74
|
+
return `sha256:${createHash("sha256").update(canonicalJson(value), "utf8").digest("hex")}`;
|
|
75
|
+
}
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// 状态域(v0.1.1 §8.1;四个状态域独立维护,绝不相互推导)
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
export const RFQ_STAGES = [
|
|
80
|
+
"NEW",
|
|
81
|
+
"NEEDS_CLARIFICATION",
|
|
82
|
+
"READY",
|
|
83
|
+
"PRICED",
|
|
84
|
+
"CLOSED",
|
|
85
|
+
"CANCELLED",
|
|
86
|
+
];
|
|
87
|
+
export const QUOTE_STATUSES = [
|
|
88
|
+
"DRAFT",
|
|
89
|
+
"VALIDATED",
|
|
90
|
+
"PENDING_APPROVAL",
|
|
91
|
+
"APPROVED",
|
|
92
|
+
"EXPORTED",
|
|
93
|
+
"REJECTED",
|
|
94
|
+
"SUPERSEDED",
|
|
95
|
+
"EXPIRED",
|
|
96
|
+
];
|
|
97
|
+
export const DELIVERY_STATUSES = [
|
|
98
|
+
"NOT_SENT",
|
|
99
|
+
"REPORTED_SENT",
|
|
100
|
+
"RECEIPT_VERIFIED",
|
|
101
|
+
"DELIVERY_UNKNOWN",
|
|
102
|
+
];
|
|
103
|
+
export const HANDOFF_STATUSES = [
|
|
104
|
+
"PACKET_READY",
|
|
105
|
+
"OWNER_RECORDED",
|
|
106
|
+
"TARGET_VERIFIED",
|
|
107
|
+
"REJECTED",
|
|
108
|
+
"UNKNOWN",
|
|
109
|
+
];
|
|
110
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/merchant-core/rfq/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -17,6 +17,10 @@ import type { A2aNegotiationRow } from "../merchant/workbench-service.js";
|
|
|
17
17
|
import { MerchantWorkbenchService, type MerchantWorkbenchServiceDeps } from "../merchant/workbench-service.js";
|
|
18
18
|
import type { MerchantOAuthStore } from "../auth/merchant-oauth.js";
|
|
19
19
|
import { MerchantCommandLog } from "./commands.js";
|
|
20
|
+
import type { CommittedDecisionProof, CommittedDecisionVerifier } from "./commands.js";
|
|
21
|
+
import { type CommandExecutor } from "./executor.js";
|
|
22
|
+
import { type ExactMoney } from "../merchant/application/money.js";
|
|
23
|
+
import type { GrantAction, GrantResourceType } from "../merchant/grant-store.js";
|
|
20
24
|
import type { ApplyPolicyResult } from "./policy-runtime.js";
|
|
21
25
|
import type { MerchantPolicy } from "../config/profile.js";
|
|
22
26
|
import type { MerchantOperation, MerchantOperationStore } from "./operations.js";
|
|
@@ -51,6 +55,18 @@ export interface MerchantCoreServiceDeps extends MerchantWorkbenchServiceDeps {
|
|
|
51
55
|
merchantDataDir?: string;
|
|
52
56
|
/** 一次性确认凭证存储(BUG-02;配置后 execute/reject 必须携带有效凭证)。 */
|
|
53
57
|
confirmations?: MerchantOAuthStore;
|
|
58
|
+
/**
|
|
59
|
+
* RFQ 子服务(询报价工作台设计 v0.1.1 §11.1):配置后启用 rfq 工具面、
|
|
60
|
+
* 发布/移交执行器与管理页路由;不配置时对应能力 fail-closed「不可得」。
|
|
61
|
+
*/
|
|
62
|
+
rfq?: {
|
|
63
|
+
service: import("./rfq/service.js").MerchantRfqService;
|
|
64
|
+
/** RFQ 固定执行器(发布/移交;静态合并进注册表)。 */
|
|
65
|
+
executors: import("./executor.js").CommandExecutor[];
|
|
66
|
+
};
|
|
67
|
+
/** Additional Workbench executors fixed at Runtime startup. */
|
|
68
|
+
extraExecutors?: CommandExecutor[];
|
|
69
|
+
requireCommittedProductDecisions?: boolean;
|
|
54
70
|
}
|
|
55
71
|
export declare class MerchantCoreService {
|
|
56
72
|
/** V1 facade(委托转发;facade 语义不变)。 */
|
|
@@ -66,22 +82,38 @@ export declare class MerchantCoreService {
|
|
|
66
82
|
private readonly confirmationStore?;
|
|
67
83
|
private readonly operationsStore?;
|
|
68
84
|
private readonly merchantDataDir?;
|
|
85
|
+
private readonly rfqDeps?;
|
|
86
|
+
private readonly extraExecutors;
|
|
87
|
+
private readonly depsRequireCommittedProductDecisions;
|
|
69
88
|
private readonly now;
|
|
70
89
|
private readonly principalId;
|
|
71
90
|
private readonly approvalsRef;
|
|
72
91
|
private readonly profileRef;
|
|
73
92
|
private readonly modeRef;
|
|
74
93
|
constructor(deps: MerchantCoreServiceDeps);
|
|
94
|
+
/** RFQ 子服务(未配置 → undefined;工具面 fail-closed)。 */
|
|
95
|
+
get rfqService(): import("./rfq/service.js").MerchantRfqService | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* BD-03 管理面策略提交入口(未配置策略运行时 → undefined)。
|
|
98
|
+
* 回执只含版本与摘要——策略数值本身不出现在任何回执(红线 6)。
|
|
99
|
+
*/
|
|
100
|
+
get policyApplier(): ((patch: Record<string, unknown>) => Promise<{
|
|
101
|
+
version: number;
|
|
102
|
+
digest: string;
|
|
103
|
+
}>) | undefined;
|
|
75
104
|
listPublicProducts(): Promise<{
|
|
76
105
|
items: import("../merchant/workbench-service.js").PublicProductView[];
|
|
77
106
|
source: "data_source" | "merchant_client";
|
|
78
107
|
}>;
|
|
79
108
|
getPublicProduct(sku: string, merchantId?: string): Promise<import("../merchant/workbench-service.js").PublicProductView>;
|
|
109
|
+
listExactProducts(): Promise<import("../agent/merchant/types.js").ExactMerchantProduct[]>;
|
|
110
|
+
getExactProduct(sku: string): Promise<import("../agent/merchant/types.js").ExactMerchantProduct>;
|
|
80
111
|
getInventorySnapshot(sku: string): Promise<import("../agent/merchant/types.js").InventorySnapshot>;
|
|
81
112
|
listA2aNegotiations(limit?: unknown): Promise<{
|
|
82
113
|
total: number;
|
|
83
114
|
items: A2aNegotiationRow[];
|
|
84
115
|
}>;
|
|
116
|
+
getA2aNegotiation(negotiationId: string): Promise<A2aNegotiationRow>;
|
|
85
117
|
listActiveConsultations(): Promise<A2aNegotiationRow[]>;
|
|
86
118
|
listHumanReviews(): Promise<import("../merchant/workbench-service.js").HumanReviewRow[]>;
|
|
87
119
|
getAnalytics(period?: string): Promise<import("../agent/merchant/intelligence/types.js").MerchantBusinessSnapshot>;
|
|
@@ -96,18 +128,21 @@ export declare class MerchantCoreService {
|
|
|
96
128
|
* 商家写,白烧人工确认)。 */
|
|
97
129
|
prepareProductCreate(input: {
|
|
98
130
|
product: unknown;
|
|
131
|
+
authorization?: Record<string, unknown>;
|
|
99
132
|
reason?: string;
|
|
100
133
|
}): Promise<import("./commands.js").PreparedCommand>;
|
|
101
134
|
/** prepare:库存调整。 */
|
|
102
135
|
prepareInventoryUpdate(input: {
|
|
103
136
|
sku: string;
|
|
104
137
|
stock: number;
|
|
138
|
+
authorization?: Record<string, unknown>;
|
|
105
139
|
reason?: string;
|
|
106
140
|
}): Promise<import("./commands.js").PreparedCommand>;
|
|
107
|
-
/** prepare:listing 销售状态变更(F08
|
|
141
|
+
/** prepare:listing 销售状态变更(F08 语义;能力探测 listing_pause=false → fail-closed「不可得」,不降级为库存写零)。 */
|
|
108
142
|
prepareListingChange(input: {
|
|
109
143
|
sku: string;
|
|
110
144
|
paused: boolean;
|
|
145
|
+
authorization?: Record<string, unknown>;
|
|
111
146
|
reason?: string;
|
|
112
147
|
}): Promise<import("./commands.js").PreparedCommand>;
|
|
113
148
|
/** prepare:人工处理(F14 两轨;A2A 轨执行面 fail-closed「不可得」留后续)。 */
|
|
@@ -122,12 +157,94 @@ export declare class MerchantCoreService {
|
|
|
122
157
|
patch: Record<string, unknown>;
|
|
123
158
|
reason?: string;
|
|
124
159
|
}): Promise<import("./commands.js").PreparedCommand>;
|
|
160
|
+
prepareBroadcastPublish(input: {
|
|
161
|
+
broadcast: Record<string, unknown>;
|
|
162
|
+
authorization?: Record<string, unknown>;
|
|
163
|
+
workflowId?: string;
|
|
164
|
+
reason?: string;
|
|
165
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
166
|
+
prepareBroadcastRevise(input: {
|
|
167
|
+
broadcastId: string;
|
|
168
|
+
expectedRevision: number;
|
|
169
|
+
broadcast: Record<string, unknown>;
|
|
170
|
+
authorization?: Record<string, unknown>;
|
|
171
|
+
reason?: string;
|
|
172
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
173
|
+
prepareBroadcastWithdraw(input: {
|
|
174
|
+
broadcastId: string;
|
|
175
|
+
expectedRevision: number;
|
|
176
|
+
authorization?: Record<string, unknown>;
|
|
177
|
+
reason?: string;
|
|
178
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
179
|
+
prepareGrantCreate(input: {
|
|
180
|
+
ownerActorId: string;
|
|
181
|
+
subjectId: string;
|
|
182
|
+
action: GrantAction;
|
|
183
|
+
resourceType: GrantResourceType;
|
|
184
|
+
resourceSelector: "merchant" | "all_products" | readonly string[];
|
|
185
|
+
expiresAt: string;
|
|
186
|
+
reason?: string;
|
|
187
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
188
|
+
prepareGrantRevoke(input: {
|
|
189
|
+
ownerActorId: string;
|
|
190
|
+
grantId: string;
|
|
191
|
+
reason?: string;
|
|
192
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
193
|
+
preparePromotionPublish(input: {
|
|
194
|
+
promotionId: string;
|
|
195
|
+
expectedRevision: number;
|
|
196
|
+
workflowId?: string;
|
|
197
|
+
broadcastAuthorization?: Record<string, unknown>;
|
|
198
|
+
reason?: string;
|
|
199
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
200
|
+
preparePromotionWithdraw(input: {
|
|
201
|
+
promotionId: string;
|
|
202
|
+
expectedRevision: number;
|
|
203
|
+
reason?: string;
|
|
204
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
205
|
+
prepareExactProductCreate(input: {
|
|
206
|
+
sku: string;
|
|
207
|
+
title: string;
|
|
208
|
+
money: ExactMoney;
|
|
209
|
+
stock: number;
|
|
210
|
+
expectedAuthorityVersion: number;
|
|
211
|
+
authorization: Record<string, unknown>;
|
|
212
|
+
description?: string;
|
|
213
|
+
category?: string;
|
|
214
|
+
tags?: string[];
|
|
215
|
+
deliveryAttributes?: string[];
|
|
216
|
+
handoffDestination?: string;
|
|
217
|
+
reason?: string;
|
|
218
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
219
|
+
prepareExactProductMoneyUpdate(input: {
|
|
220
|
+
sku: string;
|
|
221
|
+
money: ExactMoney;
|
|
222
|
+
expectedAuthorityVersion: number;
|
|
223
|
+
authorization: Record<string, unknown>;
|
|
224
|
+
reason?: string;
|
|
225
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
226
|
+
prepareServiceResume(input: {
|
|
227
|
+
expectedRevision: number;
|
|
228
|
+
reason?: string;
|
|
229
|
+
}): Promise<import("./commands.js").PreparedCommand>;
|
|
125
230
|
/** 确认通道:批准并执行(确认凭证 + 重校验 + 幂等 + 回读)。单商家单主体
|
|
126
231
|
* 实例的便捷包装——主体恒为本实例 commandPrincipalId;跨主体校验在
|
|
127
232
|
* commands.executeApproved(管理页传入会话主体时真实生效)。 */
|
|
128
233
|
executeApproved(commandId: string, confirmationToken?: string): Promise<import("../agent/merchant/action-candidate.js").ApprovalExecutionResult>;
|
|
129
234
|
/** 确认通道:拒绝候选(同上:单主体便捷包装)。 */
|
|
130
235
|
rejectCandidate(commandId: string, confirmationToken?: string): Promise<import("../agent/merchant/action-candidate.js").WriteApprovalCandidate>;
|
|
236
|
+
executeCommittedDecision(input: Omit<CommittedDecisionProof, "actionDigest">, verifier: CommittedDecisionVerifier): Promise<import("../agent/merchant/action-candidate.js").WriteApprovalCandidate | import("../agent/merchant/action-candidate.js").ApprovalExecutionResult>;
|
|
237
|
+
getCommand(commandId: string): import("../agent/merchant/action-candidate.js").WriteApprovalCandidate | undefined;
|
|
238
|
+
commandExecutionWasClaimed(commandId: string): boolean | undefined;
|
|
239
|
+
queryCommittedDecisionOutcome(input: Omit<CommittedDecisionProof, "actionDigest">): Promise<{
|
|
240
|
+
status: "succeeded";
|
|
241
|
+
} | {
|
|
242
|
+
status: "failed";
|
|
243
|
+
error: string;
|
|
244
|
+
} | {
|
|
245
|
+
status: "unknown";
|
|
246
|
+
error: string;
|
|
247
|
+
}>;
|
|
131
248
|
/**
|
|
132
249
|
* 重启恢复(阶段三推广版):恢复全部已注册写工具的 pending 命令
|
|
133
250
|
* (覆盖 V1 recoverPendingDrafts 语义并推广);未注册工具的死候选标 expired。
|