chainlesschain 0.166.86 → 0.166.88
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 +26 -15
- package/package.json +1 -1
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
- package/src/assets/web-panel/assets/{AIOps-DZwiXAIh.js → AIOps-QzeGep9J.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-aNzXoIJP.js → ActionButton-Dfc5bx7S.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-ETQk4ZXt.js → Analytics-tn-_ZG2E.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-D5oEbeEC.js → AppLayout-Deg3WAK8.js} +3 -3
- package/src/assets/web-panel/assets/{Artifacts-ja48FAne.js → Artifacts-KU05t0a6.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-DlN0YnDt.js → Audit-CkSZf54T.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CzvyNsRg.js → BackgroundAgents-i7ivfXF0.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-DXgEC2MQ.js → Backup-QcVUKtf0.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-D9XqejLx.js → BaseInput-B3h5ZJ0g.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-BTwuYUlN.js → Chat-D7AVz0xi.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-0anIC2Wn.js → ChatBubbleRenderer-B0-euPW7.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-CLuaQbDt.js → Checkbox-H0p0TMlD.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-KwQUZs8A.js → Codegen-B6HOmAY3.js} +1 -1
- package/src/assets/web-panel/assets/{Col-BCmROkzc.js → Col-n_64Fog2.js} +1 -1
- package/src/assets/web-panel/assets/{Community-CXlUEHR4.js → Community-CX0JGgj0.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-Dzx-lWI2.js → Compact-C4JWUZlx.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CfXW82FF.js → Compliance-DKyTZakB.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-DIISTRm2.js → Cowork-C0joBMci.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-nyJ-KcFE.js → Cron-D6VkYpxK.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-Dtv1E4cV.js → Crosschain-7b6Uu8jc.js} +1 -1
- package/src/assets/web-panel/assets/{DID-BCTpektS.js → DID-C8YPKqzY.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-C1Q_m0So.js → Dashboard-DJsOiEry.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-BrQ5_PPL.js → Dropdown-CyStFY-4.js} +1 -1
- package/src/assets/web-panel/assets/EmailListRenderer-COrIx2Rg.js +1 -0
- package/src/assets/web-panel/assets/{EvolutionSettings-DaGaE6bX.js → EvolutionSettings-DpxORusH.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-nJDWBECt.js → FamilyGuardDashboard-5BYZdMG0.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DhMUY_wG.js → Federation-s1kS0ekU.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CbONJPuc.js → FormItemContext-CmgoH9HV.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-CDdX4dX-.js → GenericCardRenderer-DSRWrvcL.js} +1 -1
- package/src/assets/web-panel/assets/{Git-DXbDVJdR.js → Git-Cz3EgnS1.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-DbAfAvs1.js → Governance-De4atTe7.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-Dy-fGea2.js → Inference-DoitBBxJ.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-DAxRpGUF.js → KnowledgeGraph-CIdmJ1pH.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-5L1UCR8X.js → Logs-Coa_qNhU.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-u0FPafvT.js → MarkdownRenderer-CeT_RocE.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-DUk_McDG.js → Marketplace-C6kbAQoM.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-B6PNsZ_p.js → McpTools-C2TZn8D-.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-BUUs8j5F.js → Memory-DYdEKDuB.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-pXRsgyuO.js → MobileBridge-pKLeVviZ.js} +1 -1
- package/src/assets/web-panel/assets/MobileProjects-D4bWcHA_.js +1 -0
- package/src/assets/web-panel/assets/{Mtc-Deaj4faB.js → Mtc-IEoVRV29.js} +4 -4
- package/src/assets/web-panel/assets/{MtcAudit-wUV0VUH1.js → MtcAudit-Cov-yYTY.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-C67IIkts.js → Multisig--Jr7OCmp.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-BCA_CWrW.js → NLProgramming-D2gXnYAA.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-D9eu14hQ.js → Notes-hk8pMyve.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-Cnd-J4LM.js → NotificationSettings-D26Nc7MU.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-C4pHUuyZ.js → OrderTableRenderer-DmzHMEOa.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-4YExAbnp.js → Organization-Cn-o6mHT.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-BF-wFuZz.js → Overflow-DP6xpDak.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CdiajqCT.js → P2P-C9WAjG-I.js} +2 -2
- package/src/assets/web-panel/assets/PdhVaultBrowser-DxZb0Ux8.js +7 -0
- package/src/assets/web-panel/assets/{Permissions-DrZ4D78_.js → Permissions-BFBN4-IL.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-lDc6OXjz.js → PersonalDataHub-BEDvoAiz.js} +6 -6
- package/src/assets/web-panel/assets/{Pipeline-DqDS9ON1.js → Pipeline-Co2Ze_rR.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BMekZRZu.js → Privacy-BOTn1EId.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-LYS7NFvJ.js → ProjectInit-CObyrZYm.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CcJNHk9A.js → ProjectSettings-DVTN31rd.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-DrfAHgdF.js → Projects-DQSEaVjE.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-aqsly9SR.js → Providers-BRIKWIdQ.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-ZWvR3zqg.js → QrScannerModal-3nxaEXxN.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-BT5CgsvW.js → QuickAsk-iwZJEE9z.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-Cz8Dz2RN.js → Recommend-D2_EEbvc.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BlxPVbtQ.js → RemoteSession-S4w2mUfq.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-B3VGBE-1.js → Reputation-CstUvfTC.js} +1 -1
- package/src/assets/web-panel/assets/{Row-Bwv7vSEA.js → Row-DEGHFpxz.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DHI085r_.js → RssFeed-DGdZtJQl.js} +2 -2
- package/src/assets/web-panel/assets/{Search-DBler5T0.js → Search-DhfXi99U.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BZdw43NW.js → Security-BbzISrgX.js} +4 -4
- package/src/assets/web-panel/assets/{Services-Cslk5lUj.js → Services-CFjP2sQ3.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-Bur-C-25.js → Skeleton-CFn5wbvm.js} +1 -1
- package/src/assets/web-panel/assets/Skills-fVbT8RcW.js +1 -0
- package/src/assets/web-panel/assets/{Sla-B1OWgQ51.js → Sla-D6OtC0MT.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-CaBcEaV4.js → SpeechSettings-D0kteBjU.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CBbG8L6J.js → SyncSettings-BGEWCtPh.js} +2 -2
- package/src/assets/web-panel/assets/Tasks-B1xZUG4D.js +1 -0
- package/src/assets/web-panel/assets/{Templates-VBBOZ1H5.js → Templates-COlorjqb.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CtQTj7IF.js → Tenant-yLkwfuo3.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-DXVTQjnl.js → Terminal-CAmkq1wf.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-BRIno0aN.js → TimelineRenderer-CcKYq1Ue.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-uiiAfkYN.js → Tokens-9hIqn_LE.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-CPApN8o6.js → Trigger-Dsdkb74C.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-T2jKVwCE.js → Trust-DC4GuE3C.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-C2U_gbzP.js → UkeySign-CSlh00wf.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-BCdlr3Kj.js → VideoEditing-QEWLo3QY.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-CWnjoSc1.js → Wallet-BkPNQgmg.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-CqSbYqHq.js → WebAuthn-7---jCBl.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-Dr_I3jcr.js → WorkflowEditor-Dq6Yiu8E.js} +1 -1
- package/src/assets/web-panel/assets/{chat-Cg21FKdE.js → chat-CTYIMpWD.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CK85tY9e.js → colors-C8JtYlDN.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-m-XYPC7W.js → compact-item-spXpnsNC.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-BmiEeNvs.js → createContext-D04ewPuL.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-3-s4adfp.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-CCw4KAoc.js → hasIn-DZblOKXx.js} +1 -1
- package/src/assets/web-panel/assets/{index-Br9t_I1X.js → index-749P1pkM.js} +1 -1
- package/src/assets/web-panel/assets/{index-BvjC3t35.js → index-B-cKXztT.js} +1 -1
- package/src/assets/web-panel/assets/{index-BiVPFsat.js → index-B57W1RB6.js} +1 -1
- package/src/assets/web-panel/assets/{index-8KzhlvJ9.js → index-B7RA974g.js} +1 -1
- package/src/assets/web-panel/assets/{index-OIbfsi-o.js → index-BKfR2eSQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BGb1j2z9.js → index-BLv-KSGc.js} +1 -1
- package/src/assets/web-panel/assets/{index-yYmjkf38.js → index-BOuUUW2U.js} +3 -3
- package/src/assets/web-panel/assets/{index-J81uvUMN.js → index-BSO33_O2.js} +1 -1
- package/src/assets/web-panel/assets/{index-DI9GJFcn.js → index-B_65aY6c.js} +1 -1
- package/src/assets/web-panel/assets/{index-BHsiSoGY.js → index-BjMY3Y_L.js} +1 -1
- package/src/assets/web-panel/assets/{index-6jXf-Lln.js → index-Bm0z1M6s.js} +1 -1
- package/src/assets/web-panel/assets/{index-BGUYgc96.js → index-Bw-3CtK2.js} +1 -1
- package/src/assets/web-panel/assets/{index-sWUmvT8H.js → index-CE3TYhl0.js} +1 -1
- package/src/assets/web-panel/assets/{index-CN2xbLGz.js → index-CHtwoTKX.js} +1 -1
- package/src/assets/web-panel/assets/{index-D7gS_TJl.js → index-CLkua5sJ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BStyjmLG.js → index-COvZnoIg.js} +1 -1
- package/src/assets/web-panel/assets/{index-DmSgfXuz.js → index-CZmBlh5P.js} +1 -1
- package/src/assets/web-panel/assets/{index-lhoexBDH.js → index-Cfk4o9eI.js} +1 -1
- package/src/assets/web-panel/assets/{index-DMbrl43d.js → index-Cgztj1JO.js} +1 -1
- package/src/assets/web-panel/assets/{index-DxRhnsEC.js → index-Cz0gkRz_.js} +1 -1
- package/src/assets/web-panel/assets/{index-DAlGVix-.js → index-DHOV24VR.js} +1 -1
- package/src/assets/web-panel/assets/{index-DIlGxS2W.js → index-DLUHbPl3.js} +1 -1
- package/src/assets/web-panel/assets/{index-CYEzWoyZ.js → index-DSoyEHi2.js} +1 -1
- package/src/assets/web-panel/assets/{index-CBcgIWOe.js → index-D_Md0Jhp.js} +1 -1
- package/src/assets/web-panel/assets/{index-D1sU5-XA.js → index-Dcd-qZ68.js} +1 -1
- package/src/assets/web-panel/assets/{index-B8IC9ZeZ.js → index-DcjouIsi.js} +1 -1
- package/src/assets/web-panel/assets/{index-ByVvAXdl.js → index-DdC0OsNh.js} +1 -1
- package/src/assets/web-panel/assets/{index-BtvVupUL.js → index-DruABY-g.js} +1 -1
- package/src/assets/web-panel/assets/{index-IskAKXhx.js → index-Dssnz_1x.js} +1 -1
- package/src/assets/web-panel/assets/{index-DpIy2HzE.js → index-DtSzmzFF.js} +1 -1
- package/src/assets/web-panel/assets/{index-BIOTRzaF.js → index-DwIEfKo7.js} +1 -1
- package/src/assets/web-panel/assets/{index-B7xJkhtJ.js → index-EM4_wLPi.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bv90WEWa.js → index-IFEbaISP.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cf5arJie.js → index-KIoJ2eCK.js} +1 -1
- package/src/assets/web-panel/assets/{index-BUYyhYP6.js → index-Mxj-qi1G.js} +1 -1
- package/src/assets/web-panel/assets/index-ZMf_BGlO.js +1 -0
- package/src/assets/web-panel/assets/index-jvp8bJBF.js +1 -0
- package/src/assets/web-panel/assets/{index-Br0ZNdu1.js → index-rU6_An6N.js} +1 -1
- package/src/assets/web-panel/assets/{index-BcfVHmFK.js → index-rVEqWa0_.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-Cc1XOmNe.js → initDefaultProps-Dl0wiMxn.js} +1 -1
- package/src/assets/web-panel/assets/{motion-BehsX88u.js → motion-BFmZYrGO.js} +1 -1
- package/src/assets/web-panel/assets/{move-BPx2YsqY.js → move-Cjs64yWq.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-BSFJgFQA.js → mtc-parser-NeQsnBuP.js} +1 -1
- package/src/assets/web-panel/assets/{omit-DBN5KUeo.js → omit-4Rs-rfs9.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BDK1yZ-9.js → pickAttrs-CUhx2rDY.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-C4rMmKNJ.js → placementArrow-DbIM_OB2.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-BoeoOnxX.js → responsiveObserve-B_TGx9AN.js} +1 -1
- package/src/assets/web-panel/assets/{slide-BKlr1bl9.js → slide-C46cEP5t.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-Ky1apWPI.js → statusUtils-DqeksICX.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-DxxR7uXk.js → styleChecker-2rrypo5u.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-DmsUqVe9.js → useFlexGapSupport-RRe1Edsg.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-CwkG7sOg.js → useFs-CB0oxU1U.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-CddgeEfF.js → usePersonalDataHub-B98WdlUE.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-C_-H8i4Y.js → vnode-CY8AoD95.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-aAsHUMNE.js → zoom-BnT-0MbP.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/eval.js +116 -67
- package/src/commands/memory.js +34 -15
- package/src/commands/sandbox.js +9 -0
- package/src/data/changelog.json +26 -0
- package/src/lib/causal-observability.js +6 -45
- package/src/lib/context-memory-kernel/durable-memory-port.js +49 -10
- package/src/lib/context-memory-kernel/memory-query-index.js +278 -0
- package/src/lib/context-memory-kernel/memory-service.js +17 -2
- package/src/lib/context-memory-kernel/segmented-memory-port.js +277 -9
- package/src/lib/eval/outcomes.js +20 -10
- package/src/lib/eval/runner.js +49 -5
- package/src/lib/eval/stream-terminal.js +51 -0
- package/src/lib/eval/tasks.js +8 -3
- package/src/lib/eval/verify01-contracts.js +349 -0
- package/src/lib/eval/verify01-execution.js +611 -0
- package/src/lib/eval/verify01-host-evidence.js +604 -0
- package/src/lib/execution-support.js +58 -0
- package/src/lib/llm-pricing.js +98 -11
- package/src/lib/model-catalog-review.js +116 -0
- package/src/lib/model-context-catalog.js +23 -1
- package/src/lib/openai-responses.js +39 -0
- package/src/lib/process-execution-broker/index.js +8 -0
- package/src/lib/process-execution-broker/linux-subreaper-process.js +24 -2
- package/src/lib/process-execution-broker/process-ownership-journal.js +168 -7
- package/src/lib/process-execution-broker/process-ownership-quarantine.js +56 -1
- package/src/lib/process-execution-broker/process-recovery-cgroup.js +272 -0
- package/src/runtime/agent-core.js +9 -24
- package/src/runtime/permission-authority-host.js +14 -0
- package/src/assets/web-panel/assets/EmailListRenderer-DjoNlONP.js +0 -1
- package/src/assets/web-panel/assets/MobileProjects-D7v-2Hwm.js +0 -1
- package/src/assets/web-panel/assets/PdhVaultBrowser-BkjfS6Th.js +0 -7
- package/src/assets/web-panel/assets/Skills-v0zgLy0X.js +0 -1
- package/src/assets/web-panel/assets/Tasks-C7EjXrnN.js +0 -1
- package/src/assets/web-panel/assets/devWarning-CkMEODFC.js +0 -1
- package/src/assets/web-panel/assets/index-BjE5qaKn.js +0 -1
- package/src/assets/web-panel/assets/index-CsFH-2Zk.js +0 -1
package/src/commands/eval.js
CHANGED
|
@@ -14,6 +14,8 @@ import path from "path";
|
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
15
|
import { runEvalSuite } from "../lib/eval/runner.js";
|
|
16
16
|
import { getSuite } from "../lib/eval/tasks.js";
|
|
17
|
+
import { verifyAgentTerminal } from "../lib/eval/stream-terminal.js";
|
|
18
|
+
import { persistVerify01Receipts } from "../lib/eval/verify01-execution.js";
|
|
17
19
|
import executionBroker from "../lib/process-execution-broker/index.js";
|
|
18
20
|
import {
|
|
19
21
|
TelemetryRecorder,
|
|
@@ -48,57 +50,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
48
50
|
// This file is src/commands/eval.js → the CLI entry is bin/chainlesschain.js.
|
|
49
51
|
const BIN = path.resolve(__dirname, "..", "..", "bin", "chainlesschain.js");
|
|
50
52
|
|
|
51
|
-
function verifyAgentTerminal(output) {
|
|
52
|
-
try {
|
|
53
|
-
const events = output
|
|
54
|
-
.split(/\r?\n/u)
|
|
55
|
-
.filter((line) => line.trim())
|
|
56
|
-
.map((line) => JSON.parse(line));
|
|
57
|
-
const results = events.filter((event) => event?.type === "result");
|
|
58
|
-
const terminal = results[0];
|
|
59
|
-
const usage = terminal?.usage;
|
|
60
|
-
const normalizedUsage =
|
|
61
|
-
usage &&
|
|
62
|
-
[
|
|
63
|
-
usage.input_tokens,
|
|
64
|
-
usage.output_tokens,
|
|
65
|
-
usage.cache_read_input_tokens,
|
|
66
|
-
usage.cache_creation_input_tokens,
|
|
67
|
-
].every((value) => Number.isSafeInteger(value) && value >= 0)
|
|
68
|
-
? {
|
|
69
|
-
inputTokens: usage.input_tokens,
|
|
70
|
-
outputTokens: usage.output_tokens,
|
|
71
|
-
cacheReadInputTokens: usage.cache_read_input_tokens,
|
|
72
|
-
cacheCreationInputTokens: usage.cache_creation_input_tokens,
|
|
73
|
-
}
|
|
74
|
-
: null;
|
|
75
|
-
return {
|
|
76
|
-
terminalVerified:
|
|
77
|
-
results.length === 1 &&
|
|
78
|
-
events.at(-1) === terminal &&
|
|
79
|
-
terminal.subtype === "success" &&
|
|
80
|
-
terminal.is_error === false &&
|
|
81
|
-
!events.some((event) => event?.type === "error"),
|
|
82
|
-
observedFallback: events.some((event) =>
|
|
83
|
-
["provider_fallback", "model_fallback"].includes(event?.subtype),
|
|
84
|
-
),
|
|
85
|
-
usage: normalizedUsage,
|
|
86
|
-
totalCostUsd:
|
|
87
|
-
Number.isFinite(terminal?.total_cost_usd) &&
|
|
88
|
-
terminal.total_cost_usd >= 0
|
|
89
|
-
? terminal.total_cost_usd
|
|
90
|
-
: null,
|
|
91
|
-
};
|
|
92
|
-
} catch {
|
|
93
|
-
return {
|
|
94
|
-
terminalVerified: false,
|
|
95
|
-
observedFallback: null,
|
|
96
|
-
usage: null,
|
|
97
|
-
totalCostUsd: null,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
53
|
/**
|
|
103
54
|
* Kill an agent child AND its tool grandchildren. A bare child.kill("SIGTERM")
|
|
104
55
|
* only reaches the direct child (and on Windows TerminateProcess never reaches
|
|
@@ -142,7 +93,7 @@ function killAgentTree(child) {
|
|
|
142
93
|
* workspace. acceptEdits lets it write files without an interactive prompt.
|
|
143
94
|
*/
|
|
144
95
|
function makeHeadlessRunAgent(opts = {}) {
|
|
145
|
-
return function runAgent({ prompt, cwd, timeoutMs }) {
|
|
96
|
+
return function runAgent({ prompt, cwd, timeoutMs, costBudgetUsd }) {
|
|
146
97
|
return new Promise((resolve) => {
|
|
147
98
|
let args;
|
|
148
99
|
if (opts._argv) {
|
|
@@ -163,6 +114,9 @@ function makeHeadlessRunAgent(opts = {}) {
|
|
|
163
114
|
if (opts.model) args.push("--model", opts.model);
|
|
164
115
|
if (opts.provider) args.push("--provider", opts.provider);
|
|
165
116
|
if (opts.ephemeral === true) args.push("--ephemeral");
|
|
117
|
+
if (opts.sandboxMode) args.push("--sandbox-mode", opts.sandboxMode);
|
|
118
|
+
if (Number.isFinite(costBudgetUsd) && costBudgetUsd >= 0)
|
|
119
|
+
args.push("--max-budget-usd", String(costBudgetUsd));
|
|
166
120
|
}
|
|
167
121
|
const child = _deps.spawn(process.execPath, args, {
|
|
168
122
|
cwd,
|
|
@@ -272,6 +226,26 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
272
226
|
"Run the reliability eval suite (self-checking coding tasks) and report the task-success rate",
|
|
273
227
|
)
|
|
274
228
|
.option("--suite <name>", "Suite to run", "builtin")
|
|
229
|
+
.option("--plan-dir <directory>", "Frozen VERIFY-01 plan bundle")
|
|
230
|
+
.option("--plan-digest <digest>", "Externally pinned frozen plan digest")
|
|
231
|
+
.option("--review <file>", "Independent setup/check review configuration")
|
|
232
|
+
.option("--review-digest <digest>", "Review digest pinned before execution")
|
|
233
|
+
.option(
|
|
234
|
+
"--review-root <directory>",
|
|
235
|
+
"Trusted evaluator source root outside the task project",
|
|
236
|
+
)
|
|
237
|
+
.option(
|
|
238
|
+
"--project-root <directory>",
|
|
239
|
+
"Actual checkout of the frozen project commit",
|
|
240
|
+
)
|
|
241
|
+
.option(
|
|
242
|
+
"--samples <ids>",
|
|
243
|
+
"Selected frozen sample IDs; unselected samples remain missing",
|
|
244
|
+
)
|
|
245
|
+
.option(
|
|
246
|
+
"--evidence-dir <directory>",
|
|
247
|
+
"Keep frozen-suite raw process output and complete diffs outside compact Eval history",
|
|
248
|
+
)
|
|
275
249
|
.option("--model <model>", "Model for the agent runs")
|
|
276
250
|
.option("--provider <provider>", "Provider for the agent runs")
|
|
277
251
|
.option("--json", "Output the summary as JSON")
|
|
@@ -381,21 +355,54 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
381
355
|
let tasks;
|
|
382
356
|
let comparison;
|
|
383
357
|
try {
|
|
384
|
-
tasks = _deps.getSuite(options.suite
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
})
|
|
397
|
-
: null,
|
|
358
|
+
tasks = _deps.getSuite(options.suite, {
|
|
359
|
+
verify01: {
|
|
360
|
+
planDir: options.planDir,
|
|
361
|
+
planDigest: options.planDigest,
|
|
362
|
+
reviewFile: options.review,
|
|
363
|
+
reviewDigest: options.reviewDigest,
|
|
364
|
+
reviewRoot: options.reviewRoot,
|
|
365
|
+
projectRoot: options.projectRoot,
|
|
366
|
+
sampleIds: options.samples,
|
|
367
|
+
provider: options.provider,
|
|
368
|
+
model: options.model,
|
|
369
|
+
},
|
|
398
370
|
});
|
|
371
|
+
if (tasks.verification && !/^[a-f0-9]{40}$/u.test(options.label || ""))
|
|
372
|
+
throw new Error(
|
|
373
|
+
"frozen suite requires --label <40-character tested CLI source SHA>; this differs from the task project checkout SHA",
|
|
374
|
+
);
|
|
375
|
+
if (tasks.verification)
|
|
376
|
+
tasks.verification.executionSource = {
|
|
377
|
+
declaredCommit: options.label,
|
|
378
|
+
identityVerified: false,
|
|
379
|
+
declarationOnly: true,
|
|
380
|
+
entryDigest: evalDigest(fs.readFileSync(BIN)),
|
|
381
|
+
};
|
|
382
|
+
if (tasks.verification && !options.evidenceDir)
|
|
383
|
+
throw new Error(
|
|
384
|
+
"frozen suite requires --evidence-dir to retain raw execution material",
|
|
385
|
+
);
|
|
386
|
+
if (tasks.verification && options.comparisonContext)
|
|
387
|
+
throw new Error(
|
|
388
|
+
"frozen suite comparison is bound by its plan; --comparison-context cannot override it",
|
|
389
|
+
);
|
|
390
|
+
comparison =
|
|
391
|
+
tasks.verification?.comparison ||
|
|
392
|
+
createEvalComparison({
|
|
393
|
+
suite: options.suite,
|
|
394
|
+
corpusDigest: evalDigest(
|
|
395
|
+
fs.readFileSync(new URL("../lib/eval/tasks.js", import.meta.url)),
|
|
396
|
+
),
|
|
397
|
+
provider: options.provider,
|
|
398
|
+
model: options.model,
|
|
399
|
+
context: options.comparisonContext
|
|
400
|
+
? readComparisonContext(options.comparisonContext, {
|
|
401
|
+
provider: options.provider,
|
|
402
|
+
model: options.model,
|
|
403
|
+
})
|
|
404
|
+
: null,
|
|
405
|
+
});
|
|
399
406
|
} catch (err) {
|
|
400
407
|
log.error ? log.error(err.message) : console.error(err.message);
|
|
401
408
|
process.exitCode = 1;
|
|
@@ -406,6 +413,12 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
406
413
|
: makeHeadlessRunAgent({
|
|
407
414
|
model: options.model,
|
|
408
415
|
provider: options.provider,
|
|
416
|
+
...(tasks.verification
|
|
417
|
+
? {
|
|
418
|
+
ephemeral: true,
|
|
419
|
+
sandboxMode: tasks.verification.requiredSandboxMode,
|
|
420
|
+
}
|
|
421
|
+
: {}),
|
|
409
422
|
});
|
|
410
423
|
|
|
411
424
|
// OTel-shaped telemetry for the run (per-task span + failure class).
|
|
@@ -414,7 +427,7 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
414
427
|
const summary = await _deps.runEvalSuite(tasks, {
|
|
415
428
|
runAgent,
|
|
416
429
|
recorder,
|
|
417
|
-
keepWorkspaces: options.keep === true,
|
|
430
|
+
keepWorkspaces: options.keep === true || Boolean(tasks.verification),
|
|
418
431
|
onResult: options.json
|
|
419
432
|
? undefined
|
|
420
433
|
: (r) =>
|
|
@@ -432,6 +445,40 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
432
445
|
dryRun: options.dryRun === true,
|
|
433
446
|
label: options.label || null,
|
|
434
447
|
});
|
|
448
|
+
if (tasks.verification) {
|
|
449
|
+
try {
|
|
450
|
+
record.verification = {
|
|
451
|
+
...persistVerify01Receipts(
|
|
452
|
+
tasks.verification,
|
|
453
|
+
options.evidenceDir,
|
|
454
|
+
record.runId,
|
|
455
|
+
),
|
|
456
|
+
executionStatus: options.dryRun ? "DRY_RUN" : "ATTEMPTED",
|
|
457
|
+
// Execution material for the existing collector, not an observation
|
|
458
|
+
// or an independent acceptance of the frozen population.
|
|
459
|
+
observationsCreated: false,
|
|
460
|
+
collectionReady:
|
|
461
|
+
options.dryRun !== true &&
|
|
462
|
+
record.results.every(
|
|
463
|
+
(result) =>
|
|
464
|
+
result.executionEvidence?.terminalVerified === true &&
|
|
465
|
+
result.executionEvidence.protocol ===
|
|
466
|
+
EVAL_EXECUTION_PROTOCOL &&
|
|
467
|
+
result.executionEvidence.observedFallback === false &&
|
|
468
|
+
Number.isFinite(result.totalCostUsd) &&
|
|
469
|
+
result.totalCostUsd >= 0 &&
|
|
470
|
+
Array.isArray(result.unrelatedChanges) &&
|
|
471
|
+
result.unrelatedChanges.length === 0,
|
|
472
|
+
),
|
|
473
|
+
};
|
|
474
|
+
} catch (error) {
|
|
475
|
+
(log.error || console.error)(
|
|
476
|
+
`frozen evidence persistence failed: ${error.message}`,
|
|
477
|
+
);
|
|
478
|
+
process.exitCode = 1;
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
435
482
|
|
|
436
483
|
if (options.otlp) {
|
|
437
484
|
try {
|
|
@@ -485,6 +532,8 @@ export function registerEvalCommand(program, { logger } = {}) {
|
|
|
485
532
|
// Non-zero exit when not every task passed — usable as a CI gate.
|
|
486
533
|
if (summary.total === 0 || summary.passed < summary.total)
|
|
487
534
|
process.exitCode = 1;
|
|
535
|
+
else if (record.verification && !record.verification.collectionReady)
|
|
536
|
+
process.exitCode = 2;
|
|
488
537
|
});
|
|
489
538
|
return program;
|
|
490
539
|
}
|
package/src/commands/memory.js
CHANGED
|
@@ -166,27 +166,40 @@ export function registerMemoryCommand(program) {
|
|
|
166
166
|
.description("Show memory entries")
|
|
167
167
|
.option("-n, --limit <n>", "Max entries", "20")
|
|
168
168
|
.option("--category <cat>", "Filter by category")
|
|
169
|
+
.option("--page", "Return a page with a next-page cursor")
|
|
170
|
+
.option("--cursor <cursor>", "Continue a page using the same filters")
|
|
169
171
|
.option("--json", "Output as JSON")
|
|
170
172
|
.action(async (options) => {
|
|
171
173
|
try {
|
|
172
174
|
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
173
175
|
const service = await resolveCanonicalMemory(ctx);
|
|
174
176
|
if (!ctx.db && !service.decision.canonical) {
|
|
175
|
-
|
|
176
|
-
process.exit(1);
|
|
177
|
+
throw new Error("Database not available");
|
|
177
178
|
}
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
const paged = Boolean(options.page || options.cursor !== undefined);
|
|
180
|
+
if (paged && !service.decision.canonical) {
|
|
181
|
+
throw new Error(
|
|
182
|
+
"Paged memory listing requires canonical memory mode",
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
if (options.cursor !== undefined && !options.cursor.trim()) {
|
|
186
|
+
throw new Error("Pagination cursor must not be empty");
|
|
187
|
+
}
|
|
188
|
+
const query = {
|
|
189
|
+
limit: Math.max(1, parseInt(options.limit) || 20),
|
|
190
|
+
category: options.category,
|
|
191
|
+
};
|
|
192
|
+
const page = paged
|
|
193
|
+
? await service.listPage({ ...query, cursor: options.cursor })
|
|
194
|
+
: null;
|
|
195
|
+
const entries = page
|
|
196
|
+
? page.entries
|
|
197
|
+
: service.decision.canonical
|
|
198
|
+
? await service.list(query)
|
|
199
|
+
: listMemory(ctx.db.getDatabase(), query);
|
|
187
200
|
|
|
188
201
|
if (options.json) {
|
|
189
|
-
console.log(JSON.stringify(entries, null, 2));
|
|
202
|
+
console.log(JSON.stringify(page || entries, null, 2));
|
|
190
203
|
} else if (entries.length === 0) {
|
|
191
204
|
logger.info("No memory entries. Use 'memory add' to create one.");
|
|
192
205
|
} else {
|
|
@@ -206,11 +219,17 @@ export function registerMemoryCommand(program) {
|
|
|
206
219
|
logger.log(` ${chalk.gray(e.created_at)}`);
|
|
207
220
|
}
|
|
208
221
|
}
|
|
209
|
-
|
|
210
|
-
|
|
222
|
+
if (!options.json && page?.nextCursor) {
|
|
223
|
+
logger.log(`Next page cursor: ${page.nextCursor}`);
|
|
224
|
+
logger.log(
|
|
225
|
+
"Use 'memory show --cursor <cursor>' with the same category and limit.",
|
|
226
|
+
);
|
|
227
|
+
}
|
|
211
228
|
} catch (err) {
|
|
212
229
|
logger.error(`Failed: ${err.message}`);
|
|
213
|
-
process.
|
|
230
|
+
process.exitCode = 1;
|
|
231
|
+
} finally {
|
|
232
|
+
await shutdown();
|
|
214
233
|
}
|
|
215
234
|
});
|
|
216
235
|
|
package/src/commands/sandbox.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { intArg } from "../lib/cli-arg.js";
|
|
8
|
+
import { describeExecutionSupport } from "../lib/execution-support.js";
|
|
8
9
|
import ora from "ora";
|
|
9
10
|
import { logger } from "../lib/logger.js";
|
|
10
11
|
import { bootstrap, shutdown } from "../runtime/bootstrap.js";
|
|
@@ -132,6 +133,7 @@ export function registerSandboxCommand(program, dependencies = {}) {
|
|
|
132
133
|
availability,
|
|
133
134
|
host: dependencies.host,
|
|
134
135
|
});
|
|
136
|
+
report.support = describeExecutionSupport({ capabilityReport: report });
|
|
135
137
|
|
|
136
138
|
if (options.json) {
|
|
137
139
|
console.log(JSON.stringify(report, null, 2));
|
|
@@ -144,6 +146,13 @@ export function registerSandboxCommand(program, dependencies = {}) {
|
|
|
144
146
|
` Backend: ${report.backend.engine || "none"} (${report.backend.availabilityChecked ? (report.backend.available ? "available" : "unavailable") : "not probed"})`,
|
|
145
147
|
);
|
|
146
148
|
logger.log(` Status: ${report.status}`);
|
|
149
|
+
logger.log(
|
|
150
|
+
` I/O: ${report.support.io.stdin} stdin; captured stdout/stderr`,
|
|
151
|
+
);
|
|
152
|
+
logger.log(` Permission source: ${report.support.permissionSource}`);
|
|
153
|
+
logger.log(
|
|
154
|
+
` Persistent network revocation: ${report.support.persistentNetworkRevocation.status} (${report.support.persistentNetworkRevocation.reason || "configured"})`,
|
|
155
|
+
);
|
|
147
156
|
logger.log(
|
|
148
157
|
` Execution observed: ${report.execution.observed ? "yes" : "no"}`,
|
|
149
158
|
);
|
package/src/data/changelog.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": "CHANGELOG.md",
|
|
3
3
|
"releases": [
|
|
4
|
+
{
|
|
5
|
+
"productVersion": null,
|
|
6
|
+
"cliVersion": "0.166.88",
|
|
7
|
+
"cliVersions": ["0.166.88"],
|
|
8
|
+
"date": null,
|
|
9
|
+
"title": "",
|
|
10
|
+
"sections": [
|
|
11
|
+
{
|
|
12
|
+
"heading": "Added - cc CLI 0.166.88: reviewed acceptance packs and host evidence import",
|
|
13
|
+
"body": "- Generate byte-pinned setup/check scripts for all 36 frozen tasks, including\n behavior mutants, bounded Linux Docker execution and raw acceptance receipts.\n- Import IDE and first-run evidence through existing Eval/outcome contracts,\n requiring input acceptance, terminal state, drained exit and complete file diffs.\n Explicit failures stay failures; missing cost and identity attestation stay unknown.\n- Pair VS Code `0.37.133` and JetBrains `0.4.151` with CLI `0.166.88` for optional\n ordered protocol capture. Full container, GUI, provider and billing acceptance\n remain open; the frozen 36+9 samples remain `NOT_RUN`."
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"productVersion": null,
|
|
19
|
+
"cliVersion": "0.166.87",
|
|
20
|
+
"cliVersions": ["0.166.87"],
|
|
21
|
+
"date": null,
|
|
22
|
+
"title": "",
|
|
23
|
+
"sections": [
|
|
24
|
+
{
|
|
25
|
+
"heading": "Added - cc CLI 0.166.87: October model contracts and indexed memory queries",
|
|
26
|
+
"body": "- Add exact GPT-6.1 Sol and Claude Sonnet 5.5 profiles, model-specific cache\n pricing, Responses reasoning/output validation and reviewed catalog drift checks.\n- Push memory list filters and limits into authority-bound query indexes, retain\n stable snapshot pagination and rebuild corrupted derived indexes from authority.\n Upgraded index descriptors require compatible readers; older readers fail closed.\n- Add a reviewed frozen CLI evaluation entry with isolated project snapshots,\n independent acceptance scripts and raw execution evidence. Real provider/IDE\n evaluation and billing acceptance remain separate from fixture validation.\n- Support explicit cooperative Linux cgroup2 ownership cleanup after supervisor\n loss, preserving quarantine when kernel identity or durable settlement is unknown.\n- Verify Codex 0.160.0 native protocol and pinned MCP reference-server recovery\n without expanding the production external-agent admission allowlist.\n- Pair VS Code `0.37.132` and JetBrains `0.4.150` with CLI `0.166.87` for live\n capability diagnostics, strict CLI identity and bounded slow-start draft handling."
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
4
30
|
{
|
|
5
31
|
"productVersion": null,
|
|
6
32
|
"cliVersion": "0.166.86",
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
PRICE_TABLE,
|
|
12
|
+
priceRollup,
|
|
13
|
+
normalizePricingTerms,
|
|
14
|
+
} from "./llm-pricing.js";
|
|
11
15
|
import {
|
|
12
16
|
projectUsagePricingContext,
|
|
13
17
|
mergeUsagePricingBucket,
|
|
@@ -267,50 +271,7 @@ function normalizePricingTable(table = PRICE_TABLE) {
|
|
|
267
271
|
result.exact = entry.exact;
|
|
268
272
|
}
|
|
269
273
|
if (Object.hasOwn(entry, "terms")) {
|
|
270
|
-
|
|
271
|
-
const nonNegative = (value) => {
|
|
272
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
273
|
-
throw new Error("invalid pricing multiplier");
|
|
274
|
-
return value;
|
|
275
|
-
};
|
|
276
|
-
assertKnownOwnKeys(
|
|
277
|
-
terms,
|
|
278
|
-
new Set([
|
|
279
|
-
"cacheReadMultiplier",
|
|
280
|
-
"cacheWriteMultiplier",
|
|
281
|
-
"longContext",
|
|
282
|
-
"serviceMultipliers",
|
|
283
|
-
]),
|
|
284
|
-
"pricing terms",
|
|
285
|
-
);
|
|
286
|
-
assertKnownOwnKeys(
|
|
287
|
-
terms.longContext,
|
|
288
|
-
new Set(["threshold", "inputMultiplier", "outputMultiplier"]),
|
|
289
|
-
"pricing long context",
|
|
290
|
-
);
|
|
291
|
-
const threshold = nonNegative(terms.longContext.threshold);
|
|
292
|
-
if (!Number.isSafeInteger(threshold))
|
|
293
|
-
throw new Error("invalid pricing threshold");
|
|
294
|
-
assertKnownOwnKeys(
|
|
295
|
-
terms.serviceMultipliers,
|
|
296
|
-
new Set(["standard", "default", "auto", "batch", "flex", "fast"]),
|
|
297
|
-
"pricing service multipliers",
|
|
298
|
-
);
|
|
299
|
-
result.terms = {
|
|
300
|
-
cacheReadMultiplier: nonNegative(terms.cacheReadMultiplier),
|
|
301
|
-
cacheWriteMultiplier: nonNegative(terms.cacheWriteMultiplier),
|
|
302
|
-
longContext: {
|
|
303
|
-
threshold,
|
|
304
|
-
inputMultiplier: nonNegative(terms.longContext.inputMultiplier),
|
|
305
|
-
outputMultiplier: nonNegative(terms.longContext.outputMultiplier),
|
|
306
|
-
},
|
|
307
|
-
serviceMultipliers: Object.fromEntries(
|
|
308
|
-
Object.entries(terms.serviceMultipliers).map(([key, value]) => [
|
|
309
|
-
key,
|
|
310
|
-
nonNegative(value),
|
|
311
|
-
]),
|
|
312
|
-
),
|
|
313
|
-
};
|
|
274
|
+
result.terms = normalizePricingTerms(entry.terms);
|
|
314
275
|
}
|
|
315
276
|
return result;
|
|
316
277
|
});
|
|
@@ -21,6 +21,16 @@ import {
|
|
|
21
21
|
} from "@chainlesschain/context-memory-kernel";
|
|
22
22
|
import { withFileLock } from "../with-file-lock.js";
|
|
23
23
|
import { getHomeDir } from "../paths.js";
|
|
24
|
+
import { resolve } from "node:path";
|
|
25
|
+
import {
|
|
26
|
+
compareMemoryRows,
|
|
27
|
+
decodeListCursor,
|
|
28
|
+
encodeListCursor,
|
|
29
|
+
listCursorBinding,
|
|
30
|
+
matchesListQuery,
|
|
31
|
+
normalizeListQuery,
|
|
32
|
+
pageLimit,
|
|
33
|
+
} from "./memory-query-index.js";
|
|
24
34
|
|
|
25
35
|
const STORE_SCHEMA = "chainlesschain.cli-context-memory-store/v1";
|
|
26
36
|
const DEFAULT_MAX_STORE_BYTES = 64 * 1024 * 1024;
|
|
@@ -292,19 +302,48 @@ export class DurableJsonMemoryPort {
|
|
|
292
302
|
);
|
|
293
303
|
}
|
|
294
304
|
|
|
295
|
-
async listRecords(
|
|
305
|
+
async listRecords(options = {}) {
|
|
306
|
+
const query = normalizeListQuery(options);
|
|
296
307
|
const records = await this.query();
|
|
297
308
|
return records
|
|
298
|
-
.filter(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
309
|
+
.filter((record) => matchesListQuery(record, query))
|
|
310
|
+
.sort(compareMemoryRows)
|
|
311
|
+
.slice(
|
|
312
|
+
0,
|
|
313
|
+
options.limit == null
|
|
314
|
+
? undefined
|
|
315
|
+
: Math.max(1, Number(options.limit) || 20),
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async listPage(options = {}) {
|
|
320
|
+
const query = normalizeListQuery(options);
|
|
321
|
+
const count = pageLimit(options.limit);
|
|
322
|
+
return this._locked(() => {
|
|
323
|
+
const state = this._readUnlocked();
|
|
324
|
+
const binding = listCursorBinding(
|
|
325
|
+
resolve(this.filePath),
|
|
326
|
+
state.digest,
|
|
327
|
+
query,
|
|
307
328
|
);
|
|
329
|
+
const after = decodeListCursor(options.cursor, binding);
|
|
330
|
+
const matches = Object.values(state.records)
|
|
331
|
+
.filter(
|
|
332
|
+
(record) =>
|
|
333
|
+
matchesListQuery(record, query) &&
|
|
334
|
+
(!after || compareMemoryRows(record, after) > 0),
|
|
335
|
+
)
|
|
336
|
+
.sort(compareMemoryRows);
|
|
337
|
+
const records = matches.slice(0, count);
|
|
338
|
+
return {
|
|
339
|
+
records,
|
|
340
|
+
storeRevision: state.storeRevision,
|
|
341
|
+
nextCursor:
|
|
342
|
+
matches.length > count
|
|
343
|
+
? encodeListCursor(binding, records.at(-1))
|
|
344
|
+
: null,
|
|
345
|
+
};
|
|
346
|
+
});
|
|
308
347
|
}
|
|
309
348
|
|
|
310
349
|
async commit({ record, event, reconciliation }, expectedRevision = 0) {
|