agent-canvas 0.1.24 → 0.1.26

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.
@@ -54,14 +54,14 @@ export async function handlePush(args: string[]) {
54
54
 
55
55
  let result = await response.json() as any;
56
56
 
57
- // Bun.build() can corrupt internal state in long-running daemons,
58
- // throwing opaque errors like "Bundle failed" or "Unknown Error".
59
- // Restart and retry once — but not for clear syntax errors (which
60
- // now have precise line/col info from the transpiler pre-check).
61
- const isBundlerCrash = !result.ok && result.error === "Canvas compilation failed"
62
- && result.errors && Object.values(result.errors).some((e: any) =>
63
- typeof e === "string" && (e === "Bundle failed" || e.includes("Unknown Error")));
64
- if (isBundlerCrash) {
57
+ // Bun.build() / Bun.Transpiler can fail in long-running daemons due to
58
+ // internal state corruption, CWD unlinking, etc. Restart and retry once.
59
+ // Skip restart only for clear user errors (syntax errors with line/col,
60
+ // runtime validation errors) — those won't be fixed by a restart.
61
+ const isUserError = !result.ok && result.errors && Object.values(result.errors).every((e: any) =>
62
+ typeof e === "string" && (/\(line \d+, col \d+\)/.test(e) || e.startsWith("Runtime error:")));
63
+ const shouldRestart = !result.ok && result.error === "Canvas compilation failed" && !isUserError;
64
+ if (shouldRestart) {
65
65
  console.error("Compilation failed, restarting daemon and retrying...");
66
66
  stopDaemon();
67
67
  await startDaemon();
@@ -10,10 +10,10 @@ Use it whenever structured visual communication beats inline chat: plans, review
10
10
 
11
11
  ### 1. Write JSX
12
12
 
13
- Use the **Write** tool to create `.jsx` files in `.claude/agent-canvas/<session-id>/`:
13
+ Use the **Write** tool to create `.jsx` files in `$TMPDIR/agent-canvas/<session-id>/`:
14
14
 
15
15
  ```jsx
16
- // .claude/agent-canvas/<session-id>/plan.jsx
16
+ // $TMPDIR/agent-canvas/<session-id>/plan.jsx
17
17
 
18
18
  <Section title="Authentication Redesign">
19
19
  A proposal to replace session-based auth with JWT tokens.
@@ -41,7 +41,7 @@ Components are auto-available — no imports needed. The file can be a JSX fragm
41
41
  Push the directory to open all canvases in the browser:
42
42
 
43
43
  ```bash
44
- bunx agent-canvas push .claude/agent-canvas/<session-id>/ --session <session-id> --label "Implementation Plan"
44
+ bunx agent-canvas push $TMPDIR/agent-canvas/<session-id>/ --session <session-id> --label "Implementation Plan"
45
45
  ```
46
46
 
47
47
  All `*.jsx` files in the directory are pushed as a snapshot. Each file appears as a separate tab. **Always show the `browserUrl` from the output to the user.**
@@ -82,7 +82,7 @@ Returns immediately — prints feedback if available, otherwise no output.
82
82
  Use different files for different phases or concerns:
83
83
 
84
84
  ```
85
- .claude/agent-canvas/<session-id>/
85
+ $TMPDIR/agent-canvas/<session-id>/
86
86
  discovery.jsx # Discovery interview
87
87
  requirements.jsx # Requirements spec
88
88
  plan.jsx # Implementation plan
@@ -92,7 +92,7 @@ Write new files as phases progress, then push the directory. Previous files rema
92
92
 
93
93
  ## File Location
94
94
 
95
- All canvas files go in `.claude/agent-canvas/<session-id>/` within the project root. Add `.claude/agent-canvas/` to `.gitignore`.
95
+ All canvas files go in `$TMPDIR/agent-canvas/<session-id>/`. This is a system temp directory — no `.gitignore` needed.
96
96
 
97
97
  ## Components
98
98
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-canvas",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "description": "Interactive visual canvas for Claude Code — rich annotatable documents in the browser",
5
5
  "bin": {
6
6
  "agent-canvas": "bin/agent-canvas.js"
@@ -16,7 +16,7 @@ disable-model-invocation: true
16
16
  Your canvas session ID is: `${CLAUDE_SESSION_ID}`
17
17
 
18
18
  Use this value for:
19
- - File paths: `.claude/agent-canvas/${CLAUDE_SESSION_ID}/`
19
+ - File paths: `$TMPDIR/agent-canvas/${CLAUDE_SESSION_ID}/`
20
20
  - CLI flags: `--session ${CLAUDE_SESSION_ID}`
21
21
 
22
22
  ## Instructions