@dynamicagents/plugins 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -79
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.js +21 -27
- package/dist/claude-code/cards.d.ts +53 -0
- package/dist/claude-code/cards.js +272 -0
- package/dist/claude-code/config.d.ts +73 -31
- package/dist/claude-code/config.js +0 -2
- package/dist/claude-code/credentials.d.ts +21 -9
- package/dist/claude-code/credentials.js +43 -9
- package/dist/claude-code/egress.d.ts +15 -14
- package/dist/claude-code/egress.js +51 -14
- package/dist/claude-code/events.d.ts +153 -9
- package/dist/claude-code/events.js +289 -58
- package/dist/claude-code/github.d.ts +39 -0
- package/dist/claude-code/github.js +82 -0
- package/dist/claude-code/index.d.ts +24 -80
- package/dist/claude-code/index.js +19 -234
- package/dist/claude-code/model.d.ts +152 -0
- package/dist/claude-code/model.js +342 -0
- package/dist/claude-code/run.d.ts +283 -92
- package/dist/claude-code/run.js +620 -114
- package/dist/claude-code/session.d.ts +131 -0
- package/dist/claude-code/session.js +285 -0
- package/dist/claude-code/spec.d.ts +46 -0
- package/dist/claude-code/spec.js +83 -0
- package/dist/claude-code/verified.d.ts +15 -0
- package/dist/claude-code/verified.js +15 -0
- package/dist/computer/context.d.ts +19 -0
- package/dist/computer/context.js +222 -0
- package/dist/computer/file-lock.d.ts +5 -0
- package/dist/computer/file-lock.js +40 -0
- package/dist/computer/gate.d.ts +12 -12
- package/dist/computer/gate.js +12 -12
- package/dist/computer/index.d.ts +57 -255
- package/dist/computer/index.js +98 -1039
- package/dist/computer/paths.d.ts +47 -22
- package/dist/computer/paths.js +64 -49
- package/dist/computer/proxy.d.ts +45 -0
- package/dist/computer/proxy.js +234 -0
- package/dist/computer/render.d.ts +27 -38
- package/dist/computer/render.js +32 -65
- package/dist/computer/tools-exec.d.ts +3 -0
- package/dist/computer/tools-exec.js +268 -0
- package/dist/computer/tools-file.d.ts +12 -0
- package/dist/computer/tools-file.js +64 -0
- package/dist/computer/tools-grep.d.ts +3 -0
- package/dist/computer/tools-grep.js +129 -0
- package/dist/repo/checkout.d.ts +35 -6
- package/dist/repo/checkout.js +64 -6
- package/dist/repo/context.d.ts +135 -0
- package/dist/repo/context.js +582 -0
- package/dist/repo/index.d.ts +79 -57
- package/dist/repo/index.js +118 -1112
- package/dist/repo/tools-checks.d.ts +3 -0
- package/dist/repo/tools-checks.js +112 -0
- package/dist/repo/tools-clone.d.ts +4 -0
- package/dist/repo/tools-clone.js +192 -0
- package/dist/repo/tools-pr.d.ts +14 -0
- package/dist/repo/tools-pr.js +196 -0
- package/dist/repo/tools-review.d.ts +12 -0
- package/dist/repo/tools-review.js +393 -0
- package/dist/repo/tools-worktree.d.ts +4 -0
- package/dist/repo/tools-worktree.js +305 -0
- package/dist/repo/tools-worktrees.d.ts +12 -0
- package/dist/repo/tools-worktrees.js +48 -0
- package/dist/repo/url.d.ts +2 -2
- package/dist/repo/url.js +7 -7
- package/dist/scratch/index.d.ts +4 -4
- package/dist/scratch/index.js +12 -11
- package/dist/{computer → workspace}/advisory.d.ts +33 -20
- package/dist/{computer → workspace}/advisory.js +32 -7
- package/dist/workspace/ca-trust.d.ts +95 -0
- package/dist/workspace/ca-trust.js +312 -0
- package/dist/workspace/container-deps.d.ts +54 -0
- package/dist/workspace/container-deps.js +224 -0
- package/dist/workspace/container-fault.d.ts +38 -0
- package/dist/workspace/container-fault.js +73 -0
- package/dist/workspace/exec.d.ts +94 -0
- package/dist/workspace/exec.js +153 -0
- package/dist/workspace/format.d.ts +36 -0
- package/dist/workspace/format.js +57 -0
- package/dist/workspace/git-host.d.ts +79 -0
- package/dist/workspace/git-host.js +226 -0
- package/dist/workspace/git-identity.d.ts +57 -0
- package/dist/workspace/git-identity.js +147 -0
- package/dist/workspace/index.d.ts +43 -47
- package/dist/workspace/index.js +52 -112
- package/dist/workspace/install-job.d.ts +121 -0
- package/dist/workspace/install-job.js +866 -0
- package/dist/{computer → workspace}/install.d.ts +15 -19
- package/dist/{computer → workspace}/install.js +8 -11
- package/dist/workspace/object.d.ts +502 -0
- package/dist/workspace/object.js +1427 -0
- package/dist/workspace/open.d.ts +95 -0
- package/dist/workspace/open.js +63 -0
- package/dist/workspace/read.d.ts +16 -0
- package/dist/workspace/read.js +22 -0
- package/dist/workspace/shell.d.ts +45 -0
- package/dist/workspace/shell.js +80 -0
- package/dist/workspace/sync.d.ts +111 -0
- package/dist/workspace/sync.js +124 -0
- package/dist/workspace/wake.d.ts +19 -0
- package/dist/workspace/wake.js +10 -0
- package/package.json +28 -42
- package/dist/arc-agi/analysis.d.ts +0 -336
- package/dist/arc-agi/analysis.js +0 -829
- package/dist/arc-agi/client.d.ts +0 -82
- package/dist/arc-agi/client.js +0 -113
- package/dist/arc-agi/game-tools.d.ts +0 -25
- package/dist/arc-agi/game-tools.js +0 -26
- package/dist/arc-agi/index.d.ts +0 -42
- package/dist/arc-agi/index.js +0 -175
- package/dist/arc-agi/main-agent.d.ts +0 -27
- package/dist/arc-agi/main-agent.js +0 -65
- package/dist/arc-agi/recipe.d.ts +0 -51
- package/dist/arc-agi/recipe.js +0 -100
- package/dist/arc-agi/scorecard.d.ts +0 -118
- package/dist/arc-agi/scorecard.js +0 -163
- package/dist/arc-agi/soul.d.ts +0 -40
- package/dist/arc-agi/soul.js +0 -90
- package/dist/arc-agi/store.d.ts +0 -154
- package/dist/arc-agi/store.js +0 -216
- package/dist/arc-agi/tools.d.ts +0 -36
- package/dist/arc-agi/tools.js +0 -576
- package/dist/arc-agi/types.d.ts +0 -212
- package/dist/arc-agi/types.js +0 -19
- package/dist/claude-code/recipe.d.ts +0 -53
- package/dist/claude-code/recipe.js +0 -100
- package/dist/computer/read.d.ts +0 -137
- package/dist/computer/read.js +0 -203
- package/dist/recall/index.d.ts +0 -99
- package/dist/recall/index.js +0 -171
- package/dist/triage/index.d.ts +0 -355
- package/dist/triage/index.js +0 -302
package/dist/repo/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AgentPlugin, MainAgentToolApproval } from "@dynamicagents/core";
|
|
1
|
+
import type { AgentPlugin } from "@dynamicagents/core";
|
|
3
2
|
/**
|
|
4
3
|
* The URL parsing, re-exported from the one entry point.
|
|
5
4
|
*
|
|
@@ -8,12 +7,13 @@ import type { AgentPlugin, MainAgentToolApproval } from "@dynamicagents/core";
|
|
|
8
7
|
* though it is implemented in `url.ts`.
|
|
9
8
|
*/
|
|
10
9
|
export { parseRepo } from "./url.js";
|
|
10
|
+
export { graphqlEndpoint, truncateOutput } from "./context.js";
|
|
11
11
|
/**
|
|
12
12
|
* `@dynamicagents/plugins/repo` — clone, commit, push, open a pull request.
|
|
13
13
|
*
|
|
14
14
|
* Layered over a container rather than owning one: it needs a shell with `git`
|
|
15
|
-
* on it, and `@dynamicagents/plugins/
|
|
16
|
-
* `
|
|
15
|
+
* on it, and `@dynamicagents/plugins/workspace` provides exactly that through
|
|
16
|
+
* `workspaceExec`. Passing `exec` in rather than importing that plugin keeps the
|
|
17
17
|
* two independent — a host with its own container can use this against that
|
|
18
18
|
* instead, and the tests here need no container at all.
|
|
19
19
|
*
|
|
@@ -26,7 +26,7 @@ export { parseRepo } from "./url.js";
|
|
|
26
26
|
* none of it needs to authenticate.
|
|
27
27
|
*
|
|
28
28
|
* That split is the one thing to preserve when changing this file: if an
|
|
29
|
-
* operation talks to
|
|
29
|
+
* operation talks to GitHub it does not belong on `exec`, and if it does not,
|
|
30
30
|
* it has no business anywhere else.
|
|
31
31
|
*
|
|
32
32
|
* It is absolute rather than careful because a narrower version does not hold.
|
|
@@ -40,9 +40,9 @@ export { parseRepo } from "./url.js";
|
|
|
40
40
|
* the length of one command is readable at `/proc/<pid>/environ` by anything
|
|
41
41
|
* else in the container.
|
|
42
42
|
*
|
|
43
|
-
* Two further rules, which are about
|
|
43
|
+
* Two further rules, which are about GitHub rather than the container:
|
|
44
44
|
*
|
|
45
|
-
* 1. **
|
|
45
|
+
* 1. **GitHub's hosts are an allowlist, checked before anything runs.** A clone URL is
|
|
46
46
|
* model input — a repository README, an issue body, or a page fetched by a
|
|
47
47
|
* co-installed browser plugin is enough to choose it — and a credential
|
|
48
48
|
* offered to a host of the model's choosing is the whole game. So the URL's
|
|
@@ -51,7 +51,7 @@ export { parseRepo } from "./url.js";
|
|
|
51
51
|
* check to the moment the token would actually be handed over. `origin` is
|
|
52
52
|
* re-derived and re-checked on every push rather than remembered, because the
|
|
53
53
|
* checkout's `.git/config` is a file the container can rewrite.
|
|
54
|
-
* 2. **The
|
|
54
|
+
* 2. **The GitHub API is called from the Worker**, so the credential that can
|
|
55
55
|
* write to a repository through the API never crosses the boundary either.
|
|
56
56
|
* Every tool that reads or writes through it resolves the repository from the
|
|
57
57
|
* checkout's own origin rather than from a parameter, so there is no way to
|
|
@@ -66,23 +66,20 @@ export { parseRepo } from "./url.js";
|
|
|
66
66
|
* repository. Whatever the token can reach, an agent talked into naming it can
|
|
67
67
|
* reach. See the README — the token wants to be fine-grained.
|
|
68
68
|
*/
|
|
69
|
-
/**
|
|
70
|
-
export declare const REPO_FAMILY = "repo";
|
|
71
|
-
/** Run one command in the host's container. Matches `computerExec`'s shape. */
|
|
69
|
+
/** Run one command in the host's container. Matches `workspaceExec`'s shape. */
|
|
72
70
|
export type RepoExec = (command: string, options?: {
|
|
73
71
|
cwd?: string;
|
|
74
72
|
env?: Record<string, string | undefined>;
|
|
75
73
|
timeout?: number;
|
|
76
74
|
/**
|
|
77
|
-
* The
|
|
75
|
+
* The running sub-agent's `runtime()`, forwarded **opaquely**.
|
|
78
76
|
*
|
|
79
|
-
* This plugin never looks inside it. A
|
|
80
|
-
* container its parent prepared, and the key for that lives in the
|
|
81
|
-
*
|
|
77
|
+
* This plugin never looks inside it. A sub-agent has to reach the
|
|
78
|
+
* container its parent prepared, and the key for that lives in what the
|
|
79
|
+
* parent's `prepare` returned — but decoding it is the container plugin's
|
|
82
80
|
* business, not git's. Passing it through untouched is what lets the two
|
|
83
|
-
* plugins compose
|
|
84
|
-
*
|
|
85
|
-
* injected rather than imported.
|
|
81
|
+
* plugins compose without either importing the other, which is the whole
|
|
82
|
+
* reason `exec` is injected rather than imported.
|
|
86
83
|
*/
|
|
87
84
|
runtime?: unknown;
|
|
88
85
|
}) => Promise<{
|
|
@@ -92,7 +89,7 @@ export type RepoExec = (command: string, options?: {
|
|
|
92
89
|
exitCode: number;
|
|
93
90
|
}>;
|
|
94
91
|
/**
|
|
95
|
-
* The three git operations that need the
|
|
92
|
+
* The three git operations that need the GitHub token, run by the host.
|
|
96
93
|
*
|
|
97
94
|
* Injected for the same reason {@link RepoExec} is — this plugin owns the
|
|
98
95
|
* policy, not the plumbing — but the split between the two is not arbitrary. It
|
|
@@ -101,7 +98,7 @@ export type RepoExec = (command: string, options?: {
|
|
|
101
98
|
* keeps its secret and never touches the container at all.
|
|
102
99
|
*
|
|
103
100
|
* That is why `clone`, `fetch` and `push` are the whole interface. They are
|
|
104
|
-
* exactly the operations that talk to
|
|
101
|
+
* exactly the operations that talk to GitHub. `status`, `diff`, `add`,
|
|
105
102
|
* `commit` and `checkout` are local, need nothing to authenticate with, and stay
|
|
106
103
|
* on `exec` where they are cheap and where the model can see them work.
|
|
107
104
|
*
|
|
@@ -116,7 +113,8 @@ export type RepoExec = (command: string, options?: {
|
|
|
116
113
|
* branch that does not resolve, a repository that is not there — all of it comes
|
|
117
114
|
* back as `ok: false`, because those are answers. A rejection means the host
|
|
118
115
|
* itself could not be reached, which is a different fact and gets a different
|
|
119
|
-
* sentence from every tool in this file. See
|
|
116
|
+
* sentence from every tool in this file. See
|
|
117
|
+
* {@link file://./context.ts RunResult}.
|
|
120
118
|
*/
|
|
121
119
|
export interface RepoGit {
|
|
122
120
|
/**
|
|
@@ -153,6 +151,14 @@ export interface RepoGit {
|
|
|
153
151
|
branch: string;
|
|
154
152
|
allowedHosts: string[];
|
|
155
153
|
}): Promise<RepoGitResult>;
|
|
154
|
+
/**
|
|
155
|
+
* The checkout's `origin` URL, read on the host's side; `undefined` for none.
|
|
156
|
+
*
|
|
157
|
+
* Optional. Set, the GitHub tools resolve their repository without the
|
|
158
|
+
* container, so an agent polling a pull request does not keep one running.
|
|
159
|
+
* Unset, the origin is read through {@link RepoConfig.exec}.
|
|
160
|
+
*/
|
|
161
|
+
origin?(dir: string): Promise<string | undefined>;
|
|
156
162
|
}
|
|
157
163
|
/** What a {@link RepoGit} operation reports. */
|
|
158
164
|
export type RepoGitResult = {
|
|
@@ -167,14 +173,14 @@ export interface RepoConfig {
|
|
|
167
173
|
/**
|
|
168
174
|
* Runs commands in the container holding the checkout.
|
|
169
175
|
*
|
|
170
|
-
* Uncredentialed, always. Nothing this runs is ever given the
|
|
176
|
+
* Uncredentialed, always. Nothing this runs is ever given the GitHub token —
|
|
171
177
|
* see {@link RepoGit} for the operations that need one.
|
|
172
178
|
*/
|
|
173
179
|
exec: RepoExec;
|
|
174
180
|
/** Runs the three credentialed operations, on the host's side of the boundary. */
|
|
175
181
|
git: RepoGit;
|
|
176
182
|
/**
|
|
177
|
-
* A
|
|
183
|
+
* A GitHub token with contents+pull-request write. A thunk so a rotated secret
|
|
178
184
|
* is picked up without rebuilding the plugin list.
|
|
179
185
|
*/
|
|
180
186
|
token: () => string;
|
|
@@ -203,9 +209,9 @@ export interface RepoConfig {
|
|
|
203
209
|
* 16,000 non-ASCII characters is three times that many UTF-8 bytes.
|
|
204
210
|
*
|
|
205
211
|
* `repo_diff` is the main input for an agent that
|
|
206
|
-
* reviews rather than writes — a
|
|
207
|
-
*
|
|
208
|
-
*
|
|
212
|
+
* reviews rather than writes — a coder whose sub-agents hold the shell — and
|
|
213
|
+
* an unbounded diff on a large change is precisely the context blowup that
|
|
214
|
+
* design exists to prevent.
|
|
209
215
|
*/
|
|
210
216
|
maxOutputChars?: number;
|
|
211
217
|
/**
|
|
@@ -226,7 +232,7 @@ export interface RepoConfig {
|
|
|
226
232
|
* not — a host that stored the path alongside its install state found that a
|
|
227
233
|
* repository the resolver had nothing to install in (no `package.json`) cloned
|
|
228
234
|
* perfectly, reported itself correctly, and could never be worked in, because
|
|
229
|
-
* the one path its
|
|
235
|
+
* the one path its sub-agents needed was written on a branch that never ran.
|
|
230
236
|
*
|
|
231
237
|
* Awaited, so it can record intent durably, but it must **return quickly**:
|
|
232
238
|
* it runs inside `repo_clone`, which runs inside a model turn. A host that
|
|
@@ -263,6 +269,50 @@ export interface RepoConfig {
|
|
|
263
269
|
owner: string;
|
|
264
270
|
repo: string;
|
|
265
271
|
}) => void;
|
|
272
|
+
/**
|
|
273
|
+
* The worktrees a host keeps for its sub-agents' work, and the way between
|
|
274
|
+
* them.
|
|
275
|
+
*
|
|
276
|
+
* Set, the plugin offers `repo_worktrees` and `repo_worktree`. A switch moves
|
|
277
|
+
* the installing agent's own tools, so a host sets this on the parent's
|
|
278
|
+
* install and never on a sub-agent's. See {@link RepoWorktrees}.
|
|
279
|
+
*/
|
|
280
|
+
worktrees?: RepoWorktrees;
|
|
281
|
+
/**
|
|
282
|
+
* The tools this install offers, and with them the lines of context that
|
|
283
|
+
* describe them. Unset, every tool. A selection rather than core's
|
|
284
|
+
* `restrictTools`, which drops a plugin's context whole: an agent that
|
|
285
|
+
* coordinates others' work reads about the tools it has and no others.
|
|
286
|
+
*/
|
|
287
|
+
tools?: readonly RepoToolName[];
|
|
288
|
+
}
|
|
289
|
+
/** Every tool and action this plugin can offer, by the name the model sees. */
|
|
290
|
+
export declare const REPO_TOOL_NAMES: readonly ["repo_clone", "repo_fetch", "repo_status", "repo_diff", "repo_commit", "repo_push", "repo_open_pr", "repo_issue_view", "repo_pr_view", "repo_pr_comment", "repo_pr_review_status", "repo_pr_threads", "repo_pr_thread_reply", "repo_pr_checks", "repo_worktrees", "repo_worktree"];
|
|
291
|
+
export type RepoToolName = (typeof REPO_TOOL_NAMES)[number];
|
|
292
|
+
/**
|
|
293
|
+
* Checkouts a host keeps apart from the main one — each holding a branch its
|
|
294
|
+
* writing sub-agents committed on — and the switch that points every repo tool
|
|
295
|
+
* at one of them.
|
|
296
|
+
*
|
|
297
|
+
* The host renders every answer: which worktrees exist, where their checkouts
|
|
298
|
+
* sit and what is safe to do in them are its facts, and a sentence is what the
|
|
299
|
+
* model reads.
|
|
300
|
+
*/
|
|
301
|
+
export interface RepoWorktrees {
|
|
302
|
+
/** Every worktree, with its branch and state. */
|
|
303
|
+
list(): Promise<string>;
|
|
304
|
+
/**
|
|
305
|
+
* Point every repo tool — and whatever else the host routes the same way — at
|
|
306
|
+
* the worktree holding `branch`, or back at the main checkout when it is absent.
|
|
307
|
+
* Answers what the model now has in front of it.
|
|
308
|
+
*
|
|
309
|
+
* The switch holds until the next one. This answer is what the model
|
|
310
|
+
* remembers, so a host that moves the tools on its own says so where the
|
|
311
|
+
* model reads it every turn.
|
|
312
|
+
*/
|
|
313
|
+
use(branch?: string): Promise<string>;
|
|
314
|
+
/** Give up `branch`'s worktree, and the unpushed work in it. */
|
|
315
|
+
release(branch: string): Promise<string>;
|
|
266
316
|
}
|
|
267
317
|
/** What {@link RepoConfig.afterCheckout} is told about a checkout. */
|
|
268
318
|
export interface RepoCheckout {
|
|
@@ -293,35 +343,7 @@ export interface RepoCheckout {
|
|
|
293
343
|
fresh: boolean;
|
|
294
344
|
}
|
|
295
345
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* Deliberately a **copy** of the computer plugin's function of the same name,
|
|
299
|
-
* not an import. `npm run verify:exports` fails any subpath whose module graph
|
|
300
|
-
* reaches a sibling's directory, and its own advice for a shared helper is to
|
|
301
|
-
* duplicate it — installing `repo` must not drag `computer` (and therefore
|
|
302
|
-
* `@cloudflare/computer`) into a consumer's bundle. Fifteen lines is a cheaper
|
|
303
|
-
* price than that coupling, and it is the same reason `exec` is injected here
|
|
304
|
-
* rather than imported.
|
|
305
|
-
*
|
|
306
|
-
* The `half < 1` guard is not padding: without it a small `max` makes `half`
|
|
307
|
-
* zero or negative, and `slice(-0)` is `slice(0)` — the whole string — so the
|
|
308
|
-
* function would return *more* than it was given.
|
|
309
|
-
*/
|
|
310
|
-
export declare function truncateOutput(text: string, max: number): string;
|
|
311
|
-
export declare function buildRepoTools(config: RepoConfig,
|
|
312
|
-
/** Forwarded to every `exec`; see {@link RepoExec}'s `runtime` option. */
|
|
313
|
-
runtime?: unknown): ToolSet;
|
|
314
|
-
/**
|
|
315
|
-
* The repo tools a person approves before they run: opening a pull request, and
|
|
316
|
-
* nothing else. Pushing a work branch and commenting run without asking.
|
|
317
|
-
*
|
|
318
|
-
* The reason is what the person reads beside Approve and Reject, so it says what
|
|
319
|
-
* the call will do in their terms: which repository, from which branch into
|
|
320
|
-
* which, and under what title. The repository is the checkout's origin, read
|
|
321
|
-
* through the same lookup the tool runs, so a directory named after one
|
|
322
|
-
* repository cannot present a pull request on another. The input has already
|
|
323
|
-
* passed the tool's own schema. What a rule is, and whose calls it covers, is
|
|
324
|
-
* core's to say — see `AgentPlugin.mainAgentToolApproval`.
|
|
346
|
+
* No tool here is held for a person's approval — see this plugin's README for
|
|
347
|
+
* why, and for what a fork that wants one does instead.
|
|
325
348
|
*/
|
|
326
|
-
export declare function repoToolApproval(config: RepoConfig): MainAgentToolApproval;
|
|
327
349
|
export declare function repo(config: RepoConfig): AgentPlugin;
|