@oxygen-agent/cli 1.162.10 → 1.177.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 (38) hide show
  1. package/README.md +1 -1
  2. package/dist/http-client.js +2 -78
  3. package/dist/index.js +1312 -527
  4. package/dist/run-wait.d.ts +23 -0
  5. package/dist/run-wait.js +57 -0
  6. package/node_modules/@oxygen/recipe-sdk/dist/index.d.ts +0 -5
  7. package/node_modules/@oxygen/shared/dist/cell-format.d.ts +2 -14
  8. package/node_modules/@oxygen/shared/dist/cell-format.js +3 -10
  9. package/node_modules/@oxygen/shared/dist/cli-envelope.d.ts +27 -0
  10. package/node_modules/@oxygen/shared/dist/cli-envelope.js +102 -0
  11. package/node_modules/@oxygen/shared/dist/cli-result.d.ts +39 -0
  12. package/node_modules/@oxygen/shared/dist/cli-result.js +52 -0
  13. package/node_modules/@oxygen/shared/dist/credit-guidance.d.ts +0 -1
  14. package/node_modules/@oxygen/shared/dist/credit-guidance.js +1 -1
  15. package/node_modules/@oxygen/shared/dist/file-import.js +1 -1
  16. package/node_modules/@oxygen/shared/dist/index.d.ts +3 -39
  17. package/node_modules/@oxygen/shared/dist/index.js +3 -44
  18. package/node_modules/@oxygen/shared/dist/log.d.ts +0 -1
  19. package/node_modules/@oxygen/shared/dist/log.js +8 -3
  20. package/node_modules/@oxygen/shared/dist/object-storage.d.ts +0 -3
  21. package/node_modules/@oxygen/shared/dist/object-storage.js +1 -24
  22. package/node_modules/@oxygen/shared/dist/redaction.js +45 -4
  23. package/node_modules/@oxygen/shared/dist/search-vocab.d.ts +18 -0
  24. package/node_modules/@oxygen/shared/dist/search-vocab.js +151 -0
  25. package/node_modules/@oxygen/shared/dist/select-options.d.ts +18 -0
  26. package/node_modules/@oxygen/shared/dist/select-options.js +121 -0
  27. package/node_modules/@oxygen/shared/dist/sequences.js +1 -1
  28. package/node_modules/@oxygen/shared/dist/sql-error.d.ts +0 -6
  29. package/node_modules/@oxygen/shared/dist/sql-error.js +67 -58
  30. package/node_modules/@oxygen/shared/dist/telemetry.d.ts +0 -1
  31. package/node_modules/@oxygen/shared/dist/telemetry.js +23 -18
  32. package/node_modules/@oxygen/shared/dist/version.d.ts +1 -1
  33. package/node_modules/@oxygen/shared/dist/version.js +1 -1
  34. package/node_modules/@oxygen/shared/dist/worker-failures-queue.d.ts +22 -0
  35. package/node_modules/@oxygen/shared/dist/worker-failures-queue.js +56 -0
  36. package/node_modules/@oxygen/workflows/dist/index.d.ts +12 -11
  37. package/node_modules/@oxygen/workflows/dist/index.js +58 -0
  38. package/package.json +1 -1
package/README.md CHANGED
@@ -34,4 +34,4 @@ oxygen update
34
34
 
35
35
  For product documentation, visit https://oxygen-agent.com/docs. For support, visit https://oxygen-agent.com.
36
36
 
37
- Version: 1.162.10
37
+ Version: 1.177.0
@@ -1,4 +1,4 @@
1
- import { OXYGEN_VERSION, OxygenError, isVersionGreater } from "@oxygen/shared";
1
+ import { OXYGEN_VERSION, OxygenError, isCliResult, isVersionGreater, readEnvelopeCompatibility, vercelProtectionBypassHeaders, withRetryAfterDetails, } from "@oxygen/shared";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { defaultApiUrl, loadCredentials } from "./credentials.js";
4
4
  import { resolveCliUpdateGuidance } from "./runtime.js";
@@ -28,7 +28,7 @@ path, options = {}) {
28
28
  // even against clients that predate the client-side envelope gate.
29
29
  "X-Oxygen-Client-Version": OXYGEN_VERSION,
30
30
  };
31
- addVercelProtectionBypassHeader(apiUrl, headers);
31
+ Object.assign(headers, vercelProtectionBypassHeaders(apiUrl));
32
32
  if (credentials?.token) {
33
33
  headers.Authorization = `Bearer ${credentials.token}`;
34
34
  }
@@ -188,56 +188,6 @@ function assertCliMeetsMinimumApiVersion(compatibility, options, apiUrl) {
188
188
  exitCode: 1,
189
189
  });
190
190
  }
191
- function readEnvelopeCompatibility(envelope) {
192
- const meta = envelope.meta;
193
- if (!meta || typeof meta !== "object" || Array.isArray(meta))
194
- return {};
195
- const record = meta;
196
- const compatibility = {};
197
- if (typeof record.version === "string")
198
- compatibility.version = record.version;
199
- if (typeof record.minimum_cli_version === "string") {
200
- compatibility.minimumCliVersion = record.minimum_cli_version;
201
- }
202
- return compatibility;
203
- }
204
- // Surface the server's 429 backoff as a first-class `retry_after_seconds` detail
205
- // so loop-driving callers can wait the right amount of time instead of dead-
206
- // reckoning. Prefers a value the API already put in details; otherwise derives
207
- // it from the RFC 6585 Retry-After header (or reset_at). Non-429 responses and
208
- // unparseable values pass through untouched.
209
- function withRetryAfterDetails(details, response) {
210
- if (response.status !== 429)
211
- return details;
212
- const record = details && typeof details === "object" && !Array.isArray(details)
213
- ? details
214
- : null;
215
- if (record && typeof record.retry_after_seconds === "number")
216
- return details;
217
- const retryAfterSeconds = retryAfterSecondsFromResponse(response, record);
218
- if (retryAfterSeconds === null)
219
- return details;
220
- if (record)
221
- return { ...record, retry_after_seconds: retryAfterSeconds };
222
- if (details === undefined)
223
- return { retry_after_seconds: retryAfterSeconds };
224
- return { details, retry_after_seconds: retryAfterSeconds };
225
- }
226
- function retryAfterSecondsFromResponse(response, details) {
227
- const header = response.headers.get("retry-after");
228
- if (header) {
229
- const seconds = Number(header);
230
- if (Number.isFinite(seconds) && seconds >= 0)
231
- return Math.ceil(seconds);
232
- }
233
- const resetAt = details?.reset_at;
234
- if (typeof resetAt === "string") {
235
- const resetMs = Date.parse(resetAt);
236
- if (!Number.isNaN(resetMs))
237
- return Math.max(0, Math.ceil((resetMs - Date.now()) / 1000));
238
- }
239
- return null;
240
- }
241
191
  function withTraceDetails(details, traceId, compatibility, apiUrl) {
242
192
  const serverVersion = compatibility.version;
243
193
  const fields = {
@@ -266,21 +216,6 @@ function withTraceDetails(details, traceId, compatibility, apiUrl) {
266
216
  ...fields,
267
217
  };
268
218
  }
269
- function addVercelProtectionBypassHeader(apiUrl, headers) {
270
- const secret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
271
- if (!secret)
272
- return;
273
- let hostname;
274
- try {
275
- hostname = new URL(apiUrl).hostname;
276
- }
277
- catch {
278
- return;
279
- }
280
- if (hostname === "vercel.app" || hostname.endsWith(".vercel.app")) {
281
- headers["x-vercel-protection-bypass"] = secret;
282
- }
283
- }
284
219
  function resolveRequestTimeoutMs(value) {
285
220
  if (value === undefined)
286
221
  return DEFAULT_REQUEST_TIMEOUT_MS;
@@ -333,14 +268,3 @@ async function readEnvelope(response) {
333
268
  exitCode: 1,
334
269
  });
335
270
  }
336
- function isCliResult(value) {
337
- if (!value || typeof value !== "object" || Array.isArray(value))
338
- return false;
339
- const ok = value.ok;
340
- if (ok === true)
341
- return "data" in value;
342
- if (ok !== false)
343
- return false;
344
- const error = value.error;
345
- return Boolean(error) && typeof error === "object" && !Array.isArray(error);
346
- }