@acryldev/blends 1.7.10 → 1.7.11
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/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/lib/{audit-B2H3sUfg.d.ts → audit-D0McL8hN.d.ts} +1 -1
- package/lib/cordis/door.d.ts +4 -4
- package/lib/cordis/door.js +52 -3
- package/lib/door/host.d.ts +2 -2
- package/lib/door/host.js +1 -1
- package/lib/door/page.d.ts +5 -1
- package/lib/door/page.js +28 -5
- package/lib/door/protocol.d.ts +2 -2
- package/lib/door/protocol.js +2 -2
- package/lib/{protocol-8HjYa5OX.js → protocol-BKXK53WF.js} +39 -3
- package/lib/{protocol-DdQgl224.d.ts → protocol-CbLZdkJ5.d.ts} +31 -2
- package/lib/{snapshot-text-Cyl69OKv.js → snapshot-text-BYY2gA98.js} +2 -2
- package/package.json +1 -1
- package/plugins/door/package.json +1 -1
- package/plugins/door/src/cli/acryl.ts +12 -1
- package/plugins/door/src/host/door.ts +6 -0
- package/plugins/door/src/host/verbs.ts +15 -2
- package/plugins/door/src/page/driver/driver.ts +23 -2
- package/plugins/door/src/page/index.ts +11 -0
- package/plugins/door/src/page/protocol.ts +37 -2
- package/plugins/door/src/page/snapshot-text.ts +2 -1
- package/plugins/plugin-share/package.json +1 -1
- package/plugins/plugin-share/plugin.json +1 -1
- package/plugins/save/cli.ts +2 -0
- package/plugins/save/package.json +1 -1
- package/plugins/save/plugin.json +1 -1
- package/plugins/save/share-cli.ts +8 -1
- package/shared/AGENTS.core.md +9 -0
- package/shared/library-history-versions.json +3 -1
- package/shared/library-history.json +9 -3
- package/shared/skills/acryl-app/SKILL.md +4 -3
|
@@ -6,12 +6,33 @@
|
|
|
6
6
|
* lives with the page code and has no Node imports.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The ACRYL frame around a canvas page: its own panels, mode and Settings, which are not part of the app's page. The frame publishes a
|
|
11
|
+
* {@link FrameControl} on its window under {@link FRAME_CONTROL_KEY}; the door's page script, running in the canvas, reaches it as `window.parent`.
|
|
12
|
+
*/
|
|
13
|
+
export const FRAME_CONTROL_KEY: symbol = Symbol.for('acryl.frame.control')
|
|
14
|
+
export const FRAME_ACTIONS = ['state', 'open', 'close', 'toggle', 'settings', 'build', 'preview'] as const
|
|
15
|
+
export type FrameAction = (typeof FRAME_ACTIONS)[number]
|
|
16
|
+
export type FramePanel = 'left' | 'right'
|
|
17
|
+
/** What the frame shows: its left panel (branches and versions), its right panel (the agents), its mode, and whether Settings is open. */
|
|
18
|
+
export interface FrameState {
|
|
19
|
+
readonly left: boolean
|
|
20
|
+
readonly right: boolean
|
|
21
|
+
readonly mode: 'build' | 'preview'
|
|
22
|
+
readonly settings: boolean
|
|
23
|
+
}
|
|
24
|
+
export interface FrameControl {
|
|
25
|
+
state(): FrameState
|
|
26
|
+
/** Do one frame action; the answer says what changed. @throws Error with a reason a person can read. */
|
|
27
|
+
run(request: Extract<UiRequest, { readonly op: 'frame' }>): string | Promise<string>
|
|
28
|
+
}
|
|
29
|
+
|
|
9
30
|
/** The operations the driver performs on the page. */
|
|
10
|
-
export const UI_OPS = ['snapshot', 'click', 'type', 'select', 'press', 'scroll', 'wait', 'reload', 'navigate'] as const
|
|
31
|
+
export const UI_OPS = ['snapshot', 'click', 'type', 'select', 'press', 'scroll', 'wait', 'reload', 'navigate', 'frame'] as const
|
|
11
32
|
export type UiOp = (typeof UI_OPS)[number]
|
|
12
33
|
|
|
13
34
|
/** Operations that change the page, so each call needs approval. `snapshot`, `scroll` and `wait` only look. */
|
|
14
|
-
export const MUTATING_OPS: readonly UiOp[] = ['click', 'type', 'select', 'press', 'reload', 'navigate']
|
|
35
|
+
export const MUTATING_OPS: readonly UiOp[] = ['click', 'type', 'select', 'press', 'reload', 'navigate', 'frame']
|
|
15
36
|
|
|
16
37
|
/** A place in the app to go to: a path on the page's own origin (`/demo`, `/notes?q=a#top`), never another site and never a `//host` address. */
|
|
17
38
|
export const APP_PATH = /^\/(?![/\\])[^\0\\]{0,2000}$/u
|
|
@@ -72,6 +93,8 @@ export interface UiSnapshot {
|
|
|
72
93
|
readonly total: number
|
|
73
94
|
/** Pass to the next snapshot call to continue, or absent when this is everything. */
|
|
74
95
|
readonly nextCursor?: number
|
|
96
|
+
/** The ACRYL frame around this page, when the page is in one. */
|
|
97
|
+
readonly frame?: FrameState
|
|
75
98
|
}
|
|
76
99
|
|
|
77
100
|
export type UiRequest =
|
|
@@ -84,6 +107,7 @@ export type UiRequest =
|
|
|
84
107
|
| { readonly op: 'wait'; readonly text?: string; readonly role?: string; readonly name?: string; readonly gone?: boolean; readonly timeoutMs?: number }
|
|
85
108
|
| { readonly op: 'reload' }
|
|
86
109
|
| { readonly op: 'navigate'; readonly path: string }
|
|
110
|
+
| { readonly op: 'frame'; readonly action: FrameAction; readonly panel?: FramePanel; readonly section?: string }
|
|
87
111
|
|
|
88
112
|
/** What the page did, and to which control (for the audit log and the approval prompt). */
|
|
89
113
|
export interface UiActionResult {
|
|
@@ -181,6 +205,17 @@ export function parseUiRequest(value: unknown): UiRequest {
|
|
|
181
205
|
if (typeof value.path !== 'string' || !APP_PATH.test(value.path)) return invalid('path must be a path of this app, such as /demo (it starts with one /, and names no other site)')
|
|
182
206
|
return { op, path: value.path }
|
|
183
207
|
}
|
|
208
|
+
case 'frame': {
|
|
209
|
+
only(['action', 'panel', 'section'])
|
|
210
|
+
const action = value.action === undefined ? 'state' : value.action
|
|
211
|
+
if (!FRAME_ACTIONS.includes(action as FrameAction)) return invalid(`frame action must be one of ${FRAME_ACTIONS.join(', ')}`)
|
|
212
|
+
const panel = value.panel
|
|
213
|
+
if (panel !== undefined && panel !== 'left' && panel !== 'right') return invalid('panel must be left or right')
|
|
214
|
+
if ((action === 'open' || action === 'close' || action === 'toggle') && panel === undefined) return invalid(`frame ${String(action)} needs a panel: left (branches and versions) or right (the agents)`)
|
|
215
|
+
const section = value.section === undefined ? undefined : text(value.section, 80)
|
|
216
|
+
if (section !== undefined && action !== 'settings') return invalid('section goes with settings')
|
|
217
|
+
return { op, action: action as FrameAction, ...(panel === undefined ? {} : { panel }), ...(section === undefined ? {} : { section }) }
|
|
218
|
+
}
|
|
184
219
|
default: return invalid(`unknown op ${String(op)}`)
|
|
185
220
|
}
|
|
186
221
|
}
|
|
@@ -15,5 +15,6 @@ export function renderSnapshot(snapshot: UiSnapshot, more: (cursor: number) => s
|
|
|
15
15
|
return `${' '.repeat(Math.min(node.depth, 8))}- ${node.role}${node.name === '' ? '' : ` ${JSON.stringify(node.name)}`}${level}${states}${value}${options} [ref=${node.ref}]`
|
|
16
16
|
})
|
|
17
17
|
const rest = snapshot.nextCursor === undefined ? '' : `\n(${String(snapshot.total - snapshot.nextCursor)} more elements; ${more(snapshot.nextCursor)})`
|
|
18
|
-
|
|
18
|
+
const frame = snapshot.frame === undefined ? '' : `Frame (the ACRYL window around the app, not part of the app): left panel (branches, versions) ${snapshot.frame.left ? 'open' : 'closed'}, right panel (agents) ${snapshot.frame.right ? 'open' : 'closed'}, ${snapshot.frame.mode} mode${snapshot.frame.settings ? ', Settings open' : ''}. Operate it with frame (open|close|toggle left|right, settings [section], build, preview), never by editing code.\n`
|
|
19
|
+
return `${frame}Page: ${snapshot.title || '(untitled)'}\nSnapshot ${String(snapshot.generation)}, ${String(snapshot.nodes.length)} of ${String(snapshot.total)} elements:\n${lines.join('\n')}${rest}`
|
|
19
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acryldev/plugin-share",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Share plugins between people. Pull one someone released into the running app: fetched without running anything, checked by digest and for every OS, then installed live. Publish one, only as a plan a person confirmed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/plugins/save/cli.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/** `npm run save -- "message"`: save the app folder this file lives in. Prints the result; exits 1 when the save was refused. */
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
3
|
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { adoptGithubToken } from '@acryldev/app-persistence'
|
|
4
5
|
import { saveFolder } from './index.ts'
|
|
5
6
|
|
|
6
7
|
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
7
8
|
const appRoot = fileURLToPath(new URL('../..', import.meta.url))
|
|
9
|
+
adoptGithubToken()
|
|
8
10
|
const result = saveFolder(appRoot, process.argv.slice(2).join(' ').trim() || 'save the app')
|
|
9
11
|
if (result.status === 'refused') {
|
|
10
12
|
console.error(`not saved: ${result.reason}`)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acryldev/save",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Save the app to its own git repository, and share it: a repository of its own on GitHub, created and pushed only after a person confirms the plan. Refuses a file that holds a secret, and a private app going to a public remote.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/plugins/save/plugin.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"provides": [],
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@deepseek-ai/cordis": "4.0.4",
|
|
11
|
-
"@acryldev/app-persistence": "0.1.
|
|
11
|
+
"@acryldev/app-persistence": "0.1.5"
|
|
12
12
|
},
|
|
13
13
|
"mount": "mount the plugin to give the agent a save_app tool; its scripts (npm run save, npm run share) are added to package.json with it",
|
|
14
14
|
"entries": {
|
|
@@ -13,7 +13,12 @@ import { realpathSync } from 'node:fs'
|
|
|
13
13
|
import { createInterface } from 'node:readline/promises'
|
|
14
14
|
import { fileURLToPath } from 'node:url'
|
|
15
15
|
import { parseArgs } from 'node:util'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
adoptGithubToken,
|
|
18
|
+
CATEGORIES_URL,
|
|
19
|
+
type CatalogCategory,
|
|
20
|
+
readCategories,
|
|
21
|
+
} from '@acryldev/app-persistence'
|
|
17
22
|
import { planShare, renderSharePlan, type SharePlan, type ShareResult, shareApp } from './share.ts'
|
|
18
23
|
|
|
19
24
|
function report(result: ShareResult): number {
|
|
@@ -79,6 +84,8 @@ const HELP = `npm run share [-- options]: send this app to a GitHub repository o
|
|
|
79
84
|
Example: npm run share -- --visibility public --list --category business --subcategory crm`
|
|
80
85
|
|
|
81
86
|
async function main(argv: readonly string[]): Promise<number> {
|
|
87
|
+
// The GitHub sign-in made in Control Center or in an app (`~/.acryl/github.json`) is this share's login: gh and git start with it, and fall back to their own login without it.
|
|
88
|
+
adoptGithubToken()
|
|
82
89
|
const appRoot = fileURLToPath(new URL('../..', import.meta.url))
|
|
83
90
|
const { values } = parseArgs({
|
|
84
91
|
args: [...argv],
|
package/shared/AGENTS.core.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
A Cordis app on the ACRYL framework: TypeScript that Node 22.19 or newer runs directly (no build step; erasable syntax only, so no enums and no
|
|
4
4
|
parameter properties). Every part of it is a Cordis plugin.
|
|
5
5
|
|
|
6
|
+
## Using the interface is not changing the app
|
|
7
|
+
|
|
8
|
+
A request to click, open, close, collapse, expand, show, hide, scroll, select or type something on screen ("collapse the left panel", "open Settings",
|
|
9
|
+
"click Save", "show the chart", "type milk in the search") is done by operating the interface, never by changing code. Use `.acryl/bin/acryl`:
|
|
10
|
+
`look` first (it also says what the ACRYL frame shows), then `act` for anything inside the app's page, and `frame` for the ACRYL frame around the
|
|
11
|
+
app, which is not part of the app: its left panel (branches and versions), its right panel (the agents), Build and Preview, and Settings
|
|
12
|
+
(`frame close left`, `frame open right`, `frame settings Share`, `frame preview`). Change code only when the person asks to change the app
|
|
13
|
+
("add", "build", "make it", "fix", "change how it works").
|
|
14
|
+
|
|
6
15
|
## The framework's API is in `docs/framework/`
|
|
7
16
|
|
|
8
17
|
Start at `docs/framework/README.md`; `api/summary.md` is the one-page summary. Read before you write routes: `api/routing.md` (the `Acryl` app), `api/request.md` (`c.req`),
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"door-shell.ts": ["9b879028326971973bd3", "3e535eff746a41525dbb", "399d6ff1b66596d66c69"],
|
|
115
115
|
"frame.ts": ["191f21e3dc14e1a6d2d8", "0b856f73720a4b6bb2bf", "ee2a89ff711b9c6fe268"],
|
|
116
116
|
"git.ts": ["94d70b10792693ce54db"],
|
|
117
|
-
"host-supervisor.ts": ["e69994399fa32dbb1cfc"],
|
|
117
|
+
"host-supervisor.ts": ["e69994399fa32dbb1cfc", "3bd694189bff93e8d0c3"],
|
|
118
118
|
"launch.ts": [
|
|
119
119
|
"d7468b2289b0d6b99706",
|
|
120
120
|
"b6650e0d33533bff9614",
|
|
@@ -137,7 +137,8 @@
|
|
|
137
137
|
"bd42ccc572a08e50040b",
|
|
138
138
|
"c8aa493e2753e8e04ac9",
|
|
139
139
|
"a4363ad4e36cf36ab36e",
|
|
140
|
-
"a966b97329fe5124d65f"
|
|
140
|
+
"a966b97329fe5124d65f",
|
|
141
|
+
"6650cffd23fc17b3292f"
|
|
141
142
|
],
|
|
142
143
|
"menu.ts": ["9b88cda709178fffc66d"],
|
|
143
144
|
"preload.cjs": ["c7de936c2213786f2b00"],
|
|
@@ -917,7 +918,12 @@
|
|
|
917
918
|
"index.ts": ["48f96cde6c73e781e3e6", "87f0933285eb83af7ad0"],
|
|
918
919
|
"LICENSE": ["0f98259ccb0f4cafebe9"],
|
|
919
920
|
"README.md": ["3ca5c183f7ea0bdf6b95"],
|
|
920
|
-
"share-cli.ts": [
|
|
921
|
+
"share-cli.ts": [
|
|
922
|
+
"2201fe37cbbc5d167e17",
|
|
923
|
+
"97cdb3ceaf2c73327454",
|
|
924
|
+
"5027a88554b2a654c563",
|
|
925
|
+
"a988fa0fe4949092eeda"
|
|
926
|
+
],
|
|
921
927
|
"share.ts": ["458a795e3298eb69eb82", "353ea9b5e115787c595f", "71410a74dbcc3161b433"]
|
|
922
928
|
},
|
|
923
929
|
"showcase": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: acryl-app
|
|
3
|
-
description: How the __APP_NAME__ app is put together - its blend.yaml rows, its plugins/ folder and src/ - and how to change it, run it and check it through the door. Use before adding a feature, a route, a plugin or a dependency to this app, and before saying the work is done.
|
|
3
|
+
description: How the __APP_NAME__ app is put together - its blend.yaml rows, its plugins/ folder and src/ - and how to change it, run it and check it through the door. Use before adding a feature, a route, a plugin or a dependency to this app, and before saying the work is done. Also use when asked to click, open, close, collapse, show or type something on screen: that is done with the door, not by editing code.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Working in __APP_NAME__
|
|
@@ -9,5 +9,6 @@ description: How the __APP_NAME__ app is put together - its blend.yaml rows, its
|
|
|
9
9
|
2. **The app is data plus code.** `blend.yaml` is the blueprint: which plugins (rows) the app mounts, in what order, with what config. `src/app.ts` is the runtime: a row's `name` is a library plugin its `registry` imports or a folder `plugins/<name>/` of the app's own, and `compose` starts them in row order. `src/routes.ts` is the app's own `Acryl` app (its page and API). A plugin the app owns is a folder `plugins/<name>/`.
|
|
10
10
|
3. **Make the change small.** A route is a handler on the app's `Acryl` app mounted with `ctx.router.route('/', app)`; test it with `await app.request('/path')`. Write the app's own paths: the frame that hosts the app adds its canvas prefix to every plugin route (`/board` answers `/board` under `npm start` and `/app/board` in the canvas), so never put the prefix in a route. Every feature is a Cordis plugin: a `plugins/<name>/` folder plus its row in `blend.yaml` (see the acryl-build-plugin skill); `src/app.ts` and `src/routes.ts` are never touched for a feature. `npx acrylblends add <name>` copies a library plugin there.
|
|
11
11
|
4. **Defaults are swappable.** The database, the key-value store, the server and the window are plugins behind ports; the table "Defaults you can swap" in `AGENTS.md` names each default and where it is swapped. Never reach around a port to a driver: `npx acrylblends check-deps` fails the check.
|
|
12
|
-
5. **
|
|
13
|
-
6. **
|
|
12
|
+
5. **Asked to use the interface? Operate it, don't edit it.** "Collapse the left panel", "open Settings", "click Save", "scroll to the chart" are done with `.acryl/bin/acryl look`, then `act` (inside the app's page) or `frame` (the ACRYL frame around the app: `frame close left|right`, `frame open left|right`, `frame settings [section]`, `frame build|preview`). The frame's panels are not in the app's code, so editing the app cannot and must not change them. Change code only when the person asks to change the app.
|
|
13
|
+
6. **Look at the running app.** In development the app writes `.acryl/bin/acryl`: `acryl brief` says what this folder runs, `acryl look` shows the open page as text with refs, and `acryl act click|type|select|press|scroll|wait|navigate|reload` acts on it. Look again before each act, because the refs change. This is the app's control surface: use it instead of guessing what the page shows.
|
|
14
|
+
7. **Done means checked.** `npm test` passes, and the change shows in the running app. No secret goes in a file or in `git status`: keys come from environment variables.
|