@leuduan/lagent 0.0.0-stage → 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/LICENSE +16 -0
- package/README.md +157 -2
- package/dist/chunks/2GCIWSOA.js +5 -0
- package/dist/chunks/2P47AHNK.js +7 -0
- package/dist/chunks/34KW6VNQ.js +1 -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/7VAPNE3L.js +1 -0
- package/dist/chunks/ASSQZH3F.js +1 -0
- package/dist/chunks/B4FXK5ER.js +77 -0
- package/dist/chunks/BBCW2FZK.js +1 -0
- 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/DDANMY45.js +3 -0
- package/dist/chunks/DDZ7YF26.js +1 -0
- package/dist/chunks/EMRB4KCN.js +6 -0
- package/dist/chunks/EPYQ5M3B.js +3 -0
- package/dist/chunks/FJLU4UH3.js +1 -0
- package/dist/chunks/G44LG6VL.js +1 -0
- package/dist/chunks/GGSVIIWJ.js +2 -0
- package/dist/chunks/HK6ZSONF.js +1 -0
- package/dist/chunks/IAAEP6VL.js +30 -0
- package/dist/chunks/JCTBX33H.js +36 -0
- 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/MNJ4SRF7.js +1 -0
- package/dist/chunks/N6IXG2VL.js +1 -0
- package/dist/chunks/OCBPT7KE.js +1 -0
- package/dist/chunks/OL5A6ITQ.js +1 -0
- package/dist/chunks/PUSUPTAT.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/compositions/codex.d.ts +66 -0
- package/dist/compositions/codexPrompts.d.ts +56 -0
- package/dist/context.d.ts +109 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +1 -0
- package/dist/journal/catalog.d.ts +112 -0
- package/dist/journal/forkChain.d.ts +16 -0
- package/dist/journal/index.d.ts +15 -0
- package/dist/journal/journal.d.ts +475 -0
- package/dist/journal/projection.d.ts +87 -0
- package/dist/journal/store.d.ts +181 -0
- package/dist/llm/client.d.ts +135 -0
- package/dist/llm/content.d.ts +52 -0
- package/dist/llm/failure.d.ts +82 -0
- package/dist/llm/index.d.ts +22 -0
- package/dist/llm/index.js +1 -0
- package/dist/llm/primitives.d.ts +286 -0
- package/dist/llm/prompt.d.ts +21 -0
- package/dist/llm/provider.d.ts +74 -0
- package/dist/llm/readLedger.d.ts +24 -0
- package/dist/llm/request.d.ts +58 -0
- package/dist/loop/agent.d.ts +18 -0
- package/dist/loop/authorization.d.ts +41 -0
- package/dist/loop/auxiliary.d.ts +58 -0
- package/dist/loop/chunks.d.ts +27 -0
- package/dist/loop/completion.d.ts +17 -0
- package/dist/loop/errors.d.ts +139 -0
- package/dist/loop/hooks.d.ts +274 -0
- package/dist/loop/index.d.ts +16 -0
- package/dist/loop/runner.d.ts +134 -0
- package/dist/loop/runtime.d.ts +76 -0
- package/dist/loop/strategy.d.ts +80 -0
- package/dist/loop/surfacePrepare.d.ts +30 -0
- package/dist/loop/tool.d.ts +106 -0
- package/dist/loop/toolCalls.d.ts +35 -0
- package/dist/plugin.d.ts +50 -0
- package/dist/plugin.js +1 -0
- package/dist/plugins/agentsMd.d.ts +80 -0
- package/dist/plugins/agentsMd.js +1 -0
- package/dist/plugins/ask/index.d.ts +26 -0
- package/dist/plugins/ask/index.js +1 -0
- package/dist/plugins/ask/service.d.ts +125 -0
- package/dist/plugins/ask/tools.d.ts +9 -0
- package/dist/plugins/commands/index.d.ts +43 -0
- package/dist/plugins/commands/index.js +1 -0
- package/dist/plugins/commands/output.d.ts +115 -0
- package/dist/plugins/commands/record.d.ts +558 -0
- package/dist/plugins/commands/service.d.ts +321 -0
- package/dist/plugins/commands/shell.d.ts +25 -0
- package/dist/plugins/commands/tools.d.ts +10 -0
- package/dist/plugins/compaction/checkpoint.d.ts +94 -0
- package/dist/plugins/compaction/config.d.ts +133 -0
- package/dist/plugins/compaction/estimate.d.ts +37 -0
- package/dist/plugins/compaction/index.d.ts +87 -0
- package/dist/plugins/compaction/index.js +7 -0
- package/dist/plugins/compaction/planner.d.ts +207 -0
- package/dist/plugins/compaction/prune.d.ts +9 -0
- package/dist/plugins/compaction/record.d.ts +227 -0
- package/dist/plugins/compaction/segments.d.ts +23 -0
- package/dist/plugins/compaction/state.d.ts +68 -0
- package/dist/plugins/compaction/summarize.d.ts +13 -0
- package/dist/plugins/dateAndBranch.d.ts +47 -0
- package/dist/plugins/dateAndBranch.js +1 -0
- package/dist/plugins/delegations/answers.d.ts +39 -0
- package/dist/plugins/delegations/assignmentKey.d.ts +22 -0
- package/dist/plugins/delegations/cleanup.d.ts +161 -0
- package/dist/plugins/delegations/constraint.d.ts +76 -0
- package/dist/plugins/delegations/index.d.ts +39 -0
- package/dist/plugins/delegations/index.js +1 -0
- package/dist/plugins/delegations/notices.d.ts +261 -0
- package/dist/plugins/delegations/obligations.d.ts +210 -0
- package/dist/plugins/delegations/record.d.ts +633 -0
- package/dist/plugins/delegations/request.d.ts +384 -0
- package/dist/plugins/delegations/role.d.ts +30 -0
- package/dist/plugins/delegations/service.d.ts +563 -0
- package/dist/plugins/delegations/standing.d.ts +19 -0
- package/dist/plugins/delegations/stopCheck.d.ts +21 -0
- package/dist/plugins/delegations/tools.d.ts +71 -0
- package/dist/plugins/delegations/waitContracts.d.ts +118 -0
- package/dist/plugins/delegations/waitResolver.d.ts +116 -0
- package/dist/plugins/diagnostics/digest.d.ts +14 -0
- package/dist/plugins/diagnostics/index.d.ts +68 -0
- package/dist/plugins/diagnostics/index.js +1 -0
- package/dist/plugins/fileTools/config.d.ts +10 -0
- package/dist/plugins/fileTools/editFiles.d.ts +117 -0
- package/dist/plugins/fileTools/fsRead.d.ts +17 -0
- 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/ripgrep.d.ts +20 -0
- package/dist/plugins/fileTools/textEdit.d.ts +67 -0
- package/dist/plugins/fileTools/tools.d.ts +6 -0
- package/dist/plugins/historyRecall/history.d.ts +9 -0
- package/dist/plugins/historyRecall/index.d.ts +31 -0
- package/dist/plugins/historyRecall/index.js +1 -0
- package/dist/plugins/historyRecall/render.d.ts +34 -0
- package/dist/plugins/historyRecall/tools.d.ts +4 -0
- package/dist/plugins/mcp/catalog.d.ts +36 -0
- package/dist/plugins/mcp/config.d.ts +63 -0
- package/dist/plugins/mcp/connection.d.ts +53 -0
- package/dist/plugins/mcp/errors.d.ts +32 -0
- package/dist/plugins/mcp/index.d.ts +33 -0
- package/dist/plugins/mcp/index.js +5 -0
- package/dist/plugins/mcp/mount.d.ts +98 -0
- package/dist/plugins/mcp/names.d.ts +25 -0
- package/dist/plugins/mcp/render.d.ts +29 -0
- package/dist/plugins/mcp/slots.d.ts +15 -0
- package/dist/plugins/mcp/stdio.d.ts +49 -0
- package/dist/plugins/mcp/tools.d.ts +41 -0
- package/dist/plugins/mcp/version.d.ts +2 -0
- package/dist/plugins/routeNotice.d.ts +22 -0
- package/dist/plugins/routeNotice.js +1 -0
- package/dist/plugins/sandbox/absent.d.ts +33 -0
- package/dist/plugins/sandbox/client.d.ts +39 -0
- package/dist/plugins/sandbox/files.d.ts +28 -0
- package/dist/plugins/sandbox/index.d.ts +52 -0
- package/dist/plugins/sandbox/index.js +4 -0
- package/dist/plugins/sandbox/mode.d.ts +57 -0
- package/dist/plugins/sandbox/policy.d.ts +163 -0
- package/dist/plugins/sandbox/protocol.d.ts +107 -0
- package/dist/plugins/sandbox/service.d.ts +153 -0
- package/dist/plugins/sandbox/worker.d.ts +12 -0
- package/dist/plugins/sandbox/worker.js +1 -0
- package/dist/plugins/schedules/index.d.ts +21 -0
- package/dist/plugins/schedules/index.js +5 -0
- package/dist/plugins/schedules/record.d.ts +396 -0
- package/dist/plugins/schedules/service.d.ts +120 -0
- package/dist/plugins/schedules/time.d.ts +26 -0
- package/dist/plugins/schedules/tools.d.ts +6 -0
- package/dist/plugins/skills/discovery.d.ts +83 -0
- package/dist/plugins/skills/index.d.ts +31 -0
- package/dist/plugins/skills/index.js +1 -0
- package/dist/plugins/skills/tools.d.ts +11 -0
- package/dist/plugins/subAgents/availableRoutes.d.ts +53 -0
- package/dist/plugins/subAgents/index.d.ts +67 -0
- package/dist/plugins/subAgents/index.js +1 -0
- package/dist/plugins/subAgents/tools.d.ts +67 -0
- package/dist/plugins/threadDirs.d.ts +36 -0
- package/dist/plugins/threadDirs.js +1 -0
- package/dist/plugins/toolPolicy/index.d.ts +61 -0
- package/dist/plugins/toolPolicy/index.js +1 -0
- package/dist/plugins/truncateToolOutput.d.ts +30 -0
- package/dist/plugins/truncateToolOutput.js +6 -0
- package/dist/plugins/usage/index.d.ts +26 -0
- package/dist/plugins/usage/index.js +1 -0
- package/dist/plugins/usage/tracker.d.ts +34 -0
- package/dist/plugins/verify/index.d.ts +27 -0
- package/dist/plugins/verify/index.js +6 -0
- 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 +93 -0
- package/dist/plugins/verify/state.d.ts +58 -0
- package/dist/plugins/webTools/html.d.ts +23 -0
- package/dist/plugins/webTools/index.d.ts +34 -0
- package/dist/plugins/webTools/index.js +1 -0
- package/dist/plugins/webTools/network.d.ts +23 -0
- package/dist/plugins/webTools/web.d.ts +32 -0
- package/dist/plugins/workflows/assignment.d.ts +20 -0
- package/dist/plugins/workflows/cleanup.d.ts +38 -0
- package/dist/plugins/workflows/definition.d.ts +184 -0
- package/dist/plugins/workflows/entryPlan.d.ts +95 -0
- package/dist/plugins/workflows/hostBindings.d.ts +146 -0
- package/dist/plugins/workflows/index.d.ts +28 -0
- package/dist/plugins/workflows/index.js +11 -0
- package/dist/plugins/workflows/observations.d.ts +81 -0
- package/dist/plugins/workflows/participantModels.d.ts +28 -0
- package/dist/plugins/workflows/participants.d.ts +143 -0
- package/dist/plugins/workflows/policy.d.ts +112 -0
- package/dist/plugins/workflows/record.d.ts +2849 -0
- package/dist/plugins/workflows/routing.d.ts +116 -0
- package/dist/plugins/workflows/schema.d.ts +26 -0
- package/dist/plugins/workflows/service.d.ts +477 -0
- package/dist/plugins/workflows/state.d.ts +373 -0
- 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 +103 -0
- package/dist/plugins/workflows/workStatus.d.ts +21 -0
- package/dist/plugins/workspaceNotice.d.ts +36 -0
- package/dist/plugins/workspaceNotice.js +1 -0
- package/dist/providers/anthropic.d.ts +178 -0
- package/dist/providers/anthropicMessages.d.ts +66 -0
- package/dist/providers/codex.d.ts +71 -0
- package/dist/providers/codexAuth.d.ts +116 -0
- package/dist/providers/deepseek.d.ts +59 -0
- package/dist/providers/failure.d.ts +23 -0
- package/dist/providers/gateway.d.ts +24 -0
- package/dist/providers/index.d.ts +18 -0
- package/dist/providers/index.js +6 -0
- package/dist/providers/openaiChat.d.ts +73 -0
- package/dist/providers/openaiResponses.d.ts +109 -0
- package/dist/providers/opencodeCopilot.d.ts +23 -0
- package/dist/providers/opencodeGo.d.ts +109 -0
- package/dist/providers/shared.d.ts +112 -0
- package/dist/providers/stream.d.ts +156 -0
- package/dist/records/index.d.ts +13 -0
- package/dist/records/index.js +1 -0
- package/dist/records/journal.d.ts +2968 -0
- package/dist/records/toolResult.d.ts +65 -0
- package/dist/services/agents.d.ts +62 -0
- package/dist/services/catalogContributions.d.ts +73 -0
- package/dist/services/confinement/files.d.ts +118 -0
- package/dist/services/confinement/service.d.ts +219 -0
- package/dist/services/core.d.ts +28 -0
- package/dist/services/extensionEvents.d.ts +181 -0
- package/dist/services/journal.d.ts +26 -0
- package/dist/services/llm.d.ts +82 -0
- package/dist/services/modes.d.ts +65 -0
- package/dist/services/plugins.d.ts +34 -0
- package/dist/services/presets/definition.d.ts +154 -0
- package/dist/services/presets/installations.d.ts +139 -0
- package/dist/services/prompts.d.ts +85 -0
- package/dist/services/threads/activation.d.ts +100 -0
- package/dist/services/threads/admission.d.ts +174 -0
- package/dist/services/threads/birth.d.ts +219 -0
- package/dist/services/threads/index.d.ts +14 -0
- package/dist/services/threads/runEvents.d.ts +79 -0
- package/dist/services/threads/runOwner.d.ts +368 -0
- package/dist/services/threads/service.d.ts +450 -0
- package/dist/services/threads/thread.d.ts +268 -0
- package/dist/services/threads/view.d.ts +93 -0
- package/dist/services/tools.d.ts +118 -0
- package/dist/state/birth.d.ts +62 -0
- package/dist/state/chain.d.ts +46 -0
- package/dist/state/confirmations.d.ts +64 -0
- package/dist/state/continuation.d.ts +167 -0
- package/dist/state/decide.d.ts +72 -0
- package/dist/state/dispatches.d.ts +54 -0
- package/dist/state/errors.d.ts +26 -0
- package/dist/state/forks.d.ts +61 -0
- package/dist/state/holds.d.ts +104 -0
- package/dist/state/inbox.d.ts +188 -0
- 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/limits.d.ts +14 -0
- package/dist/state/prompt.d.ts +13 -0
- package/dist/state/recovery.d.ts +7 -0
- package/dist/state/replace.d.ts +33 -0
- package/dist/state/requests.d.ts +129 -0
- package/dist/state/route.d.ts +61 -0
- package/dist/state/summary.d.ts +16 -0
- package/dist/state/surface.d.ts +153 -0
- package/dist/state/surfaceRead.d.ts +20 -0
- package/dist/state/thread.d.ts +73 -0
- package/dist/state/turns.d.ts +87 -0
- package/dist/state/waits.d.ts +38 -0
- package/dist/state/wake.d.ts +32 -0
- package/dist/stores/durableObject.d.ts +23 -0
- package/dist/stores/durableObject.js +1 -0
- package/dist/stores/durableObjectConnection.d.ts +27 -0
- package/dist/stores/memory.d.ts +29 -0
- package/dist/stores/sql.d.ts +59 -0
- package/dist/stores/sqlite.d.ts +31 -0
- package/dist/stores/sqlite.js +1 -0
- package/dist/sys/environment.d.ts +42 -0
- package/dist/sys/git.d.ts +47 -0
- package/dist/sys/paths.d.ts +9 -0
- package/dist/sys/spawn.d.ts +186 -0
- package/dist/testing/clock.d.ts +17 -0
- package/dist/testing/fakeLlm.d.ts +76 -0
- package/dist/testing/fedLlm.d.ts +34 -0
- package/dist/testing/helpers.d.ts +362 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/processes.d.ts +13 -0
- package/dist/testing/settlement.d.ts +6 -0
- package/dist/testing/tmpDirs.d.ts +17 -0
- package/dist/util/async.d.ts +8 -0
- package/dist/util/diff.d.ts +25 -0
- package/dist/util/dispatch.d.ts +8 -0
- package/dist/util/errors.d.ts +28 -0
- package/dist/util/foldState.d.ts +17 -0
- package/dist/util/freeze.d.ts +2 -0
- package/dist/util/ids.d.ts +2 -0
- package/dist/util/json.d.ts +37 -0
- package/dist/util/jsonSchema.d.ts +7 -0
- package/dist/util/log.d.ts +6 -0
- package/dist/util/retries.d.ts +25 -0
- package/dist/util/text.d.ts +21 -0
- package/dist/util/timers.d.ts +43 -0
- package/package.json +183 -3
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { SpawnResult } from '../../sys/spawn.js';
|
|
3
|
+
/**
|
|
4
|
+
* A command's log, capped at `maxBytes` in two segments: `<id>.log`, the current one, and after a
|
|
5
|
+
* rotation `<id>.1.log`, the one before it. When the current segment reaches half the cap it
|
|
6
|
+
* replaces the older one, so the latest output is always kept.
|
|
7
|
+
*
|
|
8
|
+
* Written through one stream at a time and never awaited by a call: `write` returning `false` asks
|
|
9
|
+
* the caller to pause its source until `whenWritable()`, which also waits for every rotated
|
|
10
|
+
* segment to finish flushing. A failed write is reported once, and later output is dropped rather
|
|
11
|
+
* than held.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CommandLog {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly olderPath: string;
|
|
16
|
+
/** Logical bytes accepted since the command started. */
|
|
17
|
+
written: number;
|
|
18
|
+
/** Logical bytes no longer on disk. */
|
|
19
|
+
rotatedOut: number;
|
|
20
|
+
private stream;
|
|
21
|
+
/** Rotated streams that have not closed yet. */
|
|
22
|
+
private readonly flushing;
|
|
23
|
+
private segmentBytes;
|
|
24
|
+
private olderBytes;
|
|
25
|
+
private opened;
|
|
26
|
+
private failed;
|
|
27
|
+
private readonly maxBytes;
|
|
28
|
+
private readonly onError;
|
|
29
|
+
constructor(path: string, maxBytes: number, onError: (error: unknown) => void);
|
|
30
|
+
get rotated(): boolean;
|
|
31
|
+
/** Where the output is, and what rotation or a failed write removed from it. */
|
|
32
|
+
describe(): string;
|
|
33
|
+
/** `false` when the source should pause until {@link whenWritable}. */
|
|
34
|
+
write(chunk: Buffer): boolean;
|
|
35
|
+
whenWritable(): Promise<void>;
|
|
36
|
+
end(): void;
|
|
37
|
+
private needsDrain;
|
|
38
|
+
/**
|
|
39
|
+
* The file is opened synchronously and the stream writes to its descriptor, so a rename during a
|
|
40
|
+
* rotation never races an open, and writes still pending land in the segment they belong to.
|
|
41
|
+
* A re-dispatched command appends to its log after a separator line.
|
|
42
|
+
*/
|
|
43
|
+
private open;
|
|
44
|
+
private rotate;
|
|
45
|
+
private fail;
|
|
46
|
+
}
|
|
47
|
+
export type CommandOutputOptions = {
|
|
48
|
+
/** Characters held for a result's head and for its tail; also the most one result shows. */
|
|
49
|
+
capacityChars: number;
|
|
50
|
+
openLog: () => CommandLog;
|
|
51
|
+
/** A background command logs from the start; a foreground one only once its output overflows. */
|
|
52
|
+
logFromStart: boolean;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* One command's output: one pipe, in exact order, through one decoder, so a character split across
|
|
56
|
+
* chunks survives. Memory is bounded by a head and a tail of `capacityChars` each, plus one write
|
|
57
|
+
* buffer of the log; the log has the rest.
|
|
58
|
+
*
|
|
59
|
+
* Reads are relative to a mark. A foreground command's mark stays at the start; a background
|
|
60
|
+
* command's moves to the end of each read, so the next read shows only newer output.
|
|
61
|
+
*/
|
|
62
|
+
export declare class CommandOutput {
|
|
63
|
+
private readonly decoder;
|
|
64
|
+
private log;
|
|
65
|
+
/** Raw output held until the log opens, so the log starts from the first byte. */
|
|
66
|
+
private pending;
|
|
67
|
+
private totalChars;
|
|
68
|
+
private markChars;
|
|
69
|
+
/** The first `capacityChars` since the mark, and whether that is everything since it. */
|
|
70
|
+
private sinceMark;
|
|
71
|
+
private sinceMarkComplete;
|
|
72
|
+
/** At least the last `capacityChars`, at most twice that. */
|
|
73
|
+
private recent;
|
|
74
|
+
private readonly listeners;
|
|
75
|
+
private finished;
|
|
76
|
+
private readonly options;
|
|
77
|
+
constructor(options: CommandOutputOptions);
|
|
78
|
+
/** The log's path once it exists. */
|
|
79
|
+
get logPath(): string | undefined;
|
|
80
|
+
get logDescription(): string | undefined;
|
|
81
|
+
get isFinished(): boolean;
|
|
82
|
+
get hasUnread(): boolean;
|
|
83
|
+
/** Reads `source` to its end, pausing it while the log's buffer is full. */
|
|
84
|
+
attach(source: Readable): void;
|
|
85
|
+
/** Adds text the command did not print, such as a confinement handler's report; before {@link finish}. */
|
|
86
|
+
note(text: string): void;
|
|
87
|
+
/** Flushes the decoder and ends the log. Call once the command has settled. */
|
|
88
|
+
finish(): void;
|
|
89
|
+
/** Called on new output and on `finish`, after which `finished` holds; returns the unsubscribe function. */
|
|
90
|
+
onChange(listener: () => void): () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Renders the output since the mark and then `trailer`, within `budget` characters. The trailer
|
|
93
|
+
* is laid out first and its length reserved, so no cut can remove it. What does not fit is cut
|
|
94
|
+
* from the middle, one part head to four parts tail, around the marker `omission` renders.
|
|
95
|
+
* `advance` moves the mark to the end, so what was skipped is not shown again.
|
|
96
|
+
*/
|
|
97
|
+
render(options: {
|
|
98
|
+
budget: number;
|
|
99
|
+
trailer: readonly string[];
|
|
100
|
+
empty: string;
|
|
101
|
+
omission: (omittedChars: number, log: CommandLog) => string;
|
|
102
|
+
advance: boolean;
|
|
103
|
+
}): string;
|
|
104
|
+
private push;
|
|
105
|
+
private append;
|
|
106
|
+
private ensureLog;
|
|
107
|
+
private notify;
|
|
108
|
+
}
|
|
109
|
+
export declare const capitalize: (text: string) => string;
|
|
110
|
+
/** A duration as a person reads it: `850ms`, `12.4s`, `3m 12s`, `2h 5m`. */
|
|
111
|
+
export declare function formatDuration(ms: number): string;
|
|
112
|
+
/** How the command's leader ended: its exit code, its signal, or that it never exited. */
|
|
113
|
+
export declare function describeExit(result: SpawnResult): string;
|
|
114
|
+
/** The marker for a stop that could not be confirmed. */
|
|
115
|
+
export declare const stopFailedMarker: (graceSeconds: number) => string;
|
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ExtensionRecord, type Seq } from '../../records/journal.js';
|
|
3
|
+
import type { DeepReadonly } from '../../util/json.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the journal keeps of a background command, so that a lagent process that did not start it
|
|
6
|
+
* can still say what it knows: that it was started, by whom and where, and whether and how it
|
|
7
|
+
* ended. Written by the commands plugin as `ext` rows of its own identity.
|
|
8
|
+
*
|
|
9
|
+
* The start row is written while the spawned group is still held at its startup gate, before the
|
|
10
|
+
* command runs, so no command ever runs unlisted; it says the command *may have started*, since the
|
|
11
|
+
* process can die after the row and before the gate opens. The end row is written when the plugin
|
|
12
|
+
* sees the command settle, and carries whether the stop succeeded: a settled wait does not prove
|
|
13
|
+
* the group is gone. A notifying command's natural exit writes its end row in the group of the
|
|
14
|
+
* notice that tells the thread (`commandNotice`).
|
|
15
|
+
*/
|
|
16
|
+
declare const CommandRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
op: z.ZodLiteral<"started">;
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
call_seq: z.ZodNumber;
|
|
20
|
+
command: z.ZodString;
|
|
21
|
+
cwd: z.ZodString;
|
|
22
|
+
pgid: z.ZodNumber;
|
|
23
|
+
started_at: z.ZodString;
|
|
24
|
+
owner: z.ZodString;
|
|
25
|
+
notify: z.ZodNullable<z.ZodEnum<{
|
|
26
|
+
exit: "exit";
|
|
27
|
+
}>>;
|
|
28
|
+
launch: z.ZodNullable<z.ZodObject<{
|
|
29
|
+
launcher: z.ZodString;
|
|
30
|
+
version: z.ZodString;
|
|
31
|
+
policy: z.ZodString;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
+
op: z.ZodLiteral<"ended">;
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
37
|
+
exit_signal: z.ZodNullable<z.ZodString>;
|
|
38
|
+
stopped_by: z.ZodNullable<z.ZodEnum<{
|
|
39
|
+
abort: "abort";
|
|
40
|
+
timeout: "timeout";
|
|
41
|
+
stop: "stop";
|
|
42
|
+
}>>;
|
|
43
|
+
stop_failed: z.ZodBoolean;
|
|
44
|
+
stop_reason: z.ZodNullable<z.ZodString>;
|
|
45
|
+
ended_at: z.ZodString;
|
|
46
|
+
}, z.core.$strict>], "op">;
|
|
47
|
+
export type CommandRow = z.output<typeof CommandRowSchema>;
|
|
48
|
+
export type CommandStarted = Extract<CommandRow, {
|
|
49
|
+
op: 'started';
|
|
50
|
+
}>;
|
|
51
|
+
export type CommandEnded = Extract<CommandRow, {
|
|
52
|
+
op: 'ended';
|
|
53
|
+
}>;
|
|
54
|
+
export declare const commandRow: {
|
|
55
|
+
record: (value: {
|
|
56
|
+
op: "started";
|
|
57
|
+
id: string;
|
|
58
|
+
call_seq: number;
|
|
59
|
+
command: string;
|
|
60
|
+
cwd: string;
|
|
61
|
+
pgid: number;
|
|
62
|
+
started_at: string;
|
|
63
|
+
owner: string;
|
|
64
|
+
notify: "exit" | null;
|
|
65
|
+
launch: {
|
|
66
|
+
launcher: string;
|
|
67
|
+
version: string;
|
|
68
|
+
policy: string;
|
|
69
|
+
} | null;
|
|
70
|
+
} | {
|
|
71
|
+
op: "ended";
|
|
72
|
+
id: string;
|
|
73
|
+
exit_code: number | null;
|
|
74
|
+
exit_signal: string | null;
|
|
75
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
76
|
+
stop_failed: boolean;
|
|
77
|
+
stop_reason: string | null;
|
|
78
|
+
ended_at: string;
|
|
79
|
+
}) => ExtensionRecord;
|
|
80
|
+
parse: (value: {
|
|
81
|
+
op: "started";
|
|
82
|
+
id: string;
|
|
83
|
+
call_seq: number;
|
|
84
|
+
command: string;
|
|
85
|
+
cwd: string;
|
|
86
|
+
pgid: number;
|
|
87
|
+
started_at: string;
|
|
88
|
+
owner: string;
|
|
89
|
+
notify: "exit" | null;
|
|
90
|
+
launch: {
|
|
91
|
+
launcher: string;
|
|
92
|
+
version: string;
|
|
93
|
+
policy: string;
|
|
94
|
+
} | null;
|
|
95
|
+
} | {
|
|
96
|
+
op: "ended";
|
|
97
|
+
id: string;
|
|
98
|
+
exit_code: number | null;
|
|
99
|
+
exit_signal: string | null;
|
|
100
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
101
|
+
stop_failed: boolean;
|
|
102
|
+
stop_reason: string | null;
|
|
103
|
+
ended_at: string;
|
|
104
|
+
}) => {
|
|
105
|
+
op: "started";
|
|
106
|
+
id: string;
|
|
107
|
+
call_seq: number;
|
|
108
|
+
command: string;
|
|
109
|
+
cwd: string;
|
|
110
|
+
pgid: number;
|
|
111
|
+
started_at: string;
|
|
112
|
+
owner: string;
|
|
113
|
+
notify: "exit" | null;
|
|
114
|
+
launch: {
|
|
115
|
+
launcher: string;
|
|
116
|
+
version: string;
|
|
117
|
+
policy: string;
|
|
118
|
+
} | null;
|
|
119
|
+
} | {
|
|
120
|
+
op: "ended";
|
|
121
|
+
id: string;
|
|
122
|
+
exit_code: number | null;
|
|
123
|
+
exit_signal: string | null;
|
|
124
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
125
|
+
stop_failed: boolean;
|
|
126
|
+
stop_reason: string | null;
|
|
127
|
+
ended_at: string;
|
|
128
|
+
};
|
|
129
|
+
entry: (value: {
|
|
130
|
+
op: "started";
|
|
131
|
+
id: string;
|
|
132
|
+
call_seq: number;
|
|
133
|
+
command: string;
|
|
134
|
+
cwd: string;
|
|
135
|
+
pgid: number;
|
|
136
|
+
started_at: string;
|
|
137
|
+
owner: string;
|
|
138
|
+
notify: "exit" | null;
|
|
139
|
+
launch: {
|
|
140
|
+
launcher: string;
|
|
141
|
+
version: string;
|
|
142
|
+
policy: string;
|
|
143
|
+
} | null;
|
|
144
|
+
} | {
|
|
145
|
+
op: "ended";
|
|
146
|
+
id: string;
|
|
147
|
+
exit_code: number | null;
|
|
148
|
+
exit_signal: string | null;
|
|
149
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
150
|
+
stop_failed: boolean;
|
|
151
|
+
stop_reason: string | null;
|
|
152
|
+
ended_at: string;
|
|
153
|
+
}, options: import("../../journal/journal.js").AppendOptions) => {
|
|
154
|
+
type: "ext";
|
|
155
|
+
data: {
|
|
156
|
+
plugin: string;
|
|
157
|
+
instance_id: string;
|
|
158
|
+
kind: string;
|
|
159
|
+
version: number;
|
|
160
|
+
data: z.core.util.JSONType;
|
|
161
|
+
};
|
|
162
|
+
options: import("../../journal/journal.js").AppendOptions;
|
|
163
|
+
};
|
|
164
|
+
append(journal: import("../../journal/journal.js").PluginJournal, value: {
|
|
165
|
+
op: "started";
|
|
166
|
+
id: string;
|
|
167
|
+
call_seq: number;
|
|
168
|
+
command: string;
|
|
169
|
+
cwd: string;
|
|
170
|
+
pgid: number;
|
|
171
|
+
started_at: string;
|
|
172
|
+
owner: string;
|
|
173
|
+
notify: "exit" | null;
|
|
174
|
+
launch: {
|
|
175
|
+
launcher: string;
|
|
176
|
+
version: string;
|
|
177
|
+
policy: string;
|
|
178
|
+
} | null;
|
|
179
|
+
} | {
|
|
180
|
+
op: "ended";
|
|
181
|
+
id: string;
|
|
182
|
+
exit_code: number | null;
|
|
183
|
+
exit_signal: string | null;
|
|
184
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
185
|
+
stop_failed: boolean;
|
|
186
|
+
stop_reason: string | null;
|
|
187
|
+
ended_at: string;
|
|
188
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
189
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
190
|
+
op: "started";
|
|
191
|
+
id: string;
|
|
192
|
+
call_seq: number;
|
|
193
|
+
command: string;
|
|
194
|
+
cwd: string;
|
|
195
|
+
pgid: number;
|
|
196
|
+
started_at: string;
|
|
197
|
+
owner: string;
|
|
198
|
+
notify: "exit" | null;
|
|
199
|
+
launch: {
|
|
200
|
+
launcher: string;
|
|
201
|
+
version: string;
|
|
202
|
+
policy: string;
|
|
203
|
+
} | null;
|
|
204
|
+
} | {
|
|
205
|
+
op: "ended";
|
|
206
|
+
id: string;
|
|
207
|
+
exit_code: number | null;
|
|
208
|
+
exit_signal: string | null;
|
|
209
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
210
|
+
stop_failed: boolean;
|
|
211
|
+
stop_reason: string | null;
|
|
212
|
+
ended_at: string;
|
|
213
|
+
} | undefined;
|
|
214
|
+
contribution(message: {
|
|
215
|
+
role?: import("../../records/journal.js").InputRole;
|
|
216
|
+
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
217
|
+
}, value: {
|
|
218
|
+
op: "started";
|
|
219
|
+
id: string;
|
|
220
|
+
call_seq: number;
|
|
221
|
+
command: string;
|
|
222
|
+
cwd: string;
|
|
223
|
+
pgid: number;
|
|
224
|
+
started_at: string;
|
|
225
|
+
owner: string;
|
|
226
|
+
notify: "exit" | null;
|
|
227
|
+
launch: {
|
|
228
|
+
launcher: string;
|
|
229
|
+
version: string;
|
|
230
|
+
policy: string;
|
|
231
|
+
} | null;
|
|
232
|
+
} | {
|
|
233
|
+
op: "ended";
|
|
234
|
+
id: string;
|
|
235
|
+
exit_code: number | null;
|
|
236
|
+
exit_signal: string | null;
|
|
237
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
238
|
+
stop_failed: boolean;
|
|
239
|
+
stop_reason: string | null;
|
|
240
|
+
ended_at: string;
|
|
241
|
+
}, options?: {
|
|
242
|
+
sourceSeqs?: readonly Seq[];
|
|
243
|
+
}): import("../../records/journal.js").StepContribution;
|
|
244
|
+
matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
|
|
245
|
+
rejection(reason: string, value: {
|
|
246
|
+
op: "started";
|
|
247
|
+
id: string;
|
|
248
|
+
call_seq: number;
|
|
249
|
+
command: string;
|
|
250
|
+
cwd: string;
|
|
251
|
+
pgid: number;
|
|
252
|
+
started_at: string;
|
|
253
|
+
owner: string;
|
|
254
|
+
notify: "exit" | null;
|
|
255
|
+
launch: {
|
|
256
|
+
launcher: string;
|
|
257
|
+
version: string;
|
|
258
|
+
policy: string;
|
|
259
|
+
} | null;
|
|
260
|
+
} | {
|
|
261
|
+
op: "ended";
|
|
262
|
+
id: string;
|
|
263
|
+
exit_code: number | null;
|
|
264
|
+
exit_signal: string | null;
|
|
265
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
266
|
+
stop_failed: boolean;
|
|
267
|
+
stop_reason: string | null;
|
|
268
|
+
ended_at: string;
|
|
269
|
+
}): {
|
|
270
|
+
decision: "reject";
|
|
271
|
+
reason: string;
|
|
272
|
+
source: ExtensionRecord;
|
|
273
|
+
};
|
|
274
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
275
|
+
op: "started";
|
|
276
|
+
id: string;
|
|
277
|
+
call_seq: number;
|
|
278
|
+
command: string;
|
|
279
|
+
cwd: string;
|
|
280
|
+
pgid: number;
|
|
281
|
+
started_at: string;
|
|
282
|
+
owner: string;
|
|
283
|
+
notify: "exit" | null;
|
|
284
|
+
launch: {
|
|
285
|
+
launcher: string;
|
|
286
|
+
version: string;
|
|
287
|
+
policy: string;
|
|
288
|
+
} | null;
|
|
289
|
+
} | {
|
|
290
|
+
op: "ended";
|
|
291
|
+
id: string;
|
|
292
|
+
exit_code: number | null;
|
|
293
|
+
exit_signal: string | null;
|
|
294
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
295
|
+
stop_failed: boolean;
|
|
296
|
+
stop_reason: string | null;
|
|
297
|
+
ended_at: string;
|
|
298
|
+
} | undefined;
|
|
299
|
+
readSource: (source: DeepReadonly<ExtensionRecord> | null) => {
|
|
300
|
+
op: "started";
|
|
301
|
+
id: string;
|
|
302
|
+
call_seq: number;
|
|
303
|
+
command: string;
|
|
304
|
+
cwd: string;
|
|
305
|
+
pgid: number;
|
|
306
|
+
started_at: string;
|
|
307
|
+
owner: string;
|
|
308
|
+
notify: "exit" | null;
|
|
309
|
+
launch: {
|
|
310
|
+
launcher: string;
|
|
311
|
+
version: string;
|
|
312
|
+
policy: string;
|
|
313
|
+
} | null;
|
|
314
|
+
} | {
|
|
315
|
+
op: "ended";
|
|
316
|
+
id: string;
|
|
317
|
+
exit_code: number | null;
|
|
318
|
+
exit_signal: string | null;
|
|
319
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
320
|
+
stop_failed: boolean;
|
|
321
|
+
stop_reason: string | null;
|
|
322
|
+
ended_at: string;
|
|
323
|
+
} | undefined;
|
|
324
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
325
|
+
op: "started";
|
|
326
|
+
id: string;
|
|
327
|
+
call_seq: number;
|
|
328
|
+
command: string;
|
|
329
|
+
cwd: string;
|
|
330
|
+
pgid: number;
|
|
331
|
+
started_at: string;
|
|
332
|
+
owner: string;
|
|
333
|
+
notify: "exit" | null;
|
|
334
|
+
launch: {
|
|
335
|
+
launcher: string;
|
|
336
|
+
version: string;
|
|
337
|
+
policy: string;
|
|
338
|
+
} | null;
|
|
339
|
+
} | {
|
|
340
|
+
op: "ended";
|
|
341
|
+
id: string;
|
|
342
|
+
exit_code: number | null;
|
|
343
|
+
exit_signal: string | null;
|
|
344
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
345
|
+
stop_failed: boolean;
|
|
346
|
+
stop_reason: string | null;
|
|
347
|
+
ended_at: string;
|
|
348
|
+
}>>;
|
|
349
|
+
projection<State>(fold: {
|
|
350
|
+
key: string;
|
|
351
|
+
init(): State;
|
|
352
|
+
apply(state: State, value: {
|
|
353
|
+
op: "started";
|
|
354
|
+
id: string;
|
|
355
|
+
call_seq: number;
|
|
356
|
+
command: string;
|
|
357
|
+
cwd: string;
|
|
358
|
+
pgid: number;
|
|
359
|
+
started_at: string;
|
|
360
|
+
owner: string;
|
|
361
|
+
notify: "exit" | null;
|
|
362
|
+
launch: {
|
|
363
|
+
launcher: string;
|
|
364
|
+
version: string;
|
|
365
|
+
policy: string;
|
|
366
|
+
} | null;
|
|
367
|
+
} | {
|
|
368
|
+
op: "ended";
|
|
369
|
+
id: string;
|
|
370
|
+
exit_code: number | null;
|
|
371
|
+
exit_signal: string | null;
|
|
372
|
+
stopped_by: "abort" | "timeout" | "stop" | null;
|
|
373
|
+
stop_failed: boolean;
|
|
374
|
+
stop_reason: string | null;
|
|
375
|
+
ended_at: string;
|
|
376
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
377
|
+
onFork?: "inherit" | "reset";
|
|
378
|
+
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
379
|
+
};
|
|
380
|
+
/** One recorded command: how it started, and how it ended if the plugin saw it end. */
|
|
381
|
+
export type CommandRecord = {
|
|
382
|
+
readonly started: CommandStarted;
|
|
383
|
+
readonly ended: CommandEnded | null;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* A thread's recorded commands, by id. Resets at a fork's spawn row: a command describes what its
|
|
387
|
+
* source's execution did, not the conversation a fork continues.
|
|
388
|
+
*/
|
|
389
|
+
export declare const commandRecords: import("../../journal/projection.js").PluginProjection<Map<string, CommandRecord>>;
|
|
390
|
+
declare const CommandNoticeSchema: z.ZodObject<{
|
|
391
|
+
id: z.ZodString;
|
|
392
|
+
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
393
|
+
exit_signal: z.ZodNullable<z.ZodString>;
|
|
394
|
+
summary: z.ZodString;
|
|
395
|
+
}, z.core.$strict>;
|
|
396
|
+
export type CommandNotice = z.output<typeof CommandNoticeSchema>;
|
|
397
|
+
/**
|
|
398
|
+
* The source of a command's exit notice: the input the commands plugin queues on the thread that
|
|
399
|
+
* started a command with `notify: "exit"` when it exits on its own. Its `summary` is one bounded
|
|
400
|
+
* line, such as `cmd-42 exited (exit code 0)`, for a host to show collapsed.
|
|
401
|
+
*/
|
|
402
|
+
export declare const commandNotice: {
|
|
403
|
+
record: (value: {
|
|
404
|
+
id: string;
|
|
405
|
+
exit_code: number | null;
|
|
406
|
+
exit_signal: string | null;
|
|
407
|
+
summary: string;
|
|
408
|
+
}) => ExtensionRecord;
|
|
409
|
+
parse: (value: {
|
|
410
|
+
id: string;
|
|
411
|
+
exit_code: number | null;
|
|
412
|
+
exit_signal: string | null;
|
|
413
|
+
summary: string;
|
|
414
|
+
}) => {
|
|
415
|
+
id: string;
|
|
416
|
+
exit_code: number | null;
|
|
417
|
+
exit_signal: string | null;
|
|
418
|
+
summary: string;
|
|
419
|
+
};
|
|
420
|
+
entry: (value: {
|
|
421
|
+
id: string;
|
|
422
|
+
exit_code: number | null;
|
|
423
|
+
exit_signal: string | null;
|
|
424
|
+
summary: string;
|
|
425
|
+
}, options: import("../../journal/journal.js").AppendOptions) => {
|
|
426
|
+
type: "ext";
|
|
427
|
+
data: {
|
|
428
|
+
plugin: string;
|
|
429
|
+
instance_id: string;
|
|
430
|
+
kind: string;
|
|
431
|
+
version: number;
|
|
432
|
+
data: z.core.util.JSONType;
|
|
433
|
+
};
|
|
434
|
+
options: import("../../journal/journal.js").AppendOptions;
|
|
435
|
+
};
|
|
436
|
+
append(journal: import("../../journal/journal.js").PluginJournal, value: {
|
|
437
|
+
id: string;
|
|
438
|
+
exit_code: number | null;
|
|
439
|
+
exit_signal: string | null;
|
|
440
|
+
summary: string;
|
|
441
|
+
}, options: import("../../journal/journal.js").AppendOptions): Promise<import("../../records/journal.js").JournalEvent<"ext">>;
|
|
442
|
+
read(event: import("../../records/journal.js").JournalEvent): {
|
|
443
|
+
id: string;
|
|
444
|
+
exit_code: number | null;
|
|
445
|
+
exit_signal: string | null;
|
|
446
|
+
summary: string;
|
|
447
|
+
} | undefined;
|
|
448
|
+
contribution(message: {
|
|
449
|
+
role?: import("../../records/journal.js").InputRole;
|
|
450
|
+
content: string | readonly import("../../llm/content.js").ContentPartInput[];
|
|
451
|
+
}, value: {
|
|
452
|
+
id: string;
|
|
453
|
+
exit_code: number | null;
|
|
454
|
+
exit_signal: string | null;
|
|
455
|
+
summary: string;
|
|
456
|
+
}, options?: {
|
|
457
|
+
sourceSeqs?: readonly Seq[];
|
|
458
|
+
}): import("../../records/journal.js").StepContribution;
|
|
459
|
+
matchesSource(record: DeepReadonly<ExtensionRecord>): boolean;
|
|
460
|
+
rejection(reason: string, value: {
|
|
461
|
+
id: string;
|
|
462
|
+
exit_code: number | null;
|
|
463
|
+
exit_signal: string | null;
|
|
464
|
+
summary: string;
|
|
465
|
+
}): {
|
|
466
|
+
decision: "reject";
|
|
467
|
+
reason: string;
|
|
468
|
+
source: ExtensionRecord;
|
|
469
|
+
};
|
|
470
|
+
readContribution: (event: import("../../records/journal.js").JournalEvent) => {
|
|
471
|
+
id: string;
|
|
472
|
+
exit_code: number | null;
|
|
473
|
+
exit_signal: string | null;
|
|
474
|
+
summary: string;
|
|
475
|
+
} | undefined;
|
|
476
|
+
readSource: (source: DeepReadonly<ExtensionRecord> | null) => {
|
|
477
|
+
id: string;
|
|
478
|
+
exit_code: number | null;
|
|
479
|
+
exit_signal: string | null;
|
|
480
|
+
summary: string;
|
|
481
|
+
} | undefined;
|
|
482
|
+
told: import("../../journal/projection.js").PluginProjection<import("../../services/extensionEvents.js").ToldNotices<{
|
|
483
|
+
id: string;
|
|
484
|
+
exit_code: number | null;
|
|
485
|
+
exit_signal: string | null;
|
|
486
|
+
summary: string;
|
|
487
|
+
}>>;
|
|
488
|
+
projection<State>(fold: {
|
|
489
|
+
key: string;
|
|
490
|
+
init(): State;
|
|
491
|
+
apply(state: State, value: {
|
|
492
|
+
id: string;
|
|
493
|
+
exit_code: number | null;
|
|
494
|
+
exit_signal: string | null;
|
|
495
|
+
summary: string;
|
|
496
|
+
}, event: import("../../records/journal.js").JournalEvent<"ext">): State;
|
|
497
|
+
onFork?: "inherit" | "reset";
|
|
498
|
+
}): import("../../journal/projection.js").PluginProjection<State>;
|
|
499
|
+
};
|
|
500
|
+
/** What a command notice's source carries, when `source` is one; `undefined` for any other. For a host drawing the notice. */
|
|
501
|
+
export declare const readCommandNotice: (source: DeepReadonly<ExtensionRecord> | null) => CommandNotice | undefined;
|
|
502
|
+
/** The foreground command tool's name. */
|
|
503
|
+
export declare const RUN_COMMAND = "run_command";
|
|
504
|
+
/**
|
|
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, 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
|
|
509
|
+
* succeeded (`stop_failed: false`), `stop-failed` when that report says the stop failed, and
|
|
510
|
+
* `unknown` otherwise: no result yet, a call cut off, or a result written by anything but the tool,
|
|
511
|
+
* such as an error that replaced its report.
|
|
512
|
+
*/
|
|
513
|
+
export type ForegroundEnd = 'not-run' | 'ended' | 'stop-failed' | 'unknown';
|
|
514
|
+
/**
|
|
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.
|
|
519
|
+
*/
|
|
520
|
+
export declare const foregroundCommands: import("../../journal/projection.js").PluginProjection<Map<number, ForegroundEnd>>;
|
|
521
|
+
/**
|
|
522
|
+
* A command a thread's rows leave without affirmative evidence of its end: a background one with no
|
|
523
|
+
* end row, or a `run_command` call launched with no report of its end from the tool itself; either
|
|
524
|
+
* kind with `stop_failed` when the stop it reported failed to end its process group.
|
|
525
|
+
*/
|
|
526
|
+
declare const UnendedCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
527
|
+
kind: z.ZodLiteral<"background">;
|
|
528
|
+
id: z.ZodString;
|
|
529
|
+
stop_failed: z.ZodBoolean;
|
|
530
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
531
|
+
kind: z.ZodLiteral<"foreground">;
|
|
532
|
+
call_seq: z.ZodNumber;
|
|
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;
|
|
538
|
+
}, z.core.$strict>], "kind">;
|
|
539
|
+
export type UnendedCommand = z.output<typeof UnendedCommandSchema>;
|
|
540
|
+
/**
|
|
541
|
+
* What a thread's catalog entry says of its commands: those without an established end, for every
|
|
542
|
+
* thread while the commands plugin is mounted. A thread whose records cannot be read reads
|
|
543
|
+
* `unavailable`, which nothing reads as "none".
|
|
544
|
+
*/
|
|
545
|
+
export declare const commandsContribution: import("../../services/catalogContributions.js").ContributionDefinition<({
|
|
546
|
+
kind: "background";
|
|
547
|
+
id: string;
|
|
548
|
+
stop_failed: boolean;
|
|
549
|
+
} | {
|
|
550
|
+
kind: "foreground";
|
|
551
|
+
call_seq: number;
|
|
552
|
+
stop_failed: boolean;
|
|
553
|
+
} | {
|
|
554
|
+
kind: "runtime";
|
|
555
|
+
request_seq: number;
|
|
556
|
+
stop_failed: boolean;
|
|
557
|
+
})[]>;
|
|
558
|
+
export {};
|