@dynamicagents/plugins 0.11.0 → 0.11.1

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.
@@ -73,8 +73,9 @@ export interface ArcClientOptions {
73
73
  maxAttempts?: number;
74
74
  /**
75
75
  * Stops every request this client makes, and every wait between them. Taken at
76
- * construction, because a client built for one tool surface stops on that
77
- * surface's signal — core's `ToolFamilyContext.signal` for a subagent's.
76
+ * construction, so a client lives no longer than the signal it stops on: a tool
77
+ * builds one per call, from that call's signal — see
78
+ * {@link file://./tools.ts buildArcGameTools}.
78
79
  */
79
80
  signal?: AbortSignal;
80
81
  }
@@ -45,9 +45,6 @@ export function buildArcGameTools(apiKey, ctx) {
45
45
  // cannot do — `Env` is the ambient interface `wrangler types` generates into a
46
46
  // *consumer's* app and does not exist here. Config-at-instantiation is also
47
47
  // the only thing that works on Workers at all, where `env` has no module scope.
48
- // The execution's signal goes in the same way, so a cancel reaches a request or
49
- // a backoff without every call having to carry it.
50
- const client = makeArcClient(apiKey, { signal: ctx.signal });
51
48
  const runtime = runtimeAs(ctx.runtime);
52
49
  // All settled before the model runs — it cannot pick a different game, and it
53
50
  // cannot see, choose, or name a card or a play at all. The game is the type's
@@ -183,7 +180,19 @@ export function buildArcGameTools(apiKey, ctx) {
183
180
  .optional()
184
181
  .describe("brief reasoning for this move or sequence")
185
182
  }),
186
- execute: async ({ steps, note }) => {
183
+ execute: async ({ steps, note }, { abortSignal }) => {
184
+ // The call's own signal, not the execution's: it fires at this call's time
185
+ // limit as well as on a cancel, and past that limit core has stopped
186
+ // waiting — a batch still sending would spend moves on the card that the
187
+ // model is told never finished, and it may send them again. A caller
188
+ // with no loop hands `execute` no signal, and then a cancel is all there
189
+ // is to stop at.
190
+ const signal = abortSignal ?? ctx.signal;
191
+ const client = makeArcClient(apiKey, { signal });
192
+ const stoppedBy = () => signal?.reason?.name ===
193
+ "TimeoutError"
194
+ ? "this call reached its time limit"
195
+ : "this call was cancelled";
187
196
  // Acting immediately is right — the results below carry the board — but
188
197
  // this chunk's orientation goes out first, so the model is never acting
189
198
  // on a board it can no longer see.
@@ -251,16 +260,16 @@ export function buildArcGameTools(apiKey, ctx) {
251
260
  // exactly as a crash mid-action always was.
252
261
  session.pendingAction = { action, x, y };
253
262
  await save(session);
254
- // A cancel is checked here, with the intent already on disk, because this
263
+ // The signal is checked here, with the intent already on disk, because this
255
264
  // is the last moment before the request: a check ahead of the write would
256
265
  // miss a cancel that lands during it. A request on an aborted signal is
257
266
  // never sent, so the intent is taken back rather than left for the next
258
267
  // chunk to warn about a move that never left. The batch ends the ordinary
259
268
  // way, with every step already sent recorded.
260
- if (ctx.signal?.aborted) {
269
+ if (signal?.aborted) {
261
270
  session.pendingAction = null;
262
271
  await save(session);
263
- trace.push(remaining(steps.length, index, "this call was cancelled"));
272
+ trace.push(remaining(steps.length, index, stoppedBy()));
264
273
  break;
265
274
  }
266
275
  const { frame, cookies } = await client.act({ action, gameId: session.gameId, guid: session.guid, x, y, note }, session.cookies);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamicagents/plugins",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
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",