@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
|
@@ -7,7 +7,6 @@ import { z } from 'zod';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const AgentsMdDiscoverySchema: z.ZodObject<{
|
|
9
9
|
fileNames: z.ZodArray<z.ZodString>;
|
|
10
|
-
rootMarkers: z.ZodArray<z.ZodString>;
|
|
11
10
|
maxBytes: z.ZodNumber;
|
|
12
11
|
}, z.core.$strict>;
|
|
13
12
|
export type AgentsMdDiscovery = z.output<typeof AgentsMdDiscoverySchema>;
|
|
@@ -21,9 +20,10 @@ export type Briefing = AgentsMdDiscovery & {
|
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
22
|
* Tells the thread whose scope the calling plugin is mounted in its instructions, for as long as
|
|
24
|
-
* that plugin lives; the plugin injects `journal` and `
|
|
23
|
+
* that plugin lives; the plugin injects `journal` and `confinement`. The one implementation behind
|
|
25
24
|
* both forms, and what `codexPreset` mounts on its own thread. Only that thread's steps reach a
|
|
26
|
-
* listener in its scope, so the briefing needs no thread
|
|
25
|
+
* listener in its scope, so the briefing needs no selector; `threadId` is the thread it is
|
|
26
|
+
* mounted for.
|
|
27
27
|
*
|
|
28
28
|
* It claims the thread's scope first, so a second briefing on the thread is refused, naming
|
|
29
29
|
* `holder`'s, and tells the thread at the first model step at which no notice found with the same
|
|
@@ -32,24 +32,29 @@ export type Briefing = AgentsMdDiscovery & {
|
|
|
32
32
|
* the files are never read again for them, a reopen or a retried call repeats nothing, and a fork
|
|
33
33
|
* inherits what its source was told; a briefing with other settings, such as an installation that
|
|
34
34
|
* replaced the first, finds and tells the files anew.
|
|
35
|
+
*
|
|
36
|
+
* The files are read through the thread's confinement operation, as its own file tools would read
|
|
37
|
+
* them, and read ahead: the returned promise settles once they were, so a setup that awaits it
|
|
38
|
+
* leaves the thread ready with its instructions prepared, and the step, which cannot wait, only tells
|
|
39
|
+
* what was prepared. What a step finds unprepared, because the confinement changed since the read
|
|
40
|
+
* (`ConfinementService.epoch`), is dropped and prepared again for a later step, never read by the
|
|
41
|
+
* step itself and never told from before the change. An operation the handler refuses (a sandbox
|
|
42
|
+
* that cannot say what the conversation may read) tells nothing, records nothing, and says so in the log.
|
|
35
43
|
*/
|
|
36
|
-
export declare function tellAgentsMd(ctx: Context, briefing: Briefing): void
|
|
44
|
+
export declare function tellAgentsMd(ctx: Context, briefing: Briefing, threadId: string): Promise<void>;
|
|
37
45
|
/**
|
|
38
|
-
* Tells a thread the instructions
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* file told is inside what it may read. A conversation already under way is told at its next step,
|
|
48
|
-
* and so is one whose briefing now has other settings than its latest notice recorded.
|
|
46
|
+
* Tells a thread the instructions file in its `cwd`, once, as a conversation message: on the first
|
|
47
|
+
* model step at which nothing of the kind is recorded for the thread, it reads the first of
|
|
48
|
+
* `fileNames` in the `cwd` that exists and is not empty, at most `maxBytes` of it, and records what
|
|
49
|
+
* it told, "none found" included, with those settings. Only the `cwd` is looked in: no directory
|
|
50
|
+
* above it, whatever marks a repository there. A thread is never told twice under the same
|
|
51
|
+
* settings: every later step, a reopened journal and a retried call work from that record, and
|
|
52
|
+
* edits made while the thread lives are not told; the agent can read the file with its tools,
|
|
53
|
+
* since a file told is inside what it may read. A conversation already under way is told at its
|
|
54
|
+
* next step, and so is one whose briefing now has other settings than its latest notice recorded.
|
|
49
55
|
*
|
|
50
|
-
* The notice states how the
|
|
51
|
-
*
|
|
52
|
-
* for when it works there.
|
|
56
|
+
* The notice states how the file applies: it governs the `cwd`'s tree, direct instructions beat
|
|
57
|
+
* it, and files below the `cwd` are the agent's to look for when it works there.
|
|
53
58
|
*
|
|
54
59
|
* The notice is recorded text, so once a replacement takes it off the surface it is told again as
|
|
55
60
|
* recorded: a copy of the notice row's content, under the same source, never a fresh read of the
|
|
@@ -69,8 +74,7 @@ export declare function tellAgentsMd(ctx: Context, briefing: Briefing): void;
|
|
|
69
74
|
* `mountPreset(root, agentsMdPreset, discovery, { agents })`, it tells each activation whose agent
|
|
70
75
|
* the selector picks, and hands nothing down. Its configuration is only the discovery settings.
|
|
71
76
|
*/
|
|
72
|
-
export declare const agentsMdPreset: import("../services/
|
|
77
|
+
export declare const agentsMdPreset: import("../services/presets/definition.js").Preset<z.ZodObject<{
|
|
73
78
|
fileNames: z.ZodArray<z.ZodString>;
|
|
74
|
-
rootMarkers: z.ZodArray<z.ZodString>;
|
|
75
79
|
maxBytes: z.ZodNumber;
|
|
76
80
|
}, z.core.$strict>>;
|
package/dist/plugins/agentsMd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunks/
|
|
1
|
+
import{a,b,c,d,e}from"../chunks/EMRB4KCN.js";import"../chunks/PUSUPTAT.js";import"../chunks/CQEVREBT.js";import"../chunks/5IRF47YB.js";import"../chunks/OL5A6ITQ.js";import"../chunks/S34ZA2R6.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{c as AGENTS_MD_INSTALLATION,b as AGENTS_MD_PRESET,a as AgentsMdDiscoverySchema,e as agentsMdPreset,d as tellAgentsMd};
|
|
@@ -9,9 +9,9 @@ import { type AskServiceConfig } from './service.js';
|
|
|
9
9
|
* kept on.
|
|
10
10
|
*
|
|
11
11
|
* Root-only, mounted once by the application, before the presets that mount {@link askQuestion}.
|
|
12
|
-
* The worked example is in the plugin guide (`docs/plugins.md`, Run constraints).
|
|
12
|
+
* The worked example is in the plugin guide (`docs/guides/plugins.md`, Run constraints).
|
|
13
13
|
*/
|
|
14
|
-
export declare const ask: Plugin.
|
|
14
|
+
export declare const ask: Plugin.Constructor<AskServiceConfig>;
|
|
15
15
|
declare const AskQuestionConfigSchema: z.ZodObject<{
|
|
16
16
|
name: z.ZodDefault<z.ZodString>;
|
|
17
17
|
agents: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodLiteral<"global">, z.ZodLiteral<"all">]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../../chunks/
|
|
1
|
+
import{a,b,c,d,e}from"../../chunks/RCIHV3KG.js";import"../../chunks/MNJ4SRF7.js";import"../../chunks/HK6ZSONF.js";import"../../chunks/JFX2MXBA.js";import"../../chunks/S34ZA2R6.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{a as ASK_OWNER,b as QuestionAnsweredError,c as QuestionClosedError,d as ask,e as askQuestion};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service, type Context } from '@leuduan/cordis';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { type InvocationContext, type ResolvedWait, type WaitRequest } from '../../loop/index.js';
|
|
4
|
-
import type { Seq } from '../../
|
|
4
|
+
import type { Seq } from '../../records/journal.js';
|
|
5
5
|
declare module '@leuduan/cordis' {
|
|
6
6
|
interface Context {
|
|
7
7
|
/** The questions agents ask the user, and their answers (optional plugin). */
|
|
@@ -12,7 +12,7 @@ declare module '@leuduan/cordis' {
|
|
|
12
12
|
export declare const ASK_OWNER = "lagent:ask";
|
|
13
13
|
export declare const AskServiceConfigSchema: z.ZodObject<{
|
|
14
14
|
deadlineMs: z.ZodNullable<z.ZodNumber>;
|
|
15
|
-
clock: z.ZodCustom<import("../../
|
|
15
|
+
clock: z.ZodCustom<import("../../util/timers.js").Clock, import("../../util/timers.js").Clock>;
|
|
16
16
|
}, z.core.$strict>;
|
|
17
17
|
export type AskServiceConfig = z.input<typeof AskServiceConfigSchema>;
|
|
18
18
|
declare const AskOptionSchema: z.ZodObject<{
|
|
@@ -29,11 +29,14 @@ export declare const COMMAND_TOOLS: readonly ["run_command", "start_command", "r
|
|
|
29
29
|
* is on this system, read once at mount.
|
|
30
30
|
*
|
|
31
31
|
* Every command runs with exactly the `environment` the host configures, which nothing defaults:
|
|
32
|
-
* lagent passes on none of its own. Commands launch through `ctx.
|
|
33
|
-
* so a host that registers a
|
|
32
|
+
* lagent passes on none of its own. Commands launch through `ctx.confinement`, with the thread they serve,
|
|
33
|
+
* so a host that registers a confinement handler, such as an OS sandbox, confines every `run_command` and
|
|
34
34
|
* `start_command` without this plugin knowing it. What the handler lets the model do is the
|
|
35
35
|
* handler's to tell, as a notice.
|
|
36
36
|
*
|
|
37
|
+
* Each command's log is kept in its thread's directory, so the plugin injects `threadDirs`: on a root
|
|
38
|
+
* without `threadDirs` mounted it stays pending, mounting nothing, until one is.
|
|
39
|
+
*
|
|
37
40
|
* Root-only: the background commands live on the `ctx.commands` service this mounts.
|
|
38
41
|
*/
|
|
39
42
|
export declare const commands: Plugin.Object<CommandsConfigInput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../../chunks/
|
|
1
|
+
import{a,b,c,d,e,f}from"../../chunks/JFZZXVWD.js";import"../../chunks/N6IXG2VL.js";import"../../chunks/6DRCKZ2C.js";import"../../chunks/7LI64H5X.js";import"../../chunks/3UMZMPWW.js";import"../../chunks/7VAPNE3L.js";import"../../chunks/EPYQ5M3B.js";import"../../chunks/5IRF47YB.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{e as COMMAND_TOOLS,b as commandRecords,a as commandRow,d as commandWork,f as commands,c as readCommandNotice};
|
|
@@ -82,7 +82,7 @@ export declare class CommandOutput {
|
|
|
82
82
|
get hasUnread(): boolean;
|
|
83
83
|
/** Reads `source` to its end, pausing it while the log's buffer is full. */
|
|
84
84
|
attach(source: Readable): void;
|
|
85
|
-
/** Adds text the command did not print, such as a
|
|
85
|
+
/** Adds text the command did not print, such as a confinement handler's report; before {@link finish}. */
|
|
86
86
|
note(text: string): void;
|
|
87
87
|
/** Flushes the decoder and ends the log. Call once the command has settled. */
|
|
88
88
|
finish(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type ExtensionRecord, type Seq } from '../../
|
|
2
|
+
import { type ExtensionRecord, type Seq } from '../../records/journal.js';
|
|
3
3
|
import type { DeepReadonly } from '../../util/json.js';
|
|
4
4
|
/**
|
|
5
5
|
* What the journal keeps of a background command, so that a lagent process that did not start it
|
|
@@ -185,8 +185,8 @@ export declare const commandRow: {
|
|
|
185
185
|
stop_failed: boolean;
|
|
186
186
|
stop_reason: string | null;
|
|
187
187
|
ended_at: string;
|
|
188
|
-
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../
|
|
189
|
-
read(event: import("../../
|
|
188
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
189
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
190
190
|
op: "started";
|
|
191
191
|
id: string;
|
|
192
192
|
call_seq: number;
|
|
@@ -212,7 +212,7 @@ export declare const commandRow: {
|
|
|
212
212
|
ended_at: string;
|
|
213
213
|
} | undefined;
|
|
214
214
|
contribution(message: {
|
|
215
|
-
role?: import("../../
|
|
215
|
+
role?: import("../../records/journal.js").InputRole;
|
|
216
216
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
217
217
|
}, value: {
|
|
218
218
|
op: "started";
|
|
@@ -240,7 +240,7 @@ export declare const commandRow: {
|
|
|
240
240
|
ended_at: string;
|
|
241
241
|
}, options?: {
|
|
242
242
|
sourceSeqs?: readonly Seq[];
|
|
243
|
-
}): import("../../
|
|
243
|
+
}): import("../../records/journal.js").StepContribution;
|
|
244
244
|
matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
|
|
245
245
|
rejection(reason: string, value: {
|
|
246
246
|
op: "started";
|
|
@@ -271,7 +271,7 @@ export declare const commandRow: {
|
|
|
271
271
|
reason: string;
|
|
272
272
|
source: ExtensionRecord;
|
|
273
273
|
};
|
|
274
|
-
readContribution: (event: import("../../
|
|
274
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
275
275
|
op: "started";
|
|
276
276
|
id: string;
|
|
277
277
|
call_seq: number;
|
|
@@ -321,7 +321,7 @@ export declare const commandRow: {
|
|
|
321
321
|
stop_reason: string | null;
|
|
322
322
|
ended_at: string;
|
|
323
323
|
} | undefined;
|
|
324
|
-
told: import("../../journal/projection.js").PluginProjection<import("../../
|
|
324
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
325
325
|
op: "started";
|
|
326
326
|
id: string;
|
|
327
327
|
call_seq: number;
|
|
@@ -373,7 +373,7 @@ export declare const commandRow: {
|
|
|
373
373
|
stop_failed: boolean;
|
|
374
374
|
stop_reason: string | null;
|
|
375
375
|
ended_at: string;
|
|
376
|
-
}, event: import("../../
|
|
376
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
377
377
|
onFork?: "inherit" | "reset";
|
|
378
378
|
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
379
379
|
};
|
|
@@ -438,15 +438,15 @@ export declare const commandNotice: {
|
|
|
438
438
|
exit_code: number | null;
|
|
439
439
|
exit_signal: string | null;
|
|
440
440
|
summary: string;
|
|
441
|
-
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../
|
|
442
|
-
read(event: import("../../
|
|
441
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
442
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
443
443
|
id: string;
|
|
444
444
|
exit_code: number | null;
|
|
445
445
|
exit_signal: string | null;
|
|
446
446
|
summary: string;
|
|
447
447
|
} | undefined;
|
|
448
448
|
contribution(message: {
|
|
449
|
-
role?: import("../../
|
|
449
|
+
role?: import("../../records/journal.js").InputRole;
|
|
450
450
|
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
451
451
|
}, value: {
|
|
452
452
|
id: string;
|
|
@@ -455,7 +455,7 @@ export declare const commandNotice: {
|
|
|
455
455
|
summary: string;
|
|
456
456
|
}, options?: {
|
|
457
457
|
sourceSeqs?: readonly Seq[];
|
|
458
|
-
}): import("../../
|
|
458
|
+
}): import("../../records/journal.js").StepContribution;
|
|
459
459
|
matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
|
|
460
460
|
rejection(reason: string, value: {
|
|
461
461
|
id: string;
|
|
@@ -467,7 +467,7 @@ export declare const commandNotice: {
|
|
|
467
467
|
reason: string;
|
|
468
468
|
source: ExtensionRecord;
|
|
469
469
|
};
|
|
470
|
-
readContribution: (event: import("../../
|
|
470
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
471
471
|
id: string;
|
|
472
472
|
exit_code: number | null;
|
|
473
473
|
exit_signal: string | null;
|
|
@@ -479,7 +479,7 @@ export declare const commandNotice: {
|
|
|
479
479
|
exit_signal: string | null;
|
|
480
480
|
summary: string;
|
|
481
481
|
} | undefined;
|
|
482
|
-
told: import("../../journal/projection.js").PluginProjection<import("../../
|
|
482
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
483
483
|
id: string;
|
|
484
484
|
exit_code: number | null;
|
|
485
485
|
exit_signal: string | null;
|
|
@@ -493,7 +493,7 @@ export declare const commandNotice: {
|
|
|
493
493
|
exit_code: number | null;
|
|
494
494
|
exit_signal: string | null;
|
|
495
495
|
summary: string;
|
|
496
|
-
}, event: import("../../
|
|
496
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
497
497
|
onFork?: "inherit" | "reset";
|
|
498
498
|
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
499
499
|
};
|
|
@@ -503,18 +503,19 @@ export declare const readCommandNotice: (source: DeepReadonly<ExtensionRecord> |
|
|
|
503
503
|
export declare const RUN_COMMAND = "run_command";
|
|
504
504
|
/**
|
|
505
505
|
* How a `run_command` call's process group is known to have ended, from its rows alone, on
|
|
506
|
-
* affirmative evidence only: `not-run` while no dispatch attempt of it was allowed,
|
|
507
|
-
*
|
|
506
|
+
* affirmative evidence only: `not-run` while no dispatch attempt of it was allowed, or the runtime
|
|
507
|
+
* dispatcher records that execution was prevented before entering middleware. Otherwise,
|
|
508
|
+
* `ended` only when its result carries the tool's own report that the stop
|
|
508
509
|
* succeeded (`stop_failed: false`), `stop-failed` when that report says the stop failed, and
|
|
509
510
|
* `unknown` otherwise: no result yet, a call cut off, or a result written by anything but the tool,
|
|
510
511
|
* such as an error that replaced its report.
|
|
511
512
|
*/
|
|
512
513
|
export type ForegroundEnd = 'not-run' | 'ended' | 'stop-failed' | 'unknown';
|
|
513
514
|
/**
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* spawn row, as the background records do.
|
|
515
|
+
* Foreground commands, by their `tool/call` or runtime `execution/requested` row. Authorization
|
|
516
|
+
* marks a possibly started group; only the executor's result establishes cleanup, or the runtime
|
|
517
|
+
* dispatcher's unstarted outcome establishes that nothing ran. Resets at a
|
|
518
|
+
* fork's spawn row, as the background records do.
|
|
518
519
|
*/
|
|
519
520
|
export declare const foregroundCommands: import("../../journal/projection.js").PluginProjection<Map<number, ForegroundEnd>>;
|
|
520
521
|
/**
|
|
@@ -530,6 +531,10 @@ declare const UnendedCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
530
531
|
kind: z.ZodLiteral<"foreground">;
|
|
531
532
|
call_seq: z.ZodNumber;
|
|
532
533
|
stop_failed: z.ZodBoolean;
|
|
534
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
535
|
+
kind: z.ZodLiteral<"runtime">;
|
|
536
|
+
request_seq: z.ZodNumber;
|
|
537
|
+
stop_failed: z.ZodBoolean;
|
|
533
538
|
}, z.core.$strict>], "kind">;
|
|
534
539
|
export type UnendedCommand = z.output<typeof UnendedCommandSchema>;
|
|
535
540
|
/**
|
|
@@ -537,7 +542,7 @@ export type UnendedCommand = z.output<typeof UnendedCommandSchema>;
|
|
|
537
542
|
* thread while the commands plugin is mounted. A thread whose records cannot be read reads
|
|
538
543
|
* `unavailable`, which nothing reads as "none".
|
|
539
544
|
*/
|
|
540
|
-
export declare const commandsContribution: import("../../services/
|
|
545
|
+
export declare const commandsContribution: import("../../services/catalogContributions.js").ContributionDefinition<({
|
|
541
546
|
kind: "background";
|
|
542
547
|
id: string;
|
|
543
548
|
stop_failed: boolean;
|
|
@@ -545,5 +550,9 @@ export declare const commandsContribution: import("../../services/contributions.
|
|
|
545
550
|
kind: "foreground";
|
|
546
551
|
call_seq: number;
|
|
547
552
|
stop_failed: boolean;
|
|
553
|
+
} | {
|
|
554
|
+
kind: "runtime";
|
|
555
|
+
request_seq: number;
|
|
556
|
+
stop_failed: boolean;
|
|
548
557
|
})[]>;
|
|
549
558
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Service, type Context } from '@leuduan/cordis';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import type
|
|
4
|
-
import type { Seq } from '../../
|
|
5
|
-
import type
|
|
3
|
+
import { type SpawnResult, type SpawnedCommand } from '../../sys/spawn.js';
|
|
4
|
+
import type { Seq } from '../../records/journal.js';
|
|
5
|
+
import { type ConfinementOperation, type Launched, type LaunchProvenance } from '../../services/confinement/service.js';
|
|
6
6
|
import { CommandOutput } from './output.js';
|
|
7
7
|
import { type CommandEnded, type CommandRecord, type CommandStarted } from './record.js';
|
|
8
8
|
declare module '@leuduan/cordis' {
|
|
@@ -66,7 +66,7 @@ export type CommandInfo = {
|
|
|
66
66
|
readonly stopReason: string | null;
|
|
67
67
|
readonly stopFailed: boolean;
|
|
68
68
|
readonly logPath: string;
|
|
69
|
-
/** What the
|
|
69
|
+
/** What the confinement handler selected for it, from the live launch or the start row; `null` for a plain launch. */
|
|
70
70
|
readonly launch: LaunchProvenance | null;
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
@@ -90,8 +90,9 @@ export type CommandWork = {
|
|
|
90
90
|
* still starts or runs, or whose end row is on its way, is draining; any other is unresolved. A
|
|
91
91
|
* `run_command` call has ended once its result carries the tool's own report that the stop
|
|
92
92
|
* succeeded, and never ran while no dispatch of it was allowed; one launched without that report is
|
|
93
|
-
* draining while
|
|
94
|
-
*
|
|
93
|
+
* draining only while its current-turn dispatch is unanswered and running here. A settled result
|
|
94
|
+
* lacking cleanup evidence, or an earlier turn's abandoned dispatch, is unresolved even while a
|
|
95
|
+
* later turn is running. A stop that failed,
|
|
95
96
|
* and records that cannot be read, are unresolved. Synchronous, so a write may decide on it.
|
|
96
97
|
*/
|
|
97
98
|
export declare function commandWork(ctx: Context, threadId: string, options: {
|
|
@@ -103,8 +104,10 @@ export type StartRequest = {
|
|
|
103
104
|
readonly callSeq: Seq;
|
|
104
105
|
readonly command: string;
|
|
105
106
|
readonly cwd: string;
|
|
106
|
-
/** The thread's working directory, which a
|
|
107
|
+
/** The thread's working directory, which a confinement handler treats as the root it protects. */
|
|
107
108
|
readonly threadCwd: string;
|
|
109
|
+
/** The call's confinement operation: its one snapshot admits the launch. The command outlives the call; the operation's file access does not. */
|
|
110
|
+
readonly operation: ConfinementOperation;
|
|
108
111
|
readonly notify: 'exit' | null;
|
|
109
112
|
};
|
|
110
113
|
/** A background command and everything the tools report about it. */
|
|
@@ -126,9 +129,9 @@ export declare class BackgroundCommand {
|
|
|
126
129
|
constructor(id: string, threadId: string, command: string, cwd: string, output: CommandOutput, process: SpawnedCommand,
|
|
127
130
|
/** `exit`: a natural exit wakes the thread that started it with a notice. */
|
|
128
131
|
notify: 'exit' | null,
|
|
129
|
-
/** What the
|
|
132
|
+
/** What the confinement handler selected for it. */
|
|
130
133
|
launch: LaunchProvenance | null,
|
|
131
|
-
/** The
|
|
134
|
+
/** The confinement handler's report on the command, which joins its output once it ended. */
|
|
132
135
|
diagnostics: Promise<string | null>, onEnd: (command: BackgroundCommand) => void);
|
|
133
136
|
get running(): boolean;
|
|
134
137
|
get logPath(): string;
|
|
@@ -196,9 +199,12 @@ export declare class CommandsService extends Service<CommandsConfigInput> {
|
|
|
196
199
|
private readonly operations;
|
|
197
200
|
private readonly lifetime;
|
|
198
201
|
constructor(ctx: Context, config: CommandsConfigInput);
|
|
202
|
+
/** Where command `id` of `threadId` logs, for a caller whose scope does not inject `threadDirs`. */
|
|
203
|
+
logPathFor(threadId: string, id: string): string;
|
|
199
204
|
/**
|
|
200
|
-
* Launches one command of either kind
|
|
201
|
-
*
|
|
205
|
+
* Launches one command of either kind under the calling tool's confinement operation, so what the
|
|
206
|
+
* call did with files and this launch share one snapshot: the one place a command starts, so the
|
|
207
|
+
* shutdown that stops them all sees every one. Refused once shut down. `options.signal` owns
|
|
202
208
|
* the command, and shutdown stops it too.
|
|
203
209
|
*/
|
|
204
210
|
launch(request: {
|
|
@@ -206,6 +212,7 @@ export declare class CommandsService extends Service<CommandsConfigInput> {
|
|
|
206
212
|
workdir: string;
|
|
207
213
|
threadId: string;
|
|
208
214
|
threadCwd: string;
|
|
215
|
+
operation: ConfinementOperation;
|
|
209
216
|
}, options: {
|
|
210
217
|
signal: AbortSignal;
|
|
211
218
|
timeoutMs?: number;
|
|
@@ -6,3 +6,5 @@ export declare const readCommandOutputTool: (config: CommandsConfig) => Tool;
|
|
|
6
6
|
export declare const listCommandsTool: Tool;
|
|
7
7
|
/** `stop_command`, reporting within `config`'s output budget. */
|
|
8
8
|
export declare const stopCommandTool: (config: CommandsConfig) => Tool;
|
|
9
|
+
/** `run_command`: one shell command, run to completion under `config`. */
|
|
10
|
+
export declare const runCommandTool: (config: CommandsConfig) => Tool;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Context } from '@leuduan/cordis';
|
|
2
|
+
import { type ContentPart } from '../../llm/content.js';
|
|
2
3
|
/**
|
|
3
4
|
* The texts the strategy writes: the instruction its summary call ends on, and the checkpoint that
|
|
4
5
|
* stands in for a span. Everything here but the summary is written by code, so the pointers in it
|
|
@@ -89,3 +90,5 @@ export declare const widestInstruction: (options: {
|
|
|
89
90
|
readonly cap: number;
|
|
90
91
|
readonly focus: string | null;
|
|
91
92
|
}) => string;
|
|
93
|
+
/** Whether the thread's agent has both recall tools granted now, so a stand-in or a footer may point at them. */
|
|
94
|
+
export declare function recallGranted(ctx: Context, agentName: string): boolean;
|
|
@@ -126,8 +126,8 @@ export type StrategyOptions<Strategy> = {
|
|
|
126
126
|
* What a host may pass to `thread.compact({ options })` for this strategy: nothing, or what the
|
|
127
127
|
* summary should pay particular attention to, as a person typing `/compact <focus>` would say it.
|
|
128
128
|
*/
|
|
129
|
-
export declare const
|
|
129
|
+
export declare const SummarizeRequestOptionsSchema: z.ZodNullable<z.ZodObject<{
|
|
130
130
|
focus: z.ZodOptional<z.ZodString>;
|
|
131
131
|
}, z.core.$strict>>;
|
|
132
|
-
/** The `options` a host passes to `thread.compact()` for this strategy; see `
|
|
133
|
-
export type
|
|
132
|
+
/** The `options` a host passes to `thread.compact()` for this strategy; see `SummarizeRequestOptionsSchema`. */
|
|
133
|
+
export type SummarizeRequestOptions = z.input<typeof SummarizeRequestOptionsSchema>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Context } from '@leuduan/cordis';
|
|
2
|
+
import { type PromptBlock } from '../../llm/prompt.js';
|
|
3
|
+
import { type ConversationMessage, type ToolSpec } from '../../llm/primitives.js';
|
|
4
|
+
import type { ContentPart } from '../../llm/content.js';
|
|
2
5
|
import type { DeepReadonly } from '../../util/json.js';
|
|
6
|
+
import type { SurfacePrepareInput } from '../../loop/index.js';
|
|
3
7
|
/**
|
|
4
8
|
* A character-based estimate of what a request costs in tokens, for a strategy that budgets the
|
|
5
9
|
* surface: four characters to a token, with a little framing per part and per message, as DeepSeek
|
|
@@ -27,3 +31,7 @@ export declare function estimateHead(head: {
|
|
|
27
31
|
readonly systemPrompt: readonly PromptBlock[];
|
|
28
32
|
readonly tools: readonly ToolSpec[];
|
|
29
33
|
}): number;
|
|
34
|
+
/** What the next request sends ahead of its messages: the recorded prompt and the tools the agent has now. */
|
|
35
|
+
export declare function estimateThreadHead(ctx: Context, threadId: string, agentName: string): number;
|
|
36
|
+
/** The input a step claims, which the request sends after the surface. */
|
|
37
|
+
export declare const estimateClaimed: (prepare: SurfacePrepareInput) => number;
|
|
@@ -1,2 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The compaction plugin, a `thread` preset with two placements, which keeps a thread's surface
|
|
3
|
+
* within its route's window by the strategy its configuration names. Mounted on the root for an
|
|
4
|
+
* agent selector, `mountPreset(root, compactionPreset, config, { agents })`, it serves every thread whose
|
|
5
|
+
* agent `agents` selects: each matching activation gets its own strategy, provided in the thread's
|
|
6
|
+
* scope, until the mount is disposed. Installed on one thread through the presets service, it
|
|
7
|
+
* serves that thread, recorded so a reopen and a fork keep it.
|
|
8
|
+
*
|
|
9
|
+
* Both strategies act on three triggers: **pressure**, before every model step whose request is
|
|
10
|
+
* estimated above `threshold` of the window (a route whose provider declares no window is never
|
|
11
|
+
* compacted for pressure, which is reported once per route); **overflow**, when the provider
|
|
12
|
+
* refuses a step's request as too long, after which the step is asked again if anything was
|
|
13
|
+
* replaced; and **request**, `thread.compact()`, whatever the pressure.
|
|
14
|
+
*
|
|
15
|
+
* - **`summarize`**, the default. It replaces one span, after the pinned opening and between direct
|
|
16
|
+
* developer inputs, with one `user` checkpoint: notes a summary call wrote from the surface
|
|
17
|
+
* through the span, the person's latest input copied from its row when the span held it, and a
|
|
18
|
+
* footer naming the messages replaced. It measures from the last usage the provider reported on
|
|
19
|
+
* the same provider and model plus an estimate of what came since, calibrates its estimates by
|
|
20
|
+
* an overflow, and recovers once per overflow sequence: a new turn or a completed reply allows
|
|
21
|
+
* another. Three unusable summaries in a row stop pressure compaction until its next
|
|
22
|
+
* checkpoint or a change of the thread's configuration; the count is recorded, so a reopen and a
|
|
23
|
+
* fork keep it. On request, `options` may say what the summary should `focus` on.
|
|
24
|
+
* - **`prune`**. It rewrites old tool results in place, keeping each one's role and call id, to a
|
|
25
|
+
* one-line stand-in, `[tool result pruned: <tool>, <n> characters and <k> attachments; message
|
|
26
|
+
* <number>]`, the attachments named only when it had some, followed by where to read it back when
|
|
27
|
+
* the agent has both `historyRecall` tools; no model is called. A result is pruned when it is an
|
|
28
|
+
* original, never a stand-in, outside the `keepRecent` most recent tool results, and estimated at
|
|
29
|
+
* `minTokens` or more, images and files included; every such result goes in one atomic group.
|
|
30
|
+
* Pressure is estimated by characters, uncalibrated. Nothing eligible is `skipped`, reported once
|
|
31
|
+
* per activation, trigger, route and latest replacement on pressure and overflow. It takes no
|
|
32
|
+
* request options and ignores any.
|
|
33
|
+
*
|
|
34
|
+
* Plugins whose notices a replacement took away tell them again at the next model step.
|
|
35
|
+
*
|
|
36
|
+
* Disposing a root mount stops new dispatches on the threads it serves, live ones included; a
|
|
37
|
+
* dispatch already in flight finishes, and may still record its replacement. A mount added later
|
|
38
|
+
* reaches activations from then on, not threads already live: they get it at their next activation.
|
|
39
|
+
*
|
|
40
|
+
* A thread runs one strategy, and a second on it, from another mount of this plugin or any other
|
|
41
|
+
* strategy that claims its thread, is refused when the thread activates, naming the one already
|
|
42
|
+
* there. To choose per agent, mount this on the root more than once with disjoint selectors and the
|
|
43
|
+
* strategy each should run; to choose per thread, mount none on the root and install it on each
|
|
44
|
+
* thread instead.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* await mountPreset(root, compactionPreset, {}, { agents: ['main'] }) // summarize, with every default
|
|
48
|
+
* await mountPreset(root, compactionPreset, { strategy: { kind: 'prune', keepRecent: 4 } }, { agents: ['worker'] })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const compactionPreset: import("../../services/presets/definition.js").Preset<import("zod").ZodObject<{
|
|
52
|
+
threshold: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
53
|
+
strategy: import("zod").ZodPrefault<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
54
|
+
kind: import("zod").ZodLiteral<"summarize">;
|
|
55
|
+
target: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
56
|
+
tail: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
57
|
+
opening: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
58
|
+
summaryCap: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
59
|
+
summaryFloor: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
60
|
+
reasoningAllowance: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
61
|
+
replyReserve: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
62
|
+
checkpointRatio: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
63
|
+
copiedInputChars: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
64
|
+
boundaryQuoteChars: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
65
|
+
breaker: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
66
|
+
withoutWindow: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
67
|
+
tailTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
68
|
+
openingTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
69
|
+
}, import("zod/v4/core").$strict>>;
|
|
70
|
+
summarizer: import("zod").ZodDefault<import("zod").ZodObject<{
|
|
71
|
+
provider: import("zod").ZodOptional<import("zod").ZodString>;
|
|
72
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
73
|
+
thinkingEffort: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
74
|
+
low: "low";
|
|
75
|
+
high: "high";
|
|
76
|
+
none: "none";
|
|
77
|
+
medium: "medium";
|
|
78
|
+
max: "max";
|
|
79
|
+
}>>;
|
|
80
|
+
}, import("zod/v4/core").$strict>>;
|
|
81
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
82
|
+
kind: import("zod").ZodLiteral<"prune">;
|
|
83
|
+
keepRecent: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
84
|
+
minTokens: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
85
|
+
}, import("zod/v4/core").$strict>], "kind">>;
|
|
86
|
+
}, import("zod/v4/core").$strict>>;
|
|
87
|
+
export type { CompactionConfig, SummarizeRequestOptions, PruneStrategyConfig, SummarizeStrategyConfig, } from './config.js';
|