@surph_ai/cli 0.0.32 → 0.0.33
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/package.json
CHANGED
package/scaffold/board/README.md
CHANGED
|
@@ -22,7 +22,7 @@ assets/
|
|
|
22
22
|
css/site.css Styles shared by every page in the board
|
|
23
23
|
js/ Scripts shared by the board's pages (optional)
|
|
24
24
|
board.json The board itself: name, contexts, instructions, and its pages (see "Registering pages")
|
|
25
|
-
package.json `npm run dev` serves this folder
|
|
25
|
+
package.json `npm run dev` serves this folder locally; `npm run deploy` publishes the board (see "Deploying")
|
|
26
26
|
README.md This file
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -46,7 +46,7 @@ Every page links it in `<head>`, before its own `<style>`:
|
|
|
46
46
|
|
|
47
47
|
Surph only shows pages that are registered with the board. The board itself is described by **`board.json`** in this folder, shaped like the board's record in Surph; its pages are `config.pages`, one entry per page. Keep it in step with the pages, because it's what Surph reads:
|
|
48
48
|
- **While you develop**, Surph's dev mode runs as the board this file describes, read from your local server (see [Developing locally](#developing-locally)). No live board is needed.
|
|
49
|
-
- **When the board goes live**,
|
|
49
|
+
- **When the board goes live**, `npm run deploy` uploads this same file, and the live board is built from it (see [Deploying](#deploying)). There's no separate record to set up.
|
|
50
50
|
|
|
51
51
|
```json
|
|
52
52
|
{
|
|
@@ -56,7 +56,6 @@ Surph only shows pages that are registered with the board. The board itself is d
|
|
|
56
56
|
"logo": "logo.png",
|
|
57
57
|
"contexts": ["<context slug>"],
|
|
58
58
|
"defaultContext": "<context slug>",
|
|
59
|
-
"waves": [],
|
|
60
59
|
"tools": [],
|
|
61
60
|
"config": {
|
|
62
61
|
"instructions": "How the board's chat should behave: its tone, what it helps with.",
|
|
@@ -75,7 +74,7 @@ Surph only shows pages that are registered with the board. The board itself is d
|
|
|
75
74
|
| `logo` | An image file in `assets/` (just its name, e.g. `logo.png`), shown in Surph's header. |
|
|
76
75
|
| `contexts` | Slugs of the Surph contexts the board draws on. Their items are what `board.get` and the chat's lookups return. They're live Surph contexts; find a context's slug in its address (`/c/<slug>`). |
|
|
77
76
|
| `defaultContext` | The context the chat starts with; else the first in `contexts`. |
|
|
78
|
-
| `
|
|
77
|
+
| `tools` | Slugs of Surph tools the board's chat can use. Optional. |
|
|
79
78
|
| `config.instructions` | Instructions from the board's owner for the board's chat: tone, behavior, what it helps with. On a board they take the place of each context's own instructions. |
|
|
80
79
|
| `config.pages` | The board's pages, one registry entry each (below). |
|
|
81
80
|
|
|
@@ -405,10 +404,27 @@ A field marked "omitted" is missing from the object, not `null`. Every URL is `h
|
|
|
405
404
|
2. Keep it running while you work; the terminal shows a line each time Surph saves `board.json`.
|
|
406
405
|
3. Open `http://localhost:4180/` to check a page loads without console errors. It shows its empty layout there (`hosted` is false); real data only appears inside the Surph canvas.
|
|
407
406
|
4. **Run Surph as your board with dev mode.** Keep `npm run dev` running. In Surph, open **Settings → Developer**, turn on **Run Surph as a local board**, and keep the address `http://localhost:4180`. Surph reloads as the board `board.json` describes: its name and logo in the header, its contexts and instructions in the chat, and its pages in the canvas (it opens on your start page, the Pages menu lists your pages, and the chat's model sees their `shows` lines). The status under the address says what loaded, or why it couldn't read `board.json`; until it loads, Surph runs as usual. A **DEV** label in the canvas header shows your board is loaded. While it's on, anything the chat saves goes to your own space in Surph, not to a board's shared space.
|
|
408
|
-
5. **Configure the board from Surph.** Click the **DEV** label to open the **Local board** panel: set the board's name, slug, description and logo (an image in `assets/`), pick its contexts (yours, or public ones by search) and which one the chat starts with, pick its tools, and write its instructions. The panel also lists the pages and flags a missing `shows` line or an operation the host doesn't answer. **Save and reload** writes `board.json` through the dev server and reloads Surph as the updated board. Pages and any other fields
|
|
407
|
+
5. **Configure the board from Surph.** Click the **DEV** label to open the **Local board** panel: set the board's name, slug, description and logo (an image in `assets/`), pick its contexts (yours, or public ones by search) and which one the chat starts with, pick its tools, and write its instructions. The panel also lists the pages and flags a missing `shows` line or an operation the host doesn't answer. **Save and reload** writes `board.json` through the dev server and reloads Surph as the updated board. Pages and any other fields are kept as they are in the file; edit pages in `board.json` itself.
|
|
409
408
|
6. Dev mode affects only your browser. Turn it off in the same place to get Surph's own pages back.
|
|
410
409
|
7. In Surph, keep your browser's DevTools open with **Network → Disable cache** checked, or the canvas may keep showing an older copy of a page after you change it. After editing `board.json` by hand, reload Surph so it reads the file again.
|
|
411
410
|
|
|
411
|
+
## Deploying
|
|
412
|
+
|
|
413
|
+
`npm run deploy` (`surph-board-deploy` from `@surph_ai/sdk`) publishes the board to Surph. Run it from the board's folder. It needs Node 18 or later and nothing else installed. In order, it:
|
|
414
|
+
|
|
415
|
+
1. **Reads the board's `slug`** from `board.json` (lowercase letters, digits and dashes). The slug names the board's place in Surph; without a valid one it stops before doing anything.
|
|
416
|
+
2. **Zips the site** into `site.zip`: every file in the folder except `package.json`, `package-lock.json`, `README.md`, `board.json`, `node_modules`, dot-files (`.env`, `.git`, `.DS_Store`) and `site.zip` itself. It lists the files it zipped.
|
|
417
|
+
3. **Uploads `site.zip`** to the board's `site/` folder in Surph's storage, then deletes the local `site.zip`. If the upload fails, the zip is kept to look at.
|
|
418
|
+
4. **Unzips it there**, so the pages and `assets/` sit in the board's `site/` folder, where each page's `file` is found.
|
|
419
|
+
5. **Uploads `board.json`**, last, so the live board's definition only changes once its pages are up. If an earlier step fails, `board.json` isn't uploaded and the live board keeps its previous version.
|
|
420
|
+
|
|
421
|
+
Each step prints what it did; a failure prints why and stops. After a deploy, Surph picks up the new `board.json` within about a minute.
|
|
422
|
+
|
|
423
|
+
**For coding agents:**
|
|
424
|
+
- **Deploying publishes the board to everyone who uses it.** Don't run `npm run deploy` unless the person asks you to in this conversation. Check the board with dev mode first (see [Developing locally](#developing-locally)).
|
|
425
|
+
- **Everything in the folder outside the list above is uploaded.** Keep drafts, exports, archives and secrets out of the board's folder, or in dot-files, which are never deployed.
|
|
426
|
+
- **A deploy replaces the live `board.json` with the local one.** Make sure `slug` is the board you mean to update: a deploy under another board's slug overwrites that board.
|
|
427
|
+
|
|
412
428
|
## Checklist before handing off a change
|
|
413
429
|
|
|
414
430
|
- [ ] Every `host.rpc(…)` call uses an operation from [Operations the host answers](#operations-the-host-answers) and reads only the fields listed for it and for [Item](#item).
|
|
@@ -420,3 +436,4 @@ A field marked "omitted" is missing from the object, not `null`. Every URL is `h
|
|
|
420
436
|
- [ ] `board.json`'s `config.pages` lists every page: `name`, `file` (or `url`), `shows` written as facts, `ops` matching the file's `rpc` calls, and one `start` page.
|
|
421
437
|
- [ ] Opened at `http://localhost:4180/`, every page loads without console errors.
|
|
422
438
|
- [ ] Checked in Surph with dev mode on: the canvas opens on the start page and each page paints with real data.
|
|
439
|
+
- [ ] Not deployed unless the person asked for it; if deployed, `npm run deploy` finished without errors and its file list holds only the board's site.
|