@harrylabsj/kiwi 0.12.30 → 0.12.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a/node.d.ts +1 -0
- package/dist/a2a/node.js +170 -2
- package/dist/a2a/node.js.map +1 -1
- package/dist/a2a/reception/agent-runtime.d.ts +32 -1
- package/dist/a2a/reception/agent-runtime.js +420 -11
- package/dist/a2a/reception/agent-runtime.js.map +1 -1
- package/dist/a2a/reception/customer-memory-tools.d.ts +73 -0
- package/dist/a2a/reception/customer-memory-tools.js +17 -0
- package/dist/a2a/reception/customer-memory-tools.js.map +1 -0
- package/dist/a2a/reception/engine.d.ts +12 -0
- package/dist/a2a/reception/engine.js +42 -1
- package/dist/a2a/reception/engine.js.map +1 -1
- package/dist/a2a/reception/publish.d.ts +14 -1
- package/dist/a2a/reception/publish.js +62 -1
- package/dist/a2a/reception/publish.js.map +1 -1
- package/dist/a2a/reception/question-spec.d.ts +91 -0
- package/dist/a2a/reception/question-spec.js +260 -0
- package/dist/a2a/reception/question-spec.js.map +1 -0
- package/dist/a2a/reception/reply-outbox.d.ts +6 -0
- package/dist/a2a/reception/reply-outbox.js +44 -0
- package/dist/a2a/reception/reply-outbox.js.map +1 -1
- package/dist/a2a/reception/responder.d.ts +13 -1
- package/dist/a2a/reception/responder.js +26 -3
- package/dist/a2a/reception/responder.js.map +1 -1
- package/dist/a2a/reception/skill-catalog.d.ts +72 -0
- package/dist/a2a/reception/skill-catalog.js +85 -0
- package/dist/a2a/reception/skill-catalog.js.map +1 -0
- package/dist/a2a/reception/skill-contract.d.ts +70 -0
- package/dist/a2a/reception/skill-contract.js +183 -0
- package/dist/a2a/reception/skill-contract.js.map +1 -0
- package/dist/a2a/reception/types.d.ts +12 -0
- package/dist/a2a/server/customer-identity-gateway.d.ts +111 -0
- package/dist/a2a/server/customer-identity-gateway.js +441 -0
- package/dist/a2a/server/customer-identity-gateway.js.map +1 -0
- package/dist/a2a/server/merchant-handler.d.ts +56 -1
- package/dist/a2a/server/merchant-handler.js +659 -44
- package/dist/a2a/server/merchant-handler.js.map +1 -1
- package/dist/a2a/server/pipeline.js +74 -29
- package/dist/a2a/server/pipeline.js.map +1 -1
- package/dist/a2a/server/types.d.ts +2 -0
- package/dist/a2a/unit-alias.d.ts +3 -3
- package/dist/a2a/unit-alias.js +9 -5
- package/dist/a2a/unit-alias.js.map +1 -1
- package/dist/agent/buyer/buyer-tools.js +1 -2
- package/dist/agent/buyer/buyer-tools.js.map +1 -1
- package/dist/agent/buyer/search-loop.js +0 -1
- package/dist/agent/buyer/search-loop.js.map +1 -1
- package/dist/auth/merchant-sessions.d.ts +3 -0
- package/dist/auth/merchant-sessions.js +21 -5
- package/dist/auth/merchant-sessions.js.map +1 -1
- package/dist/buyer-core/a2a-knp.d.ts +4 -2
- package/dist/buyer-core/a2a-knp.js +5 -2
- package/dist/buyer-core/a2a-knp.js.map +1 -1
- package/dist/buyer-core/a2a-negotiator.d.ts +1 -0
- package/dist/buyer-core/a2a-negotiator.js +18 -11
- package/dist/buyer-core/a2a-negotiator.js.map +1 -1
- package/dist/buyer-core/a2a-quote-fetcher.d.ts +25 -0
- package/dist/buyer-core/a2a-quote-fetcher.js +82 -4
- package/dist/buyer-core/a2a-quote-fetcher.js.map +1 -1
- package/dist/buyer-core/a2a-quote-history.d.ts +94 -0
- package/dist/buyer-core/a2a-quote-history.js +149 -0
- package/dist/buyer-core/a2a-quote-history.js.map +1 -0
- package/dist/buyer-core/build-service.d.ts +19 -0
- package/dist/buyer-core/build-service.js +30 -1
- package/dist/buyer-core/build-service.js.map +1 -1
- package/dist/buyer-core/errors.d.ts +1 -1
- package/dist/buyer-core/errors.js +1 -0
- package/dist/buyer-core/errors.js.map +1 -1
- package/dist/buyer-core/merchant-index.js +0 -1
- package/dist/buyer-core/merchant-index.js.map +1 -1
- package/dist/buyer-core/open-inquiry-signer.d.ts +1 -0
- package/dist/buyer-core/open-inquiry-signer.js +5 -2
- package/dist/buyer-core/open-inquiry-signer.js.map +1 -1
- package/dist/buyer-core/protocol-recovery.d.ts +2 -1
- package/dist/buyer-core/protocol-recovery.js +14 -4
- package/dist/buyer-core/protocol-recovery.js.map +1 -1
- package/dist/buyer-core/service.d.ts +58 -5
- package/dist/buyer-core/service.js +279 -53
- package/dist/buyer-core/service.js.map +1 -1
- package/dist/buyer-core/store.d.ts +8 -0
- package/dist/buyer-core/store.js +37 -7
- package/dist/buyer-core/store.js.map +1 -1
- package/dist/cli.js +136 -34
- package/dist/cli.js.map +1 -1
- package/dist/cloud/bootstrap.d.ts +1 -1
- package/dist/cloud/bootstrap.js +162 -35
- package/dist/cloud/bootstrap.js.map +1 -1
- package/dist/cloud/product-import-tabular.js +13 -5
- package/dist/cloud/product-import-tabular.js.map +1 -1
- package/dist/cloud/trade-platforms-client.d.ts +30 -0
- package/dist/cloud/trade-platforms-client.js +34 -1
- package/dist/cloud/trade-platforms-client.js.map +1 -1
- package/dist/commerce/receipt/dispatcher.d.ts +42 -0
- package/dist/commerce/receipt/dispatcher.js +68 -0
- package/dist/commerce/receipt/dispatcher.js.map +1 -0
- package/dist/commerce/receipt/receipts.d.ts +140 -0
- package/dist/commerce/receipt/receipts.js +247 -0
- package/dist/commerce/receipt/receipts.js.map +1 -0
- package/dist/config/profile.d.ts +2 -2
- package/dist/handoff/order-receipts.d.ts +62 -0
- package/dist/handoff/order-receipts.js +71 -0
- package/dist/handoff/order-receipts.js.map +1 -0
- package/dist/handoff/trade-platform-rules.js +5 -2
- package/dist/handoff/trade-platform-rules.js.map +1 -1
- package/dist/handoff/ucp-checkout/cart-channel.d.ts +2 -1
- package/dist/handoff/ucp-checkout/cart-channel.js +1 -0
- package/dist/handoff/ucp-checkout/cart-channel.js.map +1 -1
- package/dist/handoff/ucp-checkout/channel.d.ts +6 -0
- package/dist/handoff/ucp-checkout/channel.js +44 -0
- package/dist/handoff/ucp-checkout/channel.js.map +1 -1
- package/dist/http/cli.js +6 -0
- package/dist/http/cli.js.map +1 -1
- package/dist/http/merchant-management/api.d.ts +11 -1
- package/dist/http/merchant-management/api.js +471 -3
- package/dist/http/merchant-management/api.js.map +1 -1
- package/dist/http/merchant-management/draft-store.js +8 -6
- package/dist/http/merchant-management/draft-store.js.map +1 -1
- package/dist/http/merchant-management/page.js +83 -22
- package/dist/http/merchant-management/page.js.map +1 -1
- package/dist/mcp/cli.js +6 -0
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/merchant-runtime-assembly.d.ts +20 -0
- package/dist/mcp/merchant-runtime-assembly.js +93 -3
- package/dist/mcp/merchant-runtime-assembly.js.map +1 -1
- package/dist/mcp/merchant-server.d.ts +5 -0
- package/dist/mcp/merchant-server.js +12 -0
- package/dist/mcp/merchant-server.js.map +1 -1
- package/dist/mcp/tools.js +12 -3
- package/dist/mcp/tools.js.map +1 -1
- package/dist/merchant/application/actor.d.ts +1 -1
- package/dist/merchant/application/actor.js +15 -0
- package/dist/merchant/application/actor.js.map +1 -1
- package/dist/merchant/workbench-server.d.ts +38 -0
- package/dist/merchant/workbench-server.js +428 -0
- package/dist/merchant/workbench-server.js.map +1 -0
- package/dist/merchant-core/budget/background-budget.d.ts +132 -0
- package/dist/merchant-core/budget/background-budget.js +308 -0
- package/dist/merchant-core/budget/background-budget.js.map +1 -0
- package/dist/merchant-core/context-governance/actor-context.d.ts +56 -0
- package/dist/merchant-core/context-governance/actor-context.js +76 -0
- package/dist/merchant-core/context-governance/actor-context.js.map +1 -0
- package/dist/merchant-core/context-governance/authority.d.ts +39 -0
- package/dist/merchant-core/context-governance/authority.js +28 -0
- package/dist/merchant-core/context-governance/authority.js.map +1 -0
- package/dist/merchant-core/context-governance/context-guard.d.ts +104 -0
- package/dist/merchant-core/context-governance/context-guard.js +194 -0
- package/dist/merchant-core/context-governance/context-guard.js.map +1 -0
- package/dist/merchant-core/context-governance/data-use-grant.d.ts +91 -0
- package/dist/merchant-core/context-governance/data-use-grant.js +211 -0
- package/dist/merchant-core/context-governance/data-use-grant.js.map +1 -0
- package/dist/merchant-core/context-governance/feature-flags.d.ts +32 -0
- package/dist/merchant-core/context-governance/feature-flags.js +83 -0
- package/dist/merchant-core/context-governance/feature-flags.js.map +1 -0
- package/dist/merchant-core/context-governance/pilot-readiness.d.ts +39 -0
- package/dist/merchant-core/context-governance/pilot-readiness.js +141 -0
- package/dist/merchant-core/context-governance/pilot-readiness.js.map +1 -0
- package/dist/merchant-core/context-governance/source-governance.d.ts +157 -0
- package/dist/merchant-core/context-governance/source-governance.js +492 -0
- package/dist/merchant-core/context-governance/source-governance.js.map +1 -0
- package/dist/merchant-core/context-governance/types.d.ts +62 -0
- package/dist/merchant-core/context-governance/types.js +92 -0
- package/dist/merchant-core/context-governance/types.js.map +1 -0
- package/dist/merchant-core/customer-delivery/binding.d.ts +55 -0
- package/dist/merchant-core/customer-delivery/binding.js +121 -0
- package/dist/merchant-core/customer-delivery/binding.js.map +1 -0
- package/dist/merchant-core/customer-delivery/channel.d.ts +75 -0
- package/dist/merchant-core/customer-delivery/channel.js +157 -0
- package/dist/merchant-core/customer-delivery/channel.js.map +1 -0
- package/dist/merchant-core/customer-delivery/consent-repository.d.ts +50 -0
- package/dist/merchant-core/customer-delivery/consent-repository.js +160 -0
- package/dist/merchant-core/customer-delivery/consent-repository.js.map +1 -0
- package/dist/merchant-core/customer-delivery/dispatcher-loop.d.ts +68 -0
- package/dist/merchant-core/customer-delivery/dispatcher-loop.js +132 -0
- package/dist/merchant-core/customer-delivery/dispatcher-loop.js.map +1 -0
- package/dist/merchant-core/customer-delivery/dispatcher.d.ts +118 -0
- package/dist/merchant-core/customer-delivery/dispatcher.js +166 -0
- package/dist/merchant-core/customer-delivery/dispatcher.js.map +1 -0
- package/dist/merchant-core/customer-delivery/email-adapter.d.ts +31 -0
- package/dist/merchant-core/customer-delivery/email-adapter.js +90 -0
- package/dist/merchant-core/customer-delivery/email-adapter.js.map +1 -0
- package/dist/merchant-core/customer-delivery/gate.d.ts +37 -0
- package/dist/merchant-core/customer-delivery/gate.js +196 -0
- package/dist/merchant-core/customer-delivery/gate.js.map +1 -0
- package/dist/merchant-core/customer-delivery/reconciliation.d.ts +13 -0
- package/dist/merchant-core/customer-delivery/reconciliation.js +70 -0
- package/dist/merchant-core/customer-delivery/reconciliation.js.map +1 -0
- package/dist/merchant-core/customer-delivery/repository.d.ts +55 -0
- package/dist/merchant-core/customer-delivery/repository.js +235 -0
- package/dist/merchant-core/customer-delivery/repository.js.map +1 -0
- package/dist/merchant-core/customer-delivery/smtp-adapter.d.ts +30 -0
- package/dist/merchant-core/customer-delivery/smtp-adapter.js +183 -0
- package/dist/merchant-core/customer-delivery/smtp-adapter.js.map +1 -0
- package/dist/merchant-core/customer-delivery/stream-gate.d.ts +45 -0
- package/dist/merchant-core/customer-delivery/stream-gate.js +123 -0
- package/dist/merchant-core/customer-delivery/stream-gate.js.map +1 -0
- package/dist/merchant-core/customer-delivery/types.d.ts +103 -0
- package/dist/merchant-core/customer-delivery/types.js +32 -0
- package/dist/merchant-core/customer-delivery/types.js.map +1 -0
- package/dist/merchant-core/customer-delivery/weixin-adapter.d.ts +35 -0
- package/dist/merchant-core/customer-delivery/weixin-adapter.js +56 -0
- package/dist/merchant-core/customer-delivery/weixin-adapter.js.map +1 -0
- package/dist/merchant-core/customer-memory/auto-identity.d.ts +43 -0
- package/dist/merchant-core/customer-memory/auto-identity.js +163 -0
- package/dist/merchant-core/customer-memory/auto-identity.js.map +1 -0
- package/dist/merchant-core/customer-memory/grants.d.ts +72 -0
- package/dist/merchant-core/customer-memory/grants.js +224 -0
- package/dist/merchant-core/customer-memory/grants.js.map +1 -0
- package/dist/merchant-core/customer-memory/history.d.ts +51 -0
- package/dist/merchant-core/customer-memory/history.js +252 -0
- package/dist/merchant-core/customer-memory/history.js.map +1 -0
- package/dist/merchant-core/customer-memory/identity.d.ts +66 -0
- package/dist/merchant-core/customer-memory/identity.js +249 -0
- package/dist/merchant-core/customer-memory/identity.js.map +1 -0
- package/dist/merchant-core/customer-memory/maintenance.d.ts +51 -0
- package/dist/merchant-core/customer-memory/maintenance.js +67 -0
- package/dist/merchant-core/customer-memory/maintenance.js.map +1 -0
- package/dist/merchant-core/customer-memory/memory.d.ts +119 -0
- package/dist/merchant-core/customer-memory/memory.js +502 -0
- package/dist/merchant-core/customer-memory/memory.js.map +1 -0
- package/dist/merchant-core/customer-memory/private-transport.d.ts +10 -0
- package/dist/merchant-core/customer-memory/private-transport.js +108 -0
- package/dist/merchant-core/customer-memory/private-transport.js.map +1 -0
- package/dist/merchant-core/customer-memory/quote-history.d.ts +160 -0
- package/dist/merchant-core/customer-memory/quote-history.js +392 -0
- package/dist/merchant-core/customer-memory/quote-history.js.map +1 -0
- package/dist/merchant-core/customer-memory/reception-provider.d.ts +69 -0
- package/dist/merchant-core/customer-memory/reception-provider.js +250 -0
- package/dist/merchant-core/customer-memory/reception-provider.js.map +1 -0
- package/dist/merchant-core/customer-memory/reception-writer.d.ts +19 -0
- package/dist/merchant-core/customer-memory/reception-writer.js +32 -0
- package/dist/merchant-core/customer-memory/reception-writer.js.map +1 -0
- package/dist/merchant-core/customer-memory/types.d.ts +111 -0
- package/dist/merchant-core/customer-memory/types.js +58 -0
- package/dist/merchant-core/customer-memory/types.js.map +1 -0
- package/dist/merchant-core/followup/repository.d.ts +2 -1
- package/dist/merchant-core/followup/repository.js +29 -23
- package/dist/merchant-core/followup/repository.js.map +1 -1
- package/dist/merchant-core/learning/evaluation-fixtures.d.ts +38 -0
- package/dist/merchant-core/learning/evaluation-fixtures.js +83 -0
- package/dist/merchant-core/learning/evaluation-fixtures.js.map +1 -0
- package/dist/merchant-core/learning/evaluation-suite-v1.d.ts +56 -0
- package/dist/merchant-core/learning/evaluation-suite-v1.js +129 -0
- package/dist/merchant-core/learning/evaluation-suite-v1.js.map +1 -0
- package/dist/merchant-core/learning/evaluation.d.ts +84 -0
- package/dist/merchant-core/learning/evaluation.js +581 -0
- package/dist/merchant-core/learning/evaluation.js.map +1 -0
- package/dist/merchant-core/learning/initial-skills.d.ts +36 -0
- package/dist/merchant-core/learning/initial-skills.js +67 -0
- package/dist/merchant-core/learning/initial-skills.js.map +1 -0
- package/dist/merchant-core/learning/precheck.d.ts +33 -0
- package/dist/merchant-core/learning/precheck.js +56 -0
- package/dist/merchant-core/learning/precheck.js.map +1 -0
- package/dist/merchant-core/learning/real-evaluation-runner.d.ts +52 -0
- package/dist/merchant-core/learning/real-evaluation-runner.js +167 -0
- package/dist/merchant-core/learning/real-evaluation-runner.js.map +1 -0
- package/dist/merchant-core/learning/reception-skill-catalog.d.ts +39 -0
- package/dist/merchant-core/learning/reception-skill-catalog.js +145 -0
- package/dist/merchant-core/learning/reception-skill-catalog.js.map +1 -0
- package/dist/merchant-core/learning/recovery-gateway.d.ts +27 -0
- package/dist/merchant-core/learning/recovery-gateway.js +106 -0
- package/dist/merchant-core/learning/recovery-gateway.js.map +1 -0
- package/dist/merchant-core/learning/repository.d.ts +130 -0
- package/dist/merchant-core/learning/repository.js +588 -0
- package/dist/merchant-core/learning/repository.js.map +1 -0
- package/dist/merchant-core/learning/service.d.ts +262 -0
- package/dist/merchant-core/learning/service.js +1498 -0
- package/dist/merchant-core/learning/service.js.map +1 -0
- package/dist/merchant-core/learning/test-dispatch-gateway.d.ts +43 -0
- package/dist/merchant-core/learning/test-dispatch-gateway.js +145 -0
- package/dist/merchant-core/learning/test-dispatch-gateway.js.map +1 -0
- package/dist/merchant-core/learning/types.d.ts +217 -0
- package/dist/merchant-core/learning/types.js +52 -0
- package/dist/merchant-core/learning/types.js.map +1 -0
- package/dist/merchant-core/migrations/ledgers.d.ts +40 -0
- package/dist/merchant-core/migrations/ledgers.js +824 -0
- package/dist/merchant-core/migrations/ledgers.js.map +1 -0
- package/dist/merchant-core/migrations/runner.d.ts +55 -0
- package/dist/merchant-core/migrations/runner.js +114 -0
- package/dist/merchant-core/migrations/runner.js.map +1 -0
- package/dist/merchant-core/operations-jobs/advice-runner.d.ts +63 -0
- package/dist/merchant-core/operations-jobs/advice-runner.js +199 -0
- package/dist/merchant-core/operations-jobs/advice-runner.js.map +1 -0
- package/dist/merchant-core/operations-jobs/pilot-evidence.d.ts +64 -0
- package/dist/merchant-core/operations-jobs/pilot-evidence.js +109 -0
- package/dist/merchant-core/operations-jobs/pilot-evidence.js.map +1 -0
- package/dist/merchant-core/operations-jobs/pilot-metrics.d.ts +70 -0
- package/dist/merchant-core/operations-jobs/pilot-metrics.js +98 -0
- package/dist/merchant-core/operations-jobs/pilot-metrics.js.map +1 -0
- package/dist/merchant-core/operations-jobs/projection.d.ts +41 -0
- package/dist/merchant-core/operations-jobs/projection.js +158 -0
- package/dist/merchant-core/operations-jobs/projection.js.map +1 -0
- package/dist/merchant-core/operations-jobs/scheduler.d.ts +68 -0
- package/dist/merchant-core/operations-jobs/scheduler.js +233 -0
- package/dist/merchant-core/operations-jobs/scheduler.js.map +1 -0
- package/dist/merchant-core/operations-jobs/service.d.ts +260 -0
- package/dist/merchant-core/operations-jobs/service.js +922 -0
- package/dist/merchant-core/operations-jobs/service.js.map +1 -0
- package/dist/merchant-core/ops/facade.d.ts +10 -0
- package/dist/merchant-core/ops/facade.js +52 -0
- package/dist/merchant-core/ops/facade.js.map +1 -1
- package/dist/merchant-core/ops/schema.d.ts +1 -1
- package/dist/merchant-core/ops/schema.js +119 -2
- package/dist/merchant-core/ops/schema.js.map +1 -1
- package/dist/merchant-core/ops/surface.d.ts +37 -0
- package/dist/merchant-core/ops/surface.js +240 -0
- package/dist/merchant-core/ops/surface.js.map +1 -1
- package/dist/merchant-core/ownership/instance-ownership.d.ts +122 -0
- package/dist/merchant-core/ownership/instance-ownership.js +236 -0
- package/dist/merchant-core/ownership/instance-ownership.js.map +1 -0
- package/dist/merchant-core/ownership/runtime.d.ts +175 -0
- package/dist/merchant-core/ownership/runtime.js +422 -0
- package/dist/merchant-core/ownership/runtime.js.map +1 -0
- package/dist/merchant-core/storage/transaction.d.ts +102 -7
- package/dist/merchant-core/storage/transaction.js +274 -3
- package/dist/merchant-core/storage/transaction.js.map +1 -1
- package/dist/merchant-credential-rotation.d.ts +4 -1
- package/dist/merchant-credential-rotation.js +12 -8
- package/dist/merchant-credential-rotation.js.map +1 -1
- package/dist/merchant-gateway/catalog-tools.js +4 -2
- package/dist/merchant-gateway/catalog-tools.js.map +1 -1
- package/dist/merchant-runtime/manager.d.ts +2 -0
- package/dist/merchant-runtime/manager.js +5 -0
- package/dist/merchant-runtime/manager.js.map +1 -1
- package/dist/product-buyer.d.ts +1 -0
- package/dist/product-buyer.js +0 -1
- package/dist/product-buyer.js.map +1 -1
- package/dist/product-cli.js +11 -1
- package/dist/product-cli.js.map +1 -1
- package/package.json +5 -3
- package/skills/kiwi-buyer/SKILL.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -66,8 +66,9 @@ import { runHttpServe } from "./http/cli.js";
|
|
|
66
66
|
import { runGatewayServe } from "./merchant-gateway/cli.js";
|
|
67
67
|
import { DEFAULT_MERCHANT_MCP_HOST, DEFAULT_MERCHANT_MCP_PATH, DEFAULT_MERCHANT_MCP_PORT, startMerchantMcpServer, } from "./mcp/merchant-server.js";
|
|
68
68
|
import { resolveMerchantMcpDirs } from "./mcp/merchant-dirs.js";
|
|
69
|
+
import { DEFAULT_MERCHANT_WORKBENCH_PORT, startStandaloneMerchantWorkbench, } from "./merchant/workbench-server.js";
|
|
69
70
|
import { MerchantPolicyRuntime } from "./merchant-core/policy-runtime.js";
|
|
70
|
-
import { writeAdminCredentials } from "./auth/merchant-sessions.js";
|
|
71
|
+
import { MerchantAdminSessions, writeAdminCredentials } from "./auth/merchant-sessions.js";
|
|
71
72
|
import { createPairingCode, revokePairedCredential } from "./auth/merchant-pairing.js";
|
|
72
73
|
import { assembleMerchantRuntime, } from "./mcp/merchant-runtime-assembly.js";
|
|
73
74
|
import { MerchantRuntimeManager } from "./merchant-runtime/manager.js";
|
|
@@ -1241,7 +1242,6 @@ async function cmdBuyerSearch(args) {
|
|
|
1241
1242
|
catalogUrl: catalog,
|
|
1242
1243
|
...(limit !== undefined ? { limit } : {}),
|
|
1243
1244
|
...(args.category !== undefined ? { category: args.category } : {}),
|
|
1244
|
-
...(args.region !== undefined ? { region: args.region } : {}),
|
|
1245
1245
|
...(args.listingType === "product" || args.listingType === "capability"
|
|
1246
1246
|
? { listingType: args.listingType }
|
|
1247
1247
|
: {}),
|
|
@@ -1437,6 +1437,10 @@ async function routeMerchant(sub, args) {
|
|
|
1437
1437
|
return await cmdAgentServe(args);
|
|
1438
1438
|
if (sub === "mcp")
|
|
1439
1439
|
return await cmdMerchantMcp(args);
|
|
1440
|
+
if (sub === "admin-passwd")
|
|
1441
|
+
return await cmdMerchantAdminPasswd(args);
|
|
1442
|
+
if (sub === "workbench")
|
|
1443
|
+
return await cmdMerchantWorkbench(args);
|
|
1440
1444
|
if (sub === "runtime")
|
|
1441
1445
|
return await cmdMerchantRuntime(args);
|
|
1442
1446
|
if (sub === "connect")
|
|
@@ -1773,7 +1777,7 @@ function merchantCredentialRotationOptions(profile, dirs, manager) {
|
|
|
1773
1777
|
},
|
|
1774
1778
|
stopServices: async (services) => {
|
|
1775
1779
|
for (const name of [...services].reverse())
|
|
1776
|
-
await manager.
|
|
1780
|
+
await manager.stopForCredentialRotation(name);
|
|
1777
1781
|
const deadline = Date.now() + 5_000;
|
|
1778
1782
|
while (Date.now() < deadline && manager.status().some((entry) => services.includes(entry.name) && entry.running)) {
|
|
1779
1783
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
@@ -2076,6 +2080,76 @@ async function cmdMerchantRuntime(args) {
|
|
|
2076
2080
|
await new Promise(() => { });
|
|
2077
2081
|
return EXIT.OK;
|
|
2078
2082
|
}
|
|
2083
|
+
/**
|
|
2084
|
+
* 读取管理员口令:优先环境变量(脚本/CI),交互终端则静默输入两次确认。
|
|
2085
|
+
* 口令绝不进入 argv;错误信息不回显口令。
|
|
2086
|
+
*/
|
|
2087
|
+
async function readNewAdminPassword() {
|
|
2088
|
+
const fromEnv = (process.env.KIWI_MERCHANT_ADMIN_PASSWORD ?? "").trim();
|
|
2089
|
+
if (fromEnv !== "")
|
|
2090
|
+
return fromEnv;
|
|
2091
|
+
if (!process.stdin.isTTY) {
|
|
2092
|
+
process.stderr.write("非交互环境请通过环境变量 KIWI_MERCHANT_ADMIN_PASSWORD 提供新口令(至少 8 位)\n");
|
|
2093
|
+
return undefined;
|
|
2094
|
+
}
|
|
2095
|
+
const first = await promptSecret("设置管理员口令(至少 8 位): ");
|
|
2096
|
+
if (first.length < 8) {
|
|
2097
|
+
process.stderr.write("管理员口令至少 8 位\n");
|
|
2098
|
+
return undefined;
|
|
2099
|
+
}
|
|
2100
|
+
const second = await promptSecret("再次输入确认: ");
|
|
2101
|
+
if (first !== second) {
|
|
2102
|
+
process.stderr.write("两次输入不一致\n");
|
|
2103
|
+
return undefined;
|
|
2104
|
+
}
|
|
2105
|
+
return first;
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* `kiwi merchant admin-passwd`:初始化/重置本实例管理员口令。
|
|
2109
|
+
* 交互终端直接运行即可;脚本可用 KIWI_MERCHANT_ADMIN_PASSWORD。
|
|
2110
|
+
* 已存在凭据时必须显式 `--force`。
|
|
2111
|
+
*/
|
|
2112
|
+
async function cmdMerchantAdminPasswd(args) {
|
|
2113
|
+
const profile = requireProfileOrDefault(args);
|
|
2114
|
+
if (profile.role !== "merchant") {
|
|
2115
|
+
process.stderr.write("kiwi merchant admin-passwd 需要 merchant profile\n");
|
|
2116
|
+
return EXIT.CONFIG;
|
|
2117
|
+
}
|
|
2118
|
+
const password = await readNewAdminPassword();
|
|
2119
|
+
if (password === undefined)
|
|
2120
|
+
return EXIT.CONFIG;
|
|
2121
|
+
const dirs = resolveMerchantMcpDirs({
|
|
2122
|
+
...(configuredDataDir(args, profile) !== undefined
|
|
2123
|
+
? { dataDir: configuredDataDir(args, profile) }
|
|
2124
|
+
: {}),
|
|
2125
|
+
agentId: profile.agent_id,
|
|
2126
|
+
});
|
|
2127
|
+
try {
|
|
2128
|
+
writeAdminCredentials(dirs.merchantDataDir, {
|
|
2129
|
+
principalId: profile.agent_id,
|
|
2130
|
+
merchantId: profile.owner_id,
|
|
2131
|
+
password,
|
|
2132
|
+
force: args.force,
|
|
2133
|
+
});
|
|
2134
|
+
const sessionPath = path.join(dirs.merchantDataDir, "oauth.sqlite");
|
|
2135
|
+
if (args.force && existsSync(sessionPath)) {
|
|
2136
|
+
const sessionDb = new DatabaseSync(sessionPath);
|
|
2137
|
+
try {
|
|
2138
|
+
sessionDb.exec("PRAGMA busy_timeout = 5000");
|
|
2139
|
+
new MerchantAdminSessions({ db: sessionDb }).revokeMerchantSessions(profile.owner_id);
|
|
2140
|
+
}
|
|
2141
|
+
finally {
|
|
2142
|
+
sessionDb.close();
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
catch (err) {
|
|
2147
|
+
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
2148
|
+
return EXIT.CONFIG;
|
|
2149
|
+
}
|
|
2150
|
+
process.stdout.write(`${args.force ? "管理员口令已重置" : "管理员口令已设置"}(哈希落盘 admin-credentials.json,0600)\n`);
|
|
2151
|
+
return EXIT.OK;
|
|
2152
|
+
}
|
|
2079
2153
|
/**
|
|
2080
2154
|
* `kiwi merchant mcp serve`:Merchant Workbench 标准远程 MCP server
|
|
2081
2155
|
* (WorkBuddy Buddy 应用开发计划 阶段二;官方 @modelcontextprotocol/sdk
|
|
@@ -2092,38 +2166,10 @@ async function cmdMerchantRuntime(args) {
|
|
|
2092
2166
|
* kiwi merchant mcp serve [--profile <file>] [--host <host>] [--port N] [--data-dir <dir>]
|
|
2093
2167
|
*/
|
|
2094
2168
|
async function cmdMerchantMcp(args) {
|
|
2095
|
-
// `kiwi merchant mcp admin-passwd
|
|
2096
|
-
//
|
|
2097
|
-
// (KIWI_MERCHANT_ADMIN_PASSWORD),绝不出现在命令行/日志;落盘为 scrypt 哈希。
|
|
2169
|
+
// `kiwi merchant mcp admin-passwd`:兼容入口,委派到
|
|
2170
|
+
// `kiwi merchant admin-passwd`(交互提示/环境变量,落盘 scrypt 哈希)。
|
|
2098
2171
|
if (args.command[2] === "admin-passwd") {
|
|
2099
|
-
|
|
2100
|
-
if (profile.role !== "merchant") {
|
|
2101
|
-
process.stderr.write("kiwi merchant mcp admin-passwd 需要 merchant profile\n");
|
|
2102
|
-
return EXIT.CONFIG;
|
|
2103
|
-
}
|
|
2104
|
-
const password = (process.env.KIWI_MERCHANT_ADMIN_PASSWORD ?? "").trim();
|
|
2105
|
-
if (password === "") {
|
|
2106
|
-
process.stderr.write("请通过环境变量 KIWI_MERCHANT_ADMIN_PASSWORD 提供新口令(至少 8 位;不要写在命令行)\n");
|
|
2107
|
-
return EXIT.CONFIG;
|
|
2108
|
-
}
|
|
2109
|
-
const dirs = resolveMerchantMcpDirs({
|
|
2110
|
-
...(configuredDataDir(args, profile) !== undefined ? { dataDir: configuredDataDir(args, profile) } : {}),
|
|
2111
|
-
agentId: profile.agent_id,
|
|
2112
|
-
});
|
|
2113
|
-
try {
|
|
2114
|
-
writeAdminCredentials(dirs.merchantDataDir, {
|
|
2115
|
-
principalId: profile.agent_id,
|
|
2116
|
-
merchantId: profile.owner_id,
|
|
2117
|
-
password,
|
|
2118
|
-
force: args.force,
|
|
2119
|
-
});
|
|
2120
|
-
}
|
|
2121
|
-
catch (err) {
|
|
2122
|
-
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
2123
|
-
return EXIT.CONFIG;
|
|
2124
|
-
}
|
|
2125
|
-
process.stdout.write("管理员口令已设置(哈希落盘 admin-credentials.json,0600)\n");
|
|
2126
|
-
return EXIT.OK;
|
|
2172
|
+
return await cmdMerchantAdminPasswd(args);
|
|
2127
2173
|
}
|
|
2128
2174
|
// `kiwi merchant mcp pair`:生成一次性配对码(§8.4 第二期)。商家把它填进
|
|
2129
2175
|
// 商家连接器网关的绑定页,网关据此兑换内部凭据——不必把长期令牌贴进表单。
|
|
@@ -2241,6 +2287,62 @@ async function cmdMerchantMcp(args) {
|
|
|
2241
2287
|
await new Promise(() => { });
|
|
2242
2288
|
return EXIT.OK;
|
|
2243
2289
|
}
|
|
2290
|
+
/**
|
|
2291
|
+
* `kiwi merchant workbench serve`:独立部署的商家工作台。
|
|
2292
|
+
*
|
|
2293
|
+
* 复用云端 `/merchant/` 页面与管理 API,但只装配本地能力:
|
|
2294
|
+
* - 本地 owner 登录复用 `/admin/login`(先用 `kiwi merchant mcp admin-passwd` 设口令);
|
|
2295
|
+
* - 商品列表来自 shopping-cli 开放层(只读);
|
|
2296
|
+
* - 报价规则提交到运行中 policy runtime;
|
|
2297
|
+
* - 目录连接/商品导入/经营计划等云端页签未装配,接口明确 503。
|
|
2298
|
+
*
|
|
2299
|
+
* kiwi merchant workbench serve [--profile <file>] [--host <host>] [--port N] [--data-dir <dir>] [--public-url <origin>]
|
|
2300
|
+
*/
|
|
2301
|
+
async function cmdMerchantWorkbench(args) {
|
|
2302
|
+
if (args.command[2] !== "serve") {
|
|
2303
|
+
process.stderr.write("usage: kiwi merchant workbench serve [--profile <file>] [--host <host>] [--port N] [--data-dir <dir>] [--public-url <origin>]\n");
|
|
2304
|
+
return EXIT.CONFIG;
|
|
2305
|
+
}
|
|
2306
|
+
const profile = requireProfileOrDefault(args);
|
|
2307
|
+
if (profile.role !== "merchant") {
|
|
2308
|
+
process.stderr.write("kiwi merchant workbench serve 需要 merchant profile(role: merchant)\n");
|
|
2309
|
+
return EXIT.CONFIG;
|
|
2310
|
+
}
|
|
2311
|
+
loadMerchantCredentials();
|
|
2312
|
+
const dirs = resolveMerchantMcpDirs({
|
|
2313
|
+
...(configuredDataDir(args, profile) !== undefined
|
|
2314
|
+
? { dataDir: configuredDataDir(args, profile) }
|
|
2315
|
+
: {}),
|
|
2316
|
+
agentId: profile.agent_id,
|
|
2317
|
+
});
|
|
2318
|
+
const host = args.catalogHost ?? profile.merchant_mcp?.host ?? "127.0.0.1";
|
|
2319
|
+
const port = args.port ?? DEFAULT_MERCHANT_WORKBENCH_PORT;
|
|
2320
|
+
const publicOrigin = args.publicUrl ?? profile.merchant_mcp?.public_url;
|
|
2321
|
+
let handle;
|
|
2322
|
+
try {
|
|
2323
|
+
handle = await startStandaloneMerchantWorkbench({
|
|
2324
|
+
profile,
|
|
2325
|
+
dataDir: dirs.merchantDataDir,
|
|
2326
|
+
host,
|
|
2327
|
+
port,
|
|
2328
|
+
...(publicOrigin !== undefined ? { publicOrigin } : {}),
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
catch (err) {
|
|
2332
|
+
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
2333
|
+
return EXIT.CONFIG;
|
|
2334
|
+
}
|
|
2335
|
+
console.log(`[merchant workbench] merchant ${profile.agent_id}: ${handle.url}` +
|
|
2336
|
+
"(本地 owner 登录;报价规则在此修改,商品上下架在目录商家后台)");
|
|
2337
|
+
const shutdown = async () => {
|
|
2338
|
+
await handle.close().catch(() => undefined);
|
|
2339
|
+
process.exit(0);
|
|
2340
|
+
};
|
|
2341
|
+
process.on("SIGINT", shutdown);
|
|
2342
|
+
process.on("SIGTERM", shutdown);
|
|
2343
|
+
await new Promise(() => { });
|
|
2344
|
+
return EXIT.OK;
|
|
2345
|
+
}
|
|
2244
2346
|
/**
|
|
2245
2347
|
* `kiwi merchant stats`:商家侧运营统计(本地数据,不上报)——
|
|
2246
2348
|
* 多少个不同的买家联系过我、讨论了哪些 SKU。数据由 merchant A2A 节点
|