@oxygen-agent/cli 1.1014.620 → 1.1014.773

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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/command-manifest.js +15 -0
  3. package/dist/command-support.d.ts +5 -5
  4. package/dist/command-support.js +7 -7
  5. package/dist/commands/billing.js +12 -6
  6. package/dist/commands/columns.js +2 -2
  7. package/dist/commands/companies.js +1 -1
  8. package/dist/commands/copilot.js +1 -1
  9. package/dist/commands/dashboards.js +1 -1
  10. package/dist/commands/enrich-column.js +2 -2
  11. package/dist/commands/find.js +2 -2
  12. package/dist/commands/mailboxes.js +36 -0
  13. package/dist/commands/recipes.js +1 -1
  14. package/dist/commands/sequences.js +6 -6
  15. package/dist/commands/tables.js +1 -1
  16. package/dist/commands/verify.js +112 -11
  17. package/dist/http-client.js +1 -70
  18. package/dist/index.js +1 -1
  19. package/dist/refactor-internals/binary-download.d.ts +5 -0
  20. package/dist/refactor-internals/binary-download.js +71 -0
  21. package/node_modules/@oxygen/formula/dist/evaluate.js +2 -82
  22. package/node_modules/@oxygen/formula/dist/refactor-internals/novelty-score.d.ts +2 -0
  23. package/node_modules/@oxygen/formula/dist/refactor-internals/novelty-score.js +87 -0
  24. package/node_modules/@oxygen/shared/dist/billing.d.ts +15 -3
  25. package/node_modules/@oxygen/shared/dist/billing.js +19 -7
  26. package/node_modules/@oxygen/shared/dist/cancellation-reasons.d.ts +35 -0
  27. package/node_modules/@oxygen/shared/dist/cancellation-reasons.js +21 -0
  28. package/node_modules/@oxygen/shared/dist/capability-discovery.js +27 -1
  29. package/node_modules/@oxygen/shared/dist/contracts/browser-operations.js +6 -6
  30. package/node_modules/@oxygen/shared/dist/contracts/customer-operations.js +1 -1
  31. package/node_modules/@oxygen/shared/dist/contracts/limits-read.js +1 -0
  32. package/node_modules/@oxygen/shared/dist/contracts/teammates.js +41 -17
  33. package/node_modules/@oxygen/shared/dist/email-verification-batch.d.ts +26 -0
  34. package/node_modules/@oxygen/shared/dist/email-verification-batch.js +55 -0
  35. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +3 -3
  36. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +3 -3
  37. package/node_modules/@oxygen/shared/dist/knowledge-brain-draft.d.ts +70 -0
  38. package/node_modules/@oxygen/shared/dist/knowledge-brain-draft.js +42 -0
  39. package/node_modules/@oxygen/shared/dist/linkedin-url.d.ts +8 -0
  40. package/node_modules/@oxygen/shared/dist/linkedin-url.js +10 -0
  41. package/node_modules/@oxygen/shared/dist/plan-capabilities.js +1 -1
  42. package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +1 -1
  43. package/node_modules/@oxygen/shared/dist/pricing-sheet.js +3 -1
  44. package/node_modules/@oxygen/shared/dist/product-doctrine.js +1 -1
  45. package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.d.ts +225 -0
  46. package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.js +578 -0
  47. package/node_modules/@oxygen/shared/dist/sequences.d.ts +1 -226
  48. package/node_modules/@oxygen/shared/dist/sequences.js +2 -576
  49. package/node_modules/@oxygen/shared/dist/teammate-groups.d.ts +103 -24
  50. package/node_modules/@oxygen/shared/dist/teammate-groups.js +125 -32
  51. package/node_modules/@oxygen/shared/dist/teammate-messages.d.ts +1 -1
  52. package/node_modules/@oxygen/shared/dist/teammates.d.ts +28 -2
  53. package/node_modules/@oxygen/shared/dist/teammates.js +32 -2
  54. package/node_modules/@oxygen/shared/dist/user-capability-routing.js +40 -8
  55. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  56. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  57. package/node_modules/@oxygen/workflows/dist/graph/expression.d.ts +1 -16
  58. package/node_modules/@oxygen/workflows/dist/graph/expression.js +4 -224
  59. package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +2 -2
  60. package/node_modules/@oxygen/workflows/dist/index.d.ts +1 -63
  61. package/node_modules/@oxygen/workflows/dist/index.js +1 -193
  62. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.d.ts +18 -0
  63. package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.js +222 -0
  64. package/node_modules/@oxygen/workflows/dist/refactor-internals/execution-policy.d.ts +64 -0
  65. package/node_modules/@oxygen/workflows/dist/refactor-internals/execution-policy.js +204 -0
  66. package/node_modules/@oxygen/workflows/package.json +4 -0
  67. package/package.json +1 -1
@@ -0,0 +1,225 @@
1
+ /**
2
+ * ESP (email service provider) MATCHING mode for a sequence (settings.esp_matching).
3
+ * Deliverability lore: a send lands better when the SENDING mailbox and the
4
+ * RECIPIENT sit on the same provider (Google→Google, Microsoft→Microsoft), so at
5
+ * mailbox-pick the dispatcher can bias rotation toward a same-ESP mailbox.
6
+ * - "off" — no ESP bias; rotation is pure LRU / domain-spread.
7
+ * - "prefer" — (DEFAULT) pick a same-ESP mailbox when one is available, else
8
+ * fall back to any sendable mailbox (never blocks a send). On by default
9
+ * because it only ever improves deliverability and cannot starve sends.
10
+ * - "strict" — require a same-ESP mailbox; when none is available the action is
11
+ * DEFERRED with a visible skipped_reason rather than sent cross-provider.
12
+ * Power-user setting, reachable via CLI/MCP; the web "Provider Matching"
13
+ * checkbox toggles off↔prefer only.
14
+ */
15
+ export declare const ESP_MATCHING_MODES: readonly ["off", "prefer", "strict"];
16
+ export type EspMatchingMode = (typeof ESP_MATCHING_MODES)[number];
17
+ export declare const DEFAULT_ESP_MATCHING_MODE: EspMatchingMode;
18
+ export declare function isEspMatchingMode(value: unknown): value is EspMatchingMode;
19
+ /**
20
+ * Validate settings.esp_matching before persistence. Absent/null is valid and
21
+ * means DEFAULT_ESP_MATCHING_MODE, which is "prefer" — an unset sequence still
22
+ * biases rotation toward a same-provider sender, so a workspace whose senders on
23
+ * one provider are in bad standing concentrates that provider's recipients on
24
+ * them until an operator sets "off". Any other value must be one of the three
25
+ * modes. Pure; throws OxygenError("invalid_sequence_settings") on a bad value so
26
+ * the CLI / MCP / API report an identical error. Called from the tenant-db
27
+ * settings validator alongside the budget/prioritization checks.
28
+ */
29
+ export declare function validateEspMatchingSetting(value: unknown): void;
30
+ /**
31
+ * The MATCHABLE email-provider a recipient routes through — the narrow set ESP
32
+ * matching can act on. Kept intentionally aligned with EMAIL_MAILBOX_PROVIDERS in
33
+ * tenant-db so a mailbox's `provider` and a resolved recipient ESP compare
34
+ * directly: we can only bias rotation toward a provider we can actually SEND
35
+ * from, and the pool is Google/Microsoft only.
36
+ *
37
+ * This is deliberately NARROWER than RECIPIENT_ESP_FAMILIES (what we DISPLAY).
38
+ * A domain behind Proofpoint has family "proofpoint" but may still be matchable
39
+ * as "microsoft" — see resolveEspFamily.
40
+ */
41
+ export declare const RECIPIENT_ESPS: readonly ["google", "microsoft"];
42
+ export type RecipientEsp = (typeof RECIPIENT_ESPS)[number];
43
+ /**
44
+ * WEIGHTED SENDER ROUTING — the object form of settings.esp_matching.
45
+ *
46
+ * The three scalar modes above answer one question ("bias toward the recipient's
47
+ * own provider, yes or no"), and they bake in the assumption that same-provider
48
+ * is always better. That assumption fails whenever one provider's senders are in
49
+ * bad standing: a workspace whose Google-hosted domains are refused by Gmail
50
+ * wants its Google-hosted RECIPIENTS served from Microsoft senders, which no
51
+ * scalar mode can express. "off" does not express it either, because free
52
+ * rotation still hands Google recipients a Google sender in proportion to the
53
+ * pool.
54
+ *
55
+ * So the object form states the routing directly, as SEND SHARES per recipient
56
+ * provider:
57
+ *
58
+ * { mode: "prefer",
59
+ * routes: { google: { microsoft: 100 }, microsoft: { microsoft: 100 } },
60
+ * exclude: [{ domain: "burned.example", from_recipients: ["google"] }] }
61
+ *
62
+ * `routes` is keyed by the RECIPIENT's resolved provider; the inner map is the
63
+ * SENDER provider. Weights are relative shares, so { google: 3, microsoft: 1 }
64
+ * and { google: 75, microsoft: 25 } are the same policy and nothing has to sum
65
+ * to 100. An omitted weight is zero. A bucket whose entry is explicitly present
66
+ * but carries no positive weight means "no opinion, rotate freely for this
67
+ * recipient class"; a bucket the operator never mentioned keeps the historical
68
+ * same-provider default, so editing Google routing cannot silently change how
69
+ * Microsoft recipients are served.
70
+ *
71
+ * `exclude` is a hard never, not a preference: a sender domain listed here is
72
+ * removed from the candidate pool for the named recipient buckets (all buckets
73
+ * when `from_recipients` is absent) in EVERY mode, including "off", and it
74
+ * survives the prefer-fallback. A deliverability guard that a matching toggle
75
+ * could disarm would not be a guard.
76
+ *
77
+ * The scalar modes remain valid values and are read as policies, so there is one
78
+ * routing code path rather than two: "prefer" becomes { mode: "prefer" } with no
79
+ * routes, which resolves to the same-provider default and behaves exactly as it
80
+ * did before.
81
+ */
82
+ export declare const ESP_ROUTE_BUCKETS: readonly ["google", "microsoft", "unknown"];
83
+ /** The RECIPIENT side of a route: a matchable provider, or "unknown" when resolution failed. */
84
+ export type EspRouteBucket = (typeof ESP_ROUTE_BUCKETS)[number];
85
+ /** The SENDER side of a route: relative send shares per mailbox provider. */
86
+ export type EspRouteWeights = Partial<Record<RecipientEsp, number>>;
87
+ export type EspSenderExclusion = {
88
+ domain: string;
89
+ from_recipients?: EspRouteBucket[];
90
+ };
91
+ export type EspRoutingPolicy = {
92
+ mode?: EspMatchingMode;
93
+ routes?: Partial<Record<EspRouteBucket, EspRouteWeights>>;
94
+ exclude?: EspSenderExclusion[];
95
+ };
96
+ /** settings.esp_matching accepts either the legacy scalar or the routing policy. */
97
+ export type EspMatchingSetting = EspMatchingMode | EspRoutingPolicy;
98
+ /**
99
+ * A policy with every field present, which is what the dispatcher and the launch
100
+ * preview consume. Produced only by espPolicyFromSetting so both surfaces answer
101
+ * identically from the same stored value.
102
+ */
103
+ export type ResolvedEspPolicy = {
104
+ mode: EspMatchingMode;
105
+ routes: Partial<Record<EspRouteBucket, EspRouteWeights>>;
106
+ exclude: Array<{
107
+ domain: string;
108
+ buckets: readonly EspRouteBucket[];
109
+ }>;
110
+ };
111
+ /** Cap on settings.esp_matching.exclude — a routing policy, not a suppression list. */
112
+ export declare const MAX_ESP_SENDER_EXCLUSIONS = 50;
113
+ /** Upper bound on a single route weight; relative shares never need more. */
114
+ export declare const MAX_ESP_ROUTE_WEIGHT = 1000000;
115
+ export declare function isEspRouteBucket(value: unknown): value is EspRouteBucket;
116
+ /**
117
+ * A sending domain as the mailbox table stores it: lowercase, no leading "@".
118
+ * Mirrors lower(split_part(email_address, '@', 2)) in pickEmailMailbox so an
119
+ * exclusion the operator typed as "@Burned.Example " still matches.
120
+ */
121
+ export declare function normalizeEspSenderDomain(value: string): string;
122
+ /**
123
+ * LENIENT read of a persisted settings.esp_matching (never throws — a read must
124
+ * not break a send). Absent, null, or malformed reads as the default policy, and
125
+ * a malformed FIELD bails the WHOLE object rather than half-applying a routing
126
+ * policy, which is the readMailboxRampConfig convention in tenant-db. The strict
127
+ * counterpart that guards the write path is validateEspMatchingSetting.
128
+ */
129
+ export declare function espPolicyFromSetting(value: unknown): ResolvedEspPolicy;
130
+ /**
131
+ * The effective send shares for one recipient bucket. An explicitly-present
132
+ * entry wins even when it is empty or all-zero (that is the operator saying
133
+ * "rotate freely here"); a bucket that was never mentioned keeps the historical
134
+ * same-provider default, and "unknown" has no same-provider to default to.
135
+ */
136
+ export declare function espRouteWeightsFor(policy: ResolvedEspPolicy, bucket: EspRouteBucket): EspRouteWeights;
137
+ /**
138
+ * The sender providers to try, best first, for one recipient bucket — a
139
+ * deterministic weighted shuffle WITHOUT replacement.
140
+ *
141
+ * Returning an ORDER rather than a single draw is what makes "prefer" correct:
142
+ * a 90/10 Google policy over a pool holding no Google mailbox must send 100%
143
+ * from Microsoft, not defer and not fall through to provider-blind rotation.
144
+ * An empty result means "no opinion" and the caller rotates freely.
145
+ *
146
+ * Deterministic by construction: the seed carries the enrollment and step, never
147
+ * a clock or Math.random, so a dry-run preview and the later live send choose
148
+ * the same provider, and a replan after a defer re-derives the same route.
149
+ * Candidates are enumerated in RECIPIENT_ESPS order rather than object-key
150
+ * order, because jsonb does not preserve key order and a policy that round-trips
151
+ * through the database must not reroute the fleet.
152
+ */
153
+ export declare function espRouteCandidates(input: {
154
+ policy: ResolvedEspPolicy;
155
+ recipient: EspRouteBucket;
156
+ seed: string;
157
+ }): RecipientEsp[];
158
+ /**
159
+ * Sending domains that must not serve this recipient bucket, normalized and
160
+ * de-duplicated for pickEmailMailbox. Applies in every mode and survives the
161
+ * prefer-fallback — see the exclude contract above.
162
+ */
163
+ export declare function espExcludedSenderDomains(policy: ResolvedEspPolicy, bucket: EspRouteBucket): string[];
164
+ /**
165
+ * The DISPLAY taxonomy: the mail-infrastructure family a recipient domain sits
166
+ * on. Wider than RecipientEsp because "everything that isn't Google or Microsoft"
167
+ * is not one thing — a list that is 23% Proofpoint is a very different
168
+ * deliverability problem from one that is 23% self-hosted, and collapsing both to
169
+ * null (today's behavior) hides that. Split into three groups:
170
+ *
171
+ * - MAILBOX providers (google, microsoft) — imply a matchable ESP.
172
+ * - GATEWAY vendors (proofpoint, mimecast, ...) — security filters that sit IN
173
+ * FRONT of a mailbox provider. Their MX tells you the filter, NOT where the
174
+ * mailbox lives; the SPF fallback is what sees behind them.
175
+ * - OTHER mailbox hosts (zoho, yahoo, fastmail, ...) and self_hosted — real
176
+ * destinations we simply cannot send as, so never matchable.
177
+ */
178
+ export declare const RECIPIENT_ESP_FAMILIES: readonly ["google", "microsoft", "proofpoint", "mimecast", "barracuda", "cisco", "zscaler", "trendmicro", "sophos", "zoho", "yahoo", "apple", "proton", "fastmail", "gmx", "amazon", "self_hosted"];
179
+ export type RecipientEspFamily = (typeof RECIPIENT_ESP_FAMILIES)[number];
180
+ export declare function isRecipientEspFamily(value: unknown): value is RecipientEspFamily;
181
+ export declare function isEspGatewayFamily(family: RecipientEspFamily | null | undefined): boolean;
182
+ /**
183
+ * The matchable ESP a display family implies, or null when the family is a
184
+ * gateway (unknown until SPF) or a provider we cannot send as. The ONLY place
185
+ * family → esp is decided, so display and matching can't drift.
186
+ */
187
+ export declare function matchableEspFromFamily(family: RecipientEspFamily | null | undefined): RecipientEsp | null;
188
+ /**
189
+ * Map a domain's resolved MX exchange hostnames to a DISPLAY family. Returns null
190
+ * when no host matches any known vendor — the caller records that as
191
+ * "self_hosted" only once it is sure the lookup itself succeeded (an empty/failed
192
+ * answer is "unknown", which is a different fact).
193
+ */
194
+ export declare function familyFromMxHosts(hosts: readonly string[] | null | undefined): RecipientEspFamily | null;
195
+ /**
196
+ * Resolve the matchable ESP from a domain's TXT records by reading its SPF
197
+ * mechanisms. Scans every `v=spf1` record's include:/redirect= targets.
198
+ *
199
+ * AMBIGUITY IS NOT GUESSED: a domain mid-migration (or running Workspace
200
+ * alongside an Office tenant) can include BOTH vendors. Returning either one
201
+ * would be a coin flip that strict matching then acts on, so a both-match
202
+ * degrades to null ("unknown") and the caller falls back / defers honestly.
203
+ */
204
+ export declare function espFromSpfRecords(records: readonly string[] | null | undefined): RecipientEsp | null;
205
+ /**
206
+ * Infer a recipient's DISPLAY family from its domain string alone,
207
+ * DETERMINISTICALLY, for the well-known consumer/freemail domains. Returns null
208
+ * for any other domain — the caller then resolves via the cached MX (+ SPF)
209
+ * lookup, because a custom domain fronted by Workspace / M365 / a gateway is not
210
+ * decidable from the string. Pure: the single source of truth for the map.
211
+ */
212
+ export declare function inferRecipientEspFamily(domain: string | null | undefined): RecipientEspFamily | null;
213
+ /**
214
+ * Infer a recipient's MATCHABLE ESP from its domain string. Narrow by design:
215
+ * only the Google/Microsoft consumer domains resolve here, everything else
216
+ * (including yahoo/proton/icloud, which are real but unsendable-as) is null.
217
+ * Unchanged contract — the dispatcher's fast path still calls this.
218
+ */
219
+ export declare function inferRecipientEsp(domain: string | null | undefined): RecipientEsp | null;
220
+ /**
221
+ * Back-compat narrow view of familyFromMxHosts: MX hosts → matchable ESP. Now
222
+ * derived from the family table so the two can't drift, and gateway MX hosts
223
+ * correctly yield null here (they need the SPF signal to become matchable).
224
+ */
225
+ export declare function espFromMxHosts(hosts: readonly string[] | null | undefined): RecipientEsp | null;