@dynamicagents/plugins 0.12.0 → 0.14.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.
Files changed (132) hide show
  1. package/README.md +58 -77
  2. package/dist/browser/index.d.ts +0 -2
  3. package/dist/browser/index.js +21 -27
  4. package/dist/claude-code/cards.d.ts +55 -0
  5. package/dist/claude-code/cards.js +283 -0
  6. package/dist/claude-code/config.d.ts +28 -63
  7. package/dist/claude-code/config.js +0 -11
  8. package/dist/claude-code/egress.d.ts +8 -1
  9. package/dist/claude-code/egress.js +42 -4
  10. package/dist/claude-code/events.d.ts +106 -9
  11. package/dist/claude-code/events.js +201 -56
  12. package/dist/claude-code/github.d.ts +39 -0
  13. package/dist/claude-code/github.js +82 -0
  14. package/dist/claude-code/index.d.ts +16 -90
  15. package/dist/claude-code/index.js +14 -276
  16. package/dist/claude-code/model.d.ts +152 -0
  17. package/dist/claude-code/model.js +366 -0
  18. package/dist/claude-code/run.d.ts +230 -116
  19. package/dist/claude-code/run.js +380 -167
  20. package/dist/claude-code/session.d.ts +131 -0
  21. package/dist/claude-code/session.js +288 -0
  22. package/dist/claude-code/spec.d.ts +46 -0
  23. package/dist/claude-code/spec.js +83 -0
  24. package/dist/claude-code/verified.d.ts +15 -0
  25. package/dist/claude-code/verified.js +15 -0
  26. package/dist/computer/context.d.ts +1 -5
  27. package/dist/computer/context.js +7 -10
  28. package/dist/computer/file-lock.js +5 -4
  29. package/dist/computer/gate.d.ts +4 -4
  30. package/dist/computer/gate.js +5 -5
  31. package/dist/computer/index.d.ts +40 -258
  32. package/dist/computer/index.js +71 -324
  33. package/dist/computer/paths.d.ts +36 -16
  34. package/dist/computer/paths.js +42 -29
  35. package/dist/computer/proxy.d.ts +45 -0
  36. package/dist/computer/proxy.js +234 -0
  37. package/dist/computer/render.d.ts +1 -40
  38. package/dist/computer/render.js +2 -68
  39. package/dist/computer/tools-exec.js +12 -13
  40. package/dist/computer/tools-file.d.ts +9 -1
  41. package/dist/computer/tools-file.js +22 -82
  42. package/dist/computer/{tools-find.d.ts → tools-grep.d.ts} +1 -1
  43. package/dist/computer/tools-grep.js +129 -0
  44. package/dist/repo/checkout.d.ts +4 -5
  45. package/dist/repo/checkout.js +31 -8
  46. package/dist/repo/context.d.ts +35 -9
  47. package/dist/repo/context.js +101 -49
  48. package/dist/repo/index.d.ts +73 -28
  49. package/dist/repo/index.js +112 -96
  50. package/dist/repo/tools-checks.d.ts +3 -0
  51. package/dist/repo/tools-checks.js +112 -0
  52. package/dist/repo/tools-clone.js +1 -1
  53. package/dist/repo/tools-pr.d.ts +14 -0
  54. package/dist/repo/{tools-forge.js → tools-pr.js} +53 -36
  55. package/dist/repo/tools-review.d.ts +9 -0
  56. package/dist/repo/tools-review.js +67 -47
  57. package/dist/repo/tools-worktree.js +144 -60
  58. package/dist/repo/tools-worktrees.d.ts +12 -0
  59. package/dist/repo/tools-worktrees.js +48 -0
  60. package/dist/repo/url.d.ts +2 -2
  61. package/dist/repo/url.js +7 -7
  62. package/dist/scratch/index.d.ts +4 -4
  63. package/dist/scratch/index.js +12 -11
  64. package/dist/{computer → workspace}/advisory.d.ts +4 -4
  65. package/dist/{computer → workspace}/advisory.js +2 -2
  66. package/dist/{computer/host → workspace}/ca-trust.d.ts +8 -1
  67. package/dist/{computer/host → workspace}/ca-trust.js +12 -3
  68. package/dist/{computer/host → workspace}/container-deps.d.ts +4 -0
  69. package/dist/{computer/host → workspace}/container-deps.js +26 -1
  70. package/dist/{computer/host → workspace}/container-fault.d.ts +3 -3
  71. package/dist/{computer/host → workspace}/container-fault.js +23 -8
  72. package/dist/workspace/deps-snapshot.d.ts +110 -0
  73. package/dist/workspace/deps-snapshot.js +424 -0
  74. package/dist/workspace/exec.d.ts +94 -0
  75. package/dist/workspace/exec.js +153 -0
  76. package/dist/workspace/format.d.ts +36 -0
  77. package/dist/workspace/format.js +57 -0
  78. package/dist/{computer/host → workspace}/git-host.d.ts +21 -4
  79. package/dist/{computer/host → workspace}/git-host.js +72 -2
  80. package/dist/{computer/host → workspace}/git-identity.d.ts +1 -1
  81. package/dist/{computer/host → workspace}/git-identity.js +1 -1
  82. package/dist/workspace/index.d.ts +44 -47
  83. package/dist/workspace/index.js +52 -112
  84. package/dist/{computer/host → workspace}/install-job.d.ts +53 -4
  85. package/dist/{computer/host → workspace}/install-job.js +346 -178
  86. package/dist/{computer → workspace}/install.d.ts +17 -8
  87. package/dist/{computer → workspace}/install.js +24 -6
  88. package/dist/{computer/host/workspace.d.ts → workspace/object.d.ts} +125 -27
  89. package/dist/{computer/host/workspace.js → workspace/object.js} +341 -58
  90. package/dist/workspace/open.d.ts +95 -0
  91. package/dist/workspace/open.js +63 -0
  92. package/dist/workspace/read.d.ts +16 -0
  93. package/dist/workspace/read.js +22 -0
  94. package/dist/{computer → workspace}/shell.d.ts +5 -5
  95. package/dist/{computer → workspace}/shell.js +6 -6
  96. package/dist/{computer/host → workspace}/wake.d.ts +3 -1
  97. package/package.json +17 -37
  98. package/dist/arc-agi/analysis.d.ts +0 -322
  99. package/dist/arc-agi/analysis.js +0 -802
  100. package/dist/arc-agi/client.d.ts +0 -82
  101. package/dist/arc-agi/client.js +0 -113
  102. package/dist/arc-agi/game-tools.d.ts +0 -24
  103. package/dist/arc-agi/game-tools.js +0 -26
  104. package/dist/arc-agi/index.d.ts +0 -40
  105. package/dist/arc-agi/index.js +0 -175
  106. package/dist/arc-agi/main-agent.d.ts +0 -24
  107. package/dist/arc-agi/main-agent.js +0 -62
  108. package/dist/arc-agi/recipe.d.ts +0 -48
  109. package/dist/arc-agi/recipe.js +0 -97
  110. package/dist/arc-agi/scorecard.d.ts +0 -118
  111. package/dist/arc-agi/scorecard.js +0 -163
  112. package/dist/arc-agi/soul.d.ts +0 -29
  113. package/dist/arc-agi/soul.js +0 -79
  114. package/dist/arc-agi/store.d.ts +0 -153
  115. package/dist/arc-agi/store.js +0 -215
  116. package/dist/arc-agi/tools.d.ts +0 -36
  117. package/dist/arc-agi/tools.js +0 -574
  118. package/dist/arc-agi/types.d.ts +0 -211
  119. package/dist/arc-agi/types.js +0 -19
  120. package/dist/claude-code/recipe.d.ts +0 -53
  121. package/dist/claude-code/recipe.js +0 -100
  122. package/dist/computer/read.d.ts +0 -133
  123. package/dist/computer/read.js +0 -200
  124. package/dist/computer/tools-find.js +0 -216
  125. package/dist/recall/index.d.ts +0 -105
  126. package/dist/recall/index.js +0 -181
  127. package/dist/repo/tools-forge.d.ts +0 -4
  128. package/dist/triage/index.d.ts +0 -360
  129. package/dist/triage/index.js +0 -311
  130. /package/dist/{computer/host → workspace}/sync.d.ts +0 -0
  131. /package/dist/{computer/host → workspace}/sync.js +0 -0
  132. /package/dist/{computer/host → workspace}/wake.js +0 -0
@@ -1,8 +1,8 @@
1
- import { type WorkspaceAdvisory } from "./advisory.js";
1
+ import { type WorkspaceAdvisory } from "../workspace/advisory.js";
2
2
  /**
3
3
  * What one shell command has to wait for, and what to say when it never ran.
4
4
  *
5
- * {@link file://./advisory.ts} decides what is true about the workspace and how
5
+ * {@link file://../workspace/advisory.ts} decides what is true about the workspace and how
6
6
  * to word it; this file decides what that means for a command about to run.
7
7
  * {@link needsDependencies} is the part that cannot move there — it is a
8
8
  * question about the *command*, and it is what stops `cat README.md` queueing
@@ -12,7 +12,7 @@ import { type WorkspaceAdvisory } from "./advisory.js";
12
12
  * replaced underneath a command that was running.
13
13
  */
14
14
  /**
15
- * The one `sb_exec` failure that is not the command's fault.
15
+ * The one `bash` failure that is not the command's fault.
16
16
  *
17
17
  * An execution running when the container is replaced throws `EEXEC_LOST`.
18
18
  * Unexplained, the model receives `Execution "…" was lost when its container
@@ -75,7 +75,7 @@ export declare function execGate(advisories: readonly WorkspaceAdvisory[], comma
75
75
  /**
76
76
  * Whether a write should happen at all, and what to say when it should not.
77
77
  *
78
- * `sb_write` and `sb_edit` do not go through {@link execGate}: they run no
78
+ * `write`, `edit` and `delete` do not go through {@link execGate}: they run no
79
79
  * command, and a dependency install has nothing to do with writing source. One
80
80
  * thing does reach them, and it is the worst of the set — a workspace that
81
81
  * accepts no further writes takes an edit, reports the character count, and
@@ -1,8 +1,8 @@
1
- import { renderAdvisory, shapeOf } from "./advisory.js";
1
+ import { renderAdvisory, shapeOf } from "../workspace/advisory.js";
2
2
  /**
3
3
  * What one shell command has to wait for, and what to say when it never ran.
4
4
  *
5
- * {@link file://./advisory.ts} decides what is true about the workspace and how
5
+ * {@link file://../workspace/advisory.ts} decides what is true about the workspace and how
6
6
  * to word it; this file decides what that means for a command about to run.
7
7
  * {@link needsDependencies} is the part that cannot move there — it is a
8
8
  * question about the *command*, and it is what stops `cat README.md` queueing
@@ -12,7 +12,7 @@ import { renderAdvisory, shapeOf } from "./advisory.js";
12
12
  * replaced underneath a command that was running.
13
13
  */
14
14
  /**
15
- * The one `sb_exec` failure that is not the command's fault.
15
+ * The one `bash` failure that is not the command's fault.
16
16
  *
17
17
  * An execution running when the container is replaced throws `EEXEC_LOST`.
18
18
  * Unexplained, the model receives `Execution "…" was lost when its container
@@ -76,7 +76,7 @@ export function execGate(advisories, command) {
76
76
  /**
77
77
  * Whether a write should happen at all, and what to say when it should not.
78
78
  *
79
- * `sb_write` and `sb_edit` do not go through {@link execGate}: they run no
79
+ * `write`, `edit` and `delete` do not go through {@link execGate}: they run no
80
80
  * command, and a dependency install has nothing to do with writing source. One
81
81
  * thing does reach them, and it is the worst of the set — a workspace that
82
82
  * accepts no further writes takes an edit, reports the character count, and
@@ -108,7 +108,7 @@ export function writeGate(advisories) {
108
108
  * Position is what makes this usable rather than merely cautious. Matching these
109
109
  * anywhere in the string looks equivalent and is not: `\bvitest\b` also fires on
110
110
  * `cat vitest.config.ts`, and `next.config.js`, `eslint.config.js` and
111
- * `vite.config.ts` are exactly the files a subagent reads while orienting itself.
111
+ * `vite.config.ts` are exactly the files an agent reads while orienting itself.
112
112
  * Every one of those reads would then queue behind an `npm ci` it has no use for,
113
113
  * which is the cost this whole check exists to remove.
114
114
  */
@@ -1,196 +1,41 @@
1
1
  import type { ToolSet } from "ai";
2
2
  import type { AgentPlugin } from "@dynamicagents/core";
3
- import type { WorkspaceClient, WorkspaceStub } from "@cloudflare/computer";
4
- import type { WorkspaceAdvisory } from "./advisory.js";
3
+ import type { WorkspaceClient } from "@cloudflare/computer";
4
+ import type { WorkspaceAdvisory } from "../workspace/advisory.js";
5
+ import type { WorkspaceClientConfig } from "../workspace/exec.js";
5
6
  /**
6
- * `@dynamicagents/plugins/computer` — a Linux container whose filesystem outlives it.
7
+ * `@dynamicagents/plugins/computer` — an agent's tools over a container
8
+ * workspace: `bash`, `grep` and `edit`, and `computerWorkspace`, the agent's own
9
+ * `this.workspace`, which Think's `read`, `write`, `delete`, `find` and `list`
10
+ * go through.
7
11
  *
8
- * The filesystem **is** a Durable Object's SQLite, mounted into the container
9
- * over FUSE by `computerd`. Commands see a normal `/workspace`; the Worker reads
10
- * the same tree over RPC; and when the container is replaced the tree is pushed
11
- * back into the new one.
12
+ * The workspace itself — the Durable Object, its container, its git, its
13
+ * install — is `@dynamicagents/plugins/workspace`. This plugin reaches it only
14
+ * through that subpath's client modules, never its object, so an agent that
15
+ * holds the tools carries no container backend and no isomorphic-git.
12
16
  *
13
- * Not to be confused with `@dynamicagents/plugins/workspace`, which is a virtual
14
- * filesystem with no processes and nothing to run. Install exactly one
15
- * filesystem plugin — an agent holding two gives the model no way to know which
16
- * one a path refers to.
17
+ * The agent's own workspace has to be this one — `computerWorkspace` — or
18
+ * Think's `read` and `write` would work on a different tree from `bash`. The
19
+ * plugin refuses to start otherwise; see `./proxy.ts`.
17
20
  *
18
21
  * ## The dependency tree is not in the workspace
19
22
  *
20
23
  * The one thing to internalise before reading further. A package root's
21
24
  * `node_modules` is a bind mount of the container's disk, so installs never
22
- * sync, and a new container reinstalls — see `./host/container-deps.ts`. The file tools read
23
- * the workspace, so they refuse it; `sb_exec` reaches it. `paths.ts` owns what a
24
- * path may be and what walks drop.
25
- *
26
- * Requires the Workers **Paid** plan (containers) and a Durable Object binding
27
- * whose class owns the workspace — see the README for the wrangler block.
25
+ * sync, and a new container reinstalls — see `/workspace`'s
26
+ * `container-deps.ts`. The file tools read the workspace, so they refuse it;
27
+ * `bash` reaches it. `paths.ts` owns what a path may be and what walks drop.
28
28
  */
29
29
  /**
30
- * How a repository installs its dependencies — the mechanical half.
31
- *
32
- * Re-exported from the plugin's one entry point rather than given a subpath of
33
- * its own: `verify:exports` treats each subpath as an isolated realm, and a host
34
- * needs the resolver and the tools together anyway.
30
+ * The helpers this plugin's own tests reach for, re-exported from the one
31
+ * entry point. `verify:exports` treats `./computer` as one realm, so what it
32
+ * exports must not move when the files behind it do.
35
33
  */
36
- export { DEFAULT_INSTALL_PLAN, installFingerprint, resolveInstallCommand, type InstallPlan, type InstallProbe, type InstallResolution, type InstallRule, type InstallState } from "./install.js";
37
- /**
38
- * The helpers this plugin's own tests and hosts reach for, re-exported from the
39
- * one entry point.
40
- *
41
- * They live in sibling modules — `paths.ts`, `render.ts`, `gate.ts` — because
42
- * this file was 1,900 lines and the seams were obvious. The subpath is the unit a
43
- * consumer imports, so what it exports must not move when the files behind it do:
44
- * `verify:exports` treats `./computer` as one realm, and everything below stays
45
- * inside `dist/computer/`.
46
- */
47
- export { isGitInternal, WALK_SKIPS } from "./paths.js";
48
- export { cancelledNote, packBlocks, renderGrepMatches, renderResult, syncPendingNote, truncateOutput } from "./render.js";
34
+ export { isGitInternal, SESSION_STATE_DIR, WALK_SKIPS } from "./paths.js";
35
+ export { packBlocks, renderGrepMatches, renderResult, syncPendingNote } from "./render.js";
49
36
  export { execGate, needsDependencies, writeGate, type ExecGate } from "./gate.js";
50
- /**
51
- * The workspace-advisory vocabulary, which a host needs all of: the type to
52
- * return over RPC, `deriveAdvisories` to build it from what it already knows,
53
- * and `sessionAdvisory` for a host driving a whole session rather than one
54
- * command. `shapeOf` and `renderAdvisory` are exported for the specs that hold
55
- * their exhaustiveness — a host has no reason to call either, since calling them
56
- * would mean writing policy or wording that has one home already.
57
- */
58
- export { deriveAdvisories, renderAdvisory, sessionAdvisory, shapeOf, type AdvisoryAudience, type AdvisoryInput, type AdvisoryShape, type WorkspaceAdvisory } from "./advisory.js";
59
- export { pathExists } from "./read.js";
60
- /**
61
- * This plugin's tool-family name, as a recipe's `toolFamilies` lists it.
62
- *
63
- * `"sandbox"` names the capability — a shell and a filesystem — rather than the
64
- * package providing it, and it appears in recipes, souls and allowlists that
65
- * have nothing to do with either. Renaming it would have `validateRecipe`
66
- * silently drop the family from every recipe that still says `sandbox`: a
67
- * subagent with no tools and no error explaining why.
68
- */
69
- export declare const SANDBOX_FAMILY = "sandbox";
70
- /**
71
- * Where a parent puts the workspace name so its subagents reach the same one.
72
- *
73
- * A subagent cannot compute this itself. The name is derived from the verified
74
- * caller and the repository, and core deliberately gives a subagent execution a
75
- * `callerKey` thunk that **throws** — "a subagent execution has no caller
76
- * identity". So a facet running a `code` subtask would fail at its first tool
77
- * call, with the parent's checkout sitting in a workspace it cannot name.
78
- *
79
- * `resolveRuntime` runs on the parent, where the name resolves, and its return
80
- * value reaches every tool family as `ToolFamilyContext.runtime`. That is the
81
- * channel core built for exactly this, and it is emphatically *not* `params`,
82
- * which are declared in the subtask type's schema and rendered to the delegating
83
- * model — a workspace name there would be model-authored, and a model naming
84
- * another caller's workspace would get that caller's files.
85
- */
86
- export declare const WORKSPACE_RUNTIME_KEY = "workspaceName";
87
- /**
88
- * Read a parent-resolved workspace name off a subtask's runtime state.
89
- *
90
- * Returns `undefined` rather than throwing on anything unexpected: the main
91
- * agent's tools have no runtime at all, and falling back to the configured thunk
92
- * is right there.
93
- */
94
- export declare function workspaceNameFromRuntime(runtime: unknown): string | undefined;
95
- export { withShell, withShellTranscript } from "./shell.js";
96
- /**
97
- * The Durable Object the workspace lives in, as this plugin needs to see it.
98
- *
99
- * Structural rather than imported: the class is the host's — it owns the
100
- * container binding, the alarm and the install job — and a plugin that imported
101
- * it would stop a second host from bringing its own. `__getWorkspaceStub` is the
102
- * one method `getWorkspace()` calls across the boundary, and it is what
103
- * `withWorkspace` installs (or what a host that constructs `Workspace` itself
104
- * reimplements, which is the same three lines).
105
- */
106
- export interface WorkspaceHost extends Rpc.DurableObjectBranded {
107
- __getWorkspaceStub(): Promise<WorkspaceStub>;
108
- /**
109
- * The same workspace for filesystem-only work, which the host must serve
110
- * **without starting a container**.
111
- *
112
- * The filesystem is the Durable Object's own SQLite, while the first command
113
- * in a fresh container waits for the whole tree to be pushed into it — so a
114
- * file tool served the other way waits minutes for a local `readdir`. See
115
- * `WorkspaceObjectBase.__getWorkspaceFsStub` in `./host/workspace.ts`.
116
- *
117
- * Required rather than optional, for the reason {@link advisories} gives. A
118
- * host with nothing to distinguish returns its own `__getWorkspaceStub()`.
119
- */
120
- __getWorkspaceFsStub(): Promise<WorkspaceStub>;
121
- /**
122
- * Everything currently true about the workspace that a caller must not assume
123
- * away — see {@link file://./advisory.ts}. An empty array is the good case.
124
- *
125
- * Required rather than optional, and not only because Workers RPC types an
126
- * optional method as a union nothing can call. A host with nothing to report
127
- * returns `[]` in one line; a host that forgot to expose it gets a compile
128
- * error instead of an `sb_exec` that silently runs against a half-built
129
- * `node_modules`, or against a workspace whose writes are being dropped.
130
- *
131
- * `deriveAdvisories` builds the array from what the host already knows, so
132
- * implementing this is gathering what the host has rather than writing policy.
133
- */
134
- advisories(): Promise<readonly WorkspaceAdvisory[]>;
135
- }
136
- /**
137
- * Open the workspace behind a Durable Object stub.
138
- *
139
- * The cast is unavoidable, and narrow enough to be worth isolating here rather
140
- * than repeating. `getWorkspace` wants a handle whose `__getWorkspaceStub()`
141
- * resolves to a `WorkspaceStub` — the concrete class, private fields and all.
142
- * Across a Durable Object boundary Workers RPC hands back a structural
143
- * `Stub<WorkspaceStub>`, which forwards every method faithfully but carries none
144
- * of the class's private brand: runtime-compatible, type-incompatible. This is
145
- * the only place in the plugin that gap is crossed.
146
- */
147
- export declare function openWorkspace(host: DurableObjectStub<WorkspaceHost>): Promise<WorkspaceClient>;
148
- /**
149
- * The same workspace, opened for filesystem work alone.
150
- *
151
- * `getWorkspace` calls exactly one method on what it is handed, so the host is
152
- * wrapped in an object answering it from the other side of the seam — see
153
- * {@link WorkspaceHost.__getWorkspaceFsStub}. Everything past that is identical.
154
- *
155
- * **Only the file tools take this.** `sb_exec` and {@link computerExec} need the
156
- * container started and its CA installed, so they open it the other way.
157
- */
158
- export declare function openWorkspaceFs(host: DurableObjectStub<WorkspaceHost>): Promise<WorkspaceClient>;
159
- export interface ComputerConfig {
160
- /**
161
- * The Durable Object namespace holding workspaces, closed over at
162
- * instantiation so it is never model input.
163
- */
164
- binding: DurableObjectNamespace<WorkspaceHost>;
165
- /**
166
- * Which workspace this agent gets, by name. A thunk because the useful name —
167
- * caller plus repository — does not exist when the plugin list is built.
168
- *
169
- * One workspace is one container is one repository: `@cloudflare/computer`
170
- * pairs a Durable Object with exactly one container, so "never mix two
171
- * repositories" is structural here rather than a convention to maintain.
172
- */
173
- workspaceName: () => string;
174
- /** Working directory for every command. Defaults to `/workspace`. */
175
- cwd?: string;
176
- /**
177
- * Run every command through this shell, e.g. `"bash"`. Unset, the command
178
- * string goes to the runtime as-is and lands on whatever `/bin/sh` is.
179
- *
180
- * Worth setting, because "whatever `/bin/sh` is" is **dash** on Debian and
181
- * Ubuntu, and a model writing shell writes *bash*. `${PIPESTATUS[0]}` is the
182
- * one that costs most — a bash builtin a model reaches for to read a piped exit
183
- * code, which dash fails with exit 2, after the command it wrapped has already
184
- * run. It is one member of a family (`[[ ]]`, arrays, `set -o pipefail`,
185
- * process substitution), so the fix is the shell rather than a note in a prompt
186
- * telling the model to write POSIX.
187
- *
188
- * Set it only if the image actually has that shell: a missing one fails *every*
189
- * command rather than the bash-flavoured ones.
190
- */
191
- shell?: string;
192
- /** Per-command timeout. Defaults to ten minutes. */
193
- timeoutMs?: number;
37
+ export { computerWorkspace, isComputerWorkspace } from "./proxy.js";
38
+ export interface ComputerConfig extends WorkspaceClientConfig {
194
39
  /**
195
40
  * Output ceiling per command, in **characters**. Defaults to 16,000.
196
41
  *
@@ -205,33 +50,31 @@ export interface ComputerConfig {
205
50
  * characters far better than they track UTF-8 bytes. So the name moved to meet
206
51
  * the implementation rather than the other way round.
207
52
  *
208
- * `sb_read` is the one place a byte bound survives, and it is derived from
209
- * this rather than separate — see `readBounded`.
210
53
  */
211
54
  maxOutputChars?: number;
212
55
  /**
213
- * How long `sb_exec` waits for a running dependency install before giving the
56
+ * How long `bash` waits for a running dependency install before giving the
214
57
  * turn back. Defaults to 90 seconds.
215
58
  *
216
- * Bounded rather than open-ended because the wait happens inside a subagent's
217
- * chunk, and a tool call that blocks for the length of an `npm ci` is exactly
218
- * the thing moving the install out of the round loop was meant to prevent. On
219
- * expiry the tool runs nothing and says so, which costs one cheap turn.
59
+ * Bounded rather than open-ended because the wait happens inside a turn, and
60
+ * a tool call that blocks for the length of an `npm ci` is exactly what
61
+ * running the install as the host's own job was meant to prevent. On expiry
62
+ * the tool runs nothing and says so, which costs one cheap step.
220
63
  */
221
64
  installGateMs?: number;
222
65
  /**
223
66
  * Environment merged into every command **these tools** run — a registry host,
224
67
  * a `CI` flag, proxy settings. Host-supplied and never model input.
225
68
  *
226
- * "These tools" is exact: {@link computerExec} deliberately does not merge it,
227
- * so a proxy set here does not reach the git that `@dynamicagents/plugins/repo`
228
- * runs through that export. The reasoning, and how a host opts in explicitly,
229
- * is written up there.
69
+ * "These tools" is exact: `/workspace`'s `workspaceExec` deliberately does not
70
+ * merge it, so a proxy set here does not reach the git that
71
+ * `@dynamicagents/plugins/repo` runs through that export. The reasoning, and
72
+ * how a host opts in explicitly, is written up there.
230
73
  *
231
74
  * ## Put no secret here
232
75
  *
233
- * *Every* command gets this environment, and `sb_exec`'s command is written by
234
- * the model: `sb_exec("printenv")` prints all of it, and so does a
76
+ * *Every* command gets this environment, and `bash`'s command is written by
77
+ * the model: `bash("printenv")` prints all of it, and so does a
235
78
  * `postinstall` script in a repository the agent was asked to clone, which
236
79
  * nobody vetted.
237
80
  *
@@ -245,7 +88,7 @@ export interface ComputerConfig {
245
88
  *
246
89
  * Do not hand the agent the credential; hand it the *action*. Keep the secret
247
90
  * on the Worker and expose one tool that makes the call it is for.
248
- * `@dynamicagents/plugins/repo` is the worked example: it holds a forge token, calls
91
+ * `@dynamicagents/plugins/repo` is the worked example: it holds a GitHub token, calls
249
92
  * the API from the Worker, and runs clone, fetch and push on the host's side of
250
93
  * the boundary. **No command in its container is ever given that token.**
251
94
  */
@@ -262,70 +105,9 @@ export interface ComputerConfig {
262
105
  */
263
106
  export declare function buildComputerTools(workspace: () => Promise<WorkspaceClient>, config: ComputerConfig, advisories?: () => Promise<readonly WorkspaceAdvisory[]>, fsWorkspace?: () => Promise<WorkspaceClient>, lockScope?: () => string): ToolSet;
264
107
  /**
265
- * An `exec` bound to this workspace, for plugins that need a shell but should
266
- * not own a container.
267
- *
268
- * `@dynamicagents/plugins/repo` is the reason this exists: it needs `git` on a real
269
- * shell, but depending on this module would weld the two together and stop a
270
- * host from pointing it at its own container. Structurally typed for the same
271
- * reason — the two plugins compose without either importing the other.
272
- *
273
- * ## {@link ComputerConfig.env} is deliberately **not** merged here
274
- *
275
- * {@link buildComputerTools} merges it into every command; this does not.
276
- *
277
- * What this hands out is a raw shell to *another plugin*, whose commands this
278
- * module neither writes nor sees. `/repo` runs its unauthenticated git through
279
- * it and pins the environment those need — `GIT_TERMINAL_PROMPT=0` plus the
280
- * model-authored values it passes as variables. A host environment merged
281
- * underneath lets through every key it does *not* pin: `http_proxy`,
282
- * `GIT_PROXY_COMMAND`, `GIT_SSL_CAINFO`, `GIT_CONFIG_GLOBAL`, `GIT_EXEC_PATH` —
283
- * the last two redirect the config git reads and relocate its helper binaries.
284
- *
285
- * No token is at stake, since the credentialed operations do not run here at
286
- * all. The point is that changing what git does inside another plugin's commands
287
- * should not be something a container plugin's config field does by accident,
288
- * from a host that only meant to set a registry. A host that wants it composes
289
- * it where the merge is visible:
290
- *
291
- * ```ts
292
- * exec: (command, options) =>
293
- * computerExec(config)(command, {
294
- * ...options,
295
- * env: { ...mine, ...options?.env }
296
- * });
297
- * ```
108
+ * The container plugin. Its tools reach the workspace through the agent's own
109
+ * `computerWorkspace` — the one Think's `read` and `write` use — so the two can
110
+ * never resolve different ones. `config` answers everything else: the shell,
111
+ * the limits, the environment.
298
112
  */
299
- export declare function computerExec(config: ComputerConfig): (command: string, options?: {
300
- cwd?: string;
301
- env?: Record<string, string | undefined>;
302
- timeout?: number;
303
- runtime?: unknown;
304
- }) => Promise<{
305
- success: boolean;
306
- stdout: string;
307
- stderr: string;
308
- exitCode: number;
309
- }>;
310
113
  export declare function computer(config: ComputerConfig): AgentPlugin;
311
- /**
312
- * The Durable Object everything above talks to.
313
- *
314
- * `./host/` is a directory rather than a subpath of its own, and that is the
315
- * point: one capability is one import path, so a consumer cannot install the
316
- * tools and miss the object they address. The two halves have opposite bundle
317
- * costs — an agent that only calls `sb_exec` carries no container backend and no
318
- * isomorphic-git — and `"sideEffects": false` is what keeps that true, since
319
- * nothing here references the host unless the consumer does.
320
- *
321
- * The dependency runs one way for a mechanical reason: `./host/` imports the
322
- * leaf modules beside this file, never this barrel, because this barrel
323
- * re-exports `./host/` and a cycle through a module that builds a class at
324
- * import time is a base that evaluates `undefined`.
325
- */
326
- export { WorkspaceObjectBase, WORKSPACE_DIR, workspaceName, type WorkspaceObjectConfig, type WorkspaceGitConfig } from "./host/workspace.js";
327
- export { InstallJob, type InstallJobDeps } from "./host/install-job.js";
328
- export { WorkspaceSync, SYNC_DRAIN_BUDGET_MS, SYNC_DRAIN_RESUME_MS, SYNC_DRAIN_MAX_BACKOFF_MS, syncRetryDelayMs, type DrainOutcome, type SyncDrainIntent, type WorkspaceSyncDeps } from "./host/sync.js";
329
- export { ContainerTrust, TRUST_CA_COMMAND, type ContainerTrustDeps } from "./host/ca-trust.js";
330
- export { WorkspaceGitHost, type GitHostDeps } from "./host/git-host.js";
331
- export type { WorkspaceWakeHandlers } from "./host/wake.js";