@cloudhal/core-contracts 0.8.0 → 0.10.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.
@@ -7,7 +7,7 @@ import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { compile } from "json-schema-to-typescript";
9
9
  import { writeBundled } from "./bundle.js";
10
- import { ROOT_SCHEMAS } from "./schema-list.js";
10
+ import { INDEX_EXPORTS, ROOT_SCHEMAS } from "./schema-list.js";
11
11
 
12
12
  const here = path.dirname(fileURLToPath(import.meta.url));
13
13
  const OUT_DIR = path.resolve(here, "../src/generated");
@@ -24,7 +24,8 @@ const bundled = await writeBundled();
24
24
  await mkdir(OUT_DIR, { recursive: true });
25
25
 
26
26
  // Each generated module re-declares the shared $defs it uses (Id, Timestamp, ...). The index
27
- // exports every name exactly once, from the first module (in ROOT_SCHEMAS order) declaring it.
27
+ // exports every name exactly once, from the first module (in ROOT_SCHEMAS order) declaring it;
28
+ // a root listed in INDEX_EXPORTS contributes only the names listed there.
28
29
  const exportsByModule = new Map ();
29
30
  const claimed = new Set ();
30
31
  for (const name of ROOT_SCHEMAS) {
@@ -41,8 +42,15 @@ for (const name of ROOT_SCHEMAS) {
41
42
  });
42
43
  await writeFile(path.join(OUT_DIR, `${name}.ts`), ts);
43
44
  const names = [];
44
- for (const m of ts.matchAll(/^export (?:interface|type) (\w+)/gm)) {
45
- const id = m[1] ;
45
+ const declared = [...ts.matchAll(/^export (?:interface|type) (\w+)/gm)].map(
46
+ (m) => m[1] ,
47
+ );
48
+ const only = INDEX_EXPORTS[name];
49
+ for (const id of only ?? []) {
50
+ if (!declared.includes(id)) throw new Error(`INDEX_EXPORTS: ${name} declares no ${id}`);
51
+ }
52
+ for (const id of declared) {
53
+ if (only && !only.includes(id)) continue;
46
54
  if (!claimed.has(id)) {
47
55
  claimed.add(id);
48
56
  names.push(id);
@@ -2,6 +2,14 @@
2
2
  * Single list of root contracts. Order is the order generators emit in; keep it stable
3
3
  * so generated files and `tools/list`-style outputs are deterministic.
4
4
  */
5
- export declare const ROOT_SCHEMAS: readonly ["project", "site", "page", "section", "content-entry", "snapshot", "skill-manifest", "taxonomy", "term", "redirect", "asset", "menu", "analytics-event", "analytics-beacon", "comment", "comment-submission", "release", "automation", "schedule-run", "glossary"];
5
+ export declare const ROOT_SCHEMAS: readonly ["project", "site", "page", "section", "content-entry", "snapshot", "skill-manifest", "taxonomy", "term", "redirect", "asset", "menu", "analytics-event", "analytics-beacon", "comment", "comment-submission", "release", "automation", "schedule-run", "glossary", "release-manifest", "release-statement", "release-keys", "release-yank-list"];
6
6
  export type RootSchemaName = (typeof ROOT_SCHEMAS)[number];
7
+ /**
8
+ * Roots whose module the package index re-exports only by these names. The release roots
9
+ * (RFC-0046) keep their local `$defs` local: those definitions are portable copies (`SiteId`,
10
+ * `Capability`, `Sha256Hex`, …) whose generic names would claim the package's public type
11
+ * namespace with meanings that hold only inside a release manifest. Every listed name must be
12
+ * declared by the generated module (gen-ts refuses otherwise).
13
+ */
14
+ export declare const INDEX_EXPORTS: Partial<Record<RootSchemaName, readonly string[]>>;
7
15
  export declare const COMMON_SCHEMA = "common";
@@ -23,8 +23,26 @@ export const ROOT_SCHEMAS = [
23
23
  "automation",
24
24
  "schedule-run",
25
25
  "glossary",
26
+ "release-manifest",
27
+ "release-statement",
28
+ "release-keys",
29
+ "release-yank-list",
26
30
  ] ;
27
31
 
28
32
 
29
33
 
34
+ /**
35
+ * Roots whose module the package index re-exports only by these names. The release roots
36
+ * (RFC-0046) keep their local `$defs` local: those definitions are portable copies (`SiteId`,
37
+ * `Capability`, `Sha256Hex`, …) whose generic names would claim the package's public type
38
+ * namespace with meanings that hold only inside a release manifest. Every listed name must be
39
+ * declared by the generated module (gen-ts refuses otherwise).
40
+ */
41
+ export const INDEX_EXPORTS = {
42
+ "release-manifest": ["ReleaseManifest", "WorkerArtifact", "BindingTemplate"],
43
+ "release-statement": ["ReleaseStatement", "StatementAsset"],
44
+ "release-keys": ["ReleaseKeys", "ListedKey"],
45
+ "release-yank-list": ["ReleaseYankList"],
46
+ };
47
+
30
48
  export const COMMON_SCHEMA = "common";
@@ -21,3 +21,7 @@ export type { ReleaseId, ReleaseItem, ReleaseNodeKind, ReleaseWhen, LocalDateTim
21
21
  export type { AutomationId, AutomationJob, AutomationRule, AutomationState, Automation, BuiltinAutomationJob, AgentTaskAutomationJob, AutomationBudget, AutomationRecurrence, AutomationOwner } from "./automation.js";
22
22
  export type { ScheduleRunId, ScheduleRunSubject, ScheduleRunState, ScheduleRun, ReleaseRunSubject, AutomationRunSubject, ScheduleRunWindow, ScheduleRunUsage, ScheduleRunTaint, ScheduleRunError } from "./schedule-run.js";
23
23
  export type { Glossary, GlossaryEntry } from "./glossary.js";
24
+ export type { ReleaseManifest, WorkerArtifact, BindingTemplate } from "./release-manifest.js";
25
+ export type { ReleaseStatement, StatementAsset } from "./release-statement.js";
26
+ export type { ReleaseKeys, ListedKey } from "./release-keys.js";
27
+ export type { ReleaseYankList } from "./release-yank-list.js";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT.
3
+ * Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`)
4
+ */
5
+ /**
6
+ * Version of this contract. Readers reject unknown versions; migrations move documents forward one version at a time.
7
+ *
8
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
9
+ * via the `definition` "SchemaVersion".
10
+ */
11
+ export type SchemaVersion = 1;
12
+ /**
13
+ * RFC 3339 / ISO 8601 instant in UTC.
14
+ *
15
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
16
+ * via the `definition` "Timestamp".
17
+ */
18
+ export type Timestamp = string;
19
+ /**
20
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
21
+ * via the `definition` "KeyId".
22
+ */
23
+ export type KeyId = string;
24
+ /**
25
+ * cloudhal.release-keys@1 (RFC-0046 §9): the root-signed list of Cloudhal's release and yank keys, published as keys.json at https://cloudhal.dev/.well-known/cloudhal/keys.json next to keys.json.sig (a raw 64-byte Ed25519 signature by the offline root over the exact bytes). A consumer uses it only to reduce trust in the keys it pins: revoke, mark retiring, narrow a validity window; it never adds a key. Canonical bytes as for the release statement.
26
+ */
27
+ export interface ReleaseKeys {
28
+ schemaVersion: SchemaVersion;
29
+ format: "cloudhal.release-keys@1";
30
+ issuedAt: Timestamp;
31
+ /**
32
+ * RFC 3339 / ISO 8601 instant in UTC.
33
+ */
34
+ expires: string;
35
+ signing: {
36
+ /**
37
+ * The root key that signed this list.
38
+ */
39
+ keyId: string;
40
+ algorithm: "Ed25519";
41
+ signature: "keys.json.sig";
42
+ };
43
+ /**
44
+ * @maxItems 64
45
+ */
46
+ keys: ListedKey[];
47
+ }
48
+ /**
49
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
50
+ * via the `definition` "ListedKey".
51
+ */
52
+ export interface ListedKey {
53
+ keyId: KeyId;
54
+ /**
55
+ * The raw 32-byte Ed25519 public key, base64.
56
+ */
57
+ publicKey: string;
58
+ role: "release" | "yank";
59
+ notBefore: Timestamp;
60
+ notAfter: Timestamp;
61
+ status: "active" | "retiring" | "revoked";
62
+ }
@@ -0,0 +1,66 @@
1
+ /* eslint-disable */
2
+ /* biome-ignore-all lint: generated */
3
+ /**
4
+ * GENERATED FILE — DO NOT EDIT.
5
+ * Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`)
6
+ */
7
+
8
+ /**
9
+ * Version of this contract. Readers reject unknown versions; migrations move documents forward one version at a time.
10
+ *
11
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
12
+ * via the `definition` "SchemaVersion".
13
+ */
14
+
15
+ /**
16
+ * RFC 3339 / ISO 8601 instant in UTC.
17
+ *
18
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
19
+ * via the `definition` "Timestamp".
20
+ */
21
+
22
+ /**
23
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
24
+ * via the `definition` "KeyId".
25
+ */
26
+
27
+
28
+ /**
29
+ * cloudhal.release-keys@1 (RFC-0046 §9): the root-signed list of Cloudhal's release and yank keys, published as keys.json at https://cloudhal.dev/.well-known/cloudhal/keys.json next to keys.json.sig (a raw 64-byte Ed25519 signature by the offline root over the exact bytes). A consumer uses it only to reduce trust in the keys it pins: revoke, mark retiring, narrow a validity window; it never adds a key. Canonical bytes as for the release statement.
30
+ */
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+ /**
53
+ * This interface was referenced by `ReleaseKeys`'s JSON-Schema
54
+ * via the `definition` "ListedKey".
55
+ */
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
@@ -0,0 +1,206 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT.
3
+ * Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`)
4
+ */
5
+ /**
6
+ * Version of this contract. Readers reject unknown versions; migrations move documents forward one version at a time.
7
+ *
8
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
9
+ * via the `definition` "SchemaVersion".
10
+ */
11
+ export type SchemaVersion = 1;
12
+ /**
13
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
14
+ * via the `definition` "CloudhalVersion".
15
+ */
16
+ export type CloudhalVersion = string;
17
+ /**
18
+ * RFC 3339 / ISO 8601 instant in UTC.
19
+ *
20
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
21
+ * via the `definition` "Timestamp".
22
+ */
23
+ export type Timestamp = string;
24
+ /**
25
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
26
+ * via the `definition` "MigrationName".
27
+ */
28
+ export type MigrationName = string;
29
+ /**
30
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
31
+ * via the `definition` "BindingName".
32
+ */
33
+ export type BindingName = string;
34
+ /**
35
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
36
+ * via the `definition` "Sha256Hex".
37
+ */
38
+ export type Sha256Hex = string;
39
+ /**
40
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
41
+ * via the `definition` "SecretName".
42
+ */
43
+ export type SecretName = "BETTER_AUTH_SECRET" | "MCP_STATE_KEY" | "CLOUDHAL_PREVIEW_SECRET" | "CLOUDHAL_PURGE_TOKEN" | "CLOUDHAL_DEPLOY_TOKEN" | "CLOUDHAL_SETUP_TOKEN" | "CLOUDHAL_COMMENTS_KEY";
44
+ /**
45
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
46
+ * via the `definition` "ScopeId".
47
+ */
48
+ export type ScopeId = string;
49
+ /**
50
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
51
+ * via the `definition` "Capability".
52
+ */
53
+ export type Capability = "account" | "workers" | "d1" | "r2" | "analytics" | "domains";
54
+ /**
55
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
56
+ * via the `definition` "SiteId".
57
+ */
58
+ export type SiteId = string;
59
+ /**
60
+ * cloudhal.release-manifest@1 (RFC-0046): the manifest of one Cloudhal release bundle, published as the release asset manifest.json next to the gzip tarball cloudhal-release-<version>.tar.gz. A project release is signed through release-statement.json, which pins this file's SHA-256 and size (signing.signature = release-statement.sig); the legacy form manifest.sig, a raw 64-byte Ed25519 signature over these exact bytes, is for development keys only. It describes every built Worker module and static asset by size and SHA-256, the binding templates, feature levels, migration range and rollback facts a remote deployer needs to install, update or refuse a version without running a build. Portable on purpose: it references common only for SchemaVersion and Timestamp; every other definition is local.
61
+ */
62
+ export interface ReleaseManifest {
63
+ schemaVersion: SchemaVersion;
64
+ format: "cloudhal.release-manifest@1";
65
+ version: CloudhalVersion;
66
+ channel: "stable" | "next";
67
+ securityRelease: boolean;
68
+ commit: string;
69
+ createdAt: Timestamp;
70
+ contracts: {
71
+ schemaVersion: 1;
72
+ };
73
+ levels: {
74
+ schedules: number;
75
+ gates: number;
76
+ };
77
+ migrations: {
78
+ first: MigrationName;
79
+ last: MigrationName;
80
+ count: number;
81
+ /**
82
+ * @minItems 1
83
+ */
84
+ names: [MigrationName, ...MigrationName[]];
85
+ compatibleWithPrevious: boolean;
86
+ };
87
+ durableObjects: {
88
+ bindings: {
89
+ name: BindingName;
90
+ className: string;
91
+ migration: string;
92
+ }[];
93
+ lifecycleChange: boolean;
94
+ };
95
+ runtime: {
96
+ compatibilityDate: string;
97
+ compatibilityFlags: string[];
98
+ };
99
+ toolchain: {
100
+ [k: string]: string | undefined;
101
+ };
102
+ theme: {
103
+ name: string;
104
+ version: string;
105
+ blockTypes: string[];
106
+ settingsSha256: Sha256Hex;
107
+ designSha256: Sha256Hex;
108
+ };
109
+ skills: {
110
+ name: string;
111
+ sha256: Sha256Hex;
112
+ }[];
113
+ workers: {
114
+ site: WorkerArtifact;
115
+ admin: WorkerArtifact;
116
+ };
117
+ bindingTemplates: {
118
+ site: BindingTemplate;
119
+ admin: BindingTemplate;
120
+ };
121
+ requiredScopes: ScopeId[];
122
+ optionalScopes: ScopeId[];
123
+ requiredCapabilities: Capability[];
124
+ optionalCapabilities: Capability[];
125
+ starter: {
126
+ kind: "admin-api";
127
+ } | {
128
+ kind: "bundle";
129
+ path: string;
130
+ bytes: number;
131
+ sha256: Sha256Hex;
132
+ siteId: SiteId;
133
+ };
134
+ features: {
135
+ adminSitesAcceptsSiteId: boolean;
136
+ healthReportsVersion: boolean;
137
+ mediaTransformVar: boolean;
138
+ [k: string]: boolean | undefined;
139
+ };
140
+ planVersion: number;
141
+ signing: {
142
+ keyId: string;
143
+ algorithm: "Ed25519";
144
+ signature: "manifest.sig" | "release-statement.sig";
145
+ };
146
+ }
147
+ /**
148
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
149
+ * via the `definition` "WorkerArtifact".
150
+ */
151
+ export interface WorkerArtifact {
152
+ mainModule: string;
153
+ /**
154
+ * @minItems 1
155
+ */
156
+ modules: [
157
+ {
158
+ path: string;
159
+ type: "esm" | "cjs" | "wasm" | "text" | "data";
160
+ bytes: number;
161
+ sha256: Sha256Hex;
162
+ },
163
+ ...{
164
+ path: string;
165
+ type: "esm" | "cjs" | "wasm" | "text" | "data";
166
+ bytes: number;
167
+ sha256: Sha256Hex;
168
+ }[]
169
+ ];
170
+ assets: {
171
+ count: number;
172
+ bytes: number;
173
+ /**
174
+ * @maxItems 20000
175
+ */
176
+ files: {
177
+ path: string;
178
+ bytes: number;
179
+ sha256: Sha256Hex;
180
+ assetHash: string;
181
+ contentType: string;
182
+ }[];
183
+ headers: string;
184
+ config?: {
185
+ not_found_handling?: "none" | "404-page" | "single-page-application";
186
+ run_worker_first?: string[];
187
+ };
188
+ };
189
+ bindingTemplate?: "site" | "admin";
190
+ }
191
+ /**
192
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
193
+ * via the `definition` "BindingTemplate".
194
+ */
195
+ export interface BindingTemplate {
196
+ bindings: {
197
+ name: BindingName;
198
+ type: "d1" | "r2_bucket" | "assets" | "service" | "durable_object_namespace" | "analytics_engine" | "analytics_sql" | "ratelimit" | "ai_search" | "send_email" | "ai" | "browser";
199
+ required: boolean;
200
+ aliases?: BindingName[];
201
+ }[];
202
+ vars: BindingName[];
203
+ secrets: SecretName[];
204
+ cache?: boolean;
205
+ cron?: string;
206
+ }
@@ -0,0 +1,231 @@
1
+ /* eslint-disable */
2
+ /* biome-ignore-all lint: generated */
3
+ /**
4
+ * GENERATED FILE — DO NOT EDIT.
5
+ * Source: packages/core-contracts/schemas/*.schema.json (run `pnpm gen`)
6
+ */
7
+
8
+ /**
9
+ * Version of this contract. Readers reject unknown versions; migrations move documents forward one version at a time.
10
+ *
11
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
12
+ * via the `definition` "SchemaVersion".
13
+ */
14
+
15
+ /**
16
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
17
+ * via the `definition` "CloudhalVersion".
18
+ */
19
+
20
+ /**
21
+ * RFC 3339 / ISO 8601 instant in UTC.
22
+ *
23
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
24
+ * via the `definition` "Timestamp".
25
+ */
26
+
27
+ /**
28
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
29
+ * via the `definition` "MigrationName".
30
+ */
31
+
32
+ /**
33
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
34
+ * via the `definition` "BindingName".
35
+ */
36
+
37
+ /**
38
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
39
+ * via the `definition` "Sha256Hex".
40
+ */
41
+
42
+ /**
43
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
44
+ * via the `definition` "SecretName".
45
+ */
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ /**
55
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
56
+ * via the `definition` "ScopeId".
57
+ */
58
+
59
+ /**
60
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
61
+ * via the `definition` "Capability".
62
+ */
63
+
64
+ /**
65
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
66
+ * via the `definition` "SiteId".
67
+ */
68
+
69
+
70
+ /**
71
+ * cloudhal.release-manifest@1 (RFC-0046): the manifest of one Cloudhal release bundle, published as the release asset manifest.json next to the gzip tarball cloudhal-release-<version>.tar.gz. A project release is signed through release-statement.json, which pins this file's SHA-256 and size (signing.signature = release-statement.sig); the legacy form manifest.sig, a raw 64-byte Ed25519 signature over these exact bytes, is for development keys only. It describes every built Worker module and static asset by size and SHA-256, the binding templates, feature levels, migration range and rollback facts a remote deployer needs to install, update or refuse a version without running a build. Portable on purpose: it references common only for SchemaVersion and Timestamp; every other definition is local.
72
+ */
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ /**
161
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
162
+ * via the `definition` "WorkerArtifact".
163
+ */
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ /**
205
+ * This interface was referenced by `ReleaseManifest`'s JSON-Schema
206
+ * via the `definition` "BindingTemplate".
207
+ */
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+