@oxygen-agent/cli 1.1010.650 → 1.1010.905

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/auto-update.d.ts +129 -0
  3. package/dist/auto-update.js +392 -0
  4. package/dist/command-manifest.js +15 -1
  5. package/dist/credentials.d.ts +2 -0
  6. package/dist/credentials.js +6 -3
  7. package/dist/functions-commands.js +1 -1
  8. package/dist/http-client.js +28 -4
  9. package/dist/inbox-needs-reply-notice.d.ts +12 -0
  10. package/dist/inbox-needs-reply-notice.js +51 -0
  11. package/dist/index.js +756 -177
  12. package/dist/run-wait.d.ts +3 -1
  13. package/dist/run-wait.js +19 -5
  14. package/dist/skills.js +48 -22
  15. package/dist/streamed-file-import.d.ts +58 -0
  16. package/dist/streamed-file-import.js +115 -0
  17. package/dist/update.d.ts +29 -0
  18. package/dist/update.js +62 -16
  19. package/dist/workflow-plan-limit-notices.d.ts +8 -0
  20. package/dist/workflow-plan-limit-notices.js +28 -0
  21. package/node_modules/@oxygen/cli-ugc/dist/commands.js +3 -3
  22. package/node_modules/@oxygen/shared/dist/billing-anchors.d.ts +50 -2
  23. package/node_modules/@oxygen/shared/dist/billing-anchors.js +94 -2
  24. package/node_modules/@oxygen/shared/dist/billing.d.ts +247 -37
  25. package/node_modules/@oxygen/shared/dist/billing.js +418 -45
  26. package/node_modules/@oxygen/shared/dist/capability-discovery.js +66 -6
  27. package/node_modules/@oxygen/shared/dist/copilot-skills.generated.d.ts +6 -6
  28. package/node_modules/@oxygen/shared/dist/copilot-skills.generated.js +6 -6
  29. package/node_modules/@oxygen/shared/dist/cost-estimate-view.d.ts +50 -0
  30. package/node_modules/@oxygen/shared/dist/cost-estimate-view.js +90 -0
  31. package/node_modules/@oxygen/shared/dist/cost-estimate.d.ts +167 -0
  32. package/node_modules/@oxygen/shared/dist/cost-estimate.js +361 -0
  33. package/node_modules/@oxygen/shared/dist/credit-gate.d.ts +26 -0
  34. package/node_modules/@oxygen/shared/dist/credit-gate.js +65 -0
  35. package/node_modules/@oxygen/shared/dist/email-deliverability-policy.d.ts +51 -0
  36. package/node_modules/@oxygen/shared/dist/email-deliverability-policy.js +101 -0
  37. package/node_modules/@oxygen/shared/dist/email-hard-bounce.d.ts +27 -0
  38. package/node_modules/@oxygen/shared/dist/email-hard-bounce.js +27 -0
  39. package/node_modules/@oxygen/shared/dist/error-redaction.d.ts +1 -1
  40. package/node_modules/@oxygen/shared/dist/error-redaction.js +1 -1
  41. package/node_modules/@oxygen/shared/dist/feature-gates.d.ts +10 -1
  42. package/node_modules/@oxygen/shared/dist/feature-gates.js +12 -1
  43. package/node_modules/@oxygen/shared/dist/file-import.d.ts +13 -1
  44. package/node_modules/@oxygen/shared/dist/file-import.js +33 -6
  45. package/node_modules/@oxygen/shared/dist/hosted-ai.d.ts +73 -3
  46. package/node_modules/@oxygen/shared/dist/hosted-ai.js +246 -24
  47. package/node_modules/@oxygen/shared/dist/import-limits.d.ts +25 -1
  48. package/node_modules/@oxygen/shared/dist/import-limits.js +35 -2
  49. package/node_modules/@oxygen/shared/dist/index.d.ts +4 -23
  50. package/node_modules/@oxygen/shared/dist/index.js +4 -43
  51. package/node_modules/@oxygen/shared/dist/linkedin-sequences.d.ts +114 -0
  52. package/node_modules/@oxygen/shared/dist/linkedin-sequences.js +150 -0
  53. package/node_modules/@oxygen/shared/dist/object-storage.d.ts +9 -0
  54. package/node_modules/@oxygen/shared/dist/object-storage.js +17 -0
  55. package/node_modules/@oxygen/shared/dist/operational-telemetry.d.ts +41 -0
  56. package/node_modules/@oxygen/shared/dist/operational-telemetry.js +55 -0
  57. package/node_modules/@oxygen/shared/dist/otlp-log-sink.js +19 -2
  58. package/node_modules/@oxygen/shared/dist/plan-band.d.ts +234 -0
  59. package/node_modules/@oxygen/shared/dist/plan-band.js +312 -0
  60. package/node_modules/@oxygen/shared/dist/plan-capabilities.d.ts +77 -7
  61. package/node_modules/@oxygen/shared/dist/plan-capabilities.js +87 -7
  62. package/node_modules/@oxygen/shared/dist/plan-limits-view.d.ts +219 -0
  63. package/node_modules/@oxygen/shared/dist/plan-limits-view.js +330 -0
  64. package/node_modules/@oxygen/shared/dist/plan-limits.d.ts +335 -126
  65. package/node_modules/@oxygen/shared/dist/plan-limits.js +277 -86
  66. package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +158 -49
  67. package/node_modules/@oxygen/shared/dist/pricing-sheet.js +139 -41
  68. package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.d.ts +42 -23
  69. package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.js +56 -37
  70. package/node_modules/@oxygen/shared/dist/process-resource.d.ts +4 -0
  71. package/node_modules/@oxygen/shared/dist/process-resource.js +25 -0
  72. package/node_modules/@oxygen/shared/dist/provider-http-error.d.ts +10 -0
  73. package/node_modules/@oxygen/shared/dist/provider-http-error.js +27 -0
  74. package/node_modules/@oxygen/shared/dist/repricing.d.ts +257 -0
  75. package/node_modules/@oxygen/shared/dist/repricing.js +721 -0
  76. package/node_modules/@oxygen/shared/dist/semver.d.ts +21 -0
  77. package/node_modules/@oxygen/shared/dist/semver.js +41 -0
  78. package/node_modules/@oxygen/shared/dist/sending-limits.d.ts +30 -0
  79. package/node_modules/@oxygen/shared/dist/sending-limits.js +43 -0
  80. package/node_modules/@oxygen/shared/dist/sending-seats.d.ts +18 -15
  81. package/node_modules/@oxygen/shared/dist/sending-seats.js +22 -17
  82. package/node_modules/@oxygen/shared/dist/sequence-failures.js +4 -1
  83. package/node_modules/@oxygen/shared/dist/spend-safety.d.ts +57 -8
  84. package/node_modules/@oxygen/shared/dist/spend-safety.js +64 -11
  85. package/node_modules/@oxygen/shared/dist/stripe-price-catalog.d.ts +33 -1
  86. package/node_modules/@oxygen/shared/dist/stripe-price-catalog.js +71 -1
  87. package/node_modules/@oxygen/shared/dist/table-capacity.d.ts +68 -10
  88. package/node_modules/@oxygen/shared/dist/table-capacity.js +85 -4
  89. package/node_modules/@oxygen/shared/dist/telemetry-export-observer.d.ts +6 -0
  90. package/node_modules/@oxygen/shared/dist/telemetry-export-observer.js +13 -5
  91. package/node_modules/@oxygen/shared/dist/telemetry-resource.d.ts +40 -0
  92. package/node_modules/@oxygen/shared/dist/telemetry-resource.js +35 -0
  93. package/node_modules/@oxygen/shared/dist/telemetry.d.ts +9 -0
  94. package/node_modules/@oxygen/shared/dist/telemetry.js +41 -2
  95. package/node_modules/@oxygen/shared/dist/trace-context.d.ts +29 -0
  96. package/node_modules/@oxygen/shared/dist/trace-context.js +88 -0
  97. package/node_modules/@oxygen/shared/dist/ugc.d.ts +15 -0
  98. package/node_modules/@oxygen/shared/dist/ugc.js +29 -0
  99. package/node_modules/@oxygen/shared/dist/version.d.ts +1 -3
  100. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  101. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  102. package/node_modules/@oxygen/shared/dist/version.js +14 -27
  103. package/node_modules/@oxygen/shared/dist/workspace-file-storage.d.ts +5 -0
  104. package/node_modules/@oxygen/shared/dist/workspace-file-storage.js +5 -0
  105. package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.d.ts +3 -3
  106. package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +15 -1
  107. package/node_modules/@oxygen/workflows/dist/graph/types.js +15 -1
  108. package/node_modules/@oxygen/workflows/dist/index.d.ts +45 -0
  109. package/node_modules/@oxygen/workflows/dist/index.js +152 -2
  110. package/node_modules/@oxygen/workflows/dist/usage-estimate.d.ts +10 -1
  111. package/node_modules/@oxygen/workflows/dist/usage-estimate.js +33 -29
  112. package/package.json +1 -1
  113. package/node_modules/@oxygen/shared/dist/email-warmup-readiness.d.ts +0 -64
  114. package/node_modules/@oxygen/shared/dist/email-warmup-readiness.js +0 -90
@@ -1,5 +1,6 @@
1
1
  import { OXYGEN_VERSION, OxygenError, isCliResult, isVersionGreater, parseSemver, readEnvelopeCompatibility, vercelProtectionBypassHeaders, withRetryAfterDetails, } from "@oxygen/shared";
2
2
  import { randomUUID } from "node:crypto";
3
+ import { recordMutatingRequestAnswered, recoverFromCliFloorRejection } from "./auto-update.js";
3
4
  import { defaultApiUrl, loadCredentialsWithEndpoint } from "./credentials.js";
4
5
  import { assertResolvedApiUrl, cliEndpointDetails, describeCliEndpoint, isProdApiUrl, resolveCliUpdateGuidance, } from "./runtime.js";
5
6
  const DEFAULT_REQUEST_TIMEOUT_MS = 120_000;
@@ -31,7 +32,14 @@ path, options = {}) {
31
32
  ...init, signal: init?.signal ? AbortSignal.any([options.signal, init.signal]) : options.signal,
32
33
  }) : baseFetch;
33
34
  if (path !== "/api/health" && shouldCheckCliCompatibility(options)) {
34
- await ensureFreshCliForApiUrl(apiUrl, { fetch: fetchImpl, endpoint });
35
+ try {
36
+ await ensureFreshCliForApiUrl(apiUrl, { fetch: fetchImpl, endpoint });
37
+ }
38
+ catch (error) {
39
+ // The preflight dialed only /api/health: nothing has run yet, so an
40
+ // automatic update may re-run this command in the new binary.
41
+ throw error instanceof OxygenError ? await recoverFromCliFloorRejection(error, endpoint) : error;
42
+ }
35
43
  }
36
44
  options.signal?.throwIfAborted();
37
45
  const traceId = options.traceId ?? randomUUID();
@@ -117,17 +125,33 @@ path, options = {}) {
117
125
  }
118
126
  const envelope = await readEnvelope(response);
119
127
  const compatibility = readEnvelopeCompatibility(envelope);
120
- assertCliMeetsMinimumApiVersion(compatibility, options, endpoint);
128
+ const failed = !response.ok || !envelope.ok;
129
+ try {
130
+ assertCliMeetsMinimumApiVersion(compatibility, options, endpoint);
131
+ }
132
+ catch (error) {
133
+ // Only a refused request is safe to re-run: a successful one already did its work.
134
+ throw failed && error instanceof OxygenError ? await recoverFromCliFloorRejection(error, endpoint) : error;
135
+ }
121
136
  warnIfCliIsOlderThanApi(compatibility.version, endpoint);
122
- if (!response.ok || !envelope.ok) {
137
+ if (failed) {
123
138
  const failure = envelope;
124
139
  const responseTraceId = response.headers.get("x-oxygen-trace-id") ?? traceId;
125
140
  const details = withRetryAfterDetails(failure.error.details, response);
126
- throw new OxygenError(failure.error.code, describeFailureAgainstEndpoint(failure.error.code, failure.error.message, endpoint), {
141
+ const error = new OxygenError(failure.error.code, describeFailureAgainstEndpoint(failure.error.code, failure.error.message, endpoint), {
127
142
  details: withTraceDetails(details, responseTraceId, compatibility, endpoint),
128
143
  exitCode: 1,
129
144
  });
145
+ // The floor gate refuses before the route does any work (assertCliClientVersionFloor).
146
+ if (error.code === "cli_update_required")
147
+ throw await recoverFromCliFloorRejection(error, endpoint);
148
+ // Any other answer to a write may have written something; never re-run the command after it.
149
+ if (method !== "GET")
150
+ recordMutatingRequestAnswered();
151
+ throw error;
130
152
  }
153
+ if (method !== "GET")
154
+ recordMutatingRequestAnswered();
131
155
  return envelope.data;
132
156
  }
133
157
  async function readBoundedBinaryResponse(response, maxBytes) {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A needs-reply inbox list's composition as one terminal line (ADR 0027,
3
+ * dev-only triage). `inbox list --needs-reply` keeps every thread AI triage has
4
+ * no verdict on. In the blind acceptance (2026-09-25) the rows' `triage: null`
5
+ * read as "analysed, no signal", so the agent called the filter leaky and
6
+ * re-triaged about 140 threads by hand. This line says how many rows carry a
7
+ * verdict, how many do not, and how to get one.
8
+ *
9
+ * Returns null unless the envelope carries `needs_reply_counts`, which the API
10
+ * sends only on a needs-reply list, so every other command prints nothing.
11
+ */
12
+ export declare function formatInboxNeedsReplyNotice(data: unknown): string | null;
@@ -0,0 +1,51 @@
1
+ import { isRecord } from "./util.js";
2
+ /**
3
+ * A needs-reply inbox list's composition as one terminal line (ADR 0027,
4
+ * dev-only triage). `inbox list --needs-reply` keeps every thread AI triage has
5
+ * no verdict on. In the blind acceptance (2026-09-25) the rows' `triage: null`
6
+ * read as "analysed, no signal", so the agent called the filter leaky and
7
+ * re-triaged about 140 threads by hand. This line says how many rows carry a
8
+ * verdict, how many do not, and how to get one.
9
+ *
10
+ * Returns null unless the envelope carries `needs_reply_counts`, which the API
11
+ * sends only on a needs-reply list, so every other command prints nothing.
12
+ */
13
+ export function formatInboxNeedsReplyNotice(data) {
14
+ if (!isRecord(data) || !isRecord(data.needs_reply_counts))
15
+ return null;
16
+ const counts = data.needs_reply_counts;
17
+ const count = (value) => (typeof value === "number" && Number.isFinite(value) ? value : 0);
18
+ const total = count(counts.total);
19
+ const judged = count(counts.needs_reply_analysed);
20
+ const notAnalysed = count(counts.not_analysed_included);
21
+ const undecided = count(counts.undecided_included);
22
+ // "kept", not "judged": triages written before needs_reply_decided existed
23
+ // count as analysed even when the model abstained (conversation-triage.ts).
24
+ const line = `Needs reply: ${total} threads. Triage kept ${judged} as needing a reply`
25
+ + `; ${notAnalysed} not analysed yet and ${undecided} undecided stay in because nothing shows they need no reply.`;
26
+ if (notAnalysed + undecided === 0)
27
+ return line;
28
+ const page = pageStatusCounts(data.conversations);
29
+ const onPage = page ? ` This page: ${page.not_analysed} rows triage_status not_analysed, ${page.undecided} undecided.` : "";
30
+ // Undecided threads were analysed and the model abstained: a second paid run
31
+ // on the same message is unlikely to decide, so only not_analysed get the command.
32
+ const abstained = undecided > 0 ? " Undecided threads were analysed and the model abstained; re-analysing is unlikely to change that." : "";
33
+ const analyse = notAnalysed > 0
34
+ ? " Analyse a not_analysed thread now: oxygen inbox analyze <id> --force (add --channel linkedin or whatsapp for a DM; a small paid AI call, managed credits)."
35
+ : "";
36
+ return `${line}${onPage}${abstained}${analyse}`;
37
+ }
38
+ function pageStatusCounts(rows) {
39
+ if (!Array.isArray(rows))
40
+ return null;
41
+ const tally = { not_analysed: 0, undecided: 0 };
42
+ for (const row of rows) {
43
+ if (!isRecord(row))
44
+ continue;
45
+ if (row.triage_status === "not_analysed")
46
+ tally.not_analysed += 1;
47
+ else if (row.triage_status === "undecided")
48
+ tally.undecided += 1;
49
+ }
50
+ return tally;
51
+ }