chainlesschain 0.166.5 → 0.166.7
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 +3 -1
- package/src/assets/web-panel/assets/{AIOps-DhCWWRmS.js → AIOps-BlrmQxa2.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-BGbZcxSE.js → ActionButton-zyRyLITg.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-CUJNYrmU.js → Analytics-DwGz7OGN.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-ParuJRmc.js → AppLayout-Dc-nj7Zd.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-BMESCkte.js → Artifacts-7Hu3O73p.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-B614pUXR.js → Audit-Bnoe3-fR.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-BKkkvkQl.js → BackgroundAgents-BqYFrDKZ.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-CoFiC_kv.js → Backup-B3hwW1nz.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-Cu4OHz1W.js → BaseInput-XFVxLA4w.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-mxb_SR22.js → Chat-CWRDNw7e.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-CsqO-fiV.js → ChatBubbleRenderer-Bf30VM8G.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-BJpZz-5L.js → Checkbox-kFeeBgac.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-ng7fYMi8.js → Codegen-CCxp8xoI.js} +1 -1
- package/src/assets/web-panel/assets/{Col-D751NOsU.js → Col-BLKZalle.js} +1 -1
- package/src/assets/web-panel/assets/{Community-BPVTHvTC.js → Community-DD0eWCez.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-CY42ARxJ.js → Compact-CHqHWdy0.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-Ec3zabvu.js → Compliance-Bw54uPiK.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-Do0oOlj8.js → Cowork-DZ13zKNJ.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-BXu6LGra.js → Cron-Dlj5Jevg.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-Dg1CsWLA.js → Crosschain-Nvz0aR0j.js} +1 -1
- package/src/assets/web-panel/assets/{DID-D1B8O6C9.js → DID-Ct89eUyY.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-DJFnfIVk.js → Dashboard-BHUH5IAe.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-Be6KCHb7.js → Dropdown-BhZG-PO7.js} +1 -1
- package/src/assets/web-panel/assets/EmailListRenderer-ae4RVwwJ.js +1 -0
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-CWt6WUoP.js → FamilyGuardDashboard-AOcxLfLr.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-Ba7bRkZh.js → Federation-BK2PJQOF.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CNa8GTAM.js → FormItemContext-C2n3xO2_.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DGHg2fio.js → GenericCardRenderer-DcyUVFZq.js} +1 -1
- package/src/assets/web-panel/assets/{Git-DJAgN16e.js → Git-tBae9Lt8.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-DqIapin6.js → Governance-DmNR3AP4.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-B00_KwDW.js → Inference-CoseEigi.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-D1_ZCehX.js → KnowledgeGraph-Bdjd1sxr.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-22jGgUmw.js → Logs-CtlkKIcn.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-DOIQQUTp.js → MarkdownRenderer-CZsTBEQE.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-ClIyNRL6.js → Marketplace-BTYb7nEx.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-BhPsaaJr.js → McpTools-D0iUdW3P.js} +2 -2
- package/src/assets/web-panel/assets/{Memory-BXNDHgEH.js → Memory--gwI7w4Y.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-BeSEujLm.js → MobileBridge-JmFBi24T.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-DKJjWZ6t.js → MobileProjects-BK01cQRx.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-CsX4lo0h.js → Mtc-u7avzyoO.js} +5 -5
- package/src/assets/web-panel/assets/{MtcAudit-CdGiWPEN.js → MtcAudit-gT3z5fo_.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-C1aJmYGd.js → Multisig-BIqZTz5n.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-ClOwZKGW.js → NLProgramming-DdhVfXYq.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-xqZJkp5X.js → Notes-CBlyUmY3.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-D_8hg6E5.js → NotificationSettings-DSyI26N3.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-BNMgCFHY.js → OrderTableRenderer-B7IEuNz4.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-DQjjPQ9u.js → Organization-ozhi4kGS.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-D0g51CZb.js → Overflow-CBy57RVM.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-BqDCDnon.js → P2P-CA-ZRv77.js} +2 -2
- package/src/assets/web-panel/assets/PdhVaultBrowser-DOHc9zm8.js +7 -0
- package/src/assets/web-panel/assets/{Permissions-D9Mk4hzw.js → Permissions-DiP632GP.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-Cksd0Ft-.js → PersonalDataHub-AnU8O-SS.js} +5 -5
- package/src/assets/web-panel/assets/{Pipeline-ALaa1U0w.js → Pipeline-DDibOUaP.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-M-mmVDtr.js → Privacy-D421t36T.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-Bn39Z5S7.js → ProjectInit-DR879ZPJ.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-6Xmsc-zo.js → ProjectSettings-Ded8o6aY.js} +2 -2
- package/src/assets/web-panel/assets/Projects-BHPxiucB.js +1 -0
- package/src/assets/web-panel/assets/{Providers-FLNmdOWT.js → Providers-Boivuu-E.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-C5PNS5N7.js → QrScannerModal-xKD_ntKp.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CHSVdvQA.js → QuickAsk-D3y_A6FV.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BRwvF4m9.js → Recommend-BjKM-YC2.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DeAfmrU2.js → RemoteSession-CgqKMXG4.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-Be_YQzm9.js → Reputation-Ci2GjH5p.js} +1 -1
- package/src/assets/web-panel/assets/{Row-Bv3cbL2A.js → Row-B0-T2BSh.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DsTYAdrh.js → RssFeed-Bet-ur-r.js} +2 -2
- package/src/assets/web-panel/assets/{Search-2gch6_kT.js → Search-DWtRAS2R.js} +1 -1
- package/src/assets/web-panel/assets/{Security-pkS2eKdn.js → Security-BDfu2Qn6.js} +4 -4
- package/src/assets/web-panel/assets/{Services-D1ns1NlD.js → Services-CvJmvSMM.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-B-9nVmze.js → Skeleton-CEbrKpdC.js} +1 -1
- package/src/assets/web-panel/assets/Skills-CjVeiETf.js +1 -0
- package/src/assets/web-panel/assets/{Sla-CI9DZg-s.js → Sla-Dibypxum.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-CH0mQsl3.js → SpeechSettings-XflYXp7a.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-BHeEVZyN.js → SyncSettings-ro1Ivx1E.js} +2 -2
- package/src/assets/web-panel/assets/Tasks-CHq1qFbo.js +1 -0
- package/src/assets/web-panel/assets/{Templates--GvWvJEB.js → Templates-CRnUZxtZ.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-L-FgZD-r.js → Tenant-jUX72JCA.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-DMNfs5hK.js → Terminal-BBhAs7pt.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-DFzInCAj.js → TimelineRenderer-CD5M3RGp.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-Bnh73Gam.js → Tokens-sah3v0gu.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BO-fMwq8.js → Trigger-BNT3Uz3s.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-CX-HXcRl.js → Trust-BytMGPMo.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-C8AOFGVL.js → UkeySign-BkYVMRQs.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-B_bJ6BO2.js → VideoEditing-psvb5Q7Y.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-Ccd3u1t4.js → Wallet-PFQTW0MH.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DVSL5e6o.js → WebAuthn-DgO-OwRT.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-DqFq6xGO.js → WorkflowEditor-DL2l9VNl.js} +1 -1
- package/src/assets/web-panel/assets/{chat-s5SEbhS8.js → chat-C84akEzN.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CRFmX1eW.js → colors-DzTWuQKP.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-DCofr-Ii.js → compact-item-CR9LJQFv.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-duu0_qGr.js → createContext-CTTov5Kn.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-BOhvmlpc.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-B0KKSHGi.js → hasIn-DALj523o.js} +1 -1
- package/src/assets/web-panel/assets/{index-PR4YRMxw.js → index-3-XJoYgX.js} +1 -1
- package/src/assets/web-panel/assets/{index-DY6ZHvJw.js → index-7ux_XohH.js} +1 -1
- package/src/assets/web-panel/assets/{index-DFzJlpwu.js → index-AXnERsyV.js} +1 -1
- package/src/assets/web-panel/assets/{index-CaDLq49Y.js → index-B2qpjU-D.js} +1 -1
- package/src/assets/web-panel/assets/{index-CpnGJDxL.js → index-B6QOJbSn.js} +1 -1
- package/src/assets/web-panel/assets/{index-D6sAHm_C.js → index-BDyt57zL.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_8atrbf.js → index-BHRXKiU1.js} +1 -1
- package/src/assets/web-panel/assets/{index-CQWeRqsN.js → index-BKNIzw0U.js} +1 -1
- package/src/assets/web-panel/assets/{index-NiXCoVfh.js → index-BNaQt49r.js} +1 -1
- package/src/assets/web-panel/assets/{index-C5chs_dS.js → index-Be6Os5S8.js} +1 -1
- package/src/assets/web-panel/assets/{index-C3PtUFgB.js → index-C5eeMl_2.js} +1 -1
- package/src/assets/web-panel/assets/{index-4aqbfxrp.js → index-CNmTDXmf.js} +1 -1
- package/src/assets/web-panel/assets/{index-SbxDTh6S.js → index-CXTEpfGe.js} +1 -1
- package/src/assets/web-panel/assets/{index-BWWfogVi.js → index-CXaCRXN4.js} +1 -1
- package/src/assets/web-panel/assets/{index-CIiqGHl0.js → index-CZhhFQi9.js} +1 -1
- package/src/assets/web-panel/assets/{index-D8sxQTSI.js → index-Cef0n4k_.js} +1 -1
- package/src/assets/web-panel/assets/{index-BM48QU3P.js → index-CjkPDSX4.js} +1 -1
- package/src/assets/web-panel/assets/{index-DjZvE3_P.js → index-CmELknPe.js} +1 -1
- package/src/assets/web-panel/assets/{index-BMaM-Yex.js → index-CnxjXIsK.js} +1 -1
- package/src/assets/web-panel/assets/{index-BugberH-.js → index-CqUgXYIQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DeJMQynL.js → index-CunGDV0g.js} +1 -1
- package/src/assets/web-panel/assets/{index-DHHrnUkx.js → index-D0MqUnKO.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ch8O1mrO.js → index-D9ScRFxz.js} +3 -3
- package/src/assets/web-panel/assets/{index-DJrRZ5um.js → index-DBIPnoTj.js} +1 -1
- package/src/assets/web-panel/assets/index-DDyMJexx.js +1 -0
- package/src/assets/web-panel/assets/{index-BDGNTPr6.js → index-DH6OG-ci.js} +1 -1
- package/src/assets/web-panel/assets/{index-DDLVcra4.js → index-DZER6Lj3.js} +1 -1
- package/src/assets/web-panel/assets/{index-B24nGxlB.js → index-D_Bg0LdK.js} +1 -1
- package/src/assets/web-panel/assets/{index-CRjnopxx.js → index-Dah8M4l2.js} +1 -1
- package/src/assets/web-panel/assets/{index-BRpzktuV.js → index-DjE_ew7U.js} +1 -1
- package/src/assets/web-panel/assets/{index-BERyKHMq.js → index-DtW6Zr_i.js} +1 -1
- package/src/assets/web-panel/assets/{index-BCnLafAV.js → index-DxdzSljS.js} +1 -1
- package/src/assets/web-panel/assets/{index-CxvnkXVj.js → index-QW0EXx14.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUFMz21M.js → index-W9axN_Ce.js} +1 -1
- package/src/assets/web-panel/assets/{index-CDCDbWnv.js → index-_8vetPbU.js} +1 -1
- package/src/assets/web-panel/assets/index-btiojFYn.js +1 -0
- package/src/assets/web-panel/assets/{index-oxcFCNJ4.js → index-eJcFleIV.js} +1 -1
- package/src/assets/web-panel/assets/{index-DtPSAUza.js → index-hzzTITR9.js} +1 -1
- package/src/assets/web-panel/assets/{index-DUT3dpdB.js → index-s4CFyn-n.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-Ncgc0S0H.js → initDefaultProps-JuW8mFj7.js} +1 -1
- package/src/assets/web-panel/assets/{motion-BBobPHz-.js → motion-Cwb0HBve.js} +1 -1
- package/src/assets/web-panel/assets/{move-Dgeb9hea.js → move-DHokzMgu.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-onxX64FZ.js → mtc-parser-DX31y6QS.js} +1 -1
- package/src/assets/web-panel/assets/{omit-D2OZXzri.js → omit-BCIUYDA6.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-J5iBCavx.js → pickAttrs-DMCj4EoZ.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-CE4U8sO6.js → placementArrow-Dy5K-u1s.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-Dl64-wdo.js → responsiveObserve-DkGeZu54.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DRFC8TgC.js → slide-Dc5dyJdg.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-Bh1xb87a.js → statusUtils-DIUBjOaC.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-DlG_dRlk.js → styleChecker-DmyEOxm5.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-5qmSh3pc.js → useFlexGapSupport-FRhakk1e.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-C_fMqkQA.js → useFs-clXyV1WQ.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-D0Aih7lk.js → usePersonalDataHub-UF6DG41z.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-Cv17kLab.js → vnode-CoCt95G7.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-B8Mzvavx.js → zoom-yVWt-ENm.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/graph.js +215 -5
- package/src/commands/team-distributed.js +342 -2
- package/src/commands/team.js +169 -7
- package/src/data/changelog.json +26 -0
- package/src/generated/cc-agent-protocol.schema.json +6 -1
- package/src/lib/agent-ipc-bus.js +453 -91
- package/src/lib/agent-ipc-flow-control.js +200 -0
- package/src/lib/agent-team/task-lease.js +315 -0
- package/src/lib/agent-team/team-agent-stream.js +16 -0
- package/src/lib/agent-team/team-distributed-graph-bridge.js +257 -0
- package/src/lib/agent-team/team-distributed-graph-writer.js +523 -0
- package/src/lib/agent-team/team-distributed-queue.js +251 -0
- package/src/lib/agent-team/team-graph-runtime-adapter.js +1918 -0
- package/src/lib/agent-team/team-runner.js +225 -2
- package/src/lib/app-server/graph-runtime.js +754 -0
- package/src/lib/app-server/rollout-store.js +32 -0
- package/src/lib/app-server/server.js +140 -0
- package/src/lib/autonomous-agent.js +11 -0
- package/src/lib/cowork-graph-authority-adapter.js +455 -0
- package/src/lib/dynamic-workflow-facade.js +83 -16
- package/src/lib/graph-kernel/adapters.js +93 -20
- package/src/lib/graph-kernel/authority.js +324 -0
- package/src/lib/graph-kernel/compiler.js +1 -8
- package/src/lib/graph-kernel/cutover-authority-resolver.js +219 -0
- package/src/lib/graph-kernel/cutover-ledger.js +650 -0
- package/src/lib/graph-kernel/event-store.js +15 -1
- package/src/lib/graph-kernel/graph-runtime-surfaces.json +1427 -0
- package/src/lib/graph-kernel/index.js +4 -0
- package/src/lib/graph-kernel/migration-saga.js +309 -0
- package/src/lib/graph-kernel/runtime-surface-manifest.js +481 -0
- package/src/lib/graph-kernel/runtime.js +661 -24
- package/src/lib/graph-kernel/store-cutover-evidence.js +354 -0
- package/src/lib/graph-kernel/trace-reducer.js +6 -0
- package/src/lib/graph-kernel/trigger-adapter.js +60 -3
- package/src/lib/legacy-runtime-authority.js +160 -0
- package/src/lib/orchestrator.js +28 -0
- package/src/lib/scheduler-kernel/graph-authority-adapter.js +512 -0
- package/src/lib/scheduler-kernel/runtime.js +75 -2
- package/src/assets/web-panel/assets/EmailListRenderer-9L4EdmcR.js +0 -1
- package/src/assets/web-panel/assets/PdhVaultBrowser-BDMyV-DM.js +0 -7
- package/src/assets/web-panel/assets/Projects-C2KI2sH1.js +0 -1
- package/src/assets/web-panel/assets/Skills-V7TqlXWR.js +0 -1
- package/src/assets/web-panel/assets/Tasks-DOld05sg.js +0 -1
- package/src/assets/web-panel/assets/devWarning-0bFBr86K.js +0 -1
- package/src/assets/web-panel/assets/index-BJCitHZ6.js +0 -1
- package/src/assets/web-panel/assets/index-WmqZ5PwS.js +0 -1
|
@@ -116,6 +116,36 @@ function buildRecord(input, previous, now) {
|
|
|
116
116
|
return Object.freeze({ ...record, hash: recordHash(record) });
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
function assertExpectedHead(input, records) {
|
|
120
|
+
const previous = records.at(-1) || null;
|
|
121
|
+
if (
|
|
122
|
+
input.expectedRevision !== undefined &&
|
|
123
|
+
Number(input.expectedRevision) !== Number(previous?.event_seq || 0)
|
|
124
|
+
) {
|
|
125
|
+
throw storeError(
|
|
126
|
+
"CC_ROLLOUT_HEAD_CONFLICT",
|
|
127
|
+
"rollout revision changed before append",
|
|
128
|
+
{
|
|
129
|
+
expectedRevision: Number(input.expectedRevision),
|
|
130
|
+
actualRevision: Number(previous?.event_seq || 0),
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (
|
|
135
|
+
input.expectedHeadHash !== undefined &&
|
|
136
|
+
input.expectedHeadHash !== (previous?.hash || null)
|
|
137
|
+
) {
|
|
138
|
+
throw storeError(
|
|
139
|
+
"CC_ROLLOUT_HEAD_CONFLICT",
|
|
140
|
+
"rollout event head changed before append",
|
|
141
|
+
{
|
|
142
|
+
expectedHeadHash: input.expectedHeadHash,
|
|
143
|
+
actualHeadHash: previous?.hash || null,
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
119
149
|
function verifyRecords(records, expectedThreadId = null) {
|
|
120
150
|
let previous = null;
|
|
121
151
|
for (const record of records) {
|
|
@@ -309,6 +339,7 @@ export class JsonlRolloutStore {
|
|
|
309
339
|
return clone(duplicate);
|
|
310
340
|
}
|
|
311
341
|
}
|
|
342
|
+
assertExpectedHead(input, records);
|
|
312
343
|
const record = buildRecord(input, records.at(-1), this.now);
|
|
313
344
|
fs.appendFileSync(file, `${JSON.stringify(record)}\n`, "utf8");
|
|
314
345
|
return clone(record);
|
|
@@ -498,6 +529,7 @@ export class MemoryRolloutStore {
|
|
|
498
529
|
}
|
|
499
530
|
return clone(duplicate);
|
|
500
531
|
}
|
|
532
|
+
assertExpectedHead(input, records);
|
|
501
533
|
const record = buildRecord(input, records.at(-1), this.now);
|
|
502
534
|
records.push(record);
|
|
503
535
|
return clone(record);
|
|
@@ -2,6 +2,8 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { BoundedAsyncQueue, QueueOverloadedError } from "./bounded-queue.js";
|
|
3
3
|
import { CliAgentKernelAdapter } from "./cli-agent-kernel-adapter.js";
|
|
4
4
|
import { JsonlRolloutStore } from "./rollout-store.js";
|
|
5
|
+
import { AppServerGraphRuntime } from "./graph-runtime.js";
|
|
6
|
+
import { compileGraphDefinition } from "../graph-kernel/compiler.js";
|
|
5
7
|
import {
|
|
6
8
|
APP_SERVER_MIN_PROTOCOL_VERSION,
|
|
7
9
|
APP_SERVER_PROTOCOL_VERSION,
|
|
@@ -110,6 +112,7 @@ export class CcAppServer {
|
|
|
110
112
|
requestTimeoutMs = 120_000,
|
|
111
113
|
interruptSettlementMs = 30_000,
|
|
112
114
|
transport = "stdio",
|
|
115
|
+
graphRuntime = null,
|
|
113
116
|
} = {}) {
|
|
114
117
|
if (typeof send !== "function") {
|
|
115
118
|
throw new TypeError("CcAppServer requires a send(message) function");
|
|
@@ -122,6 +125,17 @@ export class CcAppServer {
|
|
|
122
125
|
this.requestTimeoutMs = requestTimeoutMs;
|
|
123
126
|
this.interruptSettlementMs = interruptSettlementMs;
|
|
124
127
|
this.transport = transport === "websocket" ? "websocket" : "stdio";
|
|
128
|
+
this.graphRuntime =
|
|
129
|
+
graphRuntime ||
|
|
130
|
+
new AppServerGraphRuntime({
|
|
131
|
+
rolloutStore: store,
|
|
132
|
+
now,
|
|
133
|
+
createId,
|
|
134
|
+
executeNode: (context) => this._executeGraphNode(context),
|
|
135
|
+
onEvent: (event) => {
|
|
136
|
+
void this._notify("graph/event", event).catch(() => {});
|
|
137
|
+
},
|
|
138
|
+
});
|
|
125
139
|
this.initialized = false;
|
|
126
140
|
this.negotiated = null;
|
|
127
141
|
this.client = null;
|
|
@@ -278,6 +292,11 @@ export class CcAppServer {
|
|
|
278
292
|
"thread/archive": () => this._threadArchive(message.params),
|
|
279
293
|
"turn/start": () => this._turnStart(message.params),
|
|
280
294
|
"turn/interrupt": () => this._turnInterrupt(message.params),
|
|
295
|
+
"graph/compile": () => this._graphCompile(message.params),
|
|
296
|
+
"graph/run": () => this._graphRun(message.params),
|
|
297
|
+
"graph/status": () => this._graphStatus(message.params),
|
|
298
|
+
"graph/cancel": () => this._graphCancel(message.params),
|
|
299
|
+
"graph/reconcile": () => this._graphReconcile(message.params),
|
|
281
300
|
};
|
|
282
301
|
const handler = handlers[method];
|
|
283
302
|
if (!handler) {
|
|
@@ -324,6 +343,7 @@ export class CcAppServer {
|
|
|
324
343
|
transports: [this.transport],
|
|
325
344
|
websocket: { stability: "experimental" },
|
|
326
345
|
limits: this.requestQueue.snapshot(),
|
|
346
|
+
graphRuntime: this.graphRuntime.runtimeClaims(),
|
|
327
347
|
schema: {
|
|
328
348
|
id: APP_SERVER_SCHEMA.$id,
|
|
329
349
|
version: APP_SERVER_PROTOCOL_VERSION,
|
|
@@ -331,6 +351,126 @@ export class CcAppServer {
|
|
|
331
351
|
});
|
|
332
352
|
}
|
|
333
353
|
|
|
354
|
+
_graphCompile(rawParams) {
|
|
355
|
+
const params = requireObject(rawParams);
|
|
356
|
+
const compiled = compileGraphDefinition(
|
|
357
|
+
requireObject(params.definition, "definition"),
|
|
358
|
+
);
|
|
359
|
+
return {
|
|
360
|
+
definitionId: compiled.definitionId,
|
|
361
|
+
revision: compiled.revision,
|
|
362
|
+
revisionDigest: compiled.revisionDigest,
|
|
363
|
+
topologicalOrder: [...compiled.topologicalOrder],
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
async _graphRun(rawParams) {
|
|
368
|
+
const params = requireObject(rawParams);
|
|
369
|
+
if (params.resume === true) {
|
|
370
|
+
return this.graphRuntime.resume(requiredString(params.runId, "runId"), {
|
|
371
|
+
waitForCompletion: params.waitForCompletion === true,
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return this.graphRuntime.run({
|
|
375
|
+
definition: requireObject(params.definition, "definition"),
|
|
376
|
+
runId: params.runId || this.createId(),
|
|
377
|
+
inputs: params.inputs || {},
|
|
378
|
+
originSurface: params.originSurface || "desktop",
|
|
379
|
+
agentCapacity: params.agentCapacity,
|
|
380
|
+
authorityMode: params.authorityMode || "canonical",
|
|
381
|
+
waitForCompletion: params.waitForCompletion === true,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
_graphStatus(rawParams) {
|
|
386
|
+
const params = requireObject(rawParams);
|
|
387
|
+
return this.graphRuntime.status(requiredString(params.runId, "runId"));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
_graphCancel(rawParams) {
|
|
391
|
+
const params = requireObject(rawParams);
|
|
392
|
+
return this.graphRuntime.cancel(
|
|
393
|
+
requiredString(params.runId, "runId"),
|
|
394
|
+
params.reason || "cancelled by App Server client",
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
_graphReconcile(rawParams) {
|
|
399
|
+
const params = requireObject(rawParams);
|
|
400
|
+
return this.graphRuntime.reconcile(
|
|
401
|
+
requiredString(params.runId, "runId"),
|
|
402
|
+
requireObject(params.reconciliation, "reconciliation"),
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async _executeGraphNode({ runId, nodeId, attempt, input, signal }) {
|
|
407
|
+
const threadId = `graph-agent:${runId}:${nodeId}`;
|
|
408
|
+
const turn = { id: attempt.id, threadId };
|
|
409
|
+
const onAbort = () => {
|
|
410
|
+
void this.kernel.interruptTurn?.(threadId, attempt.id);
|
|
411
|
+
};
|
|
412
|
+
signal?.addEventListener?.("abort", onAbort, { once: true });
|
|
413
|
+
try {
|
|
414
|
+
const result = await this.kernel.startTurn({
|
|
415
|
+
threadId,
|
|
416
|
+
turnId: attempt.id,
|
|
417
|
+
input: requiredString(input?.prompt, `inputs.${nodeId}.prompt`),
|
|
418
|
+
options: input?.options || {},
|
|
419
|
+
emit: (event) =>
|
|
420
|
+
this._notify("graph/event", {
|
|
421
|
+
type: "graph/agent-event",
|
|
422
|
+
runId,
|
|
423
|
+
nodeId,
|
|
424
|
+
attemptId: attempt.id,
|
|
425
|
+
event,
|
|
426
|
+
}),
|
|
427
|
+
requestApproval: (event) => this._requestApproval(turn, event),
|
|
428
|
+
});
|
|
429
|
+
const failed = result?.is_error === true || result?.subtype === "error";
|
|
430
|
+
const output = typeof result?.result === "string" ? result.result : "";
|
|
431
|
+
const receiptThreadId = `graph-executor:${runId}`;
|
|
432
|
+
this.store.start({
|
|
433
|
+
threadId: receiptThreadId,
|
|
434
|
+
title: `Graph executor receipts for ${runId}`,
|
|
435
|
+
metadata: { kind: "graph_executor_receipts", graphRunId: runId },
|
|
436
|
+
});
|
|
437
|
+
const events = this.store.read(receiptThreadId);
|
|
438
|
+
const receiptEvent = this.store.append({
|
|
439
|
+
threadId: receiptThreadId,
|
|
440
|
+
turnId: attempt.id,
|
|
441
|
+
eventType: failed ? "executor.failed" : "executor.succeeded",
|
|
442
|
+
idempotencyKey: `graph-executor:${attempt.id}`,
|
|
443
|
+
payload: {
|
|
444
|
+
runId,
|
|
445
|
+
nodeId,
|
|
446
|
+
attemptId: attempt.id,
|
|
447
|
+
status: failed ? "failed" : "succeeded",
|
|
448
|
+
outputDigest: output ? digest(output) : null,
|
|
449
|
+
error: failed ? String(result?.error || "Agent turn failed") : null,
|
|
450
|
+
},
|
|
451
|
+
expectedRevision: events.at(-1)?.seq,
|
|
452
|
+
expectedHeadHash: events.at(-1)?.hash,
|
|
453
|
+
});
|
|
454
|
+
if (failed) {
|
|
455
|
+
return {
|
|
456
|
+
status: "failed",
|
|
457
|
+
outcomeKnown: true,
|
|
458
|
+
error: result?.error || "Agent turn failed",
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
status: "succeeded",
|
|
463
|
+
terminalEvidence: {
|
|
464
|
+
eventDigest: receiptEvent.hash,
|
|
465
|
+
outputDigest: output ? digest(output) : null,
|
|
466
|
+
},
|
|
467
|
+
usage: result?.usage || {},
|
|
468
|
+
};
|
|
469
|
+
} finally {
|
|
470
|
+
signal?.removeEventListener?.("abort", onAbort);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
334
474
|
async _notify(method, params, rollout = null) {
|
|
335
475
|
if (rollout) {
|
|
336
476
|
this.store.append({
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { EventEmitter } from "events";
|
|
11
11
|
import { firstBalancedJson } from "./json-schema-output.js";
|
|
12
|
+
import { assertCLILegacyMutationAllowed } from "./legacy-runtime-authority.js";
|
|
12
13
|
|
|
13
14
|
// Exported for test injection
|
|
14
15
|
export const _deps = {
|
|
@@ -67,6 +68,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
67
68
|
maxGoals,
|
|
68
69
|
iterationBudget,
|
|
69
70
|
} = {}) {
|
|
71
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.initialize");
|
|
70
72
|
this._llmChat = llmChat || null;
|
|
71
73
|
this._toolExecutor = toolExecutor || null;
|
|
72
74
|
this._hookManager = hookManager || null;
|
|
@@ -84,6 +86,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
84
86
|
* @returns {{ goalId: string }}
|
|
85
87
|
*/
|
|
86
88
|
async submitGoal(description, { tokenBudget = 50000 } = {}) {
|
|
89
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.submitGoal");
|
|
87
90
|
if (!this._initialized) throw new Error("Agent not initialized");
|
|
88
91
|
if (!description) throw new Error("Goal description required");
|
|
89
92
|
|
|
@@ -124,6 +127,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
124
127
|
* the cap rather than losing live work.
|
|
125
128
|
*/
|
|
126
129
|
_pruneGoals() {
|
|
130
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._pruneGoals");
|
|
127
131
|
if (this._goals.size <= this._maxGoals) return;
|
|
128
132
|
for (const [id, g] of this._goals) {
|
|
129
133
|
if (this._goals.size <= this._maxGoals) break;
|
|
@@ -141,6 +145,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
141
145
|
* Pause a running goal.
|
|
142
146
|
*/
|
|
143
147
|
pauseGoal(goalId) {
|
|
148
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.pauseGoal");
|
|
144
149
|
const goal = this._goals.get(goalId);
|
|
145
150
|
if (!goal) return { error: "Goal not found" };
|
|
146
151
|
if (goal.status !== GoalStatus.RUNNING)
|
|
@@ -156,6 +161,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
156
161
|
* Resume a paused goal.
|
|
157
162
|
*/
|
|
158
163
|
resumeGoal(goalId) {
|
|
164
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.resumeGoal");
|
|
159
165
|
const goal = this._goals.get(goalId);
|
|
160
166
|
if (!goal) return { error: "Goal not found" };
|
|
161
167
|
if (goal.status !== GoalStatus.PAUSED)
|
|
@@ -178,6 +184,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
178
184
|
* Cancel a goal.
|
|
179
185
|
*/
|
|
180
186
|
cancelGoal(goalId) {
|
|
187
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.cancelGoal");
|
|
181
188
|
const goal = this._goals.get(goalId);
|
|
182
189
|
if (!goal) return { error: "Goal not found" };
|
|
183
190
|
|
|
@@ -228,6 +235,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
228
235
|
// ─── ReAct Loop ─────────────────────────────────────────────
|
|
229
236
|
|
|
230
237
|
async _runReActLoop(goal) {
|
|
238
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._runReActLoop");
|
|
231
239
|
goal.status = GoalStatus.RUNNING;
|
|
232
240
|
this.emit("goal:started", { goalId: goal.id });
|
|
233
241
|
|
|
@@ -342,6 +350,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
342
350
|
* Decompose a goal into executable steps using LLM.
|
|
343
351
|
*/
|
|
344
352
|
async _decomposeGoal(goal) {
|
|
353
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._decomposeGoal");
|
|
345
354
|
if (!this._llmChat) {
|
|
346
355
|
// No LLM — create a single step
|
|
347
356
|
return [
|
|
@@ -406,6 +415,7 @@ Only return the JSON array, no other text.`;
|
|
|
406
415
|
* Execute a single step using the tool executor.
|
|
407
416
|
*/
|
|
408
417
|
async _executeStep(step) {
|
|
418
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._executeStep");
|
|
409
419
|
if (!step.tool || !this._toolExecutor) {
|
|
410
420
|
// No tool specified or no executor — skip as informational
|
|
411
421
|
return "No tool action required";
|
|
@@ -419,6 +429,7 @@ Only return the JSON array, no other text.`;
|
|
|
419
429
|
* Returns true if a correction was applied.
|
|
420
430
|
*/
|
|
421
431
|
async _selfCorrect(goal, error) {
|
|
432
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._selfCorrect");
|
|
422
433
|
if (!this._llmChat) return false;
|
|
423
434
|
|
|
424
435
|
try {
|