@plitzi/sdk-interactions 0.38.20 → 0.38.22

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.
Files changed (2) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,148 @@
1
1
  # @plitzi/sdk-interactions
2
2
 
3
+ ## 0.38.22
4
+
5
+ ### Patch Changes
6
+
7
+ - 19fbc45: ## Server
8
+
9
+ - **`ctx.oauth`, after a project moved onto it** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`) — PZ-155..158.
10
+ `functions.oauth.callbackOrigin` fixes the one address providers send a visitor back to, on a server of one space
11
+ reached on several: `serveProject` sets it to the address people reach it on, or its loopback `127.0.0.1` when that is
12
+ plain HTTP (providers refuse `http` past loopback, and `localhost`), and prints it as it starts; the callback then sends
13
+ the visitor on to `returnTo` on the address they started from — its `location` is absolute now. `connect(name,
14
+ { returnTo, authorizeParams })` adds to the connection's parameters for one consent (`prompt: 'select_account'`), and
15
+ refuses one the platform writes. `ctx.fetch` and `ctx.oauth.fetch` take `init.signal`: in the sandbox and a runtime the
16
+ request is numbered and the code's `abort` cuts it on the platform. `ActionRefusal` takes `{ code }`; `ctx.oauth`
17
+ refuses with `oauth-not-connected` and `oauth-no-owner`.
18
+ - **A refusal of the platform's stays one across the sandbox** (`@plitzi/sdk-server`). A call answered with an
19
+ `ActionRefusal` crossed the isolate, the runner service and a runtime as a plain error: caught, the code could not tell
20
+ it apart; uncaught, a route answered 500 `This route failed` instead of 400 and the reason. The answer carries
21
+ `refused` and `code` now, and the code catches the refusal it was thrown.
22
+
23
+ - Updated dependencies [19fbc45]
24
+ - @plitzi/sdk-auth@0.38.22
25
+ - @plitzi/sdk-event-bridge@0.38.22
26
+ - @plitzi/sdk-shared@0.38.22
27
+
28
+ ## 0.38.21
29
+
30
+ ### Patch Changes
31
+
32
+ - 19fbc45: ## Server
33
+
34
+ - **Jobs: work longer than a request** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`, `@plitzi/sdk-elements`,
35
+ `@plitzi/plitzi-sdk`, `@plitzi/sdk-authoring`) — PZ-136. A space's code declares them in
36
+ `defineFunctions({ jobs: { train: { watch, maxSeconds, run(input, job, ctx) } } })` and starts them with
37
+ `ctx.jobs.start(name, input, { key })` (`get`, `pause`, `resume`, `cancel` beside it). They run in the actions' durable
38
+ queue — leased, taken over when a server dies, retried with backoff — slice by slice, in the sandbox, in a space's
39
+ runtime and natively alike: `job.save(state)` is the one checkpoint and the next slice starts with `job.state`;
40
+ `job.report(fraction, step)` says how far it is; on `job.signal` (`job.stopping`: `pause`, `cancel`, `limit`,
41
+ `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
42
+ saved since it began — one that saved nothing fails, so a job cannot loop forever; a runtime's runs until the job's
43
+ time is up. A real pause: `paused` keeps what it saved until resumed. Who may watch it is RBAC: whoever started it, and
44
+ whoever its `watch` (a channel's access) lets in, on `$job:<id>` — the platform's topic, retained — read with
45
+ `useJob(id)` or a `channel` element on `$job:{{ id }}`; the view never carries its input, its state, or an error other
46
+ than the code's own refusal. Limits per space (its plan) through `functions.jobs.limitsFor` —
47
+ `DEFAULT_FUNCTION_JOB_LIMITS` otherwise: 10 running across the account's spaces (`pool`, the oldest first), 1,000
48
+ waiting, 6 h, slices of 5 min / 30 s CPU / 10,000 calls, 1 MB of state.
49
+ - **The queue's types are the queue's** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): `ActionJobQueue`, `ActionJob`,
50
+ `ActionJobInput`, `ActionJobStatus`, `ActionJobAttempt`, `ActionJobSettlement`, `ActionJobQuery` are `JobQueue`, `Job`,
51
+ `JobInput`, `JobStatus`, `JobAttempt`, `JobSettlement`, `JobQuery` (`ACTION_JOB_STATUSES` → `JOB_STATUSES`,
52
+ `isJobStatus`, `TERMINAL_JOB_STATUSES`) — the queue holds a schedule's fires, the runs set for later and the jobs of
53
+ the spaces' functions. **What a job runs is its `target`**: `{ kind: 'action', name, trigger }` or
54
+ `{ kind: 'function', name, user, watch, at }`, in place of `actionId`, `trigger` and `function`; `listJobs` filters
55
+ by `kind` and `name`. Also on the queue: `paused` with `pause`/`resume`, `write` for what a running job saves and
56
+ reports, `state`/`progress`/`result`/`activeMs`, `heartbeat` answering `{ jobId, stop: 'cancel' | 'pause' }[]`, a
57
+ settlement's explicit `refund`, `requeue(…, { input, fresh })`. The helpers bring a store a release before left up
58
+ to it by themselves: MySQL's `ensureJobTables` gives each job its target from `action_id`/`trigger_type` and drops
59
+ them (`mysqlJobSchemaUpgrades` lists the statements for a deployment's own migrations); Mongo's queue does the same
60
+ to the documents on first use and drops the `spaceId_1_actionId_1_updatedAt_-1` index. A deployment with a queue of
61
+ its own: the contract tests (`describeJobQueue`) say what it must now do.
62
+ - **A runtime's routes stream** (`@plitzi/sdk-server`): a route under `/fn/` answered by a space's runtime is passed on
63
+ as it is written — its head at once, its body as the code writes it, with the platform's `ctx` — over the functions
64
+ protocol's new `head`/`chunk` messages, with no time limit once it answered; the deployment's own routes stream too.
65
+ A runtime's `endpoints` are for addresses outside `/fn/` (an MCP server at `/mcp`); anything that can live under
66
+ `/fn/` is a route. A sandbox's routes are answered whole, as before.
67
+ - **`createJobControl({ queue, realtime: { pubsub, kv } })`** (`@plitzi/sdk-server/actions`): an operator's
68
+ `pause`/`resume`/`cancel`/`requeue` from a process that serves no pages — a Queue panel's API — each said on
69
+ `$job:<id>` through the page server's own pub/sub and retained store, so a watcher hears what an operator did.
70
+ - **A run's user carries no session** (`RunUser`): what a step, a function and a job see of who asked.
71
+ - **The builder shows the jobs** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`): **Server → Functions** lists the
72
+ jobs the code declares as it is typed (how long each may run; one spread in or built by a call is counted, not
73
+ guessed), and the inspector of one says how it is started and who may watch it, with the space's runs of it — live
74
+ while one moves, progress and step as its code reported them — and **Pause**, **Resume**, **Cancel** and **Run
75
+ again**. Through two new builder operations, `SpaceJobs(kind, name, status, page, pageSize)` — a `SpaceJob` each:
76
+ what it runs, where it is and how far, never its input, state or result — and `SpaceControlJob(jobId, control)`
77
+ (`JobControlAction`). Beside them in `@plitzi/sdk-shared/actions`: `JOB_KINDS`/`isJobKind`, and `actionAccessOf`, the
78
+ one reading of a channel's access, which the functions' manifest now reads a job's `watch` with too.
79
+
80
+ - **`ctx.oauth.token` for an SDK in the page** (`@plitzi/sdk-server`, `@plitzi/sdk-shared`): Spotify's Web Playback,
81
+ Google's Picker and their kind ask the page for the access token themselves, and `ctx.oauth` kept every token on the
82
+ server. A connection that declares `exposeToken: true` now answers `ctx.oauth.token(name, { owner })` —
83
+ `{ token, type, expiresAt, scopes }`, renewed first when about to lapse — for a route of the code to hand to the
84
+ connection's owner. The refresh token never leaves; a connection without `exposeToken` refuses `token`, naming the
85
+ field. Through the sandbox's protocol and natively alike.
86
+
87
+ - **A page for some permissions, kept by the server** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`,
88
+ `@plitzi/sdk-authoring`, `@plitzi/sdk-elements`, `@plitzi/plitzi-builder`): a page says
89
+ `access: { permissions: [...] }`, and a visitor without every one is answered 401 (or the page's sign-in redirect) or
90
+ 403 with a refusal drawn in the page's layout. Its content is withheld from everything that visitor is sent — the
91
+ render, the hydration payload, the space document (and a document built for somebody with access is not handed to
92
+ somebody without it by its name) and the page's server data. The builder's page settings take the permissions;
93
+ authoring refuses an `access` the server could not keep (`page-access`). A space read back as code — `plitzi create
94
+ --from`, the Export — keeps each page's `access`, so a protected page is never exported open. A page's handle carries
95
+ 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
96
+ behind a session (`plitzi upgrade` rewrites an untouched one).
97
+ - **A project's first plugin is picked up while it runs** (`@plitzi/sdk-server`): `start:dev` registers a plugin folder
98
+ added under `src/plugins/` and reloads the open pages — but only watched that folder when it existed at boot, so a
99
+ project with no plugin yet (one taken out of a space that had none) showed nothing of its first `plitzi plugin add`
100
+ until a restart. With no folder, the server waits for it to appear and takes what it holds then.
101
+
102
+ ## Packaging
103
+ - **No package ships the declarations of its tests** (`@plitzi/sdk-server`, `@plitzi/sdk-mcp`, `@plitzi/plitzi-sdk`,
104
+ `@plitzi/plitzi-builder`, `@plitzi/sdk-elements`, `@plitzi/sdk-shared`): each app wrote its declarations with its own
105
+ `dts({ exclude })`, and the ones that left the tests out of it shipped a `.test.d.ts` beside their modules — 148 in
106
+ sdk-server alone — and the base config let a `.bench.d.ts` through. Every `dts()` now excludes
107
+ `'**/*.(test|bench).(ts|tsx)'`, and `yarn check:dist-exports` (CI, after `build:prod`) fails a build of any published
108
+ package that holds one.
109
+ - **`@plitzi/plitzi-builder` depends on `graphql` ^16** (was ^17): Apollo Server — the builder's API — supports only
110
+ 16, so a host installing the builder beside it got two copies. The builder uses nothing of 17's.
111
+
112
+ ## Elements
113
+ - **A dropdown closes when a link in it is chosen** (`@plitzi/sdk-elements`): a link stops its click from bubbling,
114
+ 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
115
+ cancelled, which would have kept an external link from going anywhere. The popup now hears the click as it goes down
116
+ and lets it through.
117
+
118
+ ## CLI
119
+ - **A refused push says why** (`@plitzi/cli`): `space push functions` and the data push read any 409 as "changed since
120
+ your pull" — and the platform also answers 409 when the space has no private bucket to keep its code or data in, so
121
+ a first push to a space with no storage sent its author to pull, which changed nothing. The CLI now names a conflict
122
+ only when the refusal says `version`, and prints the platform's own words otherwise (where to add the bucket).
123
+ - **`create` points at the Academy** (`@plitzi/cli`): its last lines name the docs' Academy,
124
+ `https://docs.plitzi.com/academy`, for whoever is new to Plitzi — and the README the docs themselves.
125
+
126
+ ## Builder
127
+ - **A space served by Plitzi has a server, and the builder says so** (`@plitzi/plitzi-builder`, `@plitzi/sdk-shared`):
128
+ whether a space can run its actions and resolve its connectors was read off an SSR _credential_, which only a space
129
+ deployed to a page server of its own has — so every space served at `<space>.plitzi.app` showed "No server-rendered
130
+ deployment" over Server and counted its actions unavailable, while they ran. The deployments now carry what serves
131
+ them (`provider`), and a deployment served by SSR — Plitzi's or the space's — counts.
132
+ - **New Layout saves the layout** (`@plitzi/sdk-schema`): a layout is a root of the pages' tree, added with no anchor,
133
+ and `flatMapOf` found no tree for an empty anchor — so the server refused every new layout, saying it was "already
134
+ added". A root now goes into the pages' tree, and the refusal says which of the two it is.
135
+ - **Settings → Realtime: a space's channels, declared by hand** (`@plitzi/plitzi-builder`): `settings.channels` was
136
+ written only in code or by an agent over MCP, so a space made in the builder could not open a channel. The section
137
+ lists the channels with who may join (anyone, signed-in visitors, visitors with permissions), who may speak (pages, or
138
+ only the server's `Publish On Channel`), presence, a grant, keeping the last message and the two limits — saved only
139
+ when `channelProblems` passes, with what is wrong said under the channel otherwise.
140
+
141
+ - Updated dependencies [19fbc45]
142
+ - @plitzi/sdk-auth@0.38.21
143
+ - @plitzi/sdk-event-bridge@0.38.21
144
+ - @plitzi/sdk-shared@0.38.21
145
+
3
146
  ## 0.38.20
4
147
 
5
148
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-interactions",
3
- "version": "0.38.20",
3
+ "version": "0.38.22",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@plitzi/plitzi-ui": "^1.6.34",
40
- "@plitzi/sdk-auth": "0.38.20",
41
- "@plitzi/sdk-event-bridge": "0.38.20",
42
- "@plitzi/sdk-shared": "0.38.20"
40
+ "@plitzi/sdk-auth": "0.38.22",
41
+ "@plitzi/sdk-event-bridge": "0.38.22",
42
+ "@plitzi/sdk-shared": "0.38.22"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^19"