chainlesschain 0.166.38 → 0.166.40
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/package.json +6 -1
- package/scripts/governed-learning-local-attestor-service.mjs +222 -0
- package/scripts/governed-learning-local-attestor-trust-approval-service.mjs +338 -0
- package/scripts/governed-learning-local-attestor-trust-operations-service.mjs +575 -0
- package/scripts/governed-learning-windows-secure-pipe-broker.ps1 +375 -0
- package/src/assets/web-panel/assets/{AIOps-DBbcVPqB.js → AIOps-BK9J9OWp.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-D5vETPOk.js → ActionButton-LPNZQqBA.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-WVhas3Fw.js → Analytics-Bc4GSjWD.js} +2 -2
- package/src/assets/web-panel/assets/{AppLayout-CSTRI93Q.js → AppLayout-DvOI0V4E.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-BZT8FOoE.js → Artifacts-Dk84hXbN.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-CT2-Tsby.js → Audit-q1LFnus7.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-BWA5LNBe.js → BackgroundAgents-CwalUYLs.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-B-zEbldA.js → Backup-DklgvW1G.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BAEwtdNT.js → BaseInput-BUwoeDOX.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-BT1-y6t1.js → Chat-DbHcDB_8.js} +6 -6
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-BVijMHeO.js → ChatBubbleRenderer-vEtAN7ar.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-B8IJYZsD.js → Checkbox-BhshLHuh.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-DEt453nL.js → Codegen-CrqH-uBK.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DWuVSmZv.js → Col-CTHhv3KN.js} +1 -1
- package/src/assets/web-panel/assets/{Community-CcoNuU33.js → Community-BXTvtMJe.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-BKtuIYWA.js → Compact-BpvJtxF1.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-bHzxGq3P.js → Compliance-CpMouPia.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-BY2Kb15t.js → Cowork-C7yp3_hW.js} +2 -2
- package/src/assets/web-panel/assets/{Cron-DC-j0jvp.js → Cron-C-XxPYai.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-CzEuAHQz.js → Crosschain-CMdyqfrL.js} +1 -1
- package/src/assets/web-panel/assets/{DID-7QUNq6Fz.js → DID-kuaHK2dq.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-CT6RiEFl.js → Dashboard-DH2-ms5o.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-CW8IPY7r.js → Dropdown-DXLZ0jjH.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-Zt8WOLuN.js → EmailListRenderer-DK86nfd5.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-B6aymxi7.js → FamilyGuardDashboard-CRKmGOug.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-BiuFrRq0.js → Federation-DKK3wIGA.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-DaiOAkHa.js → FormItemContext-CUGNKN_D.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-D1KbDpXs.js → GenericCardRenderer-CA0GwYSK.js} +1 -1
- package/src/assets/web-panel/assets/{Git-BILl0huA.js → Git-CFm46B43.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CLyhrPrh.js → Governance-CfOa3K-_.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-DyNhiIpK.js → Inference-C4C6jHDC.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Bor_ye4m.js → KnowledgeGraph-D5IhrCDs.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-ZDqbu8kg.js → Logs-BNeyeUIr.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-XsLyxgz8.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-DbDi29dH.js → Marketplace-0pLshxdU.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-DfU8dWbV.js → McpTools-DK4FG-4k.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DeAz-2-6.js → Memory-CQfkhP-b.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-ws3TJXal.js → MobileBridge-pbinAwCm.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-CGwVfeTv.js → MobileProjects-CWqK_5p8.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-BtJjJJpl.js → Mtc-B-OQ9yid.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-BNZwipXs.js → MtcAudit-Cp6iZgrT.js} +5 -5
- package/src/assets/web-panel/assets/{Multisig-9mSOrKWA.js → Multisig-D9cQONHI.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-gz1lEDED.js → NLProgramming-BUY0rZvc.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-BeufuOVX.js → Notes-CsXIIMCf.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-CbFyi9jZ.js → NotificationSettings-C6qIk1ej.js} +1 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-Cz3qay2q.js +1 -0
- package/src/assets/web-panel/assets/{Organization-DKBKNViH.js → Organization-Cs0gsc4U.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-CvPfKE1x.js → Overflow-C3ZfbqPx.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DjL2q8og.js → P2P-D1lxB22Z.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Cv9PLMWJ.js → PdhVaultBrowser-SNHvZvv_.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-BUoNho3w.js → Permissions-CFSk6KJV.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-C4Iu2Pic.js → PersonalDataHub-puvpUUGe.js} +3 -3
- package/src/assets/web-panel/assets/{Pipeline-BiDrIlwr.js → Pipeline-BMqYweJm.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BnvU6vGp.js → Privacy-C0sXA71u.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DDzoyhnH.js → ProjectInit-ClaKClvs.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CV6b43H0.js → ProjectSettings-CtHJp6_9.js} +2 -2
- package/src/assets/web-panel/assets/Projects-HuPL4QZa.js +1 -0
- package/src/assets/web-panel/assets/{Providers-DaeuFo-x.js → Providers-crByRu10.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-C03Bll1h.js → QrScannerModal-BKO9i7Sy.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-Cn9nLaen.js → QuickAsk-1IdXt4pm.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BXfkC8Ts.js → Recommend-DiQwZD6r.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DNj6D_LI.js → RemoteSession-DesjH6lx.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-DDDIwiUI.js → Reputation-b-nY3pul.js} +1 -1
- package/src/assets/web-panel/assets/{Row-JukNm-id.js → Row-Bt7nCF5s.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-B1AhzL2z.js → RssFeed-CcTg4JEQ.js} +2 -2
- package/src/assets/web-panel/assets/{Search-B5y6_DVm.js → Search-C2uI3GFe.js} +1 -1
- package/src/assets/web-panel/assets/{Security-C2pvv32x.js → Security-3NrvV4g1.js} +3 -3
- package/src/assets/web-panel/assets/{Services-DBka7ppY.js → Services-B1cKHgYr.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-DfPwNTSh.js → Skeleton-BTZdEKX3.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-Cs4ntp-l.js → Skills-Bi_Zy8Ru.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-CrUJ0guM.js → Sla-CR2gW1OA.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BFbokLV1.js → SpeechSettings-Bphe-fh1.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CSnh1o3D.js → SyncSettings-C64DsCjZ.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-CQZppIPo.js → Tasks-D18Px4aF.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-BqLeHq7Z.js → Templates-DGfS0ZAF.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CkzPA-ri.js → Tenant-D6ank4rT.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-D5IRhnu6.js → Terminal-MBMZ_5Gz.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-ICdiYzgz.js → TimelineRenderer-C_u6JjZi.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-89CaZBwe.js → Tokens-CqmhScSK.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-Di251qR1.js → Trigger-D1B9cX1b.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-M4sC3Mv6.js → Trust-D_P3Mfbl.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-BL7EUWxj.js → UkeySign-CUASyjWb.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-BV5Se5il.js → VideoEditing-eGLhjeJX.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-IoY13rov.js → Wallet-Dba_6QCL.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DKFPq0uV.js → WebAuthn-CiAEtYZZ.js} +3 -3
- package/src/assets/web-panel/assets/{WorkflowEditor-oizkYeQD.js → WorkflowEditor-D-zW3rph.js} +1 -1
- package/src/assets/web-panel/assets/{chat-Du6ZthE5.js → chat-DEzJInHX.js} +1 -1
- package/src/assets/web-panel/assets/{colors-I2ie73HS.js → colors-DM6Ke3hD.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-C-02XOOx.js → compact-item-CAMIx_cM.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-DgP09zg2.js → createContext-BrbtMPOW.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-DQGZAYxC.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-kWDasRib.js → hasIn-tnV_CKFU.js} +1 -1
- package/src/assets/web-panel/assets/{index-M9mzJo6V.js → index-9o6JlqCH.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cx5dAdFu.js → index-A3azg5vi.js} +1 -1
- package/src/assets/web-panel/assets/{index-AtAiEmjM.js → index-B5glieXV.js} +1 -1
- package/src/assets/web-panel/assets/{index-H_31JkaZ.js → index-B6KWb2WQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BSlTGxUJ.js → index-BIkQL-F7.js} +1 -1
- package/src/assets/web-panel/assets/{index-OYyn8GoU.js → index-BJ8Yd5W8.js} +1 -1
- package/src/assets/web-panel/assets/{index-5Ll5Fdqb.js → index-BZVDnMvs.js} +1 -1
- package/src/assets/web-panel/assets/{index-mF8UmKqp.js → index-B_aGo7Y_.js} +1 -1
- package/src/assets/web-panel/assets/{index-BUvpjPMv.js → index-BbdSgz4e.js} +1 -1
- package/src/assets/web-panel/assets/{index-CkP2DW3a.js → index-BeC4Jmxn.js} +1 -1
- package/src/assets/web-panel/assets/{index-CbHEQTU6.js → index-BfGYDWyS.js} +1 -1
- package/src/assets/web-panel/assets/{index-DKJ-d5F1.js → index-Br1t2LsA.js} +1 -1
- package/src/assets/web-panel/assets/{index-CHSghc3j.js → index-BuSXesCq.js} +1 -1
- package/src/assets/web-panel/assets/{index-CjuJ1FYZ.js → index-BzuFmNOf.js} +1 -1
- package/src/assets/web-panel/assets/index-C9a56Oco.js +1 -0
- package/src/assets/web-panel/assets/index-CU5eDYYp.js +1 -0
- package/src/assets/web-panel/assets/{index-CtbMRqD-.js → index-CVJ67rg0.js} +1 -1
- package/src/assets/web-panel/assets/{index-BZ6bWk4x.js → index-CVij36sN.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ryflob2W.js → index-CaCQEvVe.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYxia8nl.js → index-Cx3S7Z4l.js} +1 -1
- package/src/assets/web-panel/assets/{index-CpOQeTac.js → index-D1SsqpBQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-Na5QA1LE.js → index-D2X5hC5X.js} +1 -1
- package/src/assets/web-panel/assets/{index-D5LV04FO.js → index-D4-jekkQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-D9HwtJX5.js → index-D57Rt85L.js} +1 -1
- package/src/assets/web-panel/assets/{index-LLQQqj9B.js → index-DBYM7wpW.js} +1 -1
- package/src/assets/web-panel/assets/{index-D0EQSoEb.js → index-DH6MvJcX.js} +1 -1
- package/src/assets/web-panel/assets/{index-C3D5NSjS.js → index-DI1yJrlv.js} +1 -1
- package/src/assets/web-panel/assets/{index-CgogPjKJ.js → index-DJPjCj-L.js} +1 -1
- package/src/assets/web-panel/assets/{index-I4A_y2Ee.js → index-MxrGcqPa.js} +1 -1
- package/src/assets/web-panel/assets/{index-RwcHDSqP.js → index-Oi0LTcjV.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cokjvq67.js → index-QhkpDqBl.js} +1 -1
- package/src/assets/web-panel/assets/{index-CDM6OO4D.js → index-TiClDP9o.js} +1 -1
- package/src/assets/web-panel/assets/{index-BZcdP3id.js → index-cJQlyKYg.js} +1 -1
- package/src/assets/web-panel/assets/{index-DcVj7YJB.js → index-gOfw5W--.js} +1 -1
- package/src/assets/web-panel/assets/{index-HH3Zccc0.js → index-mtzwU2IE.js} +1 -1
- package/src/assets/web-panel/assets/{index-BkcCllZ7.js → index-mxqufmW1.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bpz5RnQy.js → index-nDxVFSLd.js} +3 -3
- package/src/assets/web-panel/assets/{index-CQCdk4dn.js → index-xqyMxX6r.js} +1 -1
- package/src/assets/web-panel/assets/{index-uHI8QHu4.js → index-yi_liTJn.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-BPHGo-UX.js → initDefaultProps-CVHDph1O.js} +1 -1
- package/src/assets/web-panel/assets/{motion-BBr8JvWc.js → motion-CElqp9xA.js} +1 -1
- package/src/assets/web-panel/assets/{move-CdKWToz7.js → move-XZw1bQmy.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-B8tkkKBs.js → mtc-parser-SGviFxRK.js} +1 -1
- package/src/assets/web-panel/assets/{omit-DN4aP33H.js → omit-BGKRrIHI.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-CoHRkRJq.js → pickAttrs-BuJYHAWJ.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-DpGGGAPa.js → placementArrow-TVa4r_EM.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-BabRsZo5.js → responsiveObserve-DVPWQMuO.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DJjyrwqK.js → slide-BeOL-UpA.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-BaRVkO5S.js → statusUtils-DNYqZCQQ.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-HcMYUjTR.js → styleChecker-DRx9GRig.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-c3IBzp2l.js → useFlexGapSupport-Daqz3PDA.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-DD7igwyF.js → useFs-C6A7nr7V.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-GEF0hhnd.js → usePersonalDataHub-D5hwRSvC.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-D51u7zqF.js → vnode-CHXMdIU3.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-tXG23Lc9.js → zoom-sl0JxyZz.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/evolution-attestor-trust.js +113 -0
- package/src/commands/evolution.js +2 -0
- package/src/commands/learning.js +34 -5
- package/src/data/changelog.json +26 -0
- package/src/lib/evolution/evolution-artifact-ports.js +21 -0
- package/src/lib/evolution/evolution-deployment-loader.js +56 -0
- package/src/lib/evolution/evolution-immutable-ledger-segment-store.js +812 -0
- package/src/lib/evolution/evolution-ledger-file-manifest-catalog.js +218 -0
- package/src/lib/evolution/evolution-ledger-manifest-catalog.js +472 -0
- package/src/lib/evolution/evolution-ledger-manifest-chain.js +997 -0
- package/src/lib/evolution/evolution-ledger-manifest-head-store.js +408 -0
- package/src/lib/evolution/evolution-ledger-manifest-witness-adapter.js +554 -0
- package/src/lib/evolution/evolution-ledger-v2-manifest-backend.js +460 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-ipc-endpoint.js +94 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-approval-client.js +485 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-ipc-capability.js +200 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-ledger.js +1222 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-operations-cli-host.js +802 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-operations-client.js +445 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-operations.js +1082 -0
- package/src/lib/evolution/governed-skill-synthesis-attestor-trust-operator-registry.js +1453 -0
- package/src/lib/evolution/governed-skill-synthesis-candidate-evaluator.js +147 -0
- package/src/lib/evolution/governed-skill-synthesis-cli-host.js +115 -0
- package/src/lib/evolution/governed-skill-synthesis-evaluation-ledger-adapter.js +715 -0
- package/src/lib/evolution/governed-skill-synthesis-external-attestor.js +499 -0
- package/src/lib/evolution/governed-skill-synthesis-model-evaluator.js +514 -0
- package/src/lib/evolution/governed-skill-synthesis-process-attestor-worker.mjs +208 -0
- package/src/lib/evolution/governed-skill-synthesis-process-attestor.js +557 -0
- package/src/lib/evolution/governed-skill-synthesis-process-grader-worker.mjs +143 -0
- package/src/lib/evolution/governed-skill-synthesis-process-grader.js +444 -0
- package/src/lib/evolution/governed-skill-synthesis-provider-chat.js +220 -0
- package/src/lib/evolution/governed-skill-synthesis-windows-secure-pipe-host.js +236 -0
- package/src/lib/hook-audit-store.js +68 -2
- package/src/lib/hooks-v2-runtime.js +52 -26
- package/src/lib/learning/skill-synthesizer.js +66 -5
- package/src/lib/remote-read-loop-guard.js +232 -37
- package/src/lib/task-progress-tracker.js +7 -4
- package/src/runtime/agent-core.js +16 -5
- package/src/runtime/coding-agent-shell-policy.cjs +10 -17
- package/src/assets/web-panel/assets/MarkdownRenderer-DnSfkf98.js +0 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-CFbhBT44.js +0 -1
- package/src/assets/web-panel/assets/Projects-B0k1907g.js +0 -1
- package/src/assets/web-panel/assets/devWarning-CxKkOIjh.js +0 -1
- package/src/assets/web-panel/assets/index-b5a6l3Uu.js +0 -1
- package/src/assets/web-panel/assets/index-xt-BOyp_.js +0 -1
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import net from "node:net";
|
|
3
|
+
import { types as utilTypes } from "node:util";
|
|
4
|
+
|
|
5
|
+
import { isGovernedSkillSynthesisAttestorIpcEndpoint } from "./governed-skill-synthesis-attestor-ipc-endpoint.js";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
createGovernedSkillSynthesisAttestorTrustIpcAuthorization,
|
|
9
|
+
normalizeGovernedSkillSynthesisAttestorTrustIpcCapability,
|
|
10
|
+
} from "./governed-skill-synthesis-attestor-trust-ipc-capability.js";
|
|
11
|
+
|
|
12
|
+
export const GOVERNED_SKILL_SYNTHESIS_ATTESTOR_TRUST_OPERATIONS_CLIENT_SCHEMA =
|
|
13
|
+
"chainlesschain.governed-skill-synthesis-attestor-trust-operations-client/v6";
|
|
14
|
+
export const GOVERNED_SKILL_SYNTHESIS_ATTESTOR_TRUST_OPERATIONS_IPC_SCHEMA =
|
|
15
|
+
"chainlesschain.governed-skill-synthesis-attestor-trust-operations-ipc/v3";
|
|
16
|
+
|
|
17
|
+
const CLIENTS = new WeakSet();
|
|
18
|
+
const MAX_FRAME_BYTES = 256 * 1024;
|
|
19
|
+
const ID = /^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$/u;
|
|
20
|
+
const KEY_ID = /^key:ed25519:[a-f0-9]{64}$/u;
|
|
21
|
+
const MAX_REQUESTS = 64;
|
|
22
|
+
const CAPABILITY_SERVICE = "attestor-trust-operations";
|
|
23
|
+
const OPTION_KEYS = new Set([
|
|
24
|
+
"capabilityToken",
|
|
25
|
+
"descriptor",
|
|
26
|
+
"endpoint",
|
|
27
|
+
"now",
|
|
28
|
+
"timeoutMs",
|
|
29
|
+
]);
|
|
30
|
+
const DESCRIPTOR_KEYS = new Set([
|
|
31
|
+
"approvalMode",
|
|
32
|
+
"authorizationStreamId",
|
|
33
|
+
"capability",
|
|
34
|
+
"operatorCount",
|
|
35
|
+
"operators",
|
|
36
|
+
"operatorRegistryRecordDigest",
|
|
37
|
+
"operatorRegistryRecovered",
|
|
38
|
+
"operatorRegistryStreamId",
|
|
39
|
+
"policyDigest",
|
|
40
|
+
"policyId",
|
|
41
|
+
"requiredApprovals",
|
|
42
|
+
"revision",
|
|
43
|
+
"schema",
|
|
44
|
+
"tenantId",
|
|
45
|
+
"transportSecurity",
|
|
46
|
+
]);
|
|
47
|
+
const OPERATOR_KEYS = new Set(["keyId", "operatorId"]);
|
|
48
|
+
const TRANSPORT_SECURITY_KEYS = new Set([
|
|
49
|
+
"acl",
|
|
50
|
+
"aclDigest",
|
|
51
|
+
"peerIdentity",
|
|
52
|
+
"principalDigest",
|
|
53
|
+
"remoteClients",
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
function canonical(value) {
|
|
57
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
58
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
59
|
+
return `{${Object.keys(value)
|
|
60
|
+
.sort()
|
|
61
|
+
.map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`)
|
|
62
|
+
.join(",")}}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function exact(value, keys, label) {
|
|
66
|
+
if (
|
|
67
|
+
!value ||
|
|
68
|
+
typeof value !== "object" ||
|
|
69
|
+
Array.isArray(value) ||
|
|
70
|
+
utilTypes.isProxy(value) ||
|
|
71
|
+
Object.getPrototypeOf(value) !== Object.prototype ||
|
|
72
|
+
Reflect.ownKeys(value).length !== keys.size ||
|
|
73
|
+
Reflect.ownKeys(value).some((key) => {
|
|
74
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
75
|
+
return (
|
|
76
|
+
typeof key !== "string" ||
|
|
77
|
+
!keys.has(key) ||
|
|
78
|
+
!descriptor ||
|
|
79
|
+
!("value" in descriptor) ||
|
|
80
|
+
descriptor.enumerable !== true
|
|
81
|
+
);
|
|
82
|
+
})
|
|
83
|
+
) {
|
|
84
|
+
throw new TypeError(`${label} is invalid`);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function text(value, label, maximum = 4096) {
|
|
90
|
+
if (
|
|
91
|
+
typeof value !== "string" ||
|
|
92
|
+
value.trim() !== value ||
|
|
93
|
+
value.length < 1 ||
|
|
94
|
+
value.length > maximum ||
|
|
95
|
+
value.includes("\0")
|
|
96
|
+
) {
|
|
97
|
+
throw new TypeError(`${label} is invalid`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function endpoint(value) {
|
|
103
|
+
const normalized = text(value, "operations endpoint", 1024);
|
|
104
|
+
if (
|
|
105
|
+
!isGovernedSkillSynthesisAttestorIpcEndpoint(normalized, {
|
|
106
|
+
kind: "trust-operations",
|
|
107
|
+
})
|
|
108
|
+
) {
|
|
109
|
+
throw new TypeError(
|
|
110
|
+
"operations endpoint is not a dedicated local IPC path",
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return normalized;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function normalizeDescriptor(value, capabilityToken, now) {
|
|
117
|
+
exact(value, DESCRIPTOR_KEYS, "operations service descriptor");
|
|
118
|
+
if (
|
|
119
|
+
value.schema !==
|
|
120
|
+
"chainlesschain.governed-skill-synthesis-attestor-trust-operations-service/v6" ||
|
|
121
|
+
!/^sha256:[a-f0-9]{64}$/u.test(value.policyDigest ?? "") ||
|
|
122
|
+
!Number.isSafeInteger(value.revision) ||
|
|
123
|
+
value.revision < 1 ||
|
|
124
|
+
!Number.isSafeInteger(value.requiredApprovals) ||
|
|
125
|
+
value.requiredApprovals < 1 ||
|
|
126
|
+
!Number.isSafeInteger(value.operatorCount) ||
|
|
127
|
+
value.operatorCount < value.requiredApprovals ||
|
|
128
|
+
value.approvalMode !==
|
|
129
|
+
(value.requiredApprovals === 1 ? "single-operator" : "multi-operator") ||
|
|
130
|
+
!/^sha256:[a-f0-9]{64}$/u.test(value.operatorRegistryRecordDigest ?? "") ||
|
|
131
|
+
typeof value.operatorRegistryRecovered !== "boolean"
|
|
132
|
+
) {
|
|
133
|
+
throw new TypeError("operations service descriptor is invalid");
|
|
134
|
+
}
|
|
135
|
+
exact(
|
|
136
|
+
value.transportSecurity,
|
|
137
|
+
TRANSPORT_SECURITY_KEYS,
|
|
138
|
+
"operations transport security",
|
|
139
|
+
);
|
|
140
|
+
const expectedAcl =
|
|
141
|
+
process.platform === "win32"
|
|
142
|
+
? "protected-current-logon-dacl"
|
|
143
|
+
: "unix-owner-mode-0600";
|
|
144
|
+
const expectedPeerIdentity =
|
|
145
|
+
process.platform === "win32"
|
|
146
|
+
? "client-process-token-user-and-logon-sid"
|
|
147
|
+
: "capability-authenticated-client";
|
|
148
|
+
if (
|
|
149
|
+
value.transportSecurity.acl !== expectedAcl ||
|
|
150
|
+
value.transportSecurity.peerIdentity !== expectedPeerIdentity ||
|
|
151
|
+
value.transportSecurity.remoteClients !== false ||
|
|
152
|
+
!/^sha256:[a-f0-9]{64}$/u.test(value.transportSecurity.aclDigest ?? "") ||
|
|
153
|
+
!/^sha256:[a-f0-9]{64}$/u.test(
|
|
154
|
+
value.transportSecurity.principalDigest ?? "",
|
|
155
|
+
)
|
|
156
|
+
) {
|
|
157
|
+
throw new TypeError("operations transport security is invalid");
|
|
158
|
+
}
|
|
159
|
+
for (const [field, maximum] of [
|
|
160
|
+
["tenantId", 256],
|
|
161
|
+
["authorizationStreamId", 256],
|
|
162
|
+
["policyId", 256],
|
|
163
|
+
["operatorRegistryStreamId", 256],
|
|
164
|
+
]) {
|
|
165
|
+
text(value[field], `operations descriptor ${field}`, maximum);
|
|
166
|
+
}
|
|
167
|
+
if (
|
|
168
|
+
!Array.isArray(value.operators) ||
|
|
169
|
+
utilTypes.isProxy(value.operators) ||
|
|
170
|
+
Object.getPrototypeOf(value.operators) !== Array.prototype ||
|
|
171
|
+
value.operators.length !== value.operatorCount ||
|
|
172
|
+
Reflect.ownKeys(value.operators).length !== value.operators.length + 1
|
|
173
|
+
) {
|
|
174
|
+
throw new TypeError("operations descriptor operators are invalid");
|
|
175
|
+
}
|
|
176
|
+
const operatorIds = new Set();
|
|
177
|
+
const keyIds = new Set();
|
|
178
|
+
let previous = null;
|
|
179
|
+
for (const operator of value.operators) {
|
|
180
|
+
exact(operator, OPERATOR_KEYS, "operations descriptor operator");
|
|
181
|
+
if (
|
|
182
|
+
!ID.test(operator.operatorId ?? "") ||
|
|
183
|
+
!KEY_ID.test(operator.keyId ?? "") ||
|
|
184
|
+
operatorIds.has(operator.operatorId) ||
|
|
185
|
+
keyIds.has(operator.keyId) ||
|
|
186
|
+
(previous !== null && previous.localeCompare(operator.operatorId) >= 0)
|
|
187
|
+
) {
|
|
188
|
+
throw new TypeError("operations descriptor operators are invalid");
|
|
189
|
+
}
|
|
190
|
+
operatorIds.add(operator.operatorId);
|
|
191
|
+
keyIds.add(operator.keyId);
|
|
192
|
+
previous = operator.operatorId;
|
|
193
|
+
}
|
|
194
|
+
const policyCore = {
|
|
195
|
+
tenantId: value.tenantId,
|
|
196
|
+
policyId: value.policyId,
|
|
197
|
+
revision: value.revision,
|
|
198
|
+
requiredApprovals: value.requiredApprovals,
|
|
199
|
+
operators: value.operators,
|
|
200
|
+
};
|
|
201
|
+
const expectedPolicyDigest = `sha256:${createHash("sha256")
|
|
202
|
+
.update("chainlesschain.attestor-trust-operations-policy/v1")
|
|
203
|
+
.update("\0")
|
|
204
|
+
.update(canonical(policyCore))
|
|
205
|
+
.digest("hex")}`;
|
|
206
|
+
if (value.policyDigest !== expectedPolicyDigest) {
|
|
207
|
+
throw new TypeError("operations descriptor policy digest is invalid");
|
|
208
|
+
}
|
|
209
|
+
const capability = normalizeGovernedSkillSynthesisAttestorTrustIpcCapability({
|
|
210
|
+
capability: value.capability,
|
|
211
|
+
maxUsesLimit: MAX_REQUESTS,
|
|
212
|
+
now,
|
|
213
|
+
service: CAPABILITY_SERVICE,
|
|
214
|
+
token: capabilityToken,
|
|
215
|
+
});
|
|
216
|
+
const cloned = structuredClone(value);
|
|
217
|
+
for (const operator of cloned.operators) Object.freeze(operator);
|
|
218
|
+
Object.freeze(cloned.operators);
|
|
219
|
+
cloned.capability = capability;
|
|
220
|
+
cloned.transportSecurity = Object.freeze({ ...cloned.transportSecurity });
|
|
221
|
+
return Object.freeze(cloned);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function callService({
|
|
225
|
+
target,
|
|
226
|
+
capability,
|
|
227
|
+
capabilityToken,
|
|
228
|
+
timeoutMs,
|
|
229
|
+
action,
|
|
230
|
+
payload,
|
|
231
|
+
now,
|
|
232
|
+
}) {
|
|
233
|
+
return new Promise((resolve, reject) => {
|
|
234
|
+
const currentTime = Number(now());
|
|
235
|
+
if (
|
|
236
|
+
!Number.isFinite(currentTime) ||
|
|
237
|
+
currentTime >= Date.parse(capability.expiresAt)
|
|
238
|
+
) {
|
|
239
|
+
const error = new Error("attestor trust operations capability expired");
|
|
240
|
+
error.code = "CC_ATTESTOR_TRUST_OPERATIONS_CAPABILITY_EXPIRED";
|
|
241
|
+
reject(error);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const socket = net.connect(target);
|
|
245
|
+
const requestId = randomBytes(16).toString("hex");
|
|
246
|
+
const authorization =
|
|
247
|
+
createGovernedSkillSynthesisAttestorTrustIpcAuthorization({
|
|
248
|
+
action,
|
|
249
|
+
capabilityId: capability.id,
|
|
250
|
+
clientProcessId: process.pid,
|
|
251
|
+
payload,
|
|
252
|
+
requestId,
|
|
253
|
+
schema: GOVERNED_SKILL_SYNTHESIS_ATTESTOR_TRUST_OPERATIONS_IPC_SCHEMA,
|
|
254
|
+
token: capabilityToken,
|
|
255
|
+
});
|
|
256
|
+
let carry = "";
|
|
257
|
+
let settled = false;
|
|
258
|
+
const finish = (error, value) => {
|
|
259
|
+
if (settled) return;
|
|
260
|
+
settled = true;
|
|
261
|
+
clearTimeout(timer);
|
|
262
|
+
socket.destroy();
|
|
263
|
+
if (error) reject(error);
|
|
264
|
+
else resolve(value);
|
|
265
|
+
};
|
|
266
|
+
const timer = setTimeout(() => {
|
|
267
|
+
const error = new Error(
|
|
268
|
+
`attestor trust operations service timed out after ${timeoutMs}ms`,
|
|
269
|
+
);
|
|
270
|
+
error.code = "CC_ATTESTOR_TRUST_OPERATIONS_TIMEOUT";
|
|
271
|
+
finish(error);
|
|
272
|
+
}, timeoutMs);
|
|
273
|
+
timer.unref?.();
|
|
274
|
+
socket.once("connect", () => {
|
|
275
|
+
socket.write(
|
|
276
|
+
`${JSON.stringify({
|
|
277
|
+
schema: GOVERNED_SKILL_SYNTHESIS_ATTESTOR_TRUST_OPERATIONS_IPC_SCHEMA,
|
|
278
|
+
requestId,
|
|
279
|
+
capabilityId: capability.id,
|
|
280
|
+
clientProcessId: process.pid,
|
|
281
|
+
authorization,
|
|
282
|
+
action,
|
|
283
|
+
payload,
|
|
284
|
+
})}\n`,
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
socket.on("data", (chunk) => {
|
|
288
|
+
carry += chunk.toString("utf8");
|
|
289
|
+
if (Buffer.byteLength(carry, "utf8") > MAX_FRAME_BYTES) {
|
|
290
|
+
finish(
|
|
291
|
+
new Error("operations service response exceeded its byte limit"),
|
|
292
|
+
);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const newline = carry.indexOf("\n");
|
|
296
|
+
if (newline === -1) return;
|
|
297
|
+
if (carry.slice(newline + 1).trim().length > 0) {
|
|
298
|
+
finish(new Error("operations service returned multiple records"));
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
const response = JSON.parse(
|
|
303
|
+
carry.slice(0, newline).replace(/\r$/u, ""),
|
|
304
|
+
);
|
|
305
|
+
if (
|
|
306
|
+
!response ||
|
|
307
|
+
typeof response !== "object" ||
|
|
308
|
+
Array.isArray(response) ||
|
|
309
|
+
response.requestId !== requestId ||
|
|
310
|
+
typeof response.ok !== "boolean"
|
|
311
|
+
) {
|
|
312
|
+
throw new Error("operations service response binding is invalid");
|
|
313
|
+
}
|
|
314
|
+
exact(
|
|
315
|
+
response,
|
|
316
|
+
response.ok === true
|
|
317
|
+
? new Set(["ok", "requestId", "result"])
|
|
318
|
+
: new Set(["code", "ok", "requestId"]),
|
|
319
|
+
"operations service response",
|
|
320
|
+
);
|
|
321
|
+
if (response.ok !== true) {
|
|
322
|
+
const error = new Error(
|
|
323
|
+
`attestor trust operations request denied: ${String(response.code ?? "unknown")}`,
|
|
324
|
+
);
|
|
325
|
+
error.code = "CC_ATTESTOR_TRUST_OPERATIONS_DENIED";
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
if (!Object.hasOwn(response, "result")) {
|
|
329
|
+
throw new Error("operations service response omitted its result");
|
|
330
|
+
}
|
|
331
|
+
finish(null, response.result);
|
|
332
|
+
} catch (error) {
|
|
333
|
+
finish(error);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
socket.once("error", (error) => finish(error));
|
|
337
|
+
socket.once("close", () => {
|
|
338
|
+
if (!settled)
|
|
339
|
+
finish(new Error("operations service closed without a response"));
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export function createGovernedSkillSynthesisAttestorTrustOperationsClient(
|
|
345
|
+
options = {},
|
|
346
|
+
) {
|
|
347
|
+
const normalizedOptions = Object.hasOwn(options, "now")
|
|
348
|
+
? options
|
|
349
|
+
: { ...options, now: Date.now };
|
|
350
|
+
exact(normalizedOptions, OPTION_KEYS, "operations client options");
|
|
351
|
+
const target = endpoint(normalizedOptions.endpoint);
|
|
352
|
+
const capabilityToken = text(
|
|
353
|
+
normalizedOptions.capabilityToken,
|
|
354
|
+
"operations capabilityToken",
|
|
355
|
+
);
|
|
356
|
+
if (capabilityToken.length < 32) {
|
|
357
|
+
throw new TypeError("operations capabilityToken is invalid");
|
|
358
|
+
}
|
|
359
|
+
if (
|
|
360
|
+
typeof normalizedOptions.now !== "function" ||
|
|
361
|
+
utilTypes.isProxy(normalizedOptions.now)
|
|
362
|
+
) {
|
|
363
|
+
throw new TypeError("operations client clock is invalid");
|
|
364
|
+
}
|
|
365
|
+
const currentTime = Number(normalizedOptions.now());
|
|
366
|
+
if (!Number.isFinite(currentTime)) {
|
|
367
|
+
throw new TypeError("operations client clock is invalid");
|
|
368
|
+
}
|
|
369
|
+
const serviceDescriptor = normalizeDescriptor(
|
|
370
|
+
normalizedOptions.descriptor,
|
|
371
|
+
capabilityToken,
|
|
372
|
+
currentTime,
|
|
373
|
+
);
|
|
374
|
+
const timeoutMs = Number(normalizedOptions.timeoutMs);
|
|
375
|
+
if (
|
|
376
|
+
!Number.isSafeInteger(timeoutMs) ||
|
|
377
|
+
timeoutMs < 1_000 ||
|
|
378
|
+
timeoutMs > 30_000
|
|
379
|
+
) {
|
|
380
|
+
throw new TypeError("operations client timeoutMs is invalid");
|
|
381
|
+
}
|
|
382
|
+
const descriptor = Object.freeze({
|
|
383
|
+
schema: GOVERNED_SKILL_SYNTHESIS_ATTESTOR_TRUST_OPERATIONS_CLIENT_SCHEMA,
|
|
384
|
+
isolation: "external-service",
|
|
385
|
+
transport: "local-ipc-v3",
|
|
386
|
+
endpointDigest: `sha256:${createHash("sha256")
|
|
387
|
+
.update(target, "utf8")
|
|
388
|
+
.digest("hex")}`,
|
|
389
|
+
requestTimeoutMs: timeoutMs,
|
|
390
|
+
service: serviceDescriptor,
|
|
391
|
+
});
|
|
392
|
+
const client = Object.freeze({
|
|
393
|
+
descriptor,
|
|
394
|
+
prepare(input) {
|
|
395
|
+
return callService({
|
|
396
|
+
target,
|
|
397
|
+
capability: serviceDescriptor.capability,
|
|
398
|
+
capabilityToken,
|
|
399
|
+
timeoutMs,
|
|
400
|
+
action: "prepare",
|
|
401
|
+
payload: input,
|
|
402
|
+
now: normalizedOptions.now,
|
|
403
|
+
});
|
|
404
|
+
},
|
|
405
|
+
execute({ request, approvals } = {}) {
|
|
406
|
+
return callService({
|
|
407
|
+
target,
|
|
408
|
+
capability: serviceDescriptor.capability,
|
|
409
|
+
capabilityToken,
|
|
410
|
+
timeoutMs,
|
|
411
|
+
action: "execute",
|
|
412
|
+
payload: { request, approvals },
|
|
413
|
+
now: normalizedOptions.now,
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
prepareOperatorChange(input) {
|
|
417
|
+
return callService({
|
|
418
|
+
target,
|
|
419
|
+
capability: serviceDescriptor.capability,
|
|
420
|
+
capabilityToken,
|
|
421
|
+
timeoutMs,
|
|
422
|
+
action: "operator-prepare",
|
|
423
|
+
payload: input,
|
|
424
|
+
now: normalizedOptions.now,
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
executeOperatorChange({ request, approvals } = {}) {
|
|
428
|
+
return callService({
|
|
429
|
+
target,
|
|
430
|
+
capability: serviceDescriptor.capability,
|
|
431
|
+
capabilityToken,
|
|
432
|
+
timeoutMs,
|
|
433
|
+
action: "operator-execute",
|
|
434
|
+
payload: { request, approvals },
|
|
435
|
+
now: normalizedOptions.now,
|
|
436
|
+
});
|
|
437
|
+
},
|
|
438
|
+
});
|
|
439
|
+
CLIENTS.add(client);
|
|
440
|
+
return client;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export function isGovernedSkillSynthesisAttestorTrustOperationsClient(value) {
|
|
444
|
+
return CLIENTS.has(value);
|
|
445
|
+
}
|