@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.
Files changed (134) hide show
  1. package/README.md +59 -79
  2. package/dist/browser/index.d.ts +0 -2
  3. package/dist/browser/index.js +21 -27
  4. package/dist/claude-code/cards.d.ts +53 -0
  5. package/dist/claude-code/cards.js +272 -0
  6. package/dist/claude-code/config.d.ts +73 -31
  7. package/dist/claude-code/config.js +0 -2
  8. package/dist/claude-code/credentials.d.ts +21 -9
  9. package/dist/claude-code/credentials.js +43 -9
  10. package/dist/claude-code/egress.d.ts +15 -14
  11. package/dist/claude-code/egress.js +51 -14
  12. package/dist/claude-code/events.d.ts +153 -9
  13. package/dist/claude-code/events.js +289 -58
  14. package/dist/claude-code/github.d.ts +39 -0
  15. package/dist/claude-code/github.js +82 -0
  16. package/dist/claude-code/index.d.ts +24 -80
  17. package/dist/claude-code/index.js +19 -234
  18. package/dist/claude-code/model.d.ts +152 -0
  19. package/dist/claude-code/model.js +342 -0
  20. package/dist/claude-code/run.d.ts +283 -92
  21. package/dist/claude-code/run.js +620 -114
  22. package/dist/claude-code/session.d.ts +131 -0
  23. package/dist/claude-code/session.js +285 -0
  24. package/dist/claude-code/spec.d.ts +46 -0
  25. package/dist/claude-code/spec.js +83 -0
  26. package/dist/claude-code/verified.d.ts +15 -0
  27. package/dist/claude-code/verified.js +15 -0
  28. package/dist/computer/context.d.ts +19 -0
  29. package/dist/computer/context.js +222 -0
  30. package/dist/computer/file-lock.d.ts +5 -0
  31. package/dist/computer/file-lock.js +40 -0
  32. package/dist/computer/gate.d.ts +12 -12
  33. package/dist/computer/gate.js +12 -12
  34. package/dist/computer/index.d.ts +57 -255
  35. package/dist/computer/index.js +98 -1039
  36. package/dist/computer/paths.d.ts +47 -22
  37. package/dist/computer/paths.js +64 -49
  38. package/dist/computer/proxy.d.ts +45 -0
  39. package/dist/computer/proxy.js +234 -0
  40. package/dist/computer/render.d.ts +27 -38
  41. package/dist/computer/render.js +32 -65
  42. package/dist/computer/tools-exec.d.ts +3 -0
  43. package/dist/computer/tools-exec.js +268 -0
  44. package/dist/computer/tools-file.d.ts +12 -0
  45. package/dist/computer/tools-file.js +64 -0
  46. package/dist/computer/tools-grep.d.ts +3 -0
  47. package/dist/computer/tools-grep.js +129 -0
  48. package/dist/repo/checkout.d.ts +35 -6
  49. package/dist/repo/checkout.js +64 -6
  50. package/dist/repo/context.d.ts +135 -0
  51. package/dist/repo/context.js +582 -0
  52. package/dist/repo/index.d.ts +79 -57
  53. package/dist/repo/index.js +118 -1112
  54. package/dist/repo/tools-checks.d.ts +3 -0
  55. package/dist/repo/tools-checks.js +112 -0
  56. package/dist/repo/tools-clone.d.ts +4 -0
  57. package/dist/repo/tools-clone.js +192 -0
  58. package/dist/repo/tools-pr.d.ts +14 -0
  59. package/dist/repo/tools-pr.js +196 -0
  60. package/dist/repo/tools-review.d.ts +12 -0
  61. package/dist/repo/tools-review.js +393 -0
  62. package/dist/repo/tools-worktree.d.ts +4 -0
  63. package/dist/repo/tools-worktree.js +305 -0
  64. package/dist/repo/tools-worktrees.d.ts +12 -0
  65. package/dist/repo/tools-worktrees.js +48 -0
  66. package/dist/repo/url.d.ts +2 -2
  67. package/dist/repo/url.js +7 -7
  68. package/dist/scratch/index.d.ts +4 -4
  69. package/dist/scratch/index.js +12 -11
  70. package/dist/{computer → workspace}/advisory.d.ts +33 -20
  71. package/dist/{computer → workspace}/advisory.js +32 -7
  72. package/dist/workspace/ca-trust.d.ts +95 -0
  73. package/dist/workspace/ca-trust.js +312 -0
  74. package/dist/workspace/container-deps.d.ts +54 -0
  75. package/dist/workspace/container-deps.js +224 -0
  76. package/dist/workspace/container-fault.d.ts +38 -0
  77. package/dist/workspace/container-fault.js +73 -0
  78. package/dist/workspace/exec.d.ts +94 -0
  79. package/dist/workspace/exec.js +153 -0
  80. package/dist/workspace/format.d.ts +36 -0
  81. package/dist/workspace/format.js +57 -0
  82. package/dist/workspace/git-host.d.ts +79 -0
  83. package/dist/workspace/git-host.js +226 -0
  84. package/dist/workspace/git-identity.d.ts +57 -0
  85. package/dist/workspace/git-identity.js +147 -0
  86. package/dist/workspace/index.d.ts +43 -47
  87. package/dist/workspace/index.js +52 -112
  88. package/dist/workspace/install-job.d.ts +121 -0
  89. package/dist/workspace/install-job.js +866 -0
  90. package/dist/{computer → workspace}/install.d.ts +15 -19
  91. package/dist/{computer → workspace}/install.js +8 -11
  92. package/dist/workspace/object.d.ts +502 -0
  93. package/dist/workspace/object.js +1427 -0
  94. package/dist/workspace/open.d.ts +95 -0
  95. package/dist/workspace/open.js +63 -0
  96. package/dist/workspace/read.d.ts +16 -0
  97. package/dist/workspace/read.js +22 -0
  98. package/dist/workspace/shell.d.ts +45 -0
  99. package/dist/workspace/shell.js +80 -0
  100. package/dist/workspace/sync.d.ts +111 -0
  101. package/dist/workspace/sync.js +124 -0
  102. package/dist/workspace/wake.d.ts +19 -0
  103. package/dist/workspace/wake.js +10 -0
  104. package/package.json +28 -42
  105. package/dist/arc-agi/analysis.d.ts +0 -336
  106. package/dist/arc-agi/analysis.js +0 -829
  107. package/dist/arc-agi/client.d.ts +0 -82
  108. package/dist/arc-agi/client.js +0 -113
  109. package/dist/arc-agi/game-tools.d.ts +0 -25
  110. package/dist/arc-agi/game-tools.js +0 -26
  111. package/dist/arc-agi/index.d.ts +0 -42
  112. package/dist/arc-agi/index.js +0 -175
  113. package/dist/arc-agi/main-agent.d.ts +0 -27
  114. package/dist/arc-agi/main-agent.js +0 -65
  115. package/dist/arc-agi/recipe.d.ts +0 -51
  116. package/dist/arc-agi/recipe.js +0 -100
  117. package/dist/arc-agi/scorecard.d.ts +0 -118
  118. package/dist/arc-agi/scorecard.js +0 -163
  119. package/dist/arc-agi/soul.d.ts +0 -40
  120. package/dist/arc-agi/soul.js +0 -90
  121. package/dist/arc-agi/store.d.ts +0 -154
  122. package/dist/arc-agi/store.js +0 -216
  123. package/dist/arc-agi/tools.d.ts +0 -36
  124. package/dist/arc-agi/tools.js +0 -576
  125. package/dist/arc-agi/types.d.ts +0 -212
  126. package/dist/arc-agi/types.js +0 -19
  127. package/dist/claude-code/recipe.d.ts +0 -53
  128. package/dist/claude-code/recipe.js +0 -100
  129. package/dist/computer/read.d.ts +0 -137
  130. package/dist/computer/read.js +0 -203
  131. package/dist/recall/index.d.ts +0 -99
  132. package/dist/recall/index.js +0 -171
  133. package/dist/triage/index.d.ts +0 -355
  134. package/dist/triage/index.js +0 -302
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@dynamicagents/plugins",
3
- "version": "0.11.1",
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.",
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.",
5
5
  "keywords": [
6
6
  "ai-agents",
7
7
  "cloudflare-workers",
8
8
  "durable-objects",
9
9
  "agents-sdk",
10
- "arc-agi",
11
- "vectorize",
12
10
  "browser-rendering",
13
11
  "containers",
14
12
  "git",
@@ -32,26 +30,10 @@
32
30
  "LICENSE"
33
31
  ],
34
32
  "exports": {
35
- "./arc-agi": {
36
- "types": "./dist/arc-agi/index.d.ts",
37
- "import": "./dist/arc-agi/index.js"
38
- },
39
33
  "./browser": {
40
34
  "types": "./dist/browser/index.d.ts",
41
35
  "import": "./dist/browser/index.js"
42
36
  },
43
- "./workspace": {
44
- "types": "./dist/workspace/index.d.ts",
45
- "import": "./dist/workspace/index.js"
46
- },
47
- "./recall": {
48
- "types": "./dist/recall/index.d.ts",
49
- "import": "./dist/recall/index.js"
50
- },
51
- "./triage": {
52
- "types": "./dist/triage/index.d.ts",
53
- "import": "./dist/triage/index.js"
54
- },
55
37
  "./repo": {
56
38
  "types": "./dist/repo/index.d.ts",
57
39
  "import": "./dist/repo/index.js"
@@ -64,6 +46,10 @@
64
46
  "types": "./dist/claude-code/index.d.ts",
65
47
  "import": "./dist/claude-code/index.js"
66
48
  },
49
+ "./workspace": {
50
+ "types": "./dist/workspace/index.d.ts",
51
+ "import": "./dist/workspace/index.js"
52
+ },
67
53
  "./computer": {
68
54
  "types": "./dist/computer/index.d.ts",
69
55
  "import": "./dist/computer/index.js"
@@ -77,43 +63,43 @@
77
63
  "types:check": "wrangler types --include-env=false --check && node scripts/verify-runtime-types.mjs",
78
64
  "format": "prettier --write .",
79
65
  "lint": "eslint .",
80
- "check": "npm run verify:peer-ranges && npm run types:check && prettier --check . && eslint . && tsc && npm run build",
66
+ "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
67
  "test": "vitest run",
82
68
  "test:watch": "vitest",
83
- "test:record": "RECORD=1 vitest run recorded.spec.ts",
84
69
  "verify:exports": "node scripts/verify-exports.mjs",
70
+ "verify:references": "node scripts/verify-references.mjs",
85
71
  "verify:peer-ranges": "node scripts/verify-peer-ranges.mjs",
72
+ "probe:claude-code": "npm run build && node scripts/probe-claude-code.mjs",
86
73
  "prepack": "npm run build && npm run verify:exports",
87
- "prepublishOnly": "npm run check && npm test && npm run verify:exports",
74
+ "prepublishOnly": "npm run check && npm test",
88
75
  "prepare": "husky || true && npm run build"
89
76
  },
90
77
  "peerDependencies": {
91
- "@cloudflare/computer": "^0.2.1",
92
- "@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",
96
- "drizzle-orm": ">=0.45.2",
97
- "workers-ai-provider": "^4.0.0",
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",
83
+ "ai": "^7.0.88",
98
84
  "zod": "^4.4.3"
99
85
  },
100
86
  "peerDependenciesMeta": {
101
- "@cloudflare/shell": {
87
+ "@cloudflare/computer": {
102
88
  "optional": true
103
89
  },
104
- "@cloudflare/computer": {
90
+ "@platformatic/vfs": {
105
91
  "optional": true
106
92
  }
107
93
  },
108
94
  "devDependencies": {
109
- "@cloudflare/computer": "^0.2.1",
110
- "@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
- "drizzle-orm": ">=0.45.2",
95
+ "@cloudflare/computer": "^0.4.0",
96
+ "@cloudflare/think": "^0.20.0",
97
+ "@cloudflare/vitest-plugin": "^1.1.9",
98
+ "@dynamicagents/core": "^0.13.1",
99
+ "@platformatic/vfs": "^0.4.0",
100
+ "@types/node": "^26.5.1",
101
+ "agents": "^0.26.0",
102
+ "ai": "^7.0.101",
117
103
  "eslint": "^10.10.0",
118
104
  "husky": "^9.1.7",
119
105
  "prettier": "^3.9.6",
@@ -122,8 +108,8 @@
122
108
  "typescript-eslint": "^8.70.0",
123
109
  "vitest": "^4.1.11",
124
110
  "workers-ai-provider": "^4.0.0",
125
- "wrangler": "^4.129.1",
126
- "zod": "^4.5.4"
111
+ "wrangler": "^4.131.2",
112
+ "zod": "^4.6.5"
127
113
  },
128
114
  "engines": {
129
115
  "node": ">=24"
@@ -1,336 +0,0 @@
1
- /**
2
- * Pure grid-analysis helpers for ARC-AGI-3 frames. No I/O — every function is a
3
- * deterministic transform of a 64×64 grid (color values 0–15), unit-tested in
4
- * isolation. The tool family calls these to render compact observations for the
5
- * model instead of dumping raw grids into context.
6
- *
7
- * Two rendering registers, deliberately kept apart:
8
- *
9
- * - **Prose** (diffs, shapes, histogram) names its colors: `blue->white` carries
10
- * structure a bare `9->0` hides, and no tool input ever takes a color, so the
11
- * index is never needed as an argument.
12
- * - **Grids** ({@link renderGrid}, {@link renderRegion}) stay one character per
13
- * cell and carry a {@link renderLegend} instead. One char per cell is the only
14
- * reason a 64×64 board is legible at all; a named cell would be unreadable and
15
- * cost ~50× the tokens.
16
- */
17
- /**
18
- * The ARC-AGI-3 16-color palette, index → name.
19
- *
20
- * Source: `agents/templates/multimodal.py` in `arcprize/ARC-AGI-3-Agents` (ARC
21
- * Prize's own agent template), which maps these indices to RGBA for multimodal
22
- * play. Taken from there rather than assumed, because **ARC-AGI-3's palette is
23
- * unrelated to ARC-AGI-1's**: here 0 is *white* and 1–5 are a greyscale ramp,
24
- * where the familiar ARC-AGI-1 mapping would say 0=black, 1=blue, 2=red. Note
25
- * that same repo carries a second, contradictory `COLOR_PALETTE` in
26
- * `langgraph_thinking/vision.py` — that one is incomplete and does not match the
27
- * engine; do not use it.
28
- *
29
- * The pairs matter to a player: 6/7 and 9/10 and 2/3 are related shades, which
30
- * the names convey and the indices do not.
31
- */
32
- export declare const COLOR_NAMES: readonly ["white", "off-white", "neutral-light", "neutral", "off-black", "black", "magenta", "magenta-light", "red", "blue", "blue-light", "yellow", "orange", "maroon", "green", "purple"];
33
- /** Color 0 (white) — treated as background by {@link locateComponents}. */
34
- export declare const BACKGROUND_COLOR = 0;
35
- /**
36
- * Name of a color index. An out-of-range value renders as `color <n>` rather
37
- * than throwing: a malformed frame should degrade the wording, not fail the turn.
38
- */
39
- export declare function colorName(color: number): string;
40
- /** The current board: the LAST grid of a frame response's grid array. */
41
- export declare function lastGrid(frame: number[][][]): number[][];
42
- /**
43
- * Bare hex rows, one char per cell, no labels — the round-trippable **storage**
44
- * form, paired with {@link parseGrid}. Deliberately distinct from
45
- * {@link renderGrid}, which adds a legend, rulers and row collapsing and so
46
- * cannot be parsed back.
47
- */
48
- export declare function serializeGrid(grid: number[][]): string;
49
- /** Inverse of {@link serializeGrid}. */
50
- export declare function parseGrid(hex: string): number[][];
51
- export interface CellChange {
52
- row: number;
53
- col: number;
54
- from: number;
55
- to: number;
56
- }
57
- /** The rectangle enclosing a set of cells. */
58
- export interface Box {
59
- top: number;
60
- left: number;
61
- bottom: number;
62
- right: number;
63
- }
64
- export interface GridDiff {
65
- changed: number;
66
- /** Up to `cap` changed cells (for a compact summary of a large change). */
67
- cells: CellChange[];
68
- /** Rectangle enclosing ALL changed cells (not just the capped ones). */
69
- box: Box | null;
70
- }
71
- /** Cell-by-cell diff of two grids. `cap` bounds the returned cell list. */
72
- export declare function diffGrids(a: number[][] | null, b: number[][], cap?: number): GridDiff;
73
- /** `rows 3-5, cols 10-12` — or a single row/col rendered without the range. */
74
- export declare function describeBox(box: Box): string;
75
- /** `(3,10) blue->white` — one changed cell, colors named. */
76
- export declare function describeCell(cell: CellChange): string;
77
- /** Count of each color present, descending by count. */
78
- export declare function colorHistogram(grid: number[][]): Array<{
79
- color: number;
80
- count: number;
81
- }>;
82
- /** One 4-connected same-color region, with where it sits and how big it is. */
83
- export interface Component extends Box {
84
- color: number;
85
- size: number;
86
- }
87
- export interface ComponentSummary {
88
- color: number;
89
- components: number;
90
- largest: number;
91
- }
92
- /**
93
- * Every 4-connected same-color region, with its bounding box, largest first.
94
- * Skips {@link BACKGROUND_COLOR}.
95
- *
96
- * The bounding boxes are the point: a rollup of counts alone tells the model
97
- * *that* there are three shapes and never *where* they are, which leaves dumping
98
- * the whole 64×64 grid as the only way to locate anything. The flood fill has to
99
- * visit every cell regardless, so tracking min/max row/col is free.
100
- */
101
- export declare function locateComponents(grid: number[][]): Component[];
102
- /**
103
- * Summarize components per color: how many, and the largest. Derived from
104
- * {@link locateComponents} so only one flood fill ever runs.
105
- */
106
- export declare function connectedComponents(grid: number[][]): ComponentSummary[];
107
- /**
108
- * How much of its bounding box a region actually occupies, 0–1.
109
- *
110
- * Boxes are well formed by construction wherever this is used: every caller
111
- * passes either a {@link Component} from {@link locateComponents} or a
112
- * {@link unionBox} of those, and a flood fill cannot produce `bottom < top`. So
113
- * `area` is always at least 1, and the zero-area branch below is unreachable —
114
- * kept only so a malformed box degrades to 0 instead of dividing by zero.
115
- *
116
- * The result is deliberately **not** clamped into 0–1. An out-of-range value here
117
- * could only mean a caller broke that invariant, and the way to learn that is a
118
- * region classified absurdly, not a number quietly corrected into looking sane.
119
- */
120
- export declare function fillRatio(box: Box, size: number): number;
121
- /**
122
- * A band of consecutive rows in which one color occupies exactly the same
123
- * columns, and the column runs it occupies there.
124
- */
125
- export interface SpanBand extends Pick<Box, "top" | "bottom"> {
126
- /** Inclusive `[first, last]` column runs, left to right. */
127
- cols: Array<[number, number]>;
128
- /** Runs the cap dropped, so a truncated band never reads as a complete one. */
129
- hidden: number;
130
- }
131
- /**
132
- * Where one color sits, row band by row band — the view a bounding box cannot
133
- * give for a maze, a frame, or any other structure that is mostly holes.
134
- *
135
- * Keyed by **color rather than component** on purpose. A wall that a doorway
136
- * splits into three components is one thing to a player, and three boxes describe
137
- * it worse than one span list does; the flood fill's notion of connectedness is an
138
- * implementation detail here, not something the model should have to reassemble.
139
- *
140
- * Rows whose runs are identical collapse into one band, the same trick
141
- * {@link renderGrid} uses — and for the same reason, since ARC boards are banded.
142
- * On a real 64×64 maze it turns 64 rows into ~20 bands.
143
- */
144
- export declare function colorSpans(grid: number[][], color: number): SpanBand[];
145
- /**
146
- * Runs named per band, one line each. Both caps exist to bound the render on a
147
- * board this encoding suits badly — a checkerboard is 32 runs in every one of 64
148
- * rows — and both announce themselves, so a clipped view is never mistaken for
149
- * the whole of one.
150
- */
151
- export declare function renderSpans(bands: SpanBand[]): string;
152
- /**
153
- * Named regions with their positions, largest first — the locational view.
154
- *
155
- * A bounding box describes a region only when the region roughly fills it. That
156
- * holds for the movable pieces and fails for exactly the two things a route
157
- * depends on: on a real `ls20` board the model was told `off-black: rows 0-63,
158
- * cols 0-63 (2129 cells)` for the whole maze and `neutral: rows 5-54, cols 9-58
159
- * (1354 cells)` for the whole floor, both a shade over half-filled. The first says
160
- * nothing; the second is worse, asserting a 50×50 open arena of which 46% is wall.
161
- * Blind to both, the play read its route off the boxes and walked into walls, then
162
- * spent a dozen turns rebuilding the maze through 11×11 `region` peepholes.
163
- *
164
- * So a region that sprawls is rendered as {@link colorSpans} instead — every row
165
- * band and the columns it occupies, which is the same fact at a resolution that
166
- * can be acted on. Sprawl is judged per color and the whole color is then spanned
167
- * at once, so a wall and the doorway splitting it read as one terrain layer rather
168
- * than as two boxes that overlap everything.
169
- *
170
- * `cap` bounds the boxed list; anything beyond it is reported as a count so the
171
- * model knows the view is truncated rather than complete.
172
- */
173
- export declare function renderShapes(grid: number[][], cap?: number): string;
174
- /**
175
- * What became of one shape between two frames.
176
- *
177
- * The four cases are kept apart because only **one** of them answers the question
178
- * an action asks — did anything move? Folding a counter ticking down into the
179
- * same bucket as a step taken is exactly the mistake {@link diffGrids} cannot
180
- * help making: in `ls20` every action shrinks a fuel bar by four cells, so a move
181
- * into a wall reports "4 cells changed" and reads, to a model told that `0 cells
182
- * changed` means blocked, as a move that worked. It spent eleven actions on that
183
- * misreading. A wall is `moved: []` here, whatever else on the board ticked.
184
- */
185
- export type ShapeChange = {
186
- kind: "moved";
187
- /** Where it was, with its color and cell count. */
188
- from: Component;
189
- /** Where it is now — same color and same cell count, by construction. */
190
- to: Box;
191
- dRow: number;
192
- dCol: number;
193
- }
194
- /** Same color, still overlapping, different cell count — a bar, a trail, a fill. */
195
- | {
196
- kind: "resized";
197
- from: Component;
198
- to: Component;
199
- }
200
- /**
201
- * Same footprint and same cell count, a different color — a repaint in place,
202
- * which is what a click game does instead of moving anything.
203
- */
204
- | {
205
- kind: "recolored";
206
- from: Component;
207
- to: Component;
208
- } | {
209
- kind: "appeared";
210
- shape: Component;
211
- } | {
212
- kind: "gone";
213
- shape: Component;
214
- };
215
- export type MovedShape = Extract<ShapeChange, {
216
- kind: "moved";
217
- }>;
218
- /**
219
- * Two frames' shapes, matched. Split rather than one list because both consumers
220
- * want the split: the renderer leads with movement, and a caller summing a batch
221
- * accumulates only the moves.
222
- */
223
- export interface ShapeDelta {
224
- /** Every shape that travelled, largest first. */
225
- moved: MovedShape[];
226
- /** Resized, appeared and disappeared shapes, largest first. */
227
- other: ShapeChange[];
228
- }
229
- /**
230
- * Above this many changed shapes, a frame is a repaint (a level change, a
231
- * transform) rather than a board where things moved, and naming twenty shapes
232
- * that all "appeared" says less than the cell diff does. {@link renderShapeDelta}
233
- * declines, and its caller falls back.
234
- */
235
- export declare const MAX_SHAPE_CHANGES = 10;
236
- /**
237
- * Match the shapes of two frames: what moved, what changed size, what came and
238
- * went. Null when there is no earlier frame to compare against.
239
- *
240
- * Three passes, and the order is the whole design. Color **and** cell count
241
- * first, because a rigid object that travelled keeps both — that pass is what
242
- * finds a move, and its pairs are never reconsidered. Color alone second, over
243
- * what is left, which is what a bar losing cells or a trail growing looks like.
244
- * **Footprint** alone last, over what neither pass claimed, which is a shape that
245
- * changed color without moving — see {@link matchRepaints}.
246
- */
247
- export declare function diffShapes(before: number[][] | null, after: number[][]): ShapeDelta | null;
248
- /** {@link diffShapes} over already-located components. Exported for tests. */
249
- export declare function matchShapes(before: Component[], after: Component[]): ShapeDelta;
250
- /** `down 5, left 10` — a displacement in board directions, zero terms dropped. */
251
- export declare function describeShift(dRow: number, dCol: number): string;
252
- /**
253
- * One action's effect as movement: `nothing moved` when the board's objects
254
- * stayed put, whatever a counter did alongside them.
255
- *
256
- * That phrase is spent carefully, because the soul teaches it as the signal for
257
- * *blocked or refused*: it leads a step only when everything else the delta holds
258
- * is a {@link ShapeChange} of kind `resized`, which is a counter or a bar doing
259
- * its own bookkeeping. A step that repainted a block, or made one appear, changed
260
- * the board — no object travelled, and saying so as `nothing moved` told a logged
261
- * `ft09` play that twenty clicks which each toggled a 36-cell block had been
262
- * refused.
263
- *
264
- * Null means *this view has nothing to say* — either no shape can be paired
265
- * across the frames, or so many changed that they are a repaint
266
- * ({@link MAX_SHAPE_CHANGES}). Both leave the cell diff as the better witness, so
267
- * the caller renders that instead rather than printing a confident "nothing
268
- * moved" over a board that changed completely.
269
- */
270
- export declare function renderShapeDelta(delta: ShapeDelta, cap?: number): string | null;
271
- /** Where one shape ended up over a whole batch, and how many steps took it there. */
272
- export interface ShapeTravel {
273
- shape: Component;
274
- dRow: number;
275
- dCol: number;
276
- /** Steps in which this shape moved at all. */
277
- moves: number;
278
- }
279
- /**
280
- * Fold one step's moves into a batch's running totals.
281
- *
282
- * Identity is *position*, not appearance. Boards carrying two identical shapes
283
- * are the ordinary case, not the contrived one — a pair of blocks, a player and
284
- * its twin — and summing them under one color-and-size key reports two shapes
285
- * that passed each other as one shape that never moved, which is the single
286
- * worst thing this line could say.
287
- *
288
- * Each entry is re-keyed to where its shape landed, which is exactly where the
289
- * next step's diff will find it: the frames chain, step N's board being step
290
- * N+1's starting board, so a position is a stable handle for as long as the
291
- * shape keeps its color and size. Sources are cleared before any destination is
292
- * written, so a shape sliding into the cell another just vacated inherits its
293
- * own history rather than the vacater's.
294
- */
295
- export declare function trackTravel(travels: Map<string, ShapeTravel>, moved: MovedShape[]): void;
296
- /**
297
- * A shape's net travel over a batch, counted in **moves** rather than cells.
298
- *
299
- * Cells are the misleading unit for a sequence: two presses that each slide a
300
- * selector five cells are not "ten cells down", they are two moves of five, and a
301
- * model reading the former will place itself ten cells from where it is. So the
302
- * per-move stride is stated whenever the total divides by the moves that produced
303
- * it — observed from the steps, never assumed.
304
- */
305
- export declare function renderTravel(travel: ShapeTravel): string;
306
- /** `0=white 9=blue b=yellow` — maps grid characters to names, present colors only. */
307
- export declare function renderLegend(grid: number[][]): string;
308
- /**
309
- * The full board: a legend, a column ruler, then one labeled line per row —
310
- * with **runs of identical rows collapsed** into a single `12-31 |` band.
311
- *
312
- * Labels exist because a model cannot reliably count to column 37 across 64
313
- * undelimited characters; miscounting there costs a wrong click and two more
314
- * turns. Collapsing exploits how banded ARC boards are without run-length
315
- * encoding *within* a row, which would destroy the 2-D structure that this view
316
- * exists to convey.
317
- */
318
- export declare function renderGrid(grid: number[][]): string;
319
- /**
320
- * A localized view: a `radius`-cell square around (centerRow, centerCol), with
321
- * **absolute** row and column labels. The labels are what make the view usable —
322
- * an unlabeled block cannot be mapped back to a coordinate to click.
323
- *
324
- * The window is **clipped** on every side, never padded, which is what makes the
325
- * header's `cols` anchor true: character `i` of a body line is column
326
- * `firstCol + i`. Padding off-grid columns with spaces instead would shift that
327
- * mapping by up to `radius` near the left edge.
328
- *
329
- * The header used to be the only thing to count from, on the reasoning that a
330
- * window this narrow does not need a ruler. Logs disagree: asked to place a cell
331
- * in an 11-wide window, the model counted the characters by hand and got them
332
- * wrong — "cols 34-38, 5 chars wait that's 10... hmm" — then reasoned on the wrong
333
- * columns. So the window is ruled too, at {@link REGION_RULER_STEP} rather than
334
- * {@link renderGrid}'s tens, which a window this size can miss entirely.
335
- */
336
- export declare function renderRegion(grid: number[][], centerRow: number, centerCol: number, radius?: number): string;