@clearlysh/beehaven 0.8.34 → 0.8.36
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/dist/agent-sessions.js +9 -6
- package/dist/agents-md-text.js +79 -43
- package/dist/browser-login.js +94 -0
- package/dist/build-channel.js +2 -2
- package/dist/cli.js +96 -50
- package/dist/commands/agent-instructions.js +38 -30
- package/dist/commands/agents-md.js +104 -12
- package/dist/commands/help.js +49 -14
- package/dist/commands/mcp-token.js +113 -0
- package/dist/reconnect-backoff.js +78 -0
- package/dist/relay.js +33 -22
- package/package.json +1 -1
- package/scripts/sync-skills.mjs +1 -0
- package/skills/clearly-artifacts/SKILL.md +143 -0
- package/skills/index.json +7 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clearly-artifacts
|
|
3
|
+
description: >-
|
|
4
|
+
Needs a terminal with the beehaven CLI (Claude Code, Codex, Gemini CLI); in a chat with only the Clearly connector, say so: the connector cannot make a running page.
|
|
5
|
+
Put a self-contained interactive HTML page into a Clearly workspace, the way a
|
|
6
|
+
Claude artifact works: an explainer, an animation, a small tool, a calculator, a
|
|
7
|
+
chart that runs. Covers which of the three HTML homes runs scripts (a SITE does,
|
|
8
|
+
a canvas ARTIFACT card does but cannot be clicked, a NOTE never does), the exact
|
|
9
|
+
CLI calls, the sandbox limits, updating, filing in a project, how a person opens
|
|
10
|
+
it, and QA. Use when asked to publish, host or add an HTML page, demo or animation
|
|
11
|
+
to the workspace. Triggers: "make an artifact", "publish this HTML", "add this page /
|
|
12
|
+
animation / explainer to the workspace", "host this demo", "interactive page",
|
|
13
|
+
"put this HTML on the canvas", "why doesn't my page's script run".
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Clearly artifacts — a running HTML page in the workspace
|
|
17
|
+
|
|
18
|
+
Sign in first (`clearly-agent`). `beehaven env` must name the environment you mean; staging and
|
|
19
|
+
production hold different workspaces.
|
|
20
|
+
|
|
21
|
+
## 1. Pick the home — only two of the three run code
|
|
22
|
+
|
|
23
|
+
| Home | Make it with | Scripts and CSS animation | Clickable | Search, history | Opens at |
|
|
24
|
+
|---|---|---|---|---|---|
|
|
25
|
+
| **Site** | `compose-upload-init` → `file-teleport-inline` → `compose-upload-finalize` | run | yes | not in `document-search`; no version history; a re-upload overwrites | Recents or project card → `/compositions/detail?id=<id>` |
|
|
26
|
+
| **Canvas artifact** | `canvas-act` `canvas.add-artifact` | run | **no**: the card never takes pointer events, so it pans like a picture | no; it is part of the canvas and is deleted with it | the canvas, `/c/<compositionId>` |
|
|
27
|
+
| **Note** | `document-create {html}`; `page-write` (in-app chat only) | **never**: it opens in the document editor, which drops `<script>`, `<style>` and inline `<svg>` | n/a | yes, both | `/documents/<id>` |
|
|
28
|
+
|
|
29
|
+
- An interactive page someone opens, clicks through or comes back to is a **site**. This is the
|
|
30
|
+
Claude-artifact equivalent and the default.
|
|
31
|
+
- A page that only needs to be **seen** beside other cards (a looping animation, a live chart in a
|
|
32
|
+
review board) is a **canvas artifact**. Buttons inside it cannot be pressed.
|
|
33
|
+
- Prose the team will read, search and edit is a **note**. Never put a script in a note: it
|
|
34
|
+
is stored, and then nothing ever runs it. Editing the note in the app rewrites its body.
|
|
35
|
+
|
|
36
|
+
No home gives a public link that runs. Every share link (`/r/…`) is served with
|
|
37
|
+
`script-src 'none'`, and a shared composition renders as a static picture. Say so when someone asks to
|
|
38
|
+
publish an interactive page outside the workspace.
|
|
39
|
+
|
|
40
|
+
## 2. Write it self-contained
|
|
41
|
+
|
|
42
|
+
Both running homes inject the page with `srcdoc` into `<iframe sandbox="allow-scripts">`, with no
|
|
43
|
+
`allow-same-origin`. The page gets an opaque origin (`window.origin === "null"`).
|
|
44
|
+
|
|
45
|
+
- **One file.** `<!doctype html>`, `<meta name="viewport" content="width=device-width, initial-scale=1">`,
|
|
46
|
+
CSS in `<style>`, JS in `<script>`, art as inline SVG, images and fonts as `data:` URIs,
|
|
47
|
+
system font stacks. Make no network requests and load no CDN scripts.
|
|
48
|
+
- **The sandbox blocks:** `localStorage`, `sessionStorage`, cookies and IndexedDB (accessing them
|
|
49
|
+
throws), `alert`/`confirm`/`prompt`, form submission, popups, `window.open` and top-level
|
|
50
|
+
navigation. Keep state in memory, and wrap any storage access in `try`.
|
|
51
|
+
- **A site's other files are rarely reached.** The preview rewrites only `src="…"`/`href="…"`
|
|
52
|
+
in the entry HTML that name a build file exactly (up to 60 files). It does not rewrite `url()`
|
|
53
|
+
inside CSS, `import`, or `fetch` of a sibling file. Inline them.
|
|
54
|
+
- **Size:** a canvas artifact is at most 512 KB. A site file is at most 6 MB inline. Over the CLI
|
|
55
|
+
WebSocket, keep a single `beehaven call` under about 900 KB, or use `beehaven compose push`,
|
|
56
|
+
which switches to a presigned upload.
|
|
57
|
+
- **Motion:** honour `@media (prefers-reduced-motion: reduce)`. A canvas card lays the page out
|
|
58
|
+
at `designWidth` (default 1280) and grows to the document's full height. A `100vh` layout
|
|
59
|
+
makes it grow again on every fit, so size sections in px or by content.
|
|
60
|
+
|
|
61
|
+
## 3. Make it (CLI)
|
|
62
|
+
|
|
63
|
+
Build JSON payloads with a script and pass them as `@file`. Do not hand-escape HTML into a shell
|
|
64
|
+
argument.
|
|
65
|
+
|
|
66
|
+
**Site, from one file** (one `file-teleport-inline` per file; `entryPoint` and each path are
|
|
67
|
+
relative to `build/`):
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
beehaven call compose-upload-init '{"name":"MCP tokens explained","sourceType":"static","entryPoint":"index.html","projectId":"<projectId>"}'
|
|
71
|
+
# → { "id": "cmp_…", "created": true }
|
|
72
|
+
node -e 'const fs=require("fs"),b=fs.readFileSync("page.html");fs.writeFileSync("up.json",JSON.stringify({key:"compositions/<id>/build/index.html",composition:true,name:"index.html",mimeType:"text/html",size:b.length,data:b.toString("base64")}))'
|
|
73
|
+
beehaven call file-teleport-inline @up.json
|
|
74
|
+
beehaven call compose-upload-finalize '{"compositionId":"<id>","totalBytes":<bytes>,"entryPoint":"index.html"}'
|
|
75
|
+
beehaven call composition-fs '{"compositionId":"<id>","action":"list"}' # one row per file, sizes match
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Both parts of the upload are load-bearing. A `key` outside `compositions/<id>/build/`, or a
|
|
79
|
+
missing `composition:true`, still answers ok, and the site then renders nothing.
|
|
80
|
+
|
|
81
|
+
**Site, from a folder** that holds only the page and its assets:
|
|
82
|
+
`cd <folder> && beehaven compose create --name "<title>" && beehaven compose push`. Every file in
|
|
83
|
+
the folder is uploaded. A Vite, Next, Astro or SvelteKit `package.json` there runs its build first.
|
|
84
|
+
To push to an existing site, run `beehaven compose push --composition <id>` from the folder; there
|
|
85
|
+
is no `--dir` flag. `compose create` cannot file the site, so file it afterwards (§4). Ignore the
|
|
86
|
+
URL that `push` prints, because it does not open the site.
|
|
87
|
+
|
|
88
|
+
**Canvas artifact** (create or reuse the canvas with `composition-create {title, projectId}`):
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
# payload: {"compositionId":"<canvasId>","action":"canvas.add-artifact",
|
|
92
|
+
# "args":{"html":"<!doctype html>…","title":"…","name":"explainer","x":0,"y":0,"w":1000,"designWidth":1000}}
|
|
93
|
+
beehaven call canvas-act @artifact.json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`w` is the card's width on the board; `designWidth` is the viewport the page lays out at. Use 390
|
|
97
|
+
for a phone design. `canvas.place {kind:"site", id}` puts an existing site on a canvas as an
|
|
98
|
+
artifact card. It copies the entry HTML at that moment: later re-uploads do not reach the card,
|
|
99
|
+
and the site's other files do not load.
|
|
100
|
+
|
|
101
|
+
**Connector only (MCP):** no tool makes a site or an artifact. `clearly_file_upload` cannot choose
|
|
102
|
+
a site path, and `clearly_create` stores a document body as markdown. `clearly_canvas_place
|
|
103
|
+
{target, kind:"site", id}` can place a site that already exists. Otherwise, tell the person the
|
|
104
|
+
running page needs the CLI.
|
|
105
|
+
|
|
106
|
+
## 4. Update, file, link
|
|
107
|
+
|
|
108
|
+
- **Update a site:** upload to the same `key`, then `compose-upload-finalize` again. Only someone
|
|
109
|
+
who may manage the site (its creator) can overwrite it. A file you stop shipping stays in the
|
|
110
|
+
build. Agents are refused `composition-fs … "action":"delete"`, so ask the person to remove it,
|
|
111
|
+
or stop referencing it. There is no history, so keep the source in the repository or a note.
|
|
112
|
+
- **Update a canvas artifact:** there is no edit verb. Add the new version at the old card's
|
|
113
|
+
`x`/`y`/`w`, then remove the old card with `canvas.delete {ids:[…]}`.
|
|
114
|
+
- **File:** `projectId` on `compose-upload-init` (to file later, call it again with
|
|
115
|
+
`{"compositionId","projectId"}`). For a canvas, `composition-create {projectId}`. For a note,
|
|
116
|
+
`document-create {projectId}` or `document-update {id, projectId}`. Unfiled agent work is
|
|
117
|
+
private to its author.
|
|
118
|
+
- **Link it to the ticket:** `beehaven call work-link '{"ticketId":"…","kind":"design","refKind":"composition","refId":"<id>"}'`.
|
|
119
|
+
|
|
120
|
+
## 5. Hand it over
|
|
121
|
+
|
|
122
|
+
Give the person the place to click, not just an id.
|
|
123
|
+
|
|
124
|
+
- A site: "Recents (or the project) → the card", which opens `/compositions/detail?id=<id>`.
|
|
125
|
+
Do not hand over `/c/<siteId>`. That is what `beehaven open`, ticket links and workspace-ref
|
|
126
|
+
chips build for a site, and it opens an empty canvas instead of the page.
|
|
127
|
+
- A canvas artifact: `/c/<canvasId>`. Double-clicking the card opens its stored file in a new tab,
|
|
128
|
+
which shows source text or an access error, never the running page.
|
|
129
|
+
|
|
130
|
+
## 6. QA — open it, read the console, check mobile
|
|
131
|
+
|
|
132
|
+
1. **Render it in the real frame model** before uploading. Use Playwright: an
|
|
133
|
+
`<iframe sandbox="allow-scripts" srcdoc>` at 1280 and 390 wide. Confirm there are no console
|
|
134
|
+
errors and no requests from the frame, that `scrollWidth === clientWidth`, that the animation
|
|
135
|
+
advances by itself, and that its controls respond.
|
|
136
|
+
2. **Read the stored copy back:** check that `composition-fs list` shows the size you sent.
|
|
137
|
+
3. **See the server render it.** For a canvas artifact, run
|
|
138
|
+
`canvas-act {"compositionId":"<canvasId>","action":"canvas.review","args":{"ids":["<artifactId>"]}}`.
|
|
139
|
+
It returns a filmstrip of four frames across about 5.4 s; inspect the PNG. For a site, place it on a scratch canvas
|
|
140
|
+
(`canvas.place {kind:"site", id}`), review that card the same way, and then archive the scratch
|
|
141
|
+
canvas (`composition-set-archived {id, archived:true}`).
|
|
142
|
+
4. Report what you checked and what you could not check. Opening the signed-in page itself needs a
|
|
143
|
+
person's session.
|