agentworkshop 0.11.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.AgentWorkShop/prompts/host-tools.json +4 -4
- package/.output/.AgentWorkShop/prompts/host-tools.json +4 -4
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DXXBGPAc.js → CsdezMu9.js} +4 -4
- package/.output/public/_nuxt/WL1R8lPA.js +1 -0
- package/.output/public/_nuxt/_id_.Czwkl50w.css +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/2f96705b-cf57-4bde-87a4-1b818b268f0f.json +1 -0
- package/.output/server/chunks/_/access.mjs +1 -1
- package/.output/server/chunks/_/candidate-store.mjs +1 -1
- package/.output/server/chunks/_/catalog-view.mjs +1 -1
- package/.output/server/chunks/_/character-asset.repo.mjs +1 -1
- package/.output/server/chunks/_/data-export.mjs +6 -6
- package/.output/server/chunks/_/data-query.mjs +3 -3
- package/.output/server/chunks/_/eda-run.repo.mjs +2 -2
- package/.output/server/chunks/_/entity.mjs +1 -1
- package/.output/server/chunks/_/features.mjs +5 -5
- package/.output/server/chunks/_/golden.mjs +3 -3
- package/.output/server/chunks/_/host-bindings.mjs +1 -1
- package/.output/server/chunks/_/index.mjs +1 -1
- package/.output/server/chunks/_/line-scope.mjs +1 -1
- package/.output/server/chunks/_/mes-console.mjs +1 -1
- package/.output/server/chunks/_/mes-secrets.repo.mjs +1 -1
- package/.output/server/chunks/_/mes-templates.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +4084 -2343
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/_/ocap.mjs +1 -1
- package/.output/server/chunks/_/orchestrator.mjs +1 -1
- package/.output/server/chunks/_/promote.mjs +1 -1
- package/.output/server/chunks/_/rest-auth.mjs +1 -1
- package/.output/server/chunks/_/runtime.mjs +8 -8
- package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
- package/.output/server/chunks/_/spc.mjs +1 -1
- package/.output/server/chunks/_/validator.mjs +1 -1
- package/.output/server/chunks/build/TownView-DD1zY8xq.mjs +1 -1
- package/.output/server/chunks/build/{_id_-C0vNEbts.mjs → _id_-B9zi8WEg.mjs} +23 -12
- package/.output/server/chunks/build/_id_-B9zi8WEg.mjs.map +1 -0
- package/.output/server/chunks/build/_wsId_-LDv5SEW_.mjs +1 -1
- package/.output/server/chunks/build/daq-B5zlUIlb.mjs +1 -1
- package/.output/server/chunks/build/dcw-B-eoU7sq.mjs +1 -1
- package/.output/server/chunks/build/types-D6J7slEa.mjs +1 -1
- package/.output/server/chunks/build/useDaqAddNode-Dr5CfMpU.mjs +1 -1
- package/.output/server/chunks/build/useDaqDetailNode-DDq5osE-.mjs +1 -1
- package/.output/server/chunks/build/useDaqDetailParams-DdOcUvHG.mjs +1 -1
- package/.output/server/chunks/build/useDaqFilters-Y_NRhP6i.mjs +1 -1
- package/.output/server/chunks/build/useDaqStream-phwM5tIN.mjs +1 -1
- package/.output/server/chunks/build/useDaqTemplates-lKw2b01d.mjs +1 -1
- package/.output/server/chunks/build/useDcwAddNode-CT-oOFom.mjs +1 -1
- package/.output/server/chunks/build/useDcwStream-CNtMGcR0.mjs +1 -1
- package/.output/server/chunks/routes/api/mcp/workshop.mjs +1 -1
- package/.output/server/chunks/routes/api/system/backup/run.post.mjs +2 -2
- package/.output/server/chunks/routes/api/system/index.patch.mjs +2 -2
- package/.output/server/chunks/routes/api/system/shutdown.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs +7 -2
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/agents/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id/preview.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/datasets/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/env/recheck.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/env/uv.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/env/venv.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index5.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/cancel.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/logs.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/jobs/_id/retry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/jobs/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/models/_id/predict.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/models/_id/promote.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/models/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/models/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id/train.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/training-plans/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/training-plans/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/aml/twin/providers.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/analysis/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/analysis/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/analysis/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/devices/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/assets/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/activate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/agents/_agentId_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/chat/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/execution-mode.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/harness-profiles/promote.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/improvement-proposals/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index11.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index2.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index5.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index7.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/line.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/members/join.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/memories/_memoryId/promote.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/memories/merge.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/products.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/products.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/terminals.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/tool-usage.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/tools/reset.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/twin-profile.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +7 -7
- package/.output/server/chunks/routes/api/workshop/daq/_id/bind.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/bindings.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames/content.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/frames.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/ingest.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/daq/_id/samples.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id/test.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/alarms/_id/ack.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/infra/reconnect.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/storage/retention.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/storage/rollup.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/storage.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/templates/_key_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/test-driver.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bind.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/bindings.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/param-ledger.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/read.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/test.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id/write.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/controller.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index5.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index5.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/journal/node/_nodeId/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/line/query.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/start.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/lines/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/mes-artifacts/file.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/mes-hook-test.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/mes-test-read.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/judge.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id/series.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/optimizations/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/read.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id/write.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/params/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/products/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/apply.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/mark-good.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/revert.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id/rollback-good.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/close.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/data.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/runs/_id/rollback.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/templates/_key_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/test-driver.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/control.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id/telemetry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/device-twins/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/commonality.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/index6.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/vm/predict.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/exp/confirmations/_id/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/exp/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/fs/dirs.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses/_id/providers.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/harnesses.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index12.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index13.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index14.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index5.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index6.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index7.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index8.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index9.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mes/bridge.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mes/datasets.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/autofix.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/subgraph.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/index.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/capabilities.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/index.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/index2.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/profiles/_id/publish.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/crosscheck.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/recommendations/_id/dispatch.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/optimization/solve.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/datasets.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/eligibility.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/experiments.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/index.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/specs/_id/publish.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/process-model/train.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/activate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/approvals/_aid/decide.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/archive.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/channels/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/complete.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/continue.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/_did/waive.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/deliverables/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/health.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index2.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index3.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index3.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index4.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index5.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index6.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index7.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/kernel/tick.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/ledger.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/members/_userId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/observability/activity.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/observability/route.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/observability/work-items/_wid_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/observability.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/pause.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/plan/request-approval.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/proposals/_decisionId/apply.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/reconcile.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/report.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/request-acceptance.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/review.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/submit.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/results/_rid/supersede.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/resume.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/sessions.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/snapshot.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/terminate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/trace/_traceId_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/cancel.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/dispatch.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/_wid/retry.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id/work-items/index.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/projects/instantiate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs +44 -0
- package/.output/server/chunks/routes/api/workshop/tasks/_id/recovery-disposition.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs +38 -0
- package/.output/server/chunks/routes/api/workshop/tasks/recovery-holds.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/teams/_id/deploy.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/teams/_id/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/tools/sync.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +2 -2
- package/.output/server/chunks/routes/api/workshop/ws/ticket.post.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +2 -2
- package/.output/server/chunks/virtual/entry.mjs +6 -2
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +19 -7
- package/README.md +21 -7
- package/app/components/dcw/DcwNodesTable.vue +24 -0
- package/config.yml +1 -1
- package/docs/cli.en.md +1 -1
- package/docs/cli.md +1 -1
- package/docs/mcp.en.md +30 -27
- package/docs/mcp.md +7 -3
- package/docs/plugin-idd-rag-contract.md +87 -0
- package/docs/plugins.en.md +5 -3
- package/docs/plugins.md +5 -3
- package/docs/sdk.en.md +1 -1
- package/docs/sdk.md +1 -1
- package/i18n/dicts/dcwDetail.json +221 -219
- package/i18n/locales/en.ts +2 -0
- package/i18n/locales/zh-CN.ts +2 -0
- package/package.json +3 -1
- package/scripts/check-docs-sync.mjs +20 -9
- package/scripts/onboarding/forge-channel.mjs +2 -1
- package/scripts/onboarding/lib.mjs +159 -3
- package/scripts/onboarding/onboard.mjs +2 -0
- package/scripts/onboarding/preflight.mjs +233 -231
- package/scripts/onboarding/provision-line.mjs +12 -2
- package/scripts/onboarding/sim-attest.mjs +103 -0
- package/scripts/onboarding/sim-twin.mjs +115 -19
- package/scripts/onboarding/test-connection.mjs +2 -1
- package/scripts/onboarding/v6-protected-api.mjs +41 -0
- package/scripts/onboarding/v6-protected-fixture.mjs +54 -0
- package/scripts/onboarding/verify-line.mjs +179 -136
- package/scripts/onboarding/verify-mirror.mjs +149 -145
- package/server/api/workshop/agent-tools/list.get.ts +10 -1
- package/server/api/workshop/tasks/[id]/recovery-disposition.post.ts +32 -0
- package/server/api/workshop/tasks/recovery-holds.get.ts +22 -0
- package/server/plugins-builtin/diag-bridge/host/deposit.mjs +232 -0
- package/server/plugins-builtin/diag-bridge/host/diagnosis.mjs +121 -38
- package/server/plugins-builtin/diag-bridge/host/external-v1.mjs +213 -0
- package/server/plugins-builtin/diag-bridge/host/helpers.mjs +4 -2
- package/server/plugins-builtin/diag-bridge/host/intents.mjs +65 -62
- package/server/plugins-builtin/diag-bridge/host/plugin.mjs +351 -82
- package/server/plugins-builtin/diag-bridge/host/receipt.mjs +83 -0
- package/server/plugins-builtin/diag-bridge/host/sweep.mjs +70 -91
- package/server/plugins-builtin/diag-bridge/i18n.json +4 -0
- package/server/plugins-builtin/rag-bridge/i18n.json +18 -0
- package/server/plugins-builtin/rag-bridge/index.mjs +570 -64
- package/server/services/workshop/agents/agent-interface.ts +3 -0
- package/server/services/workshop/agents/base-agent.ts +100 -4
- package/server/services/workshop/agents/execution-scope.ts +26 -0
- package/server/services/workshop/agents/hitl-capabilities.ts +3 -3
- package/server/services/workshop/agents/host-tool-bridge/dispatch.ts +42 -2
- package/server/services/workshop/agents/host-tool-bridge/tools/progress.ts +4 -0
- package/server/services/workshop/agents/host-tool-bridge/tools/tasks.ts +11 -28
- package/server/services/workshop/agents/host-tool-bridge/tools/team-delegation.ts +83 -129
- package/server/services/workshop/agents/industrial/dcw-tools.ts +27 -5
- package/server/services/workshop/agents/industrial/line-tools.ts +15 -4
- package/server/services/workshop/agents/industrial/ops-tools.ts +32 -6
- package/server/services/workshop/agents/industrial/optimization-tools.ts +28 -4
- package/server/services/workshop/agents/industrial/recipe-propose-tools.ts +26 -3
- package/server/services/workshop/agents/omp-agent/client.ts +2 -4
- package/server/services/workshop/agents/omp-agent/core.ts +3 -0
- package/server/services/workshop/agents/omp-agent/lifecycle.ts +70 -4
- package/server/services/workshop/agents/omp-agent/supervision-decision.ts +3 -1
- package/server/services/workshop/agents/omp-agent/tools-steer.ts +113 -32
- package/server/services/workshop/agents/tool-approvals.ts +113 -29
- package/server/services/workshop/agents/tool-classes.ts +72 -56
- package/server/services/workshop/db/database/open.ts +5 -2
- package/server/services/workshop/db/database/schema.ts +1 -0
- package/server/services/workshop/db/database/seed.ts +2 -2
- package/server/services/workshop/db/message.repo.ts +134 -26
- package/server/services/workshop/db/project-kernel.repo.ts +3 -3
- package/server/services/workshop/db/schema.sql +3 -1
- package/server/services/workshop/db/task.repo.ts +101 -0
- package/server/services/workshop/dcw/dcw-controller/actuation.ts +120 -9
- package/server/services/workshop/dcw/dcw-controller/contracts.ts +18 -16
- package/server/services/workshop/dcw/dcw-controller/crud.ts +23 -0
- package/server/services/workshop/dcw/dcw-controller/lines.ts +34 -2
- package/server/services/workshop/dcw/dcw-controller/recipes.ts +80 -6
- package/server/services/workshop/dcw/dcw-controller/state.ts +89 -88
- package/server/services/workshop/dcw/dcw-controller/types.ts +5 -0
- package/server/services/workshop/dcw/dcw-controller/write.ts +9 -6
- package/server/services/workshop/dcw/dcw-line.repo.ts +2 -0
- package/server/services/workshop/dcw/dcw-node.repo.ts +3 -1
- package/server/services/workshop/dcw/dcw-node.ts +346 -307
- package/server/services/workshop/dcw/dcw-runtime.ts +8 -4
- package/server/services/workshop/projects/effects.ts +47 -29
- package/server/services/workshop/projects/kernel.ts +8 -1
- package/server/services/workshop/projects/legacy-recovery.ts +36 -0
- package/server/services/workshop/projects/service.ts +15 -0
- package/server/services/workshop/runtime/agent-runtime/contracts.ts +1 -1
- package/server/services/workshop/runtime/agent-runtime/lifecycle.ts +7 -2
- package/server/services/workshop/runtime/agent-runtime/message-watchdog.ts +40 -0
- package/server/services/workshop/runtime/agent-runtime/message.ts +151 -21
- package/server/services/workshop/runtime/agent-runtime/state.ts +69 -13
- package/server/services/workshop/runtime/agent-runtime/supervise.ts +219 -42
- package/server/services/workshop/runtime/agent-runtime/types.ts +6 -0
- package/server/services/workshop/runtime/mailbox.ts +112 -21
- package/server/services/workshop/runtime/manager/admin-channel.ts +34 -22
- package/server/services/workshop/runtime/manager/host-tools.ts +18 -5
- package/server/services/workshop/runtime/manager/runtime-wiring.ts +101 -41
- package/server/services/workshop/runtime/manager/schedules.ts +3 -1
- package/server/services/workshop/runtime/manager/tasks.ts +41 -0
- package/server/services/workshop/runtime/memory/recall.ts +11 -4
- package/server/services/workshop/runtime/memory/types.ts +2 -0
- package/server/services/workshop/runtime/scheduler-loop/contracts.ts +29 -29
- package/server/services/workshop/runtime/scheduler-loop/execute.ts +7 -0
- package/server/services/workshop/runtime/scheduler-loop/rules.ts +3 -0
- package/server/services/workshop/runtime/scheduler-loop/snapshot.ts +10 -2
- package/server/services/workshop/runtime/scheduler-loop/state.ts +12 -0
- package/server/services/workshop/runtime/scheduler-loop/tick.ts +54 -5
- package/server/services/workshop/runtime/task-engine/create.ts +16 -0
- package/server/services/workshop/runtime/task-engine/helpers.ts +5 -0
- package/server/services/workshop/runtime/task-engine/legacy-recovery.ts +149 -0
- package/server/services/workshop/runtime/task-engine/lifecycle.ts +38 -1
- package/server/services/workshop/runtime/task-engine/transition.ts +4 -0
- package/server/services/workshop/runtime/task-engine/update.ts +6 -0
- package/server/services/workshop/runtime/task-engine/views.ts +61 -0
- package/server/services/workshop/tools/policy.ts +16 -1
- package/shared/dcw-protocol/line.ts +4 -0
- package/.output/public/_nuxt/C8QlHux5.js +0 -1
- package/.output/public/_nuxt/_id_.0EnzA0aA.css +0 -1
- package/.output/public/_nuxt/builds/meta/846b9c03-1442-4fcb-b3fc-1d9484eaa41b.json +0 -1
- package/.output/server/chunks/build/_id_-C0vNEbts.mjs.map +0 -1
|
@@ -1,56 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host 工具分类的单一声明源(纯常量、零依赖)。
|
|
3
|
-
* 权限面(permission-scope)与测试需在 nitro 之外导入本模块 ——
|
|
4
|
-
* host-tool-bridge/catalog 从此处 re-export,保持既有导入路径兼容。
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** 仅 lead 可见的工具名(dispatch/调度/团队管理面 + AML 模型治理面;worker 注册时剔除,压缩工具上下文) */
|
|
8
|
-
export const LEAD_ONLY_TOOL_NAMES = new Set([
|
|
9
|
-
'submit_task',
|
|
10
|
-
'dispatch_task',
|
|
11
|
-
'get_queue_overview',
|
|
12
|
-
'read_channel_mail',
|
|
13
|
-
'reassign_task',
|
|
14
|
-
'update_task',
|
|
15
|
-
'create_team_agent',
|
|
16
|
-
'update_team_agent',
|
|
17
|
-
'remove_team_agent',
|
|
18
|
-
'aml_model_promote',
|
|
19
|
-
'team_grant_nodes',
|
|
20
|
-
'team_revoke_nodes',
|
|
21
|
-
])
|
|
22
|
-
|
|
23
|
-
/** Hybrid Twin 的直接写入工具:权限面(permission-scope)与目录注入面(host-tool-bridge/catalog)fail-closed 同源于本集合;dispatch 分发层的同款守卫为并行在飞改动,待其收敛后接入(勿在此重复第三份清单)。 */
|
|
24
|
-
export const HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES = new Set([
|
|
25
|
-
'dcw_control',
|
|
26
|
-
'param_control',
|
|
27
|
-
'dcw_rollback',
|
|
28
|
-
'recipe_create',
|
|
29
|
-
'recipe_update',
|
|
30
|
-
'recipe_rollback',
|
|
31
|
-
'recipe_trial',
|
|
32
|
-
'recipe_apply',
|
|
33
|
-
])
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 观察模式(executionMode=observe)的拒绝面 = 8 个直写族 ∪ 治理写 ∪ 整包方案 ∪ 启停线。
|
|
37
|
-
* 由 HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES 派生,不再各层手抄(历史上有过注入/执行分裂)。
|
|
38
|
-
*/
|
|
39
|
-
export const OBSERVE_BLOCKED_TOOL_NAMES: ReadonlySet<string> = new Set([
|
|
40
|
-
...HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES,
|
|
41
|
-
'optimization_explore',
|
|
42
|
-
'recipe_propose',
|
|
43
|
-
'line_start',
|
|
44
|
-
'line_stop',
|
|
45
|
-
])
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Host 工具分类的单一声明源(纯常量、零依赖)。
|
|
3
|
+
* 权限面(permission-scope)与测试需在 nitro 之外导入本模块 ——
|
|
4
|
+
* host-tool-bridge/catalog 从此处 re-export,保持既有导入路径兼容。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** 仅 lead 可见的工具名(dispatch/调度/团队管理面 + AML 模型治理面;worker 注册时剔除,压缩工具上下文) */
|
|
8
|
+
export const LEAD_ONLY_TOOL_NAMES = new Set([
|
|
9
|
+
'submit_task',
|
|
10
|
+
'dispatch_task',
|
|
11
|
+
'get_queue_overview',
|
|
12
|
+
'read_channel_mail',
|
|
13
|
+
'reassign_task',
|
|
14
|
+
'update_task',
|
|
15
|
+
'create_team_agent',
|
|
16
|
+
'update_team_agent',
|
|
17
|
+
'remove_team_agent',
|
|
18
|
+
'aml_model_promote',
|
|
19
|
+
'team_grant_nodes',
|
|
20
|
+
'team_revoke_nodes',
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
/** Hybrid Twin 的直接写入工具:权限面(permission-scope)与目录注入面(host-tool-bridge/catalog)fail-closed 同源于本集合;dispatch 分发层的同款守卫为并行在飞改动,待其收敛后接入(勿在此重复第三份清单)。 */
|
|
24
|
+
export const HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES = new Set([
|
|
25
|
+
'dcw_control',
|
|
26
|
+
'param_control',
|
|
27
|
+
'dcw_rollback',
|
|
28
|
+
'recipe_create',
|
|
29
|
+
'recipe_update',
|
|
30
|
+
'recipe_rollback',
|
|
31
|
+
'recipe_trial',
|
|
32
|
+
'recipe_apply',
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 观察模式(executionMode=observe)的拒绝面 = 8 个直写族 ∪ 治理写 ∪ 整包方案 ∪ 启停线。
|
|
37
|
+
* 由 HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES 派生,不再各层手抄(历史上有过注入/执行分裂)。
|
|
38
|
+
*/
|
|
39
|
+
export const OBSERVE_BLOCKED_TOOL_NAMES: ReadonlySet<string> = new Set([
|
|
40
|
+
...HYBRID_TWIN_DIRECT_WRITE_TOOL_NAMES,
|
|
41
|
+
'optimization_explore',
|
|
42
|
+
'recipe_propose',
|
|
43
|
+
'line_start',
|
|
44
|
+
'line_stop',
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
// These tools can change node grants or the channel's authorized membership.
|
|
48
|
+
const TOKEN_PROVENANCE_AUTHORIZATION_TOOLS: ReadonlySet<string> = new Set([
|
|
49
|
+
'team_grant_nodes',
|
|
50
|
+
'team_revoke_nodes',
|
|
51
|
+
'dispatch_task',
|
|
52
|
+
'create_team_agent',
|
|
53
|
+
'update_team_agent',
|
|
54
|
+
'remove_team_agent',
|
|
55
|
+
])
|
|
56
|
+
|
|
57
|
+
/** Agent tokens identify an agent, not an authorized turn; built-ins take precedence over plugins. */
|
|
58
|
+
export function allowedWithoutTurnProvenance(name: string, isBuiltin: boolean, plugin?: { riskClass?: unknown }): boolean {
|
|
59
|
+
if (OBSERVE_BLOCKED_TOOL_NAMES.has(name) || TOKEN_PROVENANCE_AUTHORIZATION_TOOLS.has(name)) return false
|
|
60
|
+
return isBuiltin || !plugin || plugin.riskClass === 'read'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** MES 数据集工具(只读面:点位目录/历史取数/数据集读取与清单)。
|
|
64
|
+
* 不落 HIGH_RISK、不写 PLC —— fetch 只写 CSV 数据集文件(护栏在 mes-controller 代码级:
|
|
65
|
+
* 绑线授权/窗口≤7天/行数≤5000/频次限流);权限面与目录注入面可同源引用本集合。 */
|
|
66
|
+
export const MES_READ_TOOL_NAMES = new Set([
|
|
67
|
+
'mes_catalog',
|
|
68
|
+
'mes_fetch',
|
|
69
|
+
'mes_export',
|
|
70
|
+
'mes_dataset_read',
|
|
71
|
+
'mes_datasets',
|
|
72
|
+
])
|
|
@@ -17,6 +17,7 @@ import { migrateImprovementActions } from './migrations-improvement-actions'
|
|
|
17
17
|
import { migrateBlindVerifications } from './migrations-blind-verification'
|
|
18
18
|
import { ensureMigrationLedger, assertMigrationFingerprint, fingerprintMigration, recordMigration } from './migration-ledger'
|
|
19
19
|
import { seedDefaultWorkshopData } from './seed'
|
|
20
|
+
import { holdLegacyActiveTasks } from '../../runtime/task-engine/legacy-recovery'
|
|
20
21
|
|
|
21
22
|
export const require = createRequire(import.meta.url)
|
|
22
23
|
export function openWorkshopDb(path: string): DatabaseSync {
|
|
@@ -42,9 +43,9 @@ export function openWorkshopDb(path: string): DatabaseSync {
|
|
|
42
43
|
* 版本号是存量库不被新契约哈希拒绝启动的前提:老库只记录了旧版本号,
|
|
43
44
|
* assertMigrationFingerprint 查不到新版本行即放行并补录;同版本内的 SQL
|
|
44
45
|
* 漂移(手改/回滚 schema)仍会被哈希比对抓住。
|
|
45
|
-
* 历史:v1 初始契约;v2 2026-11-15 channels.channel_mode。
|
|
46
|
+
* 历史:v1 初始契约;v2 2026-11-15 channels.channel_mode;v3 messages.claim_token。
|
|
46
47
|
*/
|
|
47
|
-
const SCHEMA_CONTRACT_VERSION =
|
|
48
|
+
const SCHEMA_CONTRACT_VERSION = 3
|
|
48
49
|
|
|
49
50
|
/** 对已打开的库执行初始化:WAL + 外键约束 + 建表 + 增量迁移 */
|
|
50
51
|
export function initWorkshopDb(db: DatabaseSync): void {
|
|
@@ -140,6 +141,8 @@ export function initWorkshopDb(db: DatabaseSync): void {
|
|
|
140
141
|
migrateChannelExecutionModeColumn(db)
|
|
141
142
|
// P3-4(2026-11-01):steer 失败重投上限 —— messages.attempts 列(重投 +1,≥3 → dead)
|
|
142
143
|
migrateAddColumn(db, 'messages', 'attempts', 'INTEGER NOT NULL DEFAULT 0')
|
|
144
|
+
migrateAddColumn(db, 'messages', 'claim_token', 'TEXT')
|
|
145
|
+
holdLegacyActiveTasks(db)
|
|
143
146
|
// v32(ONT):Profile 冻结本体引用摘要(缺省 [] = 无本体约束域;只前滚,不回填)
|
|
144
147
|
migrateAddColumn(db, 'optimizer_profiles', 'ontology_refs_json', 'TEXT NOT NULL DEFAULT \'[]\'')
|
|
145
148
|
seedDefaultWorkshopData(db)
|
|
@@ -60,6 +60,7 @@ CREATE TABLE IF NOT EXISTS messages (
|
|
|
60
60
|
client_message_id TEXT, -- session client idempotency key; NULL for legacy/non-session sends
|
|
61
61
|
state TEXT NOT NULL DEFAULT 'pending', -- pending|consuming|consumed|dead(P3-4:重投达上限)
|
|
62
62
|
attempts INTEGER NOT NULL DEFAULT 0, -- P3-4:steer 失败重投计数(requeue +1)
|
|
63
|
+
claim_token TEXT, -- unique per consuming claim
|
|
63
64
|
created_at TEXT NOT NULL,
|
|
64
65
|
consumed_at TEXT
|
|
65
66
|
);
|
|
@@ -126,7 +126,7 @@ export const DEFAULT_CHANNEL_TEMPLATES: Array<{
|
|
|
126
126
|
你是产线闭环优化团队,围绕用户 goal 对**任意已接入产线**做「取证 → 知识增强 → 寻优 → 治理下发 → 复测收口(劣化即回退)」的闭环优化。开工前先用 my_industrial_nodes 与 line_context 弄清本频道持有的节点授权、产线/产品/配方与安全量程,不假设场景。
|
|
127
127
|
|
|
128
128
|
## 团队分工
|
|
129
|
-
- 生产主管(lead):统一调配 —— 把 goal 拆解为「数据分析」「知识调优」「参数调整」子任务并派发(worker
|
|
129
|
+
- 生产主管(lead):统一调配 —— 把 goal 拆解为「数据分析」「知识调优」「参数调整」子任务并派发(worker 缺节点权限时,先用 team_grant_nodes 单独授予 lead 已绑定的节点,再用不带 grant_node_ids 的 dispatch_task 派发;两步不是原子操作);复核成员结论(必须带数据证据);复测劣化时决策回退(指示工艺工程师 recipe_rollback(dispatch=true) 统一回退);对拿不准的现象先查知识库(若已启用)。
|
|
130
130
|
- 数据分析师(worker):**持续读数** —— 按固定节拍(每批次或每 5 分钟)daq_query 拉取授权数采节点时窗数据,滑动窗口对比输出趋势/均值/越限统计与工况判读;异常第一时间通报 lead、工艺工程师与知识调优工程师。
|
|
131
131
|
- 知识调优工程师(worker):**知识↔数据 → 调优方案** —— 用 kb_agent(mode=sync) 检索知识库中本场景的机理知识与历史经验(检索词带产线/产品/关键物理量),结合数据分析师的判读结论,产出带知识依据的调优方案(参数/方向/步幅/预期响应,引用知识条目与数据);知识库未启用或检索为空时退化为纯数据驱动建议并说明。收口后用 kb_agent(mode=async) 沉淀「知识↔调整↔响应」经验入库。
|
|
132
132
|
- 工艺工程师(worker):持有数控节点授权 —— daq_query 取证 → 按调优方案转成配方候选,在「安全量程 ∩ 配方窗口 ∩ 单步限幅」内 recipe_trial 整批试验(单变量小步幅);manual 模式节点先说明理由等用户批准;调整后等工艺惯性响应再复测;复测劣化立即 recipe_rollback(dispatch=true) 统一回退本次调整并通报 lead。
|
|
@@ -134,7 +134,7 @@ export const DEFAULT_CHANNEL_TEMPLATES: Array<{
|
|
|
134
134
|
## 作业纪律
|
|
135
135
|
数据先行 → 知识增强(检索在动手前)→ **产线上下文先行**(频道已绑定产线时,开工先用 line_context 读取绑定产线全景:运行状态/活动批次/当前配方与参数窗口 —— 频道绑定=只读授权,日志/配方史全员可查,写操作仍需节点授权)→ **参数变更一律走配方链路**:多参数候选 → recipe_trial 整批试验(一次带上所有要改的参数,**不写配方版本**;同线节拍 ≥5 分钟)→ 等工艺惯性后复测判读 → 有进步/达标 **recipe_update 固化**(同一配方 id,版本+1,更新而非新建)→ 需要正式落地用 recipe_apply 整批下发;无进步/劣化 **recipe_rollback(dispatch=true) 统一回退**(定义回退+PLC 整批恢复)→ 复测闭环 → 结论必附带单位与时间窗的数据证据;优化闭环内禁用逐参数直调(直写工具已禁用,防单参数震荡;AML 探索模式经 optimization_explore 的小步激励除外);知识闭环 = 检索 → 增强 → 试验 → 判读 → 固化/回退 → 沉淀;不得操作未授权节点;治理审批与硬约束被拒时按指引降步重试,不绕行。`,
|
|
136
136
|
members: [
|
|
137
|
-
{ inline: { name: '生产主管', harness: 'omp', config: { rpcMode: 'rpc', role: 'lead', systemPromptPrefix: '你是通用闭环优化团队的生产主管(lead),统一调配三人(数据分析师/知识调优工程师/工艺工程师):把用户 goal
|
|
137
|
+
{ inline: { name: '生产主管', harness: 'omp', config: { rpcMode: 'rpc', role: 'lead', systemPromptPrefix: '你是通用闭环优化团队的生产主管(lead),统一调配三人(数据分析师/知识调优工程师/工艺工程师):把用户 goal 拆解为「数据分析」「知识调优」「参数调整」子任务;需要授权时先用 team_grant_nodes 单独授予自己已绑定的节点,再用不带 grant_node_ids 的 dispatch_task 派发,两步不是原子操作;也可执行中单独授予;复核成员结论(必须带数据证据);优化动作一律走配方链路(trial 试验 → 判读 → update 固化 / 统一回退),复测指标劣化时立即指示工艺工程师 recipe_rollback(dispatch=true) 统一回退后再调整方向;频道绑定的产线只优化其当前活动配方,不新建配方 id;若知识库已启用,开工前先用 kb_agent(mode=sync) 检索场景相关数据分析与物理机理,收口后用 kb_agent(mode=async) 沉淀本次经验(可交知识调优工程师执行)。' } }, role: 'lead' },
|
|
138
138
|
{ inline: { name: '数据分析师', harness: 'omp', config: { rpcMode: 'rpc', systemPromptPrefix: '你是通用闭环优化团队的数据分析师,负责持续读数与工况判读:按固定节拍(每批次或每 5 分钟,以任务要求为准)用 daq_query 拉取授权数采节点数据(按批次/时间窗),做滑动窗口对比(当前窗 vs 基线窗),输出趋势/均值/极值/越限统计;结合数控设定考虑设定-响应滞后;发现越限或异常趋势立即用 send_message_to_agent 通报 lead、工艺工程师与知识调优工程师。结论一律引用具体数值与时间窗。' } }, role: 'worker' },
|
|
139
139
|
{ inline: { name: '知识调优工程师', harness: 'omp', config: { rpcMode: 'rpc', systemPromptPrefix: '你是通用闭环优化团队的知识调优工程师,把「知识库经验」与「数据分析结论」转化为可执行调优方案:先用 kb_agent(mode=sync) 检索知识库中本场景的机理知识与历史经验(检索词带产线/产品/关键物理量);结合数据分析师的最新判读,产出带知识依据的调优方案(调哪个参数/方向/步幅/预期响应/依据哪条知识,引用知识条目与数据证据);知识库未启用或检索为空时退化为纯数据驱动建议并明确说明;方案交工艺工程师治理下发(走 recipe_trial 小步试验);复测有效则用 kb_agent(mode=async) 把「知识↔调整↔响应」经验沉淀入库(异步提交后无需等待);复测劣化则立即建议回退并同步 lead。' } }, role: 'worker' },
|
|
140
140
|
{ inline: { name: '工艺工程师', harness: 'omp', config: { rpcMode: 'rpc', systemPromptPrefix: '你是通用闭环优化团队的工艺工程师,按知识调优工程师的方案走配方链路执行:my_industrial_nodes 确认授权 → daq_query 取证 → 把方案转成 recipe_trial(多参数候选整批试验,一次带上所有要改的参数,带 hypothesis 声明依据;不写配方版本)→ 等待工艺惯性后 daq_query 复测 → 有进步/达标用 recipe_update 把候选值固化进配方(同 id 版本+1),需要正式落地用 recipe_apply 整批下发;无进步/劣化用 recipe_rollback(dispatch=true)统一回退(定义回退+PLC 整批恢复)。优化闭环内禁用逐参数直调(直写工具已禁用,防震荡)。你的节点授权可能由 lead 在派发时或执行中授予(权限变化以 my_industrial_nodes 实时查询为准)。manual 模式节点下发前说明理由等批准。结论一律引用带单位与时间窗的数据。' } }, role: 'worker' },
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { randomUUID } from 'node:crypto'
|
|
6
6
|
import type { DatabaseSync } from 'node:sqlite'
|
|
7
7
|
import type { MessageRow } from './database'
|
|
8
|
+
import { LEGACY_RECOVERY_MARKER } from '../runtime/task-engine/legacy-recovery'
|
|
8
9
|
|
|
9
10
|
const COLS
|
|
10
11
|
= 'id, channel_id AS channelId, task_id AS taskId, session_id AS sessionId, actor_user_id AS actorUserId, client_message_id AS clientMessageId, from_agent_id AS fromAgentId, to_agent_id AS toAgentId, role, parts_json AS partsJson, metadata_json AS metadataJson, state, attempts, created_at AS createdAt, consumed_at AS consumedAt'
|
|
@@ -27,6 +28,33 @@ export interface MessageCreateInput {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export type MessageRepo = ReturnType<typeof createMessageRepo>
|
|
31
|
+
export type MessageBlocked = (row: MessageRow) => boolean
|
|
32
|
+
|
|
33
|
+
/** Preserve ordinary object metadata; ambiguous linked rows are not safe to execute. */
|
|
34
|
+
export function isRecoveryBlockedMessage(row: MessageRow, isLegacyRecoveryBlocked: (taskId: string) => boolean): boolean {
|
|
35
|
+
let metadata: unknown
|
|
36
|
+
try {
|
|
37
|
+
metadata = JSON.parse(row.metadataJson)
|
|
38
|
+
}
|
|
39
|
+
catch { metadata = null }
|
|
40
|
+
const isObject = metadata !== null && typeof metadata === 'object' && !Array.isArray(metadata)
|
|
41
|
+
const fields = isObject ? metadata as Record<string, unknown> : null
|
|
42
|
+
if (fields && !Object.hasOwn(fields, 'x-aw-task-kind')) return false
|
|
43
|
+
const ids = [row.taskId, fields?.['x-aw-task-id'], fields?.['x-aw-child-task-id']]
|
|
44
|
+
try {
|
|
45
|
+
return ids.some(id => typeof id === 'string' && id.length > 0 && isLegacyRecoveryBlocked(id))
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function blockedSafely(isBlocked: MessageBlocked, row: MessageRow): boolean {
|
|
53
|
+
try {
|
|
54
|
+
return isBlocked(row)
|
|
55
|
+
}
|
|
56
|
+
catch { return true }
|
|
57
|
+
}
|
|
30
58
|
|
|
31
59
|
export function createMessageRepo(db: DatabaseSync) {
|
|
32
60
|
const insert = db.prepare(
|
|
@@ -41,34 +69,71 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
41
69
|
const firstPending = db.prepare(
|
|
42
70
|
`SELECT ${COLS} FROM messages WHERE channel_id = ? AND to_agent_id = ? AND state = 'pending' ORDER BY createdAt ASC, rowid ASC LIMIT 1`,
|
|
43
71
|
)
|
|
72
|
+
const pendingById = db.prepare(`SELECT ${COLS} FROM messages WHERE id = ? AND state = 'pending'`)
|
|
73
|
+
const consumingByClaim = db.prepare(`SELECT ${COLS} FROM messages WHERE id = ? AND state = 'consuming' AND claim_token = ?`)
|
|
44
74
|
/**
|
|
45
75
|
* 是否有**未消费完**的消息(pending + consuming)。
|
|
46
76
|
* 卸载/重装闸门必须覆盖 consuming:claim 成功后到回合真正开始之间,
|
|
47
77
|
* 运行时状态仍可能是 idle,只看 pending 会在这个窗口把消息连同运行时一起拆掉。
|
|
78
|
+
*
|
|
79
|
+
* 「永久僵尸」行除外:带任务联动(task_id 或元数据 x-aw-task-kind,或元数据非
|
|
80
|
+
* 对象且带 task_id)且**所有**被引用任务都已不存在的行,claim 谓词会永久过滤
|
|
81
|
+
* (isLegacyRecoveryBlocked 对不存在任务 fail-closed),永远不可投递 —— 旧计数
|
|
82
|
+
* 把它们当活跃工作,idle 卸载被永久阻塞(内存/omp 进程泄漏)。原始行保留在库中
|
|
83
|
+
* 作为证据,不自动处置;引用任务仍存在的行(held 树)与无联动可投递行照常计数。
|
|
48
84
|
*/
|
|
49
85
|
const hasUnconsumed = db.prepare(
|
|
50
|
-
`SELECT 1 FROM messages WHERE channel_id = ? AND to_agent_id = ? AND state IN ('pending', 'consuming')
|
|
86
|
+
`SELECT 1 FROM messages WHERE channel_id = ? AND to_agent_id = ? AND state IN ('pending', 'consuming')
|
|
87
|
+
AND NOT (
|
|
88
|
+
CASE WHEN json_valid(metadata_json) AND json_type(metadata_json) = 'object'
|
|
89
|
+
THEN json_type(metadata_json, '$."x-aw-task-kind"') IS NOT NULL
|
|
90
|
+
ELSE task_id IS NOT NULL END
|
|
91
|
+
AND NOT EXISTS (
|
|
92
|
+
SELECT 1 FROM tasks t
|
|
93
|
+
WHERE t.id = messages.task_id
|
|
94
|
+
OR t.id = CASE WHEN json_valid(messages.metadata_json) AND json_type(messages.metadata_json) = 'object'
|
|
95
|
+
THEN json_extract(messages.metadata_json, '$."x-aw-task-id"') END
|
|
96
|
+
OR t.id = CASE WHEN json_valid(messages.metadata_json) AND json_type(messages.metadata_json) = 'object'
|
|
97
|
+
THEN json_extract(messages.metadata_json, '$."x-aw-child-task-id"') END
|
|
98
|
+
)
|
|
99
|
+
) LIMIT 1`,
|
|
51
100
|
)
|
|
52
101
|
const markConsumingStmt = db.prepare(
|
|
53
|
-
`UPDATE messages SET state = 'consuming' WHERE id = ? AND state = 'pending'`,
|
|
102
|
+
`UPDATE messages SET state = 'consuming', claim_token = ? WHERE id = ? AND state = 'pending'`,
|
|
103
|
+
)
|
|
104
|
+
const hasClaimStmt = db.prepare(
|
|
105
|
+
`SELECT 1 FROM messages WHERE id = ? AND state = 'consuming' AND claim_token = ?`,
|
|
106
|
+
)
|
|
107
|
+
const releaseClaimStmt = db.prepare(
|
|
108
|
+
`UPDATE messages SET state = 'pending', claim_token = NULL WHERE id = ? AND state = 'consuming' AND claim_token = ?`,
|
|
54
109
|
)
|
|
55
110
|
const markConsumedStmt = db.prepare(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`UPDATE messages SET state = '
|
|
111
|
+
`UPDATE messages SET state = 'consumed', consumed_at = ?, claim_token = NULL WHERE id = ? AND state = 'consuming' AND claim_token = ?`,
|
|
112
|
+
)
|
|
113
|
+
const deadLetterLegacyRecoveryClaimStmt = db.prepare(
|
|
114
|
+
`UPDATE messages SET state = 'dead', claim_token = NULL
|
|
115
|
+
WHERE id = ? AND state = 'consuming' AND claim_token = ?
|
|
116
|
+
AND CASE WHEN json_valid(metadata_json)
|
|
117
|
+
THEN json_type(metadata_json) <> 'object'
|
|
118
|
+
OR json_type(metadata_json, '$."x-aw-task-kind"') IS NOT NULL ELSE 1 END
|
|
119
|
+
AND EXISTS (
|
|
120
|
+
SELECT 1 FROM tasks t WHERE instr(COALESCE(t.close_reason, ''), ?) > 0
|
|
121
|
+
AND (messages.task_id = t.id OR CASE WHEN json_valid(messages.metadata_json)
|
|
122
|
+
THEN json_extract(messages.metadata_json, '$."x-aw-task-id"') = t.id
|
|
123
|
+
OR json_extract(messages.metadata_json, '$."x-aw-child-task-id"') = t.id ELSE 0 END)
|
|
124
|
+
)`,
|
|
60
125
|
)
|
|
61
126
|
const resetConsumingStmt = db.prepare(
|
|
62
|
-
//
|
|
63
|
-
`UPDATE messages SET state = 'pending' WHERE state = 'consuming'
|
|
127
|
+
// Recovery invalidates every old owner, including exhausted legacy claims.
|
|
128
|
+
`UPDATE messages SET state = CASE WHEN attempts < 3 THEN 'pending' ELSE 'dead' END, claim_token = NULL WHERE state = 'consuming'`,
|
|
64
129
|
)
|
|
65
130
|
const requeueStmt = db.prepare(
|
|
66
131
|
// P3-4(2026-11-01):重投计数上限 —— attempts+1,达 3 次不再回 pending(→ dead)。
|
|
67
132
|
// steer 对忙碌 Agent 的重投之前无上限:坏消息(解析必炸/超长)会在
|
|
68
133
|
// "认领→steer 失败→回 pending"里无限循环,每 250ms 吃掉一个调度拍。
|
|
69
|
-
`UPDATE messages SET attempts = attempts + 1,
|
|
134
|
+
`UPDATE messages SET attempts = attempts + 1, claim_token = NULL,
|
|
70
135
|
state = CASE WHEN attempts + 1 >= 3 THEN 'dead' ELSE 'pending' END
|
|
71
|
-
WHERE id = ? AND state = 'consuming'
|
|
136
|
+
WHERE id = ? AND state = 'consuming' AND claim_token = ?`,
|
|
72
137
|
)
|
|
73
138
|
const consumePendingByTaskStmt = db.prepare(
|
|
74
139
|
`UPDATE messages SET state = 'consumed', consumed_at = ? WHERE task_id = ? AND state = 'pending'`,
|
|
@@ -85,7 +150,9 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
85
150
|
)
|
|
86
151
|
const existsPendingAssignStmt = db.prepare(
|
|
87
152
|
`SELECT 1 AS hit FROM messages
|
|
88
|
-
WHERE task_id = ? AND state
|
|
153
|
+
WHERE task_id = ? AND state IN ('pending', 'consuming') AND CASE WHEN json_valid(metadata_json)
|
|
154
|
+
THEN json_type(metadata_json, '$."x-aw-task-kind"') = 'text'
|
|
155
|
+
AND json_extract(metadata_json, '$."x-aw-task-kind"') = 'assign' ELSE 0 END
|
|
89
156
|
LIMIT 1`,
|
|
90
157
|
)
|
|
91
158
|
|
|
@@ -170,7 +237,17 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
170
237
|
return (selectByClientMessageId.get(channelId, sessionId, actorUserId, clientMessageId) as MessageRow | undefined) ?? undefined
|
|
171
238
|
},
|
|
172
239
|
|
|
173
|
-
listPendingByChannelAgent(channelId: string, toAgentId: string, limit?: number): MessageRow[] {
|
|
240
|
+
listPendingByChannelAgent(channelId: string, toAgentId: string, limit?: number, isBlocked?: MessageBlocked): MessageRow[] {
|
|
241
|
+
if (isBlocked) {
|
|
242
|
+
if (limit != null && limit <= 0) return []
|
|
243
|
+
const eligible: MessageRow[] = []
|
|
244
|
+
for (const row of selectPending.iterate(channelId, toAgentId) as unknown as Iterable<MessageRow>) {
|
|
245
|
+
if (blockedSafely(isBlocked, row)) continue
|
|
246
|
+
eligible.push(row)
|
|
247
|
+
if (limit != null && eligible.length >= limit) break
|
|
248
|
+
}
|
|
249
|
+
return eligible
|
|
250
|
+
}
|
|
174
251
|
if (limit != null) {
|
|
175
252
|
return db.prepare(
|
|
176
253
|
`SELECT ${COLS} FROM messages WHERE channel_id = ? AND to_agent_id = ? AND state = 'pending' ORDER BY createdAt ASC, rowid ASC LIMIT ?`,
|
|
@@ -180,7 +257,8 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
180
257
|
},
|
|
181
258
|
|
|
182
259
|
/** 队头单条(dequeue 热路径:WHERE+ORDER 走 idx_messages_queue,LIMIT 1 免全量) */
|
|
183
|
-
firstPendingByChannelAgent(channelId: string, toAgentId: string): MessageRow | undefined {
|
|
260
|
+
firstPendingByChannelAgent(channelId: string, toAgentId: string, isBlocked?: MessageBlocked): MessageRow | undefined {
|
|
261
|
+
if (isBlocked) return this.listPendingByChannelAgent(channelId, toAgentId, 1, isBlocked)[0]
|
|
184
262
|
return (firstPending.get(channelId, toAgentId) as MessageRow | undefined) ?? undefined
|
|
185
263
|
},
|
|
186
264
|
|
|
@@ -189,18 +267,48 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
189
267
|
return Boolean(hasUnconsumed.get(channelId, toAgentId))
|
|
190
268
|
},
|
|
191
269
|
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
270
|
+
/** Atomically acquire a fresh ownership token, or null when already claimed. */
|
|
271
|
+
claim(id: string, isBlocked?: MessageBlocked): string | null {
|
|
272
|
+
if (isBlocked) {
|
|
273
|
+
const row = pendingById.get(id) as MessageRow | undefined
|
|
274
|
+
if (!row || blockedSafely(isBlocked, row)) return null
|
|
275
|
+
}
|
|
276
|
+
const token = randomUUID()
|
|
277
|
+
if (markConsumingStmt.run(token, id).changes === 0) return null
|
|
278
|
+
if (isBlocked) {
|
|
279
|
+
const row = consumingByClaim.get(id, token) as MessageRow | undefined
|
|
280
|
+
if (row && !blockedSafely(isBlocked, row)) return token
|
|
281
|
+
releaseClaimStmt.run(id, token)
|
|
282
|
+
return null
|
|
283
|
+
}
|
|
284
|
+
return token
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
/** Recheck an acquired claim before beginning processing. */
|
|
288
|
+
isClaimBlocked(id: string, token: string, isBlocked: MessageBlocked): boolean {
|
|
289
|
+
const row = consumingByClaim.get(id, token) as MessageRow | undefined
|
|
290
|
+
return !row || blockedSafely(isBlocked, row)
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
/** Check that a locally tracked token is still current. */
|
|
294
|
+
ownsClaim(id: string, token: string): boolean {
|
|
295
|
+
return typeof token === 'string' && token.length > 0 && Boolean(hasClaimStmt.get(id, token))
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
/** Return a claim without charging a failure attempt. */
|
|
299
|
+
releaseClaim(id: string, token: string): boolean {
|
|
300
|
+
return typeof token === 'string' && token.length > 0 && releaseClaimStmt.run(id, token).changes > 0
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
/** consuming → consumed, only for the current owner. */
|
|
304
|
+
markConsumed(id: string, token: string): boolean {
|
|
305
|
+
return typeof token === 'string' && token.length > 0 && markConsumedStmt.run(new Date().toISOString(), id, token).changes > 0
|
|
199
306
|
},
|
|
200
307
|
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
|
|
308
|
+
/** Quarantine only while both the exact claim and recovery hold are current. */
|
|
309
|
+
deadLetterLegacyRecoveryClaim(id: string, token: string): boolean {
|
|
310
|
+
return typeof token === 'string' && token.length > 0
|
|
311
|
+
&& deadLetterLegacyRecoveryClaimStmt.run(id, token, LEGACY_RECOVERY_MARKER).changes > 0
|
|
204
312
|
},
|
|
205
313
|
|
|
206
314
|
/** 启动恢复:所有 consuming 重置回 pending(重新投递) */
|
|
@@ -209,8 +317,8 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
209
317
|
},
|
|
210
318
|
|
|
211
319
|
/** 单条重投:consuming → pending(回合失败重试);返回是否实际重投 */
|
|
212
|
-
requeue(id: string): boolean {
|
|
213
|
-
return requeueStmt.run(id).changes > 0
|
|
320
|
+
requeue(id: string, token: string): boolean {
|
|
321
|
+
return typeof token === 'string' && token.length > 0 && requeueStmt.run(id, token).changes > 0
|
|
214
322
|
},
|
|
215
323
|
|
|
216
324
|
/** 按 channel 倒序列出最近消息 */
|
|
@@ -228,7 +336,7 @@ export function createMessageRepo(db: DatabaseSync) {
|
|
|
228
336
|
consumePendingByTaskStmt.run(new Date().toISOString(), taskId)
|
|
229
337
|
},
|
|
230
338
|
|
|
231
|
-
/**
|
|
339
|
+
/** Whether an assign is pending or already claimed for processing. */
|
|
232
340
|
hasPendingAssign(taskId: string): boolean {
|
|
233
341
|
return existsPendingAssignStmt.get(taskId) !== undefined
|
|
234
342
|
},
|
|
@@ -188,10 +188,10 @@ export function createProjectKernelRepo(db: DatabaseSync) {
|
|
|
188
188
|
findById(id: string) {
|
|
189
189
|
return db.prepare(`SELECT ${EFFECT_COLS} FROM project_effects WHERE id = ?`).get(id) as ProjectEffectRow | undefined
|
|
190
190
|
},
|
|
191
|
-
due(nowIso: string, limit = 20): ProjectEffectRow[] {
|
|
191
|
+
due(nowIso: string, limit = 20, offset = 0): ProjectEffectRow[] {
|
|
192
192
|
return db.prepare(
|
|
193
|
-
`SELECT ${EFFECT_COLS} FROM project_effects WHERE status = 'pending' AND (next_retry_at IS NULL OR next_retry_at <= ?) ORDER BY created_at ASC LIMIT ?`,
|
|
194
|
-
).all(nowIso, limit) as unknown as ProjectEffectRow[]
|
|
193
|
+
`SELECT ${EFFECT_COLS} FROM project_effects WHERE status = 'pending' AND (next_retry_at IS NULL OR next_retry_at <= ?) ORDER BY created_at ASC, rowid ASC LIMIT ? OFFSET ?`,
|
|
194
|
+
).all(nowIso, limit, offset) as unknown as ProjectEffectRow[]
|
|
195
195
|
},
|
|
196
196
|
claim(id: string): boolean {
|
|
197
197
|
return db.prepare(`UPDATE project_effects SET status='running', attempts = attempts + 1, updated_at = ? WHERE id = ? AND status = 'pending'`)
|
|
@@ -53,7 +53,9 @@ CREATE TABLE IF NOT EXISTS messages (
|
|
|
53
53
|
parts_json TEXT NOT NULL,
|
|
54
54
|
metadata_json TEXT NOT NULL DEFAULT '{}', -- x-aw-target-agent / x-aw-task-kind
|
|
55
55
|
client_message_id TEXT, -- session client idempotency key; NULL for legacy/non-session sends
|
|
56
|
-
state TEXT NOT NULL DEFAULT 'pending', -- pending|consuming|consumed
|
|
56
|
+
state TEXT NOT NULL DEFAULT 'pending', -- pending|consuming|consumed|dead
|
|
57
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
58
|
+
claim_token TEXT,
|
|
57
59
|
created_at TEXT NOT NULL,
|
|
58
60
|
consumed_at TEXT
|
|
59
61
|
);
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { randomUUID } from 'node:crypto'
|
|
6
6
|
import type { DatabaseSync } from 'node:sqlite'
|
|
7
7
|
import type { TaskRow } from './database'
|
|
8
|
+
import { projectHasLegacyRecoveryHold } from '../projects/legacy-recovery'
|
|
8
9
|
|
|
9
10
|
const COLS
|
|
10
11
|
= 'id, channel_id AS channelId, parent_id AS parentId, root_queue_seq AS rootQueueSeq, assignee_id AS assigneeId, creator_id AS creatorId, title, description, state, progress, retry_count AS retryCount, artifacts_json AS artifactsJson, history_json AS historyJson, route_reason AS routeReason, source_chat_message_id AS sourceChatMessageId, source_chat_delivery_id AS sourceChatDeliveryId, close_reason AS closeReason, deadline_at AS deadlineAt, source, project_id AS projectId, project_work_item_id AS projectWorkItemId, project_attempt_no AS projectAttemptNo, session_id AS sessionId, trace_id AS traceId, superseded_by_task_id AS supersededByTaskId, assignment_generation AS assignmentGeneration, execution_lease_id AS executionLeaseId, execution_lease_agent_id AS executionLeaseAgentId, execution_lease_started_at AS executionLeaseStartedAt, execution_lease_revoked_at AS executionLeaseRevokedAt, created_at AS createdAt, updated_at AS updatedAt'
|
|
@@ -114,6 +115,55 @@ export function createTaskRepo(db: DatabaseSync) {
|
|
|
114
115
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
115
116
|
)
|
|
116
117
|
const selectById = db.prepare(`SELECT ${COLS} FROM tasks WHERE id = ?`)
|
|
118
|
+
const recoveryProjectIds = db.prepare(`WITH RECURSIVE related(id, channel_id, parent_id, project_id, project_work_item_id, source_chat_message_id) AS (
|
|
119
|
+
SELECT id, channel_id, parent_id, project_id, project_work_item_id, source_chat_message_id FROM tasks WHERE id = ?
|
|
120
|
+
UNION SELECT t.id, t.channel_id, t.parent_id, t.project_id, t.project_work_item_id, t.source_chat_message_id
|
|
121
|
+
FROM tasks t JOIN related r ON t.channel_id = r.channel_id AND (t.parent_id = r.id OR t.id = r.parent_id)
|
|
122
|
+
) SELECT project_id AS projectId FROM related WHERE project_id IS NOT NULL
|
|
123
|
+
UNION SELECT w.project_id FROM project_work_items w JOIN related r ON w.id = r.project_work_item_id
|
|
124
|
+
UNION SELECT a.project_id FROM project_work_item_attempts a JOIN related r
|
|
125
|
+
ON a.channel_task_id = r.id OR a.source_key = r.source_chat_message_id`)
|
|
126
|
+
// ── legacy 恢复保留的审计处置(同一连接树:上溯父/下溯子,同 channel)──
|
|
127
|
+
const holdRowsStmt = db.prepare(`SELECT ${COLS} FROM tasks WHERE instr(COALESCE(close_reason, ''), ?) > 0 ORDER BY channel_id ASC, created_at ASC`)
|
|
128
|
+
const recoveryTreeStmt = db.prepare(`WITH RECURSIVE tree(id, channel_id, parent_id, close_reason) AS (
|
|
129
|
+
SELECT id, channel_id, parent_id, close_reason FROM tasks WHERE id = ?
|
|
130
|
+
UNION SELECT t.id, t.channel_id, t.parent_id, t.close_reason
|
|
131
|
+
FROM tasks t JOIN tree h ON t.channel_id = h.channel_id AND (t.parent_id = h.id OR t.id = h.parent_id)
|
|
132
|
+
) SELECT id AS id, close_reason AS closeReason FROM tree`)
|
|
133
|
+
const holdClearStmt = db.prepare(`WITH RECURSIVE tree(id, channel_id, parent_id) AS (
|
|
134
|
+
SELECT id, channel_id, parent_id FROM tasks WHERE id = ?
|
|
135
|
+
UNION SELECT t.id, t.channel_id, t.parent_id
|
|
136
|
+
FROM tasks t JOIN tree h ON t.channel_id = h.channel_id AND (t.parent_id = h.id OR t.id = h.parent_id)
|
|
137
|
+
) UPDATE tasks SET close_reason = CASE
|
|
138
|
+
WHEN TRIM(REPLACE(COALESCE(close_reason, ''), ?, '')) = '' THEN NULL
|
|
139
|
+
ELSE TRIM(REPLACE(COALESCE(close_reason, ''), ?, '')) END
|
|
140
|
+
WHERE id IN (SELECT id FROM tree) AND instr(COALESCE(close_reason, ''), ?) > 0`)
|
|
141
|
+
const holdMsgCountsStmt = db.prepare(`WITH RECURSIVE tree(id, channel_id, parent_id) AS (
|
|
142
|
+
SELECT id, channel_id, parent_id FROM tasks WHERE id = ?
|
|
143
|
+
UNION SELECT t.id, t.channel_id, t.parent_id FROM tasks t JOIN tree h
|
|
144
|
+
ON t.channel_id = h.channel_id AND (t.parent_id = h.id OR t.id = h.parent_id)
|
|
145
|
+
) SELECT
|
|
146
|
+
SUM(CASE WHEN m.state = 'pending' THEN 1 ELSE 0 END) AS pending,
|
|
147
|
+
SUM(CASE WHEN m.state = 'consuming' THEN 1 ELSE 0 END) AS consuming,
|
|
148
|
+
SUM(CASE WHEN m.state = 'dead' THEN 1 ELSE 0 END) AS dead
|
|
149
|
+
FROM messages m
|
|
150
|
+
WHERE m.state IN ('pending', 'consuming', 'dead')
|
|
151
|
+
AND (m.task_id IN (SELECT id FROM tree)
|
|
152
|
+
OR CASE WHEN json_valid(m.metadata_json) THEN
|
|
153
|
+
json_extract(m.metadata_json, '$."x-aw-task-id"') IN (SELECT id FROM tree)
|
|
154
|
+
OR json_extract(m.metadata_json, '$."x-aw-child-task-id"') IN (SELECT id FROM tree)
|
|
155
|
+
ELSE 0 END)`)
|
|
156
|
+
const holdRequeueStmt = db.prepare(`WITH RECURSIVE tree(id, channel_id, parent_id) AS (
|
|
157
|
+
SELECT id, channel_id, parent_id FROM tasks WHERE id = ?
|
|
158
|
+
UNION SELECT t.id, t.channel_id, t.parent_id FROM tasks t JOIN tree h
|
|
159
|
+
ON t.channel_id = h.channel_id AND (t.parent_id = h.id OR t.id = h.parent_id)
|
|
160
|
+
) UPDATE messages SET state = CASE WHEN attempts < 3 THEN 'pending' ELSE 'dead' END, claim_token = NULL
|
|
161
|
+
WHERE state = 'consuming'
|
|
162
|
+
AND (task_id IN (SELECT id FROM tree)
|
|
163
|
+
OR CASE WHEN json_valid(metadata_json) THEN
|
|
164
|
+
json_extract(metadata_json, '$."x-aw-task-id"') IN (SELECT id FROM tree)
|
|
165
|
+
OR json_extract(metadata_json, '$."x-aw-child-task-id"') IN (SELECT id FROM tree)
|
|
166
|
+
ELSE 0 END)`)
|
|
117
167
|
const selectByChannel = db.prepare(`SELECT ${COLS} FROM tasks WHERE channel_id = ? ORDER BY COALESCE(root_queue_seq, 2147483647) ASC, created_at ASC, rowid ASC`)
|
|
118
168
|
const selectRoots = db.prepare(`SELECT ${COLS} FROM tasks WHERE channel_id = ? AND parent_id IS NULL AND root_queue_seq IS NOT NULL ORDER BY COALESCE(root_queue_seq, 2147483647) ASC, created_at ASC, rowid ASC`)
|
|
119
169
|
const selectRootBySource = db.prepare(`SELECT ${COLS} FROM tasks WHERE channel_id = ? AND parent_id IS NULL AND source_chat_message_id = ? LIMIT 1`)
|
|
@@ -248,6 +298,12 @@ export function createTaskRepo(db: DatabaseSync) {
|
|
|
248
298
|
findById(id: string): TaskRow | undefined {
|
|
249
299
|
return selectById.get(id) as unknown as TaskRow | undefined
|
|
250
300
|
},
|
|
301
|
+
recoveryProjectIds(id: string): string[] {
|
|
302
|
+
return (recoveryProjectIds.all(id) as Array<{ projectId: string }>).map(row => row.projectId)
|
|
303
|
+
},
|
|
304
|
+
projectRecoveryBlocked(id: string): boolean {
|
|
305
|
+
return this.recoveryProjectIds(id).some(projectId => projectHasLegacyRecoveryHold(db, projectId))
|
|
306
|
+
},
|
|
251
307
|
findRootBySource(channelId: string, sourceChatMessageId: string): TaskRow | undefined {
|
|
252
308
|
return selectRootBySource.get(channelId, sourceChatMessageId) as unknown as TaskRow | undefined
|
|
253
309
|
},
|
|
@@ -273,6 +329,51 @@ export function createTaskRepo(db: DatabaseSync) {
|
|
|
273
329
|
listByChannelMeta(channelId: string): TaskMetaRow[] {
|
|
274
330
|
return selectByChannelMeta.all(channelId) as unknown as TaskMetaRow[]
|
|
275
331
|
},
|
|
332
|
+
|
|
333
|
+
/** 当前处于 legacy 恢复保留的任务行(marker 由 runtime 层常量传入,db 层不反向依赖)。 */
|
|
334
|
+
listRecoveryHolds(marker: string): TaskRow[] {
|
|
335
|
+
return holdRowsStmt.all(marker) as unknown as TaskRow[]
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
/** 保留树的成员(上溯父/下溯子,同 channel)及其 hold 状态。 */
|
|
339
|
+
recoveryTreeOf(taskId: string): Array<{ id: string, closeReason: string | null }> {
|
|
340
|
+
return recoveryTreeStmt.all(taskId) as unknown as Array<{ id: string, closeReason: string | null }>
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
/** 树内消息分状态计数(pending/consuming/dead;含元数据引用联动)。 */
|
|
344
|
+
recoveryHoldMessageCounts(taskId: string): { pending: number, consuming: number, dead: number } {
|
|
345
|
+
const row = holdMsgCountsStmt.get(taskId) as { pending: number | null, consuming: number | null, dead: number | null }
|
|
346
|
+
return { pending: row.pending ?? 0, consuming: row.consuming ?? 0, dead: row.dead ?? 0 }
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 处置:清除本连接树上全部 hold 标记(保留其余 close_reason 内容),并把树内
|
|
351
|
+
* 在飞 consuming 消息按重投预算复位(pending/dead)。任务状态不改动 —— 重新
|
|
352
|
+
* 执行必须走显式 retry/reopen,绝不自动重放。任务不在保留中返回 null。
|
|
353
|
+
*/
|
|
354
|
+
disposeLegacyRecoveryHold(taskId: string, marker: string): { released: string[], requeued: number, unblockedPending: number } | null {
|
|
355
|
+
const task = selectById.get(taskId) as unknown as TaskRow | undefined
|
|
356
|
+
if (!task) return null
|
|
357
|
+
const tree = recoveryTreeStmt.all(taskId) as unknown as Array<{ id: string, closeReason: string | null }>
|
|
358
|
+
if (!tree.some(row => (row.closeReason ?? '').includes(marker))) return null
|
|
359
|
+
const before = this.recoveryHoldMessageCounts(taskId)
|
|
360
|
+
db.exec('SAVEPOINT legacy_hold_disposition')
|
|
361
|
+
try {
|
|
362
|
+
holdClearStmt.run(taskId, marker, marker, marker)
|
|
363
|
+
holdRequeueStmt.run(taskId)
|
|
364
|
+
db.exec('RELEASE legacy_hold_disposition')
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
db.exec('ROLLBACK TO legacy_hold_disposition; RELEASE legacy_hold_disposition')
|
|
368
|
+
throw error
|
|
369
|
+
}
|
|
370
|
+
const after = this.recoveryHoldMessageCounts(taskId)
|
|
371
|
+
return {
|
|
372
|
+
released: tree.filter(row => (row.closeReason ?? '').includes(marker)).map(row => row.id),
|
|
373
|
+
requeued: Math.max(0, before.consuming - after.consuming),
|
|
374
|
+
unblockedPending: before.pending,
|
|
375
|
+
}
|
|
376
|
+
},
|
|
276
377
|
listByChannelAssigneeMeta(channelId: string, assigneeId: string): TaskMetaRow[] {
|
|
277
378
|
return selectByChannelAssigneeMeta.all(channelId, assigneeId) as unknown as TaskMetaRow[]
|
|
278
379
|
},
|