@plitzi/sdk-shared 0.38.23 → 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.
Files changed (194) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/dist/actions/functions.d.ts +22 -1
  3. package/dist/actions/functions.mjs +3 -3
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +7 -7
  6. package/dist/auth/failureChannel.mjs +1 -0
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.mjs +2 -2
  9. package/dist/auth/visitorRoles.d.ts +8 -0
  10. package/dist/auth/visitorRoles.mjs +5 -2
  11. package/dist/authoring/declare.d.ts +34 -1
  12. package/dist/authoring/elementCallbacks.d.ts +13 -0
  13. package/dist/authoring/elementCallbacks.mjs +11 -5
  14. package/dist/authoring/index.mjs +3 -3
  15. package/dist/authoring/paramSpec.d.ts +1 -0
  16. package/dist/dataSource/getBindingsDetails.d.ts +1 -1
  17. package/dist/dataSource/getBindingsDetails.mjs +1 -1
  18. package/dist/dataSource/globalSources.d.ts +1 -1
  19. package/dist/dataSource/index.d.ts +1 -2
  20. package/dist/dataSource/index.mjs +1 -1
  21. package/dist/dataSource/utility/arrayMap.mjs +1 -1
  22. package/dist/dataSource/utility/capitalize.mjs +1 -1
  23. package/dist/dataSource/utility/styleSelector.mjs +5 -3
  24. package/dist/dataSource/utility/styleVariant.mjs +17 -13
  25. package/dist/dataSource/variables/index.d.ts +2 -0
  26. package/dist/dataSource/variables/index.mjs +1 -0
  27. package/dist/dataSource/{resolveVariables.d.ts → variables/resolveVariables.d.ts} +1 -1
  28. package/dist/dataSource/{resolveVariables.mjs → variables/resolveVariables.mjs} +1 -1
  29. package/dist/devTools/chrome.d.ts +6 -0
  30. package/dist/devTools/chrome.mjs +2 -2
  31. package/dist/devTools/index.mjs +5 -5
  32. package/dist/devTools/sight/index.d.ts +1 -0
  33. package/dist/devTools/sight/index.mjs +1 -0
  34. package/dist/devTools/sight/sight.d.ts +28 -0
  35. package/dist/devTools/sight/sight.mjs +127 -0
  36. package/dist/devTools/utils/PlitziConsole.d.ts +14 -0
  37. package/dist/devTools/utils/PlitziConsole.mjs +20 -3
  38. package/dist/flags/flagsCookie.mjs +4 -4
  39. package/dist/flags/resolveFlags.d.ts +1 -1
  40. package/dist/helpers/index.mjs +19 -19
  41. package/dist/helpers/ruleEvaluator.d.ts +2 -0
  42. package/dist/helpers/ruleEvaluator.mjs +2 -2
  43. package/dist/helpers/scroll.d.ts +10 -0
  44. package/dist/helpers/scroll.mjs +2 -2
  45. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +90 -88
  46. package/dist/helpers/twigWrapper/Evaluator/helpers.d.ts +6 -0
  47. package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +11 -2
  48. package/dist/helpers/twigWrapper/filters/arrays.d.ts +2 -0
  49. package/dist/helpers/twigWrapper/filters/arrays.mjs +66 -0
  50. package/dist/helpers/twigWrapper/filters/catalog/index.d.ts +17 -0
  51. package/dist/helpers/twigWrapper/filters/catalog/index.mjs +351 -0
  52. package/dist/helpers/twigWrapper/filters/dateParts.d.ts +25 -0
  53. package/dist/helpers/twigWrapper/filters/dateParts.mjs +56 -0
  54. package/dist/helpers/twigWrapper/filters/dates.d.ts +2 -0
  55. package/dist/helpers/twigWrapper/filters/dates.mjs +97 -0
  56. package/dist/helpers/twigWrapper/filters/filters.d.ts +3 -13
  57. package/dist/helpers/twigWrapper/filters/filters.mjs +25 -483
  58. package/dist/helpers/twigWrapper/filters/hashing.d.ts +3 -0
  59. package/dist/helpers/twigWrapper/filters/hashing.mjs +101 -0
  60. package/dist/helpers/twigWrapper/filters/index.mjs +4 -1
  61. package/dist/helpers/twigWrapper/filters/misc.d.ts +5 -0
  62. package/dist/helpers/twigWrapper/filters/misc.mjs +52 -0
  63. package/dist/helpers/twigWrapper/filters/numbers.d.ts +2 -0
  64. package/dist/helpers/twigWrapper/filters/numbers.mjs +36 -0
  65. package/dist/helpers/twigWrapper/filters/objects.d.ts +3 -0
  66. package/dist/helpers/twigWrapper/filters/objects.mjs +61 -0
  67. package/dist/helpers/twigWrapper/filters/raw.d.ts +8 -0
  68. package/dist/helpers/twigWrapper/filters/raw.mjs +7 -0
  69. package/dist/helpers/twigWrapper/filters/strings.d.ts +7 -0
  70. package/dist/helpers/twigWrapper/filters/strings.mjs +79 -0
  71. package/dist/helpers/twigWrapper/filters/types.d.ts +5 -0
  72. package/dist/helpers/twigWrapper/filters/types.mjs +4 -0
  73. package/dist/helpers/twigWrapper/filters/values.d.ts +12 -0
  74. package/dist/helpers/twigWrapper/filters/values.mjs +17 -0
  75. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +5 -0
  76. package/dist/helpers/twigWrapper/inspectTemplate.mjs +39 -20
  77. package/dist/helpers/utils.d.ts +4 -0
  78. package/dist/helpers/utils.mjs +3 -5
  79. package/dist/navigation/index.d.ts +2 -0
  80. package/dist/navigation/index.mjs +2 -1
  81. package/dist/navigation/sitemap.d.ts +16 -0
  82. package/dist/navigation/sitemap.mjs +25 -0
  83. package/dist/network/entitlements.d.ts +101 -0
  84. package/dist/network/entitlements.mjs +4 -0
  85. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.d.ts +31 -0
  86. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +13 -0
  87. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.d.ts +5 -0
  88. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +11 -0
  89. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.d.ts +1 -1
  90. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -1
  91. package/dist/network/graphql/builder/Mutations/index.d.ts +5 -0
  92. package/dist/network/graphql/builder/Mutations/index.mjs +150 -146
  93. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.d.ts +40 -0
  94. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +24 -0
  95. package/dist/network/graphql/builder/Queries/index.d.ts +3 -0
  96. package/dist/network/graphql/builder/Queries/index.mjs +44 -42
  97. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +3 -1
  98. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
  99. package/dist/network/index.d.ts +1 -0
  100. package/dist/network/index.mjs +9 -8
  101. package/dist/network/spaceEvents.d.ts +20 -1
  102. package/dist/network/spaceEvents.mjs +12 -0
  103. package/dist/project/index.mjs +8 -5
  104. package/dist/project/layout/check.d.ts +22 -0
  105. package/dist/project/layout/check.mjs +60 -0
  106. package/dist/project/{layout.d.ts → layout/codes.d.ts} +3 -66
  107. package/dist/project/layout/codes.mjs +108 -0
  108. package/dist/project/layout/contents.d.ts +10 -0
  109. package/dist/project/layout/contents.mjs +31 -0
  110. package/dist/project/layout/files.d.ts +31 -0
  111. package/dist/project/layout/files.mjs +49 -0
  112. package/dist/project/layout/folders.d.ts +4 -0
  113. package/dist/project/layout/folders.mjs +69 -0
  114. package/dist/project/layout/index.d.ts +16 -0
  115. package/dist/project/layout/index.mjs +5 -0
  116. package/dist/project/layout/plugins.d.ts +46 -0
  117. package/dist/project/layout/plugins.mjs +99 -0
  118. package/dist/project/layout/vendor.d.ts +15 -0
  119. package/dist/project/layout/vendor.mjs +34 -0
  120. package/dist/project/pages/index.d.ts +8 -0
  121. package/dist/project/pages/index.mjs +14 -0
  122. package/dist/project/paths/index.d.ts +52 -4
  123. package/dist/project/paths/index.mjs +2 -2
  124. package/dist/project/root.d.ts +6 -0
  125. package/dist/project/root.mjs +11 -10
  126. package/dist/realtime/client.mjs +104 -91
  127. package/dist/realtime/presence.d.ts +2 -2
  128. package/dist/realtime/presence.mjs +27 -21
  129. package/dist/runs/index.d.ts +73 -0
  130. package/dist/runs/index.mjs +6 -0
  131. package/dist/runs/report.d.ts +56 -0
  132. package/dist/runs/report.mjs +17 -0
  133. package/dist/schema/index.d.ts +6 -0
  134. package/dist/schema/index.mjs +18 -12
  135. package/dist/schema/motion.d.ts +25 -0
  136. package/dist/schema/motion.mjs +47 -19
  137. package/dist/schema/pageAccess.d.ts +6 -0
  138. package/dist/schema/pageAccess.mjs +8 -3
  139. package/dist/schema/pageHead.d.ts +64 -0
  140. package/dist/schema/pageHead.mjs +68 -0
  141. package/dist/schema/providerAnswer.d.ts +17 -0
  142. package/dist/schema/providerAnswer.mjs +4 -0
  143. package/dist/schema/providerWhen.d.ts +36 -0
  144. package/dist/schema/providerWhen.mjs +58 -0
  145. package/dist/schema/schemaSettings.d.ts +14 -0
  146. package/dist/schema/schemaSettings.mjs +4 -0
  147. package/dist/schema/serverElements.d.ts +20 -1
  148. package/dist/schema/serverElements.mjs +41 -28
  149. package/dist/schema/serverInput.d.ts +34 -0
  150. package/dist/schema/serverInput.mjs +60 -0
  151. package/dist/schema/serverQuery.d.ts +47 -0
  152. package/dist/schema/serverQuery.mjs +70 -0
  153. package/dist/server/index.mjs +5 -5
  154. package/dist/server/rsc/refreshRsc.d.ts +6 -2
  155. package/dist/server/rsc/refreshRsc.mjs +75 -59
  156. package/dist/server/rsc/useRscSync.mjs +22 -18
  157. package/dist/source/export.d.ts +1 -1
  158. package/dist/state/runtimeStatePersist.mjs +25 -17
  159. package/dist/store/renderSettings.d.ts +2 -0
  160. package/dist/store/renderSettings.mjs +13 -5
  161. package/dist/store/storeHooks.d.ts +45 -45
  162. package/dist/style/index.mjs +16 -16
  163. package/dist/style/styleConstants.d.ts +12 -2
  164. package/dist/style/styleConstants.mjs +20 -0
  165. package/dist/style/styleStates.d.ts +5 -0
  166. package/dist/style/styleStates.mjs +21 -5
  167. package/dist/types/ActionTypes.d.ts +26 -3
  168. package/dist/types/AuthTypes.d.ts +19 -1
  169. package/dist/types/CommonTypes.d.ts +3 -2
  170. package/dist/types/ElementTypes.d.ts +1 -1
  171. package/dist/types/InteractionTypes.d.ts +10 -1
  172. package/dist/types/JobTypes.d.ts +2 -1
  173. package/dist/types/OAuthTypes.d.ts +246 -0
  174. package/dist/types/OAuthTypes.mjs +0 -0
  175. package/dist/types/PluginTypes.d.ts +2 -0
  176. package/dist/types/PreviewTypes.d.ts +71 -0
  177. package/dist/types/PreviewTypes.mjs +0 -0
  178. package/dist/types/RealtimeTypes.d.ts +11 -0
  179. package/dist/types/SchemaTypes.d.ts +56 -0
  180. package/dist/types/ServerAdapterTypes.d.ts +345 -0
  181. package/dist/types/ServerAdapterTypes.mjs +0 -0
  182. package/dist/types/ServerConfigTypes.d.ts +527 -0
  183. package/dist/types/ServerConfigTypes.mjs +0 -0
  184. package/dist/types/ServerLogTypes.d.ts +119 -0
  185. package/dist/types/ServerLogTypes.mjs +0 -0
  186. package/dist/types/ServerTypes.d.ts +30 -1215
  187. package/dist/types/StoreTypes.d.ts +39 -1
  188. package/dist/types/TestTypes.d.ts +249 -0
  189. package/dist/types/TestTypes.mjs +0 -0
  190. package/dist/types/index.d.ts +6 -0
  191. package/eslint.config.mjs +3 -1
  192. package/package.json +2 -2
  193. package/setupTests.ts +4 -3
  194. package/dist/project/layout.mjs +0 -394
@@ -0,0 +1,246 @@
1
+ import { SSRRequest, SSRResponseHelpers } from './ServerTypes';
2
+ /** A key/value store with per-entry expiry, backing the OAuth layer's short-lived protocol state (registered
3
+ * clients, authorization codes, refresh grants). Values are opaque strings the SDK serialises itself. A
4
+ * multi-replica deployment MUST inject a shared implementation — a code minted on one replica is redeemed on
5
+ * whichever replica the token request lands on. */
6
+ export type OAuthStore = {
7
+ put: (key: string, value: string, ttlSeconds: number) => void | Promise<void>;
8
+ get: (key: string) => (string | undefined) | Promise<string | undefined>;
9
+ drop: (key: string) => void | Promise<void>;
10
+ };
11
+ /** Someone who got through {@link OAuthAdapters.authenticate}. `id` is what the other adapters key off; `label`
12
+ * is shown back on the consent screen so the user can see who they are about to grant access as. */
13
+ export type OAuthUser = {
14
+ id: string;
15
+ label: string;
16
+ };
17
+ /** One thing the user may grant the client access to — a Plitzi space, or whatever else a deployment scopes its
18
+ * tokens by. `value` is the opaque handle the SDK round-trips back to {@link OAuthAdapters.issueToken}; only the
19
+ * consumer interprets it. A deployment whose public surface is useful on its own (plitzi_render needs no space)
20
+ * can offer a target that grants nothing, so the user is never forced to pick one. */
21
+ export type OAuthGrantTarget = {
22
+ value: string;
23
+ label: string;
24
+ description?: string;
25
+ };
26
+ /** What the OAuth layer cannot resolve on its own: who the user is, what they may grant, and the bearer to mint
27
+ * for them. The SDK owns the protocol (discovery, registration, PKCE, code exchange); the consumer owns identity
28
+ * and issues a token its own `adapters.getGrant` will accept back. */
29
+ export type OAuthAdapters = {
30
+ /**
31
+ * Who the browser making this request already is, from whatever session it carries.
32
+ *
33
+ * This server has no sign-in of its own: it reads an existing session and sends anyone it cannot identify to
34
+ * {@link OAuthConfig.signInUrl}, which brings them back. That is what lets a deployment have ONE sign-in screen
35
+ * for every surface — and it is what makes SSO somebody else's problem, because whatever established the
36
+ * session is no longer this flow's business.
37
+ *
38
+ * It replaced a username/password form this server used to render and check itself. Two sign-ins against one
39
+ * account store is two places to add a provider, to rate-limit, and to get a password check subtly wrong.
40
+ *
41
+ * Return undefined for "nobody is signed in". Never throw for that — an unreadable session is the ordinary
42
+ * first visit.
43
+ */
44
+ identify: (req: SSRRequest) => Promise<OAuthUser | undefined>;
45
+ /**
46
+ * What this user may grant access to. An empty list ends the flow with `access_denied`.
47
+ *
48
+ * `request.scope` is what the client asked for, so one deployment can offer different choices to different
49
+ * clients — a native client signing in as the person, and the same client asking which space to work in.
50
+ */
51
+ grantTargets: (user: OAuthUser, request: {
52
+ scope?: string;
53
+ }) => Promise<OAuthGrantTarget[]>;
54
+ /**
55
+ * End whatever session {@link OAuthAdapters.identify} was reading, so the person can connect as somebody else.
56
+ *
57
+ * Optional, and its absence is what takes the offer off the grant screen: a deployment that cannot end a session
58
+ * from here should not show a button that pretends to. Clear the cookies on `res` and revoke at the source —
59
+ * forgetting the cookie alone leaves the credential working for anyone who already copied it.
60
+ *
61
+ * Whoever reaches that screen arrived from another application, so this is the only way out of the wrong account
62
+ * that does not mean abandoning the connection and starting over from the host.
63
+ */
64
+ signOut?: (req: SSRRequest, res: SSRResponseHelpers) => void | Promise<void>;
65
+ /** Mint the bearer the client will send on every request. Return undefined to deny the grant. */
66
+ issueToken: (user: OAuthUser, target: OAuthGrantTarget, context: OAuthIssueContext) => Promise<{
67
+ token: string;
68
+ expiresInSeconds?: number;
69
+ } | undefined>;
70
+ /**
71
+ * End a credential {@link OAuthAdapters.issueToken} minted, when its grant is revoked (RFC 7009).
72
+ *
73
+ * Optional, for a credential that ends on its own. Without it, revoking a grant stops it being RENEWED, and what
74
+ * was already issued keeps working until it expires — which a person who just signed a device out reads as the
75
+ * sign-out not having happened, because the device is still there in their list.
76
+ */
77
+ revokeToken?: (credential: string) => Promise<void>;
78
+ store: OAuthStore;
79
+ };
80
+ /**
81
+ * Who a credential is being issued to, beyond the person: which application, from where, and — on a renewal — which
82
+ * credential it takes the place of.
83
+ *
84
+ * This is what lets a deployment tell its user WHICH of their devices a credential lives on. The application names
85
+ * itself when it registers (RFC 7591 `client_name`, `software_id`); the request is the one the credential is being
86
+ * issued on — at consent, the person's browser, which for a loopback client is the same machine.
87
+ */
88
+ export type OAuthIssueContext = {
89
+ client: {
90
+ clientId: string;
91
+ /** What the application registered as: `Plitzi CLI on dev-laptop`, `Claude`. */
92
+ name: string;
93
+ /** RFC 7591 `software_id`, when it sent one: a stable name for the SOFTWARE, the same on every machine. */
94
+ softwareId?: string;
95
+ };
96
+ request?: {
97
+ userAgent?: string;
98
+ ip?: string;
99
+ };
100
+ /**
101
+ * Where the code of THIS grant is sent: the `redirect_uri` of the authorization request, at consent. A deployment
102
+ * whose credential is only good at certain addresses checks it here — registering a client is open to anybody, and
103
+ * the address it names is the one thing that says who will receive what the person agreed to. Absent on a renewal.
104
+ */
105
+ redirectUri?: string;
106
+ /**
107
+ * The credential this grant last issued, on a renewal. A deployment that keeps a row per credential updates that
108
+ * row rather than adding one, so a device renewing every hour stays one device.
109
+ */
110
+ replaces?: string;
111
+ };
112
+ /** A connection a visitor may take WITHOUT signing in, for a server whose public surface needs no identity — the
113
+ * MCP App, the tool and resource listings, the guide. The consent screen offers it as a second button beside the
114
+ * sign-in, and the grant is whatever `target` grants: point it at a target that carries no space, never at one
115
+ * that does, since nobody proved who they are. */
116
+ export type OAuthGuestConfig = {
117
+ /** Handed straight to {@link OAuthAdapters.issueToken} when a visitor takes the guest connection. */
118
+ target: OAuthGrantTarget;
119
+ /** Button text. Defaults to 'Continue without an account'. */
120
+ label?: string;
121
+ /** Who the grant is issued as. Defaults to `{ id: 'guest', label: 'Guest' }`. */
122
+ user?: OAuthUser;
123
+ };
124
+ /** What the grant screen shows around the form. */
125
+ export type OAuthBranding = {
126
+ /** Shown as the heading, e.g. 'Plitzi'. Defaults to 'Plitzi'. */
127
+ productName?: string;
128
+ /** Absolute or same-origin URL of a logo to show above the heading. */
129
+ logoUrl?: string;
130
+ /** Extra CSS appended to the page's own, for a deployment that wants its own look without replacing the page. */
131
+ css?: string;
132
+ };
133
+ /**
134
+ * Everything the GRANT screen needs to render itself.
135
+ *
136
+ * One screen, and deliberately only one: this server asks what to connect, never who somebody is. Signing in
137
+ * happens on {@link OAuthConfig.signInUrl}, wherever the deployment keeps it.
138
+ */
139
+ export type OAuthConsentView = {
140
+ /** Where the form must POST to (the authorize endpoint). */
141
+ action: string;
142
+ /** Hidden fields the form MUST round-trip verbatim, or the flow cannot be resumed. */
143
+ hidden: Record<string, string>;
144
+ /** What this account may grant. Empty for a visitor who has not signed in, who is offered `guest` instead. */
145
+ targets: OAuthGrantTarget[];
146
+ /**
147
+ * Offered when the deployment allows a guest connection. The form submits a `guest` field for it (any non-empty
148
+ * value), which is what tells the server to grant the guest target rather than a chosen one.
149
+ *
150
+ * It is the reason an unidentified visitor is shown this screen at all rather than being sent straight to
151
+ * sign-in: a guest has no session and never will, so a redirect they cannot come back from would take the
152
+ * option away entirely.
153
+ */
154
+ guest?: {
155
+ label: string;
156
+ description?: string;
157
+ };
158
+ /** Who is signed in. Absent for a visitor taking the guest connection. */
159
+ user?: OAuthUser;
160
+ /** Where to send somebody who wants to sign in first. Shown when `user` is absent. */
161
+ signInUrl?: string;
162
+ /**
163
+ * Whether to offer "use another account" — shown only when the deployment can act on it, which means it supplied
164
+ * {@link OAuthAdapters.signOut}.
165
+ *
166
+ * A submit BUTTON in the same form rather than a link, and that is not decoration. Ending a session is a state
167
+ * change, so it may not hang off a URL anything can navigate to: a `<img src>` on any page on the internet would
168
+ * then be able to sign a visitor out. Posting it here keeps it a same-origin form submission carrying the request
169
+ * back, exactly like granting does.
170
+ */
171
+ canSwitchUser?: boolean;
172
+ /** A message to show the user. */
173
+ error?: string;
174
+ /**
175
+ * Who is asking, and where the grant goes if the person says yes.
176
+ *
177
+ * Anybody can register a client, call it anything and send somebody this screen on the deployment's own domain, so
178
+ * the name alone proves nothing. The host the code is sent back to is the one fact the requester cannot choose
179
+ * freely, and it is what tells "the app I just opened" apart from a stranger's server.
180
+ */
181
+ client: {
182
+ /** What the client registered itself as. Chosen by the client, so it is shown as a claim. */
183
+ name: string;
184
+ /** The host of the `redirect_uri` the grant is delivered to. */
185
+ redirectHost: string;
186
+ /** The grant goes back to an app listening on this computer (RFC 8252 loopback), not to a server. */
187
+ loopback: boolean;
188
+ };
189
+ branding: OAuthBranding;
190
+ };
191
+ /** OAuth 2.1 authorization for the MCP server (RFC 9728 discovery + RFC 7591 dynamic client registration +
192
+ * authorization code with PKCE). ENTIRELY OPTIONAL: without this config no endpoint is mounted, discovery keeps
193
+ * answering 404 and the server stays anonymous, which is a working setup — the public surface (handshake, tool
194
+ * and resource listing, the guide, plitzi_render) never needed a token. Configure it only to let a remote host
195
+ * that cannot send custom headers — Claude Desktop, ChatGPT — obtain a space-scoped one.
196
+ *
197
+ * Configuring it also protects the MCP endpoint: a JSON-RPC call that presents no verifiable bearer is answered
198
+ * with RFC 6750's 401 challenge rather than the anonymous surface, because that 401 is the only thing a host runs
199
+ * its flow off — it ignores a `WWW-Authenticate` header on a 200, and a server that never sends one is treated as
200
+ * needing no authorization at all, leaving a completed grant with nowhere to attach. Offer a grant target that
201
+ * carries no space ({@link OAuthGrantTarget}) so the public surface stays one consent away. */
202
+ export type OAuthConfig = {
203
+ adapters: OAuthAdapters;
204
+ /** The issuer/resource identifier published in the metadata documents. Defaults to the origin the request came
205
+ * in on, which is correct whenever the server owns its sub-domain; set it when a proxy rewrites the host. */
206
+ issuer?: string;
207
+ /** Scope names advertised and echoed back on the token. Defaults to ['plitzi']. */
208
+ scopes?: string[];
209
+ /** How long an authorization code stays redeemable, in seconds. Default 60 — codes are one-shot and redeemed
210
+ * immediately. */
211
+ codeTtlSeconds?: number;
212
+ /** How long a refresh grant lives, in seconds. Default 30 days. Set 0 to issue no refresh tokens. */
213
+ refreshTtlSeconds?: number;
214
+ /** Offer a connection that needs no account — see {@link OAuthGuestConfig}. Omit to require sign-in. */
215
+ guest?: OAuthGuestConfig;
216
+ branding?: OAuthBranding;
217
+ /**
218
+ * The sign-in screen this server sends unidentified visitors to.
219
+ *
220
+ * The whole authorization request rides along as a `redirect` query param, so signing in is an ordinary
221
+ * navigation that lands back on the `/authorize` it left — this server keeps no session of its own for a flow
222
+ * that is one page long.
223
+ *
224
+ * Required, because {@link OAuthAdapters.identify} is: a server that does not check passwords and has nowhere
225
+ * to send somebody who has not signed in cannot start the flow at all.
226
+ */
227
+ signInUrl: string;
228
+ /**
229
+ * Hand the client the credential `issueToken` minted, instead of an opaque handle to it.
230
+ *
231
+ * Off by default, which is right whenever the credential is worth more than the connection — a space token
232
+ * reaches the platform, and a client that never holds one cannot leak one. Turn it ON when the credential IS
233
+ * what the client should hold: a native app granted the person's own session is holding exactly what a browser
234
+ * holds, and wrapping it costs a store read on every request and gives a second thing to revoke.
235
+ */
236
+ directTokens?: boolean;
237
+ /**
238
+ * Accept only loopback `redirect_uri`s (`http://127.0.0.1:<port>/…`, RFC 8252 §7.3), at registration and again at
239
+ * `/authorize`.
240
+ *
241
+ * Turn it on when every client is a native app on the person's own machine — a CLI, a desktop app — and above all
242
+ * with {@link directTokens}, where the grant IS the person's session. Registration is open to anybody, so with https
243
+ * redirects allowed a stranger's server can register, send somebody the link, and collect what they approve.
244
+ */
245
+ loopbackRedirectsOnly?: boolean;
246
+ };
File without changes
@@ -6,6 +6,8 @@ export type PluginSchema = {
6
6
  builder: PluginBuilder;
7
7
  initialItems?: string[];
8
8
  definition: Element['definition'];
9
+ /** The attributes a role that edits the content and not the design may change; none, it may change none. */
10
+ contentAttributes?: string[];
9
11
  defaultStyle: {
10
12
  name: string;
11
13
  displayMode: DisplayMode;
@@ -0,0 +1,71 @@
1
+ import { OfflineDataRaw } from './SdkTypes';
2
+ /** A short-TTL, one-shot store for unsaved draft offline-data behind a preview token. The SDK ships an
3
+ * in-memory default (fine for a single replica); a multi-replica deployment injects a shared (e.g. Redis)
4
+ * implementation so a preview URL resolves on whichever replica the browser lands on. `take` consumes the
5
+ * token so a preview URL is not replayable. */
6
+ /**
7
+ * How long a stashed draft lives, and whether looking at it uses it up.
8
+ *
9
+ * `reusable: false` is the capture path: one token, one render, gone — a URL that leaks buys nobody a second look.
10
+ * `reusable: true` is somebody ITERATING: they reload, they open devtools, they navigate to the next page and back,
11
+ * and a token consumed by the first of those turns the whole loop into "mint another one". Same store, same secret,
12
+ * same expiry; the only difference is whether the read deletes it.
13
+ */
14
+ export type DraftPutOptions = {
15
+ ttlMs: number;
16
+ reusable?: boolean;
17
+ /** The space the draft was made from. It is only ever rendered for that space. */
18
+ spaceId: number;
19
+ /**
20
+ * A session a test runner plays: its pages carry the space's state bridge (`window.__plitzi`) with no panel or
21
+ * badge — what a journey sets its starting state and reads the state through.
22
+ */
23
+ inspected?: boolean;
24
+ };
25
+ /** A stashed draft, and whether the read that resolved it left it there. */
26
+ export type DraftEntry = {
27
+ data: OfflineDataRaw;
28
+ reusable: boolean;
29
+ /** The space the draft was made from — see {@link DraftPutOptions.spaceId}. */
30
+ spaceId: number;
31
+ /** Its pages carry the state bridge — see {@link DraftPutOptions.inspected}. */
32
+ inspected?: boolean;
33
+ };
34
+ export type DraftStore = {
35
+ put: (token: string, data: OfflineDataRaw, options: DraftPutOptions) => void | Promise<void>;
36
+ /**
37
+ * Resolves a draft, consuming it unless it was stored as reusable.
38
+ *
39
+ * It answers WHICH it was, rather than leaving the caller to infer it from a second read: the render that resolved
40
+ * a session is the one that has to remember it for the rest of the visit, and "did this token survive" is a fact
41
+ * the store holds and nobody else does.
42
+ */
43
+ take: (token: string) => (DraftEntry | undefined) | Promise<DraftEntry | undefined>;
44
+ /** Ends a reusable draft before its TTL — what "stop previewing" does. A token that is not there is not an error. */
45
+ drop: (token: string) => void | Promise<void>;
46
+ };
47
+ /** Draft-preview config for the MCP visual-preview tools. When enabled, an internal endpoint at `path`
48
+ * (guarded by `secret`) applies unsaved edits to a clone, stashes the resulting offline-data under a
49
+ * one-shot token, and the render path serves it back at `?__pt=<token>`. Off by default. */
50
+ export type SSRPreviewConfig = {
51
+ enabled?: boolean;
52
+ /** Internal endpoint path that mints a preview token. Default '/__preview'. */
53
+ path?: string;
54
+ /**
55
+ * Shared secret required in the `x-preview-secret` header; requests without it are rejected.
56
+ *
57
+ * Required for the endpoint to answer at all: the page server that hosts it is the one the public reaches, so an
58
+ * enabled endpoint with no secret refuses every request rather than serving anyone.
59
+ */
60
+ secret?: string;
61
+ /** One-shot token time-to-live in milliseconds. Default 60000. */
62
+ ttlMs?: number;
63
+ /**
64
+ * How long a REUSABLE draft session lives, in milliseconds. Default 900000 (fifteen minutes).
65
+ *
66
+ * Longer than a one-shot token because it is measured against a person's attention rather than an HTTP round trip,
67
+ * and short anyway: a draft is unsaved work that only its author should be looking at, and every minute it stays
68
+ * resolvable is a minute a copied URL keeps working.
69
+ */
70
+ sessionTtlMs?: number;
71
+ };
File without changes
@@ -67,6 +67,11 @@ export type RealtimeMessage = RealtimeSender & {
67
67
  * every page that joins. The newest of a type is the one that holds; `null` data forgets it.
68
68
  */
69
69
  retained?: true;
70
+ /**
71
+ * Said again, not now: a kept message handed to a page as it joins. A moment — a room opened, a show started — is
72
+ * heard once, as it is said; a flow answers it only `when` it is not `replayed`. What it keeps holds either way.
73
+ */
74
+ replayed?: true;
70
75
  };
71
76
  /** What a page asks of a publish beyond the message itself. */
72
77
  export type RealtimePublishOptions = {
@@ -116,4 +121,10 @@ export type SSRRealtimeConfig = {
116
121
  * socket carries the visitor's cookies from any site, so every other origin is refused.
117
122
  */
118
123
  allowedOrigins?: string[];
124
+ /**
125
+ * Whether a space may open the channels it declares — a deployment's policy (a plan that does not include them,
126
+ * say). A refusal's words are what the page is answered with (HTTP 402); omitted, every space may. The
127
+ * platform's own topics (a job's) are not asked about.
128
+ */
129
+ admitSpace?: (spaceId: number) => Promise<string | undefined>;
119
130
  } | false;
@@ -1,6 +1,7 @@
1
1
  import { InteractionCallbackParamValues, InteractionCallbackType } from './InteractionTypes';
2
2
  import { ChannelDeclarations } from './RealtimeTypes';
3
3
  import { SnippetStyle } from './SnippetTypes';
4
+ import { SpaceTests } from './TestTypes';
4
5
  import { BuiltinParam } from '../authoring/paramSpec';
5
6
  import { ElementMotion } from '../schema/motion';
6
7
  import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
@@ -219,6 +220,8 @@ export type Schema = {
219
220
  permanentUrl: string;
220
221
  };
221
222
  variables: SchemaVariable[];
223
+ /** The space's tests, kept with it and run against it: a snapshot and a publish need them passing. */
224
+ tests?: SpaceTests;
222
225
  /** Keyed by the name each is read by. A space that declares none has none — documents written before flags too. */
223
226
  flags?: Record<string, SchemaFlag>;
224
227
  settings: {
@@ -231,6 +234,12 @@ export type Schema = {
231
234
  * writes them.
232
235
  */
233
236
  transientState?: string[];
237
+ /**
238
+ * The only keys of `runtime.state` kept, with `keepState` on — the rest start fresh on every visit: a dismissed notice
239
+ * kept, a page's every other key left alone. The other way round from `transientState`, which names the keys to
240
+ * leave out; a space says one of the two. Top-level keys, as `setState` writes them.
241
+ */
242
+ keptState?: string[];
234
243
  /**
235
244
  * Keys of `runtime.state` the first paint depends on — the tool a toolbar shows, a name in an avatar — kept in a
236
245
  * cookie as well as in `stateStorage`, so the server renders with them and the page does not swap them in after
@@ -238,6 +247,51 @@ export type Schema = {
238
247
  * `keepState`; a key cannot be both painted and transient. Top-level keys, as `setState` writes them.
239
248
  */
240
249
  paintedState?: string[];
250
+ /**
251
+ * The space's `/robots.txt`, as search engines read it: what they may crawl, and where its sitemap is. Left out, the
252
+ * server answers that everything may be — `User-agent: *` then `Allow: /`. A page kept out of search says it on the
253
+ * page (`robots: 'noindex'`): a crawler barred from a page by this file never reads that page's own word.
254
+ */
255
+ robotsTxt?: string;
256
+ /**
257
+ * Keeps the crawlers that gather pages to train AI models (`AI_CRAWLERS`: GPTBot, ClaudeBot, Google-Extended…) out of
258
+ * the whole site: `/robots.txt` says `Disallow: /` to each, after whatever `robotsTxt` says. Search engines keep
259
+ * reading it. Left out, nobody is kept out.
260
+ */
261
+ blockAiCrawlers?: boolean;
262
+ /**
263
+ * A move from page to page drawn as one view becoming the next (the browser's view transitions): the pages cross-fade,
264
+ * and an element named the same on both by CSS — `view-transition-name: fighter-portrait` — moves from where it was
265
+ * to where it lands. Where the browser has none, or the visitor asks for less motion, the page changes at once.
266
+ */
267
+ viewTransitions?: boolean;
268
+ /**
269
+ * The site's name where a link to it is shown — a chat's preview, a search result — beside each page's own title
270
+ * (`og:site_name`).
271
+ */
272
+ siteName?: string;
273
+ /**
274
+ * The page of the space a page withheld from its visitor shows instead of the platform's refusal — by its id: drawn
275
+ * inside the withheld page's own layout and sent with the same 401 or 403; `auth.isAuthenticated` tells "sign in" from "not
276
+ * yours" there, as on any page. Left out, the platform's few words. A page with an `access` of its own cannot be it.
277
+ */
278
+ withheldPage?: string;
279
+ /** The language its pages are written in, as a language tag (`en`, `es-MX`): `<html lang>` and `og:locale`. */
280
+ language?: string;
281
+ /** The tab's icon: a file of the site (`/favicon.svg`) or an address (`https://…`). Left out, Plitzi's. */
282
+ favicon?: string;
283
+ /**
284
+ * The picture a link to a page shows when the page names none of its own — a chat's preview card, a post. A file of
285
+ * the site or an address, about 1200×630; each page's `seoImage` wins over it.
286
+ */
287
+ shareImage?: string;
288
+ /**
289
+ * The colour a phone's browser paints around the page (`<meta name="theme-color">`): one colour, or one a scheme.
290
+ */
291
+ themeColor?: string | {
292
+ light?: string;
293
+ dark?: string;
294
+ };
241
295
  customCss: string;
242
296
  /**
243
297
  * The roles a signed-in visitor may hold in this space, each with the permissions it gives:
@@ -255,6 +309,8 @@ export type Schema = {
255
309
  userUrl?: string;
256
310
  refreshUrl?: string;
257
311
  logoutUrl?: string;
312
+ /** Where the person's sessions end on every device (`{ scope }` posted): `authLogoutEverywhere`'s, for `basic`. */
313
+ revokeUrl?: string;
258
314
  detailsPath?: string;
259
315
  tokenPath?: string;
260
316
  refreshTokenPath?: string;