@dynamicagents/plugins 0.13.0 → 0.15.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 (141) hide show
  1. package/README.md +14 -14
  2. package/dist/claude-code/cards.d.ts +4 -0
  3. package/dist/claude-code/cards.js +22 -0
  4. package/dist/claude-code/config.d.ts +10 -83
  5. package/dist/claude-code/config.js +0 -2
  6. package/dist/claude-code/credentials.d.ts +32 -50
  7. package/dist/claude-code/credentials.js +115 -74
  8. package/dist/claude-code/daemon/index.d.ts +24 -0
  9. package/dist/claude-code/daemon/index.js +203 -0
  10. package/dist/claude-code/egress.d.ts +35 -117
  11. package/dist/claude-code/egress.js +80 -325
  12. package/dist/claude-code/events.d.ts +14 -17
  13. package/dist/claude-code/events.js +19 -15
  14. package/dist/claude-code/harness-wire.d.ts +45 -0
  15. package/dist/claude-code/harness-wire.js +47 -0
  16. package/dist/claude-code/index.d.ts +19 -29
  17. package/dist/claude-code/index.js +17 -25
  18. package/dist/claude-code/language-model.d.ts +19 -0
  19. package/dist/claude-code/language-model.js +71 -0
  20. package/dist/claude-code/model.d.ts +77 -70
  21. package/dist/claude-code/model.js +328 -304
  22. package/dist/claude-code/placeholder.d.ts +12 -0
  23. package/dist/claude-code/placeholder.js +12 -0
  24. package/dist/claude-code/spec.d.ts +4 -4
  25. package/dist/claude-code/spec.js +4 -4
  26. package/dist/claude-code/verified.d.ts +1 -1
  27. package/dist/claude-code/verified.js +1 -1
  28. package/dist/computer/client.d.ts +88 -0
  29. package/dist/computer/client.js +6 -0
  30. package/dist/computer/context.d.ts +7 -7
  31. package/dist/computer/context.js +14 -18
  32. package/dist/computer/gate.d.ts +4 -23
  33. package/dist/computer/gate.js +1 -37
  34. package/dist/computer/index.d.ts +44 -43
  35. package/dist/computer/index.js +29 -50
  36. package/dist/computer/paths.d.ts +5 -27
  37. package/dist/computer/paths.js +7 -30
  38. package/dist/computer/proxy.d.ts +17 -31
  39. package/dist/computer/proxy.js +9 -44
  40. package/dist/computer/render.d.ts +3 -40
  41. package/dist/computer/render.js +3 -36
  42. package/dist/computer/sandbox.d.ts +55 -0
  43. package/dist/computer/sandbox.js +236 -0
  44. package/dist/computer/shell.d.ts +36 -0
  45. package/dist/computer/shell.js +41 -0
  46. package/dist/computer/tools-exec.js +3 -9
  47. package/dist/computer/tools-file.d.ts +1 -1
  48. package/dist/computer/tools-file.js +1 -1
  49. package/dist/{repo → repo-github}/checkout.d.ts +3 -4
  50. package/dist/{repo → repo-github}/checkout.js +3 -4
  51. package/dist/{repo → repo-github}/context.d.ts +14 -32
  52. package/dist/{repo → repo-github}/context.js +46 -81
  53. package/dist/{repo → repo-github}/index.d.ts +30 -13
  54. package/dist/{repo → repo-github}/index.js +25 -6
  55. package/dist/repo-github/mcp.d.ts +95 -0
  56. package/dist/repo-github/mcp.js +107 -0
  57. package/dist/repo-github/sandbox-egress.d.ts +68 -0
  58. package/dist/repo-github/sandbox-egress.js +272 -0
  59. package/dist/repo-github/sandbox-git.d.ts +30 -0
  60. package/dist/repo-github/sandbox-git.js +113 -0
  61. package/dist/{repo → repo-github}/tools-checks.js +43 -4
  62. package/dist/{repo → repo-github}/tools-clone.js +2 -21
  63. package/dist/{repo → repo-github}/tools-pr.d.ts +0 -1
  64. package/dist/{repo → repo-github}/tools-pr.js +85 -20
  65. package/dist/{repo → repo-github}/tools-review.d.ts +6 -0
  66. package/dist/{repo → repo-github}/tools-review.js +62 -176
  67. package/dist/{repo → repo-github}/url.d.ts +11 -0
  68. package/dist/{repo → repo-github}/url.js +12 -1
  69. package/dist/{workspace → sandbox}/advisory.d.ts +16 -35
  70. package/dist/{workspace → sandbox}/advisory.js +2 -29
  71. package/dist/sandbox/agent-exec.d.ts +31 -0
  72. package/dist/sandbox/agent-exec.js +62 -0
  73. package/dist/sandbox/ca-trust.d.ts +9 -0
  74. package/dist/sandbox/ca-trust.js +21 -0
  75. package/dist/sandbox/constants.d.ts +22 -0
  76. package/dist/sandbox/constants.js +22 -0
  77. package/dist/sandbox/daemon/composite.d.ts +9 -0
  78. package/dist/sandbox/daemon/composite.js +35 -0
  79. package/dist/sandbox/daemon/index.d.ts +47 -0
  80. package/dist/sandbox/daemon/index.js +116 -0
  81. package/dist/sandbox/egress.d.ts +81 -0
  82. package/dist/sandbox/egress.js +109 -0
  83. package/dist/sandbox/exec.d.ts +57 -0
  84. package/dist/sandbox/exec.js +52 -0
  85. package/dist/sandbox/format.d.ts +2 -0
  86. package/dist/sandbox/format.js +7 -0
  87. package/dist/sandbox/header.d.ts +50 -0
  88. package/dist/sandbox/header.js +94 -0
  89. package/dist/sandbox/index.d.ts +17 -0
  90. package/dist/sandbox/index.js +17 -0
  91. package/dist/{workspace/install.d.ts → sandbox/install-plan.d.ts} +10 -1
  92. package/dist/{workspace/install.js → sandbox/install-plan.js} +22 -4
  93. package/dist/sandbox/name.d.ts +27 -0
  94. package/dist/sandbox/name.js +32 -0
  95. package/dist/sandbox/object.d.ts +244 -0
  96. package/dist/sandbox/object.js +1139 -0
  97. package/dist/scratch/index.d.ts +1 -9
  98. package/dist/scratch/index.js +2 -18
  99. package/package.json +26 -22
  100. package/dist/claude-code/github.d.ts +0 -39
  101. package/dist/claude-code/github.js +0 -82
  102. package/dist/claude-code/run.d.ts +0 -474
  103. package/dist/claude-code/run.js +0 -901
  104. package/dist/claude-code/session.d.ts +0 -131
  105. package/dist/claude-code/session.js +0 -285
  106. package/dist/workspace/ca-trust.d.ts +0 -95
  107. package/dist/workspace/ca-trust.js +0 -312
  108. package/dist/workspace/container-deps.d.ts +0 -54
  109. package/dist/workspace/container-deps.js +0 -224
  110. package/dist/workspace/container-fault.d.ts +0 -38
  111. package/dist/workspace/container-fault.js +0 -73
  112. package/dist/workspace/exec.d.ts +0 -94
  113. package/dist/workspace/exec.js +0 -153
  114. package/dist/workspace/format.d.ts +0 -36
  115. package/dist/workspace/format.js +0 -57
  116. package/dist/workspace/git-host.d.ts +0 -79
  117. package/dist/workspace/git-host.js +0 -226
  118. package/dist/workspace/git-identity.d.ts +0 -57
  119. package/dist/workspace/git-identity.js +0 -147
  120. package/dist/workspace/index.d.ts +0 -49
  121. package/dist/workspace/index.js +0 -58
  122. package/dist/workspace/install-job.d.ts +0 -121
  123. package/dist/workspace/install-job.js +0 -866
  124. package/dist/workspace/object.d.ts +0 -502
  125. package/dist/workspace/object.js +0 -1427
  126. package/dist/workspace/open.d.ts +0 -95
  127. package/dist/workspace/open.js +0 -63
  128. package/dist/workspace/read.d.ts +0 -16
  129. package/dist/workspace/read.js +0 -22
  130. package/dist/workspace/shell.d.ts +0 -45
  131. package/dist/workspace/shell.js +0 -80
  132. package/dist/workspace/sync.d.ts +0 -111
  133. package/dist/workspace/sync.js +0 -124
  134. package/dist/workspace/wake.d.ts +0 -19
  135. package/dist/workspace/wake.js +0 -10
  136. /package/dist/{repo → repo-github}/tools-checks.d.ts +0 -0
  137. /package/dist/{repo → repo-github}/tools-clone.d.ts +0 -0
  138. /package/dist/{repo → repo-github}/tools-worktree.d.ts +0 -0
  139. /package/dist/{repo → repo-github}/tools-worktree.js +0 -0
  140. /package/dist/{repo → repo-github}/tools-worktrees.d.ts +0 -0
  141. /package/dist/{repo → repo-github}/tools-worktrees.js +0 -0
@@ -29,7 +29,7 @@ import type { AgentPlugin } from "@dynamicagents/core";
29
29
  *
30
30
  * ## What the host owns
31
31
  *
32
- * The same split [`/repo`](../repo/) makes, and for the same reason — this plugin
32
+ * The same split [`/repo-github`](../repo-github/) makes, and for the same reason — this plugin
33
33
  * knows what a scratchpad *is*, the host knows how it addresses one:
34
34
  *
35
35
  * - {@link ScratchConfig.beforeOpen} selects the workspace, before anything runs.
@@ -145,14 +145,6 @@ export interface ScratchConfig {
145
145
  */
146
146
  afterOpen?: (scratch: Scratchpad) => Promise<ScratchReadiness | void>;
147
147
  }
148
- /**
149
- * Bound what reaches the model, keeping both ends.
150
- *
151
- * A copy rather than an import, for the reason {@link ScratchExec} is injected:
152
- * `verify:exports` fails any subpath that reaches a sibling's files, and `/repo`
153
- * carries the same copy for the same reason.
154
- */
155
- export declare function truncateOutput(text: string, max: number): string;
156
148
  /** The tool name, exported so a host restricting the plugin can name it. */
157
149
  export declare const SCRATCH_OPEN_TOOL = "scratch_open";
158
150
  export declare function scratch(config: ScratchConfig): AgentPlugin;
@@ -1,6 +1,6 @@
1
1
  import { tool } from "ai";
2
2
  import { z } from "zod";
3
- import { definePlugin } from "@dynamicagents/core";
3
+ import { definePlugin, truncateOutput } from "@dynamicagents/core";
4
4
  /**
5
5
  * `@dynamicagents/plugins/scratch` — a place to work that is not a repository.
6
6
  *
@@ -31,7 +31,7 @@ import { definePlugin } from "@dynamicagents/core";
31
31
  *
32
32
  * ## What the host owns
33
33
  *
34
- * The same split [`/repo`](../repo/) makes, and for the same reason — this plugin
34
+ * The same split [`/repo-github`](../repo-github/) makes, and for the same reason — this plugin
35
35
  * knows what a scratchpad *is*, the host knows how it addresses one:
36
36
  *
37
37
  * - {@link ScratchConfig.beforeOpen} selects the workspace, before anything runs.
@@ -52,22 +52,6 @@ const DEFAULT_AUTHOR = {
52
52
  const DEFAULT_MAX_OUTPUT_CHARS = 16_000;
53
53
  /** How many lines of a dirty tree are worth reciting back. */
54
54
  const STATUS_MAX_LINES = 20;
55
- /**
56
- * Bound what reaches the model, keeping both ends.
57
- *
58
- * A copy rather than an import, for the reason {@link ScratchExec} is injected:
59
- * `verify:exports` fails any subpath that reaches a sibling's files, and `/repo`
60
- * carries the same copy for the same reason.
61
- */
62
- export function truncateOutput(text, max) {
63
- if (text.length <= max)
64
- return text;
65
- const marker = (dropped) => `\n\n… [${dropped} characters omitted from the middle] …\n\n`;
66
- const half = Math.floor((max - marker(text.length).length) / 2);
67
- if (half < 1)
68
- return text.slice(0, Math.max(0, max));
69
- return (text.slice(0, half) + marker(text.length - half * 2) + text.slice(-half));
70
- }
71
55
  /** The tool name, exported so a host restricting the plugin can name it. */
72
56
  export const SCRATCH_OPEN_TOOL = "scratch_open";
73
57
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dynamicagents/plugins",
3
- "version": "0.13.0",
4
- "description": "Optional, composable capabilities for a Dynamic Agent: browser rendering, a Linux container, git and pull requests, a scratchpad, and Claude Code sessions. One subpath per plugin, so a bundle grows only with what it imports.",
3
+ "version": "0.15.0",
4
+ "description": "Optional, composable capabilities for a Dynamic Agent: browser rendering, a Linux container, git and pull requests on GitHub, a scratchpad, and Claude Code sessions. One subpath per plugin, so a bundle grows only with what it imports.",
5
5
  "keywords": [
6
6
  "ai-agents",
7
7
  "cloudflare-workers",
@@ -34,9 +34,9 @@
34
34
  "types": "./dist/browser/index.d.ts",
35
35
  "import": "./dist/browser/index.js"
36
36
  },
37
- "./repo": {
38
- "types": "./dist/repo/index.d.ts",
39
- "import": "./dist/repo/index.js"
37
+ "./repo-github": {
38
+ "types": "./dist/repo-github/index.d.ts",
39
+ "import": "./dist/repo-github/index.js"
40
40
  },
41
41
  "./scratch": {
42
42
  "types": "./dist/scratch/index.d.ts",
@@ -46,14 +46,22 @@
46
46
  "types": "./dist/claude-code/index.d.ts",
47
47
  "import": "./dist/claude-code/index.js"
48
48
  },
49
- "./workspace": {
50
- "types": "./dist/workspace/index.d.ts",
51
- "import": "./dist/workspace/index.js"
49
+ "./claude-code/daemon": {
50
+ "types": "./dist/claude-code/daemon/index.d.ts",
51
+ "import": "./dist/claude-code/daemon/index.js"
52
52
  },
53
53
  "./computer": {
54
54
  "types": "./dist/computer/index.d.ts",
55
55
  "import": "./dist/computer/index.js"
56
56
  },
57
+ "./sandbox": {
58
+ "types": "./dist/sandbox/index.d.ts",
59
+ "import": "./dist/sandbox/index.js"
60
+ },
61
+ "./sandbox/daemon": {
62
+ "types": "./dist/sandbox/daemon/index.d.ts",
63
+ "import": "./dist/sandbox/daemon/index.js"
64
+ },
57
65
  "./package.json": "./package.json"
58
66
  },
59
67
  "scripts": {
@@ -70,35 +78,31 @@
70
78
  "verify:references": "node scripts/verify-references.mjs",
71
79
  "verify:peer-ranges": "node scripts/verify-peer-ranges.mjs",
72
80
  "probe:claude-code": "npm run build && node scripts/probe-claude-code.mjs",
81
+ "probe:github-mcp": "node scripts/probe-github-mcp.mjs",
73
82
  "prepack": "npm run build && npm run verify:exports",
74
83
  "prepublishOnly": "npm run check && npm test",
75
84
  "prepare": "husky || true && npm run build"
76
85
  },
77
86
  "peerDependencies": {
78
- "@cloudflare/computer": "^0.4.0",
79
- "@cloudflare/think": ">=0.20.0 <0.21.0",
80
- "@dynamicagents/core": ">=0.13.0 <0.14.0",
81
- "@platformatic/vfs": "^0.4.0",
82
- "agents": ">=0.26.0 <0.27.0",
87
+ "@cloudflare/sandbox": "^1.0.1",
88
+ "@cloudflare/think": ">=0.20.2 <0.21.0",
89
+ "@dynamicagents/core": ">=0.15.0 <0.16.0",
90
+ "agents": ">=0.28.0 <0.29.0",
83
91
  "ai": "^7.0.88",
84
92
  "zod": "^4.4.3"
85
93
  },
86
94
  "peerDependenciesMeta": {
87
- "@cloudflare/computer": {
88
- "optional": true
89
- },
90
- "@platformatic/vfs": {
95
+ "@cloudflare/sandbox": {
91
96
  "optional": true
92
97
  }
93
98
  },
94
99
  "devDependencies": {
95
- "@cloudflare/computer": "^0.4.0",
96
- "@cloudflare/think": "^0.20.0",
100
+ "@cloudflare/sandbox": "^1.0.1",
101
+ "@cloudflare/think": "^0.20.2",
97
102
  "@cloudflare/vitest-plugin": "^1.1.9",
98
- "@dynamicagents/core": "^0.13.1",
99
- "@platformatic/vfs": "^0.4.0",
103
+ "@dynamicagents/core": "^0.15.0",
100
104
  "@types/node": "^26.5.1",
101
- "agents": "^0.26.0",
105
+ "agents": "^0.28.0",
102
106
  "ai": "^7.0.101",
103
107
  "eslint": "^10.10.0",
104
108
  "husky": "^9.1.7",
@@ -1,39 +0,0 @@
1
- /**
2
- * GitHub access for a session, with the token on the Worker side.
3
- *
4
- * The session is launched with {@link GITHUB_TOKEN_PLACEHOLDER} as `GH_TOKEN`,
5
- * and git is given a credential helper that answers with it. The egress gateway swaps
6
- * the placeholder for the real token on {@link GITHUB_HOSTS} only, so a process
7
- * in the container can *use* GitHub as the deployment's account and can never
8
- * *read* the token — the same containment as the Anthropic credential.
9
- *
10
- * Keyed on the placeholder, unlike the Anthropic swap: a GitHub request that
11
- * did not ask for a credential stays anonymous, as it would be anywhere else.
12
- */
13
- /** The hosts the token is ever sent to: git over HTTPS, and the API. */
14
- export declare const GITHUB_HOSTS: ReadonlySet<string>;
15
- /**
16
- * What `GH_TOKEN` and git's credential helper hold. Shaped like a classic
17
- * token, so nothing that checks the shape refuses it before sending it.
18
- */
19
- export declare const GITHUB_TOKEN_PLACEHOLDER: string;
20
- /**
21
- * The session's GitHub environment. A credential helper for `https://github.com`
22
- * rather than a token in the remote URL, so the checkout's `.git/config` holds
23
- * nothing and every git the session starts presents the placeholder.
24
- */
25
- export declare function githubEnv(): Record<string, string>;
26
- /** The keys {@link githubEnv} owns, which a host's `env` may not set beside it. */
27
- export declare const GITHUB_ENV_KEYS: readonly string[];
28
- /** How an authorization header carried the placeholder, if it did. */
29
- type Presented = "bearer" | "basic";
30
- /**
31
- * Whether `value` presents the placeholder: `Bearer`/`token` as `gh` sends it,
32
- * or Basic `user:placeholder` as git does after a `401`.
33
- */
34
- export declare function presentsPlaceholder(value: string | null): Presented | undefined;
35
- /** The real credential, in the scheme the placeholder came in. */
36
- export declare function githubAuthorization(presented: Presented, token: string): string;
37
- /** A refusal in GitHub's error shape, which `gh` and git both print. */
38
- export declare function githubError(message: string, status: number): Response;
39
- export {};
@@ -1,82 +0,0 @@
1
- /**
2
- * GitHub access for a session, with the token on the Worker side.
3
- *
4
- * The session is launched with {@link GITHUB_TOKEN_PLACEHOLDER} as `GH_TOKEN`,
5
- * and git is given a credential helper that answers with it. The egress gateway swaps
6
- * the placeholder for the real token on {@link GITHUB_HOSTS} only, so a process
7
- * in the container can *use* GitHub as the deployment's account and can never
8
- * *read* the token — the same containment as the Anthropic credential.
9
- *
10
- * Keyed on the placeholder, unlike the Anthropic swap: a GitHub request that
11
- * did not ask for a credential stays anonymous, as it would be anywhere else.
12
- */
13
- /** The hosts the token is ever sent to: git over HTTPS, and the API. */
14
- export const GITHUB_HOSTS = new Set([
15
- "github.com",
16
- "api.github.com"
17
- ]);
18
- /**
19
- * What `GH_TOKEN` and git's credential helper hold. Shaped like a classic
20
- * token, so nothing that checks the shape refuses it before sending it.
21
- */
22
- export const GITHUB_TOKEN_PLACEHOLDER = "ghp_" + "0".repeat(36);
23
- /** The username GitHub expects beside a token in git's Basic auth. */
24
- const GIT_USER = "x-access-token";
25
- /**
26
- * The session's GitHub environment. A credential helper for `https://github.com`
27
- * rather than a token in the remote URL, so the checkout's `.git/config` holds
28
- * nothing and every git the session starts presents the placeholder.
29
- */
30
- export function githubEnv() {
31
- return {
32
- GH_TOKEN: GITHUB_TOKEN_PLACEHOLDER,
33
- GIT_CONFIG_COUNT: "1",
34
- GIT_CONFIG_KEY_0: "credential.https://github.com.helper",
35
- // Answers `get` only; `store` and `erase` are no-ops that still exit 0.
36
- GIT_CONFIG_VALUE_0: `!f() { if test "$1" = get; then printf 'username=${GIT_USER}\\npassword=%s\\n' "$GH_TOKEN"; fi; }; f`
37
- };
38
- }
39
- /** The keys {@link githubEnv} owns, which a host's `env` may not set beside it. */
40
- export const GITHUB_ENV_KEYS = Object.keys(githubEnv());
41
- /**
42
- * Whether `value` presents the placeholder: `Bearer`/`token` as `gh` sends it,
43
- * or Basic `user:placeholder` as git does after a `401`.
44
- */
45
- export function presentsPlaceholder(value) {
46
- if (!value)
47
- return undefined;
48
- const [scheme = "", credential = ""] = value.trim().split(/\s+/, 2);
49
- switch (scheme.toLowerCase()) {
50
- case "bearer":
51
- case "token":
52
- return credential === GITHUB_TOKEN_PLACEHOLDER ? "bearer" : undefined;
53
- case "basic": {
54
- let decoded;
55
- try {
56
- decoded = atob(credential);
57
- }
58
- catch {
59
- return undefined;
60
- }
61
- const password = decoded.slice(decoded.indexOf(":") + 1);
62
- return decoded.includes(":") && password === GITHUB_TOKEN_PLACEHOLDER
63
- ? "basic"
64
- : undefined;
65
- }
66
- default:
67
- return undefined;
68
- }
69
- }
70
- /** The real credential, in the scheme the placeholder came in. */
71
- export function githubAuthorization(presented, token) {
72
- return presented === "basic"
73
- ? `Basic ${btoa(`${GIT_USER}:${token}`)}`
74
- : `Bearer ${token}`;
75
- }
76
- /** A refusal in GitHub's error shape, which `gh` and git both print. */
77
- export function githubError(message, status) {
78
- return new Response(JSON.stringify({ message }), {
79
- status,
80
- headers: { "content-type": "application/json" }
81
- });
82
- }