agent-canvas 0.1.40 → 0.1.41
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.
|
@@ -151,7 +151,7 @@ Goal: detailed implementation plan with file-level changes. The user approves be
|
|
|
151
151
|
|
|
152
152
|
## Phase 4: Summary (`summary.jsx`)
|
|
153
153
|
|
|
154
|
-
Push AFTER implementation is complete. Always do this, even briefly. **After pushing the summary, start
|
|
154
|
+
Push AFTER implementation is complete. Always do this, even briefly. **After pushing the summary, start the host-specific watch described in the overview** — the user may want to provide feedback (follow-up requests, corrections, questions about what was done).
|
|
155
155
|
|
|
156
156
|
```jsx
|
|
157
157
|
<Section title="Implementation Summary: [Feature Name]">
|
|
@@ -58,7 +58,7 @@ Goal: detailed implementation plan with file-level changes. The user approves be
|
|
|
58
58
|
|
|
59
59
|
## Phase 2: Summary (`summary.jsx`)
|
|
60
60
|
|
|
61
|
-
Push AFTER implementation is complete. Always do this, even briefly. **After pushing the summary, start
|
|
61
|
+
Push AFTER implementation is complete. Always do this, even briefly. **After pushing the summary, start the host-specific watch described in the overview** — the user may want to provide feedback (follow-up requests, corrections, questions about what was done).
|
|
62
62
|
|
|
63
63
|
```jsx
|
|
64
64
|
<Section title="Implementation Summary: [Feature Name]">
|
|
@@ -4,16 +4,17 @@ Canvas opens a rich, annotatable document in the user's browser. You write JSX,
|
|
|
4
4
|
|
|
5
5
|
Use it whenever structured visual communication beats inline chat: plans, reviews, decisions, explanations, discovery interviews.
|
|
6
6
|
|
|
7
|
-
**Note**: Replace all `<session-id>` references below with
|
|
7
|
+
**Note**: Replace all `<session-id>` references below with the stable canvas
|
|
8
|
+
session ID resolved by the skill.
|
|
8
9
|
|
|
9
10
|
## Core Workflow
|
|
10
11
|
|
|
11
12
|
### 1. Write JSX
|
|
12
13
|
|
|
13
|
-
Use the **Write** tool to create `.jsx` files in `$TMPDIR/agent-canvas/<session-id>/`:
|
|
14
|
+
Use the **Write** tool to create `.jsx` files in `${TMPDIR:-/tmp}/agent-canvas/<session-id>/`:
|
|
14
15
|
|
|
15
16
|
```jsx
|
|
16
|
-
// $TMPDIR/agent-canvas/<session-id>/plan.jsx
|
|
17
|
+
// ${TMPDIR:-/tmp}/agent-canvas/<session-id>/plan.jsx
|
|
17
18
|
|
|
18
19
|
<Section title="Authentication Redesign">
|
|
19
20
|
A proposal to replace session-based auth with JWT tokens.
|
|
@@ -41,7 +42,7 @@ Components are auto-available — no imports needed. The file can be a JSX fragm
|
|
|
41
42
|
Push the directory to open all canvases in the browser:
|
|
42
43
|
|
|
43
44
|
```bash
|
|
44
|
-
bunx agent-canvas push $TMPDIR/agent-canvas/<session-id>/ --session <session-id> --label "Implementation Plan"
|
|
45
|
+
bunx agent-canvas push ${TMPDIR:-/tmp}/agent-canvas/<session-id>/ --session <session-id> --label "Implementation Plan"
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
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.**
|
|
@@ -52,16 +53,32 @@ Options:
|
|
|
52
53
|
|
|
53
54
|
### 3. Watch for feedback
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
Start watching immediately after every push:
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
|
-
# Use Bash tool with run_in_background: true
|
|
59
59
|
bunx agent-canvas watch --session <session-id>
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
How to run the watcher depends on the host:
|
|
63
63
|
|
|
64
|
-
**
|
|
64
|
+
- **Codex**: Keep the watcher attached to the current agent turn. Run it without
|
|
65
|
+
detaching or backgrounding it. If the shell tool yields a process/session
|
|
66
|
+
handle, call `write_stdin` on that same handle until the command returns the
|
|
67
|
+
feedback. Do not end the agent turn while the watcher is still running.
|
|
68
|
+
- **Claude Code**: Run the watcher in the background using the Bash tool's
|
|
69
|
+
`run_in_background` parameter. You will be **automatically notified** when the
|
|
70
|
+
user submits feedback. Do NOT poll, sleep, or proactively check. Just stop and
|
|
71
|
+
wait.
|
|
72
|
+
- **Other hosts**: Keep the watcher in the foreground unless the host explicitly
|
|
73
|
+
guarantees that background-process completion wakes the agent.
|
|
74
|
+
|
|
75
|
+
In Codex, a wait may yield before feedback arrives. Continue waiting on the same
|
|
76
|
+
process handle; do not start another watcher. Keep user-facing progress updates
|
|
77
|
+
brief and no more than 60 seconds apart while waiting.
|
|
78
|
+
|
|
79
|
+
**Important**: The push → watch sequence is atomic. Never push without starting
|
|
80
|
+
the host-specific watcher immediately afterward. Do not continue with unrelated
|
|
81
|
+
work while waiting for feedback.
|
|
65
82
|
|
|
66
83
|
### 4. Iterate
|
|
67
84
|
|
|
@@ -82,7 +99,7 @@ Returns immediately — prints feedback if available, otherwise no output.
|
|
|
82
99
|
Use different files for different phases or concerns:
|
|
83
100
|
|
|
84
101
|
```
|
|
85
|
-
$TMPDIR/agent-canvas/<session-id>/
|
|
102
|
+
${TMPDIR:-/tmp}/agent-canvas/<session-id>/
|
|
86
103
|
discovery.jsx # Discovery interview
|
|
87
104
|
requirements.jsx # Requirements spec
|
|
88
105
|
plan.jsx # Implementation plan
|
|
@@ -92,7 +109,7 @@ Write new files as phases progress, then push the directory. Previous files rema
|
|
|
92
109
|
|
|
93
110
|
## File Location
|
|
94
111
|
|
|
95
|
-
All canvas files go in `$TMPDIR/agent-canvas/<session-id>/`. This is a system temp directory — no `.gitignore` needed.
|
|
112
|
+
All canvas files go in `${TMPDIR:-/tmp}/agent-canvas/<session-id>/`. This is a system temp directory — no `.gitignore` needed.
|
|
96
113
|
|
|
97
114
|
## Components
|
|
98
115
|
|
|
@@ -167,14 +184,14 @@ User wants to make a decision? → DECISION flow
|
|
|
167
184
|
2. **Announce** briefly: "I'll start with discovery, then create a detailed plan."
|
|
168
185
|
3. **Write canvas JSX** with the Write tool
|
|
169
186
|
4. **Push + show browserUrl** to the user
|
|
170
|
-
5. **IMMEDIATELY watch
|
|
187
|
+
5. **IMMEDIATELY watch using the host-specific strategy above** — the push → watch sequence is atomic
|
|
171
188
|
6. **Read feedback** — check for annotations, answers, context files
|
|
172
189
|
7. **Edit and re-push + watch**, or advance to next phase
|
|
173
190
|
8. **After implementation**, push a summary canvas and **watch for feedback** — the user may want to respond
|
|
174
191
|
|
|
175
192
|
## Important Rules
|
|
176
193
|
|
|
177
|
-
- **Never `cd`** before running `bunx agent-canvas` commands. The daemon uses the current working directory to resolve project file paths (`<FilePreview>`, file browser). Always run commands from the project root. Since canvas files are in `$TMPDIR`, use absolute paths to reference them — e.g. `bunx agent-canvas push $TMPDIR/agent-canvas/<session-id>/`.
|
|
194
|
+
- **Never `cd`** before running `bunx agent-canvas` commands. The daemon uses the current working directory to resolve project file paths (`<FilePreview>`, file browser). Always run commands from the project root. Since canvas files are in `${TMPDIR:-/tmp}`, use absolute paths to reference them — e.g. `bunx agent-canvas push ${TMPDIR:-/tmp}/agent-canvas/<session-id>/`.
|
|
178
195
|
- **Write** canvas files using the Write tool. Never use bash heredocs.
|
|
179
196
|
- **Edit** canvas files using the Edit tool. Never rewrite entire files.
|
|
180
197
|
- Every `<Item>` and interactive component needs a unique `id`.
|
package/package.json
CHANGED
package/skills/canvas/SKILL.md
CHANGED
|
@@ -13,16 +13,26 @@ disable-model-invocation: true
|
|
|
13
13
|
|
|
14
14
|
## Session
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Resolve the canvas session ID **once**, then reuse the literal value for the
|
|
17
|
+
entire workflow:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
```bash
|
|
20
|
+
echo "${CANVAS_SESSION_ID:-${CODEX_THREAD_ID:-${CLAUDE_CODE_SESSION_ID:-$(uuidgen)}}}"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Write the printed value into every canvas command as `--session "<id>"`, and
|
|
24
|
+
store canvas files in `${TMPDIR:-/tmp}/agent-canvas/<id>/`.
|
|
25
|
+
|
|
26
|
+
Do NOT rely on `export` — in some hosts (Claude Code) each shell call starts
|
|
27
|
+
fresh, so the variable will not survive between commands.
|
|
21
28
|
|
|
22
29
|
## Instructions
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
Run these commands from the user's project root before using Canvas:
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
```bash
|
|
34
|
+
bunx agent-canvas instructions
|
|
35
|
+
bunx agent-canvas instructions --list
|
|
36
|
+
```
|
|
27
37
|
|
|
28
38
|
**Getting detailed docs**: Run `bunx agent-canvas instructions <topic>` for detailed documentation on any component or flow. For example: `bunx agent-canvas instructions component-mermaid` or `bunx agent-canvas instructions flow-feature`.
|