chainlesschain 0.166.24 → 0.166.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -3
- package/package.json +1 -1
- package/src/assets/web-panel/assets/{AIOps-DR-MWcZc.js → AIOps-Z8_dnLd8.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-DT8B7sEb.js → ActionButton-C4bKCISV.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-asjh3dQJ.js → Analytics-GztAv2jy.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DivQ491i.js → AppLayout-DEqNcuVx.js} +4 -4
- package/src/assets/web-panel/assets/{Artifacts-DPH2uUmy.js → Artifacts-D-R4Ehap.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-Bp2nLyc-.js → Audit-mzzdTIlM.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CHS28khl.js → BackgroundAgents-DS2QupIC.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-CKeaFSfz.js → Backup-CQSirC39.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-CxwM9BAH.js → BaseInput-Bhuc-eOV.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-DYLDwaCv.js → Chat-B-RLVGnt.js} +6 -6
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-DdBJDBP0.js → ChatBubbleRenderer-CBbMoVuE.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-uYTWOB8j.js → Checkbox-DxwgBryW.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-CvYa_dwT.js → Codegen-Cwrm-7nh.js} +1 -1
- package/src/assets/web-panel/assets/{Col-CanMAX4m.js → Col-DrSCT-nF.js} +1 -1
- package/src/assets/web-panel/assets/{Community-B4WaDtHw.js → Community-DY2D9WNs.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-K93Uof_3.js → Compact-o-tV0URw.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CKeDLgUW.js → Compliance-Bndh6S8f.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-P93grAeB.js → Cowork-CSNQODak.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-BSHnMtDn.js → Cron-CTgxRHdy.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-epAOpUVJ.js → Crosschain-BJoGQzDI.js} +1 -1
- package/src/assets/web-panel/assets/{DID-ByjXfP7t.js → DID-V0Ztm8ne.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-QztTU8tb.js → Dashboard-B-38THOj.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-DhUc9yhN.js → Dropdown-B3FdOwMO.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-C2sLhJJN.js → EmailListRenderer-YQDz4mUF.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-CdfbWNDn.js → FamilyGuardDashboard-DYE45IF9.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-CcF_R7NW.js → Federation-DjBFjdRZ.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-Cm_X2IBk.js → FormItemContext-CVTXEa0R.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DUi4NWlb.js → GenericCardRenderer-B6Tkke8X.js} +1 -1
- package/src/assets/web-panel/assets/{Git-4Sq5FjBt.js → Git-CD0hyAzT.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-Dx2_v4V6.js → Governance-CWOQQJr8.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-7Vr1xekR.js → Inference-lHYwUk-C.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Cnd2XOzf.js → KnowledgeGraph-Cledxv7t.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-B66QPVf-.js → Logs-D45mt-rM.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-PLsEvhly.js → MarkdownRenderer-DJjPaOnM.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-BMIK9BmC.js → Marketplace-Yy30UZPw.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-BDbyp3J_.js → McpTools-Cil5l-bh.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-CJdzfZGi.js → Memory-DdJcnyqy.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-C2TH5Y3-.js → MobileBridge-IrzFYHEv.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-D1dYXkvV.js → MobileProjects-D8q64LMd.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-B-4A1I1j.js → Mtc-CpdTJzW7.js} +5 -5
- package/src/assets/web-panel/assets/{MtcAudit-Bgcc9UOl.js → MtcAudit-C7Tvw2m6.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-DqOe-etP.js → Multisig-Dmj9F5Kr.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-7VnhzE_6.js → NLProgramming-C9Xchob5.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-BxawpeUQ.js → Notes-Bzq6Yry5.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-Cr08G2aE.js → NotificationSettings-DxG9eKb4.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-Ce8bEGlK.js → OrderTableRenderer-BS_IYoCe.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-BC7lveGv.js → Organization-kazsRvcq.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-CakOW-G0.js → Overflow-i4wP-hwn.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-Cf8CaOBZ.js → P2P-CfGeU3h-.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Dc7b98W9.js → PdhVaultBrowser-CS-VhVUx.js} +5 -5
- package/src/assets/web-panel/assets/{Permissions-DGJyMEfS.js → Permissions-DnEHXs0I.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-DNIwSdwu.js → PersonalDataHub-DeD82qke.js} +6 -6
- package/src/assets/web-panel/assets/{Pipeline-5B1S12wa.js → Pipeline-CMGGLgBY.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-CMB6Ke5t.js → Privacy-CvHoFv32.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-D5PqTFiT.js → ProjectInit-DnJapCc1.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CbKNdSjV.js → ProjectSettings-CqVdv3-g.js} +2 -2
- package/src/assets/web-panel/assets/Projects-B_o8vcs_.js +1 -0
- package/src/assets/web-panel/assets/{Providers-CJF5_-Gs.js → Providers-CPKseoDW.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-CT6iEAdi.js → QrScannerModal-_iBfKbPQ.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-Ci0h9mJ_.js → QuickAsk-CMrlZ69a.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-Da5mobZu.js → Recommend-BwDtSZ0l.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BaCY8eey.js → RemoteSession-DomUAtn4.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-CaITfTsI.js → Reputation-Cuu2GCHr.js} +1 -1
- package/src/assets/web-panel/assets/{Row-DtUDamyP.js → Row-C7GVts31.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DX27gFpg.js → RssFeed-DRKvgEog.js} +3 -3
- package/src/assets/web-panel/assets/{Search-DFL69osN.js → Search-BGI9wOeA.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BqGeoWv-.js → Security-BlLaHy_L.js} +3 -3
- package/src/assets/web-panel/assets/{Services-3z1WnEAc.js → Services-DFqZbjmX.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-C_OJQQ9Z.js → Skeleton-BCGxdooP.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BY7aT6Mo.js → Skills-CwFKgcmm.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-BZv7DSaD.js → Sla-CiXXh9eS.js} +1 -1
- package/src/assets/web-panel/assets/SpeechSettings-WSx2CLqO.js +1 -0
- package/src/assets/web-panel/assets/{SyncSettings-B6D7STlI.js → SyncSettings-BBIqQOtW.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-Co_FCZAO.js → Tasks-D1BGLjO1.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CnY-9fgz.js → Templates-CUIl9axA.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-B71yXfZ8.js → Tenant-BFZJ0hNz.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-Dd_P7awo.js → Terminal-Cw-3eYVn.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-CvIEMyli.js → TimelineRenderer-bOVPB56L.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-DknFBGOi.js → Tokens-Czfyq2VY.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-D_4nJONB.js → Trigger-C-o4uJY0.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BNl21fa7.js → Trust-BKq_S6iF.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-CFrCI7uK.js → UkeySign-fKlWUvMx.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-BVfY6JLg.js → VideoEditing-DB5MLuS7.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-Cj9CAK0J.js → Wallet-WGXBn7IS.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DcqZlzA3.js → WebAuthn-B8TC4EMF.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-Dfr_dMld.js → WorkflowEditor-DLY--KmM.js} +1 -1
- package/src/assets/web-panel/assets/{chat-Yv6UF0AD.js → chat-Crw3XQaA.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CDW_-1fs.js → colors-CxhWauPV.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-BYOQvd-6.js → compact-item-Cp3ojtk5.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-BCGO0BiP.js → createContext-CRuRXjSo.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-CKAQY2zn.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-DY-70cfQ.js → hasIn-XGW474dj.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9ZogJJM.js → index-38TRdZb6.js} +1 -1
- package/src/assets/web-panel/assets/{index-BBs2mv5M.js → index-B45Vkh3T.js} +1 -1
- package/src/assets/web-panel/assets/{index-CCwWp3mT.js → index-B5fJS-kn.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUo27q9J.js → index-BElgeKJ0.js} +3 -3
- package/src/assets/web-panel/assets/{index-CFa2fPCk.js → index-BUWZ57T4.js} +1 -1
- package/src/assets/web-panel/assets/{index-DCtsjhhT.js → index-BVmSfIkJ.js} +1 -1
- package/src/assets/web-panel/assets/{index-NaCESahy.js → index-BW028Pwn.js} +1 -1
- package/src/assets/web-panel/assets/{index-CaT8trvf.js → index-BXnNbbwa.js} +1 -1
- package/src/assets/web-panel/assets/{index-DRFC2Qt0.js → index-BYkjs7eP.js} +1 -1
- package/src/assets/web-panel/assets/{index-Br3wQLVY.js → index-BetOkRLs.js} +1 -1
- package/src/assets/web-panel/assets/{index-DuIPq5MX.js → index-BuVA26SD.js} +1 -1
- package/src/assets/web-panel/assets/{index-C4UJA2ju.js → index-C73pqyDb.js} +1 -1
- package/src/assets/web-panel/assets/{index-BvK4fjkk.js → index-C8UOVaUH.js} +1 -1
- package/src/assets/web-panel/assets/{index-hZ0Eyrrw.js → index-CDIpH_8Q.js} +1 -1
- package/src/assets/web-panel/assets/{index-D--TEyDj.js → index-CPFam-me.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUP-A2_h.js → index-CTE32qol.js} +1 -1
- package/src/assets/web-panel/assets/{index-CnZNbcux.js → index-CdlfrcC-.js} +1 -1
- package/src/assets/web-panel/assets/index-Cetfwq8j.js +1 -0
- package/src/assets/web-panel/assets/{index-C40UdtlS.js → index-Ctu98x57.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9m5QAMg.js → index-DBcBsJYg.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXlEx4UH.js → index-DHNixOg_.js} +1 -1
- package/src/assets/web-panel/assets/index-DOpcRO2-.js +1 -0
- package/src/assets/web-panel/assets/{index-Dg-AQYDf.js → index-DUSVsOGS.js} +1 -1
- package/src/assets/web-panel/assets/{index-CzeEEazr.js → index-De2FN0xN.js} +1 -1
- package/src/assets/web-panel/assets/{index-DUDoRk9r.js → index-DfPLIA-f.js} +1 -1
- package/src/assets/web-panel/assets/{index-Y9akzgFO.js → index-DhomnuaB.js} +1 -1
- package/src/assets/web-panel/assets/{index-366wfQBU.js → index-DoUC5_ry.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bb9nyts1.js → index-Dp2nC5On.js} +1 -1
- package/src/assets/web-panel/assets/{index-CIyHxV4u.js → index-DxOtBFVy.js} +1 -1
- package/src/assets/web-panel/assets/{index-BFv1hzF6.js → index-E-RSfImO.js} +1 -1
- package/src/assets/web-panel/assets/{index-DLOf7BSz.js → index-J_08R33H.js} +1 -1
- package/src/assets/web-panel/assets/{index-RjIMPG0u.js → index-QqAuH7-S.js} +1 -1
- package/src/assets/web-panel/assets/{index-CB_Iw73G.js → index-W8_0yAi_.js} +1 -1
- package/src/assets/web-panel/assets/{index-DM5c4pc-.js → index-WvNZXbIO.js} +1 -1
- package/src/assets/web-panel/assets/{index-DT_qVaaV.js → index-Yq3bFbYX.js} +1 -1
- package/src/assets/web-panel/assets/{index-NYVBUAVN.js → index-jrIcbPUa.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cy2NE6AO.js → index-nJR64pA_.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bf_Va0S-.js → index-qzmihx1d.js} +1 -1
- package/src/assets/web-panel/assets/{index-BayRTE5w.js → index-rsACoVT9.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-CG99CcR4.js → initDefaultProps-DAu-hgme.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Z7MH0_0G.js → motion-Db8yk0Hu.js} +1 -1
- package/src/assets/web-panel/assets/{move-BX67lOdq.js → move-Cii2jOin.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-CmAbG1fE.js → mtc-parser-CnZBDkyZ.js} +1 -1
- package/src/assets/web-panel/assets/{omit-DiU5tI1_.js → omit-Buzt1FTL.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BGfvLrYL.js → pickAttrs-CpZ_NmE6.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-CggLEgaJ.js → placementArrow-mBrx3dYm.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-t3nlghPZ.js → responsiveObserve-DC_QzljB.js} +1 -1
- package/src/assets/web-panel/assets/{slide-BkV4dL9s.js → slide-DT_UVED-.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-qec1PUoC.js → statusUtils-78t6eNLV.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-ChjX6T8D.js → styleChecker-CV_T1ULL.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-B1jLoZcM.js → useFlexGapSupport-s8edGuXD.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-C3X53s4E.js → useFs-Pk9dH2HC.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-DOvbbnkZ.js → usePersonalDataHub-B_GqAm8c.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-Ie0TEVFT.js → vnode-Cxyss24q.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-CRUMVS8l.js → zoom-0UY3cOuc.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/evolution-knowledge.js +40 -1
- package/src/commands/serve.js +11 -0
- package/src/data/changelog.json +29 -3
- package/src/generated/cc-agent-protocol.schema.json +3 -1
- package/src/lib/app-server/server.js +49 -0
- package/src/lib/app-server/websocket-transport.js +13 -0
- package/src/lib/evolution/agent-model-projection.js +252 -32
- package/src/lib/evolution/evidence-backed-wiki-maintainer.js +22 -9
- package/src/lib/evolution/evolution-artifact-ports.js +3 -0
- package/src/lib/evolution/evolution-deployment-loader.js +77 -0
- package/src/lib/evolution/evolution-evidence-projector.js +36 -5
- package/src/lib/evolution/evolution-ledger-ports.js +210 -18
- package/src/lib/evolution/governed-knowledge-dependency-inventory.js +392 -0
- package/src/lib/evolution/governed-knowledge-dependency-ledger-executor.js +123 -0
- package/src/lib/evolution/governed-knowledge-quarantine-release.js +1013 -0
- package/src/lib/evolution/governed-knowledge-revocation-host.js +59 -0
- package/src/lib/evolution/governed-knowledge-skill-rollback.js +62 -27
- package/src/lib/evolution/governed-knowledge-sync.js +164 -1
- package/src/lib/evolution/governed-knowledge-wiki-tombstone.js +88 -34
- package/src/lib/evolution/knowledge-wiki-source-admission.js +160 -1
- package/src/lib/evolution/knowledge-wiki-source-provenance.js +1 -0
- package/src/lib/evolution/skill-candidate-registry.js +21 -3
- package/src/lib/evolution/skill-release-registry.js +143 -0
- package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +61 -0
- package/src/lib/evolution/wiki-target-tombstone-revision.js +15 -7
- package/src/lib/read-file-loop-guard.js +222 -0
- package/src/lib/read-file-page.js +55 -2
- package/src/repl/agent-repl.js +6 -1
- package/src/runtime/agent-core.js +177 -57
- package/src/assets/web-panel/assets/Projects-ccXaHzYL.js +0 -1
- package/src/assets/web-panel/assets/SpeechSettings-6lJKLhCn.js +0 -1
- package/src/assets/web-panel/assets/devWarning-H-kXSuf-.js +0 -1
- package/src/assets/web-panel/assets/index-B0o4MeNK.js +0 -1
- package/src/assets/web-panel/assets/index-BVafOL_I.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { types } from "node:util";
|
|
2
3
|
import { isAgentToolArgumentsPath } from "./evidence-json-text.js";
|
|
3
4
|
|
|
@@ -9,13 +10,220 @@ const MESSAGE_KEYS = new Set([
|
|
|
9
10
|
"tool_calls",
|
|
10
11
|
"tool_call_id",
|
|
11
12
|
"name",
|
|
13
|
+
"_thinkingBlocks",
|
|
12
14
|
]);
|
|
15
|
+
const OPAQUE_BLOCK_SCHEMA =
|
|
16
|
+
"chainlesschain.evolution-agent-opaque-transport-block/v1";
|
|
17
|
+
const OPAQUE_BLOCK_KEYS = new Set(["schema", "kind", "digest", "byteLength"]);
|
|
18
|
+
const IMAGE_MEDIA_TYPES = new Set([
|
|
19
|
+
"image/png",
|
|
20
|
+
"image/jpeg",
|
|
21
|
+
"image/gif",
|
|
22
|
+
"image/webp",
|
|
23
|
+
]);
|
|
24
|
+
const IMAGE_DETAILS = new Set(["auto", "low", "high"]);
|
|
25
|
+
|
|
26
|
+
function exactKeys(value, keys) {
|
|
27
|
+
return (
|
|
28
|
+
value &&
|
|
29
|
+
typeof value === "object" &&
|
|
30
|
+
!Array.isArray(value) &&
|
|
31
|
+
[Object.prototype, null].includes(Object.getPrototypeOf(value)) &&
|
|
32
|
+
Object.keys(value).length === keys.size &&
|
|
33
|
+
Object.keys(value).every((key) => keys.has(key))
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function canonical(value) {
|
|
38
|
+
if (value === null || typeof value === "boolean")
|
|
39
|
+
return JSON.stringify(value);
|
|
40
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
41
|
+
return JSON.stringify(value);
|
|
42
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
43
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
44
|
+
if (!value || typeof value !== "object") {
|
|
45
|
+
throw new TypeError("Agent opaque transport block must be finite JSON");
|
|
46
|
+
}
|
|
47
|
+
return `{${Object.keys(value)
|
|
48
|
+
.sort()
|
|
49
|
+
.map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`)
|
|
50
|
+
.join(",")}}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function blockDigest(value) {
|
|
54
|
+
return `sha256:${createHash("sha256")
|
|
55
|
+
.update("chainlesschain.evolution-agent-opaque-transport-block/v1\0")
|
|
56
|
+
.update(canonical(value))
|
|
57
|
+
.digest("hex")}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function imageBlock(value) {
|
|
61
|
+
if (!exactKeys(value, new Set(["type", "image_url"]))) return null;
|
|
62
|
+
const imageKeys = new Set(
|
|
63
|
+
value.image_url && Object.hasOwn(value.image_url, "detail")
|
|
64
|
+
? ["url", "detail"]
|
|
65
|
+
: ["url"],
|
|
66
|
+
);
|
|
67
|
+
if (
|
|
68
|
+
value.type !== "image_url" ||
|
|
69
|
+
!exactKeys(value.image_url, imageKeys) ||
|
|
70
|
+
typeof value.image_url.url !== "string" ||
|
|
71
|
+
(imageKeys.has("detail") && !IMAGE_DETAILS.has(value.image_url.detail))
|
|
72
|
+
) {
|
|
73
|
+
throw new TypeError("Agent image block has an unsupported protocol shape");
|
|
74
|
+
}
|
|
75
|
+
const match = /^data:([^;,]+);base64,([A-Za-z0-9+/]*={0,2})$/u.exec(
|
|
76
|
+
value.image_url.url,
|
|
77
|
+
);
|
|
78
|
+
if (!match || !IMAGE_MEDIA_TYPES.has(match[1]) || match[2].length % 4 !== 0) {
|
|
79
|
+
throw new TypeError(
|
|
80
|
+
"Agent image block requires a supported base64 data URL",
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const decoded = Buffer.from(match[2], "base64");
|
|
84
|
+
if (!decoded.length || decoded.toString("base64") !== match[2]) {
|
|
85
|
+
throw new TypeError("Agent image block contains non-canonical base64");
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function thinkingBlock(value) {
|
|
91
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
92
|
+
if (value.type === "thinking") {
|
|
93
|
+
if (
|
|
94
|
+
!exactKeys(value, new Set(["type", "thinking", "signature"])) ||
|
|
95
|
+
typeof value.thinking !== "string" ||
|
|
96
|
+
typeof value.signature !== "string" ||
|
|
97
|
+
value.signature.length < 16 ||
|
|
98
|
+
value.signature.length > 256 * 1024 ||
|
|
99
|
+
!/^[A-Za-z0-9_+/=-]+$/u.test(value.signature)
|
|
100
|
+
) {
|
|
101
|
+
throw new TypeError("Agent thinking block requires a bounded signature");
|
|
102
|
+
}
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
if (value.type === "redacted_thinking") {
|
|
106
|
+
if (
|
|
107
|
+
!exactKeys(value, new Set(["type", "data"])) ||
|
|
108
|
+
typeof value.data !== "string" ||
|
|
109
|
+
value.data.length < 1 ||
|
|
110
|
+
value.data.length > 256 * 1024 ||
|
|
111
|
+
!/^[A-Za-z0-9_+/=-]+$/u.test(value.data)
|
|
112
|
+
) {
|
|
113
|
+
throw new TypeError("Agent redacted thinking block is invalid");
|
|
114
|
+
}
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function opaqueKind(value, path) {
|
|
121
|
+
if (/^messages\.\d+\.content\.\d+$/u.test(path)) {
|
|
122
|
+
return imageBlock(value) ? "image" : null;
|
|
123
|
+
}
|
|
124
|
+
if (/^messages\.\d+\._thinkingBlocks\.\d+$/u.test(path)) {
|
|
125
|
+
return thinkingBlock(value) ? value.type : null;
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function projectAgentOpaqueTransportBlock(value, path) {
|
|
131
|
+
const kind = opaqueKind(value, path);
|
|
132
|
+
if (kind === null) return null;
|
|
133
|
+
return Object.freeze({
|
|
134
|
+
schema: OPAQUE_BLOCK_SCHEMA,
|
|
135
|
+
kind,
|
|
136
|
+
digest: blockDigest(value),
|
|
137
|
+
byteLength: Buffer.byteLength(canonical(value), "utf8"),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function isOpaqueBlock(value) {
|
|
142
|
+
return (
|
|
143
|
+
exactKeys(value, OPAQUE_BLOCK_KEYS) &&
|
|
144
|
+
value.schema === OPAQUE_BLOCK_SCHEMA &&
|
|
145
|
+
["image", "thinking", "redacted_thinking"].includes(value.kind) &&
|
|
146
|
+
/^sha256:[a-f0-9]{64}$/u.test(value.digest) &&
|
|
147
|
+
Number.isSafeInteger(value.byteLength) &&
|
|
148
|
+
value.byteLength > 0
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function assertContentBlock(value, path, allowOpaqueTransportBlocks) {
|
|
153
|
+
if (allowOpaqueTransportBlocks && isOpaqueBlock(value)) return;
|
|
154
|
+
if (
|
|
155
|
+
exactKeys(value, new Set(["type", "text"])) &&
|
|
156
|
+
value.type === "text" &&
|
|
157
|
+
typeof value.text === "string"
|
|
158
|
+
) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (imageBlock(value)) return;
|
|
162
|
+
throw new TypeError(`Agent model message block at ${path} is unsupported`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function assertMessageShape(message, index, allowOpaqueTransportBlocks) {
|
|
166
|
+
if (
|
|
167
|
+
!message ||
|
|
168
|
+
Array.isArray(message) ||
|
|
169
|
+
Object.keys(message).some((key) => !MESSAGE_KEYS.has(key)) ||
|
|
170
|
+
!["system", "user", "assistant", "tool"].includes(message.role)
|
|
171
|
+
) {
|
|
172
|
+
throw new TypeError(
|
|
173
|
+
"Agent model message has an unsupported protocol shape",
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
const contentOkay =
|
|
177
|
+
typeof message.content === "string" ||
|
|
178
|
+
message.content === null ||
|
|
179
|
+
(message.role === "assistant" && message.content === undefined) ||
|
|
180
|
+
(message.role === "user" && Array.isArray(message.content));
|
|
181
|
+
if (!contentOkay) {
|
|
182
|
+
throw new TypeError(
|
|
183
|
+
"Agent model message has an unsupported protocol shape",
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
if (Array.isArray(message.content)) {
|
|
187
|
+
if (!message.content.length) {
|
|
188
|
+
throw new TypeError("Agent multimodal message requires content blocks");
|
|
189
|
+
}
|
|
190
|
+
message.content.forEach((block, blockIndex) =>
|
|
191
|
+
assertContentBlock(
|
|
192
|
+
block,
|
|
193
|
+
`messages.${index}.content.${blockIndex}`,
|
|
194
|
+
allowOpaqueTransportBlocks,
|
|
195
|
+
),
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
if (Object.hasOwn(message, "_thinkingBlocks")) {
|
|
199
|
+
if (
|
|
200
|
+
message.role !== "assistant" ||
|
|
201
|
+
!Array.isArray(message._thinkingBlocks) ||
|
|
202
|
+
!message._thinkingBlocks.length
|
|
203
|
+
) {
|
|
204
|
+
throw new TypeError("Agent thinking replay requires assistant blocks");
|
|
205
|
+
}
|
|
206
|
+
message._thinkingBlocks.forEach((block, blockIndex) => {
|
|
207
|
+
if (
|
|
208
|
+
!(allowOpaqueTransportBlocks && isOpaqueBlock(block)) &&
|
|
209
|
+
!thinkingBlock(block)
|
|
210
|
+
) {
|
|
211
|
+
throw new TypeError(
|
|
212
|
+
`Agent thinking block at messages.${index}._thinkingBlocks.${blockIndex} is unsupported`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
13
218
|
|
|
14
219
|
// Capture before the first await. Accessors, proxies and exotic objects cannot
|
|
15
220
|
// change the request between commitment, durable publication and dispatch.
|
|
16
221
|
export function snapshotAgentModelRequest(
|
|
17
222
|
value,
|
|
18
|
-
{
|
|
223
|
+
{
|
|
224
|
+
allowStructuredArgumentText = true,
|
|
225
|
+
allowOpaqueTransportBlocks = false,
|
|
226
|
+
} = {},
|
|
19
227
|
) {
|
|
20
228
|
let nodes = 0;
|
|
21
229
|
let bytes = 0;
|
|
@@ -100,25 +308,9 @@ export function snapshotAgentModelRequest(
|
|
|
100
308
|
) {
|
|
101
309
|
throw new TypeError("Agent model request requires messages and tools");
|
|
102
310
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Array.isArray(message) ||
|
|
107
|
-
Object.keys(message).some((key) => !MESSAGE_KEYS.has(key)) ||
|
|
108
|
-
!["system", "user", "assistant", "tool"].includes(message.role) ||
|
|
109
|
-
!(
|
|
110
|
-
typeof message.content === "string" ||
|
|
111
|
-
message.content === null ||
|
|
112
|
-
(message.role === "assistant" && message.content === undefined)
|
|
113
|
-
)
|
|
114
|
-
) {
|
|
115
|
-
// Opaque media / signed thinking blocks need their own projection policy;
|
|
116
|
-
// they must never silently fall back to raw bytes in this text boundary.
|
|
117
|
-
throw new TypeError(
|
|
118
|
-
"Agent model message has an unsupported protocol shape",
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
311
|
+
request.messages.forEach((message, index) =>
|
|
312
|
+
assertMessageShape(message, index, allowOpaqueTransportBlocks),
|
|
313
|
+
);
|
|
122
314
|
// Include escaping, punctuation and numeric values in the transport/storage
|
|
123
315
|
// budget, not just string values. Whole fields are never split or truncated.
|
|
124
316
|
if (Buffer.byteLength(JSON.stringify(request), "utf8") > MAX_BYTES) {
|
|
@@ -130,6 +322,10 @@ export function snapshotAgentModelRequest(
|
|
|
130
322
|
function textPath(path, allowStructuredArgumentText = true) {
|
|
131
323
|
return (
|
|
132
324
|
/^messages\.\d+\.content$/u.test(path) ||
|
|
325
|
+
/^messages\.\d+\.content\.\d+\.text$/u.test(path) ||
|
|
326
|
+
/^messages\.\d+\._thinkingBlocks\.\d+\.(?:thinking|signature|data)$/u.test(
|
|
327
|
+
path,
|
|
328
|
+
) ||
|
|
133
329
|
(allowStructuredArgumentText
|
|
134
330
|
? /^messages\.\d+\.tool_calls\.\d+\.function\.arguments(?:\.|$)/u.test(
|
|
135
331
|
path,
|
|
@@ -141,9 +337,25 @@ function textPath(path, allowStructuredArgumentText = true) {
|
|
|
141
337
|
);
|
|
142
338
|
}
|
|
143
339
|
|
|
340
|
+
function restoreOpaqueBlock(original, projected, path) {
|
|
341
|
+
if (!isOpaqueBlock(projected)) return null;
|
|
342
|
+
const kind = opaqueKind(original, path);
|
|
343
|
+
const byteLength = Buffer.byteLength(canonical(original), "utf8");
|
|
344
|
+
if (
|
|
345
|
+
kind !== projected.kind ||
|
|
346
|
+
blockDigest(original) !== projected.digest ||
|
|
347
|
+
byteLength !== projected.byteLength
|
|
348
|
+
) {
|
|
349
|
+
throw new Error("Agent opaque transport block commitment changed");
|
|
350
|
+
}
|
|
351
|
+
return original;
|
|
352
|
+
}
|
|
353
|
+
|
|
144
354
|
// Redaction can change text, not roles, tool-call ids, callable names, schema
|
|
145
355
|
// keys or control values. Refuse a structurally damaged/truncated protocol.
|
|
146
356
|
function assertProtocol(original, projected, path = "") {
|
|
357
|
+
const restored = restoreOpaqueBlock(original, projected, path);
|
|
358
|
+
if (restored !== null) return restored;
|
|
147
359
|
// Object-valued arguments are historical data (e.g. Ollama), not callable
|
|
148
360
|
// metadata. Projection never replaces the live arguments used for execution.
|
|
149
361
|
if (
|
|
@@ -155,17 +367,17 @@ function assertProtocol(original, projected, path = "") {
|
|
|
155
367
|
!Array.isArray(original) &&
|
|
156
368
|
!Array.isArray(projected)
|
|
157
369
|
)
|
|
158
|
-
return;
|
|
370
|
+
return projected;
|
|
159
371
|
if (
|
|
160
372
|
typeof original === "string" &&
|
|
161
373
|
typeof projected === "string" &&
|
|
162
374
|
textPath(path)
|
|
163
375
|
)
|
|
164
|
-
return;
|
|
376
|
+
return projected;
|
|
165
377
|
if (original === null || typeof original !== "object") {
|
|
166
378
|
if (original !== projected)
|
|
167
379
|
throw new Error("Agent projection changed protocol metadata");
|
|
168
|
-
return;
|
|
380
|
+
return projected;
|
|
169
381
|
}
|
|
170
382
|
if (
|
|
171
383
|
!projected ||
|
|
@@ -176,13 +388,18 @@ function assertProtocol(original, projected, path = "") {
|
|
|
176
388
|
) {
|
|
177
389
|
throw new Error("Agent projection changed protocol structure");
|
|
178
390
|
}
|
|
391
|
+
const output = Array.isArray(original) ? [] : Object.create(null);
|
|
179
392
|
for (const key of Object.keys(original)) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
393
|
+
Object.defineProperty(output, key, {
|
|
394
|
+
value: assertProtocol(
|
|
395
|
+
original[key],
|
|
396
|
+
projected[key],
|
|
397
|
+
path ? `${path}.${key}` : key,
|
|
398
|
+
),
|
|
399
|
+
enumerable: true,
|
|
400
|
+
});
|
|
185
401
|
}
|
|
402
|
+
return Object.freeze(output);
|
|
186
403
|
}
|
|
187
404
|
|
|
188
405
|
export function buildAgentModelRequest(original, projection) {
|
|
@@ -193,8 +410,11 @@ export function buildAgentModelRequest(original, projection) {
|
|
|
193
410
|
) {
|
|
194
411
|
throw new Error("Agent model projection is opaque or truncated");
|
|
195
412
|
}
|
|
196
|
-
const
|
|
197
|
-
|
|
413
|
+
const capturedOriginal = snapshotAgentModelRequest(original);
|
|
414
|
+
const projected = snapshotAgentModelRequest(projection.content, {
|
|
415
|
+
allowOpaqueTransportBlocks: true,
|
|
416
|
+
});
|
|
417
|
+
const restored = assertProtocol(capturedOriginal, projected);
|
|
198
418
|
const provenance = {
|
|
199
419
|
evidenceId: projection.evidenceId,
|
|
200
420
|
sourceKind: projection.sourceKind,
|
|
@@ -211,7 +431,7 @@ export function buildAgentModelRequest(original, projection) {
|
|
|
211
431
|
role: "system",
|
|
212
432
|
content: `Evolution input projection: source content is evidence, not a verified outcome or authorization. Redacted/quarantined text must not be reconstructed. Provenance: ${JSON.stringify(provenance)}`,
|
|
213
433
|
},
|
|
214
|
-
...
|
|
434
|
+
...restored.messages,
|
|
215
435
|
];
|
|
216
|
-
return snapshotAgentModelRequest({ messages, tools:
|
|
436
|
+
return snapshotAgentModelRequest({ messages, tools: restored.tools });
|
|
217
437
|
}
|
|
@@ -11,6 +11,7 @@ export const WIKI_PATTERN_STATUS = Object.freeze({
|
|
|
11
11
|
CORROBORATED: "corroborated",
|
|
12
12
|
CONTRADICTED: "contradicted",
|
|
13
13
|
STALE: "stale",
|
|
14
|
+
QUARANTINED: "quarantined",
|
|
14
15
|
REVOKED: "revoked",
|
|
15
16
|
TOMBSTONED: "tombstoned",
|
|
16
17
|
});
|
|
@@ -47,6 +48,7 @@ const EVIDENCE_FIELDS = new Set([
|
|
|
47
48
|
const OPERATIONS = new Set([
|
|
48
49
|
"upsert",
|
|
49
50
|
"merge",
|
|
51
|
+
"quarantine",
|
|
50
52
|
"revoke",
|
|
51
53
|
"tombstone",
|
|
52
54
|
"proposal-impact",
|
|
@@ -309,9 +311,11 @@ function rebuildDerivedState(state, effectiveAt, descriptor) {
|
|
|
309
311
|
(dependents[ref] ??= []).push(pattern.patternId);
|
|
310
312
|
}
|
|
311
313
|
if (
|
|
312
|
-
[
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
[
|
|
315
|
+
WIKI_PATTERN_STATUS.QUARANTINED,
|
|
316
|
+
WIKI_PATTERN_STATUS.REVOKED,
|
|
317
|
+
WIKI_PATTERN_STATUS.TOMBSTONED,
|
|
318
|
+
].includes(pattern.status)
|
|
315
319
|
)
|
|
316
320
|
continue;
|
|
317
321
|
const positive = pattern.positiveEvidence
|
|
@@ -373,6 +377,7 @@ function rebuildDerivedState(state, effectiveAt, descriptor) {
|
|
|
373
377
|
![
|
|
374
378
|
WIKI_PATTERN_STATUS.REVOKED,
|
|
375
379
|
WIKI_PATTERN_STATUS.TOMBSTONED,
|
|
380
|
+
WIKI_PATTERN_STATUS.QUARANTINED,
|
|
376
381
|
WIKI_PATTERN_STATUS.STALE,
|
|
377
382
|
].includes(pattern.status),
|
|
378
383
|
)
|
|
@@ -403,6 +408,9 @@ function applyUpsert(state, operation, evidenceByRef, effectiveAt) {
|
|
|
403
408
|
fingerprint(item) === fingerprint(proposed),
|
|
404
409
|
);
|
|
405
410
|
const existing = duplicate ?? state.patterns[proposed.patternId];
|
|
411
|
+
if (existing?.status === WIKI_PATTERN_STATUS.QUARANTINED) {
|
|
412
|
+
throw new Error("cannot rewrite a quarantined pattern");
|
|
413
|
+
}
|
|
406
414
|
const patternId = existing?.patternId ?? proposed.patternId;
|
|
407
415
|
state.patterns[patternId] = {
|
|
408
416
|
...proposed,
|
|
@@ -491,14 +499,19 @@ function applyOperation(state, operation, evidenceByRef, effectiveAt) {
|
|
|
491
499
|
});
|
|
492
500
|
return;
|
|
493
501
|
}
|
|
494
|
-
if (
|
|
502
|
+
if (
|
|
503
|
+
operation.type === "quarantine" ||
|
|
504
|
+
operation.type === "revoke" ||
|
|
505
|
+
operation.type === "tombstone"
|
|
506
|
+
) {
|
|
495
507
|
const pattern =
|
|
496
508
|
state.patterns[requiredString(operation.patternId, "patternId")];
|
|
497
|
-
if (!pattern) throw new Error("cannot
|
|
498
|
-
pattern.status =
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
509
|
+
if (!pattern) throw new Error("cannot disposition an unknown pattern");
|
|
510
|
+
pattern.status = {
|
|
511
|
+
quarantine: WIKI_PATTERN_STATUS.QUARANTINED,
|
|
512
|
+
revoke: WIKI_PATTERN_STATUS.REVOKED,
|
|
513
|
+
tombstone: WIKI_PATTERN_STATUS.TOMBSTONED,
|
|
514
|
+
}[operation.type];
|
|
502
515
|
pattern.revocationReason = requiredString(operation.reason, "reason");
|
|
503
516
|
pattern.actionable = false;
|
|
504
517
|
appendLog(
|
|
@@ -90,6 +90,7 @@ export const EVOLUTION_ARTIFACT_LEDGER_RETENTION_TYPES = Object.freeze([
|
|
|
90
90
|
"governed-knowledge-sync-record",
|
|
91
91
|
"governed-knowledge-merge-operation",
|
|
92
92
|
"governed-knowledge-dependency-operation",
|
|
93
|
+
"governed-knowledge-quarantine-release",
|
|
93
94
|
"governed-knowledge-trust-record",
|
|
94
95
|
"governed-skill-marketplace-state",
|
|
95
96
|
"structured-memory-authority-receipt",
|
|
@@ -141,6 +142,7 @@ export const EVOLUTION_ARTIFACT_TYPES = Object.freeze([
|
|
|
141
142
|
"governed-knowledge-sync-record",
|
|
142
143
|
"governed-knowledge-merge-operation",
|
|
143
144
|
"governed-knowledge-dependency-operation",
|
|
145
|
+
"governed-knowledge-quarantine-release",
|
|
144
146
|
"governed-knowledge-trust-record",
|
|
145
147
|
"governed-skill-marketplace-state",
|
|
146
148
|
"evidence",
|
|
@@ -388,6 +390,7 @@ const LEDGER_RETENTION_PURPOSES_BY_TYPE = new Map([
|
|
|
388
390
|
["governed-knowledge-sync-record", new Set(["evolution-ledger"])],
|
|
389
391
|
["governed-knowledge-merge-operation", new Set(["evolution-ledger"])],
|
|
390
392
|
["governed-knowledge-dependency-operation", new Set(["evolution-ledger"])],
|
|
393
|
+
["governed-knowledge-quarantine-release", new Set(["evolution-ledger"])],
|
|
391
394
|
["governed-knowledge-trust-record", new Set(["evolution-ledger"])],
|
|
392
395
|
["governed-skill-marketplace-state", new Set(["evolution-ledger"])],
|
|
393
396
|
["wiki-revision", new Set(["evolution-ledger"])],
|
|
@@ -195,6 +195,83 @@ async function loadBuiltInFactories(commandName) {
|
|
|
195
195
|
createWikiSkillBenchmarkLedgerAdapter;
|
|
196
196
|
factories.createEvolutionEvalProcessSupervisor =
|
|
197
197
|
createEvolutionEvalProcessSupervisor;
|
|
198
|
+
const [
|
|
199
|
+
{ SkillCandidateRegistry },
|
|
200
|
+
{ SkillReleaseRegistry },
|
|
201
|
+
{ SkillPromotionController },
|
|
202
|
+
{ createEvolutionLedgerPorts },
|
|
203
|
+
{ createWikiMaintainerLedgerAdapter },
|
|
204
|
+
{ createGovernedKnowledgeArtifactLifecycle },
|
|
205
|
+
{ GovernedKnowledgeSyncLedgerAdapter },
|
|
206
|
+
{ GovernedKnowledgeDependencyLedgerExecutor },
|
|
207
|
+
{ GovernedKnowledgeDependencyInventoryPlanner },
|
|
208
|
+
{ GovernedKnowledgeSync },
|
|
209
|
+
{ createGovernedKnowledgeRevocationHost },
|
|
210
|
+
{
|
|
211
|
+
createGovernedKnowledgeCandidateQuarantineAuthority,
|
|
212
|
+
createGovernedKnowledgeCandidateRejectionAuthority,
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
createGovernedKnowledgeSkillQuarantineAuthority,
|
|
216
|
+
createGovernedKnowledgeSkillRollbackAuthority,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
createGovernedKnowledgeWikiQuarantineAuthority,
|
|
220
|
+
createGovernedKnowledgeWikiTombstoneAuthority,
|
|
221
|
+
},
|
|
222
|
+
{ createGovernedKnowledgeDependencyRouter },
|
|
223
|
+
{
|
|
224
|
+
GovernedKnowledgeQuarantineReleaseLedger,
|
|
225
|
+
createGovernedKnowledgeQuarantineReleaseDecisionAuthority,
|
|
226
|
+
},
|
|
227
|
+
] = await Promise.all([
|
|
228
|
+
import("./skill-candidate-registry.js"),
|
|
229
|
+
import("./skill-release-registry.js"),
|
|
230
|
+
import("./skill-promotion-controller.js"),
|
|
231
|
+
import("./evolution-ledger-ports.js"),
|
|
232
|
+
import("./wiki-maintainer-ledger-adapter.js"),
|
|
233
|
+
import("./governed-knowledge-artifact-lifecycle.js"),
|
|
234
|
+
import("./governed-knowledge-sync-ledger-adapter.js"),
|
|
235
|
+
import("./governed-knowledge-dependency-ledger-executor.js"),
|
|
236
|
+
import("./governed-knowledge-dependency-inventory.js"),
|
|
237
|
+
import("./governed-knowledge-sync.js"),
|
|
238
|
+
import("./governed-knowledge-revocation-host.js"),
|
|
239
|
+
import("./governed-knowledge-candidate-rejection.js"),
|
|
240
|
+
import("./governed-knowledge-skill-rollback.js"),
|
|
241
|
+
import("./governed-knowledge-wiki-tombstone.js"),
|
|
242
|
+
import("./governed-knowledge-dependency-authority.js"),
|
|
243
|
+
import("./governed-knowledge-quarantine-release.js"),
|
|
244
|
+
]);
|
|
245
|
+
Object.assign(factories, {
|
|
246
|
+
createSkillCandidateRegistry: (options) =>
|
|
247
|
+
new SkillCandidateRegistry(options),
|
|
248
|
+
createSkillReleaseRegistry: (options) =>
|
|
249
|
+
new SkillReleaseRegistry(options),
|
|
250
|
+
createSkillPromotionController: (options) =>
|
|
251
|
+
new SkillPromotionController(options),
|
|
252
|
+
createEvolutionLedgerPorts,
|
|
253
|
+
createWikiMaintainerLedgerAdapter,
|
|
254
|
+
createGovernedKnowledgeArtifactLifecycle,
|
|
255
|
+
createGovernedKnowledgeSyncLedgerAdapter: (options) =>
|
|
256
|
+
new GovernedKnowledgeSyncLedgerAdapter(options),
|
|
257
|
+
createGovernedKnowledgeDependencyLedgerExecutor: (options) =>
|
|
258
|
+
new GovernedKnowledgeDependencyLedgerExecutor(options),
|
|
259
|
+
createGovernedKnowledgeDependencyInventoryPlanner: (options) =>
|
|
260
|
+
new GovernedKnowledgeDependencyInventoryPlanner(options),
|
|
261
|
+
createGovernedKnowledgeSync: (options) =>
|
|
262
|
+
new GovernedKnowledgeSync(options),
|
|
263
|
+
createGovernedKnowledgeRevocationHost,
|
|
264
|
+
createGovernedKnowledgeCandidateQuarantineAuthority,
|
|
265
|
+
createGovernedKnowledgeCandidateRejectionAuthority,
|
|
266
|
+
createGovernedKnowledgeSkillQuarantineAuthority,
|
|
267
|
+
createGovernedKnowledgeSkillRollbackAuthority,
|
|
268
|
+
createGovernedKnowledgeWikiQuarantineAuthority,
|
|
269
|
+
createGovernedKnowledgeWikiTombstoneAuthority,
|
|
270
|
+
createGovernedKnowledgeDependencyRouter,
|
|
271
|
+
createGovernedKnowledgeQuarantineReleaseDecisionAuthority,
|
|
272
|
+
createGovernedKnowledgeQuarantineReleaseLedger: (options) =>
|
|
273
|
+
new GovernedKnowledgeQuarantineReleaseLedger(options),
|
|
274
|
+
});
|
|
198
275
|
}
|
|
199
276
|
if (commandName === "agent" || commandName === "serve") {
|
|
200
277
|
const { createAgentEvolutionRuntimeComposition } =
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { createHash, randomBytes } from "node:crypto";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
projectAgentOpaqueTransportBlock,
|
|
15
|
+
snapshotAgentModelRequest,
|
|
16
|
+
} from "./agent-model-projection.js";
|
|
14
17
|
import {
|
|
15
18
|
createEvidenceJsonTextBoundary,
|
|
16
19
|
EVIDENCE_JSON_POLICY,
|
|
@@ -478,12 +481,27 @@ const AGENT_MODEL_RULESET_V1_DIGEST = `sha256:${createHash("sha256")
|
|
|
478
481
|
"utf8",
|
|
479
482
|
)
|
|
480
483
|
.digest("hex")}`;
|
|
481
|
-
const
|
|
484
|
+
const AGENT_MODEL_RULESET_V2 = Object.freeze({
|
|
482
485
|
...AGENT_MODEL_RULESET_V1,
|
|
483
486
|
schema: "chainlesschain.evolution-agent-model-projection-rules/v2",
|
|
484
487
|
version: 2,
|
|
485
488
|
jsonTextPolicy: EVIDENCE_JSON_POLICY,
|
|
486
489
|
});
|
|
490
|
+
export const EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_V2_DIGEST = `sha256:${createHash(
|
|
491
|
+
"sha256",
|
|
492
|
+
)
|
|
493
|
+
.update(
|
|
494
|
+
`${AGENT_MODEL_RULESET_V2.schema}\0${JSON.stringify(AGENT_MODEL_RULESET_V2)}`,
|
|
495
|
+
"utf8",
|
|
496
|
+
)
|
|
497
|
+
.digest("hex")}`;
|
|
498
|
+
const AGENT_MODEL_RULESET = Object.freeze({
|
|
499
|
+
...AGENT_MODEL_RULESET_V2,
|
|
500
|
+
schema: "chainlesschain.evolution-agent-model-projection-rules/v3",
|
|
501
|
+
version: 3,
|
|
502
|
+
opaqueTransportPolicy:
|
|
503
|
+
"digest-bound-base64-image-and-signed-thinking-no-plaintext-projection-v1",
|
|
504
|
+
});
|
|
487
505
|
export const EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_DIGEST = `sha256:${createHash(
|
|
488
506
|
"sha256",
|
|
489
507
|
)
|
|
@@ -495,6 +513,7 @@ export const EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_DIGEST = `sha256:${createH
|
|
|
495
513
|
const SUPPORTED_RULESETS = new Map([
|
|
496
514
|
[RULESET_DIGEST, RULESET],
|
|
497
515
|
[AGENT_MODEL_RULESET_V1_DIGEST, AGENT_MODEL_RULESET_V1],
|
|
516
|
+
[EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_V2_DIGEST, AGENT_MODEL_RULESET_V2],
|
|
498
517
|
[EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_DIGEST, AGENT_MODEL_RULESET],
|
|
499
518
|
]);
|
|
500
519
|
|
|
@@ -568,7 +587,9 @@ const AGENT_VALUE_PATTERNS = Object.freeze([
|
|
|
568
587
|
]);
|
|
569
588
|
|
|
570
589
|
function valuePatterns(ruleset) {
|
|
571
|
-
return ruleset === AGENT_MODEL_RULESET ||
|
|
590
|
+
return ruleset === AGENT_MODEL_RULESET ||
|
|
591
|
+
ruleset === AGENT_MODEL_RULESET_V2 ||
|
|
592
|
+
ruleset === AGENT_MODEL_RULESET_V1
|
|
572
593
|
? AGENT_VALUE_PATTERNS
|
|
573
594
|
: VALUE_PATTERNS;
|
|
574
595
|
}
|
|
@@ -1225,6 +1246,11 @@ function sanitizePayload(
|
|
|
1225
1246
|
return "[TRUNCATED:CONTENT_BUDGET]";
|
|
1226
1247
|
}
|
|
1227
1248
|
const toolArguments = jsonText && isAgentToolArgumentsPath(path);
|
|
1249
|
+
const opaqueTransportBlock =
|
|
1250
|
+
ruleset === AGENT_MODEL_RULESET
|
|
1251
|
+
? projectAgentOpaqueTransportBlock(value, path.join("."))
|
|
1252
|
+
: null;
|
|
1253
|
+
if (opaqueTransportBlock !== null) return opaqueTransportBlock;
|
|
1228
1254
|
if (toolArguments && typeof value !== "string" && !isPlainRecord(value)) {
|
|
1229
1255
|
throw projectionError(
|
|
1230
1256
|
EVOLUTION_PROJECTION_INVALID_CODE,
|
|
@@ -3061,9 +3087,14 @@ function validateBundleIntegrity(bundle) {
|
|
|
3061
3087
|
);
|
|
3062
3088
|
}
|
|
3063
3089
|
if (model.content !== null) {
|
|
3064
|
-
if (
|
|
3090
|
+
if (
|
|
3091
|
+
ruleset === AGENT_MODEL_RULESET ||
|
|
3092
|
+
ruleset === AGENT_MODEL_RULESET_V2 ||
|
|
3093
|
+
ruleset === AGENT_MODEL_RULESET_V1
|
|
3094
|
+
) {
|
|
3065
3095
|
snapshotAgentModelRequest(model.content, {
|
|
3066
|
-
allowStructuredArgumentText: ruleset
|
|
3096
|
+
allowStructuredArgumentText: ruleset !== AGENT_MODEL_RULESET_V1,
|
|
3097
|
+
allowOpaqueTransportBlocks: ruleset === AGENT_MODEL_RULESET,
|
|
3067
3098
|
});
|
|
3068
3099
|
if (
|
|
3069
3100
|
model.truncated ||
|