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.
package/bin/lib/commands/push.ts
CHANGED
|
@@ -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()
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (
|
|
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
|
|
13
|
+
Use the **Write** tool to create `.jsx` files in `$TMPDIR/agent-canvas/<session-id>/`:
|
|
14
14
|
|
|
15
15
|
```jsx
|
|
16
|
-
//
|
|
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
|
|
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
|
-
|
|
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
|
|
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
package/skills/canvas/SKILL.md
CHANGED
|
@@ -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:
|
|
19
|
+
- File paths: `$TMPDIR/agent-canvas/${CLAUDE_SESSION_ID}/`
|
|
20
20
|
- CLI flags: `--session ${CLAUDE_SESSION_ID}`
|
|
21
21
|
|
|
22
22
|
## Instructions
|