@spacefast/common 0.0.13 → 0.0.18

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 (154) hide show
  1. package/dist/agents/client-registry.d.ts +22 -0
  2. package/dist/agents/client-registry.js +41 -0
  3. package/dist/agents/connect-targets.d.ts +51 -6
  4. package/dist/agents/connect-targets.js +93 -28
  5. package/dist/brand.d.ts +0 -11
  6. package/dist/brand.js +0 -20
  7. package/dist/config/domains.d.ts +15 -6
  8. package/dist/config/domains.js +24 -10
  9. package/dist/config/postgres-budget.d.ts +3 -0
  10. package/dist/config/postgres-budget.js +6 -1
  11. package/dist/config/postgres-budget.json +2 -1
  12. package/dist/contracts/abuse.js +1 -1
  13. package/dist/contracts/access.d.ts +149 -44
  14. package/dist/contracts/access.js +94 -8
  15. package/dist/contracts/activity.js +5 -1
  16. package/dist/contracts/api-keys.js +9 -9
  17. package/dist/contracts/archives.js +11 -11
  18. package/dist/contracts/beta.js +1 -1
  19. package/dist/contracts/builds.js +14 -14
  20. package/dist/contracts/channels.js +2 -2
  21. package/dist/contracts/comments.d.ts +86 -15
  22. package/dist/contracts/comments.js +116 -20
  23. package/dist/contracts/common.d.ts +12 -12
  24. package/dist/contracts/common.js +33 -30
  25. package/dist/contracts/continuation.js +5 -5
  26. package/dist/contracts/data-source-routes.js +1 -1
  27. package/dist/contracts/device-auth.d.ts +6 -6
  28. package/dist/contracts/device-auth.js +12 -12
  29. package/dist/contracts/docs.d.ts +10 -10
  30. package/dist/contracts/domains.js +39 -33
  31. package/dist/contracts/enums.d.ts +2 -10
  32. package/dist/contracts/enums.js +0 -2
  33. package/dist/contracts/error-code-meta.d.ts +116 -47
  34. package/dist/contracts/error-code-meta.js +37 -16
  35. package/dist/contracts/error-codes.d.ts +7 -4
  36. package/dist/contracts/error-codes.js +46 -21
  37. package/dist/contracts/events.d.ts +10 -3
  38. package/dist/contracts/events.js +33 -5
  39. package/dist/contracts/execution.d.ts +26 -0
  40. package/dist/contracts/execution.js +21 -0
  41. package/dist/contracts/feature-lifecycle.d.ts +21 -24
  42. package/dist/contracts/feature-lifecycle.js +28 -26
  43. package/dist/contracts/features.js +4 -4
  44. package/dist/contracts/functions.d.ts +8 -140
  45. package/dist/contracts/functions.js +9 -19
  46. package/dist/contracts/git.d.ts +1 -1
  47. package/dist/contracts/grants.d.ts +96 -79
  48. package/dist/contracts/grants.js +130 -43
  49. package/dist/contracts/ids.d.ts +2 -2
  50. package/dist/contracts/ids.js +2 -4
  51. package/dist/contracts/internal.js +2 -2
  52. package/dist/contracts/mcp.d.ts +17 -556
  53. package/dist/contracts/mcp.js +9 -103
  54. package/dist/contracts/me.js +3 -4
  55. package/dist/contracts/notifications.d.ts +108 -0
  56. package/dist/contracts/notifications.js +54 -0
  57. package/dist/contracts/oauth-resources.d.ts +18 -1
  58. package/dist/contracts/oauth-resources.js +22 -2
  59. package/dist/contracts/operations.d.ts +2 -50
  60. package/dist/contracts/operations.js +0 -19
  61. package/dist/contracts/pages.d.ts +8 -4
  62. package/dist/contracts/pages.js +16 -3
  63. package/dist/contracts/platform.js +10 -8
  64. package/dist/contracts/problem-document.d.ts +14 -0
  65. package/dist/contracts/problem-document.js +35 -0
  66. package/dist/contracts/push-new.d.ts +21 -6
  67. package/dist/contracts/push-new.js +3 -7
  68. package/dist/contracts/resources.d.ts +8 -7
  69. package/dist/contracts/resources.js +9 -6
  70. package/dist/contracts/runtime-api.d.ts +162 -92
  71. package/dist/contracts/runtime-api.js +99 -27
  72. package/dist/contracts/runtime-app.d.ts +41 -11
  73. package/dist/contracts/runtime-app.js +22 -1
  74. package/dist/contracts/runtime-db.d.ts +424 -0
  75. package/dist/contracts/runtime-db.js +108 -0
  76. package/dist/contracts/runtime-storage.d.ts +120 -0
  77. package/dist/contracts/runtime-storage.js +40 -0
  78. package/dist/contracts/sf-config-v1.d.ts +49 -1
  79. package/dist/contracts/sf-config-v1.js +2 -2
  80. package/dist/contracts/sites.d.ts +1 -0
  81. package/dist/contracts/sites.js +20 -12
  82. package/dist/contracts/space-config.d.ts +62 -22
  83. package/dist/contracts/space-config.js +173 -47
  84. package/dist/contracts/spaces.d.ts +79 -45
  85. package/dist/contracts/spaces.js +66 -50
  86. package/dist/contracts/superadmin-spaces.d.ts +13 -2
  87. package/dist/contracts/superadmin-spaces.js +15 -0
  88. package/dist/contracts/superadmin-tenants.js +4 -4
  89. package/dist/contracts/superadmin.d.ts +4 -0
  90. package/dist/contracts/superadmin.js +14 -1
  91. package/dist/contracts/tags.d.ts +17 -17
  92. package/dist/contracts/tags.js +1 -1
  93. package/dist/contracts/teams.js +25 -16
  94. package/dist/contracts/theme-json.js +1 -1
  95. package/dist/contracts/transfers.js +4 -4
  96. package/dist/contracts/variables.js +3 -3
  97. package/dist/contracts/zero.d.ts +204 -338
  98. package/dist/contracts/zero.js +94 -98
  99. package/dist/dashboard-paths/index.d.ts +16 -1
  100. package/dist/dashboard-paths/index.js +18 -0
  101. package/dist/docs/agent-handoff-document.d.ts +2 -2
  102. package/dist/docs/agent-handoff-document.js +8 -7
  103. package/dist/docs/agent-prose.d.ts +22 -3
  104. package/dist/docs/agent-prose.js +221 -51
  105. package/dist/docs/agent-setup.d.ts +13 -10
  106. package/dist/docs/agent-setup.js +279 -53
  107. package/dist/docs/agent-solutions.d.ts +6 -6
  108. package/dist/docs/agent-solutions.js +23 -21
  109. package/dist/docs/catalog.d.ts +29 -74
  110. package/dist/docs/catalog.js +65 -92
  111. package/dist/docs/error-docs.js +293 -221
  112. package/dist/docs/skill-distribution.d.ts +2 -0
  113. package/dist/docs/skill-distribution.js +7 -4
  114. package/dist/docs/skills.d.ts +546 -0
  115. package/dist/docs/skills.js +340 -0
  116. package/dist/utils/browser-credential.d.ts +19 -0
  117. package/dist/utils/browser-credential.js +62 -0
  118. package/dist/utils/comment-avatars.d.ts +7 -0
  119. package/dist/utils/comment-avatars.js +42 -0
  120. package/dist/utils/content-type.d.ts +3 -3
  121. package/dist/utils/content-type.js +38 -61
  122. package/dist/utils/domain-diagnostics.d.ts +5 -5
  123. package/dist/utils/domain-diagnostics.js +21 -10
  124. package/dist/utils/local-space-state.d.ts +78 -4
  125. package/dist/utils/local-space-state.js +383 -82
  126. package/dist/utils/one-shot-replay.d.ts +14 -0
  127. package/dist/utils/one-shot-replay.js +21 -0
  128. package/dist/utils/page-preview.d.ts +7 -0
  129. package/dist/utils/page-preview.js +9 -0
  130. package/dist/utils/pages.d.ts +2 -11
  131. package/dist/utils/pages.js +58 -14
  132. package/dist/utils/publish-form-data.d.ts +22 -0
  133. package/dist/utils/publish-form-data.js +26 -0
  134. package/dist/utils/publish-policy.js +20 -4
  135. package/dist/utils/query-keys.d.ts +7 -4
  136. package/dist/utils/query-keys.js +13 -4
  137. package/dist/utils/runtime-paths.d.ts +3 -0
  138. package/dist/utils/runtime-paths.js +7 -0
  139. package/dist/utils/secure-local-file.d.ts +73 -0
  140. package/dist/utils/secure-local-file.js +1373 -0
  141. package/dist/utils/space-config.d.ts +13 -4
  142. package/dist/utils/space-config.js +123 -15
  143. package/dist/utils/storage-policy.d.ts +20 -0
  144. package/dist/utils/storage-policy.fixtures.json +174 -0
  145. package/dist/utils/storage-policy.js +193 -0
  146. package/dist/utils/upload-session.d.ts +12 -1
  147. package/dist/utils/upload-session.js +37 -2
  148. package/dist/utils/version-file-browser.d.ts +13 -0
  149. package/dist/utils/version-file-browser.js +59 -0
  150. package/package.json +19 -1
  151. package/dist/contracts/mounts.d.ts +0 -142
  152. package/dist/contracts/mounts.js +0 -56
  153. package/dist/utils/asset-fingerprint.d.ts +0 -64
  154. package/dist/utils/asset-fingerprint.js +0 -620
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
- import { dataEnvelope } from "./common.js";
3
- import { appRoutePathSchema, EXECUTION_ENV_MAX_KEYS, executionBundleSchema, executionCapabilitiesSchema, executionEnvNameSchema, executionIdentifierSchema, executionInspectPolicySchema, executionLogEntrySchema, executionLogListQuerySchema, executionLogListResponseSchema, executionSha256Schema, executionStaticFileSchema, httpMethodSchema, PLATFORM_ROUTE_PREFIX, } from "./execution.js";
2
+ import { appRoutePathSchema, EXECUTION_ENV_MAX_KEYS, executionBundleSchema, executionCapabilitiesSchema, executionEnvNameSchema, executionIdentifierSchema, executionInspectPolicySchema, executionLogEntrySchema, executionLogListQuerySchema, executionLogListResponseSchema, executionSha256Schema, executionStaticFileSchema, httpMethodSchema, LAKEBED_SERVER_ENV_FILE, PLATFORM_ROUTE_PREFIX, runtimeRealtimeModeSchema, SERVER_ENV_FILE, } from "./execution.js";
4
3
  /**
5
4
  * Spacefast Zero: capsules — schema, queries, mutations and endpoints that run
6
5
  * together inside one parent-owned transaction — executed by the native runner
@@ -15,6 +14,11 @@ import { appRoutePathSchema, EXECUTION_ENV_MAX_KEYS, executionBundleSchema, exec
15
14
  export const ZERO_SOURCE_METADATA_KEY = "statticZero";
16
15
  export const ZERO_RUNTIME_KIND = "zero";
17
16
  export const ZERO_PLATFORM_ROUTE_PREFIX = `${PLATFORM_ROUTE_PREFIX}/zero`;
17
+ /**
18
+ * Entry paths the Zero scaffold writes into `sf.jsonc#runtime`. They are
19
+ * starting points, not the contract: a capsule's entries are whatever its
20
+ * `runtime.server`/`runtime.client` say, and nothing infers them.
21
+ */
18
22
  export const ZERO_CLIENT_ENTRY = "client/index.tsx";
19
23
  export const ZERO_SERVER_ENTRY = "server/index.ts";
20
24
  export const ZERO_RUNTIME_ROUTE_PATHS = {
@@ -24,7 +28,7 @@ export const ZERO_RUNTIME_ROUTE_PATHS = {
24
28
  db: `${ZERO_PLATFORM_ROUTE_PREFIX}/db`,
25
29
  logs: `${ZERO_PLATFORM_ROUTE_PREFIX}/logs`,
26
30
  run: `${ZERO_PLATFORM_ROUTE_PREFIX}/run`,
27
- authStart: `${ZERO_PLATFORM_ROUTE_PREFIX}/auth/wpcom/start`,
31
+ authStart: `${ZERO_PLATFORM_ROUTE_PREFIX}/auth/gravatar/start`,
28
32
  authSignOut: `${ZERO_PLATFORM_ROUTE_PREFIX}/auth/sign-out`,
29
33
  };
30
34
  export const ZERO_RUNTIME_STORAGE_ROOT = "__spacefast/zero";
@@ -35,10 +39,18 @@ export const ZERO_RUNTIME_BINARY_COMPATIBILITY_TARGET = "wpcloud-linux-x86_64-gn
35
39
  export const ZERO_RUNTIME_BUNDLE_ROOT = `${ZERO_RUNTIME_STORAGE_ROOT}/bundles`;
36
40
  export const ZERO_RUNTIME_CLIENT_BUNDLE_PATH = `${ZERO_RUNTIME_BUNDLE_ROOT}/client.js`;
37
41
  export const ZERO_RUNTIME_SERVER_BUNDLE_PATH = `${ZERO_RUNTIME_BUNDLE_ROOT}/server.qjs.mjs`;
38
- export const ZERO_SOURCE_ENV_FILE = ".env.zero.server";
39
- export const ZERO_CONFIG_FILE = "zero.json";
40
- export const ZERO_DEPLOY_FILE = ".zero/deploy.json";
41
42
  export const ZERO_RUNTIME_BUNDLE_MAX_BYTES = 786_432;
43
+ /**
44
+ * A capsule's compiled server travels as version metadata, not as content, so a
45
+ * server-only change leaves the published app shell byte-identical — and the
46
+ * version intent's manifest comparison would read it as "no changes" and never
47
+ * deploy it. The publish writes this one small file into the version instead:
48
+ * it holds a digest of everything the deploy would install, so any server,
49
+ * schema, or runtime-config change moves the manifest. Same channel a Functions
50
+ * bundle uses (`functionsBundleStoragePath`) — an ordinary manifest entry, no
51
+ * artifact-specific plumbing.
52
+ */
53
+ export const ZERO_RUNTIME_DEPLOY_PATH = `${ZERO_RUNTIME_STORAGE_ROOT}/deploy.json`;
42
54
  export const ZERO_MANAGED_TABLE_COLUMNS = ["id", "createdAt", "updatedAt"];
43
55
  /**
44
56
  * Paths the Zero app shell itself answers, on top of the platform-reserved set
@@ -150,12 +162,44 @@ export const zeroTableColumnSchema = z
150
162
  })
151
163
  .strict()
152
164
  .superRefine(zeroDefaultMatchesColumnType);
165
+ export const zeroTableIndexSchema = z
166
+ .object({
167
+ name: zeroNameSchema.refine((name) => name !== "by_creation", {
168
+ message: "by_creation is a built-in Zero index.",
169
+ }),
170
+ fields: z.array(zeroNameSchema).min(1),
171
+ })
172
+ .strict();
153
173
  export const zeroTableSchema = z
154
174
  .object({
155
175
  name: zeroNameSchema,
156
176
  columns: z.array(zeroTableColumnSchema).default([]),
177
+ indexes: z.array(zeroTableIndexSchema).default([]),
157
178
  })
158
- .strict();
179
+ .strict()
180
+ .superRefine((table, context) => {
181
+ const columnNames = new Set(table.columns.map((column) => column.name));
182
+ const indexNames = new Set();
183
+ for (const index of table.indexes) {
184
+ if (indexNames.has(index.name)) {
185
+ context.addIssue({
186
+ code: z.ZodIssueCode.custom,
187
+ message: `Zero table ${table.name} declares duplicate index ${index.name}.`,
188
+ path: ["indexes"],
189
+ });
190
+ }
191
+ indexNames.add(index.name);
192
+ for (const field of index.fields) {
193
+ if (!columnNames.has(field)) {
194
+ context.addIssue({
195
+ code: z.ZodIssueCode.custom,
196
+ message: `Zero index ${table.name}.${index.name} references unknown field ${field}.`,
197
+ path: ["indexes"],
198
+ });
199
+ }
200
+ }
201
+ }
202
+ });
159
203
  export const zeroDatabaseSchema = z.record(z.string(), zeroTableSchema);
160
204
  const zeroSha256Schema = executionSha256Schema;
161
205
  /**
@@ -216,10 +260,19 @@ export const zeroMigrationOperationSchema = z.discriminatedUnion("op", [
216
260
  .object({
217
261
  op: z.literal("add_index"),
218
262
  table: zeroNameSchema,
263
+ name: zeroNameSchema,
219
264
  columns: z.array(zeroNameSchema).min(1),
220
265
  unique: z.boolean().default(false),
221
266
  })
222
267
  .strict(),
268
+ z
269
+ .object({
270
+ op: z.literal("drop_index"),
271
+ table: zeroNameSchema,
272
+ name: zeroNameSchema,
273
+ explicit: z.literal("drop"),
274
+ })
275
+ .strict(),
223
276
  z
224
277
  .object({
225
278
  op: z.literal("drop_table"),
@@ -261,15 +314,6 @@ export const zeroMigrationPlanSchema = z
261
314
  operations: z.array(zeroMigrationOperationSchema),
262
315
  })
263
316
  .strict();
264
- const zeroRealtimeCanonicalModeSchema = z.enum(["stattic-central", "spacefast-cast", "local-dev"]);
265
- const zeroRuntimePublicRealtimeCanonicalModeSchema = z.enum([
266
- "stattic-central",
267
- "spacefast-cast",
268
- "local-dev",
269
- "local-websocket",
270
- ]);
271
- export const zeroRealtimeModeSchema = zeroRealtimeCanonicalModeSchema;
272
- export const zeroRuntimePublicRealtimeModeSchema = zeroRuntimePublicRealtimeCanonicalModeSchema;
273
317
  export const zeroInspectPolicySchema = executionInspectPolicySchema;
274
318
  const zeroRuntimePublicPathSchema = z.string().min(1).startsWith("/");
275
319
  const zeroHttpUrlSchema = z
@@ -288,7 +332,7 @@ const zeroRealtimeUrlSchema = z
288
332
  }, { message: "Realtime URL must use http, https, ws, or wss." });
289
333
  export const zeroRuntimePublicAuthConfigSchema = z
290
334
  .object({
291
- provider: z.literal("wpcom").default("wpcom"),
335
+ provider: z.literal("gravatar").default("gravatar"),
292
336
  signInPath: zeroRuntimePublicPathSchema.nullable().default(null),
293
337
  signInUrl: zeroHttpUrlSchema.nullable().default(null),
294
338
  signOutPath: zeroRuntimePublicPathSchema.nullable().default(null),
@@ -298,7 +342,7 @@ export const zeroRuntimePublicAuthConfigSchema = z
298
342
  .strict();
299
343
  export const zeroRuntimePublicRealtimeConfigSchema = z
300
344
  .object({
301
- mode: zeroRuntimePublicRealtimeModeSchema,
345
+ mode: runtimeRealtimeModeSchema,
302
346
  centralUrl: zeroRealtimeUrlSchema.nullable().default(null),
303
347
  path: zeroRuntimePublicPathSchema.optional(),
304
348
  replayPath: zeroRuntimePublicPathSchema.nullable().optional(),
@@ -306,6 +350,7 @@ export const zeroRuntimePublicRealtimeConfigSchema = z
306
350
  runPath: zeroRuntimePublicPathSchema.nullable().optional(),
307
351
  runUrl: zeroHttpUrlSchema.nullable().optional(),
308
352
  resourceKey: z.string().min(1).max(256).nullable().optional(),
353
+ ticketPath: zeroRuntimePublicPathSchema.nullable().optional(),
309
354
  socketPath: zeroRuntimePublicPathSchema.nullable().optional(),
310
355
  spaceId: z.string().min(1).nullable().optional(),
311
356
  versionId: z.string().min(1).nullable().optional(),
@@ -355,7 +400,7 @@ export const zeroRuntimeInstallProfileSchema = z
355
400
  .strict(),
356
401
  realtime: z
357
402
  .object({
358
- production: z.literal("stattic-central"),
403
+ production: z.literal("central"),
359
404
  local: z.literal("foreground-cli-ws"),
360
405
  })
361
406
  .strict(),
@@ -384,42 +429,23 @@ export const zeroSourceFileSchema = z
384
429
  .strict();
385
430
  export const zeroSourceManifestSchema = z
386
431
  .object({
432
+ // Declared in `sf.jsonc#runtime`, so the manifest records what the author
433
+ // named rather than a layout the builder assumed.
387
434
  entries: z
388
435
  .object({
389
- client: z.literal(ZERO_CLIENT_ENTRY),
390
- server: z.literal(ZERO_SERVER_ENTRY),
436
+ client: z.string().min(1),
437
+ server: z.string().min(1),
391
438
  })
392
439
  .strict(),
393
440
  sourceRoot: z.string().min(1),
394
441
  files: z.array(zeroSourceFileSchema).default([]),
395
442
  env: z
396
443
  .object({
397
- file: z.literal(ZERO_SOURCE_ENV_FILE),
444
+ file: z.enum([SERVER_ENV_FILE, LAKEBED_SERVER_ENV_FILE]),
398
445
  names: z.array(executionEnvNameSchema).max(EXECUTION_ENV_MAX_KEYS).default([]),
399
446
  })
400
447
  .nullable()
401
448
  .default(null),
402
- sourceConfig: z
403
- .object({
404
- configFile: z
405
- .object({
406
- path: z.literal(ZERO_CONFIG_FILE),
407
- appName: z.string().nullable().default(null),
408
- deployId: z.string().nullable().default(null),
409
- name: z.string().nullable().default(null),
410
- title: z.string().nullable().default(null),
411
- })
412
- .nullable()
413
- .default(null),
414
- deployFile: z
415
- .object({
416
- path: z.literal(ZERO_DEPLOY_FILE),
417
- keys: z.array(z.string()).default([]),
418
- })
419
- .nullable()
420
- .default(null),
421
- })
422
- .default({ configFile: null, deployFile: null }),
423
449
  })
424
450
  .strict();
425
451
  export const zeroCapsuleArtifactSchema = z
@@ -439,6 +465,7 @@ export const zeroCapsuleArtifactSchema = z
439
465
  schema: zeroDatabaseSchema.default({}),
440
466
  queries: z.array(zeroNameSchema).default([]),
441
467
  mutations: z.array(zeroNameSchema).default([]),
468
+ actions: z.array(zeroNameSchema).default([]),
442
469
  endpoints: z.array(zeroEndpointSchema).default([]),
443
470
  sockets: z.array(zeroNameSchema).default([]),
444
471
  })
@@ -451,7 +478,7 @@ export const zeroCapsuleArtifactSchema = z
451
478
  .strict(),
452
479
  realtime: z
453
480
  .object({
454
- mode: zeroRealtimeModeSchema,
481
+ mode: runtimeRealtimeModeSchema,
455
482
  mutationEvents: z.boolean().default(true),
456
483
  })
457
484
  .strict(),
@@ -478,7 +505,7 @@ export const zeroRuntimeFinalizePayloadSchema = z
478
505
  .strict(),
479
506
  realtime: z
480
507
  .object({
481
- mode: zeroRealtimeModeSchema,
508
+ mode: runtimeRealtimeModeSchema,
482
509
  centralUrl: zeroRealtimeUrlSchema.nullable().default(null),
483
510
  replayUrl: zeroHttpUrlSchema.nullable().default(null),
484
511
  castResourceKey: z.string().min(1).max(256).nullable().optional(),
@@ -493,7 +520,7 @@ export const zeroRuntimeFinalizePayloadSchema = z
493
520
  .strict(),
494
521
  auth: z
495
522
  .object({
496
- provider: z.literal("wpcom").default("wpcom"),
523
+ provider: z.literal("gravatar").default("gravatar"),
497
524
  signInPath: z.literal(ZERO_RUNTIME_ROUTE_PATHS.authStart).nullable().default(null),
498
525
  signInUrl: zeroHttpUrlSchema.nullable().default(null),
499
526
  signOutPath: z.literal(ZERO_RUNTIME_ROUTE_PATHS.authSignOut).nullable().default(null),
@@ -502,7 +529,7 @@ export const zeroRuntimeFinalizePayloadSchema = z
502
529
  })
503
530
  .strict()
504
531
  .default({
505
- provider: "wpcom",
532
+ provider: "gravatar",
506
533
  signInPath: null,
507
534
  signInUrl: null,
508
535
  signOutPath: null,
@@ -530,6 +557,7 @@ export const zeroRuntimeConfigSchema = zeroRuntimeFinalizePayloadSchema
530
557
  })
531
558
  .extend({
532
559
  variableValues: z.record(z.string(), z.string()).default({}),
560
+ databaseUrlSource: z.enum(["application", "provider"]).default("application"),
533
561
  })
534
562
  .strict();
535
563
  export const zeroDeployMetadataSchema = z
@@ -545,6 +573,13 @@ export const zeroDeployMetadataSchema = z
545
573
  * response already names as live, and repeating it would invite the two to
546
574
  * disagree. `artifactId` stays because it identifies the built capsule rather
547
575
  * than the publish that carries it.
576
+ *
577
+ * Every field is derived from the version's own finalize metadata, which is
578
+ * what makes this safe to answer for a space whose runtime is asleep,
579
+ * mid-move, or failing: nothing here costs a call to the space's origin. It is
580
+ * also why there are no counts of things listed here — a caller that wants
581
+ * `tables.length` can take it — and why the database is not a field: a capsule
582
+ * always owns one, so `runtimeKind: "zero"` already said so.
548
583
  */
549
584
  export const zeroAppSchema = z
550
585
  .object({
@@ -561,8 +596,17 @@ export const zeroAppSchema = z
561
596
  tables: z.array(z.string()).default([]),
562
597
  queries: z.array(z.string()).default([]),
563
598
  mutations: z.array(z.string()).default([]),
599
+ actions: z.array(z.string()).default([]),
564
600
  endpoints: z.array(zeroEndpointSchema).default([]),
565
601
  sockets: z.array(z.string()).default([]),
602
+ /**
603
+ * Migrations are operations, not names — `create_table`, `add_column` and
604
+ * friends — so a count is the honest summary here. The operations
605
+ * themselves are the database surface's answer (`GET /v1/spaces/{id}/db`).
606
+ */
607
+ migrationCount: z.number().int().nonnegative(),
608
+ /** Digest of the schema the live migration plan settled on, if it ran one. */
609
+ schemaHash: zeroSha256Schema.nullable(),
566
610
  variables: z
567
611
  .object({
568
612
  source: z.literal("stattic-variables"),
@@ -572,39 +616,6 @@ export const zeroAppSchema = z
572
616
  realtime: zeroRuntimePublicRealtimeConfigSchema,
573
617
  })
574
618
  .strict();
575
- export const zeroDbInspectResponseSchema = z
576
- .object({
577
- versionId: z.string().min(1).nullable(),
578
- artifactId: z.string().min(1).nullable(),
579
- backend: z.literal("wpcloud-mysql").nullable(),
580
- migrationMode: z.enum(["safe", "drop", "rename"]).nullable(),
581
- schemaHash: zeroSha256Schema.nullable(),
582
- tables: z.array(zeroTableSchema).default([]),
583
- migrations: z.array(zeroMigrationOperationSchema).default([]),
584
- })
585
- .strict();
586
- export const zeroDbInspectPublicResponseSchema = dataEnvelope(zeroDbInspectResponseSchema);
587
- export const zeroDbDumpQuerySchema = z
588
- .object({
589
- table: zeroNameSchema.optional(),
590
- limit: z.coerce.number().int().min(1).max(100).default(25),
591
- })
592
- .strict();
593
- export const zeroDbDumpTableSchema = z
594
- .object({
595
- name: zeroNameSchema,
596
- rows: z.array(z.record(z.string(), z.unknown())).default([]),
597
- })
598
- .strict();
599
- export const zeroDbDumpResponseSchema = z
600
- .object({
601
- versionId: z.string().min(1).nullable(),
602
- artifactId: z.string().min(1).nullable(),
603
- schemaHash: zeroSha256Schema.nullable(),
604
- tables: z.array(zeroDbDumpTableSchema).default([]),
605
- })
606
- .strict();
607
- export const zeroDbDumpPublicResponseSchema = dataEnvelope(zeroDbDumpResponseSchema);
608
619
  // Both products emit the same log shape; `handlerName` carries the mutation
609
620
  // name here and the worker handler name on Functions.
610
621
  export const zeroLogListQuerySchema = executionLogListQuerySchema;
@@ -618,22 +629,6 @@ export const zeroRealtimeEventIntakeResponseSchema = z
618
629
  duplicate: z.boolean().default(false),
619
630
  })
620
631
  .strict();
621
- export const zeroRealtimeEventListQuerySchema = z
622
- .object({
623
- afterEventId: z.string().min(1).optional(),
624
- limit: z.coerce.number().int().min(1).max(100).default(50),
625
- })
626
- .strict();
627
- export const zeroRealtimeEventListResponseSchema = z
628
- .object({
629
- data: z.array(zeroRealtimeEventSchema),
630
- pagination: z
631
- .object({
632
- nextCursor: z.string().min(1).nullable(),
633
- })
634
- .strict(),
635
- })
636
- .strict();
637
632
  export const zeroLocalDevPlanSchema = z
638
633
  .object({
639
634
  runtimeKind: z.literal(ZERO_RUNTIME_KIND),
@@ -664,6 +659,7 @@ export function createZeroCapsuleArtifact(input) {
664
659
  schema: input.schema ?? {},
665
660
  queries: input.queries ?? [],
666
661
  mutations: input.mutations ?? [],
662
+ actions: input.actions ?? [],
667
663
  endpoints: input.endpoints ?? [],
668
664
  sockets: input.sockets ?? [],
669
665
  },
@@ -672,7 +668,7 @@ export function createZeroCapsuleArtifact(input) {
672
668
  migrations: [],
673
669
  },
674
670
  realtime: {
675
- mode: input.realtimeMode ?? "stattic-central",
671
+ mode: input.realtimeMode ?? "central",
676
672
  mutationEvents: true,
677
673
  },
678
674
  limits: {},
@@ -712,7 +708,7 @@ export function createZeroRuntimeInstallProfile(input) {
712
708
  blockIncompatibleRollback: true,
713
709
  },
714
710
  realtime: {
715
- production: "stattic-central",
711
+ production: "central",
716
712
  local: "foreground-cli-ws",
717
713
  },
718
714
  });
@@ -12,11 +12,20 @@ export declare const TEAM_SLUG_ROUTE_RESERVATIONS: readonly ["accept-beta-invite
12
12
  * here before its route module lands. A repository structural test enforces
13
13
  * this.
14
14
  */
15
- export declare const SPACE_SLUG_ROUTE_RESERVATIONS: readonly ["billing", "connect", "domains", "drop", "members", "new", "settings"];
15
+ export declare const SPACE_SLUG_ROUTE_RESERVATIONS: readonly ["billing", "connect", "domains", "drop", "members", "new", "resume", "settings"];
16
16
  export type TeamSlugRouteReservation = (typeof TEAM_SLUG_ROUTE_RESERVATIONS)[number];
17
17
  export type SpaceSlugRouteReservation = (typeof SPACE_SLUG_ROUTE_RESERVATIONS)[number];
18
18
  export declare const TEAM_SLUG_ROUTE_RESERVATION_SET: ReadonlySet<string>;
19
19
  export declare const SPACE_SLUG_ROUTE_RESERVATION_SET: ReadonlySet<string>;
20
+ /**
21
+ * The Runtime page's sections. They are search params rather than path
22
+ * segments, so `runtime` stays a single route (and a single ledger row) and a
23
+ * space slugged "runtime" keeps its own Runtime page at
24
+ * `/<team>/runtime/runtime`.
25
+ */
26
+ export declare const SPACE_RUNTIME_SECTIONS: readonly ["overview", "database", "storage", "logs"];
27
+ export type SpaceRuntimeSection = (typeof SPACE_RUNTIME_SECTIONS)[number];
28
+ export declare const DEFAULT_SPACE_RUNTIME_SECTION: SpaceRuntimeSection;
20
29
  export type SpaceSettingsDestination = "access" | "advanced" | "builds" | "integrations" | "integrations/add" | "source-builds";
21
30
  export type TeamSettingsDestination = "access" | "audit" | "developer" | "developer/agents" | "developer/environment-variables" | "developer/handoffs" | "developer/webhooks" | "integrations";
22
31
  export declare function teamPath(teamSlug: string): string;
@@ -24,6 +33,12 @@ export declare function spacePath(teamSlug: string, spaceSlug: string): string;
24
33
  export declare function versionDetailPath(teamSlug: string, spaceSlug: string, versionRef: string): string;
25
34
  export declare function buildDetailPath(teamSlug: string, spaceSlug: string, buildId: string): string;
26
35
  export declare function spaceDomainsPath(teamSlug: string, spaceSlug: string): string;
36
+ /**
37
+ * The space's Runtime page. The default section is the bare URL — the route
38
+ * strips it back out of the address bar — so a link to "overview" and a link to
39
+ * the page itself are the same link.
40
+ */
41
+ export declare function spaceRuntimePath(teamSlug: string, spaceSlug: string, section?: SpaceRuntimeSection): string;
27
42
  export declare function spaceSettingsPath(teamSlug: string, spaceSlug: string, destination?: SpaceSettingsDestination): string;
28
43
  export declare function teamDomainsPath(teamSlug: string): string;
29
44
  export declare function teamBillingPath(teamSlug: string): string;
@@ -40,10 +40,19 @@ export const SPACE_SLUG_ROUTE_RESERVATIONS = [
40
40
  "drop",
41
41
  "members",
42
42
  "new",
43
+ "resume",
43
44
  "settings",
44
45
  ];
45
46
  export const TEAM_SLUG_ROUTE_RESERVATION_SET = new Set(TEAM_SLUG_ROUTE_RESERVATIONS);
46
47
  export const SPACE_SLUG_ROUTE_RESERVATION_SET = new Set(SPACE_SLUG_ROUTE_RESERVATIONS);
48
+ /**
49
+ * The Runtime page's sections. They are search params rather than path
50
+ * segments, so `runtime` stays a single route (and a single ledger row) and a
51
+ * space slugged "runtime" keeps its own Runtime page at
52
+ * `/<team>/runtime/runtime`.
53
+ */
54
+ export const SPACE_RUNTIME_SECTIONS = ["overview", "database", "storage", "logs"];
55
+ export const DEFAULT_SPACE_RUNTIME_SECTION = "overview";
47
56
  function dynamicSegment(value) {
48
57
  return encodeURIComponent(value);
49
58
  }
@@ -62,6 +71,15 @@ export function buildDetailPath(teamSlug, spaceSlug, buildId) {
62
71
  export function spaceDomainsPath(teamSlug, spaceSlug) {
63
72
  return `${spacePath(teamSlug, spaceSlug)}/domains`;
64
73
  }
74
+ /**
75
+ * The space's Runtime page. The default section is the bare URL — the route
76
+ * strips it back out of the address bar — so a link to "overview" and a link to
77
+ * the page itself are the same link.
78
+ */
79
+ export function spaceRuntimePath(teamSlug, spaceSlug, section = DEFAULT_SPACE_RUNTIME_SECTION) {
80
+ const root = `${spacePath(teamSlug, spaceSlug)}/runtime`;
81
+ return section === DEFAULT_SPACE_RUNTIME_SECTION ? root : `${root}?section=${section}`;
82
+ }
65
83
  export function spaceSettingsPath(teamSlug, spaceSlug, destination) {
66
84
  const root = `${spacePath(teamSlug, spaceSlug)}/settings`;
67
85
  return destination ? `${root}/${destination}` : root;
@@ -7,8 +7,8 @@ export declare function renderAgentHandoffDocumentMarkdown(input: {
7
7
  }): string;
8
8
  /**
9
9
  * The browser variant served at `/agent/<documentId>`: the full instructions in
10
- * the initial response body, zero scripts (nothing may ever read or echo the
11
- * URL fragment), same bytes for every ID.
10
+ * the initial response body, zero scripts (nothing may ever inspect or echo a
11
+ * handoff credential), same bytes for every ID.
12
12
  */
13
13
  export declare function renderAgentHandoffDocumentHtml(input: {
14
14
  mcpEndpoint: string;
@@ -1,9 +1,10 @@
1
1
  /*
2
2
  * The public setup document behind agent handoff links.
3
3
  *
4
- * Handoff links are `https://<dashboard-origin>/agent/<documentId>#<secret>` and
5
- * the minted prompt tells the agent to fetch that URL. Fragments never reach the
6
- * server, so this fetch is UNAUTHENTICATED BY DESIGN which means the response
4
+ * Private handoff links carry a one-use path token while the durable agent
5
+ * credential stays encrypted at the broker. The minted prompt tells the agent
6
+ * to fetch the reconstructed clean document URL instead. This
7
+ * fetch is UNAUTHENTICATED BY DESIGN — which means the response
7
8
  * must never become an existence oracle. The contract here is
8
9
  * indistinguishability: every well-formed document ID serves the exact same
9
10
  * bytes, with the same status and the same timing, whether or not a handoff with
@@ -21,7 +22,7 @@
21
22
  */
22
23
  import { buildConnectTargets } from "../agents/connect-targets.js";
23
24
  import { BRAND } from "../brand.js";
24
- import { AGENT_HANDOFF_BROWSER_APPROVAL_GUIDANCE, AGENT_HANDOFF_CLI_APPROVAL_GUIDANCE, AGENT_HANDOFF_CLI_TARGET_IDS, AGENT_HANDOFF_FETCH_SAFETY, AGENT_HANDOFF_FRAGMENT_HYGIENE, AGENT_HANDOFF_PREAMBLE, AGENT_HANDOFF_PUBLISH_PROSE, agentHandoffConnectSections, agentSetupTextUrl, } from "./agent-setup.js";
25
+ import { AGENT_HANDOFF_BROWSER_APPROVAL_GUIDANCE, AGENT_HANDOFF_CLI_APPROVAL_GUIDANCE, AGENT_HANDOFF_CLI_TARGET_IDS, AGENT_HANDOFF_CREDENTIAL_HYGIENE, AGENT_HANDOFF_FETCH_SAFETY, AGENT_HANDOFF_PREAMBLE, AGENT_HANDOFF_PUBLISH_PROSE, agentHandoffConnectSections, agentSetupTextUrl, } from "./agent-setup.js";
25
26
  const DOCUMENT_TITLE = `Set up ${BRAND.productName} from an agent handoff`;
26
27
  const DOCUMENT_SCOPE = `This is the public setup document for ${BRAND.productName} agent handoff links (\`/agent/<id>\` on the dashboard origin). Every link serves this same document — fetching it never uses a handoff and reveals nothing about one.`;
27
28
  const CONNECT_INTRO = "Set up the client you are running in. Each section stands on its own.";
@@ -49,7 +50,7 @@ export function renderAgentHandoffDocumentMarkdown(input) {
49
50
  AGENT_HANDOFF_FETCH_SAFETY,
50
51
  `From ${cliTargetNames.join(" or ")} (or any client with a shell): ${AGENT_HANDOFF_CLI_APPROVAL_GUIDANCE}`,
51
52
  `From every other client: ${AGENT_HANDOFF_BROWSER_APPROVAL_GUIDANCE}`,
52
- AGENT_HANDOFF_FRAGMENT_HYGIENE,
53
+ AGENT_HANDOFF_CREDENTIAL_HYGIENE,
53
54
  ].join("\n\n"),
54
55
  ["## Publish", AGENT_HANDOFF_PUBLISH_PROSE].join("\n\n"),
55
56
  `General agent instructions: ${agentSetupTextUrl}`,
@@ -155,8 +156,8 @@ pre code { background: none; padding: 0; font-size: 0.8125rem; }
155
156
  `.trim();
156
157
  /**
157
158
  * The browser variant served at `/agent/<documentId>`: the full instructions in
158
- * the initial response body, zero scripts (nothing may ever read or echo the
159
- * URL fragment), same bytes for every ID.
159
+ * the initial response body, zero scripts (nothing may ever inspect or echo a
160
+ * handoff credential), same bytes for every ID.
160
161
  */
161
162
  export function renderAgentHandoffDocumentHtml(input) {
162
163
  const markdown = renderAgentHandoffDocumentMarkdown(input);
@@ -9,19 +9,30 @@ export declare const EXPLAIN_TO_USER_PROSE: string;
9
9
  export declare const FAILURE_CONDUCT_PROSE: string;
10
10
  export declare const LANE_PICKER_PROSE: string;
11
11
  export declare const HOW_TO_RESEARCH_PROSE: string;
12
+ /** Curl/API skill lane: docs URLs only — no MCP or CLI tools required. */
13
+ export declare const HOW_TO_RESEARCH_API_PROSE: string;
14
+ /** MCP plugin skill lane: prefer skills for workflows and execute for the OpenAPI catalog. */
15
+ export declare const HOW_TO_RESEARCH_MCP_PROSE: string;
12
16
  export declare const ENV_NOTES_PROSE: string;
17
+ export declare const ENV_NOTES_API_PROSE: string;
13
18
  /**
14
19
  * The CHECK verb: before ever creating a space, look for the one the project
15
20
  * already has. This is what keeps a returning agent from pushing a duplicate
16
21
  * anonymous space instead of a new version.
17
22
  */
18
23
  export declare const CHECK_BEFORE_PUBLISH_PROSE: string;
24
+ export declare const CHECK_BEFORE_PUBLISH_API_PROSE: string;
25
+ export declare const CHECK_BEFORE_PUBLISH_MCP_PROSE: string;
19
26
  /**
20
27
  * The SAVE verb: persist the space id and credential after a first publish so
21
28
  * every later publish targets the same space. The CLI and On-Device MCP write
22
29
  * this state automatically; curl-only agents write the same files themselves.
23
30
  */
31
+ export declare const BUNDLED_SAVE_STATE_PROSE: string;
24
32
  export declare const SAVE_STATE_PROSE: string;
33
+ /** Curl/API skill: no CLI/MCP required to continue in-session. */
34
+ export declare const SAVE_STATE_API_PROSE: string;
35
+ export declare const SAVE_STATE_MCP_PROSE: string;
25
36
  /**
26
37
  * The UPDATE verb: a new version to the SAME space. Never re-run the
27
38
  * first-publish recipe when saved state exists.
@@ -33,9 +44,9 @@ export declare const UPDATE_SPACE_PROSE: string;
33
44
  */
34
45
  export declare const CONTINUE_AFTER_CLAIM_PROSE: string;
35
46
  /**
36
- * The zero-install publish sequence: one curl for a file, a secret-preflighted
37
- * zip for a folder. This is the load-bearing rung 0 — an agent that stops here
38
- * must still succeed.
47
+ * The zero-install publish sequence: a replay-safe curl loop for a file, a
48
+ * secret-preflighted zip for a folder. This is the load-bearing rung 0 — an
49
+ * agent that stops here must still succeed.
39
50
  */
40
51
  export declare const PUBLISH_SEQUENCE_PROSE: string;
41
52
  /**
@@ -65,11 +76,19 @@ export declare const AGENT_PROSE: {
65
76
  readonly receiptShape: string;
66
77
  readonly signedUpload: string;
67
78
  readonly checkBeforePublish: string;
79
+ readonly checkBeforePublishApi: string;
80
+ readonly checkBeforePublishMcp: string;
81
+ readonly bundledSaveState: string;
68
82
  readonly saveState: string;
83
+ readonly saveStateApi: string;
84
+ readonly saveStateMcp: string;
69
85
  readonly updateSpace: string;
70
86
  readonly continueAfterClaim: string;
71
87
  readonly lanePicker: string;
72
88
  readonly howToResearch: string;
89
+ readonly howToResearchApi: string;
90
+ readonly howToResearchMcp: string;
73
91
  readonly envNotes: string;
92
+ readonly envNotesApi: string;
74
93
  };
75
94
  export type AgentProseKey = keyof typeof AGENT_PROSE;