@surph_ai/cli 0.0.29 → 0.0.32
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
|
@@ -21,6 +21,7 @@ index.html The board's home page (edit it; it starts as an intro to t
|
|
|
21
21
|
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
|
+
board.json The board itself: name, contexts, instructions, and its pages (see "Registering pages")
|
|
24
25
|
package.json `npm run dev` serves this folder at http://localhost:4180
|
|
25
26
|
README.md This file
|
|
26
27
|
```
|
|
@@ -43,14 +44,47 @@ Every page links it in `<head>`, before its own `<style>`:
|
|
|
43
44
|
|
|
44
45
|
## Registering pages
|
|
45
46
|
|
|
46
|
-
Surph only shows pages that are registered with the board.
|
|
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
|
+
- **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**, Surph sets up the board's record from this same file; today Surph does that step, so your hand-off includes `board.json`.
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"slug": "my-board",
|
|
54
|
+
"name": "My Board",
|
|
55
|
+
"description": "What the board is about.",
|
|
56
|
+
"logo": "logo.png",
|
|
57
|
+
"contexts": ["<context slug>"],
|
|
58
|
+
"defaultContext": "<context slug>",
|
|
59
|
+
"waves": [],
|
|
60
|
+
"tools": [],
|
|
61
|
+
"config": {
|
|
62
|
+
"instructions": "How the board's chat should behave: its tone, what it helps with.",
|
|
63
|
+
"pages": [
|
|
64
|
+
{ "name": "home", "file": "index.html", "shows": "…", "start": "always", "ops": ["board.get"] }
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
| Field | Meaning |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `slug` | The board's short id. |
|
|
73
|
+
| `name` | The board's name, shown in Surph's header and returned by `board.get`. |
|
|
74
|
+
| `description` | One line about the board. |
|
|
75
|
+
| `logo` | An image file in `assets/` (just its name, e.g. `logo.png`), shown in Surph's header. |
|
|
76
|
+
| `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
|
+
| `defaultContext` | The context the chat starts with; else the first in `contexts`. |
|
|
78
|
+
| `waves`, `tools` | Slugs of Surph waves and tools on the board. Optional. |
|
|
79
|
+
| `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
|
+
| `config.pages` | The board's pages, one registry entry each (below). |
|
|
47
81
|
|
|
48
82
|
A registry entry:
|
|
49
83
|
|
|
50
84
|
```json
|
|
51
85
|
{
|
|
52
86
|
"name": "events",
|
|
53
|
-
"
|
|
87
|
+
"file": "events.html",
|
|
54
88
|
"shows": "Upcoming events from the board's contexts: each event's name, date, place, and a link to its source.",
|
|
55
89
|
"ops": ["board.get"]
|
|
56
90
|
}
|
|
@@ -59,8 +93,8 @@ A registry entry:
|
|
|
59
93
|
| Field | Meaning |
|
|
60
94
|
| --- | --- |
|
|
61
95
|
| `name` | Short, stable label. The chat's model and saved conversations refer to the page by this name, and the canvas header shows it, so don't rename it casually. Unique within the board. |
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
96
|
+
| `file` | The HTML file's name only, with no folder (`events.html`). It's found next to `board.json`: on your local server while you develop, and wherever the board's files are hosted when it's live. |
|
|
97
|
+
| `url` | Instead of `file`, a page's full `https://` address when it lives somewhere else. |
|
|
64
98
|
| `shows` | What the page displays, as plain facts. The chat's model reads this to judge when the page fits. Describe the content, not instructions: write "Every item in the board's newest 25, …", not "Use this when the user asks about…". |
|
|
65
99
|
| `start` | Optional. Marks a page the canvas opens on before the chat starts: `"always"`, `"context"` (a chat that has a context) or `"no-context"` (a chat without one). A board needs at least one. A start page may route on load to another page with [`page.open`](#pageopen) and `replace: true`. |
|
|
66
100
|
| `ops` | The operations the page calls. It must match the `host.rpc(…)` calls in the file. Surph finds pages by op; for example, the page that calls `items.get` is used to show the items a chat looked up. |
|
|
@@ -367,11 +401,13 @@ A field marked "omitted" is missing from the object, not `null`. Every URL is `h
|
|
|
367
401
|
|
|
368
402
|
## Developing locally
|
|
369
403
|
|
|
370
|
-
1. Install once
|
|
371
|
-
2.
|
|
404
|
+
1. Install once with `npm install`, then run `npm run dev`. It starts the board dev server from `@surph_ai/sdk` (`surph-board-dev`), which serves this folder at `http://localhost:4180` with caching off, lets Surph read it from another address, and lets Surph's Local board panel save `board.json`. It only listens on your own machine.
|
|
405
|
+
2. Keep it running while you work; the terminal shows a line each time Surph saves `board.json`.
|
|
372
406
|
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.
|
|
373
|
-
4.
|
|
374
|
-
5.
|
|
407
|
+
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 (such as `waves`) are kept as they are in the file; edit pages in `board.json` itself.
|
|
409
|
+
6. Dev mode affects only your browser. Turn it off in the same place to get Surph's own pages back.
|
|
410
|
+
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.
|
|
375
411
|
|
|
376
412
|
## Checklist before handing off a change
|
|
377
413
|
|
|
@@ -381,5 +417,6 @@ A field marked "omitted" is missing from the object, not `null`. Every URL is `h
|
|
|
381
417
|
- [ ] Operations that act for the person run only from their click (a start page's `page.open` aside).
|
|
382
418
|
- [ ] The SDK `<script>` tag is the v1 URL above, unchanged.
|
|
383
419
|
- [ ] Every page links `assets/css/site.css?v=<n>`; if `site.css` changed, `<n>` is bumped in every page.
|
|
384
|
-
- [ ]
|
|
420
|
+
- [ ] `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.
|
|
385
421
|
- [ ] Opened at `http://localhost:4180/`, every page loads without console errors.
|
|
422
|
+
- [ ] Checked in Surph with dev mode on: the canvas opens on the start page and each page paints with real data.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"slug": "my-board",
|
|
3
|
+
"name": "My Board",
|
|
4
|
+
"description": "",
|
|
5
|
+
"logo": "",
|
|
6
|
+
"contexts": [],
|
|
7
|
+
"defaultContext": "",
|
|
8
|
+
"waves": [],
|
|
9
|
+
"tools": [],
|
|
10
|
+
"config": {
|
|
11
|
+
"instructions": "",
|
|
12
|
+
"pages": [
|
|
13
|
+
{
|
|
14
|
+
"name": "home",
|
|
15
|
+
"file": "index.html",
|
|
16
|
+
"shows": "The board's home page: an introduction to how this board's pages work in Surph, and whether the page is running inside Surph.",
|
|
17
|
+
"start": "always",
|
|
18
|
+
"ops": ["board.get"]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
<ol class="steps">
|
|
92
92
|
<li><strong>Read <code>README.md</code>.</strong> It lists every operation the host answers, the item shape, and the rules a page follows. Point your coding agent at it.</li>
|
|
93
93
|
<li><strong>Run it locally:</strong> <code>npm run dev</code> serves this folder at <code>http://localhost:4180</code> with caching off.</li>
|
|
94
|
-
<li><strong>Add pages</strong> next to this one (<code>items.html</code>, <code>events.html</code>…). Shared styles go in <code>assets/css/site.css</code>.</li>
|
|
95
|
-
<li><strong>
|
|
94
|
+
<li><strong>Add pages</strong> next to this one (<code>items.html</code>, <code>events.html</code>…), and list each in <code>board.json</code> with its <code>name</code>, <code>file</code>, <code>shows</code> and the <code>ops</code> it calls. Shared styles go in <code>assets/css/site.css</code>.</li>
|
|
95
|
+
<li><strong>See them in Surph:</strong> open <strong>Settings → Developer</strong> and turn on dev mode for <code>http://localhost:4180</code>. The canvas then shows this folder's pages, with real data.</li>
|
|
96
96
|
</ol>
|
|
97
97
|
|
|
98
98
|
<script src="https://surph.s3.us-east-1.amazonaws.com/admin/desktop/js/wave-sdk/v1/surph-wave.js"></script>
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "
|
|
6
|
+
"dev": "surph-board-dev"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [],
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"type": "commonjs",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@surph_ai/sdk": "latest"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/scaffold/index.js
CHANGED
|
@@ -271,6 +271,7 @@ const scaffoldBoard = async (name) => {
|
|
|
271
271
|
|
|
272
272
|
shell.cp('-R', path.join(__dirname, `board/README.md`), 'README.md')
|
|
273
273
|
shell.cp('-R', path.join(__dirname, `board/index.html`), 'index.html')
|
|
274
|
+
shell.cp('-R', path.join(__dirname, `board/board.json`), 'board.json')
|
|
274
275
|
|
|
275
276
|
shell.mkdir('-p', 'assets')
|
|
276
277
|
shell.mkdir('-p', 'assets/css')
|