@plitzi/sdk-interactions 0.38.7 → 0.38.9

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