@alienplatform/sdk 1.14.1 → 2.0.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 (160) hide show
  1. package/dist/dist.js +371 -275
  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 +18 -38
  32. package/.turbo/turbo-build.log +0 -30
  33. package/AGENTS.md +0 -70
  34. package/dist/bearerTokenAuthenticationPolicy.js +0 -3028
  35. package/dist/bindings/artifact-registry.d.ts +0 -88
  36. package/dist/bindings/artifact-registry.d.ts.map +0 -1
  37. package/dist/bindings/build.d.ts +0 -67
  38. package/dist/bindings/build.d.ts.map +0 -1
  39. package/dist/bindings/index.d.ts +0 -13
  40. package/dist/bindings/index.d.ts.map +0 -1
  41. package/dist/bindings/kv.d.ts +0 -113
  42. package/dist/bindings/kv.d.ts.map +0 -1
  43. package/dist/bindings/postgres.d.ts +0 -90
  44. package/dist/bindings/postgres.d.ts.map +0 -1
  45. package/dist/bindings/postgres.test.d.ts +0 -2
  46. package/dist/bindings/postgres.test.d.ts.map +0 -1
  47. package/dist/bindings/queue.d.ts +0 -81
  48. package/dist/bindings/queue.d.ts.map +0 -1
  49. package/dist/bindings/service-account.d.ts +0 -46
  50. package/dist/bindings/service-account.d.ts.map +0 -1
  51. package/dist/bindings/storage.d.ts +0 -164
  52. package/dist/bindings/storage.d.ts.map +0 -1
  53. package/dist/bindings/vault.d.ts +0 -65
  54. package/dist/bindings/vault.d.ts.map +0 -1
  55. package/dist/bindings/worker.d.ts +0 -72
  56. package/dist/bindings/worker.d.ts.map +0 -1
  57. package/dist/channel.d.ts +0 -39
  58. package/dist/channel.d.ts.map +0 -1
  59. package/dist/checksum.js +0 -6176
  60. package/dist/commands/client.d.ts +0 -47
  61. package/dist/commands/client.d.ts.map +0 -1
  62. package/dist/commands/errors.d.ts +0 -198
  63. package/dist/commands/errors.d.ts.map +0 -1
  64. package/dist/commands/index.d.ts +0 -23
  65. package/dist/commands/index.d.ts.map +0 -1
  66. package/dist/commands/index.js +0 -387
  67. package/dist/commands/types.d.ts +0 -40
  68. package/dist/commands/types.d.ts.map +0 -1
  69. package/dist/commands.d.ts +0 -55
  70. package/dist/commands.d.ts.map +0 -1
  71. package/dist/context.d.ts +0 -182
  72. package/dist/context.d.ts.map +0 -1
  73. package/dist/dist-cjs.js +0 -15258
  74. package/dist/dist2.js +0 -1239
  75. package/dist/errors.d.ts +0 -359
  76. package/dist/errors.d.ts.map +0 -1
  77. package/dist/es5.js +0 -1720
  78. package/dist/esm.js +0 -18068
  79. package/dist/esm2.js +0 -3166
  80. package/dist/event-streams.js +0 -770
  81. package/dist/events.d.ts +0 -163
  82. package/dist/events.d.ts.map +0 -1
  83. package/dist/generated/artifact_registry.d.ts +0 -302
  84. package/dist/generated/artifact_registry.d.ts.map +0 -1
  85. package/dist/generated/build.d.ts +0 -184
  86. package/dist/generated/build.d.ts.map +0 -1
  87. package/dist/generated/container.d.ts +0 -101
  88. package/dist/generated/container.d.ts.map +0 -1
  89. package/dist/generated/control.d.ts.map +0 -1
  90. package/dist/generated/google/protobuf/duration.d.ts.map +0 -1
  91. package/dist/generated/google/protobuf/timestamp.d.ts.map +0 -1
  92. package/dist/generated/kv.d.ts +0 -182
  93. package/dist/generated/kv.d.ts.map +0 -1
  94. package/dist/generated/queue.d.ts +0 -127
  95. package/dist/generated/queue.d.ts.map +0 -1
  96. package/dist/generated/service_account.d.ts +0 -112
  97. package/dist/generated/service_account.d.ts.map +0 -1
  98. package/dist/generated/storage.d.ts +0 -784
  99. package/dist/generated/storage.d.ts.map +0 -1
  100. package/dist/generated/vault.d.ts +0 -107
  101. package/dist/generated/vault.d.ts.map +0 -1
  102. package/dist/generated/wait_until.d.ts.map +0 -1
  103. package/dist/generated/worker.d.ts +0 -107
  104. package/dist/generated/worker.d.ts.map +0 -1
  105. package/dist/global.d.ts +0 -208
  106. package/dist/global.d.ts.map +0 -1
  107. package/dist/grpc-utils.d.ts +0 -25
  108. package/dist/grpc-utils.d.ts.map +0 -1
  109. package/dist/jws.js +0 -611
  110. package/dist/open.js +0 -461
  111. package/dist/rolldown-runtime.js +0 -44
  112. package/dist/src2.js +0 -114032
  113. package/dist/types.d.ts +0 -337
  114. package/dist/types.d.ts.map +0 -1
  115. package/dist/wait-until.d.ts +0 -115
  116. package/dist/wait-until.d.ts.map +0 -1
  117. package/scripts/generate-proto.sh +0 -46
  118. package/src/bindings/AGENTS.md +0 -105
  119. package/src/bindings/artifact-registry.ts +0 -317
  120. package/src/bindings/build.ts +0 -195
  121. package/src/bindings/index.ts +0 -13
  122. package/src/bindings/kv.ts +0 -240
  123. package/src/bindings/postgres.test.ts +0 -17
  124. package/src/bindings/postgres.ts +0 -446
  125. package/src/bindings/queue.ts +0 -191
  126. package/src/bindings/service-account.ts +0 -113
  127. package/src/bindings/storage.ts +0 -536
  128. package/src/bindings/vault.ts +0 -133
  129. package/src/bindings/worker.ts +0 -164
  130. package/src/channel.ts +0 -102
  131. package/src/commands/client.ts +0 -446
  132. package/src/commands/errors.ts +0 -126
  133. package/src/commands/index.ts +0 -41
  134. package/src/commands/types.ts +0 -52
  135. package/src/commands.ts +0 -76
  136. package/src/context.ts +0 -368
  137. package/src/errors.ts +0 -280
  138. package/src/events.ts +0 -511
  139. package/src/generated/artifact_registry.ts +0 -2096
  140. package/src/generated/build.ts +0 -1311
  141. package/src/generated/container.ts +0 -503
  142. package/src/generated/control.ts +0 -2018
  143. package/src/generated/google/protobuf/duration.ts +0 -196
  144. package/src/generated/google/protobuf/timestamp.ts +0 -226
  145. package/src/generated/kv.ts +0 -1169
  146. package/src/generated/queue.ts +0 -753
  147. package/src/generated/service_account.ts +0 -814
  148. package/src/generated/storage.ts +0 -3820
  149. package/src/generated/vault.ts +0 -543
  150. package/src/generated/wait_until.ts +0 -829
  151. package/src/generated/worker.ts +0 -759
  152. package/src/global.ts +0 -287
  153. package/src/grpc-utils.ts +0 -159
  154. package/src/index.ts +0 -160
  155. package/src/types.ts +0 -397
  156. package/src/wait-until.ts +0 -273
  157. package/tsconfig.json +0 -8
  158. package/tsdown.config.ts +0 -17
  159. /package/dist/{generated → worker-runtime/generated}/google/protobuf/duration.d.ts +0 -0
  160. /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
  },
@@ -5564,6 +5727,7 @@ const AzureDaemonHeartbeatDataSchema = object({
5564
5727
  "horizonStatusMessage": string().nullish(),
5565
5728
  "horizonStatusReason": string().nullish(),
5566
5729
  "latestUpdateTimestamp": string(),
5730
+ "observedImage": string().nullish(),
5567
5731
  get "status"() {
5568
5732
  return WorkloadHeartbeatStatusSchema;
5569
5733
  },
@@ -6254,7 +6418,7 @@ object({
6254
6418
  "environment": optional(object({}).catchall(string()).describe("Key-value pairs to set as environment variables for the build.")),
6255
6419
  "id": string().describe("Identifier for the build resource. Must contain only alphanumeric characters, hyphens, and underscores ([A-Za-z0-9-_]).\nMaximum 64 characters."),
6256
6420
  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.");
6421
+ 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
6422
  },
6259
6423
  "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
6424
  }).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 +6512,7 @@ const CapacityGroupSchema = object({
6348
6512
  return union([CapacityGroupScalePolicySchema, _null()]).optional();
6349
6513
  }
6350
6514
  }).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).");
6515
+ _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
6516
  /**
6352
6517
  * Generated by Kubb (https://kubb.dev/).
6353
6518
  * Do not edit manually.
@@ -6381,6 +6546,31 @@ const CommandStateSchema = _enum([
6381
6546
  "FAILED",
6382
6547
  "EXPIRED"
6383
6548
  ]).describe("Command states in the Commands protocol lifecycle");
6549
+ /**
6550
+ * Generated by Kubb (https://kubb.dev/).
6551
+ * Do not edit manually.
6552
+ */
6553
+ /**
6554
+ * @description The kind of command-capable resource a command targets.
6555
+ */
6556
+ const CommandTargetTypeSchema = _enum([
6557
+ "worker",
6558
+ "container",
6559
+ "daemon"
6560
+ ]).describe("The kind of command-capable resource a command targets.");
6561
+ /**
6562
+ * Generated by Kubb (https://kubb.dev/).
6563
+ * Do not edit manually.
6564
+ */
6565
+ /**
6566
+ * @description Identifies the specific resource a command is addressed to.
6567
+ */
6568
+ const CommandTargetSchema = object({
6569
+ "resourceId": string().describe("The resource ID within the deployment's stack (e.g. a Worker/Container/Daemon id)."),
6570
+ get "resourceType"() {
6571
+ return CommandTargetTypeSchema.describe("The kind of command-capable resource a command targets.");
6572
+ }
6573
+ }).describe("Identifies the specific resource a command is addressed to.");
6384
6574
  object({
6385
6575
  "attempt": int().min(0).describe("Current attempt number"),
6386
6576
  "commandId": string().describe("Command identifier"),
@@ -6389,6 +6579,9 @@ object({
6389
6579
  },
6390
6580
  get "state"() {
6391
6581
  return CommandStateSchema.describe("Command states in the Commands protocol lifecycle");
6582
+ },
6583
+ get "target"() {
6584
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
6392
6585
  }
6393
6586
  }).describe("Response to status queries");
6394
6587
  /**
@@ -6636,9 +6829,11 @@ const HorizonContainerHeartbeatDataSchema = object({
6636
6829
  return array(ManagedRuntimeEventSnapshotSchema);
6637
6830
  },
6638
6831
  "image": string().nullish(),
6832
+ "latestUpdateTimestamp": string().nullish(),
6639
6833
  get "memory"() {
6640
6834
  return union([MetricSampleSchema, _null()]).optional();
6641
6835
  },
6836
+ "observedImage": string().nullish(),
6642
6837
  get "replicaUnits"() {
6643
6838
  return array(ManagedRuntimeUnitStatusSchema);
6644
6839
  },
@@ -6996,6 +7191,7 @@ object({
6996
7191
  return ContainerCodeSchema.describe("Specifies the source of the container's executable code.");
6997
7192
  },
6998
7193
  "command": array(string()).describe("Command to override image default").nullish(),
7194
+ "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
7195
  get "cpu"() {
7000
7196
  return ResourceSpecSchema.describe("Resource specification with min/desired values.");
7001
7197
  },
@@ -7009,7 +7205,7 @@ object({
7009
7205
  },
7010
7206
  "id": string().describe("Unique identifier for the container.\nMust be DNS-compatible: lowercase alphanumeric with hyphens."),
7011
7207
  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)");
7208
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.")).describe("Resource links (dependencies)");
7013
7209
  },
7014
7210
  get "memory"() {
7015
7211
  return ResourceSpecSchema.describe("Resource specification with min/desired values.");
@@ -7036,7 +7232,8 @@ object({
7036
7232
  "idempotencyKey": string().describe("Optional idempotency key").nullish(),
7037
7233
  get "params"() {
7038
7234
  return BodySpecSchema.describe("Body specification supporting inline and storage modes");
7039
- }
7235
+ },
7236
+ "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
7237
  }).describe("Request to create a new command");
7041
7238
  /**
7042
7239
  * Generated by Kubb (https://kubb.dev/).
@@ -7155,6 +7352,7 @@ const GcpDaemonHeartbeatDataSchema = object({
7155
7352
  "horizonStatusMessage": string().nullish(),
7156
7353
  "horizonStatusReason": string().nullish(),
7157
7354
  "latestUpdateTimestamp": string(),
7355
+ "observedImage": string().nullish(),
7158
7356
  get "status"() {
7159
7357
  return WorkloadHeartbeatStatusSchema;
7160
7358
  },
@@ -7235,6 +7433,7 @@ const MachinesDaemonHeartbeatDataSchema = object({
7235
7433
  "horizonStatusMessage": string().nullish(),
7236
7434
  "horizonStatusReason": string().nullish(),
7237
7435
  "latestUpdateTimestamp": string(),
7436
+ "observedImage": string().nullish(),
7238
7437
  get "status"() {
7239
7438
  return WorkloadHeartbeatStatusSchema;
7240
7439
  },
@@ -7285,7 +7484,7 @@ object({
7285
7484
  return DaemonCodeSchema;
7286
7485
  },
7287
7486
  "command": array(string()).describe("Command to override the image default.").nullish(),
7288
- "commandsEnabled": optional(boolean().default(false)),
7487
+ "commandsEnabled": optional(boolean().default(false).describe("Whether an app-owned command receiver can lease pending commands for\nthis Daemon and execute registered handlers.")),
7289
7488
  get "cpu"() {
7290
7489
  return ResourceSpecSchema.describe("Resource specification with min/desired values.").optional();
7291
7490
  },
@@ -7295,7 +7494,7 @@ object({
7295
7494
  },
7296
7495
  "id": string(),
7297
7496
  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."));
7497
+ return array(ResourceRefSchema.describe("Reference to a resource by its stable id and resource type."));
7299
7498
  },
7300
7499
  get "memory"() {
7301
7500
  return ResourceSpecSchema.describe("Resource specification with min/desired values.").optional();
@@ -7390,6 +7589,17 @@ const ResponseHandlingSchema = object({
7390
7589
  * Do not edit manually.
7391
7590
  */
7392
7591
  /**
7592
+ * @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.
7593
+ */
7594
+ const TraceContextSchema = object({
7595
+ "traceparent": string().describe("W3C `traceparent` header value."),
7596
+ "tracestate": string().describe("Optional W3C `tracestate` header value.").nullish()
7597
+ }).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.");
7598
+ /**
7599
+ * Generated by Kubb (https://kubb.dev/).
7600
+ * Do not edit manually.
7601
+ */
7602
+ /**
7393
7603
  * @description Commands envelope sent to deployments
7394
7604
  */
7395
7605
  const EnvelopeSchema = object({
@@ -7404,6 +7614,12 @@ const EnvelopeSchema = object({
7404
7614
  "protocol": string().describe("Protocol version identifier"),
7405
7615
  get "responseHandling"() {
7406
7616
  return ResponseHandlingSchema.describe("Response handling configuration for deployments");
7617
+ },
7618
+ get "target"() {
7619
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
7620
+ },
7621
+ get "traceContext"() {
7622
+ return union([TraceContextSchema, _null()]).optional();
7407
7623
  }
7408
7624
  }).describe("Commands envelope sent to deployments");
7409
7625
  /**
@@ -7855,7 +8071,7 @@ const ImportedResourceSchema = object({
7855
8071
  * @description Certificate publication or reference mode for Kubernetes public endpoints.
7856
8072
  */
7857
8073
  const KubernetesCertificateModeSchema = union([
7858
- lazy(() => KubernetesTlsSecretRefSchema).and(object({ "mode": _enum(["tlsSecretRef"]) })).describe("Namespace-scoped Kubernetes TLS Secret reference."),
8074
+ lazy(() => KubernetesTlsSecretRefSchema).and(object({ "mode": _enum(["tlsSecretRef"]) })),
7859
8075
  object({
7860
8076
  "mode": _enum(["managedAcmImport"]),
7861
8077
  "region": string().describe("ACM region. Defaults to the deployment region when omitted.").nullish(),
@@ -8072,7 +8288,7 @@ const KubernetesIngressRouteProfileSchema = object({
8072
8288
  /**
8073
8289
  * @description Kubernetes route API selected for public endpoints.
8074
8290
  */
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.");
8291
+ 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
8292
  /**
8077
8293
  * Generated by Kubb (https://kubb.dev/).
8078
8294
  * Do not edit manually.
@@ -8212,7 +8428,10 @@ const LeaseInfoSchema = object({
8212
8428
  object({
8213
8429
  "deploymentId": string().describe("Deployment identifier"),
8214
8430
  "leaseSeconds": optional(int().min(0).describe("Lease duration in seconds")),
8215
- "maxLeases": optional(int().min(0).describe("Maximum number of leases to acquire"))
8431
+ "maxLeases": optional(int().min(0).describe("Maximum number of leases to acquire")),
8432
+ get "target"() {
8433
+ return CommandTargetSchema.describe("Identifies the specific resource a command is addressed to.");
8434
+ }
8216
8435
  }).describe("Request for acquiring leases");
8217
8436
  object({ get "leases"() {
8218
8437
  return array(LeaseInfoSchema.describe("Lease information")).describe("Acquired leases (empty array if none available)");
@@ -8327,9 +8546,9 @@ const LocalWorkerHeartbeatDataSchema = object({
8327
8546
  * @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
8547
  */
8329
8548
  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"),
8549
+ lazy(() => AwsManagementConfigSchema).and(object({ "platform": _enum(["aws"]) })),
8550
+ lazy(() => GcpManagementConfigSchema).and(object({ "platform": _enum(["gcp"]) })),
8551
+ lazy(() => AzureManagementConfigSchema).and(object({ "platform": _enum(["azure"]) })),
8333
8552
  object({ "platform": _enum(["kubernetes"]) })
8334
8553
  ]).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
8554
  /**
@@ -8550,10 +8769,10 @@ const PostgresBackendSchema = object({ "type": _enum(["auroraServerlessV2"]) }).
8550
8769
  * Do not edit manually.
8551
8770
  */
8552
8771
  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.")
8772
+ lazy(() => AuroraPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["aurora"]) })),
8773
+ lazy(() => GcpCloudSqlPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["cloudSql"]) })),
8774
+ lazy(() => AzureFlexibleServerPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["flexibleServer"]) })),
8775
+ lazy(() => LocalPostgresHeartbeatDataSchema).and(object({ "backend": _enum(["local"]) }))
8557
8776
  ]);
8558
8777
  object({
8559
8778
  "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 +8810,7 @@ object({
8591
8810
  "receiptHandle": string().describe("Platform-specific receipt handle for acknowledgment"),
8592
8811
  "source": string().describe("Source queue/topic name (derived from ARN/source/topic)"),
8593
8812
  "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.");
8813
+ }).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
8814
  object({
8596
8815
  "identifier": string().describe("Platform-specific identifier or URL (e.g., SQS URL, Pub/Sub topic/subscription).").nullish(),
8597
8816
  "queueName": string().describe("The name of the queue (platform-specific physical name).")
@@ -8634,7 +8853,7 @@ const ResourceEntrySchema = object({
8634
8853
  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
8854
  },
8636
8855
  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");
8856
+ 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
8857
  },
8639
8858
  get "lifecycle"() {
8640
8859
  return ResourceLifecycleSchema.describe("Describes the lifecycle of a resource within a stack, determining how it's managed and deployed.");
@@ -9132,7 +9351,7 @@ object({
9132
9351
  "publicRead": optional(boolean().describe("Allows public read access to objects without authentication.\nDefault: `false`")),
9133
9352
  "versioning": optional(boolean().describe("Enables object versioning.\nDefault: `false`"))
9134
9353
  }).describe("Represents an object storage bucket.");
9135
- lazy(() => CommandResponseSchema).describe("Command response from deployment").describe("Request to submit a command response (from deployment)");
9354
+ lazy(() => CommandResponseSchema).describe("Request to submit a command response (from deployment)");
9136
9355
  object({ "size": int().min(0).describe("Size of uploaded data") }).describe("Request to mark upload as complete");
9137
9356
  object({
9138
9357
  "commandId": string().describe("Command identifier"),
@@ -9187,14 +9406,14 @@ const WorkerPublicEndpointSchema = object({
9187
9406
  const WorkerTriggerSchema = union([
9188
9407
  object({
9189
9408
  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.");
9409
+ return ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.");
9191
9410
  },
9192
9411
  "type": _enum(["queue"])
9193
9412
  }),
9194
9413
  object({
9195
9414
  "events": array(string()).describe("Events to trigger on (e.g., [\"created\", \"deleted\"])"),
9196
9415
  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.");
9416
+ return ResourceRefSchema.describe("Reference to a resource by its stable id and resource type.");
9198
9417
  },
9199
9418
  "type": _enum(["storage"])
9200
9419
  }),
@@ -9207,12 +9426,12 @@ object({
9207
9426
  get "code"() {
9208
9427
  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
9428
  },
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.")),
9429
+ "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
9430
  "concurrencyLimit": int().min(0).describe("Maximum number of concurrent executions allowed for the worker.\nNone means platform default applies.").nullish(),
9212
9431
  "environment": optional(object({}).catchall(string()).describe("Key-value pairs to set as environment variables for the worker.")),
9213
9432
  "id": string().describe("Identifier for the worker. Must contain only alphanumeric characters, hyphens, and underscores ([A-Za-z0-9-_]).\nMaximum 64 characters."),
9214
9433
  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.");
9434
+ 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
9435
  },
9217
9436
  "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
9437
  "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 +9441,11 @@ object({
9222
9441
  get "readinessProbe"() {
9223
9442
  return union([ReadinessProbeSchema, _null()]).optional();
9224
9443
  },
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")),
9444
+ "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
9445
  get "triggers"() {
9227
9446
  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
9447
  }
9229
9448
  }).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
9449
  /**
9354
9450
  * This module provides a structured error handling system similar to Rust's error types,
9355
9451
  * with TypeScript type safety, error chaining, and context preservation.
@@ -9908,4 +10004,4 @@ defineError({
9908
10004
  httpStatusCode: 400
9909
10005
  });
9910
10006
  //#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 };
10007
+ 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 };