@dynamicagents/plugins 0.11.0 → 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 (95) 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/client.d.ts +3 -2
  5. package/dist/arc-agi/game-tools.d.ts +5 -6
  6. package/dist/arc-agi/index.d.ts +6 -8
  7. package/dist/arc-agi/index.js +3 -3
  8. package/dist/arc-agi/main-agent.d.ts +5 -8
  9. package/dist/arc-agi/main-agent.js +5 -8
  10. package/dist/arc-agi/recipe.d.ts +17 -20
  11. package/dist/arc-agi/recipe.js +17 -20
  12. package/dist/arc-agi/soul.d.ts +16 -27
  13. package/dist/arc-agi/soul.js +16 -27
  14. package/dist/arc-agi/store.d.ts +4 -5
  15. package/dist/arc-agi/store.js +4 -5
  16. package/dist/arc-agi/tools.d.ts +1 -1
  17. package/dist/arc-agi/tools.js +26 -19
  18. package/dist/arc-agi/types.d.ts +6 -7
  19. package/dist/claude-code/config.d.ts +88 -11
  20. package/dist/claude-code/config.js +11 -2
  21. package/dist/claude-code/credentials.d.ts +21 -9
  22. package/dist/claude-code/credentials.js +43 -9
  23. package/dist/claude-code/egress.d.ts +7 -13
  24. package/dist/claude-code/egress.js +9 -10
  25. package/dist/claude-code/events.d.ts +47 -0
  26. package/dist/claude-code/events.js +96 -10
  27. package/dist/claude-code/index.d.ts +31 -13
  28. package/dist/claude-code/index.js +62 -15
  29. package/dist/claude-code/run.d.ts +135 -41
  30. package/dist/claude-code/run.js +366 -61
  31. package/dist/computer/advisory.d.ts +31 -18
  32. package/dist/computer/advisory.js +30 -5
  33. package/dist/computer/context.d.ts +23 -0
  34. package/dist/computer/context.js +225 -0
  35. package/dist/computer/file-lock.d.ts +5 -0
  36. package/dist/computer/file-lock.js +39 -0
  37. package/dist/computer/gate.d.ts +8 -8
  38. package/dist/computer/gate.js +7 -7
  39. package/dist/computer/host/ca-trust.d.ts +88 -0
  40. package/dist/computer/host/ca-trust.js +303 -0
  41. package/dist/computer/host/container-deps.d.ts +54 -0
  42. package/dist/computer/host/container-deps.js +224 -0
  43. package/dist/computer/host/container-fault.d.ts +38 -0
  44. package/dist/computer/host/container-fault.js +58 -0
  45. package/dist/computer/host/git-host.d.ts +62 -0
  46. package/dist/computer/host/git-host.js +156 -0
  47. package/dist/computer/host/git-identity.d.ts +57 -0
  48. package/dist/computer/host/git-identity.js +147 -0
  49. package/dist/computer/host/install-job.d.ts +121 -0
  50. package/dist/computer/host/install-job.js +766 -0
  51. package/dist/computer/host/sync.d.ts +111 -0
  52. package/dist/computer/host/sync.js +124 -0
  53. package/dist/computer/host/wake.d.ts +19 -0
  54. package/dist/computer/host/wake.js +10 -0
  55. package/dist/computer/host/workspace.d.ts +424 -0
  56. package/dist/computer/host/workspace.js +1258 -0
  57. package/dist/computer/index.d.ts +70 -50
  58. package/dist/computer/index.js +79 -767
  59. package/dist/computer/install.d.ts +8 -12
  60. package/dist/computer/install.js +6 -9
  61. package/dist/computer/paths.d.ts +21 -16
  62. package/dist/computer/paths.js +40 -38
  63. package/dist/computer/read.d.ts +18 -22
  64. package/dist/computer/read.js +24 -27
  65. package/dist/computer/render.d.ts +28 -0
  66. package/dist/computer/render.js +34 -1
  67. package/dist/computer/shell.d.ts +45 -0
  68. package/dist/computer/shell.js +80 -0
  69. package/dist/computer/tools-exec.d.ts +3 -0
  70. package/dist/computer/tools-exec.js +269 -0
  71. package/dist/computer/tools-file.d.ts +4 -0
  72. package/dist/computer/tools-file.js +124 -0
  73. package/dist/computer/tools-find.d.ts +3 -0
  74. package/dist/computer/tools-find.js +216 -0
  75. package/dist/recall/index.d.ts +9 -3
  76. package/dist/recall/index.js +22 -12
  77. package/dist/repo/checkout.d.ts +34 -4
  78. package/dist/repo/checkout.js +36 -1
  79. package/dist/repo/context.d.ts +109 -0
  80. package/dist/repo/context.js +530 -0
  81. package/dist/repo/index.d.ts +6 -29
  82. package/dist/repo/index.js +17 -1027
  83. package/dist/repo/tools-clone.d.ts +4 -0
  84. package/dist/repo/tools-clone.js +192 -0
  85. package/dist/repo/tools-forge.d.ts +4 -0
  86. package/dist/repo/tools-forge.js +179 -0
  87. package/dist/repo/tools-review.d.ts +3 -0
  88. package/dist/repo/tools-review.js +373 -0
  89. package/dist/repo/tools-worktree.d.ts +4 -0
  90. package/dist/repo/tools-worktree.js +221 -0
  91. package/dist/triage/index.d.ts +6 -1
  92. package/dist/triage/index.js +32 -23
  93. package/dist/workspace/index.d.ts +3 -3
  94. package/dist/workspace/index.js +3 -3
  95. package/package.json +21 -15
@@ -2,7 +2,7 @@ import { generateText, Output, tool } from "ai";
2
2
  import { z } from "zod";
3
3
  import { createWorkersAI } from "workers-ai-provider";
4
4
  import { definePlugin } from "@dynamicagents/core";
5
- import { parseTurn, sessionText } from "@dynamicagents/core/agent";
5
+ import { gatewayLogFields, parseTurn, sessionText } from "@dynamicagents/core/agent";
6
6
  /**
7
7
  * `@dynamicagents/plugins/triage` — decide whether an inbound message deserves a
8
8
  * reply at all, *before* the tool loop runs.
@@ -161,43 +161,52 @@ export async function shouldReply(model, history, options = {}) {
161
161
  }
162
162
  }
163
163
  export function triage(config) {
164
- const { ai, aiGatewayId, modelId = DEFAULT_TRIAGE_MODEL_ID, historyMessages, messageMaxChars } = config;
164
+ const { ai, aiGatewayId, agentName, modelId = DEFAULT_TRIAGE_MODEL_ID, historyMessages, messageMaxChars } = config;
165
165
  /**
166
- * Built on first use, never at module scope. Cloudflare evaluates module scope
167
- * during `wrangler deploy` to validate the new version, and bindings are not
168
- * populated at that point — constructing eagerly makes `createWorkersAI` throw
169
- * "you must provide either a binding or credentials". The same laziness
170
- * protects a host that builds its runtime early.
166
+ * Built on first use, never at module scope, for the reason
167
+ * {@link file://../recall/index.ts} gives on its own provider — and the
168
+ * gateway goes on the model, never on the provider, for the reason it gives
169
+ * there too.
170
+ *
171
+ * The provider is what is memoized, not the model: the model carries the
172
+ * channel of the turn it judges, which differs turn to turn.
171
173
  *
172
174
  * No fallback model: triage fails open, so a second attempt on a different
173
175
  * model buys nothing a `true` does not already buy, at twice the latency in
174
176
  * front of every turn.
175
177
  */
176
- let model;
177
- const classifier = () => (model ??=
178
- config.model ??
179
- createWorkersAI({
180
- binding: ai,
181
- ...(aiGatewayId ? { gateway: { id: aiGatewayId } } : {})
182
- })(modelId));
178
+ let provider;
179
+ const classifier = (history) => {
180
+ if (config.model)
181
+ return config.model;
182
+ provider ??= createWorkersAI({ binding: ai });
183
+ if (!aiGatewayId)
184
+ return provider(modelId);
185
+ const judged = history.filter((m) => m.role === "user").at(-1);
186
+ const fields = gatewayLogFields({
187
+ agent: agentName,
188
+ phase: "triage",
189
+ channel: judged ? parseTurn(sessionText(judged))?.channel : undefined
190
+ });
191
+ return provider(modelId, { gateway: { id: aiGatewayId, ...fields } });
192
+ };
183
193
  return definePlugin({
184
194
  key: "triage",
185
195
  /**
186
196
  * Building the classifier is inside the guarantee, not in front of it.
187
197
  *
188
- * `shouldReply` catches its own failures, but it can only catch what happens
189
- * after it is entered — and `createWorkersAI` throws synchronously when the
190
- * binding is missing, before the call is ever made. That threw straight out
191
- * of this hook, which is the one outcome the whole design forbids: a triage
192
- * outage must degrade to *running the turn*, never to a silent agent.
193
- * (`createAgentRuntime` also treats a rejected gate as `true`, so the agent
194
- * stayed correct — but a plugin that documents fail-open should not be
195
- * relying on its host to make that true.)
198
+ * `shouldReply` catches its own failures, but only what happens after it is
199
+ * entered — and `createWorkersAI` throws synchronously when the binding is
200
+ * missing, before the call is ever made. A throw out of this hook is the one
201
+ * outcome the whole design forbids: a triage outage must degrade to *running
202
+ * the turn*, never to a silent agent. A host that also treats a rejected gate
203
+ * as `true` is a second layer, not a substitute — a plugin documenting
204
+ * fail-open cannot rely on its host to make that true.
196
205
  */
197
206
  shouldHandleTurn: async ({ history }) => {
198
207
  let model;
199
208
  try {
200
- model = classifier();
209
+ model = classifier(history);
201
210
  }
202
211
  catch (error) {
203
212
  console.warn("[triage] classifier unavailable, replying by default", {
@@ -11,9 +11,9 @@ import type { AgentPlugin, WorkspaceBacking, WorkspaceHandle } from "@dynamicage
11
11
  * changes"). An agent that never delegates file work should not carry that
12
12
  * dependency, so it ships here and is an optional peer.
13
13
  *
14
- * This is the only `@cloudflare/shell` import surface in the package — the same
15
- * discipline the predecessor kept, for the same reason: everything else codes
16
- * against core's stable wrapper rather than shell's large, churning API.
14
+ * This is the only `@cloudflare/shell` import surface in the package, and stays
15
+ * that way: everything else codes against core's stable wrapper rather than
16
+ * shell's large, churning API.
17
17
  *
18
18
  * Two halves, and they are independent:
19
19
  *
@@ -13,9 +13,9 @@ import { Workspace } from "@cloudflare/shell";
13
13
  * changes"). An agent that never delegates file work should not carry that
14
14
  * dependency, so it ships here and is an optional peer.
15
15
  *
16
- * This is the only `@cloudflare/shell` import surface in the package — the same
17
- * discipline the predecessor kept, for the same reason: everything else codes
18
- * against core's stable wrapper rather than shell's large, churning API.
16
+ * This is the only `@cloudflare/shell` import surface in the package, and stays
17
+ * that way: everything else codes against core's stable wrapper rather than
18
+ * shell's large, churning API.
19
19
  *
20
20
  * Two halves, and they are independent:
21
21
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamicagents/plugins",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Optional, composable capabilities for a Dynamic Agent: ARC-AGI-3, browser rendering, a Linux container, git and pull requests, workspace, episodic recall, and pre-turn triage. One subpath per plugin, so a bundle grows only with what it imports.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -77,22 +77,24 @@
77
77
  "types:check": "wrangler types --include-env=false --check && node scripts/verify-runtime-types.mjs",
78
78
  "format": "prettier --write .",
79
79
  "lint": "eslint .",
80
- "check": "npm run verify:peer-ranges && npm run types:check && prettier --check . && eslint . && tsc && npm run build",
80
+ "check": "npm run verify:peer-ranges && npm run verify:references && npm run types:check && prettier --check . && eslint . && tsc && npm run build && npm run verify:exports",
81
81
  "test": "vitest run",
82
82
  "test:watch": "vitest",
83
83
  "test:record": "RECORD=1 vitest run recorded.spec.ts",
84
84
  "verify:exports": "node scripts/verify-exports.mjs",
85
+ "verify:references": "node scripts/verify-references.mjs",
85
86
  "verify:peer-ranges": "node scripts/verify-peer-ranges.mjs",
86
87
  "prepack": "npm run build && npm run verify:exports",
87
- "prepublishOnly": "npm run check && npm test && npm run verify:exports",
88
+ "prepublishOnly": "npm run check && npm test",
88
89
  "prepare": "husky || true && npm run build"
89
90
  },
90
91
  "peerDependencies": {
91
- "@cloudflare/computer": "^0.2.1",
92
+ "@cloudflare/computer": "^0.3.1",
92
93
  "@cloudflare/shell": "^0.4.3",
93
- "@dynamicagents/core": ">=0.11.0 <0.12.0",
94
- "agents": ">=0.21.0 <0.23.0",
95
- "ai": "^7.0.77",
94
+ "@dynamicagents/core": ">=0.12.0 <0.13.0",
95
+ "@platformatic/vfs": "^0.4.0",
96
+ "agents": ">=0.24.0 <0.25.0",
97
+ "ai": "^7.0.88",
96
98
  "drizzle-orm": ">=0.45.2",
97
99
  "workers-ai-provider": "^4.0.0",
98
100
  "zod": "^4.4.3"
@@ -103,16 +105,20 @@
103
105
  },
104
106
  "@cloudflare/computer": {
105
107
  "optional": true
108
+ },
109
+ "@platformatic/vfs": {
110
+ "optional": true
106
111
  }
107
112
  },
108
113
  "devDependencies": {
109
- "@cloudflare/computer": "^0.2.1",
114
+ "@cloudflare/computer": "^0.3.1",
110
115
  "@cloudflare/shell": "0.4.3",
111
- "@cloudflare/vitest-plugin": "^1.1.5",
112
- "@dynamicagents/core": "^0.11.0",
113
- "@types/node": "^26.5.0",
114
- "agents": ">=0.21.0 <0.23.0",
115
- "ai": "^7.0.93",
116
+ "@platformatic/vfs": "^0.4.0",
117
+ "@cloudflare/vitest-plugin": "^1.1.9",
118
+ "@dynamicagents/core": "^0.12.0",
119
+ "@types/node": "^26.5.1",
120
+ "agents": "^0.24.0",
121
+ "ai": "^7.0.101",
116
122
  "drizzle-orm": ">=0.45.2",
117
123
  "eslint": "^10.10.0",
118
124
  "husky": "^9.1.7",
@@ -122,8 +128,8 @@
122
128
  "typescript-eslint": "^8.70.0",
123
129
  "vitest": "^4.1.11",
124
130
  "workers-ai-provider": "^4.0.0",
125
- "wrangler": "^4.129.1",
126
- "zod": "^4.5.4"
131
+ "wrangler": "^4.131.2",
132
+ "zod": "^4.6.5"
127
133
  },
128
134
  "engines": {
129
135
  "node": ">=24"