gencow 0.1.299 → 0.2.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 (149) hide show
  1. package/bin/gencow.mjs +0 -6
  2. package/core/package.json +1 -1
  3. package/docs/packaging.md +14 -4
  4. package/lib/cli-artifact-guard.mjs +53 -3
  5. package/lib/cli-dev-runtime.mjs +1 -0
  6. package/lib/cli-project-runtime.mjs +26 -14
  7. package/lib/codegen-command.mjs +16 -0
  8. package/lib/coding-guardrails.mjs +2 -0
  9. package/lib/dashboard-artifact.mjs +65 -0
  10. package/lib/dashboard-assets.mjs +20 -0
  11. package/lib/db-command.mjs +121 -80
  12. package/lib/db-migration-command-steps.mjs +19 -16
  13. package/lib/db-push-command.mjs +1 -1
  14. package/lib/deploy-codegen-preflight.mjs +1 -0
  15. package/lib/dev-cloud-command.mjs +1 -1
  16. package/lib/dev-local-command.mjs +19 -56
  17. package/lib/document-local-converter.mjs +11 -0
  18. package/lib/local-dashboard-plan.mjs +60 -0
  19. package/lib/local-database-commands.mjs +127 -0
  20. package/lib/local-development-migrations.mjs +157 -0
  21. package/lib/local-drizzle-database.config.mjs +10 -0
  22. package/lib/local-runtime-features.mjs +12 -0
  23. package/lib/rag-selection.mjs +7 -0
  24. package/lib/runtime-local-worker.mjs +116 -0
  25. package/lib/runtime-mode.mjs +3 -0
  26. package/lib/standalone-codegen-adapter.mjs +91 -0
  27. package/lib/ts-codegen-import-extension.mjs +228 -19
  28. package/package.json +16 -9
  29. package/runtime/config.mjs +218 -2
  30. package/runtime/engine/chunk-2HA4CUMS.mjs +90 -0
  31. package/runtime/engine/chunk-2JLO3KMM.mjs +305 -0
  32. package/runtime/engine/chunk-2SR2M7SR.mjs +1045 -0
  33. package/runtime/engine/chunk-3D7MHEUC.mjs +253 -0
  34. package/runtime/engine/chunk-3R7COBWG.mjs +309 -0
  35. package/runtime/engine/chunk-3ZKA54UW.mjs +1560 -0
  36. package/runtime/engine/chunk-45I4YR2J.mjs +9 -0
  37. package/runtime/engine/chunk-4MLRXO7F.mjs +74 -0
  38. package/runtime/engine/chunk-5575APCJ.mjs +215 -0
  39. package/runtime/engine/chunk-5GUJZQF3.mjs +114 -0
  40. package/runtime/engine/chunk-5MXY3T75.mjs +428 -0
  41. package/runtime/engine/chunk-5TACQ2US.mjs +44 -0
  42. package/runtime/engine/chunk-66G4YEDT.mjs +3104 -0
  43. package/runtime/engine/chunk-67YO53WW.mjs +1426 -0
  44. package/runtime/engine/chunk-6GQRM7XY.mjs +87 -0
  45. package/runtime/engine/chunk-6JO72SPP.mjs +68 -0
  46. package/runtime/engine/chunk-6W653LXI.mjs +13 -0
  47. package/runtime/engine/chunk-7ITSMI3S.mjs +69 -0
  48. package/runtime/engine/chunk-7KUJ2H2S.mjs +128 -0
  49. package/runtime/engine/chunk-A5BMQ5IC.mjs +45 -0
  50. package/runtime/engine/chunk-ADF3UR6L.mjs +428 -0
  51. package/runtime/engine/chunk-AEBW7XZJ.mjs +4510 -0
  52. package/runtime/engine/chunk-AGPQ5XIV.mjs +156 -0
  53. package/runtime/engine/chunk-CPU4OZSX.mjs +753 -0
  54. package/runtime/engine/chunk-CSWPPWBL.mjs +50 -0
  55. package/runtime/engine/chunk-DPWXSMWO.mjs +53 -0
  56. package/runtime/engine/chunk-EAIELFKU.mjs +151 -0
  57. package/runtime/engine/chunk-EDU5CBKT.mjs +10 -0
  58. package/runtime/engine/chunk-EQCTAET7.mjs +173 -0
  59. package/runtime/engine/chunk-EQCXDF2Z.mjs +70 -0
  60. package/runtime/engine/chunk-F3G4UGV4.mjs +330 -0
  61. package/runtime/engine/chunk-F62NUNOO.mjs +26 -0
  62. package/runtime/engine/chunk-FKPNIFRP.mjs +2492 -0
  63. package/runtime/engine/chunk-FM23RGVI.mjs +81 -0
  64. package/runtime/engine/chunk-FW5AK4YP.mjs +1041 -0
  65. package/runtime/engine/chunk-GDWYAGWV.mjs +23 -0
  66. package/runtime/engine/chunk-GO5PZUYW.mjs +53 -0
  67. package/runtime/engine/chunk-GOLP7OSG.mjs +340 -0
  68. package/runtime/engine/chunk-GSLM44EF.mjs +242 -0
  69. package/runtime/engine/chunk-GYAJ7OX2.mjs +125 -0
  70. package/runtime/engine/chunk-I3GWR43K.mjs +14 -0
  71. package/runtime/engine/chunk-IFMOTJNU.mjs +106 -0
  72. package/runtime/engine/chunk-IKQKBE2G.mjs +128 -0
  73. package/runtime/engine/chunk-ITH2NEKM.mjs +282 -0
  74. package/runtime/engine/chunk-J6SDRCG4.mjs +96 -0
  75. package/runtime/engine/chunk-JODRNM3S.mjs +29596 -0
  76. package/runtime/engine/chunk-JUDKX53X.mjs +137 -0
  77. package/runtime/engine/chunk-K2YZVPJ4.mjs +827 -0
  78. package/runtime/engine/chunk-KEZJUXEE.mjs +151 -0
  79. package/runtime/engine/chunk-KVLTJFCH.mjs +234 -0
  80. package/runtime/engine/chunk-KX2PRQPS.mjs +126 -0
  81. package/runtime/engine/chunk-LEW5ZMLR.mjs +76 -0
  82. package/runtime/engine/chunk-LINVSJEM.mjs +175 -0
  83. package/runtime/engine/chunk-M7K2ICSM.mjs +11 -0
  84. package/runtime/engine/chunk-MZXDXSDC.mjs +292 -0
  85. package/runtime/engine/chunk-N2TA2IK2.mjs +678 -0
  86. package/runtime/engine/chunk-N4LTCKJP.mjs +695 -0
  87. package/runtime/engine/chunk-N6GCLOUX.mjs +13 -0
  88. package/runtime/engine/chunk-NAG2OXS5.mjs +37 -0
  89. package/runtime/engine/chunk-NNZ2QJUG.mjs +381 -0
  90. package/runtime/engine/chunk-NZPPLDNW.mjs +15 -0
  91. package/runtime/engine/chunk-ODWM57W6.mjs +138 -0
  92. package/runtime/engine/chunk-P5IIXAIE.mjs +23 -0
  93. package/runtime/engine/chunk-PBOXB2BV.mjs +6 -0
  94. package/runtime/engine/chunk-PMOJLN2P.mjs +8 -0
  95. package/runtime/engine/chunk-PZFMKFHO.mjs +180 -0
  96. package/runtime/engine/chunk-QL2TQX2N.mjs +114 -0
  97. package/runtime/engine/chunk-RITT2RSJ.mjs +258 -0
  98. package/runtime/engine/chunk-RODBVJ5M.mjs +135 -0
  99. package/runtime/engine/chunk-RW65MPVY.mjs +261 -0
  100. package/runtime/engine/chunk-S67UYPB6.mjs +25 -0
  101. package/runtime/engine/chunk-SVJCOUI3.mjs +47 -0
  102. package/runtime/engine/chunk-TCN3ZASV.mjs +957 -0
  103. package/runtime/engine/chunk-U2NRG6KC.mjs +32 -0
  104. package/runtime/engine/chunk-UM3F7HUV.mjs +432 -0
  105. package/runtime/engine/chunk-VWU7JJ3P.mjs +146 -0
  106. package/runtime/engine/chunk-WDTKPPMU.mjs +310 -0
  107. package/runtime/engine/chunk-WJOO4XTB.mjs +31 -0
  108. package/runtime/engine/chunk-XNFVL2OY.mjs +63 -0
  109. package/runtime/engine/chunk-XPWJXP2J.mjs +58 -0
  110. package/runtime/engine/chunk-Y3HSBJ3I.mjs +1132 -0
  111. package/runtime/engine/chunk-YMH4RYSX.mjs +317 -0
  112. package/runtime/engine/chunk-YNOMPSGS.mjs +8 -0
  113. package/runtime/engine/chunk-YRBAYTEZ.mjs +251 -0
  114. package/runtime/engine/chunk-YRHM272W.mjs +528 -0
  115. package/runtime/engine/chunk-ZQUZAGIQ.mjs +149 -0
  116. package/runtime/engine/chunk-ZXMM7QFP.mjs +176 -0
  117. package/runtime/engine/chunk-ZZJSIPV2.mjs +262 -0
  118. package/runtime/engine/composition.mjs +325 -0
  119. package/runtime/engine/document-local.mjs +504 -0
  120. package/runtime/engine/graph.json +4134 -0
  121. package/runtime/engine/index.mjs +265 -0
  122. package/runtime/engine/local-postgres-support.mjs +69 -0
  123. package/runtime/engine/local.mjs +3275 -0
  124. package/runtime/engine/pglite-directory-lock.mjs +8 -0
  125. package/runtime/engine/rag.mjs +11 -0
  126. package/runtime/engine/search.mjs +18 -0
  127. package/runtime/framework-migrations/foundation-bootstrap/rag.sql +115 -0
  128. package/runtime/framework-migrations/foundation-bootstrap/workflow.sql +194 -0
  129. package/runtime/framework-migrations/journal-bootstrap/migration.sql +26 -0
  130. package/runtime/framework-migrations/manifest.json +56 -0
  131. package/runtime/framework-migrations/rag/20261006111509_mushy_warhawk/migration.sql +121 -0
  132. package/runtime/framework-migrations/rag/20261013234621_rag_v2_lifecycle_markers/migration.sql +6 -0
  133. package/runtime/framework-migrations/workflow/20261006111508_perpetual_star_brand/migration.sql +31 -0
  134. package/runtime/runtime-metadata.json +27 -0
  135. package/runtime/tooling.mjs +10399 -8951
  136. package/scripts/bundle-runtime-config.mjs +23 -0
  137. package/scripts/bundle-runtime.mjs +100 -0
  138. package/scripts/bundle-runtime.test.mjs +33 -0
  139. package/scripts/bundle-shared.mjs +3 -0
  140. package/scripts/copy-dashboard.mjs +16 -0
  141. package/scripts/pre-publish-check.mjs +23 -11
  142. package/templateFeature/sso/sso-auth-callback.tsx +37 -5
  143. package/templateFeature/tools/manifest.json +2 -1
  144. package/templateFeature/tools/tools.ts +3 -3
  145. package/runtime/server.mjs +0 -14389
  146. package/scripts/bundle-server.mjs +0 -223
  147. package/server/config.js +0 -1
  148. package/server/index.js +0 -1
  149. package/server/package.json +0 -6
@@ -0,0 +1,310 @@
1
+ import {
2
+ schedulerFailure
3
+ } from "./chunk-NAG2OXS5.mjs";
4
+ import {
5
+ runtimeStartupError
6
+ } from "./chunk-IFMOTJNU.mjs";
7
+
8
+ // ../runtime/dist/app/generation-binding.js
9
+ function snapshotRuntimeBinding(binding) {
10
+ if (!binding || typeof binding.appId !== "string" || typeof binding.generationId !== "string" || !binding.appId.trim() || !binding.generationId.trim()) {
11
+ throw runtimeStartupError("RUNTIME_COMPONENT_DEPENDENCY_INVALID", "Supply a trusted app and generation identity before startup.");
12
+ }
13
+ return Object.freeze({ appId: binding.appId, generationId: binding.generationId });
14
+ }
15
+
16
+ // ../runtime/dist/adapters/scheduler/local/source-evidence.js
17
+ var localInvocationConsumers = /* @__PURE__ */ new WeakMap();
18
+ var issuedLocalJobEvidence = /* @__PURE__ */ new WeakSet();
19
+ function isRuntimeLocalJobSourceEvidence(value) {
20
+ return Boolean(value && typeof value === "object" && issuedLocalJobEvidence.has(value));
21
+ }
22
+ function getRuntimeLocalSchedulerInvocationConsumer(delivery) {
23
+ return localInvocationConsumers.get(delivery);
24
+ }
25
+ function registerLocalSchedulerInvocationConsumer(delivery, consume) {
26
+ localInvocationConsumers.set(delivery, consume);
27
+ }
28
+ function registerLocalJobSourceEvidence(evidence) {
29
+ issuedLocalJobEvidence.add(evidence);
30
+ }
31
+
32
+ // ../runtime/dist/scheduler/timed-out-work.js
33
+ function createTimedOutSchedulerWork() {
34
+ const held = /* @__PURE__ */ new Map();
35
+ const listeners = /* @__PURE__ */ new Set();
36
+ const deferred = /* @__PURE__ */ new WeakMap();
37
+ const key = (target) => JSON.stringify([target.kind, target.name, "actionToken" in target ? target.actionToken : null]);
38
+ return {
39
+ blocked(target) {
40
+ return Boolean(held.get(key(target))?.size);
41
+ },
42
+ subscribe(listener) {
43
+ listeners.add(listener);
44
+ return () => {
45
+ listeners.delete(listener);
46
+ };
47
+ },
48
+ recordDeferral(outcome, invocation, settled) {
49
+ if (outcome.execution === "not_started" && outcome.effects === "settled" && !outcome.operationIds.length && !outcome.diagnostic && !outcome.settlementDiagnostic && settled())
50
+ deferred.set(outcome, { invocation, settled });
51
+ },
52
+ isDeferred(outcome, invocation) {
53
+ const receipt = deferred.get(outcome);
54
+ try {
55
+ return receipt?.invocation === invocation && receipt.settled();
56
+ } catch {
57
+ return false;
58
+ }
59
+ },
60
+ retain(target) {
61
+ const id = key(target);
62
+ let resolve;
63
+ const settled = new Promise((done) => {
64
+ resolve = done;
65
+ });
66
+ const pending = held.get(id) ?? /* @__PURE__ */ new Set();
67
+ pending.add(settled);
68
+ held.set(id, pending);
69
+ let released = false;
70
+ return () => {
71
+ if (released)
72
+ return;
73
+ released = true;
74
+ pending.delete(settled);
75
+ if (!pending.size)
76
+ held.delete(id);
77
+ resolve();
78
+ for (const listener of listeners) {
79
+ try {
80
+ listener();
81
+ } catch {
82
+ }
83
+ }
84
+ };
85
+ },
86
+ async wait(target, signal, cancellation, maximumWaitMs) {
87
+ const id = key(target);
88
+ const cancelled = () => cancellation?.() ?? schedulerFailure("RUNTIME_GENERATION_CLOSING", "Keep this accepted job and inspect the original handler's settlement before restarting its generation.");
89
+ if (signal.aborted)
90
+ throw cancelled();
91
+ if (!held.get(id)?.size)
92
+ return true;
93
+ let timer;
94
+ let onAbort;
95
+ const aborted = new Promise((_, reject) => {
96
+ onAbort = () => reject(cancelled());
97
+ signal.addEventListener("abort", onAbort, { once: true });
98
+ if (signal.aborted)
99
+ onAbort();
100
+ });
101
+ const elapsed = new Promise((resolve) => {
102
+ if (maximumWaitMs !== void 0)
103
+ timer = setTimeout(() => resolve(false), maximumWaitMs);
104
+ });
105
+ try {
106
+ while (held.get(id)?.size) {
107
+ const pending = Promise.all([...held.get(id)]).then(() => true);
108
+ const ready = await Promise.race([pending, aborted, elapsed]);
109
+ if (signal.aborted)
110
+ throw cancelled();
111
+ if (!ready)
112
+ return !held.get(id)?.size;
113
+ }
114
+ if (signal.aborted)
115
+ throw cancelled();
116
+ return true;
117
+ } finally {
118
+ clearTimeout(timer);
119
+ signal.removeEventListener("abort", onAbort);
120
+ }
121
+ }
122
+ };
123
+ }
124
+ var dispatchOwners = /* @__PURE__ */ new WeakMap();
125
+ function bindTimedOutSchedulerWork(run, owner) {
126
+ dispatchOwners.set(run, owner);
127
+ }
128
+ function timedOutSchedulerWorkFor(run) {
129
+ return dispatchOwners.get(run);
130
+ }
131
+
132
+ // ../runtime/dist/scheduler/json-values.js
133
+ import { createHash } from "node:crypto";
134
+ var SchedulerValueError = class extends Error {
135
+ constructor() {
136
+ super("SCHEDULER_VALUE_INVALID");
137
+ this.name = "SchedulerValueError";
138
+ }
139
+ };
140
+ function snapshotSchedulerValue(input, maxBytes = 65536) {
141
+ const visiting = /* @__PURE__ */ new Set();
142
+ let bytes = 0;
143
+ function counted(text) {
144
+ bytes += Buffer.byteLength(text, "utf8");
145
+ if (bytes > maxBytes)
146
+ throw new SchedulerValueError();
147
+ return text;
148
+ }
149
+ function visit(value, depth) {
150
+ if (depth > 64)
151
+ throw new SchedulerValueError();
152
+ if (value === null || typeof value === "boolean" || typeof value === "string" || typeof value === "number" && Number.isFinite(value)) {
153
+ return { args: Object.is(value, -0) ? 0 : value, canonical: counted(JSON.stringify(value)) };
154
+ }
155
+ if (!value || typeof value !== "object" || visiting.has(value))
156
+ throw new SchedulerValueError();
157
+ const array = Array.isArray(value);
158
+ const prototype = Object.getPrototypeOf(value);
159
+ if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
160
+ throw new SchedulerValueError();
161
+ const descriptors = Object.getOwnPropertyDescriptors(value);
162
+ const keys = Reflect.ownKeys(descriptors);
163
+ if (keys.some((key) => typeof key !== "string" || !("value" in descriptors[key]) || !descriptors[key].enumerable && !(array && key === "length")))
164
+ throw new SchedulerValueError();
165
+ visiting.add(value);
166
+ try {
167
+ if (array) {
168
+ if (keys.length !== value.length + 1 || value.length > maxBytes)
169
+ throw new SchedulerValueError();
170
+ const args2 = [];
171
+ const parts2 = [];
172
+ counted("[]");
173
+ for (let index = 0; index < value.length; index++) {
174
+ if (!Object.hasOwn(descriptors, index))
175
+ throw new SchedulerValueError();
176
+ const entry = visit(descriptors[index].value, depth + 1);
177
+ args2.push(entry.args);
178
+ parts2.push(entry.canonical);
179
+ if (index)
180
+ counted(",");
181
+ }
182
+ return { args: Object.freeze(args2), canonical: `[${parts2.join(",")}]` };
183
+ }
184
+ const args = /* @__PURE__ */ Object.create(null);
185
+ const parts = [];
186
+ counted("{}");
187
+ for (const key of Object.keys(descriptors).sort()) {
188
+ const encodedKey = counted(JSON.stringify(key) + ":");
189
+ const entry = visit(descriptors[key].value, depth + 1);
190
+ args[key] = entry.args;
191
+ if (parts.length)
192
+ counted(",");
193
+ parts.push(encodedKey + entry.canonical);
194
+ }
195
+ return { args: Object.freeze(args), canonical: `{${parts.join(",")}}` };
196
+ } finally {
197
+ visiting.delete(value);
198
+ }
199
+ }
200
+ const snapshot = visit(input === void 0 ? {} : input, 0);
201
+ return Object.freeze({
202
+ args: snapshot.args,
203
+ argsDigest: createHash("sha256").update(snapshot.canonical, "utf8").digest("hex")
204
+ });
205
+ }
206
+ function snapshotSchedulerAdmissionArgs(input, maxBytes = 65536, onErrorAction) {
207
+ const snapshot = snapshotSchedulerValue(input, onErrorAction === void 0 ? maxBytes : Math.min(maxBytes, 61440));
208
+ if (onErrorAction !== void 0)
209
+ snapshotSchedulerFailureArgs(onErrorAction, "00000000-0000-0000-0000-000000000000", snapshot.args, maxBytes);
210
+ return snapshot;
211
+ }
212
+ function snapshotSchedulerFailureArgs(action, canonicalJobId, args, maxBytes) {
213
+ return snapshotSchedulerValue({
214
+ failedAction: action,
215
+ failedJobId: canonicalJobId,
216
+ originalArgs: args,
217
+ error: "RUNTIME_SCHEDULER_EXECUTION_FAILED"
218
+ }, maxBytes);
219
+ }
220
+
221
+ // ../runtime/dist/scheduler/values.js
222
+ function invalidInput(correlationId, onError = false) {
223
+ return schedulerFailure("RUNTIME_SCHEDULER_INPUT_INVALID", onError ? "Use plain JSON arguments; on-error original arguments must fit 61,440 UTF-8 bytes and depth 63, and the complete failure payload must fit the selected scheduler limit." : "Use valid dates, identifiers and plain JSON arguments within the local scheduler limits.", "request", correlationId);
224
+ }
225
+ function schedulerIdentifier(value) {
226
+ if (typeof value !== "string" || !value || Buffer.byteLength(value, "utf8") > 256 || /[\u0000-\u001f\u007f-\u009f]/u.test(value))
227
+ throw invalidInput();
228
+ return value;
229
+ }
230
+ function schedulerInstant(value) {
231
+ const number = value instanceof Date ? Date.prototype.getTime.call(value) : value;
232
+ if (typeof number !== "number" || !Number.isFinite(number))
233
+ throw invalidInput();
234
+ const clipped = new Date(number).getTime();
235
+ if (!Number.isSafeInteger(clipped))
236
+ throw invalidInput();
237
+ return clipped;
238
+ }
239
+ function snapshotSchedulerArgs(input, maxBytes = 65536) {
240
+ try {
241
+ return snapshotSchedulerValue(input, maxBytes);
242
+ } catch (error) {
243
+ if (error instanceof SchedulerValueError)
244
+ throw invalidInput();
245
+ throw error;
246
+ }
247
+ }
248
+ function snapshotSchedulerAdmissionArgs2(input, maxBytes, onErrorAction, correlationId) {
249
+ try {
250
+ return snapshotSchedulerAdmissionArgs(input, maxBytes, onErrorAction);
251
+ } catch (error) {
252
+ if (error instanceof SchedulerValueError)
253
+ throw invalidInput(correlationId, onErrorAction !== void 0);
254
+ throw error;
255
+ }
256
+ }
257
+ function schedulerOperationId(value) {
258
+ if (typeof value !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(value))
259
+ throw schedulerFailure("RUNTIME_SCHEDULER_INPUT_INVALID", "Use the operation UUID from the local receipt.");
260
+ return value;
261
+ }
262
+ function snapshotOnErrorArgs(action, jobId, args, maxBytes) {
263
+ try {
264
+ return snapshotSchedulerFailureArgs(action, jobId, args, maxBytes);
265
+ } catch (error) {
266
+ if (error instanceof SchedulerValueError)
267
+ throw invalidInput(void 0, true);
268
+ throw error;
269
+ }
270
+ }
271
+ function schedulerOptionsSnapshot(options) {
272
+ if (options === void 0)
273
+ return {};
274
+ if (!options || typeof options !== "object" || Object.getPrototypeOf(options) !== Object.prototype && Object.getPrototypeOf(options) !== null)
275
+ throw schedulerFailure("RUNTIME_SCHEDULER_INPUT_INVALID", "Provide plain scheduler options.");
276
+ const result = {};
277
+ for (const key of Reflect.ownKeys(options)) {
278
+ const descriptor = Object.getOwnPropertyDescriptor(options, key);
279
+ if (typeof key !== "string" || !["id", "dedupeKey", "onError"].includes(key) || !descriptor || !("value" in descriptor))
280
+ throw schedulerFailure("RUNTIME_SCHEDULER_INPUT_INVALID", "Provide only supported scheduler option data fields.");
281
+ if (descriptor.value !== void 0) {
282
+ const value = schedulerIdentifier(descriptor.value);
283
+ if (key === "id")
284
+ result.id = value;
285
+ else if (key === "dedupeKey")
286
+ result.dedupeKey = value;
287
+ else
288
+ result.onError = value;
289
+ }
290
+ }
291
+ return result;
292
+ }
293
+
294
+ export {
295
+ snapshotRuntimeBinding,
296
+ isRuntimeLocalJobSourceEvidence,
297
+ getRuntimeLocalSchedulerInvocationConsumer,
298
+ registerLocalSchedulerInvocationConsumer,
299
+ registerLocalJobSourceEvidence,
300
+ createTimedOutSchedulerWork,
301
+ bindTimedOutSchedulerWork,
302
+ timedOutSchedulerWorkFor,
303
+ schedulerIdentifier,
304
+ schedulerInstant,
305
+ snapshotSchedulerArgs,
306
+ snapshotSchedulerAdmissionArgs2 as snapshotSchedulerAdmissionArgs,
307
+ schedulerOperationId,
308
+ snapshotOnErrorArgs,
309
+ schedulerOptionsSnapshot
310
+ };
@@ -0,0 +1,31 @@
1
+ // ../runtime/dist/adapters/auth/better-auth/sdk.js
2
+ async function loadBetterAuthSdk() {
3
+ const [{ betterAuth }, { bearer, genericOAuth }, { drizzleAdapter }, { APIError, isAPIError, createAuthEndpoint, createAuthMiddleware, signUpEmail }, { parseInputData, getAuthTables }, { runWithTransaction }] = await Promise.all([
4
+ import("better-auth"),
5
+ import("better-auth/plugins"),
6
+ import("better-auth/adapters/drizzle"),
7
+ import("better-auth/api"),
8
+ import("better-auth/db"),
9
+ import("@better-auth/core/context")
10
+ ]);
11
+ const profileSchema = signUpEmail().options.body;
12
+ const profileEmailIsValid = (email) => profileSchema.safeParse({ name: "Profile", email, password: "validation-only-placeholder" }).success;
13
+ return {
14
+ APIError,
15
+ profileEmailIsValid,
16
+ createAuthEndpoint,
17
+ createAuthMiddleware,
18
+ parseInputData,
19
+ isAPIError,
20
+ betterAuth,
21
+ bearer,
22
+ genericOAuth,
23
+ drizzleAdapter,
24
+ getAuthTables,
25
+ runWithTransaction
26
+ };
27
+ }
28
+
29
+ export {
30
+ loadBetterAuthSdk
31
+ };
@@ -0,0 +1,63 @@
1
+ import {
2
+ RuntimeDiagnosticError
3
+ } from "./chunk-AEBW7XZJ.mjs";
4
+
5
+ // ../runtime/dist/adapters/grounding/errors.js
6
+ var groundingProducerDiagnostics = /* @__PURE__ */ new WeakMap();
7
+ function groundingError(diagnostic) {
8
+ const error = new RuntimeDiagnosticError(diagnostic);
9
+ groundingProducerDiagnostics.set(error, Object.freeze({ ...diagnostic }));
10
+ return error;
11
+ }
12
+ function groundingProducerDiagnostic(error) {
13
+ return error !== null && typeof error === "object" ? groundingProducerDiagnostics.get(error) : void 0;
14
+ }
15
+ var evidenceInspection = "Inspect the selected database and corpus readiness with `pnpm gencow db:check`. Restore the existing prerequisite and retry only this read-only grounding call; preserve existing data and serving state.";
16
+ function groundingInputInvalid(stage, correlationId) {
17
+ return groundingError({
18
+ code: "GROUNDING_INPUT_INVALID",
19
+ stage,
20
+ capability: "application",
21
+ servingStarted: "unchanged",
22
+ dataImpact: "none",
23
+ retryable: false,
24
+ retryPrecondition: "Correct the question, scope, claims, mode or budget input before submitting this read again.",
25
+ nextAction: "Correct the documented Grounding input and submit it again. No provider read or write was admitted.",
26
+ correlationId
27
+ });
28
+ }
29
+ function groundingScopeEnded(stage, correlationId) {
30
+ return groundingError({
31
+ code: "GROUNDING_SCOPE_ENDED",
32
+ stage,
33
+ capability: "application",
34
+ servingStarted: "unchanged",
35
+ dataImpact: "none",
36
+ retryable: false,
37
+ retryPrecondition: "Use a fresh verified request. Workflow recovery belongs to its existing owner; verify earlier effects before any same-run recovery.",
38
+ nextAction: "For a Workflow, inspect the existing run with `workflows.get({ id })` and use only its documented same-run recovery after checking prior effects. Never replay a mutation or start a replacement run.",
39
+ correlationId
40
+ });
41
+ }
42
+ function groundingEvidenceUnavailable(stage, correlationId, classification) {
43
+ const databaseFailure = classification !== "reader-unavailable";
44
+ const diagnostic = {
45
+ code: "GROUNDING_EVIDENCE_UNAVAILABLE",
46
+ stage,
47
+ capability: databaseFailure ? "database" : "application",
48
+ servingStarted: "unchanged",
49
+ dataImpact: "none",
50
+ retryable: false,
51
+ retryPrecondition: "Wait for the classified database or corpus readiness condition to recover; retry only the read-only grounding call afterward.",
52
+ nextAction: `${evidenceInspection} For a Workflow, preserve the same run and checkpoints; do not start replacement work or blindly replay earlier mutations.`,
53
+ correlationId
54
+ };
55
+ return groundingError(diagnostic);
56
+ }
57
+
58
+ export {
59
+ groundingProducerDiagnostic,
60
+ groundingInputInvalid,
61
+ groundingScopeEnded,
62
+ groundingEvidenceUnavailable
63
+ };
@@ -0,0 +1,58 @@
1
+ import {
2
+ loadRuntimeFrameworkFoundationBootstrap
3
+ } from "./chunk-PZFMKFHO.mjs";
4
+ import {
5
+ validateRuntimeWorkflowSchema,
6
+ workflowSchemaFailure
7
+ } from "./chunk-LINVSJEM.mjs";
8
+ import {
9
+ workflowSchemaIndexes,
10
+ workflowSchemaTables
11
+ } from "./chunk-GOLP7OSG.mjs";
12
+ import "./chunk-SVJCOUI3.mjs";
13
+ import "./chunk-IFMOTJNU.mjs";
14
+ import "./chunk-AEBW7XZJ.mjs";
15
+
16
+ // ../runtime/dist/workflow/schema-initializer.js
17
+ import { sql } from "drizzle-orm";
18
+ import { drizzle } from "drizzle-orm/pglite";
19
+ async function initializePgliteWorkflowSchema(client) {
20
+ try {
21
+ const artifact = loadRuntimeFrameworkFoundationBootstrap("workflow");
22
+ const baseline = {
23
+ ...artifact,
24
+ statements: artifact.sql.split("--> statement-breakpoint").map((statement) => statement.trim()).filter(Boolean)
25
+ };
26
+ if (!baseline || baseline.executionEligibility !== "startup-compatible")
27
+ throw workflowSchemaFailure();
28
+ await drizzle({ client }).transaction(async (transaction) => {
29
+ if (await validateRuntimeWorkflowSchema(transaction, true))
30
+ return;
31
+ const names = workflowSchemaTables.map((table) => table.name);
32
+ const present = await transaction.execute(sql`SELECT relname FROM pg_class c JOIN pg_namespace n ON n.oid=c.relnamespace
33
+ WHERE n.nspname='public' AND c.relname IN (${sql.join(names.map((name) => sql`${name}`), sql`,`)})`);
34
+ if (present.rows.length === 0) {
35
+ for (const statement of baseline.statements)
36
+ await transaction.execute(sql.raw(statement));
37
+ } else if (present.rows.length === names.length) {
38
+ for (const index of workflowSchemaIndexes) {
39
+ const existing = await transaction.execute(sql`SELECT to_regclass(${`public.${index.name}`}) AS name`);
40
+ if (existing.rows[0]?.name)
41
+ continue;
42
+ const prefix = `CREATE ${index.unique ? "UNIQUE " : ""}INDEX "${index.name}" `;
43
+ const statement = baseline.statements.find((candidate) => candidate.trimStart().startsWith(prefix));
44
+ if (!statement)
45
+ throw workflowSchemaFailure();
46
+ await transaction.execute(sql.raw(statement));
47
+ }
48
+ } else
49
+ throw workflowSchemaFailure();
50
+ await validateRuntimeWorkflowSchema(transaction);
51
+ });
52
+ } catch {
53
+ throw workflowSchemaFailure();
54
+ }
55
+ }
56
+ export {
57
+ initializePgliteWorkflowSchema
58
+ };