@plitzi/sdk-interactions 0.38.20 → 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.
Files changed (2) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,123 @@
1
1
  # @plitzi/sdk-interactions
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-auth@0.38.21
118
+ - @plitzi/sdk-event-bridge@0.38.21
119
+ - @plitzi/sdk-shared@0.38.21
120
+
3
121
  ## 0.38.20
4
122
 
5
123
  ### 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.21",
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.21",
41
+ "@plitzi/sdk-event-bridge": "0.38.21",
42
+ "@plitzi/sdk-shared": "0.38.21"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^19"