@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,11 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { AnyObjectSchema, dataEnvelope } from "./common.js";
3
3
  export const hostedMcpSessionStatusSchema = z.enum(["active", "closed", "expired", "interrupted"]);
4
- export const hostedMcpWorkspaceSummarySchema = z.object({
5
- files: z.number().int().nonnegative(),
6
- totalBytes: z.number().int().nonnegative(),
7
- updatedAt: z.string().datetime().nullable(),
8
- });
9
4
  export const hostedMcpSessionSchema = z.object({
10
5
  sessionId: z.string(),
11
6
  clientId: z.string().nullable(),
@@ -14,31 +9,16 @@ export const hostedMcpSessionSchema = z.object({
14
9
  scopes: z.array(z.string()),
15
10
  policy: z.object({
16
11
  credential: z.string(),
17
- approvals: z.string(),
18
12
  tools: z.string(),
19
13
  }),
20
14
  status: hostedMcpSessionStatusSchema,
21
15
  metadata: AnyObjectSchema.nullable(),
22
- workspace: hostedMcpWorkspaceSummarySchema,
23
16
  ownerId: z.string().nullable(),
24
17
  ownerLeaseExpiresAt: z.string().datetime().nullable(),
25
18
  createdAt: z.string().datetime(),
26
19
  lastSeenAt: z.string().datetime(),
27
20
  closedAt: z.string().datetime().nullable(),
28
21
  });
29
- export const hostedMcpApprovalSchema = z.object({
30
- id: z.string(),
31
- runtime: z.enum(["hosted", "local"]),
32
- tool: z.string(),
33
- args: AnyObjectSchema,
34
- preview: z.unknown(),
35
- status: z.enum(["pending", "approved", "denied", "consumed", "expired"]),
36
- decision: z.enum(["approve", "deny"]).nullable(),
37
- decisionReason: z.string().nullable(),
38
- decidedAt: z.string().datetime().nullable(),
39
- createdAt: z.string().datetime(),
40
- expiresAt: z.string().datetime(),
41
- });
42
22
  export const hostedMcpSessionEventSchema = z.object({
43
23
  id: z.string(),
44
24
  sessionId: z.string(),
@@ -51,71 +31,6 @@ export const hostedMcpSessionEventSchema = z.object({
51
31
  data: AnyObjectSchema.nullable(),
52
32
  createdAt: z.string().datetime(),
53
33
  });
54
- export const hostedMcpExecutionRunStatusSchema = z.enum([
55
- "queued",
56
- "running",
57
- "approval_required",
58
- "completed",
59
- "failed",
60
- "canceled",
61
- ]);
62
- export const hostedMcpExecutionStepSchema = z.object({
63
- id: z.string(),
64
- runId: z.string(),
65
- index: z.number().int().nonnegative(),
66
- tool: z.string().nullable(),
67
- status: z.string(),
68
- dryRun: z.boolean().nullable(),
69
- durationMs: z.number().int().nonnegative().nullable(),
70
- input: AnyObjectSchema.nullable(),
71
- output: z.unknown().nullable(),
72
- createdAt: z.string().datetime(),
73
- });
74
- export const hostedMcpExecutionArtifactSchema = z.object({
75
- id: z.string(),
76
- runId: z.string(),
77
- kind: z.enum(["log", "warning", "result", "resource", "file", "summary"]),
78
- name: z.string(),
79
- mimeType: z.string().nullable(),
80
- sizeBytes: z.number().int().nonnegative().nullable(),
81
- data: z.unknown().nullable(),
82
- createdAt: z.string().datetime(),
83
- });
84
- export const hostedMcpExecutionRunSchema = z.object({
85
- id: z.string(),
86
- sessionId: z.string().nullable(),
87
- credentialId: z.string().nullable(),
88
- tool: z.string(),
89
- mode: z.string().nullable(),
90
- status: hostedMcpExecutionRunStatusSchema,
91
- approvalId: z.string().nullable(),
92
- cancellationRequested: z.boolean(),
93
- summary: z.string().nullable(),
94
- error: z.string().nullable(),
95
- startedAt: z.string().datetime(),
96
- completedAt: z.string().datetime().nullable(),
97
- updatedAt: z.string().datetime(),
98
- steps: z.array(hostedMcpExecutionStepSchema).optional(),
99
- artifacts: z.array(hostedMcpExecutionArtifactSchema).optional(),
100
- });
101
- export const hostedMcpToolPolicySchema = z.object({
102
- tool: z.string(),
103
- runtime: z.enum(["hosted", "on-device", "both"]),
104
- category: z.string(),
105
- defaultMode: z.enum(["allow", "approval", "local-only"]),
106
- approvalRequired: z.boolean(),
107
- requiredScopes: z.array(z.string()),
108
- clientPolicy: z.string(),
109
- sessionPolicy: z.string(),
110
- });
111
- export const hostedMcpPolicyDefaultsSchema = z.object({
112
- approvalTtlSeconds: z.number().int().positive(),
113
- hostedTransport: z.string(),
114
- onDeviceTransport: z.string(),
115
- hostedBoundary: z.string(),
116
- onDeviceBoundary: z.string(),
117
- toolPolicies: z.array(hostedMcpToolPolicySchema),
118
- });
119
34
  export const hostedMcpSummarySchema = z.object({
120
35
  rowLimit: z.number().int().positive(),
121
36
  sessions: z.object({
@@ -125,37 +40,28 @@ export const hostedMcpSummarySchema = z.object({
125
40
  expired: z.number().int().nonnegative(),
126
41
  interrupted: z.number().int().nonnegative(),
127
42
  }),
128
- approvals: z.object({
129
- pending: z.number().int().nonnegative(),
130
- }),
131
43
  events: z.object({
132
44
  recent: z.number().int().nonnegative(),
133
45
  }),
134
- executions: z.object({
135
- recent: z.number().int().nonnegative(),
136
- running: z.number().int().nonnegative(),
137
- }),
138
46
  });
139
47
  export const hostedMcpDashboardSchema = z.object({
140
48
  summary: hostedMcpSummarySchema,
141
- policyDefaults: hostedMcpPolicyDefaultsSchema,
142
49
  sessions: z.array(hostedMcpSessionSchema),
143
- approvals: z.array(hostedMcpApprovalSchema),
144
50
  events: z.array(hostedMcpSessionEventSchema),
145
- executions: z.array(hostedMcpExecutionRunSchema),
146
51
  });
147
52
  export const hostedMcpDashboardResponseSchema = dataEnvelope(hostedMcpDashboardSchema);
148
53
  export const hostedMcpCloseSessionResponseSchema = dataEnvelope(hostedMcpSessionSchema);
149
- export const hostedMcpApprovalDecisionRequestSchema = z.object({
150
- decision: z.enum(["approve", "deny"]),
151
- reason: z.string().max(1_000).optional(),
152
- });
153
- export const hostedMcpApprovalResponseSchema = dataEnvelope(hostedMcpApprovalSchema);
154
54
  export const hostedMcpSessionEventsResponseSchema = dataEnvelope(z.object({
155
55
  session: hostedMcpSessionSchema,
156
56
  events: z.array(hostedMcpSessionEventSchema),
157
57
  }));
158
- export const hostedMcpExecutionRunsResponseSchema = dataEnvelope(z.object({
159
- runs: z.array(hostedMcpExecutionRunSchema),
58
+ export const hostedMcpPausedExecutionSchema = z.object({
59
+ text: z.string(),
60
+ structured: z.unknown(),
61
+ });
62
+ export const hostedMcpPausedExecutionResponseSchema = dataEnvelope(hostedMcpPausedExecutionSchema);
63
+ export const hostedMcpApprovalActionSchema = z.enum(["accept", "decline", "cancel"]);
64
+ export const hostedMcpApprovalResponseSchema = dataEnvelope(z.object({
65
+ text: z.string(),
66
+ structured: z.unknown(),
160
67
  }));
161
- export const hostedMcpExecutionRunResponseSchema = dataEnvelope(hostedMcpExecutionRunSchema);
@@ -30,7 +30,7 @@ export const meResponseSchema = z.object({
30
30
  isSuperadmin: z.boolean().describe("Whether the user is a platform operator."),
31
31
  })
32
32
  .nullable()
33
- .describe("Authenticated user identity for user-subject credentials. Null for team- or service-subject machine credentials; creator metadata is retained only for audit attribution, not request identity."),
33
+ .describe("Authenticated user identity for user-subject credentials. Null for team-subject or service-subject machine credentials. Creator metadata is retained only for audit attribution, not request identity."),
34
34
  tenants: z
35
35
  .array(z.object({
36
36
  id: z.string().describe("Tenant id."),
@@ -85,7 +85,7 @@ export const meResponseSchema = z.object({
85
85
  .object({
86
86
  gateEnabled: z
87
87
  .boolean()
88
- .describe("Whether the beta.enrollment_gate flag is on for this deployment."),
88
+ .describe("Whether the `beta.enrollment_gate` flag is on for this environment."),
89
89
  enrolled: z
90
90
  .boolean()
91
91
  .describe("Whether the subject user is enrolled (beta_enrolled_at is set)."),
@@ -99,6 +99,5 @@ export const meResponseSchema = z.object({
99
99
  }))
100
100
  .describe("Teams the user may join via the picker (pending invitation, auto-enroll match, or Automattician access)."),
101
101
  })
102
- .describe("Private-beta state. Dashboards key the blocked screen on gateEnabled && !enrolled, " +
103
- "never on !enrolled alone — else launch-day flag-off would still block people."),
102
+ .describe("Private-beta state. Dashboards key the blocked screen on `gateEnabled && !enrolled`, never on `!enrolled` alone. Otherwise, a launch-day flag-off still blocks people."),
104
103
  });
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ export declare const notificationKindValues: readonly ["comment.created", "comment.replied", "thread.archived", "thread.unarchived", "mention"];
3
+ export declare const notificationKindSchema: z.ZodEnum<{
4
+ "comment.created": "comment.created";
5
+ "comment.replied": "comment.replied";
6
+ "thread.archived": "thread.archived";
7
+ "thread.unarchived": "thread.unarchived";
8
+ mention: "mention";
9
+ }>;
10
+ export declare const notificationSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ kind: z.ZodEnum<{
13
+ "comment.created": "comment.created";
14
+ "comment.replied": "comment.replied";
15
+ "thread.archived": "thread.archived";
16
+ "thread.unarchived": "thread.unarchived";
17
+ mention: "mention";
18
+ }>;
19
+ teamId: z.ZodNullable<z.ZodString>;
20
+ spaceId: z.ZodNullable<z.ZodString>;
21
+ threadId: z.ZodNullable<z.ZodString>;
22
+ title: z.ZodString;
23
+ body: z.ZodNullable<z.ZodString>;
24
+ actor: z.ZodObject<{
25
+ name: z.ZodNullable<z.ZodString>;
26
+ avatarUrl: z.ZodNullable<z.ZodString>;
27
+ color: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ path: z.ZodNullable<z.ZodString>;
30
+ versionId: z.ZodNullable<z.ZodString>;
31
+ link: z.ZodNullable<z.ZodString>;
32
+ readAt: z.ZodNullable<z.ZodString>;
33
+ createdAt: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export declare const notificationListQuerySchema: z.ZodObject<{
36
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
37
+ cursor: z.ZodOptional<z.ZodString>;
38
+ unread: z.ZodDefault<z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>>;
39
+ }, z.core.$strip>;
40
+ export declare const notificationListResponseSchema: z.ZodObject<{
41
+ data: z.ZodObject<{
42
+ notifications: z.ZodArray<z.ZodObject<{
43
+ id: z.ZodString;
44
+ kind: z.ZodEnum<{
45
+ "comment.created": "comment.created";
46
+ "comment.replied": "comment.replied";
47
+ "thread.archived": "thread.archived";
48
+ "thread.unarchived": "thread.unarchived";
49
+ mention: "mention";
50
+ }>;
51
+ teamId: z.ZodNullable<z.ZodString>;
52
+ spaceId: z.ZodNullable<z.ZodString>;
53
+ threadId: z.ZodNullable<z.ZodString>;
54
+ title: z.ZodString;
55
+ body: z.ZodNullable<z.ZodString>;
56
+ actor: z.ZodObject<{
57
+ name: z.ZodNullable<z.ZodString>;
58
+ avatarUrl: z.ZodNullable<z.ZodString>;
59
+ color: z.ZodNullable<z.ZodString>;
60
+ }, z.core.$strip>;
61
+ path: z.ZodNullable<z.ZodString>;
62
+ versionId: z.ZodNullable<z.ZodString>;
63
+ link: z.ZodNullable<z.ZodString>;
64
+ readAt: z.ZodNullable<z.ZodString>;
65
+ createdAt: z.ZodString;
66
+ }, z.core.$strip>>;
67
+ pagination: z.ZodObject<{
68
+ nextCursor: z.ZodNullable<z.ZodString>;
69
+ hasMore: z.ZodBoolean;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>;
72
+ }, z.core.$strip>;
73
+ export declare const notificationUnreadCountResponseSchema: z.ZodObject<{
74
+ data: z.ZodObject<{
75
+ count: z.ZodNumber;
76
+ }, z.core.$strip>;
77
+ }, z.core.$strip>;
78
+ export declare const notificationReadRequestSchema: z.ZodObject<{
79
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
+ all: z.ZodOptional<z.ZodBoolean>;
81
+ }, z.core.$strip>;
82
+ export declare const notificationReadResponseSchema: z.ZodObject<{
83
+ data: z.ZodObject<{
84
+ updated: z.ZodNumber;
85
+ }, z.core.$strip>;
86
+ }, z.core.$strip>;
87
+ export declare const collabNotifyEmailRequestSchema: z.ZodObject<{
88
+ castActorId: z.ZodString;
89
+ email: z.ZodEmail;
90
+ }, z.core.$strip>;
91
+ export declare const collabNotifyEmailResponseSchema: z.ZodObject<{
92
+ data: z.ZodObject<{
93
+ subscribed: z.ZodLiteral<true>;
94
+ consentAt: z.ZodString;
95
+ }, z.core.$strip>;
96
+ }, z.core.$strip>;
97
+ export declare const collabNotifyEmailUnsubscribeQuerySchema: z.ZodObject<{
98
+ token: z.ZodString;
99
+ }, z.core.$strip>;
100
+ export declare const collabNotifyEmailUnsubscribeResponseSchema: z.ZodObject<{
101
+ data: z.ZodObject<{
102
+ unsubscribed: z.ZodBoolean;
103
+ }, z.core.$strip>;
104
+ }, z.core.$strip>;
105
+ export type Notification = z.infer<typeof notificationSchema>;
106
+ export type NotificationListQuery = z.infer<typeof notificationListQuerySchema>;
107
+ export type NotificationReadRequest = z.infer<typeof notificationReadRequestSchema>;
108
+ export type CollabNotifyEmailRequest = z.infer<typeof collabNotifyEmailRequestSchema>;
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { CursorPaginationSchema, cursorListQuerySchema, dataEnvelope } from "./common.js";
3
+ export const notificationKindValues = [
4
+ "comment.created",
5
+ "comment.replied",
6
+ "thread.archived",
7
+ "thread.unarchived",
8
+ "mention",
9
+ ];
10
+ export const notificationKindSchema = z.enum(notificationKindValues);
11
+ export const notificationSchema = z.object({
12
+ id: z.string().min(1),
13
+ kind: notificationKindSchema,
14
+ teamId: z.string().nullable(),
15
+ spaceId: z.string().nullable(),
16
+ threadId: z.string().nullable(),
17
+ title: z.string(),
18
+ body: z.string().nullable(),
19
+ actor: z.object({
20
+ name: z.string().nullable(),
21
+ avatarUrl: z.string().nullable(),
22
+ color: z.string().nullable(),
23
+ }),
24
+ path: z.string().nullable(),
25
+ versionId: z.string().nullable(),
26
+ link: z.string().nullable(),
27
+ readAt: z.string().datetime().nullable(),
28
+ createdAt: z.string().datetime(),
29
+ });
30
+ export const notificationListQuerySchema = cursorListQuerySchema.extend({
31
+ unread: z.stringbool().optional().default(false),
32
+ });
33
+ export const notificationListResponseSchema = dataEnvelope(z.object({
34
+ notifications: z.array(notificationSchema),
35
+ pagination: CursorPaginationSchema,
36
+ }));
37
+ export const notificationUnreadCountResponseSchema = dataEnvelope(z.object({ count: z.number().int().nonnegative() }));
38
+ export const notificationReadRequestSchema = z.object({
39
+ ids: z.array(z.string().min(1)).max(100).optional(),
40
+ all: z.boolean().optional(),
41
+ });
42
+ export const notificationReadResponseSchema = dataEnvelope(z.object({ updated: z.number().int().nonnegative() }));
43
+ export const collabNotifyEmailRequestSchema = z.object({
44
+ castActorId: z.string().trim().min(1).max(128),
45
+ email: z.email().max(320),
46
+ });
47
+ export const collabNotifyEmailResponseSchema = dataEnvelope(z.object({
48
+ subscribed: z.literal(true),
49
+ consentAt: z.string().datetime(),
50
+ }));
51
+ export const collabNotifyEmailUnsubscribeQuerySchema = z.object({
52
+ token: z.string().min(1),
53
+ });
54
+ export const collabNotifyEmailUnsubscribeResponseSchema = dataEnvelope(z.object({ unsubscribed: z.boolean() }));
@@ -5,7 +5,24 @@ export declare const OAUTH_API_RESOURCE_PATH: "/v1";
5
5
  export type OAuthResourceKey = "api" | "mcp";
6
6
  export declare const OAUTH_API_RESOURCE_SCOPES: readonly ["teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write"];
7
7
  export declare const OAUTH_MCP_TOOL_SCOPE: "mcp:tools";
8
+ export declare const OAUTH_OFFLINE_ACCESS_SCOPE: "offline_access";
8
9
  export declare const OAUTH_MCP_RESOURCE_SCOPES: readonly ["mcp:tools", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write"];
10
+ /**
11
+ * A resource's `allowedScopes` is intersected with the requested scopes on every
12
+ * token request, and the refresh token stores that intersection — so a resource
13
+ * that omits `offline_access` cannot mint a refresh token that survives
14
+ * rotation, and its clients must re-consent in a browser every
15
+ * `accessTokenTtlSeconds`. Kept separate from OAUTH_MCP_RESOURCE_SCOPES, which
16
+ * is the list of capabilities the dashboard and CLI offer per agent account.
17
+ */
18
+ export declare const OAUTH_MCP_RESOURCE_ALLOWED_SCOPES: readonly ["mcp:tools", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write", "offline_access"];
19
+ /**
20
+ * Interactive MCP clients should be useful after one consent. Authorization is
21
+ * still bounded by the user's live team role and by approval gates around
22
+ * sensitive execution; these scopes only let the MCP resource represent those
23
+ * capabilities. Machine clients may continue to request a narrower set.
24
+ */
25
+ export declare const OAUTH_MCP_DEFAULT_SCOPES: readonly ["mcp:tools", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write", "offline_access"];
9
26
  export declare const OAUTH_PROVIDER_SCOPES: readonly ["openid", "profile", "email", "offline_access", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write", "mcp:tools"];
10
27
  export declare const OAUTH_RESOURCE_DEFINITIONS: {
11
28
  readonly api: {
@@ -18,7 +35,7 @@ export declare const OAUTH_RESOURCE_DEFINITIONS: {
18
35
  readonly key: "mcp";
19
36
  readonly name: "Spacefast MCP";
20
37
  readonly accessTokenTtlSeconds: number;
21
- readonly allowedScopes: readonly ["mcp:tools", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write"];
38
+ readonly allowedScopes: readonly ["mcp:tools", "teams:read", "teams:create", "spaces:read", "spaces:write", "spaces:rename", "publish:write", "domains:read", "domains:write", "offline_access"];
22
39
  };
23
40
  };
24
41
  /** Resource identifier for the public API: `https://api.<domain>/v1`. */
@@ -13,15 +13,35 @@ export const OAUTH_API_RESOURCE_SCOPES = [
13
13
  "domains:write",
14
14
  ];
15
15
  export const OAUTH_MCP_TOOL_SCOPE = "mcp:tools";
16
+ export const OAUTH_OFFLINE_ACCESS_SCOPE = "offline_access";
16
17
  export const OAUTH_MCP_RESOURCE_SCOPES = [
17
18
  OAUTH_MCP_TOOL_SCOPE,
18
19
  ...OAUTH_API_RESOURCE_SCOPES,
19
20
  ];
21
+ /**
22
+ * A resource's `allowedScopes` is intersected with the requested scopes on every
23
+ * token request, and the refresh token stores that intersection — so a resource
24
+ * that omits `offline_access` cannot mint a refresh token that survives
25
+ * rotation, and its clients must re-consent in a browser every
26
+ * `accessTokenTtlSeconds`. Kept separate from OAUTH_MCP_RESOURCE_SCOPES, which
27
+ * is the list of capabilities the dashboard and CLI offer per agent account.
28
+ */
29
+ export const OAUTH_MCP_RESOURCE_ALLOWED_SCOPES = [
30
+ ...OAUTH_MCP_RESOURCE_SCOPES,
31
+ OAUTH_OFFLINE_ACCESS_SCOPE,
32
+ ];
33
+ /**
34
+ * Interactive MCP clients should be useful after one consent. Authorization is
35
+ * still bounded by the user's live team role and by approval gates around
36
+ * sensitive execution; these scopes only let the MCP resource represent those
37
+ * capabilities. Machine clients may continue to request a narrower set.
38
+ */
39
+ export const OAUTH_MCP_DEFAULT_SCOPES = OAUTH_MCP_RESOURCE_ALLOWED_SCOPES;
20
40
  export const OAUTH_PROVIDER_SCOPES = [
21
41
  "openid",
22
42
  "profile",
23
43
  "email",
24
- "offline_access",
44
+ OAUTH_OFFLINE_ACCESS_SCOPE,
25
45
  ...OAUTH_API_RESOURCE_SCOPES,
26
46
  OAUTH_MCP_TOOL_SCOPE,
27
47
  ];
@@ -36,7 +56,7 @@ export const OAUTH_RESOURCE_DEFINITIONS = {
36
56
  key: "mcp",
37
57
  name: "Spacefast MCP",
38
58
  accessTokenTtlSeconds: 15 * 60,
39
- allowedScopes: OAUTH_MCP_RESOURCE_SCOPES,
59
+ allowedScopes: OAUTH_MCP_RESOURCE_ALLOWED_SCOPES,
40
60
  },
41
61
  };
42
62
  /** Resource identifier for the public API: `https://api.<domain>/v1`. */
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  export declare const userOperationKindSchema: z.ZodEnum<{
3
- approval: "approval";
4
3
  version_finalize: "version_finalize";
5
4
  version_promote_live: "version_promote_live";
6
5
  version_delete: "version_delete";
@@ -14,7 +13,6 @@ export declare const userOperationKindSchema: z.ZodEnum<{
14
13
  variable_cascade: "variable_cascade";
15
14
  webhook_deliver: "webhook_deliver";
16
15
  integration_release: "integration_release";
17
- agent_run: "agent_run";
18
16
  }>;
19
17
  export type UserOperationKind = z.infer<typeof userOperationKindSchema>;
20
18
  export declare const UserOperationSchema: z.ZodObject<{
@@ -57,7 +55,6 @@ export declare const UserOperationSchema: z.ZodObject<{
57
55
  createdAt: z.ZodString;
58
56
  finishedAt: z.ZodOptional<z.ZodString>;
59
57
  kind: z.ZodEnum<{
60
- approval: "approval";
61
58
  version_finalize: "version_finalize";
62
59
  version_promote_live: "version_promote_live";
63
60
  version_delete: "version_delete";
@@ -71,7 +68,6 @@ export declare const UserOperationSchema: z.ZodObject<{
71
68
  variable_cascade: "variable_cascade";
72
69
  webhook_deliver: "webhook_deliver";
73
70
  integration_release: "integration_release";
74
- agent_run: "agent_run";
75
71
  }>;
76
72
  versionSource: z.ZodOptional<z.ZodEnum<{
77
73
  direct_upload: "direct_upload";
@@ -80,32 +76,11 @@ export declare const UserOperationSchema: z.ZodObject<{
80
76
  }>>;
81
77
  integrationRelease: z.ZodOptional<z.ZodObject<{
82
78
  environment: z.ZodEnum<{
83
- preview: "preview";
84
79
  production: "production";
80
+ preview: "preview";
85
81
  development: "development";
86
82
  }>;
87
83
  }, z.core.$strip>>;
88
- agentRun: z.ZodOptional<z.ZodObject<{
89
- state: z.ZodEnum<{
90
- failed: "failed";
91
- completed: "completed";
92
- canceled: "canceled";
93
- queued: "queued";
94
- running: "running";
95
- approval_required: "approval_required";
96
- }>;
97
- tool: z.ZodString;
98
- mode: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strip>>;
100
- approval: z.ZodOptional<z.ZodObject<{
101
- decision: z.ZodNullable<z.ZodEnum<{
102
- deny: "deny";
103
- approve: "approve";
104
- }>>;
105
- decidedAt: z.ZodNullable<z.ZodString>;
106
- expiresAt: z.ZodString;
107
- consumedAt: z.ZodNullable<z.ZodString>;
108
- }, z.core.$strip>>;
109
84
  }, z.core.$strip>;
110
85
  export declare const operationListQuerySchema: z.ZodObject<{
111
86
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -155,7 +130,6 @@ export declare const operationListResponseSchema: z.ZodObject<{
155
130
  createdAt: z.ZodString;
156
131
  finishedAt: z.ZodOptional<z.ZodString>;
157
132
  kind: z.ZodEnum<{
158
- approval: "approval";
159
133
  version_finalize: "version_finalize";
160
134
  version_promote_live: "version_promote_live";
161
135
  version_delete: "version_delete";
@@ -169,7 +143,6 @@ export declare const operationListResponseSchema: z.ZodObject<{
169
143
  variable_cascade: "variable_cascade";
170
144
  webhook_deliver: "webhook_deliver";
171
145
  integration_release: "integration_release";
172
- agent_run: "agent_run";
173
146
  }>;
174
147
  versionSource: z.ZodOptional<z.ZodEnum<{
175
148
  direct_upload: "direct_upload";
@@ -178,32 +151,11 @@ export declare const operationListResponseSchema: z.ZodObject<{
178
151
  }>>;
179
152
  integrationRelease: z.ZodOptional<z.ZodObject<{
180
153
  environment: z.ZodEnum<{
181
- preview: "preview";
182
154
  production: "production";
155
+ preview: "preview";
183
156
  development: "development";
184
157
  }>;
185
158
  }, z.core.$strip>>;
186
- agentRun: z.ZodOptional<z.ZodObject<{
187
- state: z.ZodEnum<{
188
- failed: "failed";
189
- completed: "completed";
190
- canceled: "canceled";
191
- queued: "queued";
192
- running: "running";
193
- approval_required: "approval_required";
194
- }>;
195
- tool: z.ZodString;
196
- mode: z.ZodOptional<z.ZodString>;
197
- }, z.core.$strip>>;
198
- approval: z.ZodOptional<z.ZodObject<{
199
- decision: z.ZodNullable<z.ZodEnum<{
200
- deny: "deny";
201
- approve: "approve";
202
- }>>;
203
- decidedAt: z.ZodNullable<z.ZodString>;
204
- expiresAt: z.ZodString;
205
- consumedAt: z.ZodNullable<z.ZodString>;
206
- }, z.core.$strip>>;
207
159
  }, z.core.$strip>>;
208
160
  pagination: z.ZodObject<{
209
161
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -14,8 +14,6 @@ export const userOperationKindSchema = z.enum([
14
14
  "variable_cascade",
15
15
  "webhook_deliver",
16
16
  "integration_release",
17
- "agent_run",
18
- "approval",
19
17
  ]);
20
18
  export const UserOperationSchema = AsyncOperationSchema.extend({
21
19
  kind: userOperationKindSchema,
@@ -29,23 +27,6 @@ export const UserOperationSchema = AsyncOperationSchema.extend({
29
27
  })
30
28
  .optional()
31
29
  .describe("Release environment for an integration tag pointer flip."),
32
- agentRun: z
33
- .object({
34
- state: z.enum(["queued", "running", "approval_required", "completed", "failed", "canceled"]),
35
- tool: z.string(),
36
- mode: z.string().optional(),
37
- })
38
- .optional()
39
- .describe("Authoritative agent execution state and the tool invocation that produced it."),
40
- approval: z
41
- .object({
42
- decision: z.enum(["approve", "deny"]).nullable(),
43
- decidedAt: z.string().datetime().nullable(),
44
- expiresAt: z.string().datetime(),
45
- consumedAt: z.string().datetime().nullable(),
46
- })
47
- .optional()
48
- .describe("Current approval decision and lifecycle timestamps from the approval authority."),
49
30
  });
50
31
  export const operationListQuerySchema = cursorListQuerySchema.extend({
51
32
  resourceType: z
@@ -1,23 +1,26 @@
1
1
  import { z } from "zod";
2
- export declare const SITE_PAGE_IDS: readonly ["404", "denied", "index", "preview"];
2
+ export declare const SITE_PAGE_IDS: readonly ["404", "denied", "access", "index", "preview"];
3
3
  export declare const sitePageIdSchema: z.ZodEnum<{
4
4
  denied: "denied";
5
5
  index: "index";
6
6
  preview: "preview";
7
+ access: "access";
7
8
  404: "404";
8
9
  }>;
9
10
  export type SitePageId = z.infer<typeof sitePageIdSchema>;
10
- export declare const ROUTE_PAGE_IDS: readonly ["404", "denied"];
11
+ export declare const ROUTE_PAGE_IDS: readonly ["404", "denied", "access"];
11
12
  export declare const routePageIdSchema: z.ZodEnum<{
12
13
  denied: "denied";
14
+ access: "access";
13
15
  404: "404";
14
16
  }>;
15
17
  export type RoutePageId = z.infer<typeof routePageIdSchema>;
16
- export declare const CUSTOM_PAGE_IDS: readonly ["404", "denied", "index", "preview"];
18
+ export declare const CUSTOM_PAGE_IDS: readonly ["404", "denied", "access", "index", "preview"];
17
19
  export declare const customPageIdSchema: z.ZodEnum<{
18
20
  denied: "denied";
19
21
  index: "index";
20
22
  preview: "preview";
23
+ access: "access";
21
24
  404: "404";
22
25
  }>;
23
26
  export type CustomPageId = z.infer<typeof customPageIdSchema>;
@@ -35,7 +38,7 @@ export declare const platformPageIdSchema: z.ZodEnum<{
35
38
  "content-too-large": "content-too-large";
36
39
  }>;
37
40
  export type PlatformPageId = z.infer<typeof platformPageIdSchema>;
38
- export declare const PAGE_ELEMENTS: readonly ["sf-content", "sf-denial-context", "sf-page-path", "sf-page-title", "sf-page-summary", "sf-spacefast-branding", "sf-files", "sf-file", "sf-logo", "sf-name"];
41
+ export declare const PAGE_ELEMENTS: readonly ["sf-content", "sf-denial-context", "sf-access-status", "sf-access-lanes", "sf-page-path", "sf-page-title", "sf-page-summary", "sf-spacefast-branding", "sf-files", "sf-file", "sf-logo", "sf-name"];
39
42
  export type PageElement = (typeof PAGE_ELEMENTS)[number];
40
43
  export type PageDefinition = {
41
44
  id: SitePageId;
@@ -53,6 +56,7 @@ export declare const runtimePagesSchema: z.ZodObject<{
53
56
  routes: z.ZodRecord<z.ZodString, z.ZodObject<{
54
57
  pages: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
55
58
  denied: "denied";
59
+ access: "access";
56
60
  404: "404";
57
61
  }>, z.ZodString>>;
58
62
  index: z.ZodOptional<z.ZodString>;
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod";
2
- export const SITE_PAGE_IDS = ["404", "denied", "index", "preview"];
2
+ export const SITE_PAGE_IDS = ["404", "denied", "access", "index", "preview"];
3
3
  export const sitePageIdSchema = z.enum(SITE_PAGE_IDS);
4
- export const ROUTE_PAGE_IDS = ["404", "denied"];
4
+ export const ROUTE_PAGE_IDS = ["404", "denied", "access"];
5
5
  export const routePageIdSchema = z.enum(ROUTE_PAGE_IDS);
6
- export const CUSTOM_PAGE_IDS = ["404", "denied", "index", "preview"];
6
+ export const CUSTOM_PAGE_IDS = ["404", "denied", "access", "index", "preview"];
7
7
  export const customPageIdSchema = z.enum(CUSTOM_PAGE_IDS);
8
8
  export const PLATFORM_PAGE_IDS = [
9
9
  "undeployed",
@@ -21,6 +21,8 @@ export const platformPageIdSchema = z.enum(PLATFORM_PAGE_IDS);
21
21
  export const PAGE_ELEMENTS = [
22
22
  "sf-content",
23
23
  "sf-denial-context",
24
+ "sf-access-status",
25
+ "sf-access-lanes",
24
26
  "sf-page-path",
25
27
  "sf-page-title",
26
28
  "sf-page-summary",
@@ -45,6 +47,17 @@ export const PAGE_CATALOG = {
45
47
  noindex: true,
46
48
  customTemplate: false,
47
49
  },
50
+ // The visitor access page: the deny surface WITH lanes (sign in, SSO,
51
+ // password, request an invite). Rendered by the runtime at the requested URL;
52
+ // publishers may fully retheme it — the runtime injects the functional lane
53
+ // blocks into the sf-access-* slots so forms and states stay correct.
54
+ access: {
55
+ id: "access",
56
+ status: 403,
57
+ cacheControl: "private, no-store",
58
+ noindex: true,
59
+ customTemplate: true,
60
+ },
48
61
  index: {
49
62
  id: "index",
50
63
  status: 200,