anhedral 0.18.0 → 0.20.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 (128) hide show
  1. package/README.md +10 -6
  2. package/assets/contracts/deployment-provenance.json +6 -6
  3. package/assets/contracts/operations-provenance.json +2 -1
  4. package/assets/launch/oj/OJ.LICENSE +21 -0
  5. package/assets/launch/oj/run.mjs +82 -0
  6. package/assets/launch/oj/runtime.json +21 -0
  7. package/assets/launch/root.tsx.txt +1 -2
  8. package/assets/launch/server.ts.txt +4 -2
  9. package/assets/ui/catalog.json +36 -324
  10. package/dist/{platforms/web.d.ts → api-proxy.d.ts} +1 -3
  11. package/dist/api-proxy.js +48 -0
  12. package/dist/capability-catalog.d.ts +3 -57
  13. package/dist/capability-catalog.js +3 -90
  14. package/dist/capability-command.d.ts +10 -2
  15. package/dist/capability-command.js +35 -99
  16. package/dist/capability-editor.js +21 -1
  17. package/dist/capability-recipes.js +8 -343
  18. package/dist/cli-commands.js +6 -1
  19. package/dist/command-schema.js +141 -2
  20. package/dist/command-types.d.ts +1 -0
  21. package/dist/composition.d.ts +4 -14
  22. package/dist/composition.js +6 -6
  23. package/dist/contracts/cli-transport.d.ts +139 -40
  24. package/dist/contracts/cli-transport.js +96 -27
  25. package/dist/contracts/deployment.d.ts +7 -56
  26. package/dist/contracts/deployment.js +9 -45
  27. package/dist/contracts/production-transport.d.ts +71 -0
  28. package/dist/contracts/production-transport.js +56 -0
  29. package/dist/contracts/source-profile.js +1 -1
  30. package/dist/contracts/staging-transport.d.ts +2 -2
  31. package/dist/credential-helper.d.ts +2 -0
  32. package/dist/credential-helper.js +44 -0
  33. package/dist/dependencies.d.ts +0 -27
  34. package/dist/dependencies.js +3 -67
  35. package/dist/index.d.ts +0 -4
  36. package/dist/index.js +0 -2
  37. package/dist/launch.d.ts +11 -5
  38. package/dist/launch.js +21 -9
  39. package/dist/platform-command.js +245 -42
  40. package/dist/platform-production.d.ts +16 -0
  41. package/dist/platform-production.js +135 -0
  42. package/dist/platform-state.d.ts +4 -1
  43. package/dist/platform-state.js +28 -5
  44. package/dist/platforms/tanstack.d.ts +2 -0
  45. package/dist/platforms/tanstack.js +113 -20
  46. package/dist/registry/usage.js +3 -1
  47. package/dist/release-artifact.d.ts +18 -0
  48. package/dist/release-artifact.js +169 -0
  49. package/dist/scaffold/bootstrap.d.ts +3 -3
  50. package/dist/scaffold/styling.d.ts +3 -2
  51. package/dist/stack-update.d.ts +39 -0
  52. package/dist/stack-update.js +346 -0
  53. package/dist/transaction.d.ts +1 -0
  54. package/dist/transaction.js +2 -0
  55. package/dist/ui-catalog.d.ts +3 -5
  56. package/dist/ui-catalog.js +8 -24
  57. package/dist/ui-command.d.ts +1 -1
  58. package/dist/ui-command.js +18 -57
  59. package/dist/ui-project.d.ts +2 -2
  60. package/dist/ui-project.js +8 -36
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/docs/capabilities.md +7 -7
  64. package/docs/software-factory.md +83 -16
  65. package/docs/stack-standard.md +1 -1
  66. package/package.json +1 -4
  67. package/assets/stack/ai-schema.ts.txt +0 -5
  68. package/assets/stack/ai.ts.txt +0 -30
  69. package/assets/stack/desktop.rs.txt +0 -21
  70. package/assets/stack/event-retention.sql.txt +0 -10
  71. package/assets/stack/events-schema.ts.txt +0 -12
  72. package/assets/stack/events.ts.txt +0 -59
  73. package/assets/stack/mobile-auth.ts.txt +0 -25
  74. package/assets/stack/mobile-billing.tsx.txt +0 -63
  75. package/assets/stack/mobile-session.tsx.txt +0 -83
  76. package/assets/stack/native-button.tsx.txt +0 -108
  77. package/assets/stack/native-global.css.txt +0 -4
  78. package/assets/stack/native-lib-utils.ts.txt +0 -5
  79. package/assets/stack/native-metro.config.js.txt +0 -6
  80. package/assets/stack/native-nativewind-env.d.ts.txt +0 -1
  81. package/assets/stack/native-tailwind.config.js.txt +0 -73
  82. package/assets/stack/native-text.tsx.txt +0 -89
  83. package/assets/stack/purchases.ts.txt +0 -65
  84. package/assets/stack/revenuecat.ts.txt +0 -88
  85. package/assets/stack/rtc-schema.ts.txt +0 -10
  86. package/assets/stack/rtc.ts.txt +0 -122
  87. package/assets/stack/web-sign-in.tsx.txt +0 -51
  88. package/dist/capabilities.d.ts +0 -11
  89. package/dist/capabilities.js +0 -14
  90. package/dist/dependency-order.d.ts +0 -2
  91. package/dist/dependency-order.js +0 -24
  92. package/dist/platforms/lint.d.ts +0 -1
  93. package/dist/platforms/lint.js +0 -5
  94. package/dist/platforms/web.js +0 -251
  95. package/dist/project-config.d.ts +0 -3
  96. package/dist/project-config.js +0 -16
  97. package/dist/registry/context.d.ts +0 -3
  98. package/dist/registry/context.js +0 -20
  99. package/dist/registry/options.d.ts +0 -2
  100. package/dist/registry/options.js +0 -47
  101. package/dist/registry/resolve.d.ts +0 -11
  102. package/dist/registry/resolve.js +0 -46
  103. package/dist/registry/types.d.ts +0 -60
  104. package/dist/scaffold/api.d.ts +0 -2
  105. package/dist/scaffold/api.js +0 -38
  106. package/dist/scaffold/backend.d.ts +0 -2
  107. package/dist/scaffold/backend.js +0 -36
  108. package/dist/scaffold/compose.d.ts +0 -4
  109. package/dist/scaffold/compose.js +0 -30
  110. package/dist/scaffold/database.d.ts +0 -2
  111. package/dist/scaffold/database.js +0 -41
  112. package/dist/scaffold/documentation.d.ts +0 -2
  113. package/dist/scaffold/documentation.js +0 -71
  114. package/dist/scaffold/environment.d.ts +0 -4
  115. package/dist/scaffold/environment.js +0 -22
  116. package/dist/scaffold/stack-documentation.d.ts +0 -2
  117. package/dist/scaffold/stack-documentation.js +0 -6
  118. package/dist/scaffold/storage.d.ts +0 -2
  119. package/dist/scaffold/storage.js +0 -21
  120. package/dist/scaffold/workspace.d.ts +0 -3
  121. package/dist/scaffold/workspace.js +0 -141
  122. package/dist/stack-registry.d.ts +0 -35
  123. package/dist/stack-registry.js +0 -189
  124. package/dist/standard.d.ts +0 -8
  125. package/dist/standard.js +0 -109
  126. package/dist/workspace-graph.d.ts +0 -7
  127. package/dist/workspace-graph.js +0 -74
  128. /package/dist/{registry/types.js → command-types.js} +0 -0
@@ -6,23 +6,23 @@ export const launchCompositionSchema = sourceCompositionSchema.safeExtend({
6
6
  contractVersion: z.literal(2),
7
7
  foundation: z.literal('tanstack-start'),
8
8
  });
9
- const compositionSchema = sourceCompositionSchema;
9
+ const compositionSchema = launchCompositionSchema;
10
10
  /** Local source provenance is never a hosting receipt or a provider activation claim. */
11
11
  export function composeSourceProvenance(previous, installed, additions) {
12
- const old = previous === undefined ? undefined : compositionSchema.parse(previous);
12
+ const old = compositionSchema.parse(previous);
13
13
  if (old && Object.keys(old.capabilities).some((id) => !installed.includes(id)))
14
14
  throw Error('Composition provenance disagrees with installed source; reconcile anhedral.json.');
15
15
  const identity = installed.includes('database-auth') ? 'better-auth-d1-v1' : 'none';
16
16
  if (old && old.identity !== 'none' && old.identity !== identity)
17
17
  throw Error('Preserve existing application identity; an explicit adapter is required.');
18
18
  return compositionSchema.parse({
19
- contractVersion: old?.contractVersion ?? 1,
20
- foundation: old?.foundation ?? 'next-opennext',
21
- generatorVersion: old?.generatorVersion ?? null,
19
+ contractVersion: 2,
20
+ foundation: 'tanstack-start',
21
+ generatorVersion: GENERATOR_VERSION,
22
22
  identity,
23
23
  capabilities: Object.fromEntries(installed.map((id) => [
24
24
  id,
25
- additions.includes(id) ? GENERATOR_VERSION : (old?.capabilities[id] ?? null),
25
+ additions.includes(id) ? GENERATOR_VERSION : old.capabilities[id],
26
26
  ])),
27
27
  });
28
28
  }
@@ -29,6 +29,58 @@ export declare const cliLinkSchema: z.ZodObject<{
29
29
  principalId: z.ZodUUID;
30
30
  name: z.ZodString;
31
31
  }, z.core.$strict>;
32
+ /** Metadata-only project management; creation never initializes or provisions source.
33
+ * Pure factories keep unused wire schemas outside the immutable build-tool artifact. */
34
+ export declare const cliProjectListQuerySchema: z.ZodObject<{
35
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
36
+ cursor: z.ZodOptional<z.ZodUUID>;
37
+ }, z.core.$strict>;
38
+ export declare const cliProjectCreateInputSchema: z.ZodObject<{
39
+ protocol: z.ZodLiteral<1>;
40
+ requestId: z.ZodUUID;
41
+ name: z.ZodString;
42
+ summary: z.ZodDefault<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export declare const cliProjectSchema: z.ZodObject<{
45
+ projectId: z.ZodUUID;
46
+ teamId: z.ZodUUID;
47
+ name: z.ZodString;
48
+ slug: z.ZodString;
49
+ canLink: z.ZodBoolean;
50
+ }, z.core.$strict>;
51
+ export declare const cliProjectListSchema: z.ZodObject<{
52
+ protocol: z.ZodLiteral<1>;
53
+ principalId: z.ZodUUID;
54
+ team: z.ZodNullable<z.ZodObject<{
55
+ id: z.ZodUUID;
56
+ name: z.ZodString;
57
+ }, z.core.$strict>>;
58
+ availableTeams: z.ZodArray<z.ZodObject<{
59
+ id: z.ZodUUID;
60
+ name: z.ZodString;
61
+ }, z.core.$strict>>;
62
+ teamsTruncated: z.ZodBoolean;
63
+ projects: z.ZodArray<z.ZodObject<{
64
+ projectId: z.ZodUUID;
65
+ teamId: z.ZodUUID;
66
+ name: z.ZodString;
67
+ slug: z.ZodString;
68
+ canLink: z.ZodBoolean;
69
+ }, z.core.$strict>>;
70
+ nextCursor: z.ZodNullable<z.ZodUUID>;
71
+ }, z.core.$strict>;
72
+ export declare const cliProjectCreateReceiptSchema: z.ZodObject<{
73
+ projectId: z.ZodUUID;
74
+ teamId: z.ZodUUID;
75
+ name: z.ZodString;
76
+ slug: z.ZodString;
77
+ canLink: z.ZodBoolean;
78
+ protocol: z.ZodLiteral<1>;
79
+ requestId: z.ZodUUID;
80
+ principalId: z.ZodUUID;
81
+ summary: z.ZodString;
82
+ initialization: z.ZodLiteral<"source-upload">;
83
+ }, z.core.$strict>;
32
84
  export declare const sourceUploadInputSchema: z.ZodObject<{
33
85
  protocol: z.ZodLiteral<1>;
34
86
  requestId: z.ZodUUID;
@@ -66,29 +118,16 @@ export declare const cliPlanInputSchema: z.ZodObject<{
66
118
  uploadId: z.ZodUUID;
67
119
  manifest: z.ZodObject<{
68
120
  contractVersion: z.ZodLiteral<1>;
69
- foundation: z.ZodEnum<{
70
- "next-opennext": "next-opennext";
71
- "tanstack-start": "tanstack-start";
72
- }>;
121
+ foundation: z.ZodLiteral<"tanstack-start">;
73
122
  capabilities: z.ZodArray<z.ZodEnum<{
74
123
  hono: "hono";
75
124
  "database-auth": "database-auth";
76
125
  r2: "r2";
77
126
  stripe: "stripe";
78
- realtime: "realtime";
79
- rtc: "rtc";
80
- ai: "ai";
81
- expo: "expo";
82
- "native-ui": "native-ui";
83
- revenuecat: "revenuecat";
84
- wxt: "wxt";
85
- "side-panel": "side-panel";
86
- gpui: "gpui";
87
127
  }>>;
88
128
  identity: z.ZodEnum<{
89
129
  none: "none";
90
130
  "better-auth-d1-v1": "better-auth-d1-v1";
91
- "platform-application-services-v1": "platform-application-services-v1";
92
131
  }>;
93
132
  cliArtifact: z.ZodObject<{
94
133
  version: z.ZodString;
@@ -97,7 +136,7 @@ export declare const cliPlanInputSchema: z.ZodObject<{
97
136
  }, z.core.$strict>;
98
137
  intent: z.ZodObject<{
99
138
  contractVersion: z.ZodLiteral<1>;
100
- runtimeProfile: z.ZodString;
139
+ runtimeProfile: z.ZodLiteral<"anhedral-stack">;
101
140
  environment: z.ZodEnum<{
102
141
  production: "production";
103
142
  preview: "preview";
@@ -109,6 +148,45 @@ export declare const cliPlanInputSchema: z.ZodObject<{
109
148
  }, z.core.$strict>;
110
149
  }, z.core.$strict>;
111
150
  }, z.core.$strict>;
151
+ export declare const cliPlanBlockerSchema: z.ZodEnum<{
152
+ HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
153
+ ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
154
+ CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
155
+ RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
156
+ ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
157
+ SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
158
+ DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
159
+ }>;
160
+ export declare const cliPlanAdmissionSchema: z.ZodObject<{
161
+ version: z.ZodLiteral<1>;
162
+ expectedCliArtifact: z.ZodNullable<z.ZodObject<{
163
+ version: z.ZodString;
164
+ sourceRevision: z.ZodString;
165
+ packageIntegrity: z.ZodString;
166
+ }, z.core.$strict>>;
167
+ supportedCompositions: z.ZodArray<z.ZodObject<{
168
+ dependencyLockDigest: z.ZodString;
169
+ capabilities: z.ZodArray<z.ZodEnum<{
170
+ hono: "hono";
171
+ "database-auth": "database-auth";
172
+ r2: "r2";
173
+ stripe: "stripe";
174
+ }>>;
175
+ }, z.core.$strict>>;
176
+ diagnostics: z.ZodArray<z.ZodObject<{
177
+ code: z.ZodEnum<{
178
+ HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
179
+ ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
180
+ CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
181
+ RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
182
+ ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
183
+ SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
184
+ DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
185
+ }>;
186
+ message: z.ZodString;
187
+ action: z.ZodString;
188
+ }, z.core.$strict>>;
189
+ }, z.core.$strict>;
112
190
  export declare const cliPlanSchema: z.ZodObject<{
113
191
  protocol: z.ZodLiteral<1>;
114
192
  id: z.ZodUUID;
@@ -118,29 +196,16 @@ export declare const cliPlanSchema: z.ZodObject<{
118
196
  digest: z.ZodString;
119
197
  manifest: z.ZodObject<{
120
198
  contractVersion: z.ZodLiteral<1>;
121
- foundation: z.ZodEnum<{
122
- "next-opennext": "next-opennext";
123
- "tanstack-start": "tanstack-start";
124
- }>;
199
+ foundation: z.ZodLiteral<"tanstack-start">;
125
200
  capabilities: z.ZodArray<z.ZodEnum<{
126
201
  hono: "hono";
127
202
  "database-auth": "database-auth";
128
203
  r2: "r2";
129
204
  stripe: "stripe";
130
- realtime: "realtime";
131
- rtc: "rtc";
132
- ai: "ai";
133
- expo: "expo";
134
- "native-ui": "native-ui";
135
- revenuecat: "revenuecat";
136
- wxt: "wxt";
137
- "side-panel": "side-panel";
138
- gpui: "gpui";
139
205
  }>>;
140
206
  identity: z.ZodEnum<{
141
207
  none: "none";
142
208
  "better-auth-d1-v1": "better-auth-d1-v1";
143
- "platform-application-services-v1": "platform-application-services-v1";
144
209
  }>;
145
210
  cliArtifact: z.ZodObject<{
146
211
  version: z.ZodString;
@@ -149,7 +214,7 @@ export declare const cliPlanSchema: z.ZodObject<{
149
214
  }, z.core.$strict>;
150
215
  intent: z.ZodObject<{
151
216
  contractVersion: z.ZodLiteral<1>;
152
- runtimeProfile: z.ZodString;
217
+ runtimeProfile: z.ZodLiteral<"anhedral-stack">;
153
218
  environment: z.ZodEnum<{
154
219
  production: "production";
155
220
  preview: "preview";
@@ -173,12 +238,50 @@ export declare const cliPlanSchema: z.ZodObject<{
173
238
  policyDigest: z.ZodString;
174
239
  migrationDigests: z.ZodArray<z.ZodString>;
175
240
  expiresAt: z.ZodISODateTime;
176
- runtimeImage: z.ZodNull;
241
+ runtimeImage: z.ZodNullable<z.ZodString>;
177
242
  configurationRevision: z.ZodNull;
178
- artifactVerified: z.ZodLiteral<false>;
179
- hostedAdmission: z.ZodLiteral<false>;
243
+ artifactVerified: z.ZodBoolean;
244
+ hostedAdmission: z.ZodBoolean;
180
245
  identityAction: z.ZodLiteral<"preserve">;
181
- blockers: z.ZodTuple<[z.ZodLiteral<"HOSTED_ADMISSION_DISABLED">, z.ZodLiteral<"ARTIFACT_UNREVIEWED">, z.ZodLiteral<"CONFIGURATION_UNVERIFIED">], null>;
246
+ blockers: z.ZodArray<z.ZodEnum<{
247
+ HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
248
+ ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
249
+ CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
250
+ RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
251
+ ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
252
+ SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
253
+ DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
254
+ }>>;
255
+ admission: z.ZodOptional<z.ZodObject<{
256
+ version: z.ZodLiteral<1>;
257
+ expectedCliArtifact: z.ZodNullable<z.ZodObject<{
258
+ version: z.ZodString;
259
+ sourceRevision: z.ZodString;
260
+ packageIntegrity: z.ZodString;
261
+ }, z.core.$strict>>;
262
+ supportedCompositions: z.ZodArray<z.ZodObject<{
263
+ dependencyLockDigest: z.ZodString;
264
+ capabilities: z.ZodArray<z.ZodEnum<{
265
+ hono: "hono";
266
+ "database-auth": "database-auth";
267
+ r2: "r2";
268
+ stripe: "stripe";
269
+ }>>;
270
+ }, z.core.$strict>>;
271
+ diagnostics: z.ZodArray<z.ZodObject<{
272
+ code: z.ZodEnum<{
273
+ HOSTED_ADMISSION_DISABLED: "HOSTED_ADMISSION_DISABLED";
274
+ ARTIFACT_UNREVIEWED: "ARTIFACT_UNREVIEWED";
275
+ CONFIGURATION_UNVERIFIED: "CONFIGURATION_UNVERIFIED";
276
+ RUNTIME_UNAVAILABLE: "RUNTIME_UNAVAILABLE";
277
+ ARTIFACT_MISMATCH: "ARTIFACT_MISMATCH";
278
+ SOURCE_VERSION_MISMATCH: "SOURCE_VERSION_MISMATCH";
279
+ DEPENDENCY_LOCK_MISMATCH: "DEPENDENCY_LOCK_MISMATCH";
280
+ }>;
281
+ message: z.ZodString;
282
+ action: z.ZodString;
283
+ }, z.core.$strict>>;
284
+ }, z.core.$strict>>;
182
285
  }, z.core.$strict>;
183
286
  export declare const cliPrepareInputSchema: z.ZodObject<{
184
287
  protocol: z.ZodLiteral<1>;
@@ -201,15 +304,11 @@ export declare const cliPreparationSchema: z.ZodObject<{
201
304
  }>;
202
305
  buildDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
203
306
  error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
204
- admission: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
205
- policyDigest: z.ZodString;
206
- image: z.ZodString;
207
- scope: z.ZodLiteral<"isolated-build">;
208
- }, z.core.$strict>, z.ZodObject<{
307
+ admission: z.ZodOptional<z.ZodNullable<z.ZodObject<{
209
308
  policyDigest: z.ZodString;
210
309
  image: z.ZodString;
211
310
  scope: z.ZodLiteral<"candidate-workspace">;
212
- }, z.core.$strict>], "scope">>>;
311
+ }, z.core.$strict>>>;
213
312
  hostedAdmission: z.ZodBoolean;
214
313
  identityAction: z.ZodLiteral<"preserve">;
215
314
  }, z.core.$strict>;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { deploymentManifestSchema } from "./deployment.js";
2
+ import { cliArtifactSchema, deploymentManifestSchema } from "./deployment.js";
3
3
  export const CLI_CLIENT_ID = "anhedral-cli";
4
4
  export const SOURCE_LIMITS = {
5
5
  bytes: 16 * 1024 * 1024,
@@ -34,6 +34,57 @@ export const cliLinkSchema = z
34
34
  name: z.string().min(1).max(200),
35
35
  })
36
36
  .strict();
37
+ /** Metadata-only project management; creation never initializes or provisions source.
38
+ * Pure factories keep unused wire schemas outside the immutable build-tool artifact. */
39
+ export const cliProjectListQuerySchema = /* @__PURE__ */ (() => z
40
+ .object({
41
+ limit: z.coerce.number().int().min(1).max(100).default(50),
42
+ cursor: z.uuid().optional(),
43
+ })
44
+ .strict())();
45
+ export const cliProjectCreateInputSchema = /* @__PURE__ */ (() => z
46
+ .object({
47
+ protocol: z.literal(1),
48
+ requestId: z.uuid(),
49
+ name: z.string().trim().min(1).max(160),
50
+ summary: z.string().trim().max(2000).default(""),
51
+ })
52
+ .strict())();
53
+ export const cliProjectSchema = /* @__PURE__ */ (() => z
54
+ .object({
55
+ projectId: z.uuid(),
56
+ teamId: z.uuid(),
57
+ name: z.string().min(1).max(200),
58
+ slug: z.string().min(1).max(200),
59
+ canLink: z.boolean(),
60
+ })
61
+ .strict())();
62
+ export const cliProjectListSchema = /* @__PURE__ */ (() => z
63
+ .object({
64
+ protocol: z.literal(1),
65
+ principalId: z.uuid(),
66
+ team: z
67
+ .object({ id: z.uuid(), name: z.string().min(1).max(200) })
68
+ .strict()
69
+ .nullable(),
70
+ availableTeams: z
71
+ .array(z.object({ id: z.uuid(), name: z.string().min(1).max(200) }).strict())
72
+ .max(100),
73
+ teamsTruncated: z.boolean(),
74
+ projects: z.array(cliProjectSchema).max(100),
75
+ nextCursor: z.uuid().nullable(),
76
+ })
77
+ .strict())();
78
+ export const cliProjectCreateReceiptSchema = /* @__PURE__ */ (() => cliProjectSchema
79
+ .extend({
80
+ protocol: z.literal(1),
81
+ requestId: z.uuid(),
82
+ principalId: z.uuid(),
83
+ summary: z.string().max(2000),
84
+ initialization: z.literal("source-upload"),
85
+ })
86
+ .strict()
87
+ .refine((value) => value.projectId === value.requestId, "Project identity differs from request."))();
37
88
  export const sourceUploadInputSchema = z
38
89
  .object({
39
90
  protocol: z.literal(1),
@@ -75,6 +126,38 @@ export const cliPlanInputSchema = z
75
126
  manifest: deploymentManifestSchema,
76
127
  })
77
128
  .strict();
129
+ export const cliPlanBlockerSchema = z.enum([
130
+ "HOSTED_ADMISSION_DISABLED",
131
+ "ARTIFACT_UNREVIEWED",
132
+ "CONFIGURATION_UNVERIFIED",
133
+ "RUNTIME_UNAVAILABLE",
134
+ "ARTIFACT_MISMATCH",
135
+ "SOURCE_VERSION_MISMATCH",
136
+ "DEPENDENCY_LOCK_MISMATCH",
137
+ ]);
138
+ export const cliPlanAdmissionSchema = z
139
+ .object({
140
+ version: z.literal(1),
141
+ expectedCliArtifact: cliArtifactSchema.nullable(),
142
+ supportedCompositions: z
143
+ .array(z
144
+ .object({
145
+ dependencyLockDigest: sourceHashSchema,
146
+ capabilities: z.array(z.enum(["hono", "database-auth", "r2", "stripe"])).max(4),
147
+ })
148
+ .strict())
149
+ .max(32),
150
+ diagnostics: z
151
+ .array(z
152
+ .object({
153
+ code: cliPlanBlockerSchema,
154
+ message: z.string().min(1).max(500),
155
+ action: z.string().min(1).max(500),
156
+ })
157
+ .strict())
158
+ .max(8),
159
+ })
160
+ .strict();
78
161
  export const cliPlanSchema = z
79
162
  .object({
80
163
  protocol: z.literal(1),
@@ -99,16 +182,14 @@ export const cliPlanSchema = z
99
182
  policyDigest: sourceHashSchema,
100
183
  migrationDigests: z.array(sourceHashSchema).max(100),
101
184
  expiresAt: z.iso.datetime(),
102
- runtimeImage: z.null(),
185
+ runtimeImage: z.string().max(256).nullable(),
103
186
  configurationRevision: z.null(),
104
- artifactVerified: z.literal(false),
105
- hostedAdmission: z.literal(false),
187
+ artifactVerified: z.boolean(),
188
+ hostedAdmission: z.boolean(),
106
189
  identityAction: z.literal("preserve"),
107
- blockers: z.tuple([
108
- z.literal("HOSTED_ADMISSION_DISABLED"),
109
- z.literal("ARTIFACT_UNREVIEWED"),
110
- z.literal("CONFIGURATION_UNVERIFIED"),
111
- ]),
190
+ blockers: z.array(cliPlanBlockerSchema).max(8),
191
+ // Optional so parsing an old immutable plan never adds signed fields.
192
+ admission: cliPlanAdmissionSchema.optional(),
112
193
  })
113
194
  .strict();
114
195
  export const cliPrepareInputSchema = z
@@ -130,24 +211,12 @@ export const cliPreparationSchema = z
130
211
  buildDigest: sourceHashSchema.nullable().optional(),
131
212
  error: z.string().max(300).nullable().optional(),
132
213
  admission: z
133
- .discriminatedUnion("scope", [
134
- z
135
- .object({
136
- policyDigest: sourceHashSchema,
137
- image: z.string().regex(/^sha256:[a-f0-9]{64}$/),
138
- scope: z.literal("isolated-build"),
139
- })
140
- .strict(),
141
- z
142
- .object({
143
- policyDigest: sourceHashSchema,
144
- image: z
145
- .string()
146
- .regex(/^registry\.[a-z0-9.-]+\/[a-zA-Z0-9/_.-]+@sha256:[a-f0-9]{64}$/),
147
- scope: z.literal("candidate-workspace"),
148
- })
149
- .strict(),
150
- ])
214
+ .object({
215
+ policyDigest: sourceHashSchema,
216
+ image: z.string().regex(/^registry\.[a-z0-9.-]+\/[a-zA-Z0-9/_.-]+@sha256:[a-f0-9]{64}$/),
217
+ scope: z.literal("candidate-workspace"),
218
+ })
219
+ .strict()
151
220
  .nullable()
152
221
  .optional(),
153
222
  hostedAdmission: z.boolean(),
@@ -5,22 +5,12 @@ export declare const deploymentDigestSchema: z.ZodString;
5
5
  export declare const applicationIdentitySchema: z.ZodEnum<{
6
6
  none: "none";
7
7
  "better-auth-d1-v1": "better-auth-d1-v1";
8
- "platform-application-services-v1": "platform-application-services-v1";
9
8
  }>;
10
9
  export declare const deploymentCapabilitySchema: z.ZodEnum<{
11
10
  hono: "hono";
12
11
  "database-auth": "database-auth";
13
12
  r2: "r2";
14
13
  stripe: "stripe";
15
- realtime: "realtime";
16
- rtc: "rtc";
17
- ai: "ai";
18
- expo: "expo";
19
- "native-ui": "native-ui";
20
- revenuecat: "revenuecat";
21
- wxt: "wxt";
22
- "side-panel": "side-panel";
23
- gpui: "gpui";
24
14
  }>;
25
15
  export declare const cliArtifactSchema: z.ZodObject<{
26
16
  version: z.ZodString;
@@ -29,7 +19,7 @@ export declare const cliArtifactSchema: z.ZodObject<{
29
19
  }, z.core.$strict>;
30
20
  export declare const deploymentIntentSchema: z.ZodObject<{
31
21
  contractVersion: z.ZodLiteral<1>;
32
- runtimeProfile: z.ZodString;
22
+ runtimeProfile: z.ZodLiteral<"anhedral-stack">;
33
23
  environment: z.ZodEnum<{
34
24
  production: "production";
35
25
  preview: "preview";
@@ -41,58 +31,32 @@ export declare const deploymentIntentSchema: z.ZodObject<{
41
31
  }, z.core.$strict>;
42
32
  /** Source provenance only. Null versions preserve unknown legacy origins honestly. */
43
33
  export declare const sourceCompositionSchema: z.ZodObject<{
44
- contractVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
45
- foundation: z.ZodEnum<{
46
- "next-opennext": "next-opennext";
47
- "tanstack-start": "tanstack-start";
48
- }>;
34
+ contractVersion: z.ZodLiteral<2>;
35
+ foundation: z.ZodLiteral<"tanstack-start">;
49
36
  generatorVersion: z.ZodNullable<z.ZodString>;
50
37
  identity: z.ZodEnum<{
51
38
  none: "none";
52
39
  "better-auth-d1-v1": "better-auth-d1-v1";
53
- "platform-application-services-v1": "platform-application-services-v1";
54
40
  }>;
55
41
  capabilities: z.ZodRecord<z.ZodEnum<{
56
42
  hono: "hono";
57
43
  "database-auth": "database-auth";
58
44
  r2: "r2";
59
45
  stripe: "stripe";
60
- realtime: "realtime";
61
- rtc: "rtc";
62
- ai: "ai";
63
- expo: "expo";
64
- "native-ui": "native-ui";
65
- revenuecat: "revenuecat";
66
- wxt: "wxt";
67
- "side-panel": "side-panel";
68
- gpui: "gpui";
69
46
  }> & z.core.$partial, z.ZodNullable<z.ZodString>>;
70
47
  }, z.core.$strict>;
71
48
  export declare const deploymentManifestSchema: z.ZodObject<{
72
49
  contractVersion: z.ZodLiteral<1>;
73
- foundation: z.ZodEnum<{
74
- "next-opennext": "next-opennext";
75
- "tanstack-start": "tanstack-start";
76
- }>;
50
+ foundation: z.ZodLiteral<"tanstack-start">;
77
51
  capabilities: z.ZodArray<z.ZodEnum<{
78
52
  hono: "hono";
79
53
  "database-auth": "database-auth";
80
54
  r2: "r2";
81
55
  stripe: "stripe";
82
- realtime: "realtime";
83
- rtc: "rtc";
84
- ai: "ai";
85
- expo: "expo";
86
- "native-ui": "native-ui";
87
- revenuecat: "revenuecat";
88
- wxt: "wxt";
89
- "side-panel": "side-panel";
90
- gpui: "gpui";
91
56
  }>>;
92
57
  identity: z.ZodEnum<{
93
58
  none: "none";
94
59
  "better-auth-d1-v1": "better-auth-d1-v1";
95
- "platform-application-services-v1": "platform-application-services-v1";
96
60
  }>;
97
61
  cliArtifact: z.ZodObject<{
98
62
  version: z.ZodString;
@@ -101,7 +65,7 @@ export declare const deploymentManifestSchema: z.ZodObject<{
101
65
  }, z.core.$strict>;
102
66
  intent: z.ZodObject<{
103
67
  contractVersion: z.ZodLiteral<1>;
104
- runtimeProfile: z.ZodString;
68
+ runtimeProfile: z.ZodLiteral<"anhedral-stack">;
105
69
  environment: z.ZodEnum<{
106
70
  production: "production";
107
71
  preview: "preview";
@@ -125,29 +89,16 @@ export declare const deploymentPlanSchema: z.ZodObject<{
125
89
  projectId: z.ZodUUID;
126
90
  manifest: z.ZodObject<{
127
91
  contractVersion: z.ZodLiteral<1>;
128
- foundation: z.ZodEnum<{
129
- "next-opennext": "next-opennext";
130
- "tanstack-start": "tanstack-start";
131
- }>;
92
+ foundation: z.ZodLiteral<"tanstack-start">;
132
93
  capabilities: z.ZodArray<z.ZodEnum<{
133
94
  hono: "hono";
134
95
  "database-auth": "database-auth";
135
96
  r2: "r2";
136
97
  stripe: "stripe";
137
- realtime: "realtime";
138
- rtc: "rtc";
139
- ai: "ai";
140
- expo: "expo";
141
- "native-ui": "native-ui";
142
- revenuecat: "revenuecat";
143
- wxt: "wxt";
144
- "side-panel": "side-panel";
145
- gpui: "gpui";
146
98
  }>>;
147
99
  identity: z.ZodEnum<{
148
100
  none: "none";
149
101
  "better-auth-d1-v1": "better-auth-d1-v1";
150
- "platform-application-services-v1": "platform-application-services-v1";
151
102
  }>;
152
103
  cliArtifact: z.ZodObject<{
153
104
  version: z.ZodString;
@@ -156,7 +107,7 @@ export declare const deploymentPlanSchema: z.ZodObject<{
156
107
  }, z.core.$strict>;
157
108
  intent: z.ZodObject<{
158
109
  contractVersion: z.ZodLiteral<1>;
159
- runtimeProfile: z.ZodString;
110
+ runtimeProfile: z.ZodLiteral<"anhedral-stack">;
160
111
  environment: z.ZodEnum<{
161
112
  production: "production";
162
113
  preview: "preview";
@@ -4,29 +4,11 @@ export const deploymentContractVersion = 1;
4
4
  export const deploymentDigestSchema = z.string().regex(/^[a-f0-9]{64}$/);
5
5
  const revisionSchema = z.string().regex(/^[a-f0-9]{40}$/);
6
6
  const versionSchema = z.string().regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
7
- export const applicationIdentitySchema = z.enum([
8
- "none",
9
- "better-auth-d1-v1",
10
- "platform-application-services-v1",
11
- ]);
12
- export const deploymentCapabilitySchema = z.enum([
13
- "hono",
14
- "database-auth",
15
- "r2",
16
- "stripe",
17
- "realtime",
18
- "rtc",
19
- "ai",
20
- "expo",
21
- "native-ui",
22
- "revenuecat",
23
- "wxt",
24
- "side-panel",
25
- "gpui",
26
- ]);
7
+ export const applicationIdentitySchema = z.enum(["none", "better-auth-d1-v1"]);
8
+ export const deploymentCapabilitySchema = z.enum(["hono", "database-auth", "r2", "stripe"]);
27
9
  const capabilitiesSchema = z
28
10
  .array(deploymentCapabilitySchema)
29
- .max(13)
11
+ .max(4)
30
12
  .refine((items) => new Set(items).size === items.length, "Duplicate capabilities.");
31
13
  export const cliArtifactSchema = z
32
14
  .object({
@@ -38,7 +20,7 @@ export const cliArtifactSchema = z
38
20
  export const deploymentIntentSchema = z
39
21
  .object({
40
22
  contractVersion: z.literal(1),
41
- runtimeProfile: z.string().regex(/^[a-z][a-z0-9-]{0,63}$/),
23
+ runtimeProfile: z.literal("anhedral-stack"),
42
24
  environment: z.enum(["preview", "production"]),
43
25
  visibility: z.enum(["protected", "public"]),
44
26
  })
@@ -46,25 +28,17 @@ export const deploymentIntentSchema = z
46
28
  /** Source provenance only. Null versions preserve unknown legacy origins honestly. */
47
29
  export const sourceCompositionSchema = z
48
30
  .object({
49
- contractVersion: z.union([z.literal(1), z.literal(2)]),
50
- foundation: z.enum(["next-opennext", "tanstack-start"]),
31
+ contractVersion: z.literal(2),
32
+ foundation: z.literal("tanstack-start"),
51
33
  generatorVersion: versionSchema.nullable(),
52
34
  identity: applicationIdentitySchema,
53
35
  capabilities: z.partialRecord(deploymentCapabilitySchema, versionSchema.nullable()),
54
36
  })
55
- .strict()
56
- .superRefine((value, ctx) => {
57
- if ((value.contractVersion === 1) !== (value.foundation === "next-opennext"))
58
- ctx.addIssue({
59
- code: "custom",
60
- path: ["foundation"],
61
- message: "Source composition version must match its foundation.",
62
- });
63
- });
37
+ .strict();
64
38
  export const deploymentManifestSchema = z
65
39
  .object({
66
40
  contractVersion: z.literal(1),
67
- foundation: z.enum(["next-opennext", "tanstack-start"]),
41
+ foundation: z.literal("tanstack-start"),
68
42
  capabilities: capabilitiesSchema,
69
43
  identity: applicationIdentitySchema,
70
44
  cliArtifact: cliArtifactSchema,
@@ -74,8 +48,7 @@ export const deploymentManifestSchema = z
74
48
  .superRefine((value, ctx) => {
75
49
  const selected = new Set(value.capabilities);
76
50
  const tanstack = value.foundation === "tanstack-start";
77
- if (tanstack !==
78
- ["anhedral-stack", "progressive-tanstack-v1"].includes(value.intent.runtimeProfile))
51
+ if (tanstack !== (value.intent.runtimeProfile === "anhedral-stack"))
79
52
  ctx.addIssue({
80
53
  code: "custom",
81
54
  path: ["intent", "runtimeProfile"],
@@ -106,15 +79,6 @@ export const deploymentManifestSchema = z
106
79
  "database-auth": ["hono"],
107
80
  r2: ["database-auth"],
108
81
  stripe: ["database-auth"],
109
- realtime: ["database-auth"],
110
- rtc: ["database-auth"],
111
- ai: ["database-auth"],
112
- expo: ["database-auth"],
113
- "native-ui": ["expo"],
114
- revenuecat: ["expo", "stripe"],
115
- wxt: ["database-auth"],
116
- "side-panel": ["wxt"],
117
- gpui: ["database-auth"],
118
82
  };
119
83
  for (const id of value.capabilities)
120
84
  for (const parent of prerequisites[id] ?? [])