@leuduan/lagent 0.1.2 → 44.0.0
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 +28 -15
- package/dist/chunks/{UC3FVVJ2.js → 2GCIWSOA.js} +2 -2
- package/dist/chunks/2P47AHNK.js +7 -0
- package/dist/chunks/3UMZMPWW.js +1 -0
- package/dist/chunks/5IRF47YB.js +1 -0
- package/dist/chunks/6DRCKZ2C.js +1 -0
- package/dist/chunks/6FRNHMCV.js +1 -0
- package/dist/chunks/7LI64H5X.js +17 -0
- package/dist/chunks/{SL2YLB2F.js → 7VAPNE3L.js} +1 -1
- package/dist/chunks/{BM3S37EZ.js → ASSQZH3F.js} +1 -1
- package/dist/chunks/B4FXK5ER.js +77 -0
- package/dist/chunks/{37YOGDGY.js → BBCW2FZK.js} +1 -1
- package/dist/chunks/BPRCULZH.js +1 -0
- package/dist/chunks/CANPZYTH.js +24 -0
- package/dist/chunks/CQEVREBT.js +1 -0
- package/dist/chunks/CUK7CGC7.js +1 -0
- package/dist/chunks/D4PQP5MA.js +3 -0
- package/dist/chunks/{CDQG7RKA.js → DDZ7YF26.js} +1 -1
- package/dist/chunks/EMRB4KCN.js +6 -0
- package/dist/chunks/EPYQ5M3B.js +3 -0
- package/dist/chunks/G44LG6VL.js +1 -0
- package/dist/chunks/GGSVIIWJ.js +2 -0
- package/dist/chunks/IAAEP6VL.js +30 -0
- package/dist/chunks/{AP6Q4EPT.js → JCTBX33H.js} +1 -1
- package/dist/chunks/JFX2MXBA.js +4 -0
- package/dist/chunks/JFZZXVWD.js +15 -0
- package/dist/chunks/KUZCL2SH.js +1 -0
- package/dist/chunks/MHC6VPB4.js +7 -0
- package/dist/chunks/MMNNZCBO.js +5 -0
- package/dist/chunks/{C5LYCXJG.js → MNJ4SRF7.js} +1 -1
- package/dist/chunks/N6IXG2VL.js +1 -0
- package/dist/chunks/OCBPT7KE.js +1 -0
- package/dist/chunks/OL5A6ITQ.js +1 -0
- package/dist/chunks/Q75FUN7D.js +2 -0
- package/dist/chunks/Q7S5LFGN.js +1 -0
- package/dist/chunks/RCIHV3KG.js +1 -0
- package/dist/chunks/S34ZA2R6.js +1 -0
- package/dist/chunks/SS3B5W34.js +12 -0
- package/dist/chunks/VYMT4TXD.js +1 -0
- package/dist/chunks/W57RW55W.js +1 -0
- package/dist/compositions/base.d.ts +11 -0
- package/dist/{presets → compositions}/codex.d.ts +12 -6
- package/dist/{presets/prompts.d.ts → compositions/codexPrompts.d.ts} +1 -1
- package/dist/context.d.ts +18 -10
- package/dist/index.d.ts +31 -23
- package/dist/index.js +1 -77
- package/dist/journal/catalog.d.ts +1 -1
- package/dist/journal/journal.d.ts +3 -3
- package/dist/journal/projection.d.ts +1 -1
- package/dist/journal/store.d.ts +3 -3
- package/dist/llm/index.d.ts +19 -13
- package/dist/llm/index.js +1 -0
- package/dist/llm/provider.d.ts +11 -0
- package/dist/loop/agent.d.ts +16 -132
- package/dist/loop/authorization.d.ts +41 -0
- package/dist/loop/auxiliary.d.ts +7 -3
- package/dist/loop/chunks.d.ts +3 -3
- package/dist/loop/completion.d.ts +17 -0
- package/dist/loop/errors.d.ts +6 -29
- package/dist/loop/hooks.d.ts +39 -6
- package/dist/loop/index.d.ts +7 -28
- package/dist/loop/runner.d.ts +134 -0
- package/dist/loop/runtime.d.ts +7 -16
- package/dist/loop/strategy.d.ts +12 -3
- package/dist/loop/{prepare.d.ts → surfacePrepare.d.ts} +2 -2
- package/dist/loop/tool.d.ts +11 -6
- package/dist/loop/toolCalls.d.ts +3 -10
- package/dist/plugin.d.ts +31 -34
- package/dist/plugin.js +1 -1
- package/dist/plugins/agentsMd.d.ts +24 -20
- package/dist/plugins/agentsMd.js +1 -1
- package/dist/plugins/ask/index.d.ts +2 -2
- package/dist/plugins/ask/index.js +1 -1
- package/dist/plugins/ask/service.d.ts +2 -2
- package/dist/plugins/commands/index.d.ts +5 -2
- package/dist/plugins/commands/index.js +1 -1
- package/dist/plugins/commands/output.d.ts +1 -1
- package/dist/plugins/commands/record.d.ts +31 -22
- package/dist/plugins/commands/service.d.ts +18 -11
- package/dist/plugins/commands/{background.d.ts → tools.d.ts} +2 -0
- package/dist/plugins/compaction/checkpoint.d.ts +4 -1
- package/dist/plugins/compaction/config.d.ts +3 -3
- package/dist/plugins/compaction/estimate.d.ts +9 -1
- package/dist/plugins/compaction/index.d.ts +87 -2
- package/dist/plugins/compaction/index.js +5 -5
- package/dist/plugins/compaction/{records.d.ts → record.d.ts} +36 -36
- package/dist/plugins/compaction/{log.d.ts → state.d.ts} +8 -1
- package/dist/plugins/dateAndBranch.js +1 -1
- package/dist/plugins/delegations/answers.d.ts +1 -1
- package/dist/plugins/delegations/assignmentKey.d.ts +1 -1
- package/dist/plugins/delegations/cleanup.d.ts +1 -1
- package/dist/plugins/delegations/index.js +1 -1
- package/dist/plugins/delegations/notices.d.ts +8 -8
- package/dist/plugins/delegations/obligations.d.ts +13 -13
- package/dist/plugins/delegations/record.d.ts +11 -10
- package/dist/plugins/delegations/request.d.ts +8 -5
- package/dist/plugins/delegations/role.d.ts +1 -1
- package/dist/plugins/delegations/service.d.ts +9 -8
- package/dist/plugins/delegations/{waitBook.d.ts → waitResolver.d.ts} +9 -9
- package/dist/plugins/diagnostics/digest.d.ts +1 -1
- package/dist/plugins/diagnostics/index.d.ts +1 -1
- package/dist/plugins/diagnostics/index.js +1 -1
- package/dist/plugins/fileTools/config.d.ts +10 -0
- package/dist/plugins/{tools → fileTools}/editFiles.d.ts +16 -27
- package/dist/plugins/fileTools/gitDiscovery.d.ts +9 -0
- package/dist/plugins/fileTools/index.d.ts +18 -0
- package/dist/plugins/fileTools/index.js +1 -0
- package/dist/plugins/fileTools/tools.d.ts +6 -0
- package/dist/plugins/historyRecall/history.d.ts +1 -1
- package/dist/plugins/historyRecall/index.js +1 -1
- package/dist/plugins/historyRecall/render.d.ts +1 -1
- package/dist/plugins/mcp/catalog.d.ts +1 -1
- package/dist/plugins/mcp/index.d.ts +2 -2
- package/dist/plugins/mcp/index.js +1 -1
- package/dist/plugins/mcp/mount.d.ts +2 -2
- package/dist/plugins/mcp/render.d.ts +1 -1
- package/dist/plugins/mcp/{tool.d.ts → tools.d.ts} +1 -1
- package/dist/plugins/{routeContext.d.ts → routeNotice.d.ts} +2 -2
- package/dist/plugins/routeNotice.js +1 -0
- package/dist/{sandbox → plugins/sandbox}/absent.d.ts +11 -10
- package/dist/{sandbox → plugins/sandbox}/index.d.ts +5 -2
- package/dist/plugins/sandbox/index.js +4 -0
- package/dist/{sandbox → plugins/sandbox}/mode.d.ts +5 -5
- package/dist/plugins/sandbox/policy.d.ts +163 -0
- package/dist/{sandbox → plugins/sandbox}/service.d.ts +23 -13
- package/dist/plugins/schedules/index.js +3 -3
- package/dist/plugins/schedules/record.d.ts +18 -18
- package/dist/plugins/schedules/service.d.ts +2 -2
- package/dist/plugins/skills/discovery.d.ts +38 -9
- package/dist/plugins/skills/index.d.ts +1 -1
- package/dist/plugins/skills/index.js +1 -1
- package/dist/plugins/subAgents/index.js +1 -1
- package/dist/plugins/subAgents/{fork.d.ts → tools.d.ts} +36 -1
- package/dist/plugins/threadDirs.d.ts +36 -0
- package/dist/plugins/threadDirs.js +1 -0
- package/dist/plugins/toolPolicy/index.d.ts +2 -2
- package/dist/plugins/toolPolicy/index.js +1 -1
- package/dist/plugins/truncateToolOutput.d.ts +14 -10
- package/dist/plugins/truncateToolOutput.js +6 -1
- package/dist/plugins/usage/index.d.ts +4 -2
- package/dist/plugins/usage/index.js +1 -1
- package/dist/plugins/usage/tracker.d.ts +1 -1
- package/dist/plugins/verify/index.d.ts +7 -55
- package/dist/plugins/verify/index.js +6 -1
- package/dist/plugins/verify/judgement.d.ts +16 -0
- package/dist/plugins/verify/record.d.ts +382 -0
- package/dist/plugins/verify/service.d.ts +7 -4
- package/dist/plugins/verify/state.d.ts +58 -0
- package/dist/plugins/webTools/index.d.ts +34 -0
- package/dist/plugins/webTools/index.js +1 -0
- package/dist/plugins/workflows/assignment.d.ts +6 -2
- package/dist/plugins/workflows/cleanup.d.ts +1 -1
- package/dist/plugins/workflows/definition.d.ts +2 -2
- package/dist/plugins/workflows/{bindings.d.ts → entryPlan.d.ts} +2 -2
- package/dist/plugins/workflows/{providers.d.ts → hostBindings.d.ts} +2 -2
- package/dist/plugins/workflows/index.d.ts +4 -4
- package/dist/plugins/workflows/index.js +10 -5
- package/dist/plugins/workflows/observations.d.ts +3 -3
- package/dist/plugins/workflows/participantModels.d.ts +28 -0
- package/dist/plugins/workflows/participants.d.ts +2 -2
- package/dist/plugins/workflows/policy.d.ts +2 -2
- package/dist/plugins/workflows/record.d.ts +51 -65
- package/dist/plugins/workflows/routing.d.ts +2 -2
- package/dist/plugins/workflows/service.d.ts +24 -24
- package/dist/plugins/workflows/{fold.d.ts → state.d.ts} +2 -2
- package/dist/plugins/workflows/stopCheck.d.ts +13 -0
- package/dist/plugins/workflows/tools.d.ts +13 -0
- package/dist/plugins/workflows/view.d.ts +2 -2
- package/dist/plugins/{workspaceContext.d.ts → workspaceNotice.d.ts} +5 -7
- package/dist/plugins/workspaceNotice.js +1 -0
- package/dist/{plugins/providers → providers}/anthropic.d.ts +6 -3
- package/dist/{plugins/providers → providers}/anthropicMessages.d.ts +2 -1
- package/dist/{plugins/providers → providers}/codex.d.ts +14 -3
- package/dist/{plugins/providers → providers}/deepseek.d.ts +6 -2
- package/dist/{plugins/providers → providers}/failure.d.ts +1 -1
- package/dist/{plugins/providers → providers}/gateway.d.ts +2 -1
- package/dist/providers/index.d.ts +18 -0
- package/dist/providers/index.js +6 -0
- package/dist/{plugins/providers → providers}/openaiChat.d.ts +13 -2
- package/dist/{plugins/providers → providers}/openaiResponses.d.ts +12 -3
- package/dist/{plugins/providers → providers}/opencodeCopilot.d.ts +2 -2
- package/dist/{plugins/providers → providers}/opencodeGo.d.ts +18 -7
- package/dist/{plugins/providers → providers}/shared.d.ts +9 -1
- package/dist/{plugins/providers → providers}/stream.d.ts +4 -2
- package/dist/{models/door.d.ts → records/index.d.ts} +8 -7
- package/dist/records/index.js +1 -0
- package/dist/{models/wire → records}/journal.d.ts +210 -14
- package/dist/{models/wire/primitives.d.ts → records/toolResult.d.ts} +1 -1
- package/dist/services/agents.d.ts +26 -1
- package/dist/services/confinement/files.d.ts +118 -0
- package/dist/services/confinement/service.d.ts +219 -0
- package/dist/services/core.d.ts +2 -8
- package/dist/{kit/extension.d.ts → services/extensionEvents.d.ts} +5 -4
- package/dist/services/journal.d.ts +1 -1
- package/dist/services/llm.d.ts +4 -2
- package/dist/{kit → services}/modes.d.ts +1 -1
- package/dist/services/plugins.d.ts +34 -0
- package/dist/services/{preset.d.ts → presets/definition.d.ts} +4 -4
- package/dist/services/{presets.d.ts → presets/installations.d.ts} +3 -3
- package/dist/services/prompts.d.ts +23 -5
- package/dist/services/{threadActivation.d.ts → threads/activation.d.ts} +3 -3
- package/dist/services/{admission.d.ts → threads/admission.d.ts} +3 -3
- package/dist/services/{birth.d.ts → threads/birth.d.ts} +9 -10
- package/dist/services/threads/index.d.ts +14 -0
- package/dist/services/{runEvents.d.ts → threads/runEvents.d.ts} +2 -2
- package/dist/services/{owner.d.ts → threads/runOwner.d.ts} +5 -4
- package/dist/services/{threads.d.ts → threads/service.d.ts} +9 -8
- package/dist/services/{thread.d.ts → threads/thread.d.ts} +8 -7
- package/dist/services/{threadView.d.ts → threads/view.d.ts} +7 -6
- package/dist/services/tools.d.ts +79 -2
- package/dist/{loop/opening.d.ts → state/birth.d.ts} +22 -2
- package/dist/{loop → state}/chain.d.ts +3 -3
- package/dist/state/confirmations.d.ts +64 -0
- package/dist/{loop → state}/continuation.d.ts +3 -2
- package/dist/{loop → state}/decide.d.ts +10 -2
- package/dist/state/dispatches.d.ts +54 -0
- package/dist/state/errors.d.ts +26 -0
- package/dist/{loop → state}/forks.d.ts +1 -1
- package/dist/{loop → state}/holds.d.ts +1 -1
- package/dist/{loop → state}/inbox.d.ts +2 -2
- package/dist/state/index.d.ts +31 -0
- package/dist/state/inputs.d.ts +58 -0
- package/dist/state/installations.d.ts +28 -0
- package/dist/state/prompt.d.ts +13 -0
- package/dist/state/recovery.d.ts +7 -0
- package/dist/{loop → state}/replace.d.ts +2 -2
- package/dist/{loop → state}/requests.d.ts +3 -3
- package/dist/{loop → state}/route.d.ts +10 -2
- package/dist/state/summary.d.ts +16 -0
- package/dist/{loop → state}/surface.d.ts +3 -3
- package/dist/state/surfaceRead.d.ts +20 -0
- package/dist/{loop/threadState.d.ts → state/thread.d.ts} +12 -11
- package/dist/state/turns.d.ts +87 -0
- package/dist/state/waits.d.ts +38 -0
- package/dist/{loop → state}/wake.d.ts +1 -1
- package/dist/stores/durableObject.js +1 -0
- package/dist/{plugins/store → stores}/memory.d.ts +2 -2
- package/dist/{plugins/store → stores}/sql.d.ts +2 -2
- package/dist/stores/sqlite.js +1 -0
- package/dist/sys/environment.d.ts +0 -5
- package/dist/sys/git.d.ts +0 -13
- package/dist/sys/paths.d.ts +0 -47
- package/dist/sys/spawn.d.ts +16 -6
- package/dist/testing/clock.d.ts +1 -1
- package/dist/testing/fakeLlm.d.ts +4 -2
- package/dist/testing/fedLlm.d.ts +3 -1
- package/dist/testing/helpers.d.ts +31 -13
- package/dist/testing/index.js +1 -1
- package/dist/testing/settlement.d.ts +1 -1
- package/package.json +36 -28
- package/dist/chunks/2O7ZGEIT.js +0 -1
- package/dist/chunks/2OSESBIL.js +0 -1
- package/dist/chunks/3LQHQRIU.js +0 -6
- package/dist/chunks/3QCW4WDJ.js +0 -1
- package/dist/chunks/4XVRUSCQ.js +0 -1
- package/dist/chunks/6ECI2GGV.js +0 -1
- package/dist/chunks/74HKUGRR.js +0 -1
- package/dist/chunks/ADHERZLW.js +0 -2
- package/dist/chunks/D7E6EWIE.js +0 -3
- package/dist/chunks/DRYAN665.js +0 -1
- package/dist/chunks/DXFXAYDN.js +0 -17
- package/dist/chunks/EGZI4XQX.js +0 -24
- package/dist/chunks/ENWFSU27.js +0 -41
- package/dist/chunks/G6RXC3AL.js +0 -1
- package/dist/chunks/G74AGRAJ.js +0 -15
- package/dist/chunks/GQGNVSKB.js +0 -1
- package/dist/chunks/IJ2WNMD5.js +0 -7
- package/dist/chunks/JPZFKSWT.js +0 -1
- package/dist/chunks/KESCTXGO.js +0 -5
- package/dist/chunks/L3N4FIEN.js +0 -1
- package/dist/chunks/NAOUTU7A.js +0 -4
- package/dist/chunks/NDIM7MEW.js +0 -1
- package/dist/chunks/O4PPOM5Z.js +0 -2
- package/dist/chunks/OVZFGILJ.js +0 -1
- package/dist/chunks/P5ZHHOOM.js +0 -6
- package/dist/chunks/QMMLQJBS.js +0 -1
- package/dist/chunks/RK3VP2Q4.js +0 -3
- package/dist/chunks/SGGMBSBA.js +0 -1
- package/dist/chunks/TOOIB6J2.js +0 -1
- package/dist/chunks/TYTQRLTX.js +0 -1
- package/dist/chunks/UCTEU62F.js +0 -1
- package/dist/chunks/UD3VJER6.js +0 -1
- package/dist/chunks/WUUKTSRT.js +0 -7
- package/dist/chunks/X65X4KP5.js +0 -7
- package/dist/chunks/YIR5MYGU.js +0 -1
- package/dist/chunks/YLNJXQ3Z.js +0 -1
- package/dist/kit/claim.d.ts +0 -13
- package/dist/kit/drain.d.ts +0 -10
- package/dist/kit/grants.d.ts +0 -9
- package/dist/kit/scope.d.ts +0 -32
- package/dist/kit/service.d.ts +0 -7
- package/dist/kit/strategy.d.ts +0 -10
- package/dist/kit/tool.d.ts +0 -72
- package/dist/llm/door.d.ts +0 -21
- package/dist/llm/door.js +0 -1
- package/dist/loop/projections.d.ts +0 -307
- package/dist/loop/state.d.ts +0 -70
- package/dist/loop/summary.d.ts +0 -3
- package/dist/models/config/agent.d.ts +0 -18
- package/dist/models/config/prompt.d.ts +0 -18
- package/dist/models/door.js +0 -1
- package/dist/models/index.d.ts +0 -7
- package/dist/plugins/commands/foreground.d.ts +0 -4
- package/dist/plugins/compaction/preset.d.ts +0 -86
- package/dist/plugins/compaction/shared.d.ts +0 -14
- package/dist/plugins/delegations/testing.d.ts +0 -16
- package/dist/plugins/providers/door.d.ts +0 -61
- package/dist/plugins/providers/door.js +0 -1
- package/dist/plugins/providers/index.d.ts +0 -6
- package/dist/plugins/routeContext.js +0 -1
- package/dist/plugins/store/durableObject.js +0 -1
- package/dist/plugins/store/sqlite.js +0 -1
- package/dist/plugins/subAgents/tool.d.ts +0 -38
- package/dist/plugins/tools/index.d.ts +0 -59
- package/dist/plugins/tools/index.js +0 -1
- package/dist/plugins/verify/facts.d.ts +0 -356
- package/dist/plugins/workflows/submit.d.ts +0 -8
- package/dist/plugins/workspaceContext.js +0 -1
- package/dist/presets/agents.d.ts +0 -7
- package/dist/presets/base.d.ts +0 -10
- package/dist/presets/index.d.ts +0 -4
- package/dist/sandbox/index.js +0 -4
- package/dist/sandbox/policy.d.ts +0 -86
- package/dist/services/launches.d.ts +0 -104
- package/dist/services/threadDirs.d.ts +0 -38
- package/dist/testing/sandbox.d.ts +0 -71
- /package/dist/chunks/{UKXMCHHT.js → FJLU4UH3.js} +0 -0
- /package/dist/chunks/{J5S4URAW.js → HK6ZSONF.js} +0 -0
- /package/dist/plugins/ask/{askQuestion.d.ts → tools.d.ts} +0 -0
- /package/dist/plugins/delegations/{waits.d.ts → waitContracts.d.ts} +0 -0
- /package/dist/plugins/{tools → fileTools}/fsRead.d.ts +0 -0
- /package/dist/plugins/{tools → fileTools}/ripgrep.d.ts +0 -0
- /package/dist/plugins/{tools → fileTools}/textEdit.d.ts +0 -0
- /package/dist/{util → plugins/mcp}/version.d.ts +0 -0
- /package/dist/{sandbox → plugins/sandbox}/client.d.ts +0 -0
- /package/dist/{sandbox → plugins/sandbox}/files.d.ts +0 -0
- /package/dist/{sandbox → plugins/sandbox}/protocol.d.ts +0 -0
- /package/dist/{sandbox → plugins/sandbox}/worker.d.ts +0 -0
- /package/dist/{sandbox → plugins/sandbox}/worker.js +0 -0
- /package/dist/plugins/skills/{tool.d.ts → tools.d.ts} +0 -0
- /package/dist/plugins/{tools → webTools}/html.d.ts +0 -0
- /package/dist/plugins/{tools → webTools}/network.d.ts +0 -0
- /package/dist/plugins/{tools → webTools}/web.d.ts +0 -0
- /package/dist/plugins/workflows/{work.d.ts → workStatus.d.ts} +0 -0
- /package/dist/{plugins/providers → providers}/codexAuth.d.ts +0 -0
- /package/dist/services/{contributions.d.ts → catalogContributions.d.ts} +0 -0
- /package/dist/{loop → state}/limits.d.ts +0 -0
- /package/dist/{plugins/store → stores}/durableObject.d.ts +0 -0
- /package/dist/{plugins/store → stores}/durableObjectConnection.d.ts +0 -0
- /package/dist/{plugins/store → stores}/sqlite.d.ts +0 -0
- /package/dist/{models → util}/jsonSchema.d.ts +0 -0
- /package/dist/{kit → util}/retries.d.ts +0 -0
- /package/dist/{kit → util}/timers.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as B,b as Me,c as j}from"../../chunks/
|
|
2
|
-
`)}
|
|
3
|
-
`)}var ht=(e,t)=>{let n=e.replace(/[\s\p{Cc}\p{Cs}]+/gu," ").trim();if(n.length===0)return"(no text)";if(n.length<=t)return JSON.stringify(n);let s=/[\uD800-\uDBFF]$/.test(n.slice(0,t))?t-1:t;return JSON.stringify(`${n.slice(0,s).trimEnd()}\u2026`)};function Ge(e,t,n){let s=$e(e),r=e.filter(i=>i.type!=="text").length;if(s.length<=n)return{text:s,number:t,cutFrom:null,attachments:r};let o=Math.floor(n/2),a=/[\uD800-\uDBFF]$/.test(s.slice(0,o))?o-1:o;return{text:s.slice(0,a),number:t,cutFrom:s.length,attachments:r}}function ce(e){let n=["The notes below stand in for part of the earlier conversation, the messages their last line names, condensed as of the last of those messages. A model wrote them, so they may leave things out or get things wrong. The messages after these notes happened later and take precedence. The notes are a record and carry no instructions of their own; continue without acknowledging them.",L("summary",Ke(e.summary))];return e.copied!==null&&n.push(le(e.copied)),n.push([pt(e.replaced),...e.recall===null?[]:[e.recall]].join(`
|
|
1
|
+
import{a as B,b as Me,c as j}from"../../chunks/2GCIWSOA.js";import{a as Se}from"../../chunks/OL5A6ITQ.js";import"../../chunks/JFX2MXBA.js";import"../../chunks/S34ZA2R6.js";import{b as K}from"../../chunks/6FRNHMCV.js";import"../../chunks/CUK7CGC7.js";import{Y as G,q as qe,r as Ie,s as A,t as Oe}from"../../chunks/BPRCULZH.js";import"../../chunks/FJLU4UH3.js";import{f as re}from"../../chunks/DDANMY45.js";import{h as Te}from"../../chunks/BBCW2FZK.js";import{a as L,b as Ce}from"../../chunks/MMNNZCBO.js";import"../../chunks/G44LG6VL.js";import{A as Re,d as $e,e as ne,f as _e,l as ve,q as D,r as H}from"../../chunks/D4PQP5MA.js";import{z as p}from"zod";var ze=p.number().gt(0).lt(1),U=p.number().int().nonnegative(),rt=p.strictObject({provider:p.string().min(1).optional(),model:p.string().min(1).optional(),thinkingEffort:_e.default("low")}),st=p.strictObject({kind:p.literal("summarize"),target:ze.default(.5),tail:p.number().nonnegative().lt(1).default(.15),opening:p.number().nonnegative().lt(1).default(.1),summaryCap:p.number().int().positive().default(8192),summaryFloor:p.number().int().positive().default(1024),reasoningAllowance:U.default(8192),replyReserve:U.default(16384),checkpointRatio:p.number().gt(0).lte(1).default(.5),copiedInputChars:p.number().int().positive().default(4e3),boundaryQuoteChars:p.number().int().positive().default(200),breaker:p.number().int().positive().default(3),withoutWindow:p.strictObject({tailTokens:U.default(2e4),openingTokens:U.default(1e4)}).default({tailTokens:2e4,openingTokens:1e4}),summarizer:rt.default({thinkingEffort:"low"})}).refine(e=>e.summaryFloor<=e.summaryCap,{message:"The summary floor must not exceed the summary cap, or no summary could be allowed"}),ot=p.strictObject({kind:p.literal("prune"),keepRecent:p.number().int().nonnegative().default(8),minTokens:p.number().int().positive().default(250)}),Ee=p.strictObject({threshold:ze.default(.8),strategy:p.discriminatedUnion("kind",[st,ot]).prefault({kind:"summarize"})}).refine(e=>e.strategy.kind!=="summarize"||e.strategy.target<e.threshold,{message:"The target must lie below the threshold, or a compaction would aim above the point that triggers it",path:["strategy","target"]}),Ae=p.strictObject({focus:p.string().trim().min(1).optional()}).nullable();import{scopeOf as at}from"@leuduan/cordis";var it=4,se=4,je=4,ct=1600,v=e=>Math.ceil(e.length/it);function lt(e){let t=0;for(let n of e)t+=se+(n.type==="text"?v(n.text):ct);return t}function M(e){let t=je+lt(e.content);e.reasoning_content!==null&&(t+=v(e.reasoning_content));for(let n of e.tool_calls)t+=se+v(n.name)+v(ve(n));return t}function ut(e){let t=Re(e.systemPrompt),n=e.tools.length===0?0:se+v(JSON.stringify(e.tools));return(t.length===0?0:je+v(t))+n}function J(e,t,n){return ut({systemPrompt:e.journal.state(A,t).threadPrompt??[],tools:e.tools.toolsFor(at(e),n).map(r=>r.spec)})}var Q=e=>e.queued.reduce((t,n)=>t+M(D({role:n.role,content:n.content})),0);import{z as C}from"zod";var W="lagent:compaction",Ne=K({plugin:W,kind:"checkpoint",version:1,schema:C.strictObject({summary_cap:C.number().int().positive(),target_reached:C.boolean().nullable()})}),Pe=K({plugin:W,kind:"prune",version:1,schema:C.strictObject({chars:C.number().int().nonnegative(),attachments:C.number().int().nonnegative()})}),Fe=K({plugin:W,kind:"unusable-summary",version:1,schema:C.strictObject({reason:C.string()})});var N=(e,t)=>e.provider===t.provider&&e.model===t.model;function We(e,t=null){let n=r=>r.plugin===e.plugin&&r.instance_id===e.instance_id&&r.kind===e.kind;return Te({key:`compaction-log:${JSON.stringify([e.plugin,e.instance_id,e.kind])}`,init:()=>({pending:new Map,measured:null,overflows:[],overflowReplaced:!1,latestReplacement:null,unusableInARow:0}),apply(r,s){switch(s.type){case"turn/start":return r.overflowReplaced=!1,r;case"llm/request":return r.pending.set(s.data.llm_call_id,{provider:s.data.route.provider,model:s.data.route.model}),r;case"assistant/message":{let o=r.pending.get(s.data.llm_call_id);if(r.pending.delete(s.data.llm_call_id),s.data.interrupted)return r;r.overflowReplaced=!1;let{message:a}=s.data.response,i=s.data.usage??a.usage;if(o===void 0||i===null)return r;let c=mt(i,a);return c>0&&(r.measured={...o,seq:s.seq,tokens:c},r.overflows=r.overflows.filter(l=>!N(l,o))),r}case"assistant/attempt":{let o=r.pending.get(s.data.llm_call_id);return r.pending.delete(s.data.llm_call_id),s.data.failure_kind==="overflow"&&o!==void 0&&r.overflows.push({...o,seq:s.seq,measured:r.measured}),r}case"surface/replaced":return r.latestReplacement=s.seq,n(s.data.source)&&(s.data.trigger==="overflow"&&(r.overflowReplaced=!0),r.unusableInARow=0),r;case"ext":return t!==null&&s.data.plugin===e.plugin&&s.data.instance_id===e.instance_id&&s.data.kind===t.kind&&(r.unusableInARow+=1),r;case"installation/applied":case"installation/removed":return r.unusableInARow=0,r;default:return r}}})}function mt(e,t){let n=t.provider_state!==null||t.reasoning_content!==null;return e.input_tokens+e.output_tokens-(n?0:e.reasoning_output_tokens)}function V(e){let t=new Set;return(n,r)=>{t.has(n)||(t.add(n),e.reportError(new Error(r)))}}import{scopeOf as dt}from"@leuduan/cordis";function oe(e){let{boundary:t}=e;return[t===null?"Condense the conversation above, from its first message through its last, into a checkpoint.":`Condense part of the conversation above into a checkpoint: every message after the ${t.role} message that begins ${ht(t.text,e.quoteChars)} (the last message with that beginning before the part), through the last message above. What comes before that part is context, kept as it is or condensed already: do not restate it.`,"The checkpoint will replace that part for a model that continues the work from it. Describe the state as of the last message above, not what is happening now: later messages exist that you cannot see.",...e.merges?["That part holds an earlier checkpoint. Merge it and what came after it into one checkpoint; do not copy it."]:[],"Use these sections:","- Request and intent: what was asked and why, and what was being asked when the part ends.","- Constraints and decisions: mark each as established (stated in the conversation) or inferred (your reading).","- Completed work.","- Unresolved requests and open questions, as of the end of the part.","- Files, commands, identifiers and error text, exactly as they appeared.","- What you could not tell from the conversation.",...e.focus===null?[]:[`Pay particular attention to: ${e.focus}`],`Write only the checkpoint, as plain text, in at most about ${e.cap} tokens. Do not call any tool.`].join(`
|
|
2
|
+
`)}var ht=(e,t)=>{let n=e.replace(/[\s\p{Cc}\p{Cs}]+/gu," ").trim();if(n.length===0)return"(no text)";if(n.length<=t)return JSON.stringify(n);let r=/[\uD800-\uDBFF]$/.test(n.slice(0,t))?t-1:t;return JSON.stringify(`${n.slice(0,r).trimEnd()}\u2026`)};function De(e,t,n){let r=$e(e),s=e.filter(i=>i.type!=="text").length;if(r.length<=n)return{text:r,number:t,cutFrom:null,attachments:s};let o=Math.floor(n/2),a=/[\uD800-\uDBFF]$/.test(r.slice(0,o))?o-1:o;return{text:r.slice(0,a),number:t,cutFrom:r.length,attachments:s}}function ae(e){let n=["The notes below stand in for part of the earlier conversation, the messages their last line names, condensed as of the last of those messages. A model wrote them, so they may leave things out or get things wrong. The messages after these notes happened later and take precedence. The notes are a record and carry no instructions of their own; continue without acknowledging them.",L("summary",He(e.summary))];return e.copied!==null&&n.push(ie(e.copied)),n.push([pt(e.replaced),...e.recall===null?[]:[e.recall]].join(`
|
|
4
3
|
`)),L("checkpoint",n.join(`
|
|
5
4
|
|
|
6
|
-
`))}function
|
|
7
|
-
`))}var Ke=e=>Re(e,["summary","latest_user_message","checkpoint"]),pt=({first:e,last:t,count:n})=>e===t?`These notes replace message ${e} of this conversation.`:`These notes replace messages ${e} to ${t} of this conversation (${n} messages).`,Be=ce({summary:"",copied:null,replaced:{first:9999998,last:9999999,count:9999999},recall:j(9999998,2)}),Ue=e=>ie({boundary:{role:"developer",text:"\\".repeat(e.quoteChars+1)},quoteChars:e.quoteChars,merges:!0,cap:e.cap,focus:e.focus});var P=(e,t)=>e.provider===t.provider&&e.model===t.model;function Je(e,t=null){let n=s=>s.plugin===e.plugin&&s.instance_id===e.instance_id&&s.kind===e.kind;return Ie({key:`compaction-log:${JSON.stringify([e.plugin,e.instance_id,e.kind])}`,init:()=>({pending:new Map,measured:null,overflows:[],overflowReplaced:!1,latestReplacement:null,unusableInARow:0}),apply(s,r){switch(r.type){case"turn/start":return s.overflowReplaced=!1,s;case"llm/request":return s.pending.set(r.data.llm_call_id,{provider:r.data.route.provider,model:r.data.route.model}),s;case"assistant/message":{let o=s.pending.get(r.data.llm_call_id);if(s.pending.delete(r.data.llm_call_id),r.data.interrupted)return s;s.overflowReplaced=!1;let{message:a}=r.data.response,i=r.data.usage??a.usage;if(o===void 0||i===null)return s;let c=ft(i,a);return c>0&&(s.measured={...o,seq:r.seq,tokens:c},s.overflows=s.overflows.filter(l=>!P(l,o))),s}case"assistant/attempt":{let o=s.pending.get(r.data.llm_call_id);return s.pending.delete(r.data.llm_call_id),r.data.failure_kind==="overflow"&&o!==void 0&&s.overflows.push({...o,seq:r.seq,measured:s.measured}),s}case"surface/replaced":return s.latestReplacement=r.seq,n(r.data.source)&&(r.data.trigger==="overflow"&&(s.overflowReplaced=!0),s.unusableInARow=0),s;case"ext":return t!==null&&r.data.plugin===e.plugin&&r.data.instance_id===e.instance_id&&r.data.kind===t.kind&&(s.unusableInARow+=1),s;case"installation/applied":case"installation/removed":return s.unusableInARow=0,s;default:return s}}})}function ft(e,t){let n=t.provider_state!==null||t.reasoning_content!==null;return e.input_tokens+e.output_tokens-(n?0:e.reasoning_output_tokens)}function Qe(e,t=0){let n=[],s=t;for(let r=t;r<=e.length;r+=1)r<e.length&&!e[r].directDeveloperInput||(r>s&&n.push({start:s,end:r,last:r===e.length}),s=r+1);return n}var de=e=>e.measured||e.written;function Ye(e){let{entries:t,balanced:n,budgets:s}=e;if(n.length!==t.length+1)throw new RangeError(`balanced has ${n.length} cuts for ${t.length} entries; it needs one more`);let r=t.length,{window:o}=e.continuation,a=ue(e.continuation,e.head,t),i=ue(e.summarizer,e.head,t),c=me(t.map(u=>u.retold?u.tokens:0)),l=(u,m,h)=>u[h]-u[m],w=o===null?s.withoutWindow.openingTokens:s.opening*o,k=o===null?s.withoutWindow.tailTokens:s.tail*o,{openingEnd:g}=e,f=g!==null&&g<r&&n[g+1]===!0&&l(a.sums,0,g+1)<=w?g+1:0,d=Qe(t,f),y=me(t.map(u=>u.written?0:1)),x=(u,m)=>l(y,u,m)>0,E=d.map(u=>{if(!n[u.start])return[];if(!u.last)return n[u.end]&&x(u.start,u.end)?[u.end]:[];let m=[];for(let h=u.start+1;h<r;h+=1)n[h]&&x(u.start,h)&&m.push(h);return m}),z=(u,m,h,$)=>{let I=l(a.sums,m,h),O=l(c,m,h),S=e.latestInput,C=S!==null&&S.index>=m&&S.index<h,M=C?S.tokens:0,F=a.head+a.sums[r]-I+a.written*(e.framing+M+O)+e.continuation.factor*e.claimed,ge=$===null?1/0:($-F)/a.written,Z=e.summarizer,we=Z.reasons?s.reasoningAllowance:0,ke=i.head+i.sums[h]+i.written*e.instruction,ye=Z.window===null?1/0:Z.window-ke-we,xe=s.checkpointRatio*I/a.written-(e.framing+M+O),ee=Math.floor(Math.min(s.summaryCap,ge,ye,xe)),te=Math.max(ee,0),rt=a.written*(e.framing+M+O+te),be=F+a.written*te;return{segment:u,start:m,end:h,capContinuation:ge,capSummary:ye,capRatio:xe,summaryCap:ee,feasible:ee>=s.summaryFloor,copiesInput:C,spanTokens:I,continuation:be,summaryCall:ke+te+we,reduction:I-rt,targetReached:o===null?null:be+s.replyReserve<=s.target*o}},_=u=>{let m=r,h=0;do m-=1,h+=l(a.sums,m,m+1);while(m>u+1&&h<k);for(;m>u&&!n[m];)m-=1;return m},q=u=>d.map((m,h)=>E[h].map($=>z(h,m.start,$,u)).filter($=>$.feasible)),fe=u=>{let m=u.flatMap(($,I)=>{if($.length===0)return[];let O=$.filter(C=>C.targetReached!==!1);if(O.length===0)return[Ve($)];if(!d[I].last)return[O[0]];let S=_(d[I].start);return[O.reduce((C,M)=>{let F=Math.abs(M.end-S)-Math.abs(C.end-S);return F<0||F===0&&M.end<C.end?M:C})]});if(m.length===0)return null;let h=m.filter($=>$.targetReached!==!1);return Ve(h.length>0?h:m)},X=o===null?null:s.threshold*o-s.replyReserve,b=fe(q(X));if(b===null&&o!==null){let u=q(o-s.replyReserve),m=u.filter(h=>h.length>0).length>=2;(e.acceptance==="window"||m)&&(X=o-s.replyReserve,b=fe(u))}return b===null?gt(s.summaryFloor,d.flatMap((u,m)=>E[m].map(h=>z(m,u.start,h,X)))):{kind:"plan",start:b.start,end:b.end,pinned:f,summaryCap:b.summaryCap,copiesInput:b.copiesInput,spanTokens:b.spanTokens,continuation:b.continuation,summaryCall:b.summaryCall,targetReached:b.targetReached,segment:{index:b.segment,count:d.length}}}var Ve=e=>e.reduce((t,n)=>n.reduction>t.reduction?n:t);function gt(e,t){if(t.length===0)return{kind:"none",cause:"nothing-to-replace",reason:"no span can be replaced: past the pinned opening there is no balanced run that keeps the newest message and holds more than checkpoints and notices"};let n=r=>Math.floor(r)>=e,s=t.filter(r=>n(r.capRatio));return s.length===0?{kind:"none",cause:"no-reduction",reason:`no span leaves room for a summary of at least ${e} tokens under the reduction it must make, its checkpoint and the notices it would make plugins tell again counted`}:s.every(r=>!n(r.capSummary))?{kind:"none",cause:"summary-call-too-large",reason:`no span's summary call leaves room for a summary of at least ${e} tokens in the summarizer's window; a summarizer route with a larger window is the way out`}:s.every(r=>!n(r.capContinuation))?{kind:"none",cause:"continuation-too-large",reason:`no span leaves room for a summary of at least ${e} tokens under the next request's ceiling: what must stay (prompt, tools, opening, developer input, tail) plus the reply reserve is too large`}:{kind:"none",cause:"no-span-fits-both",reason:`no span fits both budgets with room for a summary of at least ${e} tokens: a span short enough for the summary call leaves the next request over its ceiling; a summarizer route with a larger window is the way out`}}function ue(e,t,n){let s=e.scale??e.factor,r=o=>e.scale!==null&&de(o)?e.scale:e.factor;return{head:s*t,sums:me(n.map(o=>r(o)*o.tokens)),written:s}}var me=e=>{let t=[0];for(let n of e)t.push(t.at(-1)+n);return t};function Xe(e){let{head:t,sums:n}=ue(e.route,e.head,e.entries);return t+n.at(-1)+e.route.factor*e.claimed}function Ze(e,t,n){let s=t-(n.measuredTokens??0),r=n.estimated>0?s/n.estimated:1;return Math.max(1,e,r)}var wt=Je({plugin:W,instance_id:"default",kind:"checkpoint"},{kind:"unusable-summary"}),nt={name:"lagent:compaction:summarize",inject:["journal","llm","tools"],apply(e,t){let n=new pe(e,t);G(e,t.threadId,{name:"compaction (summarize)",plan:s=>n.plan(s)})}},pe=class{strategy;threshold;threadId;agentName;reportOnce;estimates=new Map;overflowParts=new Map;counted=new Map;ctx;constructor(t,n){this.ctx=t,this.strategy=n.strategy,this.threshold=n.threshold,this.threadId=n.threadId,this.agentName=n.agentName,this.reportOnce=J(t)}plan(t){let{strategy:n}=this,{trigger:s,route:r}=t,o=null;if(s==="request"){let _=Ae.safeParse(t.options??null);if(!_.success)return{kind:"fail",reason:`invalid compaction options: ${_.error.message}`};o=_.data?.focus??null}let a=this.ctx.journal.state(wt,this.threadId);if(s==="pressure"&&a.unusableInARow>=n.breaker)return{kind:"skip",reason:`the summarizer failed ${a.unusableInARow} times in a row; pressure no longer compacts until a summary is recorded or the thread is configured again`};if(s==="overflow"&&a.overflowReplaced)return{kind:"skip",reason:"this overflow sequence already had its recovery; a new turn or a completed reply allows another"};let i=this.ctx.llm.capacity(r).contextWindow;if(s==="pressure"&&i===null)return this.reportOnce(`window:${he(r)}`,`Thread ${this.threadId}: ${he(r)} declares no context window, so it is never compacted for pressure`),{kind:"skip",reason:"the route declares no context window"};let c=this.snapshot(t),l=this.factorFor(r,c.head,a),w=this.measurementOn(r,c.head,a),k=w?.scale??null,g=tt(c.entries,c.estimates,w?.anchor??null);if(s==="pressure"){let _=Xe({entries:g,head:c.head,claimed:c.claimed,route:{window:i,factor:l,scale:k}});if(a.overflowReplaced&&_<=i-n.replyReserve)return{kind:"skip",reason:"the overflow recovery planned this request; pressure resumes after the next finished reply"};if(_<=this.threshold*i)return{kind:"skip",reason:`the request is estimated at ${st(_/i)} of the window, under the threshold`}}let f,d;try{f=yt(this.ctx.llm.resolveRoute(kt(n.summarizer),r),n),d=this.ctx.llm.capacity(f)}catch(_){let q=`the summarizer route cannot be resolved: ${se(_)}`;return s==="request"?{kind:"fail",reason:q}:(this.reportOnce(`summarizer:${q}`,`Thread ${this.threadId}: cannot compact (${s}): ${q}`),{kind:"skip",reason:q})}let y=f.thinking_effort!=="none",x=this.shape(c,g),E=Ue({quoteChars:n.boundaryQuoteChars,cap:n.summaryCap,focus:o}),z=Ye({entries:x.entries,balanced:x.balanced,openingEnd:x.openingEnd,latestInput:x.latest===null?null:{index:x.latest.index,tokens:v(le(x.latest.copied))},head:c.head,claimed:c.claimed,framing:et(Be),instruction:et(E),continuation:{window:i,factor:l,scale:k},summarizer:P(f,r)?{window:d.contextWindow,factor:l,scale:k,reasons:y}:{window:d.contextWindow,factor:this.factorFor(f,c.head,a),scale:null,reasons:y},budgets:{...n,threshold:this.threshold},acceptance:s==="pressure"?"threshold":"window"});return z.kind==="none"?this.noCut(t,r,z,a):this.summarize(t,{snapshot:c,shape:x,plan:z,summarizer:f,reasons:y,focus:o,window:i},a)}summarize(t,n,s){let{strategy:r}=this,{snapshot:o,shape:a,plan:i,summarizer:c}=n,l=o.entries.slice(i.start,i.end),w=i.start>0?o.entries[i.start-1]:null,k=w===null?null:{role:w.message.role,text:D(w.message)},g=ie({boundary:k,quoteChars:r.boundaryQuoteChars,merges:l.some(f=>f.type==="surface/replaced"&&f.kind==="span"),cap:i.summaryCap,focus:n.focus});return{kind:"ask",call:{through:l.at(-1).row.seq,instructions:[g],route:{provider:c.provider,model:c.model,...c.thinking_effort===null?{}:{thinkingEffort:c.thinking_effort}},toolChoice:this.ctx.llm.capacity(c).providerTools?"none":"auto",maxOutputTokens:i.summaryCap+(n.reasons?r.reasoningAllowance:0)},finish:f=>this.checkpoint(f,n,s)}}checkpoint(t,n,s){let{strategy:r}=this,{snapshot:o,shape:a,plan:i}=n,c=o.entries.slice(i.start,i.end);if("failure"in t)return this.unusable(`the summary call failed: ${se(t.failure)}`,s);let{reply:l}=t,w=i.copiesInput?a.latest.copied:null,k=l.text.trim(),g=xt(a,i.start,i.end),f=ce({summary:k,copied:w,replaced:g,recall:this.recallLine(g.first,g.count)}),d=i.summaryCap+(n.reasons?r.reasoningAllowance:0),y=l.usage!==null?{tokens:Math.max(0,l.usage.output_tokens-l.usage.reasoning_output_tokens),limit:i.summaryCap,what:"its cap"}:n.reasons?{tokens:v(k),limit:d,what:"its generation limit"}:null,x=bt(l,y);return x!==null?this.unusable(x,s):{kind:"replace",replacements:[{kind:"span",stand_in:{role:"user",content:f},source:Pe.record({summary_cap:i.summaryCap,target_reached:i.targetReached}),source_seqs:c.map(E=>E.row.seq),auxiliary_request_seq:l.requestSeq}],reason:$t(i,g,n.window)}}recallLine(t,n){return Q(this.ctx,this.agentName)?j(t,n):null}unusable(t,n){let s=n.unusableInARow+1,r=s>=this.strategy.breaker?`; after ${s} in a row, pressure no longer compacts until a summary is recorded`:"";return{kind:"fail",reason:`unusable summary, nothing replaced: ${t}${r}`,facts:[We.record({reason:t})]}}noCut(t,n,s,r){let o=s.cause==="nothing-to-replace"||s.cause==="no-reduction";return t.trigger==="request"?{kind:o?"skip":"fail",reason:s.reason}:(this.reportOnce(`cut:${t.trigger}:${s.cause}:${he(n)}:${r.latestReplacement??0}`,`Thread ${this.threadId}: cannot compact (${t.trigger}): ${s.reason}`),{kind:"skip",reason:s.reason})}snapshot(t){let{journal:n}=this.ctx,s=[...n.state(A,this.threadId).surface.entries],r=s.map(a=>this.estimateOf(a)),o=V(this.ctx,this.threadId,this.agentName);return{entries:s,estimates:r,head:o,claimed:Y(t)}}factorFor(t,n,s){let r=this.ctx.llm.capacity(t).contextWindow;if(r===null)return 1;let o=1;for(let a of s.overflows){if(!P(a,t))continue;let i=this.overflowParts.get(a.seq);if(i===void 0){let c=a.measured!==null&&P(a.measured,a)?a.measured:null,l=0,w=0,k=this.sentWith(a.seq),g=k.map(f=>this.estimateOf(f));for(let f of tt(k,g,c))c!==null&&de(f)?l+=f.tokens:w+=f.tokens;i={measured:c,counted:l,rest:w},this.overflowParts.set(a.seq,i)}o=Ze(o,r,i.measured===null?{measuredTokens:null,estimated:n+i.rest}:{measuredTokens:this.scaleOf(i.measured,n)*(n+i.counted),estimated:i.rest})}return o}measurementOn(t,n,s){let{measured:r}=s;return r===null||!P(r,t)?null:{anchor:r,scale:this.scaleOf(r,n)}}scaleOf(t,n){let s=this.counted.get(t.seq);s===void 0&&(s=this.sentWith(t.seq).reduce((o,a)=>o+this.estimateOf(a).tokens,0),this.counted.set(t.seq,s));let r=n+s;return r>0?t.tokens/r:1}sentWith(t){let n=this.ctx.journal.eventAt(t)?.thread_id??this.threadId;return this.ctx.journal.stateAt(Oe("surface"),n,t).entries}estimateOf(t){let n=this.estimates.get(t.row.seq);if(n===void 0){let s=this.ctx.journal.eventAt(t.row.seq);n={tokens:R(t.message),retold:s?.type==="input/message"&&s.data.source!==null&&s.data.input_id===null},this.estimates.set(t.row.seq,n)}return n}shape(t,n){let{journal:s}=this.ctx,{entries:r}=t,a=s.lineage(this.threadId).filter(d=>d.type==="input/message"&&d.data.role==="user"&&d.data.source===null),i=a[0]?.seq,c=a.at(-1),l=r.map(d=>d.type==="surface/replaced"?qe(s,d.row):[d.row]),w=B(s,this.threadId),k=r.findIndex((d,y)=>(d.type!=="surface/replaced"||d.kind==="rewrite")&&l[y][0]?.seq===i),g=c===void 0?-1:l.findIndex(d=>d.some(y=>y.seq===c.seq));return{entries:r.map((d,y)=>({...n[y],directDeveloperInput:d.directDeveloperInput,retold:t.estimates[y].retold})),balanced:Array.from({length:r.length+1},(d,y)=>Te(r,y)),openingEnd:i===void 0||k<0?null:k,latest:c===void 0||g<0||c.type!=="input/message"?null:{index:g,copied:Ge(c.data.content,w.get(c.seq),this.strategy.copiedInputChars)},originals:l,numbers:w}}},et=e=>R(H({role:"user",content:e})),kt=({provider:e,model:t})=>({...e===void 0?{}:{provider:e},...t===void 0?{}:{model:t}});function yt(e,t){let n=e.thinking_effort,s=t.summarizer.thinkingEffort;if(n===null)return e;let r=ne.indexOf(s)<ne.indexOf(n)?s:n;return{...e,thinking_effort:r}}function xt(e,t,n){let s=e.originals.slice(t,n).flatMap(r=>r.map(o=>e.numbers.get(o.seq)));return{first:s.reduce((r,o)=>Math.min(r,o)),last:s.reduce((r,o)=>Math.max(r,o)),count:s.length}}function bt(e,t){return e.message.tool_calls.length>0?"it asked for a tool call":e.message.provider_calls.length>0?"the provider ran a tool for it":e.finish!=="completed"?`it did not finish (${e.finish})`:e.text.trim()===""?"it returned no text":t!==null&&t.tokens>t.limit?`it is longer than ${t.what} of ${t.limit} tokens`:null}function $t(e,t,n){let s=t.first===t.last?`message ${t.first}`:`messages ${t.first} to ${t.last}`;if(n===null)return`replaced ${s} with a checkpoint; the route declares no window, so the next request is estimated at ${Math.round(e.continuation)} tokens`;let r=st(e.continuation/n);return e.targetReached?`replaced ${s} with a checkpoint; the next request is estimated at ${r} of the window, within the target`:`replaced ${s} with a checkpoint; the next request is estimated at ${r} of the window, above the target`}var st=e=>`${Math.round(e*100)}%`,he=e=>`${e.provider}/${e.model}`;function tt(e,t,n){return e.map((s,r)=>({tokens:t[r].tokens,measured:n!==null&&s.row.seq<=n.seq,written:s.type==="surface/replaced"||t[r].retold}))}var _t=Se({id:"compaction#2",placement:"thread",schema:ze,setup(e,t,n){vt(e,n.thread.id,n.thread.agentName,t)}});function vt(e,t,n,s){let{strategy:r,threshold:o}=s;return r.kind==="summarize"?e.plugin(nt,{threadId:t,agentName:n,threshold:o,strategy:r}):e.plugin(Le,{threadId:t,agentName:n,threshold:o,strategy:r})}export{_t as compaction};
|
|
5
|
+
`))}function ie(e){let t=[`The person's latest message in those messages, message ${e.number}, in their own words:`];return t.push(He(e.text)),e.cutFrom!==null&&t.push(`[cut here: the message is ${e.cutFrom} characters long; message ${e.number} holds it whole]`),e.attachments>0&&t.push(`[it also carried ${e.attachments} attachment${e.attachments===1?"":"s"}, not copied here]`),L("latest_user_message",t.join(`
|
|
6
|
+
`))}var He=e=>Ce(e,["summary","latest_user_message","checkpoint"]),pt=({first:e,last:t,count:n})=>e===t?`These notes replace message ${e} of this conversation.`:`These notes replace messages ${e} to ${t} of this conversation (${n} messages).`,Le=ae({summary:"",copied:null,replaced:{first:9999998,last:9999999,count:9999999},recall:j(9999998,2)}),Ge=e=>oe({boundary:{role:"developer",text:"\\".repeat(e.quoteChars+1)},quoteChars:e.quoteChars,merges:!0,cap:e.cap,focus:e.focus});function Y(e,t){let n=new Set(e.tools.toolsFor(dt(e),t).map(r=>r.name));return Me.every(r=>n.has(r))}var Be={name:"lagent:compaction:prune",inject:["journal","llm","tools"],apply(e,t){let n=new le(e,t);G(e,t.threadId,{name:"compaction (prune)",plan:r=>n.plan(r)})}},le=class{strategy;threshold;threadId;agentName;reportOnce;ctx;constructor(t,n){this.ctx=t,this.strategy=n.strategy,this.threshold=n.threshold,this.threadId=n.threadId,this.agentName=n.agentName,this.reportOnce=V(t)}plan(t){let{trigger:n,route:r}=t,s=this.ctx.journal.state(A,this.threadId).surface.entries,o=this.survey(s);if(n==="pressure"){let c=this.ctx.llm.capacity(r).contextWindow;if(c===null)return this.reportOnce(`window:${ce(r)}`,`Thread ${this.threadId}: ${ce(r)} declares no context window, so its tool results are never pruned for pressure`),{kind:"skip",reason:"the route declares no context window"};let l=this.estimate(s,t);if(l<=this.threshold*c)return{kind:"skip",reason:`the request is estimated at ${gt(l/c)} of the window, under the threshold`}}if(o.eligible.length===0){let c=`nothing to prune: ${P(o.results,"tool result")}, ${o.kept} kept recent, none of the rest an unpruned result estimated at ${P(this.strategy.minTokens,"token")} or more`;return n!=="request"&&this.reportOnce(`none:${n}:${r===null?"":ce(r)}:${ft(s)}`,`Thread ${this.threadId}: cannot prune (${n}): ${c}`),{kind:"skip",reason:c}}let a=o.eligible.reduce((c,l)=>c+l.chars,0),i=o.eligible.reduce((c,l)=>c+l.attachments,0);return{kind:"replace",replacements:this.rewrites(o.eligible),reason:`pruned ${P(o.eligible.length,"tool result")}, ${Ke(a,i)}`}}survey(t){let n=t.filter(a=>a.message.role==="tool"),r=Math.min(this.strategy.keepRecent,n.length),s=n.slice(0,n.length-r),o=[];for(let a of s){if(a.type!=="tool/result"||M(a.message)<this.strategy.minTokens)continue;let i=this.ctx.journal.eventAt(a.row.seq);if(i?.type!=="tool/result")throw new Error(`Row ${a.row.seq} is behind a tool result but is no tool result`);o.push({entry:a,name:i.data.result.name,chars:H(a.message).length,attachments:a.message.content.filter(c=>c.type!=="text").length})}return{results:n.length,kept:r,eligible:o}}rewrites(t){let{journal:n}=this.ctx,r=B(n,this.threadId),s=Y(this.ctx,this.agentName);return t.map(({entry:o,name:a,chars:i,attachments:c})=>{let l=r.get(o.row.seq);return{kind:"rewrite",stand_in:{content:[{type:"text",text:[`[tool result pruned: ${a}, ${Ke(i,c)}; message ${l}]`,...s?[j(l,1)]:[]].join(`
|
|
7
|
+
`)}]},source:Pe.record({chars:i,attachments:c}),source_seqs:[o.row.seq]}})}estimate(t,n){let r=J(this.ctx,this.threadId,this.agentName),s=t.reduce((o,a)=>o+M(a.message),0);return r+s+Q(n)}},ft=e=>e.reduce((t,n)=>n.type==="surface/replaced"?Math.max(t,n.row.seq):t,0),P=(e,t)=>`${e} ${t}${e===1?"":"s"}`,Ke=(e,t)=>t===0?P(e,"character"):`${P(e,"character")} and ${P(t,"attachment")}`,gt=e=>`${Math.round(e*100)}%`,ce=e=>`${e.provider}/${e.model}`;function Ue(e,t=0){let n=[],r=t;for(let s=t;s<=e.length;s+=1)s<e.length&&!e[s].directDeveloperInput||(s>r&&n.push({start:r,end:s,last:s===e.length}),r=s+1);return n}var de=e=>e.measured||e.written;function Qe(e){let{entries:t,balanced:n,budgets:r}=e;if(n.length!==t.length+1)throw new RangeError(`balanced has ${n.length} cuts for ${t.length} entries; it needs one more`);let s=t.length,{window:o}=e.continuation,a=ue(e.continuation,e.head,t),i=ue(e.summarizer,e.head,t),c=me(t.map(u=>u.retold?u.tokens:0)),l=(u,m,h)=>u[h]-u[m],w=o===null?r.withoutWindow.openingTokens:r.opening*o,k=o===null?r.withoutWindow.tailTokens:r.tail*o,{openingEnd:g}=e,f=g!==null&&g<s&&n[g+1]===!0&&l(a.sums,0,g+1)<=w?g+1:0,d=Ue(t,f),y=me(t.map(u=>u.written?0:1)),x=(u,m)=>l(y,u,m)>0,z=d.map(u=>{if(!n[u.start])return[];if(!u.last)return n[u.end]&&x(u.start,u.end)?[u.end]:[];let m=[];for(let h=u.start+1;h<s;h+=1)n[h]&&x(u.start,h)&&m.push(h);return m}),E=(u,m,h,$)=>{let q=l(a.sums,m,h),I=l(c,m,h),O=e.latestInput,R=O!==null&&O.index>=m&&O.index<h,S=R?O.tokens:0,F=a.head+a.sums[s]-q+a.written*(e.framing+S+I)+e.continuation.factor*e.claimed,ge=$===null?1/0:($-F)/a.written,Z=e.summarizer,we=Z.reasons?r.reasoningAllowance:0,ke=i.head+i.sums[h]+i.written*e.instruction,ye=Z.window===null?1/0:Z.window-ke-we,xe=r.checkpointRatio*q/a.written-(e.framing+S+I),ee=Math.floor(Math.min(r.summaryCap,ge,ye,xe)),te=Math.max(ee,0),nt=a.written*(e.framing+S+I+te),be=F+a.written*te;return{segment:u,start:m,end:h,capContinuation:ge,capSummary:ye,capRatio:xe,summaryCap:ee,feasible:ee>=r.summaryFloor,copiesInput:R,spanTokens:q,continuation:be,summaryCall:ke+te+we,reduction:q-nt,targetReached:o===null?null:be+r.replyReserve<=r.target*o}},_=u=>{let m=s,h=0;do m-=1,h+=l(a.sums,m,m+1);while(m>u+1&&h<k);for(;m>u&&!n[m];)m-=1;return m},T=u=>d.map((m,h)=>z[h].map($=>E(h,m.start,$,u)).filter($=>$.feasible)),fe=u=>{let m=u.flatMap(($,q)=>{if($.length===0)return[];let I=$.filter(R=>R.targetReached!==!1);if(I.length===0)return[Je($)];if(!d[q].last)return[I[0]];let O=_(d[q].start);return[I.reduce((R,S)=>{let F=Math.abs(S.end-O)-Math.abs(R.end-O);return F<0||F===0&&S.end<R.end?S:R})]});if(m.length===0)return null;let h=m.filter($=>$.targetReached!==!1);return Je(h.length>0?h:m)},X=o===null?null:r.threshold*o-r.replyReserve,b=fe(T(X));if(b===null&&o!==null){let u=T(o-r.replyReserve),m=u.filter(h=>h.length>0).length>=2;(e.acceptance==="window"||m)&&(X=o-r.replyReserve,b=fe(u))}return b===null?wt(r.summaryFloor,d.flatMap((u,m)=>z[m].map(h=>E(m,u.start,h,X)))):{kind:"plan",start:b.start,end:b.end,pinned:f,summaryCap:b.summaryCap,copiesInput:b.copiesInput,spanTokens:b.spanTokens,continuation:b.continuation,summaryCall:b.summaryCall,targetReached:b.targetReached,segment:{index:b.segment,count:d.length}}}var Je=e=>e.reduce((t,n)=>n.reduction>t.reduction?n:t);function wt(e,t){if(t.length===0)return{kind:"none",cause:"nothing-to-replace",reason:"no span can be replaced: past the pinned opening there is no balanced run that keeps the newest message and holds more than checkpoints and notices"};let n=s=>Math.floor(s)>=e,r=t.filter(s=>n(s.capRatio));return r.length===0?{kind:"none",cause:"no-reduction",reason:`no span leaves room for a summary of at least ${e} tokens under the reduction it must make, its checkpoint and the notices it would make plugins tell again counted`}:r.every(s=>!n(s.capSummary))?{kind:"none",cause:"summary-call-too-large",reason:`no span's summary call leaves room for a summary of at least ${e} tokens in the summarizer's window; a summarizer route with a larger window is the way out`}:r.every(s=>!n(s.capContinuation))?{kind:"none",cause:"continuation-too-large",reason:`no span leaves room for a summary of at least ${e} tokens under the next request's ceiling: what must stay (prompt, tools, opening, developer input, tail) plus the reply reserve is too large`}:{kind:"none",cause:"no-span-fits-both",reason:`no span fits both budgets with room for a summary of at least ${e} tokens: a span short enough for the summary call leaves the next request over its ceiling; a summarizer route with a larger window is the way out`}}function ue(e,t,n){let r=e.scale??e.factor,s=o=>e.scale!==null&&de(o)?e.scale:e.factor;return{head:r*t,sums:me(n.map(o=>s(o)*o.tokens)),written:r}}var me=e=>{let t=[0];for(let n of e)t.push(t.at(-1)+n);return t};function Ve(e){let{head:t,sums:n}=ue(e.route,e.head,e.entries);return t+n.at(-1)+e.route.factor*e.claimed}function Ye(e,t,n){let r=t-(n.measuredTokens??0),s=n.estimated>0?r/n.estimated:1;return Math.max(1,e,s)}var kt=We({plugin:W,instance_id:"default",kind:"checkpoint"},{kind:"unusable-summary"}),et={name:"lagent:compaction:summarize",inject:["journal","llm","tools"],apply(e,t){let n=new pe(e,t);G(e,t.threadId,{name:"compaction (summarize)",plan:r=>n.plan(r)})}},pe=class{strategy;threshold;threadId;agentName;reportOnce;estimates=new Map;overflowParts=new Map;counted=new Map;ctx;constructor(t,n){this.ctx=t,this.strategy=n.strategy,this.threshold=n.threshold,this.threadId=n.threadId,this.agentName=n.agentName,this.reportOnce=V(t)}plan(t){let{strategy:n}=this,{trigger:r,route:s}=t,o=null;if(r==="request"){let _=Ae.safeParse(t.options??null);if(!_.success)return{kind:"fail",reason:`invalid compaction options: ${_.error.message}`};o=_.data?.focus??null}let a=this.ctx.journal.state(kt,this.threadId);if(r==="pressure"&&a.unusableInARow>=n.breaker)return{kind:"skip",reason:`the summarizer failed ${a.unusableInARow} times in a row; pressure no longer compacts until a summary is recorded or the thread is configured again`};if(r==="overflow"&&a.overflowReplaced)return{kind:"skip",reason:"this overflow sequence already had its recovery; a new turn or a completed reply allows another"};let i=this.ctx.llm.capacity(s).contextWindow;if(r==="pressure"&&i===null)return this.reportOnce(`window:${he(s)}`,`Thread ${this.threadId}: ${he(s)} declares no context window, so it is never compacted for pressure`),{kind:"skip",reason:"the route declares no context window"};let c=this.snapshot(t),l=this.factorFor(s,c.head,a),w=this.measurementOn(s,c.head,a),k=w?.scale??null,g=Ze(c.entries,c.estimates,w?.anchor??null);if(r==="pressure"){let _=Ve({entries:g,head:c.head,claimed:c.claimed,route:{window:i,factor:l,scale:k}});if(a.overflowReplaced&&_<=i-n.replyReserve)return{kind:"skip",reason:"the overflow recovery planned this request; pressure resumes after the next finished reply"};if(_<=this.threshold*i)return{kind:"skip",reason:`the request is estimated at ${tt(_/i)} of the window, under the threshold`}}let f,d;try{f=xt(this.ctx.llm.resolveRoute(yt(n.summarizer),s),n),d=this.ctx.llm.capacity(f)}catch(_){let T=`the summarizer route cannot be resolved: ${re(_)}`;return r==="request"?{kind:"fail",reason:T}:(this.reportOnce(`summarizer:${T}`,`Thread ${this.threadId}: cannot compact (${r}): ${T}`),{kind:"skip",reason:T})}let y=f.thinking_effort!=="none",x=this.shape(c,g),z=Ge({quoteChars:n.boundaryQuoteChars,cap:n.summaryCap,focus:o}),E=Qe({entries:x.entries,balanced:x.balanced,openingEnd:x.openingEnd,latestInput:x.latest===null?null:{index:x.latest.index,tokens:v(ie(x.latest.copied))},head:c.head,claimed:c.claimed,framing:Xe(Le),instruction:Xe(z),continuation:{window:i,factor:l,scale:k},summarizer:N(f,s)?{window:d.contextWindow,factor:l,scale:k,reasons:y}:{window:d.contextWindow,factor:this.factorFor(f,c.head,a),scale:null,reasons:y},budgets:{...n,threshold:this.threshold},acceptance:r==="pressure"?"threshold":"window"});return E.kind==="none"?this.noCut(t,s,E,a):this.summarize(t,{snapshot:c,shape:x,plan:E,summarizer:f,reasons:y,focus:o,window:i},a)}summarize(t,n,r){let{strategy:s}=this,{snapshot:o,shape:a,plan:i,summarizer:c}=n,l=o.entries.slice(i.start,i.end),w=i.start>0?o.entries[i.start-1]:null,k=w===null?null:{role:w.message.role,text:H(w.message)},g=oe({boundary:k,quoteChars:s.boundaryQuoteChars,merges:l.some(f=>f.type==="surface/replaced"&&f.kind==="span"),cap:i.summaryCap,focus:n.focus});return{kind:"ask",call:{through:l.at(-1).row.seq,instructions:[g],route:{provider:c.provider,model:c.model,...c.thinking_effort===null?{}:{thinkingEffort:c.thinking_effort}},toolChoice:this.ctx.llm.capacity(c).providerTools?"none":"auto",maxOutputTokens:i.summaryCap+(n.reasons?s.reasoningAllowance:0)},finish:f=>this.checkpoint(f,n,r)}}checkpoint(t,n,r){let{strategy:s}=this,{snapshot:o,shape:a,plan:i}=n,c=o.entries.slice(i.start,i.end);if("failure"in t)return this.unusable(`the summary call failed: ${re(t.failure)}`,r);let{reply:l}=t,w=i.copiesInput?a.latest.copied:null,k=l.text.trim(),g=bt(a,i.start,i.end),f=ae({summary:k,copied:w,replaced:g,recall:this.recallLine(g.first,g.count)}),d=i.summaryCap+(n.reasons?s.reasoningAllowance:0),y=l.usage!==null?{tokens:Math.max(0,l.usage.output_tokens-l.usage.reasoning_output_tokens),limit:i.summaryCap,what:"its cap"}:n.reasons?{tokens:v(k),limit:d,what:"its generation limit"}:null,x=$t(l,y);return x!==null?this.unusable(x,r):{kind:"replace",replacements:[{kind:"span",stand_in:{role:"user",content:f},source:Ne.record({summary_cap:i.summaryCap,target_reached:i.targetReached}),source_seqs:c.map(z=>z.row.seq),auxiliary_request_seq:l.requestSeq}],reason:_t(i,g,n.window)}}recallLine(t,n){return Y(this.ctx,this.agentName)?j(t,n):null}unusable(t,n){let r=n.unusableInARow+1,s=r>=this.strategy.breaker?`; after ${r} in a row, pressure no longer compacts until a summary is recorded`:"";return{kind:"fail",reason:`unusable summary, nothing replaced: ${t}${s}`,facts:[Fe.record({reason:t})]}}noCut(t,n,r,s){let o=r.cause==="nothing-to-replace"||r.cause==="no-reduction";return t.trigger==="request"?{kind:o?"skip":"fail",reason:r.reason}:(this.reportOnce(`cut:${t.trigger}:${r.cause}:${he(n)}:${s.latestReplacement??0}`,`Thread ${this.threadId}: cannot compact (${t.trigger}): ${r.reason}`),{kind:"skip",reason:r.reason})}snapshot(t){let{journal:n}=this.ctx,r=[...n.state(A,this.threadId).surface.entries],s=r.map(a=>this.estimateOf(a)),o=J(this.ctx,this.threadId,this.agentName);return{entries:r,estimates:s,head:o,claimed:Q(t)}}factorFor(t,n,r){let s=this.ctx.llm.capacity(t).contextWindow;if(s===null)return 1;let o=1;for(let a of r.overflows){if(!N(a,t))continue;let i=this.overflowParts.get(a.seq);if(i===void 0){let c=a.measured!==null&&N(a.measured,a)?a.measured:null,l=0,w=0,k=this.sentWith(a.seq),g=k.map(f=>this.estimateOf(f));for(let f of Ze(k,g,c))c!==null&&de(f)?l+=f.tokens:w+=f.tokens;i={measured:c,counted:l,rest:w},this.overflowParts.set(a.seq,i)}o=Ye(o,s,i.measured===null?{measuredTokens:null,estimated:n+i.rest}:{measuredTokens:this.scaleOf(i.measured,n)*(n+i.counted),estimated:i.rest})}return o}measurementOn(t,n,r){let{measured:s}=r;return s===null||!N(s,t)?null:{anchor:s,scale:this.scaleOf(s,n)}}scaleOf(t,n){let r=this.counted.get(t.seq);r===void 0&&(r=this.sentWith(t.seq).reduce((o,a)=>o+this.estimateOf(a).tokens,0),this.counted.set(t.seq,r));let s=n+r;return s>0?t.tokens/s:1}sentWith(t){let n=this.ctx.journal.eventAt(t)?.thread_id??this.threadId;return this.ctx.journal.stateAt(Oe("surface"),n,t).entries}estimateOf(t){let n=this.estimates.get(t.row.seq);if(n===void 0){let r=this.ctx.journal.eventAt(t.row.seq);n={tokens:M(t.message),retold:r?.type==="input/message"&&r.data.source!==null&&r.data.input_id===null},this.estimates.set(t.row.seq,n)}return n}shape(t,n){let{journal:r}=this.ctx,{entries:s}=t,a=r.lineage(this.threadId).filter(d=>d.type==="input/message"&&d.data.role==="user"&&d.data.source===null),i=a[0]?.seq,c=a.at(-1),l=s.map(d=>d.type==="surface/replaced"?Ie(r,d.row):[d.row]),w=B(r,this.threadId),k=s.findIndex((d,y)=>(d.type!=="surface/replaced"||d.kind==="rewrite")&&l[y][0]?.seq===i),g=c===void 0?-1:l.findIndex(d=>d.some(y=>y.seq===c.seq));return{entries:s.map((d,y)=>({...n[y],directDeveloperInput:d.directDeveloperInput,retold:t.estimates[y].retold})),balanced:Array.from({length:s.length+1},(d,y)=>qe(s,y)),openingEnd:i===void 0||k<0?null:k,latest:c===void 0||g<0||c.type!=="input/message"?null:{index:g,copied:De(c.data.content,w.get(c.seq),this.strategy.copiedInputChars)},originals:l,numbers:w}}},Xe=e=>M(D({role:"user",content:e})),yt=({provider:e,model:t})=>({...e===void 0?{}:{provider:e},...t===void 0?{}:{model:t}});function xt(e,t){let n=e.thinking_effort,r=t.summarizer.thinkingEffort;if(n===null)return e;let s=ne.indexOf(r)<ne.indexOf(n)?r:n;return{...e,thinking_effort:s}}function bt(e,t,n){let r=e.originals.slice(t,n).flatMap(s=>s.map(o=>e.numbers.get(o.seq)));return{first:r.reduce((s,o)=>Math.min(s,o)),last:r.reduce((s,o)=>Math.max(s,o)),count:r.length}}function $t(e,t){return e.message.tool_calls.length>0?"it asked for a tool call":e.message.provider_calls.length>0?"the provider ran a tool for it":e.finish!=="completed"?`it did not finish (${e.finish})`:e.text.trim()===""?"it returned no text":t!==null&&t.tokens>t.limit?`it is longer than ${t.what} of ${t.limit} tokens`:null}function _t(e,t,n){let r=t.first===t.last?`message ${t.first}`:`messages ${t.first} to ${t.last}`;if(n===null)return`replaced ${r} with a checkpoint; the route declares no window, so the next request is estimated at ${Math.round(e.continuation)} tokens`;let s=tt(e.continuation/n);return e.targetReached?`replaced ${r} with a checkpoint; the next request is estimated at ${s} of the window, within the target`:`replaced ${r} with a checkpoint; the next request is estimated at ${s} of the window, above the target`}var tt=e=>`${Math.round(e*100)}%`,he=e=>`${e.provider}/${e.model}`;function Ze(e,t,n){return e.map((r,s)=>({tokens:t[s].tokens,measured:n!==null&&r.row.seq<=n.seq,written:r.type==="surface/replaced"||t[s].retold}))}var Rn=Se({id:"compaction#2",placement:"thread",schema:Ee,setup(e,t,n){vt(e,n.thread.id,n.thread.agentName,t)}});function vt(e,t,n,r){let{strategy:s,threshold:o}=r;return s.kind==="summarize"?e.plugin(et,{threadId:t,agentName:n,threshold:o,strategy:s}):e.plugin(Be,{threadId:t,agentName:n,threshold:o,strategy:s})}export{Rn as compactionPreset};
|
|
@@ -9,7 +9,7 @@ export declare const checkpointRecord: {
|
|
|
9
9
|
record: (value: {
|
|
10
10
|
summary_cap: number;
|
|
11
11
|
target_reached: boolean | null;
|
|
12
|
-
}) => import("../../
|
|
12
|
+
}) => import("../../records/journal.js").ExtensionRecord;
|
|
13
13
|
parse: (value: {
|
|
14
14
|
summary_cap: number;
|
|
15
15
|
target_reached: boolean | null;
|
|
@@ -34,38 +34,38 @@ export declare const checkpointRecord: {
|
|
|
34
34
|
append(journal: import("../../plugin.js").PluginJournal, value: {
|
|
35
35
|
summary_cap: number;
|
|
36
36
|
target_reached: boolean | null;
|
|
37
|
-
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../
|
|
38
|
-
read(event: import("../../
|
|
37
|
+
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
38
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
39
39
|
summary_cap: number;
|
|
40
40
|
target_reached: boolean | null;
|
|
41
41
|
} | undefined;
|
|
42
42
|
contribution(message: {
|
|
43
|
-
role?: import("../../
|
|
43
|
+
role?: import("../../records/journal.js").InputRole;
|
|
44
44
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
45
45
|
}, value: {
|
|
46
46
|
summary_cap: number;
|
|
47
47
|
target_reached: boolean | null;
|
|
48
48
|
}, options?: {
|
|
49
|
-
sourceSeqs?: readonly import("../../
|
|
50
|
-
}): import("../../
|
|
51
|
-
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../
|
|
49
|
+
sourceSeqs?: readonly import("../../records/journal.js").Seq[];
|
|
50
|
+
}): import("../../records/journal.js").StepContribution;
|
|
51
|
+
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord>): boolean;
|
|
52
52
|
rejection(reason: string, value: {
|
|
53
53
|
summary_cap: number;
|
|
54
54
|
target_reached: boolean | null;
|
|
55
55
|
}): {
|
|
56
56
|
decision: "reject";
|
|
57
57
|
reason: string;
|
|
58
|
-
source: import("../../
|
|
58
|
+
source: import("../../records/journal.js").ExtensionRecord;
|
|
59
59
|
};
|
|
60
|
-
readContribution: (event: import("../../
|
|
60
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
61
61
|
summary_cap: number;
|
|
62
62
|
target_reached: boolean | null;
|
|
63
63
|
} | undefined;
|
|
64
|
-
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../
|
|
64
|
+
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord> | null) => {
|
|
65
65
|
summary_cap: number;
|
|
66
66
|
target_reached: boolean | null;
|
|
67
67
|
} | undefined;
|
|
68
|
-
told: import("../../plugin.js").PluginProjection<import("../../
|
|
68
|
+
told: import("../../plugin.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
69
69
|
summary_cap: number;
|
|
70
70
|
target_reached: boolean | null;
|
|
71
71
|
}>>;
|
|
@@ -75,7 +75,7 @@ export declare const checkpointRecord: {
|
|
|
75
75
|
apply(state: State, value: {
|
|
76
76
|
summary_cap: number;
|
|
77
77
|
target_reached: boolean | null;
|
|
78
|
-
}, event: import("../../
|
|
78
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
79
79
|
onFork?: "inherit" | "reset";
|
|
80
80
|
}): import("../../plugin.js").PluginProjection<State>;
|
|
81
81
|
};
|
|
@@ -88,7 +88,7 @@ export declare const pruneRecord: {
|
|
|
88
88
|
record: (value: {
|
|
89
89
|
chars: number;
|
|
90
90
|
attachments: number;
|
|
91
|
-
}) => import("../../
|
|
91
|
+
}) => import("../../records/journal.js").ExtensionRecord;
|
|
92
92
|
parse: (value: {
|
|
93
93
|
chars: number;
|
|
94
94
|
attachments: number;
|
|
@@ -113,38 +113,38 @@ export declare const pruneRecord: {
|
|
|
113
113
|
append(journal: import("../../plugin.js").PluginJournal, value: {
|
|
114
114
|
chars: number;
|
|
115
115
|
attachments: number;
|
|
116
|
-
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../
|
|
117
|
-
read(event: import("../../
|
|
116
|
+
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
117
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
118
118
|
chars: number;
|
|
119
119
|
attachments: number;
|
|
120
120
|
} | undefined;
|
|
121
121
|
contribution(message: {
|
|
122
|
-
role?: import("../../
|
|
122
|
+
role?: import("../../records/journal.js").InputRole;
|
|
123
123
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
124
124
|
}, value: {
|
|
125
125
|
chars: number;
|
|
126
126
|
attachments: number;
|
|
127
127
|
}, options?: {
|
|
128
|
-
sourceSeqs?: readonly import("../../
|
|
129
|
-
}): import("../../
|
|
130
|
-
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../
|
|
128
|
+
sourceSeqs?: readonly import("../../records/journal.js").Seq[];
|
|
129
|
+
}): import("../../records/journal.js").StepContribution;
|
|
130
|
+
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord>): boolean;
|
|
131
131
|
rejection(reason: string, value: {
|
|
132
132
|
chars: number;
|
|
133
133
|
attachments: number;
|
|
134
134
|
}): {
|
|
135
135
|
decision: "reject";
|
|
136
136
|
reason: string;
|
|
137
|
-
source: import("../../
|
|
137
|
+
source: import("../../records/journal.js").ExtensionRecord;
|
|
138
138
|
};
|
|
139
|
-
readContribution: (event: import("../../
|
|
139
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
140
140
|
chars: number;
|
|
141
141
|
attachments: number;
|
|
142
142
|
} | undefined;
|
|
143
|
-
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../
|
|
143
|
+
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord> | null) => {
|
|
144
144
|
chars: number;
|
|
145
145
|
attachments: number;
|
|
146
146
|
} | undefined;
|
|
147
|
-
told: import("../../plugin.js").PluginProjection<import("../../
|
|
147
|
+
told: import("../../plugin.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
148
148
|
chars: number;
|
|
149
149
|
attachments: number;
|
|
150
150
|
}>>;
|
|
@@ -154,7 +154,7 @@ export declare const pruneRecord: {
|
|
|
154
154
|
apply(state: State, value: {
|
|
155
155
|
chars: number;
|
|
156
156
|
attachments: number;
|
|
157
|
-
}, event: import("../../
|
|
157
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
158
158
|
onFork?: "inherit" | "reset";
|
|
159
159
|
}): import("../../plugin.js").PluginProjection<State>;
|
|
160
160
|
};
|
|
@@ -166,7 +166,7 @@ export declare const pruneRecord: {
|
|
|
166
166
|
export declare const unusableSummaryRecord: {
|
|
167
167
|
record: (value: {
|
|
168
168
|
reason: string;
|
|
169
|
-
}) => import("../../
|
|
169
|
+
}) => import("../../records/journal.js").ExtensionRecord;
|
|
170
170
|
parse: (value: {
|
|
171
171
|
reason: string;
|
|
172
172
|
}) => {
|
|
@@ -187,33 +187,33 @@ export declare const unusableSummaryRecord: {
|
|
|
187
187
|
};
|
|
188
188
|
append(journal: import("../../plugin.js").PluginJournal, value: {
|
|
189
189
|
reason: string;
|
|
190
|
-
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../
|
|
191
|
-
read(event: import("../../
|
|
190
|
+
}, options: import("../../plugin.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
191
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
192
192
|
reason: string;
|
|
193
193
|
} | undefined;
|
|
194
194
|
contribution(message: {
|
|
195
|
-
role?: import("../../
|
|
195
|
+
role?: import("../../records/journal.js").InputRole;
|
|
196
196
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
197
197
|
}, value: {
|
|
198
198
|
reason: string;
|
|
199
199
|
}, options?: {
|
|
200
|
-
sourceSeqs?: readonly import("../../
|
|
201
|
-
}): import("../../
|
|
202
|
-
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../
|
|
200
|
+
sourceSeqs?: readonly import("../../records/journal.js").Seq[];
|
|
201
|
+
}): import("../../records/journal.js").StepContribution;
|
|
202
|
+
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord>): boolean;
|
|
203
203
|
rejection(reason: string, value: {
|
|
204
204
|
reason: string;
|
|
205
205
|
}): {
|
|
206
206
|
decision: "reject";
|
|
207
207
|
reason: string;
|
|
208
|
-
source: import("../../
|
|
208
|
+
source: import("../../records/journal.js").ExtensionRecord;
|
|
209
209
|
};
|
|
210
|
-
readContribution: (event: import("../../
|
|
210
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
211
211
|
reason: string;
|
|
212
212
|
} | undefined;
|
|
213
|
-
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../
|
|
213
|
+
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord> | null) => {
|
|
214
214
|
reason: string;
|
|
215
215
|
} | undefined;
|
|
216
|
-
told: import("../../plugin.js").PluginProjection<import("../../
|
|
216
|
+
told: import("../../plugin.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
217
217
|
reason: string;
|
|
218
218
|
}>>;
|
|
219
219
|
projection<State>(fold: {
|
|
@@ -221,7 +221,7 @@ export declare const unusableSummaryRecord: {
|
|
|
221
221
|
init(): State;
|
|
222
222
|
apply(state: State, value: {
|
|
223
223
|
reason: string;
|
|
224
|
-
}, event: import("../../
|
|
224
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
225
225
|
onFork?: "inherit" | "reset";
|
|
226
226
|
}): import("../../plugin.js").PluginProjection<State>;
|
|
227
227
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context } from '@leuduan/cordis';
|
|
2
|
+
import type { ExtensionRecord, Seq } from '../../records/journal.js';
|
|
2
3
|
/** A provider and model: what a usage measurement and a calibration factor belong to, effort aside. */
|
|
3
4
|
export type ModelKey = {
|
|
4
5
|
readonly provider: string;
|
|
@@ -59,3 +60,9 @@ export type CompactionLog = {
|
|
|
59
60
|
* the measurements that describe it.
|
|
60
61
|
*/
|
|
61
62
|
export declare function compactionLog(source: Pick<ExtensionRecord, 'plugin' | 'instance_id' | 'kind'>, unusable?: Pick<ExtensionRecord, 'kind'> | null): import("../../journal/projection.js").PluginProjection<CompactionLog>;
|
|
63
|
+
/**
|
|
64
|
+
* A reporter that says each condition once for as long as the strategy lives, one activation. `key`
|
|
65
|
+
* names the condition (its cause, the route, the latest replacement), so a step that finds it again
|
|
66
|
+
* stays quiet.
|
|
67
|
+
*/
|
|
68
|
+
export declare function onceReporter(ctx: Context): (key: string, message: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"../chunks/
|
|
1
|
+
import{b as a,c as b,d as c}from"../chunks/GGSVIIWJ.js";import"../chunks/6FRNHMCV.js";import"../chunks/CUK7CGC7.js";import"../chunks/BPRCULZH.js";import"../chunks/DDANMY45.js";import"../chunks/BBCW2FZK.js";import"../chunks/MMNNZCBO.js";import"../chunks/G44LG6VL.js";import"../chunks/D4PQP5MA.js";export{b as currentDateAndBranch,a as dateAndBranch,c as renderDateAndBranch};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolResult } from '../../
|
|
1
|
+
import type { ToolResult } from '../../records/toolResult.js';
|
|
2
2
|
import type { TaskSettlement } from './record.js';
|
|
3
3
|
import type { DelegationOutcome } from './request.js';
|
|
4
4
|
/** The most a failed task's answer quotes of the child's latest text. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { OriginCause } from '../../
|
|
2
|
+
import type { OriginCause } from '../../records/journal.js';
|
|
3
3
|
import type { StartedOrigin } from './record.js';
|
|
4
4
|
/**
|
|
5
5
|
* What delegations records of an owner's assignment in a task's origin: which assignment, and the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@leuduan/cordis';
|
|
2
|
-
import type { Seq } from '../../
|
|
2
|
+
import type { Seq } from '../../records/journal.js';
|
|
3
3
|
import { type TaskRef, type TaskState } from './record.js';
|
|
4
4
|
/** Who stops a task, why, and the call that stopped it when a call did. */
|
|
5
5
|
export type StopOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"../../chunks/
|
|
1
|
+
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s,y as t,z as u}from"../../chunks/CANPZYTH.js";import"../../chunks/VYMT4TXD.js";import"../../chunks/MNJ4SRF7.js";import"../../chunks/JFZZXVWD.js";import"../../chunks/N6IXG2VL.js";import"../../chunks/6DRCKZ2C.js";import"../../chunks/7LI64H5X.js";import"../../chunks/3UMZMPWW.js";import"../../chunks/34KW6VNQ.js";import"../../chunks/KUZCL2SH.js";import"../../chunks/CQEVREBT.js";import"../../chunks/HK6ZSONF.js";import"../../chunks/7VAPNE3L.js";import"../../chunks/EPYQ5M3B.js";import"../../chunks/5IRF47YB.js";import"../../chunks/OL5A6ITQ.js";import"../../chunks/JFX2MXBA.js";import"../../chunks/S34ZA2R6.js";import"../../chunks/6FRNHMCV.js";import"../../chunks/CUK7CGC7.js";import"../../chunks/BPRCULZH.js";import"../../chunks/FJLU4UH3.js";import"../../chunks/DDANMY45.js";import"../../chunks/BBCW2FZK.js";import"../../chunks/MMNNZCBO.js";import"../../chunks/G44LG6VL.js";import"../../chunks/D4PQP5MA.js";export{c as AssignmentKeyError,i as BackgroundField,t as DELEGATION_TOOLS,l as ROLE_INSTALLATION,b as ROLE_PRESET,a as RoleConfigSchema,f as assignmentChildId,d as assignmentKey,m as assignmentOutcome,e as assignmentTaskId,g as delegatedInputCall,j as delegationParameters,u as delegations,h as describeFailure,o as latestTaskOpenedAt,k as modelSelection,p as readNotice,r as readObligations,q as stopObligation,n as taskOrigin,s as tasksUnder};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@leuduan/cordis';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { type PluginJournal } from '../../journal/index.js';
|
|
4
|
-
import type { ExtensionRecord, Seq } from '../../
|
|
4
|
+
import type { ExtensionRecord, Seq } from '../../records/journal.js';
|
|
5
5
|
import { type TaskRef, type TaskState } from './record.js';
|
|
6
6
|
import type { DeepReadonly } from '../../util/json.js';
|
|
7
7
|
/** The most a notice quotes of what a blocking call would have returned; its closing hint comes on top. */
|
|
@@ -61,15 +61,15 @@ export declare const noticeEvent: {
|
|
|
61
61
|
thread_id: string;
|
|
62
62
|
status: "completed" | "failed";
|
|
63
63
|
summary: string;
|
|
64
|
-
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../
|
|
65
|
-
read(event: import("../../
|
|
64
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
65
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
66
66
|
task_id: string;
|
|
67
67
|
thread_id: string;
|
|
68
68
|
status: "completed" | "failed";
|
|
69
69
|
summary: string;
|
|
70
70
|
} | undefined;
|
|
71
71
|
contribution(message: {
|
|
72
|
-
role?: import("../../
|
|
72
|
+
role?: import("../../records/journal.js").InputRole;
|
|
73
73
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
74
74
|
}, value: {
|
|
75
75
|
task_id: string;
|
|
@@ -78,7 +78,7 @@ export declare const noticeEvent: {
|
|
|
78
78
|
summary: string;
|
|
79
79
|
}, options?: {
|
|
80
80
|
sourceSeqs?: readonly Seq[];
|
|
81
|
-
}): import("../../
|
|
81
|
+
}): import("../../records/journal.js").StepContribution;
|
|
82
82
|
matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
|
|
83
83
|
rejection(reason: string, value: {
|
|
84
84
|
task_id: string;
|
|
@@ -90,7 +90,7 @@ export declare const noticeEvent: {
|
|
|
90
90
|
reason: string;
|
|
91
91
|
source: ExtensionRecord;
|
|
92
92
|
};
|
|
93
|
-
readContribution: (event: import("../../
|
|
93
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
94
94
|
task_id: string;
|
|
95
95
|
thread_id: string;
|
|
96
96
|
status: "completed" | "failed";
|
|
@@ -102,7 +102,7 @@ export declare const noticeEvent: {
|
|
|
102
102
|
status: "completed" | "failed";
|
|
103
103
|
summary: string;
|
|
104
104
|
} | undefined;
|
|
105
|
-
told: import("../../journal/projection.js").PluginProjection<import("../../
|
|
105
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
106
106
|
task_id: string;
|
|
107
107
|
thread_id: string;
|
|
108
108
|
status: "completed" | "failed";
|
|
@@ -116,7 +116,7 @@ export declare const noticeEvent: {
|
|
|
116
116
|
thread_id: string;
|
|
117
117
|
status: "completed" | "failed";
|
|
118
118
|
summary: string;
|
|
119
|
-
}, event: import("../../
|
|
119
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
120
120
|
onFork?: "inherit" | "reset";
|
|
121
121
|
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
122
122
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type AppendEntry, type PluginJournal } from '../../journal/index.js';
|
|
3
|
-
import type { Seq } from '../../
|
|
3
|
+
import type { Seq } from '../../records/journal.js';
|
|
4
4
|
import type { TaskRef } from './record.js';
|
|
5
5
|
export declare const stopObligationRow: {
|
|
6
6
|
record: (value: {
|
|
@@ -14,7 +14,7 @@ export declare const stopObligationRow: {
|
|
|
14
14
|
} | {
|
|
15
15
|
op: "stop_completed";
|
|
16
16
|
obligation_id: string;
|
|
17
|
-
}) => import("../../
|
|
17
|
+
}) => import("../../records/journal.js").ExtensionRecord;
|
|
18
18
|
parse: (value: {
|
|
19
19
|
op: "stop_requested";
|
|
20
20
|
obligation_id: string;
|
|
@@ -71,8 +71,8 @@ export declare const stopObligationRow: {
|
|
|
71
71
|
} | {
|
|
72
72
|
op: "stop_completed";
|
|
73
73
|
obligation_id: string;
|
|
74
|
-
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../
|
|
75
|
-
read(event: import("../../
|
|
74
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
75
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
76
76
|
op: "stop_requested";
|
|
77
77
|
obligation_id: string;
|
|
78
78
|
reason: string;
|
|
@@ -85,7 +85,7 @@ export declare const stopObligationRow: {
|
|
|
85
85
|
obligation_id: string;
|
|
86
86
|
} | undefined;
|
|
87
87
|
contribution(message: {
|
|
88
|
-
role?: import("../../
|
|
88
|
+
role?: import("../../records/journal.js").InputRole;
|
|
89
89
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
90
90
|
}, value: {
|
|
91
91
|
op: "stop_requested";
|
|
@@ -100,8 +100,8 @@ export declare const stopObligationRow: {
|
|
|
100
100
|
obligation_id: string;
|
|
101
101
|
}, options?: {
|
|
102
102
|
sourceSeqs?: readonly Seq[];
|
|
103
|
-
}): import("../../
|
|
104
|
-
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../
|
|
103
|
+
}): import("../../records/journal.js").StepContribution;
|
|
104
|
+
matchesSource(record: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord>): boolean;
|
|
105
105
|
rejection(reason: string, value: {
|
|
106
106
|
op: "stop_requested";
|
|
107
107
|
obligation_id: string;
|
|
@@ -116,9 +116,9 @@ export declare const stopObligationRow: {
|
|
|
116
116
|
}): {
|
|
117
117
|
decision: "reject";
|
|
118
118
|
reason: string;
|
|
119
|
-
source: import("../../
|
|
119
|
+
source: import("../../records/journal.js").ExtensionRecord;
|
|
120
120
|
};
|
|
121
|
-
readContribution: (event: import("../../
|
|
121
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
122
122
|
op: "stop_requested";
|
|
123
123
|
obligation_id: string;
|
|
124
124
|
reason: string;
|
|
@@ -130,7 +130,7 @@ export declare const stopObligationRow: {
|
|
|
130
130
|
op: "stop_completed";
|
|
131
131
|
obligation_id: string;
|
|
132
132
|
} | undefined;
|
|
133
|
-
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../
|
|
133
|
+
readSource: (source: import("../../util/json.js").DeepReadonly<import("../../records/journal.js").ExtensionRecord> | null) => {
|
|
134
134
|
op: "stop_requested";
|
|
135
135
|
obligation_id: string;
|
|
136
136
|
reason: string;
|
|
@@ -142,7 +142,7 @@ export declare const stopObligationRow: {
|
|
|
142
142
|
op: "stop_completed";
|
|
143
143
|
obligation_id: string;
|
|
144
144
|
} | undefined;
|
|
145
|
-
told: import("../../journal/projection.js").PluginProjection<import("../../
|
|
145
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
146
146
|
op: "stop_requested";
|
|
147
147
|
obligation_id: string;
|
|
148
148
|
reason: string;
|
|
@@ -168,7 +168,7 @@ export declare const stopObligationRow: {
|
|
|
168
168
|
} | {
|
|
169
169
|
op: "stop_completed";
|
|
170
170
|
obligation_id: string;
|
|
171
|
-
}, event: import("../../
|
|
171
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
172
172
|
onFork?: "inherit" | "reset";
|
|
173
173
|
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
174
174
|
};
|
|
@@ -194,7 +194,7 @@ export declare const stopObligations: import("../../journal/projection.js").Plug
|
|
|
194
194
|
* entry carries the value, so one rebuilt without it, after a crash between rows and catalog, is
|
|
195
195
|
* one the registration's refresh recomputes.
|
|
196
196
|
*/
|
|
197
|
-
export declare const outstandingStops: import("../../services/
|
|
197
|
+
export declare const outstandingStops: import("../../services/catalogContributions.js").ContributionDefinition<{
|
|
198
198
|
obligation_id: string;
|
|
199
199
|
seq: number;
|
|
200
200
|
reason: string;
|