@brickkit/cli 0.11.0 → 0.13.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 (177) hide show
  1. package/dashboard-dist/CollapsiblePanel-CbUysOp5.js +2 -0
  2. package/dashboard-dist/CompositeRoot-D4sRkYq3.js +1 -0
  3. package/dashboard-dist/Geist-Variable.woff2 +0 -0
  4. package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
  5. package/dashboard-dist/PopoverPopup-CiI2avT_.js +1 -0
  6. package/dashboard-dist/api-reference-mT9VNcPb.js +265 -0
  7. package/dashboard-dist/app.css +2 -2
  8. package/dashboard-dist/app.js +12 -13
  9. package/dashboard-dist/ccount-CcG1m-Yh.js +1 -0
  10. package/dashboard-dist/client-CwATkLJa.js +1 -0
  11. package/dashboard-dist/core-BEUWp6B5.js +1 -0
  12. package/dashboard-dist/docs-BRrtyxDB.js +4 -0
  13. package/dashboard-dist/docs.css +1 -1
  14. package/dashboard-dist/kit.js +1 -1
  15. package/dashboard-dist/popover-Bj9x-88h.js +1 -0
  16. package/dist/bin.d.ts +0 -2
  17. package/dist/bin.js +309 -211
  18. package/dist/bin.js.map +1 -1
  19. package/dist/build.js +463 -0
  20. package/dist/build.js.map +1 -0
  21. package/dist/client-contract-file.js +356 -1
  22. package/dist/client-contract-file.js.map +1 -0
  23. package/dist/compiler.d.ts +12 -3
  24. package/dist/compiler.js +1 -1
  25. package/dist/compiler2.js +13 -7
  26. package/dist/compiler2.js.map +1 -1
  27. package/dist/config.d.ts +3 -0
  28. package/dist/config.js +1 -252
  29. package/dist/config2.d.ts +122 -0
  30. package/dist/config2.js +207 -0
  31. package/dist/config2.js.map +1 -0
  32. package/dist/dashboard-extension.d.ts +3 -2
  33. package/dist/{dev-telemetry-store.js → dashboard-host.js} +1381 -1432
  34. package/dist/dashboard-host.js.map +1 -0
  35. package/dist/dashboard-protocol.js +189 -0
  36. package/dist/dashboard-protocol.js.map +1 -0
  37. package/dist/dashboard.d.ts +8 -135
  38. package/dist/definitions.js +33 -0
  39. package/dist/definitions.js.map +1 -0
  40. package/dist/dev-application.js +34 -0
  41. package/dist/dev-application.js.map +1 -0
  42. package/dist/dev-protocol.js +21 -0
  43. package/dist/dev-protocol.js.map +1 -0
  44. package/dist/dev-reporter.d.ts +0 -2
  45. package/dist/dev-reporter.js +3 -3
  46. package/dist/dev-reporter.js.map +1 -1
  47. package/dist/dev-telemetry.js +8 -24
  48. package/dist/dev-telemetry.js.map +1 -1
  49. package/dist/dev-worker.js +80 -21
  50. package/dist/dev-worker.js.map +1 -1
  51. package/dist/index.d.ts +18 -87
  52. package/dist/index.js +12 -6
  53. package/dist/index.js.map +1 -0
  54. package/dist/lint/oxlint.d.ts +0 -2
  55. package/dist/lint/oxlint.js +6 -5
  56. package/dist/lint/oxlint.js.map +1 -1
  57. package/dist/own-module.js +7 -0
  58. package/dist/own-module.js.map +1 -0
  59. package/dist/plugin.d.ts +6 -11
  60. package/dist/plugin.js +6 -42
  61. package/dist/plugin.js.map +1 -1
  62. package/dist/production-dashboard.d.ts +2 -0
  63. package/dist/production-dashboard.js +51 -0
  64. package/dist/production-dashboard.js.map +1 -0
  65. package/dist/production-dashboard2.d.ts +34 -0
  66. package/dist/{presets.js → project.js} +107 -113
  67. package/dist/project.js.map +1 -0
  68. package/dist/serve.d.ts +24 -0
  69. package/dist/serve.js +1 -0
  70. package/dist/serve2.js +49 -0
  71. package/dist/serve2.js.map +1 -0
  72. package/dist/vite.d.ts +0 -2
  73. package/dist/vite.js +28 -51
  74. package/dist/vite.js.map +1 -1
  75. package/dist/workflows.d.ts +2 -4
  76. package/dist/workflows2.js +60 -39
  77. package/dist/workflows2.js.map +1 -1
  78. package/inspector-dist/client/assets/api.rpc-BvRk9kiK.js +0 -0
  79. package/inspector-dist/client/assets/api.stream._streamId-BvRk9kiK.js +0 -0
  80. package/inspector-dist/client/assets/app-CeSwVsRm.css +2 -0
  81. package/inspector-dist/client/assets/dist-BK8w6xOr.js +3930 -0
  82. package/inspector-dist/client/assets/dist-CG2aVufI.js +197 -0
  83. package/inspector-dist/client/assets/entry.client-D9jbgmTR.js +9391 -0
  84. package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-CfRnuITN.js +34 -0
  85. package/inspector-dist/client/assets/home-hwPlkNhv.js +4034 -0
  86. package/inspector-dist/client/assets/jsx-runtime-CPEah4WQ.js +7084 -0
  87. package/inspector-dist/client/assets/manifest-0e76e9ac.js +1 -0
  88. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-ZDR2PNY_.js +1 -0
  89. package/inspector-dist/client/assets/root-ChBNTZd2.css +2 -0
  90. package/inspector-dist/client/assets/root-SLeEf-sT.js +320 -0
  91. package/inspector-dist/client/assets/run-detail-DYbVkIFH.js +1871 -0
  92. package/inspector-dist/client/assets/tabs-CaJisoyb.js +73751 -0
  93. package/inspector-dist/client/assets/tabs-L5XKzOpP.css +1 -0
  94. package/inspector-dist/client/assets/zstd-browser-decoder-D94wmfAU.js +41 -0
  95. package/inspector-dist/server/assets/app-DGlfWVUI.js +99330 -0
  96. package/inspector-dist/server/assets/chunk-RLXIAIE6-F0SJZlei.js +42975 -0
  97. package/inspector-dist/server/assets/dist-BCbwm6jl.js +10325 -0
  98. package/inspector-dist/server/assets/dist-CG2aVufI.js +197 -0
  99. package/inspector-dist/server/assets/dist-Ce0I2PUv.js +1137 -0
  100. package/inspector-dist/server/assets/dist-DY0UlahA.js +1642 -0
  101. package/inspector-dist/server/assets/encryption-DdQgC8Rk.js +886 -0
  102. package/inspector-dist/server/assets/event-metadata-n7E4zEmT.js +145 -0
  103. package/inspector-dist/server/assets/functions-CNVQtbgg.js +1170 -0
  104. package/inspector-dist/server/assets/global-singleton-D8sIN5du.js +80 -0
  105. package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-CWRzMxYD.js +34 -0
  106. package/inspector-dist/server/assets/mermaid-3ZIDBTTL-D0v0ngVr.js +1 -0
  107. package/inspector-dist/server/assets/parse-Begau9cA.js +469 -0
  108. package/inspector-dist/server/assets/rolldown-runtime-C1I3wEg2.js +43 -0
  109. package/inspector-dist/server/assets/serialization-format-BbuGfHog.js +476 -0
  110. package/inspector-dist/server/assets/token-BgMmJNP5.js +60 -0
  111. package/inspector-dist/server/assets/token-BrUX0bxz.js +55 -0
  112. package/inspector-dist/server/assets/token-util-DZN32qmT.js +455 -0
  113. package/inspector-dist/server/assets/wrapper-CIC3w0oC.js +3624 -0
  114. package/inspector-dist/server/assets/ws-transport-CxTYB11n.js +29476 -0
  115. package/inspector-dist/server/assets/zstd-browser-decoder-D7bCXbGg.js +38 -0
  116. package/inspector-dist/server/index.js +1 -58
  117. package/package.json +39 -28
  118. package/vite-client.d.ts +1 -1
  119. package/dashboard-dist/CollapsiblePanel-BX79_W-b.js +0 -2
  120. package/dashboard-dist/CompositeRoot-xzybXjnx.js +0 -1
  121. package/dashboard-dist/PopoverPopup-CvlmC7EL.js +0 -1
  122. package/dashboard-dist/api-reference-BcAYVYwJ.js +0 -260
  123. package/dashboard-dist/core-BGO9JZ1r.js +0 -1
  124. package/dashboard-dist/docs-DHikPD2v.js +0 -4
  125. package/dashboard-dist/popover-DG498XHH.js +0 -1
  126. package/dist/app-entry.js +0 -1
  127. package/dist/app-entry2.js +0 -19
  128. package/dist/app-entry2.js.map +0 -1
  129. package/dist/bin.d.ts.map +0 -1
  130. package/dist/client-contract-file2.js +0 -34
  131. package/dist/client-contract-file2.js.map +0 -1
  132. package/dist/client-contract.js +0 -1
  133. package/dist/client-contract2.js +0 -294
  134. package/dist/client-contract2.js.map +0 -1
  135. package/dist/config.js.map +0 -1
  136. package/dist/dashboard-extension.d.ts.map +0 -1
  137. package/dist/dev-reporter.d.ts.map +0 -1
  138. package/dist/dev-telemetry-store.js.map +0 -1
  139. package/dist/emit.d.ts +0 -7
  140. package/dist/emit.d.ts.map +0 -1
  141. package/dist/index.d.ts.map +0 -1
  142. package/dist/lint/oxlint.d.ts.map +0 -1
  143. package/dist/plugin.d.ts.map +0 -1
  144. package/dist/presets.js.map +0 -1
  145. package/dist/runner.js +0 -523
  146. package/dist/runner.js.map +0 -1
  147. package/dist/vite.d.ts.map +0 -1
  148. package/dist/workflows.d.ts.map +0 -1
  149. package/inspector-dist/client/assets/api.rpc-l0sNRNKZ.js +0 -1
  150. package/inspector-dist/client/assets/api.stream._streamId-l0sNRNKZ.js +0 -1
  151. package/inspector-dist/client/assets/app-CvoGgWcV.css +0 -1
  152. package/inspector-dist/client/assets/entry.client-BJ6G3n5t.js +0 -11697
  153. package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-C-3wZnxf.js +0 -19
  154. package/inspector-dist/client/assets/home-CSKAS4P2.js +0 -4979
  155. package/inspector-dist/client/assets/index-DECCyMR0.js +0 -4482
  156. package/inspector-dist/client/assets/index-Dot7CgrA.js +0 -9837
  157. package/inspector-dist/client/assets/index-HqNj_XIX.js +0 -200
  158. package/inspector-dist/client/assets/manifest-139c9319.js +0 -1
  159. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-DC0K8uTy.js +0 -58626
  160. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-F88p7PFX.css +0 -1
  161. package/inspector-dist/client/assets/root-BMHd_XHz.css +0 -1
  162. package/inspector-dist/client/assets/root-cbi6iYwg.js +0 -305
  163. package/inspector-dist/client/assets/run-detail-CWoGxu_0.css +0 -1
  164. package/inspector-dist/client/assets/run-detail-Cc7tSGNq.js +0 -6237
  165. package/inspector-dist/client/assets/world-config-context-BAD1QCrR.js +0 -26
  166. package/inspector-dist/client/assets/zstd-browser-decoder-BQoRpP7L.js +0 -28
  167. package/inspector-dist/server/assets/app-DUP5RybL.js +0 -174880
  168. package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-D2g4hL2-.js +0 -71
  169. package/inspector-dist/server/assets/index-BfLBLRRi.js +0 -204
  170. package/inspector-dist/server/assets/index-BzrGWk7J.js +0 -1164
  171. package/inspector-dist/server/assets/index-D71yP6AL.js +0 -191
  172. package/inspector-dist/server/assets/index-wGSWRns3.js +0 -1296
  173. package/inspector-dist/server/assets/mermaid-3ZIDBTTL-DsvuKoEV.js +0 -58
  174. package/inspector-dist/server/assets/token-ClUZZwXl.js +0 -95
  175. package/inspector-dist/server/assets/token-util-DSxMZ6nI.js +0 -33
  176. package/inspector-dist/server/assets/wrapper-B3vstpCO.js +0 -67
  177. package/inspector-dist/server/assets/zstd-browser-decoder-Dn82m2BU.js +0 -77
@@ -0,0 +1,476 @@
1
+ import { r as __exportAll } from "./rolldown-runtime-C1I3wEg2.js";
2
+ import { t as globalSingleton } from "./global-singleton-D8sIN5du.js";
3
+ import { i as getEventDataRefFields } from "./event-metadata-n7E4zEmT.js";
4
+ import { n as unflatten, t as parse } from "./parse-Begau9cA.js";
5
+ import { r as deriveRunPayloadKeys } from "./encryption-DdQgC8Rk.js";
6
+ // ../../node_modules/.bun/@workflow+core@5.3.0+eefe5d4a997ff1ee/node_modules/@workflow/core/dist/serialization-format.js
7
+ /**
8
+ * Browser-safe serialization format utilities.
9
+ *
10
+ * This module contains the format prefix handling, generic hydrate/dehydrate
11
+ * dispatch, and shared types/classes used by all environments (runtime, web
12
+ * o11y, CLI o11y). It has NO Node.js dependencies.
13
+ */
14
+ var serialization_format_exports = /* @__PURE__ */ __exportAll({
15
+ deriveRunPayloadKeys: () => deriveRunPayloadKeys,
16
+ hydrateDataWithKey: () => hydrateDataWithKey
17
+ });
18
+ var SerializationFormat = {
19
+ /** devalue stringify/parse with TextEncoder/TextDecoder */
20
+ DEVALUE_V1: "devl",
21
+ /** Encrypted payload (inner payload has its own format prefix after decryption) */
22
+ ENCRYPTED: "encr",
23
+ /**
24
+ * Sealed payload: asymmetrically encrypted to a run's X25519 public key
25
+ * (inner payload has its own format prefix after opening).
26
+ *
27
+ * Written by cross-run writers that hold only the recipient run's public
28
+ * key. Opening it requires the run's private scalar rather than the
29
+ * symmetric per-run key, so o11y display treats it as ciphertext via
30
+ * {@link isEncryptedData} but {@link hydrateDataWithKey} does not attempt
31
+ * an AES-GCM decrypt on it.
32
+ */
33
+ SEALED: "encp",
34
+ /** Gzip-compressed payload (inner payload has its own format prefix after decompression) */
35
+ GZIP: "gzip",
36
+ /** Zstandard-compressed payload (inner payload has its own format prefix after decompression) */
37
+ ZSTD: "zstd"
38
+ };
39
+ /** Length of the format prefix in bytes */
40
+ var FORMAT_PREFIX_LENGTH = 4;
41
+ new TextEncoder();
42
+ var formatDecoder = new TextDecoder();
43
+ /**
44
+ * Decode a format-prefixed payload.
45
+ */
46
+ function decodeFormatPrefix(data) {
47
+ if (!(data instanceof Uint8Array)) return {
48
+ format: SerializationFormat.DEVALUE_V1,
49
+ payload: new TextEncoder().encode(JSON.stringify(data))
50
+ };
51
+ if (data.length < FORMAT_PREFIX_LENGTH) throw new Error(`Data too short to contain format prefix: expected at least ${FORMAT_PREFIX_LENGTH} bytes, got ${data.length}`);
52
+ const prefixBytes = data.subarray(0, FORMAT_PREFIX_LENGTH);
53
+ const format = formatDecoder.decode(prefixBytes);
54
+ const knownFormats = Object.values(SerializationFormat);
55
+ if (!knownFormats.includes(format)) throw new Error(`Unknown serialization format: "${format}". Known formats: ${knownFormats.join(", ")}`);
56
+ return {
57
+ format,
58
+ payload: data.subarray(FORMAT_PREFIX_LENGTH)
59
+ };
60
+ }
61
+ /**
62
+ * Check if a plain object is `{ expiredAt: "<ISO date>" }`: a single-key
63
+ * object with a string `expiredAt` value.
64
+ */
65
+ function isExpiredObject(data) {
66
+ if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
67
+ const keys = Object.keys(data);
68
+ return keys.length === 1 && keys[0] === "expiredAt" && typeof data.expiredAt === "string";
69
+ }
70
+ /**
71
+ * Check if a hydrated value is an expired data stub from the server.
72
+ *
73
+ * The server replaces expired ref fields with a devalue-encoded stub
74
+ * (`makeExpiredStub`) that deserializes to `[{ expiredAt: "<ISO date>" }]`
75
+ * after `unflatten` (array-wrapped due to backwards-compatible encoding).
76
+ * Also matches the unwrapped `{ expiredAt: "..." }` form for robustness.
77
+ */
78
+ function isExpiredStub(data) {
79
+ if (isExpiredObject(data)) return true;
80
+ if (Array.isArray(data) && data.length === 1 && isExpiredObject(data[0])) return true;
81
+ return false;
82
+ }
83
+ /**
84
+ * Check if a binary value is ciphertext: either a symmetrically encrypted
85
+ * payload ('encr') or a sealed cross-run payload ('encp').
86
+ *
87
+ * This is the predicate display layers want: both schemes are opaque bytes
88
+ * that must not be fed to the devalue parser, and both render as the same
89
+ * "Encrypted" affordance in the CLI and web UI. Use {@link isSealedData} when
90
+ * the *scheme* matters, notably when choosing a decryption path, since a
91
+ * sealed payload needs the run's private scalar rather than its symmetric key.
92
+ *
93
+ * Browser-safe: does not depend on the full serialization module.
94
+ */
95
+ function isEncryptedData(data) {
96
+ if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) return false;
97
+ const prefix = formatDecoder.decode(data.subarray(0, FORMAT_PREFIX_LENGTH));
98
+ return prefix === SerializationFormat.ENCRYPTED || prefix === SerializationFormat.SEALED;
99
+ }
100
+ /**
101
+ * Check if a binary value has the 'encp' format prefix, indicating a sealed
102
+ * (asymmetrically encrypted) cross-run payload.
103
+ *
104
+ * Browser-safe: does not depend on the full serialization module.
105
+ */
106
+ function isSealedData(data) {
107
+ if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) return false;
108
+ return formatDecoder.decode(data.subarray(0, FORMAT_PREFIX_LENGTH)) === SerializationFormat.SEALED;
109
+ }
110
+ /**
111
+ * Check if a binary value has a compression format prefix ('gzip' or 'zstd').
112
+ * Browser-safe: does not depend on the full serialization module.
113
+ */
114
+ function isCompressedData(data) {
115
+ if (!(data instanceof Uint8Array) || data.length < FORMAT_PREFIX_LENGTH) return false;
116
+ const prefix = formatDecoder.decode(data.subarray(0, FORMAT_PREFIX_LENGTH));
117
+ return prefix === SerializationFormat.GZIP || prefix === SerializationFormat.ZSTD;
118
+ }
119
+ /**
120
+ * Resolve `node:zlib` via `process.getBuiltinModule`: no static Node
121
+ * dependency, invisible to browser bundlers. Returns undefined off Node.
122
+ */
123
+ function getNodeZlib() {
124
+ try {
125
+ return globalThis.process?.getBuiltinModule?.("node:zlib");
126
+ } catch {
127
+ return;
128
+ }
129
+ }
130
+ /**
131
+ * Synchronously decompress a `gzip`/`zstd` payload when running on Node.js.
132
+ *
133
+ * Returns `undefined` when sync decompression isn't available (e.g. in the
134
+ * browser, or zstd on Node < 22.15); callers fall back to leaving the data
135
+ * un-hydrated (the async `hydrateDataWithKey` path handles decompression in
136
+ * browsers via `DecompressionStream` / a registered zstd decoder).
137
+ */
138
+ function decompressSyncIfAvailable(format, payload) {
139
+ try {
140
+ const zlib = getNodeZlib();
141
+ if (format === SerializationFormat.GZIP && zlib?.gunzipSync) return new Uint8Array(zlib.gunzipSync(payload));
142
+ if (format === SerializationFormat.ZSTD && zlib?.zstdDecompressSync) return new Uint8Array(zlib.zstdDecompressSync(payload));
143
+ } catch {}
144
+ }
145
+ /**
146
+ * Browser zstd decoder, registered by the o11y host (web-shared) since the
147
+ * Web `DecompressionStream` has no zstd support. Node decodes via `node:zlib`
148
+ * and never needs this. See `registerZstdDecoder`.
149
+ */
150
+ var zstd = globalSingleton("@workflow/core//zstd.decoder", 1, () => ({ decoder: void 0 }));
151
+ /**
152
+ * Register a browser zstd decoder (e.g. a WASM-backed one). The web o11y UI
153
+ * calls this at init so `hydrateDataWithKey` can inflate zstd payloads after
154
+ * client-side decryption. Node readers use `node:zlib` and ignore this.
155
+ */
156
+ function registerZstdDecoder(decoder) {
157
+ zstd.decoder = decoder;
158
+ }
159
+ /**
160
+ * Asynchronously decompress a `gzip`/`zstd` payload.
161
+ * - gzip: web-standard `DecompressionStream` (Node 18+, browsers, edge).
162
+ * - zstd: `node:zlib` when on Node, else the registered browser decoder.
163
+ */
164
+ async function decompressAsync(format, payload) {
165
+ if (format === SerializationFormat.ZSTD) {
166
+ const sync = decompressSyncIfAvailable(format, payload);
167
+ if (sync) return sync;
168
+ if (zstd.decoder) return zstd.decoder(payload);
169
+ throw new Error("zstd-compressed workflow data encountered but no zstd decoder is available. Node.js 22.15+ decodes natively; in the browser register one via registerZstdDecoder (the web o11y package does this).");
170
+ }
171
+ const transform = new DecompressionStream("gzip");
172
+ const writer = transform.writable.getWriter();
173
+ const writePromise = writer.write(payload).then(() => writer.close());
174
+ writePromise.catch(() => {});
175
+ const chunks = [];
176
+ let total = 0;
177
+ const reader = transform.readable.getReader();
178
+ for (;;) {
179
+ const { done, value } = await reader.read();
180
+ if (done) break;
181
+ chunks.push(value);
182
+ total += value.length;
183
+ }
184
+ await writePromise;
185
+ const out = new Uint8Array(total);
186
+ let offset = 0;
187
+ for (const chunk of chunks) {
188
+ out.set(chunk, offset);
189
+ offset += chunk.length;
190
+ }
191
+ return out;
192
+ }
193
+ /**
194
+ * Hydrate (deserialize) a value that was stored in the database.
195
+ *
196
+ * Handles four data shapes:
197
+ * 1. `Uint8Array` with 'encr' prefix → returned as-is (encrypted, not yet decrypted)
198
+ * 2. `Uint8Array` with a format prefix (specVersion 2+) → decode prefix, parse
199
+ * 3. `Array` (legacy specVersion 1, "revived devalue") → unflatten
200
+ * 4. Other (already a plain JS value) → return as-is
201
+ *
202
+ * Encrypted data is intentionally left as a `Uint8Array` so that consumers
203
+ * (CLI, web UI) can detect it with `isEncryptedData()` and decide how to
204
+ * handle it: the CLI replaces it with a styled placeholder, the web UI
205
+ * renders an "Encrypted" card with a Decrypt button that triggers
206
+ * client-side decryption on demand.
207
+ */
208
+ function hydrateData(value, revivers) {
209
+ if (value instanceof Uint8Array) {
210
+ if (isEncryptedData(value)) return value;
211
+ const { format, payload } = decodeFormatPrefix(value);
212
+ if (format === SerializationFormat.DEVALUE_V1) {
213
+ const str = new TextDecoder().decode(payload);
214
+ return parse(str, revivers);
215
+ }
216
+ if (format === SerializationFormat.GZIP || format === SerializationFormat.ZSTD) {
217
+ const inflated = decompressSyncIfAvailable(format, payload);
218
+ if (inflated === void 0) return value;
219
+ return hydrateData(inflated, revivers);
220
+ }
221
+ throw new Error(`Unsupported serialization format: ${format}`);
222
+ }
223
+ if (Array.isArray(value)) return unflatten(value, revivers);
224
+ return value;
225
+ }
226
+ /**
227
+ * Hydrate a value, decrypting it first if an encryption key is provided.
228
+ *
229
+ * This is the async version of `hydrateData` that supports transparent
230
+ * decryption. Used by o11y tooling (web UI, CLI) when the user requests
231
+ * decryption.
232
+ *
233
+ * @param value - The value to hydrate (may be encrypted or sealed)
234
+ * @param revivers - Devalue revivers for deserialization
235
+ * @param key - The run's key material. Pass `RunPayloadKeys` (from
236
+ * `deriveRunPayloadKeys`) to open both symmetric (`encr`) and sealed
237
+ * (`encp`) payloads; a bare `CryptoKey` opens only the symmetric ones.
238
+ * Typed as a read capability so a write-only seal target (which could open
239
+ * neither scheme) is rejected at compile time rather than failing here.
240
+ */
241
+ async function hydrateDataWithKey(value, revivers, key) {
242
+ let data = value;
243
+ if (data instanceof Uint8Array && isEncryptedData(data) && key) {
244
+ const { decrypt, isRunPayloadKeys } = await import("./encryption-DdQgC8Rk.js").then((n) => n.a);
245
+ if (!isSealedData(data) || isRunPayloadKeys(key)) data = await decrypt(data, key);
246
+ }
247
+ if (data instanceof Uint8Array && isCompressedData(data)) {
248
+ const { format, payload } = decodeFormatPrefix(data);
249
+ data = await decompressAsync(format, payload);
250
+ }
251
+ return hydrateData(data, revivers);
252
+ }
253
+ var STREAM_ID_PREFIX = "strm_";
254
+ /** Marker for stream reference objects rendered as links in the UI */
255
+ var STREAM_REF_TYPE = "__workflow_stream_ref__";
256
+ /** Marker for Run reference objects rendered as links in the UI */
257
+ var RUN_REF_TYPE = "__workflow_run_ref__";
258
+ /** Check if a value is a RunRef object */
259
+ var isRunRef = (value) => {
260
+ return value !== null && typeof value === "object" && "__type" in value && value.__type === "__workflow_run_ref__" && "runId" in value && typeof value.runId === "string";
261
+ };
262
+ /** Convert a serialized Run value to a RunRef for display */
263
+ var serializedRunToRunRef = (value) => {
264
+ return {
265
+ __type: RUN_REF_TYPE,
266
+ runId: value.runId
267
+ };
268
+ };
269
+ /** Marker for custom class instance references */
270
+ var CLASS_INSTANCE_REF_TYPE = "__workflow_class_instance_ref__";
271
+ /**
272
+ * A class instance reference for o11y display.
273
+ *
274
+ * Browser-safe base class: no `util.inspect.custom`. Environment-specific
275
+ * rendering (CLI inspect, web component) is handled by each consumer.
276
+ */
277
+ var ClassInstanceRef = class {
278
+ className;
279
+ classId;
280
+ data;
281
+ __type = CLASS_INSTANCE_REF_TYPE;
282
+ constructor(className, classId, data) {
283
+ this.className = className;
284
+ this.classId = classId;
285
+ this.data = data;
286
+ }
287
+ toJSON() {
288
+ return {
289
+ __type: this.__type,
290
+ className: this.className,
291
+ classId: this.classId,
292
+ data: this.data
293
+ };
294
+ }
295
+ };
296
+ /**
297
+ * Convert a serialized stream value to a StreamRef for display.
298
+ */
299
+ var streamToStreamRef = (value) => {
300
+ let streamId;
301
+ if ("name" in value) {
302
+ const name = String(value.name);
303
+ if (!name.startsWith(STREAM_ID_PREFIX)) streamId = `${STREAM_ID_PREFIX}${name}`;
304
+ else streamId = name;
305
+ } else streamId = `${STREAM_ID_PREFIX}null`;
306
+ return {
307
+ __type: STREAM_REF_TYPE,
308
+ streamId
309
+ };
310
+ };
311
+ /** Convert a serialized step function to a display string */
312
+ var serializedStepFunctionToString = (value) => {
313
+ if (!value) return "null";
314
+ if (typeof value !== "object") return "null";
315
+ if ("stepId" in value) return `<step:${value.stepId}>`;
316
+ return "<function>";
317
+ };
318
+ /** Extract the class name from a classId */
319
+ var extractClassName = (classId) => {
320
+ if (!classId) return "Unknown";
321
+ const parts = classId.split("/");
322
+ return parts[parts.length - 1] || classId;
323
+ };
324
+ /** Convert a serialized class instance to a ClassInstanceRef for display.
325
+ * Run instances are special-cased to a RunRef for clickable rendering. */
326
+ var serializedInstanceToRef = (value) => {
327
+ const className = extractClassName(value.classId);
328
+ if (className === "Run" && value.data !== null && typeof value.data === "object" && "runId" in value.data && typeof value.data.runId === "string") return serializedRunToRunRef(value.data);
329
+ return new ClassInstanceRef(className, value.classId, value.data);
330
+ };
331
+ /** Convert a serialized class reference to a display string */
332
+ var serializedClassToString = (value) => {
333
+ return `<class:${extractClassName(value.classId)}>`;
334
+ };
335
+ /**
336
+ * Standard o11y revivers that override runtime-specific types with
337
+ * display-friendly values. Used by both web and CLI hydration.
338
+ */
339
+ var observabilityRevivers = {
340
+ ReadableStream: streamToStreamRef,
341
+ WritableStream: streamToStreamRef,
342
+ TransformStream: streamToStreamRef,
343
+ AbortController: (value) => `<AbortController(aborted: ${value.aborted})>`,
344
+ AbortSignal: (value) => `<AbortSignal(aborted: ${value.aborted})>`,
345
+ DOMException: (value) => {
346
+ const G = globalThis;
347
+ if (typeof G.DOMException === "function") {
348
+ const e = new G.DOMException(value.message, value.name);
349
+ if (value.stack !== void 0) e.stack = value.stack;
350
+ if ("cause" in value) e.cause = value.cause;
351
+ return e;
352
+ }
353
+ const e = new Error(value.message);
354
+ e.name = value.name;
355
+ if (value.stack !== void 0) e.stack = value.stack;
356
+ if ("cause" in value) e.cause = value.cause;
357
+ return e;
358
+ },
359
+ StepFunction: serializedStepFunctionToString,
360
+ WorkflowFunction: (value) => `<workflow:${value.workflowId}>`,
361
+ Instance: serializedInstanceToRef,
362
+ Class: serializedClassToString
363
+ };
364
+ /**
365
+ * Hydrate the data fields of a step resource.
366
+ */
367
+ function hydrateStepIO(resource, revivers) {
368
+ let hydratedInput = resource.input;
369
+ let hydratedOutput = resource.output;
370
+ let hydratedError = resource.error;
371
+ if (resource.input != null) try {
372
+ hydratedInput = hydrateData(resource.input, revivers);
373
+ } catch {}
374
+ if (resource.output != null) try {
375
+ hydratedOutput = hydrateData(resource.output, revivers);
376
+ } catch {}
377
+ if (resource.error != null) try {
378
+ hydratedError = hydrateData(resource.error, revivers);
379
+ } catch {}
380
+ return {
381
+ ...resource,
382
+ input: hydratedInput,
383
+ output: hydratedOutput,
384
+ error: hydratedError
385
+ };
386
+ }
387
+ /**
388
+ * Hydrate the data fields of a workflow run resource.
389
+ */
390
+ function hydrateWorkflowIO(resource, revivers) {
391
+ let hydratedInput = resource.input;
392
+ let hydratedOutput = resource.output;
393
+ let hydratedError = resource.error;
394
+ let hydratedDynamicWorkflowCode = resource.dynamicWorkflowCode;
395
+ if (resource.input != null) try {
396
+ hydratedInput = hydrateData(resource.input, revivers);
397
+ } catch {}
398
+ if (resource.output != null) try {
399
+ hydratedOutput = hydrateData(resource.output, revivers);
400
+ } catch {}
401
+ if (resource.error != null) try {
402
+ hydratedError = hydrateData(resource.error, revivers);
403
+ } catch {}
404
+ if (resource.dynamicWorkflowCode != null) try {
405
+ hydratedDynamicWorkflowCode = hydrateData(resource.dynamicWorkflowCode, revivers);
406
+ } catch {}
407
+ return {
408
+ ...resource,
409
+ input: hydratedInput,
410
+ output: hydratedOutput,
411
+ error: hydratedError,
412
+ ...resource.dynamicWorkflowCode != null ? { dynamicWorkflowCode: hydratedDynamicWorkflowCode } : {}
413
+ };
414
+ }
415
+ /**
416
+ * Hydrate the eventData fields of an event resource.
417
+ */
418
+ function hydrateEventData(resource, revivers) {
419
+ if (!resource.eventData) return resource;
420
+ const eventData = { ...resource.eventData };
421
+ for (const field of getEventDataRefFields(resource.eventType ?? "")) {
422
+ if (eventData[field] == null) continue;
423
+ try {
424
+ eventData[field] = hydrateData(eventData[field], revivers);
425
+ } catch {}
426
+ }
427
+ return {
428
+ ...resource,
429
+ eventData
430
+ };
431
+ }
432
+ /**
433
+ * Hydrate the metadata field of a hook resource.
434
+ */
435
+ function hydrateHookMetadata(resource, revivers) {
436
+ if (resource.metadata == null) return resource;
437
+ let hydratedMetadata = resource.metadata;
438
+ try {
439
+ hydratedMetadata = hydrateData(resource.metadata, revivers);
440
+ } catch {}
441
+ return {
442
+ ...resource,
443
+ metadata: hydratedMetadata
444
+ };
445
+ }
446
+ /**
447
+ * Hydrate the serialized data fields of any resource for o11y display.
448
+ *
449
+ * Dispatches by resource type (step, hook, event, workflow) and calls
450
+ * `hydrateData` with the provided revivers for each data field.
451
+ *
452
+ * Each environment (web, CLI) provides its own revivers; this function
453
+ * only handles the dispatch logic and field mapping.
454
+ */
455
+ function hydrateResourceIO(resource, revivers) {
456
+ if (!resource) return resource;
457
+ let hydrated;
458
+ if ("stepId" in resource) hydrated = hydrateStepIO(resource, revivers);
459
+ else if ("hookId" in resource) hydrated = hydrateHookMetadata(resource, revivers);
460
+ else if ("eventId" in resource) hydrated = hydrateEventData(resource, revivers);
461
+ else hydrated = hydrateWorkflowIO(resource, revivers);
462
+ if ("executionContext" in hydrated) {
463
+ const { executionContext, ...rest } = hydrated;
464
+ const ctx = executionContext && typeof executionContext === "object" ? executionContext : void 0;
465
+ const preserved = {};
466
+ if (ctx?.workflowCoreVersion) preserved.workflowCoreVersion = ctx.workflowCoreVersion;
467
+ if (typeof ctx?.workflowVm === "string") preserved.workflowVm = ctx.workflowVm;
468
+ if (typeof ctx?.snapshotThreshold === "number") preserved.snapshotThreshold = ctx.snapshotThreshold;
469
+ return {
470
+ ...rest,
471
+ ...preserved
472
+ };
473
+ }
474
+ return hydrated;
475
+ }
476
+ export { isExpiredStub as a, registerZstdDecoder as c, isEncryptedData as i, serialization_format_exports as l, hydrateData as n, isRunRef as o, hydrateResourceIO as r, observabilityRevivers as s, extractClassName as t, serializedInstanceToRef as u };
@@ -0,0 +1,60 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-C1I3wEg2.js";
2
+ import { i as require_token_error, n as require_token_util, r as require_dist } from "./app-DGlfWVUI.js";
3
+ // ../../node_modules/.bun/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/token.js
4
+ var require_token = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var token_exports = {};
26
+ __export(token_exports, { refreshToken: () => refreshToken });
27
+ module.exports = __toCommonJS(token_exports);
28
+ var import_cli_config = require_dist();
29
+ var import_token_error = require_token_error();
30
+ var import_token_util = require_token_util();
31
+ async function refreshToken(options) {
32
+ let projectId = options?.project;
33
+ let teamId = options?.team;
34
+ if (!projectId && !teamId) {
35
+ const projectInfo = (0, import_token_util.findProjectInfo)();
36
+ projectId = projectInfo.projectId;
37
+ teamId = projectInfo.teamId;
38
+ } else if (!projectId || !teamId) {
39
+ const projectInfo = (0, import_token_util.findProjectInfo)();
40
+ projectId = projectId ?? projectInfo.projectId;
41
+ teamId = teamId ?? projectInfo.teamId;
42
+ }
43
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");
44
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
45
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
46
+ const configDir = (0, import_cli_config.getGlobalPathConfig)();
47
+ if ((0, import_cli_config.getLikelyEffectiveCredStorage)(configDir) === "keyring") maybeToken = await (0, import_token_util.getVercelOidcTokenFromCli)(projectId, teamId);
48
+ else {
49
+ const authToken = await (0, import_token_util.getVercelToken)({ expirationBufferMs: options?.expirationBufferMs });
50
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
51
+ }
52
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
53
+ (0, import_token_util.saveToken)(maybeToken, projectId);
54
+ }
55
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
56
+ }
57
+ 0 && (module.exports = { refreshToken });
58
+ }));
59
+ export default require_token();
60
+ export {};
@@ -0,0 +1,55 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-C1I3wEg2.js";
2
+ import { r as require_token_error, t as require_token_util } from "./token-util-DZN32qmT.js";
3
+ // ../../node_modules/.bun/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js
4
+ var require_token = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var token_exports = {};
26
+ __export(token_exports, { refreshToken: () => refreshToken });
27
+ module.exports = __toCommonJS(token_exports);
28
+ var import_token_error = require_token_error();
29
+ var import_token_util = require_token_util();
30
+ async function refreshToken(options) {
31
+ let projectId = options?.project;
32
+ let teamId = options?.team;
33
+ if (!projectId && !teamId) {
34
+ const projectInfo = (0, import_token_util.findProjectInfo)();
35
+ projectId = projectInfo.projectId;
36
+ teamId = projectInfo.teamId;
37
+ } else if (!projectId || !teamId) {
38
+ const projectInfo = (0, import_token_util.findProjectInfo)();
39
+ projectId = projectId ?? projectInfo.projectId;
40
+ teamId = teamId ?? projectInfo.teamId;
41
+ }
42
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");
43
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
44
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
45
+ const authToken = await (0, import_token_util.getVercelToken)({ expirationBufferMs: options?.expirationBufferMs });
46
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
47
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
48
+ (0, import_token_util.saveToken)(maybeToken, projectId);
49
+ }
50
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
51
+ }
52
+ 0 && (module.exports = { refreshToken });
53
+ }));
54
+ export default require_token();
55
+ export {};