@ai-hero/sandcastle 0.1.7 → 0.2.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 (46) hide show
  1. package/README.md +160 -31
  2. package/dist/AgentProvider.d.ts +28 -4
  3. package/dist/AgentProvider.d.ts.map +1 -1
  4. package/dist/AgentProvider.js +193 -49
  5. package/dist/AgentProvider.js.map +1 -1
  6. package/dist/InitService.d.ts +16 -3
  7. package/dist/InitService.d.ts.map +1 -1
  8. package/dist/InitService.js +166 -19
  9. package/dist/InitService.js.map +1 -1
  10. package/dist/Orchestrator.d.ts +9 -34
  11. package/dist/Orchestrator.d.ts.map +1 -1
  12. package/dist/Orchestrator.js +38 -105
  13. package/dist/Orchestrator.js.map +1 -1
  14. package/dist/SandboxFactory.d.ts +14 -5
  15. package/dist/SandboxFactory.d.ts.map +1 -1
  16. package/dist/SandboxFactory.js +86 -36
  17. package/dist/SandboxFactory.js.map +1 -1
  18. package/dist/WorktreeManager.d.ts +10 -5
  19. package/dist/WorktreeManager.d.ts.map +1 -1
  20. package/dist/WorktreeManager.js +13 -8
  21. package/dist/WorktreeManager.js.map +1 -1
  22. package/dist/cli.d.ts +3 -0
  23. package/dist/cli.d.ts.map +1 -1
  24. package/dist/cli.js +75 -27
  25. package/dist/cli.js.map +1 -1
  26. package/dist/createSandbox.d.ts +82 -0
  27. package/dist/createSandbox.d.ts.map +1 -0
  28. package/dist/createSandbox.js +192 -0
  29. package/dist/createSandbox.js.map +1 -0
  30. package/dist/index.d.ts +5 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/run.d.ts +22 -6
  35. package/dist/run.d.ts.map +1 -1
  36. package/dist/run.js +36 -31
  37. package/dist/run.js.map +1 -1
  38. package/dist/templates/blank/.env.example +4 -0
  39. package/dist/templates/blank/main.ts +2 -1
  40. package/dist/templates/parallel-planner/.env.example +4 -0
  41. package/dist/templates/parallel-planner/main.ts +4 -4
  42. package/dist/templates/sequential-reviewer/.env.example +4 -0
  43. package/dist/templates/sequential-reviewer/main.ts +3 -3
  44. package/dist/templates/simple-loop/.env.example +4 -0
  45. package/dist/templates/simple-loop/main.ts +6 -5
  46. package/package.json +2 -2
@@ -1,9 +1,10 @@
1
- import { run } from "@ai-hero/sandcastle";
1
+ import { run, claudeCode } from "@ai-hero/sandcastle";
2
2
 
3
3
  // Blank template: customize this to build your own orchestration.
4
4
  // Run this with: npx tsx .sandcastle/main.ts
5
5
  // Or add to package.json scripts: "sandcastle": "npx tsx .sandcastle/main.ts"
6
6
 
7
7
  await run({
8
+ agent: claudeCode("claude-opus-4-6"),
8
9
  promptFile: "./.sandcastle/prompt.md",
9
10
  });
@@ -0,0 +1,4 @@
1
+ # Anthropic API key
2
+ ANTHROPIC_API_KEY=
3
+ # GitHub personal access token
4
+ GH_TOKEN=
@@ -61,7 +61,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
61
61
  // not write code.
62
62
  maxIterations: 1,
63
63
  // Opus for planning: dependency analysis benefits from deeper reasoning.
64
- model: "claude-opus-4-6",
64
+ agent: sandcastle.claudeCode("claude-opus-4-6"),
65
65
  promptFile: "./.sandcastle/plan-prompt.md",
66
66
  });
67
67
 
@@ -109,7 +109,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
109
109
  // Give each agent plenty of room to implement and iterate on tests.
110
110
  maxIterations: 100,
111
111
  // Sonnet for execution: fast and capable enough for typical issue work.
112
- model: "claude-sonnet-4-6",
112
+ agent: sandcastle.claudeCode("claude-sonnet-4-6"),
113
113
  promptFile: "./.sandcastle/implement-prompt.md",
114
114
  // Prompt arguments substitute {{ISSUE_NUMBER}}, {{ISSUE_TITLE}},
115
115
  // and {{BRANCH}} placeholders in implement-prompt.md before the
@@ -120,7 +120,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
120
120
  BRANCH: issue.branch,
121
121
  },
122
122
  // Each agent starts on its own branch.
123
- branch: issue.branch,
123
+ worktree: { mode: "branch", branch: issue.branch },
124
124
  }),
125
125
  ),
126
126
  );
@@ -182,7 +182,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
182
182
  name: "merger",
183
183
  maxIterations: 10,
184
184
  // Sonnet is sufficient for merge conflict resolution.
185
- model: "claude-sonnet-4-6",
185
+ agent: sandcastle.claudeCode("claude-sonnet-4-6"),
186
186
  promptFile: "./.sandcastle/merge-prompt.md",
187
187
  promptArgs: {
188
188
  // A markdown list of branch names, one per line.
@@ -0,0 +1,4 @@
1
+ # Anthropic API key
2
+ ANTHROPIC_API_KEY=
3
+ # GitHub personal access token
4
+ GH_TOKEN=
@@ -59,7 +59,7 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
59
59
  copyToSandbox,
60
60
  name: "implementer",
61
61
  maxIterations: 100,
62
- model: "claude-sonnet-4-6",
62
+ agent: sandcastle.claudeCode("claude-sonnet-4-6"),
63
63
  promptFile: "./.sandcastle/implement-prompt.md",
64
64
  });
65
65
 
@@ -86,14 +86,14 @@ for (let iteration = 1; iteration <= MAX_ITERATIONS; iteration++) {
86
86
  copyToSandbox,
87
87
  name: "reviewer",
88
88
  maxIterations: 10,
89
- model: "claude-sonnet-4-6",
89
+ agent: sandcastle.claudeCode("claude-sonnet-4-6"),
90
90
  promptFile: "./.sandcastle/review-prompt.md",
91
91
  // Prompt arguments substitute {{BRANCH}} in review-prompt.md before the
92
92
  // agent sees the prompt.
93
93
  promptArgs: {
94
94
  BRANCH: branch,
95
95
  },
96
- branch,
96
+ worktree: { mode: "branch", branch },
97
97
  });
98
98
 
99
99
  console.log("\nReview complete.");
@@ -0,0 +1,4 @@
1
+ # Anthropic API key
2
+ ANTHROPIC_API_KEY=
3
+ # GitHub personal access token
4
+ GH_TOKEN=
@@ -1,4 +1,4 @@
1
- import { run } from "@ai-hero/sandcastle";
1
+ import { run, claudeCode } from "@ai-hero/sandcastle";
2
2
 
3
3
  // Simple loop: an agent that picks open GitHub issues one by one and closes them.
4
4
  // Run this with: npx tsx .sandcastle/main.ts
@@ -8,6 +8,11 @@ await run({
8
8
  // A name for this run, shown as a prefix in log output.
9
9
  name: "worker",
10
10
 
11
+ // The agent provider. Pass a model string to claudeCode() — sonnet balances
12
+ // capability and speed for most tasks. Switch to claude-opus-4-6 for harder
13
+ // problems, or claude-haiku-4-5-20251001 for speed.
14
+ agent: claudeCode("claude-sonnet-4-6"),
15
+
11
16
  // Path to the prompt file. Shell expressions inside are evaluated inside the
12
17
  // sandbox at the start of each iteration, so the agent always sees fresh data.
13
18
  promptFile: "./.sandcastle/prompt.md",
@@ -17,10 +22,6 @@ await run({
17
22
  // per run, or set it to 1 for a single-shot mode.
18
23
  maxIterations: 3,
19
24
 
20
- // The Claude model to use. Sonnet balances capability and speed for most tasks.
21
- // Switch to claude-opus-4-6 for harder problems, or claude-haiku-4-5 for speed.
22
- model: "claude-sonnet-4-6",
23
-
24
25
  // Copy node_modules from the host into the worktree before the sandbox
25
26
  // starts. This avoids a full npm install from scratch on every iteration.
26
27
  // The onSandboxReady hook still runs npm install as a safety net to handle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-hero/sandcastle",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for orchestrating AI agents in isolated sandbox environments",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "format:check": "prettier --check .",
25
25
  "prepare": "husky",
26
26
  "release": "changeset publish",
27
- "run-sandcastle": "tsx .sandcastle/run.ts"
27
+ "sandcastle": "npm run build && tsx .sandcastle/run.ts"
28
28
  },
29
29
  "keywords": [
30
30
  "cli",