@alienplatform/sdk 1.14.0 → 1.14.1-dev.e74fae6cd01b61e77a285276f264b5480977f41a

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 (161) hide show
  1. package/dist/dist.js +416 -284
  2. package/dist/index.d.ts +22 -28
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -14356
  5. package/dist/native.d.ts +26 -0
  6. package/dist/native.d.ts.map +1 -0
  7. package/dist/native.js +2 -0
  8. package/dist/worker-runtime/channel.d.ts +25 -0
  9. package/dist/worker-runtime/channel.d.ts.map +1 -0
  10. package/dist/worker-runtime/errors.d.ts +79 -0
  11. package/dist/worker-runtime/errors.d.ts.map +1 -0
  12. package/dist/worker-runtime/event-loop.d.ts +43 -0
  13. package/dist/worker-runtime/event-loop.d.ts.map +1 -0
  14. package/dist/{generated → worker-runtime/generated}/control.d.ts +15 -15
  15. package/dist/worker-runtime/generated/control.d.ts.map +1 -0
  16. package/dist/worker-runtime/generated/google/protobuf/duration.d.ts.map +1 -0
  17. package/dist/worker-runtime/generated/google/protobuf/timestamp.d.ts.map +1 -0
  18. package/dist/{generated → worker-runtime/generated}/wait_until.d.ts +29 -29
  19. package/dist/worker-runtime/generated/wait_until.d.ts.map +1 -0
  20. package/dist/worker-runtime/grpc-utils.d.ts +23 -0
  21. package/dist/worker-runtime/grpc-utils.d.ts.map +1 -0
  22. package/dist/worker-runtime/index.d.ts +33 -0
  23. package/dist/worker-runtime/index.d.ts.map +1 -0
  24. package/dist/{src.js → worker-runtime/index.js} +9370 -4035
  25. package/dist/worker-runtime/registry.d.ts +169 -0
  26. package/dist/worker-runtime/registry.d.ts.map +1 -0
  27. package/dist/worker-runtime/service-definitions.d.ts +12 -0
  28. package/dist/worker-runtime/service-definitions.d.ts.map +1 -0
  29. package/dist/worker-runtime/wait-until-manager.d.ts +34 -0
  30. package/dist/worker-runtime/wait-until-manager.d.ts.map +1 -0
  31. package/package.json +31 -50
  32. package/.turbo/turbo-build.log +0 -30
  33. package/AGENTS.md +0 -70
  34. package/LICENSE.md +0 -105
  35. package/dist/bearerTokenAuthenticationPolicy.js +0 -3028
  36. package/dist/bindings/artifact-registry.d.ts +0 -88
  37. package/dist/bindings/artifact-registry.d.ts.map +0 -1
  38. package/dist/bindings/build.d.ts +0 -67
  39. package/dist/bindings/build.d.ts.map +0 -1
  40. package/dist/bindings/index.d.ts +0 -13
  41. package/dist/bindings/index.d.ts.map +0 -1
  42. package/dist/bindings/kv.d.ts +0 -113
  43. package/dist/bindings/kv.d.ts.map +0 -1
  44. package/dist/bindings/postgres.d.ts +0 -90
  45. package/dist/bindings/postgres.d.ts.map +0 -1
  46. package/dist/bindings/postgres.test.d.ts +0 -2
  47. package/dist/bindings/postgres.test.d.ts.map +0 -1
  48. package/dist/bindings/queue.d.ts +0 -81
  49. package/dist/bindings/queue.d.ts.map +0 -1
  50. package/dist/bindings/service-account.d.ts +0 -46
  51. package/dist/bindings/service-account.d.ts.map +0 -1
  52. package/dist/bindings/storage.d.ts +0 -164
  53. package/dist/bindings/storage.d.ts.map +0 -1
  54. package/dist/bindings/vault.d.ts +0 -65
  55. package/dist/bindings/vault.d.ts.map +0 -1
  56. package/dist/bindings/worker.d.ts +0 -72
  57. package/dist/bindings/worker.d.ts.map +0 -1
  58. package/dist/channel.d.ts +0 -39
  59. package/dist/channel.d.ts.map +0 -1
  60. package/dist/checksum.js +0 -6176
  61. package/dist/commands/client.d.ts +0 -47
  62. package/dist/commands/client.d.ts.map +0 -1
  63. package/dist/commands/errors.d.ts +0 -198
  64. package/dist/commands/errors.d.ts.map +0 -1
  65. package/dist/commands/index.d.ts +0 -23
  66. package/dist/commands/index.d.ts.map +0 -1
  67. package/dist/commands/index.js +0 -387
  68. package/dist/commands/types.d.ts +0 -40
  69. package/dist/commands/types.d.ts.map +0 -1
  70. package/dist/commands.d.ts +0 -55
  71. package/dist/commands.d.ts.map +0 -1
  72. package/dist/context.d.ts +0 -182
  73. package/dist/context.d.ts.map +0 -1
  74. package/dist/dist-cjs.js +0 -15258
  75. package/dist/dist2.js +0 -1239
  76. package/dist/errors.d.ts +0 -359
  77. package/dist/errors.d.ts.map +0 -1
  78. package/dist/es5.js +0 -1720
  79. package/dist/esm.js +0 -18068
  80. package/dist/esm2.js +0 -3166
  81. package/dist/event-streams.js +0 -770
  82. package/dist/events.d.ts +0 -163
  83. package/dist/events.d.ts.map +0 -1
  84. package/dist/generated/artifact_registry.d.ts +0 -302
  85. package/dist/generated/artifact_registry.d.ts.map +0 -1
  86. package/dist/generated/build.d.ts +0 -184
  87. package/dist/generated/build.d.ts.map +0 -1
  88. package/dist/generated/container.d.ts +0 -101
  89. package/dist/generated/container.d.ts.map +0 -1
  90. package/dist/generated/control.d.ts.map +0 -1
  91. package/dist/generated/google/protobuf/duration.d.ts.map +0 -1
  92. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  93. package/dist/generated/kv.d.ts +0 -182
  94. package/dist/generated/kv.d.ts.map +0 -1
  95. package/dist/generated/queue.d.ts +0 -127
  96. package/dist/generated/queue.d.ts.map +0 -1
  97. package/dist/generated/service_account.d.ts +0 -112
  98. package/dist/generated/service_account.d.ts.map +0 -1
  99. package/dist/generated/storage.d.ts +0 -784
  100. package/dist/generated/storage.d.ts.map +0 -1
  101. package/dist/generated/vault.d.ts +0 -107
  102. package/dist/generated/vault.d.ts.map +0 -1
  103. package/dist/generated/wait_until.d.ts.map +0 -1
  104. package/dist/generated/worker.d.ts +0 -107
  105. package/dist/generated/worker.d.ts.map +0 -1
  106. package/dist/global.d.ts +0 -208
  107. package/dist/global.d.ts.map +0 -1
  108. package/dist/grpc-utils.d.ts +0 -25
  109. package/dist/grpc-utils.d.ts.map +0 -1
  110. package/dist/jws.js +0 -611
  111. package/dist/open.js +0 -461
  112. package/dist/rolldown-runtime.js +0 -44
  113. package/dist/src2.js +0 -114032
  114. package/dist/types.d.ts +0 -337
  115. package/dist/types.d.ts.map +0 -1
  116. package/dist/wait-until.d.ts +0 -115
  117. package/dist/wait-until.d.ts.map +0 -1
  118. package/scripts/generate-proto.sh +0 -46
  119. package/src/bindings/AGENTS.md +0 -105
  120. package/src/bindings/artifact-registry.ts +0 -317
  121. package/src/bindings/build.ts +0 -195
  122. package/src/bindings/index.ts +0 -13
  123. package/src/bindings/kv.ts +0 -240
  124. package/src/bindings/postgres.test.ts +0 -17
  125. package/src/bindings/postgres.ts +0 -446
  126. package/src/bindings/queue.ts +0 -191
  127. package/src/bindings/service-account.ts +0 -113
  128. package/src/bindings/storage.ts +0 -536
  129. package/src/bindings/vault.ts +0 -133
  130. package/src/bindings/worker.ts +0 -164
  131. package/src/channel.ts +0 -102
  132. package/src/commands/client.ts +0 -446
  133. package/src/commands/errors.ts +0 -126
  134. package/src/commands/index.ts +0 -41
  135. package/src/commands/types.ts +0 -52
  136. package/src/commands.ts +0 -76
  137. package/src/context.ts +0 -368
  138. package/src/errors.ts +0 -280
  139. package/src/events.ts +0 -511
  140. package/src/generated/artifact_registry.ts +0 -2096
  141. package/src/generated/build.ts +0 -1311
  142. package/src/generated/container.ts +0 -503
  143. package/src/generated/control.ts +0 -2018
  144. package/src/generated/google/protobuf/duration.ts +0 -196
  145. package/src/generated/google/protobuf/timestamp.ts +0 -226
  146. package/src/generated/kv.ts +0 -1169
  147. package/src/generated/queue.ts +0 -753
  148. package/src/generated/service_account.ts +0 -814
  149. package/src/generated/storage.ts +0 -3820
  150. package/src/generated/vault.ts +0 -543
  151. package/src/generated/wait_until.ts +0 -829
  152. package/src/generated/worker.ts +0 -759
  153. package/src/global.ts +0 -287
  154. package/src/grpc-utils.ts +0 -159
  155. package/src/index.ts +0 -160
  156. package/src/types.ts +0 -397
  157. package/src/wait-until.ts +0 -273
  158. package/tsconfig.json +0 -8
  159. package/tsdown.config.ts +0 -17
  160. /package/dist/{generated → worker-runtime/generated}/google/protobuf/duration.d.ts +0 -0
  161. /package/dist/{generated → worker-runtime/generated}/google/protobuf/timestamp.d.ts +0 -0
package/dist/dist.js CHANGED
@@ -1,3 +1,168 @@
1
+ //#region src/worker-runtime/registry.ts
2
+ const REGISTRY_KEY = Symbol.for("@alienplatform/sdk#worker-runtime-registry");
3
+ function registry$1() {
4
+ const holder = globalThis;
5
+ let state = holder[REGISTRY_KEY];
6
+ if (!state) {
7
+ state = {
8
+ commands: /* @__PURE__ */ new Map(),
9
+ eventHandlers: /* @__PURE__ */ new Map(),
10
+ waitUntilTasks: /* @__PURE__ */ new Map(),
11
+ counters: {
12
+ handler: 0,
13
+ task: 0
14
+ }
15
+ };
16
+ holder[REGISTRY_KEY] = state;
17
+ }
18
+ return state;
19
+ }
20
+ /**
21
+ * Register a command handler.
22
+ *
23
+ * The handler receives the decoded params and, optionally, a
24
+ * {@link WorkerCommandContext} with `commandId`, `attempt`, and `deadline` —
25
+ * use `attempt` to make redeliveries idempotent (at-least-once semantics).
26
+ *
27
+ * @param name - Command name
28
+ * @param handler - Handler that receives params (and optionally the context)
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * import { command } from "@alienplatform/sdk"
33
+ *
34
+ * command("echo", async ({ message }: { message: string }, { attempt }) => {
35
+ * return { message, attempt, timestamp: new Date().toISOString() }
36
+ * })
37
+ * ```
38
+ */
39
+ function command(name, handler) {
40
+ registry$1().commands.set(name, {
41
+ name,
42
+ handler
43
+ });
44
+ }
45
+ /** Get all registered commands. @internal */
46
+ function getCommands() {
47
+ return registry$1().commands;
48
+ }
49
+ /** Execute a registered command by name. @internal */
50
+ async function runCommand(name, params, context) {
51
+ const commands = registry$1().commands;
52
+ const cmd = commands.get(name);
53
+ if (!cmd) throw new Error(`Unknown command: ${name}. Available: ${[...commands.keys()].join(", ")}`);
54
+ return await cmd.handler(params, context);
55
+ }
56
+ /**
57
+ * Register a storage event handler.
58
+ *
59
+ * @param bucket - Bucket name (or `"*"` for all buckets)
60
+ * @param handler - Handler function for storage events
61
+ * @param options - Handler options
62
+ * @returns Unsubscribe function
63
+ */
64
+ function onStorageEvent(bucket, handler, options) {
65
+ const state = registry$1();
66
+ const id = `storage-${++state.counters.handler}`;
67
+ state.eventHandlers.set(id, {
68
+ registration: {
69
+ id,
70
+ type: "storage",
71
+ source: bucket,
72
+ prefix: options?.prefix
73
+ },
74
+ handler
75
+ });
76
+ return () => {
77
+ state.eventHandlers.delete(id);
78
+ };
79
+ }
80
+ /**
81
+ * Register a cron/scheduled event handler.
82
+ *
83
+ * @param scheduleName - Schedule name (or `"*"` for all schedules)
84
+ * @param handler - Handler function for scheduled events
85
+ * @returns Unsubscribe function
86
+ */
87
+ function onCronEvent(scheduleName, handler) {
88
+ const state = registry$1();
89
+ const id = `cron-${++state.counters.handler}`;
90
+ state.eventHandlers.set(id, {
91
+ registration: {
92
+ id,
93
+ type: "cron",
94
+ source: scheduleName
95
+ },
96
+ handler
97
+ });
98
+ return () => {
99
+ state.eventHandlers.delete(id);
100
+ };
101
+ }
102
+ /**
103
+ * Register a queue message handler.
104
+ *
105
+ * @param queueName - Queue name (or `"*"` for all queues)
106
+ * @param handler - Handler function for queue messages
107
+ * @returns Unsubscribe function
108
+ */
109
+ function onQueueMessage(queueName, handler) {
110
+ const state = registry$1();
111
+ const id = `queue-${++state.counters.handler}`;
112
+ state.eventHandlers.set(id, {
113
+ registration: {
114
+ id,
115
+ type: "queue",
116
+ source: queueName
117
+ },
118
+ handler
119
+ });
120
+ return () => {
121
+ state.eventHandlers.delete(id);
122
+ };
123
+ }
124
+ /** Get all registered event handlers. @internal */
125
+ function getEventHandlers() {
126
+ return registry$1().eventHandlers;
127
+ }
128
+ /**
129
+ * Register a background task to continue after the response.
130
+ *
131
+ * The runtime waits for all registered tasks to complete before shutting down.
132
+ * This is the protocol-only registrar: it tracks the promise and (inside a
133
+ * running Worker) notifies the runtime via the installed hook. The gRPC drain
134
+ * coordination lives in {@link runWorker}.
135
+ *
136
+ * @param promise - The promise to track
137
+ */
138
+ function waitUntil(promise) {
139
+ const state = registry$1();
140
+ const id = `task-${++state.counters.task}`;
141
+ const tracker = {
142
+ id,
143
+ promise,
144
+ registeredAt: /* @__PURE__ */ new Date(),
145
+ completed: false
146
+ };
147
+ state.waitUntilTasks.set(id, tracker);
148
+ promise.then(() => {
149
+ tracker.completed = true;
150
+ }).catch((error) => {
151
+ tracker.completed = true;
152
+ tracker.error = error instanceof Error ? error : new Error(String(error));
153
+ }).finally(() => {
154
+ state.waitUntilTasks.delete(id);
155
+ });
156
+ try {
157
+ state.onTaskRegistered?.(tracker);
158
+ } catch (error) {
159
+ console.error("[alien:wait-until] onTaskRegistered hook failed:", error);
160
+ }
161
+ }
162
+ /** Install the runtime's task-registered hook. @internal */
163
+ function setOnTaskRegistered(hook) {
164
+ registry$1().onTaskRegistered = hook;
165
+ }
1
166
  Object.freeze({ status: "aborted" });
2
167
  function $constructor(name, initializer, params) {
3
168
  function init(inst, def) {
@@ -71,7 +236,6 @@ function cached(getter) {
71
236
  Object.defineProperty(this, "value", { value });
72
237
  return value;
73
238
  }
74
- throw new Error("cached value already set");
75
239
  } };
76
240
  }
77
241
  function nullish(input) {
@@ -1690,61 +1854,6 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1690
1854
  });
1691
1855
  };
1692
1856
  });
1693
- const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
1694
- def.inclusive = false;
1695
- $ZodUnion.init(inst, def);
1696
- const _super = inst._zod.parse;
1697
- defineLazy(inst._zod, "propValues", () => {
1698
- const propValues = {};
1699
- for (const option of def.options) {
1700
- const pv = option._zod.propValues;
1701
- if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1702
- for (const [k, v] of Object.entries(pv)) {
1703
- if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
1704
- for (const val of v) propValues[k].add(val);
1705
- }
1706
- }
1707
- return propValues;
1708
- });
1709
- const disc = cached(() => {
1710
- const opts = def.options;
1711
- const map = /* @__PURE__ */ new Map();
1712
- for (const o of opts) {
1713
- const values = o._zod.propValues?.[def.discriminator];
1714
- if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1715
- for (const v of values) {
1716
- if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
1717
- map.set(v, o);
1718
- }
1719
- }
1720
- return map;
1721
- });
1722
- inst._zod.parse = (payload, ctx) => {
1723
- const input = payload.value;
1724
- if (!isObject(input)) {
1725
- payload.issues.push({
1726
- code: "invalid_type",
1727
- expected: "object",
1728
- input,
1729
- inst
1730
- });
1731
- return payload;
1732
- }
1733
- const opt = disc.value.get(input?.[def.discriminator]);
1734
- if (opt) return opt._zod.run(payload, ctx);
1735
- if (def.unionFallback) return _super(payload, ctx);
1736
- payload.issues.push({
1737
- code: "invalid_union",
1738
- errors: [],
1739
- note: "No matching discriminator",
1740
- discriminator: def.discriminator,
1741
- input,
1742
- path: [def.discriminator],
1743
- inst
1744
- });
1745
- return payload;
1746
- };
1747
- });
1748
1857
  const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
1749
1858
  $ZodType.init(inst, def);
1750
1859
  inst._zod.parse = (payload, ctx) => {
@@ -1862,24 +1971,6 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1862
1971
  return payload;
1863
1972
  };
1864
1973
  });
1865
- const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1866
- $ZodType.init(inst, def);
1867
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1868
- const values = new Set(def.values);
1869
- inst._zod.values = values;
1870
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1871
- inst._zod.parse = (payload, _ctx) => {
1872
- const input = payload.value;
1873
- if (values.has(input)) return payload;
1874
- payload.issues.push({
1875
- code: "invalid_value",
1876
- values: def.values,
1877
- input,
1878
- inst
1879
- });
1880
- return payload;
1881
- };
1882
- });
1883
1974
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1884
1975
  $ZodType.init(inst, def);
1885
1976
  inst._zod.parse = (payload, ctx) => {
@@ -3030,27 +3121,6 @@ const enumProcessor = (schema, _ctx, json, _params) => {
3030
3121
  if (values.every((v) => typeof v === "string")) json.type = "string";
3031
3122
  json.enum = values;
3032
3123
  };
3033
- const literalProcessor = (schema, ctx, json, _params) => {
3034
- const def = schema._zod.def;
3035
- const vals = [];
3036
- for (const val of def.values) if (val === void 0) {
3037
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3038
- } else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3039
- else vals.push(Number(val));
3040
- else vals.push(val);
3041
- if (vals.length === 0) {} else if (vals.length === 1) {
3042
- const val = vals[0];
3043
- json.type = val === null ? "null" : typeof val;
3044
- if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
3045
- else json.const = val;
3046
- } else {
3047
- if (vals.every((v) => typeof v === "number")) json.type = "number";
3048
- if (vals.every((v) => typeof v === "string")) json.type = "string";
3049
- if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
3050
- if (vals.every((v) => v === null)) json.type = "null";
3051
- json.enum = vals;
3052
- }
3053
- };
3054
3124
  const customProcessor = (_schema, ctx, _json, _params) => {
3055
3125
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3056
3126
  };
@@ -3636,18 +3706,6 @@ function union(options, params) {
3636
3706
  ...normalizeParams(params)
3637
3707
  });
3638
3708
  }
3639
- const ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
3640
- ZodUnion.init(inst, def);
3641
- $ZodDiscriminatedUnion.init(inst, def);
3642
- });
3643
- function discriminatedUnion(discriminator, options, params) {
3644
- return new ZodDiscriminatedUnion({
3645
- type: "union",
3646
- options,
3647
- discriminator,
3648
- ...normalizeParams(params)
3649
- });
3650
- }
3651
3709
  const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
3652
3710
  $ZodIntersection.init(inst, def);
3653
3711
  ZodType.init(inst, def);
@@ -3698,23 +3756,6 @@ function _enum(values, params) {
3698
3756
  ...normalizeParams(params)
3699
3757
  });
3700
3758
  }
3701
- const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
3702
- $ZodLiteral.init(inst, def);
3703
- ZodType.init(inst, def);
3704
- inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
3705
- inst.values = new Set(def.values);
3706
- Object.defineProperty(inst, "value", { get() {
3707
- if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
3708
- return def.values[0];
3709
- } });
3710
- });
3711
- function literal(value, params) {
3712
- return new ZodLiteral({
3713
- type: "literal",
3714
- values: Array.isArray(value) ? value : [value],
3715
- ...normalizeParams(params)
3716
- });
3717
- }
3718
3759
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3719
3760
  $ZodTransform.init(inst, def);
3720
3761
  ZodType.init(inst, def);
@@ -3891,7 +3932,128 @@ function superRefine(fn) {
3891
3932
  return /* @__PURE__ */ _superRefine(fn);
3892
3933
  }
3893
3934
  //#endregion
3894
- //#region ../core/dist/stack.js
3935
+ //#region ../../node_modules/.pnpm/serialize-error@12.0.0/node_modules/serialize-error/error-constructors.js
3936
+ const list = [
3937
+ Error,
3938
+ EvalError,
3939
+ RangeError,
3940
+ ReferenceError,
3941
+ SyntaxError,
3942
+ TypeError,
3943
+ URIError,
3944
+ AggregateError,
3945
+ globalThis.DOMException,
3946
+ globalThis.AssertionError,
3947
+ globalThis.SystemError
3948
+ ].filter(Boolean).map((constructor) => [constructor.name, constructor]);
3949
+ const errorConstructors = new Map(list);
3950
+ //#endregion
3951
+ //#region ../../node_modules/.pnpm/serialize-error@12.0.0/node_modules/serialize-error/index.js
3952
+ const errorProperties = [
3953
+ {
3954
+ property: "name",
3955
+ enumerable: false
3956
+ },
3957
+ {
3958
+ property: "message",
3959
+ enumerable: false
3960
+ },
3961
+ {
3962
+ property: "stack",
3963
+ enumerable: false
3964
+ },
3965
+ {
3966
+ property: "code",
3967
+ enumerable: true
3968
+ },
3969
+ {
3970
+ property: "cause",
3971
+ enumerable: false
3972
+ },
3973
+ {
3974
+ property: "errors",
3975
+ enumerable: false
3976
+ }
3977
+ ];
3978
+ const toJsonWasCalled = /* @__PURE__ */ new WeakSet();
3979
+ const toJSON = (from) => {
3980
+ toJsonWasCalled.add(from);
3981
+ const json = from.toJSON();
3982
+ toJsonWasCalled.delete(from);
3983
+ return json;
3984
+ };
3985
+ const newError = (name) => {
3986
+ const ErrorConstructor = errorConstructors.get(name) ?? Error;
3987
+ return ErrorConstructor === AggregateError ? new ErrorConstructor([]) : new ErrorConstructor();
3988
+ };
3989
+ const destroyCircular = ({ from, seen, to, forceEnumerable, maxDepth, depth, useToJSON, serialize }) => {
3990
+ if (!to) if (Array.isArray(from)) to = [];
3991
+ else if (!serialize && isErrorLike(from)) to = newError(from.name);
3992
+ else to = {};
3993
+ seen.push(from);
3994
+ if (depth >= maxDepth) return to;
3995
+ if (useToJSON && typeof from.toJSON === "function" && !toJsonWasCalled.has(from)) return toJSON(from);
3996
+ const continueDestroyCircular = (value) => destroyCircular({
3997
+ from: value,
3998
+ seen: [...seen],
3999
+ forceEnumerable,
4000
+ maxDepth,
4001
+ depth,
4002
+ useToJSON,
4003
+ serialize
4004
+ });
4005
+ for (const [key, value] of Object.entries(from)) {
4006
+ if (value && value instanceof Uint8Array && value.constructor.name === "Buffer") {
4007
+ to[key] = "[object Buffer]";
4008
+ continue;
4009
+ }
4010
+ if (value !== null && typeof value === "object" && typeof value.pipe === "function") {
4011
+ to[key] = "[object Stream]";
4012
+ continue;
4013
+ }
4014
+ if (typeof value === "function") continue;
4015
+ if (!value || typeof value !== "object") {
4016
+ try {
4017
+ to[key] = value;
4018
+ } catch {}
4019
+ continue;
4020
+ }
4021
+ if (!seen.includes(from[key])) {
4022
+ depth++;
4023
+ to[key] = continueDestroyCircular(from[key]);
4024
+ continue;
4025
+ }
4026
+ to[key] = "[Circular]";
4027
+ }
4028
+ if (serialize || to instanceof Error) {
4029
+ for (const { property, enumerable } of errorProperties) if (from[property] !== void 0 && from[property] !== null) Object.defineProperty(to, property, {
4030
+ value: isErrorLike(from[property]) || Array.isArray(from[property]) ? continueDestroyCircular(from[property]) : from[property],
4031
+ enumerable: forceEnumerable ? true : enumerable,
4032
+ configurable: true,
4033
+ writable: true
4034
+ });
4035
+ }
4036
+ return to;
4037
+ };
4038
+ function serializeError(value, options = {}) {
4039
+ const { maxDepth = Number.POSITIVE_INFINITY, useToJSON = true } = options;
4040
+ if (typeof value === "object" && value !== null) return destroyCircular({
4041
+ from: value,
4042
+ seen: [],
4043
+ forceEnumerable: true,
4044
+ maxDepth,
4045
+ depth: 0,
4046
+ useToJSON,
4047
+ serialize: true
4048
+ });
4049
+ if (typeof value === "function") return `[Function: ${value.name || "anonymous"}]`;
4050
+ return value;
4051
+ }
4052
+ function isErrorLike(value) {
4053
+ return Boolean(value) && typeof value === "object" && typeof value.name === "string" && typeof value.message === "string" && typeof value.stack === "string";
4054
+ }
4055
+ //#endregion
4056
+ //#region ../core/dist/index.js
3895
4057
  /**
3896
4058
  * Generated by Kubb (https://kubb.dev/).
3897
4059
  * Do not edit manually.
@@ -4042,14 +4204,14 @@ const ResourceLifecycleSchema = _enum(["frozen", "live"]).describe("Describes th
4042
4204
  * Do not edit manually.
4043
4205
  */
4044
4206
  /**
4045
- * @description New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.
4207
+ * @description Reference to a resource by its stable id and resource type.
4046
4208
  */
4047
4209
  const ResourceRefSchema = object({
4048
4210
  "id": string(),
4049
4211
  get "type"() {
4050
4212
  return ResourceTypeSchema.describe("Resource type identifier that determines the specific kind of resource. This field is used for polymorphic deserialization and resource-specific behavior.");
4051
4213
  }
4052
- }).describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.");
4214
+ }).describe("Reference to a resource by its stable id and resource type.");
4053
4215
  /**
4054
4216
  * Generated by Kubb (https://kubb.dev/).
4055
4217
  * Do not edit manually.
@@ -4086,7 +4248,7 @@ const StackResourceStateSchema = object({
4086
4248
  return union([PlatformSchema, _null()]).optional();
4087
4249
  },
4088
4250
  get "dependencies"() {
4089
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.")).describe("Complete list of dependencies for this resource, including infrastructure dependencies.\nThis preserves the full dependency information from the stack definition.").optional();
4251
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("Complete list of dependencies for this resource, including infrastructure dependencies.\nThis preserves the full dependency information from the stack definition.").optional();
4090
4252
  },
4091
4253
  get "error"() {
4092
4254
  return union([AlienErrorSchema, _null()]).optional();
@@ -4890,6 +5052,7 @@ const AwsDaemonHeartbeatDataSchema = object({
4890
5052
  "horizonStatusMessage": string().nullish(),
4891
5053
  "horizonStatusReason": string().nullish(),
4892
5054
  "latestUpdateTimestamp": string(),
5055
+ "observedImage": string().nullish(),
4893
5056
  get "status"() {
4894
5057
  return WorkloadHeartbeatStatusSchema;
4895
5058
  },
@@ -4956,6 +5119,17 @@ const AwsDynamoDbKvHeartbeatDataSchema = object({
4956
5119
  * Generated by Kubb (https://kubb.dev/).
4957
5120
  * Do not edit manually.
4958
5121
  */
5122
+ /**
5123
+ * @description AWS subnets grouped by their real availability zone.
5124
+ */
5125
+ const AwsFailureDomainSubnetsSchema = object({
5126
+ "privateSubnetIds": optional(array(string()).describe("Private subnet IDs in this availability zone.")),
5127
+ "publicSubnetIds": optional(array(string()).describe("Public subnet IDs in this availability zone."))
5128
+ }).describe("AWS subnets grouped by their real availability zone.");
5129
+ /**
5130
+ * Generated by Kubb (https://kubb.dev/).
5131
+ * Do not edit manually.
5132
+ */
4959
5133
  const ServiceAccountHeartbeatStatusSchema = object({
4960
5134
  get "collectionIssues"() {
4961
5135
  return array(HeartbeatCollectionIssueSchema);
@@ -5050,6 +5224,7 @@ object({
5050
5224
  "publicRouteTableId": string().describe("Public route table ID.").nullish(),
5051
5225
  "publicSubnetIds": array(string()).describe("Public subnet IDs."),
5052
5226
  "securityGroupId": string().describe("Security group ID for private workloads.").nullish(),
5227
+ "subnetsByFailureDomain": optional(object({}).catchall(lazy(() => AwsFailureDomainSubnetsSchema).describe("AWS subnets grouped by their real availability zone.")).describe("Exact subnet membership keyed by real availability zone.")),
5053
5228
  "vpcId": string().describe("VPC ID. Absent when default-VPC mode defers lookup to AWS at runtime.").nullish()
5054
5229
  }).describe("AWS Network ImportData.");
5055
5230
  /**
@@ -5438,6 +5613,7 @@ const AzureComputeClusterHeartbeatDataSchema = object({
5438
5613
  object({
5439
5614
  "clusterId": string().describe("Cluster identifier used by the controller."),
5440
5615
  "clusterIdentityPrincipalId": string().describe("AKS cluster identity principal id (system-assigned identity)."),
5616
+ "identityId": string().describe("Resource ID of the user-assigned identity attached to cluster VMs."),
5441
5617
  "kubeletIdentityClientId": string().describe("kubelet UAMI client id used by node pools.")
5442
5618
  }).describe("Azure ComputeCluster ImportData — AKS node pool identity / network.");
5443
5619
  /**
@@ -5564,6 +5740,7 @@ const AzureDaemonHeartbeatDataSchema = object({
5564
5740
  "horizonStatusMessage": string().nullish(),
5565
5741
  "horizonStatusReason": string().nullish(),
5566
5742
  "latestUpdateTimestamp": string(),
5743
+ "observedImage": string().nullish(),
5567
5744
  get "status"() {
5568
5745
  return WorkloadHeartbeatStatusSchema;
5569
5746
  },
@@ -6254,7 +6431,7 @@ object({
6254
6431
  "environment": optional(object({}).catchall(string()).describe("Key-value pairs to set as environment variables for the build.")),
6255
6432
  "id": string().describe("Identifier for the build resource. Must contain only alphanumeric characters, hyphens, and underscores ([A-Za-z0-9-_]).\nMaximum 64 characters."),
6256
6433
  get "links"() {
6257
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.")).describe("List of resource references this build depends on.");
6434
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("List of resource references this build depends on.");
6258
6435
  },
6259
6436
  "permissions": string().describe("Permission profile name that defines the permissions granted to this build.\nThis references a profile defined in the stack's permission definitions.")
6260
6437
  }).describe("Represents a build resource that executes bash scripts to build code.\nBuilds are designed to be stateless and can be triggered on-demand to compile,\ntest, or package application code.");
@@ -6348,6 +6525,7 @@ const CapacityGroupSchema = object({
6348
6525
  return union([CapacityGroupScalePolicySchema, _null()]).optional();
6349
6526
  }
6350
6527
  }).describe("Capacity group definition.\n\nA capacity group represents machines with identical hardware profiles.\nEach group becomes a separate Auto Scaling Group (AWS), Managed Instance Group (GCP),\nor VM Scale Set (Azure).");
6528
+ _enum(["push", "pull"]).describe("How a command is delivered to its target resource.\n\nThis is a Commands-protocol-specific concept and is intentionally distinct\nfrom `DeploymentModel` (see `stack_settings.rs`), which governs the\ninfrastructure-level push/pull wiring for a deployment. Serialized\nlowercase for consistency with `CommandTargetType`.");
6351
6529
  /**
6352
6530
  * Generated by Kubb (https://kubb.dev/).
6353
6531
  * Do not edit manually.
@@ -6381,6 +6559,31 @@ const CommandStateSchema = _enum([
6381
6559
  "FAILED",
6382
6560
  "EXPIRED"
6383
6561
  ]).describe("Command states in the Commands protocol lifecycle");
6562
+ /**
6563
+ * Generated by Kubb (https://kubb.dev/).
6564
+ * Do not edit manually.
6565
+ */
6566
+ /**
6567
+ * @description The kind of command-capable resource a command targets.
6568
+ */
6569
+ const CommandTargetTypeSchema = _enum([
6570
+ "worker",
6571
+ "container",
6572
+ "daemon"
6573
+ ]).describe("The kind of command-capable resource a command targets.");
6574
+ /**
6575
+ * Generated by Kubb (https://kubb.dev/).
6576
+ * Do not edit manually.
6577
+ */
6578
+ /**
6579
+ * @description Identifies the specific resource a command is addressed to.
6580
+ */
6581
+ const CommandTargetSchema = object({
6582
+ "resourceId": string().describe("The resource ID within the deployment's stack (e.g. a Worker/Container/Daemon id)."),
6583
+ get "resourceType"() {
6584
+ return CommandTargetTypeSchema.describe("The kind of command-capable resource a command targets.");
6585
+ }
6586
+ }).describe("Identifies the specific resource a command is addressed to.");
6384
6587
  object({
6385
6588
  "attempt": int().min(0).describe("Current attempt number"),
6386
6589
  "commandId": string().describe("Command identifier"),
@@ -6389,6 +6592,9 @@ object({
6389
6592
  },
6390
6593
  get "state"() {
6391
6594
  return CommandStateSchema.describe("Command states in the Commands protocol lifecycle");
6595
+ },
6596
+ get "target"() {
6597
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
6392
6598
  }
6393
6599
  }).describe("Response to status queries");
6394
6600
  /**
@@ -6507,20 +6713,39 @@ object({
6507
6713
  return array(CapacityGroupSchema.describe("Capacity group definition.\n\nA capacity group represents machines with identical hardware profiles.\nEach group becomes a separate Auto Scaling Group (AWS), Managed Instance Group (GCP),\nor VM Scale Set (Azure).")).describe("Capacity groups defining the machine pools for this cluster.\nEach group becomes a separate ASG/MIG/VMSS.");
6508
6714
  },
6509
6715
  "containerCidr": string().describe("Container CIDR block for internal container networking.\nAuto-generated as \"10.244.0.0/16\" if not specified.\nEach machine gets a /24 subnet from this range.").nullish(),
6510
- "id": string().describe("Unique identifier for the container cluster.\nMust contain only alphanumeric characters, hyphens, and underscores.")
6716
+ "failureDomainSpread": optional(object({}).catchall(int().min(0)).describe("Requested failure-domain spread keyed by capacity group.\nEmpty preserves the existing aggregate layout.")),
6717
+ "id": string().describe("Unique identifier for the container cluster.\nMust contain only alphanumeric characters, hyphens, and underscores."),
6718
+ "selectedFailureDomains": optional(object({}).catchall(array(string())).describe("Concrete provider failure domains selected during setup, keyed by capacity group.\nEmpty preserves the existing aggregate layout when no spread policy is configured."))
6511
6719
  }).describe("ComputeCluster resource for running long-running container workloads.\n\nA ComputeCluster provides the setup-owned machine boundary for containers.\nAlien may manage the worker fleet inside that boundary when setup grants\n`compute-cluster/management`.\n\n## Architecture\n\n- **Setup** creates cloud resources: ASGs/MIGs/VMSSs, IAM roles, security groups\n- **Alien** manages allowed fleet operations: machine count and runtime\n machine image rollout\n- A node agent runs on each machine from the selected runtime image channel\n\n## Example\n\n```rust\nuse alien_core::{CapacityGroup, ComputeCluster, MachineProfile};\n\nlet cluster = ComputeCluster::new(\"compute\".to_string())\n .capacity_group(CapacityGroup {\n group_id: \"general\".to_string(),\n instance_type: None,\n profile: Some(MachineProfile {\n cpu: \"4.0\".to_string(),\n memory_bytes: 16 * 1024 * 1024 * 1024,\n ephemeral_storage_bytes: 20 * 1024 * 1024 * 1024,\n architecture: None,\n gpu: None,\n }),\n min_size: 1,\n max_size: 5,\n scale_policy: None,\n nested_virtualization: None,\n })\n .build();\n```");
6512
6720
  /**
6513
6721
  * Generated by Kubb (https://kubb.dev/).
6514
6722
  * Do not edit manually.
6515
6723
  */
6516
6724
  /**
6725
+ * @description Failure-domain policy selected for a compute pool.
6726
+ */
6727
+ const FailureDomainSelectionSchema = object({
6728
+ "selectedFailureDomains": optional(array(string()).describe("Concrete provider domains selected during setup.\nEmpty delegates deterministic selection to the provider setup implementation.")),
6729
+ "spread": int().min(0).describe("Number of distinct failure domains across which new stateful replicas may be spread.")
6730
+ }).describe("Failure-domain policy selected for a compute pool.");
6731
+ /**
6732
+ * Generated by Kubb (https://kubb.dev/).
6733
+ * Do not edit manually.
6734
+ */
6735
+ /**
6517
6736
  * @description User-selected deployment settings for one compute pool.
6518
6737
  */
6519
6738
  const ComputePoolSelectionSchema = union([object({
6739
+ get "failure_domains"() {
6740
+ return union([FailureDomainSelectionSchema, _null()]).optional();
6741
+ },
6520
6742
  "machine": string().describe("Provider machine type selected for this deployment.").nullish(),
6521
6743
  "machines": int().min(0).describe("Number of machines to run."),
6522
6744
  "mode": _enum(["fixed"])
6523
6745
  }), object({
6746
+ get "failure_domains"() {
6747
+ return union([FailureDomainSelectionSchema, _null()]).optional();
6748
+ },
6524
6749
  "machine": string().describe("Provider machine type selected for this deployment.").nullish(),
6525
6750
  "max": int().min(0).describe("Maximum machine count."),
6526
6751
  "min": int().min(0).describe("Minimum machine count."),
@@ -6636,9 +6861,11 @@ const HorizonContainerHeartbeatDataSchema = object({
6636
6861
  return array(ManagedRuntimeEventSnapshotSchema);
6637
6862
  },
6638
6863
  "image": string().nullish(),
6864
+ "latestUpdateTimestamp": string().nullish(),
6639
6865
  get "memory"() {
6640
6866
  return union([MetricSampleSchema, _null()]).optional();
6641
6867
  },
6868
+ "observedImage": string().nullish(),
6642
6869
  get "replicaUnits"() {
6643
6870
  return array(ManagedRuntimeUnitStatusSchema);
6644
6871
  },
@@ -6871,6 +7098,14 @@ const ContainerStatusSchema = _enum([
6871
7098
  * Do not edit manually.
6872
7099
  */
6873
7100
  /**
7101
+ * @description Protocol for public workload endpoints.
7102
+ */
7103
+ const ExposeProtocolSchema = _enum(["http", "tcp"]).describe("Protocol for public workload endpoints.");
7104
+ /**
7105
+ * Generated by Kubb (https://kubb.dev/).
7106
+ * Do not edit manually.
7107
+ */
7108
+ /**
6874
7109
  * @description Load balancer endpoint information for DNS management.\nThis is optional metadata used by the DNS controller to create domain mappings.
6875
7110
  */
6876
7111
  const LoadBalancerEndpointSchema = object({
@@ -6889,6 +7124,10 @@ const PublicEndpointOutputSchema = object({
6889
7124
  get "loadBalancerEndpoint"() {
6890
7125
  return union([LoadBalancerEndpointSchema, _null()]).optional();
6891
7126
  },
7127
+ "port": int().min(1).max(65535).describe("Public connection port."),
7128
+ get "protocol"() {
7129
+ return ExposeProtocolSchema.describe("Protocol for public workload endpoints.");
7130
+ },
6892
7131
  "url": string().describe("Base URL for this endpoint."),
6893
7132
  "wildcardHost": string().describe("Wildcard hostname routed to this endpoint, when configured.").nullish()
6894
7133
  }).describe("Runtime-resolved public endpoint metadata.");
@@ -6957,14 +7196,6 @@ const PersistentStorageSchema = object({
6957
7196
  * Do not edit manually.
6958
7197
  */
6959
7198
  /**
6960
- * @description Protocol for public workload endpoints.
6961
- */
6962
- const ExposeProtocolSchema = _enum(["http", "tcp"]).describe("Protocol for public workload endpoints.");
6963
- /**
6964
- * Generated by Kubb (https://kubb.dev/).
6965
- * Do not edit manually.
6966
- */
6967
- /**
6968
7199
  * @description Public endpoint configuration for port-backed workload resources.
6969
7200
  */
6970
7201
  const PublicEndpointSchema = object({
@@ -6996,6 +7227,7 @@ object({
6996
7227
  return ContainerCodeSchema.describe("Specifies the source of the container's executable code.");
6997
7228
  },
6998
7229
  "command": array(string()).describe("Command to override image default").nullish(),
7230
+ "commandsEnabled": optional(boolean().default(false).describe("Whether the container can receive remote commands via the Commands protocol.\nWhen enabled, an app-owned command receiver can lease pending commands\nfor this Container and execute registered handlers.")),
6999
7231
  get "cpu"() {
7000
7232
  return ResourceSpecSchema.describe("Resource specification with min/desired values.");
7001
7233
  },
@@ -7009,7 +7241,7 @@ object({
7009
7241
  },
7010
7242
  "id": string().describe("Unique identifier for the container.\nMust be DNS-compatible: lowercase alphanumeric with hyphens."),
7011
7243
  get "links"() {
7012
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.")).describe("Resource links (dependencies)");
7244
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("Resource links (dependencies)");
7013
7245
  },
7014
7246
  get "memory"() {
7015
7247
  return ResourceSpecSchema.describe("Resource specification with min/desired values.");
@@ -7036,7 +7268,8 @@ object({
7036
7268
  "idempotencyKey": string().describe("Optional idempotency key").nullish(),
7037
7269
  get "params"() {
7038
7270
  return BodySpecSchema.describe("Body specification supporting inline and storage modes");
7039
- }
7271
+ },
7272
+ "targetResourceId": string().describe("Optional explicit target resource ID within the deployment's stack.\nWhen omitted, the target is resolved server-side (single-target shorthand):\nexactly one command-capable resource must exist, or resolution fails.").nullish()
7040
7273
  }).describe("Request to create a new command");
7041
7274
  /**
7042
7275
  * Generated by Kubb (https://kubb.dev/).
@@ -7155,6 +7388,7 @@ const GcpDaemonHeartbeatDataSchema = object({
7155
7388
  "horizonStatusMessage": string().nullish(),
7156
7389
  "horizonStatusReason": string().nullish(),
7157
7390
  "latestUpdateTimestamp": string(),
7391
+ "observedImage": string().nullish(),
7158
7392
  get "status"() {
7159
7393
  return WorkloadHeartbeatStatusSchema;
7160
7394
  },
@@ -7235,6 +7469,7 @@ const MachinesDaemonHeartbeatDataSchema = object({
7235
7469
  "horizonStatusMessage": string().nullish(),
7236
7470
  "horizonStatusReason": string().nullish(),
7237
7471
  "latestUpdateTimestamp": string(),
7472
+ "observedImage": string().nullish(),
7238
7473
  get "status"() {
7239
7474
  return WorkloadHeartbeatStatusSchema;
7240
7475
  },
@@ -7285,7 +7520,7 @@ object({
7285
7520
  return DaemonCodeSchema;
7286
7521
  },
7287
7522
  "command": array(string()).describe("Command to override the image default.").nullish(),
7288
- "commandsEnabled": optional(boolean().default(false)),
7523
+ "commandsEnabled": optional(boolean().default(false).describe("Whether an app-owned command receiver can lease pending commands for\nthis Daemon and execute registered handlers.")),
7289
7524
  get "cpu"() {
7290
7525
  return ResourceSpecSchema.describe("Resource specification with min/desired values.").optional();
7291
7526
  },
@@ -7295,7 +7530,7 @@ object({
7295
7530
  },
7296
7531
  "id": string(),
7297
7532
  get "links"() {
7298
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility."));
7533
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type."));
7299
7534
  },
7300
7535
  get "memory"() {
7301
7536
  return ResourceSpecSchema.describe("Resource specification with min/desired values.").optional();
@@ -7390,6 +7625,17 @@ const ResponseHandlingSchema = object({
7390
7625
  * Do not edit manually.
7391
7626
  */
7392
7627
  /**
7628
+ * @description W3C Trace Context propagated with a command lease.\n\nThe values are kept in their standard wire form so receivers can attach\nthem to handler telemetry without inventing separate trace/span fields.
7629
+ */
7630
+ const TraceContextSchema = object({
7631
+ "traceparent": string().describe("W3C `traceparent` header value."),
7632
+ "tracestate": string().describe("Optional W3C `tracestate` header value.").nullish()
7633
+ }).describe("W3C Trace Context propagated with a command lease.\n\nThe values are kept in their standard wire form so receivers can attach\nthem to handler telemetry without inventing separate trace/span fields.");
7634
+ /**
7635
+ * Generated by Kubb (https://kubb.dev/).
7636
+ * Do not edit manually.
7637
+ */
7638
+ /**
7393
7639
  * @description Commands envelope sent to deployments
7394
7640
  */
7395
7641
  const EnvelopeSchema = object({
@@ -7404,6 +7650,12 @@ const EnvelopeSchema = object({
7404
7650
  "protocol": string().describe("Protocol version identifier"),
7405
7651
  get "responseHandling"() {
7406
7652
  return ResponseHandlingSchema.describe("Response handling configuration for deployments");
7653
+ },
7654
+ get "target"() {
7655
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
7656
+ },
7657
+ get "traceContext"() {
7658
+ return union([TraceContextSchema, _null()]).optional();
7407
7659
  }
7408
7660
  }).describe("Commands envelope sent to deployments");
7409
7661
  /**
@@ -7855,7 +8107,7 @@ const ImportedResourceSchema = object({
7855
8107
  * @description Certificate publication or reference mode for Kubernetes public endpoints.
7856
8108
  */
7857
8109
  const KubernetesCertificateModeSchema = union([
7858
- lazy(() => KubernetesTlsSecretRefSchema).and(object({ "mode": _enum(["tlsSecretRef"]) })).describe("Namespace-scoped Kubernetes TLS Secret reference."),
8110
+ lazy(() => KubernetesTlsSecretRefSchema).and(object({ "mode": _enum(["tlsSecretRef"]) })),
7859
8111
  object({
7860
8112
  "mode": _enum(["managedAcmImport"]),
7861
8113
  "region": string().describe("ACM region. Defaults to the deployment region when omitted.").nullish(),
@@ -8072,7 +8324,7 @@ const KubernetesIngressRouteProfileSchema = object({
8072
8324
  /**
8073
8325
  * @description Kubernetes route API selected for public endpoints.
8074
8326
  */
8075
- const KubernetesRouteProfileSchema = union([lazy(() => KubernetesIngressRouteProfileSchema).and(object({ "routeApi": _enum(["ingress"]) })).describe("Shared Ingress route profile values."), lazy(() => KubernetesGatewayRouteProfileSchema).and(object({ "routeApi": _enum(["gateway"]) })).describe("Shared Gateway API route profile values.")]).describe("Kubernetes route API selected for public endpoints.");
8327
+ const KubernetesRouteProfileSchema = union([lazy(() => KubernetesIngressRouteProfileSchema).and(object({ "routeApi": _enum(["ingress"]) })), lazy(() => KubernetesGatewayRouteProfileSchema).and(object({ "routeApi": _enum(["gateway"]) }))]).describe("Kubernetes route API selected for public endpoints.");
8076
8328
  /**
8077
8329
  * Generated by Kubb (https://kubb.dev/).
8078
8330
  * Do not edit manually.
@@ -8212,7 +8464,10 @@ const LeaseInfoSchema = object({
8212
8464
  object({
8213
8465
  "deploymentId": string().describe("Deployment identifier"),
8214
8466
  "leaseSeconds": optional(int().min(0).describe("Lease duration in seconds")),
8215
- "maxLeases": optional(int().min(0).describe("Maximum number of leases to acquire"))
8467
+ "maxLeases": optional(int().min(0).describe("Maximum number of leases to acquire")),
8468
+ get "target"() {
8469
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
8470
+ }
8216
8471
  }).describe("Request for acquiring leases");
8217
8472
  object({ get "leases"() {
8218
8473
  return array(LeaseInfoSchema.describe("Lease information")).describe("Acquired leases (empty array if none available)");
@@ -8327,9 +8582,9 @@ const LocalWorkerHeartbeatDataSchema = object({
8327
8582
  * @description Management configuration for different cloud platforms.\n\nPlatform-derived configuration for cross-account/cross-tenant access.\nThis is NOT user-specified - it\'s derived from the Manager\'s ServiceAccount.
8328
8583
  */
8329
8584
  const ManagementConfigSchema = union([
8330
- lazy(() => AwsManagementConfigSchema).and(object({ "platform": _enum(["aws"]) })).describe("AWS management configuration extracted from stack settings"),
8331
- lazy(() => GcpManagementConfigSchema).and(object({ "platform": _enum(["gcp"]) })).describe("GCP management configuration extracted from stack settings"),
8332
- lazy(() => AzureManagementConfigSchema).and(object({ "platform": _enum(["azure"]) })).describe("Azure management configuration extracted from stack settings"),
8585
+ lazy(() => AwsManagementConfigSchema).and(object({ "platform": _enum(["aws"]) })),
8586
+ lazy(() => GcpManagementConfigSchema).and(object({ "platform": _enum(["gcp"]) })),
8587
+ lazy(() => AzureManagementConfigSchema).and(object({ "platform": _enum(["azure"]) })),
8333
8588
  object({ "platform": _enum(["kubernetes"]) })
8334
8589
  ]).describe("Management configuration for different cloud platforms.\n\nPlatform-derived configuration for cross-account/cross-tenant access.\nThis is NOT user-specified - it's derived from the Manager's ServiceAccount.");
8335
8590
  /**
@@ -8550,10 +8805,10 @@ const PostgresBackendSchema = object({ "type": _enum(["auroraServerlessV2"]) }).
8550
8805
  * Do not edit manually.
8551
8806
  */
8552
8807
  const PostgresHeartbeatDataSchema = union([
8553
- lazy(() => AuroraPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["aurora"]) })).describe("AWS Aurora Serverless v2 backend."),
8554
- lazy(() => GcpCloudSqlPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["cloudSql"]) })).describe("GCP Cloud SQL backend."),
8555
- lazy(() => AzureFlexibleServerPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["flexibleServer"]) })).describe("Azure Flexible Server backend."),
8556
- lazy(() => LocalPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["local"]) })).describe("Local embedded Postgres backend.")
8808
+ lazy(() => AuroraPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["aurora"]) })),
8809
+ lazy(() => GcpCloudSqlPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["cloudSql"]) })),
8810
+ lazy(() => AzureFlexibleServerPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["flexibleServer"]) })),
8811
+ lazy(() => LocalPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["local"]) }))
8557
8812
  ]);
8558
8813
  object({
8559
8814
  "database": string().describe("The default database created for this resource. On cloud backends this is the fixed\nlabel `POSTGRES_DATABASE_NAME` (`alien`); on Local it is the resource id."),
@@ -8591,7 +8846,7 @@ object({
8591
8846
  "receiptHandle": string().describe("Platform-specific receipt handle for acknowledgment"),
8592
8847
  "source": string().describe("Source queue/topic name (derived from ARN/source/topic)"),
8593
8848
  "timestamp": datetime().describe("Message timestamp (from SentTimestamp/ce-time/enqueuedTimeUtc)")
8594
- }).describe("Standardized queue message structure used by alien-runtime\n\nThis structure contains commonly available metadata across all platforms\nand a JSON-first payload that handles both structured data and plain text.");
8849
+ }).describe("Standardized queue message structure delivered to applications\n\nThis structure contains commonly available metadata across all platforms\nand a JSON-first payload that handles both structured data and plain text.");
8595
8850
  object({
8596
8851
  "identifier": string().describe("Platform-specific identifier or URL (e.g., SQS URL, Pub/Sub topic/subscription).").nullish(),
8597
8852
  "queueName": string().describe("The name of the queue (platform-specific physical name).")
@@ -8634,7 +8889,7 @@ const ResourceEntrySchema = object({
8634
8889
  return BaseResourceSchema.describe("Resource that can hold any resource type in the Alien system. All resources share common 'type' and 'id' fields with additional type-specific properties.");
8635
8890
  },
8636
8891
  get "dependencies"() {
8637
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.")).describe("Additional dependencies for this resource beyond those defined in the resource itself.\nThe total dependencies are: resource.get_dependencies() + this list");
8892
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("Additional dependencies for this resource beyond those defined in the resource itself.\nThe total dependencies are: resource.get_dependencies() + this list");
8638
8893
  },
8639
8894
  get "lifecycle"() {
8640
8895
  return ResourceLifecycleSchema.describe("Describes the lifecycle of a resource within a stack, determining how it's managed and deployed.");
@@ -9132,7 +9387,7 @@ object({
9132
9387
  "publicRead": optional(boolean().describe("Allows public read access to objects without authentication.\nDefault: `false`")),
9133
9388
  "versioning": optional(boolean().describe("Enables object versioning.\nDefault: `false`"))
9134
9389
  }).describe("Represents an object storage bucket.");
9135
- lazy(() => CommandResponseSchema).describe("Command response from deployment").describe("Request to submit a command response (from deployment)");
9390
+ lazy(() => CommandResponseSchema).describe("Request to submit a command response (from deployment)");
9136
9391
  object({ "size": int().min(0).describe("Size of uploaded data") }).describe("Request to mark upload as complete");
9137
9392
  object({
9138
9393
  "commandId": string().describe("Command identifier"),
@@ -9187,14 +9442,14 @@ const WorkerPublicEndpointSchema = object({
9187
9442
  const WorkerTriggerSchema = union([
9188
9443
  object({
9189
9444
  get "queue"() {
9190
- return ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.");
9445
+ return ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.");
9191
9446
  },
9192
9447
  "type": _enum(["queue"])
9193
9448
  }),
9194
9449
  object({
9195
9450
  "events": array(string()).describe("Events to trigger on (e.g., [\"created\", \"deleted\"])"),
9196
9451
  get "storage"() {
9197
- return ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.");
9452
+ return ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.");
9198
9453
  },
9199
9454
  "type": _enum(["storage"])
9200
9455
  }),
@@ -9207,12 +9462,12 @@ object({
9207
9462
  get "code"() {
9208
9463
  return WorkerCodeSchema.describe("Specifies the source of the worker's executable code.\nThis can be a pre-built container image or source code that the system will build.");
9209
9464
  },
9210
- "commandsEnabled": optional(boolean().default(false).describe("Whether the worker can receive remote commands via the Commands protocol.\nWhen enabled, the runtime polls the manager for pending commands and executes registered handlers.")),
9465
+ "commandsEnabled": optional(boolean().default(false).describe("Whether the worker can receive remote commands via the Commands protocol.\nWhen enabled, the platform pushes commands into the Worker runtime,\nwhich executes registered handlers.")),
9211
9466
  "concurrencyLimit": int().min(0).describe("Maximum number of concurrent executions allowed for the worker.\nNone means platform default applies.").nullish(),
9212
9467
  "environment": optional(object({}).catchall(string()).describe("Key-value pairs to set as environment variables for the worker.")),
9213
9468
  "id": string().describe("Identifier for the worker. Must contain only alphanumeric characters, hyphens, and underscores ([A-Za-z0-9-_]).\nMaximum 64 characters."),
9214
9469
  get "links"() {
9215
- return array(ResourceRefSchema.describe("New ResourceRef that works with any resource type.\nThis can eventually replace the enum-based ResourceRef for full extensibility.")).describe("List of resource references this worker depends on.");
9470
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("List of resource references this worker depends on.");
9216
9471
  },
9217
9472
  "memoryMb": optional(int().min(0).default(256).describe("Memory allocated to the worker in megabytes (MB).\nDefault: 256\n\nPlatform-specific constraints:\n- **AWS Lambda**: 128–10240 MB in 1 MB increments\n- **GCP Cloud Run**: 128–32768 MB\n- **Azure Container Apps**: fixed CPU/memory pairs — 512, 1024, 1536, 2048, 2560,\n 3072, 3584, 4096 MB. Values below 512 are automatically rounded up at deploy time.")),
9218
9473
  "permissions": string().describe("Permission profile name that defines the permissions granted to this worker.\nThis references a profile defined in the stack's permission definitions."),
@@ -9222,134 +9477,11 @@ object({
9222
9477
  get "readinessProbe"() {
9223
9478
  return union([ReadinessProbeSchema, _null()]).optional();
9224
9479
  },
9225
- "timeoutSeconds": optional(int().min(0).default(180).describe("Maximum execution time for the worker in seconds.\nConstraints: 1‑3600 seconds (platform-specific limits may apply)\nDefault: 30")),
9480
+ "timeoutSeconds": optional(int().min(1).max(3600).default(180).describe("Maximum execution time for the worker in seconds.\nConstraints: 1‑3600 seconds (platform-specific limits may apply)\nDefault: 180")),
9226
9481
  get "triggers"() {
9227
9482
  return array(WorkerTriggerSchema.describe("Defines what triggers a worker execution.")).describe("List of triggers that define what events automatically invoke this worker.\nIf empty, the worker is only invokable directly via HTTP calls or platform-specific invocation APIs.\nWhen configured, the worker will be automatically invoked when any of the specified trigger conditions are met.");
9228
9483
  }
9229
9484
  }).describe("Represents a serverless worker that executes code in response to triggers or direct invocations.\nWorkers are the primary compute resource in serverless applications, designed to be stateless and ephemeral.");
9230
- //#endregion
9231
- //#region ../../node_modules/.pnpm/serialize-error@12.0.0/node_modules/serialize-error/error-constructors.js
9232
- const list = [
9233
- Error,
9234
- EvalError,
9235
- RangeError,
9236
- ReferenceError,
9237
- SyntaxError,
9238
- TypeError,
9239
- URIError,
9240
- AggregateError,
9241
- globalThis.DOMException,
9242
- globalThis.AssertionError,
9243
- globalThis.SystemError
9244
- ].filter(Boolean).map((constructor) => [constructor.name, constructor]);
9245
- const errorConstructors = new Map(list);
9246
- //#endregion
9247
- //#region ../../node_modules/.pnpm/serialize-error@12.0.0/node_modules/serialize-error/index.js
9248
- const errorProperties = [
9249
- {
9250
- property: "name",
9251
- enumerable: false
9252
- },
9253
- {
9254
- property: "message",
9255
- enumerable: false
9256
- },
9257
- {
9258
- property: "stack",
9259
- enumerable: false
9260
- },
9261
- {
9262
- property: "code",
9263
- enumerable: true
9264
- },
9265
- {
9266
- property: "cause",
9267
- enumerable: false
9268
- },
9269
- {
9270
- property: "errors",
9271
- enumerable: false
9272
- }
9273
- ];
9274
- const toJsonWasCalled = /* @__PURE__ */ new WeakSet();
9275
- const toJSON = (from) => {
9276
- toJsonWasCalled.add(from);
9277
- const json = from.toJSON();
9278
- toJsonWasCalled.delete(from);
9279
- return json;
9280
- };
9281
- const newError = (name) => {
9282
- const ErrorConstructor = errorConstructors.get(name) ?? Error;
9283
- return ErrorConstructor === AggregateError ? new ErrorConstructor([]) : new ErrorConstructor();
9284
- };
9285
- const destroyCircular = ({ from, seen, to, forceEnumerable, maxDepth, depth, useToJSON, serialize }) => {
9286
- if (!to) if (Array.isArray(from)) to = [];
9287
- else if (!serialize && isErrorLike(from)) to = newError(from.name);
9288
- else to = {};
9289
- seen.push(from);
9290
- if (depth >= maxDepth) return to;
9291
- if (useToJSON && typeof from.toJSON === "function" && !toJsonWasCalled.has(from)) return toJSON(from);
9292
- const continueDestroyCircular = (value) => destroyCircular({
9293
- from: value,
9294
- seen: [...seen],
9295
- forceEnumerable,
9296
- maxDepth,
9297
- depth,
9298
- useToJSON,
9299
- serialize
9300
- });
9301
- for (const [key, value] of Object.entries(from)) {
9302
- if (value && value instanceof Uint8Array && value.constructor.name === "Buffer") {
9303
- to[key] = "[object Buffer]";
9304
- continue;
9305
- }
9306
- if (value !== null && typeof value === "object" && typeof value.pipe === "function") {
9307
- to[key] = "[object Stream]";
9308
- continue;
9309
- }
9310
- if (typeof value === "function") continue;
9311
- if (!value || typeof value !== "object") {
9312
- try {
9313
- to[key] = value;
9314
- } catch {}
9315
- continue;
9316
- }
9317
- if (!seen.includes(from[key])) {
9318
- depth++;
9319
- to[key] = continueDestroyCircular(from[key]);
9320
- continue;
9321
- }
9322
- to[key] = "[Circular]";
9323
- }
9324
- if (serialize || to instanceof Error) {
9325
- for (const { property, enumerable } of errorProperties) if (from[property] !== void 0 && from[property] !== null) Object.defineProperty(to, property, {
9326
- value: isErrorLike(from[property]) || Array.isArray(from[property]) ? continueDestroyCircular(from[property]) : from[property],
9327
- enumerable: forceEnumerable ? true : enumerable,
9328
- configurable: true,
9329
- writable: true
9330
- });
9331
- }
9332
- return to;
9333
- };
9334
- function serializeError(value, options = {}) {
9335
- const { maxDepth = Number.POSITIVE_INFINITY, useToJSON = true } = options;
9336
- if (typeof value === "object" && value !== null) return destroyCircular({
9337
- from: value,
9338
- seen: [],
9339
- forceEnumerable: true,
9340
- maxDepth,
9341
- depth: 0,
9342
- useToJSON,
9343
- serialize: true
9344
- });
9345
- if (typeof value === "function") return `[Function: ${value.name || "anonymous"}]`;
9346
- return value;
9347
- }
9348
- function isErrorLike(value) {
9349
- return Boolean(value) && typeof value === "object" && typeof value.name === "string" && typeof value.message === "string" && typeof value.stack === "string";
9350
- }
9351
- //#endregion
9352
- //#region ../core/dist/index.js
9353
9485
  /**
9354
9486
  * This module provides a structured error handling system similar to Rust's error types,
9355
9487
  * with TypeScript type safety, error chaining, and context preservation.
@@ -9908,4 +10040,4 @@ defineError({
9908
10040
  httpStatusCode: 400
9909
10041
  });
9910
10042
  //#endregion
9911
- export { literal as a, string as c, discriminatedUnion as i, defineError as n, number as o, _enum as r, object as s, AlienError as t };
10043
+ export { command as a, onCronEvent as c, runCommand as d, setOnTaskRegistered as f, string as i, onQueueMessage as l, defineError as n, getCommands as o, waitUntil as p, object as r, getEventHandlers as s, AlienError as t, onStorageEvent as u };