agentworkshop 0.7.71 → 0.8.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 +332 -0
- package/.output/.AgentWorkShop/prompts/host-tools.json +332 -0
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/BH8RvpVy.js +1 -0
- package/.output/public/_nuxt/Byf4IxU2.js +14 -0
- package/.output/public/_nuxt/CxVhG0Xx.js +1 -0
- package/.output/public/_nuxt/D0mzKkZr.js +1 -0
- package/.output/public/_nuxt/DIFkTkdS.js +1 -0
- package/.output/public/_nuxt/DgrK8UCQ.js +0 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/7a79a7e4-d691-4cf5-ae3a-3b01814479fb.json +1 -0
- package/.output/public/_nuxt/{default.BzOcvmSE.css → default.BEXGWZFQ.css} +1 -1
- package/.output/public/_nuxt/{entry.CL2i0F8o.css → entry.C7koBPom.css} +1 -1
- package/.output/public/_nuxt/ontology.QMGeh66l.css +1 -0
- package/.output/server/chunks/_/access.mjs +1 -1
- package/.output/server/chunks/_/binding-authz.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/_/chart-repo.mjs +1 -1
- package/.output/server/chunks/_/dashboard-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/_/mes-console.mjs +1 -1
- package/.output/server/chunks/_/nitro.mjs +5362 -2240
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/_/ocap.mjs +1 -1
- package/.output/server/chunks/_/rest-auth.mjs +1 -1
- package/.output/server/chunks/_/scene-layout.repo.mjs +1 -1
- package/.output/server/chunks/_/spc.mjs +2 -2
- package/.output/server/chunks/build/TownView-BWMDbosY.mjs +1 -1
- package/.output/server/chunks/build/api-BEW_ebY_.mjs +64 -0
- package/.output/server/chunks/build/api-BEW_ebY_.mjs.map +1 -0
- package/.output/server/chunks/build/daq-CdxcfY_G.mjs +1 -1
- package/.output/server/chunks/build/dcw-BlDQtS4q.mjs +1 -1
- package/.output/server/chunks/build/{default-BeB88U7y.mjs → default-CJkOcmrm.mjs} +14 -8
- package/.output/server/chunks/build/{default-BeB88U7y.mjs.map → default-CJkOcmrm.mjs.map} +1 -1
- package/.output/server/chunks/build/ontology-C3HS5pMo.mjs +977 -0
- package/.output/server/chunks/build/ontology-C3HS5pMo.mjs.map +1 -0
- package/.output/server/chunks/build/types-D6J7slEa.mjs +6 -2
- package/.output/server/chunks/build/useDaqAddNode-D_Rkju0f.mjs +1 -1
- package/.output/server/chunks/build/useDaqDetailNode-DeOsDxK5.mjs +1 -1
- package/.output/server/chunks/build/useDaqDetailParams-Cm9a9r5G.mjs +1 -1
- package/.output/server/chunks/build/useDaqFilters-CctmO03p.mjs +1 -1
- package/.output/server/chunks/build/useDaqStream-B9ZBVQrI.mjs +1 -1
- package/.output/server/chunks/build/useDaqTemplates-CK37sMfi.mjs +1 -1
- package/.output/server/chunks/build/useDcwAddNode-DACVcEHs.mjs +1 -1
- package/.output/server/chunks/build/useDcwStream-Dir5ufAU.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/workshop/agent-tools/approvals/_id/decide.post.mjs +17 -4
- package/.output/server/chunks/routes/api/workshop/agent-tools/approvals/_id/decide.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/_id_.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/grant.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/bindings/revoke.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/index2.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/invoke.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/agent-tools/list.get.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/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/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/approvals/_id/decide.post.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/channels/_id/activate.post.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/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/index2.put.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/index4.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels/_id/index5.get.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/terminals.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/index.get.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/alarms.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/controller.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/daq/export/_id_.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/infra.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/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/_id_.patch.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/versions.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/dcw/recipes/_id_.delete.mjs +1 -1
- 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/features/run.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/index3.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/runs/_id/labels.patch.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/eda/runs.get.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 +62 -0
- package/.output/server/chunks/routes/api/workshop/index.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/index.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index10.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index11.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index12.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/index2.get.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/index8.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mes/datasets.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/mes/preview.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs +54 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/compile.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs +51 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/evidence.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs +67 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/publish.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs +49 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval-decision.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs +35 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/approval.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs +49 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/rules/_ruleId/transition.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs +35 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/validate.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs +70 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId_.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs +64 -0
- package/.output/server/chunks/routes/api/workshop/ontology/export/_ontologyId_.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/index.mjs +44 -0
- package/.output/server/chunks/routes/api/workshop/ontology/index.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs +36 -0
- package/.output/server/chunks/routes/api/workshop/ontology/scene.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs +38 -0
- package/.output/server/chunks/routes/api/workshop/ontology/traces/_ontologyId_.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs +40 -0
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId/compare.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs +63 -0
- package/.output/server/chunks/routes/api/workshop/ontology/versions/_ontologyId_.mjs.map +1 -0
- 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/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/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/_name_.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/renderer.mjs +2 -2
- package/.output/server/chunks/virtual/entry.mjs +234 -3
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +27 -6
- package/README.md +25 -4
- package/app/components/AppSidebar.vue +1 -0
- package/app/pages/ontology/api.ts +18 -0
- package/app/pages/ontology/index.vue +779 -0
- package/app/pages/ontology/types.ts +122 -0
- package/config.yml +1 -1
- package/docs/cli.en.md +2 -2
- package/docs/cli.md +2 -2
- package/docs/plugins.en.md +1 -1
- package/docs/plugins.md +1 -1
- package/docs/sdk.en.md +1 -1
- package/docs/sdk.md +1 -1
- package/i18n/locales/en.ts +58 -0
- package/i18n/locales/zh-CN.ts +58 -0
- package/mcp/aw-mcp-server.mjs +35 -1
- package/package.json +1 -1
- package/scripts/docs-shots.mjs +36 -0
- package/scripts/e2e-model-loop-live.mjs +731 -0
- package/scripts/e2e-ontology-live.mjs +774 -0
- package/scripts/e2e-ontology.mjs +328 -0
- package/scripts/ontology-idd-rag-e2e.mjs +449 -0
- package/server/api/workshop/agent-tools/approvals/[id]/decide.post.ts +16 -0
- package/server/api/workshop/ontology/drafts/[draftId]/compile.ts +39 -0
- package/server/api/workshop/ontology/drafts/[draftId]/evidence.ts +33 -0
- package/server/api/workshop/ontology/drafts/[draftId]/publish.ts +44 -0
- package/server/api/workshop/ontology/drafts/[draftId]/rules/[ruleId]/approval-decision.ts +28 -0
- package/server/api/workshop/ontology/drafts/[draftId]/rules/[ruleId]/approval.ts +17 -0
- package/server/api/workshop/ontology/drafts/[draftId]/rules/[ruleId]/transition.ts +32 -0
- package/server/api/workshop/ontology/drafts/[draftId]/validate.ts +16 -0
- package/server/api/workshop/ontology/drafts/[draftId].ts +52 -0
- package/server/api/workshop/ontology/drafts/index.ts +20 -0
- package/server/api/workshop/ontology/export/[ontologyId].ts +50 -0
- package/server/api/workshop/ontology/index.ts +38 -0
- package/server/api/workshop/ontology/scene.ts +21 -0
- package/server/api/workshop/ontology/traces/[ontologyId].ts +19 -0
- package/server/api/workshop/ontology/versions/[ontologyId]/compare.ts +21 -0
- package/server/api/workshop/ontology/versions/[ontologyId].ts +42 -0
- package/server/services/workshop/agents/hitl-decision/dispatcher.ts +15 -0
- package/server/services/workshop/agents/host-tool-bridge/tools/industrial.ts +13 -1
- package/server/services/workshop/agents/industrial/grant-guard.ts +59 -0
- package/server/services/workshop/agents/industrial/index.ts +38 -32
- package/server/services/workshop/agents/industrial/ontology-tools.ts +320 -0
- package/server/services/workshop/agents/industrial/optimizer-tools.ts +79 -0
- package/server/services/workshop/agents/industrial/tool-verify.ts +32 -2
- package/server/services/workshop/agents/tool-reference-spec.ts +1 -1
- package/server/services/workshop/aml/twin/physics-spec.ts +6 -22
- package/server/services/workshop/daq/storage/index.ts +6 -5
- package/server/services/workshop/daq/storage/sqlite.adapter.ts +25 -13
- package/server/services/workshop/db/database/open.ts +2 -0
- package/server/services/workshop/db/database/schema.ts +155 -1
- package/server/services/workshop/ontology/compiler.ts +474 -0
- package/server/services/workshop/ontology/contracts.ts +441 -0
- package/server/services/workshop/ontology/guards.ts +139 -0
- package/server/services/workshop/ontology/index.ts +10 -0
- package/server/services/workshop/ontology/ontology.service.ts +892 -0
- package/server/services/workshop/ontology/repo.ts +449 -0
- package/server/services/workshop/ontology/semantic-binding.service.ts +226 -0
- package/server/services/workshop/ontology/validator.ts +218 -0
- package/server/services/workshop/optimization/binding.repo.ts +7 -0
- package/server/services/workshop/optimization/contracts.ts +14 -0
- package/server/services/workshop/optimization/dispatch.service.ts +16 -0
- package/server/services/workshop/optimization/profile-adopt.service.ts +256 -0
- package/server/services/workshop/optimization/profile.repo.ts +19 -3
- package/server/services/workshop/optimization/python/__pycache__/problems.cpython-312.pyc +0 -0
- package/shared/dimensions.ts +124 -0
- package/.output/public/_nuxt/B7s2qeyT.js +0 -14
- package/.output/public/_nuxt/LHIav-Kv.js +0 -1
- package/.output/public/_nuxt/RuMLNeQE.js +0 -1
- package/.output/public/_nuxt/builds/meta/0ae8cb0f-6ce5-4096-9692-9b1fc197b30d.json +0 -1
- /package/.output/public/_nuxt/{62J4vljm2.js → 62J4vljm.js} +0 -0
- /package/.output/public/_nuxt/{BO0BJx3w.js → BO0BJx3w2.js} +0 -0
- /package/.output/public/_nuxt/{C-MY-JQE2.js → C-MY-JQE.js} +0 -0
- /package/.output/public/_nuxt/{D5kCimyw.js → D5kCimyw2.js} +0 -0
- /package/.output/public/_nuxt/{DGrrucbG2.js → DGrrucbG.js} +0 -0
- /package/.output/public/_nuxt/{Y4sMSPrS.js → Y4sMSPrS2.js} +0 -0
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable @stylistic/max-statements-per-line */
|
|
3
|
+
/**
|
|
4
|
+
* Ontology 真机全链路集成 E2E(2026-10-24,ralph 第二轮)。
|
|
5
|
+
*
|
|
6
|
+
* L1 隔离实例 + PLC 场景产线管理/节点绑定(REST)
|
|
7
|
+
* L2 本体全功能真机 REST 全链(草稿→文档→校验→编译→证据→生命周期→批准→发布→版本/diff/溯源/场景/导出)
|
|
8
|
+
* L3 运行时守卫(真实产线,节点级意图面)
|
|
9
|
+
* L4 AML 训练集成 + 本体训练先验派生
|
|
10
|
+
* L5 求解器集成(profile→binding→solve→crosscheck;含 ontologyRefs 耦合 Profile v2)
|
|
11
|
+
* L6 数据分析作业(agent-tools/invoke analysis_save → 台账读回)
|
|
12
|
+
* L7 前端渲染走查(真实 Chrome:/ontology 六 tab + 五页截图)
|
|
13
|
+
*
|
|
14
|
+
* 运行:node scripts/e2e-ontology-live.mjs
|
|
15
|
+
* 证据:docs/audit/evidence/2026-10-24-ontology-live/{report.json,*.png}
|
|
16
|
+
*/
|
|
17
|
+
import { spawn } from 'node:child_process'
|
|
18
|
+
import { mkdirSync, writeFileSync, existsSync, symlinkSync, openSync, readFileSync } from 'node:fs'
|
|
19
|
+
import { join, resolve, dirname } from 'node:path'
|
|
20
|
+
import { fileURLToPath } from 'node:url'
|
|
21
|
+
import { tmpdir, homedir } from 'node:os'
|
|
22
|
+
import { DatabaseSync } from 'node:sqlite'
|
|
23
|
+
|
|
24
|
+
const REPO = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
25
|
+
const ROOT = join(tmpdir(), `aw-ontology-live-${Date.now()}`)
|
|
26
|
+
const HOME = join(ROOT, 'home')
|
|
27
|
+
const EVID = resolve(process.env.AW_E2E_EVIDENCE_DIR || join(REPO, 'docs', 'audit', 'evidence', '2026-10-24-ontology-live'))
|
|
28
|
+
mkdirSync(HOME, { recursive: true })
|
|
29
|
+
mkdirSync(EVID, { recursive: true })
|
|
30
|
+
|
|
31
|
+
const TAG = `ont${Date.now().toString(36).slice(-4)}`
|
|
32
|
+
const BEAT = 5000
|
|
33
|
+
const H = 24
|
|
34
|
+
const F = 6
|
|
35
|
+
const N_STEPS = 160
|
|
36
|
+
const N_RUNS = 6
|
|
37
|
+
const DELAY_STEPS = 2
|
|
38
|
+
|
|
39
|
+
process.env.AW_MODE = 'home'
|
|
40
|
+
process.env.AW_HOME = HOME
|
|
41
|
+
process.env.AW_AML_DIR = join(HOME, 'aml')
|
|
42
|
+
process.env.NO_PROXY = '127.0.0.1,localhost'
|
|
43
|
+
|
|
44
|
+
mkdirSync(join(HOME, 'aml'), { recursive: true })
|
|
45
|
+
const realVenv = join(homedir(), '.AgentWorkShop', 'aml', '.venv')
|
|
46
|
+
let venvLinked = false
|
|
47
|
+
if (existsSync(join(realVenv, 'Scripts', 'python.exe'))) {
|
|
48
|
+
symlinkSync(realVenv, join(HOME, 'aml', '.venv'), 'junction')
|
|
49
|
+
venvLinked = true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const results = []
|
|
53
|
+
function check(id, name, cond, detail = '') {
|
|
54
|
+
const pass = Boolean(cond)
|
|
55
|
+
results.push({ id, name, pass, detail: String(detail).slice(0, 600) })
|
|
56
|
+
console.log(`${pass ? '✔' : '✘'} [${id}] ${name}${detail ? ` — ${String(detail).slice(0, 200)}` : ''}`)
|
|
57
|
+
return pass
|
|
58
|
+
}
|
|
59
|
+
const sleep = ms => new Promise(r => setTimeout(r, ms))
|
|
60
|
+
function killTree(pid) {
|
|
61
|
+
if (!pid) return
|
|
62
|
+
try {
|
|
63
|
+
if (process.platform === 'win32') spawn('taskkill', ['/PID', String(pid), '/T', '/F'], { stdio: 'ignore' })
|
|
64
|
+
else process.kill(pid, 'SIGTERM')
|
|
65
|
+
}
|
|
66
|
+
catch { /* 已退出 */ }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ════ 0. seed(直连仓储:产线/节点/配方/历史批次/样本/工况段) ════
|
|
70
|
+
console.log('\n=== 0. seed PLC 场景 ===')
|
|
71
|
+
const { getDcwLineRepo } = await import('../server/services/workshop/dcw/dcw-line.repo')
|
|
72
|
+
const { getDcwProductRepo } = await import('../server/services/workshop/dcw/dcw-product.repo')
|
|
73
|
+
const { getDcwRecipeRepo } = await import('../server/services/workshop/dcw/dcw-recipe.repo')
|
|
74
|
+
const { getDcwNodeRepo } = await import('../server/services/workshop/dcw/dcw-node.repo')
|
|
75
|
+
const { DcwNode } = await import('../server/services/workshop/dcw/dcw-node')
|
|
76
|
+
const { getDaqNodeRepo } = await import('../server/services/workshop/daq/daq-node.repo')
|
|
77
|
+
const { DaqNode } = await import('../server/services/workshop/daq/daq-node')
|
|
78
|
+
const { SqliteTimeSeriesAdapter } = await import('../server/services/workshop/daq/storage/sqlite.adapter')
|
|
79
|
+
const { getContextSegmentRepo, recipeContentHash } = await import('../server/services/workshop/process-model/context-segments.repo')
|
|
80
|
+
const { openWorkshopDb } = await import('../server/services/workshop/db/database/open')
|
|
81
|
+
const { configureAmlRuntime } = await import('../server/services/workshop/aml/runtime')
|
|
82
|
+
const { bindOpsRepos } = await import('../server/services/workshop/ops/ops')
|
|
83
|
+
const { createAuditRepo } = await import('../server/services/workshop/db/ops.repo')
|
|
84
|
+
|
|
85
|
+
const seedDb = openWorkshopDb(join(HOME, 'data', 'workshop.sqlite'))
|
|
86
|
+
configureAmlRuntime(seedDb)
|
|
87
|
+
try {
|
|
88
|
+
bindOpsRepos({ audit: createAuditRepo(seedDb) })
|
|
89
|
+
}
|
|
90
|
+
catch { /* 重复装配无害 */ }
|
|
91
|
+
|
|
92
|
+
const line = getDcwLineRepo().create({ name: `本体验收线-${TAG}`, simulated: true })
|
|
93
|
+
const product = getDcwProductRepo().create({ name: `本体验收产品-${TAG}`, lineId: line.id })
|
|
94
|
+
// 数控节点:压力控制(写) + 线速控制(写,守卫目标)
|
|
95
|
+
getDcwNodeRepo().insert(new DcwNode({
|
|
96
|
+
id: `dcw-${TAG}-press`, templateRef: 'dcw-temp-sp', driver: 'mock',
|
|
97
|
+
name: `熔体压力控制-${TAG}`, lineId: line.id, min: 0, max: 100, unit: 'bar',
|
|
98
|
+
}))
|
|
99
|
+
getDcwNodeRepo().insert(new DcwNode({
|
|
100
|
+
id: `dcw-${TAG}-speed`, templateRef: 'dcw-temp-sp', driver: 'mock',
|
|
101
|
+
name: `线速度控制-${TAG}`, lineId: line.id, min: 0, max: 50, unit: 'm/min',
|
|
102
|
+
}))
|
|
103
|
+
const DCW_PRESS = `dcw-${TAG}-press`
|
|
104
|
+
const DCW_SPEED = `dcw-${TAG}-speed`
|
|
105
|
+
for (const id of [DCW_PRESS, DCW_SPEED]) {
|
|
106
|
+
const node = getDcwNodeRepo().byId(id)
|
|
107
|
+
if (node) {
|
|
108
|
+
node.readValue = id === DCW_PRESS ? 50 : 10
|
|
109
|
+
getDcwNodeRepo().flushNow()
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// 数采节点:压力 MV / 膜厚 CV / 温区状态(守卫条件变量)
|
|
113
|
+
getDaqNodeRepo().insert(DaqNode.fromRow({
|
|
114
|
+
id: `dn-${TAG}-mv`, templateRef: 'tpl-live-mv', name: `熔体压力-${TAG}`, unit: 'bar',
|
|
115
|
+
min: 0, max: 100, lineId: line.id, driver: 'mock',
|
|
116
|
+
}))
|
|
117
|
+
getDaqNodeRepo().insert(DaqNode.fromRow({
|
|
118
|
+
id: `dn-${TAG}-cv`, templateRef: 'tpl-live-cv', name: `平均膜厚-${TAG}`, unit: 'μm',
|
|
119
|
+
min: 0, max: 200, lineId: line.id, driver: 'mock',
|
|
120
|
+
}))
|
|
121
|
+
getDaqNodeRepo().insert(DaqNode.fromRow({
|
|
122
|
+
id: `dn-${TAG}-temp`, templateRef: 'tpl-live-temp', name: `温区温度-${TAG}`, unit: '℃',
|
|
123
|
+
min: 0, max: 400, lineId: line.id, driver: 'mock',
|
|
124
|
+
}))
|
|
125
|
+
const MV_ID = `dn-${TAG}-mv`
|
|
126
|
+
const CV_ID = `dn-${TAG}-cv`
|
|
127
|
+
const TEMP_ID = `dn-${TAG}-temp`
|
|
128
|
+
const recipe = getDcwRecipeRepo().create({
|
|
129
|
+
name: `本体验收配方-${TAG}`, productId: product.id,
|
|
130
|
+
params: [{ nodeId: DCW_PRESS, value: 50, min: 0, max: 100 }],
|
|
131
|
+
daqWindows: [{ nodeId: MV_ID, min: 0, max: 100 }],
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const now0 = Date.now()
|
|
135
|
+
const runStartBase = now0 - 3 * 3600_000
|
|
136
|
+
const sampleRows = []
|
|
137
|
+
const segRepo = getContextSegmentRepo()
|
|
138
|
+
const seedHash = recipeContentHash(recipe)
|
|
139
|
+
for (let r = 0; r < N_RUNS; r++) {
|
|
140
|
+
const start = runStartBase + r * (N_STEPS * BEAT + 120_000)
|
|
141
|
+
const end = start + (N_STEPS - 1) * BEAT
|
|
142
|
+
const run = getDcwRecipeRepo().createRun(recipe)
|
|
143
|
+
run.startedAt = new Date(start).toISOString()
|
|
144
|
+
run.endedAt = new Date(end).toISOString()
|
|
145
|
+
getDcwRecipeRepo().updateRun(run)
|
|
146
|
+
segRepo.insert({ lineId: line.id, runId: run.id, fromTs: start, toTs: end, recipeId: recipe.id, recipeVersion: recipe.version ?? 1, recipeContentHash: seedHash, conditionId: 'c-live', source: 'line_run', confirmed: true })
|
|
147
|
+
let y = 52
|
|
148
|
+
const uq = []
|
|
149
|
+
for (let k = 0; k < N_STEPS; k++) {
|
|
150
|
+
const u = 50 + 20 * Math.sin((k + r * 11) / 9) + 6 * Math.sin((k + r * 3) / 4)
|
|
151
|
+
uq.push(u)
|
|
152
|
+
const delayed = uq[Math.max(0, uq.length - 1 - DELAY_STEPS)]
|
|
153
|
+
y = 0.3 * y + 0.7 * delayed + 8 + 0.02 * Math.sin((k + r) / 3)
|
|
154
|
+
const ts = start + k * BEAT
|
|
155
|
+
const tags = { lineId: line.id, productId: product.id, recipeId: recipe.id, runId: run.id }
|
|
156
|
+
sampleRows.push({ nodeId: MV_ID, tsMs: ts, value: u, state: 'ok', ...tags })
|
|
157
|
+
sampleRows.push({ nodeId: CV_ID, tsMs: ts, value: y, state: 'ok', ...tags })
|
|
158
|
+
sampleRows.push({ nodeId: TEMP_ID, tsMs: ts, value: 190 + 8 * Math.sin((k + r) / 6), state: 'ok', ...tags })
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const seedTsdb = new SqliteTimeSeriesAdapter()
|
|
162
|
+
await seedTsdb.init()
|
|
163
|
+
await seedTsdb.writeSamples(sampleRows)
|
|
164
|
+
await seedTsdb.close()
|
|
165
|
+
console.log(`seed: line=${line.id} recipe=${recipe.id} runs=${N_RUNS} samples=${sampleRows.length}`)
|
|
166
|
+
console.log(`venv: ${venvLinked ? 'junction ok' : '未复用'}`)
|
|
167
|
+
|
|
168
|
+
function insertSamples(rows) {
|
|
169
|
+
if (!rows.length) return
|
|
170
|
+
const db = new DatabaseSync(join(HOME, 'data', 'daq-timeseries.sqlite'))
|
|
171
|
+
db.exec('PRAGMA busy_timeout=8000')
|
|
172
|
+
const ins = db.prepare(`INSERT OR IGNORE INTO daq_samples
|
|
173
|
+
(node_id, ts_ms, value, state, line_id, product_id, recipe_id, run_id, ingested_at)
|
|
174
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
175
|
+
db.exec('BEGIN')
|
|
176
|
+
for (const r of rows) ins.run(r.nodeId, r.tsMs, r.value, r.state ?? 'ok', r.lineId ?? null, r.productId ?? null, r.recipeId ?? null, r.runId ?? null, r.ingestedAt ?? Date.now())
|
|
177
|
+
db.exec('COMMIT')
|
|
178
|
+
db.close()
|
|
179
|
+
}
|
|
180
|
+
function writeFreshTail() {
|
|
181
|
+
// context 窗口 = H*beat + maxDelay + 5*beat(≈155s);尾巴必须覆盖整窗,否则网格 NaN
|
|
182
|
+
const now = Date.now()
|
|
183
|
+
const rows = []
|
|
184
|
+
const span = Math.ceil(H + DELAY_STEPS + 6)
|
|
185
|
+
for (let k = span; k >= 1; k--) {
|
|
186
|
+
const ts = now - k * BEAT
|
|
187
|
+
const tags = { lineId: line.id, productId: product.id, recipeId: recipe.id }
|
|
188
|
+
const mv = 50 + 6 * Math.sin(k / 5)
|
|
189
|
+
rows.push({ nodeId: MV_ID, tsMs: ts, value: mv, state: 'ok', ...tags })
|
|
190
|
+
rows.push({ nodeId: CV_ID, tsMs: ts, value: 50 + 0.7 * (mv - 50) + 0.05 * Math.sin(k / 3), state: 'ok', ...tags })
|
|
191
|
+
rows.push({ nodeId: TEMP_ID, tsMs: ts, value: 195, state: 'ok', ...tags })
|
|
192
|
+
}
|
|
193
|
+
insertSamples(rows)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ════ 1. 启动隔离实例 ════
|
|
197
|
+
// 隔离实例强制 SQLite 时序(宿主机真实 Timescale 在线时,插件会切到 Timescale,
|
|
198
|
+
// 看不到本用例预置的 SQLite 样本——2026-10-24 真机验收实测踩中);MQTT 指到关闭端口 → 进程内队列。
|
|
199
|
+
const { saveSettings } = await import('../shared/config/engine.mjs')
|
|
200
|
+
saveSettings({
|
|
201
|
+
'daq.timescale.host': '127.0.0.1',
|
|
202
|
+
'daq.timescale.port': 6543,
|
|
203
|
+
'daq.mqtt.host': '127.0.0.1',
|
|
204
|
+
'daq.mqtt.port': 18830,
|
|
205
|
+
'daq.startInfrastructure': 'never',
|
|
206
|
+
}, join(HOME, 'runtime-settings.json'))
|
|
207
|
+
let port = 0
|
|
208
|
+
for (const p of [3992, 3991, 3990, 3989, 3988]) {
|
|
209
|
+
let occupied = false
|
|
210
|
+
try {
|
|
211
|
+
await fetch(`http://127.0.0.1:${p}/api/health`, { signal: AbortSignal.timeout(800) })
|
|
212
|
+
occupied = true
|
|
213
|
+
}
|
|
214
|
+
catch { /* 空闲 */ }
|
|
215
|
+
if (!occupied) {
|
|
216
|
+
// 二次确认:端口无监听才用(僵尸可能健康检查超时但仍占口)
|
|
217
|
+
const { execSync } = await import('node:child_process')
|
|
218
|
+
try {
|
|
219
|
+
const out = execSync(`netstat -ano | findstr :${p} | findstr LISTENING`, { shell: 'cmd.exe' }).toString()
|
|
220
|
+
const pidMatch = out.match(/\s(\d+)\s*$/m)
|
|
221
|
+
if (pidMatch) { spawn('taskkill', ['/PID', pidMatch[1], '/T', '/F'], { stdio: 'ignore' }); await sleep(1500) }
|
|
222
|
+
}
|
|
223
|
+
catch { /* 无监听 */ }
|
|
224
|
+
port = p
|
|
225
|
+
break
|
|
226
|
+
}
|
|
227
|
+
await sleep(300)
|
|
228
|
+
}
|
|
229
|
+
if (!port) throw new Error('无空闲端口')
|
|
230
|
+
const BASE = `http://127.0.0.1:${port}`
|
|
231
|
+
console.log(`\n=== 1. boot ${BASE} ===`)
|
|
232
|
+
const logFd = openSync(join(ROOT, 'dev.log'), 'a')
|
|
233
|
+
const child = spawn(process.execPath, [join(REPO, 'bin', 'aw.mjs'), 'dev', '--port', String(port)], {
|
|
234
|
+
cwd: REPO,
|
|
235
|
+
env: { ...process.env, AW_RATE_LIMIT_OFF: '1', NUXT_SESSION_PASSWORD: 'OntologyLive#2026-e2e-session', NO_PROXY: '127.0.0.1,localhost' },
|
|
236
|
+
stdio: ['ignore', logFd, logFd],
|
|
237
|
+
windowsHide: true,
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
async function api(method, path, body, token, timeoutMs = 180_000) {
|
|
241
|
+
const res = await fetch(BASE + path, {
|
|
242
|
+
method,
|
|
243
|
+
headers: { 'content-type': 'application/json', ...(token ? { authorization: `Bearer ${token}` } : {}) },
|
|
244
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
245
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
246
|
+
})
|
|
247
|
+
let json = null
|
|
248
|
+
try {
|
|
249
|
+
json = await res.json()
|
|
250
|
+
}
|
|
251
|
+
catch { /* 非 JSON */ }
|
|
252
|
+
return { status: res.status, ...(json ?? {}) }
|
|
253
|
+
}
|
|
254
|
+
const data = r => r?.data
|
|
255
|
+
const errCode = r => r?.code ?? r?.data?.code ?? ''
|
|
256
|
+
|
|
257
|
+
let healthy = false
|
|
258
|
+
for (let i = 0; i < 120; i++) {
|
|
259
|
+
await sleep(1500)
|
|
260
|
+
try {
|
|
261
|
+
const h = await api('GET', '/api/health', undefined, undefined, 3000)
|
|
262
|
+
if (h?.data?.status === 'ok' && h?.data?.workshop === 'ready') { healthy = true; break }
|
|
263
|
+
}
|
|
264
|
+
catch { /* 未就绪 */ }
|
|
265
|
+
}
|
|
266
|
+
check('BOOT', '隔离实例启动 + workshop ready', healthy, `port=${port}`)
|
|
267
|
+
if (!healthy) { killTree(child.pid); throw new Error('实例未就绪:' + join(ROOT, 'dev.log')) }
|
|
268
|
+
|
|
269
|
+
const email = `ont-${TAG}@awshop.local`
|
|
270
|
+
let reg = null
|
|
271
|
+
for (let attempt = 0; attempt < 3 && !data(reg ?? {})?.token; attempt++) {
|
|
272
|
+
try {
|
|
273
|
+
reg = await api('POST', '/api/users/register', { name: `本体验收-${TAG}`, email, password: 'OntLive#2026' })
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
console.log(`register attempt ${attempt + 1} failed: ${String(err).slice(0, 120)}`)
|
|
277
|
+
await sleep(3000)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const token = data(reg ?? {})?.token
|
|
281
|
+
check('BOOT', '管理员注册(首注册=admin)', Boolean(token), `status=${reg.status}`)
|
|
282
|
+
if (!token) { killTree(child.pid); throw new Error('注册失败') }
|
|
283
|
+
|
|
284
|
+
// ════ L1 产线管理与节点绑定(REST) ════
|
|
285
|
+
console.log('\n=== L1 产线管理/节点绑定 ===')
|
|
286
|
+
{
|
|
287
|
+
const lines = await api('GET', '/api/workshop/dcw/lines', undefined, token)
|
|
288
|
+
check('L1.1', 'GET /dcw/lines 含验收线(simulated)', (data(lines)?.lines ?? lines ?? []).some?.(l => l.id === line.id) ?? JSON.stringify(data(lines) ?? lines).includes(line.id), `status=${lines.status}`)
|
|
289
|
+
const dcwNodes = await api('GET', '/api/workshop/dcw', undefined, token)
|
|
290
|
+
const daqNodes = await api('GET', '/api/workshop/daq', undefined, token)
|
|
291
|
+
const daqList = JSON.stringify(data(daqNodes) ?? {})
|
|
292
|
+
check('L1.2', 'GET /daq 数采节点齐备(MV/CV/温区)', daqNodes.status === 200 && [MV_ID, CV_ID, TEMP_ID].every(id => daqList.includes(id)), `status=${daqNodes.status}`)
|
|
293
|
+
check('L1.3', '数控节点清单含压力/线速', dcwNodes.status === 200 && JSON.stringify(data(dcwNodes) ?? {}).includes(DCW_PRESS) && JSON.stringify(data(dcwNodes) ?? {}).includes(DCW_SPEED), `status=${dcwNodes.status}`)
|
|
294
|
+
const recipes = await api('GET', '/api/workshop/dcw/recipes', undefined, token).catch(() => ({ status: 0, raw: null }))
|
|
295
|
+
check('L1.4', '配方可读(REST 或清单)', recipes.status === 0 || JSON.stringify(data(recipes) ?? recipes).includes(recipe.id), `status=${recipes.status}`)
|
|
296
|
+
writeFreshTail()
|
|
297
|
+
check('L1.5', 'PLC 场景数据就绪(4 批次历史 + 新鲜尾巴)', sampleRows.length > 1000, `samples=${sampleRows.length}`)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// ════ L2 本体全功能真机 REST ════
|
|
301
|
+
console.log('\n=== L2 本体全链 REST ===')
|
|
302
|
+
const ONT = `ont-${TAG}`
|
|
303
|
+
let draftId
|
|
304
|
+
let draftRev
|
|
305
|
+
let v1Hash
|
|
306
|
+
let v1PackHash
|
|
307
|
+
{
|
|
308
|
+
const created = await api('POST', '/api/workshop/ontology', { ontologyId: ONT, lineId: line.id, name: `本体验收-${TAG}` }, token)
|
|
309
|
+
draftId = data(created)?.draft?.id ?? ''
|
|
310
|
+
check('L2.1', 'POST /ontology 创建草稿', created.status === 200 && Boolean(draftId), `status=${created.status} id=${draftId}`)
|
|
311
|
+
|
|
312
|
+
const doc = {
|
|
313
|
+
schemaVersion: 1,
|
|
314
|
+
name: `本体验收-${TAG}`,
|
|
315
|
+
lineId: line.id,
|
|
316
|
+
entities: [
|
|
317
|
+
{ key: 'pv.melt_pressure', kind: 'process_variable', name: '熔体压力', description: '', unit: 'bar', dimension: 'pressure', role: 'control', attrs: { dataType: 'number' } },
|
|
318
|
+
{ key: 'cv.thickness', kind: 'quality_variable', name: '平均膜厚', description: '', unit: 'μm', dimension: 'length', role: 'target', attrs: { dataType: 'number' } },
|
|
319
|
+
{ key: 'st.line_speed', kind: 'process_variable', name: '线速度', description: '', unit: 'm/min', dimension: '', role: 'control', attrs: { dataType: 'number' } },
|
|
320
|
+
{ key: 'st.zone_temp', kind: 'process_variable', name: '温区温度', description: '', unit: '℃', dimension: 'temperature', role: 'state', attrs: { dataType: 'number' } },
|
|
321
|
+
],
|
|
322
|
+
relations: [
|
|
323
|
+
{
|
|
324
|
+
id: 'rel-1', kind: 'influences', srcKey: 'pv.melt_pressure', dstKey: 'cv.thickness', status: 'validated',
|
|
325
|
+
evidence: [{ id: 'ev-rel', level: 'validated_control', source: { type: 'optimizer_run', runId: 'run-live', problemIrHash: 'ir-live', modelArtifactHash: 'mdl-live' }, sourceRefHash: 'h', createdAt: new Date().toISOString() }],
|
|
326
|
+
properties: { sign: 'negative', gainPerUnit: -0.4, lagMs: 2 * DELAY_STEPS * BEAT, evidenceTier: 'validated_control', variabilityChecked: true },
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: 'rel-2', kind: 'influences', srcKey: 'st.line_speed', dstKey: 'cv.thickness', status: 'proposed',
|
|
330
|
+
evidence: [{ id: 'ev-rel2', level: 'candidate_influence', source: { type: 'expert_note', author: 'engineer', noteId: 'n1' }, sourceRefHash: 'h', createdAt: new Date().toISOString() }],
|
|
331
|
+
properties: { evidenceTier: 'candidate_influence', variabilityChecked: false, transportDistanceM: 10, nominalSpeedMps: 0.5 },
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
rules: [
|
|
335
|
+
{
|
|
336
|
+
id: 'R-BOUND', key: 'thickness-window', kind: 'bound',
|
|
337
|
+
dsl: { type: 'bound', variableKey: 'cv.thickness', min: 45, max: 55, unit: 'μm' },
|
|
338
|
+
constraintLevel: 'hard', severity: 'error', status: 'proposed',
|
|
339
|
+
evidence: [{ id: 'ev-bound', level: 'validated_control', source: { type: 'optimizer_run', runId: 'run-live-b', problemIrHash: 'ir', modelArtifactHash: 'mdl' }, sourceRefHash: 'h', createdAt: new Date().toISOString() }],
|
|
340
|
+
description: '膜厚工艺窗(μm)', scope: { lineId: line.id, recipeId: recipe.id, conditionId: '' },
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
id: 'R-GUARD', key: 'cold-zone-no-speedup', kind: 'state_condition',
|
|
344
|
+
dsl: { type: 'state_condition', when: { variableKey: 'st.zone_temp', op: 'lt', value: 180 }, forbid: { kind: 'positive_increment', variableKey: 'st.line_speed' }, message: '温区未达 180℃,禁止提速' },
|
|
345
|
+
constraintLevel: 'hard', severity: 'error', status: 'proposed',
|
|
346
|
+
evidence: [{ id: 'ev-guard', level: 'validated_control', source: { type: 'optimizer_run', runId: 'run-live-g', problemIrHash: 'ir', modelArtifactHash: 'mdl' }, sourceRefHash: 'h', createdAt: new Date().toISOString() }],
|
|
347
|
+
description: '冷区禁提速', scope: { lineId: line.id, recipeId: recipe.id, conditionId: '' },
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: 'R-INTERLOCK', key: 'estop', kind: 'interlock',
|
|
351
|
+
dsl: { type: 'interlock', text: '急停回路动作时禁止任何写控' },
|
|
352
|
+
constraintLevel: 'hard', severity: 'error', status: 'proposed',
|
|
353
|
+
evidence: [{ id: 'ev-il', level: 'candidate_influence', source: { type: 'expert_note', author: 'safety', noteId: 'n2' }, sourceRefHash: 'h', createdAt: new Date().toISOString() }],
|
|
354
|
+
description: '安全联锁归 PLC', scope: { lineId: line.id, recipeId: '', conditionId: '' },
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
bindings: [
|
|
358
|
+
{ id: 'b-press', entityKey: 'pv.melt_pressure', platformKind: 'dcw_node', platformId: DCW_PRESS, targetSub: '', scope: `line:${line.id}`, direction: 'write', unitDeclared: 'bar', unitTarget: 'bar', scale: 1, offset: 0 },
|
|
359
|
+
{ id: 'b-speed', entityKey: 'st.line_speed', platformKind: 'dcw_node', platformId: DCW_SPEED, targetSub: '', scope: `line:${line.id}`, direction: 'write', unitDeclared: 'm/min', unitTarget: 'm/min', scale: 1, offset: 0 },
|
|
360
|
+
{ id: 'b-cv', entityKey: 'cv.thickness', platformKind: 'daq_node', platformId: CV_ID, targetSub: '', scope: `line:${line.id}`, direction: 'read', unitDeclared: 'μm', unitTarget: 'μm', scale: 1, offset: 0 },
|
|
361
|
+
{ id: 'b-temp', entityKey: 'st.zone_temp', platformKind: 'daq_node', platformId: TEMP_ID, targetSub: '', scope: `line:${line.id}`, direction: 'read', unitDeclared: '℃', unitTarget: '℃', scale: 1, offset: 0 },
|
|
362
|
+
{ id: 'b-param', entityKey: 'pv.melt_pressure', platformKind: 'recipe_param', platformId: recipe.id, targetSub: DCW_PRESS, scope: `recipe:${recipe.id}@1`, direction: 'write', unitDeclared: 'bar', unitTarget: 'bar', scale: 1, offset: 0 },
|
|
363
|
+
],
|
|
364
|
+
note: 'live e2e',
|
|
365
|
+
}
|
|
366
|
+
const saved = await api('PATCH', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}`, { doc, expectedRev: 1 }, token)
|
|
367
|
+
draftRev = data(saved)?.draft?.rev ?? 0
|
|
368
|
+
check('L2.2', 'PATCH 草稿(整份文档,绑定真实节点)通过活体校验', saved.status === 200 && draftRev === 2 && data(saved)?.validation?.ok === true && data(saved)?.bindings?.ok === true, `status=${saved.status} code=${errCode(saved)} msg=${String(saved.message ?? '').slice(0, 200)} rev=${draftRev} issues=${JSON.stringify((data(saved)?.validation?.issues ?? []).filter(i => i.severity === 'error').slice(0, 2))} bindFail=${JSON.stringify((data(saved)?.bindings?.failures ?? []).slice(0, 2))}`)
|
|
369
|
+
|
|
370
|
+
const stale = await api('PATCH', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}`, { doc, expectedRev: 1 }, token)
|
|
371
|
+
check('L2.3', '过期 rev → 409 DRAFT_CONCURRENT_MODIFY', stale.status === 409 && String(errCode(stale)).includes('DRAFT_CONCURRENT_MODIFY'), `${stale.status}/${errCode(stale)}`)
|
|
372
|
+
|
|
373
|
+
const validated = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/validate`, {}, token)
|
|
374
|
+
check('L2.4', 'POST validate 全量校验 200', validated.status === 200 && data(validated)?.ok === true, `issues=${(data(validated)?.issues ?? []).length}`)
|
|
375
|
+
|
|
376
|
+
const compiled = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/compile`, {}, token)
|
|
377
|
+
check('L2.5', 'POST compile 四类产物 + 溯源', compiled.status === 200 && data(compiled)?.counts?.compiled >= 1 && (data(compiled)?.traces ?? []).length === 3, `status=${data(compiled)?.status} counts=${JSON.stringify(data(compiled)?.counts)}`)
|
|
378
|
+
|
|
379
|
+
// 证据登记(R-GUARD 追加一条 observed;两硬规则已带 validated_control)
|
|
380
|
+
const ev = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/evidence`, {
|
|
381
|
+
targetKind: 'rule', targetKey: 'R-GUARD', level: 'observed_correlation',
|
|
382
|
+
source: { type: 'dataset_stats', datasetId: 'ds-live', sha256: 'sha-live' }, sourceRef: 'ds-live',
|
|
383
|
+
}, token)
|
|
384
|
+
check('L2.6', 'POST evidence 写回草稿', ev.status === 200, `status=${ev.status}`)
|
|
385
|
+
|
|
386
|
+
// 生命周期:单管理员部署 → solo 豁免自审(打 solo_operator 标记);批准单仍需两步
|
|
387
|
+
const t1 = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/transition`, { to: 'reviewed' }, token)
|
|
388
|
+
check('L2.7', 'solo 部署自审豁免:proposed→reviewed', t1.status === 200 && data(t1)?.rule?.status === 'reviewed', `${t1.status}/${errCode(t1)}`)
|
|
389
|
+
const t2 = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/transition`, { to: 'validated' }, token)
|
|
390
|
+
check('L2.8', 'reviewed→validated(有 validated_control 证据)', t2.status === 200, `${t2.status}/${errCode(t2)}`)
|
|
391
|
+
const noApproval = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/transition`, { to: 'approved_for_control' }, token)
|
|
392
|
+
check('L2.9', '无批准单 → 403 APPROVAL_REQUIRED', noApproval.status === 403, `${noApproval.status}/${errCode(noApproval)}`)
|
|
393
|
+
const approval = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/approval`, {}, token)
|
|
394
|
+
const approvalId = data(approval)?.approvalId ?? ''
|
|
395
|
+
check('L2.10', '申请批准单', approval.status === 200 && Boolean(approvalId), `id=${approvalId}`)
|
|
396
|
+
const decided = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/approval-decision`, { approvalId, approved: true, comment: '工艺确认' }, token)
|
|
397
|
+
check('L2.11', '裁决批准(同一管理员,审计留痕)', decided.status === 200, `${decided.status}/${errCode(decided)}`)
|
|
398
|
+
const approved = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-BOUND/transition`, { to: 'approved_for_control', approvalId }, token)
|
|
399
|
+
check('L2.12', '→ approved_for_control', approved.status === 200 && data(approved)?.rule?.status === 'approved_for_control', `${approved.status}`)
|
|
400
|
+
// R-GUARD 同样推进
|
|
401
|
+
await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-GUARD/transition`, { to: 'reviewed' }, token)
|
|
402
|
+
await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-GUARD/transition`, { to: 'validated' }, token)
|
|
403
|
+
const approval2 = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-GUARD/approval`, {}, token)
|
|
404
|
+
await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-GUARD/approval-decision`, { approvalId: data(approval2)?.approvalId, approved: true }, token)
|
|
405
|
+
await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/rules/R-GUARD/transition`, { to: 'approved_for_control', approvalId: data(approval2)?.approvalId }, token)
|
|
406
|
+
|
|
407
|
+
// 未获批规则拒发(独立小本体)
|
|
408
|
+
const draft2 = await api('POST', '/api/workshop/ontology', { ontologyId: `${ONT}-u`, lineId: line.id }, token)
|
|
409
|
+
const doc2 = JSON.parse(JSON.stringify(doc))
|
|
410
|
+
doc2.rules = [{ ...doc.rules[0], status: 'validated' }]
|
|
411
|
+
await api('PATCH', `/api/workshop/ontology/drafts/${encodeURIComponent(data(draft2)?.draft?.id)}`, { doc: doc2, expectedRev: 1 }, token)
|
|
412
|
+
const rejectPub = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(data(draft2)?.draft?.id)}/publish`, {}, token)
|
|
413
|
+
check('L2.13', '未获控制级批准 → 422 ONTOLOGY_NOT_APPROVED', rejectPub.status === 422 && String(errCode(rejectPub)).includes('ONTOLOGY_NOT_APPROVED'), `${rejectPub.status}/${errCode(rejectPub)}`)
|
|
414
|
+
|
|
415
|
+
const pub = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/publish`, {}, token)
|
|
416
|
+
v1Hash = data(pub)?.version?.contentHash ?? ''
|
|
417
|
+
v1PackHash = data(pub)?.packHash ?? ''
|
|
418
|
+
check('L2.14', 'admin 发布 v1(contentHash+packHash+counts)', pub.status === 200 && data(pub)?.version?.version === 1 && v1Hash.length === 64 && v1PackHash.length === 64, `counts=${JSON.stringify(data(pub)?.counts)}`)
|
|
419
|
+
|
|
420
|
+
const versions = await api('GET', `/api/workshop/ontology/versions/${encodeURIComponent(ONT)}`, undefined, token)
|
|
421
|
+
check('L2.15', 'GET versions 列出 v1(published)', versions.status === 200 && (data(versions)?.versions ?? []).some(v => v.version === 1 && v.status === 'published'), `n=${(data(versions)?.versions ?? []).length}`)
|
|
422
|
+
|
|
423
|
+
const traces = await api('GET', `/api/workshop/ontology/traces/${encodeURIComponent(ONT)}?version=1`, undefined, token)
|
|
424
|
+
check('L2.16', 'GET traces 溯源(每规则一行+决策)', traces.status === 200 && (data(traces)?.traces ?? []).length === 3 && (data(traces)?.traces ?? []).some(t => t.decisionCode === 'PLC_LAYER_REQUIRED'), `n=${(data(traces)?.traces ?? []).length}`)
|
|
425
|
+
|
|
426
|
+
const scene = await api('GET', `/api/workshop/ontology/scene?lineId=${encodeURIComponent(line.id)}`, undefined, token)
|
|
427
|
+
const sceneGraph = data(scene)?.graph
|
|
428
|
+
check('L2.17', 'GET scene 运行时子图(实体+绑定+守卫)', scene?.status === 200 && data(scene)?.active === true && (sceneGraph?.entities ?? []).length >= 4 && (sceneGraph?.guards ?? []).length >= 1 && (sceneGraph?.entities ?? []).some(e => e.bindings.length > 0), `entities=${(sceneGraph?.entities ?? []).length} guards=${(sceneGraph?.guards ?? []).length}`)
|
|
429
|
+
|
|
430
|
+
const exp = await fetch(`${BASE}/api/workshop/ontology/export/${encodeURIComponent(ONT)}?version=1`, { headers: { authorization: `Bearer ${token}` } })
|
|
431
|
+
const bundle = await exp.json().catch(() => null)
|
|
432
|
+
check('L2.18', 'GET export JSON bundle', exp.status === 200 && bundle?.data?.ontologyId === ONT && (bundle?.data?.entities ?? []).length >= 4, `status=${exp.status}`)
|
|
433
|
+
|
|
434
|
+
// 不可变:重复发布同 rev 内容 → 版本号递增,不覆盖
|
|
435
|
+
const republished = await api('POST', `/api/workshop/ontology/drafts/${encodeURIComponent(draftId)}/publish`, {}, token)
|
|
436
|
+
check('L2.19', '重复发布 → 新版本 v2(不可变语义)', republished.status === 200 && data(republished)?.version?.version === 2, `v=${data(republished)?.version?.version}`)
|
|
437
|
+
const cmp = await api('GET', `/api/workshop/ontology/versions/${encodeURIComponent(ONT)}/compare?from=1&to=2`, undefined, token)
|
|
438
|
+
check('L2.20', 'GET compare 四段 diff(无内容变更=空)', cmp.status === 200 && (data(cmp)?.rules?.changed ?? []).length === 0, `rules=${JSON.stringify(data(cmp)?.rules)}`)
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// ════ L3 运行时守卫(真实产线,进程内同库) ════
|
|
442
|
+
console.log('\n=== L3 运行时守卫 ===')
|
|
443
|
+
const svc = await import('../server/services/workshop/ontology/ontology.service')
|
|
444
|
+
{
|
|
445
|
+
const active = svc.resolveActiveOntology(line.id)
|
|
446
|
+
check('L3.1', 'resolveActiveOntology 解析最新发布版本', active?.version.version === 2 && active.packHash.length === 64, `v=${active?.version.version} pack=${String(active?.packHash).slice(0, 10)}`)
|
|
447
|
+
const blocked = svc.evaluateOntologyGuards(line.id, { values: { 'st.zone_temp': 150 }, deltas: { 'st.line_speed': 2 }, recipeId: recipe.id })
|
|
448
|
+
check('L3.2', '低温 150℃ + 提速 → 阻断', blocked.blocked === true, blocked.violations[0]?.message ?? '')
|
|
449
|
+
const allowed = svc.evaluateOntologyGuards(line.id, { values: { 'st.zone_temp': 200 }, deltas: { 'st.line_speed': 2 }, recipeId: recipe.id })
|
|
450
|
+
check('L3.3', '高温 200℃ + 提速 → 放行', allowed.blocked === false)
|
|
451
|
+
const failClosed = svc.evaluateOntologyGuards(line.id, { values: {}, deltas: { 'st.line_speed': 1 }, recipeId: recipe.id })
|
|
452
|
+
check('L3.4', '状态未知 + 提速 → fail-closed 阻断', failClosed.blocked === true && failClosed.violations[0]?.reason === 'state_unknown')
|
|
453
|
+
// 节点级意图面:绑定行在 L2 发布时已落库(dcw_node 映射),dcw 节点 readValue 由 seed 直置
|
|
454
|
+
const intent = svc.evaluateOntologyGuardsForNodes(line.id, [{ nodeId: DCW_SPEED, from: 10, to: 12 }], { recipeId: recipe.id })
|
|
455
|
+
check('L3.5', '节点级意图:实体→dcw 节点映射 + 状态未知提速 → 阻断', intent.blocked === true, `unmapped=${intent.unmapped.join(',')}`)
|
|
456
|
+
const intentDown = svc.evaluateOntologyGuardsForNodes(line.id, [{ nodeId: DCW_SPEED, from: 10, to: 8 }], { recipeId: recipe.id })
|
|
457
|
+
check('L3.6', '节点级意图:降速 → 放行', intentDown.blocked === false)
|
|
458
|
+
const drift = svc.verifyVersionBindings(ONT, 1)
|
|
459
|
+
check('L3.7', '绑定漂移巡检:真实节点在册 → 无漂移', drift.ok === true, JSON.stringify(drift.drifted).slice(0, 120))
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// ════ L4 AML 训练集成 + 本体先验 ════
|
|
463
|
+
console.log('\n=== L4 AML 集成 ===')
|
|
464
|
+
const SPEC = `pms-${TAG}`
|
|
465
|
+
let trainedModelId
|
|
466
|
+
let modelArtifactHash
|
|
467
|
+
{
|
|
468
|
+
const spec = {
|
|
469
|
+
schemaVersion: 2, id: SPEC, version: 1,
|
|
470
|
+
lineId: line.id, productId: product.id, recipeId: recipe.id, recipeVersion: recipe.version ?? 1,
|
|
471
|
+
conditions: [{ id: 'c1', match: [{ field: 'recipeId', op: 'eq', value: recipe.id }] }],
|
|
472
|
+
variables: [
|
|
473
|
+
{ id: 'mv1', nodeId: MV_ID, role: 'mv', field: 'value', unit: 'bar', scale: 1, offset: 0, delayMs: DELAY_STEPS * BEAT, min: 0, max: 100, maxStep: 20, controlNodeId: DCW_PRESS },
|
|
474
|
+
{ id: 'cv1', nodeId: CV_ID, role: 'cv', field: 'value', unit: 'μm', scale: 1, offset: 0, min: 0, max: 200 },
|
|
475
|
+
],
|
|
476
|
+
timing: { beatMs: BEAT, historySteps: H, horizonSteps: F, fixedDt: true },
|
|
477
|
+
trainer: { ref: 'linear_arx@1', config: { arOrder: 1, inputOrder: 1, ridgeLambda: 1e-6, standardize: true } },
|
|
478
|
+
datasetPolicy: { split: { valRatio: 0.4, testRatio: 0.4, seed: 42 }, cleaning: { hampelK: 0 } },
|
|
479
|
+
gatePolicyRef: 'process-model.gates@1',
|
|
480
|
+
modelInterface: { id: 'linear_state_space', version: 1, inputSemantics: 'setpoint', mode: 'state_space' },
|
|
481
|
+
effectiveDomain: { mv: { mv1: { min: 0, max: 100, maxStep: 20 } }, cv: { cv1: { min: 0, max: 200 } } },
|
|
482
|
+
purpose: 'mpc_surrogate',
|
|
483
|
+
}
|
|
484
|
+
const created = await api('POST', '/api/workshop/process-model/specs', spec, token)
|
|
485
|
+
check('L4.1', 'POST /process-model/specs 登记', created.status === 200, `${created.status}/${errCode(created)}`)
|
|
486
|
+
const publish = await api('POST', `/api/workshop/process-model/specs/${encodeURIComponent(SPEC)}/publish?version=1`, undefined, token)
|
|
487
|
+
check('L4.2', 'spec 发布', publish.status === 200 && data(publish)?.spec?.status === 'published', `${publish.status}`)
|
|
488
|
+
let ds = await api('POST', '/api/workshop/process-model/datasets', spec, token)
|
|
489
|
+
for (const backoff of [3000, 6000]) {
|
|
490
|
+
if (ds.status === 200) break
|
|
491
|
+
// 已知环境抖动(dev TSDB 适配器初始化竞态):重写尾巴后指数退避重试
|
|
492
|
+
writeFreshTail()
|
|
493
|
+
await sleep(backoff)
|
|
494
|
+
ds = await api('POST', '/api/workshop/process-model/datasets', spec, token)
|
|
495
|
+
}
|
|
496
|
+
const datasetId = data(ds)?.datasetId
|
|
497
|
+
check('L4.3', '数据集构建(lineage_verified)', ds.status === 200 && Boolean(datasetId) && data(ds)?.rowCount > 200, `status=${ds.status} code=${errCode(ds)} msg=${String(ds.message ?? '').slice(0, 160)} rows=${data(ds)?.rowCount}`)
|
|
498
|
+
const dsGet = await api('GET', `/api/workshop/aml/datasets/${encodeURIComponent(datasetId)}`, undefined, token)
|
|
499
|
+
check('L4.4', '数据集 manifest 可读', dsGet.status === 200 && data(dsGet)?.manifest?.version === 2, `v=${data(dsGet)?.manifest?.version}`)
|
|
500
|
+
const elig = await api('POST', '/api/workshop/process-model/eligibility', { specId: SPEC, specVersion: 1, datasetId, scope: 'simulation' }, token)
|
|
501
|
+
check('L4.5', '资格报告 optimizationEligible', elig.status === 200 && data(elig)?.report?.optimizationEligible === true, `gaps=${(data(elig)?.report?.gaps ?? []).map(g => g.code).join(',') || 'none'}`)
|
|
502
|
+
const train = await api('POST', '/api/workshop/process-model/train', { spec, datasetId, modelName: `本体验收模型-${TAG}` }, token)
|
|
503
|
+
const jobId = data(train)?.job?.id
|
|
504
|
+
check('L4.6', '训练作业提交', train.status === 200 && Boolean(jobId), `status=${train.status} code=${errCode(train)} msg=${String(train.message ?? '').slice(0, 160)}`)
|
|
505
|
+
let job = null
|
|
506
|
+
const terminal = new Set(['done', 'failed', 'cancelled', 'timeout', 'interrupted'])
|
|
507
|
+
for (let i = 0; i < 240; i++) {
|
|
508
|
+
const jr = await api('GET', `/api/workshop/aml/jobs/${encodeURIComponent(jobId)}`, undefined, token)
|
|
509
|
+
job = data(jr)?.job
|
|
510
|
+
if (job && terminal.has(job.status)) break
|
|
511
|
+
await sleep(500)
|
|
512
|
+
}
|
|
513
|
+
trainedModelId = job?.modelId ?? ''
|
|
514
|
+
check('L4.7', '训练 done + 模型登记', job?.status === 'done' && Boolean(trainedModelId), `status=${job?.status} model=${trainedModelId} err=${String(job?.error ?? '').slice(0, 120)}`)
|
|
515
|
+
const models = await api('GET', `/api/workshop/aml/models?recipeId=${encodeURIComponent(recipe.id)}`, undefined, token)
|
|
516
|
+
const model = (data(models)?.models ?? []).find(m => m.id === trainedModelId)
|
|
517
|
+
modelArtifactHash = model?.artifactHash ?? ''
|
|
518
|
+
check('L4.8', '模型 linear_state_space@1 + artifactHash', model?.artifactKind === 'linear_state_space@1' && modelArtifactHash.length === 64, `${model?.artifactKind} metrics=${JSON.stringify(model?.metrics ?? {}).slice(0, 200)}`)
|
|
519
|
+
|
|
520
|
+
// 本体先验派生(进程内,读已发布版本)
|
|
521
|
+
const priors = svc.deriveTrainingPriors(line.id)
|
|
522
|
+
check('L4.9', '本体训练先验:特征候选≥2(压力/线速→膜厚)', (priors?.featureCandidates ?? []).length >= 2, JSON.stringify((priors?.featureCandidates ?? []).map(f => f.entityKey)))
|
|
523
|
+
check('L4.10', '本体训练先验:时滞含 τ=D/v(10m/0.5mps=20s)', (priors?.delayPriors ?? []).some(d => d.basis === 'tau_eq_D_over_v' && d.delayMs === 20000), JSON.stringify(priors?.delayPriors))
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// ════ L5 求解器集成(含 ontologyRefs 耦合) ════
|
|
527
|
+
console.log('\n=== L5 求解器集成 ===')
|
|
528
|
+
const profileId = `optp-${TAG}`
|
|
529
|
+
let bindingId
|
|
530
|
+
let recId
|
|
531
|
+
let leadAgentIdOuter
|
|
532
|
+
let channelIdOuter
|
|
533
|
+
{
|
|
534
|
+
// 工艺优化档位频道(模板实例化):优化器族工具在该档位才开放(注入差异化实测)
|
|
535
|
+
const inst = await api('POST', '/api/workshop/channel-templates/chtpl-aml-optimization-default/instantiate', { name: `本体验收优化频道-${TAG}`, bindLineId: line.id }, token)
|
|
536
|
+
const instData = data(inst) ?? {}
|
|
537
|
+
const workspaceId = data(await api('POST', '/api/workshop/workspaces', { name: `本体验收工作区-${TAG}` }, token))?.id
|
|
538
|
+
const channelId = instData.channelId
|
|
539
|
+
const leadAgentId = instData.leadAgentId ?? (instData.agents ?? []).find(a => a.role === 'lead')?.id
|
|
540
|
+
leadAgentIdOuter = leadAgentId
|
|
541
|
+
channelIdOuter = channelId
|
|
542
|
+
if (workspaceId && channelId) await api('POST', `/api/workshop/workspaces/${encodeURIComponent(workspaceId)}/channels/${encodeURIComponent(channelId)}`, undefined, token)
|
|
543
|
+
check('L5.1', '优化档位频道(模板实例化)+workspace 就绪', Boolean(workspaceId && channelId && leadAgentId), `inst=${inst.status} ch=${channelId}`)
|
|
544
|
+
|
|
545
|
+
const profileBody = {
|
|
546
|
+
schemaVersion: 1, id: profileId, version: 1,
|
|
547
|
+
modelRef: { modelId: trainedModelId, artifactKind: 'linear_state_space@1', artifactHash: '', modelInterface: 'linear_state_space', stage: 'candidate' },
|
|
548
|
+
problemTemplateRef: 'linear_mpc_quadratic@1',
|
|
549
|
+
problemConfig: { linear_mpc_quadratic: { cvWeights: { cv1: 1 }, duWeights: { mv1: 0.1 }, terminalWeight: 2, targets: { cv1: 50 } } },
|
|
550
|
+
solverRef: 'osqp_mpc@1', solverVersion: '1',
|
|
551
|
+
processSpecRef: `${SPEC}@1`, conditionIds: [], status: 'draft',
|
|
552
|
+
}
|
|
553
|
+
const created = await api('POST', '/api/workshop/optimization/profiles', profileBody, token)
|
|
554
|
+
check('L5.2', 'Profile v1 创建(服务端回填工件)', created.status === 200 && data(created)?.profile?.modelArtifactHash?.length === 64, `status=${created.status} code=${errCode(created)} msg=${String(created.message ?? '').slice(0, 160)}`)
|
|
555
|
+
const pub = await api('POST', `/api/workshop/optimization/profiles/${encodeURIComponent(profileId)}/publish?version=1`, undefined, token)
|
|
556
|
+
check('L5.3', 'Profile v1 发布', pub.status === 200 && data(pub)?.profile?.status === 'published', `${pub.status}`)
|
|
557
|
+
const bind = await api('POST', '/api/workshop/optimization/bindings', {
|
|
558
|
+
workspaceId, channelId, agentInstanceId: leadAgentId, profileId, profileVersion: 1, mode: 'recommendation',
|
|
559
|
+
}, token)
|
|
560
|
+
bindingId = data(bind)?.binding?.id ?? ''
|
|
561
|
+
check('L5.4', 'Agent↔Profile 绑定(revision=1)', bind.status === 200 && Boolean(bindingId), `id=${bindingId}`)
|
|
562
|
+
|
|
563
|
+
writeFreshTail()
|
|
564
|
+
const solve = await api('POST', '/api/workshop/optimization/solve', { agentInstanceId: leadAgentId }, token)
|
|
565
|
+
const outcome = data(solve)
|
|
566
|
+
recId = String(outcome?.recommendation?.id ?? '')
|
|
567
|
+
check('L5.5', 'solve optimal(本体已发布不干扰求解)', solve.status === 200 && outcome?.result?.status === 'optimal', `status=${outcome?.result?.status} http=${solve.status} msg=${String(solve.message ?? '').slice(0, 120)}`)
|
|
568
|
+
const writesPath = join(HOME, 'data', 'dcw-writes.json')
|
|
569
|
+
const writesBefore = existsSync(writesPath) ? readFileSync(writesPath, 'utf8').length : 0
|
|
570
|
+
let solve2 = await api('POST', '/api/workshop/optimization/solve', { agentInstanceId: leadAgentId }, token)
|
|
571
|
+
if (solve2.status !== 200) {
|
|
572
|
+
writeFreshTail()
|
|
573
|
+
await sleep(2000)
|
|
574
|
+
solve2 = await api('POST', '/api/workshop/optimization/solve', { agentInstanceId: leadAgentId }, token)
|
|
575
|
+
}
|
|
576
|
+
const writesAfter = existsSync(writesPath) ? readFileSync(writesPath, 'utf8').length : 0
|
|
577
|
+
check('L5.6', '求解零 DCW 写入(治理红线)', solve2.status === 200 && writesBefore === writesAfter, `http=${solve2.status} code=${errCode(solve2)} msg=${String(solve2.message ?? data(solve2)?.result?.diagnostics?.message ?? '').slice(0, 140)} writes=${writesBefore}→${writesAfter}`)
|
|
578
|
+
|
|
579
|
+
const recId2 = String(data(solve2)?.recommendation?.id ?? '')
|
|
580
|
+
const recPath = `/api/workshop/optimization/recommendations/${encodeURIComponent(recId || recId2)}`
|
|
581
|
+
const xcheck = await api('POST', `${recPath}/crosscheck`, {}, token)
|
|
582
|
+
const xrow = data(xcheck)?.crosscheck
|
|
583
|
+
check('L5.7', 'crosscheck 双实现互校', xcheck.status === 200 && ['pass', 'not_applicable'].includes(xrow?.verdict),
|
|
584
|
+
`verdict=${xrow?.verdict} maxDev=${JSON.stringify(xrow?.maxDevDimensionless ?? xrow?.maxDev)} tol=${xrow?.tol} reason=${String(xrow?.reason ?? '').slice(0, 120)} model=${String(recId2 ? '' : '')}`)
|
|
585
|
+
|
|
586
|
+
// ontologyRefs 耦合:Profile v2 冻结本体引用
|
|
587
|
+
const v1 = await api('GET', `/api/workshop/ontology/versions/${encodeURIComponent(ONT)}`, undefined, token)
|
|
588
|
+
const v1row = (data(v1)?.versions ?? []).find(x => x.version === 1)
|
|
589
|
+
const profileV2 = {
|
|
590
|
+
...profileBody, version: 2,
|
|
591
|
+
ontologyRefs: [{ ontologyId: ONT, ontologyVersion: 1, contentHash: v1row?.contentHash, rulePackHash: v1row?.compiled?.rulePackHash, guardCount: 1 }],
|
|
592
|
+
}
|
|
593
|
+
const created2 = await api('POST', '/api/workshop/optimization/profiles', profileV2, token)
|
|
594
|
+
const pub2 = await api('POST', `/api/workshop/optimization/profiles/${encodeURIComponent(profileId)}/publish?version=2`, undefined, token)
|
|
595
|
+
check('L5.8', 'Profile v2 带 ontologyRefs 创建+发布', created2.status === 200 && pub2.status === 200, `c=${created2.status}/${errCode(created2)} p=${pub2.status}`)
|
|
596
|
+
const rebind = await api('POST', '/api/workshop/optimization/bindings', {
|
|
597
|
+
workspaceId, channelId, agentInstanceId: leadAgentId, profileId, profileVersion: 2, mode: 'recommendation',
|
|
598
|
+
}, token)
|
|
599
|
+
writeFreshTail()
|
|
600
|
+
const bindingV2Id = data(rebind)?.binding?.id ?? bindingId
|
|
601
|
+
const solve3 = await api('POST', '/api/workshop/optimization/solve', { agentInstanceId: leadAgentId, bindingId: bindingV2Id }, token)
|
|
602
|
+
check('L5.9', 'ontologyRefs Profile 求解正常(引用不进 IR hash)', solve3.status === 200 && data(solve3)?.result?.status === 'optimal', `http=${solve3.status} status=${data(solve3)?.result?.status} code=${errCode(solve3)} msg=${String(solve3.message ?? data(solve3)?.result?.diagnostics?.message ?? '').slice(0, 160)}`)
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// ════ L5b 模型采纳闭环(AI 提议 → HITL 批准 → 发布+重绑 → 新模型生效)════
|
|
606
|
+
{
|
|
607
|
+
// Agent 经工具桥发起采纳(同步等待 HITL;测试端并发裁决)
|
|
608
|
+
const adoptInvoke = api('POST', '/api/workshop/agent-tools/invoke', {
|
|
609
|
+
agentId: leadAgentIdOuter, tool: 'optimizer_profile_propose',
|
|
610
|
+
args: { model_id: trainedModelId, reason: '采纳闭环验收:重新绑定到最新训练模型' },
|
|
611
|
+
}, token, 300_000)
|
|
612
|
+
let card = null
|
|
613
|
+
for (let i = 0; i < 60; i++) {
|
|
614
|
+
await sleep(500)
|
|
615
|
+
try {
|
|
616
|
+
const pending = await api('GET', '/api/workshop/agent-tools/approvals', undefined, token)
|
|
617
|
+
card = (data(pending)?.approvals ?? []).find(a => String(a.nodeId).startsWith('optimizer-profile:') && a.agentId === leadAgentIdOuter)
|
|
618
|
+
if (card) break
|
|
619
|
+
}
|
|
620
|
+
catch { /* 未就绪 */ }
|
|
621
|
+
}
|
|
622
|
+
check('L5.10', '采纳卡挂出(nodeId=optimizer-profile:<id>@<v>)', Boolean(card), `nodeId=${card?.nodeId ?? 'none'}`)
|
|
623
|
+
const dec = card
|
|
624
|
+
? await api('POST', `/api/workshop/agent-tools/approvals/${encodeURIComponent(card.id)}/decide`, { approved: true, choice: 0, comment: '采纳闭环验收批准' }, token)
|
|
625
|
+
: { status: 0 }
|
|
626
|
+
check('L5.11', 'HITL 批准 → 单一咽喉完成发布+重绑', dec.status === 200 && (JSON.stringify(dec).includes('published') || JSON.stringify(dec).includes('已发布')), `status=${dec.status} body=${JSON.stringify(dec).slice(0, 700)}`)
|
|
627
|
+
const versionsAfter = data(await api('GET', `/api/workshop/optimization/profiles?limit=50`, undefined, token))
|
|
628
|
+
console.log(`[adopt] profiles after decide: ${JSON.stringify(versionsAfter).slice(0, 400)}`)
|
|
629
|
+
let adoptText
|
|
630
|
+
try {
|
|
631
|
+
adoptText = await adoptInvoke
|
|
632
|
+
}
|
|
633
|
+
catch (err) {
|
|
634
|
+
adoptText = { text: `invoke rejected: ${String(err).slice(0, 160)}` }
|
|
635
|
+
}
|
|
636
|
+
const adoptData = adoptText.data ?? {}
|
|
637
|
+
const adoptStr = String(adoptData.text ?? adoptData.result?.text ?? JSON.stringify(adoptData)).slice(0, 240)
|
|
638
|
+
check('L5.12', '工具回执:模型采纳完成', adoptStr.includes('模型采纳完成'), `status=${adoptText.status} body=${adoptStr}`)
|
|
639
|
+
// 采纳基线 = 最新已发布版本;重绑语义 = 绑定在基线版本的 Agent 升到新版本
|
|
640
|
+
const allBinds = (data(await api('GET', `/api/workshop/optimization/bindings?agentInstanceId=${encodeURIComponent(leadAgentIdOuter)}`, undefined, token))?.bindings ?? []).filter(b => b.profileId === profileId)
|
|
641
|
+
const adoptedCardVersion = Number(String(card?.nodeId ?? '').split('@')[1])
|
|
642
|
+
const rebound = allBinds.find(b => Number(b.profileVersionNumber) === adoptedCardVersion)
|
|
643
|
+
check('L5.13', '存在绑定已自动重绑到采纳版本(revision+1)', Boolean(rebound) && Number(rebound?.revision) >= 1, `versions=[${allBinds.map(b => b.profileVersionNumber).join(',')}] card=v${adoptedCardVersion} reboundRev=${rebound?.revision}`)
|
|
644
|
+
writeFreshTail()
|
|
645
|
+
const solve4 = await api('POST', '/api/workshop/optimization/solve', { agentInstanceId: leadAgentIdOuter, bindingId: rebound?.id }, token)
|
|
646
|
+
check('L5.14', '重绑后 solve optimal(新模型工件生效)', solve4.status === 200 && data(solve4)?.result?.status === 'optimal', `status=${data(solve4)?.result?.status} binding=${rebound?.id}`)
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// ════ L6 数据分析作业 ════
|
|
650
|
+
console.log('\n=== L6 数据分析 ===')
|
|
651
|
+
{
|
|
652
|
+
// 频道绑定产线(产线管理正道:产线配频道);绑线后 Agent 可读面覆盖该线
|
|
653
|
+
const bindLine = channelIdOuter
|
|
654
|
+
? await api('PUT', `/api/workshop/channels/${encodeURIComponent(channelIdOuter)}/line`, { lineId: line.id }, token)
|
|
655
|
+
: { status: 0 }
|
|
656
|
+
check('L6.0', '频道绑定产线(产线配频道)', bindLine.status === 200, `status=${bindLine.status} code=${errCode(bindLine)}`)
|
|
657
|
+
const agentId = leadAgentIdOuter
|
|
658
|
+
const save = agentId
|
|
659
|
+
? await api('POST', '/api/workshop/agent-tools/invoke', {
|
|
660
|
+
agentId,
|
|
661
|
+
tool: 'analysis_save',
|
|
662
|
+
args: {
|
|
663
|
+
title: `本体验收分析-${TAG}`,
|
|
664
|
+
summary: '压力-膜厚负相关确认;本体规则 R-BOUND 界与数据一致',
|
|
665
|
+
conclusions: ['R-BOUND 膜厚窗 [4.5,5.5] 与批次数据一致', '温区未稳期禁止提速与运行实践一致'],
|
|
666
|
+
report: '# 验收分析\n\n本体驱动分析留痕。',
|
|
667
|
+
category: 'quality',
|
|
668
|
+
line_id: line.id,
|
|
669
|
+
recipe_id: recipe.id,
|
|
670
|
+
},
|
|
671
|
+
}, token)
|
|
672
|
+
: { status: 0 }
|
|
673
|
+
const savedOk = save.status === 200 && !save.isError
|
|
674
|
+
check('L6.1', 'analysis_save 经 agent-tools/invoke 落台账', savedOk, `status=${save.status} text=${String(save.text ?? save.message ?? '').slice(0, 120)}`)
|
|
675
|
+
const list = await api('GET', '/api/workshop/analysis', undefined, token)
|
|
676
|
+
check('L6.2', 'GET /analysis 台账读回', list.status === 200 && JSON.stringify(data(list) ?? list).includes(`本体验收分析-${TAG}`), `status=${list.status} body=${JSON.stringify(list).slice(0, 260)}`)
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// ════ L7 前端渲染走查 ════
|
|
680
|
+
console.log('\n=== L7 前端渲染 ===')
|
|
681
|
+
process.env.AW_BASE = BASE
|
|
682
|
+
{
|
|
683
|
+
const { launch, openPage, gotoReady } = await import('./ui/lib.mjs')
|
|
684
|
+
const browser = await launch({ width: 1600, height: 1000 })
|
|
685
|
+
const page = await openPage(browser, { token, width: 1600, height: 1000, deviceScaleFactor: 1 })
|
|
686
|
+
const pageErrors = []
|
|
687
|
+
page.on('pageerror', e => pageErrors.push(String(e.message).slice(0, 200)))
|
|
688
|
+
const shot = name => page.screenshot({ path: join(EVID, `${name}.png`), fullPage: true })
|
|
689
|
+
|
|
690
|
+
try {
|
|
691
|
+
await gotoReady(page, '/ontology', { wait: 3500 })
|
|
692
|
+
const sidebar = await page.evaluate(() => document.body.textContent.includes('本体模型'))
|
|
693
|
+
check('L7.1', '侧边栏含「本体模型」入口', sidebar)
|
|
694
|
+
const tabs = await page.evaluate(() => Array.from(document.querySelectorAll('.tabs .pill-btn')).map(b => (b.textContent || '').trim()))
|
|
695
|
+
check('L7.2', '/ontology 六 tab 渲染', tabs.length === 6, tabs.join('|'))
|
|
696
|
+
await shot('ontology-overview')
|
|
697
|
+
|
|
698
|
+
const tabKeys = ['graph', 'rules', 'bindings', 'versions']
|
|
699
|
+
const tabIndex = { graph: 1, rules: 2, bindings: 3, versions: 4 }
|
|
700
|
+
let renderedOk = true
|
|
701
|
+
const renderDetail = []
|
|
702
|
+
for (const key of tabKeys) {
|
|
703
|
+
await page.evaluate((idx) => {
|
|
704
|
+
const btn = Array.from(document.querySelectorAll('.tabs .pill-btn'))[idx]
|
|
705
|
+
if (btn) btn.click()
|
|
706
|
+
}, tabIndex[key])
|
|
707
|
+
await sleep(1200)
|
|
708
|
+
const info = await page.evaluate(() => ({
|
|
709
|
+
rows: document.querySelectorAll('.ant-table-tbody tr').length,
|
|
710
|
+
empty: document.querySelectorAll('.ant-empty').length,
|
|
711
|
+
}))
|
|
712
|
+
renderDetail.push(`${key}:rows=${info.rows},empty=${info.empty}`)
|
|
713
|
+
if (info.rows === 0 && info.empty === 0) renderedOk = false
|
|
714
|
+
await shot(`ontology-${key}`)
|
|
715
|
+
}
|
|
716
|
+
check('L7.3', '四个内容 tab 表格渲染非空', renderedOk, renderDetail.join(' '))
|
|
717
|
+
|
|
718
|
+
// 编译预览:真实点击工具栏按钮 → 产物面板 + Rule Trace 表
|
|
719
|
+
await page.evaluate(() => {
|
|
720
|
+
const btn = Array.from(document.querySelectorAll('button')).find(b => (b.textContent || '').includes('编译预览'))
|
|
721
|
+
if (btn) btn.click()
|
|
722
|
+
})
|
|
723
|
+
await sleep(3500)
|
|
724
|
+
const compileInfo = await page.evaluate(() => ({
|
|
725
|
+
artifacts: document.querySelectorAll('.artifacts pre').length,
|
|
726
|
+
traceRows: document.querySelectorAll('.ant-table-tbody tr').length,
|
|
727
|
+
}))
|
|
728
|
+
check('L7.3b', 'UI 编译预览:四类产物 + 溯源表渲染', compileInfo.artifacts >= 4 && compileInfo.traceRows >= 3, JSON.stringify(compileInfo))
|
|
729
|
+
await shot('ontology-compile')
|
|
730
|
+
|
|
731
|
+
const headText = await page.evaluate(() => document.querySelector('.aw-page-head')?.textContent ?? '')
|
|
732
|
+
check('L7.4', '页面头/副标题渲染(价值叙事可见)', headText.includes('本体模型'), headText.slice(0, 60))
|
|
733
|
+
|
|
734
|
+
for (const [path, name] of [
|
|
735
|
+
['/dcw', 'dcw', '产线'],
|
|
736
|
+
['/daq', 'daq', '数采'],
|
|
737
|
+
['/aml', 'aml', '建模'],
|
|
738
|
+
['/optimizer', 'optimizer', '优化'],
|
|
739
|
+
['/analysis', 'analysis', '分析'],
|
|
740
|
+
]) {
|
|
741
|
+
const errsBefore = pageErrors.length
|
|
742
|
+
await gotoReady(page, path, { wait: 2500 })
|
|
743
|
+
await sleep(800)
|
|
744
|
+
const bodyLen = await page.evaluate(() => (document.body.textContent ?? '').length)
|
|
745
|
+
const ok = pageErrors.length === errsBefore && bodyLen > 400
|
|
746
|
+
check(`L7.${5 + ['dcw', 'daq', 'aml', 'optimizer', 'analysis'].indexOf(name)}`, `/${name} 可打开无 pageerror`, ok, `len=${bodyLen} newErrors=${pageErrors.slice(errsBefore).slice(0, 1).join(';')}`)
|
|
747
|
+
await shot(`page-${name}`)
|
|
748
|
+
}
|
|
749
|
+
check('L7.10', '全程无未捕获 pageerror', pageErrors.length === 0 || pageErrors.every(e => e.includes('dispose')), pageErrors.slice(0, 2).join(';'))
|
|
750
|
+
}
|
|
751
|
+
finally {
|
|
752
|
+
await browser.close().catch(() => {})
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// ════ 报告 ════
|
|
757
|
+
const pass = results.filter(r => r.pass).length
|
|
758
|
+
const report = {
|
|
759
|
+
script: 'scripts/e2e-ontology-live.mjs',
|
|
760
|
+
generatedAt: new Date().toISOString(),
|
|
761
|
+
base: BASE,
|
|
762
|
+
home: HOME,
|
|
763
|
+
ontology: ONT,
|
|
764
|
+
lineId: line.id,
|
|
765
|
+
total: results.length,
|
|
766
|
+
pass,
|
|
767
|
+
fail: results.length - pass,
|
|
768
|
+
results,
|
|
769
|
+
}
|
|
770
|
+
writeFileSync(join(EVID, 'report.json'), JSON.stringify(report, null, 2))
|
|
771
|
+
console.log(`\nONTOLOGY LIVE E2E: ${pass}/${results.length} passed, ${results.length - pass} failed`)
|
|
772
|
+
console.log(`evidence: ${EVID}`)
|
|
773
|
+
killTree(child.pid)
|
|
774
|
+
process.exit(results.some(r => !r.pass) ? 1 : 0)
|