@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import { type ContextCollectionResult } from "
|
|
4
|
-
type ValidatedInput =
|
|
1
|
+
import type { ObjectBase } from "@wowok/wowok";
|
|
2
|
+
import type { AssembleContextInput } from "../../schema/query/bi.js";
|
|
3
|
+
import { type ContextCollectionResult } from "../../loop-engineering/context-collect.js";
|
|
4
|
+
type ValidatedInput = AssembleContextInput;
|
|
5
5
|
export interface DependencyEdge {
|
|
6
6
|
object: string;
|
|
7
7
|
depth: number;
|
|
@@ -22,4 +22,9 @@ export interface AssembleContextResult {
|
|
|
22
22
|
flywheel_collected?: ContextCollectionResult;
|
|
23
23
|
}
|
|
24
24
|
export declare function assembleContext(validated: ValidatedInput): Promise<AssembleContextResult>;
|
|
25
|
+
export declare function extractAddressFields(obj: ObjectBase): Array<{
|
|
26
|
+
address: string;
|
|
27
|
+
field: string;
|
|
28
|
+
type: string;
|
|
29
|
+
}>;
|
|
25
30
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHash}from'crypto';import{query_objects,query_events}from'@wowok/wowok';import{annotateEventsMonetaryFields}from'../../knowledge/fund-layer.js';import{buildDataSemantic}from'../../schema/call/semantic.js';import{collectContextExperience}from'../../loop-engineering/context-collect.js';const STATE_TRANSITION_EVENTS=['NewOrderEvent','ProgressEvent','ArbEvent','DemandPresentEvent','DemandFeedbackEvent','NewEntityEvent'],MAX_OBJECTS_PER_QUERY=0x32;export async function assembleContext(a){const b=a['context_objects'];if(!b||b['length']===0x0)throw new Error('assemble_context\x20requires\x20\x27context_objects\x27\x20—\x20an\x20array\x20of\x20object\x20IDs\x20or\x20LocalMark\x20names.');const c=a['context_network']??'testnet',d=a['include_events']??![],e=Math['max'](0x0,Math['min'](0x5,a['context_depth']??0x0)),g=a['context_include']?.['length']?new Set(a['context_include']):null,h=await query_objects({'objects':b,'no_cache':![],'network':c}),k=h?.['objects']??[],l=[],m=[];if(e>0x0){const A=new Set();for(const C of k){const D=C?.['object'];if(typeof D==='string')A['add'](D);}let B=[];for(const E of k){const F=safeExtractAddressFields(E);for(const G of F){if(g&&!g['has'](G['field']))continue;if(A['has'](G['address']))continue;B['push']({'id':G['address'],'parent':E?.['object']??'','viaField':G['field'],'viaType':G['type'],'depth':0x1});}}for(let H=0x1;H<=e&&B['length']>0x0;H++){const I=new Set(),J=[];for(const L of B){if(A['has'](L['id'])||I['has'](L['id']))continue;I['add'](L['id']),A['add'](L['id']),J['push'](L);}if(J['length']===0x0)break;const K=[];for(let M=0x0;M<J['length'];M+=MAX_OBJECTS_PER_QUERY){const N=J['slice'](M,M+MAX_OBJECTS_PER_QUERY);let O;try{O=await query_objects({'objects':N['map'](Q=>Q['id']),'no_cache':![],'network':c});}catch{continue;}const P=O?.['objects']??[];for(let Q=0x0;Q<N['length'];Q++){const R=N[Q],S=P[Q];if(!S)continue;l['push']({'object':R['id'],'depth':R['depth'],'via_field':R['viaField'],'via_type':R['viaType'],'parent':R['parent']}),m['push'](S);if(H<e){const T=safeExtractAddressFields(S);for(const U of T){if(g&&!g['has'](U['field']))continue;if(A['has'](U['address']))continue;K['push']({'id':U['address'],'parent':R['id'],'viaField':U['field'],'viaType':U['type'],'depth':H+0x1});}}}}B=K;}}const n=[...k,...m],p=extractEmbeddedHistory(n),q=Object['keys'](p)['length']>0x0;let s;if(d){s=[];for(const V of STATE_TRANSITION_EVENTS){try{const W=await query_events({'type':V,'limit':0x5,'order':'descending','network':c});W?.['data']&&W['data']['length']>0x0&&s['push'](...W['data']);}catch{}}if(s['length']===0x0)s=undefined;else try{await annotateEventsMonetaryFields(s,c);}catch{}}const t={'operation_type':'assemble_context','data':{'context_objects':k,'embedded_history':p,'events':s}},u=buildDataSemantic({'objects':k,'embedded_history':p,'events':s},t),v=k['map'](X=>(X?.['object']??X?.['data']?.['object']??'?')+':'+(X?.['version']??X?.['data']?.['version']??'?'));m['length']>0x0&&v['push']('deps:'+m['map'](X=>(X?.['object']??'?')+':'+(X?.['version']??'?'))['join'](','));v['push']('ts:'+Date['now']());const w=createHash('sha256')['update'](v['join']('|'))['digest']('hex')['substring'](0x0,0x10),x=l['length']>0x0,y=x?'Context\x20assembled\x20with\x20'+l['length']+'\x20dependency\x20object(s)\x20across\x20'+e+'\x20level(s).\x20'+'Use\x20onchain_transaction\x20with\x20a\x20specific\x20digest\x20to\x20verify\x20a\x20past\x20operation,\x20'+'or\x20proceed\x20with\x20onchain_operations\x20(consider\x20dry_run=true\x20first\x20to\x20validate).':q?'Context\x20assembled\x20with\x20embedded\x20operation\x20history.\x20Use\x20onchain_transaction\x20with\x20a\x20specific\x20digest\x20to\x20verify\x20a\x20past\x20operation,\x20or\x20proceed\x20with\x20onchain_operations\x20(consider\x20dry_run=true\x20first\x20to\x20validate).':s&&s['length']>0x0?'Context\x20assembled\x20with\x20recent\x20events.\x20Use\x20onchain_transaction\x20with\x20a\x20specific\x20digest\x20to\x20verify\x20any\x20event\x27s\x20tx,\x20or\x20proceed\x20with\x20onchain_operations.':'Context\x20assembled\x20(current\x20state\x20only).\x20Proceed\x20with\x20onchain_operations\x20(consider\x20dry_run=true\x20first\x20to\x20validate).';let z;try{z=collectContextExperience({'action':'assemble_context','objects':k,'events':s,'embedded_history':q?p:undefined,'semantic_summary':u,'context_digest':w,'next_action':y},c);}catch{}return{'action':'assemble_context','objects':k,'events':s,'embedded_history':q?p:undefined,'dependencies':x?l:undefined,'dependency_objects':x?m:undefined,'semantic_summary':u,'context_digest':w,'next_action':y,'flywheel_collected':z};}export function extractAddressFields(a){const b=[],c=a['type'];let d=c;if(c&&c['includes']('::')){const k=c['split']('::');d=k[k['length']-0x1];}const e=l=>typeof l==='string'&&l['startsWith']('0x')&&l['length']>=0xa,f=(l,m,n)=>{e(l)&&l!=='0x0'&&l!==a['object']&&b['push']({'address':l,'field':m,'type':n});},h=(l,m,n)=>{if(Array['isArray'](l))for(const o of l){f(o,m,n);}},i=(l,m,n)=>{l!==null&&l!==undefined&&f(l,m,n);},j=a;switch(d){case'Service':{i(j['machine'],'machine','bind'),i(j['buy_guard'],'buy_guard','validate'),i(j['um'],'um','bind'),f(j['permission'],'permission','validate'),h(j['repositories'],'repositories','consume'),h(j['arbitrations'],'arbitrations','trigger'),h(j['rewards'],'rewards','trigger');if(j['order_allocators']?.['allocators']){for(const m of j['order_allocators']['allocators']){f(m['guard'],'allocator_guard','validate');}const l=j['order_allocators']['allocators'][0x0]?.['guard'];f(l,'order_allocators','create');}break;}case'Machine':{f(j['permission'],'permission','validate'),h(j['consensus_repositories'],'consensus_repositories','consume');break;}case'Order':{f(j['service'],'service','consume'),i(j['machine'],'machine','consume'),i(j['progress'],'progress','trigger'),h(j['dispute'],'dispute','trigger'),i(j['allocation'],'allocation','bind');break;}case'Progress':{f(j['machine'],'machine','bind'),h(j['context_repositories'],'context_repositories','consume');break;}case'Treasury':{f(j['permission'],'permission','validate');if(Array['isArray'](j['external_deposit_guard'])){for(const n of j['external_deposit_guard'])f(n?.['guard'],'external_deposit_guard','validate');}if(Array['isArray'](j['external_withdraw_guard'])){for(const o of j['external_withdraw_guard'])f(o?.['guard'],'external_withdraw_guard','validate');}break;}case'Allocation':{if(Array['isArray'](j['allocators'])){for(const p of j['allocators'])f(p?.['guard'],'allocator_guard','validate');}i(j['payment_info']?.['for_object'],'for_object','bind'),i(j['payment_info']?.['for_guard'],'for_guard','validate'),h(j['payment'],'payment','trigger');break;}case'Arbitration':{f(j['permission'],'permission','validate');if(Array['isArray'](j['voting_guard'])){for(const q of j['voting_guard'])f(q?.['guard'],'voting_guard','validate');}i(j['usage_guard'],'usage_guard','validate');break;}case'Reward':{f(j['permission'],'permission','validate');if(Array['isArray'](j['guards'])){for(const s of j['guards'])f(s?.['guard'],'guard','validate');}break;}case'Repository':{f(j['permission'],'permission','validate'),h(j['rewards'],'rewards','trigger');if(Array['isArray'](j['policies']))for(const t of j['policies']){if(Array['isArray'](t?.['write_guard'])){for(const u of t['write_guard'])f(u?.['guard'],'write_guard','validate');}i(t?.['quote_guard'],'quote_guard','validate');}break;}case'Demand':{f(j['permission'],'permission','validate');if(Array['isArray'](j['guards'])){for(const v of j['guards'])f(v?.['guard'],'guard','validate');}h(j['rewards'],'rewards','trigger');break;}case'Contact':{f(j['permission'],'permission','validate');break;}case'Permission':{break;}case'Payment':{i(j['info']?.['for_object'],'for_object','bind'),i(j['info']?.['for_guard'],'for_guard','validate');if(Array['isArray'](j['record']))for(const w of j['record']){const x=w?.['recipient'];x&&typeof x==='object'&&typeof x['Entity']==='string'&&f(x['Entity'],'recipient_entity','consume');}break;}case'Guard':{break;}default:break;}return b;}function safeExtractAddressFields(a){if(!a||typeof a!=='object')return[];try{return extractAddressFields(a);}catch{return[];}}function extractEmbeddedHistory(a){const b={};for(const c of a){const d=c?.['data']??c,e=c?.['object']??d?.['object'];if(!e)continue;const f=d?.['type']??'',g={};f['includes']('Progress')&&d?.['session']?.['forwards']&&(g['operation_history']=d['session']['forwards']['map'](h=>({'operation':h['forward'],'operator':h['who'],'accomplished':h['accomplished'],'time':h['time'],'message':h['msg']})),g['next_node']=d['session']?.['next_node'],g['threshold']=d['session']?.['threshold']),f['includes']('Order')&&(d?.['dispute']&&Array['isArray'](d['dispute'])&&d['dispute']['length']>0x0&&(g['disputes']=d['dispute']),d?.['claimed_by']&&(g['claimed_by']=d['claimed_by']),d?.['progress']&&(g['progress_object']=d['progress'])),f['includes']('Service')&&d?.['sales']&&(g['sale_count']=Array['isArray'](d['sales'])?d['sales']['length']:0x0),Object['keys'](g)['length']>0x0&&(b[e]=g);}return b;}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SemanticObjectGraph } from "./semantic-graph.js";
|
|
2
2
|
import type { BusinessIntent } from "./intent-analyzer.js";
|
|
3
|
-
import type { BusinessModuleId } from "
|
|
3
|
+
import type { BusinessModuleId } from "../../extensions/business-modules.js";
|
|
4
4
|
export type GameScenario = "merchant_may_deliver_late" | "merchant_may_abandon" | "customer_may_deny_acceptance" | "customer_may_false_claim" | "supplier_may_not_deliver";
|
|
5
5
|
export interface GameTheoryConstraint {
|
|
6
6
|
scenario: GameScenario;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface StageCacheEntry {
|
|
2
|
+
stage: string;
|
|
3
|
+
updated_at: number;
|
|
4
|
+
puzzles?: Record<string, unknown>;
|
|
5
|
+
risk_status?: string;
|
|
6
|
+
risk_can_proceed?: boolean;
|
|
7
|
+
trace_coherent?: boolean;
|
|
8
|
+
trace_can_proceed?: boolean;
|
|
9
|
+
business_intent?: string;
|
|
10
|
+
industry?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getStageCache(prefix: string, version: string): StageCacheEntry | undefined;
|
|
13
|
+
export declare function updateStageCache(prefix: string, version: string, update: Partial<StageCacheEntry>): StageCacheEntry;
|
|
14
|
+
export declare const SERVICE_BUILD_CACHE_VERSION = 1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ensureServiceBuildProcess,openServiceBuildProcessDir,SERVICE_BUILD_STAGES}from'./process.js';import{loadManifest,loadStageState,saveStageState}from'../../task/ProcessStore.js';const STAGE_CACHE=new Map();function stageCacheKey(a,b){return a+':'+b;}export function getStageCache(a,b){const c=stageCacheKey(a,b),d=STAGE_CACHE['get'](c);if(d)return d;const e=openServiceBuildProcessDir(a,b),f=loadStageState(e);if(f){const g={'stage':SERVICE_BUILD_STAGES['includes'](f['current_stage'])?f['current_stage']:SERVICE_BUILD_STAGES[0x0],'updated_at':f['updated_at']};return STAGE_CACHE['set'](c,g),g;}return undefined;}export function updateStageCache(a,b,c){const d=stageCacheKey(a,b),e=STAGE_CACHE['get'](d),f={'stage':c['stage']??e?.['stage']??SERVICE_BUILD_STAGES[0x0],'updated_at':Date['now'](),...e,...c};return STAGE_CACHE['set'](d,f),persistStageState(a,b,f),f;}function persistStageState(a,b,c){try{const d=ensureServiceBuildProcess(a,b,'service-build-v'+SERVICE_BUILD_CACHE_VERSION),e=loadManifest(d);if(e['archived'])return;const f=loadStageState(d);if(!f)return;f['current_stage']=SERVICE_BUILD_STAGES['includes'](c['stage'])?c['stage']:SERVICE_BUILD_STAGES[0x0],f['updated_at']=c['updated_at'],saveStageState(d,f);}catch{}}export const SERVICE_BUILD_CACHE_VERSION=0x1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IndustryTraits } from "
|
|
1
|
+
import type { IndustryTraits } from "../../knowledge/industry-registry.js";
|
|
2
2
|
export type BusinessIntentType = "sell_service" | "sell_product" | "sell_subscription" | "rent_asset" | "crowdfund" | "escrow";
|
|
3
3
|
export interface RoleDefinition {
|
|
4
4
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findSimilarIndustries,inferTraitsFromDescription}from'../../knowledge/industry-generalizer.js';const INTENT_KEYWORDS={'sell_service':['design','develop','consult','freelance','service','build','create','write','translate'],'sell_product':['sell','product','item','goods','merchandise','store','shop'],'sell_subscription':['subscribe','subscription','membership','monthly','recurring','creator','patron'],'rent_asset':['rent','rental','lease','borrow','car','house','apartment','equipment'],'crowdfund':['crowdfund','fund','raise','campaign','donation','backer'],'escrow':['escrow','hold','mediate','intermediary','safe','secure\x20transaction']};function classifyIntentType(a){const b=a['toLowerCase']();let c='sell_service',d=0x0;for(const [e,f]of Object['entries'](INTENT_KEYWORDS)){const g=f['filter'](h=>b['includes'](h))['length'];g>d&&(d=g,c=e);}return c;}function inferPaymentModel(a){const b=a['toLowerCase']();if(b['includes']('milestone')||b['includes']('phase')||b['includes']('stage'))return'milestone';if(b['includes']('subscription')||b['includes']('monthly')||b['includes']('recurring'))return'subscription';if(b['includes']('per\x20use')||b['includes']('hourly')||b['includes']('per\x20session'))return'per_use';if(b['includes']('escrow')||b['includes']('hold'))return'escrow';return'upfront';}function inferRefundPolicy(a){const b=a['toLowerCase']();if(b['includes']('no\x20refund')||b['includes']('non-refundable'))return'no_refund';if(b['includes']('milestone')&&b['includes']('refund'))return'milestone_prorated';if(b['includes']('full\x20refund'))return'full';return'partial';}function inferArbitration(a){const b=a['toLowerCase']();if(b['includes']('no\x20arbitration')||b['includes']('no\x20dispute'))return'none';if(b['includes']('third\x20party')||b['includes']('independent'))return'third_party';if(b['includes']('mutual'))return'mutual_pick';return'merchant_pick';}export async function analyzeIntent(a,b){const c=[],d=classifyIntentType(a),e=inferTraitsFromDescription(a),f=findSimilarIndustries(e['traits'],0x3),g=f['map'](n=>n['industry']),h=b?.['preferredIndustry']??g[0x0]??'general',i=g['includes'](h)?0.85:0.5,j=e['traits'],k={'intent':d,'industry':h,'description':a,'roles':{'merchant':{'name':'merchant','description':'Service\x20provider\x20or\x20seller','obligations':['Deliver\x20as\x20described','Maintain\x20compensation_fund\x20if\x20required','Accept\x20arbitration\x20verdicts'],'rights':['Receive\x20payment\x20upon\x20verified\x20delivery','Set\x20service\x20terms\x20before\x20publish']},'customer':{'name':'customer','description':'Buyer\x20or\x20service\x20recipient','obligations':['Pay\x20according\x20to\x20agreed\x20schedule','Provide\x20acceptance/rejection\x20within\x20timeout'],'rights':['Receive\x20deliverables\x20as\x20described','Request\x20refund\x20if\x20delivery\x20fails','Initiate\x20arbitration\x20for\x20disputes']}},'deliverables':[{'name':'main_deliverable','type':inferDeliverableType(a),'acceptanceCriteria':'To\x20be\x20defined\x20by\x20merchant\x20during\x20configuration','proofOfDelivery':'wip_hash'}],'payment':{'model':inferPaymentModel(a),'currency':b?.['currency']??'WOW','triggers':[{'event':inferPaymentModel(a)==='milestone'?'milestone\x20completion':'service\x20confirmation','guardDescription':'Guard\x20verifies\x20deliverable\x20meets\x20acceptance\x20criteria'}],'allocation':[{'recipient':'merchant','percentage':0x5a},{'recipient':'platform','percentage':0x0},{'recipient':'arbitration_reserve','percentage':0xa}]},'trust':{'refundPolicy':inferRefundPolicy(a),'arbitration':inferArbitration(a),'escrow':!![],'transparency':'full'}};k['payment']['model']==='milestone'&&!a['toLowerCase']()['includes']('milestone')&&c['push']('Payment\x20model\x20inferred\x20as\x20\x27milestone\x27\x20but\x20not\x20explicitly\x20mentioned.\x20Please\x20verify.');k['trust']['arbitration']==='none'&&c['push']('No\x20arbitration\x20configured.\x20This\x20increases\x20risk\x20for\x20both\x20parties.\x20Consider\x20adding\x20independent_arbitration\x20module.');k['payment']['allocation']&&k['payment']['allocation']['some'](n=>n['recipient']==='platform'&&n['percentage']>0x0)&&c['push']('Platform\x20fee\x20>\x200\x20detected.\x20WOW\x20philosophy\x20recommends\x200%\x20platform\x20fee\x20for\x20peer-to-peer\x20transactions.');const l=a['toLowerCase']();/(refund|cancel|dispute)/['test'](l)&&k['payment']['model']==='milestone'&&c['push']('T1\x20B-1:\x20\x27refund/dispute\x27\x20must\x20be\x20modeled\x20via\x20the\x20Allocation\x20waterfall\x20(order_allocators)\x20+\x20'+'the\x20bound\x20Arbitration\x20—\x20NOT\x20a\x20Machine\x20\x27refunded\x27/\x27disputed\x27\x20node\x20(R-M1-11).');/(按(实际|定损|损失|评估)[^。]{0,8}(金额|赔付|赔偿)|variable amount|dynamic amount|actual loss|assessed loss)/['test'](l)&&c['push']('T1\x20B-2:\x20a\x20variable/conditional\x20payout\x20amount\x20cannot\x20be\x20expressed\x20in\x20Allocation\x20—\x20amounts\x20are\x20'+'pre-configured.\x20Use\x20fixed\x20tiers\x20guarded\x20by\x20distinct\x20Guards,\x20or\x20an\x20Amount\x20with\x20a\x20max\x20cap.');/(auto|automatic|automatically|after \d+ (day|hour|week)|within \d+ (day|hour|week)|自动|到期后)/['test'](l)&&c['push']('T1\x20B-3:\x20\x27auto\x20/\x20after\x20N\x20days\x27\x20has\x20no\x20on-chain\x20cron\x20—\x20it\x20requires\x20a\x20time_guard\x20PLUS\x20an\x20off-chain\x20'+'keeper\x20to\x20submit.\x20Configuring\x20a\x20time_guard\x20without\x20a\x20keeper\x20means\x20nothing\x20ever\x20fires.');let m=[];try{const {recommendModules:n}=await import('../../extensions/business-modules.js'),o=n(h,a,{'maxModules':0x5});m=o['map'](p=>p['id']);}catch{m=['milestone_escrow','independent_arbitration','wip_provenance'];}return{'intent':k,'inferredIndustry':h,'industryConfidence':i,'similarIndustries':g,'inferredTraits':j,'recommendedModules':m,'warnings':c};}function inferDeliverableType(a){const b=a['toLowerCase']();if(b['includes']('design')||b['includes']('code')||b['includes']('write')||b['includes']('digital'))return'digital';if(b['includes']('class')||b['includes']('lesson')||b['includes']('session'))return'service_session';if(b['includes']('rent')||b['includes']('access'))return'access_right';return'physical';}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ENTRYPOINT, TableItem_MachineNode } from "@wowok/wowok";
|
|
2
|
+
export declare function fetchMachineNodes(machineAddress: string, network: ENTRYPOINT): Promise<TableItem_MachineNode[]>;
|
|
3
|
+
export interface MachineGraphForward {
|
|
4
|
+
name: string;
|
|
5
|
+
weight: number;
|
|
6
|
+
guard: string | null;
|
|
7
|
+
retained_submission: number[] | null;
|
|
8
|
+
named_operator: string | null;
|
|
9
|
+
permission_index: number | null;
|
|
10
|
+
}
|
|
11
|
+
export interface MachineGraphEdge {
|
|
12
|
+
from: string;
|
|
13
|
+
to: string;
|
|
14
|
+
threshold: number;
|
|
15
|
+
forwards: MachineGraphForward[];
|
|
16
|
+
}
|
|
17
|
+
export interface MachineGraphNode {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare function normalizeForwards(raw: unknown): MachineGraphForward[];
|
|
22
|
+
export declare function buildMachineGraph(rawNodes: TableItem_MachineNode[]): {
|
|
23
|
+
nodes: MachineGraphNode[];
|
|
24
|
+
edges: MachineGraphEdge[];
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{query_objects,query_table}from'@wowok/wowok';const BATCH=0x32;export async function fetchMachineNodes(a,b){const c=[];let d=undefined;for(;;){const f=await query_table({'parent':a,'cursor':d??undefined,'network':b});if(!f?.['items']||f['items']['length']===0x0)break;for(const g of f['items']){if(g['object'])c['push'](g['object']);}if(!f['hasNextPage']||!f['nextCursor'])break;d=f['nextCursor'];}const e=[];for(let h=0x0;h<c['length'];h+=BATCH){const j=c['slice'](h,h+BATCH),k=await query_objects({'objects':j,'network':b});for(const l of k?.['objects']??[]){l['type']==='TableItem_MachineNode'&&e['push'](l);}}return e;}export function normalizeForwards(a){if(!Array['isArray'](a))return[];return a['map'](b=>{const c=b?.['guard'],d=c&&typeof c==='object'&&typeof c['guard']==='string';return{'name':typeof b?.['name']==='string'?b['name']:'','weight':typeof b?.['weight']==='number'?b['weight']:0x0,'guard':d?c['guard']:typeof c==='string'?c:null,'retained_submission':d&&Array['isArray'](c['retained_submission'])?c['retained_submission']:null,'named_operator':typeof b?.['namedOperator']==='string'?b['namedOperator']:null,'permission_index':typeof b?.['permissionIndex']==='number'?b['permissionIndex']:null};});}export function buildMachineGraph(a){const b=new Map(),c=[];for(const d of a){const e=d['name'];if(!e)continue;!b['has'](e)&&b['set'](e,{'name':e,'description':null});const f=Array['isArray'](d['value'])?d['value']:[];for(const g of f){if(!g||typeof g!=='object')continue;const h=typeof g['prev_node']==='string'?g['prev_node']:'';if(!h)continue;c['push']({'from':h,'to':e,'threshold':typeof g['threshold']==='number'?g['threshold']:0x1,'forwards':normalizeForwards(g['forwards'])});}}for(const i of c){!b['has'](i['from'])&&b['set'](i['from'],{'name':i['from'],'description':null}),!b['has'](i['to'])&&b['set'](i['to'],{'name':i['to'],'description':null});}return{'nodes':Array['from'](b['values']()),'edges':c};}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { MachinePanoramaInput } from "../../schema/query/bi.js";
|
|
2
|
+
import { type MachineGraphNode, type MachineGraphEdge } from "./machine-nodes.js";
|
|
3
|
+
type ProjectInput = MachinePanoramaInput;
|
|
4
|
+
export interface MachinePanoramaResult {
|
|
5
|
+
action: "machine_panorama";
|
|
6
|
+
machineAddress: string;
|
|
7
|
+
network: string;
|
|
8
|
+
head: {
|
|
9
|
+
name: string | null;
|
|
10
|
+
tags: string[];
|
|
11
|
+
description: string | null;
|
|
12
|
+
published: boolean | null;
|
|
13
|
+
paused: boolean | null;
|
|
14
|
+
};
|
|
15
|
+
fields: {
|
|
16
|
+
permission: string | null;
|
|
17
|
+
um: string | null;
|
|
18
|
+
node_count: number | null;
|
|
19
|
+
consensus_repositories: string[];
|
|
20
|
+
};
|
|
21
|
+
graph: {
|
|
22
|
+
nodes: MachineGraphNode[];
|
|
23
|
+
edges: MachineGraphEdge[];
|
|
24
|
+
};
|
|
25
|
+
progresses: {
|
|
26
|
+
count: number;
|
|
27
|
+
items: {
|
|
28
|
+
progress: string;
|
|
29
|
+
name: string | null;
|
|
30
|
+
current: string | null;
|
|
31
|
+
task: string | null;
|
|
32
|
+
history_count: number | null;
|
|
33
|
+
current_time: number | null;
|
|
34
|
+
created_at: number | null;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
related: {
|
|
38
|
+
count: number;
|
|
39
|
+
};
|
|
40
|
+
data_gaps: string[];
|
|
41
|
+
}
|
|
42
|
+
export declare function handleMachinePanorama(v: ProjectInput): Promise<MachinePanoramaResult>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Config,LocalMark,query_objects,queryTableItem_ObjectLinkerTx,objectTypeFromAddress,ObjectType}from'@wowok/wowok';import{fetchMachineNodes,buildMachineGraph}from'./machine-nodes.js';export async function handleMachinePanorama(a){const b=a['object_address'];if(!b)throw new Error('\x27object_address\x27\x20is\x20required\x20for\x20machine_panorama');let c=a['context_network']??undefined;const d=[];let f=b;if(!/^0x[0-9a-fA-F]{32,64}$/['test'](b)){const p=await LocalMark['Instance']()['get_address'](b);if(!p)throw new Error('Cannot\x20resolve\x20machine\x20\x27'+b+'\x27\x20—\x20not\x20a\x20valid\x20address\x20and\x20no\x20LocalMark\x20entry\x20found.\x20'+'Pass\x20the\x200x\x20Machine\x20object\x20address\x20directly\x20or\x20register\x20the\x20name\x20via\x20local_mark_operation.');f=p;}let g=null;try{if(!c)c=await Config['Instance']()['network_get']();const q=await query_objects({'objects':[f],'network':c});g=q?.['objects']?.[0x0]??null;if(!g&&a['context_network']){const s=await Config['Instance']()['network_get']();if(s&&s!==c){const t=await query_objects({'objects':[f],'network':s,'no_cache':!![]}),u=t?.['objects']?.[0x0]??null;u&&(g=u,c=s);}}}catch(w){throw new Error('Failed\x20to\x20query\x20Machine\x20'+f+'\x20on\x20'+c+':\x20'+(''+(w instanceof Error?w['message']:String(w))));}if(!g)throw new Error('Machine\x20'+f+'\x20not\x20found\x20on\x20'+c+'.\x20It\x20may\x20not\x20exist\x20on\x20this\x20network.');f=g['object']??f;let h=null,j=[];try{const x=await LocalMark['Instance']()['list']({'address':f});x['length']>0x0&&(h=x[0x0]['name']??null,j=(x[0x0]['tags']??[])['map'](y=>String(y)));}catch{d['push']('head:\x20LocalMark\x20lookup\x20failed');}let k={'nodes':[],'edges':[]};try{const y=await fetchMachineNodes(f,c);k=buildMachineGraph(y);}catch{d['push']('graph:\x20node\x20fetch\x20failed\x20(non-blocking)');}const l=[];let m=0x0,n=0x0;try{const z=await queryTableItem_ObjectLinkerTx({'address':f,'no_cache':!![],'network':c}),A=z?.['items']??[],B=new Set();for(const G of A){const H=typeof G?.['who']==='string'?G['who']['toLowerCase']():'';if(!H||H==='0x0')continue;if(!objectTypeFromAddress(H))continue;B['add'](H);}n=B['size'];const C=A['filter'](I=>objectTypeFromAddress(I['who'])===ObjectType['Progress']);m=C['length'];const D=C['slice'](-0x32)['reverse'](),E=D['map'](I=>I['who']),F=new Map();if(E['length']>0x0)try{const I=await query_objects({'objects':E,'network':c});for(const J of I?.['objects']??[]){if(J?.['object'])F['set'](J['object'],J);}}catch{d['push']('progresses:\x20detail\x20fetch\x20failed');}for(const K of D){const L=typeof K?.['who']==='string'?K['who']:'';if(!L)continue;const M=F['get'](L);l['push']({'progress':L,'name':null,'current':M?.['current']??null,'task':M?.['task']??null,'history_count':typeof M?.['history_count']==='number'?M['history_count']:null,'current_time':typeof M?.['current_time']==='number'?M['current_time']:null,'created_at':typeof K?.['time']==='number'?K['time']:null});}}catch{d['push']('progresses:\x20global-table\x20lookup\x20failed\x20(non-blocking)');}return{'action':'machine_panorama','machineAddress':f,'network':String(c),'head':{'name':h,'tags':j,'description':typeof g['description']==='string'?g['description']:null,'published':typeof g['bPublished']==='boolean'?g['bPublished']:null,'paused':typeof g['bPaused']==='boolean'?g['bPaused']:null},'fields':{'permission':g['permission']??null,'um':g['um']??null,'node_count':typeof g['node_count']==='number'?g['node_count']:null,'consensus_repositories':Array['isArray'](g['consensus_repositories'])?g['consensus_repositories']:[]},'graph':k,'progresses':{'count':m,'items':l},'related':{'count':n},'data_gaps':d};}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BusinessIntent, type DeliverableDefinition, type PaymentIntent, type TrustIntent } from "./intent-analyzer.js";
|
|
2
|
-
import { type BusinessModuleId } from "
|
|
2
|
+
import { type BusinessModuleId } from "../../extensions/business-modules.js";
|
|
3
3
|
export interface GuideState {
|
|
4
4
|
intent_text: string;
|
|
5
5
|
confirmed_industry?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{analyzeIntent}from'./intent-analyzer.js';import{buildSemanticGraph,validateGraph}from'./semantic-graph.js';import{checkGameTheoryConstraints}from'./game-theory.js';import{assessWorkflowDesign}from'./workflow-design-assessment.js';import{CORE_BUSINESS_MODULES,getBusinessModule,recommendModules,checkModuleConstraints}from'../../extensions/business-modules.js';function derivePlanSatisfiedConstraints(a,b){const c=new Set(),d=h=>a['edges']['some'](i=>i['relation']===h),e=h=>a['nodes']['some'](i=>i['id']===h),f=h=>a['nodes']['some'](i=>i['type']===h),g=h=>a['adoptedModules']['includes'](h);if(d('has_order_allocators'))c['add']('order_allocators_bound');if(d('uses_machine'))c['add']('machine_bound_before_publish');if(d('has_arbitration'))c['add']('arbitration_bound_to_service');if(e('main_machine'))c['add']('machine_published');if(e('main_repository'))c['add']('repository_published');if(e('main_service'))c['add']('service_published');e('arb_permission')&&e('main_permission')&&c['add']('arbitration_permission_independent');g('independent_arbitration')&&e('guard_independent_arbitration')&&c['add']('voting_guard_configured');g('accept_timeout_protection')&&(c['add']('time_guard_configured'),c['add']('adminUnhold_permission'));g('milestone_escrow')&&f('guard')&&c['add']('milestone_forward_guarded');if(e('main_allocation')&&b['payment']['allocation']&&b['payment']['allocation']['length']>0x0){c['add']('allocators_configured');const h=b['payment']['allocation']['reduce']((j,k)=>j+k['percentage'],0x0);if(Math['abs'](h-0x64)<0.001)c['add']('sharing_sum_100');const i=b['payment']['allocation']['find'](j=>j['recipient']==='platform');if(i&&i['percentage']===0x0)c['add']('platform_fee_zero');g('supplier_collaboration')&&(c['add']('allocation_sharing_configured'),c['add']('demand_configured'));}return g('wip_provenance')&&e('main_repository')&&c['add']('wip_hash_before_delivery'),g('subscription_with_proof')&&e('main_repository')&&(c['add']('delivery_guard_per_cycle'),c['add']('repository_updated')),g('damage_attestation')&&(c['add']('pre_rental_hash'),c['add']('post_rental_hash')),g('refund_guarantee')&&(c['add']('compensation_fund_positive'),c['add']('refund_guard_configured')),c;}function deriveDeployTimeChecks(a){const b=[];return a['nodes']['some'](c=>c['id']==='main_machine')&&b['push']('Machine\x20published\x20AND\x20bound\x20to\x20Service\x20BEFORE\x20Service.publish\x20(machine\x20is\x20immutable\x20after\x20publish)'),a['edges']['some'](c=>c['relation']==='has_order_allocators')&&b['push']('Service.order_allocators\x20bound\x20(verify\x20via\x20query_objects\x20after\x20publish\x20—\x20order_allocators\x20is\x20FROZEN\x20at\x20publish)'),a['nodes']['some'](c=>c['id']==='main_arbitration')&&b['push']('Arbitration.permission\x20!=\x20Service.permission\x20on-chain\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)'),a['nodes']['some'](c=>c['id']==='main_repository')&&b['push']('Repository\x20published\x20and\x20Guard\x20write\x20validation\x20configured'),b['push']('After\x20materialization,\x20confirm\x20the\x20on-chain\x20state\x20matches\x20this\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27)'),b;}function buildCreationPlan(a){const b=[],c=new Map(a['nodes']['map'](i=>[i['id'],i])),f=new Map();for(const i of a['nodes'])f['set'](i['id'],new Set());for(const j of a['edges']){j['required']&&f['has'](j['from'])&&c['has'](j['to'])&&f['get'](j['from'])['add'](j['to']);}const g=[],h=new Map(f);while(h['size']>0x0){const k=[...h['entries']()]['filter'](([,l])=>l['size']===0x0)['map'](([l])=>l);if(k['length']===0x0){g['push'](...h['keys']());break;}k['sort']();for(const l of k){g['push'](l),h['delete'](l);for(const m of h['values']())m['delete'](l);}}return g['forEach']((o,p)=>{const q=c['get'](o),r=q['config']['name'];b['push']({'order':p+0x1,'node_id':o,'object_type':q['type'],'suggested_name':r?.['type']==='string'?r['value']:o,'depends_on':[...f['get'](o)??[]],'operation_hint':'Create\x20'+q['type']+'\x20via\x20onchain_operations,\x20then\x20configure.\x20Purpose:\x20'+q['purpose']});}),b;}export async function handleMerchantGuide(a){const b=a['guide_state']??{'intent_text':''},c=a['guide_confirm']??{},d={'intent_text':(a['intent']??b['intent_text']??'')['trim'](),'confirmed_industry':c['industry']??b['confirmed_industry'],'currency':c['currency']??b['currency'],'deliverables':c['deliverables']??b['deliverables'],'payment_override':c['payment']??b['payment_override'],'trust_override':c['trust']??b['trust_override'],'adopted_module_ids':c['adopted_module_ids']??b['adopted_module_ids']};for(const r of Object['keys'](d)){if(d[r]===undefined)delete d[r];}if(!d['intent_text'])throw new Error('merchant_guide\x20requires\x20\x27intent\x27\x20(business\x20description)\x20for\x20Step\x201.\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20offer\x20online\x20design\x20service\x20with\x20milestone\x20payments\x27.\x20'+'Pass\x20the\x20returned\x20guide_state\x20back\x20UNCHANGED\x20on\x20subsequent\x20calls,\x20plus\x20guide_confirm\x20for\x20merchant\x20decisions.');const e=await analyzeIntent(d['intent_text'],{'preferredIndustry':d['confirmed_industry'],'currency':d['currency']});if(!d['confirmed_industry'])return{'action':'merchant_guide','current_step':0x2,'step_name':'Industry\x20Matching','guide_state':d,'intent_draft':e['intent'],'industry_options':{'inferred':e['inferredIndustry'],'confidence':e['industryConfidence'],'similar':e['similarIndustries']},'warnings':e['warnings'],'next_action':'Confirm\x20the\x20industry\x20by\x20calling\x20merchant_guide\x20again\x20with\x20guide_state\x20(UNCHANGED)\x20'+('plus\x20guide_confirm={\x20industry:\x20\x27<one\x20of:\x20'+e['similarIndustries']['join'](',\x20')+'\x20—\x20or\x20any\x20other\x20industry\x20id>\x27\x20}')};const f={...e['intent'],'industry':d['confirmed_industry'],'deliverables':d['deliverables']??e['intent']['deliverables'],'payment':{...e['intent']['payment'],...d['payment_override']??{}},'trust':{...e['intent']['trust'],...d['trust_override']??{}}},g=d['adopted_module_ids']?d['adopted_module_ids']['map'](s=>getBusinessModule(s))['filter'](s=>!!s):recommendModules(d['confirmed_industry'],d['intent_text'],{'maxModules':0x5}),h=buildSemanticGraph(f,g),i=validateGraph(h),j=derivePlanSatisfiedConstraints(h,f),l=g['map'](s=>checkModuleConstraints(s,j)),m=deriveDeployTimeChecks(h),n=l['filter'](s=>!s['adopted']),o=checkGameTheoryConstraints(h,f),p=assessWorkflowDesign(h),q=buildCreationPlan(h);return{'action':'merchant_guide','current_step':n['length']>0x0?0x9:0xa,'step_name':n['length']>0x0?'Harness\x20Check\x20(issues\x20found)':'Submission\x20Plan\x20Ready','guide_state':{...d,'adopted_module_ids':g['map'](s=>s['id'])},'intent':{'intent_type':f['intent'],'industry':f['industry'],'roles':f['roles'],'deliverables':f['deliverables'],'payment':f['payment'],'trust':f['trust']},'adopted_modules':g['map'](s=>({'id':s['id'],'name':s['name'],'description':s['description'],'requires_keeper':s['requiresKeeper'],'keeper_hint':s['keeperHint'],'user_protections':s['userProtections'],'merchant_obligations':s['merchantObligations']})),'blueprint':{'nodes':h['nodes']['map'](s=>({'id':s['id'],'type':s['type'],'purpose':s['purpose']})),'edges':h['edges']['map'](s=>({'from':s['from'],'to':s['to'],'relation':s['relation'],'required':s['required']}))},'evaluation_preview':h['evaluationPreview'],'graph_validation':{'valid':i['valid'],'hard_violations':i['hardViolations']['map'](s=>({'id':s['id'],'description':s['description'],'fix':s['fixSuggestion']})),'soft_notes':i['softViolations']['map'](s=>({'id':s['id'],'description':s['description']}))},'harness_check':{'module_constraints':l['map'](s=>({'module':s['module'],'plan_satisfied':s['adopted'],'missing':s['missingConstraints'],'reason':s['reason'],'estimated_score_boost':s['estimatedScoreBoost']})),'blocking_issues':n['map'](s=>({'module':s['module'],'missing_constraints':s['missingConstraints'],'fix':s['reason']})),'deploy_time_checks':m},'game_theory':{'summary':o['summary'],'coverage':o['coveredCount']+'/'+o['totalCount'],'exposed_scenarios':o['exposedScenarios'],'wow_alignments':o['wowAlignments'],'scenarios':o['results']['map'](s=>({'scenario':s['scenario'],'covered':s['covered'],'conflict':s['conflict'],'user_protection':s['userProtection'],'evaluation_metric':s['evaluationMetric'],'recommendation':s['recommendation']}))},'workflow_design_assessment':{'score':p['score'],'summary':p['summary'],'findings':p['findings']['map'](s=>({'kind':s['kind'],'severity':s['severity'],'message':s['message'],'fix':s['fix']})),'checks':p['checks']['map'](s=>({'id':s['id'],'dimension':s['dimension'],'passed':s['passed'],'severity':s['severity'],'message':s['message'],'fix':s['fix']}))},'creation_plan':q,'warnings':e['warnings'],'next_action':n['length']>0x0?'Resolve\x20the\x20blocking_issues\x20above\x20(adjust\x20guide_confirm\x20payment/trust/modules,\x20or\x20accept\x20and\x20drop\x20the\x20affected\x20module\x20via\x20guide_confirm.adopted_module_ids),\x20then\x20call\x20merchant_guide\x20again.':'Plan\x20ready.\x20Materialize:\x20create\x20the\x20objects\x20in\x20creation_plan\x20order\x20via\x20onchain_operations,\x20then\x20publish\x20the\x20Service\x20(machine\x20binding\x20is\x20immutable\x20after\x20publish).'};}export function listBusinessModules(){return CORE_BUSINESS_MODULES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'industry_fit':a['industryFit'],'addresses_pain_points':a['addressesPainPoints'],'requires_keeper':a['requiresKeeper']}));}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MetricType, type MetricScale, type ConstraintRule, type ConstraintSeverity, type ConstraintViolationAction } from "
|
|
1
|
+
import { type MetricType, type MetricScale, type ConstraintRule, type ConstraintSeverity, type ConstraintViolationAction } from "../../extensions/index.js";
|
|
2
2
|
export interface RecommendIndustryInput {
|
|
3
3
|
intent?: string;
|
|
4
4
|
project_description?: string;
|
|
@@ -7,7 +7,7 @@ export interface RecommendIndustryInput {
|
|
|
7
7
|
export declare function handleRecommendIndustry(v: RecommendIndustryInput): {
|
|
8
8
|
action: "recommend_industry";
|
|
9
9
|
intent: string;
|
|
10
|
-
inferred_traits: import("
|
|
10
|
+
inferred_traits: import("../../knowledge/industry-registry.js").IndustryTraits;
|
|
11
11
|
inference_confidence: number;
|
|
12
12
|
matched_keywords: string[];
|
|
13
13
|
recommendations: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getIndustryModeRegistry,getMetricRegistry,getConstraintRegistry}from'../../extensions/index.js';import{inferTraitsFromDescription,findSimilarIndustries}from'../../knowledge/industry-generalizer.js';import{searchExamples}from'../../schema-query-impl/index.js';const LOCAL_MODE_OWNER='local',RM1_11_NODE_REGEX=/(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;function validateMachineShape(a,b){const c=[];if(!Array['isArray'](a))return c;const d=new Set();for(const e of a){const f=e?.['name'];if(typeof f!=='string'||!f){c['push'](b+':\x20every\x20node\x20must\x20have\x20a\x20non-empty\x20string\x20\x27name\x27');continue;}d['has'](f)&&c['push'](b+':\x20duplicate\x20node\x20name\x20\x27'+f+'\x27\x20(R-M1-10)'),d['add'](f),RM1_11_NODE_REGEX['test'](f)&&c['push'](b+':\x20node\x20\x27'+f+'\x27\x20violates\x20R-M1-11\x20—\x20dispute/refund\x20flows\x20must\x20NOT\x20be\x20'+'modeled\x20as\x20Machine\x20nodes.\x20Disputes\x20flow\x20through\x20Service.arbitrations\x20→\x20Arbitration.dispute()\x20'+'independently\x20of\x20the\x20Machine.\x20Use\x20business-state\x20nodes\x20(e.g.\x20\x27cancelled\x27,\x20\x27return_approved\x27)\x20'+'and\x20route\x20fund\x20refunds\x20via\x20Allocator\x20triggered\x20by\x20those\x20states.');}return c;}export function handleRecommendIndustry(a){const b=(a['intent']??a['project_description']??a['project_name']??'')['trim']();if(!b)throw new Error('recommend_industry\x20requires\x20\x27intent\x27\x20(business\x20description\x20text).\x20'+'Example:\x20intent=\x27I\x20rent\x20cameras\x20to\x20photographers\x20with\x20deposit\x20and\x20damage\x20inspection\x27.');const c=inferTraitsFromDescription(b),d=findSimilarIndustries(c['traits'],0x3),e=d['map'](g=>{const h=searchExamples(g['industry'])['slice'](0x0,0x3)['map'](i=>({'file':i['file'],'title':i['title'],'operation_type':i['operation_type'],'verified':i['verified']}));return{'industry':g['industry'],'similarity':g['similarity'],'matched_traits':g['matched_traits'],'reference_examples':h};}),f=e[0x0];return{'action':'recommend_industry','intent':b,'inferred_traits':c['traits'],'inference_confidence':c['confidence'],'matched_keywords':c['matched_keywords'],'recommendations':e,'hint':f?'Top\x20match:\x20\x27'+f['industry']+'\x27\x20(similarity\x20'+(f['similarity']*0x64)['toFixed'](0x0)+'%).\x20'+'Use\x20it\x20to\x20shape\x20the\x20build\x20—\x20run\x20goal_operation\x20action=\x27merchant_guide\x27\x20(or\x20\x27analyze_intent\x27)\x20with\x20this\x20industry\x20context,\x20'+'or\x20choose\x20another\x20industry\x20from\x20\x27recommendations\x27.\x20'+'Review\x20reference\x20examples\x20via\x20schema_query\x20action=\x27search_examples\x27\x20query=\x27<industry>\x27.':'No\x20similar\x20industry\x20found.\x20Shape\x20the\x20build\x20from\x20scratch\x20via\x20goal_operation\x20action=\x27merchant_guide\x27.'};}export async function handleListModes(){const a=getIndustryModeRegistry(),b=a['listModes']()['filter'](d=>d['source']==='builtin')['map'](d=>({'name':d['name'],'display_name':d['display_name'],'version':d['version'],'key_risk':d['key_risk'],'machine_nodes':d['machine_shape']['map'](e=>e['name']),'similar_industries':d['similar_industries']??[]})),c=(await a['listUserModes'](LOCAL_MODE_OWNER))['map'](d=>({'name':d['name'],'display_name':d['display_name'],'version':d['version'],'derived_from':d['derived_from']??null,'key_risk':d['key_risk'],'machine_nodes':d['machine_shape']['map'](e=>e['name']),'evolution_history':(d['evolution_history']??[])['map'](e=>({'version':e['version'],'changed_at':e['changed_at'],'changes':e['changes']}))}));return{'action':'list_modes','builtin_modes':b,'user_modes':c,'owner':LOCAL_MODE_OWNER,'hint':'Use\x20a\x20builtin\x20mode\x20name\x20as\x20the\x20industry/mode\x20context\x20for\x20your\x20build\x20(see\x20recommend_industry\x20/\x20merchant_guide).\x20'+'Use\x20derive_user_mode\x20to\x20customize\x20a\x20builtin\x20mode,\x20or\x20register_user_mode\x20for\x20a\x20fully\x20custom\x20mode.\x20'+'User\x20modes\x20are\x20referenced\x20as\x20\x27<name>\x27\x20in\x20derive/evolve/unregister\x20actions.'};}export async function handleDeriveUserMode(a){const b=requireField(a['mode_source'],'mode_source'),c=requireField(a['mode_name'],'mode_name'),d=a['mode_changes']??{},e=validateMachineShape(d['machine_shape'],'mode_changes.machine_shape');if(e['length']>0x0)throw new Error('derive_user_mode\x20blocked:\x0a'+e['join']('\x0a'));const f=getIndustryModeRegistry(),g=await f['deriveMode'](b,d,LOCAL_MODE_OWNER,c,a['mode_display_name']);if(!g)throw new Error('derive_user_mode\x20failed:\x20source\x20mode\x20\x27'+b+'\x27\x20not\x20found,\x20or\x20name\x20\x27'+c+'\x27\x20conflicts\x20'+'with\x20a\x20builtin/existing\x20user\x20mode.\x20Call\x20list_modes\x20to\x20see\x20available\x20names.');return{'action':'derive_user_mode','mode':summarizeUserMode(g),'hint':'Mode\x20\x27'+c+'\x27\x20derived\x20from\x20\x27'+b+'\x27.\x20Use\x20it\x20as\x20the\x20industry/mode\x20context\x20for\x20your\x20build.\x20'+'Iterate\x20with\x20evolve_user_mode.'};}export async function handleEvolveUserMode(a){const b=requireField(a['mode_name'],'mode_name'),c=requireField(a['mode_change_description'],'mode_change_description'),d=a['mode_changes']??{},e=validateMachineShape(d['machine_shape'],'mode_changes.machine_shape');if(e['length']>0x0)throw new Error('evolve_user_mode\x20blocked:\x0a'+e['join']('\x0a'));const f=getIndustryModeRegistry(),g=await f['evolveMode'](b,d,LOCAL_MODE_OWNER,c,a['mode_bump_version']??!![]);if(!g)throw new Error('evolve_user_mode\x20failed:\x20user\x20mode\x20\x27'+b+'\x27\x20not\x20found\x20for\x20owner\x20\x27'+LOCAL_MODE_OWNER+'\x27.\x20'+'Call\x20list_modes\x20to\x20see\x20your\x20modes.');return{'action':'evolve_user_mode','mode':summarizeUserMode(g),'hint':'Mode\x20\x27'+b+'\x27\x20evolved\x20to\x20'+g['version']+'.\x20Evolution\x20history\x20recorded.'};}export async function handleRegisterUserMode(a){const b=requireField(a['mode_name'],'mode_name'),c=a['mode_changes']??{},d=[];(!Array['isArray'](c['machine_shape'])||c['machine_shape']['length']===0x0)&&d['push']('machine_shape\x20(non-empty\x20array\x20of\x20{name,\x20role})');(typeof c['key_risk']!=='string'||!c['key_risk'])&&d['push']('key_risk\x20(string\x20describing\x20the\x20industry\x27s\x20key\x20risk)');if(d['length']>0x0)throw new Error('register_user_mode\x20requires\x20these\x20fields\x20in\x20mode_changes:\x20'+d['join'](',\x20')+'.\x20'+'Tip:\x20derive_user_mode\x20from\x20a\x20builtin\x20mode\x20is\x20usually\x20easier\x20than\x20registering\x20from\x20scratch.');const e=validateMachineShape(c['machine_shape'],'mode_changes.machine_shape');if(e['length']>0x0)throw new Error('register_user_mode\x20blocked:\x0a'+e['join']('\x0a'));const f=getIndustryModeRegistry(),g=f['getMode']('general');if(!g)throw new Error('Builtin\x20mode\x20\x27general\x27\x20not\x20registered\x20—\x20cannot\x20build\x20custom\x20mode\x20defaults');const h={...g,...c,'name':b,'display_name':a['mode_display_name']??b,'version':'v1','source':'custom','owner':LOCAL_MODE_OWNER,'derived_from':undefined,'evolution_history':[]},i=await f['registerUserMode'](h,LOCAL_MODE_OWNER);if(!i)throw new Error('register_user_mode\x20failed:\x20name\x20\x27'+b+'\x27\x20conflicts\x20with\x20a\x20builtin/existing\x20user\x20mode,\x20'+'or\x20payload\x20is\x20invalid.\x20Call\x20list_modes\x20to\x20see\x20available\x20names.');return{'action':'register_user_mode','mode':summarizeUserMode(h),'hint':'Custom\x20mode\x20\x27'+b+'\x27\x20registered.\x20Use\x20it\x20as\x20the\x20industry/mode\x20context\x20for\x20your\x20build.'};}export async function handleUnregisterUserMode(a){const b=requireField(a['mode_name'],'mode_name'),c=getIndustryModeRegistry(),d=await c['unregisterUserMode'](b,LOCAL_MODE_OWNER);if(!d)throw new Error('unregister_user_mode\x20failed:\x20user\x20mode\x20\x27'+b+'\x27\x20not\x20found\x20for\x20owner\x20\x27'+LOCAL_MODE_OWNER+'\x27.');return{'action':'unregister_user_mode','removed':!![],'mode_name':b};}export function handleRegisterCustomMetric(a){const b=requireField(a['metric_id'],'metric_id'),c=requireField(a['metric_display_name'],'metric_display_name'),d=requireField(a['metric_description'],'metric_description'),e=requireField(a['metric_type'],'metric_type'),f=requireField(a['metric_scale'],'metric_scale'),g=getMetricRegistry()['registerCustomMetric'](b,c,d,e,f,LOCAL_MODE_OWNER,a['metric_weight']);if(!g)throw new Error('register_custom_metric\x20failed:\x20metric_id\x20\x27'+b+'\x27\x20already\x20exists\x20or\x20fields\x20are\x20invalid.');return{'action':'register_custom_metric','metric':{'metric_id':b,'display_name':c,'description':d,'type':e,'scale':f,'weight':a['metric_weight']??0x1,'scope':'custom','owner':LOCAL_MODE_OWNER},'hint':'Custom\x20metric\x20\x27'+b+'\x27\x20registered\x20globally\x20—\x20all\x20modes\x20can\x20reference\x20it\x20via\x20custom_metrics.'};}export function handleRegisterCustomConstraint(a){const b=requireField(a['constraint_id'],'constraint_id'),c=requireField(a['constraint_display_name'],'constraint_display_name'),d=requireField(a['constraint_description'],'constraint_description'),e=a['constraint_rule'];if(!e||typeof e!=='object'||!('type'in e))throw new Error('constraint_rule\x20is\x20required\x20and\x20must\x20be\x20one\x20of:\x20'+'{type:\x27capability_required\x27,\x20capability_id}\x20|\x20{type:\x27capability_forbidden\x27,\x20capability_id}\x20|\x20'+'{type:\x27numeric_limit\x27,\x20field,\x20max?,\x20min?}\x20|\x20{type:\x27condition_required\x27,\x20condition,\x20ai_evaluated:true}');const f=getConstraintRegistry()['registerCustomConstraint'](b,c,d,e,LOCAL_MODE_OWNER,a['constraint_severity']??'soft',a['constraint_on_violation']??'warn');if(!f)throw new Error('register_custom_constraint\x20failed:\x20constraint_id\x20\x27'+b+'\x27\x20already\x20exists\x20or\x20rule\x20is\x20invalid.');return{'action':'register_custom_constraint','constraint':{'constraint_id':b,'display_name':c,'description':d,'rule':e,'severity':a['constraint_severity']??'soft','on_violation':a['constraint_on_violation']??'warn','scope':'custom','owner':LOCAL_MODE_OWNER},'hint':'Custom\x20constraint\x20\x27'+b+'\x27\x20registered.\x20\x27hard\x27\x20constraints\x20block\x20applyTemplate\x20on\x20violation;\x20\x27soft\x27\x20only\x20warn.'};}export function handleListMetricsConstraints(a){const b=getMetricRegistry()['listMetrics']({'type':a['metric_type_filter'],'scope':a['scope_filter']})['map'](d=>({'metric_id':d['metric_id'],'display_name':d['display_name'],'description':d['description'],'type':d['type'],'scale':d['scale'],'weight':d['weight'],'scope':d['scope']})),c=getConstraintRegistry()['listConstraints']({'scope':a['scope_filter']})['map'](d=>({'constraint_id':d['constraint_id'],'display_name':d['display_name'],'description':d['description'],'rule':d['rule'],'severity':d['severity'],'on_violation':d['on_violation'],'scope':d['scope']}));return{'action':'list_metrics_constraints','metrics':b,'constraints':c,'hint':'Register\x20custom\x20entries\x20via\x20register_custom_metric\x20/\x20register_custom_constraint.\x20'+'Filter\x20with\x20metric_type_filter\x20(\x27risk\x27|\x27benefit\x27)\x20or\x20scope_filter\x20(\x27builtin\x27|\x27custom\x27).'};}function requireField(a,b){if(a===undefined||a===null||typeof a==='string'&&!a['trim']())throw new Error('\x27'+b+'\x27\x20is\x20required\x20for\x20this\x20action');return a;}function summarizeUserMode(a){return{'name':a['name'],'display_name':a['display_name'],'version':a['version'],'derived_from':a['derived_from']??null,'owner':a['owner'],'key_risk':a['key_risk'],'machine_nodes':a['machine_shape']['map'](b=>b['name']),'evolution_history':(a['evolution_history']??[])['map'](b=>({'version':b['version'],'changed_at':b['changed_at'],'changes':b['changes']}))};}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type ProjectObjectType = "service" | "machine" | "guard" | "permission" | "reward" | "arb" | "progress" | "treasury" | "demand" | "repository" | "contact" | "order" | "allocation" | "personal" | "payment" | "proof";
|
|
2
|
+
export type IndustryMode = "freelance" | "rental" | "education" | "travel" | "subscription" | "general";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { ObjectPanoramaInput } from "../../schema/query/bi.js";
|
|
2
|
+
type ProjectInput = ObjectPanoramaInput;
|
|
3
|
+
interface PanoBase {
|
|
4
|
+
action: "object_panorama";
|
|
5
|
+
object: string;
|
|
6
|
+
network: string;
|
|
7
|
+
head: {
|
|
8
|
+
name: string | null;
|
|
9
|
+
tags: string[];
|
|
10
|
+
description: string | null;
|
|
11
|
+
};
|
|
12
|
+
data_gaps: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ProgressPanoramaResult extends PanoBase {
|
|
15
|
+
object_type: "Progress";
|
|
16
|
+
fields: {
|
|
17
|
+
machine: string | null;
|
|
18
|
+
current: string | null;
|
|
19
|
+
task: string | null;
|
|
20
|
+
history_count: number | null;
|
|
21
|
+
current_time: number | null;
|
|
22
|
+
};
|
|
23
|
+
context_repositories: string[];
|
|
24
|
+
operators: {
|
|
25
|
+
name: string;
|
|
26
|
+
operators: string[];
|
|
27
|
+
}[];
|
|
28
|
+
session: {
|
|
29
|
+
next_node: string | null;
|
|
30
|
+
weights: number | null;
|
|
31
|
+
threshold: number | null;
|
|
32
|
+
forwards: {
|
|
33
|
+
forward: string;
|
|
34
|
+
who: string | null;
|
|
35
|
+
accomplished: boolean;
|
|
36
|
+
msg: string | null;
|
|
37
|
+
time: number | null;
|
|
38
|
+
}[];
|
|
39
|
+
} | null;
|
|
40
|
+
related: {
|
|
41
|
+
key: string | null;
|
|
42
|
+
items: {
|
|
43
|
+
address: string;
|
|
44
|
+
object_type: string;
|
|
45
|
+
time: number | null;
|
|
46
|
+
}[];
|
|
47
|
+
count: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface DemandPanoramaResult extends PanoBase {
|
|
51
|
+
object_type: "Demand";
|
|
52
|
+
fields: {
|
|
53
|
+
location: string | null;
|
|
54
|
+
um: string | null;
|
|
55
|
+
permission: string | null;
|
|
56
|
+
presenters_count: number | null;
|
|
57
|
+
};
|
|
58
|
+
rewards: string[];
|
|
59
|
+
guards: {
|
|
60
|
+
guard: string;
|
|
61
|
+
}[];
|
|
62
|
+
presenters: {
|
|
63
|
+
count: number;
|
|
64
|
+
items: {
|
|
65
|
+
service: string;
|
|
66
|
+
recommend: string | null;
|
|
67
|
+
acceptance_score: number | null;
|
|
68
|
+
feedback: string | null;
|
|
69
|
+
feedback_time: number | null;
|
|
70
|
+
update_time: number | null;
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface OrderPanoramaResult extends PanoBase {
|
|
75
|
+
object_type: "Order";
|
|
76
|
+
fields: {
|
|
77
|
+
service: string | null;
|
|
78
|
+
machine: string | null;
|
|
79
|
+
progress: string | null;
|
|
80
|
+
allocation: string | null;
|
|
81
|
+
discount: string | null;
|
|
82
|
+
amount: string | null;
|
|
83
|
+
owner: string | null;
|
|
84
|
+
claimed_by: string | null;
|
|
85
|
+
required_info: string | null;
|
|
86
|
+
time: number | null;
|
|
87
|
+
};
|
|
88
|
+
items: {
|
|
89
|
+
name: string | null;
|
|
90
|
+
price: string | null;
|
|
91
|
+
quantity: string | null;
|
|
92
|
+
wip_hash: string | null;
|
|
93
|
+
}[];
|
|
94
|
+
allocation_state: "none" | "pending" | "allocated";
|
|
95
|
+
progress_next: string | null;
|
|
96
|
+
progress_since: number | null;
|
|
97
|
+
disputes: string[];
|
|
98
|
+
agents: string[];
|
|
99
|
+
updated_ms: number | null;
|
|
100
|
+
related: {
|
|
101
|
+
key: string | null;
|
|
102
|
+
items: {
|
|
103
|
+
address: string;
|
|
104
|
+
object_type: string;
|
|
105
|
+
time: number | null;
|
|
106
|
+
}[];
|
|
107
|
+
count: number;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export interface ArbPanoramaResult extends PanoBase {
|
|
111
|
+
object_type: "Arb";
|
|
112
|
+
fields: {
|
|
113
|
+
arbitration: string | null;
|
|
114
|
+
order: string | null;
|
|
115
|
+
service: string | null;
|
|
116
|
+
fee: string | null;
|
|
117
|
+
feedback: string | null;
|
|
118
|
+
indemnity: {
|
|
119
|
+
amount: string | null;
|
|
120
|
+
time: number | null;
|
|
121
|
+
} | null;
|
|
122
|
+
voting_deadline: number | null;
|
|
123
|
+
objection: string | null;
|
|
124
|
+
status: string | null;
|
|
125
|
+
compensation_time: number | null;
|
|
126
|
+
time: number | null;
|
|
127
|
+
type_raw: string | null;
|
|
128
|
+
};
|
|
129
|
+
voted: {
|
|
130
|
+
voter: string;
|
|
131
|
+
agrees: number[];
|
|
132
|
+
weight: number;
|
|
133
|
+
time: number;
|
|
134
|
+
}[];
|
|
135
|
+
proposition: {
|
|
136
|
+
name: string;
|
|
137
|
+
votes: number;
|
|
138
|
+
}[];
|
|
139
|
+
updated_ms: number | null;
|
|
140
|
+
related: {
|
|
141
|
+
key: string | null;
|
|
142
|
+
items: {
|
|
143
|
+
address: string;
|
|
144
|
+
object_type: string;
|
|
145
|
+
time: number | null;
|
|
146
|
+
}[];
|
|
147
|
+
count: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export interface RepositoryPanoramaResult extends PanoBase {
|
|
151
|
+
object_type: "Repository";
|
|
152
|
+
fields: {
|
|
153
|
+
um: string | null;
|
|
154
|
+
permission: string | null;
|
|
155
|
+
data_count: number | null;
|
|
156
|
+
};
|
|
157
|
+
policies: {
|
|
158
|
+
name: string;
|
|
159
|
+
description: string | null;
|
|
160
|
+
id_from: string | null;
|
|
161
|
+
value_type: string | null;
|
|
162
|
+
write_guards: number;
|
|
163
|
+
quote_guard: string | null;
|
|
164
|
+
}[];
|
|
165
|
+
rewards: string[];
|
|
166
|
+
data_entries: {
|
|
167
|
+
count: number | null;
|
|
168
|
+
items: {
|
|
169
|
+
entity: string | null;
|
|
170
|
+
name: string | null;
|
|
171
|
+
value: string | null;
|
|
172
|
+
value_type: string | null;
|
|
173
|
+
}[];
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export type ObjectPanoramaResult = ProgressPanoramaResult | DemandPanoramaResult | OrderPanoramaResult | ArbPanoramaResult | RepositoryPanoramaResult;
|
|
177
|
+
export declare function handleObjectPanorama(v: ProjectInput): Promise<ObjectPanoramaResult>;
|
|
178
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Config,LocalMark,query_objects,query_object_last_updated,queryTableItem_ObjectLinkerTx,queryTableItem_DemandPresenter,objectTypeFromAddress,ObjectType}from'@wowok/wowok';const js=a=>{if(typeof a==='bigint')return a['toString']();if(a&&typeof a==='object'&&!Array['isArray'](a)){const b={};for(const [c,d]of Object['entries'](a)){b[c]=js(d);}return b;}if(Array['isArray'](a))return a['map'](js);return a;},str=a=>a===null||a===undefined?null:String(a),ownerAddr=a=>{if(typeof a==='string')return a;const b=a;if(b&&typeof b==='object'){if(typeof b['AddressOwner']==='string')return b['AddressOwner'];if(typeof b['ObjectOwner']==='string')return b['ObjectOwner'];const c=Object['values'](b)['find'](d=>typeof d==='string'&&d['length']>0x14);if(typeof c==='string')return c;}return null;},num=a=>{if(typeof a==='bigint')return Number(a);if(typeof a==='number')return Number['isFinite'](a)?a:null;if(typeof a==='string'&&a['trim']()!==''){const b=Number(a);return Number['isFinite'](b)?b:null;}return null;},arr=a=>Array['isArray'](a)?a:[],ARB_STATUS_NAMES={0x0:'Principal_confirming',0x1:'Arbitrator_confirming',0x2:'Voting',0x3:'Arbitrated',0x4:'Objectionable',0x5:'Finished',0x6:'Withdrawn'};async function resolveObject(a,b){let c=a;if(!/^0x[0-9a-fA-F]{32,64}$/['test'](c)){const g=await LocalMark['Instance']()['get_address'](c);if(!g)throw new Error('Cannot\x20resolve\x20\x27'+c+'\x27\x20—\x20not\x20a\x20valid\x20address\x20and\x20no\x20LocalMark\x20entry\x20found.');c=g;}let d=b??undefined,f=null;if(!d)d=await Config['Instance']()['network_get']();try{const h=await query_objects({'objects':[c],'network':d});f=h?.['objects']?.[0x0]??null;if(!f&&b){const i=await Config['Instance']()['network_get']();if(i&&i!==d){const j=await query_objects({'objects':[c],'network':i,'no_cache':!![]}),k=j?.['objects']?.[0x0]??null;k&&(f=k,d=i);}}}catch(l){throw new Error('Failed\x20to\x20query\x20'+c+'\x20on\x20'+d+':\x20'+(l instanceof Error?l['message']:String(l)));}if(!f)throw new Error(c+'\x20not\x20found\x20on\x20'+d+'.\x20It\x20may\x20not\x20exist\x20on\x20this\x20network.');return f['object']=f['object']??c,{'network':String(d),'obj':f};}async function resolveHead(a,b,c){let d=null,e=[];try{const f=await LocalMark['Instance']()['list']({'address':a});f['length']>0x0&&(d=f[0x0]['name']??null,e=(f[0x0]['tags']??[])['map'](g=>String(g)));}catch{c['push']('head:\x20LocalMark\x20lookup\x20failed');}return{'name':d,'tags':e,'description':str(b['description'])};}async function buildPresenters(a,b,c){const d=[];let e=0x0;try{const f=await queryTableItem_ObjectLinkerTx({'address':a,'no_cache':!![],'network':b}),g=(f?.['items']??[])['map'](j=>({'service':String(j?.['who']??''),'time':typeof j?.['time']==='number'?j['time']:null}))['filter'](i=>objectTypeFromAddress(i['service'])===ObjectType['Service']);e=g['length'];const h=g['slice'](-0x32)['reverse']();for(const i of h){let j;try{j=await queryTableItem_DemandPresenter({'parent':a,'address':i['service'],'no_cache':!![],'network':b});}catch{c['push']('presenters:\x20detail\x20fetch\x20failed\x20for\x20one\x20entry');}d['push']({'service':i['service'],'recommend':str(j?.['recommend']),'acceptance_score':num(j?.['acceptance_score']),'feedback':str(j?.['feedback']),'feedback_time':num(j?.['feedback_time']),'update_time':num(j?.['update_time'])??i['time']});}}catch{c['push']('presenters:\x20global-table\x20lookup\x20failed\x20(non-blocking)');}return{'count':e,'items':d};}async function buildRepositoryData(a,b,c){return void a,void b,c['push']('data:\x20per-key\x20enumeration\x20requires\x20the\x20{entity,name}\x20pair\x20—\x20showing\x20count\x20only'),{'count':null,'items':[]};}export async function handleObjectPanorama(b){const c=b['object_address'];if(!c)throw new Error('\x27object_address\x27\x20is\x20required\x20for\x20object_panorama');const {network:d,obj:e}=await resolveObject(c,b['context_network']),f=String(e['object']),g=[],h=await resolveHead(f,e,g),j=String(e['type']??'');if(j==='Progress'){const k=arr(e['session'])[0x0],l=k?{'next_node':str(k['next_node']),'weights':num(k['weights']),'threshold':num(k['threshold']),'forwards':arr(k['forwards'])['map'](n=>{const o=n;return{'forward':str(o['forward'])??'','who':str(o['who']),'accomplished':o['accomplished']===!![],'msg':str(o['msg']),'time':num(o['time'])};})}:null,m={'key':typeof e['machine']==='string'?e['machine']:null,'items':[],'count':0x0};if(m['key'])try{const n=await queryTableItem_ObjectLinkerTx({'address':m['key'],'no_cache':!![],'network':d}),o=n?.['items']??[];for(const q of o['slice'](-0x32)['reverse']()){const r=typeof q?.['who']==='string'?q['who']:'';if(!r||r['toLowerCase']()===f['toLowerCase']())continue;let s;try{s=objectTypeFromAddress(r);}catch{}if(!s)continue;m['items']['push']({'address':r,'object_type':s,'time':typeof q?.['time']==='number'?q['time']:null});}m['count']=m['items']['length'];}catch{g['push']('related:\x20ObjectLinkerTx(machine)\x20lookup\x20failed');}return{'action':'object_panorama','object':f,'object_type':'Progress','network':d,'head':h,'fields':{'machine':str(e['machine']),'current':str(e['current']),'task':str(e['task']),'history_count':num(e['history_count']),'current_time':num(e['current_time'])},'context_repositories':arr(e['context_repositories'])['map'](t=>String(t)),'operators':arr(e['namedOperator'])['map'](t=>{const u=t;return{'name':str(u['name'])??'','operators':arr(u['operators'])['map'](w=>String(w))};}),'session':l,'related':m,'data_gaps':g};}if(j==='Demand')return{'action':'object_panorama','object':f,'object_type':'Demand','network':d,'head':h,'fields':{'location':str(e['location']),'um':str(e['um']),'permission':str(e['permission']),'presenters_count':num(e['presenters_count'])},'rewards':arr(e['rewards'])['map'](t=>String(t)),'guards':arr(e['guards'])['map'](t=>({'guard':str(t['guard'])??''})),'presenters':await buildPresenters(f,d,g),'data_gaps':g};if(j==='Order'){let t=null;try{const C=await query_object_last_updated({'object':f,'network':d,'previous_transaction':str(e['previousTransaction'])});t=C?.['timestamp_ms']?Number(C['timestamp_ms'])||null:null;}catch{}let u='none',w=null,x=null;const y=str(e['allocation']),z=str(e['progress']),A=[y,z]['filter'](D=>!!D);if(A['length']>0x0)try{const D=await query_objects({'objects':A,'network':d}),E=D?.['objects']??[];if(y){u='pending';const F=E['find'](H=>H?.['object']===y),G=Number(F?.['balance']??NaN);if(Number['isFinite'](G)&&G===0x0)u='allocated';}if(z){const H=E['find'](I=>I?.['object']===z);w=str(H?.['current']),x=num(H?.['current_time']);}}catch{}const B={'key':f,'items':[],'count':0x0};try{const I=await queryTableItem_ObjectLinkerTx({'address':f,'no_cache':!![],'network':d}),J=I?.['items']??[];for(const K of J['slice'](-0x32)['reverse']()){const L=typeof K?.['who']==='string'?K['who']:'';if(!L||L['toLowerCase']()===f['toLowerCase']())continue;let M;try{M=objectTypeFromAddress(L);}catch{}if(!M)continue;B['items']['push']({'address':L,'object_type':M,'time':typeof K?.['time']==='number'?K['time']:null});}B['count']=B['items']['length'];}catch{g['push']('related:\x20ObjectLinkerTx(order)\x20lookup\x20failed');}return{'action':'object_panorama','object':f,'object_type':'Order','network':d,'head':h,'fields':{'service':str(e['service']),'machine':str(e['machine']),'progress':z,'allocation':y,'discount':str(e['discount']),'amount':str(e['amount']),'owner':ownerAddr(e['builder']??e['owner']),'claimed_by':str(e['claimed_by']),'required_info':str(e['required_info']),'time':num(e['time'])},'updated_ms':t,'related':B,'allocation_state':u,'progress_next':w,'progress_since':x,'items':arr(e['items'])['map'](N=>{const O=N;return{'name':str(O['name']),'price':str(O['price']),'quantity':str(O['quantity']),'wip_hash':str(O['wip_hash'])};}),'disputes':arr(e['dispute'])['map'](N=>String(N)),'agents':arr(e['agent'])['map'](N=>String(N)),'data_gaps':g};}if(j==='Arb'){const N=e['indemnity'];let O=null;try{const S=await query_object_last_updated({'object':f,'network':d,'previous_transaction':str(e['previousTransaction'])});O=S?.['timestamp_ms']?Number(S['timestamp_ms'])||null:null;}catch{}const P=str(e['order']);let Q=null;if(P)try{const T=await query_objects({'objects':[P],'network':d}),U=T?.['objects']?.[0x0];Q=str(U?.['service']);}catch{}const R={'key':f,'items':[],'count':0x0};try{const V=await queryTableItem_ObjectLinkerTx({'address':f,'no_cache':!![],'network':d}),W=V?.['items']??[];for(const X of W['slice'](-0x32)['reverse']()){const Y=typeof X?.['who']==='string'?X['who']:'';if(!Y||Y['toLowerCase']()===f['toLowerCase']())continue;let Z;try{Z=objectTypeFromAddress(Y);}catch{}if(!Z)continue;R['items']['push']({'address':Y,'object_type':Z,'time':typeof X?.['time']==='number'?X['time']:null});}R['count']=R['items']['length'];}catch{g['push']('related:\x20ObjectLinkerTx(arb)\x20lookup\x20failed');}return{'action':'object_panorama','object':f,'object_type':'Arb','network':d,'head':h,'fields':{'arbitration':str(e['arbitration']),'order':str(e['order']),'service':Q,'fee':str(e['fee']),'feedback':str(e['feedback']),'indemnity':N?{'amount':str(N['amount']),'time':num(N['time'])}:null,'voting_deadline':num(e['voting_deadline']),'objection':str(e['objection']),'status':ARB_STATUS_NAMES[num(e['status'])??-0x1]??str(e['status']),'compensation_time':num(e['compensation_time']),'time':num(e['time']),'type_raw':str(e['type_raw'])},'voted':arr(e['voted'])['map'](a0=>{const a1=a0;return{'voter':str(a1['voter'])??'','agrees':arr(a1['agrees'])['map'](a2=>Number(a2)),'weight':num(a1['weight'])??0x0,'time':num(a1['time'])??0x0};}),'proposition':arr(e['proposition'])['map'](a0=>{const a1=a0;return{'name':str(a1['name'])??'','votes':num(a1['votes'])??0x0};}),'related':R,'updated_ms':O,'data_gaps':g};}if(j==='Repository')return{'action':'object_panorama','object':f,'object_type':'Repository','network':d,'head':h,'fields':{'um':str(e['um']),'permission':str(e['permission']),'data_count':num(e['data_count'])},'policies':arr(e['policies'])['map'](a0=>{const a1=a0;return{'name':str(a1['name'])??'','description':str(a1['description']),'id_from':str(a1['id_from']),'value_type':str(a1['value_type']),'write_guards':arr(a1['write_guard'])['length'],'quote_guard':str(a1['quote_guard'])};}),'rewards':arr(e['rewards'])['map'](a0=>String(a0)),'data_entries':await buildRepositoryData(f,d,g),'data_gaps':g};throw new Error('object_panorama:\x20unsupported\x20object\x20type\x20\x27'+(j||'unknown')+'\x27\x20for\x20'+f+'.\x20'+'Supported:\x20Progress\x20/\x20Demand\x20/\x20Order\x20/\x20Arb\x20/\x20Repository.');}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeObjectType(objectType: string | null | undefined): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function normalizeObjectType(a){if(!a)return'unknown';const b=a['replace'](/<.*>/,'')['trim'](),c=b['split']('::'),d=c[c['length']-0x1]||'unknown';if(d['length']>0x0&&d===d['toLowerCase']())return d['charAt'](0x0)['toUpperCase']()+d['slice'](0x1);return d;}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type ProjectInput = z.infer<typeof ProjectOperationInputSchema>;
|
|
1
|
+
import { type OrderRadarResult } from "../../participation/radar-core.js";
|
|
2
|
+
import type { ParticipationRadarInput } from "../../schema/query/bi.js";
|
|
3
|
+
type ProjectInput = ParticipationRadarInput;
|
|
5
4
|
export declare function handleParticipationRadar(v: ProjectInput): Promise<{
|
|
6
5
|
action: "participation_radar";
|
|
7
6
|
account: string;
|
|
8
7
|
orders_analyzed: number;
|
|
9
8
|
actionable: OrderRadarResult[];
|
|
10
9
|
waiting: OrderRadarResult[];
|
|
11
|
-
all_pending_claims: (import("
|
|
10
|
+
all_pending_claims: (import("../../participation/radar-core.js").PendingClaim & {
|
|
12
11
|
progress: string;
|
|
13
12
|
})[];
|
|
14
13
|
unread_messages_total: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LocalMark,query_objects,query_table,watch_conversations}from'@wowok/wowok';import{analyzeOrderParticipation,aggregateRadar,isConsequenceNode}from'../../participation/radar-core.js';import{monitorOrder}from'../../customer/order-monitor.js';import{analyzeMerchantInterest}from'../../participation/merchant-interest.js';import{analyzeCustomerInterest}from'../../participation/customer-interest.js';import{analyzeSupplierInterest}from'../../participation/supplier-interest.js';import{analyzeCollaboratorInterest}from'../../participation/collaborator-interest.js';import{fetchMachineNodes}from'./machine-nodes.js';import{extractGenericTokenType,registryDisplayHint}from'../../knowledge/fund-layer.js';const QUERY_BATCH=0x32;function fld(a,b){return a?.[b]??a?.['data']?.[b];}async function resolveAddress(a,b){const c=await LocalMark['Instance']()['get_address'](a);if(!c)throw new Error('Cannot\x20resolve\x20'+b+'\x20\x27'+a+'\x27\x20—\x20not\x20a\x20valid\x20address\x20and\x20no\x20LocalMark\x20entry\x20found.\x20'+'Register\x20it\x20via\x20local_mark_operation\x20or\x20pass\x20the\x200x\x20address\x20directly.');return c;}function balanceStr(a){if(a==null)return undefined;if(typeof a==='object'&&'balance'in a)return String(a['balance']);return String(a);}function balanceToken(a){if(a!=null&&typeof a==='object'&&typeof a['token_type']==='string')return a['token_type'];return undefined;}function summarizeAllocation(a,b){const c=Array['isArray'](a)?a:Array['isArray'](a?.['allocators'])?a['allocators']:[];if(c['length']===0x0)return undefined;let d=0x0,e=0x0,f=0x0,g=0x0;const h=b['toLowerCase']();for(const i of c){for(const j of i?.['sharing']??[]){d++;const k=j?.['who'];if(k==null)continue;if(typeof k==='object'&&'GuardIdentifier'in k)e++;else{if(typeof k==='object'&&'Signer'in k)g++;else{if(typeof k==='object'&&'Entity'in k){const l=k['Entity'],m=typeof l==='string'?l:l?.['name_or_address'];if(typeof m==='string'&&m['toLowerCase']()===h)f++;}else typeof k==='string'&&k['toLowerCase']()===h&&f++;}}}}return{'recipient_slots':d,'guard_gated_slots':e,'direct_to_me_slots':f,'to_payer_slots':g};}async function queryObjectsBatched(a,b){const c=[];for(let d=0x0;d<a['length'];d+=QUERY_BATCH){const e=a['slice'](d,d+QUERY_BATCH),f=await query_objects({'objects':e,'network':b});c['push'](...f?.['objects']??[]);}return c;}async function fetchEntityPermissions(a,b){const c=new Map(),d=[];let e=undefined;for(;;){const g=await query_table({'parent':a,'cursor':e??undefined,'network':b});if(!g?.['items']||g['items']['length']===0x0)break;for(const h of g['items']){if(h['object'])d['push'](h['object']);}if(!g['hasNextPage']||!g['nextCursor'])break;e=g['nextCursor'];}const f=await queryObjectsBatched(d,b);for(const i of f){if(i?.['type']!=='TableItem_PermissionPerm')continue;const j=fld(i,'address'),k=fld(i,'perm')??[],l=k['map'](m=>typeof m==='number'?m:typeof m?.['index']==='number'?m['index']:null)['filter'](m=>m!==null);if(j)c['set'](j,l);}return c;}function toRadarMachineNodes(a){return a['map'](b=>({'name':b['name'],'pairs':(Array['isArray'](b['value'])?b['value']:[])['map'](c=>({'prev_node':c['prev_node'],'threshold':c['threshold']??undefined,'forwards':(c['forwards']??[])['map'](d=>({'name':d['name'],'permissionIndex':d['permissionIndex']??null,'namedOperator':d['namedOperator']??null,'guard':d['guard']?.['guard']??(typeof d['guard']==='string'?d['guard']:null),'weight':d['weight']??null}))}))}));}export async function handleParticipationRadar(a){if(!a['radar_account'])throw new Error('\x27radar_account\x27\x20is\x20required\x20for\x20participation_radar');if(!a['radar_targets']||a['radar_targets']['length']===0x0)throw new Error('\x27radar_targets\x27\x20(1-20\x20in-flight\x20orders)\x20is\x20required\x20for\x20participation_radar');const b=a['context_network']??'testnet',d=a['radar_include_alerts']??!![],f=[],g=await resolveAddress(a['radar_account'],'radar_account'),h=await Promise['all'](a['radar_targets']['map'](async I=>({'progress':await resolveAddress(I['progress'],'progress'),'order':I['order']?await resolveAddress(I['order'],'order'):undefined}))),i=h['flatMap'](I=>I['order']?[I['progress'],I['order']]:[I['progress']]),j=await queryObjectsBatched(i,b),k=new Map();for(const I of j){const J=fld(I,'object');if(J)k['set'](J,I);}const l=new Map(),m=new Map();for(const K of h){const L=k['get'](K['progress']);if(!L){f['push']('Progress\x20'+K['progress']+'\x20not\x20found\x20on\x20'+b+'\x20—\x20target\x20skipped.');continue;}l['set'](K['progress'],L);if(K['order']){const M=k['get'](K['order']);if(M)m['set'](K['order'],M);else f['push']('Order\x20'+K['order']+'\x20not\x20found\x20on\x20'+b+'\x20—\x20order-holder\x20detection\x20disabled\x20for\x20'+K['progress']+'.');}}h['length']>0x0&&l['size']===0x0&&f['push']('NETWORK\x20MISMATCH\x20SUSPECTED:\x200/'+h['length']+'\x20radar\x20targets\x20exist\x20on\x20network=\x27'+b+'\x27.\x20'+'These\x20objects\x20most\x20likely\x20live\x20on\x20a\x20different\x20network\x20—\x20re-run\x20with\x20the\x20matching\x20\x27network\x27\x20parameter.');const q=[...new Set([...l['values']()]['map'](N=>fld(N,'machine'))['filter'](N=>!!N))],s=[...new Set([...m['values']()]['map'](N=>fld(N,'service'))['filter'](N=>!!N))],u=[...new Set([...m['values']()]['flatMap'](N=>{const O=fld(N,'dispute');return Array['isArray'](O)?O:[];}))],w=new Map(),x=new Map(),y=new Map(),z=new Map();await Promise['all']([...q['map'](async N=>{try{const [O,P]=await Promise['all']([queryObjectsBatched([N],b),fetchMachineNodes(N,b)]);if(O[0x0])w['set'](N,O[0x0]);x['set'](N,toRadarMachineNodes(P));}catch(Q){f['push']('Machine\x20'+N+'\x20fetch\x20failed:\x20'+Q['message']+'\x20—\x20workflow\x20unknown\x20for\x20its\x20orders.');}}),((async()=>{if(s['length']===0x0)return;try{const N=await queryObjectsBatched(s,b);for(const O of N){const P=fld(O,'object');if(P)y['set'](P,O);}}catch(Q){f['push']('Service\x20query\x20failed:\x20'+Q['message']+'\x20—\x20compensation/reward\x20context\x20degraded.');}})()),((async()=>{if(u['length']===0x0)return;try{const N=await queryObjectsBatched(u,b);for(const O of N){const P=fld(O,'object');if(P)z['set'](P,O);}}catch(Q){f['push']('Arb\x20query\x20failed:\x20'+Q['message']+'\x20—\x20compensation\x20claim\x20detection\x20disabled.');}})())]);const A=new Map(),B=[...new Set(q['map'](N=>fld(w['get'](N),'permission'))['filter'](N=>!!N))],C=new Map();await Promise['all'](B['map'](async N=>{try{const [O,P]=await Promise['all']([queryObjectsBatched([N],b),fetchEntityPermissions(N,b)]),Q=O[0x0];C['set'](N,{'address':N,'entity_count':fld(Q,'entity_count'),'perm_remark':fld(Q,'perm_remark'),'entityPermissions':P,'owner':fld(Q,'builder')});}catch(R){f['push']('Permission\x20'+N+'\x20fetch\x20failed:\x20'+R['message']+'\x20—\x20operator\x20permission\x20matching\x20degraded.');}}));for(const N of q){const O=fld(w['get'](N),'permission');if(O&&C['has'](O))A['set'](N,C['get'](O));}let D=0x0;const E=new Map();try{const P=await watch_conversations({'account':g,'unreadOnly':!![],'previewMessageCount':0x0,'skipAutoMarkViewed':!![]}),Q=Array['isArray'](P)?P:P?.['conversations']??[];for(const R of Q){const S=R?.['peerAddress'],T=typeof R?.['unreadCount']==='number'?R['unreadCount']:0x0;typeof S==='string'&&T>0x0&&(E['set'](S['toLowerCase'](),T),D+=T);}}catch{f['push']('Messenger\x20unread\x20unavailable\x20(radar\x20account\x20is\x20not\x20a\x20local\x20messenger\x20account,\x20or\x20messenger\x20storage\x20offline)\x20'+'—\x20unread_messages_total\x20reported\x20as\x200.');}const F=[],G=Date['now']();for(const U of h){const V=l['get'](U['progress']);if(!V)continue;const W=U['order']?m['get'](U['order']):undefined,X=fld(V,'machine'),Y=fld(V,'current')??'',Z=fld(V,'namedOperator')??[],a0={};for(const ae of Z){if(ae?.['name'])a0[ae['name']]=Array['isArray'](ae['operators'])?ae['operators']:[];}const a1=W?fld(W,'service'):undefined,a2=a1?y['get'](a1):undefined;let a3;const a4=W?fld(W,'builder'):undefined;if(W&&a4===g){const af=fld(W,'dispute')??[];for(const ag of af){const ah=z['get'](ag);if(!ah)continue;const ai=fld(ah,'indemnity');if(ai){a3={'arbitration':fld(ah,'arbitration')??ag,'note':'Arbitration\x20verdict\x20recorded\x20an\x20indemnity\x20(Arb\x20'+ag+').\x20'+'Claim\x20via\x20service\x20op=\x27compensation_claim\x27\x20—\x20paid\x20directly\x20from\x20the\x20Service\x20compensation_fund.\x20'+'(Claimed-status\x20is\x20not\x20readable\x20from\x20the\x20Arb\x20object;\x20the\x20contract\x20rejects\x20double-claims.)'};break;}}}const a5=[];if(a2&&a4===g){const aj=fld(a2,'rewards')??[];for(const ak of aj){a5['push']({'address':ak,'description':'Service\x20reward\x20'+ak+'\x20(guard-gated\x20—\x20eligibility\x20verified\x20at\x20claim\x20time)'});}}const a6=isConsequenceNode(Y,'completed'),a7=isConsequenceNode(Y,'refunded');let a8=0x0;if(E['size']>0x0){const al=new Set();if(a4)al['add'](a4['toLowerCase']());for(const am of Object['values'](a0)){for(const an of am)al['add'](an['toLowerCase']());}al['delete'](g['toLowerCase']());for(const ao of al){a8+=E['get'](ao)??0x0;}}const a9={'account':g,'progress_address':U['progress'],'order_address':U['order'],'current_node':Y,'order_holder':a4,'machine_nodes':X?x['get'](X):undefined,'permission':X?A['get'](X)??null:null,'named_accounts':a0,'claimable_rewards':a5['length']>0x0?a5:undefined,'pending_compensation':a3,'rating_pending':a6&&a4===g,'unread_messages':a8>0x0?a8:undefined,'last_progress_at':fld(V,'current_time')??undefined,'now':G},aa=analyzeOrderParticipation(a9),ab=(fld(a2,'arbitrations')??[])['length']>0x0,ac=a6?'completed':a7?'refunded':null,ad=a9['last_progress_at']!=null?(G-a9['last_progress_at'])/0x36ee80:undefined;if(aa['perspective']==='merchant')aa['interest_analysis']=analyzeMerchantInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'allocation':summarizeAllocation(fld(a2,'order_allocators'),g),'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'arbitration_bound':ab,'rewards_count':(fld(a2,'rewards')??[])['length'],'stalled_hours':ad,'terminal':ac,'unread_messages':a8>0x0?a8:undefined});else{if(aa['perspective']==='supplier')aa['interest_analysis']=analyzeSupplierInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'arbitration_bound':ab,'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined});else{if(aa['perspective']==='collaborator')aa['interest_analysis']=analyzeCollaboratorInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'collaborator_kind':aa['collaborator_kind'],'arbitration_bound':ab,'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined});else aa['perspective']==='customer'&&(aa['interest_analysis']=analyzeCustomerInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'arbitration_bound':ab,'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined}));}}if(d&&W){const ap={'order_id':U['order'],'service_id':a1??'','current_node':Y||undefined,'created_at':Number(fld(W,'time')??G)||G,'last_progress_at':fld(V,'current_time')??undefined,'now':G,'order_amount':((()=>{try{return BigInt(fld(W,'amount')??0x0);}catch{return undefined;}})()),'compensation_balance':((()=>{try{const aq=fld(a2,'compensation_fund');return aq!=null?BigInt(aq):undefined;}catch{return undefined;}})()),'token':registryDisplayHint(extractGenericTokenType(fld(a2,'type_raw'))),'has_arbitration':(fld(a2,'arbitrations')??[])['length']>0x0,'pending_user_action':aa['operable']['some'](aq=>aq['execution_path']==='order_holder'),'completed':a6,'refunded':a7};try{const aq=monitorOrder({'current':ap,'thresholds':a['radar_monitor_thresholds']});aq['length']>0x0&&(aa['attached_alerts']=aq);}catch(ar){f['push']('Order\x20monitor\x20failed\x20for\x20'+U['order']+':\x20'+ar['message']+'.');}}F['push'](aa);}const H=aggregateRadar(F,D);return{'action':'participation_radar','account':g,'orders_analyzed':H['orders_analyzed'],'actionable':H['actionable'],'waiting':H['waiting'],'all_pending_claims':H['all_pending_claims'],'unread_messages_total':H['unread_messages_total'],'data_gaps':f,'summary':H['summary']};}
|