@oxygen-agent/cli 1.1014.2170 → 1.1015.29

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/README.md +1 -1
  2. package/dist/browser-login.js +1 -1
  3. package/dist/cli-output.js +1 -1
  4. package/dist/command-manifest.js +8 -0
  5. package/dist/command-support.js +1 -1
  6. package/dist/commands/admin.js +1 -1
  7. package/dist/commands/billing.js +1 -1
  8. package/dist/commands/companies.js +1 -1
  9. package/dist/commands/directory.js +1 -1
  10. package/dist/commands/domains.js +36 -15
  11. package/dist/commands/email-templates.js +1 -1
  12. package/dist/commands/mailboxes.js +1 -1
  13. package/dist/commands/posts.js +1 -1
  14. package/dist/commands/sequences.js +2 -2
  15. package/dist/commands/workflows.js +1 -1
  16. package/dist/sender-limits-flags.js +1 -1
  17. package/dist/sequence-start-at.js +1 -1
  18. package/dist/sequences-content-commands.js +1 -1
  19. package/dist/sequences-newsletter-commands.js +1 -1
  20. package/dist/sequences-test-send-command.js +1 -1
  21. package/node_modules/@oxygen/formula/dist/value-cleaners.d.ts +1 -1
  22. package/node_modules/@oxygen/formula/dist/value-cleaners.js +2 -2
  23. package/node_modules/@oxygen/shared/dist/{reply-oxygent.js → agents/reply-oxygent.js} +1 -1
  24. package/node_modules/@oxygen/shared/dist/{agent-session-schedule.js → agents/session-schedule.js} +2 -2
  25. package/node_modules/@oxygen/shared/dist/{agent-sessions.d.ts → agents/sessions.d.ts} +3 -3
  26. package/node_modules/@oxygen/shared/dist/{agent-sessions.js → agents/sessions.js} +10 -10
  27. package/node_modules/@oxygen/shared/dist/{teammate-routines.d.ts → agents/teammate-routines.d.ts} +2 -2
  28. package/node_modules/@oxygen/shared/dist/{teammate-routines.js → agents/teammate-routines.js} +4 -4
  29. package/node_modules/@oxygen/shared/dist/{teammates.js → agents/teammates.js} +3 -3
  30. package/node_modules/@oxygen/shared/dist/billing.js +1 -1
  31. package/node_modules/@oxygen/shared/dist/capability-intents/sending-infrastructure.js +2 -0
  32. package/node_modules/@oxygen/shared/dist/company-url-identity.js +2 -2
  33. package/node_modules/@oxygen/shared/dist/contracts/sender-limits.js +1 -1
  34. package/node_modules/@oxygen/shared/dist/contracts/teammates.js +4 -4
  35. package/node_modules/@oxygen/shared/dist/diagnostic-spool.js +102 -14
  36. package/node_modules/@oxygen/shared/dist/feature-gates.d.ts +3 -3
  37. package/node_modules/@oxygen/shared/dist/feature-gates.js +3 -3
  38. package/node_modules/@oxygen/shared/dist/index.d.ts +28 -28
  39. package/node_modules/@oxygen/shared/dist/index.js +28 -28
  40. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +1 -1
  41. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +2 -2
  42. package/node_modules/@oxygen/shared/dist/mailboxes/email-deliverability-policy.d.ts +1 -1
  43. package/node_modules/@oxygen/shared/dist/{mailbox-import.js → mailboxes/import.js} +1 -1
  44. package/node_modules/@oxygen/shared/dist/{sending-domain-faults.d.ts → mailboxes/sending-domain-faults.d.ts} +1 -1
  45. package/node_modules/@oxygen/shared/dist/{sending-domain-faults.js → mailboxes/sending-domain-faults.js} +1 -1
  46. package/node_modules/@oxygen/shared/dist/{listed-website-platforms.js → marketing/listed-website-platforms.js} +1 -1
  47. package/node_modules/@oxygen/shared/dist/{newsletter-test-send.d.ts → marketing/newsletter-test-send.d.ts} +1 -1
  48. package/node_modules/@oxygen/shared/dist/{newsletter-test-send.js → marketing/newsletter-test-send.js} +1 -1
  49. package/node_modules/@oxygen/shared/dist/mcp-event-contract.js +2 -2
  50. package/node_modules/@oxygen/shared/dist/network-mining-approval.js +1 -1
  51. package/node_modules/@oxygen/shared/dist/onboarding/plays.d.ts +1 -0
  52. package/node_modules/@oxygen/shared/dist/onboarding/plays.js +13 -0
  53. package/node_modules/@oxygen/shared/dist/onboarding/research.d.ts +20 -12
  54. package/node_modules/@oxygen/shared/dist/onboarding/research.js +20 -12
  55. package/node_modules/@oxygen/shared/dist/onboarding/signup-lead-payload.js +1 -1
  56. package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.js +1 -1
  57. package/node_modules/@oxygen/shared/dist/sequences/bulk-email-pacing.js +1 -1
  58. package/node_modules/@oxygen/shared/dist/{company-reply-pause.js → sequences/company-reply-pause.js} +1 -1
  59. package/node_modules/@oxygen/shared/dist/{dnc-identities.js → sequences/dnc-identities.js} +1 -1
  60. package/node_modules/@oxygen/shared/dist/{email-delivery.js → sequences/email-delivery.js} +1 -1
  61. package/node_modules/@oxygen/shared/dist/{email-tracking-token.d.ts → sequences/email-tracking-token.d.ts} +1 -1
  62. package/node_modules/@oxygen/shared/dist/{email-tracking-token.js → sequences/email-tracking-token.js} +1 -1
  63. package/node_modules/@oxygen/shared/dist/{email-unsubscribe-token.d.ts → sequences/email-unsubscribe-token.d.ts} +1 -1
  64. package/node_modules/@oxygen/shared/dist/{email-unsubscribe-token.js → sequences/email-unsubscribe-token.js} +1 -1
  65. package/node_modules/@oxygen/shared/dist/{sequence-failures.js → sequences/failures.js} +3 -3
  66. package/node_modules/@oxygen/shared/dist/{sequence-hubspot-sync.d.ts → sequences/hubspot-sync.d.ts} +1 -1
  67. package/node_modules/@oxygen/shared/dist/{sequence-hubspot-sync.js → sequences/hubspot-sync.js} +1 -1
  68. package/node_modules/@oxygen/shared/dist/{linkedin-quota-denial.d.ts → sequences/linkedin-quota-denial.d.ts} +1 -1
  69. package/node_modules/@oxygen/shared/dist/{linkedin-quota-denial.js → sequences/linkedin-quota-denial.js} +3 -3
  70. package/node_modules/@oxygen/shared/dist/{linkedin-sequences.d.ts → sequences/linkedin-sequences.d.ts} +1 -1
  71. package/node_modules/@oxygen/shared/dist/{linkedin-sequences.js → sequences/linkedin-sequences.js} +1 -1
  72. package/node_modules/@oxygen/shared/dist/{recipient-provider.d.ts → sequences/recipient-provider.d.ts} +2 -2
  73. package/node_modules/@oxygen/shared/dist/{recipient-provider.js → sequences/recipient-provider.js} +2 -2
  74. package/node_modules/@oxygen/shared/dist/sequences/sending-limits.js +1 -1
  75. package/node_modules/@oxygen/shared/dist/sequences/sending-schedule.d.ts +1 -1
  76. package/node_modules/@oxygen/shared/dist/{sequences.d.ts → sequences/sequences.d.ts} +1 -1
  77. package/node_modules/@oxygen/shared/dist/{sequences.js → sequences/sequences.js} +3 -3
  78. package/node_modules/@oxygen/shared/dist/{suppression-entries.js → sequences/suppression-entries.js} +1 -1
  79. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  80. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  81. package/node_modules/@oxygen/shared/dist/{workspace-event-catalog.d.ts → workflows/workspace-event-catalog.d.ts} +1 -1
  82. package/node_modules/@oxygen/shared/dist/{workspace-event-catalog.js → workflows/workspace-event-catalog.js} +9 -9
  83. package/node_modules/@oxygen/shared/package.json +0 -55
  84. package/package.json +1 -1
  85. /package/node_modules/@oxygen/shared/dist/{reply-oxygent.d.ts → agents/reply-oxygent.d.ts} +0 -0
  86. /package/node_modules/@oxygen/shared/dist/{agent-session-schedule.d.ts → agents/session-schedule.d.ts} +0 -0
  87. /package/node_modules/@oxygen/shared/dist/{teammate-groups.d.ts → agents/teammate-groups.d.ts} +0 -0
  88. /package/node_modules/@oxygen/shared/dist/{teammate-groups.js → agents/teammate-groups.js} +0 -0
  89. /package/node_modules/@oxygen/shared/dist/{teammate-messages.d.ts → agents/teammate-messages.d.ts} +0 -0
  90. /package/node_modules/@oxygen/shared/dist/{teammate-messages.js → agents/teammate-messages.js} +0 -0
  91. /package/node_modules/@oxygen/shared/dist/{teammate-notes.d.ts → agents/teammate-notes.d.ts} +0 -0
  92. /package/node_modules/@oxygen/shared/dist/{teammate-notes.js → agents/teammate-notes.js} +0 -0
  93. /package/node_modules/@oxygen/shared/dist/{teammate-tasks.d.ts → agents/teammate-tasks.d.ts} +0 -0
  94. /package/node_modules/@oxygen/shared/dist/{teammate-tasks.js → agents/teammate-tasks.js} +0 -0
  95. /package/node_modules/@oxygen/shared/dist/{teammates.d.ts → agents/teammates.d.ts} +0 -0
  96. /package/node_modules/@oxygen/shared/dist/{workspace-agents.d.ts → agents/workspace-agents.d.ts} +0 -0
  97. /package/node_modules/@oxygen/shared/dist/{workspace-agents.js → agents/workspace-agents.js} +0 -0
  98. /package/node_modules/@oxygen/shared/dist/{cli-login-code.d.ts → auth/cli-login-code.d.ts} +0 -0
  99. /package/node_modules/@oxygen/shared/dist/{cli-login-code.js → auth/cli-login-code.js} +0 -0
  100. /package/node_modules/@oxygen/shared/dist/{signed-token.d.ts → auth/signed-token.d.ts} +0 -0
  101. /package/node_modules/@oxygen/shared/dist/{signed-token.js → auth/signed-token.js} +0 -0
  102. /package/node_modules/@oxygen/shared/dist/{mailbox-egress-ownership.d.ts → mailboxes/egress-ownership.d.ts} +0 -0
  103. /package/node_modules/@oxygen/shared/dist/{mailbox-egress-ownership.js → mailboxes/egress-ownership.js} +0 -0
  104. /package/node_modules/@oxygen/shared/dist/{egress-transport-readiness.d.ts → mailboxes/egress-transport-readiness.d.ts} +0 -0
  105. /package/node_modules/@oxygen/shared/dist/{egress-transport-readiness.js → mailboxes/egress-transport-readiness.js} +0 -0
  106. /package/node_modules/@oxygen/shared/dist/{email-campaign-ramp.d.ts → mailboxes/email-campaign-ramp.d.ts} +0 -0
  107. /package/node_modules/@oxygen/shared/dist/{email-campaign-ramp.js → mailboxes/email-campaign-ramp.js} +0 -0
  108. /package/node_modules/@oxygen/shared/dist/{email-infrastructure-policy.d.ts → mailboxes/email-infrastructure-policy.d.ts} +0 -0
  109. /package/node_modules/@oxygen/shared/dist/{email-infrastructure-policy.js → mailboxes/email-infrastructure-policy.js} +0 -0
  110. /package/node_modules/@oxygen/shared/dist/{freemail-domains.d.ts → mailboxes/freemail-domains.d.ts} +0 -0
  111. /package/node_modules/@oxygen/shared/dist/{freemail-domains.js → mailboxes/freemail-domains.js} +0 -0
  112. /package/node_modules/@oxygen/shared/dist/{mailbox-import.d.ts → mailboxes/import.d.ts} +0 -0
  113. /package/node_modules/@oxygen/shared/dist/{directory.d.ts → marketing/directory.d.ts} +0 -0
  114. /package/node_modules/@oxygen/shared/dist/{directory.js → marketing/directory.js} +0 -0
  115. /package/node_modules/@oxygen/shared/dist/{listed-website-platforms.d.ts → marketing/listed-website-platforms.d.ts} +0 -0
  116. /package/node_modules/@oxygen/shared/dist/{newsletter-analytics.d.ts → marketing/newsletter-analytics.d.ts} +0 -0
  117. /package/node_modules/@oxygen/shared/dist/{newsletter-analytics.js → marketing/newsletter-analytics.js} +0 -0
  118. /package/node_modules/@oxygen/shared/dist/{inbox-avatar-url.d.ts → messages/avatar-url.d.ts} +0 -0
  119. /package/node_modules/@oxygen/shared/dist/{inbox-avatar-url.js → messages/avatar-url.js} +0 -0
  120. /package/node_modules/@oxygen/shared/dist/{conversation-lineage.d.ts → messages/conversation-lineage.d.ts} +0 -0
  121. /package/node_modules/@oxygen/shared/dist/{conversation-lineage.js → messages/conversation-lineage.js} +0 -0
  122. /package/node_modules/@oxygen/shared/dist/{email-classification-scope.d.ts → messages/email-classification-scope.d.ts} +0 -0
  123. /package/node_modules/@oxygen/shared/dist/{email-classification-scope.js → messages/email-classification-scope.js} +0 -0
  124. /package/node_modules/@oxygen/shared/dist/{linkedin-message-deletion.d.ts → messages/linkedin-message-deletion.d.ts} +0 -0
  125. /package/node_modules/@oxygen/shared/dist/{linkedin-message-deletion.js → messages/linkedin-message-deletion.js} +0 -0
  126. /package/node_modules/@oxygen/shared/dist/{call-outcomes.d.ts → sequences/call-outcomes.d.ts} +0 -0
  127. /package/node_modules/@oxygen/shared/dist/{call-outcomes.js → sequences/call-outcomes.js} +0 -0
  128. /package/node_modules/@oxygen/shared/dist/{cancellation-reasons.d.ts → sequences/cancellation-reasons.d.ts} +0 -0
  129. /package/node_modules/@oxygen/shared/dist/{cancellation-reasons.js → sequences/cancellation-reasons.js} +0 -0
  130. /package/node_modules/@oxygen/shared/dist/{company-reply-pause.d.ts → sequences/company-reply-pause.d.ts} +0 -0
  131. /package/node_modules/@oxygen/shared/dist/{sequence-crm-events.d.ts → sequences/crm-events.d.ts} +0 -0
  132. /package/node_modules/@oxygen/shared/dist/{sequence-crm-events.js → sequences/crm-events.js} +0 -0
  133. /package/node_modules/@oxygen/shared/dist/{dial-guardrail-overrides.d.ts → sequences/dial-guardrail-overrides.d.ts} +0 -0
  134. /package/node_modules/@oxygen/shared/dist/{dial-guardrail-overrides.js → sequences/dial-guardrail-overrides.js} +0 -0
  135. /package/node_modules/@oxygen/shared/dist/{dnc-identities.d.ts → sequences/dnc-identities.d.ts} +0 -0
  136. /package/node_modules/@oxygen/shared/dist/{dnc-rules.d.ts → sequences/dnc-rules.d.ts} +0 -0
  137. /package/node_modules/@oxygen/shared/dist/{dnc-rules.js → sequences/dnc-rules.js} +0 -0
  138. /package/node_modules/@oxygen/shared/dist/{email-delivery.d.ts → sequences/email-delivery.d.ts} +0 -0
  139. /package/node_modules/@oxygen/shared/dist/{email-dsn.d.ts → sequences/email-dsn.d.ts} +0 -0
  140. /package/node_modules/@oxygen/shared/dist/{email-dsn.js → sequences/email-dsn.js} +0 -0
  141. /package/node_modules/@oxygen/shared/dist/{email-hard-bounce.d.ts → sequences/email-hard-bounce.d.ts} +0 -0
  142. /package/node_modules/@oxygen/shared/dist/{email-hard-bounce.js → sequences/email-hard-bounce.js} +0 -0
  143. /package/node_modules/@oxygen/shared/dist/{sequence-failures.d.ts → sequences/failures.d.ts} +0 -0
  144. /package/node_modules/@oxygen/shared/dist/{sequence-lifecycle.d.ts → sequences/lifecycle.d.ts} +0 -0
  145. /package/node_modules/@oxygen/shared/dist/{sequence-lifecycle.js → sequences/lifecycle.js} +0 -0
  146. /package/node_modules/@oxygen/shared/dist/{networks.d.ts → sequences/networks.d.ts} +0 -0
  147. /package/node_modules/@oxygen/shared/dist/{networks.js → sequences/networks.js} +0 -0
  148. /package/node_modules/@oxygen/shared/dist/{suppression-entries.d.ts → sequences/suppression-entries.d.ts} +0 -0
  149. /package/node_modules/@oxygen/shared/dist/{sequence-template.d.ts → sequences/template.d.ts} +0 -0
  150. /package/node_modules/@oxygen/shared/dist/{sequence-template.js → sequences/template.js} +0 -0
  151. /package/node_modules/@oxygen/shared/dist/{sequence-terminal-events.d.ts → sequences/terminal-events.d.ts} +0 -0
  152. /package/node_modules/@oxygen/shared/dist/{sequence-terminal-events.js → sequences/terminal-events.js} +0 -0
  153. /package/node_modules/@oxygen/shared/dist/{workflow-mcp-tools.d.ts → workflows/mcp-tools.d.ts} +0 -0
  154. /package/node_modules/@oxygen/shared/dist/{workflow-mcp-tools.js → workflows/mcp-tools.js} +0 -0
  155. /package/node_modules/@oxygen/shared/dist/{workflow-status-change.d.ts → workflows/status-change.d.ts} +0 -0
  156. /package/node_modules/@oxygen/shared/dist/{workflow-status-change.js → workflows/status-change.js} +0 -0
  157. /package/node_modules/@oxygen/shared/dist/{workflow-trigger-label.d.ts → workflows/trigger-label.d.ts} +0 -0
  158. /package/node_modules/@oxygen/shared/dist/{workflow-trigger-label.js → workflows/trigger-label.js} +0 -0
  159. /package/node_modules/@oxygen/shared/dist/{workflow-trigger-metadata.d.ts → workflows/trigger-metadata.d.ts} +0 -0
  160. /package/node_modules/@oxygen/shared/dist/{workflow-trigger-metadata.js → workflows/trigger-metadata.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { mkdir, open, readFile, readdir, rename, stat, unlink, utimes, writeFile } from "node:fs/promises";
2
+ import { mkdir, open, opendir, readFile, readdir, rename, stat, unlink, utimes, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { DIAGNOSTIC_MAX_BYTES, diagnosticId } from "./diagnostics.js";
5
5
  import { acquireDiagnosticStorageLock } from "./diagnostic-storage-lock.js";
@@ -8,6 +8,12 @@ import { log } from "./log.js";
8
8
  import { recordTelemetryCounter } from "./telemetry.js";
9
9
  const admissions = new Map();
10
10
  const RECEIPT_MAX_BYTES = 512;
11
+ /** The largest receipt any writer produces: two SHA-256 hex digests and a flag. */
12
+ const RECEIPT_BYTES = Buffer.byteLength(JSON.stringify({ sha256: "0".repeat(64), store: "0".repeat(64), published: false }));
13
+ /** Surveyed expiries confirmed under the mutex per inspection; the rest wait for the next one. */
14
+ const RECEIPT_EXPIRY_BATCH = 2_048;
15
+ const SPOOL_EXPIRY_MS = 72 * 60 * 60 * 1000;
16
+ const RECEIPT_NAME = /^[0-9a-f-]+\.receipt\.json$/;
11
17
  /** A full scan bounds ledger drift (a crashed owner, a pre-ledger writer) and enforces expiry. */
12
18
  const LEDGER_MAX_AGE_MS = 15_000;
13
19
  /** This process's last full listing supplies retry candidates between scans. */
@@ -69,27 +75,41 @@ async function drainAdmissions(directory, queue) {
69
75
  let published;
70
76
  try {
71
77
  // Bound actual cross-process contention, not local queue/inspection time (#5810).
72
- release = await storageStage("lock", () => acquireDiagnosticStorageLock(join(directory, ".admission.lock"), 5_000));
73
- if (!release)
74
- throw new StorageFailure("lock", { code: "lock_timeout" });
75
- const started = performance.now();
78
+ release = await lockAdmission(directory, 5_000);
79
+ let started = performance.now();
76
80
  const reservedOnly = batch.every(admission => admission.progress && admission.reservation);
77
81
  let files = queue.files ?? [];
78
82
  let scanned = false;
83
+ let survey;
84
+ let receipts;
79
85
  if (!reservedOnly) {
80
86
  // A fresh shared ledger stands in for the full scan, which held this
81
87
  // cross-process mutex ~1 s per batch at 24k retained files (2026-10-23).
82
- const ledger = await readAdmissionLedger(directory, batch.reduce((sum, admission) => sum + admissionBytes(admission), 0));
88
+ const required = batch.reduce((sum, admission) => sum + admissionBytes(admission), 0);
89
+ let ledger = await readAdmissionLedger(directory, required);
90
+ if (!ledger) {
91
+ // Statting ~800k receipts held the mutex 6 s per scan (2026-10-28):
92
+ // survey them unlocked, then inspect within a fresh wait budget.
93
+ const owner = release;
94
+ release = null;
95
+ await owner();
96
+ survey = await surveyReceipts(directory);
97
+ release = await lockAdmission(directory, 5_000);
98
+ started = performance.now();
99
+ // Another replica may have inspected during the survey.
100
+ ledger = await readAdmissionLedger(directory, required);
101
+ }
83
102
  if (ledger) {
84
103
  queue.used = ledger.used;
85
104
  queue.scannedAt = ledger.scanned_at;
86
105
  queue.files = files = ledger.files;
87
106
  }
88
107
  else {
89
- const inspected = await storageStage("inspect", () => inspectDiagnosticSpool(directory));
108
+ const inspected = await storageStage("inspect", () => inspectDiagnosticSpool(directory, survey));
90
109
  queue.used = inspected.used;
91
110
  queue.files = files = inspected.files;
92
111
  queue.scannedAt = Date.now();
112
+ receipts = inspected.receipts;
93
113
  scanned = true;
94
114
  }
95
115
  }
@@ -131,7 +151,8 @@ async function drainAdmissions(directory, queue) {
131
151
  const waitMs = performance.now() - batch[0].enqueuedAt;
132
152
  if (!reservedOnly && (scanned || waitMs >= 1_000))
133
153
  log("info", "diagnostics.spool_admitted", { queue_role: diagnosticRole(), batch_records: batch.length, spool_files: files.length,
134
- spool_bytes: queue.used, scan_ms: scanMs, admission_wait_ms: waitMs, inspection: scanned ? "scan" : "ledger" });
154
+ spool_bytes: queue.used, scan_ms: scanMs, admission_wait_ms: waitMs, inspection: scanned ? "scan" : "ledger",
155
+ ...(scanned ? { spool_receipts: receipts, survey_ms: survey?.ms ?? null } : {}) });
135
156
  }
136
157
  catch (error) {
137
158
  for (const admission of batch)
@@ -156,6 +177,12 @@ async function drainAdmissions(directory, queue) {
156
177
  admissions.delete(directory);
157
178
  }
158
179
  }
180
+ async function lockAdmission(directory, waitMs) {
181
+ const release = await storageStage("lock", () => acquireDiagnosticStorageLock(join(directory, ".admission.lock"), waitMs));
182
+ if (!release)
183
+ throw new StorageFailure("lock", { code: "lock_timeout" });
184
+ return release;
185
+ }
159
186
  /** Include an upload receipt and its atomic replacement in admission. */
160
187
  function admissionBytes(admission) {
161
188
  return admission.reservation ? 0 : admission.progress ? RECEIPT_MAX_BYTES : admission.encoded.compressed.length + 2 * RECEIPT_MAX_BYTES;
@@ -273,7 +300,8 @@ export async function readUploadProgress(directory, id, storeFingerprint) {
273
300
  }
274
301
  async function writeUploadProgress(directory, record, progress, reservation) {
275
302
  const bytes = Buffer.from(JSON.stringify(progress));
276
- if (bytes.length > RECEIPT_MAX_BYTES)
303
+ // Inspection counts receipts at this bound without statting them.
304
+ if (bytes.length > RECEIPT_BYTES)
277
305
  throw new Error("Diagnostic upload receipt exceeds its bound");
278
306
  if (reservation) {
279
307
  // Caller owns the admission mutex. Exchange already-counted bytes for the
@@ -381,12 +409,19 @@ export async function retryDiagnosticSpool(directory, upload) {
381
409
  ({ files, reservation } = local.used === undefined ? { files: [] } : await reserveRetryBatch(directory, retained, local.used, local));
382
410
  }
383
411
  else {
412
+ // Each idle replica sweeps every 30 s: skip while admission is busy, and
413
+ // survey receipts between that probe and the inspection's own mutex hold.
414
+ const probe = await storageStage("lock", () => acquireDiagnosticStorageLock(join(directory, ".admission.lock")));
415
+ if (!probe)
416
+ return;
417
+ await probe();
418
+ const survey = await surveyReceipts(directory);
384
419
  const admission = await storageStage("lock", () => acquireDiagnosticStorageLock(join(directory, ".admission.lock")));
385
420
  if (!admission)
386
421
  return;
387
422
  try {
388
423
  const scannedAt = Date.now();
389
- const inspected = await storageStage("inspect", () => inspectDiagnosticSpool(directory));
424
+ const inspected = await storageStage("inspect", () => inspectDiagnosticSpool(directory, survey));
390
425
  ({ files, reservation } = await reserveRetryBatch(directory, inspected.files.slice(0, 20), inspected.used));
391
426
  // Unreserved, any existing ledger still covers the spool; skip the extra mutex hold.
392
427
  if (reservation)
@@ -425,11 +460,64 @@ export async function retryDiagnosticSpool(directory, upload) {
425
460
  await release();
426
461
  }
427
462
  }
463
+ /**
464
+ * Stat receipts without the admission mutex. Every writer bounds a receipt to
465
+ * RECEIPT_BYTES and stamps its capture time, so the locked inspection counts a
466
+ * receipt at that bound (or its larger surveyed size) without a stat, and
467
+ * stats again only surveyed expiries before removing them. `opendir` streams
468
+ * the listing.
469
+ */
470
+ async function surveyReceipts(directory) {
471
+ const started = performance.now();
472
+ const survey = { sizes: new Map(), expired: new Set(), ms: 0 };
473
+ const inspect = (names) => Promise.all(names.map(async (name) => {
474
+ const info = await stat(join(directory, name)).catch(error => { if (error?.code === "ENOENT")
475
+ return null; throw error; });
476
+ if (!info)
477
+ return;
478
+ if (Date.now() - info.mtimeMs >= SPOOL_EXPIRY_MS)
479
+ survey.expired.add(name);
480
+ if (info.size > RECEIPT_BYTES)
481
+ survey.sizes.set(name, info.size);
482
+ }));
483
+ try {
484
+ let batch = [];
485
+ for await (const entry of await opendir(directory, { bufferSize: 256 })) {
486
+ if (!RECEIPT_NAME.test(entry.name))
487
+ continue;
488
+ batch.push(entry.name);
489
+ if (batch.length === 64) {
490
+ await inspect(batch);
491
+ batch = [];
492
+ }
493
+ }
494
+ await inspect(batch);
495
+ }
496
+ catch {
497
+ return undefined;
498
+ } // The locked inspection then stats every receipt itself.
499
+ survey.ms = performance.now() - started;
500
+ return survey;
501
+ }
428
502
  /** Caller holds admission lock; count retained bytes and expire actual filenames. */
429
- async function inspectDiagnosticSpool(directory) {
503
+ async function inspectDiagnosticSpool(directory, survey) {
430
504
  let used = 0;
505
+ let receipts = 0;
506
+ let confirmations = 0;
431
507
  const retained = [];
432
- const names = (await readdir(directory)).filter(name => /^[0-9a-f-]+\.(?:json\.gz|receipt\.json)$/.test(name) || /^[0-9a-f-]+(?:\.[0-9a-f-]+)?\.tmp$/.test(name));
508
+ const names = [];
509
+ for (const name of await readdir(directory)) {
510
+ if (RECEIPT_NAME.test(name)) {
511
+ receipts += 1;
512
+ if (survey && !(survey.expired.has(name) && confirmations++ < RECEIPT_EXPIRY_BATCH)) {
513
+ used += Math.max(RECEIPT_BYTES, survey.sizes.get(name) ?? 0);
514
+ continue;
515
+ }
516
+ }
517
+ else if (!/^[0-9a-f-]+\.json\.gz$/.test(name) && !/^[0-9a-f-]+(?:\.[0-9a-f-]+)?\.tmp$/.test(name))
518
+ continue;
519
+ names.push(name);
520
+ }
433
521
  for (let offset = 0; offset < names.length; offset += 64) {
434
522
  const inspected = await Promise.all(names.slice(offset, offset + 64).map(async (name) => {
435
523
  const path = join(directory, name);
@@ -441,7 +529,7 @@ async function inspectDiagnosticSpool(directory) {
441
529
  const record = /^[0-9a-f-]+\.json\.gz$/.test(name);
442
530
  if (!info)
443
531
  continue;
444
- if (Date.now() - info.mtimeMs >= 72 * 60 * 60 * 1000) {
532
+ if (Date.now() - info.mtimeMs >= SPOOL_EXPIRY_MS) {
445
533
  const removed = await unlink(path).then(() => true).catch(error => { if (error?.code === "ENOENT")
446
534
  return false; throw error; });
447
535
  if (removed && !name.endsWith(".receipt.json") && !/^f\.[0-9a-f-]+\.tmp$/.test(name)) {
@@ -458,5 +546,5 @@ async function inspectDiagnosticSpool(directory) {
458
546
  }
459
547
  const files = retained.sort((a, b) => a.mtimeMs - b.mtimeMs || a.name.localeCompare(b.name)).map(file => file.name);
460
548
  inspections.set(directory, { files, at: Date.now() });
461
- return { used, files };
549
+ return { used, files, receipts };
462
550
  }
@@ -53,7 +53,7 @@ export type FeatureGateResolution = {
53
53
  * remote resolution would drag a flag client into the published CLI.
54
54
  * - OXYGEN_TRIGGER_DEFAULT_CAPS — (b). Selects log-only vs enforce for the
55
55
  * plan-tier default per-delivery ceiling on autonomous triggers
56
- * (`apps/worker/src/workflow-spend-cap.ts`). Remote control over spend
56
+ * (`apps/worker/src/workflows/spend-cap.ts`). Remote control over spend
57
57
  * ENFORCEMENT means an outage can uncap autonomous credit spend everywhere.
58
58
  * - OXYGEN_BYOK_DAILY_CAPS — (b). Same, for BYOK per-provider daily caps
59
59
  * (`packages/providers/src/provider-fetch.ts`) — external money on the
@@ -69,8 +69,8 @@ export type FeatureGateResolution = {
69
69
  * flag service being reachable — and "the flag service is unreachable" is exactly
70
70
  * the kind of incident during which you least want the fleet to move.
71
71
  * - OXYGEN_AGENTS_ENABLED — (b). Authorizes autonomous Agent run execution —
72
- * tool authority AND credit spend (`apps/web/src/lib/agent-runtime.ts`,
73
- * `apps/worker/src/agent-cycle.ts`). Same class as publishing.
72
+ * tool authority AND credit spend (`apps/web/src/lib/agents/runtime.ts`,
73
+ * `apps/worker/src/agents/cycle.ts`). Same class as publishing.
74
74
  * - OXYGEN_AGENTS_WORKSPACE_IDS — (b). Which workspaces the "staff" stage of
75
75
  * that execution may run in (`packages/shared/src/agents-enabled.ts`);
76
76
  * production also requires its reviewed PRODUCTION_AGENT_WORKSPACE_IDS.
@@ -44,7 +44,7 @@
44
44
  * remote resolution would drag a flag client into the published CLI.
45
45
  * - OXYGEN_TRIGGER_DEFAULT_CAPS — (b). Selects log-only vs enforce for the
46
46
  * plan-tier default per-delivery ceiling on autonomous triggers
47
- * (`apps/worker/src/workflow-spend-cap.ts`). Remote control over spend
47
+ * (`apps/worker/src/workflows/spend-cap.ts`). Remote control over spend
48
48
  * ENFORCEMENT means an outage can uncap autonomous credit spend everywhere.
49
49
  * - OXYGEN_BYOK_DAILY_CAPS — (b). Same, for BYOK per-provider daily caps
50
50
  * (`packages/providers/src/provider-fetch.ts`) — external money on the
@@ -60,8 +60,8 @@
60
60
  * flag service being reachable — and "the flag service is unreachable" is exactly
61
61
  * the kind of incident during which you least want the fleet to move.
62
62
  * - OXYGEN_AGENTS_ENABLED — (b). Authorizes autonomous Agent run execution —
63
- * tool authority AND credit spend (`apps/web/src/lib/agent-runtime.ts`,
64
- * `apps/worker/src/agent-cycle.ts`). Same class as publishing.
63
+ * tool authority AND credit spend (`apps/web/src/lib/agents/runtime.ts`,
64
+ * `apps/worker/src/agents/cycle.ts`). Same class as publishing.
65
65
  * - OXYGEN_AGENTS_WORKSPACE_IDS — (b). Which workspaces the "staff" stage of
66
66
  * that execution may run in (`packages/shared/src/agents-enabled.ts`);
67
67
  * production also requires its reviewed PRODUCTION_AGENT_WORKSPACE_IDS.
@@ -1,6 +1,6 @@
1
1
  export { OXYGEN_MINIMUM_CLI_VERSION, OXYGEN_VERSION, } from "./version.js";
2
- export { WORKFLOW_TRIGGER_AUTO_PAUSE_METADATA_KEYS, clearWorkflowTriggerAutoPauseMetadata, } from "./workflow-trigger-metadata.js";
3
- export { WORKFLOW_STATUS_CHANGE_METADATA_KEY, type WorkflowStatusChange, type WorkflowStatusChangeActor, type WorkflowStatusChangeSource, describeWorkflowStatusChange, formatWorkflowStatusChangeTimestamp, parseWorkflowStatusChange, readWorkflowStatusChange, } from "./workflow-status-change.js";
2
+ export { WORKFLOW_TRIGGER_AUTO_PAUSE_METADATA_KEYS, clearWorkflowTriggerAutoPauseMetadata, } from "./workflows/trigger-metadata.js";
3
+ export { WORKFLOW_STATUS_CHANGE_METADATA_KEY, type WorkflowStatusChange, type WorkflowStatusChangeActor, type WorkflowStatusChangeSource, describeWorkflowStatusChange, formatWorkflowStatusChangeTimestamp, parseWorkflowStatusChange, readWorkflowStatusChange, } from "./workflows/status-change.js";
4
4
  export * from "./billing.js";
5
5
  export * from "./visual-render.js";
6
6
  export * from "./billing-anchors.js";
@@ -24,7 +24,7 @@ export * from "./error-message.js";
24
24
  export * from "./sql-rows.js";
25
25
  export * from "./cell-format.js";
26
26
  export * from "./cli-envelope.js";
27
- export * from "./cli-login-code.js";
27
+ export * from "./auth/cli-login-code.js";
28
28
  export * from "./cli-result.js";
29
29
  export * from "./collab.js";
30
30
  export * from "./records/reply-events.js";
@@ -36,11 +36,11 @@ export * from "./copilot-playbooks.js";
36
36
  export * from "./copilot-plan.js";
37
37
  export * from "./credit-guidance.js";
38
38
  export * from "./deploy-env.js";
39
- export * from "./directory.js";
40
- export * from "./email-dsn.js";
41
- export * from "./email-hard-bounce.js";
42
- export * from "./email-tracking-token.js";
43
- export * from "./email-unsubscribe-token.js";
39
+ export * from "./marketing/directory.js";
40
+ export * from "./sequences/email-dsn.js";
41
+ export * from "./sequences/email-hard-bounce.js";
42
+ export * from "./sequences/email-tracking-token.js";
43
+ export * from "./sequences/email-unsubscribe-token.js";
44
44
  export * from "./error-redaction.js";
45
45
  export * from "./onboarding/future-signup-events.js";
46
46
  export * from "./onboarding/future-signup-lifecycle-projection.js";
@@ -60,27 +60,27 @@ export * from "./langfuse.js";
60
60
  export * from "./llm-usage.js";
61
61
  export * from "./posts/linkedin-mentions.js";
62
62
  export * from "./posts/linkedin-post-url.js";
63
- export * from "./linkedin-quota-denial.js";
63
+ export * from "./sequences/linkedin-quota-denial.js";
64
64
  export * from "./tables/linkedin-url.js";
65
- export * from "./linkedin-sequences.js";
65
+ export * from "./sequences/linkedin-sequences.js";
66
66
  export * from "./records/member-columns.js";
67
67
  export * from "./mailboxes/microsoft-consent-url.js";
68
- export * from "./networks.js";
68
+ export * from "./sequences/networks.js";
69
69
  export * from "./person-name.js";
70
70
  export * from "./product-doctrine.js";
71
71
  export * from "./recipes.js";
72
- export * from "./sequence-template.js";
73
- export * from "./sequence-crm-events.js";
74
- export * from "./sequence-failures.js";
75
- export * from "./sequence-hubspot-sync.js";
76
- export * from "./sequence-terminal-events.js";
77
- export * from "./call-outcomes.js";
78
- export * from "./dial-guardrail-overrides.js";
79
- export * from "./sequences.js";
72
+ export * from "./sequences/template.js";
73
+ export * from "./sequences/crm-events.js";
74
+ export * from "./sequences/failures.js";
75
+ export * from "./sequences/hubspot-sync.js";
76
+ export * from "./sequences/terminal-events.js";
77
+ export * from "./sequences/call-outcomes.js";
78
+ export * from "./sequences/dial-guardrail-overrides.js";
79
+ export * from "./sequences/sequences.js";
80
80
  export { ESP_MATCHING_MODES, type EspMatchingMode, DEFAULT_ESP_MATCHING_MODE, isEspMatchingMode, validateEspMatchingSetting, RECIPIENT_ESPS, type RecipientEsp, ESP_ROUTE_BUCKETS, type EspRouteBucket, type EspRouteWeights, type EspSenderExclusion, type EspRoutingPolicy, type EspMatchingSetting, type ResolvedEspPolicy, MAX_ESP_SENDER_EXCLUSIONS, MAX_ESP_ROUTE_WEIGHT, isEspRouteBucket, normalizeEspSenderDomain, espPolicyFromSetting, espRouteWeightsFor, espRouteCandidates, espExcludedSenderDomains, RECIPIENT_ESP_FAMILIES, type RecipientEspFamily, isRecipientEspFamily, isEspGatewayFamily, matchableEspFromFamily, familyFromMxHosts, espFromSpfRecords, inferRecipientEspFamily, inferRecipientEsp, espFromMxHosts, } from "./sequence-internals/esp-policy.js";
81
- export * from "./suppression-entries.js";
82
- export * from "./dnc-identities.js";
83
- export * from "./dnc-rules.js";
81
+ export * from "./sequences/suppression-entries.js";
82
+ export * from "./sequences/dnc-identities.js";
83
+ export * from "./sequences/dnc-rules.js";
84
84
  export * from "./tables/limits.js";
85
85
  export * from "./tables/capacity.js";
86
86
  export * from "./log.js";
@@ -96,8 +96,8 @@ export * from "./postgres-text.js";
96
96
  export * from "./tags/tags.js";
97
97
  export * from "./telemetry.js";
98
98
  export * from "./tenant-database-secret.js";
99
- export * from "./egress-transport-readiness.js";
100
- export * from "./mailbox-egress-ownership.js";
99
+ export * from "./mailboxes/egress-transport-readiness.js";
100
+ export * from "./mailboxes/egress-ownership.js";
101
101
  export * from "./rate-window.js";
102
102
  export * from "./timing.js";
103
103
  export * from "./type-guards.js";
@@ -105,12 +105,12 @@ export * from "./value-readers.js";
105
105
  export * from "./array-utils.js";
106
106
  export * from "./format-percent.js";
107
107
  export * from "./worker-failures-queue.js";
108
- export * from "./workflow-mcp-tools.js";
108
+ export * from "./workflows/mcp-tools.js";
109
109
  export * from "./webhook-headers.js";
110
- export * from "./workflow-trigger-label.js";
111
- export * from "./workspace-event-catalog.js";
110
+ export * from "./workflows/trigger-label.js";
111
+ export * from "./workflows/workspace-event-catalog.js";
112
112
  export * from "./records/notetaker-events.js";
113
- export * from "./workspace-agents.js";
113
+ export * from "./agents/workspace-agents.js";
114
114
  export * from "./semver.js";
115
115
  export * from "./ugc/ugc.js";
116
116
  export * from "./ugc/amplification-identity.js";
@@ -1,6 +1,6 @@
1
1
  export { OXYGEN_MINIMUM_CLI_VERSION, OXYGEN_VERSION, } from "./version.js";
2
- export { WORKFLOW_TRIGGER_AUTO_PAUSE_METADATA_KEYS, clearWorkflowTriggerAutoPauseMetadata, } from "./workflow-trigger-metadata.js";
3
- export { WORKFLOW_STATUS_CHANGE_METADATA_KEY, describeWorkflowStatusChange, formatWorkflowStatusChangeTimestamp, parseWorkflowStatusChange, readWorkflowStatusChange, } from "./workflow-status-change.js";
2
+ export { WORKFLOW_TRIGGER_AUTO_PAUSE_METADATA_KEYS, clearWorkflowTriggerAutoPauseMetadata, } from "./workflows/trigger-metadata.js";
3
+ export { WORKFLOW_STATUS_CHANGE_METADATA_KEY, describeWorkflowStatusChange, formatWorkflowStatusChangeTimestamp, parseWorkflowStatusChange, readWorkflowStatusChange, } from "./workflows/status-change.js";
4
4
  export * from "./billing.js";
5
5
  export * from "./visual-render.js";
6
6
  export * from "./billing-anchors.js";
@@ -24,7 +24,7 @@ export * from "./error-message.js";
24
24
  export * from "./sql-rows.js";
25
25
  export * from "./cell-format.js";
26
26
  export * from "./cli-envelope.js";
27
- export * from "./cli-login-code.js";
27
+ export * from "./auth/cli-login-code.js";
28
28
  export * from "./cli-result.js";
29
29
  export * from "./collab.js";
30
30
  export * from "./records/reply-events.js";
@@ -36,11 +36,11 @@ export * from "./copilot-playbooks.js";
36
36
  export * from "./copilot-plan.js";
37
37
  export * from "./credit-guidance.js";
38
38
  export * from "./deploy-env.js";
39
- export * from "./directory.js";
40
- export * from "./email-dsn.js";
41
- export * from "./email-hard-bounce.js";
42
- export * from "./email-tracking-token.js";
43
- export * from "./email-unsubscribe-token.js";
39
+ export * from "./marketing/directory.js";
40
+ export * from "./sequences/email-dsn.js";
41
+ export * from "./sequences/email-hard-bounce.js";
42
+ export * from "./sequences/email-tracking-token.js";
43
+ export * from "./sequences/email-unsubscribe-token.js";
44
44
  export * from "./error-redaction.js";
45
45
  export * from "./onboarding/future-signup-events.js";
46
46
  export * from "./onboarding/future-signup-lifecycle-projection.js";
@@ -60,28 +60,28 @@ export * from "./langfuse.js";
60
60
  export * from "./llm-usage.js";
61
61
  export * from "./posts/linkedin-mentions.js";
62
62
  export * from "./posts/linkedin-post-url.js";
63
- export * from "./linkedin-quota-denial.js";
63
+ export * from "./sequences/linkedin-quota-denial.js";
64
64
  export * from "./tables/linkedin-url.js";
65
- export * from "./linkedin-sequences.js";
65
+ export * from "./sequences/linkedin-sequences.js";
66
66
  export * from "./records/member-columns.js";
67
67
  export * from "./mailboxes/microsoft-consent-url.js";
68
- export * from "./networks.js";
68
+ export * from "./sequences/networks.js";
69
69
  export * from "./person-name.js";
70
70
  export * from "./product-doctrine.js";
71
71
  export * from "./recipes.js";
72
- export * from "./sequence-template.js";
73
- export * from "./sequence-crm-events.js";
74
- export * from "./sequence-failures.js";
75
- export * from "./sequence-hubspot-sync.js";
76
- export * from "./sequence-terminal-events.js";
77
- export * from "./call-outcomes.js";
78
- export * from "./dial-guardrail-overrides.js";
79
- export * from "./sequences.js";
72
+ export * from "./sequences/template.js";
73
+ export * from "./sequences/crm-events.js";
74
+ export * from "./sequences/failures.js";
75
+ export * from "./sequences/hubspot-sync.js";
76
+ export * from "./sequences/terminal-events.js";
77
+ export * from "./sequences/call-outcomes.js";
78
+ export * from "./sequences/dial-guardrail-overrides.js";
79
+ export * from "./sequences/sequences.js";
80
80
  // The ESP contract the root barrel has always carried (it used to arrive through sequences.ts).
81
81
  export { ESP_MATCHING_MODES, DEFAULT_ESP_MATCHING_MODE, isEspMatchingMode, validateEspMatchingSetting, RECIPIENT_ESPS, ESP_ROUTE_BUCKETS, MAX_ESP_SENDER_EXCLUSIONS, MAX_ESP_ROUTE_WEIGHT, isEspRouteBucket, normalizeEspSenderDomain, espPolicyFromSetting, espRouteWeightsFor, espRouteCandidates, espExcludedSenderDomains, RECIPIENT_ESP_FAMILIES, isRecipientEspFamily, isEspGatewayFamily, matchableEspFromFamily, familyFromMxHosts, espFromSpfRecords, inferRecipientEspFamily, inferRecipientEsp, espFromMxHosts, } from "./sequence-internals/esp-policy.js";
82
- export * from "./suppression-entries.js";
83
- export * from "./dnc-identities.js";
84
- export * from "./dnc-rules.js";
82
+ export * from "./sequences/suppression-entries.js";
83
+ export * from "./sequences/dnc-identities.js";
84
+ export * from "./sequences/dnc-rules.js";
85
85
  export * from "./tables/limits.js";
86
86
  export * from "./tables/capacity.js";
87
87
  export * from "./log.js";
@@ -108,8 +108,8 @@ export * from "./postgres-text.js";
108
108
  export * from "./tags/tags.js";
109
109
  export * from "./telemetry.js";
110
110
  export * from "./tenant-database-secret.js";
111
- export * from "./egress-transport-readiness.js";
112
- export * from "./mailbox-egress-ownership.js";
111
+ export * from "./mailboxes/egress-transport-readiness.js";
112
+ export * from "./mailboxes/egress-ownership.js";
113
113
  export * from "./rate-window.js";
114
114
  export * from "./timing.js";
115
115
  export * from "./type-guards.js";
@@ -117,12 +117,12 @@ export * from "./value-readers.js";
117
117
  export * from "./array-utils.js";
118
118
  export * from "./format-percent.js";
119
119
  export * from "./worker-failures-queue.js";
120
- export * from "./workflow-mcp-tools.js";
120
+ export * from "./workflows/mcp-tools.js";
121
121
  export * from "./webhook-headers.js";
122
- export * from "./workflow-trigger-label.js";
123
- export * from "./workspace-event-catalog.js";
122
+ export * from "./workflows/trigger-label.js";
123
+ export * from "./workflows/workspace-event-catalog.js";
124
124
  export * from "./records/notetaker-events.js";
125
- export * from "./workspace-agents.js";
125
+ export * from "./agents/workspace-agents.js";
126
126
  export * from "./semver.js";
127
127
  export * from "./ugc/ugc.js";
128
128
  export * from "./ugc/amplification-identity.js";
@@ -282,7 +282,7 @@ export declare function readKnowledgeBootstrapConsent(metadata: unknown): Knowle
282
282
  * It sits beside the consent key for the same reason: the setup surface writes it and
283
283
  * the worker reads it, and two spellings of the key would silently drop a hint the
284
284
  * customer took the trouble to give us. The stored value is the canonical form
285
- * produced by `normalizeLinkedinCompanyUrl` (./dnc-identities.js) — normalize on the
285
+ * produced by `normalizeLinkedinCompanyUrl` (./sequences/dnc-identities.js) — normalize on the
286
286
  * way in AND on the way out, never trust the raw string, and never let a personal
287
287
  * `/in/` profile through: this is the COMPANY page, and researching a founder's
288
288
  * personal profile as if it were the company is exactly the confidently-wrong write
@@ -54,7 +54,7 @@
54
54
  * Professional person evidence remains actor-scoped; ICP/offers are hypotheses.
55
55
  * The provider sub-cap covers every external research leg, including fallbacks.
56
56
  */
57
- import { normalizeLinkedinCompanyUrl } from "./dnc-identities.js";
57
+ import { normalizeLinkedinCompanyUrl } from "./sequences/dnc-identities.js";
58
58
  import { normalizeLinkedinProfileUrl } from "./tables/linkedin-url.js";
59
59
  /**
60
60
  * Hard ceiling on managed credits ONE workspace bootstrap may spend, all phases.
@@ -254,7 +254,7 @@ function readGrant(raw) {
254
254
  * It sits beside the consent key for the same reason: the setup surface writes it and
255
255
  * the worker reads it, and two spellings of the key would silently drop a hint the
256
256
  * customer took the trouble to give us. The stored value is the canonical form
257
- * produced by `normalizeLinkedinCompanyUrl` (./dnc-identities.js) — normalize on the
257
+ * produced by `normalizeLinkedinCompanyUrl` (./sequences/dnc-identities.js) — normalize on the
258
258
  * way in AND on the way out, never trust the raw string, and never let a personal
259
259
  * `/in/` profile through: this is the COMPANY page, and researching a founder's
260
260
  * personal profile as if it were the company is exactly the confidently-wrong write
@@ -1,4 +1,4 @@
1
- import type { SequenceSendWindow } from "../sequences.js";
1
+ import type { SequenceSendWindow } from "../sequences/sequences.js";
2
2
  /** Deliverability defaults are independent of pricing and confer no send/spend authority. */
3
3
  export declare const EMAIL_DELIVERABILITY_POLICY_VERSION = "2026-09-27-v1";
4
4
  export declare const EMAIL_DELIVERABILITY_DEFAULTS: Readonly<{
@@ -1,4 +1,4 @@
1
- import { OxygenError } from "./cli-result.js";
1
+ import { OxygenError } from "../cli-result.js";
2
2
  export const MAILBOX_IMPORT_FILE_MAX_BYTES = 5 * 1024 * 1024;
3
3
  export const MAILBOX_IMPORT_ROW_LIMIT = 500;
4
4
  export const MAILBOX_OAUTH_REVIEW_BATCH_SIZE = 10;
@@ -1,4 +1,4 @@
1
- import { CliHttpError } from "./cli-http-error.js";
1
+ import { CliHttpError } from "../cli-http-error.js";
2
2
  export declare const SENDING_DOMAIN_FAULT_CODES: {
3
3
  readonly ownedElsewhere: "sending_domain_owned_elsewhere";
4
4
  readonly reserved: "sending_domain_reserved";
@@ -1,4 +1,4 @@
1
- import { CliHttpError } from "./cli-http-error.js";
1
+ import { CliHttpError } from "../cli-http-error.js";
2
2
  // Customer-facing refusals for workspace sending domains (ADR 0023): fixed copy,
3
3
  // a machine code and a next step. None names SES, AWS or another workspace, and
4
4
  // an ownership refusal never says which domain it collided with.
@@ -1,4 +1,4 @@
1
- import { isFreemailDomain } from "./freemail-domains.js";
1
+ import { isFreemailDomain } from "../mailboxes/freemail-domains.js";
2
2
  /**
3
3
  * Hosts that list a company without being its website: social profiles, link-in-bio
4
4
  * pages, shorteners, maps, calendars, chat links, code hosts, marketplaces, and
@@ -1,4 +1,4 @@
1
- import { CliHttpError } from "./cli-http-error.js";
1
+ import { CliHttpError } from "../cli-http-error.js";
2
2
  export declare const NEWSLETTER_TEST_MAX_RECIPIENTS = 5;
3
3
  /** Test sends (requests, not emails) a workspace may make per day. */
4
4
  export declare const NEWSLETTER_TEST_DAILY_LIMIT = 20;
@@ -1,4 +1,4 @@
1
- import { CliHttpError } from "./cli-http-error.js";
1
+ import { CliHttpError } from "../cli-http-error.js";
2
2
  // A newsletter test send: one email step rendered as delivery renders it, sent
3
3
  // to at most five verified addresses of the workspace's own members. Web, CLI
4
4
  // and MCP share these limits and refusals (ADR 0023: fixed copy, a machine code
@@ -4,8 +4,8 @@ import { CRM_ACTIVITY_CREATED_EVENT } from "./records/activity-events.js";
4
4
  import { CRM_EMAIL_REPLY_CLASSIFIED_EVENT, CRM_WORKFLOW_EVENT_SOURCE, } from "./records/reply-events.js";
5
5
  import { NOTETAKER_MEETING_COMPLETED_EVENT, NOTETAKER_WORKFLOW_EVENT_SOURCE } from "./records/notetaker-events.js";
6
6
  import { slugifyOption } from "./tables/select-options.js";
7
- import { SEQUENCE_ENROLLMENT_TERMINAL_EVENT, SEQUENCE_TERMINAL_EVENT_SOURCE, SEQUENCE_TERMINAL_STATUSES, } from "./sequence-terminal-events.js";
8
- import { resolveAppBaseUrl } from "./signed-token.js";
7
+ import { SEQUENCE_ENROLLMENT_TERMINAL_EVENT, SEQUENCE_TERMINAL_EVENT_SOURCE, SEQUENCE_TERMINAL_STATUSES, } from "./sequences/terminal-events.js";
8
+ import { resolveAppBaseUrl } from "./auth/signed-token.js";
9
9
  import { isRecord, readCoercedString, readTrimmedString } from "./type-guards.js";
10
10
  // The v1 MCP Events contract (ADR 0030, ledger OXP-11.5.17): the six events
11
11
  // `events/list` advertises, what a subscription may filter on, what a delivery
@@ -7,7 +7,7 @@
7
7
  // Founder decision 3 (2026-10-17) holds regardless of Auto-approve: the first launch of every Sequence needs a person.
8
8
  // D8: under standing approval, "copy" is the prompt and voice revision, a person's review of at least 10 samples, and
9
9
  // the automatic check below on every draft.
10
- import { LINKEDIN_INVITE_NOTE_LIMIT_BASIC } from "./linkedin-sequences.js";
10
+ import { LINKEDIN_INVITE_NOTE_LIMIT_BASIC } from "./sequences/linkedin-sequences.js";
11
11
  export const STANDING_APPROVAL_VERSION = 1;
12
12
  export const PILOT_SAMPLE_MIN = 10;
13
13
  export const BATCH_SAMPLE_MAX = 30;
@@ -55,6 +55,7 @@ export declare const ONBOARDING_OWN_PLAY_TITLE = "My own play";
55
55
  export declare function onboardingOwnPlayMessage(description: string): string;
56
56
  /** The message a chosen play sends, as the person's own. */
57
57
  export declare function onboardingPlayMessage(play: Pick<OnboardingPlay, "title" | "firstStep" | "page">): string;
58
+ export declare function isPlayGoAhead(message: string): boolean;
58
59
  type ProjectionTurn = {
59
60
  id: string;
60
61
  status: string;
@@ -100,6 +100,19 @@ export function onboardingOwnPlayMessage(description) {
100
100
  export function onboardingPlayMessage(play) {
101
101
  return `${ONBOARDING_PLAY_MESSAGE_PREFIX}${play.title}". Start with: ${play.firstStep}${play.page ? ` (see [[${play.page}]])` : ""}`;
102
102
  }
103
+ /**
104
+ * A short reply that only says "go" (yes, go ahead, continue, do it) while the
105
+ * plays are on screen. Production 2026-10-28: a quarter of onboarding chats
106
+ * answered the plays that way and never picked one, so it picks the
107
+ * recommended (first) play. Anything longer is an ordinary message.
108
+ */
109
+ const GO_AHEAD = new RegExp("^(?:(?:ok(?:ay)?|yes|yeah|yep|yup|sure|go|go ahead|do it|run it|start|continue|contin(?:i)?ue|proceed|let'?s go|sounds good|perfect|great|"
110
+ + "ja|los|mach(?: das)?|weiter|gerne|s[ií]|vale|dale|adelante|oui|vas-y|allez|d'accord|"
111
+ + "please|pls|bitte|por favor|s'il (?:te|vous) pla[iî]t)[\\s,.!]*)+$", "i");
112
+ export function isPlayGoAhead(message) {
113
+ const text = message.trim().replace(/\s+/g, " ");
114
+ return text.length > 0 && text.length <= 40 && GO_AHEAD.test(text);
115
+ }
103
116
  /**
104
117
  * The plays the chat is waiting on, or null: the newest proposal of a completed
105
118
  * turn, until a play is chosen from it, which sends the play's message. Unlike a