@wowok/agent-mcp 2.7.7 → 2.7.10
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 +2 -2
- package/dist/config/runtime.d.ts +1 -1
- package/dist/config/runtime.js +1 -1
- package/dist/customer/index.d.ts +3 -4
- package/dist/customer/index.js +1 -1
- package/dist/customer/info-puzzle.js +1 -1
- package/dist/customer/order-monitor.d.ts +0 -9
- package/dist/customer/order-monitor.js +1 -1
- package/dist/customer/order-strategy.d.ts +0 -19
- package/dist/customer/order-strategy.js +1 -1
- package/dist/customer/reminder-system.d.ts +0 -5
- package/dist/customer/reminder-system.js +1 -1
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/injection.d.ts +6 -0
- package/dist/evaluation/injection.js +1 -0
- package/dist/evaluation/node-game.js +1 -1
- package/dist/examples/machine-multisig-threshold.json +1 -0
- package/dist/examples/rental-ziroom-machine-create.json +1 -2
- package/dist/examples/rental-ziroom-permission-create.json +1 -2
- package/dist/examples/rental-ziroom-service-create.json +1 -2
- package/dist/experience/experience-reuse.js +1 -1
- package/dist/experience/index.d.ts +2 -1
- package/dist/experience/index.js +1 -1
- package/dist/experience/persistence-config.d.ts +6 -0
- package/dist/experience/persistence-config.js +1 -0
- package/dist/experience/persistence.d.ts +21 -0
- package/dist/experience/persistence.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/experience/user-profile.js +1 -1
- package/dist/extensions/business-modules.d.ts +1 -1
- package/dist/extensions/capability-manifest.d.ts +1 -1
- package/dist/extensions/types.d.ts +1 -1
- package/dist/goal/GoalClassifier.d.ts +17 -0
- package/dist/goal/GoalClassifier.js +1 -0
- package/dist/goal/GoalEngine.d.ts +120 -0
- package/dist/goal/GoalEngine.js +1 -0
- package/dist/goal/GoalStore.d.ts +27 -0
- package/dist/goal/GoalStore.js +1 -0
- package/dist/goal/plan-approval.d.ts +5 -0
- package/dist/goal/plan-approval.js +1 -0
- package/dist/goal/types.d.ts +76 -0
- package/dist/goal/types.js +1 -0
- package/dist/harness/index.d.ts +2 -7
- package/dist/harness/index.js +1 -1
- package/dist/harness/plan.d.ts +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/harness/types.d.ts +1 -36
- package/dist/harness/verify.js +1 -1
- package/dist/index.js +1 -1
- package/dist/intent/enrich.js +1 -1
- package/dist/intent/matcher.js +1 -1
- package/dist/intent/types.d.ts +1 -1
- package/dist/intent/types.js +1 -1
- package/dist/knowledge/account-marks.d.ts +35 -0
- package/dist/knowledge/account-marks.js +1 -0
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +3 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/contract-invariants.d.ts +53 -0
- package/dist/knowledge/contract-invariants.js +1 -0
- package/dist/knowledge/dynamic-pricing.d.ts +0 -2
- package/dist/knowledge/dynamic-pricing.js +1 -1
- package/dist/knowledge/event-semantics.d.ts +20 -0
- package/dist/knowledge/event-semantics.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -1
- package/dist/knowledge/examples-scanner.js +1 -1
- package/dist/knowledge/glossary.js +1 -1
- package/dist/knowledge/goal-completion.d.ts +19 -0
- package/dist/knowledge/goal-completion.js +1 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/immutability.d.ts +11 -0
- package/dist/knowledge/immutability.js +1 -0
- package/dist/knowledge/index.d.ts +13 -6
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/intent-metrics.d.ts +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +37 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -0
- package/dist/knowledge/machine-confirm.js +1 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-topology.d.ts +11 -0
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/market-metrics.d.ts +11 -0
- package/dist/knowledge/market-metrics.js +1 -1
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
- package/dist/knowledge/mcp-schema-audit.d.ts +1 -0
- package/dist/knowledge/mcp-schema-audit.js +1 -1
- package/dist/knowledge/messenger-guard-guidance.d.ts +17 -0
- package/dist/knowledge/messenger-guard-guidance.js +1 -0
- package/dist/knowledge/operation-dictionary.d.ts +18 -0
- package/dist/knowledge/operation-dictionary.js +1 -0
- package/dist/knowledge/passport-confirm.js +1 -1
- package/dist/knowledge/passport-puzzle.js +1 -1
- package/dist/knowledge/passport-translation.js +1 -1
- package/dist/knowledge/proof-risk.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/service-translation.js +1 -1
- package/dist/knowledge/supply-chain.d.ts +24 -0
- package/dist/knowledge/supply-chain.js +1 -0
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/trust-metrics.d.ts +27 -2
- package/dist/knowledge/trust-metrics.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +22 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.d.ts +56 -0
- package/dist/knowledge/workspace-lists.js +1 -0
- package/dist/loop-engineering/context-collect.d.ts +1 -1
- package/dist/monitor/EventRouter.d.ts +10 -0
- package/dist/monitor/EventRouter.js +1 -0
- package/dist/monitor/EventStore.d.ts +98 -0
- package/dist/monitor/EventStore.js +1 -0
- package/dist/monitor/MonitorLoop.d.ts +79 -0
- package/dist/monitor/MonitorLoop.js +1 -0
- package/dist/monitor/ProblemBridge.d.ts +32 -0
- package/dist/monitor/ProblemBridge.js +1 -0
- package/dist/monitor/ScopeResolver.d.ts +59 -0
- package/dist/monitor/ScopeResolver.js +1 -0
- package/dist/monitor/SubscriptionStore.d.ts +13 -0
- package/dist/monitor/SubscriptionStore.js +1 -0
- package/dist/monitor/normalize.d.ts +8 -0
- package/dist/monitor/normalize.js +1 -0
- package/dist/monitor/types.d.ts +89 -0
- package/dist/monitor/types.js +1 -0
- package/dist/participation/radar-core.d.ts +0 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/address-format.d.ts +6 -0
- package/dist/persona/address-format.js +1 -0
- package/dist/persona/analyzer.js +1 -1
- package/dist/persona/distill-goal.d.ts +20 -0
- package/dist/persona/distill-goal.js +1 -0
- package/dist/persona/index.d.ts +5 -0
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.js +1 -1
- package/dist/persona/types.d.ts +1 -1
- package/dist/persona/types.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -0
- package/dist/{project → playbooks/service-build}/context-assembly.d.ts +9 -4
- package/dist/playbooks/service-build/context-assembly.js +1 -0
- package/dist/{project → playbooks/service-build}/game-theory.d.ts +1 -1
- package/dist/playbooks/service-build/index.d.ts +14 -0
- package/dist/playbooks/service-build/index.js +1 -0
- package/dist/{project → playbooks/service-build}/intent-analyzer.d.ts +1 -1
- package/dist/playbooks/service-build/intent-analyzer.js +1 -0
- package/dist/playbooks/service-build/machine-nodes.d.ts +25 -0
- package/dist/playbooks/service-build/machine-nodes.js +1 -0
- package/dist/playbooks/service-build/machine-panorama.d.ts +43 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -0
- package/dist/{project → playbooks/service-build}/merchant-guide.d.ts +1 -1
- package/dist/playbooks/service-build/merchant-guide.js +1 -0
- package/dist/{project → playbooks/service-build}/mode-actions.d.ts +2 -2
- package/dist/playbooks/service-build/mode-actions.js +1 -0
- package/dist/playbooks/service-build/namespace.d.ts +2 -0
- package/dist/playbooks/service-build/namespace.js +1 -0
- package/dist/playbooks/service-build/object-panorama.d.ts +178 -0
- package/dist/playbooks/service-build/object-panorama.js +1 -0
- package/dist/playbooks/service-build/object-type.d.ts +1 -0
- package/dist/playbooks/service-build/object-type.js +1 -0
- package/dist/{project → playbooks/service-build}/participation-radar.d.ts +4 -5
- package/dist/playbooks/service-build/participation-radar.js +1 -0
- package/dist/{project → playbooks/service-build}/pipeline-actions.d.ts +9 -9
- package/dist/playbooks/service-build/pipeline-actions.js +1 -0
- package/dist/playbooks/service-build/process.d.ts +6 -0
- package/dist/playbooks/service-build/process.js +1 -0
- package/dist/playbooks/service-build/risk-aggregator.js +1 -0
- package/dist/{project → playbooks/service-build}/semantic-graph.d.ts +2 -2
- package/dist/playbooks/service-build/service-panorama.d.ts +164 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -0
- package/dist/review/arb.d.ts +6 -0
- package/dist/review/arb.js +1 -0
- package/dist/review/demand.d.ts +3 -0
- package/dist/review/demand.js +1 -0
- package/dist/review/index.d.ts +3 -0
- package/dist/review/index.js +1 -0
- package/dist/review/machine.d.ts +3 -0
- package/dist/review/machine.js +1 -0
- package/dist/review/order.d.ts +9 -0
- package/dist/review/order.js +1 -0
- package/dist/review/progress.d.ts +3 -0
- package/dist/review/progress.js +1 -0
- package/dist/review/repository.d.ts +3 -0
- package/dist/review/repository.js +1 -0
- package/dist/review/service.d.ts +5 -0
- package/dist/review/service.js +1 -0
- package/dist/review/types.d.ts +156 -0
- package/dist/review/types.js +1 -0
- package/dist/role/derivation.d.ts +19 -2
- package/dist/role/derivation.js +1 -1
- package/dist/role/index.d.ts +2 -2
- package/dist/role/index.js +1 -1
- package/dist/role/model.js +1 -1
- package/dist/role/resolution.d.ts +16 -0
- package/dist/role/resolution.js +1 -1
- package/dist/role/types.d.ts +1 -1
- package/dist/role/types.js +1 -1
- package/dist/rules.d.ts +2 -2
- package/dist/rules.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/safety/index.d.ts +1 -1
- package/dist/safety/index.js +1 -1
- package/dist/safety/preview.d.ts +1 -0
- package/dist/safety/preview.js +1 -1
- package/dist/schema/call/allocation.d.ts +2 -1
- package/dist/schema/call/arbitration.d.ts +5 -4
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +17 -1
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +11 -4
- package/dist/schema/call/contact.d.ts +2 -1
- package/dist/schema/call/contact.js +1 -1
- package/dist/schema/call/demand.d.ts +2 -1
- package/dist/schema/call/demand.js +1 -1
- package/dist/schema/call/guard.d.ts +6 -3
- package/dist/schema/call/handler.d.ts +0 -3
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +4 -2
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +2 -1
- package/dist/schema/call/payment.d.ts +2 -1
- package/dist/schema/call/permission.d.ts +2 -1
- package/dist/schema/call/personal.d.ts +39 -1
- package/dist/schema/call/personal.js +1 -1
- package/dist/schema/call/progress.d.ts +2 -1
- package/dist/schema/call/proof.d.ts +4 -2
- package/dist/schema/call/repository.d.ts +6 -5
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +2 -13
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +3 -2
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +2 -1
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +2 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +146 -0
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +317 -0
- package/dist/schema/goal/index.js +1 -0
- package/dist/schema/goal/planning.d.ts +465 -0
- package/dist/schema/goal/planning.js +1 -0
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +265 -1
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/industry-pack/modes.d.ts +268 -0
- package/dist/schema/industry-pack/modes.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +30 -3
- package/dist/schema/intent-radar/index.js +1 -1
- package/dist/schema/local/index.d.ts +9 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +54 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +1147 -94
- package/dist/schema/operations.js +1 -1
- package/dist/schema/permission/index.d.ts +18 -0
- package/dist/schema/permission/index.js +1 -1
- package/dist/schema/persona/index.d.ts +40 -0
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +783 -0
- package/dist/schema/query/bi.js +1 -0
- package/dist/schema/query/index.d.ts +1471 -208
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/trust/index.d.ts +17 -0
- package/dist/schema/trust/index.js +1 -1
- package/dist/schema/utils/skills-recommendation.d.ts +0 -1
- package/dist/schema/utils/skills-recommendation.js +1 -1
- package/dist/schema/watch/index.d.ts +204 -0
- package/dist/schema/watch/index.js +1 -0
- package/dist/schema/workflow/index.d.ts +301 -0
- package/dist/schema/workflow/index.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +8 -5
- package/dist/schemas/account_operation.schema.json +2 -2
- package/dist/schemas/bridge_operation.output.json +7 -4
- package/dist/schemas/bridge_operation.schema.json +37 -21
- package/dist/schemas/config_operation.output.json +1 -1
- package/dist/schemas/config_operation.schema.json +1 -1
- package/dist/schemas/evaluation_operation.output.json +276 -1
- package/dist/schemas/evaluation_operation.schema.json +307 -0
- package/dist/schemas/goal_operation.schema.json +1016 -0
- package/dist/schemas/guard2file.schema.json +9 -5
- package/dist/schemas/index.json +22 -11
- package/dist/schemas/industry_pack_operation.output.json +898 -0
- package/dist/schemas/industry_pack_operation.schema.json +217 -2
- package/dist/schemas/intent_radar.output.json +20 -2
- package/dist/schemas/intent_radar.schema.json +10 -1
- package/dist/schemas/local_info_operation.output.json +7 -4
- package/dist/schemas/local_mark_operation.output.json +7 -4
- package/dist/schemas/machineNode2file.schema.json +9 -5
- package/dist/schemas/messenger_operation.output.json +107 -4
- package/dist/schemas/messenger_operation.schema.json +98 -0
- package/dist/schemas/monitor_events.output.json +1435 -0
- package/dist/schemas/monitor_events.schema.json +85 -0
- package/dist/schemas/monitor_subscription.output.json +1462 -0
- package/dist/schemas/monitor_subscription.schema.json +327 -0
- package/dist/schemas/onchain_events.output.json +241 -18
- package/dist/schemas/onchain_events.schema.json +20 -0
- package/dist/schemas/onchain_operations.output.json +12 -7
- package/dist/schemas/onchain_operations.schema.json +570 -478
- package/dist/schemas/onchain_operations_allocation.schema.json +14 -10
- package/dist/schemas/onchain_operations_arbitration.schema.json +17 -12
- package/dist/schemas/onchain_operations_contact.schema.json +13 -9
- package/dist/schemas/onchain_operations_demand.schema.json +13 -9
- package/dist/schemas/onchain_operations_gen_passport.schema.json +9 -5
- package/dist/schemas/onchain_operations_gen_proof.schema.json +9 -5
- package/dist/schemas/onchain_operations_guard.schema.json +9 -5
- package/dist/schemas/onchain_operations_machine.schema.json +17 -13
- package/dist/schemas/onchain_operations_order.schema.json +12 -8
- package/dist/schemas/onchain_operations_payment.schema.json +10 -6
- package/dist/schemas/onchain_operations_permission.schema.json +12 -8
- package/dist/schemas/onchain_operations_personal.schema.json +47 -5
- package/dist/schemas/onchain_operations_progress.schema.json +12 -8
- package/dist/schemas/onchain_operations_proof.schema.json +9 -5
- package/dist/schemas/onchain_operations_repository.schema.json +295 -310
- package/dist/schemas/onchain_operations_reward.schema.json +17 -13
- package/dist/schemas/onchain_operations_service.schema.json +21 -17
- package/dist/schemas/onchain_operations_treasury.schema.json +17 -13
- package/dist/schemas/onchain_table_data.output.json +4125 -239
- package/dist/schemas/onchain_table_data.schema.json +326 -15
- package/dist/schemas/permission_operation.output.json +32 -0
- package/dist/schemas/permission_operation.schema.json +6 -2
- package/dist/schemas/persona_operation.output.json +145 -0
- package/dist/schemas/persona_operation.schema.json +28 -2
- package/dist/schemas/query_toolkit.output.json +3384 -2040
- package/dist/schemas/query_toolkit.schema.json +548 -9
- package/dist/schemas/trust_score.output.json +38 -0
- package/dist/schemas/trust_score.schema.json +32 -0
- package/dist/schemas/watch_operation.output.json +827 -0
- package/dist/schemas/watch_operation.schema.json +145 -0
- package/dist/schemas/workflow_operation.output.json +263 -5
- package/dist/schemas/workflow_operation.schema.json +599 -4
- package/dist/task/ProcessStore.d.ts +81 -0
- package/dist/task/ProcessStore.js +1 -0
- package/dist/task/playbook.d.ts +11 -0
- package/dist/task/playbook.js +1 -0
- package/dist/task/stage-gate.d.ts +22 -0
- package/dist/task/stage-gate.js +1 -0
- package/dist/{project → task}/substep-trace.d.ts +6 -45
- package/dist/task/types.d.ts +120 -0
- package/dist/task/types.js +1 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/goal.d.ts +4 -0
- package/dist/tools/handlers/goal.js +1 -0
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/intent-radar.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/monitor.d.ts +26 -0
- package/dist/tools/handlers/monitor.js +1 -0
- package/dist/tools/handlers/network.d.ts +1 -0
- package/dist/tools/handlers/network.js +1 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/permission.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/trust.d.ts +14 -0
- package/dist/tools/handlers/trust.js +1 -1
- package/dist/tools/handlers/watch.d.ts +2 -0
- package/dist/tools/handlers/watch.js +1 -0
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +5 -4
- package/dist/customer/post-purchase.d.ts +0 -44
- package/dist/customer/post-purchase.js +0 -1
- package/dist/harness/checkpoint.d.ts +0 -8
- package/dist/harness/checkpoint.js +0 -1
- package/dist/knowledge/deployment-scanner.d.ts +0 -66
- package/dist/knowledge/deployment-scanner.js +0 -1
- package/dist/project/business-puzzle.js +0 -1
- package/dist/project/context-assembly.js +0 -1
- package/dist/project/deployment-bridge.d.ts +0 -5
- package/dist/project/deployment-bridge.js +0 -1
- package/dist/project/deployment-doc.d.ts +0 -190
- package/dist/project/deployment-doc.js +0 -1
- package/dist/project/edit-planner.d.ts +0 -123
- package/dist/project/edit-planner.js +0 -1
- package/dist/project/evaluation-fix.spec.d.ts +0 -1
- package/dist/project/evaluation-fix.spec.js +0 -1
- package/dist/project/evaluation.d.ts +0 -127
- package/dist/project/evaluation.js +0 -1
- package/dist/project/graph-builder.d.ts +0 -51
- package/dist/project/graph-builder.js +0 -1
- package/dist/project/graph.d.ts +0 -70
- package/dist/project/graph.js +0 -1
- package/dist/project/handlers.d.ts +0 -540
- package/dist/project/handlers.js +0 -1
- package/dist/project/index.d.ts +0 -91
- package/dist/project/index.js +0 -1
- package/dist/project/intent-analyzer.js +0 -1
- package/dist/project/machine-nodes.d.ts +0 -2
- package/dist/project/machine-nodes.js +0 -1
- package/dist/project/merchant-guide.js +0 -1
- package/dist/project/migration.d.ts +0 -22
- package/dist/project/migration.js +0 -1
- package/dist/project/mode-actions.js +0 -1
- package/dist/project/namespace.d.ts +0 -72
- package/dist/project/namespace.js +0 -1
- package/dist/project/participation-radar.js +0 -1
- package/dist/project/pipeline-actions.js +0 -1
- package/dist/project/project-store.d.ts +0 -110
- package/dist/project/project-store.js +0 -1
- package/dist/project/query.d.ts +0 -43
- package/dist/project/query.js +0 -1
- package/dist/project/risk-aggregator.js +0 -1
- package/dist/project/rollback-policy.d.ts +0 -45
- package/dist/project/rollback-policy.js +0 -1
- package/dist/project/semantic-assembler.d.ts +0 -93
- package/dist/project/semantic-assembler.js +0 -1
- package/dist/project/stage-gate.d.ts +0 -53
- package/dist/project/stage-gate.js +0 -1
- package/dist/project/task-tracker.d.ts +0 -26
- package/dist/project/task-tracker.js +0 -1
- package/dist/schema/project/index.d.ts +0 -2015
- package/dist/schema/project/index.js +0 -1
- package/dist/schema/task-status.d.ts +0 -62
- package/dist/schema/task-status.js +0 -1
- package/dist/schemas/project_operation.output.json +0 -7877
- package/dist/schemas/project_operation.schema.json +0 -1133
- package/dist/schemas/query_task_status.output.json +0 -211
- package/dist/schemas/query_task_status.schema.json +0 -18
- package/dist/tools/handlers/project.d.ts +0 -2
- package/dist/tools/handlers/project.js +0 -1
- package/dist/tools/handlers/task-status.d.ts +0 -2
- package/dist/tools/handlers/task-status.js +0 -1
- /package/dist/{project → playbooks/service-build}/business-puzzle.d.ts +0 -0
- /package/dist/{project → playbooks/service-build}/game-theory.js +0 -0
- /package/dist/{project → playbooks/service-build}/reverse-mapping.d.ts +0 -0
- /package/dist/{project → playbooks/service-build}/reverse-mapping.js +0 -0
- /package/dist/{project → playbooks/service-build}/risk-aggregator.d.ts +0 -0
- /package/dist/{project → playbooks/service-build}/semantic-graph.js +0 -0
- /package/dist/{project → playbooks/service-build}/workflow-design-assessment.d.ts +0 -0
- /package/dist/{project → playbooks/service-build}/workflow-design-assessment.js +0 -0
- /package/dist/{project → task}/substep-trace.js +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type DecisionRecord, type FeedbackRecord, type ProblemRecord, type ProcessEvent, type ProcessManifest, type ProcessStageState, type SubstepRecord, type StageMeta } from "./types.js";
|
|
2
|
+
export declare function processesRootDir(): string;
|
|
3
|
+
export declare function processDir(id: string): string;
|
|
4
|
+
export declare function deleteProcessDir(dir: string): void;
|
|
5
|
+
export declare function initProcess(dir: string, manifest: ProcessManifest, stages: string[]): ProcessManifest;
|
|
6
|
+
export declare function loadManifest(dir: string): ProcessManifest;
|
|
7
|
+
export declare function saveManifest(dir: string, manifest: ProcessManifest): void;
|
|
8
|
+
export declare function loadStageState(dir: string): ProcessStageState | undefined;
|
|
9
|
+
export declare function saveStageState(dir: string, state: ProcessStageState): void;
|
|
10
|
+
export declare function advanceStage(dir: string, toStage: string, opts?: {
|
|
11
|
+
allowSkip?: boolean;
|
|
12
|
+
}): ProcessStageState;
|
|
13
|
+
export declare function updateStageMeta(dir: string, stage: string, patch: Partial<StageMeta>): StageMeta;
|
|
14
|
+
export declare function appendEvent(dir: string, event: ProcessEvent): void;
|
|
15
|
+
export declare function readEvents(dir: string): ProcessEvent[];
|
|
16
|
+
export declare function addProblem(dir: string, input: {
|
|
17
|
+
stage?: string;
|
|
18
|
+
object?: string;
|
|
19
|
+
severity: ProblemRecord["severity"];
|
|
20
|
+
title: string;
|
|
21
|
+
detail?: string;
|
|
22
|
+
note?: {
|
|
23
|
+
by: "user" | "agent" | "system";
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
origin?: ProblemRecord["origin"];
|
|
27
|
+
}): ProblemRecord;
|
|
28
|
+
export declare function updateProblem(dir: string, id: string, patch: Partial<Pick<ProblemRecord, "status" | "severity" | "title" | "detail" | "stage" | "object">>, note?: {
|
|
29
|
+
by: "user" | "agent" | "system";
|
|
30
|
+
text: string;
|
|
31
|
+
}): ProblemRecord;
|
|
32
|
+
export declare function listProblems(dir: string, filter?: {
|
|
33
|
+
status?: ProblemRecord["status"];
|
|
34
|
+
}): ProblemRecord[];
|
|
35
|
+
export declare function addFeedback(dir: string, input: {
|
|
36
|
+
source: FeedbackRecord["source"];
|
|
37
|
+
sentiment: FeedbackRecord["sentiment"];
|
|
38
|
+
comment: string;
|
|
39
|
+
refs?: FeedbackRecord["refs"];
|
|
40
|
+
}): FeedbackRecord;
|
|
41
|
+
export declare function listFeedback(dir: string): FeedbackRecord[];
|
|
42
|
+
export declare function addDecision(dir: string, input: {
|
|
43
|
+
stage?: string;
|
|
44
|
+
by: DecisionRecord["by"];
|
|
45
|
+
decision: string;
|
|
46
|
+
rationale?: string;
|
|
47
|
+
reversible: boolean;
|
|
48
|
+
}): DecisionRecord;
|
|
49
|
+
export declare function listDecisions(dir: string): DecisionRecord[];
|
|
50
|
+
export declare function appendSubstep(dir: string, network: string, record: SubstepRecord): void;
|
|
51
|
+
export declare function readSubsteps(dir: string, network: string): SubstepRecord[];
|
|
52
|
+
export declare function savePayload(dir: string, relPath: string, data: unknown): string;
|
|
53
|
+
export declare function loadPayload<T = unknown>(dir: string, relPath: string): T | undefined;
|
|
54
|
+
export interface ProcessBundle {
|
|
55
|
+
schema_version: string;
|
|
56
|
+
exported_at: string;
|
|
57
|
+
manifest: ProcessManifest;
|
|
58
|
+
stage?: ProcessStageState;
|
|
59
|
+
events: ProcessEvent[];
|
|
60
|
+
problems: ProblemRecord[];
|
|
61
|
+
feedback: FeedbackRecord[];
|
|
62
|
+
decisions: DecisionRecord[];
|
|
63
|
+
substeps: Record<string, SubstepRecord[]>;
|
|
64
|
+
payloads: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
export declare function exportBundle(dir: string): ProcessBundle;
|
|
67
|
+
export declare function importBundle(destDir: string, bundle: ProcessBundle, opts?: {
|
|
68
|
+
remap?: Record<string, string>;
|
|
69
|
+
}): ProcessManifest;
|
|
70
|
+
export declare function forkProcess(srcDir: string, destDir: string): ProcessManifest;
|
|
71
|
+
export interface ProcessListEntry {
|
|
72
|
+
dir_name: string;
|
|
73
|
+
path: string;
|
|
74
|
+
manifest?: ProcessManifest;
|
|
75
|
+
current_stage?: string;
|
|
76
|
+
stages?: string[];
|
|
77
|
+
committed_stages?: string[];
|
|
78
|
+
archived: boolean;
|
|
79
|
+
mtime: number;
|
|
80
|
+
}
|
|
81
|
+
export declare function listProcesses(root?: string): ProcessListEntry[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{appendFileSync,copyFileSync,existsSync,mkdirSync,readFileSync,readdirSync,rmSync,statSync,writeFileSync}from'fs';import{basename,dirname,join,relative,sep}from'path';import{getWowMcpDir}from'@wowok/wowok';import{PROCESS_SCHEMA_VERSION}from'./types.js';export function processesRootDir(){return join(getWowMcpDir(),'processes');}export function processDir(a){return join(processesRootDir(),a);}export function deleteProcessDir(a){rmSync(a,{'recursive':!![],'force':!![]});}function manifestPath(a){return join(a,'manifest.json');}function stageStatePath(a){return join(a,'stage.json');}function eventsPath(a){return join(a,'events.jsonl');}function problemsPath(a){return join(a,'problems.jsonl');}function feedbackPath(a){return join(a,'feedback.jsonl');}function decisionsPath(a){return join(a,'decisions.jsonl');}function netKey(a){return(a||'default')['replace'](/[^a-zA-Z0-9_-]/g,'_');}function substepsPath(a,b){return join(a,'substeps-'+netKey(b)+'.jsonl');}function relKey(a,b){return relative(a,b)['split'](sep)['join']('/');}function zeroStageMeta(){return{'committed':![],'gate_passed':![],'blocking_issues':[],'completion':0x0};}function newRecordId(a){return a+'_'+Date['now']()['toString'](0x24)+'_'+Math['random']()['toString'](0x24)['slice'](0x2,0x8);}export function initProcess(a,b,c){if(c['length']===0x0)throw new Error('initProcess\x20requires\x20a\x20non-empty\x20stage\x20sequence');mkdirSync(a,{'recursive':!![]}),writeFileSync(manifestPath(a),JSON['stringify'](b,null,0x2),'utf-8');const d={};for(const e of c)d[e]=zeroStageMeta();return saveStageState(a,{'stages':[...c],'current_stage':c[0x0],'stage_meta':d,'updated_at':Date['now']()}),appendEvent(a,{'timestamp':b['created_at'],'event':'process_init','stage':c[0x0],'reason':'process\x20initialized\x20(playbook:\x20'+b['playbook']+')','data':{'playbook':b['playbook'],'stages':[...c]}}),b;}export function loadManifest(a){const b=manifestPath(a);if(!existsSync(b))throw new Error('process\x20not\x20initialized:\x20'+a+'\x20(missing\x20manifest.json)');return JSON['parse'](readFileSync(b,'utf-8'));}export function saveManifest(a,b){b['updated_at']=new Date()['toISOString'](),writeFileSync(manifestPath(a),JSON['stringify'](b,null,0x2),'utf-8');}export function loadStageState(a){const b=stageStatePath(a);if(!existsSync(b))return undefined;return JSON['parse'](readFileSync(b,'utf-8'));}export function saveStageState(a,b){b['updated_at']=Date['now'](),mkdirSync(a,{'recursive':!![]}),writeFileSync(stageStatePath(a),JSON['stringify'](b,null,0x2),'utf-8');}export function advanceStage(a,b,c={}){const d=loadStageState(a);if(!d)throw new Error('process\x20not\x20initialized:\x20'+a+'\x20(missing\x20stage.json)');const e=d['stages']['indexOf'](b);if(e<0x0)throw new Error('unknown\x20stage\x20\x27'+b+'\x27\x20(stages:\x20'+d['stages']['join']('\x20→\x20')+')');const f=d['stages']['indexOf'](d['current_stage']);if(b===d['current_stage'])return d;if(e<f)throw new Error('invalid\x20stage\x20transition:\x20'+d['current_stage']+'\x20→\x20'+b+'\x20(forward-only)');if(e>f+0x1&&!c['allowSkip'])throw new Error('invalid\x20stage\x20transition:\x20'+d['current_stage']+'\x20→\x20'+b+'\x20(skips\x20'+d['stages'][f+0x1]+';\x20pass\x20allowSkip\x20to\x20jump)');const g=d['current_stage'],h=d['stage_meta'][g]??zeroStageMeta();return d['stage_meta'][g]={...h,'committed':!![],'committed_at':h['committed_at']??Date['now'](),'completion':h['committed']?h['completion']:0x64},d['current_stage']=b,saveStageState(a,d),appendEvent(a,{'timestamp':new Date()['toISOString'](),'event':'stage_commit','stage':g,'reason':'stage\x20\x27'+g+'\x27\x20committed;\x20advanced\x20to\x20\x27'+b+'\x27','data':{'from':g,'to':b}}),d;}export function updateStageMeta(a,b,c){const d=loadStageState(a);if(!d)throw new Error('process\x20not\x20initialized:\x20'+a+'\x20(missing\x20stage.json)');if(!d['stages']['includes'](b))throw new Error('unknown\x20stage\x20\x27'+b+'\x27\x20(stages:\x20'+d['stages']['join']('\x20→\x20')+')');const e={...d['stage_meta'][b]??zeroStageMeta(),...c};return d['stage_meta'][b]=e,saveStageState(a,d),e;}export function appendEvent(a,b){mkdirSync(a,{'recursive':!![]}),appendFileSync(eventsPath(a),JSON['stringify'](b)+'\x0a','utf-8');}export function readEvents(a){return readJsonl(eventsPath(a));}function readJsonl(a){if(!existsSync(a))return[];return readFileSync(a,'utf-8')['split']('\x0a')['filter'](b=>b['trim']()['length']>0x0)['map'](b=>JSON['parse'](b));}function appendJsonlRecord(a,b){mkdirSync(dirname(a),{'recursive':!![]}),appendFileSync(a,JSON['stringify'](b)+'\x0a','utf-8');}function foldLatest(a){const b=new Map();for(const c of a)b['set'](c['id'],c);return[...b['values']()];}export function addProblem(a,b){const c={'id':newRecordId('prob'),'created_at':new Date()['toISOString'](),...b['stage']?{'stage':b['stage']}:{},...b['object']?{'object':b['object']}:{},'severity':b['severity'],'status':'open','title':b['title'],...b['detail']?{'detail':b['detail']}:{},'notes':b['note']?[{'at':new Date()['toISOString'](),'by':b['note']['by'],'text':b['note']['text']}]:[],...b['origin']?{'origin':b['origin']}:{}};return appendJsonlRecord(problemsPath(a),c),c;}export function updateProblem(a,b,c,d){const e=foldLatest(readJsonl(problemsPath(a)))['find'](g=>g['id']===b);if(!e)throw new Error('problem\x20not\x20found:\x20'+b);const f={...e,...Object['fromEntries'](Object['entries'](c)['filter'](([,g])=>g!==undefined)),'notes':d?[...e['notes'],{'at':new Date()['toISOString'](),'by':d['by'],'text':d['text']}]:e['notes']};return appendJsonlRecord(problemsPath(a),f),f;}export function listProblems(a,b={}){const c=foldLatest(readJsonl(problemsPath(a)));return b['status']?c['filter'](d=>d['status']===b['status']):c;}export function addFeedback(a,b){const c={'id':newRecordId('fb'),'at':new Date()['toISOString'](),'source':b['source'],'sentiment':b['sentiment'],'comment':b['comment'],...b['refs']?{'refs':b['refs']}:{}};return appendJsonlRecord(feedbackPath(a),c),c;}export function listFeedback(a){return readJsonl(feedbackPath(a));}export function addDecision(a,b){const c={'id':newRecordId('dec'),'at':new Date()['toISOString'](),...b['stage']?{'stage':b['stage']}:{},'by':b['by'],'decision':b['decision'],...b['rationale']?{'rationale':b['rationale']}:{},'reversible':b['reversible']};return appendJsonlRecord(decisionsPath(a),c),c;}export function listDecisions(a){return readJsonl(decisionsPath(a));}export function appendSubstep(a,b,c){appendJsonlRecord(substepsPath(a,b),c);}export function readSubsteps(a,b){return readJsonl(substepsPath(a,b));}export function savePayload(a,b,c){const d=join(a,b);return mkdirSync(dirname(d),{'recursive':!![]}),writeFileSync(d,JSON['stringify'](c,null,0x2),'utf-8'),d;}export function loadPayload(a,b){const c=join(a,b);if(!existsSync(c))return undefined;return JSON['parse'](readFileSync(c,'utf-8'));}export function exportBundle(a){const b=loadManifest(a),c={},d={};function e(f){if(!existsSync(f))return;for(const g of readdirSync(f,{'withFileTypes':!![]})){const h=join(f,g['name']);if(g['isDirectory']())e(h);else{if(g['isFile']()){const i=relKey(a,h);if(i==='manifest.json'||i==='stage.json')continue;if(g['name']['endsWith']('.json'))try{c[i]=JSON['parse'](readFileSync(h,'utf-8'));}catch{}else{const j=g['name']['match'](/^substeps-(.+)\.jsonl$/);if(j)d[j[0x1]]=readJsonl(h);}}}}}return e(a),{'schema_version':PROCESS_SCHEMA_VERSION,'exported_at':new Date()['toISOString'](),'manifest':b,'stage':loadStageState(a),'events':readEvents(a),'problems':listProblems(a),'feedback':listFeedback(a),'decisions':listDecisions(a),'substeps':d,'payloads':c};}function remapDeep(a,b,c){if(typeof a==='string'){const d=b[a];if(d!==undefined)return c['n']+=0x1,d;return a;}if(Array['isArray'](a))return a['map'](e=>remapDeep(e,b,c));if(a!==null&&typeof a==='object'){const e={};for(const [f,g]of Object['entries'](a)){e[f]=remapDeep(g,b,c);}return e;}return a;}export function importBundle(a,b,c={}){const g=c['remap']??{},h={'n':0x0};mkdirSync(a,{'recursive':!![]});const i=remapDeep(b['manifest'],g,h);i['updated_at']=new Date()['toISOString'](),writeFileSync(manifestPath(a),JSON['stringify'](i,null,0x2),'utf-8');b['stage']&&writeFileSync(stageStatePath(a),JSON['stringify'](b['stage'],null,0x2),'utf-8');for(const j of b['events'])appendJsonlRecord(eventsPath(a),j);for(const k of b['problems'])appendJsonlRecord(problemsPath(a),k);for(const l of b['feedback'])appendJsonlRecord(feedbackPath(a),l);for(const m of b['decisions'])appendJsonlRecord(decisionsPath(a),m);for(const [n,o]of Object['entries'](b['substeps'])){for(const q of o){appendJsonlRecord(substepsPath(a,n),remapDeep(q,g,h));}}for(const [s,t]of Object['entries'](b['payloads'])){savePayload(a,s,remapDeep(t,g,h));}return appendEvent(a,{'timestamp':new Date()['toISOString'](),'event':'process_imported','reason':'process\x20imported\x20from\x20bundle\x20(exported_at\x20'+b['exported_at']+')','data':{'remapped':h['n']}}),i;}export function forkProcess(a,b){const c=loadManifest(a);mkdirSync(b,{'recursive':!![]});function d(f,g){for(const h of readdirSync(f,{'withFileTypes':!![]})){const i=join(f,h['name']),j=join(g,h['name']);if(h['isDirectory']())mkdirSync(j,{'recursive':!![]}),d(i,j);else h['isFile']()&©FileSync(i,j);}}d(a,b);const e={...c,'process_id':basename(b),'forked_from':c['process_id'],'archived':![],'updated_at':new Date()['toISOString']()};return writeFileSync(manifestPath(b),JSON['stringify'](e,null,0x2),'utf-8'),appendEvent(b,{'timestamp':new Date()['toISOString'](),'event':'process_forked','reason':'forked\x20from\x20'+c['process_id']+'\x20('+a+')','data':{'source_dir':a,'source_process':c['process_id']}}),e;}export function listProcesses(a=processesRootDir()){if(!existsSync(a))return[];const b=[];for(const c of readdirSync(a,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(a,c['name']);if(!existsSync(manifestPath(d)))continue;const f={'dir_name':c['name'],'path':d,'archived':![],'mtime':0x0};try{f['manifest']=loadManifest(d),f['archived']=f['manifest']['archived'];}catch{}try{const g=loadStageState(d);g&&(f['current_stage']=g['current_stage'],f['stages']=g['stages'],f['committed_stages']=g['stages']['filter'](h=>g['stage_meta'][h]?.['committed']));}catch{}try{f['mtime']=statSync(d)['mtimeMs'];}catch{}b['push'](f);}return b['sort']((h,i)=>i['mtime']-h['mtime']);}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ProcessPlaybook {
|
|
2
|
+
name: string;
|
|
3
|
+
stages: string[];
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerPlaybook(playbook: ProcessPlaybook): void;
|
|
7
|
+
export declare function getPlaybook(name: string): ProcessPlaybook | undefined;
|
|
8
|
+
export declare function listPlaybooks(): ProcessPlaybook[];
|
|
9
|
+
export declare function hasPlaybook(name: string): boolean;
|
|
10
|
+
export declare const GENERIC_PLAYBOOK = "generic";
|
|
11
|
+
export declare function playbookForGoalType(goalType: string): ProcessPlaybook;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const registry=new Map();export function registerPlaybook(a){if(!a['name'])throw new Error('playbook\x20requires\x20a\x20name');if(a['stages']['length']===0x0)throw new Error('playbook\x20\x27'+a['name']+'\x27\x20requires\x20stages');registry['set'](a['name'],{...a,'stages':[...a['stages']]});}export function getPlaybook(a){return registry['get'](a);}export function listPlaybooks(){return[...registry['values']()];}export function hasPlaybook(a){return registry['has'](a);}export const GENERIC_PLAYBOOK='generic';export function playbookForGoalType(a){switch(a){case'publish_service':return registry['get']('service-build');case'fulfill_order':return registry['get']('order-fulfillment');case'capture_demand':return registry['get']('demand-capture');case'publish_demand':return registry['get']('demand-publish');case'purchase_service':return registry['get']('purchase');default:return registry['get'](GENERIC_PLAYBOOK);}}registerPlaybook({'name':GENERIC_PLAYBOOK,'stages':['prepare','execute','verify','close'],'description':'Fallback\x20stage\x20sequence\x20for\x20goals\x20without\x20a\x20dedicated\x20playbook.'}),registerPlaybook({'name':'service-build','stages':['namespace','puzzle','risk','doc','substeps'],'description':'Design\x20&\x20publish\x20a\x20commercial\x20service\x20(content:\x20src/playbooks/service-build/).'}),registerPlaybook({'name':'order-fulfillment','stages':['confirm','deliver','accept','settle'],'description':'Merchant-side\x20order\x20fulfillment.'}),registerPlaybook({'name':'demand-capture','stages':['discover','evaluate','engage','close'],'description':'Discover\x20and\x20capture\x20demand\x20opportunities.'}),registerPlaybook({'name':'demand-publish','stages':['draft','fund','publish','close'],'description':'Publish\x20a\x20funded\x20demand.'}),registerPlaybook({'name':'purchase','stages':['select','order','monitor','review'],'description':'Purchase\x20a\x20service\x20and\x20see\x20it\x20delivered.'});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type GateDimension = "semantic" | "tools" | "reversibility" | "risk" | "isolation" | "gas_budget";
|
|
2
|
+
export interface GasBudgetCheck {
|
|
3
|
+
network: "testnet" | "mainnet";
|
|
4
|
+
already_spent_gas: number;
|
|
5
|
+
estimated_rerun_gas: number;
|
|
6
|
+
warning?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StageGateCheck {
|
|
9
|
+
dimension: GateDimension;
|
|
10
|
+
status: "PASS" | "FAIL" | "WARN";
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
export interface StageGateResult {
|
|
14
|
+
stage: string;
|
|
15
|
+
passed: boolean;
|
|
16
|
+
checks: StageGateCheck[];
|
|
17
|
+
blocking_issues: string[];
|
|
18
|
+
warnings: string[];
|
|
19
|
+
can_proceed: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function buildGasBudgetCheck(gas?: GasBudgetCheck): StageGateCheck;
|
|
22
|
+
export declare function composeStageGateResult(stage: string, checks: StageGateCheck[]): StageGateResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function buildGasBudgetCheck(a){if(!a)return{'dimension':'gas_budget','status':'PASS','message':'Gas\x20budget\x20not\x20provided\x20(N/A\x20for\x20this\x20stage\x20or\x20caller\x20omitted)'};if(a['network']==='testnet')return{'dimension':'gas_budget','status':'PASS','message':'testnet:\x20no\x20gas\x20limit\x20(faucet\x20is\x20free);\x20rollback\x20is\x20costless'};const b=a['already_spent_gas']+a['estimated_rerun_gas'],c=a['warning']??'mainnet:\x20estimated\x20total\x20gas\x20'+b+'\x20MIST\x20(already_spent='+a['already_spent_gas']+'\x20+\x20rerun='+a['estimated_rerun_gas']+').\x20Rollback\x20will\x20incur\x20real\x20cost.';return{'dimension':'gas_budget','status':'WARN','message':c};}export function composeStageGateResult(a,b){const c=b['filter'](e=>e['status']==='FAIL')['map'](e=>'['+e['dimension']+']\x20'+e['message']),d=b['filter'](e=>e['status']==='WARN')['map'](e=>'['+e['dimension']+']\x20'+e['message']);return{'stage':a,'passed':c['length']===0x0,'checks':b,'blocking_issues':c,'warnings':d,'can_proceed':c['length']===0x0};}
|
|
@@ -1,50 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type SubstepNetwork = "testnet" | "mainnet";
|
|
1
|
+
import type { SubstepEdge, SubstepRecord } from "./types.js";
|
|
3
2
|
export type SubstepStatus = "PENDING" | "SUCCESS" | "FAILED" | "SKIPPED";
|
|
4
|
-
export interface OutputRef {
|
|
5
|
-
substep_id: string;
|
|
6
|
-
field_path: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SubstepRecord {
|
|
9
|
-
step_id: string;
|
|
10
|
-
parent_step: string;
|
|
11
|
-
object_type: ProjectObjectType;
|
|
12
|
-
entry_id: string;
|
|
13
|
-
operation_type: string;
|
|
14
|
-
network: SubstepNetwork;
|
|
15
|
-
input: {
|
|
16
|
-
data: Record<string, unknown>;
|
|
17
|
-
input_refs: string[];
|
|
18
|
-
};
|
|
19
|
-
output?: {
|
|
20
|
-
object_id?: string;
|
|
21
|
-
tx_digest?: string;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
timestamp: number;
|
|
25
|
-
status: SubstepStatus;
|
|
26
|
-
failure_reason?: string;
|
|
27
|
-
dependencies: {
|
|
28
|
-
input_refs: string[];
|
|
29
|
-
output_refs: OutputRef[];
|
|
30
|
-
};
|
|
31
|
-
retry_info?: {
|
|
32
|
-
original_step_id: string;
|
|
33
|
-
retry_count: number;
|
|
34
|
-
retry_reason: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface SubstepEdge {
|
|
38
|
-
source: string;
|
|
39
|
-
target: string;
|
|
40
|
-
field_path: string;
|
|
41
|
-
}
|
|
42
3
|
export interface SubstepDAG {
|
|
43
4
|
namespace: {
|
|
44
5
|
prefix: string;
|
|
45
6
|
version: string;
|
|
46
7
|
};
|
|
47
|
-
network:
|
|
8
|
+
network: string;
|
|
48
9
|
substeps: SubstepRecord[];
|
|
49
10
|
edges: SubstepEdge[];
|
|
50
11
|
topological_order: string[];
|
|
@@ -79,7 +40,7 @@ export interface StepTraceDetail {
|
|
|
79
40
|
export interface SubstepTraceInput {
|
|
80
41
|
project_prefix: string;
|
|
81
42
|
version: string;
|
|
82
|
-
network:
|
|
43
|
+
network: string;
|
|
83
44
|
substeps: SubstepRecord[];
|
|
84
45
|
edges?: SubstepEdge[];
|
|
85
46
|
}
|
|
@@ -88,7 +49,7 @@ export interface SubstepTraceResult {
|
|
|
88
49
|
prefix: string;
|
|
89
50
|
version: string;
|
|
90
51
|
};
|
|
91
|
-
network:
|
|
52
|
+
network: string;
|
|
92
53
|
coherent: boolean;
|
|
93
54
|
dangling_inputs: DanglingInput[];
|
|
94
55
|
circular_refs: CircularRef[];
|
|
@@ -113,7 +74,7 @@ export declare class SubstepTracer {
|
|
|
113
74
|
private records;
|
|
114
75
|
private namespace;
|
|
115
76
|
private network;
|
|
116
|
-
constructor(prefix: string, version: string, network:
|
|
77
|
+
constructor(prefix: string, version: string, network: string);
|
|
117
78
|
record(rec: SubstepRecord): void;
|
|
118
79
|
getTrace(): SubstepRecord[];
|
|
119
80
|
updateStatus(step_id: string, status: SubstepStatus, output?: Record<string, unknown>, failure_reason?: string): void;
|
|
@@ -124,7 +85,7 @@ export declare class SubstepTracer {
|
|
|
124
85
|
prefix: string;
|
|
125
86
|
version: string;
|
|
126
87
|
};
|
|
127
|
-
network:
|
|
88
|
+
network: string;
|
|
128
89
|
substeps: SubstepRecord[];
|
|
129
90
|
};
|
|
130
91
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export declare const PROCESS_SCHEMA_VERSION = "1.0.0";
|
|
2
|
+
export interface ProcessManifest {
|
|
3
|
+
schema_version: string;
|
|
4
|
+
mcp_version: string;
|
|
5
|
+
process_id: string;
|
|
6
|
+
playbook: string;
|
|
7
|
+
goal_id?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
network?: string;
|
|
10
|
+
objects: {
|
|
11
|
+
type: string;
|
|
12
|
+
object: string;
|
|
13
|
+
}[];
|
|
14
|
+
created_at: string;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
forked_from?: string;
|
|
17
|
+
archived: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface StageMeta {
|
|
20
|
+
committed: boolean;
|
|
21
|
+
committed_at?: number;
|
|
22
|
+
gate_passed: boolean;
|
|
23
|
+
blocking_issues: string[];
|
|
24
|
+
completion: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ProcessStageState {
|
|
27
|
+
stages: string[];
|
|
28
|
+
current_stage: string;
|
|
29
|
+
stage_meta: Record<string, StageMeta>;
|
|
30
|
+
updated_at: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ProcessEvent {
|
|
33
|
+
timestamp: string;
|
|
34
|
+
event: string;
|
|
35
|
+
stage?: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
user_confirmed?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ProblemRecord {
|
|
41
|
+
id: string;
|
|
42
|
+
created_at: string;
|
|
43
|
+
stage?: string;
|
|
44
|
+
object?: string;
|
|
45
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
46
|
+
status: "open" | "resolved" | "wontfix";
|
|
47
|
+
title: string;
|
|
48
|
+
detail?: string;
|
|
49
|
+
notes: {
|
|
50
|
+
at: string;
|
|
51
|
+
by: "user" | "agent" | "system";
|
|
52
|
+
text: string;
|
|
53
|
+
}[];
|
|
54
|
+
origin?: {
|
|
55
|
+
source: "monitor";
|
|
56
|
+
network: string;
|
|
57
|
+
event_id: string;
|
|
58
|
+
event_type: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface FeedbackRecord {
|
|
62
|
+
id: string;
|
|
63
|
+
at: string;
|
|
64
|
+
source: "user" | "agent" | "system";
|
|
65
|
+
sentiment: "positive" | "negative" | "neutral";
|
|
66
|
+
comment: string;
|
|
67
|
+
refs?: {
|
|
68
|
+
stage?: string;
|
|
69
|
+
object?: string;
|
|
70
|
+
run_id?: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface DecisionRecord {
|
|
74
|
+
id: string;
|
|
75
|
+
at: string;
|
|
76
|
+
stage?: string;
|
|
77
|
+
by: "user" | "agent";
|
|
78
|
+
decision: string;
|
|
79
|
+
rationale?: string;
|
|
80
|
+
reversible: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface OutputRef {
|
|
83
|
+
substep_id: string;
|
|
84
|
+
field_path: string;
|
|
85
|
+
}
|
|
86
|
+
export interface SubstepEdge {
|
|
87
|
+
source: string;
|
|
88
|
+
target: string;
|
|
89
|
+
field_path: string;
|
|
90
|
+
}
|
|
91
|
+
export interface SubstepRecord {
|
|
92
|
+
step_id: string;
|
|
93
|
+
parent_step: string;
|
|
94
|
+
object_type: string;
|
|
95
|
+
entry_id: string;
|
|
96
|
+
operation_type: string;
|
|
97
|
+
network: string;
|
|
98
|
+
input: {
|
|
99
|
+
data: Record<string, unknown>;
|
|
100
|
+
input_refs: string[];
|
|
101
|
+
};
|
|
102
|
+
output?: {
|
|
103
|
+
object_id?: string;
|
|
104
|
+
tx_digest?: string;
|
|
105
|
+
[key: string]: unknown;
|
|
106
|
+
};
|
|
107
|
+
timestamp: number;
|
|
108
|
+
status: "PENDING" | "SUCCESS" | "FAILED" | "SKIPPED";
|
|
109
|
+
failure_reason?: string;
|
|
110
|
+
dependencies: {
|
|
111
|
+
input_refs: string[];
|
|
112
|
+
output_refs: OutputRef[];
|
|
113
|
+
};
|
|
114
|
+
retry_info?: {
|
|
115
|
+
original_step_id: string;
|
|
116
|
+
retry_count: number;
|
|
117
|
+
retry_reason: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export declare function newProcessId(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PROCESS_SCHEMA_VERSION='1.0.0';export function newProcessId(){return'proc_'+Date['now']()['toString'](0x24)+'_'+Math['random']()['toString'](0x24)['slice'](0x2,0x8);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{listServices,getServiceInfo,toggle as
|
|
1
|
+
import{listServices,getServiceInfo,toggle as a384a,setEnabled as a384b,reset as a384c}from'../../config/index.js';import{strictParse}from'../../schema/index.js';import{ConfigOperationInputSchema}from'../../schema/config/index.js';export async function handleConfigOperation(a){const b=strictParse(ConfigOperationInputSchema,a,'config_operation\x20input'),{action:c,service:d}=b;let e;switch(c){case'list':e={'action':'list','services':listServices()};break;case'toggle':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20toggle');const f=d,g=getServiceInfo(f);if(!g)throw new Error('Unknown\x20service:\x20'+f+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');const h=a384a(f);e={'action':'toggle','service':f,'enabled':h,'reminder':g['reminder']};break;}case'enable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20enable');const i=d,j=getServiceInfo(i);if(!j)throw new Error('Unknown\x20service:\x20'+i+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a384b(i,!![]),e={'action':'enable','service':i,'enabled':!![],'reminder':j['reminder']};break;}case'disable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20disable');const k=d,l=getServiceInfo(k);if(!l)throw new Error('Unknown\x20service:\x20'+k+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a384b(k,![]),e={'action':'disable','service':k,'enabled':![],'reminder':l['reminder']};break;}case'reset':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20reset');const m=d,n=getServiceInfo(m);if(!n)throw new Error('Unknown\x20service:\x20'+m+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a384c(m),e={'action':'reset','service':m,'enabled':getServiceInfo(m)?.['enabled'],'reminder':n['reminder'],'reset':!![]};break;}case'info':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20info');const o=d,p=getServiceInfo(o);if(!p)throw new Error('Unknown\x20service:\x20'+o+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');e={'action':'info',...p};break;}default:throw new Error('Unknown\x20config_operation\x20action:\x20'+String(c));}return{'content':[{'type':'text','text':JSON['stringify']({'result':e})}],'structuredContent':{'result':e}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{strictParse}from'../../schema/index.js';import{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{evaluatePathReasoning}from'../../evaluation/path-reasoning.js';import{assessEvidenceReview}from'../../knowledge/evidence-review.js';import{expandSearchScope,inferSensitivity,rankByLocation}from'../../evaluation/location-match.js';import{query_services,query_arbs,query_demands,query_objects,ArbStatus}from'@wowok/wowok';import{fetchObjectLinkerCore}from'../../knowledge/index.js';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{extractDemandCapability}from'../../evaluation/extract.js';import{assessServiceRisk}from'../../evaluation/builtins/service-risk.js';import{assessArbitration}from'../../evaluation/builtins/arbitration-score.js';import{resolveCategoryMatchRules,toSoftWeightInjection,applyHardConstraints}from'../../evaluation/category-match-rules.js';import{computeMarketMetrics}from'../../knowledge/market-metrics.js';import{assessAntiCheat}from'../../knowledge/anti-cheat.js';import{computeJourneyFunnel,attributeReferrals,buildCustomerRelationships}from'../../knowledge/market-operations.js';import{suggestPricing}from'../../knowledge/dynamic-pricing.js';import{runAccountEventWatchers}from'../../customer/account-events.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections,personaToInjection}from'../../persona/index.js';registerBuiltinEvaluations();function arbCaseFromObject(b){const c=typeof b['time']==='number'?b['time']:Number(b['time']??0x0);return{'status':b['status'],'time':Number['isFinite'](c)?c:undefined,'resolved_time':typeof b['indemnity']?.['time']==='number'?b['indemnity']['time']:b['compensation_time']??undefined,'indemnity_amount':b['indemnity']?.['amount'],'objected':b['status']===ArbStatus['Objectionable']||b['objection']!=null&&b['objection']['length']>0x0};}async function arbCasesWithRoles(a,b){const c=a['map'](arbCaseFromObject),d=Array['from'](new Set(a['map'](j=>j['order'])['filter'](Boolean))),e=new Map(),f=[];if(d['length']>0x0){const j=await query_objects({'objects':d,'network':b});for(const k of j['objects']??[]){const l=k;if(!l?.['object'])continue;e['set'](l['object'],l);if(l['service'])f['push'](l['service']);}}const g=new Map(),h=Array['from'](new Set(f));if(h['length']>0x0){const m=await query_objects({'objects':h,'network':b});for(const n of m['objects']??[]){const p=n;if(p?.['object'])g['set'](p['object'],p);}}for(let q=0x0;q<a['length'];q++){const r=e['get'](a[q]['order']);if(!r)continue;c[q]['customer']=r['builder']||undefined;const t=g['get'](r['service']);if(t)c[q]['merchant']=t['permission']||undefined;}return c;}function capabilityFromInput(a){return{'id':a['id'],'kind':a['kind'],'owner':a['owner']??'','industry':a['industry'],'industry_confidence':a['industry_confidence']??0x0,'region':a['region'],'price_min':a['price_min']!==undefined?BigInt(a['price_min']):undefined,'price_max':a['price_max']!==undefined?BigInt(a['price_max']):undefined,'token_type':a['token_type']??'','ticket_size':a['ticket_size']??'medium','trust_score':a['trust_score']??0x32,'reputation_like_ratio':a['reputation_like_ratio']??0x1,'arbitration_independent':a['arbitration_independent']??![],'merchant_history_count':a['merchant_history_count']??0x0,'capabilities':a['capabilities'],'tags':a['tags']??[],'keywords':a['keywords']??[]};}function puzzleRawFromInput(a){return{'service':{...a['service'],'priceRaw':a['service']['priceRaw']!==undefined?BigInt(a['service']['priceRaw']):undefined,'compensation_fund':a['service']['compensation_fund']?{'balance':a['service']['compensation_fund']['balance']!==undefined?BigInt(a['service']['compensation_fund']['balance']):undefined}:undefined},'machine_nodes':a['machine_nodes'],'machine_published':a['machine_published'],'machine_paused':a['machine_paused'],'reviews':a['reviews'],'events':a['events'],'similar_services':a['similar_services']?.['map'](b=>({'price':BigInt(b['price'])})),'order_amount':a['order_amount']!==undefined?BigInt(a['order_amount']):undefined,'trust_score':a['trust_score'],'arbitration_owner':a['arbitration_owner'],'service_owner':a['service_owner'],'wip_verified':a['wip_verified'],'order_history':a['order_history'],'merchant_reputation':a['merchant_reputation']};}async function resolveInjection(a,b){const c=a?personaToInjection(await getEffectivePersona(a)):undefined;return mergeInjections(c,b);}function serviceSummaryToExtract(a){const b=a['json']??{},c=f=>typeof f==='string'?f:undefined,d=f=>typeof f==='string'?f:null,e=Array['isArray'](b['sales'])?b['sales']['map'](f=>({'name':typeof f?.['name']==='string'?f['name']:undefined,'price':typeof f?.['price']==='string'?f['price']:f?.['price']!=null?String(f['price']):'0','wip_hash':typeof f?.['wip_hash']==='string'?f['wip_hash']:undefined})):[];return{'object':a['object'],'description':c(b['description'])??'','location':a['location']??c(b['location'])??'','sales':e,'arbitrations':Array['isArray'](b['arbitrations'])?b['arbitrations']['map'](String):[],'compensation_fund':c(b['compensation_fund']),'buy_guard':d(b['buy_guard']),'machine':d(b['machine']),'um':d(b['um']),'bPublished':b['bPublished']===!![],'bPaused':b['bPaused']===!![]};}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const e=b['account']?await getEffectivePersona(b['account']):null,f=b['appetite']??e?.['layer']['preferences']?.['risk_appetite'],g=b['requirements']??e?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':f,'requirements':g})};break;}case'node_game':{const h=b['account']?await getEffectivePersona(b['account']):null,i=b['appetite']??h?.['layer']['preferences']?.['risk_appetite'],j=b['requirements']??h?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':i,'requirements':j,'threshold':b['threshold'],'allocation':b['allocation'],'order_amount':b['order_amount'],'compensation_fund':b['compensation_fund'],'operable':b['operable'],'waiting_on':b['waiting_on']??[]})};break;}case'capability_gap':{c={'action':'capability_gap','report':summarizeCapabilityGaps(capabilityFromInput(b['demand']),capabilityFromInput(b['service']))};break;}case'compose_service':{c={'action':'compose_service','plan':composeServicesForDemand(capabilityFromInput(b['demand']),b['services']['map'](capabilityFromInput))};break;}case'demand_match':{c={'action':'demand_match','matches':await matchDemandToServices(capabilityFromInput(b['demand_cap']),b['services'],await resolveInjection(b['account'],b['injection']))};break;}case'service_match':{c={'action':'service_match','matches':await matchServiceToDemands(capabilityFromInput(b['service_cap']),b['demands'],await resolveInjection(b['account'],b['injection']))};break;}case'service_risk':{c={'action':'service_risk','result':await assessServiceRisk(b['service_id'],puzzleRawFromInput(b['puzzle_raw']),await resolveInjection(b['account'],b['injection']),b['depth']??'preorder')};break;}case'path_reasoning':{const k=b['account']?await getEffectivePersona(b['account']):null,l=b['appetite']??k?.['layer']['preferences']?.['risk_appetite'],m=b['requirements']??k?.['layer']['requirements'];c={'action':'path_reasoning',...evaluatePathReasoning({'current_node':b['current_node'],'perspective':b['perspective'],'machine_nodes':b['machine_nodes'],'node_annotations':b['node_annotations'],'appetite':l,'requirements':m,'order_amount':b['order_amount'],'max_depth':b['max_depth']})};break;}case'evidence_review':{c={'action':'evidence_review','review':assessEvidenceReview({'kind':b['kind'],'hash_committed':b['hash_committed'],'digital_check_passed':b['digital_check_passed'],'contradiction':b['contradiction']})};break;}case'discover_services':{const n=!b['sensitivity']?inferSensitivity(b['description']??''):null,o=b['sensitivity']??n['sensitivity'],p=n?.['signals']??[],q=b['context_network']??'testnet',r={'raw':b['location'],...b['region']??{}},s=expandSearchScope(o,r),t=await query_services({'coin_type':b['coin_type'],'name_contains':b['name_contains'],'location_any':s['search_terms'],'max_objects':b['max_objects'],'network':q,'no_cache':b['no_cache']}),u=rankByLocation(o,r,t['services']['map'](v=>({'id':v['object'],'name':v['name'],'location':v['location']})));c={'action':'discover_services','sensitivity':o,'inference_signals':p,'services':u['map'](v=>{const w=t['services']['find'](x=>x['object']===v['id']);return{'object':v['id'],'name':w?.['name'],'location':w?.['location'],'relation':v['relation'],'satisfied':v['satisfied'],'score':v['score'],'reason':v['reason']};}),'total_enumerated':t['total_enumerated'],'has_more':t['has_more'],'scope_advice':{'search_terms':s['search_terms'],'ai_enrichment_note':s['ai_enrichment_note']}};break;}case'discover_demands':{const v=b['context_network']??'testnet',w=await query_demands({'max_objects':b['max_objects'],'network':v,'no_cache':b['no_cache']}),x=b['location']?.['toLowerCase'](),y=w['demands']['filter'](z=>!x||(z['location']??'')['toLowerCase']()['includes'](x))['map'](z=>({'object':z['object'],'description':z['description']??'','location':z['location']??'','presenters_count':z['presenters_count']??0x0,'permission':z['permission']??''}));c={'action':'discover_demands','demands':y,'total_enumerated':w['total_enumerated'],'has_more':w['has_more']};break;}case'market_metrics':{const z=b['context_network']??'testnet',A=await computeMarketMetrics(z,b['no_cache']);c={'action':'market_metrics',...A};break;}case'anti_cheat':{const B=assessAntiCheat({'service':{'object':b['service']['object'],'arbitrations':b['service']['arbitrations'],'compensation_fund':b['service']['compensation_fund'],'machine':b['service']['machine'],'bPublished':b['service']['bPublished']},'orders':b['orders'],'reviews':b['reviews']});c={'action':'anti_cheat','signals':B};break;}case'market_operations':{if(b['op']==='journey_funnel')c={'action':'market_operations','result':computeJourneyFunnel({'due_diligence':b['due_diligence']??0x0,'orders':b['orders']??0x0,'completed':b['completed']??0x0,'reviews':b['reviews']??0x0})};else{if(b['op']==='referral_attribution')c={'action':'market_operations','result':attributeReferrals(b['referral_orders']??[])};else{if(b['op']==='dynamic_pricing'){const C=b['market_signals'];if(!C)throw new Error('dynamic_pricing\x20op\x20requires\x20market_signals');c={'action':'market_operations','result':suggestPricing({'supplyCount':C['supplyCount'],'demandCount':C['demandCount'],'avgPrice':C['avgPrice'],'myPrice':C['myPrice'],'competitorPrices':C['competitorPrices'],'recentOrderCount':C['recentOrderCount'],'repeatCustomerRate':C['repeatCustomerRate']})};}else c={'action':'market_operations','result':buildCustomerRelationships(b['customer_orders']??[])};}}break;}case'match_discover':{const D=!b['sensitivity']?inferSensitivity(b['description']??''):null,E=b['sensitivity']??D['sensitivity'],F=D?.['signals']??[],G=b['context_network']??'testnet',H={'raw':b['location'],...b['region']??{}},I=expandSearchScope(E,H),J=await query_services({'coin_type':b['coin_type'],'name_contains':b['name_contains'],'location_any':I['search_terms'],'max_objects':b['max_objects'],'network':G,'no_cache':b['no_cache']}),K=new Set(b['required_capabilities']??[]),L=extractDemandCapability({'object':'intent','description':b['description'],'location':b['location'],'owner':b['account']},{'price_max':b['budget']!==undefined?BigInt(b['budget']):undefined,'capabilities':{'has_arbitration':K['has']('has_arbitration'),'has_refund_path':K['has']('has_refund_path'),'has_milestone_nodes':K['has']('has_milestone_nodes'),'has_compensation_fund':K['has']('has_compensation_fund'),'has_wip_verification':K['has']('has_wip_verification'),'has_messenger':K['has']('has_messenger'),'has_buy_guard':K['has']('has_buy_guard'),'has_dynamic_pricing':K['has']('has_dynamic_pricing'),'is_published':!![],'is_paused':![]}}),M=rankByLocation(E,H,J['services']['map'](X=>({'id':X['object'],'name':X['name'],'location':X['location']}))),N=M['filter'](X=>X['satisfied']),O=J['services']['filter'](X=>N['some'](Y=>Y['id']===X['object']))['map'](serviceSummaryToExtract),P=resolveCategoryMatchRules(b['category']);let Q=O;const R=[];if(P){const X=applyHardConstraints(P,O);Q=X['passed'];for(const Y of X['dropped']){R['push']({'object':Y['candidate']['object'],'reason':Y['constraint']['description']});}}let S=await resolveInjection(b['account'],b['injection']);P&&(S=mergeInjections(S,toSoftWeightInjection(P)));const T=await matchDemandToServices(L,Q,S,Q['length']),U=new Map(T['map'](Z=>[Z['service']['object'],Z['result']])),V=new Set(Q['map'](Z=>Z['object'])),W=N['filter'](Z=>V['has'](Z['id']))['map'](Z=>{const a0=J['services']['find'](a1=>a1['object']===Z['id']);return{'service':serviceSummaryToExtract(a0),'location':{'relation':Z['relation'],'satisfied':Z['satisfied'],'score':Z['score'],'reason':Z['reason']},'result':U['get'](Z['id'])};});c={'action':'match_discover','sensitivity':E,'inference_signals':F,'matches':W,'total_enumerated':J['total_enumerated'],'has_more':J['has_more'],'scope_advice':{'search_terms':I['search_terms'],'ai_enrichment_note':I['ai_enrichment_note']}};break;}case'arbitration_score':{let Z=b['history'];const a0=b['context_network']??'testnet';if((!Z||Z['length']===0x0)&&b['arbitration']['object'])try{const a2=await query_arbs({'arbitration':b['arbitration']['object'],'network':a0});Z=await arbCasesWithRoles(a2['arbs'],a0);}catch{Z=b['history'];}if((!Z||Z['length']===0x0)&&b['arbitration']['object'])try{const a3=await query_objects({'objects':[b['arbitration']['object']],'network':a0}),a4=a3?.['objects']?.[0x0];if(a4?.['permission']){const a5=await fetchObjectLinkerCore(a4['permission'],a0),a6=(a5?.['items']??[])['map'](a8=>a8['who'])['filter'](a8=>a8!==b['arbitration']['object']),a7=[];for(const a8 of a6['slice'](0x0,0xa)){const a9=await query_arbs({'arbitration':a8,'network':a0})['catch'](()=>undefined);a9?.['arbs']?.['length']&&a7['push'](...await arbCasesWithRoles(a9['arbs'],a0));}if(a7['length']>0x0)Z=a7;}}catch{}const a1=await assessArbitration({'arbitration':{'object':b['arbitration']['object'],'fee':b['arbitration']['fee'],'balance':b['arbitration']['balance'],'voting_guard_count':b['arbitration']['voting_guard_count'],'bPaused':b['arbitration']['bPaused'],'location':b['arbitration']['location'],'has_verified_identity':b['arbitration']['has_verified_identity']},'history':Z,'entity_votes':b['entity_votes'],'fee_median':b['fee_median']},await resolveInjection(b['account'],b['injection']));c={'action':'arbitration_score',...a1};break;}case'account_events':{const aa=await runAccountEventWatchers({'account':b['account'],'network':b['context_network']??'testnet','reviews':b['reviews']?.['map'](ab=>({'reviewer':ab['reviewer'],'rating':ab['rating'],'tags':ab['tags'],'comment':ab['comment'],'orderRef':ab['orderRef'],'timestamp':ab['timestamp'],'verified':ab['verified']??![]})),'order_history':b['order_history']},b['categories']);c={'action':'account_events','events':aa};break;}default:throw new Error('Unknown\x20evaluation_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{evaluatePathReasoning}from'../../evaluation/path-reasoning.js';import{assessEvidenceReview}from'../../knowledge/evidence-review.js';import{expandSearchScope,inferSensitivity,rankByLocation}from'../../evaluation/location-match.js';import{query_objects,ArbStatus}from'@wowok/wowok';import{enumerateServices,enumerateDemands,enumerateArbs}from'../../knowledge/jsonrpc-enum.js';import{fetchObjectLinkerCore}from'../../knowledge/index.js';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{extractDemandCapability}from'../../evaluation/extract.js';import{assessServiceRisk}from'../../evaluation/builtins/service-risk.js';import{assessArbitration}from'../../evaluation/builtins/arbitration-score.js';import{resolveCategoryMatchRules,toSoftWeightInjection,applyHardConstraints}from'../../evaluation/category-match-rules.js';import{computeMarketMetrics,computeOrderFlow}from'../../knowledge/market-metrics.js';import{assessAntiCheat}from'../../knowledge/anti-cheat.js';import{computeJourneyFunnel,attributeReferrals,buildCustomerRelationships}from'../../knowledge/market-operations.js';import{suggestPricing}from'../../knowledge/dynamic-pricing.js';import{runAccountEventWatchers}from'../../customer/account-events.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections}from'../../persona/index.js';import{buildUserInjection}from'../../evaluation/injection.js';registerBuiltinEvaluations();function arbCaseFromObject(b){const c=typeof b['time']==='number'?b['time']:Number(b['time']??0x0);return{'status':b['status'],'time':Number['isFinite'](c)?c:undefined,'resolved_time':typeof b['indemnity']?.['time']==='number'?b['indemnity']['time']:b['compensation_time']??undefined,'indemnity_amount':b['indemnity']?.['amount'],'objected':b['status']===ArbStatus['Objectionable']||b['objection']!=null&&b['objection']['length']>0x0};}async function arbCasesWithRoles(a,b){const c=a['map'](arbCaseFromObject),d=Array['from'](new Set(a['map'](j=>j['order'])['filter'](Boolean))),e=new Map(),f=[];if(d['length']>0x0){const j=await query_objects({'objects':d,'network':b});for(const k of j['objects']??[]){const l=k;if(!l?.['object'])continue;e['set'](l['object'],l);if(l['service'])f['push'](l['service']);}}const g=new Map(),h=Array['from'](new Set(f));if(h['length']>0x0){const m=await query_objects({'objects':h,'network':b});for(const n of m['objects']??[]){const p=n;if(p?.['object'])g['set'](p['object'],p);}}for(let q=0x0;q<a['length'];q++){const r=e['get'](a[q]['order']);if(!r)continue;c[q]['customer']=r['builder']||undefined;const t=g['get'](r['service']);if(t)c[q]['merchant']=t['permission']||undefined;}return c;}function capabilityFromInput(a){return{'id':a['id'],'kind':a['kind'],'owner':a['owner']??'','industry':a['industry'],'industry_confidence':a['industry_confidence']??0x0,'region':a['region'],'price_min':a['price_min']!==undefined?BigInt(a['price_min']):undefined,'price_max':a['price_max']!==undefined?BigInt(a['price_max']):undefined,'token_type':a['token_type']??'','ticket_size':a['ticket_size']??'medium','trust_score':a['trust_score']??0x32,'reputation_like_ratio':a['reputation_like_ratio']??0x1,'arbitration_independent':a['arbitration_independent']??![],'merchant_history_count':a['merchant_history_count']??0x0,'capabilities':a['capabilities'],'tags':a['tags']??[],'keywords':a['keywords']??[]};}function puzzleRawFromInput(a){return{'service':{...a['service'],'priceRaw':a['service']['priceRaw']!==undefined?BigInt(a['service']['priceRaw']):undefined,'compensation_fund':a['service']['compensation_fund']?{'balance':a['service']['compensation_fund']['balance']!==undefined?BigInt(a['service']['compensation_fund']['balance']):undefined}:undefined},'machine_nodes':a['machine_nodes'],'machine_published':a['machine_published'],'machine_paused':a['machine_paused'],'reviews':a['reviews'],'events':a['events'],'similar_services':a['similar_services']?.['map'](b=>({'price':BigInt(b['price'])})),'order_amount':a['order_amount']!==undefined?BigInt(a['order_amount']):undefined,'trust_score':a['trust_score'],'arbitration_owner':a['arbitration_owner'],'service_owner':a['service_owner'],'wip_verified':a['wip_verified'],'order_history':a['order_history'],'merchant_reputation':a['merchant_reputation']};}async function resolveInjection(a,b){return mergeInjections(await buildUserInjection(a),b);}function serviceSummaryToExtract(a){const b=a['json']??{},c=f=>typeof f==='string'?f:undefined,d=f=>typeof f==='string'?f:null,e=Array['isArray'](b['sales'])?b['sales']['map'](f=>({'name':typeof f?.['name']==='string'?f['name']:undefined,'price':typeof f?.['price']==='string'?f['price']:f?.['price']!=null?String(f['price']):'0','wip_hash':typeof f?.['wip_hash']==='string'?f['wip_hash']:undefined})):[];return{'object':a['object'],'description':c(b['description'])??'','location':a['location']??c(b['location'])??'','sales':e,'arbitrations':Array['isArray'](b['arbitrations'])?b['arbitrations']['map'](String):[],'compensation_fund':c(b['compensation_fund']),'buy_guard':d(b['buy_guard']),'machine':d(b['machine']),'um':d(b['um']),'bPublished':b['bPublished']===!![],'bPaused':b['bPaused']===!![]};}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const e=b['account']?await getEffectivePersona(b['account']):null,f=b['appetite']??e?.['layer']['preferences']?.['risk_appetite'],g=b['requirements']??e?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':f,'requirements':g})};break;}case'node_game':{const h=b['account']?await getEffectivePersona(b['account']):null,i=b['appetite']??h?.['layer']['preferences']?.['risk_appetite'],j=b['requirements']??h?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':i,'requirements':j,'threshold':b['threshold'],'allocation':b['allocation'],'order_amount':b['order_amount'],'compensation_fund':b['compensation_fund'],'operable':b['operable'],'waiting_on':b['waiting_on']??[]})};break;}case'capability_gap':{c={'action':'capability_gap','report':summarizeCapabilityGaps(capabilityFromInput(b['demand']),capabilityFromInput(b['service']))};break;}case'compose_service':{c={'action':'compose_service','plan':composeServicesForDemand(capabilityFromInput(b['demand']),b['services']['map'](capabilityFromInput))};break;}case'demand_match':{c={'action':'demand_match','matches':await matchDemandToServices(capabilityFromInput(b['demand_cap']),b['services'],await resolveInjection(b['account'],b['injection']))};break;}case'service_match':{c={'action':'service_match','matches':await matchServiceToDemands(capabilityFromInput(b['service_cap']),b['demands'],await resolveInjection(b['account'],b['injection']))};break;}case'service_risk':{c={'action':'service_risk','result':await assessServiceRisk(b['service_id'],puzzleRawFromInput(b['puzzle_raw']),await resolveInjection(b['account'],b['injection']),b['depth']??'preorder')};break;}case'path_reasoning':{const k=b['account']?await getEffectivePersona(b['account']):null,l=b['appetite']??k?.['layer']['preferences']?.['risk_appetite'],m=b['requirements']??k?.['layer']['requirements'];c={'action':'path_reasoning',...evaluatePathReasoning({'current_node':b['current_node'],'perspective':b['perspective'],'machine_nodes':b['machine_nodes'],'node_annotations':b['node_annotations'],'appetite':l,'requirements':m,'order_amount':b['order_amount'],'max_depth':b['max_depth']})};break;}case'evidence_review':{c={'action':'evidence_review','review':assessEvidenceReview({'kind':b['kind'],'hash_committed':b['hash_committed'],'digital_check_passed':b['digital_check_passed'],'contradiction':b['contradiction']})};break;}case'discover_services':{const n=!b['sensitivity']?inferSensitivity(b['description']??''):null,o=b['sensitivity']??n['sensitivity'],p=n?.['signals']??[],q=b['context_network']??'testnet',r={'raw':b['location'],...b['region']??{}},s=expandSearchScope(o,r),t=await enumerateServices(q,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':s['search_terms']}),u=rankByLocation(o,r,t['services']['map'](v=>({'id':v['object'],'name':v['name'],'location':v['location']})));c={'action':'discover_services','sensitivity':o,'inference_signals':p,'services':u['map'](v=>{const w=t['services']['find'](x=>x['object']===v['id']);return{'object':v['id'],'name':w?.['name'],'location':w?.['location'],'relation':v['relation'],'satisfied':v['satisfied'],'score':v['score'],'reason':v['reason']};}),'total_enumerated':t['total_enumerated'],'has_more':t['has_more'],'scope_advice':{'search_terms':s['search_terms'],'ai_enrichment_note':s['ai_enrichment_note']}};break;}case'discover_demands':{const v=b['context_network']??'testnet',w=await enumerateDemands(v,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),x=b['location']?.['toLowerCase'](),y=w['demands']['filter'](z=>!x||(z['location']??'')['toLowerCase']()['includes'](x))['map'](z=>({'object':z['object'],'description':z['description']??'','location':z['location']??'','presenters_count':z['presenters_count']??0x0,'permission':z['permission']??''}));c={'action':'discover_demands','demands':y,'total_enumerated':w['total_enumerated'],'has_more':w['has_more']};break;}case'demand_present':{const z=b['context_network']??'testnet',A=await enumerateDemands(z,{'max_objects':b['max_objects'],'no_cache':b['no_cache']}),B=b['location']?.['toLowerCase'](),C=A['demands']['filter'](G=>!B||(G['location']??'')['toLowerCase']()['includes'](B)),D=new Map(C['map'](G=>[G['object'],(G['guards']?.['length']??0x0)>0x0])),E=C['map'](G=>({'object':G['object'],'description':G['description']??'','location':G['location']??'','rewards':G['rewards']??[],'um':G['um']??null})),F=await matchServiceToDemands(capabilityFromInput(b['service_cap']),E,await resolveInjection(b['account'],b['injection']),b['limit']??0x5);c={'action':'demand_present','matches':F['map'](G=>{const H=D['get'](G['demand']['object'])??![];return{'demand':G['demand'],'result':G['result'],'present':{'operation':H?'demand.present_service_with_passport':'demand.present_service','guard_required':H}};}),'total_enumerated':A['total_enumerated'],'has_more':A['has_more']};break;}case'market_metrics':{const G=b['context_network']??'testnet',H=await computeMarketMetrics(G,b['no_cache']),I=await computeOrderFlow(G,b['limit'],b['no_cache']);c={'action':'market_metrics',...H,'order_flow':I};break;}case'anti_cheat':{const J=assessAntiCheat({'service':{'object':b['service']['object'],'arbitrations':b['service']['arbitrations'],'compensation_fund':b['service']['compensation_fund'],'machine':b['service']['machine'],'bPublished':b['service']['bPublished']},'orders':b['orders'],'reviews':b['reviews']});c={'action':'anti_cheat','signals':J};break;}case'market_operations':{if(b['op']==='journey_funnel')c={'action':'market_operations','result':computeJourneyFunnel({'due_diligence':b['due_diligence']??0x0,'orders':b['orders']??0x0,'completed':b['completed']??0x0,'reviews':b['reviews']??0x0})};else{if(b['op']==='referral_attribution')c={'action':'market_operations','result':attributeReferrals(b['referral_orders']??[])};else{if(b['op']==='dynamic_pricing'){const K=b['market_signals'];if(!K)throw new Error('dynamic_pricing\x20op\x20requires\x20market_signals');c={'action':'market_operations','result':suggestPricing({'supplyCount':K['supplyCount'],'demandCount':K['demandCount'],'avgPrice':K['avgPrice'],'myPrice':K['myPrice'],'competitorPrices':K['competitorPrices'],'recentOrderCount':K['recentOrderCount'],'repeatCustomerRate':K['repeatCustomerRate']})};}else c={'action':'market_operations','result':buildCustomerRelationships(b['customer_orders']??[])};}}break;}case'match_discover':{const L=!b['sensitivity']?inferSensitivity(b['description']??''):null,M=b['sensitivity']??L['sensitivity'],N=L?.['signals']??[],O=b['context_network']??'testnet',P={'raw':b['location'],...b['region']??{}},Q=expandSearchScope(M,P),R=await enumerateServices(O,{'max_objects':b['max_objects'],'no_cache':b['no_cache'],'location_any':Q['search_terms']}),S=new Set(b['required_capabilities']??[]),T=extractDemandCapability({'object':'intent','description':b['description'],'location':b['location'],'owner':b['account']},{'price_max':b['budget']!==undefined?BigInt(b['budget']):undefined,'capabilities':{'has_arbitration':S['has']('has_arbitration'),'has_refund_path':S['has']('has_refund_path'),'has_milestone_nodes':S['has']('has_milestone_nodes'),'has_compensation_fund':S['has']('has_compensation_fund'),'has_wip_verification':S['has']('has_wip_verification'),'has_messenger':S['has']('has_messenger'),'has_buy_guard':S['has']('has_buy_guard'),'has_dynamic_pricing':S['has']('has_dynamic_pricing'),'is_published':!![],'is_paused':![]}}),U=rankByLocation(M,P,R['services']['map'](a5=>({'id':a5['object'],'name':a5['name'],'location':a5['location']}))),V=U['filter'](a5=>a5['satisfied']),W=R['services']['filter'](a5=>V['some'](a6=>a6['id']===a5['object']))['map'](serviceSummaryToExtract),X=resolveCategoryMatchRules(b['category']);let Y=W;const Z=[];if(X){const a5=applyHardConstraints(X,W);Y=a5['passed'];for(const a6 of a5['dropped']){Z['push']({'object':a6['candidate']['object'],'reason':a6['constraint']['description']});}}let a0=await resolveInjection(b['account'],b['injection']);X&&(a0=mergeInjections(a0,toSoftWeightInjection(X)));const a1=await matchDemandToServices(T,Y,a0,Y['length']),a2=new Map(a1['map'](a7=>[a7['service']['object'],a7['result']])),a3=new Set(Y['map'](a7=>a7['object'])),a4=V['filter'](a7=>a3['has'](a7['id']))['map'](a7=>{const a8=R['services']['find'](a9=>a9['object']===a7['id']);return{'service':serviceSummaryToExtract(a8),'location':{'relation':a7['relation'],'satisfied':a7['satisfied'],'score':a7['score'],'reason':a7['reason']},'result':a2['get'](a7['id'])};});c={'action':'match_discover','sensitivity':M,'inference_signals':N,'matches':a4,'total_enumerated':R['total_enumerated'],'has_more':R['has_more'],'scope_advice':{'search_terms':Q['search_terms'],'ai_enrichment_note':Q['ai_enrichment_note']}};break;}case'arbitration_score':{let a7=b['history'];const a8=b['context_network']??'testnet';if((!a7||a7['length']===0x0)&&b['arbitration']['object'])try{const aa=await enumerateArbs(a8,{'arbitration':b['arbitration']['object']});a7=await arbCasesWithRoles(aa['arbs'],a8);}catch{a7=b['history'];}if((!a7||a7['length']===0x0)&&b['arbitration']['object'])try{const ab=await query_objects({'objects':[b['arbitration']['object']],'network':a8}),ac=ab?.['objects']?.[0x0];if(ac?.['permission']){const ad=await fetchObjectLinkerCore(ac['permission'],a8),ae=(ad?.['items']??[])['map'](ag=>ag['who'])['filter'](ag=>ag!==b['arbitration']['object']),af=[];for(const ag of ae['slice'](0x0,0xa)){const ah=await enumerateArbs(a8,{'arbitration':ag})['catch'](()=>undefined);ah?.['arbs']?.['length']&&af['push'](...await arbCasesWithRoles(ah['arbs'],a8));}if(af['length']>0x0)a7=af;}}catch{}const a9=await assessArbitration({'arbitration':{'object':b['arbitration']['object'],'fee':b['arbitration']['fee'],'balance':b['arbitration']['balance'],'voting_guard_count':b['arbitration']['voting_guard_count'],'bPaused':b['arbitration']['bPaused'],'location':b['arbitration']['location'],'has_verified_identity':b['arbitration']['has_verified_identity']},'history':a7,'entity_votes':b['entity_votes'],'fee_median':b['fee_median']},await resolveInjection(b['account'],b['injection']));c={'action':'arbitration_score',...a9};break;}case'account_events':{const ai=await runAccountEventWatchers({'account':b['account'],'network':b['context_network']??'testnet','reviews':b['reviews']?.['map'](aj=>({'reviewer':aj['reviewer'],'rating':aj['rating'],'tags':aj['tags'],'comment':aj['comment'],'orderRef':aj['orderRef'],'timestamp':aj['timestamp'],'verified':aj['verified']??![]})),'order_history':b['order_history']},b['categories']);c={'action':'account_events','events':ai};break;}default:throw new Error('Unknown\x20evaluation_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GoalEngine } from "../../goal/GoalEngine.js";
|
|
2
|
+
import type { ToolDispatchResult } from "../types.js";
|
|
3
|
+
export declare function setGoalEngineDeps(engine?: GoalEngine): void;
|
|
4
|
+
export declare function handleGoalOperation(args: unknown): Promise<ToolDispatchResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{GoalOperationInputSchema}from'../../schema/goal/index.js';import{goalEngine}from'../../goal/GoalEngine.js';import{isTerminalStage}from'../../goal/types.js';import{resolveNetwork}from'./network.js';import{handleAnalyzeIntent,handleAggregateRisks,handleTraceSubsteps}from'../../playbooks/service-build/pipeline-actions.js';import{handleMerchantGuide}from'../../playbooks/service-build/merchant-guide.js';let engineOverride;export function setGoalEngineDeps(a){engineOverride=a;}function engine(){return engineOverride??goalEngine;}export async function handleGoalOperation(a){const b=strictParse(GoalOperationInputSchema,a,'goal_operation\x20input'),c=await resolveNetwork(b['network']),d=engine();let e;switch(b['action']){case'create':{const f=await d['createOrAdopt']({'intent_text':b['intent_text'],...b['goal_type']?{'goal_type':b['goal_type']}:{},...b['account']?{'account':b['account']}:{},...b['persona']?{'persona':b['persona']}:{},...b['title']?{'title':b['title']}:{},...b['conversation_id']?{'conversation_id':b['conversation_id']}:{},...b['create_process']!==undefined?{'create_process':b['create_process']}:{},'network':c});e={'action':'create',...f};break;}case'list':{const {goals:g,counts:h}=await d['list'](c,{...b['stage']?{'stage':b['stage']}:{},...b['account']?{'account':b['account']}:{},...b['conversation_id']?{'conversation_id':b['conversation_id']}:{}}),i=b['include_finished']?g:g['filter'](j=>!isTerminalStage(j['stage']));e={'action':'list','goals':i,'counts':h};break;}case'get':{e={'action':'get','goal':await d['get'](c,b['id'])};break;}case'approve':{e={'action':'approve','goal':await d['approve'](c,b['id'],b['note'])};break;}case'bind':{e={'action':'bind','goal':await d['bind'](c,b['id'],b['account'],b['persona'])};break;}case'advance':{const j=await d['advance'](c,b['id'],{...b['stage']?{'stage':b['stage']}:{},...b['objects']?{'objects':b['objects']}:{}});e={'action':'advance','goal':j};break;}case'pause':{e={'action':'pause','goal':await d['pause'](c,b['id'])};break;}case'complete':{const k=await d['complete'](c,b['id'],{'force':b['force']===!![],...b['feedback']?{'feedback':b['feedback']}:{}});e={'action':'complete',...k};break;}case'abandon':{const l=await d['abandon'](c,b['id'],b['reason']);e={'action':'abandon',...l};break;}case'delete':{const m=await d['remove'](c,b['id'],{'force':b['force']===!![]});e={'action':'delete',...m};break;}case'analyze_intent':e=await handleAnalyzeIntent(b);break;case'aggregate_risks':e=await handleAggregateRisks(b);break;case'trace_substeps':e=await handleTraceSubsteps(b);break;case'merchant_guide':e=await handleMerchantGuide(b);break;default:throw new Error('Unknown\x20goal_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':e})}],'structuredContent':{'result':e}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdirSync,readFileSync,writeFileSync,existsSync,mkdirSync,statSync,cpSync,renameSync,rmSync}from'node:fs';import{join,relative,resolve,sep,dirname,basename}from'node:path';import{strictParse}from'../../schema/index.js';import{IndustryPackOperationInputSchema}from'../../schema/industry-pack/index.js';import{scaffoldIndustryPack,listRegisteredPacks,scanDefaultIndustryPacks,seedBuiltinIndustryTemplates,ensureIndustryReadme,resolveIndustryPackDir,rescanPack,resolveDisputeRules,resolveComplianceRules,resolveSupplyRules,resolveIndustryRules,resolveIndustryPlaybook,diffIndustryPack,resetIndustryPath}from'../../extensions/index.js';const INDUSTRY_ROOT=resolveIndustryPackDir();function resolveIndustryPath(a){const b=resolve(INDUSTRY_ROOT,a);if(b!==INDUSTRY_ROOT&&!b['startsWith'](INDUSTRY_ROOT+sep))throw new Error('path\x20\x27'+a+'\x27\x20escapes\x20the\x20industry\x20root');return b;}function rescanAffectedPack(a){const b=a['split'](/[\\/]+/)['find'](c=>c['length']>0x0);if(!b)return;rescanPack(b);}function listRecursive(a,b,c,d=0x0){if(d>0x8)return;let f;try{f=readdirSync(a,{'withFileTypes':!![]});}catch{return;}for(const g of f){const h=join(a,g['name']),i=relative(b,h)['split'](sep)['join']('/');let j=0x0,k=0x0;try{const l=statSync(h);k=l['size'],j=l['mtimeMs'];}catch{}g['isDirectory']()?(c['push']({'path':i,'is_dir':!![],'size':0x0,'mtime':j}),listRecursive(h,b,c,d+0x1)):c['push']({'path':i,'is_dir':![],'size':k,'mtime':j});}}export async function handleIndustryPackOperation(a){const b=strictParse(IndustryPackOperationInputSchema,a,'industry_pack_operation\x20input');mkdirSync(INDUSTRY_ROOT,{'recursive':!![]}),seedBuiltinIndustryTemplates(),ensureIndustryReadme();let c;switch(b['action']){case'scaffold':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27scaffold\x27');const d=scaffoldIndustryPack(b['name']);c={'action':'scaffold','ok':d['ok'],'dir':d['dir'],'files':d['files'],'errors':d['errors']};if(d['ok'])rescanPack(b['name']);break;}case'list':{c={'action':'list','packs':listRegisteredPacks()};break;}case'scan':{c={'action':'scan','results':scanDefaultIndustryPacks()};break;}case'resolve':{c={'action':'resolve','dir':INDUSTRY_ROOT};break;}case'list_files':{const e=[];listRecursive(INDUSTRY_ROOT,INDUSTRY_ROOT,e),c={'action':'list_files','dir':INDUSTRY_ROOT,'files':e};break;}case'read_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27read_file\x27');const f=resolveIndustryPath(b['path']);if(!existsSync(f))throw new Error('file\x20not\x20found:\x20'+b['path']);c={'action':'read_file','path':f,'content':readFileSync(f,'utf-8')};break;}case'write_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27write_file\x27');if(b['content']===undefined)throw new Error('\x27content\x27\x20is\x20required\x20for\x20action=\x27write_file\x27');const g=resolveIndustryPath(b['path']);mkdirSync(dirname(g),{'recursive':!![]}),writeFileSync(g,b['content'],'utf-8'),c={'action':'write_file','path':g,'ok':!![]},rescanAffectedPack(b['path']);break;}case'get':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27get\x27');const h=b['name'];c={'action':'get','category':h,...resolveDisputeRules(h)?{'dispute':resolveDisputeRules(h)}:{},...resolveComplianceRules(h)?{'compliance':resolveComplianceRules(h)}:{},...resolveSupplyRules(h)?{'supply':resolveSupplyRules(h)}:{},...resolveIndustryRules(h)?{'rules':resolveIndustryRules(h)}:{},...resolveIndustryPlaybook(h)?{'playbook':resolveIndustryPlaybook(h)}:{}};break;}case'diff':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27diff\x27');c={'action':'diff',...diffIndustryPack(b['name'])};break;}case'reset':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27reset\x27');const i=resetIndustryPath(b['path']);c={'action':'reset','ok':i['ok'],'layout':i['layout'],'target':i['target'],'restored_files':i['restored_files'],'errors':i['errors']},rescanAffectedPack(b['path']);break;}case'delete_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27delete_file\x27');const j=resolveIndustryPath(b['path']);if(!existsSync(j))throw new Error('file\x20not\x20found:\x20'+b['path']);rmSync(j,{'recursive':!![],'force':!![]}),c={'action':'delete_file','path':j,'ok':!![]},rescanAffectedPack(b['path']);break;}case'create_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27create_file\x27');const k=resolveIndustryPath(b['path']);if(existsSync(k))throw new Error('file\x20already\x20exists:\x20'+b['path']);mkdirSync(dirname(k),{'recursive':!![]}),writeFileSync(k,b['content']??'','utf-8'),c={'action':'create_file','path':k,'ok':!![]},rescanAffectedPack(b['path']);break;}case'create_dir':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27create_dir\x27');const l=resolveIndustryPath(b['path']);mkdirSync(l,{'recursive':!![]}),c={'action':'create_dir','path':l,'ok':!![]},rescanAffectedPack(b['path']);break;}case'copy':{if(!b['from'])throw new Error('\x27from\x27\x20is\x20required\x20for\x20action=\x27copy\x27');if(!b['to'])throw new Error('\x27to\x27\x20is\x20required\x20for\x20action=\x27copy\x27');const m=resolveIndustryPath(b['from']);let n=resolveIndustryPath(b['to']);if(!existsSync(m))throw new Error('source\x20not\x20found:\x20'+b['from']);try{existsSync(n)&&statSync(n)['isDirectory']()&&(n=join(n,basename(m)));}catch{}if(n===m)throw new Error('\x27copy\x27\x20cannot\x20copy\x20a\x20file\x20onto\x20itself');mkdirSync(dirname(n),{'recursive':!![]}),cpSync(m,n,{'recursive':!![],'force':!![]}),c={'action':'copy','from':m,'to':n,'ok':!![]},rescanAffectedPack(b['to']);break;}case'move':case'rename':{if(!b['from'])throw new Error('\x27from\x27\x20is\x20required\x20for\x20action=\x27'+b['action']+'\x27');if(!b['to'])throw new Error('\x27to\x27\x20is\x20required\x20for\x20action=\x27'+b['action']+'\x27');const o=resolveIndustryPath(b['from']);let p=resolveIndustryPath(b['to']);if(!existsSync(o))throw new Error('source\x20not\x20found:\x20'+b['from']);try{existsSync(p)&&statSync(p)['isDirectory']()&&(p=join(p,basename(o)));}catch{}if(p===o)throw new Error('\x27'+b['action']+'\x27\x20cannot\x20move\x20onto\x20itself');mkdirSync(dirname(p),{'recursive':!![]}),renameSync(o,p),c={'action':b['action'],'from':o,'to':p,'ok':!![]},rescanAffectedPack(b['from']),rescanAffectedPack(b['to']);break;}default:throw new Error('Unknown\x20industry_pack_operation\x20action:\x20'+String(b['action']));}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
1
|
+
import{readdirSync,readFileSync,writeFileSync,existsSync,mkdirSync,statSync,cpSync,renameSync,rmSync}from'node:fs';import{join,relative,resolve,sep,dirname,basename}from'node:path';import{strictParse}from'../../schema/index.js';import{IndustryPackOperationInputSchema}from'../../schema/industry-pack/index.js';import{scaffoldIndustryPack,listRegisteredPacks,scanDefaultIndustryPacks,seedBuiltinIndustryTemplates,ensureIndustryReadme,resolveIndustryPackDir,rescanPack,resolveDisputeRules,resolveComplianceRules,resolveSupplyRules,resolveIndustryRules,resolveIndustryPlaybook,diffIndustryPack,resetIndustryPath}from'../../extensions/index.js';import{handleRecommendIndustry,handleListModes,handleDeriveUserMode,handleEvolveUserMode,handleRegisterUserMode,handleUnregisterUserMode,handleRegisterCustomMetric,handleRegisterCustomConstraint,handleListMetricsConstraints}from'../../playbooks/service-build/mode-actions.js';const INDUSTRY_ROOT=resolveIndustryPackDir();function resolveIndustryPath(a){const b=resolve(INDUSTRY_ROOT,a);if(b!==INDUSTRY_ROOT&&!b['startsWith'](INDUSTRY_ROOT+sep))throw new Error('path\x20\x27'+a+'\x27\x20escapes\x20the\x20industry\x20root');return b;}function rescanAffectedPack(a){const b=a['split'](/[\\/]+/)['find'](c=>c['length']>0x0);if(!b)return;rescanPack(b);}function listRecursive(a,b,c,d=0x0){if(d>0x8)return;let f;try{f=readdirSync(a,{'withFileTypes':!![]});}catch{return;}for(const g of f){const h=join(a,g['name']),i=relative(b,h)['split'](sep)['join']('/');let j=0x0,k=0x0;try{const l=statSync(h);k=l['size'],j=l['mtimeMs'];}catch{}g['isDirectory']()?(c['push']({'path':i,'is_dir':!![],'size':0x0,'mtime':j}),listRecursive(h,b,c,d+0x1)):c['push']({'path':i,'is_dir':![],'size':k,'mtime':j});}}export async function handleIndustryPackOperation(a){const b=strictParse(IndustryPackOperationInputSchema,a,'industry_pack_operation\x20input');mkdirSync(INDUSTRY_ROOT,{'recursive':!![]}),seedBuiltinIndustryTemplates(),ensureIndustryReadme();let c;switch(b['action']){case'scaffold':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27scaffold\x27');const d=scaffoldIndustryPack(b['name']);c={'action':'scaffold','ok':d['ok'],'dir':d['dir'],'files':d['files'],'errors':d['errors']};if(d['ok'])rescanPack(b['name']);break;}case'list':{c={'action':'list','packs':listRegisteredPacks()};break;}case'scan':{c={'action':'scan','results':scanDefaultIndustryPacks()};break;}case'resolve':{c={'action':'resolve','dir':INDUSTRY_ROOT};break;}case'list_files':{const e=[];listRecursive(INDUSTRY_ROOT,INDUSTRY_ROOT,e),c={'action':'list_files','dir':INDUSTRY_ROOT,'files':e};break;}case'read_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27read_file\x27');const f=resolveIndustryPath(b['path']);if(!existsSync(f))throw new Error('file\x20not\x20found:\x20'+b['path']);c={'action':'read_file','path':f,'content':readFileSync(f,'utf-8')};break;}case'write_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27write_file\x27');if(b['content']===undefined)throw new Error('\x27content\x27\x20is\x20required\x20for\x20action=\x27write_file\x27');const g=resolveIndustryPath(b['path']);mkdirSync(dirname(g),{'recursive':!![]}),writeFileSync(g,b['content'],'utf-8'),c={'action':'write_file','path':g,'ok':!![]},rescanAffectedPack(b['path']);break;}case'get':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27get\x27');const h=b['name'];c={'action':'get','category':h,...resolveDisputeRules(h)?{'dispute':resolveDisputeRules(h)}:{},...resolveComplianceRules(h)?{'compliance':resolveComplianceRules(h)}:{},...resolveSupplyRules(h)?{'supply':resolveSupplyRules(h)}:{},...resolveIndustryRules(h)?{'rules':resolveIndustryRules(h)}:{},...resolveIndustryPlaybook(h)?{'playbook':resolveIndustryPlaybook(h)}:{}};break;}case'diff':{if(!b['name'])throw new Error('\x27name\x27\x20is\x20required\x20for\x20action=\x27diff\x27');c={'action':'diff',...diffIndustryPack(b['name'])};break;}case'reset':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27reset\x27');const i=resetIndustryPath(b['path']);c={'action':'reset','ok':i['ok'],'layout':i['layout'],'target':i['target'],'restored_files':i['restored_files'],'errors':i['errors']},rescanAffectedPack(b['path']);break;}case'delete_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27delete_file\x27');const j=resolveIndustryPath(b['path']);if(!existsSync(j))throw new Error('file\x20not\x20found:\x20'+b['path']);rmSync(j,{'recursive':!![],'force':!![]}),c={'action':'delete_file','path':j,'ok':!![]},rescanAffectedPack(b['path']);break;}case'create_file':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27create_file\x27');const k=resolveIndustryPath(b['path']);if(existsSync(k))throw new Error('file\x20already\x20exists:\x20'+b['path']);mkdirSync(dirname(k),{'recursive':!![]}),writeFileSync(k,b['content']??'','utf-8'),c={'action':'create_file','path':k,'ok':!![]},rescanAffectedPack(b['path']);break;}case'create_dir':{if(!b['path'])throw new Error('\x27path\x27\x20is\x20required\x20for\x20action=\x27create_dir\x27');const l=resolveIndustryPath(b['path']);mkdirSync(l,{'recursive':!![]}),c={'action':'create_dir','path':l,'ok':!![]},rescanAffectedPack(b['path']);break;}case'copy':{if(!b['from'])throw new Error('\x27from\x27\x20is\x20required\x20for\x20action=\x27copy\x27');if(!b['to'])throw new Error('\x27to\x27\x20is\x20required\x20for\x20action=\x27copy\x27');const m=resolveIndustryPath(b['from']);let n=resolveIndustryPath(b['to']);if(!existsSync(m))throw new Error('source\x20not\x20found:\x20'+b['from']);try{existsSync(n)&&statSync(n)['isDirectory']()&&(n=join(n,basename(m)));}catch{}if(n===m)throw new Error('\x27copy\x27\x20cannot\x20copy\x20a\x20file\x20onto\x20itself');mkdirSync(dirname(n),{'recursive':!![]}),cpSync(m,n,{'recursive':!![],'force':!![]}),c={'action':'copy','from':m,'to':n,'ok':!![]},rescanAffectedPack(b['to']);break;}case'move':case'rename':{if(!b['from'])throw new Error('\x27from\x27\x20is\x20required\x20for\x20action=\x27'+b['action']+'\x27');if(!b['to'])throw new Error('\x27to\x27\x20is\x20required\x20for\x20action=\x27'+b['action']+'\x27');const o=resolveIndustryPath(b['from']);let p=resolveIndustryPath(b['to']);if(!existsSync(o))throw new Error('source\x20not\x20found:\x20'+b['from']);try{existsSync(p)&&statSync(p)['isDirectory']()&&(p=join(p,basename(o)));}catch{}if(p===o)throw new Error('\x27'+b['action']+'\x27\x20cannot\x20move\x20onto\x20itself');mkdirSync(dirname(p),{'recursive':!![]}),renameSync(o,p),c={'action':b['action'],'from':o,'to':p,'ok':!![]},rescanAffectedPack(b['from']),rescanAffectedPack(b['to']);break;}case'recommend_industry':c=await handleRecommendIndustry(b);break;case'list_modes':c=await handleListModes();break;case'derive_user_mode':c=await handleDeriveUserMode(b);break;case'evolve_user_mode':c=await handleEvolveUserMode(b);break;case'register_user_mode':c=await handleRegisterUserMode(b);break;case'unregister_user_mode':c=await handleUnregisterUserMode(b);break;case'register_custom_metric':c=await handleRegisterCustomMetric(b);break;case'register_custom_constraint':c=await handleRegisterCustomConstraint(b);break;case'list_metrics_constraints':c=await handleListMetricsConstraints(b);break;default:throw new Error('Unknown\x20industry_pack_operation\x20action:\x20'+String(b['action']));}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{strictParse}from'../../schema/index.js';import{IntentRadarInputSchema}from'../../schema/intent-radar/index.js';import{createIntent,listIntents,matchAllIntents,matchIntent,removeIntent}from'../../intent/index.js';import{enrichEventsWithObjectText}from'../../intent/enrich.js';import{query_events}from'@wowok/wowok';const AUTO_PULL_TYPES=['
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{IntentRadarInputSchema}from'../../schema/intent-radar/index.js';import{createIntent,listIntents,matchAllIntents,matchIntent,removeIntent}from'../../intent/index.js';import{enrichEventsWithObjectText}from'../../intent/enrich.js';import{query_events}from'@wowok/wowok';const AUTO_PULL_TYPES=['ServiceEvent','DemandChangedEvent','DemandPresentEvent','NewOrderEvent','ProgressEvent','ArbEvent','VoteEvent','DemandFeedbackEvent','NewEntityEvent','NewPaymentEvent','AllocationEvent','TreasuryEvent','RewardClaimEvent','RewardFundEvent'];async function pullRecentEvents(a,b){const c=[];for(const d of AUTO_PULL_TYPES){try{const e=await query_events({'type':d,'cursor':null,'limit':b,'order':'descending','no_cache':![],'network':a}),f=e?.['data'];if(Array['isArray'](f))c['push'](...f);}catch{}}return c;}export async function handleIntentRadar(a){const b=strictParse(IntentRadarInputSchema,a,'intent_radar\x20input');let c;switch(b['action']){case'save':{const d=await createIntent({'intent':b['intent'],'account':b['account'],'role':b['role'],'target_types':b['target_types']});c={'action':'save','intent':d};break;}case'list':{c={'action':'list','intents':await listIntents(b['account'])};break;}case'remove':{c={'action':'remove','removed':await removeIntent(b['id'])};break;}case'match':{let e=b['events']??[];e['length']===0x0&&(e=await pullRecentEvents(b['network'],b['limit']??0x5));e=await enrichEventsWithObjectText(e,b['network']);const f=b['intent_id']?[await matchIntent(b['intent_id'],e)]['filter'](g=>g!==null):await matchAllIntents(e,b['account']);c={'action':'match','results':f};break;}default:throw new Error('Unknown\x20intent_radar\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{strictParse,MessengerOperationInputSchema}from'../../schema/index.js';import{watch_conversations,send_message,send_file,watch_messages,extract_zip_messages,pull_messages,generate_wts,verify_wts,sign_wts,wts2html,proof_message,mark_messages_as_viewed,mark_conversation_as_viewed,blacklist,friendslist,guardlist,settings}from'@wowok/wowok';import{classifyError,buildDataSemantic}from'../../schema/call/semantic.js';export function normalizeAccountOrMark(a){if(typeof a==='string')return{'name_or_address':a,'local_mark_first':!![]};return a;}export function normalizeManyAccountOrMark(a){if(Array['isArray'](a))return{'entities':a['map'](b=>typeof b==='string'?{'name_or_address':b,'local_mark_first':!![]}:b),'check_all_founded':!![]};return a;}export async function handleMessengerOperation(a){let b;try{b=strictParse(MessengerOperationInputSchema,a,'messenger_operation\x20input');const c=b['operation'];let d;switch(b['operation']){case'watch_conversations':{const e=await watch_conversations(b['filter']);d={'operation':'watch_conversations','result':e};break;}case'send_message':{const f=await send_message(b['from'],normalizeAccountOrMark(b['to']),b['content'],b['options']),g={...f,'merkleData':f['merkleData']?{'leafIndex':f['merkleData']['leafIndex'],'prevRoot':f['merkleData']['prevRoot'],'newRoot':f['merkleData']['newRoot'],'serverSignature':f['merkleData']['serverSignature'],'serverTimestamp':f['merkleData']['serverTimestamp'],'serverPublicKey':f['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_message','result':g};break;}case'send_file':{const h=await send_file(b['from'],normalizeAccountOrMark(b['to']),b['filePath'],b['options']),i={...h,'merkleData':h['merkleData']?{'leafIndex':h['merkleData']['leafIndex'],'prevRoot':h['merkleData']['prevRoot'],'newRoot':h['merkleData']['newRoot'],'serverSignature':h['merkleData']['serverSignature'],'serverTimestamp':h['merkleData']['serverTimestamp'],'serverPublicKey':h['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_file','result':i};break;}case'
|
|
1
|
+
import{strictParse,MessengerOperationInputSchema}from'../../schema/index.js';import{watch_conversations,send_message,send_file,watch_messages,extract_zip_messages,pull_messages,generate_wts,verify_wts,sign_wts,wts2html,proof_message,mark_messages_as_viewed,mark_conversation_as_viewed,blacklist,friendslist,guardlist,settings,LocalInfo}from'@wowok/wowok';import{classifyError,buildDataSemantic}from'../../schema/call/semantic.js';export function normalizeAccountOrMark(a){if(typeof a==='string')return{'name_or_address':a,'local_mark_first':!![]};return a;}export function normalizeManyAccountOrMark(a){if(Array['isArray'](a))return{'entities':a['map'](b=>typeof b==='string'?{'name_or_address':b,'local_mark_first':!![]}:b),'check_all_founded':!![]};return a;}export async function handleMessengerOperation(a){let b;try{b=strictParse(MessengerOperationInputSchema,a,'messenger_operation\x20input');const c=b['operation'];let d;switch(b['operation']){case'watch_conversations':{const e=await watch_conversations(b['filter']);d={'operation':'watch_conversations','result':e};break;}case'send_message':{const f=await send_message(b['from'],normalizeAccountOrMark(b['to']),b['content'],b['options']),g={...f,'merkleData':f['merkleData']?{'leafIndex':f['merkleData']['leafIndex'],'prevRoot':f['merkleData']['prevRoot'],'newRoot':f['merkleData']['newRoot'],'serverSignature':f['merkleData']['serverSignature'],'serverTimestamp':f['merkleData']['serverTimestamp'],'serverPublicKey':f['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_message','result':g};break;}case'send_file':{const h=await send_file(b['from'],normalizeAccountOrMark(b['to']),b['filePath'],b['options']),i={...h,'merkleData':h['merkleData']?{'leafIndex':h['merkleData']['leafIndex'],'prevRoot':h['merkleData']['prevRoot'],'newRoot':h['merkleData']['newRoot'],'serverSignature':h['merkleData']['serverSignature'],'serverTimestamp':h['merkleData']['serverTimestamp'],'serverPublicKey':h['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_file','result':i};break;}case'send_required_info':{let j=b['content'];const k=[];if(!j){const n=await LocalInfo['Instance']()['list'](),o=b['fields'],p=o&&o['length']>0x0?n['filter'](q=>o['includes'](q['name'])):n;if(p['length']===0x0)throw new Error('No\x20LocalInfo\x20fields\x20available.\x20Add\x20private\x20info\x20first\x20via\x20local_info_operation.');j=p['map'](q=>q['name']+':\x20'+q['default'])['join']('\x0a'),k['push'](...p['map'](q=>q['name']));}const l=await send_message(b['from'],normalizeAccountOrMark(b['to']),j,b['options']),m={...l,'merkleData':l['merkleData']?{'leafIndex':l['merkleData']['leafIndex'],'prevRoot':l['merkleData']['prevRoot'],'newRoot':l['merkleData']['newRoot'],'serverSignature':l['merkleData']['serverSignature'],'serverTimestamp':l['merkleData']['serverTimestamp'],'serverPublicKey':l['merkleData']['serverPublicKey']}:undefined,'sent_fields':k};d={'operation':'send_required_info','result':m};break;}case'watch_messages':{const q=b['filter']?{...b['filter'],'peerAddress':b['filter']['peerAddress']?normalizeAccountOrMark(b['filter']['peerAddress']):undefined}:undefined,r=await watch_messages(q);d={'operation':'watch_messages','result':r};break;}case'extract_zip_messages':{const s=await extract_zip_messages(b['account'],b['messages'],b['outputDir']);d={'operation':'extract_zip_messages','result':s};break;}case'generate_wts':{const t=b['params']?{...b['params'],'peerAccount':normalizeAccountOrMark(b['params']['peerAccount'])}:undefined,u=await generate_wts(t);d={'operation':'generate_wts','result':u};break;}case'verify_wts':{const v=await verify_wts(b['wtsFilePath']);d={'operation':'verify_wts','result':v};break;}case'sign_wts':{const w=await sign_wts(b['wtsFilePath'],b['account'],b['outputPath']);d={'operation':'sign_wts','result':w};break;}case'wts2html':{const x=await wts2html(b['wtsPath'],b['options']);d={'operation':'wts2html','result':x};break;}case'proof_message':{const y=await proof_message(b['account'],b['messageId'],b['network']);d={'operation':'proof_message','result':y};break;}case'blacklist':{const z={'account':b['account'],'op':b['blacklist']['op']};'users'in b['blacklist']&&(z['users']=normalizeManyAccountOrMark(b['blacklist']['users']));const A=await blacklist(z);d={'operation':'blacklist','op':b['blacklist']['op'],'result':A['result']};break;}case'friendslist':{const B={'account':b['account'],'op':b['friendslist']['op']};'users'in b['friendslist']&&(B['users']=normalizeManyAccountOrMark(b['friendslist']['users']));const C=await friendslist(B);d={'operation':'friendslist','op':b['friendslist']['op'],'result':C['result']};break;}case'guardlist':{const D=await guardlist({'account':b['account'],...b['guardlist']});d={'operation':'guardlist','op':b['guardlist']['op'],'result':D['result']};break;}case'settings':{const E=await settings({'account':b['account'],...b['settings']});d={'operation':'settings','op':b['settings']['op'],'result':E['result']};break;}case'mark_messages_as_viewed':{const F=await mark_messages_as_viewed(b['messageIds'],b['account']);d={'operation':'mark_messages_as_viewed','result':F};break;}case'mark_conversation_as_viewed':{const G=await mark_conversation_as_viewed(normalizeAccountOrMark(b['peerAddress']),b['account']);d={'operation':'mark_conversation_as_viewed','result':G};break;}case'pull_messages':{const H=await pull_messages(b['account'],b['limit']);d={'operation':'pull_messages','result':H};break;}default:throw new Error('Unknown\x20messenger\x20operation:\x20'+c);}return{'content':[{'type':'text','text':JSON['stringify'](d)}],'structuredContent':{'result':d}};}catch(I){const J=I instanceof Error?I['message']:String(I),K=b?{'operation_type':'messenger_'+b['operation'],'data':b}:undefined,L=classifyError(J),M={'operation':'error','error':J};if(L['error_code']!==undefined)M['error_code']=L['error_code'];if(L['retryable']!==undefined)M['retryable']=L['retryable'];if(L['recovery_hint']!==undefined)M['recovery_hint']=L['recovery_hint'];return{'content':[{'type':'text','text':'Error:\x20'+J}],'structuredContent':{'result':M,'semantic':buildDataSemantic(undefined,K,!![],J)}};}}
|