@plitzi/sdk-interactions 0.38.7 → 0.38.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,194 @@
1
1
  # @plitzi/sdk-interactions
2
2
 
3
+ ## 0.38.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 1b45aae: ## The CLI's commands are named after what they act on
8
+
9
+ Every command sits under the thing it acts on — `plitzi element move`, never a bare `move` that could mean anything —
10
+ and only what acts on the project as a whole or the account stays at the top:
11
+
12
+ | Before | Now |
13
+ | -------------------------------------------- | ------------------------------------------------------------------ |
14
+ | `where`, `edit`, `remove`, `move` | `element where`, `element edit`, `element remove`, `element move` |
15
+ | `check`, `shot`, `import` | `page check`, `page shot`, `page import` |
16
+ | `space`, `pull`, `push`, `lint`, `fix` | `space use`, `space pull`, `space push`, `space lint`, `space fix` |
17
+ | `add plugin`, `pack plugin`, `upload plugin` | `plugin add`, `plugin pack`, `plugin upload` |
18
+ | `add runtime` | `runtime add` |
19
+ | `pack source` | `source pack` |
20
+ | `update` (alias of `upgrade`) | `upgrade` |
21
+
22
+ `create`, `verify`, `doctor`, `upgrade`, `explain`, `feedback`, `login`, `logout` and `whoami` stay at the top, beside
23
+ `functions`, `runtime`, `data` and `skills`. There are no aliases: a name asked for at the top that is a group's command
24
+ answers where it is — `There is no plitzi push: it is one of plitzi space push, plitzi runtime push, plitzi functions
25
+ push` — read off the commands themselves. A project's scripts (`lint:space`, `check`, `shot`) call the new names;
26
+ `plitzi upgrade --write` updates the ones the CLI wrote.
27
+
28
+ ## Agents load less to do the same (RFC 0025)
29
+ - **The MCP lists the operations vocabulary once.** A connection with a space listed ~69k tokens of tools before an
30
+ agent did anything — the operations schema five times. `plitzi_apply` carries it; `plitzi_render` lists only its
31
+ operations' types beside it (and keeps the whole schema on a guest connection, where it is alone). The listing is
32
+ now ~18k tokens.
33
+ - **`plitzi_validate` is `plitzi_apply`'s `dryRun`**, which already answered the same; the `validate` function, its
34
+ `validateShape` and `ValidateInput` are gone from `@plitzi/sdk-mcp`.
35
+ - **`plitzi_apply` looks at the page it would leave**: `look: 'html' | 'image' | 'accessibility' | 'both'` (with
36
+ `pageRef`, `viewport`, `fullPage`) renders it — with `dryRun`, as the batch would leave it, nothing saved; without, as
37
+ saved. Check, look and save with the operations written twice, not four times.
38
+ - **`plitzi_look` is the one way to see a saved page** — its accessibility outline (the default: text, cheap), its HTML
39
+ or a PNG; `plitzi_preview` and `plitzi_screenshot` are gone. It is always offered: without a browser service it answers
40
+ the HTML and says so.
41
+ - **`plitzi_describe_operation { type }`** answers one operation's schema, or every type there is; a type that does not
42
+ exist is answered with the nearest one.
43
+ - `closest` is exported from `@plitzi/sdk-authoring`: the nearest of a closed list of names.
44
+ - **`plitzi element where <id | class | words>`** answers where the project's code writes an element — the file, the line and
45
+ the call itself — asked of the code as it is now, so it follows an element wherever somebody moved it. A class is
46
+ found by its name or by the variable that holds it (`nav-link`, `navLink`).
47
+ - **`plitzi element edit <id> --set key=value --remove key`** writes attributes in that call (`content` where the factory takes
48
+ it first), keeping each one's kind, formatted as the project formats, and keeps the change only if the space still
49
+ authors with every value there. Behind both, `locateElements` in `@plitzi/sdk-authoring`: every element with the call
50
+ that wrote it.
51
+ - A generated project's `AGENTS.md` says to ask `where` instead of keeping a note of where things are.
52
+ - **`plitzi doctor` says one fact once**: packages installed from the same place, and packages behind the same version,
53
+ are one line each — on a project installed from local tarballs, ~1,050 tokens of output became ~330.
54
+ - **A mistake costs one line.** An operation type that does not exist is answered with the nearest one; a field an
55
+ operation, an element, a binding or a flow step does not have is refused naming the one meant — it used to be dropped,
56
+ and `prop` for `props` answered success having applied nothing. An element type spelt with other capitals
57
+ (`Heading`) is read as the catalog spells it and said in `warnings`.
58
+ - **The same batch refused twice is not run a third time** (`REPEATED_BATCH`), and the second refusal says so; `plitzi
59
+ edit` does the same, kept in the project's `tmp/refusals.json`.
60
+ - **`plitzi_apply`'s `look` renders a batch through the path a save takes** (`draftBatch`): a
61
+ `repeatElement` expanded, what has one reading read, the same refusals.
62
+ - **Each skill is a core an agent reads every time, and references it opens when the task names one.** The core —
63
+ what it is for, the rules that go wrong most, a table routing each task to its one file — is held to 1,500 tokens:
64
+ `plitzi-authoring` went from ~4,000 to ~920 (every rule kept in `reference/rules.md`, the recipes indexed in
65
+ `reference/recipes.md`, every reference in `reference/index.md`), `plitzi-cli` from ~4,000 to ~820 (projects,
66
+ plugins and troubleshooting are references of their own), `plitzi-render` from ~3,100 to ~1,050.
67
+ - **Intent tools on the MCP**: `plitzi_set_attributes`, `plitzi_set_classes` (classes added or removed, the rest
68
+ kept), `plitzi_bind_attribute`, `plitzi_place_component`, `plitzi_add_page` — a few parameters, the element by its ref alone (the
69
+ page is found, a ref that does not exist answered with the nearest), checked and saved as `plitzi_apply` saves, and
70
+ answered in a line with the next step.
71
+ - **An element may only wear a class the space has, or the batch declares**: `plitzi_apply` used to save one nothing
72
+ defines — rendered unstyled, said by nobody. It is refused naming the nearest class.
73
+ - **`plitzi explain` answers any export of `@plitzi/sdk-authoring`** — `pageFamily`, `styles`, `SpaceSpec` — with its
74
+ signature and the first paragraph of its doc, read from the `.d.ts` the project installed: a few dozen tokens where an
75
+ agent used to search ~180k of published types.
76
+ - **`plitzi element where --by id|class|text`** reads a query one way; without it, the first reading that matches is answered
77
+ and every other one that matched is said with its count and the command for it — a query that means two things is
78
+ never answered as one. `plitzi element edit` reads its element by id alone.
79
+ - **A helper written once and called for many elements** is told apart: `locateElements` answers each element's
80
+ `through` — the calls of the author's code that led to the one that wrote it — so `plitzi element where` says which other
81
+ elements the same call writes and the call that leads to this one alone, and `plitzi element edit` changes a value the helper
82
+ is handed where it is handed (`pageHead('about-head', 'About us')`), refuses an edit of a call that writes several
83
+ elements unless `--every` says so, and never writes `content` beside words given as the factory's first argument.
84
+ - `plitzi explain` of a name that is the project's own says where to read it.
85
+ - **Nothing a write does is silent.** `plitzi_apply` answers `effects`: every change the batch made, read off the space
86
+ before and after it (elements added or removed by subtree, attributes, classes, moves, styles, settings, connectors,
87
+ actions), with a note where a changed attribute is one a binding computes; a batch that changed nothing says so, and
88
+ a store with no persister leads the warnings as `NOT saved: …`. The intent tools answer those `effects`, whether it
89
+ was `saved` and what was already so, refuse to take off a class the element does not wear and to write a value under
90
+ a binding. `plitzi element edit` reads the whole space before and after the edit (`plitzi element readings`, in a fresh process),
91
+ prints every change, and puts the files back when anything changed that was not asked, naming it; it refuses an
92
+ attribute a binding computes, and `plitzi element where` marks those `Bound`. `canonicalJson` (`@plitzi/sdk-shared`) is
93
+ what every before-and-after comparison is made with. Authoring keeps deep enough a call stack (64 frames) that a
94
+ helper inside a helper is still told apart.
95
+ - `locateElements` answers the parts of every component too, in the component (`rootId` is its id): `plitzi element where`
96
+ and `plitzi element edit` reach an element inside a component as they reach one on a page or a layout.
97
+
98
+ ## Fixed
99
+ - **A layout no longer mounts twice when the page hydrates.** An element with `runtime: 'server'` was wrapped in its
100
+ static shell while hydrating and handed back without it — under another key — on the next render, so React tore
101
+ down everything under it and built it again. With a server provider around a layout (an `apiContainer` that draws
102
+ no markup of its own), the whole layout's DOM was replaced on every page, and every `motion` arrival in it played
103
+ twice: a visible flicker on load. The shell now stays around the element on both sides of hydration, under the same
104
+ key, and only stops freezing (`frozen`).
105
+ - **A component's instance is written somewhere.** `component(…)` — and each child it places in a slot — rebuilt its
106
+ spec with a spread and lost the marker of where the author wrote it: `plitzi element where` could not place an instance and
107
+ `plitzi element edit` refused it. The original marker is carried (`carryWrittenAt`); `where` finds the words an instance
108
+ hands its component, and `edit` writes an instance's props.
109
+ - `plitzi element edit` follows a value read off a list the call is repeated for (`item.question` in
110
+ `QUESTIONS.flatMap(item => …)`) to the one entry that holds it, in the file the list is written in; when the shared
111
+ value is not a literal it says where it comes from instead of offering `--every`.
112
+ - **`plitzi page check --element` says which class wins.** Each property more than one of the element's classes sets, at
113
+ rest: the value shown, the class it comes from and what the others say — or that they all set it so. Which wins is
114
+ asked of the page, each class taken off for a moment; a style change is verified in text, not with a picture.
115
+ - **`plitzi element where` reads more.** By words it finds every word an element says (`words` on `WrittenElement`: content,
116
+ `label`, `title`, `alt`, `placeholder`, binding templates, an instance's props); by class it says where the class
117
+ is declared (`locateClasses` in `@plitzi/sdk-authoring`); an element repeated over a list says which list, and its
118
+ file; a page or a layout is placed at the object it is declared as.
119
+ - **`plitzi element edit` edits a page** by the attributes `where` shows (`seoPageTitle` written as `seoTitle`;
120
+ `PAGE_SPEC_FIELDS` in `@plitzi/sdk-authoring`), refusing `layout` and `seoEnabled`, which are no field of their own;
121
+ and a value read in more than one place (a list entry a nav and a menu both draw) changes them all only with
122
+ `--every`, each named.
123
+ - **A component prop of a type that does not exist is refused** (`prop-type-unknown`, with the types there are):
124
+ `type: 'string'` was accepted at run time, offered by no editor and checked against nothing. `BUILTIN_PARAM_TYPES`
125
+ in `@plitzi/sdk-shared` is the list, and `BuiltinParamType` is derived from it.
126
+ - **`plitzi element remove <id>` and `plitzi element move <id> --before|--after <id>`** take an element out of the code that writes
127
+ it, or reorder it among its siblings — following a section a helper returns to the helper's call — checked as
128
+ `edit` is: a removal may take only the element and what it holds, a move only reorder its parent, or the file goes
129
+ back. Styles and imports only the removed call used go with it, named; a helper left unread is said.
130
+ - **`plitzi verify`** runs the project's checks — author (no warning), lint:space, typecheck, lint, format — and every
131
+ page with no parameter, and prints only what fails; a page it could not open is said as not checked. Generated
132
+ projects get `npm run verify`, and their `AGENTS.md` names it as the way to leave the project passing.
133
+ - **A component's refusal says where it is written** (by its root's call).
134
+ - **`check --element`** says a class changes nothing on the element only when every property it sets stays without
135
+ it, and names the other elements the class is on: changing the class changes them; taking it off this element does
136
+ not.
137
+ - **An element's generated selector and binding ids are named after its id**, under its parent's place, not after its
138
+ position among its siblings: a move renames nothing. Every space written in code gets new generated names once —
139
+ the same rules, so nothing a visitor sees changes.
140
+ - A change of an element's children is said as what came, went or moved (`faq moved — now after hero, before pricing`).
141
+ - **`plitzi page check --click <id>`** clicks one element and says what changed — flows run and how each step ended, the
142
+ page it went to, what scrolled, what is shown now and what no longer is, the state — or that nothing did, in those words; a flow that
143
+ succeeded while nothing on the page changed is said as that. A click that could not be made, or a flow that failed,
144
+ fails the check.
145
+ - **A refusal of the authored space's gate says where**: each of the validator's errors (`UNRESOLVED_INTERACTION_TARGET`,
146
+ `UNRESOLVED_BINDING_SOURCE`, …) carries the file and line of the element it is about, and a name nothing answers to is
147
+ offered the nearest element that answers the step it was for (`openModal('search')` → `search-modal`, not the
148
+ `search-q` field), or the few that do. `SchemaValidationError` gains `missing` and `wantedBy` (`@plitzi/sdk-schema`).
149
+ - **`plitzi element where` finds the words a list's rows show** when the list is handed them as data (`items:
150
+ [...PLANS]`), and says the list they are the entries of and its file (`Its rows are the entries of PLANS
151
+ (src/space/enterprise/content.ts)`).
152
+ - `plitzi page check --click` says what is **shown** now and what no longer is (drawn, wherever the page is scrolled),
153
+ not "on screen".
154
+ - `plitzi upgrade` says packages installed locally in one line past three, and a skill rewritten within the same
155
+ version as that, not `0.38.7 → 0.38.7`.
156
+ - **What `element edit`, `remove` and `move` read back goes through the gate `npm run author` does**: a change that
157
+ leaves the space refused — a flow still opening a modal that was removed — is put back, the refusal said with where.
158
+ `element remove` refuses before writing when another element's flows act on what it takes away, and says what it
159
+ took once, by the outermost element (`search-modal removed, with 18 inside`). Moving an element beside itself is
160
+ refused as nothing to do.
161
+ - **An id, a plugin folder or a data file written a letter off is offered the nearest one** (`element where`, `edit`,
162
+ `remove`, `move`, `plugin pack`, `data describe`).
163
+ - **A project file that does not load is said at its file and line** — `src/space/hero.ts:139: Expected ','` — by the
164
+ server, `npm run author` and every CLI command, never as a stack (`ProjectModuleError` and `moduleProblem` in
165
+ `@plitzi/sdk-authoring/node`).
166
+ - **`plitzi verify` stops at the first failure** — one broken file fails every later step the same way — and says the
167
+ rest as not run (`--keep-going` runs them anyway); `--no-pages` no longer fails a run that passed.
168
+ - **`plitzi space fix` no longer drops attributes written one level too deep**: `attributes: { value: 5 }` where
169
+ `value: 5` was meant is put in its place (a new `unwrap` fix), not removed with what it said.
170
+ - **`plitzi explain <type>` explains the project's own elements** (`src/plugins/`), and `plugin add` prints how to place
171
+ one with the attributes it was declared with.
172
+ - **`plitzi data describe` says an object keyed by data once**, as a map of one shape with how many keys, so a file of
173
+ five hundred articles reads as one.
174
+ - **`plitzi page check` says a path no page answers before opening it**, with the paths the pages do answer — never a
175
+ redirect home read as a page for signed-in visitors.
176
+ - **`copyToClipboard(text)`**, a utility step (`@plitzi/sdk-interactions`, built with `copyToClipboard` in
177
+ `@plitzi/sdk-authoring`): a "Copy link" button had no step to write with. A browser that gives the page no clipboard
178
+ fails the step, so a toast after it is never said of a copy that was not made.
179
+ - **`plitzi explain` lists the values a param takes only when it is a choice** (`select`): `setState`'s `value` read
180
+ as `'true' | 'false'`, the examples of a free value taken for its only ones.
181
+ - **`plitzi page check --click` says what the page said** — a toast or an alert, `said: "Link copied"` — and **a form
182
+ the browser held back**, with the field and the browser's reason, never as a click that changed nothing.
183
+ - **`plitzi page check --click <id> --fill <id>=<value>`** fills fields before the click as a visitor does (typed, an
184
+ option chosen, a box ticked), so a form's success flow is checked, not only its refusal when empty. A container of
185
+ several fields is refused with their ids; a field filled inside another element says whose it is.
186
+
187
+ - Updated dependencies [1b45aae]
188
+ - @plitzi/sdk-shared@0.38.8
189
+ - @plitzi/sdk-auth@0.38.8
190
+ - @plitzi/sdk-event-bridge@0.38.8
191
+
3
192
  ## 0.38.7
4
193
 
5
194
  ### Patch Changes
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Writes `text` to the visitor's clipboard. A browser with no clipboard — an insecure origin, a document without focus,
3
+ * a permission refused — throws, and the step fails with what it said: the flow's `onFailure` is where to tell them.
4
+ */
5
+ declare const copyToClipboard: import('@plitzi/sdk-shared').InteractionCallback<{
6
+ text: string;
7
+ }>;
8
+ export default copyToClipboard;
@@ -0,0 +1,10 @@
1
+ import { copyToClipboardSpec as e } from "./copyToClipboardSpec.mjs";
2
+ import { toInteractionCallback as t } from "@plitzi/sdk-shared/authoring/builder";
3
+ //#region src/utility/copyToClipboard.ts
4
+ var n = t("copyToClipboard", e, async ({ text: e }) => {
5
+ let t = typeof navigator > "u" ? void 0 : Reflect.get(navigator, "clipboard"), n = typeof t == "object" && t ? Reflect.get(t, "writeText") : void 0;
6
+ if (typeof n != "function") throw Error("This page has no clipboard to write to: the browser offers none here (a page not on https?)");
7
+ await Reflect.apply(n, t, [e]);
8
+ });
9
+ //#endregion
10
+ export { n as default };
@@ -0,0 +1,8 @@
1
+ import { BuiltinActionSpec } from '@plitzi/sdk-shared/authoring/builder';
2
+ /**
3
+ * The copy-to-clipboard step, as the editor and anything authoring one offline read it: the words to copy — a template
4
+ * like any step's param, so `{{ navigation.href }}` copies the page's address and `{{ snippet.code }}` what a source
5
+ * holds. Run where there is no clipboard to write to, or one the browser refuses, the step fails: the flow stops and
6
+ * its `onFailure` runs, so "Copied" is never said of something that was not.
7
+ */
8
+ export declare const copyToClipboardSpec: BuiltinActionSpec;
@@ -0,0 +1,15 @@
1
+ //#region src/utility/copyToClipboardSpec.ts
2
+ var e = {
3
+ title: "Copy To Clipboard",
4
+ type: "utility",
5
+ strictParams: !0,
6
+ params: { text: {
7
+ type: "text",
8
+ description: "The words to copy — a template reads the page: {{ navigation.href }} is its address.",
9
+ default: "",
10
+ label: "Text",
11
+ required: !0
12
+ } }
13
+ };
14
+ //#endregion
15
+ export { e as copyToClipboardSpec };
@@ -1,4 +1,7 @@
1
1
  declare const _default: {
2
+ copyToClipboard: import('@plitzi/sdk-shared').InteractionCallback<{
3
+ text: string;
4
+ }>;
2
5
  delayTime: import('@plitzi/sdk-shared').InteractionCallback<{
3
6
  time: number;
4
7
  }>;
@@ -1,11 +1,13 @@
1
- import e from "./delayTime.mjs";
2
- import t from "./twigTemplate.mjs";
3
- import n from "./webHook.mjs";
1
+ import e from "./copyToClipboard.mjs";
2
+ import t from "./delayTime.mjs";
3
+ import n from "./twigTemplate.mjs";
4
+ import r from "./webHook.mjs";
4
5
  //#region src/utility/index.ts
5
- var r = {
6
- delayTime: e,
7
- twigTemplate: t,
8
- webHook: n
6
+ var i = {
7
+ copyToClipboard: e,
8
+ delayTime: t,
9
+ twigTemplate: n,
10
+ webHook: r
9
11
  };
10
12
  //#endregion
11
- export { r as default };
13
+ export { i as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-interactions",
3
- "version": "0.38.7",
3
+ "version": "0.38.8",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -154,6 +154,14 @@
154
154
  "types": "./dist/utility/index.d.ts",
155
155
  "import": "./dist/utility/index.mjs"
156
156
  },
157
+ "./utility/copyToClipboard": {
158
+ "types": "./dist/utility/copyToClipboard.d.ts",
159
+ "import": "./dist/utility/copyToClipboard.mjs"
160
+ },
161
+ "./utility/copyToClipboardSpec": {
162
+ "types": "./dist/utility/copyToClipboardSpec.d.ts",
163
+ "import": "./dist/utility/copyToClipboardSpec.mjs"
164
+ },
157
165
  "./utility/delayTime": {
158
166
  "types": "./dist/utility/delayTime.d.ts",
159
167
  "import": "./dist/utility/delayTime.mjs"
@@ -195,9 +203,9 @@
195
203
  },
196
204
  "dependencies": {
197
205
  "@plitzi/plitzi-ui": "^1.6.32",
198
- "@plitzi/sdk-auth": "0.38.7",
199
- "@plitzi/sdk-event-bridge": "0.38.7",
200
- "@plitzi/sdk-shared": "0.38.7"
206
+ "@plitzi/sdk-auth": "0.38.8",
207
+ "@plitzi/sdk-event-bridge": "0.38.8",
208
+ "@plitzi/sdk-shared": "0.38.8"
201
209
  },
202
210
  "peerDependencies": {
203
211
  "react": "^19"