@ai-hero/sandcastle 0.4.7 → 0.4.8
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 +152 -27
- package/dist/CopyToWorktree.d.ts +9 -0
- package/dist/CopyToWorktree.d.ts.map +1 -0
- package/dist/{CopyToWorkspace.js → CopyToWorktree.js} +9 -3
- package/dist/CopyToWorktree.js.map +1 -0
- package/dist/DockerLifecycle.d.ts +2 -0
- package/dist/DockerLifecycle.d.ts.map +1 -1
- package/dist/DockerLifecycle.js +7 -0
- package/dist/DockerLifecycle.js.map +1 -1
- package/dist/ErrorHandler.d.ts.map +1 -1
- package/dist/ErrorHandler.js +20 -2
- package/dist/ErrorHandler.js.map +1 -1
- package/dist/InitService.d.ts +6 -1
- package/dist/InitService.d.ts.map +1 -1
- package/dist/InitService.js +90 -56
- package/dist/InitService.js.map +1 -1
- package/dist/MountConfig.d.ts +13 -2
- package/dist/MountConfig.d.ts.map +1 -1
- package/dist/Orchestrator.d.ts +1 -1
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +6 -7
- package/dist/Orchestrator.js.map +1 -1
- package/dist/PromptPreprocessor.d.ts +2 -2
- package/dist/PromptPreprocessor.d.ts.map +1 -1
- package/dist/PromptPreprocessor.js +7 -2
- package/dist/PromptPreprocessor.js.map +1 -1
- package/dist/SandboxFactory.d.ts +7 -9
- package/dist/SandboxFactory.d.ts.map +1 -1
- package/dist/SandboxFactory.js +21 -23
- package/dist/SandboxFactory.js.map +1 -1
- package/dist/SandboxLifecycle.d.ts.map +1 -1
- package/dist/SandboxLifecycle.js +33 -9
- package/dist/SandboxLifecycle.js.map +1 -1
- package/dist/SandboxProvider.d.ts +7 -7
- package/dist/SandboxProvider.d.ts.map +1 -1
- package/dist/WorktreeManager.d.ts +3 -3
- package/dist/WorktreeManager.d.ts.map +1 -1
- package/dist/WorktreeManager.js +14 -3
- package/dist/WorktreeManager.js.map +1 -1
- package/dist/createSandbox.d.ts +24 -1
- package/dist/createSandbox.d.ts.map +1 -1
- package/dist/createSandbox.js +227 -131
- package/dist/createSandbox.js.map +1 -1
- package/dist/createWorktree.d.ts +121 -0
- package/dist/createWorktree.d.ts.map +1 -0
- package/dist/createWorktree.js +314 -0
- package/dist/createWorktree.js.map +1 -0
- package/dist/errors.d.ts +101 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +38 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interactive.d.ts +1 -1
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +54 -45
- package/dist/interactive.js.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +5 -5
- package/dist/run.js.map +1 -1
- package/dist/sandboxes/daytona.js +4 -4
- package/dist/sandboxes/daytona.js.map +1 -1
- package/dist/sandboxes/docker.d.ts +9 -0
- package/dist/sandboxes/docker.d.ts.map +1 -1
- package/dist/sandboxes/docker.js +15 -5
- package/dist/sandboxes/docker.js.map +1 -1
- package/dist/sandboxes/no-sandbox.js +4 -4
- package/dist/sandboxes/no-sandbox.js.map +1 -1
- package/dist/sandboxes/podman.d.ts +9 -0
- package/dist/sandboxes/podman.d.ts.map +1 -1
- package/dist/sandboxes/podman.js +21 -5
- package/dist/sandboxes/podman.js.map +1 -1
- package/dist/sandboxes/test-isolated.js +5 -5
- package/dist/sandboxes/test-isolated.js.map +1 -1
- package/dist/sandboxes/vercel.js +7 -7
- package/dist/sandboxes/vercel.js.map +1 -1
- package/dist/startSandbox.d.ts +7 -6
- package/dist/startSandbox.d.ts.map +1 -1
- package/dist/startSandbox.js +38 -19
- package/dist/startSandbox.js.map +1 -1
- package/dist/syncIn.js +7 -7
- package/dist/syncIn.js.map +1 -1
- package/dist/syncOut.js +6 -6
- package/dist/syncOut.js.map +1 -1
- package/dist/templates/parallel-planner/implement-prompt.md +2 -2
- package/dist/templates/parallel-planner/main.mts +2 -6
- package/dist/templates/parallel-planner/merge-prompt.md +5 -1
- package/dist/templates/parallel-planner-with-review/implement-prompt.md +2 -2
- package/dist/templates/parallel-planner-with-review/main.mts +28 -62
- package/dist/templates/parallel-planner-with-review/merge-prompt.md +5 -1
- package/dist/templates/sequential-reviewer/main.mts +3 -3
- package/dist/templates/simple-loop/main.mts +2 -2
- package/package.json +1 -1
- package/dist/CopyToWorkspace.d.ts +0 -8
- package/dist/CopyToWorkspace.d.ts.map +0 -1
- package/dist/CopyToWorkspace.js.map +0 -1
- package/dist/templates/blank/.env.example +0 -5
- package/dist/templates/parallel-planner/.env.example +0 -5
- package/dist/templates/parallel-planner-with-review/.env.example +0 -5
- package/dist/templates/sequential-reviewer/.env.example +0 -5
- package/dist/templates/simple-loop/.env.example +0 -5
package/README.md
CHANGED
|
@@ -65,14 +65,16 @@ await run({
|
|
|
65
65
|
|
|
66
66
|
## Sandbox Providers
|
|
67
67
|
|
|
68
|
-
Sandcastle uses a `SandboxProvider` to create isolated environments. The `sandbox` option on `run()` and `createSandbox()` accepts any provider. A no-sandbox option is also available for `interactive()`
|
|
68
|
+
Sandcastle uses a `SandboxProvider` to create isolated environments. The `sandbox` option on `run()` and `createSandbox()` accepts any provider. A no-sandbox option is also available for `interactive()` and `wt.interactive()`. Built-in providers:
|
|
69
69
|
|
|
70
|
-
| Provider | Import path | Type | Accepted by
|
|
71
|
-
| ---------- | ------------------------------------------ | ---------- |
|
|
72
|
-
| Docker | `@ai-hero/sandcastle/sandboxes/docker` | Bind-mount | `run()`, `createSandbox()`, `interactive()`
|
|
73
|
-
| Podman | `@ai-hero/sandcastle/sandboxes/podman` | Bind-mount | `run()`, `createSandbox()`, `interactive()`
|
|
74
|
-
| Vercel | `@ai-hero/sandcastle/sandboxes/vercel` | Isolated | `run()`, `createSandbox()`, `interactive()`
|
|
75
|
-
| No-sandbox | `@ai-hero/sandcastle/sandboxes/no-sandbox` | None | `interactive()`
|
|
70
|
+
| Provider | Import path | Type | Accepted by |
|
|
71
|
+
| ---------- | ------------------------------------------ | ---------- | --------------------------------------------- |
|
|
72
|
+
| Docker | `@ai-hero/sandcastle/sandboxes/docker` | Bind-mount | `run()`, `createSandbox()`, `interactive()` |
|
|
73
|
+
| Podman | `@ai-hero/sandcastle/sandboxes/podman` | Bind-mount | `run()`, `createSandbox()`, `interactive()` |
|
|
74
|
+
| Vercel | `@ai-hero/sandcastle/sandboxes/vercel` | Isolated | `run()`, `createSandbox()`, `interactive()` |
|
|
75
|
+
| No-sandbox | `@ai-hero/sandcastle/sandboxes/no-sandbox` | None | `interactive()`, `wt.interactive()` (default) |
|
|
76
|
+
|
|
77
|
+
Worktree methods (`wt.run()`, `wt.interactive()`, `wt.createSandbox()`) accept the same providers as their top-level counterparts. `wt.interactive()` defaults to `noSandbox()` when no sandbox is specified.
|
|
76
78
|
|
|
77
79
|
```typescript
|
|
78
80
|
import { docker } from "@ai-hero/sandcastle/sandboxes/docker";
|
|
@@ -91,7 +93,7 @@ await run({
|
|
|
91
93
|
await interactive({
|
|
92
94
|
agent: claudeCode("claude-opus-4-6"),
|
|
93
95
|
sandbox: noSandbox(),
|
|
94
|
-
prompt: "...",
|
|
96
|
+
prompt: "...", // optional — omit to launch the TUI with no initial prompt
|
|
95
97
|
});
|
|
96
98
|
```
|
|
97
99
|
|
|
@@ -132,11 +134,16 @@ const result = await run({
|
|
|
132
134
|
sandbox: docker({
|
|
133
135
|
imageName: "sandcastle:local",
|
|
134
136
|
// Optional: mount host directories into the sandbox (e.g. package manager caches)
|
|
137
|
+
// hostPath supports absolute, tilde-expanded (~), and relative paths (resolved from cwd).
|
|
138
|
+
// sandboxPath supports absolute and relative paths (resolved from the sandbox repo directory).
|
|
135
139
|
mounts: [
|
|
136
140
|
{ hostPath: "~/.npm", sandboxPath: "/home/agent/.npm", readonly: true },
|
|
141
|
+
{ hostPath: "data", sandboxPath: "data" }, // mounts <cwd>/data → <sandbox-repo>/data
|
|
137
142
|
],
|
|
138
143
|
// Optional: provider-level env vars merged at launch time
|
|
139
144
|
env: { DOCKER_SPECIFIC: "value" },
|
|
145
|
+
// Optional: attach container to Docker network(s) — string or string[]
|
|
146
|
+
network: "my-network",
|
|
140
147
|
}),
|
|
141
148
|
|
|
142
149
|
// Branch strategy — controls how the agent's changes relate to branches.
|
|
@@ -166,7 +173,7 @@ const result = await run({
|
|
|
166
173
|
|
|
167
174
|
// Host-relative file paths to copy into the sandbox before the container starts.
|
|
168
175
|
// Not supported with branchStrategy: { type: "head" }.
|
|
169
|
-
|
|
176
|
+
copyToWorktree: [".env"],
|
|
170
177
|
|
|
171
178
|
// How to record progress. Default: write to a file under .sandcastle/logs/
|
|
172
179
|
logging: { type: "file", path: ".sandcastle/logs/my-run.log" },
|
|
@@ -264,7 +271,7 @@ if (closeResult.preservedWorktreePath) {
|
|
|
264
271
|
| `branch` | string | — | **Required.** Explicit branch for the sandbox |
|
|
265
272
|
| `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`, `podman()`) |
|
|
266
273
|
| `hooks` | object | — | Lifecycle hooks (`onSandboxReady`) — run once at creation time |
|
|
267
|
-
| `
|
|
274
|
+
| `copyToWorktree` | string[] | — | Host-relative file paths to copy into the sandbox at creation time |
|
|
268
275
|
| `throwOnDuplicateWorktree` | boolean | `true` | When `false`, reuse an existing worktree instead of failing on collision |
|
|
269
276
|
|
|
270
277
|
#### `Sandbox`
|
|
@@ -307,6 +314,124 @@ if (closeResult.preservedWorktreePath) {
|
|
|
307
314
|
| ----------------------- | ------- | ------------------------------------------------------------------------ |
|
|
308
315
|
| `preservedWorktreePath` | string? | Host path to the preserved worktree, set when it had uncommitted changes |
|
|
309
316
|
|
|
317
|
+
### `createWorktree()` — independent worktree lifecycle
|
|
318
|
+
|
|
319
|
+
Use `createWorktree()` when you need a worktree (git worktree) as an independent, first-class concept — separate from any sandbox. This is useful when you want to run an interactive session first and then hand the same worktree to a sandboxed AFK agent.
|
|
320
|
+
|
|
321
|
+
Only `branch` and `merge-to-head` strategies are accepted; `head` is a compile-time type error since it means no worktree.
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
import { createWorktree } from "@ai-hero/sandcastle";
|
|
325
|
+
|
|
326
|
+
await using wt = await createWorktree({
|
|
327
|
+
branchStrategy: { type: "branch", branch: "agent/fix-42" },
|
|
328
|
+
copyToWorktree: ["node_modules"],
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
console.log(wt.worktreePath); // host path to the worktree
|
|
332
|
+
console.log(wt.branch); // "agent/fix-42"
|
|
333
|
+
|
|
334
|
+
// Run an interactive session in the worktree (defaults to noSandbox)
|
|
335
|
+
await wt.interactive({
|
|
336
|
+
agent: claudeCode("claude-opus-4-6"),
|
|
337
|
+
prompt: "Explore the codebase and understand the bug.",
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// Run an AFK agent in the worktree (sandbox is required)
|
|
341
|
+
const result = await wt.run({
|
|
342
|
+
agent: claudeCode("claude-opus-4-6"),
|
|
343
|
+
sandbox: docker({ imageName: "sandcastle:myrepo" }),
|
|
344
|
+
prompt: "Fix issue #42.",
|
|
345
|
+
maxIterations: 3,
|
|
346
|
+
});
|
|
347
|
+
console.log(result.commits); // commits made during the run
|
|
348
|
+
|
|
349
|
+
// Create a long-lived sandbox from the worktree
|
|
350
|
+
import { docker } from "@ai-hero/sandcastle/sandboxes/docker";
|
|
351
|
+
|
|
352
|
+
await using sandbox = await wt.createSandbox({
|
|
353
|
+
sandbox: docker(),
|
|
354
|
+
hooks: { onSandboxReady: [{ command: "npm install" }] },
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// sandbox.close() tears down the container only — the worktree stays
|
|
358
|
+
await sandbox.close();
|
|
359
|
+
|
|
360
|
+
// wt.close() cleans up the worktree
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
`wt.close()` checks for uncommitted changes: if the worktree is dirty, it's preserved on disk; if clean, it's removed. `await using` calls `close()` automatically. The worktree persists after `run()`, `interactive()`, and `createSandbox()` complete, so you can hand it to another agent or inspect it.
|
|
364
|
+
|
|
365
|
+
**Split ownership**: When a sandbox is created via `wt.createSandbox()`, `sandbox.close()` tears down the container only — the worktree remains. `wt.close()` is responsible for worktree cleanup. This differs from the top-level `createSandbox()`, where `sandbox.close()` owns both container and worktree.
|
|
366
|
+
|
|
367
|
+
#### `CreateWorktreeOptions`
|
|
368
|
+
|
|
369
|
+
| Option | Type | Default | Description |
|
|
370
|
+
| ---------------- | ---------------------- | ------- | ------------------------------------------------------------------------- |
|
|
371
|
+
| `branchStrategy` | WorktreeBranchStrategy | — | **Required.** `{ type: "branch", branch }` or `{ type: "merge-to-head" }` |
|
|
372
|
+
| `copyToWorktree` | string[] | — | Host-relative file paths to copy into the worktree at creation time |
|
|
373
|
+
|
|
374
|
+
#### `Worktree`
|
|
375
|
+
|
|
376
|
+
| Property / Method | Type | Description |
|
|
377
|
+
| ------------------------ | --------------------------------------------------------------------- | --------------------------------------------------- |
|
|
378
|
+
| `branch` | string | The branch the worktree is on |
|
|
379
|
+
| `worktreePath` | string | Host path to the worktree |
|
|
380
|
+
| `run(options)` | `(options: WorktreeRunOptions) => Promise<WorktreeRunResult>` | Run an AFK agent in the worktree (sandbox required) |
|
|
381
|
+
| `interactive(options)` | `(options: WorktreeInteractiveOptions) => Promise<InteractiveResult>` | Run an interactive agent session in the worktree |
|
|
382
|
+
| `createSandbox(options)` | `(options: WorktreeCreateSandboxOptions) => Promise<Sandbox>` | Create a long-lived sandbox backed by this worktree |
|
|
383
|
+
| `close()` | `() => Promise<CloseResult>` | Clean up the worktree (preserves if dirty) |
|
|
384
|
+
| `[Symbol.asyncDispose]` | `() => Promise<void>` | Auto cleanup via `await using` |
|
|
385
|
+
|
|
386
|
+
#### `WorktreeInteractiveOptions`
|
|
387
|
+
|
|
388
|
+
| Option | Type | Default | Description |
|
|
389
|
+
| ------------ | ---------------------- | ------------- | ---------------------------------------------------- |
|
|
390
|
+
| `agent` | AgentProvider | — | **Required.** Agent provider |
|
|
391
|
+
| `sandbox` | AnySandboxProvider | `noSandbox()` | Sandbox provider (defaults to no sandbox) |
|
|
392
|
+
| `prompt` | string | — | Inline prompt (mutually exclusive with `promptFile`) |
|
|
393
|
+
| `promptFile` | string | — | Path to prompt file |
|
|
394
|
+
| `name` | string | — | Optional session name |
|
|
395
|
+
| `hooks` | SandboxHooks | — | Hooks to run during sandbox lifecycle |
|
|
396
|
+
| `promptArgs` | PromptArgs | — | Key-value map for `{{KEY}}` placeholder substitution |
|
|
397
|
+
| `env` | Record<string, string> | — | Environment variables to inject into the sandbox |
|
|
398
|
+
|
|
399
|
+
#### `WorktreeRunOptions`
|
|
400
|
+
|
|
401
|
+
| Option | Type | Default | Description |
|
|
402
|
+
| -------------------- | ---------------------- | ------- | ------------------------------------------------------------- |
|
|
403
|
+
| `agent` | AgentProvider | — | **Required.** Agent provider |
|
|
404
|
+
| `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (AFK agents must be sandboxed) |
|
|
405
|
+
| `prompt` | string | — | Inline prompt (mutually exclusive with `promptFile`) |
|
|
406
|
+
| `promptFile` | string | — | Path to prompt file |
|
|
407
|
+
| `maxIterations` | number | 1 | Maximum iterations to run |
|
|
408
|
+
| `completionSignal` | string \| string[] | — | Substring(s) to stop the iteration loop early |
|
|
409
|
+
| `idleTimeoutSeconds` | number | 600 | Idle timeout in seconds |
|
|
410
|
+
| `name` | string | — | Optional run name |
|
|
411
|
+
| `logging` | LoggingOption | file | Logging mode |
|
|
412
|
+
| `hooks` | SandboxHooks | — | Hooks to run during sandbox lifecycle |
|
|
413
|
+
| `promptArgs` | PromptArgs | — | Key-value map for `{{KEY}}` placeholder substitution |
|
|
414
|
+
| `env` | Record<string, string> | — | Environment variables to inject into the sandbox |
|
|
415
|
+
|
|
416
|
+
#### `WorktreeRunResult`
|
|
417
|
+
|
|
418
|
+
| Property | Type | Description |
|
|
419
|
+
| ------------------ | ----------------- | ------------------------------------------------------ |
|
|
420
|
+
| `iterationsRun` | number | Number of iterations the agent completed |
|
|
421
|
+
| `completionSignal` | string | The matched completion signal, or undefined |
|
|
422
|
+
| `stdout` | string | Combined stdout output from all agent iterations |
|
|
423
|
+
| `commits` | { sha: string }[] | List of commits made by the agent during the run |
|
|
424
|
+
| `branch` | string | The branch name the agent worked on |
|
|
425
|
+
| `logFilePath` | string | Path to the log file, if logging was drained to a file |
|
|
426
|
+
|
|
427
|
+
#### `WorktreeCreateSandboxOptions`
|
|
428
|
+
|
|
429
|
+
| Option | Type | Default | Description |
|
|
430
|
+
| ---------------- | --------------- | ------- | ------------------------------------------------------------------- |
|
|
431
|
+
| `sandbox` | SandboxProvider | — | **Required.** Sandbox provider (e.g. `docker()`) |
|
|
432
|
+
| `hooks` | SandboxHooks | — | One-time setup hooks to run when the sandbox is first created |
|
|
433
|
+
| `copyToWorktree` | string[] | — | Host-relative file paths to copy into the worktree at creation time |
|
|
434
|
+
|
|
310
435
|
## How it works
|
|
311
436
|
|
|
312
437
|
Sandcastle uses a **branch strategy** configured on the sandbox provider to control how the agent's changes relate to branches. There are three strategies:
|
|
@@ -505,7 +630,7 @@ Removes the Podman image.
|
|
|
505
630
|
| `name` | string | — | Display name for the run, shown as a prefix in log output |
|
|
506
631
|
| `promptArgs` | PromptArgs | — | Key-value map for `{{KEY}}` placeholder substitution |
|
|
507
632
|
| `branchStrategy` | BranchStrategy | per-provider default | Branch strategy: `{ type: 'head' }`, `{ type: 'merge-to-head' }`, or `{ type: 'branch', branch: '…' }` |
|
|
508
|
-
| `
|
|
633
|
+
| `copyToWorktree` | string[] | — | Host-relative file paths to copy into the sandbox before start (not supported with `branchStrategy: { type: 'head' }`) |
|
|
509
634
|
| `logging` | object | file (auto-generated) | `{ type: 'file', path }` or `{ type: 'stdout' }` |
|
|
510
635
|
| `completionSignal` | string \| string[] | `<promise>COMPLETE</promise>` | String or array of strings the agent emits to stop the iteration loop early |
|
|
511
636
|
| `idleTimeoutSeconds` | number | `600` | Idle timeout in seconds — resets on each agent output event |
|
|
@@ -583,13 +708,13 @@ Sandcastle ships with built-in providers for Docker, Podman, and Vercel, but you
|
|
|
583
708
|
|
|
584
709
|
Both provider types return a **sandbox handle** from their `create()` function. The handle exposes:
|
|
585
710
|
|
|
586
|
-
| Method
|
|
587
|
-
|
|
|
588
|
-
| `exec`
|
|
589
|
-
| `close`
|
|
590
|
-
| `copyIn`
|
|
591
|
-
| `copyOut`
|
|
592
|
-
| `
|
|
711
|
+
| Method | Required | Description |
|
|
712
|
+
| -------------- | -------- | ---------------------------------------------------------------------------- |
|
|
713
|
+
| `exec` | Both | Run a command, optionally streaming stdout line-by-line via `options.onLine` |
|
|
714
|
+
| `close` | Both | Tear down the sandbox |
|
|
715
|
+
| `copyIn` | Isolated | Copy a file or directory from the host into the sandbox |
|
|
716
|
+
| `copyOut` | Isolated | Copy a file from the sandbox to the host |
|
|
717
|
+
| `worktreePath` | Both | Absolute path to the repo directory inside the sandbox |
|
|
593
718
|
|
|
594
719
|
### `ExecResult`
|
|
595
720
|
|
|
@@ -623,10 +748,10 @@ const localProcess = () =>
|
|
|
623
748
|
create: async (
|
|
624
749
|
options: BindMountCreateOptions,
|
|
625
750
|
): Promise<BindMountSandboxHandle> => {
|
|
626
|
-
const
|
|
751
|
+
const worktreePath = options.worktreePath;
|
|
627
752
|
|
|
628
753
|
return {
|
|
629
|
-
|
|
754
|
+
worktreePath,
|
|
630
755
|
|
|
631
756
|
exec: (
|
|
632
757
|
command: string,
|
|
@@ -636,7 +761,7 @@ const localProcess = () =>
|
|
|
636
761
|
const onLine = opts.onLine;
|
|
637
762
|
return new Promise((resolve, reject) => {
|
|
638
763
|
const proc = spawn("sh", ["-c", command], {
|
|
639
|
-
cwd: opts?.cwd ??
|
|
764
|
+
cwd: opts?.cwd ?? worktreePath,
|
|
640
765
|
stdio: ["ignore", "pipe", "pipe"],
|
|
641
766
|
});
|
|
642
767
|
|
|
@@ -668,7 +793,7 @@ const localProcess = () =>
|
|
|
668
793
|
execFile(
|
|
669
794
|
"sh",
|
|
670
795
|
["-c", command],
|
|
671
|
-
{ cwd: opts?.cwd ??
|
|
796
|
+
{ cwd: opts?.cwd ?? worktreePath, maxBuffer: 10 * 1024 * 1024 },
|
|
672
797
|
(error, stdout, stderr) => {
|
|
673
798
|
if (error && error.code === undefined) {
|
|
674
799
|
reject(new Error(`exec failed: ${error.message}`));
|
|
@@ -713,11 +838,11 @@ const tempDir = () =>
|
|
|
713
838
|
name: "temp-dir",
|
|
714
839
|
create: async (): Promise<IsolatedSandboxHandle> => {
|
|
715
840
|
const root = await mkdtemp(join(tmpdir(), "sandbox-"));
|
|
716
|
-
const
|
|
717
|
-
await mkdir(
|
|
841
|
+
const worktreePath = join(root, "workspace");
|
|
842
|
+
await mkdir(worktreePath, { recursive: true });
|
|
718
843
|
|
|
719
844
|
return {
|
|
720
|
-
|
|
845
|
+
worktreePath,
|
|
721
846
|
|
|
722
847
|
exec: (
|
|
723
848
|
command: string,
|
|
@@ -727,7 +852,7 @@ const tempDir = () =>
|
|
|
727
852
|
const onLine = opts.onLine;
|
|
728
853
|
return new Promise((resolve, reject) => {
|
|
729
854
|
const proc = spawn("sh", ["-c", command], {
|
|
730
|
-
cwd: opts?.cwd ??
|
|
855
|
+
cwd: opts?.cwd ?? worktreePath,
|
|
731
856
|
stdio: ["ignore", "pipe", "pipe"],
|
|
732
857
|
});
|
|
733
858
|
|
|
@@ -759,7 +884,7 @@ const tempDir = () =>
|
|
|
759
884
|
execFile(
|
|
760
885
|
"sh",
|
|
761
886
|
["-c", command],
|
|
762
|
-
{ cwd: opts?.cwd ??
|
|
887
|
+
{ cwd: opts?.cwd ?? worktreePath, maxBuffer: 10 * 1024 * 1024 },
|
|
763
888
|
(error, stdout, stderr) => {
|
|
764
889
|
if (error && error.code === undefined) {
|
|
765
890
|
reject(new Error(`exec failed: ${error.message}`));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { CopyToWorktreeTimeoutError } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Copy files and directories from the host repo root to the worktree root,
|
|
5
|
+
* using `cp -R --reflink=auto` for copy-on-write when the filesystem supports it.
|
|
6
|
+
* Missing paths are silently skipped.
|
|
7
|
+
*/
|
|
8
|
+
export declare const copyToWorktree: (paths: string[], hostRepoDir: string, worktreePath: string) => Effect.Effect<void, CopyToWorktreeTimeoutError, never>;
|
|
9
|
+
//# sourceMappingURL=CopyToWorktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyToWorktree.d.ts","sourceRoot":"","sources":["../src/CopyToWorktree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAe,MAAM,aAAa,CAAC;AAItE;;;;GAIG;AACH,eAAO,MAAM,cAAc,wHAmCxB,CAAC"}
|
|
@@ -2,12 +2,14 @@ import { execFile } from "node:child_process";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
+
import { CopyToWorktreeTimeoutError, withTimeout } from "./errors.js";
|
|
6
|
+
const COPY_TO_WORKTREE_TIMEOUT_MS = 60_000;
|
|
5
7
|
/**
|
|
6
8
|
* Copy files and directories from the host repo root to the worktree root,
|
|
7
9
|
* using `cp -R --reflink=auto` for copy-on-write when the filesystem supports it.
|
|
8
10
|
* Missing paths are silently skipped.
|
|
9
11
|
*/
|
|
10
|
-
export const
|
|
12
|
+
export const copyToWorktree = (paths, hostRepoDir, worktreePath) => Effect.gen(function* () {
|
|
11
13
|
for (const relativePath of paths) {
|
|
12
14
|
const src = join(hostRepoDir, relativePath);
|
|
13
15
|
if (!existsSync(src)) {
|
|
@@ -28,5 +30,9 @@ export const copyToWorkspace = (paths, hostRepoDir, worktreePath) => Effect.gen(
|
|
|
28
30
|
});
|
|
29
31
|
});
|
|
30
32
|
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
+
}).pipe(withTimeout(COPY_TO_WORKTREE_TIMEOUT_MS, () => new CopyToWorktreeTimeoutError({
|
|
34
|
+
message: `Copying files to worktree timed out after ${COPY_TO_WORKTREE_TIMEOUT_MS}ms`,
|
|
35
|
+
timeoutMs: COPY_TO_WORKTREE_TIMEOUT_MS,
|
|
36
|
+
paths,
|
|
37
|
+
})));
|
|
38
|
+
//# sourceMappingURL=CopyToWorktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyToWorktree.js","sourceRoot":"","sources":["../src/CopyToWorktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAe,EACf,WAAmB,EACnB,YAAoB,EAC6B,EAAE,CACnD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,KAAK,MAAM,YAAY,IAAI,KAAK,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC5C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC9C,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAc,CAAC,MAAM,EAAE,EAAE;YAC1C,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC5D,IAAI,KAAK,EAAE,CAAC;oBACV,0DAA0D;oBAC1D,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE;wBACrC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;oBACpC,CAAC,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC,IAAI,CACL,WAAW,CACT,2BAA2B,EAC3B,GAAG,EAAE,CACH,IAAI,0BAA0B,CAAC;IAC7B,OAAO,EAAE,6CAA6C,2BAA2B,IAAI;IACrF,SAAS,EAAE,2BAA2B;IACtC,KAAK;CACN,CAAC,CACL,CACF,CAAC"}
|
|
@@ -15,6 +15,8 @@ export interface StartContainerOptions {
|
|
|
15
15
|
readonly workdir?: string;
|
|
16
16
|
/** Run the container as this uid:gid instead of the Dockerfile's USER. */
|
|
17
17
|
readonly user?: string;
|
|
18
|
+
/** Docker network(s) to attach the container to. Passed as `--network` flags. */
|
|
19
|
+
readonly network?: string | readonly string[];
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Start a new container with environment variables injected.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DockerLifecycle.d.ts","sourceRoot":"","sources":["../src/DockerLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwB1C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;yDAkBnB,CAAC;AAEL,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"DockerLifecycle.d.ts","sourceRoot":"","sources":["../src/DockerLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwB1C;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;yDAkBnB,CAAC;AAEL,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CAC/C;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,iKAwDvB,CAAC;AAEL;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,2FAuB1B,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,eAAe,oEAQxB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,WAAW,gEAKpB,CAAC"}
|
package/dist/DockerLifecycle.js
CHANGED
|
@@ -64,6 +64,12 @@ export const startContainer = (containerName, imageName, env, options) => Effect
|
|
|
64
64
|
]);
|
|
65
65
|
const workdirFlags = options?.workdir ? ["-w", options.workdir] : [];
|
|
66
66
|
const userFlags = options?.user ? ["--user", options.user] : [];
|
|
67
|
+
const networks = options?.network
|
|
68
|
+
? Array.isArray(options.network)
|
|
69
|
+
? options.network
|
|
70
|
+
: [options.network]
|
|
71
|
+
: [];
|
|
72
|
+
const networkFlags = networks.flatMap((n) => ["--network", n]);
|
|
67
73
|
yield* dockerExec([
|
|
68
74
|
"run",
|
|
69
75
|
"-d",
|
|
@@ -73,6 +79,7 @@ export const startContainer = (containerName, imageName, env, options) => Effect
|
|
|
73
79
|
...volumeFlags,
|
|
74
80
|
...workdirFlags,
|
|
75
81
|
...userFlags,
|
|
82
|
+
...networkFlags,
|
|
76
83
|
imageName,
|
|
77
84
|
]);
|
|
78
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DockerLifecycle.js","sourceRoot":"","sources":["../src/DockerLifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,UAAU,GAAG,CAAC,IAAc,EAAsC,EAAE,CACxE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;IACtB,QAAQ,CACN,QAAQ,EACR,IAAI,EACJ,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,EAC/B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QACxB,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CACJ,MAAM,CAAC,IAAI,CACT,IAAI,WAAW,CAAC;gBACd,OAAO,EAAE,UAAU,IAAI,CAAC,CAAC,CAAC,YAAY,MAAM,EAAE,QAAQ,EAAE,IAAI,KAAK,CAAC,OAAO,EAAE;aAC5E,CAAC,CACH,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CA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
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../src/ErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../src/ErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,iCAoC9B,CAAC;AASF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,4FA0BqB,CAAC"}
|
package/dist/ErrorHandler.js
CHANGED
|
@@ -28,7 +28,16 @@ export const formatErrorMessage = (error) => {
|
|
|
28
28
|
return `${error.message}`;
|
|
29
29
|
case "InitError":
|
|
30
30
|
return `${error.message}`;
|
|
31
|
-
case "
|
|
31
|
+
case "AgentIdleTimeoutError":
|
|
32
|
+
case "WorktreeTimeoutError":
|
|
33
|
+
case "ContainerStartTimeoutError":
|
|
34
|
+
case "CopyToWorktreeTimeoutError":
|
|
35
|
+
case "SyncInTimeoutError":
|
|
36
|
+
case "HookTimeoutError":
|
|
37
|
+
case "GitSetupTimeoutError":
|
|
38
|
+
case "PromptExpansionTimeoutError":
|
|
39
|
+
case "CommitCollectionTimeoutError":
|
|
40
|
+
case "MergeToHostTimeoutError":
|
|
32
41
|
return error.message;
|
|
33
42
|
}
|
|
34
43
|
};
|
|
@@ -56,6 +65,15 @@ Effect.catchTags(effect, {
|
|
|
56
65
|
AgentError: showErrorAndExit,
|
|
57
66
|
ConfigDirError: showErrorAndExit,
|
|
58
67
|
InitError: showErrorAndExit,
|
|
59
|
-
|
|
68
|
+
AgentIdleTimeoutError: showErrorAndExit,
|
|
69
|
+
WorktreeTimeoutError: showErrorAndExit,
|
|
70
|
+
ContainerStartTimeoutError: showErrorAndExit,
|
|
71
|
+
CopyToWorktreeTimeoutError: showErrorAndExit,
|
|
72
|
+
SyncInTimeoutError: showErrorAndExit,
|
|
73
|
+
HookTimeoutError: showErrorAndExit,
|
|
74
|
+
GitSetupTimeoutError: showErrorAndExit,
|
|
75
|
+
PromptExpansionTimeoutError: showErrorAndExit,
|
|
76
|
+
CommitCollectionTimeoutError: showErrorAndExit,
|
|
77
|
+
MergeToHostTimeoutError: showErrorAndExit,
|
|
60
78
|
});
|
|
61
79
|
//# sourceMappingURL=ErrorHandler.js.map
|
package/dist/ErrorHandler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.js","sourceRoot":"","sources":["../src/ErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAmB,EAAU,EAAE;IAChE,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,WAAW;YACd,OAAO,8BAA8B,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAC1E,KAAK,eAAe;YAClB,OAAO,2BAA2B,KAAK,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACvE,KAAK,WAAW;YACd,OAAO,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC;QAC9C,KAAK,aAAa;YAChB,OAAO,4BAA4B,KAAK,CAAC,OAAO,sBAAsB,CAAC;QACzE,KAAK,aAA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EAAE,gBAAgB;IAC3B,aAAa,EAAE,gBAAgB;IAC/B,SAAS,EAAE,gBAAgB;IAC3B,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gBAAgB;IAC7B,SAAS,EAAE,gBAAgB;IAC3B,aAAa,EAAE,gBAAgB;IAC/B,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,gBAAgB;IAC5B,cAAc,EAAE,gBAAgB;IAChC,SAAS,EAAE,gBAAgB;IAC3B,qBAAqB,EAAE,gBAAgB;IACvC,oBAAoB,EAAE,gBAAgB;IACtC,0BAA0B,EAAE,gBAAgB;IAC5C,0BAA0B,EAAE,gBAAgB;IAC5C,kBAAkB,EAAE,gBAAgB;IACpC,gBAAgB,EAAE,gBAAgB;IAClC,oBAAoB,EAAE,gBAAgB;IACtC,2BAA2B,EAAE,gBAAgB;IAC7C,4BAA4B,EAAE,gBAAgB;IAC9C,uBAAuB,EAAE,gBAAgB;CAC1C,CAA4D,CAAC"}
|
package/dist/InitService.d.ts
CHANGED
|
@@ -11,16 +11,21 @@ export interface AgentEntry {
|
|
|
11
11
|
readonly defaultModel: string;
|
|
12
12
|
readonly factoryImport: string;
|
|
13
13
|
readonly dockerfileTemplate: string;
|
|
14
|
+
/** Lines to include in the generated `.env.example` for this agent's API key. */
|
|
15
|
+
readonly envExample: string;
|
|
14
16
|
}
|
|
15
17
|
export declare const listAgents: () => AgentEntry[];
|
|
16
18
|
export interface BacklogManagerEntry {
|
|
17
19
|
readonly name: string;
|
|
18
20
|
readonly label: string;
|
|
19
|
-
readonly
|
|
21
|
+
readonly templateArgs: {
|
|
20
22
|
readonly LIST_TASKS_COMMAND: string;
|
|
21
23
|
readonly VIEW_TASK_COMMAND: string;
|
|
22
24
|
readonly CLOSE_TASK_COMMAND: string;
|
|
25
|
+
readonly BACKLOG_MANAGER_TOOLS: string;
|
|
23
26
|
};
|
|
27
|
+
/** Lines to append to `.env.example` for this backlog manager, or empty string if none needed. */
|
|
28
|
+
readonly envExample: string;
|
|
24
29
|
}
|
|
25
30
|
export declare const listBacklogManagers: () => BacklogManagerEntry[];
|
|
26
31
|
export declare const getBacklogManager: (name: string) => BacklogManagerEntry | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitService.d.ts","sourceRoot":"","sources":["../src/InitService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUhC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AA4BD,eAAO,MAAM,aAAa,0BAAsC,CAAC;AAMjE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"InitService.d.ts","sourceRoot":"","sources":["../src/InitService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUhC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AA4BD,eAAO,MAAM,aAAa,0BAAsC,CAAC;AAMjE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kB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