@plitzi/sdk-dev-tools 0.38.24 → 0.39.0
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 +152 -1
- package/dist/DevToolsContainer.d.ts +11 -1
- package/dist/DevToolsContainer.mjs +68 -62
- package/dist/DevToolsContextProvider.mjs +5 -3
- package/dist/PageContext.d.ts +7 -0
- package/dist/PageContext.mjs +6 -0
- package/dist/agentInspector/flowRuns.d.ts +1 -1
- package/dist/agentInspector/flowRuns.mjs +22 -15
- package/dist/agentInspector/index.d.ts +2 -0
- package/dist/agentInspector/index.mjs +1 -0
- package/dist/agentInspector/inspector.d.ts +31 -1
- package/dist/agentInspector/inspector.mjs +57 -19
- package/dist/agentInspector/report.d.ts +27 -2
- package/dist/agentInspector/report.mjs +59 -38
- package/dist/agentInspector/useAgentInspector.d.ts +3 -2
- package/dist/agentInspector/useAgentInspector.mjs +20 -16
- package/dist/components/DevToolsOverlay/DevToolsOverlay.d.ts +3 -4
- package/dist/components/DevToolsOverlay/DevToolsOverlay.mjs +4 -4
- package/dist/components/DevToolsPanel/DevToolsBody.d.ts +4 -1
- package/dist/components/DevToolsPanel/DevToolsBody.mjs +33 -31
- package/dist/components/DevToolsPanel/DevToolsButton.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsButton.mjs +4 -3
- package/dist/components/DevToolsPanel/DevToolsHeader.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsHeader.mjs +52 -34
- package/dist/components/DevToolsPanel/DevToolsPanel.d.ts +3 -1
- package/dist/components/DevToolsPanel/DevToolsPanel.mjs +50 -47
- package/dist/components/DevToolsPanel/tabs/QaViewer/QaReplayButton.mjs +2 -2
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.d.ts +7 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunReport.mjs +97 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.d.ts +6 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunTaskRow.mjs +79 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.d.ts +11 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/RunViewer.mjs +222 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/index.d.ts +3 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/index.mjs +6 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.d.ts +9 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/reportHelpers.mjs +39 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.d.ts +27 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs +51 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.d.ts +14 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/usePointAt.mjs +33 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.d.ts +9 -0
- package/dist/components/DevToolsPanel/tabs/RunViewer/useRunSnapshot.mjs +22 -0
- package/dist/qa/QaContext.d.ts +2 -5
- package/dist/qa/QaContext.mjs +28 -31
- package/dist/qa/QaLayer.mjs +78 -77
- package/dist/qa/overlays/QaInspector.mjs +28 -27
- package/dist/qa/overlays/QaTabOrder.mjs +2 -2
- package/dist/qa/overlays/QaXrayTags.mjs +22 -22
- package/dist/useNarrowWindow.d.ts +8 -0
- package/dist/useNarrowWindow.mjs +13 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,156 @@
|
|
|
1
1
|
# @plitzi/sdk-dev-tools
|
|
2
2
|
|
|
3
|
+
## 0.39.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 587c35b: A team of agents on one project (`plitzi run`, `plitzi task`), the page tools those agents measure with, tests kept in
|
|
8
|
+
the space, and what authoring and the elements learnt from the runs. Each command and option is in the CLI's README;
|
|
9
|
+
how the runs work, in `docs/en/agent-runs.md`.
|
|
10
|
+
|
|
11
|
+
## To do when you upgrade
|
|
12
|
+
- **Node 24.** `engines` is `^24.22.1 || >=26.12.1`; Node 22 is no longer supported (`plitzi doctor` says it,
|
|
13
|
+
`doctor --fix` raises an older project's `engines`).
|
|
14
|
+
- **`createServer({ outbound: { privateOrigins } })` replaces `allowPrivatePluginHosts`:** a space's requests reach no
|
|
15
|
+
private address but the origins named (`privateOrigins: ['http://localhost:9000']`).
|
|
16
|
+
- **Job queues from 0.38.20 or before are recreated, not upgraded:** `createMongoJobQueue` / `createMysqlJobQueue` empty
|
|
17
|
+
or drop the old `action_jobs` / `action_kv` and make them again; `mysqlJobSchemaUpgrades` is gone.
|
|
18
|
+
- **`PLITZI_KV_FILE` is `PLITZI_STATE_DIR`**, a folder holding the server's `kv` and job queue.
|
|
19
|
+
- **A social provider's `fetchProfile` takes `{ accessToken, idToken, nonce }`**, and `createSocialAuth(...).start` is
|
|
20
|
+
async.
|
|
21
|
+
- **A `DraftStore` of a deployment's own keeps `inspected`** beside `reusable`, or a test session renders without the
|
|
22
|
+
state bridge.
|
|
23
|
+
- **`navigation.navigate(url, { external, replace })`** takes an object where it took `navigate(url, true)`.
|
|
24
|
+
- **`window.__plitzi.setSource` / `setAttribute` may answer `{ refused }`**: read it before treating the answer as written.
|
|
25
|
+
- **Renamed:** `stepText` → `e2eStepText` (a run's `said` is the step in words); `OverQuotaNotice` → `QuotaNotice` and
|
|
26
|
+
its classes `plitzi-quota-notice…`; `sightOf` / `sightText` come from `@plitzi/sdk-shared/devTools/sight`.
|
|
27
|
+
- **`SchemaVariables` and `StyleVariables` draw no add button of their own:** the holder passes `adding`, `onAddingEnd`
|
|
28
|
+
and optionally `empty`.
|
|
29
|
+
- **A page handed to `runE2eTest`** has `selectOption`, `position` in `click`/`hover` and `evaluate(fn, arg)`, as a
|
|
30
|
+
Playwright locator: a hand-written page adds them.
|
|
31
|
+
- **Journey steps play as the page commands do:** `scroll` with `dx`/`dy` scrolls the element's content, `waitFor`
|
|
32
|
+
waits 10 s, `type` replaces a field's value.
|
|
33
|
+
- **Authoring refuses more:** two flows of one element naming a step alike (`step-duplicate`), `visible` written as an
|
|
34
|
+
expression (`visible-expression`), a step condition naming a source by id alone (`condition-short-source`).
|
|
35
|
+
`navbar` / `navbarItem` are no longer read by `specFromSpace`.
|
|
36
|
+
- **`/robots.txt` ends naming its sitemap** unless the space's own text does.
|
|
37
|
+
- **The CLI's part of a project is `.plitzi/`** (it was split with `plitzi/`): `plitzi doctor --fix` moves it, and a
|
|
38
|
+
tsconfig names `.plitzi/**/*`.
|
|
39
|
+
- **`plitzi upgrade`** brings the new scripts (`start:preview`, the visual suite's server on 8400, `test`), the ignores
|
|
40
|
+
for `.plitzi/plitzi-reports/` and the skills. `test` runs the project's own tests, so red tests now fail
|
|
41
|
+
`plitzi verify` and a run's checks.
|
|
42
|
+
- **Reports to Plitzi live in `.plitzi/plitzi-reports/`**, committed: a run's in `runs/<run>/`, an agent's in
|
|
43
|
+
`agents/<date>/`. The old files are read no more.
|
|
44
|
+
- **The CLI's surface is smaller — one command for each thing.** Old names and flags are refused naming the new one;
|
|
45
|
+
`plitzi upgrade skills --write` updates the agents' skills. The main moves: `run plan` / `run rehearse` →
|
|
46
|
+
`run open --dry-run [--rehearse]`; `run extend` → `run open <stage>`; `run purge` → `run abort`; `task take` →
|
|
47
|
+
`task next <task>`; `task ask` / `block` / `note` → `task tell --ask | --blocked | --handoff`; `task wait` / `release`
|
|
48
|
+
→ `task claim --wait | --release`; `task request` → `task propose --file`; `task check --before | --mutate` →
|
|
49
|
+
`task prove`; `run feedback` → `run report --plitzi`; `functions pull|push` → `space pull|push functions`;
|
|
50
|
+
`runtime push` → `space push runtime`; `page shot --live` / `--clip` → `--fresh` / `--within`; `PLITZI_TASK_TOKEN` →
|
|
51
|
+
`PLITZI_TOKEN`.
|
|
52
|
+
- **Research and reviews are cards on one board:** `task spike` and the separate UI review are gone; a card's `review`
|
|
53
|
+
names its roles in order. Runs opened before keep working.
|
|
54
|
+
- **Page commands:** `page check --expect` fails only on what it expects; every page command reads at 900 px tall
|
|
55
|
+
(`--height`); a page that sends a guest away is read signed in as the project's account (`--as`, `--guest`).
|
|
56
|
+
- **`create --from`** names page files by the page's name; a space's functions are pushed without their tests.
|
|
57
|
+
|
|
58
|
+
## A space's tests (`@plitzi/sdk-authoring`, `@plitzi/sdk-shared`, `@plitzi/plitzi-builder`, `@plitzi/sdk-mcp`)
|
|
59
|
+
- **Tests are part of the space's document** (`Schema.tests`): unit tests (element checks) and journeys (what a visitor
|
|
60
|
+
does), authored in code, edited in the builder's Tests area, played on the canvas or the server. See
|
|
61
|
+
`docs/en/space-tests.md`.
|
|
62
|
+
- **Journeys play signed in as test accounts** (`tests.accounts`), carry tags, can be held and stopped
|
|
63
|
+
(`runE2eTest`'s `beforeStep`), and hold element checks (`e2e.expectCheck`).
|
|
64
|
+
- **`plitzi test [id…]`** runs a project's tests; **`plitzi_test`** lets an agent run them over the MCP. What a plan
|
|
65
|
+
allows (`journeysPerSpace`, `serverRunsPerMonth`) is in its entitlements; a `canTest` grant writes tests alone.
|
|
66
|
+
|
|
67
|
+
## Several agents on one project (`@plitzi/cli`)
|
|
68
|
+
- **A run is a kanban:** a lead plans, reviews and closes; developers, testers, designers and scouts take cards with
|
|
69
|
+
`task next`, each in its own copy of the project; every card is reviewed by the roles it names, step by step.
|
|
70
|
+
Nothing reaches the project until a person applies the run (`run finish --apply`).
|
|
71
|
+
- **Files are owned by imports:** one agent per file, shared files taken by turns or changed by agreement
|
|
72
|
+
(`task propose`), merged line by line, checked on the whole result.
|
|
73
|
+
- **The run keeps itself going:** a keeper starts the agents work is waiting for, and holds
|
|
74
|
+
starts after the harness's limit or repeated quick exits until the lead allows them (`run hold`, `run allow`).
|
|
75
|
+
- **`run monitor`:** the run live in a terminal — board, flow, agents, spend, activity — with an emergency panel (`!`)
|
|
76
|
+
to pause, resume, hold or allow agents.
|
|
77
|
+
- **A change mid-run says what it reaches:** `run open <stage> --dry-run` and `run amend --dry-run` name the approved
|
|
78
|
+
tasks, tasks at work and tests each change touches, read off the import graph.
|
|
79
|
+
- **Reviews see what goes in:** a review taken says whether the task merges with the run's newer work and, if not, the
|
|
80
|
+
failing lines; `task show <file> --merged` and `task look --merged` read and serve the merge;
|
|
81
|
+
`task look --alone <element> --with '{…}'` draws a component or plugin no page places yet. A step's time stops while
|
|
82
|
+
its reviewer proves or looks.
|
|
83
|
+
- **Proofs:** `task prove --before` (what each acceptance line proves against the run before the task) and
|
|
84
|
+
`--mutate` (whether a task's tests catch a broken change, with a control run).
|
|
85
|
+
- **The finish:** `run finish` checks the whole result and stops at the first failing line; `--every-line` reports
|
|
86
|
+
them all. The run then leaves its reports in `.plitzi/plitzi-reports/runs/<run>/`.
|
|
87
|
+
- **A report to Plitzi holds nothing of the person or the project:** a run's `feedback.md` writes over names, emails,
|
|
88
|
+
addresses, IPs, the project's files, tasks and elements, leaves out what was said of the project alone, and lists
|
|
89
|
+
quoted passages for the person to read before sending. `plitzi feedback` carries no project name, asks the developer
|
|
90
|
+
before anything of the project goes in, and `plitzi feedback --check <file>` names what a filled report still holds.
|
|
91
|
+
|
|
92
|
+
## Page tools (`@plitzi/cli`, `@plitzi/sdk-authoring`)
|
|
93
|
+
- **`page measure`** reads what an element draws (`--only drawn`, `box-*`, `attr:<name>`, `accessible-name`,
|
|
94
|
+
`scroll-*`, custom properties) and holds bounds and positions (`--expect "width<=44px"`, `"a.bottom + 8 <= b.top"`).
|
|
95
|
+
- **`page play`** plays steps — `drag … hold`, `scroll page 1500`, `click <el> 30%,60%` — reads what is drawn, not
|
|
96
|
+
what is in the DOM, and `--motion` plays animations moving. A press is made once and waits for the page to take it.
|
|
97
|
+
- **`page check`** says what a visitor cannot reach, text cut or spilling, canvases left blank, the server's error page
|
|
98
|
+
when the space does not author, and holds a text whole (`=`) or in part (`~`).
|
|
99
|
+
- **`page shot`** waits for canvases, pictures hovers (`--hover`, `--frames`) and parts (`--within`), and says what it
|
|
100
|
+
could not picture.
|
|
101
|
+
- **Every page command reads a page as one visitor from the same flags** (`--as`, `--guest`, `--width`, `--height`,
|
|
102
|
+
`--fresh`), with a browser driver of the CLI's own.
|
|
103
|
+
|
|
104
|
+
## Authoring (`@plitzi/sdk-authoring`)
|
|
105
|
+
- **New checks:** a server provider the page server cannot read (`server-query-unresolved`) or that reads browser state
|
|
106
|
+
(`server-when-unknown`), an action without `runtime: 'server'` (`server-source-in-browser`), class overrides,
|
|
107
|
+
messages arriving while a flow runs, unused plugins.
|
|
108
|
+
- **New authoring:** `focus('field')`, a factory for every trigger, the scroll family's sides, `pagesIn(...)` to
|
|
109
|
+
register pages by folder, channel topics with a choice, a plugin's imported stylesheets read for its tokens.
|
|
110
|
+
- **An element drawn alone:** a server started with `PLITZI_PREVIEW_FILE` gets a page for one element at
|
|
111
|
+
`/plitzi-preview` (`withPreview`, `SpacePreviewError`) — what `task look --alone` uses.
|
|
112
|
+
|
|
113
|
+
## Elements and the SDK (`@plitzi/sdk-elements`, `@plitzi/plitzi-sdk`, `@plitzi/sdk-shared`)
|
|
114
|
+
- **Navigation:** `navigate` can replace the address, and a navigation inside the site leaves the scroll as a page
|
|
115
|
+
load would.
|
|
116
|
+
- **Providers:** a `when` holds the same in the browser and on the page server; a server provider can read another
|
|
117
|
+
site's address while the page is built.
|
|
118
|
+
- **Plans and roles in the contract:** entitlements (`TSpaceEntitlements`), the space role (`TSpaceAccess`), the quota
|
|
119
|
+
warning at 80% (`render.quotaNear`) and the "Made with Plitzi" badge (`PlitziBadge`).
|
|
120
|
+
- **Fixes:** a binding's `sourceTo` is the previous value; an element with no tag and no `visible` draws nothing;
|
|
121
|
+
placeholder words never reach a page; notifications stay open for a visitor who asked for less motion.
|
|
122
|
+
|
|
123
|
+
## Server (`@plitzi/sdk-server`, `@plitzi/sdk-auth`, `@plitzi/sdk-mcp`)
|
|
124
|
+
- **`/sitemap.xml`** for every space, and `/robots.txt` naming it.
|
|
125
|
+
- **Accounts:** terms accepted at sign-up (MySQL schema version 7), single sign-on with any OpenID Connect issuer
|
|
126
|
+
(`createOidcProvider`), providers resolved at run time, a password that may not sign in, `/auth/continue` with a step
|
|
127
|
+
of the deployment's own, a signed-out visitor never signed back in by a stale answer.
|
|
128
|
+
- **Policy adapters:** metering can hold a page back (503), decide the badge and `noindex`; the MCP can cap tool calls
|
|
129
|
+
and names the space's plan; realtime admits spaces per deployment.
|
|
130
|
+
- **Dev server:** a removed plugin folder is unregistered (`PluginRegistry.unregister`), and a space that does not
|
|
131
|
+
author is said whole, with no stack.
|
|
132
|
+
|
|
133
|
+
## The builder (`@plitzi/plitzi-builder`)
|
|
134
|
+
- **A Tests area** with journeys played beside the page at the journey's device, and element checks.
|
|
135
|
+
- **One way to build a panel**, a header grouped by what its controls do, and the layout's mask dimming only what the
|
|
136
|
+
layout draws.
|
|
137
|
+
- **Plans and roles shown:** what the role allows (`useSpaceAccess`), what the plan leaves out shown locked, the plan
|
|
138
|
+
and its spend in the header; pages left out of the sitemap marked.
|
|
139
|
+
|
|
140
|
+
## Dev tools (`@plitzi/sdk-dev-tools`)
|
|
141
|
+
- **`element(id).visible` is what a visitor sees** (`sightOf`), with why not; `element(id).resolved` says what each
|
|
142
|
+
binding gave; a refused server action is a `refused` step.
|
|
143
|
+
- **Report what you see** in the Run tab of a run's preview, and the panel docks at the bottom under 900 px.
|
|
144
|
+
|
|
145
|
+
## The workspace
|
|
146
|
+
- **No file past 600 lines of code** (`max-lines`), and ESLint's `quotes` rule is gone — Prettier writes them.
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [587c35b]
|
|
151
|
+
- @plitzi/sdk-schema@0.39.0
|
|
152
|
+
- @plitzi/sdk-shared@0.39.0
|
|
153
|
+
|
|
3
154
|
## 0.38.24
|
|
4
155
|
|
|
5
156
|
### Patch Changes
|
|
@@ -3519,7 +3670,7 @@ author`, `plitzi_validate`/`plitzi_apply`, `plitzi explain` and the builder's pr
|
|
|
3519
3670
|
- **Devices are listed by device, not by session.** `GET /devices/sessions` groups sessions by what they were created
|
|
3520
3671
|
from and answers this device apart; a browser that signed in forty times is one row saying "40 sessions". The list
|
|
3521
3672
|
had shipped and drawn every session — 1,218 for one account a test suite signs in as — inside a box that scrolled.
|
|
3522
|
-
- **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on
|
|
3673
|
+
- **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on dev-laptop`,
|
|
3523
3674
|
`Plitzi Desktop on studio`), a browser and its system, an automated client (Playwright, headless Chrome) — never a
|
|
3524
3675
|
raw user agent. Sessions record their address and **when they were last used** (at most every five minutes, on the
|
|
3525
3676
|
lookup a request already makes). A sign-in deletes the account's dead sessions.
|
|
@@ -30,6 +30,16 @@ export type DevToolsContainerProps = {
|
|
|
30
30
|
* of it.
|
|
31
31
|
*/
|
|
32
32
|
qa?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The page's server previews a run of agents (`plitzi run preview`): the Run tab asks it for the run. Said by the
|
|
35
|
+
* server, never guessed — asked of a server with none, it answers 404 every few seconds in the page's console.
|
|
36
|
+
*/
|
|
37
|
+
run?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The page's state bridge alone (`window.__plitzi`) — no panel, no badge: a page a test runner plays, which reads and
|
|
40
|
+
* sets the space's state through it. Said by the server, for a session it minted for tests.
|
|
41
|
+
*/
|
|
42
|
+
inspector?: boolean;
|
|
33
43
|
};
|
|
34
|
-
declare const DevToolsContainer: ({ children, className, innerClassName, enabled, instanceId, renderMode, scroll, qa, devToolsStyle, devToolsStyleLink, devToolsIconsLink }: DevToolsContainerProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
44
|
+
declare const DevToolsContainer: ({ children, className, innerClassName, enabled, instanceId, renderMode, scroll, qa, run, inspector, devToolsStyle, devToolsStyleLink, devToolsIconsLink }: DevToolsContainerProps) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
35
45
|
export default DevToolsContainer;
|
|
@@ -1,72 +1,78 @@
|
|
|
1
1
|
import e from "./agentInspector/useAgentInspector.mjs";
|
|
2
|
-
import t from "./
|
|
3
|
-
import n from "./
|
|
4
|
-
import
|
|
5
|
-
import i from "./
|
|
6
|
-
import a from "./
|
|
7
|
-
import o from "./
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
2
|
+
import t from "./components/DevToolsPanel/tabs/RunViewer/stepRecorder.mjs";
|
|
3
|
+
import n from "./DevToolsContextProvider.mjs";
|
|
4
|
+
import r from "./DevToolsRoot.mjs";
|
|
5
|
+
import { useIsSelectedInstance as i } from "./instanceRegistry.mjs";
|
|
6
|
+
import a from "./PageContext.mjs";
|
|
7
|
+
import o from "./useHydrated.mjs";
|
|
8
|
+
import ee from "./useNarrowWindow.mjs";
|
|
9
|
+
import s from "./useRegisterQueriesStore.mjs";
|
|
10
|
+
import c from "./useRegisterRootStore.mjs";
|
|
11
|
+
import l from "@plitzi/plitzi-ui/ContainerShadow";
|
|
12
|
+
import u from "@plitzi/plitzi-ui/hooks/useStorage";
|
|
13
|
+
import d from "clsx";
|
|
14
|
+
import { Suspense as f, lazy as p, useCallback as m, useRef as h, useState as g } from "react";
|
|
15
|
+
import { DevStoreScopeContext as _ } from "@plitzi/nexus/react";
|
|
16
|
+
import { DEV_TOOLS_ATTRIBUTE as v } from "@plitzi/sdk-shared/devTools";
|
|
17
|
+
import { useTheme as y } from "@plitzi/sdk-shared/theme";
|
|
18
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
16
19
|
//#region src/DevToolsContainer.tsx
|
|
17
|
-
var
|
|
18
|
-
let { resolvedTheme:
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
e &&
|
|
24
|
-
}, [
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
if (!
|
|
28
|
-
let Z =
|
|
29
|
-
className:
|
|
30
|
-
collapsed:
|
|
31
|
-
orientation:
|
|
32
|
-
tabSelected:
|
|
33
|
-
logTypeFilter:
|
|
34
|
-
onOpen:
|
|
35
|
-
onCollapse:
|
|
36
|
-
onTabSelect:
|
|
37
|
-
onChangeOrientation:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}), $ =
|
|
41
|
-
|
|
42
|
-
children:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
var S = p(() => import("./components/DevToolsOverlay/index.mjs")), C = "horizontal", w = 0, T = ({ children: p, className: T, innerClassName: E, enabled: D = !1, instanceId: O, renderMode: k = "default", scroll: te = "container", qa: ne = !1, run: A = !1, inspector: j = !1, devToolsStyle: M = "", devToolsStyleLink: N = "", devToolsIconsLink: P = "" }) => {
|
|
21
|
+
let { resolvedTheme: F } = y(), [I, L] = u("plitzi-sdk.dev-tools.orientation", C), [R, z] = u("plitzi-sdk.dev-tools.collapsed", !0), [B, V] = u("plitzi-sdk.dev-tools.tab", "logs"), [H, U] = g(), W = h(void 0), G = h(null);
|
|
22
|
+
W.current ||= `sdk-instance-${++w}`;
|
|
23
|
+
let K = O || W.current, q = o(), J = ee(), Y = q && !J ? I : C, X = i(K, D);
|
|
24
|
+
c(D || j), s(X, K), e(D ? X : j), t(D && X && A);
|
|
25
|
+
let re = m((e) => L(e), [L]), ie = m((e) => {
|
|
26
|
+
e && V("logs"), U(e), z(!1);
|
|
27
|
+
}, [z, V]), ae = m(() => z(!0), [z]), oe = m((e) => {
|
|
28
|
+
U(void 0), V(e);
|
|
29
|
+
}, [V]);
|
|
30
|
+
if (!D) return p;
|
|
31
|
+
let Z = te === "document" && (!q || R), Q = /* @__PURE__ */ b(S, {
|
|
32
|
+
className: d({ dark: F === "dark" }),
|
|
33
|
+
collapsed: R,
|
|
34
|
+
orientation: Y,
|
|
35
|
+
tabSelected: B,
|
|
36
|
+
logTypeFilter: H,
|
|
37
|
+
onOpen: ie,
|
|
38
|
+
onCollapse: ae,
|
|
39
|
+
onTabSelect: oe,
|
|
40
|
+
onChangeOrientation: re,
|
|
41
|
+
qa: ne,
|
|
42
|
+
run: A
|
|
43
|
+
}), $ = X && q && /* @__PURE__ */ b(r, { children: /* @__PURE__ */ b(a, {
|
|
44
|
+
value: G,
|
|
45
|
+
children: /* @__PURE__ */ b(n, { children: /* @__PURE__ */ x(f, {
|
|
46
|
+
fallback: null,
|
|
47
|
+
children: [k === "default" && Q, k === "shadow" && /* @__PURE__ */ b("div", {
|
|
48
|
+
style: { display: "contents" },
|
|
49
|
+
[v]: "",
|
|
50
|
+
children: /* @__PURE__ */ x(l, { children: [
|
|
51
|
+
P && /* @__PURE__ */ b(l.Link, { href: P }),
|
|
52
|
+
N && /* @__PURE__ */ b(l.Link, { href: N }),
|
|
53
|
+
/* @__PURE__ */ x(l.Content, { children: [/* @__PURE__ */ b("style", { dangerouslySetInnerHTML: { __html: M } }), Q] })
|
|
54
|
+
] })
|
|
55
|
+
})]
|
|
56
|
+
}) })
|
|
57
|
+
}) });
|
|
58
|
+
return /* @__PURE__ */ x("div", {
|
|
59
|
+
className: d("relative flex min-w-0 grow", {
|
|
54
60
|
"overflow-auto": !Z,
|
|
55
|
-
"flex-col": Z ||
|
|
56
|
-
"h-screen": !Z &&
|
|
57
|
-
},
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
-
value:
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
-
ref:
|
|
62
|
-
className:
|
|
63
|
-
children:
|
|
61
|
+
"flex-col": Z || Y === "horizontal",
|
|
62
|
+
"h-screen": !Z && Y === "vertical"
|
|
63
|
+
}, T),
|
|
64
|
+
children: [/* @__PURE__ */ b(_, {
|
|
65
|
+
value: K,
|
|
66
|
+
children: /* @__PURE__ */ b("div", {
|
|
67
|
+
ref: G,
|
|
68
|
+
className: d("grow", { "basis-0 flex-col overflow-auto": !Z }, E),
|
|
69
|
+
children: p
|
|
64
70
|
})
|
|
65
|
-
}), Z ? /* @__PURE__ */
|
|
71
|
+
}), Z ? /* @__PURE__ */ b("div", {
|
|
66
72
|
className: "sticky bottom-0 h-0",
|
|
67
73
|
children: $
|
|
68
74
|
}) : $]
|
|
69
75
|
});
|
|
70
76
|
};
|
|
71
77
|
//#endregion
|
|
72
|
-
export {
|
|
78
|
+
export { T as default };
|
|
@@ -5,7 +5,7 @@ import { DevToolsContext as s } from "@plitzi/sdk-shared/devTools/react";
|
|
|
5
5
|
import { jsx as c } from "react/jsx-runtime";
|
|
6
6
|
//#region src/DevToolsContextProvider.tsx
|
|
7
7
|
var l = ({ children: l }) => {
|
|
8
|
-
let [u, d] = i(
|
|
8
|
+
let [u, d] = i(() => a.history()), [f, p] = i(() => a.providerMethods()), m = r(!1), h = e((e, t, n, r, i) => {
|
|
9
9
|
d((a) => [...a, {
|
|
10
10
|
logType: e,
|
|
11
11
|
category: t,
|
|
@@ -18,8 +18,10 @@ var l = ({ children: l }) => {
|
|
|
18
18
|
[e]: t
|
|
19
19
|
})), []), _ = e((e) => p((t) => o(t, [e])), []), v = e((e, ...t) => {
|
|
20
20
|
if (e && typeof f[e] == "function") return f[e](...t);
|
|
21
|
-
}, [f]), y = e(() =>
|
|
22
|
-
|
|
21
|
+
}, [f]), y = e(() => {
|
|
22
|
+
a.clearHistory(), d([]);
|
|
23
|
+
}, []);
|
|
24
|
+
m.current ||= (a.setCallback(h), a.setCallbackAddProvider(g), a.setCallbackRemoveProvider(_), !0), t(() => (d(a.history()), a.dropPending(), a.setCallback(h), a.setCallbackAddProvider(g), a.setCallbackRemoveProvider(_), () => {
|
|
23
25
|
a.setCallback(void 0), a.setCallbackAddProvider(void 0), a.setCallbackRemoveProvider(void 0), a.flush();
|
|
24
26
|
}), [
|
|
25
27
|
h,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The page's own box, beside the panel — what the tools draw over, look in and measure, never the panel: the QA tools,
|
|
4
|
+
* and the width a report from a run's preview says the page had.
|
|
5
|
+
*/
|
|
6
|
+
declare const PageContext: import('react').Context<RefObject<HTMLElement | null>>;
|
|
7
|
+
export default PageContext;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Log } from '@plitzi/sdk-shared';
|
|
2
|
-
/** One step of a flow that ran, in words. */
|
|
2
|
+
/** One step of a flow that ran, in words — `refused` when it ran and the run it started was refused (`error`, why). */
|
|
3
3
|
export type FlowStep = {
|
|
4
4
|
title: string;
|
|
5
5
|
action: string;
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
+
import { isRecord as e } from "@plitzi/sdk-shared/helpers";
|
|
1
2
|
//#region src/agentInspector/flowRuns.ts
|
|
2
|
-
var
|
|
3
|
+
var t = (e) => typeof e == "object" && "nodes" in e && "startTime" in e && "node" in e, n = (t) => {
|
|
4
|
+
if (t.status !== "success" || !e(t.result)) return;
|
|
5
|
+
let { status: n, reason: r, error: i } = t.result;
|
|
6
|
+
if (n !== "failed" && n !== "aborted") return;
|
|
7
|
+
let a = typeof r == "string" && r !== "" ? r : n;
|
|
8
|
+
return typeof i == "string" && i !== "" ? `${i} (${a})` : a;
|
|
9
|
+
}, r = (e) => {
|
|
3
10
|
if (e.status === "failed") return e.result instanceof Error ? e.result.message : typeof e.result == "string" ? e.result : void 0;
|
|
4
|
-
},
|
|
5
|
-
if (
|
|
6
|
-
let { node:
|
|
7
|
-
let n = t(e);
|
|
11
|
+
}, i = (e) => {
|
|
12
|
+
if (e.category !== "interactions" || !t(e.params)) return;
|
|
13
|
+
let { node: i, hostElementId: a, status: o, startTime: s, endTime: c, nodes: l } = e.params, u = Object.values(l).filter((e) => e.node.id !== i.id).toSorted((e, t) => e.startTime - t.startTime).map((e) => {
|
|
14
|
+
let t = n(e), i = t ?? r(e);
|
|
8
15
|
return {
|
|
9
16
|
title: e.node.title,
|
|
10
17
|
action: e.node.action,
|
|
11
|
-
status: e.status,
|
|
18
|
+
status: t === void 0 ? e.status : "refused",
|
|
12
19
|
ms: Math.round(e.endTime - e.startTime),
|
|
13
|
-
...
|
|
20
|
+
...i === void 0 ? {} : { error: i }
|
|
14
21
|
};
|
|
15
22
|
});
|
|
16
23
|
return {
|
|
17
|
-
at:
|
|
18
|
-
trigger: `${
|
|
19
|
-
...
|
|
20
|
-
status:
|
|
21
|
-
ms: Math.round(
|
|
22
|
-
steps:
|
|
24
|
+
at: e.time ?? "",
|
|
25
|
+
trigger: `${i.title} [${i.action}]`,
|
|
26
|
+
...a === void 0 ? {} : { on: a },
|
|
27
|
+
status: o,
|
|
28
|
+
ms: Math.round(c - s),
|
|
29
|
+
steps: u
|
|
23
30
|
};
|
|
24
|
-
},
|
|
31
|
+
}, a = (e) => `[flow] ${e.trigger}${e.on ? ` on ${e.on}` : ""} → ${e.status} (${String(e.steps.length)} steps, ${String(e.ms)}ms)` + e.steps.filter((e) => e.error !== void 0).map((e) => `\n ${e.status === "refused" ? "refused" : "✗"} ${e.title} [${e.action}]: ${e.error ?? ""}`).join("");
|
|
25
32
|
//#endregion
|
|
26
|
-
export {
|
|
33
|
+
export { a as flowRunLine, i as flowRunOf };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useAgentInspector } from "./useAgentInspector.mjs";
|
|
@@ -1,27 +1,57 @@
|
|
|
1
1
|
import { FlowRun } from './flowRuns';
|
|
2
2
|
import { ElementReport } from './report';
|
|
3
3
|
import { DevStore } from '@plitzi/nexus';
|
|
4
|
+
import { SignedInTestAccount } from '@plitzi/sdk-shared';
|
|
4
5
|
/** `window.__plitzi`: the page's state, data, elements and flows, in text, for whoever cannot read the panel. */
|
|
5
6
|
export type AgentInspector = {
|
|
6
7
|
help: () => string;
|
|
7
8
|
state: (key?: string) => unknown;
|
|
8
9
|
setState: (key: string, value: unknown) => void;
|
|
9
10
|
sources: (name?: string) => unknown;
|
|
11
|
+
/**
|
|
12
|
+
* The source written — by its name, or the one an element's id names (`<type>_<id>`) — false when none holds it, or why
|
|
13
|
+
* it was not written (`refused`): what is written there no element would draw.
|
|
14
|
+
*/
|
|
15
|
+
setSource: (path: string, value: unknown) => string | false | Refused;
|
|
16
|
+
/**
|
|
17
|
+
* An element's attribute given a value, as a page binding it would (`<id>.<attribute>`): the element it was written
|
|
18
|
+
* on, or false when the space has none by that id — a plugin's new attribute seen drawn before any page binds it.
|
|
19
|
+
*/
|
|
20
|
+
setAttribute: (path: string, value: unknown) => string | false | Refused;
|
|
10
21
|
element: (id: string) => ElementReport | undefined;
|
|
11
22
|
flows: (limit?: number) => FlowRun[];
|
|
23
|
+
/** Why each server element failed on the page server since the page loaded, by id — answered later or not. */
|
|
24
|
+
serverFailures: () => Record<string, unknown>;
|
|
12
25
|
watch: (on?: boolean) => string;
|
|
26
|
+
/**
|
|
27
|
+
* The page's visitor signed in as a journey's test account (`tests.accounts`): its details, roles and permissions,
|
|
28
|
+
* with no session the server knows — `null` signs it out. What it signed in as, or why not. With `path`, the page is
|
|
29
|
+
* moved there in the same step: one render, signed in and there — never the page it was on, signed in, which a page
|
|
30
|
+
* for signed-out visitors would send on.
|
|
31
|
+
*/
|
|
32
|
+
signInAs: (account: unknown, path?: unknown) => string | Refused;
|
|
33
|
+
/** The page moved to a path of the space as its links move it, without loading it again: the path, or false. */
|
|
34
|
+
navigate: (path: string) => string | false;
|
|
35
|
+
};
|
|
36
|
+
/** A write refused, and why: a value that would be written and drawn over, or written where nothing reads it. */
|
|
37
|
+
export type Refused = {
|
|
38
|
+
refused: string;
|
|
13
39
|
};
|
|
14
40
|
export type AgentInspectorOptions = {
|
|
15
41
|
/** The root store: the schema, `runtime.state`, every element's UI state. */
|
|
16
42
|
root: DevStore;
|
|
17
43
|
/** Writes one key of `runtime.state`, as a `setState` step does. */
|
|
18
44
|
writeState: (key: string, value: unknown) => void;
|
|
45
|
+
/** Sets the test account the page shows signed in (`runtime.testAccount`), or none. */
|
|
46
|
+
writeTestAccount: (account: SignedInTestAccount | undefined) => void;
|
|
19
47
|
/** Every store the dev tools know — a provider's data lives in its own. */
|
|
20
48
|
stores: () => readonly DevStore[];
|
|
21
49
|
/** The flows that ran, newest last. */
|
|
22
50
|
runs: () => readonly FlowRun[];
|
|
23
51
|
/** Whether each flow is said in the console as it ends. */
|
|
24
52
|
setWatching: (on: boolean) => void;
|
|
53
|
+
/** The sources an element sees, by its id — its scope's, a list row's included: what its bindings read. */
|
|
54
|
+
elementSources?: (id: string) => unknown;
|
|
25
55
|
document: Document;
|
|
26
56
|
};
|
|
27
|
-
export declare const createAgentInspector: ({ root, writeState, stores, runs, setWatching, document }: AgentInspectorOptions) => AgentInspector;
|
|
57
|
+
export declare const createAgentInspector: ({ root, writeState, writeTestAccount, stores, runs, setWatching, elementSources, document }: AgentInspectorOptions) => AgentInspector;
|
|
@@ -1,28 +1,66 @@
|
|
|
1
|
-
import { elementReport as e,
|
|
2
|
-
import { isRecord as
|
|
1
|
+
import { elementReport as e, findElement as t, plain as n, recordAt as r } from "./report.mjs";
|
|
2
|
+
import { isRecord as i } from "@plitzi/sdk-shared/helpers";
|
|
3
3
|
//#region src/agentInspector/inspector.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
4
|
+
var a = (e, t) => {
|
|
5
|
+
let n = i(e.definition) ? e.definition : {}, r = i(n.bindings) ? n.bindings : {}, a = Object.values(r).flatMap((e) => Array.isArray(e) ? e : []).find((e) => i(e) && e.to === t && e.enabled !== !1);
|
|
6
|
+
return i(a) && typeof a.source == "string" ? a.source : void 0;
|
|
7
|
+
}, o = /* @__PURE__ */ new Set(["item", "index"]), s = "window.__plitzi — this page, in text (debug mode only):\n state(key?) runtime.state, or one key of it\n setState(key, value) writes runtime.state.<key>, as a setState step would\n sources(name?) every source's current value by name (apiContainer_site, list_products…), or one\n setAttribute(path, value)\n an element's attribute given a value (map.storms), as a page binding it would — refused, saying\n why, for one a binding gives (write its source)\n setSource(path, value)\n writes a source, or a path in it (apiContainer_site.items — or by its element, site.items),\n where its provider keeps it — what the page shows filled; until the provider answers again.\n A list row's item is refused: it comes from the list's items\n element(id) an element by its id, in a page or a component: type, attributes, what it reads and what each\n binding gave it (resolved), its own state, the component it places, copies, on screen, box\n flows(limit = 20) the last flows that ran: trigger, element, status, every step with its time and error\n serverFailures() why each server element failed on the page server since the page loaded, by id\n watch(on = true) one console line per flow as it ends\n signInAs(account, path?) the visitor signed in as a journey's test account ({ id, email?, roles?, permissions? }) —\n no session the server knows, moved to path in the same render; signInAs(null) signs it out\n navigate(path) the page moved to a path of the space as a link moves it, without loading it again", c = (e, t) => i(e) && i(t) && Object.keys(t).some((t) => !Object.hasOwn(e, t)), l = /^[A-Za-z0-9_-]+$/, u = (e) => Array.isArray(e) && e.every((e) => typeof e == "string" && l.test(e)), d = (e, t) => {
|
|
8
|
+
let n = r(e.getState(), "navigation").navigate;
|
|
9
|
+
return typeof n == "function" && (Reflect.apply(n, void 0, [t]), !0);
|
|
10
|
+
}, f = (e) => i(e) && typeof e.id == "string" && l.test(e.id) && (e.email === void 0 || typeof e.email == "string") && (e.roles === void 0 || u(e.roles)) && (e.permissions === void 0 || u(e.permissions)) ? {
|
|
11
|
+
id: e.id,
|
|
12
|
+
...typeof e.email == "string" ? { email: e.email } : {},
|
|
13
|
+
...u(e.roles) ? { roles: e.roles } : {},
|
|
14
|
+
permissions: u(e.permissions) ? e.permissions : []
|
|
15
|
+
} : void 0, p = ({ root: l, writeState: u, writeTestAccount: p, stores: m, runs: h, setWatching: g, elementSources: _, document: v }) => ({
|
|
16
|
+
help: () => s,
|
|
6
17
|
state: (e) => {
|
|
7
|
-
let
|
|
8
|
-
return
|
|
18
|
+
let t = r(l.getState(), "runtime", "state");
|
|
19
|
+
return n(e === void 0 ? t : t[e]);
|
|
9
20
|
},
|
|
10
|
-
setState:
|
|
21
|
+
setState: u,
|
|
11
22
|
sources: (e) => {
|
|
12
|
-
let
|
|
13
|
-
for (let e of [
|
|
14
|
-
let
|
|
15
|
-
for (let [
|
|
23
|
+
let t = {}, i = {};
|
|
24
|
+
for (let e of [l, ...m()]) {
|
|
25
|
+
let n = r(e.getState(), "runtime", "sources");
|
|
26
|
+
for (let [a, o] of Object.entries(r(e.getOwnState(), "runtime", "sources"))) c(o, n[a]) ? i[a] = o : t[a] = o;
|
|
16
27
|
}
|
|
17
|
-
let
|
|
18
|
-
...
|
|
19
|
-
...
|
|
28
|
+
let a = {
|
|
29
|
+
...i,
|
|
30
|
+
...t
|
|
20
31
|
};
|
|
21
|
-
return
|
|
32
|
+
return n(e === void 0 ? a : a[e]);
|
|
22
33
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
setSource: (e, n) => {
|
|
35
|
+
let [s = "", ...u] = e.split("."), d = (e) => [l, ...m()].find((t) => {
|
|
36
|
+
let n = r(t.getOwnState(), "runtime", "sources")[e];
|
|
37
|
+
return n !== void 0 && !c(n, r(t.getState(), "runtime", "sources")[e]);
|
|
38
|
+
}), f = [...new Set([l, ...m()].flatMap((e) => Object.keys(r(e.getOwnState(), "runtime", "sources")).filter((e) => e.slice(e.indexOf("_") + 1) === s && e.includes("_"))))], p = d(s) || f.length !== 1 ? s : f[0] ?? s, h = u.at(0);
|
|
39
|
+
if (p.startsWith("list_") && h !== void 0 && o.has(h)) {
|
|
40
|
+
let e = t(r(l.getState(), "schema"), p.slice(5)).element, n = i(e) ? a(e, "items") : void 0;
|
|
41
|
+
return { refused: `${p}.${u.join(".")} is each row's own — a list's ${h} comes from its items${n ? `, bound from ${n}: write that source (setSource('${n}', …))` : `: write ${p}.items`}` };
|
|
42
|
+
}
|
|
43
|
+
let g = d(p), _ = `runtime.sources.${[p, ...u].join(".")}`;
|
|
44
|
+
return g?.setState(_, n), g !== void 0 && p;
|
|
45
|
+
},
|
|
46
|
+
setAttribute: (e, n) => {
|
|
47
|
+
let [o = "", ...s] = e.split("."), { element: c, inComponent: u } = t(r(l.getState(), "schema"), o);
|
|
48
|
+
if (!i(c) || s.length === 0) return !1;
|
|
49
|
+
let [d = ""] = s, f = a(c, d);
|
|
50
|
+
if (f !== void 0) return { refused: `${o}.${d} is given by its binding, from ${f}: what is written on it is drawn over at once — write what it reads (setSource('${f}', …))` };
|
|
51
|
+
let p = `schema.${u === void 0 ? "" : `components.${u}.`}flat.${o}.attributes.${s.join(".")}`;
|
|
52
|
+
return l.setState(p, n), o;
|
|
53
|
+
},
|
|
54
|
+
element: (t) => e(l.getState(), t, v, _),
|
|
55
|
+
flows: (e = 20) => h().slice(-e),
|
|
56
|
+
serverFailures: () => r(l.getState(), "rsc", "failures"),
|
|
57
|
+
watch: (e = !0) => (g(e), e ? "Each flow is said in the console as it ends." : "Flows are no longer said in the console."),
|
|
58
|
+
signInAs: (e, t) => {
|
|
59
|
+
if (e == null) return p(void 0), "Signed out: the page shows a guest.";
|
|
60
|
+
let n = f(e);
|
|
61
|
+
return n ? t !== void 0 && typeof t != "string" ? { refused: "A path is where the page is moved once signed in: /account" } : (p(n), t !== void 0 && !d(l, t) ? { refused: `Signed in as ${n.id}, and the page could not be moved to ${t}` } : `Signed in as ${n.id}${t === void 0 ? "" : `, on ${t}`}: what the page shows that visitor — no session the server knows.`) : { refused: "A test account is { id, email?, roles?, permissions? }: an id, roles and permissions of letters, digits, - and _" };
|
|
62
|
+
},
|
|
63
|
+
navigate: (e) => d(l, e) ? e : !1
|
|
26
64
|
});
|
|
27
65
|
//#endregion
|
|
28
|
-
export {
|
|
66
|
+
export { p as createAgentInspector };
|