@harrylabsj/kiwi 0.9.0 → 0.11.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 +1 -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 +161 -0
- package/contracts/vectors/binding-thumbprint.json +15 -0
- package/dist/a2a/node.d.ts +96 -2
- package/dist/a2a/node.js +164 -91
- 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 +267 -34
- 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 +48 -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 +23 -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.js +1 -1
- package/dist/agent/buyer/buyer-tools.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.js +6 -6
- package/dist/agent/kernel.js.map +1 -1
- 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/types.d.ts +107 -0
- package/dist/agent/merchant/types.js +69 -0
- package/dist/agent/merchant/types.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.js +22 -243
- 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/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 +178 -0
- package/dist/cloud/binding/runtime-challenge.js.map +1 -0
- package/dist/cloud/bootstrap.d.ts +63 -0
- package/dist/cloud/bootstrap.js +937 -0
- package/dist/cloud/bootstrap.js.map +1 -0
- package/dist/cloud/config.d.ts +91 -0
- package/dist/cloud/config.js +229 -0
- package/dist/cloud/config.js.map +1 -0
- package/dist/cloud/http-router.d.ts +61 -0
- package/dist/cloud/http-router.js +127 -0
- package/dist/cloud/http-router.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/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-source.d.ts +97 -0
- package/dist/cloud/product-source.js +226 -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/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 +379 -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 +241 -0
- package/dist/http/merchant-management/api.js +2785 -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 +346 -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 +473 -0
- package/dist/mcp/merchant-runtime-assembly.js.map +1 -0
- package/dist/mcp/merchant-server.d.ts +64 -1
- package/dist/mcp/merchant-server.js +245 -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/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/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/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 +25 -0
- package/dist/merchant-gateway/catalog-publications.js +37 -0
- package/dist/merchant-gateway/catalog-publications.js.map +1 -1
- package/dist/merchant-gateway/catalog-tools.js +42 -4
- package/dist/merchant-gateway/catalog-tools.js.map +1 -1
- package/dist/merchant-gateway/cli.js +6 -3
- package/dist/merchant-gateway/cli.js.map +1 -1
- package/dist/merchant-gateway/entry-server.js +57 -10
- package/dist/merchant-gateway/entry-server.js.map +1 -1
- package/dist/merchant-gateway/instance-registration.d.ts +1 -0
- package/dist/merchant-gateway/instance-registration.js +11 -2
- package/dist/merchant-gateway/instance-registration.js.map +1 -1
- package/dist/merchant-gateway/instance-tools.d.ts +3 -3
- package/dist/merchant-gateway/instance-tools.js +13 -11
- package/dist/merchant-gateway/instance-tools.js.map +1 -1
- package/dist/merchant-gateway/pinned-fetch.d.ts +3 -1
- package/dist/merchant-gateway/pinned-fetch.js +24 -5
- package/dist/merchant-gateway/pinned-fetch.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 +133 -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/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 +12 -4
- package/skills/kiwi-buyer/SKILL.md +33 -2
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
* 服务可取用性状态(BD 设计 §9.1 的 service_state 与 §10.1 的 pause/resume 命令)。
|
|
18
|
+
*
|
|
19
|
+
* 边界(沿用 M4 T012 的实测教训:就绪 ≠ 业务可取用性):这里只保存**操作者
|
|
20
|
+
* 显式声明**的状态(管理 API 命令或 KIWI_CLOUD_SERVICE_STATE 初始值),绝不
|
|
21
|
+
* 从就绪检查推导「停业」;resume 的就绪门由调用方先取就绪结论再传入
|
|
22
|
+
* (BD §10.1:恢复要重新通过就绪门,不是只翻转布尔值)。
|
|
23
|
+
*
|
|
24
|
+
* 撤回(WITHDRAWN)是独立生命周期(BD §16.3):不能经 pause/resume 进入或复活。
|
|
25
|
+
*/
|
|
26
|
+
import { ManagementError } from "../../merchant/application/service.js";
|
|
27
|
+
const SERVICE_STATE_VALUES = new Set([
|
|
28
|
+
"OPERATING",
|
|
29
|
+
"PAUSED",
|
|
30
|
+
"WITHDRAWN",
|
|
31
|
+
"DEGRADED",
|
|
32
|
+
]);
|
|
33
|
+
export class MutableServiceState {
|
|
34
|
+
stateValue;
|
|
35
|
+
revisionValue;
|
|
36
|
+
stateReason;
|
|
37
|
+
/**
|
|
38
|
+
* 最近一次 resume 的操作引用(= committed decision 的 operationId),与状态迁移
|
|
39
|
+
* 在**同一个 UPDATE** 里落库(「查到引用 ⟺ 效果已提交」),供对账适配器反查——
|
|
40
|
+
* 服务恢复是 kiwi 内部写,没有下游服务可问。每行只留最近一次 resume 的引用:
|
|
41
|
+
* 被后续操作覆盖后对账得 unknown(保守升级人工,不会误判)。无持久化时为空。
|
|
42
|
+
*/
|
|
43
|
+
resumeOperationIdValue = null;
|
|
44
|
+
persistence;
|
|
45
|
+
/**
|
|
46
|
+
* 业务时钟(P2-1 刀 2 补注入):落库的 updated_at 是业务时间,必须可钉死——
|
|
47
|
+
* 字面量墙钟是「上午绿下午红」那类缺陷的同族(见 clock-injection-contract.test.ts
|
|
48
|
+
* 头注释)。可选注入、缺省回退墙钟,与全仓构造器注入同例。
|
|
49
|
+
*/
|
|
50
|
+
now;
|
|
51
|
+
constructor(initial = "OPERATING", options = {}) {
|
|
52
|
+
this.stateValue = initial;
|
|
53
|
+
this.revisionValue = 1;
|
|
54
|
+
this.stateReason = initial === "OPERATING" ? "" : "declared by the operator";
|
|
55
|
+
this.now = options.now ?? (() => new Date().toISOString());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 环境声明 → 初始状态(与 M4 行为一致:任何非 OPERATING 的显式声明都关闸)。
|
|
59
|
+
* 无法识别的声明按 DEGRADED 关闸——绝不静默营业。
|
|
60
|
+
*/
|
|
61
|
+
static fromDeclared(raw) {
|
|
62
|
+
const declared = String(raw ?? "")
|
|
63
|
+
.trim()
|
|
64
|
+
.toUpperCase();
|
|
65
|
+
if (declared === "" || declared === "OPERATING")
|
|
66
|
+
return new MutableServiceState("OPERATING");
|
|
67
|
+
if (SERVICE_STATE_VALUES.has(declared)) {
|
|
68
|
+
return new MutableServiceState(declared);
|
|
69
|
+
}
|
|
70
|
+
return new MutableServiceState("DEGRADED");
|
|
71
|
+
}
|
|
72
|
+
attachPersistence(db, merchantId) {
|
|
73
|
+
db.exec(`
|
|
74
|
+
CREATE TABLE IF NOT EXISTS workbench_service_control (
|
|
75
|
+
merchant_id TEXT PRIMARY KEY,
|
|
76
|
+
state TEXT NOT NULL CHECK(state IN ('OPERATING','PAUSED','WITHDRAWN','DEGRADED')),
|
|
77
|
+
revision INTEGER NOT NULL,
|
|
78
|
+
reason TEXT NOT NULL,
|
|
79
|
+
updated_at TEXT NOT NULL,
|
|
80
|
+
resume_operation_id TEXT
|
|
81
|
+
)
|
|
82
|
+
`);
|
|
83
|
+
// 既有库缺列时补上(SQLite 支持 ADD COLUMN,无需重建表;幂等判定读表结构)
|
|
84
|
+
const columns = db.prepare("PRAGMA table_info(workbench_service_control)").all();
|
|
85
|
+
if (!columns.some((column) => column.name === "resume_operation_id")) {
|
|
86
|
+
db.exec("ALTER TABLE workbench_service_control ADD COLUMN resume_operation_id TEXT");
|
|
87
|
+
}
|
|
88
|
+
const row = db
|
|
89
|
+
.prepare("SELECT state, revision, reason, resume_operation_id FROM workbench_service_control WHERE merchant_id=?")
|
|
90
|
+
.get(merchantId);
|
|
91
|
+
this.persistence = { db, merchantId };
|
|
92
|
+
if (row === undefined) {
|
|
93
|
+
this.insertCurrent();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// A persisted safety state wins over an implicit OPERATING startup. An explicit
|
|
97
|
+
// non-operating declaration may only tighten a previously operating row.
|
|
98
|
+
if (row.state === "OPERATING" && this.stateValue !== "OPERATING") {
|
|
99
|
+
this.revisionValue = row.revision + 1;
|
|
100
|
+
this.persistCurrent(row.revision);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.stateValue = row.state;
|
|
104
|
+
this.revisionValue = row.revision;
|
|
105
|
+
this.stateReason = row.reason;
|
|
106
|
+
this.resumeOperationIdValue = row.resume_operation_id;
|
|
107
|
+
}
|
|
108
|
+
get state() {
|
|
109
|
+
return this.stateValue;
|
|
110
|
+
}
|
|
111
|
+
/** 服务状态版本(pause/resume 写命令的乐观并发依据;每次状态迁移递增)。 */
|
|
112
|
+
get serviceRevision() {
|
|
113
|
+
return this.revisionValue;
|
|
114
|
+
}
|
|
115
|
+
get reason() {
|
|
116
|
+
return this.stateReason;
|
|
117
|
+
}
|
|
118
|
+
/** 最近一次 resume 的操作引用(对账用;无持久化或无记录时为 null)。 */
|
|
119
|
+
get lastResumeOperationId() {
|
|
120
|
+
return this.resumeOperationIdValue;
|
|
121
|
+
}
|
|
122
|
+
gateCheck() {
|
|
123
|
+
if (this.stateValue === "OPERATING")
|
|
124
|
+
return { accepting: true };
|
|
125
|
+
return { accepting: false, state: this.stateValue, reason: this.stateReason };
|
|
126
|
+
}
|
|
127
|
+
/** 暂停:拒新询价,既有任务不受影响(T012 语义)。已 PAUSED 时幂等原样返回。 */
|
|
128
|
+
pause(reason) {
|
|
129
|
+
if (this.stateValue === "WITHDRAWN") {
|
|
130
|
+
throw new ManagementError("conflict", "service is withdrawn; pause is not applicable");
|
|
131
|
+
}
|
|
132
|
+
if (this.stateValue === "PAUSED")
|
|
133
|
+
return { service_revision: this.revisionValue };
|
|
134
|
+
const text = String(reason ?? "").trim();
|
|
135
|
+
const previousState = this.stateValue;
|
|
136
|
+
const previousReason = this.stateReason;
|
|
137
|
+
this.stateValue = "PAUSED";
|
|
138
|
+
this.stateReason = text === "" ? "paused by the operator" : `paused by the operator: ${text}`;
|
|
139
|
+
try {
|
|
140
|
+
this.advancePersistedRevision();
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
this.stateValue = previousState;
|
|
144
|
+
this.stateReason = previousReason;
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
return { service_revision: this.revisionValue };
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 恢复:`readinessOk=false` → 503 且状态不变(就绪门,BD §10.1)。
|
|
151
|
+
* 撤回态不可经 resume 复活。
|
|
152
|
+
* `operationId`:committed decision 的操作标识,与状态迁移同一个 UPDATE 落库,
|
|
153
|
+
* 供写后不确定时的对账反查;非决定路径(管理 API 直通)不传、不落引用。
|
|
154
|
+
*/
|
|
155
|
+
resume(readinessOk, failedChecks, operationId) {
|
|
156
|
+
if (this.stateValue === "WITHDRAWN") {
|
|
157
|
+
throw new ManagementError("conflict", "service is withdrawn; resume is not applicable");
|
|
158
|
+
}
|
|
159
|
+
if (!readinessOk) {
|
|
160
|
+
const detail = failedChecks.length > 0 ? ` (${failedChecks.join(",")})` : "";
|
|
161
|
+
throw new ManagementError("unavailable", `readiness gate failed; refusing to resume${detail}`);
|
|
162
|
+
}
|
|
163
|
+
if (this.stateValue === "OPERATING")
|
|
164
|
+
return { service_revision: this.revisionValue };
|
|
165
|
+
const previousState = this.stateValue;
|
|
166
|
+
const previousReason = this.stateReason;
|
|
167
|
+
const previousOperationId = this.resumeOperationIdValue;
|
|
168
|
+
this.stateValue = "OPERATING";
|
|
169
|
+
this.stateReason = "";
|
|
170
|
+
this.resumeOperationIdValue = operationId ?? null;
|
|
171
|
+
try {
|
|
172
|
+
this.advancePersistedRevision();
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
this.stateValue = previousState;
|
|
176
|
+
this.stateReason = previousReason;
|
|
177
|
+
this.resumeOperationIdValue = previousOperationId;
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
return { service_revision: this.revisionValue };
|
|
181
|
+
}
|
|
182
|
+
insertCurrent() {
|
|
183
|
+
const persistence = this.persistence;
|
|
184
|
+
if (persistence === undefined)
|
|
185
|
+
return;
|
|
186
|
+
persistence.db
|
|
187
|
+
.prepare(`INSERT INTO workbench_service_control
|
|
188
|
+
(merchant_id, state, revision, reason, updated_at, resume_operation_id)
|
|
189
|
+
VALUES (?, ?, ?, ?, ?, ?)`)
|
|
190
|
+
.run(persistence.merchantId, this.stateValue, this.revisionValue, this.stateReason, this.now(), this.resumeOperationIdValue);
|
|
191
|
+
}
|
|
192
|
+
advancePersistedRevision() {
|
|
193
|
+
const previous = this.revisionValue;
|
|
194
|
+
this.revisionValue += 1;
|
|
195
|
+
try {
|
|
196
|
+
this.persistCurrent(previous);
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
this.revisionValue = previous;
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
persistCurrent(expectedRevision) {
|
|
204
|
+
const persistence = this.persistence;
|
|
205
|
+
if (persistence === undefined)
|
|
206
|
+
return;
|
|
207
|
+
const changed = persistence.db
|
|
208
|
+
.prepare(`UPDATE workbench_service_control
|
|
209
|
+
SET state=?, revision=?, reason=?, updated_at=?, resume_operation_id=?
|
|
210
|
+
WHERE merchant_id=? AND revision=?`)
|
|
211
|
+
.run(this.stateValue, this.revisionValue, this.stateReason, this.now(), this.resumeOperationIdValue, persistence.merchantId, expectedRevision);
|
|
212
|
+
if (changed.changes !== 1) {
|
|
213
|
+
throw new ManagementError("conflict", "service control revision changed concurrently");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=service-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-state.js","sourceRoot":"","sources":["../../../src/http/merchant-management/service-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAqB,MAA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ebAuthn registration and action confirmation. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
3
|
+
export declare function createTrustedWorkbenchPageHandler(): (req: IncomingMessage, res: ServerResponse) => void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Top-level, no-third-party-script pages for WebAuthn registration and action confirmation. */
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
export function createTrustedWorkbenchPageHandler() {
|
|
4
|
+
return (req, res) => {
|
|
5
|
+
const url = new URL(req.url ?? "/", "http://trusted-page.internal");
|
|
6
|
+
const nonce = randomBytes(18).toString("base64url");
|
|
7
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
8
|
+
res.writeHead(405, { allow: "GET, HEAD", "cache-control": "no-store" });
|
|
9
|
+
res.end();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (url.pathname === "/merchant/trusted/register") {
|
|
13
|
+
writePage(res, nonce, renderRegistrationPage(nonce));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (url.pathname === "/merchant/trusted/confirm") {
|
|
17
|
+
writePage(res, nonce, renderConfirmationPage(nonce, url.searchParams.get("ref") ?? ""));
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
res.writeHead(404, { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" });
|
|
21
|
+
res.end("not found");
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function writePage(res, nonce, html) {
|
|
25
|
+
res.writeHead(200, {
|
|
26
|
+
"content-type": "text/html; charset=utf-8",
|
|
27
|
+
"cache-control": "no-store",
|
|
28
|
+
pragma: "no-cache",
|
|
29
|
+
"content-security-policy": `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; ` +
|
|
30
|
+
"connect-src 'self'; img-src 'none'; object-src 'none'; base-uri 'none'; " +
|
|
31
|
+
"form-action 'self'; frame-ancestors 'none'",
|
|
32
|
+
"x-frame-options": "DENY",
|
|
33
|
+
"referrer-policy": "no-referrer",
|
|
34
|
+
"permissions-policy": "camera=(), microphone=(), geolocation=()",
|
|
35
|
+
});
|
|
36
|
+
res.end(html);
|
|
37
|
+
}
|
|
38
|
+
function shell(nonce, title, body, script) {
|
|
39
|
+
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8">
|
|
40
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(title)}</title>
|
|
41
|
+
<style nonce="${nonce}">body{font:16px system-ui;max-width:760px;margin:40px auto;padding:0 20px;color:#17231c}button,input{font:inherit;padding:10px;margin:6px 0}button{background:#176b42;color:white;border:0;border-radius:8px}pre{white-space:pre-wrap;background:#f2f6f3;padding:16px;border-radius:8px}.warn{color:#8a3b12}</style></head>
|
|
42
|
+
<body>${body}<pre id="status">等待操作</pre><script nonce="${nonce}">'use strict';
|
|
43
|
+
if(window.top!==window.self){document.body.textContent='必须在顶层页面打开';throw new Error('embedded');}
|
|
44
|
+
const status=document.getElementById('status');const show=(v)=>status.textContent=typeof v==='string'?v:JSON.stringify(v,null,2);
|
|
45
|
+
const b64=(s)=>{const p=s.replace(/-/g,'+').replace(/_/g,'/');const raw=atob(p+'='.repeat((4-p.length%4)%4));return Uint8Array.from(raw,c=>c.charCodeAt(0));};
|
|
46
|
+
const enc=(v)=>{const a=new Uint8Array(v);let s='';for(const b of a)s+=String.fromCharCode(b);return btoa(s).replaceAll('+','-').replaceAll('/','_').replace(/=+$/,'');};
|
|
47
|
+
const session=async()=>{const r=await fetch('/merchant/api/session',{credentials:'same-origin'});if(!r.ok)throw new Error('请先在此设备重新登录');return r.json();};
|
|
48
|
+
const post=async(path,value,csrf,extra={})=>{const r=await fetch(path,{method:'POST',credentials:'same-origin',headers:{'content-type':'application/json','x-csrf-token':csrf,...extra},body:JSON.stringify(value)});const j=await r.json();if(!r.ok)throw new Error(j.detail||j.message||'请求失败');return j;};
|
|
49
|
+
${script}</script></body></html>`;
|
|
50
|
+
}
|
|
51
|
+
function renderRegistrationPage(nonce) {
|
|
52
|
+
return shell(nonce, "绑定可信确认设备", `<h1>绑定可信确认设备</h1><p class="warn">只应在商家确认的独立设备/浏览器 profile 打开。管理登录本身不足以授权新增认证器。</p>
|
|
53
|
+
<label>一次性登记码<br><input id="code" autocomplete="one-time-code"></label><br><button id="go">绑定本设备</button>`, `document.getElementById('go').onclick=async()=>{try{const s=await session();const code=document.getElementById('code').value;
|
|
54
|
+
const begun=await post('/merchant/api/v1/webauthn/registrations/options',{},s.csrf_token,{'x-registration-authorization':code});
|
|
55
|
+
const o=begun.options;o.challenge=b64(o.challenge);o.user.id=b64(o.user.id);o.excludeCredentials=(o.excludeCredentials||[]).map(c=>({...c,id:b64(c.id)}));
|
|
56
|
+
const c=await navigator.credentials.create({publicKey:o});if(!c)throw new Error('认证器未返回结果');
|
|
57
|
+
const r={id:c.id,rawId:enc(c.rawId),type:c.type,authenticatorAttachment:c.authenticatorAttachment||undefined,clientExtensionResults:c.getClientExtensionResults(),response:{clientDataJSON:enc(c.response.clientDataJSON),attestationObject:enc(c.response.attestationObject),transports:c.response.getTransports?c.response.getTransports():[]}};
|
|
58
|
+
show(await post('/merchant/api/v1/webauthn/registrations/'+encodeURIComponent(begun.registration_id)+'/verify',r,s.csrf_token,{'x-registration-authorization':code}));}catch(e){show(String(e.message||e));}};`);
|
|
59
|
+
}
|
|
60
|
+
function renderConfirmationPage(nonce, requestRef) {
|
|
61
|
+
return shell(nonce, "可信动作确认", `<h1>可信动作确认</h1><p class="warn">请核对服务器冻结的商家、对象、数量、金额、影响范围和决定。request_ref 不是批准能力。</p>
|
|
62
|
+
<pre id="snapshot">正在读取服务器快照…</pre><button id="go" disabled>使用本设备确认</button>`, `const ref=${JSON.stringify(requestRef)};let projection;const load=async()=>{const s=await session();const r=await fetch('/merchant/api/v1/confirmations/by-ref/'+encodeURIComponent(ref),{credentials:'same-origin'});if(!r.ok)throw new Error('确认请求不存在、已消费或不属于当前主体');projection=await r.json();document.getElementById('snapshot').textContent=JSON.stringify(projection.snapshot,null,2);document.getElementById('go').disabled=false;return s;};
|
|
63
|
+
let sessionData;load().then(s=>sessionData=s).catch(e=>show(String(e.message||e)));
|
|
64
|
+
document.getElementById('go').onclick=async()=>{try{const o=await post('/merchant/api/v1/confirmations/'+encodeURIComponent(projection.confirmation_id)+'/assertion-options',{},sessionData.csrf_token);const p={challenge:b64(o.challenge),rpId:o.rp_id,userVerification:'required',allowCredentials:o.allow_credentials.map(c=>({type:'public-key',id:b64(c.id)}))};const c=await navigator.credentials.get({publicKey:p});if(!c)throw new Error('认证器未返回结果');const a={credential_id:c.id,client_data_json:enc(c.response.clientDataJSON),authenticator_data:enc(c.response.authenticatorData),signature:enc(c.response.signature)};show(await post('/merchant/api/v1/approvals/'+encodeURIComponent(projection.candidate_id)+'/decisions',{confirmation_id:projection.confirmation_id,decision:projection.decision,expected_version:projection.expected_version,assertion:a},sessionData.csrf_token));document.getElementById('go').disabled=true;}catch(e){show(String(e.message||e));}};`);
|
|
65
|
+
}
|
|
66
|
+
function escapeHtml(value) {
|
|
67
|
+
return value
|
|
68
|
+
.replaceAll("&", "&")
|
|
69
|
+
.replaceAll("<", "<")
|
|
70
|
+
.replaceAll(">", ">")
|
|
71
|
+
.replaceAll('"', """);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=trusted-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trusted-page.js","sourceRoot":"","sources":["../../../src/http/merchant-management/trusted-page.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,UAAU,iCAAiC;IAI/C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAClB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,EAAE,8BAA8B,CAAC,CAAC;QACpE,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,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,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,KAAa,EAAE,IAAY,EAAE,MAAc;IACvE,OAAO;4EACmE,UAAU,CAAC,KAAK,CAAC;gBAC7E,KAAK;QACb,IAAI,6CAA6C,KAAK;;;;;;;EAO5D,MAAM,yBAAyB,CAAC;AAClC,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,KAAK,CACV,KAAK,EACL,UAAU,EACV;0GACsG,EACtG;;;;;+MAK2M,CAC5M,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa,EAAE,UAAkB;IAC/D,OAAO,KAAK,CACV,KAAK,EACL,QAAQ,EACR;6EACyE,EACzE,aAAa,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;;67BAEk5B,CAC17B,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workbench v0.1.1 可信确认与审批仲裁薄切片。
|
|
3
|
+
*
|
|
4
|
+
* 这不是“前端说 WebAuthn 成功”的适配器:服务端解析 clientDataJSON 与
|
|
5
|
+
* authenticatorData,校验 challenge、精确 origin、RP ID hash、UP/UV、签名、凭据归属、
|
|
6
|
+
* 撤销状态和 signCount。确认核销、唯一决定、operation 与 outbox 在同一 SQLite
|
|
7
|
+
* BEGIN IMMEDIATE 原子边界提交。
|
|
8
|
+
*
|
|
9
|
+
* 注册仪式的 attestation/身份恢复仍由上层可信登记流程完成;本存储只接受明确标记为
|
|
10
|
+
* 已验证的注册结果,绝不把普通页面提交的公钥当成已验证认证器。
|
|
11
|
+
*/
|
|
12
|
+
import type { DatabaseSync } from "node:sqlite";
|
|
13
|
+
import { generateRegistrationOptions, verifyRegistrationResponse, type RegistrationResponseJSON } from "@simplewebauthn/server";
|
|
14
|
+
export interface WebAuthnAssertionInput {
|
|
15
|
+
credentialId: string;
|
|
16
|
+
clientDataJSON: string;
|
|
17
|
+
authenticatorData: string;
|
|
18
|
+
signature: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ConfirmationRequest {
|
|
21
|
+
confirmationId: string;
|
|
22
|
+
requestRef: string;
|
|
23
|
+
challenge: string;
|
|
24
|
+
expiresAt: string;
|
|
25
|
+
}
|
|
26
|
+
export type DecisionOutcome = {
|
|
27
|
+
kind: "decided";
|
|
28
|
+
decision: "approve" | "reject";
|
|
29
|
+
operationId: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "already_decided";
|
|
32
|
+
decision: "approve" | "reject";
|
|
33
|
+
operationId: string;
|
|
34
|
+
actorId: string;
|
|
35
|
+
};
|
|
36
|
+
export declare class WorkbenchConfirmationError extends Error {
|
|
37
|
+
readonly code: "invalid_registration" | "confirmation_not_found" | "confirmation_expired" | "confirmation_consumed" | "confirmation_binding_mismatch" | "credential_unavailable" | "assertion_invalid";
|
|
38
|
+
constructor(code: WorkbenchConfirmationError["code"], message: string);
|
|
39
|
+
}
|
|
40
|
+
export declare class WorkbenchConfirmationStore {
|
|
41
|
+
private readonly db;
|
|
42
|
+
private readonly now;
|
|
43
|
+
private readonly registrationVerifier;
|
|
44
|
+
constructor(options: {
|
|
45
|
+
db: DatabaseSync;
|
|
46
|
+
now?: () => string;
|
|
47
|
+
registrationVerifier?: typeof verifyRegistrationResponse;
|
|
48
|
+
});
|
|
49
|
+
beginCredentialRegistration(input: {
|
|
50
|
+
merchantId: string;
|
|
51
|
+
actorId: string;
|
|
52
|
+
rpName: string;
|
|
53
|
+
rpId: string;
|
|
54
|
+
origin: string;
|
|
55
|
+
userName: string;
|
|
56
|
+
userDisplayName: string;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
registration_id: string;
|
|
59
|
+
expires_at: string;
|
|
60
|
+
options: Awaited<ReturnType<typeof generateRegistrationOptions>>;
|
|
61
|
+
}>;
|
|
62
|
+
finishCredentialRegistration(input: {
|
|
63
|
+
registrationId: string;
|
|
64
|
+
merchantId: string;
|
|
65
|
+
actorId: string;
|
|
66
|
+
response: RegistrationResponseJSON;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
credential_id: string;
|
|
69
|
+
}>;
|
|
70
|
+
persistVerifiedCredential(input: {
|
|
71
|
+
registrationVerified: true;
|
|
72
|
+
credentialId: string;
|
|
73
|
+
merchantId: string;
|
|
74
|
+
actorId: string;
|
|
75
|
+
publicKeyPem: string;
|
|
76
|
+
rpId: string;
|
|
77
|
+
origin: string;
|
|
78
|
+
signCount?: number;
|
|
79
|
+
}): void;
|
|
80
|
+
revokeCredential(credentialId: string, merchantId: string, actorId: string): boolean;
|
|
81
|
+
hasUsableCredential(merchantId: string, actorId: string): boolean;
|
|
82
|
+
verifyCommittedDecision(input: {
|
|
83
|
+
operationId: string;
|
|
84
|
+
candidateId: string;
|
|
85
|
+
actorId: string;
|
|
86
|
+
decision: "approve" | "reject";
|
|
87
|
+
actionDigest: string;
|
|
88
|
+
}): boolean;
|
|
89
|
+
authorizationSnapshotForOperation(operationId: string): Record<string, unknown> | undefined;
|
|
90
|
+
createRequest(input: {
|
|
91
|
+
merchantId: string;
|
|
92
|
+
actorId: string;
|
|
93
|
+
candidateId: string;
|
|
94
|
+
approvalGeneration: number;
|
|
95
|
+
decision: "approve" | "reject";
|
|
96
|
+
operationId: string;
|
|
97
|
+
actionDigest: string;
|
|
98
|
+
actionSnapshot: Readonly<Record<string, unknown>>;
|
|
99
|
+
expectedVersion: number;
|
|
100
|
+
expiresAt: string;
|
|
101
|
+
}): ConfirmationRequest;
|
|
102
|
+
requestProjection(input: {
|
|
103
|
+
confirmationId: string;
|
|
104
|
+
merchantId: string;
|
|
105
|
+
actorId: string;
|
|
106
|
+
}): {
|
|
107
|
+
confirmation_id: string;
|
|
108
|
+
candidate_id: string;
|
|
109
|
+
decision: "approve" | "reject";
|
|
110
|
+
operation_id: string;
|
|
111
|
+
expected_version: number;
|
|
112
|
+
snapshot: Record<string, unknown>;
|
|
113
|
+
expires_at: string;
|
|
114
|
+
};
|
|
115
|
+
requestProjectionByRef(input: {
|
|
116
|
+
requestRef: string;
|
|
117
|
+
merchantId: string;
|
|
118
|
+
actorId: string;
|
|
119
|
+
}): ReturnType<WorkbenchConfirmationStore["requestProjection"]>;
|
|
120
|
+
assertionOptions(input: {
|
|
121
|
+
confirmationId: string;
|
|
122
|
+
merchantId: string;
|
|
123
|
+
actorId: string;
|
|
124
|
+
}): {
|
|
125
|
+
challenge: string;
|
|
126
|
+
rp_id: string;
|
|
127
|
+
allow_credentials: Array<{
|
|
128
|
+
id: string;
|
|
129
|
+
type: "public-key";
|
|
130
|
+
}>;
|
|
131
|
+
user_verification: "required";
|
|
132
|
+
expires_at: string;
|
|
133
|
+
};
|
|
134
|
+
finalizeDecision(input: {
|
|
135
|
+
confirmationId: string;
|
|
136
|
+
merchantId: string;
|
|
137
|
+
actorId: string;
|
|
138
|
+
candidateId: string;
|
|
139
|
+
approvalGeneration: number;
|
|
140
|
+
decision: "approve" | "reject";
|
|
141
|
+
actionDigest: string;
|
|
142
|
+
expectedVersion: number;
|
|
143
|
+
assertion: WebAuthnAssertionInput;
|
|
144
|
+
}): DecisionOutcome;
|
|
145
|
+
private requireRequest;
|
|
146
|
+
private requireCredential;
|
|
147
|
+
private readDecision;
|
|
148
|
+
}
|