@dynamicagents/plugins 0.11.1 → 0.12.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 (94) hide show
  1. package/README.md +12 -13
  2. package/dist/arc-agi/analysis.d.ts +16 -30
  3. package/dist/arc-agi/analysis.js +20 -47
  4. package/dist/arc-agi/game-tools.d.ts +5 -6
  5. package/dist/arc-agi/index.d.ts +6 -8
  6. package/dist/arc-agi/index.js +3 -3
  7. package/dist/arc-agi/main-agent.d.ts +5 -8
  8. package/dist/arc-agi/main-agent.js +5 -8
  9. package/dist/arc-agi/recipe.d.ts +17 -20
  10. package/dist/arc-agi/recipe.js +17 -20
  11. package/dist/arc-agi/soul.d.ts +16 -27
  12. package/dist/arc-agi/soul.js +16 -27
  13. package/dist/arc-agi/store.d.ts +4 -5
  14. package/dist/arc-agi/store.js +4 -5
  15. package/dist/arc-agi/tools.d.ts +1 -1
  16. package/dist/arc-agi/tools.js +10 -12
  17. package/dist/arc-agi/types.d.ts +6 -7
  18. package/dist/claude-code/config.d.ts +88 -11
  19. package/dist/claude-code/config.js +11 -2
  20. package/dist/claude-code/credentials.d.ts +21 -9
  21. package/dist/claude-code/credentials.js +43 -9
  22. package/dist/claude-code/egress.d.ts +7 -13
  23. package/dist/claude-code/egress.js +9 -10
  24. package/dist/claude-code/events.d.ts +47 -0
  25. package/dist/claude-code/events.js +96 -10
  26. package/dist/claude-code/index.d.ts +31 -13
  27. package/dist/claude-code/index.js +62 -15
  28. package/dist/claude-code/run.d.ts +135 -41
  29. package/dist/claude-code/run.js +366 -61
  30. package/dist/computer/advisory.d.ts +31 -18
  31. package/dist/computer/advisory.js +30 -5
  32. package/dist/computer/context.d.ts +23 -0
  33. package/dist/computer/context.js +225 -0
  34. package/dist/computer/file-lock.d.ts +5 -0
  35. package/dist/computer/file-lock.js +39 -0
  36. package/dist/computer/gate.d.ts +8 -8
  37. package/dist/computer/gate.js +7 -7
  38. package/dist/computer/host/ca-trust.d.ts +88 -0
  39. package/dist/computer/host/ca-trust.js +303 -0
  40. package/dist/computer/host/container-deps.d.ts +54 -0
  41. package/dist/computer/host/container-deps.js +224 -0
  42. package/dist/computer/host/container-fault.d.ts +38 -0
  43. package/dist/computer/host/container-fault.js +58 -0
  44. package/dist/computer/host/git-host.d.ts +62 -0
  45. package/dist/computer/host/git-host.js +156 -0
  46. package/dist/computer/host/git-identity.d.ts +57 -0
  47. package/dist/computer/host/git-identity.js +147 -0
  48. package/dist/computer/host/install-job.d.ts +121 -0
  49. package/dist/computer/host/install-job.js +766 -0
  50. package/dist/computer/host/sync.d.ts +111 -0
  51. package/dist/computer/host/sync.js +124 -0
  52. package/dist/computer/host/wake.d.ts +19 -0
  53. package/dist/computer/host/wake.js +10 -0
  54. package/dist/computer/host/workspace.d.ts +424 -0
  55. package/dist/computer/host/workspace.js +1258 -0
  56. package/dist/computer/index.d.ts +70 -50
  57. package/dist/computer/index.js +79 -767
  58. package/dist/computer/install.d.ts +8 -12
  59. package/dist/computer/install.js +6 -9
  60. package/dist/computer/paths.d.ts +21 -16
  61. package/dist/computer/paths.js +40 -38
  62. package/dist/computer/read.d.ts +18 -22
  63. package/dist/computer/read.js +24 -27
  64. package/dist/computer/render.d.ts +28 -0
  65. package/dist/computer/render.js +34 -1
  66. package/dist/computer/shell.d.ts +45 -0
  67. package/dist/computer/shell.js +80 -0
  68. package/dist/computer/tools-exec.d.ts +3 -0
  69. package/dist/computer/tools-exec.js +269 -0
  70. package/dist/computer/tools-file.d.ts +4 -0
  71. package/dist/computer/tools-file.js +124 -0
  72. package/dist/computer/tools-find.d.ts +3 -0
  73. package/dist/computer/tools-find.js +216 -0
  74. package/dist/recall/index.d.ts +9 -3
  75. package/dist/recall/index.js +22 -12
  76. package/dist/repo/checkout.d.ts +34 -4
  77. package/dist/repo/checkout.js +36 -1
  78. package/dist/repo/context.d.ts +109 -0
  79. package/dist/repo/context.js +530 -0
  80. package/dist/repo/index.d.ts +6 -29
  81. package/dist/repo/index.js +17 -1027
  82. package/dist/repo/tools-clone.d.ts +4 -0
  83. package/dist/repo/tools-clone.js +192 -0
  84. package/dist/repo/tools-forge.d.ts +4 -0
  85. package/dist/repo/tools-forge.js +179 -0
  86. package/dist/repo/tools-review.d.ts +3 -0
  87. package/dist/repo/tools-review.js +373 -0
  88. package/dist/repo/tools-worktree.d.ts +4 -0
  89. package/dist/repo/tools-worktree.js +221 -0
  90. package/dist/triage/index.d.ts +6 -1
  91. package/dist/triage/index.js +32 -23
  92. package/dist/workspace/index.d.ts +3 -3
  93. package/dist/workspace/index.js +3 -3
  94. package/package.json +21 -15
@@ -15,18 +15,13 @@ import type { WorkspaceAdvisory } from "./advisory.js";
15
15
  * filesystem plugin — an agent holding two gives the model no way to know which
16
16
  * one a path refers to.
17
17
  *
18
- * ## `node_modules` is **not** in the workspace
18
+ * ## The dependency tree is not in the workspace
19
19
  *
20
- * The one thing to internalise before reading further. `computerd` excludes it
21
- * from the sync, and the exclusion is right: pushing a real one (429 MB, 22,470
22
- * files) into the object exceeds the Durable Object's 128 MB isolate memory
23
- * limit, leaving the tree silently short — and the reconciliation that follows
24
- * propagates the shortfall back into the container.
25
- *
26
- * So dependencies live in the container and die with it, while source and `.git`
27
- * are durable. Two consequences run through everything below: an install has to
28
- * be re-run on a cold container, and `sb_read` cannot see a path under
29
- * `node_modules` even though a shell in the same container can.
20
+ * The one thing to internalise before reading further. A package root's
21
+ * `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.
30
25
  *
31
26
  * Requires the Workers **Paid** plan (containers) and a Durable Object binding
32
27
  * whose class owns the workspace — see the README for the wrangler block.
@@ -49,8 +44,8 @@ export { DEFAULT_INSTALL_PLAN, installFingerprint, resolveInstallCommand, type I
49
44
  * `verify:exports` treats `./computer` as one realm, and everything below stays
50
45
  * inside `dist/computer/`.
51
46
  */
52
- export { isContainerOnly, isGitInternal } from "./paths.js";
53
- export { cancelledNote, packBlocks, renderGrepMatches, renderResult, truncateOutput } from "./render.js";
47
+ export { isGitInternal, WALK_SKIPS } from "./paths.js";
48
+ export { cancelledNote, packBlocks, renderGrepMatches, renderResult, syncPendingNote, truncateOutput } from "./render.js";
54
49
  export { execGate, needsDependencies, writeGate, type ExecGate } from "./gate.js";
55
50
  /**
56
51
  * The workspace-advisory vocabulary, which a host needs all of: the type to
@@ -97,6 +92,7 @@ export declare const WORKSPACE_RUNTIME_KEY = "workspaceName";
97
92
  * is right there.
98
93
  */
99
94
  export declare function workspaceNameFromRuntime(runtime: unknown): string | undefined;
95
+ export { withShell, withShellTranscript } from "./shell.js";
100
96
  /**
101
97
  * The Durable Object the workspace lives in, as this plugin needs to see it.
102
98
  *
@@ -109,6 +105,19 @@ export declare function workspaceNameFromRuntime(runtime: unknown): string | und
109
105
  */
110
106
  export interface WorkspaceHost extends Rpc.DurableObjectBranded {
111
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>;
112
121
  /**
113
122
  * Everything currently true about the workspace that a caller must not assume
114
123
  * away — see {@link file://./advisory.ts}. An empty array is the good case.
@@ -120,52 +129,33 @@ export interface WorkspaceHost extends Rpc.DurableObjectBranded {
120
129
  * `node_modules`, or against a workspace whose writes are being dropped.
121
130
  *
122
131
  * `deriveAdvisories` builds the array from what the host already knows, so
123
- * implementing this is gathering three values rather than writing policy.
132
+ * implementing this is gathering what the host has rather than writing policy.
124
133
  */
125
134
  advisories(): Promise<readonly WorkspaceAdvisory[]>;
126
135
  }
127
136
  /**
128
- * Run a command under {@link ComputerConfig.shell} with its two output streams
129
- * left as they are, or hand it back untouched when no shell is configured.
130
- *
131
- * This is the variant for a caller that **reads the result in code**: `stdout` is
132
- * a data channel it compares or parses, and `stderr` is a separate diagnostic.
133
- * {@link computerExec} is that caller, on behalf of `@dynamicagents/plugins/repo`,
134
- * which asks git questions like `symbolic-ref --short refs/remotes/origin/HEAD`
135
- * and `rev-list --count` and needs the answer alone.
137
+ * Open the workspace behind a Durable Object stub.
136
138
  *
137
- * Two functions rather than one with a flag, because the difference is a change
138
- * to the *output contract* and a boolean hides it at the call site. Merging the
139
- * streams here would give every `/repo` git command an empty `stderr` and a
140
- * `stdout` that is a transcript rather than an answer — which fails silently,
141
- * since the commands `/repo` parses are quiet ones and a single `warning:` is
142
- * enough to skip the empty-branch guard.
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.
143
146
  */
144
- export declare function withShell(command: string, shell: string | undefined): string;
147
+ export declare function openWorkspace(host: DurableObjectStub<WorkspaceHost>): Promise<WorkspaceClient>;
145
148
  /**
146
- * Run a command under {@link ComputerConfig.shell} with its two output streams
147
- * merged into one transcript, in the order they were written.
148
- *
149
- * This is the variant for a caller whose consumer is **a model reading output**.
150
- * `sb_exec` is that caller. A project's check is a chain — `wrangler types &&
151
- * prettier && eslint && tsc` — and *which tool spoke last* is how you know which
152
- * one failed. A stdout block and a separate stderr block destroy that ordering,
153
- * and a model that wants it back re-runs the whole gate as
154
- * `npm run check > /tmp/out 2>&1; cat /tmp/out`. This is that workaround, done
155
- * once, for free.
149
+ * The same workspace, opened for filesystem work alone.
156
150
  *
157
- * The redirect binds to the wrapper process, so it applies to everything the
158
- * command writes however deeply nested — and there is no inner brace group or
159
- * subshell to mis-parse a command that already contains `&&`, quotes or redirects
160
- * of its own.
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.
161
154
  *
162
- * With no shell configured there is no wrapper process to redirect, so the
163
- * command goes to the runtime untouched and the two streams arrive separate.
164
- * That is not a gap: {@link renderResult} renders them as a labelled
165
- * `--- stderr ---` block for exactly this case. The transcript is the better
166
- * answer, not the only supported one.
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.
167
157
  */
168
- export declare function withShellTranscript(command: string, shell: string | undefined): string;
158
+ export declare function openWorkspaceFs(host: DurableObjectStub<WorkspaceHost>): Promise<WorkspaceClient>;
169
159
  export interface ComputerConfig {
170
160
  /**
171
161
  * The Durable Object namespace holding workspaces, closed over at
@@ -261,7 +251,16 @@ export interface ComputerConfig {
261
251
  */
262
252
  env?: () => Record<string, string | undefined>;
263
253
  }
264
- export declare function buildComputerTools(workspace: () => Promise<WorkspaceClient>, config: ComputerConfig, advisories?: () => Promise<readonly WorkspaceAdvisory[]>): ToolSet;
254
+ /**
255
+ * @param workspace Opens the workspace for a command: container started, CA
256
+ * installed.
257
+ * @param fsWorkspace Opens it for the file tools, which touch nothing but the
258
+ * host's SQLite. Defaults to {@link workspace}, so a host with one way in
259
+ * behaves as before. See {@link openWorkspaceFs}.
260
+ * @param lockScope Names the workspace a write locks within — see
261
+ * {@link file://./file-lock.ts}. Defaults to this tool set alone.
262
+ */
263
+ export declare function buildComputerTools(workspace: () => Promise<WorkspaceClient>, config: ComputerConfig, advisories?: () => Promise<readonly WorkspaceAdvisory[]>, fsWorkspace?: () => Promise<WorkspaceClient>, lockScope?: () => string): ToolSet;
265
264
  /**
266
265
  * An `exec` bound to this workspace, for plugins that need a shell but should
267
266
  * not own a container.
@@ -309,3 +308,24 @@ export declare function computerExec(config: ComputerConfig): (command: string,
309
308
  exitCode: number;
310
309
  }>;
311
310
  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";