orkestrator 2.34.5-beta → 2.35.0-beta

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.
package/dist/client.js CHANGED
@@ -7885,6 +7885,7 @@ var COORDINATOR_CONTROL_TOOL_NAMES = Object.freeze([
7885
7885
  "stop_node_environment",
7886
7886
  "stop_worker_turn",
7887
7887
  "switch_provider_account",
7888
+ "set_account_auto_switch",
7888
7889
  "transfer_files",
7889
7890
  "update_schedule",
7890
7891
  "update_ticket"
@@ -8333,7 +8334,7 @@ import path5 from "path";
8333
8334
  // ../../apps/backend/package.json
8334
8335
  var package_default = {
8335
8336
  name: "@orkestrator/backend",
8336
- version: "2.34.5-beta",
8337
+ version: "2.35.0-beta",
8337
8338
  private: true,
8338
8339
  type: "module",
8339
8340
  exports: {
@@ -9123,6 +9124,15 @@ async function waitForOperation(context, session, initial, timeoutMs, options2 =
9123
9124
  }
9124
9125
  async function waitForEnvironment(context, session, environmentId, condition, receipt, timeoutMs) {
9125
9126
  let latestReceipt = receipt;
9127
+ const deadline = Date.now() + timeoutMs;
9128
+ const remaining = () => {
9129
+ if (context.signal?.aborted)
9130
+ throw new ObservationStopped("signal", signalName(context.signal));
9131
+ const budget = deadline - Date.now();
9132
+ if (budget <= 0)
9133
+ throw new ObservationStopped("deadline");
9134
+ return budget;
9135
+ };
9126
9136
  const conditionMet = (environment) => {
9127
9137
  if (condition === "deleted")
9128
9138
  return environment === null;
@@ -9136,8 +9146,10 @@ async function waitForEnvironment(context, session, environmentId, condition, re
9136
9146
  };
9137
9147
  try {
9138
9148
  return await observe(async () => {
9149
+ remaining();
9139
9150
  if (latestReceipt && !isTerminalReceipt(latestReceipt)) {
9140
- latestReceipt = await readOperation(session, latestReceipt.operationId);
9151
+ latestReceipt = await readOperation(session, latestReceipt.operationId, remaining());
9152
+ remaining();
9141
9153
  }
9142
9154
  if (latestReceipt && isTerminalReceipt(latestReceipt)) {
9143
9155
  const failure = receiptFailure(latestReceipt);
@@ -9146,15 +9158,15 @@ async function waitForEnvironment(context, session, environmentId, condition, re
9146
9158
  }
9147
9159
  let environment;
9148
9160
  try {
9149
- environment = await session.read("environment.get", {
9150
- environmentId
9151
- });
9161
+ const snapshot = await session.readWithReceipt("environment.get", { environmentId }, remaining());
9162
+ environment = snapshot.result;
9152
9163
  } catch (error) {
9153
9164
  if (error instanceof CliError && error.code === "not-found")
9154
9165
  environment = null;
9155
9166
  else
9156
9167
  throw error;
9157
9168
  }
9169
+ remaining();
9158
9170
  if (condition !== "deleted" && !environment) {
9159
9171
  throw new CliError("not-found", "The environment no longer exists", latestReceipt ? { receipt: latestReceipt } : {});
9160
9172
  }
@@ -9173,8 +9185,9 @@ async function waitForEnvironment(context, session, environmentId, condition, re
9173
9185
  return { done: false };
9174
9186
  }, { timeoutMs, signal: context.signal });
9175
9187
  } catch (error) {
9176
- if (error instanceof ObservationStopped) {
9177
- throw stoppedError(error, latestReceipt?.action ?? "environment.get", latestReceipt, `the environment (${condition})`);
9188
+ const stopped = context.signal?.aborted ? new ObservationStopped("signal", signalName(context.signal)) : Date.now() >= deadline && error instanceof CliError && error.code === "connection-failed" ? new ObservationStopped("deadline") : error;
9189
+ if (stopped instanceof ObservationStopped) {
9190
+ throw stoppedError(stopped, latestReceipt?.action ?? "environment.get", latestReceipt, `the environment (${condition})`);
9178
9191
  }
9179
9192
  throw error;
9180
9193
  }
@@ -10269,6 +10282,35 @@ var REVIEWER_STATUSES = new Set([
10269
10282
  "cancelled"
10270
10283
  ]);
10271
10284
 
10285
+ // ../protocol/src/build-pipeline-key-information.ts
10286
+ var KEY_INFORMATION_LIMITS = Object.freeze({
10287
+ proseLength: 4000,
10288
+ itemLength: 600,
10289
+ listItems: 30,
10290
+ decisions: 12,
10291
+ decisionLength: 400,
10292
+ options: 6,
10293
+ optionLength: 300,
10294
+ prosCons: 6,
10295
+ rationaleLength: 1000,
10296
+ tests: 40,
10297
+ testNameLength: 400,
10298
+ issues: 60,
10299
+ issueLength: 400,
10300
+ severityLength: 40,
10301
+ resolutionLength: 1000,
10302
+ verifications: 20,
10303
+ summaryLength: 2000,
10304
+ checks: 30,
10305
+ checkLength: 400,
10306
+ updates: 30,
10307
+ maxRound: 1000
10308
+ });
10309
+ var KEY_INFORMATION_TOOL_NAMES = Object.freeze([
10310
+ "get_key_information",
10311
+ "update_key_information"
10312
+ ]);
10313
+
10272
10314
  // ../protocol/src/ticket-sections.ts
10273
10315
  var ACCEPTANCE_CRITERION_STATUSES = ["passed", "failed", "not-checked"];
10274
10316
  var TICKET_SECTION_DEFINITIONS = [
@@ -16665,17 +16707,24 @@ function waitOption(conditions) {
16665
16707
  description: `Observe until the environment is ${conditions.join(" or ")} (bounded by --timeout).`
16666
16708
  };
16667
16709
  }
16710
+ function remainingBudget(budget, recoveryDeadline) {
16711
+ return recoveryDeadline === undefined ? budget : Math.max(0, recoveryDeadline - Date.now());
16712
+ }
16668
16713
  async function lifecycle(context, parsed, action, conditions, extraInput = {}) {
16669
16714
  const environmentId = String(parsed.positionals.environment);
16670
16715
  const wait = parsed.options.wait === undefined ? undefined : oneOf(parsed.options.wait, conditions, "--wait");
16671
16716
  if (parsed.options.timeout !== undefined && wait === undefined) {
16672
16717
  throw new CliError("invalid-input", "--timeout needs --wait");
16673
16718
  }
16674
- const { session, result, receipt, warnings } = await submit(context, action, { environmentId, ...extraInput }, parsed.options);
16719
+ const input = { environmentId, ...extraInput };
16720
+ const budget = parsed.options.timeout ?? DEFAULT_WAIT_MS;
16721
+ const submitted = wait ? await submitForWait(context, action, input, parsed.options, budget) : await submit(context, action, input, parsed.options);
16722
+ const { session, receipt, warnings } = submitted;
16723
+ const result = submitted.result ?? receipt?.result;
16675
16724
  let finalReceipt = receipt;
16676
16725
  let environment;
16677
16726
  if (wait) {
16678
- const waited = await waitForEnvironment(context, session, environmentId, wait, receipt, parsed.options.timeout ?? DEFAULT_WAIT_MS);
16727
+ const waited = await waitForEnvironment(context, session, environmentId, wait, receipt, remainingBudget(budget, "deadline" in submitted ? submitted.deadline : undefined));
16679
16728
  finalReceipt = waited.receipt ?? finalReceipt;
16680
16729
  environment = waited.environment;
16681
16730
  }
@@ -17101,14 +17150,18 @@ var environmentCommands = [
17101
17150
  if (options2["exit-code"] === true && options2.wait !== true) {
17102
17151
  throw new CliError("invalid-input", "--exit-code needs --wait");
17103
17152
  }
17104
- const { session, receipt, result, warnings } = await submit(context, "environment.exec", {
17153
+ const input = {
17105
17154
  environmentId: parsed.positionals.environment,
17106
17155
  argv,
17107
17156
  ...options2.cwd !== undefined ? { cwd: options2.cwd } : {},
17108
17157
  ...Object.keys(env).length > 0 ? { env } : {},
17109
17158
  ...stdinBase64 !== undefined ? { stdinBase64 } : {},
17110
17159
  ...options2["exec-timeout"] !== undefined ? { timeoutMs: options2["exec-timeout"] } : {}
17111
- }, options2);
17160
+ };
17161
+ const budget = options2.timeout ?? DEFAULT_WAIT_MS;
17162
+ const submitted = options2.wait === true ? await submitForWait(context, "environment.exec", input, options2, budget) : await submit(context, "environment.exec", input, options2);
17163
+ const { session, receipt, warnings } = submitted;
17164
+ const result = submitted.result ?? receipt?.result;
17112
17165
  if (!receipt)
17113
17166
  throw new CliError("response-invalid", "environment.exec returned no receipt");
17114
17167
  if (options2.wait !== true) {
@@ -17122,7 +17175,7 @@ var environmentCommands = [
17122
17175
  human: receiptLines(receipt)
17123
17176
  };
17124
17177
  }
17125
- const final = await waitForOperation(context, session, receipt, options2.timeout ?? DEFAULT_WAIT_MS);
17178
+ const final = await waitForOperation(context, session, receipt, remainingBudget(budget, "deadline" in submitted ? submitted.deadline : undefined));
17126
17179
  const human = [];
17127
17180
  if (context.global.output === "human") {
17128
17181
  for (const stream of ["stdout", "stderr"]) {