agentworkshop 0.7.71 → 0.8.1
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 +455 -0
- package/.output/.AgentWorkShop/prompts/host-tools.json +455 -0
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DJJDigim2.js → -FhgRqJl2.js} +1 -1
- package/.output/public/_nuxt/{CGk_VUhO2.js → 0qvcO_KM2.js} +1 -1
- package/.output/public/_nuxt/26OL4Ao82.js +1 -0
- package/.output/public/_nuxt/{sBDZymdy2.js → 2Kwo_j9G2.js} +1 -1
- package/.output/public/_nuxt/{BqYVLAcm.js → 2v5GdspM.js} +1 -1
- package/.output/public/_nuxt/{DkQBMVTs2.js → 8M7wFbEN2.js} +1 -1
- package/.output/public/_nuxt/{DtiY69xi2.js → 8SZLbrI42.js} +1 -1
- package/.output/public/_nuxt/{DF32f5EL2.js → B2NbzUau2.js} +1 -1
- package/.output/public/_nuxt/{CwZW1ZCe2.js → B4JlRHBB2.js} +1 -1
- package/.output/public/_nuxt/{BQOn0q6Y.js → B6C4WofF.js} +1 -1
- package/.output/public/_nuxt/{BC7W6lNm.js → B6UwtJ1a.js} +1 -1
- package/.output/public/_nuxt/{BfQ-ptH0.js → B8HFUsMH.js} +1 -1
- package/.output/public/_nuxt/{DzBbYWrw2.js → BBB_j2LU2.js} +1 -1
- package/.output/public/_nuxt/BCLUwdP52.js +1 -0
- package/.output/public/_nuxt/{CLxmY3Rh.js → BK4wbfGS.js} +1 -1
- package/.output/public/_nuxt/{BRMVDfPl2.js → BKidykmV2.js} +1 -1
- package/.output/public/_nuxt/BPUQZ9Lq2.js +8 -0
- package/.output/public/_nuxt/BRYBzVMJ.js +1 -0
- package/.output/public/_nuxt/{Bj5sjA5O.js → BRci9D_l.js} +1 -1
- package/.output/public/_nuxt/{Dmgqz2np2.js → BVGzwAxr2.js} +1 -1
- package/.output/public/_nuxt/BVg2R2VB2.js +1 -0
- package/.output/public/_nuxt/{C3aUN4Vp2.js → BW2uTUx52.js} +1 -1
- package/.output/public/_nuxt/{B5FKaMM02.js → BY3Lbz3h2.js} +1 -1
- package/.output/public/_nuxt/{DIwmMa_7.js → BYzim_Bn.js} +1 -1
- package/.output/public/_nuxt/{D8xUsQGt.js → B_Obcbiu.js} +1 -1
- package/.output/public/_nuxt/BaYDgyaR.js +3 -0
- package/.output/public/_nuxt/{DZJ11BTI.js → BbACaREb.js} +1 -1
- package/.output/public/_nuxt/{BJrj5JVe2.js → BcosvNXb2.js} +1 -1
- package/.output/public/_nuxt/{B_-vAvzb.js → BfeXib9G.js} +1 -1
- package/.output/public/_nuxt/{CeLqojCJ.js → BfgTar9L.js} +1 -1
- package/.output/public/_nuxt/BfvuWqSa.js +1 -0
- package/.output/public/_nuxt/{D8r8PNQa2.js → BiZWwdcD2.js} +1 -1
- package/.output/public/_nuxt/BkEokGX5.js +1 -0
- package/.output/public/_nuxt/{CJSohaqk2.js → BklGqEto2.js} +2 -2
- package/.output/public/_nuxt/{DkpmSnHX.js → Bko5adbu.js} +1 -1
- package/.output/public/_nuxt/{DTQTGA6v2.js → BmBlIIJo2.js} +1 -1
- package/.output/public/_nuxt/{D_NjL-Hz.js → Bmvt9ydE.js} +1 -1
- package/.output/public/_nuxt/{Cp4r6Eiz.js → BoyuIoSm.js} +1 -1
- package/.output/public/_nuxt/{62J4vljm2.js → Bq-tmkst.js} +1 -1
- package/.output/public/_nuxt/{BMMoqi94.js → BqFaZ4kS.js} +1 -1
- package/.output/public/_nuxt/BsJYieAL2.js +1 -0
- package/.output/public/_nuxt/{DD4J2Otc.js → BtZKe9ZV.js} +1 -1
- package/.output/public/_nuxt/{BnpY_zNx.js → BtumQhZK.js} +1 -1
- package/.output/public/_nuxt/{BjLzqWJH2.js → BwWs9EdO2.js} +1 -1
- package/.output/public/_nuxt/{Bx2a9cuY2.js → BxxpJxZf2.js} +1 -1
- package/.output/public/_nuxt/{qRXa-PM22.js → ByTnUqFw2.js} +1 -1
- package/.output/public/_nuxt/{DvOETuoT2.js → Byiiiwc72.js} +1 -1
- package/.output/public/_nuxt/{Car2lkbb.js → C1-SuwUN.js} +1 -1
- package/.output/public/_nuxt/{Dg81dOEO.js → C14pM5G4.js} +1 -1
- package/.output/public/_nuxt/{MDhaRQq_.js → C2Yp-B8m.js} +1 -1
- package/.output/public/_nuxt/{BJ2nJNlK2.js → C4e6_nom2.js} +1 -1
- package/.output/public/_nuxt/{CiCEprsp2.js → C5OStZJ62.js} +1 -1
- package/.output/public/_nuxt/{ByMj6e7s.js → C6lssmvl.js} +2 -2
- package/.output/public/_nuxt/{C6uBP0Xa.js → CC-GEjfN.js} +1 -1
- package/.output/public/_nuxt/CC2Pv8VL2.js +1 -0
- package/.output/public/_nuxt/{DKiqdYnj.js → CCcMgxV9.js} +1 -1
- package/.output/public/_nuxt/{5S26I34j2.js → CDL30A2z2.js} +1 -1
- package/.output/public/_nuxt/{B8C-QJB5.js → CDYLasP8.js} +1 -1
- package/.output/public/_nuxt/CElzwyXQ.js +1 -0
- package/.output/public/_nuxt/{2KE8xGVm.js → CEvJu-xI.js} +1 -1
- package/.output/public/_nuxt/{CR612R752.js → CFQRFctQ2.js} +1 -1
- package/.output/public/_nuxt/{DnzjxC0u.js → CHk9XxNi.js} +2 -2
- package/.output/public/_nuxt/{Bx4MR0jd.js → CLFmtXU7.js} +1 -1
- package/.output/public/_nuxt/{DW8k_0dQ.js → CMJi6yYS.js} +1 -1
- package/.output/public/_nuxt/{DD-r0S1p.js → CPvFGbr8.js} +1 -1
- package/.output/public/_nuxt/{CCgbgkid.js → CQSxS_Ek.js} +2 -2
- package/.output/public/_nuxt/{jGxHnjW6.js → CQuo31jF.js} +1 -1
- package/.output/public/_nuxt/{SoO2K-di.js → CRCrWy-6.js} +1 -1
- package/.output/public/_nuxt/CUCFFL9m.js +84 -0
- package/.output/public/_nuxt/CZYNy60j2.js +1 -0
- package/.output/public/_nuxt/{WPwdj9pg.js → CZsFf7ck.js} +1 -1
- package/.output/public/_nuxt/CfFUK6932.js +2 -0
- package/.output/public/_nuxt/{DAsjfdZD.js → CfIbFnJz.js} +1 -1
- package/.output/public/_nuxt/{Tk6TQZjU.js → CjF4QY9h.js} +1 -1
- package/.output/public/_nuxt/{DlUQa0wn.js → Cjo1t2IF.js} +1 -1
- package/.output/public/_nuxt/{CDn0eDn8.js → CmuGMxDP.js} +1 -1
- package/.output/public/_nuxt/Cn6EojFe.js +1 -0
- package/.output/public/_nuxt/{DLqSQbGv.js → CnYazk8d.js} +1 -1
- package/.output/public/_nuxt/{DQfy6R_2.js → CnrGVJIr.js} +1 -1
- package/.output/public/_nuxt/{C0YL0HKK.js → CtcBhkci.js} +1 -1
- package/.output/public/_nuxt/{h5gsh8E92.js → Cv-Mv7_h2.js} +1 -1
- package/.output/public/_nuxt/{vPcnBJsa2.js → CzlZrfq82.js} +1 -1
- package/.output/public/_nuxt/{C2YYOgMe.js → CznnUTZx.js} +2 -2
- package/.output/public/_nuxt/{csitHKnE2.js → D-80EfyA2.js} +1 -1
- package/.output/public/_nuxt/{BRdoISnJ2.js → D1C6qtS12.js} +1 -1
- package/.output/public/_nuxt/{Cnrmlixo.js → D1MkndMZ.js} +2 -2
- package/.output/public/_nuxt/{BLwDhlaa.js → D37gODe0.js} +1 -1
- package/.output/public/_nuxt/{NXY37IO62.js → D6FhDrYe2.js} +1 -1
- package/.output/public/_nuxt/{Btx8wL4-.js → D7TZLu4F.js} +1 -1
- package/.output/public/_nuxt/{qoUdVDnC.js → D7tEwf-o.js} +3 -3
- package/.output/public/_nuxt/D8HQPtm62.js +1 -0
- package/.output/public/_nuxt/D9O4L4jK.js +1 -0
- package/.output/public/_nuxt/{aQ1B7BZa2.js → D9lL3fJM2.js} +2 -2
- package/.output/public/_nuxt/{CT-vTjcG2.js → DC-2eKo62.js} +1 -1
- package/.output/public/_nuxt/DF9ETYJ32.js +1 -0
- package/.output/public/_nuxt/DGGBrc0q2.js +1 -0
- package/.output/public/_nuxt/DGu_fna7.js +1 -0
- package/.output/public/_nuxt/{BupBjt6B.js → DKOvbitt.js} +1 -1
- package/.output/public/_nuxt/{B1PzYsqN.js → DNxudyND.js} +1 -1
- package/.output/public/_nuxt/{BfX6_AjY.js → DOT-XQyi.js} +1 -1
- package/.output/public/_nuxt/{BsTZnkVK.js → DPPC9Teq.js} +1 -1
- package/.output/public/_nuxt/{HxohXQ_r.js → DRskyE7l.js} +1 -1
- package/.output/public/_nuxt/{B-U7E_Mc2.js → DW4ZgInh2.js} +1 -1
- package/.output/public/_nuxt/{BErG4kzc2.js → DWe6BMlp2.js} +1 -1
- package/.output/public/_nuxt/DWy0AjON.js +1 -0
- package/.output/public/_nuxt/{Bc_k6AVA.js → DXgw1dVL.js} +4 -4
- package/.output/public/_nuxt/{C3sWJ8SD2.js → DZsKIzKD2.js} +1 -1
- package/.output/public/_nuxt/D_59BNP1.js +14 -0
- package/.output/public/_nuxt/{BQIO4MkA2.js → D_FZ3KZI2.js} +1 -1
- package/.output/public/_nuxt/{n_Njdwii2.js → D__vJGHF2.js} +1 -1
- package/.output/public/_nuxt/{C9gErLQc2.js → DaizNGUm2.js} +1 -1
- package/.output/public/_nuxt/{C-MY-JQE2.js → DdyE0ylS.js} +1 -1
- package/.output/public/_nuxt/DgrK8UCQ.js +0 -0
- package/.output/public/_nuxt/DhLlTxQh2.js +1 -0
- package/.output/public/_nuxt/DhW7cFOa.js +1 -0
- package/.output/public/_nuxt/{Rt2i6k7C2.js → DhjgWrB62.js} +1 -1
- package/.output/public/_nuxt/{KwT4sN_d.js → DiWcX4gj.js} +1 -1
- package/.output/public/_nuxt/DiloA8vK.js +1 -0
- package/.output/public/_nuxt/{DX-c5laM2.js → DlS-SkQ42.js} +1 -1
- package/.output/public/_nuxt/{D_Zspo1y.js → DmHp9yQ3.js} +1 -1
- package/.output/public/_nuxt/{dq1HKoGD.js → DoL9u6wu.js} +1 -1
- package/.output/public/_nuxt/{CIvMT5Ic.js → DqxBCeDe.js} +1 -1
- package/.output/public/_nuxt/{BnNmkGJS2.js → DrlnrdvY2.js} +3 -3
- package/.output/public/_nuxt/{BAcjVcku2.js → Dt8TL8_X2.js} +1 -1
- package/.output/public/_nuxt/{BtfwbNC0.js → Du7gS8RU.js} +1 -1
- package/.output/public/_nuxt/DuUc4bbY2.js +1 -0
- package/.output/public/_nuxt/{DPUXbTg9.js → DudoisLM.js} +1 -1
- package/.output/public/_nuxt/{Ce5R-ZGf2.js → DwgVlehj2.js} +1 -1
- package/.output/public/_nuxt/Dyxf2xZw.js +1 -0
- package/.output/public/_nuxt/Dz9C2pTa.js +1 -0
- package/.output/public/_nuxt/{BYxG9Hb2.js → EMbqTHfT.js} +1 -1
- package/.output/public/_nuxt/{B1SzppY12.js → FsRVXpyF2.js} +1 -1
- package/.output/public/_nuxt/{0MLy6ogg2.js → GQrEW8nk2.js} +1 -1
- package/.output/public/_nuxt/{Tuz5LcLM.js → IXR1BWP5.js} +1 -1
- package/.output/public/_nuxt/{-jpUnM1I2.js → Iub61dX92.js} +1 -1
- package/.output/public/_nuxt/{CQgOzpvI.js → JegDslce.js} +2 -2
- package/.output/public/_nuxt/{DrF3TWoj.js → KzK37yIr.js} +1 -1
- package/.output/public/_nuxt/{Br3MggOL.js → N-CCmCsX.js} +1 -1
- package/.output/public/_nuxt/{DHhmq7s_.js → NfvZ5Lzv.js} +1 -1
- package/.output/public/_nuxt/{CzX_kaPL.js → POTcePF_.js} +1 -1
- package/.output/public/_nuxt/{D7s96J3r2.js → Q-JpBT032.js} +1 -1
- package/.output/public/_nuxt/{DzwIZ81f2.js → R1g64DNi2.js} +1 -1
- package/.output/public/_nuxt/{JgheoP3e.js → R5Pz7BqB.js} +1 -1
- package/.output/public/_nuxt/{yLyz0-Yz.js → SvjzWbn8.js} +1 -1
- package/.output/public/_nuxt/{Dd7MZc_Q.js → XqXoaoDs.js} +1 -1
- package/.output/public/_nuxt/{B6jtLy6z.js → YAA98rWJ.js} +11 -11
- package/.output/public/_nuxt/{HX4_xnak2.js → YLYSczSq2.js} +1 -1
- package/.output/public/_nuxt/{BBw9ylUY2.js → YNhAoK-R2.js} +1 -1
- package/.output/public/_nuxt/Zkbt8Uk5.js +1 -0
- package/.output/public/_nuxt/aml.PalMp-5n.css +1 -0
- package/.output/public/_nuxt/{C41CcsiD.js → b7UcqLKi.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/fa0af8b5-3929-428d-a6de-3b5cc6b8248f.json +1 -0
- package/.output/public/_nuxt/{DVkFSOZi.js → cKj4vSo5.js} +1 -1
- package/.output/public/_nuxt/{r1CpGsFp.js → dHwWyr6b.js} +1 -1
- package/.output/public/_nuxt/{default.BzOcvmSE.css → default.BEXGWZFQ.css} +1 -1
- package/.output/public/_nuxt/{DlcA9Gxl.js → eePbiWEh.js} +1 -1
- package/.output/public/_nuxt/{entry.CL2i0F8o.css → entry.C7koBPom.css} +1 -1
- package/.output/public/_nuxt/{cjRzSvAg2.js → eymRov9Y2.js} +1 -1
- package/.output/public/_nuxt/{B8cViLJT.js → geMze5qw.js} +1 -1
- package/.output/public/_nuxt/{uu1wfdfR2.js → gh-WMxV_2.js} +1 -1
- package/.output/public/_nuxt/{Ce6e1mPk2.js → hCN555XP2.js} +1 -1
- package/.output/public/_nuxt/{rdUE8Khf.js → hZG5MLjK.js} +3 -3
- package/.output/public/_nuxt/{CcX_jP-d.js → hlfahYxK.js} +1 -1
- package/.output/public/_nuxt/{cGSl2GZp2.js → ilJHF1nA2.js} +1 -1
- package/.output/public/_nuxt/{D6ZcgHPz.js → jDuiDtGb.js} +1 -1
- package/.output/public/_nuxt/{DbeNMehP.js → k9b520K-.js} +1 -1
- package/.output/public/_nuxt/ontology.B_3Wn907.css +1 -0
- package/.output/public/_nuxt/optimizer.CLA8I1sy.css +1 -0
- package/.output/public/_nuxt/{DSORcpTJ.js → rDvMijKA.js} +2 -2
- package/.output/public/_nuxt/{CAiHhX8P2.js → rF7mggl72.js} +2 -2
- package/.output/public/_nuxt/ri9UF8rk.js +2 -0
- package/.output/public/_nuxt/{KgnxOsMr.js → toG_qAMH.js} +1 -1
- package/.output/public/_nuxt/{KQZmHR_K.js → u3h4pGpm.js} +2 -2
- package/.output/public/_nuxt/{dJ7gK7C2.js → uomnHjhM.js} +1 -1
- package/.output/public/_nuxt/{BUTg4W_x2.js → v77qozuJ2.js} +1 -1
- package/.output/public/_nuxt/{BcEr7tIB.js → v7cV7hJa.js} +1 -1
- package/.output/public/_nuxt/{D25dVZ822.js → vkQoYNQR2.js} +2 -2
- package/.output/public/_nuxt/{wR_w07322.js → vp3LtnTz2.js} +1 -1
- package/.output/public/_nuxt/{Bnc8HELj2.js → we7-sMSo2.js} +1 -1
- package/.output/public/_nuxt/{kN3ZzR1-.js → wxISMS1i.js} +1 -1
- package/.output/public/_nuxt/{DGrrucbG2.js → zy7efYKR.js} +1 -1
- 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 +7291 -3540
- 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/{_wsId_-BNKrrV1H.mjs → _wsId_-BPy-Aj9L.mjs} +3 -3
- package/.output/server/chunks/build/{_wsId_-BNKrrV1H.mjs.map → _wsId_-BPy-Aj9L.mjs.map} +1 -1
- package/.output/server/chunks/build/{agents-8tV9xL97.mjs → agents-CpNLdI8E.mjs} +6 -6
- package/.output/server/chunks/build/{agents-8tV9xL97.mjs.map → agents-CpNLdI8E.mjs.map} +1 -1
- package/.output/server/chunks/build/{aml-BNTEDOsl.mjs → aml-DRAFRcGU.mjs} +15 -12
- package/.output/server/chunks/build/{aml-BNTEDOsl.mjs.map → aml-DRAFRcGU.mjs.map} +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/{channel-templates-Iot9Y3vV.mjs → channel-templates-ByHOQQkO.mjs} +2 -2
- package/.output/server/chunks/build/{channel-templates-Iot9Y3vV.mjs.map → channel-templates-ByHOQQkO.mjs.map} +1 -1
- 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-CNWS6NUw.mjs} +17 -11
- package/.output/server/chunks/build/{default-BeB88U7y.mjs.map → default-CNWS6NUw.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-CjwsxU39.mjs → dropdown-BNwTVGde.mjs} +2 -2
- package/.output/server/chunks/build/{dropdown-CjwsxU39.mjs.map → dropdown-BNwTVGde.mjs.map} +1 -1
- package/.output/server/chunks/build/{dropdown-C6YH_kSO.mjs → dropdown-Cd-xPhR6.mjs} +2 -2
- package/.output/server/chunks/build/{dropdown-C6YH_kSO.mjs.map → dropdown-Cd-xPhR6.mjs.map} +1 -1
- package/.output/server/chunks/build/input-number-BNlNDK7H.mjs +1 -1
- package/.output/server/chunks/build/{logs-BTfJQ6vQ.mjs → logs-pRb-TMWa.mjs} +3 -3
- package/.output/server/chunks/build/{logs-BTfJQ6vQ.mjs.map → logs-pRb-TMWa.mjs.map} +1 -1
- package/.output/server/chunks/build/{monitor-DvaR3yo8.mjs → monitor-Cq6hRFeQ.mjs} +6 -6
- package/.output/server/chunks/build/{monitor-DvaR3yo8.mjs.map → monitor-Cq6hRFeQ.mjs.map} +1 -1
- package/.output/server/chunks/build/ontology-DK0Mf0zT.mjs +1406 -0
- package/.output/server/chunks/build/ontology-DK0Mf0zT.mjs.map +1 -0
- package/.output/server/chunks/build/{operations-Cl8nVm9D.mjs → operations-SMQrRAcr.mjs} +3 -3
- package/.output/server/chunks/build/{operations-Cl8nVm9D.mjs.map → operations-SMQrRAcr.mjs.map} +1 -1
- package/.output/server/chunks/build/optimizer-BlWTsM-W.mjs +202 -0
- package/.output/server/chunks/build/optimizer-BlWTsM-W.mjs.map +1 -0
- package/.output/server/chunks/build/{pagination-KaIvHBzi.mjs → pagination-DTAconUo.mjs} +2 -2
- package/.output/server/chunks/build/{pagination-KaIvHBzi.mjs.map → pagination-DTAconUo.mjs.map} +1 -1
- package/.output/server/chunks/build/{permissions-CVTfixZj.mjs → permissions-DgXQZSyx.mjs} +6 -6
- package/.output/server/chunks/build/{permissions-CVTfixZj.mjs.map → permissions-DgXQZSyx.mjs.map} +1 -1
- package/.output/server/chunks/build/{schedules-BLhn2CLn.mjs → schedules-dSnr8url.mjs} +6 -6
- package/.output/server/chunks/build/{schedules-BLhn2CLn.mjs.map → schedules-dSnr8url.mjs.map} +1 -1
- package/.output/server/chunks/build/{select--XFl7CtY.mjs → select-B3Dsb9yq.mjs} +3 -3
- package/.output/server/chunks/build/{select--XFl7CtY.mjs.map → select-B3Dsb9yq.mjs.map} +1 -1
- package/.output/server/chunks/build/{settings-DIf_iYdu.mjs → settings-BrIhnS2Z.mjs} +2 -2
- package/.output/server/chunks/build/{settings-DIf_iYdu.mjs.map → settings-BrIhnS2Z.mjs.map} +1 -1
- package/.output/server/chunks/build/{table-DIu_YCJN.mjs → table-CmVD-cA9.mjs} +4 -4
- package/.output/server/chunks/build/{table-DIu_YCJN.mjs.map → table-CmVD-cA9.mjs.map} +1 -1
- package/.output/server/chunks/build/{teams-B2J6ouRY.mjs → teams-B1d32eHK.mjs} +4 -4
- package/.output/server/chunks/build/{teams-B2J6ouRY.mjs.map → teams-B1d32eHK.mjs.map} +1 -1
- package/.output/server/chunks/build/{tokens-DFQGaN2n.mjs → tokens-GYaGJ35Z.mjs} +6 -6
- package/.output/server/chunks/build/{tokens-DFQGaN2n.mjs.map → tokens-GYaGJ35Z.mjs.map} +1 -1
- package/.output/server/chunks/build/{tools-DWJFnU_t.mjs → tools-s_9U1Djj.mjs} +6 -6
- package/.output/server/chunks/build/{tools-DWJFnU_t.mjs.map → tools-s_9U1Djj.mjs.map} +1 -1
- 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/build/{users-BWw0VCr9.mjs → users-DjiVC_tS.mjs} +6 -6
- package/.output/server/chunks/build/{users-BWw0VCr9.mjs.map → users-DjiVC_tS.mjs.map} +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 +8 -2
- package/.output/server/chunks/routes/api/workshop/aml/models/_id_.patch.mjs.map +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/autofix.mjs +52 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/autofix.mjs.map +1 -0
- 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/subgraph.mjs +38 -0
- package/.output/server/chunks/routes/api/workshop/ontology/drafts/_draftId/subgraph.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 +43 -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 +323 -18
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README-zh.md +28 -6
- package/README.md +26 -4
- package/app/components/AppSidebar.vue +1 -0
- package/app/components/aml/AmlModelsTable.vue +5 -0
- package/app/components/ontology/OntologyGraph.vue +356 -0
- package/app/pages/aml/styles.css +1 -0
- package/app/pages/ontology/api.ts +18 -0
- package/app/pages/ontology/index.vue +1062 -0
- package/app/pages/ontology/types.ts +164 -0
- package/app/pages/optimizer/index.vue +21 -4
- 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 +84 -0
- package/i18n/locales/zh-CN.ts +84 -0
- package/mcp/aw-mcp-server.mjs +53 -1
- package/package.json +1 -1
- package/scripts/docs-shots.mjs +36 -0
- package/scripts/e2e-direct-rest-simulator-paper.mjs +624 -0
- package/scripts/e2e-idd-results.mjs +177 -0
- package/scripts/e2e-model-loop-live.mjs +785 -0
- package/scripts/e2e-ontology-live.mjs +909 -0
- package/scripts/e2e-ontology.mjs +393 -0
- package/scripts/e2e-pi-simulator-paper.mjs +2316 -0
- package/scripts/e2e-registered-harness-simulator-paper.mjs +1926 -0
- package/scripts/e2e-simulator-optimizer-paper.mjs +264 -0
- package/scripts/fixtures/omp-paper-harness.mjs +163 -0
- package/scripts/ontology-idd-rag-e2e.mjs +449 -0
- package/sdk/context.mjs +6 -0
- package/sdk/index.d.mts +2 -0
- package/server/api/workshop/agent-tools/approvals/[id]/decide.post.ts +16 -0
- package/server/api/workshop/aml/models/[id].patch.ts +36 -30
- package/server/api/workshop/ontology/drafts/[draftId]/autofix.ts +31 -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]/subgraph.ts +24 -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 +34 -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/plugins-builtin/diag-bridge/client.mjs +390 -239
- package/server/plugins-builtin/diag-bridge/host/helpers.mjs +80 -0
- package/server/plugins-builtin/diag-bridge/host/plugin.mjs +264 -2
- package/server/plugins-builtin/diag-bridge/i18n.json +84 -4
- package/server/services/workshop/agents/adapters/omp-rpc-client/frames.ts +129 -111
- package/server/services/workshop/agents/hitl-decision/dispatcher.ts +15 -0
- package/server/services/workshop/agents/host-tool-bridge/tools/industrial.ts +17 -2
- package/server/services/workshop/agents/industrial/aml-job-tools.ts +602 -569
- package/server/services/workshop/agents/industrial/grant-guard.ts +73 -0
- package/server/services/workshop/agents/industrial/index.ts +38 -32
- package/server/services/workshop/agents/industrial/ontology-tools.ts +380 -0
- package/server/services/workshop/agents/industrial/ops-tools.ts +54 -16
- package/server/services/workshop/agents/industrial/optimizer-tools.ts +81 -0
- package/server/services/workshop/agents/industrial/recipe-gate.ts +19 -6
- package/server/services/workshop/agents/industrial/recipe-propose-tools.ts +1 -1
- package/server/services/workshop/agents/industrial/tool-verify.ts +32 -2
- package/server/services/workshop/agents/omp-agent/supervision-history.ts +38 -0
- package/server/services/workshop/agents/omp-agent/tools-steer.ts +18 -1
- package/server/services/workshop/agents/tool-reference-spec.ts +1 -1
- package/server/services/workshop/aml/aml.repo.ts +16 -0
- package/server/services/workshop/aml/twin/physics-spec.ts +6 -22
- package/server/services/workshop/daq/bus/index.ts +12 -5
- 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 +97 -95
- package/server/services/workshop/db/database/schema.ts +156 -1
- package/server/services/workshop/ontology/autofix.ts +198 -0
- package/server/services/workshop/ontology/compiler.ts +474 -0
- package/server/services/workshop/ontology/contracts.ts +443 -0
- package/server/services/workshop/ontology/guards.ts +139 -0
- package/server/services/workshop/ontology/index.ts +12 -0
- package/server/services/workshop/ontology/ontology.service.ts +938 -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/subgraph.core.ts +300 -0
- package/server/services/workshop/ontology/subgraph.service.ts +113 -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 +16 -0
- package/server/services/workshop/optimization/dispatch.service.ts +16 -0
- package/server/services/workshop/optimization/profile-adopt.service.ts +261 -0
- package/server/services/workshop/optimization/profile.repo.ts +24 -6
- package/server/services/workshop/optimization/python/__pycache__/problems.cpython-312.pyc +0 -0
- package/shared/dimensions.ts +124 -0
- package/.output/public/_nuxt/B3Y5bCrM.js +0 -1
- package/.output/public/_nuxt/B7s2qeyT.js +0 -14
- package/.output/public/_nuxt/B8N8nsad2.js +0 -2
- package/.output/public/_nuxt/BO0BJx3w.js +0 -8
- package/.output/public/_nuxt/BWn-lfCp2.js +0 -1
- package/.output/public/_nuxt/Bcs9zzO62.js +0 -1
- package/.output/public/_nuxt/BwO2Y5FH2.js +0 -1
- package/.output/public/_nuxt/C-LU6xv_.js +0 -1
- package/.output/public/_nuxt/CJ0bjZ6v2.js +0 -1
- package/.output/public/_nuxt/CJ3Vul2u.js +0 -1
- package/.output/public/_nuxt/CNwx04ln.js +0 -84
- package/.output/public/_nuxt/CVCscYzb2.js +0 -1
- package/.output/public/_nuxt/C_A0MCol2.js +0 -1
- package/.output/public/_nuxt/CnP6snIz.js +0 -3
- package/.output/public/_nuxt/D3buuIkE.js +0 -1
- package/.output/public/_nuxt/D4_INWgq.js +0 -1
- package/.output/public/_nuxt/D5kCimyw.js +0 -1
- package/.output/public/_nuxt/DBtXLkyA.js +0 -1
- package/.output/public/_nuxt/DHURbGkn2.js +0 -1
- package/.output/public/_nuxt/DaBzS-iu.js +0 -1
- package/.output/public/_nuxt/DnlhV7Xe.js +0 -1
- package/.output/public/_nuxt/GtI6PUI32.js +0 -1
- package/.output/public/_nuxt/LHIav-Kv.js +0 -1
- package/.output/public/_nuxt/Nw_6OpQZ.js +0 -1
- package/.output/public/_nuxt/RuMLNeQE.js +0 -1
- package/.output/public/_nuxt/Y4sMSPrS.js +0 -1
- package/.output/public/_nuxt/aml.CeLxRzvI.css +0 -1
- package/.output/public/_nuxt/builds/meta/0ae8cb0f-6ce5-4096-9692-9b1fc197b30d.json +0 -1
- package/.output/public/_nuxt/goF_oZHF.js +0 -2
- package/.output/public/_nuxt/optimizer.B8gCbU1b.css +0 -1
- package/.output/public/_nuxt/rJ7To74v2.js +0 -1
- package/.output/server/chunks/build/optimizer-BOtGWEtc.mjs +0 -200
- package/.output/server/chunks/build/optimizer-BOtGWEtc.mjs.map +0 -1
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ontology Service —— 草稿生命周期 / 校验 / 编译预览 / 规则审批 / 版本发布。
|
|
3
|
+
*
|
|
4
|
+
* 治理不变量(验收逐条断言):
|
|
5
|
+
* 1) 自审禁止:审查人 ≠ 草稿发起人(单管理员实例豁免并打 solo_operator 标记);
|
|
6
|
+
* 2) 硬约束/阻断级守卫只接受 approved_for_control(第二人批准);
|
|
7
|
+
* 3) 发布 = 不可变快照(同版本改内容 → 409);运行中本体更新不改在跑版本;
|
|
8
|
+
* 4) 草稿编辑乐观锁(rev),并发写 → 409 而非静默覆盖;
|
|
9
|
+
* 5) 每次状态迁移/发布/审批都落 ontology_publish_log(actuator 三态 + 归因)。
|
|
10
|
+
*/
|
|
11
|
+
import { DatabaseSync } from 'node:sqlite'
|
|
12
|
+
import { join } from 'node:path'
|
|
13
|
+
import { AppError } from '../../../utils/errors'
|
|
14
|
+
import { ensureDataDir } from '@/shared/config/home.mjs'
|
|
15
|
+
import type {
|
|
16
|
+
BindingDraft,
|
|
17
|
+
CompileOptions,
|
|
18
|
+
ControlGuard,
|
|
19
|
+
EvidenceRecord,
|
|
20
|
+
OntologyCompileResult,
|
|
21
|
+
OntologyDraftDoc,
|
|
22
|
+
OntologyRole,
|
|
23
|
+
OntologyState,
|
|
24
|
+
OntologyTarget,
|
|
25
|
+
} from './contracts'
|
|
26
|
+
import {
|
|
27
|
+
ONTOLOGY_SCHEMA_VERSION,
|
|
28
|
+
RULE_ERROR_CODES,
|
|
29
|
+
RULE_TRANSITIONS,
|
|
30
|
+
draftContentHash,
|
|
31
|
+
emptyDraftDoc,
|
|
32
|
+
parseDraftDoc,
|
|
33
|
+
} from './contracts'
|
|
34
|
+
import { dimensionOf } from '@/shared/dimensions'
|
|
35
|
+
import { compileOntology, ontologyPackHash } from './compiler'
|
|
36
|
+
import { evaluateGuards, extractGuardSet, type GuardEvaluationInput, type GuardEvaluationResult } from './guards'
|
|
37
|
+
import {
|
|
38
|
+
getOntologyRepo,
|
|
39
|
+
parseDraftRow,
|
|
40
|
+
type DraftRow,
|
|
41
|
+
type EvidenceRow,
|
|
42
|
+
type VersionRow,
|
|
43
|
+
} from './repo'
|
|
44
|
+
import { detectBindingDrift, validateDraftBindings } from './semantic-binding.service'
|
|
45
|
+
import { getDcwController } from '../dcw/dcw-controller'
|
|
46
|
+
import { autoFixDraftDoc, type OntologyAutoFix } from './autofix'
|
|
47
|
+
import { validateDraftDoc, type DraftValidationReport } from './validator'
|
|
48
|
+
|
|
49
|
+
export interface Actor {
|
|
50
|
+
userId: string
|
|
51
|
+
role: 'admin' | 'editor' | 'user'
|
|
52
|
+
/** agent 发起时携带其 channel 属主(归因与撤权收敛) */
|
|
53
|
+
actorKind?: 'user' | 'agent' | 'system'
|
|
54
|
+
initiatorUserId?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** REST 调用者 → 治理 Actor(角色收敛到三档,未知角色按 user) */
|
|
58
|
+
export function actorFromUser(user: { id: string, role: string }): Actor {
|
|
59
|
+
const role: Actor['role'] = user.role === 'admin' || user.role === 'editor' ? user.role : 'user'
|
|
60
|
+
return { userId: user.id, role, actorKind: 'user' }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const EDITOR_ROLES = new Set(['admin', 'editor'])
|
|
64
|
+
|
|
65
|
+
function newId(prefix: string): string {
|
|
66
|
+
return `${prefix}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function requireEditor(actor: Actor, what: string): void {
|
|
70
|
+
if (!EDITOR_ROLES.has(actor.role)) {
|
|
71
|
+
throw new AppError(403, 'FORBIDDEN_ROLE', `${what} 需要 admin 或 editor 角色`)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function requireAdmin(actor: Actor, what: string): void {
|
|
76
|
+
if (actor.role !== 'admin') throw new AppError(403, 'ADMIN_REQUIRED', `${what} 仅管理员可执行`)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 单管理员部署豁免自审(打 solo_operator 标记,审计可追溯)。
|
|
81
|
+
*
|
|
82
|
+
* 用户与角色在独立的 users.sqlite(user.repository),不在 workshop 主库。
|
|
83
|
+
* env `AW_ONTOLOGY_SOLO_OPERATOR=1|0` 可显式覆盖(部署/测试用);否则按管理员人数判断。
|
|
84
|
+
*/
|
|
85
|
+
function isSoloOperator(): boolean {
|
|
86
|
+
const override = process.env.AW_ONTOLOGY_SOLO_OPERATOR
|
|
87
|
+
if (override === '1') return true
|
|
88
|
+
if (override === '0') return false
|
|
89
|
+
try {
|
|
90
|
+
// 用户/角色在独立的 users.sqlite(不在 workshop 主库);只读短连接统计管理员人数
|
|
91
|
+
const db = new DatabaseSync(join(ensureDataDir(), 'users.sqlite'), { readOnly: true })
|
|
92
|
+
try {
|
|
93
|
+
const row = db.prepare('SELECT COUNT(*) AS n FROM users WHERE role = \'admin\' AND status = \'active\'').get() as { n: number } | undefined
|
|
94
|
+
return (row?.n ?? 0) <= 1
|
|
95
|
+
}
|
|
96
|
+
finally { db.close() }
|
|
97
|
+
}
|
|
98
|
+
catch { return true }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function log(input: {
|
|
102
|
+
ontologyId: string
|
|
103
|
+
version?: number
|
|
104
|
+
action: string
|
|
105
|
+
actor: Actor
|
|
106
|
+
soloOperator?: boolean
|
|
107
|
+
approvalId?: string | null
|
|
108
|
+
detail?: Record<string, unknown>
|
|
109
|
+
}): void {
|
|
110
|
+
getOntologyRepo().appendPublishLog({
|
|
111
|
+
id: newId('opl'),
|
|
112
|
+
ontologyId: input.ontologyId,
|
|
113
|
+
version: input.version ?? 0,
|
|
114
|
+
action: input.action,
|
|
115
|
+
actor: input.actor.userId,
|
|
116
|
+
actorKind: input.actor.actorKind ?? 'user',
|
|
117
|
+
soloOperator: input.soloOperator ? 1 : 0,
|
|
118
|
+
approvalId: input.approvalId ?? null,
|
|
119
|
+
detailJson: JSON.stringify({ ...input.detail, initiatorUserId: input.actor.initiatorUserId ?? '' }),
|
|
120
|
+
createdAt: new Date().toISOString(),
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ===== 草稿 =====
|
|
125
|
+
|
|
126
|
+
export interface CreateDraftInput {
|
|
127
|
+
ontologyId: string
|
|
128
|
+
/** 草稿属主(缺省=调用者;admin 可代建) */
|
|
129
|
+
ownerId?: string
|
|
130
|
+
baseVersion?: number
|
|
131
|
+
/** 从已发布版本克隆(基于上一版继续演进) */
|
|
132
|
+
cloneFromVersion?: boolean
|
|
133
|
+
lineId?: string
|
|
134
|
+
name?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function createDraft(actor: Actor, input: CreateDraftInput): DraftRow {
|
|
138
|
+
requireEditor(actor, '创建本体草稿')
|
|
139
|
+
const ontologyId = input.ontologyId.trim()
|
|
140
|
+
if (!/^[a-z][a-z0-9_-]{1,79}$/.test(ontologyId)) {
|
|
141
|
+
throw new AppError(422, 'ONTOLOGY_INVALID', 'ontologyId 必须形如 ont-pva-line01(小写字母开头,允许数字/下划线/连字符)')
|
|
142
|
+
}
|
|
143
|
+
const ownerId = input.ownerId || actor.userId
|
|
144
|
+
const repo = getOntologyRepo()
|
|
145
|
+
const active = repo.getActiveDraft(ontologyId, ownerId)
|
|
146
|
+
if (active) {
|
|
147
|
+
throw new AppError(409, 'DRAFT_ALREADY_ACTIVE', `本体 ${ontologyId} 已有活跃草稿(${active.id}, rev=${active.rev});请继续编辑`)
|
|
148
|
+
}
|
|
149
|
+
let doc: OntologyDraftDoc = emptyDraftDoc(ontologyId, input.lineId ?? '')
|
|
150
|
+
if (input.name) doc.name = input.name
|
|
151
|
+
if (input.cloneFromVersion) {
|
|
152
|
+
const latest = repo.latestVersion(ontologyId, 'published')
|
|
153
|
+
if (!latest) throw new AppError(404, 'VERSION_NOT_FOUND', `本体 ${ontologyId} 还没有已发布版本可克隆`)
|
|
154
|
+
doc = cloneVersionDoc(latest)
|
|
155
|
+
input = { ...input, baseVersion: latest.version }
|
|
156
|
+
}
|
|
157
|
+
const row = repo.insertDraft({
|
|
158
|
+
id: newId('ontd'),
|
|
159
|
+
ontologyId,
|
|
160
|
+
baseVersion: input.baseVersion ?? null,
|
|
161
|
+
draftJson: JSON.stringify(doc),
|
|
162
|
+
ownerUserId: ownerId,
|
|
163
|
+
})
|
|
164
|
+
log({ ontologyId, version: input.baseVersion ?? 0, action: 'draft.create', actor, detail: { draftId: row.id } })
|
|
165
|
+
return row
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function cloneVersionDoc(version: VersionRow): OntologyDraftDoc {
|
|
169
|
+
const repo = getOntologyRepo()
|
|
170
|
+
const entities = repo.listEntities(version.id, version.version)
|
|
171
|
+
const relations = repo.listRelations(version.id, version.version)
|
|
172
|
+
const rules = repo.listRules(version.id, version.version)
|
|
173
|
+
const bindings = repo.listBindings(version.id, version.version).map(row => ({
|
|
174
|
+
id: row.id,
|
|
175
|
+
entityKey: row.entityKey,
|
|
176
|
+
platformKind: row.platformKind as BindingDraft['platformKind'],
|
|
177
|
+
platformId: row.platformId,
|
|
178
|
+
targetSub: row.targetSub,
|
|
179
|
+
scope: row.scope,
|
|
180
|
+
direction: row.direction as BindingDraft['direction'],
|
|
181
|
+
unitDeclared: row.unitDeclared,
|
|
182
|
+
unitTarget: row.unitTarget,
|
|
183
|
+
scale: row.scale,
|
|
184
|
+
offset: row.offset,
|
|
185
|
+
}))
|
|
186
|
+
return {
|
|
187
|
+
schemaVersion: ONTOLOGY_SCHEMA_VERSION,
|
|
188
|
+
name: version.name || version.id,
|
|
189
|
+
description: '',
|
|
190
|
+
lineId: version.lineId,
|
|
191
|
+
entities,
|
|
192
|
+
relations,
|
|
193
|
+
rules,
|
|
194
|
+
bindings,
|
|
195
|
+
note: '',
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function getDraft(draftId: string): DraftRow {
|
|
200
|
+
const row = getOntologyRepo().getDraft(draftId)
|
|
201
|
+
if (!row) throw new AppError(404, 'DRAFT_NOT_FOUND', `草稿 ${draftId} 不存在`)
|
|
202
|
+
return row
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function requireDraftAccess(draft: DraftRow, actor: Actor, opts: { write?: boolean } = {}): void {
|
|
206
|
+
if (draft.ownerUserId && draft.ownerUserId !== actor.userId && actor.role !== 'admin') {
|
|
207
|
+
throw new AppError(403, 'DRAFT_SCOPE_VIOLATION', `草稿 ${draft.id} 属于其他用户;只有属主或管理员可${opts.write ? '修改' : '查看'}`)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function listDrafts(actor: Actor, filter: { ontologyId?: string } = {}): DraftRow[] {
|
|
212
|
+
const repo = getOntologyRepo()
|
|
213
|
+
if (actor.role === 'admin') return repo.listDrafts(filter)
|
|
214
|
+
return repo.listDrafts({ ...filter, ownerUserId: actor.userId })
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface DraftDetail {
|
|
218
|
+
draft: DraftRow
|
|
219
|
+
doc: OntologyDraftDoc
|
|
220
|
+
validation: DraftValidationReport
|
|
221
|
+
bindings: ReturnType<typeof validateDraftBindings>
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export function getDraftDetail(draftId: string, actor: Actor): DraftDetail {
|
|
225
|
+
const draft = getDraft(draftId)
|
|
226
|
+
requireDraftAccess(draft, actor)
|
|
227
|
+
const doc = parseDraftRow(draft)
|
|
228
|
+
const validation = validateDraftDoc(doc)
|
|
229
|
+
// 绑定活体校验只对「目标仍存在」的 kind 有意义;device/spec_variable 等无目录面会报不存在,
|
|
230
|
+
// 因此这里只报告,不阻断非绑定编辑。
|
|
231
|
+
const bindings = validateDraftBindings(doc, { lineId: doc.lineId })
|
|
232
|
+
return { draft, doc, validation, bindings }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export interface UpdateDraftInput {
|
|
236
|
+
doc: unknown
|
|
237
|
+
expectedRev: number
|
|
238
|
+
/** 保存前是否强制活体绑定校验通过(默认 true:不允许落库已知失效的绑定) */
|
|
239
|
+
strictBindings?: boolean
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function updateDraft(draftId: string, actor: Actor, input: UpdateDraftInput): DraftDetail {
|
|
243
|
+
requireEditor(actor, '修改本体草稿')
|
|
244
|
+
const draft = getDraft(draftId)
|
|
245
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
246
|
+
let doc: OntologyDraftDoc
|
|
247
|
+
try {
|
|
248
|
+
doc = parseDraftDoc(input.doc)
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
throw new AppError(422, RULE_ERROR_CODES.INVALID, `本体文档形状非法:${(err as Error).message}`)
|
|
252
|
+
}
|
|
253
|
+
const validation = validateDraftDoc(doc)
|
|
254
|
+
if (!validation.ok) {
|
|
255
|
+
const first = validation.issues.filter(i => i.severity === 'error').slice(0, 5)
|
|
256
|
+
.map(i => `[${i.code}] ${i.path}: ${i.message}`).join('; ')
|
|
257
|
+
throw new AppError(422, RULE_ERROR_CODES.INVALID, `本体文档校验未通过:${first}`)
|
|
258
|
+
}
|
|
259
|
+
const bindings = validateDraftBindings(doc, { lineId: doc.lineId })
|
|
260
|
+
if ((input.strictBindings ?? true) && !bindings.ok) {
|
|
261
|
+
const first = bindings.failures.slice(0, 5).map(f => `[${f.code}] ${f.message}`).join('; ')
|
|
262
|
+
throw new AppError(422, 'ONTOLOGY_BINDING_INVALID', `语义绑定校验未通过:${first}`)
|
|
263
|
+
}
|
|
264
|
+
const updated = getOntologyRepo().updateDraft(draftId, JSON.stringify(doc), input.expectedRev)
|
|
265
|
+
log({ ontologyId: updated.ontologyId, version: updated.baseVersion ?? 0, action: 'draft.update', actor, detail: { draftId, rev: updated.rev } })
|
|
266
|
+
return { draft: updated, doc, validation, bindings }
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function deleteDraft(draftId: string, actor: Actor): void {
|
|
270
|
+
requireEditor(actor, '删除本体草稿')
|
|
271
|
+
const draft = getDraft(draftId)
|
|
272
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
273
|
+
getOntologyRepo().deleteDraft(draftId)
|
|
274
|
+
log({ ontologyId: draft.ontologyId, action: 'draft.delete', actor, detail: { draftId } })
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* 自动修复草稿(Agent 工具与 UI「自动修复」共用):
|
|
279
|
+
* 与 updateDraft 同一写路径(乐观锁 rev + 审计),区别有两点:
|
|
280
|
+
* - strictBindings=false:平台侧绑定漂移不阻塞文档内安全修复的落库;
|
|
281
|
+
* - 允许「部分修复」落库:自动修复后仍有不可自动修复的错误(如证据缺失)时,
|
|
282
|
+
* 已做的安全规范化照样保存,剩余错误随 validation 原样返回 —— 否则修复器
|
|
283
|
+
* 在历史/导入的脏草稿上会因残余错误整体回滚,等于不可用。
|
|
284
|
+
* 证据永不伪造:残余错误只能由人/Agent 补真实证据后再次校验。
|
|
285
|
+
*/
|
|
286
|
+
export function autoFixDraft(draftId: string, actor: Actor): {
|
|
287
|
+
draft: DraftRow
|
|
288
|
+
doc: OntologyDraftDoc
|
|
289
|
+
validation: DraftValidationReport
|
|
290
|
+
bindings: ReturnType<typeof validateDraftBindings>
|
|
291
|
+
fixes: OntologyAutoFix[]
|
|
292
|
+
} {
|
|
293
|
+
requireEditor(actor, '自动修复本体草稿')
|
|
294
|
+
const draft = getDraft(draftId)
|
|
295
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
296
|
+
const { doc, fixes, validation } = autoFixDraftDoc(parseDraftRow(draft))
|
|
297
|
+
const bindings = validateDraftBindings(doc, { lineId: doc.lineId })
|
|
298
|
+
if (!fixes.length) {
|
|
299
|
+
return { draft, doc, validation, bindings, fixes }
|
|
300
|
+
}
|
|
301
|
+
let updated: DraftRow
|
|
302
|
+
if (validation.ok) {
|
|
303
|
+
// 修复后完全合法:走标准写路径(含活体绑定复核与审计)
|
|
304
|
+
const detail = updateDraft(draftId, actor, { doc, expectedRev: draft.rev, strictBindings: false })
|
|
305
|
+
updated = detail.draft
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// 部分修复:直接落库(乐观锁 + 审计),残余错误由回执暴露,不静默掩盖
|
|
309
|
+
updated = getOntologyRepo().updateDraft(draftId, JSON.stringify(doc), draft.rev)
|
|
310
|
+
}
|
|
311
|
+
log({
|
|
312
|
+
ontologyId: updated.ontologyId,
|
|
313
|
+
version: updated.baseVersion ?? 0,
|
|
314
|
+
action: 'draft.autofix',
|
|
315
|
+
actor,
|
|
316
|
+
detail: { draftId, rev: updated.rev, fixes: fixes.length, residualErrors: validation.issues.filter(i => i.severity === 'error').length },
|
|
317
|
+
})
|
|
318
|
+
return { draft: updated, doc, validation, bindings, fixes }
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ===== 校验 / 编译预览 =====
|
|
322
|
+
|
|
323
|
+
export function validateDraft(draftId: string, actor: Actor): DraftValidationReport & { bindings: ReturnType<typeof validateDraftBindings> } {
|
|
324
|
+
const detail = getDraftDetail(draftId, actor)
|
|
325
|
+
return { ...detail.validation, bindings: detail.bindings }
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface CompilePreview {
|
|
329
|
+
result: OntologyCompileResult
|
|
330
|
+
guards: ControlGuard[]
|
|
331
|
+
contentHash: string
|
|
332
|
+
packHash: string
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export function compileDraft(draftId: string, actor: Actor, options: Partial<CompileOptions> = {}): CompilePreview {
|
|
336
|
+
const draft = getDraft(draftId)
|
|
337
|
+
requireDraftAccess(draft, actor)
|
|
338
|
+
const doc = parseDraftRow(draft)
|
|
339
|
+
const version = draft.baseVersion ? (draft.baseVersion + 1) : 1
|
|
340
|
+
const result = compileOntology(doc, {
|
|
341
|
+
ontologyId: draft.ontologyId,
|
|
342
|
+
version,
|
|
343
|
+
scope: { lineId: doc.lineId },
|
|
344
|
+
approvedOnly: options.approvedOnly ?? false,
|
|
345
|
+
currentBounds: options.currentBounds,
|
|
346
|
+
createdAt: options.createdAt,
|
|
347
|
+
})
|
|
348
|
+
const contentHash = draftContentHash(doc)
|
|
349
|
+
return { result, guards: result.artifacts.controlGuard.guards, contentHash, packHash: ontologyPackHash({ rulePackHash: result.rulePackHash, contentHash }) }
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ===== 证据 =====
|
|
353
|
+
|
|
354
|
+
export interface AppendEvidenceInput {
|
|
355
|
+
targetKind: 'entity' | 'relation' | 'rule' | 'binding'
|
|
356
|
+
targetKey: string
|
|
357
|
+
level: EvidenceRecord['level']
|
|
358
|
+
source: EvidenceRecord['source']
|
|
359
|
+
sourceRef?: string
|
|
360
|
+
note?: string
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function appendEvidence(draftId: string, actor: Actor, input: AppendEvidenceInput): DraftDetail {
|
|
364
|
+
requireEditor(actor, '登记本体证据')
|
|
365
|
+
const draft = getDraft(draftId)
|
|
366
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
367
|
+
const doc = parseDraftRow(draft)
|
|
368
|
+
const record: EvidenceRecord = {
|
|
369
|
+
id: newId('ev'),
|
|
370
|
+
level: input.level,
|
|
371
|
+
source: input.source,
|
|
372
|
+
sourceRefHash: input.sourceRef ? ontologyPackHash({ rulePackHash: input.sourceRef, contentHash: input.level }) : '',
|
|
373
|
+
createdAt: new Date().toISOString(),
|
|
374
|
+
note: input.note,
|
|
375
|
+
}
|
|
376
|
+
if (input.targetKind === 'rule') {
|
|
377
|
+
const rule = doc.rules.find(r => r.id === input.targetKey || r.key === input.targetKey)
|
|
378
|
+
if (!rule) throw new AppError(404, 'RULE_NOT_FOUND', `草稿 ${draftId} 中没有规则「${input.targetKey}」`)
|
|
379
|
+
rule.evidence = [...rule.evidence, record]
|
|
380
|
+
}
|
|
381
|
+
else if (input.targetKind === 'relation') {
|
|
382
|
+
const relation = doc.relations.find(r => r.id === input.targetKey)
|
|
383
|
+
if (!relation) throw new AppError(404, 'RELATION_NOT_FOUND', `草稿 ${draftId} 中没有关系「${input.targetKey}」`)
|
|
384
|
+
relation.evidence = [...relation.evidence, record]
|
|
385
|
+
}
|
|
386
|
+
else if (input.targetKind === 'entity') {
|
|
387
|
+
const entity = doc.entities.find(e => e.key === input.targetKey)
|
|
388
|
+
if (!entity) throw new AppError(404, 'ENTITY_NOT_FOUND', `草稿 ${draftId} 中没有实体「${input.targetKey}」`)
|
|
389
|
+
}
|
|
390
|
+
const ledgerRow: EvidenceRow = {
|
|
391
|
+
id: record.id,
|
|
392
|
+
ontologyId: draft.ontologyId,
|
|
393
|
+
targetKind: input.targetKind,
|
|
394
|
+
targetKey: input.targetKey,
|
|
395
|
+
level: record.level,
|
|
396
|
+
sourceType: record.source.type,
|
|
397
|
+
sourceRef: input.sourceRef ?? '',
|
|
398
|
+
sourceRefHash: record.sourceRefHash,
|
|
399
|
+
detailJson: JSON.stringify({ source: record.source, note: input.note ?? '' }),
|
|
400
|
+
createdBy: actor.userId,
|
|
401
|
+
createdAt: record.createdAt,
|
|
402
|
+
}
|
|
403
|
+
// 追加行与草稿更新保持同一 rev 语义:先落账本,再以乐观锁写回草稿
|
|
404
|
+
getOntologyRepo().appendEvidence(ledgerRow)
|
|
405
|
+
const updated = getOntologyRepo().updateDraft(draftId, JSON.stringify(doc), draft.rev)
|
|
406
|
+
log({ ontologyId: draft.ontologyId, action: 'evidence.append', actor, detail: { draftId, targetKind: input.targetKind, targetKey: input.targetKey, level: input.level } })
|
|
407
|
+
return { draft: updated, doc, validation: validateDraftDoc(doc), bindings: validateDraftBindings(doc, { lineId: doc.lineId }) }
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export function listEvidence(ontologyId: string, filter: { targetKind?: string, targetKey?: string } = {}): EvidenceRow[] {
|
|
411
|
+
return getOntologyRepo().listEvidence(ontologyId, filter)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// ===== 规则生命周期 =====
|
|
415
|
+
|
|
416
|
+
export interface TransitionInput {
|
|
417
|
+
to: OntologyState
|
|
418
|
+
/** approved_for_control 必须携带已批准的审批单 id */
|
|
419
|
+
approvalId?: string
|
|
420
|
+
comment?: string
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export function transitionRule(draftId: string, ruleId: string, actor: Actor, input: TransitionInput): DraftDetail {
|
|
424
|
+
requireEditor(actor, '规则状态迁移')
|
|
425
|
+
// 审查/批准是**治理动作**,允许第二人对他人草稿执行(自审由 ownerUserId 比对单独拦截);
|
|
426
|
+
// 编辑类动作(updateDraft/appendEvidence)才是属主私有。
|
|
427
|
+
const draft = getDraft(draftId)
|
|
428
|
+
const doc = parseDraftRow(draft)
|
|
429
|
+
const rule = doc.rules.find(r => r.id === ruleId || r.key === ruleId)
|
|
430
|
+
if (!rule) throw new AppError(404, 'RULE_NOT_FOUND', `草稿 ${draftId} 中没有规则「${ruleId}」`)
|
|
431
|
+
|
|
432
|
+
const allowed = RULE_TRANSITIONS[rule.status] ?? []
|
|
433
|
+
if (!allowed.includes(input.to)) {
|
|
434
|
+
throw new AppError(409, 'RULE_LIFECYCLE_CONFLICT',
|
|
435
|
+
`规则 ${rule.id} 当前状态 ${rule.status},不能迁移到 ${input.to};合法目标:${allowed.join(', ') || '(终态)'}`)
|
|
436
|
+
}
|
|
437
|
+
const evidenceMax = rule.evidence.reduce((rank, e) => {
|
|
438
|
+
const order = ['candidate_influence', 'observed_correlation', 'validated_control']
|
|
439
|
+
return Math.max(rank, order.indexOf(e.level))
|
|
440
|
+
}, -1)
|
|
441
|
+
|
|
442
|
+
if (input.to === 'reviewed') {
|
|
443
|
+
// 自审禁止(单管理员实例豁免并打标)
|
|
444
|
+
const solo = isSoloOperator()
|
|
445
|
+
if (draft.ownerUserId === actor.userId && !solo) {
|
|
446
|
+
throw new AppError(403, 'SELF_REVIEW_FORBIDDEN',
|
|
447
|
+
`规则 ${rule.id} 的起草人不能自审(本体草稿属主=${draft.ownerUserId});请由另一名编辑/管理员审查`)
|
|
448
|
+
}
|
|
449
|
+
if (!solo) requireEditor(actor, '规则审查')
|
|
450
|
+
doc.rules = doc.rules.map(r => r.id === rule.id ? { ...r, status: 'reviewed' as OntologyState } : r)
|
|
451
|
+
log({ ontologyId: draft.ontologyId, action: 'rule.transition', actor, soloOperator: solo, detail: { draftId, ruleId, from: rule.status, to: 'reviewed', comment: input.comment ?? '' } })
|
|
452
|
+
}
|
|
453
|
+
else if (input.to === 'validated') {
|
|
454
|
+
if (evidenceMax < 1) {
|
|
455
|
+
throw new AppError(422, RULE_ERROR_CODES.EVIDENCE_INSUFFICIENT,
|
|
456
|
+
`规则 ${rule.id} 缺少可解析的证据(至少需要 observed_correlation:数据统计/工件系数);当前最高级别 ${rule.evidence[evidenceMax]?.level ?? '无'}`)
|
|
457
|
+
}
|
|
458
|
+
doc.rules = doc.rules.map(r => r.id === rule.id ? { ...r, status: 'validated' as OntologyState } : r)
|
|
459
|
+
log({ ontologyId: draft.ontologyId, action: 'rule.transition', actor, detail: { draftId, ruleId, from: rule.status, to: 'validated', comment: input.comment ?? '' } })
|
|
460
|
+
}
|
|
461
|
+
else if (input.to === 'approved_for_control') {
|
|
462
|
+
if (evidenceMax < 2) {
|
|
463
|
+
throw new AppError(422, RULE_ERROR_CODES.EVIDENCE_INSUFFICIENT,
|
|
464
|
+
`规则 ${rule.id} 缺少 validated_control 级证据(run+crosscheck+outcome 全链);当前最高级别 ${rule.evidence[evidenceMax]?.level ?? '无'}`)
|
|
465
|
+
}
|
|
466
|
+
if (!input.approvalId) {
|
|
467
|
+
throw new AppError(403, 'APPROVAL_REQUIRED',
|
|
468
|
+
`规则 ${rule.id} 进入 approved_for_control 必须有第二人批准单;请先 requestRuleApproval 并取得已批准的 approvalId`)
|
|
469
|
+
}
|
|
470
|
+
const decision = latestApprovalDecision(draft.ontologyId, input.approvalId)
|
|
471
|
+
if (!decision) throw new AppError(404, 'APPROVAL_NOT_FOUND', `审批单 ${input.approvalId} 不存在`)
|
|
472
|
+
if (decision.decision !== 'approved') {
|
|
473
|
+
throw new AppError(409, 'APPROVAL_NOT_GRANTED', `审批单 ${input.approvalId} 当前结论为 ${decision.decision};不能据以批准规则`)
|
|
474
|
+
}
|
|
475
|
+
if (decision.approver === draft.ownerUserId && !isSoloOperator()) {
|
|
476
|
+
throw new AppError(403, 'SELF_REVIEW_FORBIDDEN', `审批人 ${decision.approver} 是草稿属主,不能自我批准控制级规则`)
|
|
477
|
+
}
|
|
478
|
+
if (decision.ruleId !== rule.id) {
|
|
479
|
+
throw new AppError(409, 'APPROVAL_SCOPE_MISMATCH', `审批单 ${input.approvalId} 针对规则 ${decision.ruleId},与本次规则 ${rule.id} 不一致`)
|
|
480
|
+
}
|
|
481
|
+
doc.rules = doc.rules.map(r => r.id === rule.id ? { ...r, status: 'approved_for_control' as OntologyState } : r)
|
|
482
|
+
log({
|
|
483
|
+
ontologyId: draft.ontologyId, action: 'rule.approve', actor, approvalId: input.approvalId,
|
|
484
|
+
detail: { draftId, ruleId, from: rule.status, to: 'approved_for_control', comment: input.comment ?? '' },
|
|
485
|
+
})
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
doc.rules = doc.rules.map(r => r.id === rule.id ? { ...r, status: input.to } : r)
|
|
489
|
+
log({ ontologyId: draft.ontologyId, action: 'rule.transition', actor, detail: { draftId, ruleId, from: rule.status, to: input.to, comment: input.comment ?? '' } })
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
const updated = getOntologyRepo().updateDraft(draftId, JSON.stringify(doc), draft.rev)
|
|
493
|
+
return { draft: updated, doc, validation: validateDraftDoc(doc), bindings: validateDraftBindings(doc, { lineId: doc.lineId }) }
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ===== 审批单(第二人批准) =====
|
|
497
|
+
|
|
498
|
+
export interface ApprovalRequestRow { approvalId: string, ruleId: string, requester: string, createdAt: string, detail?: Record<string, unknown> }
|
|
499
|
+
|
|
500
|
+
export function requestRuleApproval(draftId: string, ruleId: string, actor: Actor): { approvalId: string, ruleId: string } {
|
|
501
|
+
requireEditor(actor, '申请规则批准')
|
|
502
|
+
const draft = getDraft(draftId)
|
|
503
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
504
|
+
const doc = parseDraftRow(draft)
|
|
505
|
+
const rule = doc.rules.find(r => r.id === ruleId || r.key === ruleId)
|
|
506
|
+
if (!rule) throw new AppError(404, 'RULE_NOT_FOUND', `草稿 ${draftId} 中没有规则「${ruleId}」`)
|
|
507
|
+
if (rule.status !== 'validated') {
|
|
508
|
+
throw new AppError(409, 'RULE_LIFECYCLE_CONFLICT', `只有 validated 状态的规则可申请控制级批准;当前 ${rule.status}`)
|
|
509
|
+
}
|
|
510
|
+
const approvalId = newId('oap')
|
|
511
|
+
log({
|
|
512
|
+
ontologyId: draft.ontologyId, action: 'rule.approve_request', actor, approvalId,
|
|
513
|
+
detail: { draftId, ruleId: rule.id, ruleKey: rule.key, requester: actor.userId },
|
|
514
|
+
})
|
|
515
|
+
return { approvalId, ruleId: rule.id }
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export function latestApprovalDecision(ontologyId: string, approvalId: string): { decision: string, approver: string, ruleId: string } | null {
|
|
519
|
+
const rows = getOntologyRepo().listPublishLog(ontologyId, 500).filter(r => r.approvalId === approvalId)
|
|
520
|
+
const request = rows.find(r => r.action === 'rule.approve_request')
|
|
521
|
+
if (!request) return null
|
|
522
|
+
const ruleId = (JSON.parse(request.detailJson || '{}') as { ruleId?: string }).ruleId ?? ''
|
|
523
|
+
const decision = rows.filter(r => r.action === 'rule.approve' || r.action === 'rule.reject')
|
|
524
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0]
|
|
525
|
+
if (!decision) return { decision: 'pending', approver: '', ruleId }
|
|
526
|
+
return { decision: decision.action === 'rule.approve' ? 'approved' : 'rejected', approver: decision.actor, ruleId }
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export function decideRuleApproval(draftId: string, approvalId: string, approver: Actor, decision: { approved: boolean, comment?: string }): { approvalId: string, decision: string } {
|
|
530
|
+
requireEditor(approver, '裁决规则批准')
|
|
531
|
+
const draft = getDraft(draftId)
|
|
532
|
+
const current = latestApprovalDecision(draft.ontologyId, approvalId)
|
|
533
|
+
if (!current) throw new AppError(404, 'APPROVAL_NOT_FOUND', `审批单 ${approvalId} 不存在`)
|
|
534
|
+
if (current.decision !== 'pending') {
|
|
535
|
+
throw new AppError(409, 'APPROVAL_ALREADY_DECIDED', `审批单 ${approvalId} 已裁决(${current.decision})`)
|
|
536
|
+
}
|
|
537
|
+
const solo = isSoloOperator()
|
|
538
|
+
if (draft.ownerUserId === approver.userId && !solo) {
|
|
539
|
+
throw new AppError(403, 'SELF_REVIEW_FORBIDDEN', '起草人不能裁决自己的批准申请(需要第二人)')
|
|
540
|
+
}
|
|
541
|
+
const action = decision.approved ? 'rule.approve' : 'rule.reject'
|
|
542
|
+
log({
|
|
543
|
+
ontologyId: draft.ontologyId, action, actor: approver, approvalId, soloOperator: solo,
|
|
544
|
+
detail: { draftId, ruleId: current.ruleId, comment: decision.comment ?? '' },
|
|
545
|
+
})
|
|
546
|
+
return { approvalId, decision: decision.approved ? 'approved' : 'rejected' }
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// ===== 发布 =====
|
|
550
|
+
|
|
551
|
+
export interface PublishResult {
|
|
552
|
+
version: VersionRow
|
|
553
|
+
compile: OntologyCompileResult
|
|
554
|
+
packHash: string
|
|
555
|
+
draft: DraftRow
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export function publishDraft(
|
|
559
|
+
draftId: string,
|
|
560
|
+
actor: Actor,
|
|
561
|
+
options: { currentBounds?: CompileOptions['currentBounds'] } = {},
|
|
562
|
+
): PublishResult {
|
|
563
|
+
requireAdmin(actor, '发布本体版本')
|
|
564
|
+
const draft = getDraft(draftId)
|
|
565
|
+
requireDraftAccess(draft, actor, { write: true })
|
|
566
|
+
const doc = parseDraftRow(draft)
|
|
567
|
+
|
|
568
|
+
const validation = validateDraftDoc(doc)
|
|
569
|
+
if (!validation.ok) {
|
|
570
|
+
throw new AppError(422, 'VALIDATION_BLOCKED',
|
|
571
|
+
`本体文档校验未通过,不能发布:${validation.issues.filter(i => i.severity === 'error').slice(0, 5).map(i => `[${i.code}] ${i.message}`).join('; ')}`)
|
|
572
|
+
}
|
|
573
|
+
const bindings = validateDraftBindings(doc, { lineId: doc.lineId })
|
|
574
|
+
if (!bindings.ok) {
|
|
575
|
+
throw new AppError(422, 'ONTOLOGY_BINDING_INVALID',
|
|
576
|
+
`语义绑定校验未通过,不能发布:${bindings.failures.slice(0, 5).map(f => `[${f.code}] ${f.message}`).join('; ')}`)
|
|
577
|
+
}
|
|
578
|
+
if (!doc.lineId && actor.role !== 'admin') {
|
|
579
|
+
throw new AppError(403, 'LINE_REQUIRED', '全局本体(lineId 为空)仅管理员可发布')
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const repo = getOntologyRepo()
|
|
583
|
+
const versionNumber = repo.nextVersionNumber(draft.ontologyId)
|
|
584
|
+
const compile = compileOntology(doc, {
|
|
585
|
+
ontologyId: draft.ontologyId,
|
|
586
|
+
version: versionNumber,
|
|
587
|
+
scope: { lineId: doc.lineId },
|
|
588
|
+
currentBounds: options.currentBounds,
|
|
589
|
+
approvedOnly: true,
|
|
590
|
+
})
|
|
591
|
+
// 未获批规则绝不可进入发布版控制约束(即使整体 status 只是 warning/rejected)
|
|
592
|
+
const notApproved = compile.issues.filter(i => i.code === RULE_ERROR_CODES.NOT_APPROVED)
|
|
593
|
+
if (notApproved.length > 0) {
|
|
594
|
+
throw new AppError(422, RULE_ERROR_CODES.NOT_APPROVED,
|
|
595
|
+
`存在未获批规则,不能进入发布版控制约束:${notApproved.slice(0, 5).map(i => i.message).join('; ')}`)
|
|
596
|
+
}
|
|
597
|
+
if (compile.status === 'rejected') {
|
|
598
|
+
throw new AppError(422, 'VALIDATION_BLOCKED',
|
|
599
|
+
`编译结果 rejected,不能发布:${compile.issues.slice(0, 5).map(i => `[${i.code}] ${i.message}`).join('; ')}`)
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
const contentHash = draftContentHash(doc)
|
|
603
|
+
const packHash = ontologyPackHash({ rulePackHash: compile.rulePackHash, contentHash })
|
|
604
|
+
const parent = repo.latestVersion(draft.ontologyId)
|
|
605
|
+
const compiledJson = JSON.stringify({
|
|
606
|
+
schemaVersion: ONTOLOGY_SCHEMA_VERSION,
|
|
607
|
+
ontologyId: draft.ontologyId,
|
|
608
|
+
ontologyVersion: versionNumber,
|
|
609
|
+
contentHash,
|
|
610
|
+
rulePackHash: compile.rulePackHash,
|
|
611
|
+
packHash,
|
|
612
|
+
status: compile.status,
|
|
613
|
+
compiledAt: new Date().toISOString(),
|
|
614
|
+
artifacts: compile.artifacts,
|
|
615
|
+
issues: compile.issues,
|
|
616
|
+
counts: {
|
|
617
|
+
compiled: compile.compiledCount, guard: compile.guardCount,
|
|
618
|
+
explained: compile.explainedCount, rejected: compile.rejectedCount,
|
|
619
|
+
},
|
|
620
|
+
})
|
|
621
|
+
const changelog = JSON.stringify(buildChangelog(parent, doc, compile))
|
|
622
|
+
|
|
623
|
+
let version: VersionRow
|
|
624
|
+
try {
|
|
625
|
+
version = repo.publishSnapshot({
|
|
626
|
+
version: {
|
|
627
|
+
id: draft.ontologyId, version: versionNumber, name: doc.name, lineId: doc.lineId,
|
|
628
|
+
parentVersion: parent?.version ?? null, contentHash, compiledJson, changelogJson: changelog,
|
|
629
|
+
status: 'published', ownerUserId: draft.ownerUserId, publishedBy: actor.userId,
|
|
630
|
+
createdAt: '', updatedAt: '',
|
|
631
|
+
},
|
|
632
|
+
entities: doc.entities.map(e => ({ ...e, dimension: e.dimension || dimensionOf(e.unit) })),
|
|
633
|
+
relations: doc.relations,
|
|
634
|
+
rules: doc.rules,
|
|
635
|
+
bindings: doc.bindings,
|
|
636
|
+
traces: compile.traces,
|
|
637
|
+
guards: compile.artifacts.controlGuard.guards,
|
|
638
|
+
createdBy: actor.userId,
|
|
639
|
+
})
|
|
640
|
+
}
|
|
641
|
+
catch (err) {
|
|
642
|
+
throw new AppError(409, 'ONTOLOGY_VERSION_CONFLICT',
|
|
643
|
+
`本体 ${draft.ontologyId} 版本 ${versionNumber} 并发发布冲突,请重新读取后重试(${(err as Error).message})`)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// 草稿保留为新版本的工作副本(baseVersion 前移,rev++),便于继续演进
|
|
647
|
+
repo.updateDraftMeta(draftId, { baseVersion: versionNumber })
|
|
648
|
+
const refreshed = repo.updateDraft(draftId, JSON.stringify(doc), draft.rev)
|
|
649
|
+
|
|
650
|
+
log({
|
|
651
|
+
ontologyId: draft.ontologyId, version: versionNumber, action: 'publish', actor,
|
|
652
|
+
detail: {
|
|
653
|
+
draftId, contentHash, packHash, compiled: compile.compiledCount, guards: compile.guardCount,
|
|
654
|
+
rejected: compile.rejectedCount, explained: compile.explainedCount,
|
|
655
|
+
},
|
|
656
|
+
})
|
|
657
|
+
return { version, compile, packHash, draft: refreshed }
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
function buildChangelog(parent: VersionRow | undefined, doc: OntologyDraftDoc, compile: OntologyCompileResult) {
|
|
661
|
+
return {
|
|
662
|
+
generatedAt: new Date().toISOString(),
|
|
663
|
+
parentVersion: parent?.version ?? null,
|
|
664
|
+
counts: {
|
|
665
|
+
entities: doc.entities.length, relations: doc.relations.length,
|
|
666
|
+
rules: doc.rules.length, bindings: doc.bindings.length,
|
|
667
|
+
},
|
|
668
|
+
ruleDecisions: compile.traces.map(t => ({ ruleId: t.ruleId, decision: t.decision, code: t.decisionCode })),
|
|
669
|
+
artifacts: {
|
|
670
|
+
mvBounds: Object.keys(compile.artifacts.problemIr.mvBounds),
|
|
671
|
+
cvBounds: Object.keys(compile.artifacts.problemIr.cvBounds),
|
|
672
|
+
guards: compile.artifacts.controlGuard.guards.map(g => g.id),
|
|
673
|
+
featureCandidates: compile.artifacts.processModel.featureCandidates.length,
|
|
674
|
+
delayPriors: compile.artifacts.processModel.delayPriors.length,
|
|
675
|
+
},
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// ===== 版本读取 / 比较 / 退役 =====
|
|
680
|
+
|
|
681
|
+
export function listVersions(ontologyId: string): VersionRow[] {
|
|
682
|
+
return getOntologyRepo().listVersions(ontologyId)
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export function getVersion(ontologyId: string, version: number): VersionRow {
|
|
686
|
+
const row = getOntologyRepo().getVersion(ontologyId, version)
|
|
687
|
+
if (!row) throw new AppError(404, 'VERSION_NOT_FOUND', `本体 ${ontologyId}@${version} 不存在`)
|
|
688
|
+
return row
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
export interface VersionDiff {
|
|
692
|
+
from: number
|
|
693
|
+
to: number
|
|
694
|
+
entities: { added: string[], removed: string[], changed: string[] }
|
|
695
|
+
relations: { added: string[], removed: string[], changed: string[] }
|
|
696
|
+
rules: { added: string[], removed: string[], changed: string[] }
|
|
697
|
+
bindings: { added: string[], removed: string[], changed: string[] }
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function diffSections<T>(a: T[], b: T[], keyOf: (item: T) => string): { added: string[], removed: string[], changed: string[] } {
|
|
701
|
+
const mapA = new Map(a.map(item => [keyOf(item), item]))
|
|
702
|
+
const mapB = new Map(b.map(item => [keyOf(item), item]))
|
|
703
|
+
const added: string[] = []
|
|
704
|
+
const removed: string[] = []
|
|
705
|
+
const changed: string[] = []
|
|
706
|
+
for (const [key, item] of mapB) {
|
|
707
|
+
if (!mapA.has(key)) added.push(key)
|
|
708
|
+
else if (JSON.stringify(mapA.get(key)) !== JSON.stringify(item)) changed.push(key)
|
|
709
|
+
}
|
|
710
|
+
for (const key of mapA.keys()) if (!mapB.has(key)) removed.push(key)
|
|
711
|
+
return { added: added.sort(), removed: removed.sort(), changed: changed.sort() }
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
export function compareVersions(ontologyId: string, from: number, to: number): VersionDiff {
|
|
715
|
+
const repo = getOntologyRepo()
|
|
716
|
+
const a = getVersion(ontologyId, from)
|
|
717
|
+
const b = getVersion(ontologyId, to)
|
|
718
|
+
return {
|
|
719
|
+
from, to,
|
|
720
|
+
entities: diffSections(repo.listEntities(a.id, a.version), repo.listEntities(b.id, b.version), e => e.key),
|
|
721
|
+
relations: diffSections(repo.listRelations(a.id, a.version), repo.listRelations(b.id, b.version), r => r.id),
|
|
722
|
+
rules: diffSections(repo.listRules(a.id, a.version), repo.listRules(b.id, b.version), r => r.id),
|
|
723
|
+
bindings: diffSections(repo.listBindings(a.id, a.version), repo.listBindings(b.id, b.version), r => r.id),
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export function retireVersion(ontologyId: string, version: number, actor: Actor): void {
|
|
728
|
+
requireAdmin(actor, '退役本体版本')
|
|
729
|
+
const row = getVersion(ontologyId, version)
|
|
730
|
+
if (row.status !== 'published') {
|
|
731
|
+
throw new AppError(409, 'VERSION_NOT_PUBLISHED', `本体 ${ontologyId}@${version} 状态为 ${row.status},只有 published 可退役`)
|
|
732
|
+
}
|
|
733
|
+
const ok = getOntologyRepo().transitionVersion(ontologyId, version, 'retired', 'published')
|
|
734
|
+
if (!ok) throw new AppError(409, 'VERSION_TRANSITION_CONFLICT', `本体 ${ontologyId}@${version} 并发状态变更,请重试`)
|
|
735
|
+
log({ ontologyId, version, action: 'retire', actor })
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
export function listOntologies(lineId?: string) {
|
|
739
|
+
return getOntologyRepo().listAllOntologyIds(lineId)
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// ===== 运行时消费面 =====
|
|
743
|
+
|
|
744
|
+
export interface ActiveOntology {
|
|
745
|
+
version: VersionRow
|
|
746
|
+
guards: ControlGuard[]
|
|
747
|
+
artifacts: OntologyCompileResult['artifacts']
|
|
748
|
+
packHash: string
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/** 取某产线当前生效的已发布本体(该线最新的 published 版本;无则 null) */
|
|
752
|
+
export function resolveActiveOntology(lineId: string): ActiveOntology | null {
|
|
753
|
+
const repo = getOntologyRepo()
|
|
754
|
+
const version = repo.latestPublishedForLine(lineId)
|
|
755
|
+
if (!version) return null
|
|
756
|
+
const compiled = JSON.parse(version.compiledJson || '{}') as {
|
|
757
|
+
artifacts?: OntologyCompileResult['artifacts']
|
|
758
|
+
packHash?: string
|
|
759
|
+
controlGuard?: { guards?: ControlGuard[] }
|
|
760
|
+
}
|
|
761
|
+
const guards = extractGuardSet(compiled)
|
|
762
|
+
const artifacts = compiled.artifacts ?? { processModel: { featureCandidates: [], delayPriors: [], monotonicity: [] }, problemIr: { templateRef: 'linear_mpc_quadratic@1', mvBounds: {}, cvBounds: {}, softRegularization: [] }, sceneContract: { variables: [], constraints: [], inferredRelations: [] }, controlGuard: { guards } }
|
|
763
|
+
return { version, guards, artifacts, packHash: compiled.packHash ?? version.contentHash }
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** 运行时守卫求值(供求解/下发前置检查调用) */
|
|
767
|
+
export function evaluateOntologyGuards(lineId: string, input: Omit<GuardEvaluationInput, 'scope'> & { recipeId?: string, conditionId?: string }): GuardEvaluationResult & { packHash: string } {
|
|
768
|
+
const active = resolveActiveOntology(lineId)
|
|
769
|
+
if (!active) return { ok: true, blocked: false, violations: [], evaluated: 0, skipped: 0, packHash: '' }
|
|
770
|
+
const result = evaluateGuards(active.guards, { ...input, scope: { lineId, recipeId: input.recipeId, conditionId: input.conditionId } })
|
|
771
|
+
return { ...result, packHash: active.packHash }
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Profile 漂移校验:Profile 冻结时记录的 packHash 必须与当前已发布版本一致。
|
|
776
|
+
* 不一致 → 409 ONTOLOGY_PACK_DRIFTED(只拒不放行;与 D12 工件 hash 独立比对同构)。
|
|
777
|
+
*/
|
|
778
|
+
export function assertOntologyUnchanged(refs: Array<{ ontologyId: string, ontologyVersion: number, rulePackHash?: string, contentHash?: string }> | undefined): void {
|
|
779
|
+
if (!refs || refs.length === 0) return
|
|
780
|
+
const repo = getOntologyRepo()
|
|
781
|
+
for (const ref of refs) {
|
|
782
|
+
const row = repo.getVersion(ref.ontologyId, ref.ontologyVersion)
|
|
783
|
+
if (!row) {
|
|
784
|
+
throw new AppError(409, 'ONTOLOGY_PACK_DRIFTED', `Profile 引用的本体 ${ref.ontologyId}@${ref.ontologyVersion} 已不存在`)
|
|
785
|
+
}
|
|
786
|
+
if (row.status !== 'published') {
|
|
787
|
+
throw new AppError(409, 'ONTOLOGY_PACK_DRIFTED', `Profile 引用的本体 ${ref.ontologyId}@${ref.ontologyVersion} 状态为 ${row.status}(需 published)`)
|
|
788
|
+
}
|
|
789
|
+
if (ref.contentHash && row.contentHash !== ref.contentHash) {
|
|
790
|
+
throw new AppError(409, 'ONTOLOGY_PACK_DRIFTED',
|
|
791
|
+
`Profile 引用的本体 ${ref.ontologyId}@${ref.ontologyVersion} 内容已变(冻结 ${ref.contentHash.slice(0, 12)} ≠ 当前 ${row.contentHash.slice(0, 12)})`)
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/** 绑定漂移巡检(发布前与周期巡检共用) */
|
|
797
|
+
export function verifyVersionBindings(ontologyId: string, version: number): { ok: boolean, drifted: Array<{ bindingId: string, reason: string }> } {
|
|
798
|
+
const repo = getOntologyRepo()
|
|
799
|
+
const row = getVersion(ontologyId, version)
|
|
800
|
+
const report = detectBindingDrift(repo.listBindings(row.id, row.version))
|
|
801
|
+
for (const drift of report.drifted) repo.markBindingStatus(drift.bindingId, 'drifted')
|
|
802
|
+
return report
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* 下发意图的守卫检查(运行时真正生效的落点之一)。
|
|
807
|
+
*
|
|
808
|
+
* 输入是**平台节点级**的动作(from→to 工程值),经语义绑定映射到本体实体 key,
|
|
809
|
+
* 再用本体实体 key 观测当前状态并求值。返回 blocked 时调用方必须拒绝下发。
|
|
810
|
+
*
|
|
811
|
+
* 映射规则:
|
|
812
|
+
* - 守卫的 when.variableKey 绑定到 dcw_node → 取该节点 readValue/value 作观测;
|
|
813
|
+
* 绑定到 daq_node → 无同步读值(交 fail-closed:未知状态 + 提速 = 阻断);
|
|
814
|
+
* - 守卫的 forbid.variableKey 绑定到 dcw_node → 由 from/to 计算增量。
|
|
815
|
+
*/
|
|
816
|
+
export function evaluateOntologyGuardsForNodes(
|
|
817
|
+
lineId: string,
|
|
818
|
+
moves: Array<{ nodeId: string, from: number | null, to: number }>,
|
|
819
|
+
opts: { recipeId?: string, conditionId?: string } = {},
|
|
820
|
+
): GuardEvaluationResult & { packHash: string, unmapped: string[] } {
|
|
821
|
+
const active = resolveActiveOntology(lineId)
|
|
822
|
+
if (!active || active.guards.length === 0) {
|
|
823
|
+
return { ok: true, blocked: false, violations: [], evaluated: 0, skipped: 0, packHash: '', unmapped: [] }
|
|
824
|
+
}
|
|
825
|
+
const repo = getOntologyRepo()
|
|
826
|
+
const bindings = repo.listBindings(active.version.id, active.version.version)
|
|
827
|
+
const byEntity = new Map<string, typeof bindings>()
|
|
828
|
+
for (const b of bindings) {
|
|
829
|
+
const list = byEntity.get(b.entityKey) ?? []
|
|
830
|
+
list.push(b)
|
|
831
|
+
byEntity.set(b.entityKey, list)
|
|
832
|
+
}
|
|
833
|
+
const nodeOf = (entityKey: string): string | null => {
|
|
834
|
+
const list = byEntity.get(entityKey) ?? []
|
|
835
|
+
// 优先写通道(dcw),其次任意通道
|
|
836
|
+
const dcw = list.find(b => b.platformKind === 'dcw_node')
|
|
837
|
+
const any = dcw ?? list[0]
|
|
838
|
+
return any ? any.platformId : null
|
|
839
|
+
}
|
|
840
|
+
const moveOf = (nodeId: string | null) => (nodeId ? moves.find(m => m.nodeId === nodeId) : undefined)
|
|
841
|
+
|
|
842
|
+
const values: GuardEvaluationInput['values'] = {}
|
|
843
|
+
const deltas: Record<string, number> = {}
|
|
844
|
+
const unmapped: string[] = []
|
|
845
|
+
for (const guard of active.guards) {
|
|
846
|
+
const whenNode = nodeOf(guard.when.variableKey)
|
|
847
|
+
if (!whenNode) {
|
|
848
|
+
unmapped.push(guard.when.variableKey)
|
|
849
|
+
continue
|
|
850
|
+
}
|
|
851
|
+
const node = getDcwNodeReadValue(whenNode)
|
|
852
|
+
if (node !== undefined) values[guard.when.variableKey] = node
|
|
853
|
+
const forbidNode = nodeOf(guard.forbid.variableKey)
|
|
854
|
+
const move = moveOf(forbidNode)
|
|
855
|
+
if (move) {
|
|
856
|
+
const from = typeof move.from === 'number' && Number.isFinite(move.from) ? move.from : move.to
|
|
857
|
+
deltas[guard.forbid.variableKey] = move.to - from
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
const result = evaluateGuards(active.guards, { values, deltas, scope: { lineId, recipeId: opts.recipeId, conditionId: opts.conditionId } })
|
|
861
|
+
return { ...result, packHash: active.packHash, unmapped }
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/** 读 dcw 节点当前值(工程值);节点不存在返回 undefined */
|
|
865
|
+
function getDcwNodeReadValue(nodeId: string): number | undefined {
|
|
866
|
+
try {
|
|
867
|
+
const node = getDcwController().byId(nodeId)
|
|
868
|
+
if (!node) return undefined
|
|
869
|
+
const value = typeof node.readValue === 'number' ? node.readValue : (typeof node.value === 'number' ? node.value : undefined)
|
|
870
|
+
return value
|
|
871
|
+
}
|
|
872
|
+
catch { return undefined }
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/** 供 Agent 上下文/工具用的场景子图(只含绑定面实体 + 命中规则摘要) */
|
|
876
|
+
export interface SceneSubgraph {
|
|
877
|
+
ontologyId: string
|
|
878
|
+
version: number
|
|
879
|
+
lineId: string
|
|
880
|
+
entities: Array<{ key: string, kind: string, name: string, unit: string, role: string | undefined, bindings: Array<{ platformKind: string, platformId: string, targetSub: string, direction: string }> }>
|
|
881
|
+
relations: Array<{ id: string, kind: string, srcKey: string, dstKey: string, evidenceTier: string }>
|
|
882
|
+
rules: Array<{ id: string, key: string, kind: string, status: string, decision: string, message: string }>
|
|
883
|
+
guards: Array<{ id: string, ruleId: string, message: string, onViolate: string }>
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
export function sceneSubgraph(lineId: string, opts: { limit?: number } = {}): SceneSubgraph | null {
|
|
887
|
+
const active = resolveActiveOntology(lineId)
|
|
888
|
+
if (!active) return null
|
|
889
|
+
const repo = getOntologyRepo()
|
|
890
|
+
const entities = repo.listEntities(active.version.id, active.version.version)
|
|
891
|
+
const relations = repo.listRelations(active.version.id, active.version.version)
|
|
892
|
+
const rules = repo.listRules(active.version.id, active.version.version)
|
|
893
|
+
const bindings = repo.listBindings(active.version.id, active.version.version)
|
|
894
|
+
const traces = repo.listTraces(active.version.id, active.version.version)
|
|
895
|
+
const traceOf = new Map(traces.map(t => [t.ruleId, t]))
|
|
896
|
+
const bindingsOf = new Map<string, SceneSubgraph['entities'][number]['bindings']>()
|
|
897
|
+
for (const b of bindings) {
|
|
898
|
+
const list = bindingsOf.get(b.entityKey) ?? []
|
|
899
|
+
list.push({ platformKind: b.platformKind, platformId: b.platformId, targetSub: b.targetSub, direction: b.direction })
|
|
900
|
+
bindingsOf.set(b.entityKey, list)
|
|
901
|
+
}
|
|
902
|
+
const limit = opts.limit ?? 200
|
|
903
|
+
return {
|
|
904
|
+
ontologyId: active.version.id,
|
|
905
|
+
version: active.version.version,
|
|
906
|
+
lineId,
|
|
907
|
+
entities: entities.slice(0, limit).map(e => ({
|
|
908
|
+
key: e.key, kind: e.kind, name: e.name, unit: e.unit, role: e.role,
|
|
909
|
+
bindings: bindingsOf.get(e.key) ?? [],
|
|
910
|
+
})),
|
|
911
|
+
relations: relations.map(r => ({ id: r.id, kind: r.kind, srcKey: r.srcKey, dstKey: r.dstKey, evidenceTier: r.properties.evidenceTier })),
|
|
912
|
+
rules: rules.map((r) => {
|
|
913
|
+
const trace = traceOf.get(r.id)
|
|
914
|
+
return {
|
|
915
|
+
id: r.id, key: r.key, kind: r.kind, status: r.status,
|
|
916
|
+
decision: trace?.decision ?? 'unknown', message: trace?.message ?? '',
|
|
917
|
+
}
|
|
918
|
+
}),
|
|
919
|
+
guards: active.guards.map(g => ({ id: g.id, ruleId: g.ruleId, message: g.message, onViolate: g.onViolate })),
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** AML 派生:特征候选 + 时滞先验(供训练编排消费) */
|
|
924
|
+
export function deriveTrainingPriors(lineId: string): {
|
|
925
|
+
featureCandidates: Array<{ entityKey: string, role: string, relation: string, evidenceLevel: string, priorDelayMs?: number, variabilityChecked: boolean }>
|
|
926
|
+
delayPriors: Array<{ entityKey: string, delayMs: number, basis: string, variabilityChecked: boolean }>
|
|
927
|
+
monotonicity: Array<{ output: string, input: string, direction: string }>
|
|
928
|
+
} | null {
|
|
929
|
+
const active = resolveActiveOntology(lineId)
|
|
930
|
+
if (!active) return null
|
|
931
|
+
return {
|
|
932
|
+
featureCandidates: active.artifacts.processModel.featureCandidates,
|
|
933
|
+
delayPriors: active.artifacts.processModel.delayPriors,
|
|
934
|
+
monotonicity: active.artifacts.processModel.monotonicity,
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
export type { OntologyRole, OntologyTarget }
|