@ai-hero/sandcastle 0.4.0 → 0.4.2
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 +185 -126
- package/dist/AgentProvider.d.ts +22 -2
- package/dist/AgentProvider.d.ts.map +1 -1
- package/dist/AgentProvider.js +18 -2
- package/dist/AgentProvider.js.map +1 -1
- package/dist/InitService.d.ts.map +1 -1
- package/dist/InitService.js +55 -6
- package/dist/InitService.js.map +1 -1
- package/dist/MountConfig.d.ts +15 -0
- package/dist/MountConfig.d.ts.map +1 -0
- package/dist/MountConfig.js +7 -0
- package/dist/MountConfig.js.map +1 -0
- package/dist/Orchestrator.d.ts +0 -1
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +29 -19
- package/dist/Orchestrator.js.map +1 -1
- package/dist/SandboxFactory.d.ts +16 -10
- package/dist/SandboxFactory.d.ts.map +1 -1
- package/dist/SandboxFactory.js +20 -22
- package/dist/SandboxFactory.js.map +1 -1
- package/dist/SandboxLifecycle.d.ts +1 -1
- package/dist/SandboxLifecycle.d.ts.map +1 -1
- package/dist/SandboxLifecycle.js +2 -2
- package/dist/SandboxLifecycle.js.map +1 -1
- package/dist/SandboxProvider.d.ts +31 -21
- package/dist/SandboxProvider.d.ts.map +1 -1
- package/dist/SandboxProvider.js +2 -2
- package/dist/SandboxProvider.js.map +1 -1
- package/dist/TextDeltaBuffer.d.ts +24 -0
- package/dist/TextDeltaBuffer.d.ts.map +1 -0
- package/dist/TextDeltaBuffer.js +68 -0
- package/dist/TextDeltaBuffer.js.map +1 -0
- package/dist/WorktreeManager.d.ts +2 -0
- package/dist/WorktreeManager.d.ts.map +1 -1
- package/dist/WorktreeManager.js +3 -0
- package/dist/WorktreeManager.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -7
- package/dist/cli.js.map +1 -1
- package/dist/createSandbox.d.ts +6 -5
- package/dist/createSandbox.d.ts.map +1 -1
- package/dist/createSandbox.js +18 -8
- package/dist/createSandbox.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mergeProviderEnv.d.ts +13 -0
- package/dist/mergeProviderEnv.d.ts.map +1 -0
- package/dist/mergeProviderEnv.js +23 -0
- package/dist/mergeProviderEnv.js.map +1 -0
- package/dist/run.d.ts +7 -2
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +20 -6
- package/dist/run.js.map +1 -1
- package/dist/sandboxes/daytona.d.ts +48 -0
- package/dist/sandboxes/daytona.d.ts.map +1 -0
- package/dist/sandboxes/daytona.js +125 -0
- package/dist/sandboxes/daytona.js.map +1 -0
- package/dist/sandboxes/docker.d.ts +11 -3
- package/dist/sandboxes/docker.d.ts.map +1 -1
- package/dist/sandboxes/docker.js +69 -43
- package/dist/sandboxes/docker.js.map +1 -1
- package/dist/sandboxes/podman.d.ts +46 -0
- package/dist/sandboxes/podman.d.ts.map +1 -0
- package/dist/sandboxes/podman.js +195 -0
- package/dist/sandboxes/podman.js.map +1 -0
- package/dist/sandboxes/test-isolated.d.ts +3 -7
- package/dist/sandboxes/test-isolated.d.ts.map +1 -1
- package/dist/sandboxes/test-isolated.js +57 -47
- package/dist/sandboxes/test-isolated.js.map +1 -1
- package/dist/sandboxes/vercel.d.ts +92 -0
- package/dist/sandboxes/vercel.d.ts.map +1 -0
- package/dist/sandboxes/vercel.js +165 -0
- package/dist/sandboxes/vercel.js.map +1 -0
- package/dist/syncOut.d.ts +1 -1
- package/dist/syncOut.js +3 -3
- package/dist/syncOut.js.map +1 -1
- package/dist/templates/parallel-planner/main.mts +6 -3
- package/dist/templates/parallel-planner-with-review/.env.example +5 -0
- package/dist/templates/parallel-planner-with-review/CODING_STANDARDS.md +27 -0
- package/dist/templates/parallel-planner-with-review/implement-prompt.md +62 -0
- package/dist/templates/parallel-planner-with-review/main.mts +251 -0
- package/dist/templates/parallel-planner-with-review/merge-prompt.md +22 -0
- package/dist/templates/parallel-planner-with-review/plan-prompt.md +33 -0
- package/dist/templates/parallel-planner-with-review/review-prompt.md +55 -0
- package/dist/templates/parallel-planner-with-review/template.json +4 -0
- package/dist/templates/sequential-reviewer/CODING_STANDARDS.md +27 -0
- package/dist/templates/sequential-reviewer/implement-prompt.md +34 -45
- package/dist/templates/sequential-reviewer/main.mts +4 -2
- package/dist/templates/sequential-reviewer/review-prompt.md +1 -1
- package/dist/templates/simple-loop/main.mts +6 -0
- package/dist/testSandbox.d.ts.map +1 -1
- package/dist/testSandbox.js +58 -53
- package/dist/testSandbox.js.map +1 -1
- package/package.json +25 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ISSUES
|
|
2
|
+
|
|
3
|
+
Here are the open issues in the repo:
|
|
4
|
+
|
|
5
|
+
<issues-json>
|
|
6
|
+
|
|
7
|
+
!`gh issue list --state open --label Sandcastle --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'`
|
|
8
|
+
|
|
9
|
+
</issues-json>
|
|
10
|
+
|
|
11
|
+
# TASK
|
|
12
|
+
|
|
13
|
+
Analyze the open issues and build a dependency graph. For each issue, determine whether it **blocks** or **is blocked by** any other open issue.
|
|
14
|
+
|
|
15
|
+
An issue B is **blocked by** issue A if:
|
|
16
|
+
|
|
17
|
+
- B requires code or infrastructure that A introduces
|
|
18
|
+
- B and A modify overlapping files or modules, making concurrent work likely to produce merge conflicts
|
|
19
|
+
- B's requirements depend on a decision or API shape that A will establish
|
|
20
|
+
|
|
21
|
+
An issue is **unblocked** if it has zero blocking dependencies on other open issues.
|
|
22
|
+
|
|
23
|
+
For each unblocked issue, assign a branch name using the format `sandcastle/issue-{number}-{slug}`.
|
|
24
|
+
|
|
25
|
+
# OUTPUT
|
|
26
|
+
|
|
27
|
+
Output your plan as a JSON object wrapped in `<plan>` tags:
|
|
28
|
+
|
|
29
|
+
<plan>
|
|
30
|
+
{"issues": [{"number": 42, "title": "Fix auth bug", "branch": "sandcastle/issue-42-fix-auth-bug"}]}
|
|
31
|
+
</plan>
|
|
32
|
+
|
|
33
|
+
Include only unblocked issues. If every issue is blocked, include the single highest-priority candidate (the one with the fewest or weakest dependencies).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# TASK
|
|
2
|
+
|
|
3
|
+
Review the code changes on branch `{{BRANCH}}` and improve code clarity, consistency, and maintainability while preserving exact functionality.
|
|
4
|
+
|
|
5
|
+
# CONTEXT
|
|
6
|
+
|
|
7
|
+
## Branch diff
|
|
8
|
+
|
|
9
|
+
!`git diff main...{{BRANCH}}`
|
|
10
|
+
|
|
11
|
+
## Commits on this branch
|
|
12
|
+
|
|
13
|
+
!`git log main..{{BRANCH}} --oneline`
|
|
14
|
+
|
|
15
|
+
# REVIEW PROCESS
|
|
16
|
+
|
|
17
|
+
1. **Understand the change**: Read the diff and commits above to understand the intent.
|
|
18
|
+
|
|
19
|
+
2. **Analyze for improvements**: Look for opportunities to:
|
|
20
|
+
- Reduce unnecessary complexity and nesting
|
|
21
|
+
- Eliminate redundant code and abstractions
|
|
22
|
+
- Improve readability through clear variable and function names
|
|
23
|
+
- Consolidate related logic
|
|
24
|
+
- Remove unnecessary comments that describe obvious code
|
|
25
|
+
- Avoid nested ternary operators - prefer switch statements or if/else chains
|
|
26
|
+
- Choose clarity over brevity - explicit code is often better than overly compact code
|
|
27
|
+
|
|
28
|
+
3. **Check correctness**:
|
|
29
|
+
- Does the implementation match the intent? Are edge cases handled?
|
|
30
|
+
- Are new/changed behaviours covered by tests?
|
|
31
|
+
- Are there unsafe casts, `any` types, or unchecked assumptions?
|
|
32
|
+
- Does the change introduce injection vulnerabilities, credential leaks, or other security issues?
|
|
33
|
+
|
|
34
|
+
4. **Maintain balance**: Avoid over-simplification that could:
|
|
35
|
+
- Reduce code clarity or maintainability
|
|
36
|
+
- Create overly clever solutions that are hard to understand
|
|
37
|
+
- Combine too many concerns into single functions or components
|
|
38
|
+
- Remove helpful abstractions that improve code organization
|
|
39
|
+
- Make the code harder to debug or extend
|
|
40
|
+
|
|
41
|
+
5. **Apply project standards**: Follow the coding standards defined in @.sandcastle/CODING_STANDARDS.md
|
|
42
|
+
|
|
43
|
+
6. **Preserve functionality**: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
|
|
44
|
+
|
|
45
|
+
# EXECUTION
|
|
46
|
+
|
|
47
|
+
If you find improvements to make:
|
|
48
|
+
|
|
49
|
+
1. Make the changes directly on this branch
|
|
50
|
+
2. Run tests and type checking to ensure nothing is broken
|
|
51
|
+
3. Commit describing the refinements
|
|
52
|
+
|
|
53
|
+
If the code is already clean and well-structured, do nothing.
|
|
54
|
+
|
|
55
|
+
Once complete, output <promise>COMPLETE</promise>.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Coding Standards
|
|
2
|
+
|
|
3
|
+
<!-- Customize this file with your project's coding standards.
|
|
4
|
+
The reviewer agent loads it during code review via @.sandcastle/CODING_STANDARDS.md
|
|
5
|
+
so these standards are enforced during review without costing tokens during implementation. -->
|
|
6
|
+
|
|
7
|
+
## Style
|
|
8
|
+
|
|
9
|
+
<!-- Example:
|
|
10
|
+
- Use camelCase for variables and functions
|
|
11
|
+
- Use PascalCase for classes and types
|
|
12
|
+
- Prefer named exports over default exports
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
|
|
17
|
+
<!-- Example:
|
|
18
|
+
- Every public function must have at least one test
|
|
19
|
+
- Use descriptive test names that explain the expected behavior
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
<!-- Example:
|
|
25
|
+
- Keep modules focused on a single responsibility
|
|
26
|
+
- Prefer composition over inheritance
|
|
27
|
+
-->
|
|
@@ -1,62 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Context
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Open issues
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
!`gh issue list --label Sandcastle --json number,title,body --limit 20`
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Recent RALPH commits (last 10)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
!`git log --oneline --grep="RALPH" -10`
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Task
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You are RALPH — an autonomous coding agent working through GitHub issues one at a time.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Priority order
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Work on issues in this order:
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
1. **Bug fixes** — broken behaviour affecting users
|
|
20
|
+
2. **Tracer bullets** — thin end-to-end slices that prove an approach works
|
|
21
|
+
3. **Polish** — improving existing functionality (error messages, UX, docs)
|
|
22
|
+
4. **Refactors** — internal cleanups with no user-visible change
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
Pick the highest-priority open issue that is not blocked by another open issue.
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
## Workflow
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
1. **Explore** — read the issue carefully. Pull in the parent PRD if referenced. Read the relevant source files and tests before writing any code.
|
|
29
|
+
2. **Plan** — decide what to change and why. Keep the change as small as possible.
|
|
30
|
+
3. **Execute** — use RGR (Red → Green → Repeat → Refactor): write a failing test first, then write the implementation to pass it.
|
|
31
|
+
4. **Verify** — run `npm run typecheck` and `npm run test` before committing. Fix any failures before proceeding.
|
|
32
|
+
5. **Commit** — make a single git commit. The message MUST:
|
|
33
|
+
- Start with `RALPH:` prefix
|
|
34
|
+
- Include the task completed and any PRD reference
|
|
35
|
+
- List key decisions made
|
|
36
|
+
- List files changed
|
|
37
|
+
- Note any blockers for the next iteration
|
|
38
|
+
6. **Close** — close the issue with `gh issue close <number> --comment "..."` explaining what was done.
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
## Rules
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
- Work on **one issue per iteration**. Do not attempt multiple issues in a single iteration.
|
|
43
|
+
- Do not close an issue until you have committed the fix and verified tests pass.
|
|
44
|
+
- Do not leave commented-out code or TODO comments in committed code.
|
|
45
|
+
- If you are blocked (missing context, failing tests you cannot fix, external dependency), leave a comment on the issue and move on — do not close it.
|
|
30
46
|
|
|
31
|
-
|
|
32
|
-
2. GREEN: write the implementation to pass that test
|
|
33
|
-
3. REPEAT until done
|
|
34
|
-
4. REFACTOR the code
|
|
47
|
+
# Done
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
When all actionable issues are complete (or you are blocked on all remaining ones), output the completion signal:
|
|
37
50
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# COMMIT
|
|
41
|
-
|
|
42
|
-
Make a git commit. The commit message must:
|
|
43
|
-
|
|
44
|
-
1. Start with `RALPH:` prefix
|
|
45
|
-
2. Include task completed + PRD reference
|
|
46
|
-
3. Key decisions made
|
|
47
|
-
4. Files changed
|
|
48
|
-
5. Blockers or notes for next iteration
|
|
49
|
-
|
|
50
|
-
Keep it concise.
|
|
51
|
-
|
|
52
|
-
# THE ISSUE
|
|
53
|
-
|
|
54
|
-
If the task is not complete, leave a comment on the GitHub issue with what was done.
|
|
55
|
-
|
|
56
|
-
Do not close the issue - this will be done later.
|
|
57
|
-
|
|
58
|
-
Once complete, output <promise>COMPLETE</promise>.
|
|
59
|
-
|
|
60
|
-
# FINAL RULES
|
|
61
|
-
|
|
62
|
-
ONLY WORK ON A SINGLE TASK.
|
|
51
|
+
<promise>COMPLETE</promise>
|
|
@@ -59,6 +59,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
|
|
|
59
59
|
hooks,
|
|
60
60
|
copyToSandbox,
|
|
61
61
|
sandbox: docker(),
|
|
62
|
+
branchStrategy: { type: "merge-to-head" },
|
|
62
63
|
name: "implementer",
|
|
63
64
|
maxIterations: 100,
|
|
64
65
|
agent: sandcastle.claudeCode("claude-sonnet-4-6"),
|
|
@@ -86,9 +87,10 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
|
|
|
86
87
|
await sandcastle.run({
|
|
87
88
|
hooks,
|
|
88
89
|
copyToSandbox,
|
|
89
|
-
sandbox: docker(
|
|
90
|
+
sandbox: docker(),
|
|
91
|
+
branchStrategy: { type: "branch", branch },
|
|
90
92
|
name: "reviewer",
|
|
91
|
-
maxIterations:
|
|
93
|
+
maxIterations: 1,
|
|
92
94
|
agent: sandcastle.claudeCode("claude-sonnet-4-6"),
|
|
93
95
|
promptFile: "./.sandcastle/review-prompt.md",
|
|
94
96
|
// Prompt arguments substitute {{BRANCH}} in review-prompt.md before the
|
|
@@ -38,7 +38,7 @@ Review the code changes on branch `{{BRANCH}}` and improve code clarity, consist
|
|
|
38
38
|
- Remove helpful abstractions that improve code organization
|
|
39
39
|
- Make the code harder to debug or extend
|
|
40
40
|
|
|
41
|
-
5. **Apply project standards**: Follow the
|
|
41
|
+
5. **Apply project standards**: Follow the coding standards defined in @.sandcastle/CODING_STANDARDS.md
|
|
42
42
|
|
|
43
43
|
6. **Preserve functionality**: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
|
|
44
44
|
|
|
@@ -26,6 +26,12 @@ await run({
|
|
|
26
26
|
// per run, or set it to 1 for a single-shot mode.
|
|
27
27
|
maxIterations: 3,
|
|
28
28
|
|
|
29
|
+
// Branch strategy — merge-to-head creates a temporary branch for the agent
|
|
30
|
+
// to work on, then merges the result back to HEAD when the run completes.
|
|
31
|
+
// This is required when using copyToSandbox, since head mode bind-mounts
|
|
32
|
+
// the host directory directly (no worktree to copy into).
|
|
33
|
+
branchStrategy: { type: "merge-to-head" },
|
|
34
|
+
|
|
29
35
|
// Copy node_modules from the host into the worktree before the sandbox
|
|
30
36
|
// starts. This avoids a full npm install from scratch on every iteration.
|
|
31
37
|
// The onSandboxReady hook still runs npm install as a safety net to handle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testSandbox.d.ts","sourceRoot":"","sources":["../src/testSandbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQvC,OAAO,EAAmB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAa/D,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"testSandbox.d.ts","sourceRoot":"","sources":["../src/testSandbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQvC,OAAO,EAAmB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAa/D,eAAO,MAAM,qBAAqB,4DAiHjC,CAAC"}
|
package/dist/testSandbox.js
CHANGED
|
@@ -25,59 +25,64 @@ export const makeLocalSandboxLayer = (sandboxDir) => {
|
|
|
25
25
|
const gitEnv = createIsolatedGitEnv();
|
|
26
26
|
const env = { ...process.env, ...gitEnv };
|
|
27
27
|
return Layer.succeed(Sandbox, {
|
|
28
|
-
exec: (command, options) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
exec: (command, options) => {
|
|
29
|
+
if (options?.onLine) {
|
|
30
|
+
const onLine = options.onLine;
|
|
31
|
+
return Effect.async((resume) => {
|
|
32
|
+
const proc = spawn("sh", ["-c", command], {
|
|
33
|
+
cwd: options?.cwd ?? sandboxDir,
|
|
34
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
35
|
+
env,
|
|
36
|
+
});
|
|
37
|
+
const stdoutChunks = [];
|
|
38
|
+
const stderrChunks = [];
|
|
39
|
+
const rl = createInterface({ input: proc.stdout });
|
|
40
|
+
rl.on("line", (line) => {
|
|
41
|
+
stdoutChunks.push(line);
|
|
42
|
+
onLine(line);
|
|
43
|
+
});
|
|
44
|
+
proc.stderr.on("data", (chunk) => {
|
|
45
|
+
stderrChunks.push(chunk.toString());
|
|
46
|
+
});
|
|
47
|
+
proc.on("error", (error) => {
|
|
48
|
+
resume(Effect.fail(new ExecError({
|
|
49
|
+
command,
|
|
50
|
+
message: `Failed to exec: ${error.message}`,
|
|
51
|
+
})));
|
|
52
|
+
});
|
|
53
|
+
proc.on("close", (code) => {
|
|
54
|
+
resume(Effect.succeed({
|
|
55
|
+
stdout: stdoutChunks.join("\n"),
|
|
56
|
+
stderr: stderrChunks.join(""),
|
|
57
|
+
exitCode: code ?? 0,
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return Effect.async((resume) => {
|
|
63
|
+
execFile("sh", ["-c", command], {
|
|
64
|
+
cwd: options?.cwd ?? sandboxDir,
|
|
65
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
66
|
+
env,
|
|
67
|
+
}, (error, stdout, stderr) => {
|
|
68
|
+
if (error && error.code === undefined) {
|
|
69
|
+
resume(Effect.fail(new ExecError({
|
|
70
|
+
command,
|
|
71
|
+
message: `Failed to exec: ${error.message}`,
|
|
72
|
+
})));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
resume(Effect.succeed({
|
|
76
|
+
stdout: stdout.toString(),
|
|
77
|
+
stderr: stderr.toString(),
|
|
78
|
+
exitCode: typeof error?.code === "number"
|
|
79
|
+
? error.code
|
|
80
|
+
: 0,
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
49
84
|
});
|
|
50
|
-
}
|
|
51
|
-
execStreaming: (command, onStdoutLine, options) => Effect.async((resume) => {
|
|
52
|
-
const proc = spawn("sh", ["-c", command], {
|
|
53
|
-
cwd: options?.cwd ?? sandboxDir,
|
|
54
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
55
|
-
env,
|
|
56
|
-
});
|
|
57
|
-
const stdoutChunks = [];
|
|
58
|
-
const stderrChunks = [];
|
|
59
|
-
const rl = createInterface({ input: proc.stdout });
|
|
60
|
-
rl.on("line", (line) => {
|
|
61
|
-
stdoutChunks.push(line);
|
|
62
|
-
onStdoutLine(line);
|
|
63
|
-
});
|
|
64
|
-
proc.stderr.on("data", (chunk) => {
|
|
65
|
-
stderrChunks.push(chunk.toString());
|
|
66
|
-
});
|
|
67
|
-
proc.on("error", (error) => {
|
|
68
|
-
resume(Effect.fail(new ExecError({
|
|
69
|
-
command,
|
|
70
|
-
message: `Failed to exec: ${error.message}`,
|
|
71
|
-
})));
|
|
72
|
-
});
|
|
73
|
-
proc.on("close", (code) => {
|
|
74
|
-
resume(Effect.succeed({
|
|
75
|
-
stdout: stdoutChunks.join("\n"),
|
|
76
|
-
stderr: stderrChunks.join(""),
|
|
77
|
-
exitCode: code ?? 0,
|
|
78
|
-
}));
|
|
79
|
-
});
|
|
80
|
-
}),
|
|
85
|
+
},
|
|
81
86
|
copyIn: (hostPath, sandboxPath) => Effect.tryPromise({
|
|
82
87
|
try: async () => {
|
|
83
88
|
await mkdir(dirname(sandboxPath), { recursive: true });
|
|
@@ -87,7 +92,7 @@ export const makeLocalSandboxLayer = (sandboxDir) => {
|
|
|
87
92
|
message: `Failed to copy ${hostPath} -> ${sandboxPath}: ${e}`,
|
|
88
93
|
}),
|
|
89
94
|
}),
|
|
90
|
-
|
|
95
|
+
copyFileOut: (sandboxPath, hostPath) => Effect.tryPromise({
|
|
91
96
|
try: async () => {
|
|
92
97
|
await mkdir(dirname(hostPath), { recursive: true });
|
|
93
98
|
await copyFile(sandboxPath, hostPath);
|
package/dist/testSandbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testSandbox.js","sourceRoot":"","sources":["../src/testSandbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM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AC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvD,MAAM,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACxC,CAAC;YACD,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CACX,IAAI,SAAS,CAAC;gBACZ,OAAO,EAAE,kBAAkB,QAAQ,OAAO,WAAW,KAAK,CAAC,EAAE;aAC9D,CAAC;SACL,CAAC;QAEJ,WAAW,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CACrC,MAAM,CAAC,UAAU,CAAC;YAChB,GAAG,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpD,MAAM,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACxC,CAAC;YACD,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CACX,IAAI,SAAS,CAAC;gBACZ,OAAO,EAAE,kBAAkB,WAAW,OAAO,QAAQ,KAAK,CAAC,EAAE;aAC9D,CAAC;SACL,CAAC;KACL,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-hero/sandcastle",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "CLI for orchestrating AI agents in isolated sandbox environments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,6 +13,18 @@
|
|
|
13
13
|
"./sandboxes/docker": {
|
|
14
14
|
"import": "./dist/sandboxes/docker.js",
|
|
15
15
|
"types": "./dist/sandboxes/docker.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./sandboxes/vercel": {
|
|
18
|
+
"import": "./dist/sandboxes/vercel.js",
|
|
19
|
+
"types": "./dist/sandboxes/vercel.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./sandboxes/podman": {
|
|
22
|
+
"import": "./dist/sandboxes/podman.js",
|
|
23
|
+
"types": "./dist/sandboxes/podman.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./sandboxes/daytona": {
|
|
26
|
+
"import": "./dist/sandboxes/daytona.js",
|
|
27
|
+
"types": "./dist/sandboxes/daytona.d.ts"
|
|
16
28
|
}
|
|
17
29
|
},
|
|
18
30
|
"bin": {
|
|
@@ -63,6 +75,18 @@
|
|
|
63
75
|
"@effect/printer-ansi": "^0.48.0",
|
|
64
76
|
"effect": "^3.20.0"
|
|
65
77
|
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@vercel/sandbox": ">=1.0.0",
|
|
80
|
+
"@daytona/sdk": "^0.164.0"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@vercel/sandbox": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@daytona/sdk": {
|
|
87
|
+
"optional": true
|
|
88
|
+
}
|
|
89
|
+
},
|
|
66
90
|
"lint-staged": {
|
|
67
91
|
"*.{ts,tsx,js,jsx,json,md}": "prettier --write"
|
|
68
92
|
},
|