@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
package/dist/sandbox/policy.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { SpawnEnvironment } from '../sys/spawn.js';
|
|
2
|
-
import type { CallConfig, PathEntry } from './protocol.js';
|
|
3
|
-
export declare function refuseStartupInjection(environment: SpawnEnvironment): void;
|
|
4
|
-
/** The most command text one launch carries, which travels in the environment of the process that starts it. */
|
|
5
|
-
export declare const MAX_COMMAND_BYTES: number;
|
|
6
|
-
/** `path` with every link in its existing part resolved, so containment is judged on real locations. */
|
|
7
|
-
export declare function canonical(path: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* The root a command's protected names are rebuilt for, canonical. sandbox-runtime substitutes the
|
|
10
|
-
* real prefix before it compiles a pattern, and cannot anchor one this module hands it, so a root
|
|
11
|
-
* whose real path holds glob characters or its compiler's placeholders would turn the patterns
|
|
12
|
-
* below into something else: it is refused, not escaped.
|
|
13
|
-
*/
|
|
14
|
-
export declare function canonicalRoot(root: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* sandbox-runtime's mandatory write denies, rebuilt for `root`: its own set anchors at the host's
|
|
17
|
-
* working directory and only ever adds denies there. Each name once as the path at the root and
|
|
18
|
-
* once as a pattern for the same name anywhere beneath it. `root` is canonical and holds no glob
|
|
19
|
-
* characters (`canonicalRoot`).
|
|
20
|
-
*/
|
|
21
|
-
export declare function mandatoryDenies(root: string): PathEntry[];
|
|
22
|
-
/**
|
|
23
|
-
* The programs a launch runs before confinement, as the search path finds them: the directories
|
|
24
|
-
* searched, since a program dropped into an earlier one would win, and the real file of every
|
|
25
|
-
* candidate for each program, wherever its link leads.
|
|
26
|
-
*/
|
|
27
|
-
export declare function helperLocations(searchPath: string): string[];
|
|
28
|
-
/**
|
|
29
|
-
* Refuses roots a command could use against the sandbox itself: one overlapping, either way, what
|
|
30
|
-
* a launch runs before confinement, or the temporary root, whose directories the host creates
|
|
31
|
-
* unconfined. `roots` are canonical.
|
|
32
|
-
*/
|
|
33
|
-
export declare function refuseUnsafeRoots(roots: readonly string[], trusted: readonly string[], tmpRoot: string): void;
|
|
34
|
-
/** What a command's filesystem policy is made of, besides its root and scratch directory. */
|
|
35
|
-
export type HostFacts = {
|
|
36
|
-
readonly allowWrite: readonly string[];
|
|
37
|
-
readonly denyWrite: readonly string[];
|
|
38
|
-
readonly denyRead: readonly string[];
|
|
39
|
-
readonly dataDir: string;
|
|
40
|
-
/** The paths under the home directory sandbox-runtime keeps writable for itself, as its worker reported them. */
|
|
41
|
-
readonly conveniences: readonly string[];
|
|
42
|
-
readonly privateDirectory: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* A command's complete filesystem lists, which replace the initialized ones for the call: writes
|
|
46
|
-
* only in the root, the host's roots and the scratch directory, and never in what the host or
|
|
47
|
-
* sandbox-runtime keeps for itself or in the root's protected names. Every path is literal.
|
|
48
|
-
*/
|
|
49
|
-
export declare function callPolicy(facts: HostFacts, root: string, scratchDirectory: string): CallConfig['filesystem'];
|
|
50
|
-
/**
|
|
51
|
-
* The script the sandbox runs: restores the command's `PATH`, sets its temporary directory and runs
|
|
52
|
-
* it with `/bin/sh -c`. Everything it needs arrives in variables, never spliced into the script.
|
|
53
|
-
*/
|
|
54
|
-
export declare const BOOTSTRAP: string;
|
|
55
|
-
/**
|
|
56
|
-
* The environment of the process that starts the sandbox: the command's own, but with the trusted
|
|
57
|
-
* `PATH` until the sandbox holds, since the wrapped line runs `env` and `sandbox-exec` before
|
|
58
|
-
* confinement. The bootstrap restores the rest.
|
|
59
|
-
*/
|
|
60
|
-
export declare function launchEnvironment(environment: SpawnEnvironment, searchPath: string, scratchDirectory: string, command: string): SpawnEnvironment;
|
|
61
|
-
/** What the name and version say in a command's recorded launch. */
|
|
62
|
-
export declare const LAUNCHER = "lagent-srt";
|
|
63
|
-
export declare const versionOf: (runtime: string) => string;
|
|
64
|
-
/** Everything enforcement depends on, digested: recorded with a launch as its policy. */
|
|
65
|
-
export declare function policyDigest(facts: {
|
|
66
|
-
readonly filesystem: CallConfig['filesystem'];
|
|
67
|
-
readonly network: unknown;
|
|
68
|
-
readonly searchPath: string;
|
|
69
|
-
readonly cwd: string;
|
|
70
|
-
readonly home: string;
|
|
71
|
-
readonly conveniences: readonly string[];
|
|
72
|
-
readonly javaAgent: string;
|
|
73
|
-
readonly version: string;
|
|
74
|
-
}): string;
|
|
75
|
-
/** What the model is told about sandboxed commands. */
|
|
76
|
-
export declare function instructionsFor(config: {
|
|
77
|
-
readonly filesystem: {
|
|
78
|
-
readonly allowWrite: readonly string[];
|
|
79
|
-
};
|
|
80
|
-
readonly network: {
|
|
81
|
-
readonly mode: 'allowlist';
|
|
82
|
-
readonly allowedDomains: readonly string[];
|
|
83
|
-
} | {
|
|
84
|
-
readonly mode: 'unrestricted';
|
|
85
|
-
};
|
|
86
|
-
}): string;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Service, type Context } from '@leuduan/cordis';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { type SpawnedCommand, type SpawnEnvironment } from '../sys/spawn.js';
|
|
4
|
-
/**
|
|
5
|
-
* How a model-driven process becomes a local launch: the one place `run_command`, and later other
|
|
6
|
-
* model-driven processes such as MCP stdio servers, start a process, so a host's confinement sees
|
|
7
|
-
* every one. Not `sys/spawn`: lagent's own spawns (`rg`, git, the shell probe, stop-check hooks) call
|
|
8
|
-
* `spawnCommand` directly and are never intercepted.
|
|
9
|
-
*/
|
|
10
|
-
/** Which launch a process got, recorded with it: never secrets, ids or ports. */
|
|
11
|
-
export declare const LaunchProvenanceSchema: z.ZodObject<{
|
|
12
|
-
launcher: z.ZodString;
|
|
13
|
-
version: z.ZodString;
|
|
14
|
-
policy: z.ZodString;
|
|
15
|
-
}, z.core.$strict>;
|
|
16
|
-
export type LaunchProvenance = z.output<typeof LaunchProvenanceSchema>;
|
|
17
|
-
/** The `policy` of a launch a handler chose to run unconfined: what a host or a listing marks as such. */
|
|
18
|
-
export declare const UNCONFINED_LAUNCH = "unconfined";
|
|
19
|
-
/**
|
|
20
|
-
* What to launch: the geometry to confine (`root`, `scratch`) and the thread the launch is for, the
|
|
21
|
-
* subject a handler's per-thread policy is decided on.
|
|
22
|
-
*/
|
|
23
|
-
export type LaunchRequest = {
|
|
24
|
-
/** The thread the launch serves: the policy subject, never a place to confine. */
|
|
25
|
-
readonly threadId: string;
|
|
26
|
-
/** What runs. */
|
|
27
|
-
readonly program: {
|
|
28
|
-
readonly shell: string;
|
|
29
|
-
};
|
|
30
|
-
/** Absolute: where it starts. */
|
|
31
|
-
readonly workdir: string;
|
|
32
|
-
/** The writable root the protected names are rebuilt for: the thread's working directory for commands. */
|
|
33
|
-
readonly root: string;
|
|
34
|
-
/** Keys the process's temporary directory: `thread:<id>` for commands. Equal keys share one directory. */
|
|
35
|
-
readonly scratch: string;
|
|
36
|
-
/** The process's environment: the caller's. */
|
|
37
|
-
readonly environment: SpawnEnvironment;
|
|
38
|
-
/** Aborting it stops the launch: preparation at once, and the process within its stop bound. */
|
|
39
|
-
readonly signal: AbortSignal;
|
|
40
|
-
};
|
|
41
|
-
export type LaunchOptions = {
|
|
42
|
-
readonly timeoutMs?: number;
|
|
43
|
-
readonly killGraceMs: number;
|
|
44
|
-
/** Awaited before the process is released, as `spawnCommand`'s, with the launch it got. */
|
|
45
|
-
readonly beforeRelease?: (pgid: number, launch: LaunchProvenance | null) => Promise<void>;
|
|
46
|
-
};
|
|
47
|
-
/** A local process to spawn in place of `/bin/sh -c <command>`. */
|
|
48
|
-
export type PreparedLaunch = {
|
|
49
|
-
readonly argv: readonly [string, ...string[]];
|
|
50
|
-
readonly cwd: string;
|
|
51
|
-
readonly env: SpawnEnvironment;
|
|
52
|
-
readonly provenance: LaunchProvenance;
|
|
53
|
-
/** After the process ended: bounded report lines, or `null`. Never rejects the process's outcome. */
|
|
54
|
-
violations(): Promise<string | null>;
|
|
55
|
-
};
|
|
56
|
-
/** What confines launches, such as the OS sandbox of `@leuduan/lagent/sandbox`. */
|
|
57
|
-
export type LaunchHandler = {
|
|
58
|
-
/** Rejects, with a message for the model, to refuse the launch. */
|
|
59
|
-
prepare(request: LaunchRequest): Promise<PreparedLaunch>;
|
|
60
|
-
};
|
|
61
|
-
export type LaunchHandle = {
|
|
62
|
-
/**
|
|
63
|
-
* Stops admitting through the handler, aborts every launch it prepared, and waits for each one's
|
|
64
|
-
* preparation, process and report within `timeoutMs`. Resolves `true` only when every group was
|
|
65
|
-
* confirmed stopped: no `stopFailed` result, ever, and nothing still running at the bound.
|
|
66
|
-
* Idempotent: every caller shares the first call's result.
|
|
67
|
-
*/
|
|
68
|
-
release(timeoutMs: number): Promise<boolean>;
|
|
69
|
-
};
|
|
70
|
-
/** A launched process: its group, what it was launched as, and the handler's report once it ends. */
|
|
71
|
-
export type Launched = {
|
|
72
|
-
readonly spawned: SpawnedCommand;
|
|
73
|
-
readonly launch: LaunchProvenance | null;
|
|
74
|
-
/** Settles after `spawned.result`, within {@link DIAGNOSTICS_MS}; `null` for nothing to report. Never rejects. */
|
|
75
|
-
readonly diagnostics: Promise<string | null>;
|
|
76
|
-
};
|
|
77
|
-
/** How long after a process ended its report may take. */
|
|
78
|
-
export declare const DIAGNOSTICS_MS = 1000;
|
|
79
|
-
/**
|
|
80
|
-
* The launch seam. With no handler, a launch is `/bin/sh -c <command>`. The first {@link handle}
|
|
81
|
-
* declares for the root's lifetime that launches go through a handler, which decides what each one
|
|
82
|
-
* gets (confinement, or refusal): from then on a launch with no live handler, because it was
|
|
83
|
-
* released, failed or never mounted again, is refused, and nothing falls back to a plain spawn. A
|
|
84
|
-
* host mounts the handler before anything launches.
|
|
85
|
-
*
|
|
86
|
-
* A handler is told nothing about consumers. It is released as a whole: core aborts what it
|
|
87
|
-
* prepared and reports whether every group stopped, so the handler may then free what confined them.
|
|
88
|
-
*/
|
|
89
|
-
export declare class LaunchesService extends Service {
|
|
90
|
-
private readonly root;
|
|
91
|
-
constructor(ctx: Context);
|
|
92
|
-
/**
|
|
93
|
-
* Registers the one handler. Throws while another is live. Afterwards, until the root ends, a
|
|
94
|
-
* launch with no live handler is refused.
|
|
95
|
-
*/
|
|
96
|
-
handle(handler: LaunchHandler): LaunchHandle;
|
|
97
|
-
/** One launch: through the handler when one was registered, else `/bin/sh -c`. */
|
|
98
|
-
launch(request: LaunchRequest, options: LaunchOptions): Promise<Launched>;
|
|
99
|
-
private spawnPlain;
|
|
100
|
-
private spawnThrough;
|
|
101
|
-
private release;
|
|
102
|
-
/** Whether every operation settled within `timeoutMs` and no stop ever failed. */
|
|
103
|
-
private settle;
|
|
104
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Service, type Context } from '@leuduan/cordis';
|
|
2
|
-
export type ThreadDirsConfig = {
|
|
3
|
-
/**
|
|
4
|
-
* Absolute application data directory; thread directories live under `<dataDir>/threads`. `null`
|
|
5
|
-
* turns thread directories off, for a host without a filesystem of its own. Required either way.
|
|
6
|
-
*/
|
|
7
|
-
dataDir: string | null;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Where each thread keeps files of its own: `<dataDir>/threads/<thread-id>/`, a scratch space its
|
|
11
|
-
* file tools may read and write as part of the application's shared data directory. Harness-written
|
|
12
|
-
* files go in named subdirectories such as `tool-outputs/`.
|
|
13
|
-
*
|
|
14
|
-
* The path is derived from the data directory and thread id, but absolute paths are also recorded
|
|
15
|
-
* in prompts and tool results. Keep the data directory at the same location when reopening a
|
|
16
|
-
* durable journal. Plugins can use the id supplied by their activation hook to find the directory.
|
|
17
|
-
*
|
|
18
|
-
* File tools may read and write the entire data directory, including other threads' scratch files.
|
|
19
|
-
*
|
|
20
|
-
* With `dataDir: null` there are no directories: `dataDir` and `root` are `null`, activation creates
|
|
21
|
-
* nothing, and `dirFor` and `ensure` throw. The service stays mounted either way, because the threads
|
|
22
|
-
* service injects it. A plugin that needs directories calls {@link ThreadDirsService.require} where it
|
|
23
|
-
* mounts, so a composition without them fails there.
|
|
24
|
-
*/
|
|
25
|
-
export declare class ThreadDirsService extends Service<ThreadDirsConfig> {
|
|
26
|
-
readonly dataDir: string | null;
|
|
27
|
-
readonly root: string | null;
|
|
28
|
-
constructor(ctx: Context, config: ThreadDirsConfig);
|
|
29
|
-
/**
|
|
30
|
-
* The data directory, for the plugin `user` that cannot work without thread directories. Call it
|
|
31
|
-
* first where the plugin mounts, so a root mounted with `dataDir: null` refuses there.
|
|
32
|
-
*/
|
|
33
|
-
require(user: string): string;
|
|
34
|
-
/** The directory of `threadId`, without touching the filesystem. */
|
|
35
|
-
dirFor(threadId: string): string;
|
|
36
|
-
/** The directory of `threadId`, created if missing. */
|
|
37
|
-
ensure(threadId: string): string;
|
|
38
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { Fiber } from '@leuduan/cordis';
|
|
2
|
-
import { type LLMClient } from '../llm/index.js';
|
|
3
|
-
import type { ToolResult } from '../models/index.js';
|
|
4
|
-
import { type SandboxConfigInput } from '../sandbox/index.js';
|
|
5
|
-
import type { Launched, LaunchOptions } from '../services/launches.js';
|
|
6
|
-
import type { SandboxService } from '../sandbox/service.js';
|
|
7
|
-
import { type TestRoot } from './helpers.js';
|
|
8
|
-
/**
|
|
9
|
-
* A root with the OS sandbox mounted over real sandbox-runtime, for the sandbox's tests. The sandbox
|
|
10
|
-
* starts once per process, so a test file starts one harness and every test in it shares the service.
|
|
11
|
-
*/
|
|
12
|
-
/** Whether this machine can run the sandbox: macOS with Seatbelt. */
|
|
13
|
-
export declare const sandboxSupported: boolean;
|
|
14
|
-
type RunOptions = {
|
|
15
|
-
signal?: AbortSignal;
|
|
16
|
-
workdir?: string;
|
|
17
|
-
root?: string;
|
|
18
|
-
/** Keys the launch's scratch directory. */
|
|
19
|
-
threadId?: string;
|
|
20
|
-
/** The thread the launch serves, which must exist: its conversation's mode decides it. */
|
|
21
|
-
subject?: string;
|
|
22
|
-
beforeRelease?: LaunchOptions['beforeRelease'];
|
|
23
|
-
};
|
|
24
|
-
type RunOutcome = {
|
|
25
|
-
launched: Launched;
|
|
26
|
-
output: string;
|
|
27
|
-
result: Awaited<Launched['spawned']['result']>;
|
|
28
|
-
report: string | null;
|
|
29
|
-
};
|
|
30
|
-
export type SandboxHarness = {
|
|
31
|
-
readonly root: TestRoot;
|
|
32
|
-
/** Canonical, like every path the sandbox judges. */
|
|
33
|
-
readonly base: string;
|
|
34
|
-
readonly workspace: string;
|
|
35
|
-
/** The extra writable root, when the harness was started with one. */
|
|
36
|
-
readonly extraRoot: string;
|
|
37
|
-
readonly data: string;
|
|
38
|
-
readonly tmpRoot: string;
|
|
39
|
-
readonly config: SandboxConfigInput;
|
|
40
|
-
readonly fiber: Fiber;
|
|
41
|
-
readonly service: SandboxService;
|
|
42
|
-
readonly environment: Record<string, string>;
|
|
43
|
-
/** Calls a `commands` tool as a thread's model would; needs the harness started with `commands`. */
|
|
44
|
-
tool(name: string, args: Record<string, unknown>, options?: {
|
|
45
|
-
threadId?: string;
|
|
46
|
-
callSeq?: number;
|
|
47
|
-
}): Promise<ToolResult>;
|
|
48
|
-
/**
|
|
49
|
-
* Launches `command` through `ctx.launches` as `commands` does:
|
|
50
|
-
* resolves once it runs, with output attached, and `done` settles when it has ended.
|
|
51
|
-
*/
|
|
52
|
-
launch(command: string, options?: RunOptions): Promise<{
|
|
53
|
-
launched: Launched;
|
|
54
|
-
done: Promise<RunOutcome>;
|
|
55
|
-
}>;
|
|
56
|
-
/** {@link launch}, then waits for the end. */
|
|
57
|
-
run(command: string, options?: RunOptions): Promise<RunOutcome>;
|
|
58
|
-
dispose(): Promise<void>;
|
|
59
|
-
};
|
|
60
|
-
export declare function startSandboxHarness(options?: {
|
|
61
|
-
config?: Partial<SandboxConfigInput>;
|
|
62
|
-
/** The model the root's threads run on; one with no script unless a test drives turns. */
|
|
63
|
-
llm?: LLMClient;
|
|
64
|
-
/** Mount `commands` over it, as a host does. */
|
|
65
|
-
commands?: boolean;
|
|
66
|
-
/** Lists `<workspace>/cache` as an extra writable root, created. */
|
|
67
|
-
extraRoot?: boolean;
|
|
68
|
-
/** The worker entry; the sources' `worker.ts` unless a test needs another. */
|
|
69
|
-
worker?: URL;
|
|
70
|
-
}): Promise<SandboxHarness>;
|
|
71
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|