@plitzi/sdk-event-bridge 0.38.19 → 0.38.21
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 +176 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,181 @@
|
|
|
1
1
|
# @plitzi/sdk-event-bridge
|
|
2
2
|
|
|
3
|
+
## 0.38.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 19fbc45: ## Server
|
|
8
|
+
|
|
9
|
+
- **Jobs: work longer than a request** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-elements`,
|
|
10
|
+
`@plitzi/plitzi-sdk`, `@plitzi/sdk-authoring`) — PZ-136. A space's code declares them in
|
|
11
|
+
`defineFunctions({ jobs: { train: { watch, maxSeconds, run(input, job, ctx) } } })` and starts them with
|
|
12
|
+
`ctx.jobs.start(name, input, { key })` (`get`, `pause`, `resume`, `cancel` beside it). They run in the actions' durable
|
|
13
|
+
queue — leased, taken over when a server dies, retried with backoff — slice by slice, in the sandbox, in a space's
|
|
14
|
+
runtime and natively alike: `job.save(state)` is the one checkpoint and the next slice starts with `job.state`;
|
|
15
|
+
`job.report(fraction, step)` says how far it is; on `job.signal` (`job.stopping`: `pause`, `cancel`, `limit`,
|
|
16
|
+
`shutdown`) the code has 5 s to save and return. A sandbox slice runs at most `sliceMs` and goes on in the next if it
|
|
17
|
+
saved since it began — one that saved nothing fails, so a job cannot loop forever; a runtime's runs until the job's
|
|
18
|
+
time is up. A real pause: `paused` keeps what it saved until resumed. Who may watch it is RBAC: whoever started it, and
|
|
19
|
+
whoever its `watch` (a channel's access) lets in, on `$job:<id>` — the platform's topic, retained — read with
|
|
20
|
+
`useJob(id)` or a `channel` element on `$job:{{ id }}`; the view never carries its input, its state, or an error other
|
|
21
|
+
than the code's own refusal. Limits per space (its plan) through `functions.jobs.limitsFor` —
|
|
22
|
+
`DEFAULT_FUNCTION_JOB_LIMITS` otherwise: 10 running across the account's spaces (`pool`, the oldest first), 1,000
|
|
23
|
+
waiting, 6 h, slices of 5 min / 30 s CPU / 10,000 calls, 1 MB of state.
|
|
24
|
+
- **The queue's types are the queue's** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): `ActionJobQueue`, `ActionJob`,
|
|
25
|
+
`ActionJobInput`, `ActionJobStatus`, `ActionJobAttempt`, `ActionJobSettlement`, `ActionJobQuery` are `JobQueue`, `Job`,
|
|
26
|
+
`JobInput`, `JobStatus`, `JobAttempt`, `JobSettlement`, `JobQuery` (`ACTION_JOB_STATUSES` → `JOB_STATUSES`,
|
|
27
|
+
`isJobStatus`, `TERMINAL_JOB_STATUSES`) — the queue holds a schedule's fires, the runs set for later and the jobs of
|
|
28
|
+
the spaces' functions. **What a job runs is its `target`**: `{ kind: 'action', name, trigger }` or
|
|
29
|
+
`{ kind: 'function', name, user, watch, at }`, in place of `actionId`, `trigger` and `function`; `listJobs` filters
|
|
30
|
+
by `kind` and `name`. Also on the queue: `paused` with `pause`/`resume`, `write` for what a running job saves and
|
|
31
|
+
reports, `state`/`progress`/`result`/`activeMs`, `heartbeat` answering `{ jobId, stop: 'cancel' | 'pause' }[]`, a
|
|
32
|
+
settlement's explicit `refund`, `requeue(…, { input, fresh })`. The helpers bring a store a release before left up
|
|
33
|
+
to it by themselves: MySQL's `ensureJobTables` gives each job its target from `action_id`/`trigger_type` and drops
|
|
34
|
+
them (`mysqlJobSchemaUpgrades` lists the statements for a deployment's own migrations); Mongo's queue does the same
|
|
35
|
+
to the documents on first use and drops the `spaceId_1_actionId_1_updatedAt_-1` index. A deployment with a queue of
|
|
36
|
+
its own: the contract tests (`describeJobQueue`) say what it must now do.
|
|
37
|
+
- **A runtime's routes stream** (`@plitzi/sdk-server`): a route under `/fn/` answered by a space's runtime is passed on
|
|
38
|
+
as it is written — its head at once, its body as the code writes it, with the platform's `ctx` — over the functions
|
|
39
|
+
protocol's new `head`/`chunk` messages, with no time limit once it answered; the deployment's own routes stream too.
|
|
40
|
+
A runtime's `endpoints` are for addresses outside `/fn/` (an MCP server at `/mcp`); anything that can live under
|
|
41
|
+
`/fn/` is a route. A sandbox's routes are answered whole, as before.
|
|
42
|
+
- **`createJobControl({ queue, realtime: { pubsub, kv } })`** (`@plitzi/sdk-server/actions`): an operator's
|
|
43
|
+
`pause`/`resume`/`cancel`/`requeue` from a process that serves no pages — a Queue panel's API — each said on
|
|
44
|
+
`$job:<id>` through the page server's own pub/sub and retained store, so a watcher hears what an operator did.
|
|
45
|
+
- **A run's user carries no session** (`RunUser`): what a step, a function and a job see of who asked.
|
|
46
|
+
- **The builder shows the jobs** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`): **Server → Functions** lists the
|
|
47
|
+
jobs the code declares as it is typed (how long each may run; one spread in or built by a call is counted, not
|
|
48
|
+
guessed), and the inspector of one says how it is started and who may watch it, with the space's runs of it — live
|
|
49
|
+
while one moves, progress and step as its code reported them — and **Pause**, **Resume**, **Cancel** and **Run
|
|
50
|
+
again**. Through two new builder operations, `SpaceJobs(kind, name, status, page, pageSize)` — a `SpaceJob` each:
|
|
51
|
+
what it runs, where it is and how far, never its input, state or result — and `SpaceControlJob(jobId, control)`
|
|
52
|
+
(`JobControlAction`). Beside them in `@plitzi/sdk-shared/actions`: `JOB_KINDS`/`isJobKind`, and `actionAccessOf`, the
|
|
53
|
+
one reading of a channel's access, which the functions' manifest now reads a job's `watch` with too.
|
|
54
|
+
|
|
55
|
+
- **`ctx.oauth.token` for an SDK in the page** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): Spotify's Web Playback,
|
|
56
|
+
Google's Picker and their kind ask the page for the access token themselves, and `ctx.oauth` kept every token on the
|
|
57
|
+
server. A connection that declares `exposeToken: true` now answers `ctx.oauth.token(name, { owner })` —
|
|
58
|
+
`{ token, type, expiresAt, scopes }`, renewed first when about to lapse — for a route of the code to hand to the
|
|
59
|
+
connection's owner. The refresh token never leaves; a connection without `exposeToken` refuses `token`, naming the
|
|
60
|
+
field. Through the sandbox's protocol and natively alike.
|
|
61
|
+
|
|
62
|
+
- **A page for some permissions, kept by the server** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`,
|
|
63
|
+
`@plitzi/sdk-authoring`, `@plitzi/sdk-elements`, `@plitzi/plitzi-builder`): a page says
|
|
64
|
+
`access: { permissions: [...] }`, and a visitor without every one is answered 401 (or the page's sign-in redirect) or
|
|
65
|
+
403 with a refusal drawn in the page's layout. Its content is withheld from everything that visitor is sent — the
|
|
66
|
+
render, the hydration payload, the space document (and a document built for somebody with access is not handed to
|
|
67
|
+
somebody without it by its name) and the page's server data. The builder's page settings take the permissions;
|
|
68
|
+
authoring refuses an `access` the server could not keep (`page-access`). A space read back as code — `plitzi create
|
|
69
|
+
--from`, the Export — keeps each page's `access`, so a protected page is never exported open. A page's handle carries
|
|
70
|
+
its `access` too, and a project's `visual/home.spec.ts` leaves such a page to a test that signs in, as it does a page
|
|
71
|
+
behind a session (`plitzi upgrade` rewrites an untouched one).
|
|
72
|
+
- **A project's first plugin is picked up while it runs** (`@plitzi/sdk-server`): `start:dev` registers a plugin folder
|
|
73
|
+
added under `src/plugins/` and reloads the open pages — but only watched that folder when it existed at boot, so a
|
|
74
|
+
project with no plugin yet (one taken out of a space that had none) showed nothing of its first `plitzi plugin add`
|
|
75
|
+
until a restart. With no folder, the server waits for it to appear and takes what it holds then.
|
|
76
|
+
|
|
77
|
+
## Packaging
|
|
78
|
+
- **No package ships the declarations of its tests** (`@plitzi/sdk-server`, `@plitzi/sdk-mcp`, `@plitzi/plitzi-sdk`,
|
|
79
|
+
`@plitzi/plitzi-builder`, `@plitzi/sdk-elements`, `@plitzi/sdk-shared`): each app wrote its declarations with its own
|
|
80
|
+
`dts({ exclude })`, and the ones that left the tests out of it shipped a `.test.d.ts` beside their modules — 148 in
|
|
81
|
+
sdk-server alone — and the base config let a `.bench.d.ts` through. Every `dts()` now excludes
|
|
82
|
+
`'**/*.(test|bench).(ts|tsx)'`, and `yarn check:dist-exports` (CI, after `build:prod`) fails a build of any published
|
|
83
|
+
package that holds one.
|
|
84
|
+
- **`@plitzi/plitzi-builder` depends on `graphql` ^16** (was ^17): Apollo Server — the builder's API — supports only
|
|
85
|
+
16, so a host installing the builder beside it got two copies. The builder uses nothing of 17's.
|
|
86
|
+
|
|
87
|
+
## Elements
|
|
88
|
+
- **A dropdown closes when a link in it is chosen** (`@plitzi/sdk-elements`): a link stops its click from bubbling,
|
|
89
|
+
and the popup listened for clicks on the way up — so no menu of links ever closed, and a click that did reach it was
|
|
90
|
+
cancelled, which would have kept an external link from going anywhere. The popup now hears the click as it goes down
|
|
91
|
+
and lets it through.
|
|
92
|
+
|
|
93
|
+
## CLI
|
|
94
|
+
- **A refused push says why** (`@plitzi/cli`): `space push functions` and the data push read any 409 as "changed since
|
|
95
|
+
your pull" — and the platform also answers 409 when the space has no private bucket to keep its code or data in, so
|
|
96
|
+
a first push to a space with no storage sent its author to pull, which changed nothing. The CLI now names a conflict
|
|
97
|
+
only when the refusal says `version`, and prints the platform's own words otherwise (where to add the bucket).
|
|
98
|
+
- **`create` points at the Academy** (`@plitzi/cli`): its last lines name the docs' Academy,
|
|
99
|
+
`https://docs.plitzi.com/academy`, for whoever is new to Plitzi — and the README the docs themselves.
|
|
100
|
+
|
|
101
|
+
## Builder
|
|
102
|
+
- **A space served by Plitzi has a server, and the builder says so** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`):
|
|
103
|
+
whether a space can run its actions and resolve its connectors was read off an SSR _credential_, which only a space
|
|
104
|
+
deployed to a page server of its own has — so every space served at `<space>.plitzi.app` showed "No server-rendered
|
|
105
|
+
deployment" over Server and counted its actions unavailable, while they ran. The deployments now carry what serves
|
|
106
|
+
them (`provider`), and a deployment served by SSR — Plitzi's or the space's — counts.
|
|
107
|
+
- **New Layout saves the layout** (`@plitzi/sdk-schema`): a layout is a root of the pages' tree, added with no anchor,
|
|
108
|
+
and `flatMapOf` found no tree for an empty anchor — so the server refused every new layout, saying it was "already
|
|
109
|
+
added". A root now goes into the pages' tree, and the refusal says which of the two it is.
|
|
110
|
+
- **Settings → Realtime: a space's channels, declared by hand** (`@plitzi/plitzi-builder`): `settings.channels` was
|
|
111
|
+
written only in code or by an agent over MCP, so a space made in the builder could not open a channel. The section
|
|
112
|
+
lists the channels with who may join (anyone, signed-in visitors, visitors with permissions), who may speak (pages, or
|
|
113
|
+
only the server's `Publish On Channel`), presence, a grant, keeping the last message and the two limits — saved only
|
|
114
|
+
when `channelProblems` passes, with what is wrong said under the channel otherwise.
|
|
115
|
+
|
|
116
|
+
- Updated dependencies [19fbc45]
|
|
117
|
+
- @plitzi/sdk-shared@0.38.21
|
|
118
|
+
|
|
119
|
+
## 0.38.20
|
|
120
|
+
|
|
121
|
+
### Patch Changes
|
|
122
|
+
|
|
123
|
+
- c7c241a: ## Security
|
|
124
|
+
|
|
125
|
+
- **The `Origin` fallback reads the request's own authority before a forwarded one** (`@plitzi/sdk-server`): 0.38.19
|
|
126
|
+
took `X-Forwarded-Host` first, and with no proxy in front a client could send one naming this host on another port,
|
|
127
|
+
making that port's `Origin` this server's own. Now `:authority` or `Host` decide whenever they name the host the
|
|
128
|
+
request is answered as; `X-Forwarded-Host` only when they do not — a host that took its hostname from the header
|
|
129
|
+
(Express's `trust proxy`) trusts the proxy that wrote it. No option to set: what the host resolved says which one it
|
|
130
|
+
believes. The write guard (`crossSiteWrites`), the sign-in's login-CSRF check and `createOriginGuardMiddleware`
|
|
131
|
+
share it.
|
|
132
|
+
|
|
133
|
+
## Server
|
|
134
|
+
- **`ctx.oauth`: OAuth 2.0 for a space's code, any provider** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): a
|
|
135
|
+
connection is data in `defineFunctions({ oauth: { calendar: { issuer | authorizeUrl + tokenUrl, credential, scopes,
|
|
136
|
+
authorizeParams, clientAuth } } })` — an OpenID provider by its `issuer` (endpoints discovered), any other by its
|
|
137
|
+
endpoints; none is known to the platform by name. `ctx.oauth.connect(name, { returnTo, owner? })` answers the
|
|
138
|
+
consent URL (authorization code with PKCE); the platform answers `/fn/oauth/callback` — the one address to register
|
|
139
|
+
with every provider — exchanges the code with the app's id and secret from the named credential, and sends the
|
|
140
|
+
visitor back to `returnTo` with `?oauth=<name>&oauth_result=connected` (or `&oauth_error=`). `ctx.oauth.fetch(name,
|
|
141
|
+
url)` writes the token in, renewed before it lapses and once more on a 401, only to `allow.hosts`; `status` and
|
|
142
|
+
`disconnect` (revoked where the provider says). A token is a signed-in visitor's own by default, `{ owner: 'space' }`
|
|
143
|
+
the space's, or a key of the code's own; it is kept in the space's `kv` sealed with a key of the space's that no
|
|
144
|
+
`ctx.sign` reaches, so the code never holds one. In the sandbox, natively and in a space's runtime alike; a plugin's
|
|
145
|
+
functions declare and reach none. Needs `signingSecret`. Runs also carry the `origin` of the request that started
|
|
146
|
+
them (`ctx.origin` of a task context), what the callback address is made of.
|
|
147
|
+
|
|
148
|
+
## Packages
|
|
149
|
+
- **No path a package does not export is written anywhere in the packages** (`@plitzi/plitzi-sdk`,
|
|
150
|
+
`@plitzi/sdk-shared`): two JSDoc comments sent readers to `@plitzi/sdk-authoring/testing`, which is not an entry —
|
|
151
|
+
`inspectRenders` is exported by `@plitzi/sdk-authoring`. `yarn check:specifiers` (in CI after the build) reads every
|
|
152
|
+
`@plitzi/<package>/<path>` the workspace writes — the code, its built declarations, JSDoc, skills and docs — against
|
|
153
|
+
what that package exports, so an import somebody would copy into a project and get `ERR_MODULE_NOT_FOUND` from cannot
|
|
154
|
+
be published again.
|
|
155
|
+
|
|
156
|
+
- **The packages that run in Node say which Node** (`@plitzi/sdk-server`, `@plitzi/cli`, `@plitzi/sdk-mcp`,
|
|
157
|
+
`@plitzi/sdk-authoring`): `"engines": { "node": ">=22.18" }`, the floor every project the CLI makes already declares —
|
|
158
|
+
installed on an older Node they now say so, instead of failing on the first API it lacks (`--env-file-if-exists`,
|
|
159
|
+
`--permission`, `Set#union`). The browser's packages declare none: a bundler reads them.
|
|
160
|
+
|
|
161
|
+
- **A short render guide, and each part of it alone** (`@plitzi/sdk-mcp`): `renderGuideText` stays the whole guide
|
|
162
|
+
(~30k characters); `renderGuideCore` is a third of it for an agent that counts its tokens — a voice assistant, a small
|
|
163
|
+
model — with the model of a render, the element types, the host's theme and what to do on a refusal, and the address
|
|
164
|
+
of every other section; `renderGuideTopics[topic]` and `renderGuideTopicUri(topic)` (`plitzi://render/guide/repeat`,
|
|
165
|
+
`…/data`…) serve each one, cut from the one text. The MCP server answers them as resources and through `plitzi_read`.
|
|
166
|
+
|
|
167
|
+
## CLI
|
|
168
|
+
- **What Plitzi decided reaches the agent writing a report** (`@plitzi/cli`): `plitzi feedback`'s brief lists what was
|
|
169
|
+
reported and kept as it is — with why, and what to do instead — so a report files it under `changed` as `decided`
|
|
170
|
+
rather than carrying it as open, and the page has that status.
|
|
171
|
+
|
|
172
|
+
- **The CLI skill says what `ERR_MODULE_NOT_FOUND` into a `@plitzi` package's `dist` is** (`@plitzi/cli`): an import of
|
|
173
|
+
a path the package does not export — a file rather than its folder — with `plitzi doctor` to name each one and
|
|
174
|
+
`plitzi upgrade migrations --write` to rewrite it.
|
|
175
|
+
|
|
176
|
+
- Updated dependencies [c7c241a]
|
|
177
|
+
- @plitzi/sdk-shared@0.38.20
|
|
178
|
+
|
|
3
179
|
## 0.38.19
|
|
4
180
|
|
|
5
181
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-event-bridge",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.21",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@plitzi/sdk-shared": "0.38.
|
|
31
|
+
"@plitzi/sdk-shared": "0.38.21"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@testing-library/react": "^16.3.3",
|