operon-agents-core 0.1.0-alpha.2 → 0.1.0-alpha.21
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/dist/agent/agent.d.ts +8 -7
- package/dist/agent/compose-hooks.d.ts +10 -1
- package/dist/agent/compose-hooks.js +61 -6
- package/dist/agent/concurrency.js +1 -1
- package/dist/agent/context-report.d.ts +2 -2
- package/dist/agent/durable-state.d.ts +22 -0
- package/dist/agent/durable-state.js +54 -0
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/agent/instruction-context.d.ts +6 -6
- package/dist/agent/instruction-context.js +23 -23
- package/dist/agent/profile-builtins.js +1 -1
- package/dist/agent/run-support.d.ts +1 -1
- package/dist/agent/run-support.js +6 -5
- package/dist/agent/runner.d.ts +25 -22
- package/dist/agent/runner.js +217 -121
- package/dist/agent/session.d.ts +262 -156
- package/dist/agent/session.js +590 -418
- package/dist/agent/subagent-tools.js +3 -3
- package/dist/agent/subagent.js +28 -13
- package/dist/agent/toolset.d.ts +1 -0
- package/dist/agent/toolset.js +13 -7
- package/dist/agent/workflow/journal.d.ts +2 -2
- package/dist/agent/workflow/journal.js +2 -2
- package/dist/agent/workflow/manager.d.ts +1 -1
- package/dist/agent/workflow/manager.js +1 -1
- package/dist/agent/workflow/prompt.js +2 -2
- package/dist/agent/workflow/sandbox.d.ts +1 -1
- package/dist/agent/workflow/sandbox.js +1 -1
- package/dist/agent/workflow/tool.js +30 -43
- package/dist/agent/worktree.d.ts +8 -8
- package/dist/agent/worktree.js +15 -15
- package/dist/capabilities/assembler.d.ts +29 -5
- package/dist/capabilities/assembler.js +85 -9
- package/dist/capabilities/background/code-task.d.ts +43 -0
- package/dist/capabilities/background/code-task.js +75 -0
- package/dist/capabilities/background/command-task.d.ts +9 -2
- package/dist/capabilities/background/command-task.js +22 -6
- package/dist/capabilities/background/index.d.ts +6 -1
- package/dist/capabilities/background/index.js +26 -20
- package/dist/capabilities/background/manager.d.ts +57 -1
- package/dist/capabilities/background/manager.js +210 -45
- package/dist/capabilities/background/persist-disk.d.ts +1 -1
- package/dist/capabilities/background/persist-disk.js +1 -1
- package/dist/capabilities/background/persist.js +4 -2
- package/dist/capabilities/background/projections.d.ts +16 -0
- package/dist/capabilities/background/projections.js +86 -0
- package/dist/capabilities/background/stall-watchdog.d.ts +41 -0
- package/dist/capabilities/background/stall-watchdog.js +85 -0
- package/dist/capabilities/background/task.d.ts +8 -7
- package/dist/capabilities/background/tools.js +33 -7
- package/dist/capabilities/capability-data.d.ts +52 -0
- package/dist/capabilities/capability-data.js +88 -0
- package/dist/capabilities/capability-state.d.ts +2 -4
- package/dist/capabilities/capability-state.js +5 -23
- package/dist/capabilities/capability.d.ts +203 -38
- package/dist/capabilities/compaction/index.js +10 -4
- package/dist/capabilities/compaction/service.d.ts +20 -5
- package/dist/capabilities/compaction/service.js +27 -11
- package/dist/capabilities/goal/goal-store.d.ts +76 -12
- package/dist/capabilities/goal/goal-store.js +137 -53
- package/dist/capabilities/goal/index.d.ts +1 -1
- package/dist/capabilities/goal/index.js +30 -7
- package/dist/capabilities/index.d.ts +9 -6
- package/dist/capabilities/index.js +4 -3
- package/dist/capabilities/plan/index.js +22 -5
- package/dist/capabilities/plan/plan-mode.d.ts +30 -9
- package/dist/capabilities/plan/plan-mode.js +57 -32
- package/dist/capabilities/plan/tools.js +1 -1
- package/dist/capabilities/skills/flow-provider.js +3 -3
- package/dist/capabilities/skills/index.d.ts +13 -1
- package/dist/capabilities/skills/index.js +30 -21
- package/dist/capabilities/skills/parser.d.ts +2 -2
- package/dist/capabilities/skills/parser.js +3 -3
- package/dist/capabilities/skills/registry.d.ts +5 -6
- package/dist/capabilities/skills/registry.js +6 -9
- package/dist/capabilities/skills/scanner.d.ts +3 -3
- package/dist/capabilities/skills/scanner.js +14 -14
- package/dist/capabilities/skills/service.d.ts +2 -1
- package/dist/capabilities/skills/service.js +3 -3
- package/dist/capabilities/skills/skill-tool.d.ts +2 -0
- package/dist/capabilities/skills/skill-tool.js +1 -1
- package/dist/capabilities/task/index.js +2 -1
- package/dist/capabilities/task/persist-disk.d.ts +1 -1
- package/dist/capabilities/task/persist-disk.js +1 -1
- package/dist/capabilities/task/persist.js +1 -1
- package/dist/capabilities/todo/index.js +11 -6
- package/dist/capabilities/todo/injector.js +2 -1
- package/dist/capabilities/todo/todo-store.d.ts +28 -7
- package/dist/capabilities/todo/todo-store.js +44 -11
- package/dist/capabilities/todo/tools.js +8 -3
- package/dist/capabilities/tool-provider.d.ts +3 -3
- package/dist/capabilities/user-hooks/engine.d.ts +3 -3
- package/dist/capabilities/user-hooks/engine.js +7 -7
- package/dist/capabilities/user-hooks/index.js +2 -1
- package/dist/capabilities/workflow/index.d.ts +5 -3
- package/dist/capabilities/workflow/index.js +3 -2
- package/dist/commands/index.js +34 -32
- package/dist/config/index.d.ts +1 -1
- package/dist/config/provider-manager.js +0 -28
- package/dist/config/schema.d.ts +53 -4
- package/dist/config/schema.js +53 -1
- package/dist/events/events.d.ts +43 -11
- package/dist/events/events.js +1 -0
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.js +1 -1
- package/dist/events/projection.d.ts +49 -1
- package/dist/events/projection.js +144 -19
- package/dist/events/publisher.js +2 -21
- package/dist/home.d.ts +1 -1
- package/dist/home.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.js +5 -2
- package/dist/llm/define-model.d.ts +4 -0
- package/dist/llm/define-model.js +63 -25
- package/dist/llm/index.d.ts +1 -0
- package/dist/llm/index.js +1 -0
- package/dist/llm/model.d.ts +2 -0
- package/dist/llm/provider.d.ts +17 -0
- package/dist/llm/provider.js +14 -0
- package/dist/llm/retry.js +1 -1
- package/dist/loop/context.d.ts +21 -1
- package/dist/loop/context.js +47 -9
- package/dist/loop/events.d.ts +5 -1
- package/dist/loop/index.d.ts +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/interruption.d.ts +9 -4
- package/dist/loop/interruption.js +11 -25
- package/dist/loop/run-turn.d.ts +16 -3
- package/dist/loop/run-turn.js +13 -4
- package/dist/loop/steer.d.ts +78 -12
- package/dist/loop/steer.js +101 -38
- package/dist/loop/tool-call.d.ts +13 -2
- package/dist/loop/tool-call.js +135 -5
- package/dist/loop/turn-step.d.ts +13 -2
- package/dist/loop/turn-step.js +29 -7
- package/dist/loop/types.d.ts +6 -0
- package/dist/mcp/auth-tool.d.ts +3 -1
- package/dist/mcp/auth-tool.js +2 -2
- package/dist/mcp/capability.d.ts +13 -0
- package/dist/mcp/capability.js +36 -17
- package/dist/mcp/config-loader.d.ts +5 -5
- package/dist/mcp/config-loader.js +17 -17
- package/dist/mcp/credentials.d.ts +35 -0
- package/dist/mcp/credentials.js +2 -0
- package/dist/mcp/filter.d.ts +2 -2
- package/dist/mcp/index.d.ts +4 -3
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/manager.d.ts +108 -6
- package/dist/mcp/manager.js +262 -18
- package/dist/mcp/oauth/callback-server.d.ts +10 -1
- package/dist/mcp/oauth/callback-server.js +82 -16
- package/dist/mcp/oauth/index.d.ts +2 -2
- package/dist/mcp/oauth/provider.d.ts +18 -0
- package/dist/mcp/oauth/provider.js +31 -1
- package/dist/mcp/oauth/service.d.ts +9 -3
- package/dist/mcp/oauth/service.js +29 -4
- package/dist/mcp/sdk-transport.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/permission/auto-approver/prompts-data.d.ts +1 -1
- package/dist/permission/auto-approver/prompts-data.js +1 -1
- package/dist/permission/manager.d.ts +5 -3
- package/dist/permission/manager.js +7 -3
- package/dist/permission/policies.d.ts +2 -2
- package/dist/permission/policies.js +4 -4
- package/dist/plugins/fields.d.ts +14 -0
- package/dist/plugins/fields.js +30 -0
- package/dist/plugins/hooks.d.ts +2 -2
- package/dist/plugins/hooks.js +12 -12
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/manager.d.ts +8 -3
- package/dist/plugins/manager.js +18 -7
- package/dist/plugins/manifest.d.ts +2 -2
- package/dist/plugins/manifest.js +101 -91
- package/dist/plugins/marketplace.js +76 -57
- package/dist/plugins/store.d.ts +3 -3
- package/dist/plugins/store.js +6 -6
- package/dist/protocol/index.d.ts +1 -1
- package/dist/store/catalog-store.d.ts +4 -1
- package/dist/store/catalog-store.js +5 -1
- package/dist/store/checkpointing-store.d.ts +41 -0
- package/dist/store/checkpointing-store.js +86 -0
- package/dist/store/disk-store.d.ts +8 -0
- package/dist/store/disk-store.js +127 -5
- package/dist/store/index.d.ts +3 -2
- package/dist/store/index.js +2 -1
- package/dist/store/log-store.d.ts +9 -1
- package/dist/store/log-store.js +68 -4
- package/dist/store/migrate.d.ts +8 -2
- package/dist/store/migrate.js +9 -2
- package/dist/store/origin.d.ts +31 -6
- package/dist/store/origin.js +0 -14
- package/dist/store/pg.d.ts +1 -0
- package/dist/store/pg.js +37 -2
- package/dist/store/redis.d.ts +1 -0
- package/dist/store/redis.js +30 -0
- package/dist/store/repository.d.ts +13 -1
- package/dist/store/repository.js +45 -2
- package/dist/store/session-catalog.d.ts +4 -0
- package/dist/store/session-catalog.js +6 -0
- package/dist/store/storage.js +3 -0
- package/dist/store/store.d.ts +97 -34
- package/dist/store/store.js +64 -10
- package/dist/telemetry/appender.d.ts +43 -0
- package/dist/telemetry/appender.js +46 -0
- package/dist/telemetry/events.d.ts +142 -0
- package/dist/telemetry/events.js +141 -0
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.js +6 -0
- package/dist/telemetry/projection.d.ts +23 -0
- package/dist/telemetry/projection.js +185 -0
- package/dist/telemetry/redact.d.ts +20 -0
- package/dist/telemetry/redact.js +40 -0
- package/dist/telemetry/service.d.ts +49 -0
- package/dist/telemetry/service.js +137 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +123 -0
- package/dist/tool/background.d.ts +9 -6
- package/dist/tool/background.js +7 -1
- package/dist/tool/builtin/ask-user-question.js +6 -5
- package/dist/tool/builtin/bash.d.ts +6 -0
- package/dist/tool/builtin/bash.js +79 -42
- package/dist/tool/builtin/edit.js +82 -109
- package/dist/tool/builtin/glob.js +13 -13
- package/dist/tool/builtin/grep.js +13 -13
- package/dist/tool/builtin/read.js +25 -15
- package/dist/tool/builtin/write.js +49 -33
- package/dist/tool/define.d.ts +14 -8
- package/dist/tool/define.js +8 -2
- package/dist/tool/{machine-base.d.ts → environment-base.d.ts} +37 -37
- package/dist/tool/{machine-base.js → environment-base.js} +45 -119
- package/dist/tool/{machine-local.d.ts → environment-local.d.ts} +9 -8
- package/dist/tool/{machine-local.js → environment-local.js} +60 -81
- package/dist/tool/{machine-null.d.ts → environment-null.d.ts} +9 -9
- package/dist/tool/{machine-null.js → environment-null.js} +9 -9
- package/dist/tool/{machine-ssh.d.ts → environment-ssh.d.ts} +33 -18
- package/dist/tool/{machine-ssh.js → environment-ssh.js} +118 -149
- package/dist/tool/{machine.d.ts → environment.d.ts} +53 -82
- package/dist/tool/environment.js +2 -0
- package/dist/tool/file-freshness.d.ts +33 -19
- package/dist/tool/file-freshness.js +39 -30
- package/dist/tool/filesystem-tools.d.ts +1 -1
- package/dist/tool/filesystem-tools.js +1 -1
- package/dist/tool/git-context.d.ts +2 -2
- package/dist/tool/git-context.js +8 -8
- package/dist/tool/index.d.ts +12 -12
- package/dist/tool/index.js +12 -10
- package/dist/tool/policies/path-access.d.ts +4 -4
- package/dist/tool/policies/path-access.js +12 -12
- package/dist/tool/questions.d.ts +8 -0
- package/dist/tool/search/catalog.d.ts +37 -0
- package/dist/tool/search/catalog.js +182 -0
- package/dist/tool/search/deferral.d.ts +3 -2
- package/dist/tool/search/loaded.d.ts +32 -0
- package/dist/tool/search/loaded.js +96 -0
- package/dist/tool/search/search-tool.d.ts +2 -6
- package/dist/tool/search/search-tool.js +16 -15
- package/dist/tool/shell-env.js +4 -0
- package/dist/tool/support/bash-paths.js +38 -7
- package/dist/tool/support/{machine-ops.d.ts → environment-ops.d.ts} +12 -14
- package/dist/tool/support/{machine-ops.js → environment-ops.js} +21 -2
- package/dist/tool/support/git-worktree.d.ts +3 -3
- package/dist/tool/support/git-worktree.js +6 -6
- package/dist/tool/support/rg-locator.d.ts +6 -6
- package/dist/tool/support/rg-locator.js +6 -6
- package/dist/tool/support/ripgrep-run.d.ts +5 -5
- package/dist/tool/support/ripgrep-run.js +3 -3
- package/dist/tool/support/tool-path.d.ts +3 -3
- package/dist/tool/support/tool-path.js +7 -7
- package/dist/tool/types.d.ts +54 -10
- package/dist/tool/web/fetch-url.js +1 -1
- package/dist/tool/web/web-search.js +1 -1
- package/dist/tool/workspace-spec.d.ts +3 -3
- package/dist/tool/workspace-spec.js +27 -27
- package/dist/tracing/bridge.d.ts +9 -1
- package/dist/tracing/bridge.js +307 -77
- package/dist/tracing/index.d.ts +2 -2
- package/dist/tracing/otel.d.ts +28 -1
- package/dist/tracing/otel.js +150 -38
- package/dist/tracing/processor.d.ts +22 -0
- package/dist/tracing/processor.js +2 -0
- package/dist/tracing/spans.d.ts +54 -0
- package/dist/tracing/spans.js +5 -0
- package/package.json +6 -2
- package/dist/tool/machine.js +0 -15
- package/dist/tool/search/activation.d.ts +0 -13
- package/dist/tool/search/activation.js +0 -31
|
@@ -60,7 +60,7 @@ export interface ByteRange {
|
|
|
60
60
|
export type DecodeErrors = "strict" | "replace" | "ignore";
|
|
61
61
|
export type OsKind = "Linux" | "Darwin" | "Windows" | (string & {});
|
|
62
62
|
export type ShellName = "bash" | "zsh" | "sh" | "powershell" | "cmd" | (string & {});
|
|
63
|
-
export interface
|
|
63
|
+
export interface OsInfo {
|
|
64
64
|
readonly osKind: OsKind;
|
|
65
65
|
readonly osArch: string;
|
|
66
66
|
readonly osVersion: string;
|
|
@@ -95,11 +95,11 @@ export interface DirEntry {
|
|
|
95
95
|
readonly kind: FileKind;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Version stamp for
|
|
99
|
-
* (local-first): on hosts with a reliable mtime the check
|
|
100
|
-
* without one (some sandbox vendors) leave `mtimeMs` undefined,
|
|
101
|
-
* check there falls back to content comparison
|
|
102
|
-
*
|
|
98
|
+
* Version stamp for the session's read-state record (see FileFreshnessLedger).
|
|
99
|
+
* mtime and nothing else (local-first): on hosts with a reliable mtime the check
|
|
100
|
+
* is free; hosts without one (some sandbox vendors) leave `mtimeMs` undefined,
|
|
101
|
+
* and every check there falls back to content comparison, done on a digest
|
|
102
|
+
* (`hashFileContent`) so neither side retains the text.
|
|
103
103
|
*
|
|
104
104
|
* Size deliberately plays no part. It only ever ruled on cases the mtime had
|
|
105
105
|
* already decided, except for one it decided WRONG: an mtime-less backend
|
|
@@ -117,38 +117,19 @@ export interface WriteTextOptions {
|
|
|
117
117
|
/** Line-ending style to restore on write; `data` is LF-normalized. Default LF. */
|
|
118
118
|
readonly lineEndings?: "LF" | "CRLF";
|
|
119
119
|
}
|
|
120
|
-
export interface WriteTextIfUnchangedOptions extends WriteTextOptions {
|
|
121
|
-
/**
|
|
122
|
-
* Expected pre-write state (REQUIRED — the name must not lie; an unconditional
|
|
123
|
-
* write is {@link Machine.writeText}):
|
|
124
|
-
* - FileVersion: file must still match (mtime-first); mismatch throws StaleFileError.
|
|
125
|
-
* - "must-not-exist": create-new semantics; an existing file throws FileExistsError.
|
|
126
|
-
*/
|
|
127
|
-
readonly expected: FileVersion | "must-not-exist";
|
|
128
|
-
/**
|
|
129
|
-
* Prior full content (LF-normalized) for false-positive review when the mtime moved
|
|
130
|
-
* or is unavailable. Omit to treat any mtime change as a conflict.
|
|
131
|
-
*/
|
|
132
|
-
readonly expectedContent?: string;
|
|
133
|
-
}
|
|
134
120
|
export interface WriteTextResult {
|
|
135
121
|
readonly bytesWritten: number;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
readonly
|
|
144
|
-
constructor(message?: string);
|
|
145
|
-
}
|
|
146
|
-
export declare class FileExistsError extends Error {
|
|
147
|
-
readonly code = "FILE_ALREADY_EXISTS";
|
|
148
|
-
constructor(message?: string);
|
|
122
|
+
/**
|
|
123
|
+
* The version this write produced — present ONLY when the backend already knew it
|
|
124
|
+
* (LocalEnvironment: one stat syscall). `undefined` everywhere a round trip would be
|
|
125
|
+
* needed to learn it, which is why it is optional rather than a promise: the caller
|
|
126
|
+
* records what it got, and a versionless record is decided by content instead
|
|
127
|
+
* (see FileFreshnessLedger). Never stat here just to fill it in.
|
|
128
|
+
*/
|
|
129
|
+
readonly version?: FileVersion;
|
|
149
130
|
}
|
|
150
131
|
/**
|
|
151
|
-
* Handle to the
|
|
132
|
+
* Handle to the environment the workspace lives on.
|
|
152
133
|
*
|
|
153
134
|
* Not a filesystem abstraction: files, processes and path/OS semantics are one
|
|
154
135
|
* contract precisely because they must agree — a command started by `run` sees
|
|
@@ -158,17 +139,18 @@ export declare class FileExistsError extends Error {
|
|
|
158
139
|
* - `run` is the universal primitive — the single way anything executes, from a
|
|
159
140
|
* one-shot `git status` to a background build. Search-shaped operations (grep,
|
|
160
141
|
* glob) run a uniform binary through it rather than getting their own member.
|
|
161
|
-
* - File I/O is
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
142
|
+
* - File I/O is `readBytes` (every read, whole file or a byte window) plus two
|
|
143
|
+
* unconditional writes, `writeText` and `writeBytes`. There is deliberately NO
|
|
144
|
+
* compare-and-swap write: the read-before-write safety the tools need is decided
|
|
145
|
+
* against the session's read-state record (FileFreshnessLedger) BEFORE the write,
|
|
146
|
+
* and no backend but the local one can make the compare and the write one step
|
|
147
|
+
* anyway — a CAS member could only have promised what it does not deliver.
|
|
166
148
|
* - `realpath` exists for symlink anti-bypass: path-access
|
|
167
149
|
* checks canonicalize before prefix-matching. The threat model is the tool
|
|
168
150
|
* call escaping the workspace, not the backend lying — so a `readlink -f` run
|
|
169
151
|
* through `run` is as authoritative as the backend's own FS view.
|
|
170
152
|
*
|
|
171
|
-
* Implementations extend {@link
|
|
153
|
+
* Implementations extend {@link BaseEnvironment} (environment-base.ts):
|
|
172
154
|
* it derives the high-level operations from a small SPI so a new backend only
|
|
173
155
|
* writes the dumb primitives, and overrides them only where it can do better
|
|
174
156
|
* (single round trip, true atomicity, bounded-memory streaming).
|
|
@@ -178,9 +160,9 @@ export declare class FileExistsError extends Error {
|
|
|
178
160
|
* by the user's workspace goes through the host; content owned by the agent's
|
|
179
161
|
* session goes through the store.
|
|
180
162
|
*/
|
|
181
|
-
export interface
|
|
163
|
+
export interface Environment {
|
|
182
164
|
readonly name: string;
|
|
183
|
-
readonly
|
|
165
|
+
readonly osInfo: OsInfo;
|
|
184
166
|
pathClass(): "posix" | "win32";
|
|
185
167
|
normpath(path: string): string;
|
|
186
168
|
gethome(): string;
|
|
@@ -193,24 +175,24 @@ export interface Machine {
|
|
|
193
175
|
*/
|
|
194
176
|
additionalDirs?(): readonly string[];
|
|
195
177
|
/**
|
|
196
|
-
* Return a sibling
|
|
197
|
-
* resources (the same ssh connection / sandbox session / local
|
|
178
|
+
* Return a sibling environment rooted at `cwd`, sharing this environment's backend
|
|
179
|
+
* resources (the same ssh connection / sandbox session / local environment) — only
|
|
198
180
|
* the working directory differs. Purely structural and cheap (no I/O); the
|
|
199
181
|
* symmetric counterpart of `getcwd()`. Callers that need an isolated workspace
|
|
200
182
|
* (e.g. a git worktree for a subagent) build it on top of this rather than the
|
|
201
|
-
*
|
|
202
|
-
* the current one. Never mutates this
|
|
183
|
+
* environment knowing anything about isolation. A relative `cwd` resolves against
|
|
184
|
+
* the current one. Never mutates this environment, so re-rooting one copy can't
|
|
203
185
|
* clobber the cwd of another that shares the same connection.
|
|
204
186
|
*/
|
|
205
|
-
withCwd(cwd: string):
|
|
187
|
+
withCwd(cwd: string): Environment;
|
|
206
188
|
/**
|
|
207
|
-
* Public URL for a port listening inside this
|
|
189
|
+
* Public URL for a port listening inside this environment, or `undefined` when the backend
|
|
208
190
|
* has no way to expose one (local, ssh, a sandbox without port forwarding). A dev server
|
|
209
191
|
* the agent just started is only useful if someone can reach it, and only the backend
|
|
210
192
|
* knows the mapping — E2B's `getHost`, a vendor tunnel, and so on.
|
|
211
193
|
*
|
|
212
|
-
* This is an OPERATION on a running
|
|
213
|
-
* question about
|
|
194
|
+
* This is an OPERATION on a running environment, not workspace lifecycle: it answers a
|
|
195
|
+
* question about an environment we were handed, and never creates or destroys anything.
|
|
214
196
|
* `undefined` rather than a throw, so a caller writes one code path.
|
|
215
197
|
*/
|
|
216
198
|
exposedPortUrl?(port: number): Promise<string | undefined>;
|
|
@@ -227,7 +209,7 @@ export interface Machine {
|
|
|
227
209
|
* `onOutput`, learn how it ended from the resolved result. That is exactly what the
|
|
228
210
|
* background-task machinery does.
|
|
229
211
|
*
|
|
230
|
-
* `
|
|
212
|
+
* `BaseEnvironment` derives it from a process-spawning SPI, so local and SSH backends get it
|
|
231
213
|
* for free; backends with native support (a vendor `timeoutMs` + `kill`) override it.
|
|
232
214
|
*/
|
|
233
215
|
run(argv: readonly string[], options?: RunCommandOptions): Promise<RunCommandResult>;
|
|
@@ -241,7 +223,7 @@ export interface Machine {
|
|
|
241
223
|
*
|
|
242
224
|
* Entries carry their `kind` because every backend's readdir already knows it — handing
|
|
243
225
|
* back bare names would force callers into a stat per entry, which is free locally and
|
|
244
|
-
* seconds of serial round trips on a remote
|
|
226
|
+
* seconds of serial round trips on a remote environment. `kind` is lstat semantics; resolve
|
|
245
227
|
* `"symlink"` entries with `fileInfo` when the target kind matters (see `DirEntry`).
|
|
246
228
|
*/
|
|
247
229
|
listDir(path: string): Promise<readonly DirEntry[]>;
|
|
@@ -251,7 +233,6 @@ export interface Machine {
|
|
|
251
233
|
* directory is always OK (`existOk` is implied and effectively ignored).
|
|
252
234
|
* - `existOk: true` (with `parents` unset/false) — an existing DIRECTORY at `path` is
|
|
253
235
|
* OK; anything else occupying the path (a file) must still throw EEXIST.
|
|
254
|
-
* (Known deviation: `SshMachine` currently passes a file occupant through.)
|
|
255
236
|
* - neither — plain mkdir: throws if `path` exists or its parent is missing.
|
|
256
237
|
*/
|
|
257
238
|
mkdir(path: string, options?: {
|
|
@@ -275,31 +256,21 @@ export interface Machine {
|
|
|
275
256
|
* through a shell.
|
|
276
257
|
*/
|
|
277
258
|
writeBytes(path: string, data: Buffer): Promise<void>;
|
|
278
|
-
/** Unconditional text write — no staleness check, no stat round trips, no version stamp. */
|
|
279
|
-
writeText(path: string, data: string, options?: WriteTextOptions): Promise<WriteTextResult>;
|
|
280
259
|
/**
|
|
281
|
-
*
|
|
260
|
+
* Unconditional text write — no staleness check, no stat round trips, no version stamp.
|
|
282
261
|
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* interleave their compare and write, and the returned `version` is the one
|
|
288
|
-
* this write produced, not a later sibling's.
|
|
289
|
-
* - External writers (other processes, remote users): the compare and the write
|
|
290
|
-
* are separate operations. LocalMachine's gap is sub-millisecond; remote
|
|
291
|
-
* backends' is ~1 round trip (SFTP and sandbox file APIs have no CAS). An
|
|
292
|
-
* external write landing inside that window is silently overwritten — the
|
|
293
|
-
* protocol ceiling, documented rather than papered over.
|
|
294
|
-
* - `expected: "must-not-exist"` on SshMachine is the exception: strictly atomic
|
|
295
|
-
* (server-enforced SFTP EXCL create), even against external writers.
|
|
262
|
+
* `lineEndings: "CRLF"` normalizes to LF first and then joins, so text that ALREADY contains
|
|
263
|
+
* `\r\n` — which model output routinely does, having just read a CRLF file — comes out with
|
|
264
|
+
* `\r\n` rather than `\r\r\n`. Backends share one implementation of this; a backend
|
|
265
|
+
* overriding `writeText` must keep the same two-step.
|
|
296
266
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
267
|
+
* Whether the file lands all-at-once is a BACKEND property, not a promise of this
|
|
268
|
+
* contract: LocalEnvironment swaps a sibling temp file into place (free there, and it
|
|
269
|
+
* keeps symlink/mode semantics), remote backends write straight to the target
|
|
270
|
+
* because staging a temp file and renaming it costs round trips on every write to
|
|
271
|
+
* narrow a window nothing in the tool path depends on.
|
|
301
272
|
*/
|
|
302
|
-
|
|
273
|
+
writeText(path: string, data: string, options?: WriteTextOptions): Promise<WriteTextResult>;
|
|
303
274
|
/**
|
|
304
275
|
* Canonicalize symlinks (security: path-access checks must canonicalize before
|
|
305
276
|
* prefix-matching). Derived default is `readlink -f` on posix / normpath on
|
|
@@ -308,26 +279,26 @@ export interface Machine {
|
|
|
308
279
|
*/
|
|
309
280
|
realpath(path: string): Promise<string>;
|
|
310
281
|
}
|
|
311
|
-
export interface
|
|
282
|
+
export interface EnvironmentOpenContext {
|
|
312
283
|
readonly sessionId: string;
|
|
313
284
|
readonly signal: AbortSignal;
|
|
314
285
|
}
|
|
315
286
|
/**
|
|
316
|
-
* Lazy, per-session way to hand a session its {@link
|
|
287
|
+
* Lazy, per-session way to hand a session its {@link Environment} — for hosts that can only
|
|
317
288
|
* build one once they know the session (or that must `await` a connection). Pass a
|
|
318
|
-
* `
|
|
289
|
+
* `Environment` directly whenever one already exists; that is the common case.
|
|
319
290
|
*
|
|
320
291
|
* Sandbox LIFECYCLE — creating, snapshotting, pausing, destroying — deliberately lives
|
|
321
292
|
* outside this framework. A sandbox is typically a user- or workspace-scoped resource
|
|
322
293
|
* whose lifetime spans many sessions (new, resumed and forked alike), so the layer that
|
|
323
294
|
* knows when a user is actually done is the host, not a session. The host creates the
|
|
324
|
-
* sandbox, hands the
|
|
325
|
-
* only ever OPERATES
|
|
326
|
-
* teardown half: a factory that mints
|
|
295
|
+
* sandbox, hands the environment in, and disposes of it on its own terms; everything here
|
|
296
|
+
* only ever OPERATES an environment it was given — which is also why this type has no
|
|
297
|
+
* teardown half: a factory that mints an environment per session has nowhere to release it.
|
|
327
298
|
*
|
|
328
299
|
* The concrete thing this buys: nothing in a session's durable state points at a sandbox,
|
|
329
300
|
* so forking a session cannot silently make two sessions share one workspace, and closing
|
|
330
301
|
* one session cannot pull the sandbox out from under the others.
|
|
331
302
|
*/
|
|
332
|
-
export type
|
|
333
|
-
//# sourceMappingURL=
|
|
303
|
+
export type EnvironmentFactory = (ctx: EnvironmentOpenContext) => Environment | Promise<Environment>;
|
|
304
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -9,30 +9,27 @@
|
|
|
9
9
|
* by the loop. Keys are host-canonical absolute paths.
|
|
10
10
|
*
|
|
11
11
|
* Freshness is mtime-first (local-first): when both sides have an mtime and it
|
|
12
|
-
* matches, the file is fresh with zero extra I/O. Content comparison
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
import type { FileVersion, LineEndings } from "./machine.ts";
|
|
18
|
-
/**
|
|
19
|
-
* Above this, content is not retained (version-only record) — freshness then degrades to
|
|
20
|
-
* conservative-stale on mtime change.
|
|
12
|
+
* matches, the file is fresh with zero extra I/O. Content comparison runs only when
|
|
13
|
+
* the mtime moved (false-positive review: cloud sync / antivirus / Windows) or is
|
|
14
|
+
* unavailable (mtime-less sandbox backends), and compares a digest of the text the
|
|
15
|
+
* record was taken from — the text itself is never retained, so a record costs the
|
|
16
|
+
* same for a 1 KB file and a 10 MB one.
|
|
21
17
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* stops that from being a multi-megabyte generated file.
|
|
18
|
+
* Bounded as an LRU: an agent that has touched more than {@link LEDGER_MAX_ENTRIES}
|
|
19
|
+
* files forgets the least recently used, which then reads as "not read yet" — the
|
|
20
|
+
* conservative direction.
|
|
26
21
|
*/
|
|
27
|
-
|
|
22
|
+
import type { FileVersion, LineEndings } from "./environment.ts";
|
|
23
|
+
/** Default record cap of a {@link FileFreshnessLedger}. */
|
|
24
|
+
export declare const LEDGER_MAX_ENTRIES = 5000;
|
|
28
25
|
export declare const FILE_NOT_READ_MESSAGE = "File has not been read yet. Read it first before writing to it.";
|
|
29
26
|
export declare const FILE_MODIFIED_MESSAGE = "File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.";
|
|
30
27
|
export declare const FILE_UNCHANGED_STUB = "File unchanged since last read. The content from the earlier Read tool_result in this conversation is still current; refer to that instead of re-reading.";
|
|
31
28
|
export interface FileReadRecord {
|
|
32
29
|
readonly version: FileVersion;
|
|
33
|
-
/**
|
|
34
|
-
readonly
|
|
35
|
-
/** True when the read
|
|
30
|
+
/** {@link hashFileContent} of the full text (LF-normalized, BOM-stripped); full reads only. */
|
|
31
|
+
readonly contentHash?: string;
|
|
32
|
+
/** True when the read covered the whole file. Partial reads never pass content review. */
|
|
36
33
|
readonly fullRead: boolean;
|
|
37
34
|
readonly range?: {
|
|
38
35
|
readonly lineOffset: number;
|
|
@@ -50,17 +47,34 @@ export type FreshnessVerdict = {
|
|
|
50
47
|
} | {
|
|
51
48
|
readonly kind: "stale";
|
|
52
49
|
};
|
|
50
|
+
/** What a reader hands the ledger: the record, with the text in place of its digest. */
|
|
51
|
+
export type RecordReadInput = Omit<FileReadRecord, "contentHash"> & {
|
|
52
|
+
/** Full text (LF-normalized, BOM-stripped) — hashed, not retained. Pass only for full reads. */
|
|
53
|
+
readonly content?: string;
|
|
54
|
+
};
|
|
53
55
|
export interface RecordWriteOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Post-write version, when the caller happens to have one. Omitted by the write
|
|
58
|
+
* path on purpose: a stat after every write costs a round trip on remote backends
|
|
59
|
+
* to record an mtime the next check does not need — a versionless record is
|
|
60
|
+
* decided by {@link RecordWriteOptions.content}'s digest, which Edit compares for
|
|
61
|
+
* free against the text it must read anyway.
|
|
62
|
+
*/
|
|
63
|
+
readonly version?: FileVersion;
|
|
64
|
+
/** The written text (LF-normalized, BOM-stripped) — hashed, not retained. */
|
|
54
65
|
readonly content?: string;
|
|
55
66
|
readonly lineEndings?: LineEndings;
|
|
56
67
|
readonly encoding?: BufferEncoding;
|
|
57
68
|
}
|
|
58
69
|
export declare class FileFreshnessLedger {
|
|
59
70
|
private readonly records;
|
|
60
|
-
|
|
71
|
+
private readonly maxEntries;
|
|
72
|
+
constructor(maxEntries?: number);
|
|
73
|
+
recordRead(path: string, input: RecordReadInput): void;
|
|
61
74
|
/** A successful write makes the writer the last reader. */
|
|
62
|
-
recordWrite(path: string,
|
|
75
|
+
recordWrite(path: string, options?: RecordWriteOptions): void;
|
|
63
76
|
get(path: string): FileReadRecord | undefined;
|
|
77
|
+
private put;
|
|
64
78
|
delete(path: string): void;
|
|
65
79
|
clear(): void;
|
|
66
80
|
get size(): number;
|
|
@@ -1,45 +1,54 @@
|
|
|
1
|
-
// Same predicate the
|
|
1
|
+
// Same predicate the Environment-side check uses (BaseEnvironment.assertUnchanged) — the two
|
|
2
2
|
// run at different moments and must never disagree about what "unchanged" means.
|
|
3
|
-
import { fileVersionsMatch } from "./support/
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* conservative-stale on mtime change.
|
|
7
|
-
*
|
|
8
|
-
* It bounds the WRITE path, not the read path. A read can only retain content when it read
|
|
9
|
-
* the file whole, which the Read tool's own output caps already keep far below this. A write
|
|
10
|
-
* has no such ceiling: `recordWrite` retains whatever the model just produced, and nothing
|
|
11
|
-
* stops that from being a multi-megabyte generated file.
|
|
12
|
-
*/
|
|
13
|
-
export const CONTENT_RETENTION_MAX_BYTES = 10 * 1024 * 1024;
|
|
3
|
+
import { fileVersionsMatch, hashFileContent } from "./support/environment-ops.js";
|
|
4
|
+
/** Default record cap of a {@link FileFreshnessLedger}. */
|
|
5
|
+
export const LEDGER_MAX_ENTRIES = 5000;
|
|
14
6
|
export const FILE_NOT_READ_MESSAGE = "File has not been read yet. Read it first before writing to it.";
|
|
15
7
|
export const FILE_MODIFIED_MESSAGE = "File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.";
|
|
16
8
|
export const FILE_UNCHANGED_STUB = "File unchanged since last read. The content from the earlier Read tool_result in this conversation is still current; refer to that instead of re-reading.";
|
|
17
|
-
function clampContent(record) {
|
|
18
|
-
if (record.content === undefined)
|
|
19
|
-
return record;
|
|
20
|
-
if (Buffer.byteLength(record.content, "utf8") <= CONTENT_RETENTION_MAX_BYTES)
|
|
21
|
-
return record;
|
|
22
|
-
const { content: _dropped, ...rest } = record;
|
|
23
|
-
return rest;
|
|
24
|
-
}
|
|
25
9
|
export class FileFreshnessLedger {
|
|
10
|
+
// Map iteration order is insertion order: re-inserting on every touch keeps the
|
|
11
|
+
// least recently used entry first.
|
|
26
12
|
records = new Map();
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
maxEntries;
|
|
14
|
+
constructor(maxEntries = LEDGER_MAX_ENTRIES) {
|
|
15
|
+
this.maxEntries = maxEntries;
|
|
16
|
+
}
|
|
17
|
+
recordRead(path, input) {
|
|
18
|
+
const { content, ...rest } = input;
|
|
19
|
+
this.put(path, { ...rest, ...(content !== undefined ? { contentHash: hashFileContent(content) } : {}) });
|
|
29
20
|
}
|
|
30
21
|
/** A successful write makes the writer the last reader. */
|
|
31
|
-
recordWrite(path,
|
|
32
|
-
this.
|
|
33
|
-
version
|
|
22
|
+
recordWrite(path, options = {}) {
|
|
23
|
+
this.put(path, {
|
|
24
|
+
// No version: "the backend has no mtime for this" and "we did not spend a stat
|
|
25
|
+
// to learn it" reach the freshness check as the same thing — unverifiable by
|
|
26
|
+
// mtime, decided by content. One rule, not two.
|
|
27
|
+
version: options.version ?? {},
|
|
34
28
|
fullRead: true,
|
|
35
29
|
lineEndings: options.lineEndings ?? "LF",
|
|
36
30
|
encoding: options.encoding ?? "utf8",
|
|
37
31
|
readAt: Date.now(),
|
|
38
|
-
...(options.content !== undefined ? {
|
|
39
|
-
})
|
|
32
|
+
...(options.content !== undefined ? { contentHash: hashFileContent(options.content) } : {}),
|
|
33
|
+
});
|
|
40
34
|
}
|
|
41
35
|
get(path) {
|
|
42
|
-
|
|
36
|
+
const record = this.records.get(path);
|
|
37
|
+
if (record !== undefined) {
|
|
38
|
+
this.records.delete(path);
|
|
39
|
+
this.records.set(path, record);
|
|
40
|
+
}
|
|
41
|
+
return record;
|
|
42
|
+
}
|
|
43
|
+
put(path, record) {
|
|
44
|
+
this.records.delete(path);
|
|
45
|
+
this.records.set(path, record);
|
|
46
|
+
while (this.records.size > this.maxEntries) {
|
|
47
|
+
const oldest = this.records.keys().next().value;
|
|
48
|
+
if (oldest === undefined)
|
|
49
|
+
break;
|
|
50
|
+
this.records.delete(oldest);
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
delete(path) {
|
|
45
54
|
this.records.delete(path);
|
|
@@ -57,9 +66,9 @@ export async function checkFreshness(input) {
|
|
|
57
66
|
return { kind: "not-read" };
|
|
58
67
|
if (fileVersionsMatch(record.version, input.current))
|
|
59
68
|
return { kind: "fresh" };
|
|
60
|
-
if (record.fullRead && record.
|
|
69
|
+
if (record.fullRead && record.contentHash !== undefined && input.currentContent !== undefined) {
|
|
61
70
|
const currentText = await input.currentContent();
|
|
62
|
-
if (currentText !== undefined && currentText === record.
|
|
71
|
+
if (currentText !== undefined && hashFileContent(currentText) === record.contentHash)
|
|
63
72
|
return { kind: "fresh" };
|
|
64
73
|
}
|
|
65
74
|
return { kind: "stale" };
|
|
@@ -7,7 +7,7 @@ export interface FilesystemToolsOptions {
|
|
|
7
7
|
readonly mode?: "all" | "readonly";
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* The standard
|
|
10
|
+
* The standard environment-backed builtin tools as a single array — convenience
|
|
11
11
|
* sugar for assembling an agent's toolset (`tools: filesystemTools()`). It is
|
|
12
12
|
* NOT a capability or a new mechanism: these are the same tools exported
|
|
13
13
|
* individually from this package. Omit it entirely for a no-filesystem agent.
|
|
@@ -5,7 +5,7 @@ import { grepTool } from "./builtin/grep.js";
|
|
|
5
5
|
import { readTool } from "./builtin/read.js";
|
|
6
6
|
import { writeTool } from "./builtin/write.js";
|
|
7
7
|
/**
|
|
8
|
-
* The standard
|
|
8
|
+
* The standard environment-backed builtin tools as a single array — convenience
|
|
9
9
|
* sugar for assembling an agent's toolset (`tools: filesystemTools()`). It is
|
|
10
10
|
* NOT a capability or a new mechanism: these are the same tools exported
|
|
11
11
|
* individually from this package. Omit it entirely for a no-filesystem agent.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Environment } from "./environment.ts";
|
|
2
2
|
export interface GitContextOptions {
|
|
3
3
|
readonly maxDirtyFiles?: number;
|
|
4
4
|
readonly recentCommits?: number;
|
|
@@ -13,7 +13,7 @@ export interface GitContext {
|
|
|
13
13
|
readonly dirtyCount: number;
|
|
14
14
|
readonly recentCommits: readonly string[];
|
|
15
15
|
}
|
|
16
|
-
export declare function collectGitContext(
|
|
16
|
+
export declare function collectGitContext(environment: Environment, cwd: string, options?: GitContextOptions): Promise<GitContext>;
|
|
17
17
|
export declare function formatGitContext(ctx: GitContext): string;
|
|
18
18
|
export declare function sanitizeRemoteUrl(remoteUrl: string): string | null;
|
|
19
19
|
export declare function parseProjectName(remoteUrl: string): string | null;
|
package/dist/tool/git-context.js
CHANGED
|
@@ -3,17 +3,17 @@ const DEFAULT_MAX_DIRTY_FILES = 20;
|
|
|
3
3
|
const DEFAULT_RECENT_COMMITS = 3;
|
|
4
4
|
const MAX_COMMIT_LINE_LENGTH = 200;
|
|
5
5
|
const ALLOWED_HOSTS = ["github.com", "gitlab.com", "gitee.com", "bitbucket.org", "codeberg.org", "git.sr.ht"];
|
|
6
|
-
export async function collectGitContext(
|
|
6
|
+
export async function collectGitContext(environment, cwd, options = {}) {
|
|
7
7
|
const maxDirty = options.maxDirtyFiles ?? DEFAULT_MAX_DIRTY_FILES;
|
|
8
8
|
const nCommits = options.recentCommits ?? DEFAULT_RECENT_COMMITS;
|
|
9
|
-
if ((await runGit(
|
|
9
|
+
if ((await runGit(environment, cwd, ["rev-parse", "--is-inside-work-tree"])) === null) {
|
|
10
10
|
return { isRepo: false, cwd, dirtyFiles: [], dirtyCount: 0, recentCommits: [] };
|
|
11
11
|
}
|
|
12
12
|
const [remoteRaw, branchRaw, dirtyRaw, logRaw] = await Promise.all([
|
|
13
|
-
runGit(
|
|
14
|
-
runGit(
|
|
15
|
-
runGit(
|
|
16
|
-
runGit(
|
|
13
|
+
runGit(environment, cwd, ["remote", "get-url", "origin"]),
|
|
14
|
+
runGit(environment, cwd, ["branch", "--show-current"]),
|
|
15
|
+
runGit(environment, cwd, ["status", "--porcelain"]),
|
|
16
|
+
runGit(environment, cwd, ["log", `-${String(nCommits)}`, "--format=%h %s"]),
|
|
17
17
|
]);
|
|
18
18
|
const remote = remoteRaw !== null ? (sanitizeRemoteUrl(remoteRaw) ?? undefined) : undefined;
|
|
19
19
|
const project = remote !== undefined ? (parseProjectName(remote) ?? undefined) : undefined;
|
|
@@ -105,8 +105,8 @@ function tryUrlPath(remoteUrl) {
|
|
|
105
105
|
* the backend enforces it with its own kill (and a backend that cannot reports `timedOut`
|
|
106
106
|
* without pretending it stopped anything).
|
|
107
107
|
*/
|
|
108
|
-
async function runGit(
|
|
109
|
-
const result = await
|
|
108
|
+
async function runGit(environment, cwd, args) {
|
|
109
|
+
const result = await environment.run(["git", "-C", cwd, ...args], { timeoutMs: GIT_TIMEOUT_MS }).catch(() => undefined);
|
|
110
110
|
if (result === undefined || result.timedOut || result.exitCode !== 0)
|
|
111
111
|
return null;
|
|
112
112
|
return result.stdout.trim();
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
export type * from "./types.ts";
|
|
2
2
|
export { ToolAccesses } from "./access.ts";
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export type { SpawnedProcess } from "./machine-base.ts";
|
|
3
|
+
export type { Environment, EnvironmentFactory, EnvironmentOpenContext, DecodeErrors, OsInfo, OsKind, ShellName, } from "./environment.ts";
|
|
4
|
+
export type { ByteRange, RunCommandResult, DirEntry, OutputChunk, RunCommandOptions, FileInfo, FileKind, FileVersion, LineEndings, WriteTextOptions, WriteTextResult, } from "./environment.ts";
|
|
5
|
+
export { BaseEnvironment } from "./environment-base.ts";
|
|
6
|
+
export type { SpawnedProcess } from "./environment-base.ts";
|
|
8
7
|
export { materializeWorkspace, describeWorkspace, WorkspaceMaterializeError } from "./workspace-spec.ts";
|
|
9
8
|
export type { HostReader, MaterializeOptions, WorkspaceEntry, WorkspaceSpec } from "./workspace-spec.ts";
|
|
10
|
-
export { FileFreshnessLedger, checkFreshness,
|
|
11
|
-
export type { FileReadRecord, FreshnessVerdict, RecordWriteOptions, CheckFreshnessInput } from "./file-freshness.ts";
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
9
|
+
export { FileFreshnessLedger, checkFreshness, LEDGER_MAX_ENTRIES, FILE_NOT_READ_MESSAGE, FILE_MODIFIED_MESSAGE, FILE_UNCHANGED_STUB, } from "./file-freshness.ts";
|
|
10
|
+
export type { FileReadRecord, FreshnessVerdict, RecordReadInput, RecordWriteOptions, CheckFreshnessInput } from "./file-freshness.ts";
|
|
11
|
+
export { LocalEnvironment, detectOsInfo } from "./environment-local.ts";
|
|
12
|
+
export { NullEnvironment } from "./environment-null.ts";
|
|
14
13
|
export { nonInteractiveShellEnv, proxyEnv, PROXY_ENV_VARS } from "./shell-env.ts";
|
|
15
14
|
export type { NonInteractiveEnvOptions } from "./shell-env.ts";
|
|
16
15
|
export { collectGitContext, formatGitContext, sanitizeRemoteUrl, parseProjectName } from "./git-context.ts";
|
|
17
16
|
export type { GitContext, GitContextOptions } from "./git-context.ts";
|
|
18
|
-
export {
|
|
19
|
-
export type {
|
|
17
|
+
export { SshEnvironment } from "./environment-ssh.ts";
|
|
18
|
+
export type { SshEnvironmentOptions, SshEnvironmentExtraOptions } from "./environment-ssh.ts";
|
|
20
19
|
export type { BackgroundSpawner } from "./background.ts";
|
|
21
20
|
export { askUser } from "./ask.ts";
|
|
22
21
|
export { defineTool, tool } from "./define.ts";
|
|
@@ -26,7 +25,7 @@ export { writeTool } from "./builtin/write.ts";
|
|
|
26
25
|
export { editTool } from "./builtin/edit.ts";
|
|
27
26
|
export { readTool } from "./builtin/read.ts";
|
|
28
27
|
export { globTool } from "./builtin/glob.ts";
|
|
29
|
-
export { bashTool } from "./builtin/bash.ts";
|
|
28
|
+
export { bashTool, prepareBackgroundLog } from "./builtin/bash.ts";
|
|
30
29
|
export { grepTool } from "./builtin/grep.ts";
|
|
31
30
|
export { askUserQuestionTool } from "./builtin/ask-user-question.ts";
|
|
32
31
|
export type { QuestionOption, QuestionItem, QuestionRequest, QuestionAnswerValue, QuestionAnswers, QuestionAnswerMethod, QuestionResponse, QuestionResult, QuestionResponder, } from "./questions.ts";
|
|
@@ -34,4 +33,5 @@ export type { QuestionSpawnOptions } from "./background.ts";
|
|
|
34
33
|
export { filesystemTools } from "./filesystem-tools.ts";
|
|
35
34
|
export type { FilesystemToolsOptions } from "./filesystem-tools.ts";
|
|
36
35
|
export * from "./web/index.ts";
|
|
36
|
+
export { searchDeferredTools } from "./search/deferral.ts";
|
|
37
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tool/index.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
export { ToolAccesses } from "./access.js";
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
// Everything above is the CALLER's surface: `Machine` and the shapes its methods take and
|
|
2
|
+
// ── Writing an Environment backend ────────────────────────────────────────────────
|
|
3
|
+
// Everything above is the CALLER's surface: `Environment` and the shapes its methods take and
|
|
5
4
|
// return. What follows is the IMPLEMENTER's, and only a backend author needs it.
|
|
6
5
|
//
|
|
7
|
-
// Extend `
|
|
6
|
+
// Extend `BaseEnvironment` and it derives the high-level operations for you. Its process SPI —
|
|
8
7
|
// `spawn`, returning a `SpawnedProcess` — is what gets you `run` for free, and is optional:
|
|
9
8
|
// a transport with no OS process (a sandbox HTTP API, as in `operon-sandbox`) omits it and
|
|
10
9
|
// overrides `run` natively instead. Nothing outside the class hierarchy calls either one.
|
|
11
|
-
export {
|
|
10
|
+
export { BaseEnvironment } from "./environment-base.js";
|
|
12
11
|
export { materializeWorkspace, describeWorkspace, WorkspaceMaterializeError } from "./workspace-spec.js";
|
|
13
12
|
// Low-level file-op helpers (readTextFile / decodeText / …) are on
|
|
14
13
|
// `operon-agents-core/internal`.
|
|
15
|
-
export { FileFreshnessLedger, checkFreshness,
|
|
14
|
+
export { FileFreshnessLedger, checkFreshness, LEDGER_MAX_ENTRIES, FILE_NOT_READ_MESSAGE, FILE_MODIFIED_MESSAGE, FILE_UNCHANGED_STUB, } from "./file-freshness.js";
|
|
16
15
|
// Bash permission-rule matching helpers are on `operon-agents-core/internal`.
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
16
|
+
export { LocalEnvironment, detectOsInfo } from "./environment-local.js";
|
|
17
|
+
export { NullEnvironment } from "./environment-null.js";
|
|
19
18
|
export { nonInteractiveShellEnv, proxyEnv, PROXY_ENV_VARS } from "./shell-env.js";
|
|
20
19
|
export { collectGitContext, formatGitContext, sanitizeRemoteUrl, parseProjectName } from "./git-context.js";
|
|
21
|
-
export {
|
|
20
|
+
export { SshEnvironment } from "./environment-ssh.js";
|
|
22
21
|
export { askUser } from "./ask.js";
|
|
23
22
|
export { defineTool, tool } from "./define.js";
|
|
24
23
|
export { globApproval } from "./support/tool-path.js";
|
|
@@ -26,9 +25,12 @@ export { writeTool } from "./builtin/write.js";
|
|
|
26
25
|
export { editTool } from "./builtin/edit.js";
|
|
27
26
|
export { readTool } from "./builtin/read.js";
|
|
28
27
|
export { globTool } from "./builtin/glob.js";
|
|
29
|
-
export { bashTool } from "./builtin/bash.js";
|
|
28
|
+
export { bashTool, prepareBackgroundLog } from "./builtin/bash.js";
|
|
30
29
|
export { grepTool } from "./builtin/grep.js";
|
|
31
30
|
export { askUserQuestionTool } from "./builtin/ask-user-question.js";
|
|
32
31
|
export { filesystemTools } from "./filesystem-tools.js";
|
|
33
32
|
export * from "./web/index.js";
|
|
33
|
+
// The keyword search behind SearchTool, for other surfaces that look tools up by intent
|
|
34
|
+
// (Code Mode's `searchTools`).
|
|
35
|
+
export { searchDeferredTools } from "./search/deferral.js";
|
|
34
36
|
//# sourceMappingURL=index.js.map
|