@oxygen-agent/cli 1.1037.21 → 1.1038.33

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/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.1037.21
37
+ Version: 1.1038.33
@@ -84,7 +84,7 @@ function writeManagedProviderAvailabilityNotice(data) {
84
84
  export function emitCliFailure(command, error) {
85
85
  recordCliDiagnosticFailure(error);
86
86
  writeJson(toFailure(command, error));
87
- writeMaxCreditsHint(error);
87
+ writeMaxCreditsHint(error, command);
88
88
  process.exitCode = error instanceof OxygenError ? exitCodeForOxygenError(error) : 1;
89
89
  }
90
90
  function writeDryRunNotice(data) {
@@ -161,9 +161,15 @@ export function writeBillingNotices(command, data) {
161
161
  return;
162
162
  const count = typeof unpaid.count === "number" ? unpaid.count : 0;
163
163
  const credits = typeof unpaid.credits_required === "number" ? unpaid.credits_required : 0;
164
+ // A renewal the workspace's own budget cap holds is not cleared by a top-up (T-437).
165
+ const heldByCap = asPayloadRecord(unpaid.held_by_budget_cap);
166
+ const held = typeof heldByCap?.count === "number" ? heldByCap.count : 0;
167
+ const next = held > 0
168
+ ? `A budget cap holds ${held >= count ? "them" : `${held} of them`}, which a top-up does not clear; run \`oxygen billing balance\` for what does.`
169
+ : "Run `oxygen billing balance` for the top-up amount.";
164
170
  // Said explicitly because it is the one number in this command that is NOT part of the
165
171
  // pool: it is money the biller could not take, so it is not in total_credits.
166
- process.stderr.write(`! renewals unpaid: ${count} item${count === 1 ? "" : "s"}, ${credits.toLocaleString("en-US")} credits — not included in total_credits. Run \`oxygen billing balance\` for the top-up amount.\n`);
172
+ process.stderr.write(`! renewals unpaid: ${count} item${count === 1 ? "" : "s"}, ${credits.toLocaleString("en-US")} credits — not included in total_credits. ${next}\n`);
167
173
  return;
168
174
  }
169
175
  if (command === "domains list") {
@@ -256,8 +262,9 @@ function writeMailboxRampNotice(data) {
256
262
  // (max_credits_required, approval_required, spend_cap_required,
257
263
  // spend_cap_too_low). Surface each as a one-line stderr hint with the concrete
258
264
  // re-run flags so users don't have to dig values out of the JSON envelope
259
- // (stderr keeps --json stdout machine-clean).
260
- function writeMaxCreditsHint(error) {
265
+ // (stderr keeps --json stdout machine-clean). `command` is the failing leaf
266
+ // (`search run`), for the gates whose flags differ by command.
267
+ function writeMaxCreditsHint(error, command) {
261
268
  if (!(error instanceof OxygenError))
262
269
  return;
263
270
  switch (error.code) {
@@ -366,6 +373,15 @@ function writeMaxCreditsHint(error) {
366
373
  process.stderr.write("hint: inspect the preview, then re-run with --yes to approve the permanent deletion\n");
367
374
  return;
368
375
  }
376
+ // `search run` refuses a paid live route without max_credits under this
377
+ // code, but it has no --approved flag: the ceiling is its whole gate
378
+ // (assertLiveSearchRunAllowed), and Commander rejects --approved as an
379
+ // unknown option, so the generic hint below would send the user to a
380
+ // flag that fails (OXP-3.4.214).
381
+ if (command === "search run") {
382
+ process.stderr.write("hint: search run takes no --approved; re-run with --max-credits <n> at or above the dry run's estimated_total_credits\n");
383
+ return;
384
+ }
369
385
  const estimated = readDetailsNumber(error.details, "estimated_credits");
370
386
  process.stderr.write(`hint: inspect the dry run, then re-run with --approved --max-credits <n>${estimated !== null ? ` (estimated ~${estimated} credits)` : ""}\n`);
371
387
  return;
@@ -94,7 +94,7 @@ export function registerBillingFamily(program, handleAsyncAction, billingDocsUrl
94
94
  }));
95
95
  }))
96
96
  .addCommand(new Command("balance")
97
- .description("May apply due plan grants or credit expiry. Compare all six subscription sizes in `available_plans`: monthly prices, full upfront yearly prices, credit allowances and savings. `annual_billing_available` says whether yearly billing is offered; deprecated `annual_monthly_billing_available` is false for new purchases. `annual_terms` explains upfront payment, monthly credits and plan-change timing. `first_month_offer` is the first-month offer this workspace can still claim: every size it applies to (`plans`, from `minimum_plan` up) with its first-month and regular price before tax, `default_plan` (the size the web proposes while the offer runs; propose it unless the human names another), and `ends_at`, null until its 24-hour window starts. The window starts the first time the workspace meets the offer: the app showing it, signup from a browser that saw it on the website, or creating its Checkout with `billing change`. Also show the current plan, commitment, subscription entitlement, and managed credit balance: available and reserved credits, FIXED credits committed to recurring per-resource charges, and the FLEXIBLE free-to-spend remainder. `next_renewal` answers \"will I be charged?\": read `will_charge` first — true only when this workspace's own Stripe plan is going to charge its card, in which case `charge_at` and the subscription's recurring amount in money say when and roughly how much (the exact amount, with any promotion code or tax, is on the invoice); `period_ends_at` is the trial or period end either way, `cancellation_scheduled` says whether a cancellation is already set, and `stop_command` names the one command that changes it (`billing cancel`, undone by `billing resume`) or is null when nothing here can stop it (staff-invoiced, billed through another workspace, not active). `billing_interval` is payment cadence. New yearly plans charge the full year upfront; `commitment` identifies existing yearly installment contracts and is null for monthly and prepaid yearly plans. Credits are granted monthly; `next_credit_grant_at` is the next grant. For an existing yearly installment commitment, cancellation stops annual renewal but remaining monthly payments continue until commitment.ends_at. `renewals_past_due` lists infrastructure renewals (managed-inbox domains, warm-ups) OXYGEN could NOT charge this month, what they cost, and the exact top-up that clears them — nothing is cancelled and billing retries automatically after a top-up. `warnings` also flags a recurring_shortfall when your connected infrastructure costs more per month than the plan grants. `partner_bonus` says whether this workspace earns the agency partner bonus (+15% credits a month for a published directory partner on $99 or above), how many credits, and why not when it does not; the bonus arrives as its own ledger line (`billing usage --category partner_bonus`), never inside plan.monthly_credits. Its basis is the plan face value; `first_grant_timing` explains unknown processing time separately from the next scheduled grant. PARTNERS2026 ends on cancellation or effective plan change; `partner_bonus.conditions` and `coupon_authority` describe the separate prospective exclusion when it applies. See the agency-partner-bonus section of the billing policy. A workspace linked to another organization (`orgs billing-link`) reads its billing at that owner: the balance is the owner's pool, `shared_billing` is true and `billing_owner_organization_id` names the owner. After failed-payment grace expires, mutations stop while read/export and billing recovery remain available. Recovery: " + oxygenAppUrl(defaultApiUrl(), "/billing") + ". Policy: " + billingDocsUrl + ". 0 credits; reserves nothing.")
97
+ .description("May apply due plan grants or credit expiry. Compare all six subscription sizes in `available_plans`: monthly prices, full upfront yearly prices, credit allowances and savings. `annual_billing_available` says whether yearly billing is offered; deprecated `annual_monthly_billing_available` is false for new purchases. `annual_terms` explains upfront payment, monthly credits and plan-change timing. `first_month_offer` is the first-month offer this workspace can still claim: every size it applies to (`plans`, from `minimum_plan` up) with its first-month and regular price before tax, `default_plan` (the size the web proposes while the offer runs; propose it unless the human names another), and `ends_at`, null until its 24-hour window starts. The window starts the first time the workspace meets the offer: the app showing it, signup from a browser that saw it on the website, or creating its Checkout with `billing change`. Also show the current plan, commitment, subscription entitlement, and managed credit balance: available and reserved credits, FIXED credits committed to recurring per-resource charges, and the FLEXIBLE free-to-spend remainder. `next_renewal` answers \"will I be charged?\": read `will_charge` first — true only when this workspace's own Stripe plan is going to charge its card, in which case `charge_at` and the subscription's recurring amount in money say when and roughly how much (the exact amount, with any promotion code or tax, is on the invoice); `period_ends_at` is the trial or period end either way, `cancellation_scheduled` says whether a cancellation is already set, and `stop_command` names the one command that changes it (`billing cancel`, undone by `billing resume`) or is null when nothing here can stop it (staff-invoiced, billed through another workspace, not active). `billing_interval` is payment cadence. New yearly plans charge the full year upfront; `commitment` identifies existing yearly installment contracts and is null for monthly and prepaid yearly plans. Credits are granted monthly; `next_credit_grant_at` is the next grant. For an existing yearly installment commitment, cancellation stops annual renewal but remaining monthly payments continue until commitment.ends_at. `renewals_past_due` lists infrastructure renewals (managed-inbox domains, warm-ups) OXYGEN could NOT charge this month, what they cost, and the exact top-up that clears them — nothing is cancelled and billing retries automatically after a top-up. Its `budget_cap_hold` counts renewals your own budget cap holds instead: a top-up does not clear those, and its `cli` raises the cap. `warnings` also flags a recurring_shortfall when your connected infrastructure costs more per month than the plan grants. `partner_bonus` says whether this workspace earns the agency partner bonus (+15% credits a month for a published directory partner on $99 or above), how many credits, and why not when it does not; the bonus arrives as its own ledger line (`billing usage --category partner_bonus`), never inside plan.monthly_credits. Its basis is the plan face value; `first_grant_timing` explains unknown processing time separately from the next scheduled grant. PARTNERS2026 ends on cancellation or effective plan change; `partner_bonus.conditions` and `coupon_authority` describe the separate prospective exclusion when it applies. See the agency-partner-bonus section of the billing policy. A workspace linked to another organization (`orgs billing-link`) reads its billing at that owner: the balance is the owner's pool, `shared_billing` is true and `billing_owner_organization_id` names the owner. After failed-payment grace expires, mutations stop while read/export and billing recovery remain available. Recovery: " + oxygenAppUrl(defaultApiUrl(), "/billing") + ". Policy: " + billingDocsUrl + ". 0 credits; reserves nothing.")
98
98
  .option("--json", "Print a JSON envelope.")
99
99
  .action(async (options) => {
100
100
  await handleAsyncAction("billing balance", options, () => requestOxygen("/api/cli/billing/balance"));
@@ -39,7 +39,7 @@ export function registerInboxFamily(program, handleAsyncAction) {
39
39
  .option("--search <text>", "Fuzzy search (typos, word order, prefixes) over names, addresses, subjects and the text of every message in EVERY non-warmup conversation: all channels unless --channel narrows, archived and sent-only threads included. --segment, --unanswered and the Primary tab's negative-tier exclusion are ignored while set; explicit facets such as --status still narrow. For structured filters use --status or --tag, not a text search.")
40
40
  .option("--include-archived", "Include archived conversations.")
41
41
  .option("--limit <n>", "Maximum conversations to return (1-200). Defaults to 50.")
42
- .option("--cursor <cursor>", "Merged stream only: the previous page's next_cursor — resumes after that row.")
42
+ .option("--cursor <cursor>", "The previous page's next_cursor — resumes after that row.")
43
43
  .option("--no-counts", "channel=all only: skip the sidebar facet counts for a faster paged read (total_conversations/unread_conversations/sidebar_counts omitted from the envelope). Other channels ignore it.")
44
44
  .option("--json", "Print a JSON envelope.")
45
45
  .action(async (options) => {
@@ -141,9 +141,10 @@ function readPublishingFirstComment(options) {
141
141
  return text;
142
142
  }
143
143
  /**
144
- * The X flags as content keys (see the API's X content contract). On update they
145
- * become a `content_merge` so the rest of the stored content is kept; there
146
- * `--reply-settings everyone` removes the key.
144
+ * The X flags and `--trial-reel` (Instagram) as content keys (see the API's
145
+ * content contracts). On update they become a `content_merge` so the rest of the
146
+ * stored content is kept; there `--reply-settings everyone` and
147
+ * `--trial-reel off` remove their keys.
147
148
  */
148
149
  function buildPublishingXContent(options, mode) {
149
150
  const content = {};
@@ -190,6 +191,15 @@ function buildPublishingXContent(options, mode) {
190
191
  const photoTags = (options.photoTag ?? []).map((name) => name.trim().replace(/^@/, "")).filter(Boolean);
191
192
  if (photoTags.length > 0)
192
193
  content.media_tagged_usernames = photoTags;
194
+ const trialReel = readOption(options.trialReel)?.toLowerCase();
195
+ if (trialReel) {
196
+ const strategies = { manual: "MANUAL", auto: "SS_PERFORMANCE", off: null };
197
+ if (!Object.hasOwn(strategies, trialReel) || (trialReel === "off" && !mode.forMerge)) {
198
+ throw new OxygenError("invalid_request", mode.forMerge ? "--trial-reel must be manual, auto, or off." : "--trial-reel must be manual or auto.", { exitCode: 2 });
199
+ }
200
+ const strategy = strategies[trialReel];
201
+ content.trial_params = strategy ? { graduation_strategy: strategy } : null;
202
+ }
193
203
  return Object.keys(content).length > 0 ? content : null;
194
204
  }
195
205
  /** `key=value` pairs from a repeatable flag; the value may itself contain `=`. */
@@ -859,6 +869,7 @@ export function registerPublishingFamily(program, handleAsyncAction) {
859
869
  .option("--poll-option <text>", "X: a poll option on the first post (2-4 options, 25 characters each). Repeatable.", collectRepeatable, [])
860
870
  .option("--poll-duration <duration>", "X: how long the poll runs, e.g. 30m, 6h, 2d (5 minutes to 7 days; default 1d).")
861
871
  .option("--reply-settings <who>", "X: who can reply: everyone, following, mentioned, or subscribers.")
872
+ .option("--trial-reel <graduation>", "Instagram Reel: publish it as a trial Reel, shown to non-followers first. manual: you share it to followers in the Instagram app; auto: Instagram shares it when it performs well. Needs the Reel's video first in --media.")
862
873
  .option("--alt-text <media_id=text>", "X: image or GIF description for screen readers (up to 1,000 characters). Repeatable.", collectRepeatable, [])
863
874
  .option("--photo-tag <username>", "X: tag an account in the first post's images (up to 10). Repeatable.", collectRepeatable, [])
864
875
  .option("--video-thumbnail <media_id>", "Video cover for a LinkedIn video, Instagram Reel or YouTube video: an uploaded media id (`publishing media upload`); JPEG or PNG on LinkedIn, a JPEG up to 8 MB on Instagram, a JPEG or PNG up to 2 MB on YouTube. Needs a video in media_asset_ids (first on Instagram and YouTube).")
@@ -903,6 +914,7 @@ export function registerPublishingFamily(program, handleAsyncAction) {
903
914
  .option("--poll-option <text>", "X: a poll option on the first post (2-4 options, 25 characters each). Repeatable.", collectRepeatable, [])
904
915
  .option("--poll-duration <duration>", "X: how long the poll runs, e.g. 30m, 6h, 2d (5 minutes to 7 days; default 1d).")
905
916
  .option("--reply-settings <who>", "X: who can reply: everyone, following, mentioned, or subscribers.")
917
+ .option("--trial-reel <graduation>", "Instagram Reel: manual or auto makes it a trial Reel, shown to non-followers first (manual: you share it to followers in the Instagram app; auto: Instagram shares it when it performs well); off makes it a normal Reel. Revokes approval on an approved post.")
906
918
  .option("--alt-text <media_id=text>", "X: image or GIF description for screen readers (up to 1,000 characters). Repeatable.", collectRepeatable, [])
907
919
  .option("--photo-tag <username>", "X: tag an account in the first post's images (up to 10). Repeatable.", collectRepeatable, [])
908
920
  .option("--content-merge-json <json>", "Merge content keys; null removes a key, e.g. '{\"poll\":null}'. Arrays, including mention_previews, are replaced whole: carry every entry you want to keep.")
@@ -73,6 +73,18 @@ export declare function crmSampleRecordRecommendation(query: string): {
73
73
  commands: string[];
74
74
  execution: string;
75
75
  } | null;
76
+ /**
77
+ * Deleting a CRM record is a row delete on its object's backing Table. Without
78
+ * this, "delete crm records" got the search/get gateways and command search
79
+ * left out `tables delete-rows` (not a crm command), so every discovery path
80
+ * answered as though records could not be deleted (Plain T-428). It answers
81
+ * only on the Records card, so asks other owners route keep their card.
82
+ */
83
+ export declare function crmRecordDeletionRecommendation(query: string): {
84
+ tools: string[];
85
+ commands: string[];
86
+ execution: string;
87
+ } | null;
76
88
  /** Inventory reads select existing Table fields and retain honest sample totals. */
77
89
  export declare function crmInventoryRecommendation(query: string): {
78
90
  tools: string[];
@@ -208,15 +208,156 @@ export function crmSampleRecordRecommendation(query) {
208
208
  const sample = (/\bsamples?\b/.test(query) && (/^samples?$/.test(query) || record.test(query) || /\b(data|pipeline|crm)\b/.test(query)))
209
209
  || /\b(?:seed(?:ed)?|demo|example) (?:data|records?)\b/.test(query)
210
210
  || /\bseeded (?:deals?|compan(?:y|ies)|contacts?|people|persons?|accounts?|pipeline)\b/.test(query)
211
- || /\b(?:dummy|placeholder|fake) (?:data|records?|deals?|compan(?:y|ies)|contacts?|people|persons?|accounts?)\b/.test(query);
211
+ || /\b(?:dummy|placeholder|fake) (?:data|records?|deals?|compan(?:y|ies)|contacts?|people|persons?|accounts?)\b/.test(query)
212
+ || REMOVES_SAMPLES_ALONE.test(query)
213
+ || REMOVES_SAMPLE_LEADS.test(query)
214
+ || (SAMPLE_PEOPLE.test(query) && removesDoNotContact(query));
212
215
  if (!named && (slice || (!asReal && !sample)))
213
216
  return null;
217
+ // Plain T-428 (2026-11-10): "remove all sample records" got this keep card,
218
+ // so a founder clearing the samples before real leads concluded nothing
219
+ // deletes them. Only a removal whose object is the samples themselves
220
+ // counts, even beside `crm keep` ("we found crm keep but no delete");
221
+ // removing something from or on a sample, a sample's marker, samples from a
222
+ // total, and a negated or keep ask stay here.
223
+ const markerEdit = /\bsamples?\s+(?:flags?|markers?|marks?|markings?|labels?|badges?|status(?:es)?|state|tags?|indicators?|designations?)\b/.test(query);
224
+ const keeps = asReal || markerEdit || negatesRemoval(query) || HYGIENE.test(query);
225
+ const records = !keeps && removalOf(query, SAMPLE_REMOVAL, SAMPLE_MODIFIER, String.raw `(?:${RECORD_NOUN}|data|samples?)`);
226
+ // "…but keep the do-not-contact entries" keeps them.
227
+ const doNotContact = !keeps && !KEEPS_DO_NOT_CONTACT.test(query.replace(/\b(?:crm|record) keep\b/g, "")) && removesDoNotContact(query);
228
+ if (records)
229
+ return doNotContact ? CRM_SAMPLE_REMOVAL_WITH_DNC : CRM_SAMPLE_REMOVAL;
230
+ if (doNotContact)
231
+ return CRM_SAMPLE_DNC_REMOVAL;
214
232
  return {
215
233
  tools: ["oxygen_crm_record_keep", "oxygen_crm_pipeline", "oxygen_crm_record_search", "oxygen_crm_record_get"],
216
234
  commands: ["crm keep", "crm pipeline", "crm search", "crm get"],
217
235
  execution: "A new workspace's seeded companies, CEOs and deals read _sample: true (sample: true on suggest hits and crm pipeline deals); pipeline, dashboard and chart totals leave them out and say how many. Keep one as real only when the user says it is: crm keep <object> <record> takes a row id or an identity such as stripe.com. It is free and idempotent, has no undo, and keeps that record alone: a kept deal's company and contact stay samples until each is kept. MCP runs oxygen_crm_record_keep through oxygen_capabilities_call.",
218
236
  };
219
237
  }
238
+ /*
239
+ * Record removal (Plain T-428). A removal counts only when its object is the
240
+ * records themselves: between the verb and the record noun stand determiners
241
+ * and qualities, never another noun; the noun ends its phrase ("the deal
242
+ * stage", "the sample people's photos" name a field); and the rest of its
243
+ * clause does not make them part of something else ("as the primary contact",
244
+ * "on this deal", "in my pipeline report", "of my calls", "from my newsletter
245
+ * list"). Only the CRM itself may follow "from" or "in".
246
+ */
247
+ // Present and -ing forms only: "the deleted sample people" describes, it does not ask.
248
+ const REMOVAL = String.raw `(?:delet(?:e|es|ing)|remov(?:e|es|ing)|eras(?:e|es|ing)|purg(?:e|es|ing)|wip(?:e|es|ing)|get(?:ting)? rid of)`;
249
+ // Beside records "clean up" and "clear" are data hygiene ("clean up my contacts",
250
+ // "clear the record"); beside the samples they, and blunter verbs, remove.
251
+ const SAMPLE_REMOVAL = String.raw `(?:${REMOVAL}|clear(?:s|ing)?|clean(?:s|ing)? (?:up|out)|cleanup|drop(?:s|ping)?|discard(?:s|ing)?|trash(?:es|ing)?|nuk(?:e|es|ing))`;
252
+ const RECORD_MODIFIER = String.raw `(?:the|a|an|all|of|these|those|this|that|my|our|some|every|each|any|both|\d+|old|older|stale|test|unused|inactive|junk|bad|empty|blank|wrong|outdated|unwanted|lost|closed|won|archived|existing|remaining|imported|selected|other|crm)`;
253
+ const SAMPLE_MODIFIER = String.raw `(?:${RECORD_MODIFIER}|samples?|seed(?:ed)?|demo|example|dummy|placeholder|fake|default|starter)`;
254
+ const RECORD_WORD = String.raw `(?:compan(?:y|ies)|people|persons?|contacts?|leads?|deals?|accounts?|opportunit(?:y|ies)|ceos?)`;
255
+ const RECORD_NOUN = String.raw `(?:${RECORD_WORD}(?:\s+(?:records?|rows?))?|records?|rows?)`;
256
+ const CLAUSE_END = /[,;.!?()]/;
257
+ // What may follow the removed records without changing what they are.
258
+ const PHRASE_CONTINUES = /^(?:from|in|inside|on|at|that|which|who|whose|with|without|where|we|i|you|they|for|before|after|so|and|or|but|now|too|please|again|entirely|completely|permanently|forever|first|then|altogether|instead|via|using|through|by|once|if|when|to|including|plus|along|together|except|excluding)\b/;
259
+ const CONTAINER = String.raw `(?:${RECORD_WORD}|records?|pipelines?|forecasts?|hold|reports?|dashboards?|boards?|lists?|views?|tables?|charts?|widgets?|totals?|counts?|segments?|audiences?|campaigns?|sequences?|programs?|queues?|tests?|inbox(?:es)?|wiki|knowledge|voice|profiles?|graphs?|calls?|meetings?|transcripts?|recordings?|conversations?|messages?|signals?|runs?|workflows?|agents?|newsletters?|drips?|outreach|cadences?)`;
260
+ const PART_OF_SOMETHING_ELSE = new RegExp(String.raw `^(?:as|of)\b|^(?:on|in|for|with|to|at|inside|within|under|between)\s+(?:(?:the|this|that|these|those|a|an|my|our|your|its|their|his|her|each|every)\s+)?(?:[\w'-]+\s+){0,2}?${CONTAINER}\b`);
261
+ // "the contact that is linked to this deal" names a link, not a record to delete.
262
+ const RELATIVE_LINK = new RegExp(String.raw `^(?:that|which|who|whose|where)\b.*\b(?:${RECORD_WORD}|linked|assigned|associated|attached|connected|related|primary|roles?|champions?|stakeholders?)\b`);
263
+ const FROM_THE_CRM = /^from\s+(?:(?:the|my|our|this|your)\s+)?(?:crm|oxygen|workspace)(?:\s*$|\s+(?:before|after|so|and|but|because|since|then|now|too|please|entirely|completely|permanently|for|to|if|when|without|with)\b)/;
264
+ const REMOVES_WHOLE_CRM = /\b(?:wip(?:e|es|ing)|purg(?:e|es|ing)|empty(?:ing)?|clean(?:s|ing)? out|clear(?:s|ing)? out)\s+(?:(?:the|my|our|whole|entire)\s+){0,2}crm\s*[?.!]*\s*$/;
265
+ const NAMES_RECORD_DELETION = /\b(?:crm\s+)?records?\s+(?:delete|deletion|removal)\b|\bcrm\s+(?:delete|deletion)\s*[?.!]*\s*$/;
266
+ // "delete the samples" alone; with more words, "samples" may be another owner's.
267
+ const REMOVES_SAMPLES_ALONE = new RegExp(String.raw `\b${SAMPLE_REMOVAL}\s+(?:${RECORD_MODIFIER}\s+){0,3}samples?\s*[?.!]*\s*$`);
268
+ const REMOVES_SAMPLE_LEADS = new RegExp(String.raw `\b${SAMPLE_REMOVAL}\s+(?:${RECORD_MODIFIER}\s+){0,3}samples?\s+leads?\s*[?.!]*\s*$`);
269
+ // Fixing records is not removing them.
270
+ const HYGIENE = /\b(?:fix\w*|standardi[sz]\w*|normali[sz]\w*|consistent|realistic|tidy\w*|reformat\w*|correct\w*|renam\w*|updat\w*|edit\w*)\b/;
271
+ // A person who opted out needs a do-not-contact entry, not a delete: the
272
+ // delete leaves their enrollments and lets a re-import recreate them. Any
273
+ // reason about the person ("…, they asked to be removed", "because she
274
+ // retired", "the lead requested no further contact") is that kind of ask, so
275
+ // it is read structurally rather than phrase by phrase; "it" reasons ("delete
276
+ // the deal, it was a mistake") still pass.
277
+ const REASON_VERB = String.raw `(?:ask\w*|request\w*|wants?|wanted|demand\w*|said|says|told|tell\w*|report\w*|withdr\w*|revok\w*|threat\w*|complain\w*|opt\w*|unsubscrib\w*|repl\w*|respond\w*|no longer|retir\w*|pass\w*|left|moved|died|object\w*|refus\w*|su(?:e|es|ed|ing))`;
278
+ const PERSON_REASON = new RegExp([
279
+ // ", they …", "because she …"
280
+ String.raw `(?:[,;:]|\b(?:because|since|as|cause)\b)\s*(?:they|he|she|them|him|her)\b`,
281
+ // "the lead asked …", "these contacts requested …"
282
+ String.raw `\b(?:they|he|she|(?:the|this|these|those|our|my)\s+(?:\w+\s+){0,2}?(?:persons?|people|contacts?|leads?|prospects?|customers?|recipients?))\s+(?:\w+\s+){0,3}?${REASON_VERB}\b`,
283
+ // "the contacts who asked to be removed", "leads that told us to stop"
284
+ String.raw `\b(?:who|whom|that|which)\s+(?:\w+\s+){0,3}?${REASON_VERB}\b`,
285
+ // "remove the contact; asked to be removed", ", per request" (not "…: we want")
286
+ String.raw `[,;:]\s*(?!(?:we|i|i'm|we're|our|my|us|please)\b)(?:\w+\s+){0,2}?${REASON_VERB}\b`,
287
+ ].join("|"));
288
+ const OPT_OUT_WORDS = /\b(?:spam|consent|cease|desist|legal|lawyers?|attorneys?|lawsuits?|litigation|subpoena\w*|removal requests?|take (?:\w+\s+){0,2}off|no further|reach(?:ing)? out|back off|do not reach|deceased|passed away|died|retired|no longer work\w*|no longer (?:at|with))\b/;
289
+ const OPT_OUT = /\b(?:contacted|opt(?:ed|ing)? ?outs?|never (?:contact|email|message|reach)\w*|remove me|said stop|asked (?:\w+\s+){0,3}(?:to stop|not to|never)|stop (?:contacting|emailing|messaging|reaching)|complain\w*|hear from us|don'?t want|doesn'?t want|do not want|does not want|no longer want|unsubscrib\w*)\b/;
290
+ // Who may delete, when to delete, and where else records live are other owners' asks.
291
+ const NOT_A_RECORD_DELETE = /\b(?:who can|can (?:a|my|our) (?:teammate|member|user|colleague)s?|admins?|permissions?|prevent\w*|restrict\w*|allowed to|csv|spreadsheets?|sheets?|xlsx|excel|apollo|gmail|outlook|google|sandbox|airtable|clay|moved|left|joined|changed (?:jobs?|compan(?:y|ies))|new (?:job|company|role)|automatically|whenever|every time|each time)\b|\b(?:when|once|as soon as)\s+(?:the|a|an|it|they|its|their|this|that)\b/;
292
+ const NEGATED_REMOVAL = new RegExp(String.raw `\b(?:do not|don't|dont|never|not|no need to|avoid|without|instead of|rather than|shouldn't|mustn't|stop|hold off(?: on)?|under no circumstances|wait (?:before|to|until)|refrain from|hate to|afraid to|scared to|reluctant to|hesitant to)\s+(?:\w+\s+){0,2}?${SAMPLE_REMOVAL}`);
293
+ // The seed's do-not-contact entries belong to sample PEOPLE; "sample emails" or a
294
+ // "sample domain" on a blocklist are another owner's.
295
+ const SAMPLE_PEOPLE = /\bsamples?(?:'s|')?\s+(?:people|persons?|ceos?|contacts?|leads?|linkedin|profiles?|suppressions?|do not contact|dnc|entries)\b/;
296
+ const DO_NOT_CONTACT = String.raw `(?:do not contact|dnc|suppressions?|suppressed|block ?lists?|opt ?outs?)`;
297
+ // "keep …" before the do-not-contact words in its sentence keeps them.
298
+ const KEEPS_DO_NOT_CONTACT = new RegExp(String.raw `\bkeep\w*\b[^.!?]*?\b${DO_NOT_CONTACT}\b`);
299
+ // The removal reaches the do-not-contact words in its own clause, unhedged.
300
+ const REMOVES_DO_NOT_CONTACT = new RegExp(String.raw `\b${SAMPLE_REMOVAL}\b(?:(?!\b(?:but|except|keep\w*|leave|leaving|not)\b)[^,;.!?]){0,80}?\b${DO_NOT_CONTACT}\b|\bunsuppress\w*\b`);
301
+ /** Whether a removal verb takes these records as its object (see above). */
302
+ function removalOf(query, verb, modifier, noun) {
303
+ for (const match of query.matchAll(new RegExp(String.raw `\b${verb}\s+(?:${modifier}\s+){0,5}${noun}\b`, "g"))) {
304
+ const rest = query.slice((match.index ?? 0) + match[0].length);
305
+ if (rest && !/^\s/.test(rest) && !CLAUSE_END.test(rest[0] ?? ""))
306
+ continue;
307
+ const clause = (rest.split(CLAUSE_END)[0] ?? "").trim();
308
+ if (!clause)
309
+ return true;
310
+ if (!PHRASE_CONTINUES.test(clause) || PART_OF_SOMETHING_ELSE.test(clause) || RELATIVE_LINK.test(clause))
311
+ continue;
312
+ if (/^from\b/.test(clause) && !FROM_THE_CRM.test(clause))
313
+ continue;
314
+ return true;
315
+ }
316
+ return false;
317
+ }
318
+ function negatesRemoval(query) {
319
+ return NEGATED_REMOVAL.test(query);
320
+ }
321
+ function removesDoNotContact(query) {
322
+ return REMOVES_DO_NOT_CONTACT.test(query);
323
+ }
324
+ const SAMPLE_DNC_GUARD = "The seed also put each sample person's LinkedIn profile on the do-not-contact list (reason do_not_contact, detail \"Sample CRM person …\") so those real public figures stay unreachable. Remove an entry only when the user asks, and only once no People record holds its LinkedIn URL: crm keep clears a kept sample's marker but keeps its URL and its entry, so check each URL with crm search <url> --object people (oxygen_crm_record_search) first. List the entries with suppressions list --reason do_not_contact (oxygen_suppressions_list, reason) and remove them with suppressions remove --leads <urls> (oxygen_suppressions_remove, lead_provider_ids); every other entry stays.";
325
+ const CRM_SAMPLE_REMOVAL_EXECUTION = `Seeded samples delete like any CRM record; no sample-only command exists. Web: tick the rows in the CRM Companies, People and Deals grids and Delete (Deals opens on its Pipeline board; switch to All Deals). CLI/MCP: tables query <table> --fields <a field key> (MCP oxygen_tables_query with fields) on companies, people and deals lists _row_id and _sample: true; then tables delete-rows <table> --row-ids-json '[...]' (oxygen_rows_delete with row_ids, through oxygen_capabilities_call). Permanent and free: the delete releases their identities and links, and the seed never runs again. crm keep is the opposite: it keeps one sample as real. ${SAMPLE_DNC_GUARD}`;
326
+ const CRM_SAMPLE_REMOVAL = {
327
+ tools: ["oxygen_rows_delete", "oxygen_tables_query", "oxygen_crm_record_keep"],
328
+ commands: ["tables delete-rows", "tables query", "crm keep"],
329
+ execution: CRM_SAMPLE_REMOVAL_EXECUTION,
330
+ };
331
+ const CRM_SAMPLE_REMOVAL_WITH_DNC = {
332
+ tools: ["oxygen_rows_delete", "oxygen_tables_query", "oxygen_suppressions_list", "oxygen_suppressions_remove"],
333
+ commands: ["tables delete-rows", "tables query", "suppressions list", "suppressions remove"],
334
+ execution: CRM_SAMPLE_REMOVAL_EXECUTION,
335
+ };
336
+ const CRM_SAMPLE_DNC_REMOVAL = {
337
+ tools: ["oxygen_suppressions_list", "oxygen_suppressions_remove", "oxygen_crm_record_search"],
338
+ commands: ["suppressions list", "suppressions remove", "crm search"],
339
+ execution: `${SAMPLE_DNC_GUARD} Deleting a sample's own row is tables delete-rows (oxygen_rows_delete).`,
340
+ };
341
+ /**
342
+ * Deleting a CRM record is a row delete on its object's backing Table. Without
343
+ * this, "delete crm records" got the search/get gateways and command search
344
+ * left out `tables delete-rows` (not a crm command), so every discovery path
345
+ * answered as though records could not be deleted (Plain T-428). It answers
346
+ * only on the Records card, so asks other owners route keep their card.
347
+ */
348
+ export function crmRecordDeletionRecommendation(query) {
349
+ const removal = removalOf(query, REMOVAL, RECORD_MODIFIER, RECORD_NOUN)
350
+ || REMOVES_WHOLE_CRM.test(query) || NAMES_RECORD_DELETION.test(query);
351
+ if (!removal || negatesRemoval(query) || isHostedWorkflowIntent(query) || OPT_OUT.test(query) || OPT_OUT_WORDS.test(query) || PERSON_REASON.test(query) || HYGIENE.test(query) || NOT_A_RECORD_DELETE.test(query)
352
+ || /\b(?:notes?|tasks?|reminders?|files?|attachments?|tags?|labels?|fields?|attributes?|columns?|propert(?:y|ies)|values?|objects?|relationships?|links?|unlink\w*|associations?|merg\w*|dedup\w*|duplicat\w*|dupes?|doubles?|sequences?|campaigns?|cadences?|drips?|outreach|enroll\w*|lists?|audiences?|segments?|newsletters?|mailing|workflows?|automations?|agents?|suppress\w*|do not contact|dnc|block ?lists?|opt ?outs?|exclusions?|unsubscrib\w*|sync\w*|hubspot|attio|pipedrive|salesforce|connections?|integrations?|activit(?:y|ies)|timeline|views?|dashboards?|reports?|totals?|enrich\w*|members?|owners?|samples?|emails?|phones?|linkedin|urls?|photos?|avatars?|logos?|comments?|identit(?:y|ies)|stages?|statuses|gdpr|ccpa|privacy|personal data|data subject|forgotten|cancel\w*|workspaces?|polic(?:y|ies)|retention|compliance|undo\w*|undelet\w*|recover\w*|restor\w*|fail\w*|errors?|accidental\w*|history|audit\w*|logs?|repl(?:y|ies|ied)|emailing|messaging|contacting|zoho|copper|freshsales|dynamics|keap|insightly|close crm|dns|mx|spf|dkim|dmarc|cname|txt|bimi|ptr)\b/.test(query)
353
+ || /\b(?:my|our)\s+(?:\w+\s+)?accounts?\b|\bcrm accounts?\b|\baccounts?\s*[?.!]*\s*$|\b(?:other|another|second|previous|external|legacy) crm\b/.test(query))
354
+ return null;
355
+ return {
356
+ tools: ["oxygen_rows_delete", "oxygen_crm_record_search", "oxygen_crm_objects_list"],
357
+ commands: ["tables delete-rows", "crm search", "crm objects"],
358
+ execution: "A CRM record is a row in its object's backing Table, so it is deleted as a row, with the user's approval: find its row id with crm search, then tables delete-rows <table> --row-ids-json '[...]' (oxygen_rows_delete with row_ids; MCP runs it through oxygen_capabilities_call); crm objects names each object's table, and the CRM grid deletes selected rows too. Permanent and free: the delete releases the record's identities and CRM links, so a later import of the same email or domain creates a fresh record, and campaign enrollments stay enrolled. Seeded samples read _sample: true. crm objects delete removes a whole custom object, never single records.",
359
+ };
360
+ }
220
361
  /** Inventory reads select existing Table fields and retain honest sample totals. */
221
362
  export function crmInventoryRecommendation(query) {
222
363
  if (!/\b(crm|records?)\b/.test(query)
@@ -1,4 +1,4 @@
1
- import { CRM_ENRICHMENT_READ_VIEW, crmConnectionsReadRecommendation, crmEnrichmentReadRecommendation, crmFileUploadRecommendation, crmInventoryRecommendation, crmMaintenanceRecommendation, crmSampleRecordRecommendation, isCrmEnrichmentConfigurationRead, recordDossierReadRecommendation, storedCrmContactReadRecommendation, } from "./records.js";
1
+ import { CRM_ENRICHMENT_READ_VIEW, crmConnectionsReadRecommendation, crmEnrichmentReadRecommendation, crmFileUploadRecommendation, crmInventoryRecommendation, crmMaintenanceRecommendation, crmRecordDeletionRecommendation, crmSampleRecordRecommendation, isCrmEnrichmentConfigurationRead, recordDossierReadRecommendation, storedCrmContactReadRecommendation, } from "./records.js";
2
2
  export const rules = {
3
3
  explicit: [
4
4
  { order: 110, route: (query) => isCrmEnrichmentConfigurationRead(query) ? "records" : null },
@@ -14,6 +14,7 @@ export const rules = {
14
14
  { order: 130, recommend: (card, query) => card.id === "records" ? recordDossierReadRecommendation(query) : null },
15
15
  { order: 140, recommend: (card, query) => card.id === "records" ? crmFileUploadRecommendation(query) : null },
16
16
  { order: 150, recommend: (card, query) => card.id === "records" ? crmSampleRecordRecommendation(query) : null },
17
+ { order: 155, recommend: (card, query) => card.id === "records" ? crmRecordDeletionRecommendation(query) : null },
17
18
  { order: 160, recommend: (card, query) => card.id === "records" ? storedCrmContactReadRecommendation(query) : null },
18
19
  { order: 170, recommend: (card, query) => card.id === "records" ? crmInventoryRecommendation(query) : null },
19
20
  { order: 250, recommend: (card, query) => card.id === "records" && isCrmEnrichmentConfigurationRead(query) ? crmEnrichmentReadRecommendation(query) : null },
@@ -60,6 +61,13 @@ export const rules = {
60
61
  return crmSample ? { card: { ...card, execution: crmSample.execution }, done: true } : null;
61
62
  },
62
63
  },
64
+ {
65
+ order: 165,
66
+ view: (card, query) => {
67
+ const crmDeletion = card.id === "records" ? crmRecordDeletionRecommendation(query) : null;
68
+ return crmDeletion ? { card: { ...card, execution: crmDeletion.execution }, done: true } : null;
69
+ },
70
+ },
63
71
  {
64
72
  order: 170,
65
73
  view: (card, query) => {
@@ -135,7 +135,7 @@ export const BROWSER_OPERATIONS = [
135
135
  operation("notetaker.calendar.schedule", "/api/cli/notetaker/calendar", "POST", "notetaker calendar schedule", "oxygen_notetaker_calendar_schedule", "crm", "Schedule recording for an existing calendar event after approval; an external CLI or MCP caller must supply an explicit max_credits ceiling.", { event_id: text(), approved: bool(), max_credits: num({ minimum: 0 }) }, ["event_id", "approved"], { defaults: { action: "schedule" }, spends: true }),
136
136
  operation("notetaker.note.edit", "/api/cli/notetaker/sessions/{session}/note", "PATCH", "notetaker notes edit", "oxygen_notetaker_note_edit", "crm", "Save the markdown note for one meeting session and return the committed note.", { markdown: text() }, ["markdown"]),
137
137
  operation("orgs.create", "/api/cli/orgs/create", "POST", "orgs create", "oxygen_workspace_create", "workspace", "Create a workspace for the authenticated person's account and begin native company setup. Workspace API keys cannot create personal workspaces.", { name: text(), company_domain: text("Company website or domain, or its LinkedIn company page URL when it has no website."), linkedin_profile_url: text("Creator's LinkedIn profile URL, separate from the company's page.") }, ["name", "company_domain"]),
138
- operation("onboarding.complete", "/api/cli/onboarding/complete", "POST", "onboarding complete", "oxygen_onboarding_complete", "workspace", "Complete the active workspace's onboarding step and record its discovery-source choices. The other choice requires source_other.", { sources: arr(enumOf(["linkedin_content", "linkedin_dm", "linkedin_ads", "x", "youtube", "google", "ai_assistant", "email", "word_of_mouth", "referral", "event", "other"])), source_other: text(), redirect_url: text() }, ["sources"]),
138
+ operation("onboarding.complete", "/api/cli/onboarding/complete", "POST", "onboarding complete", "oxygen_onboarding_complete", "workspace", "Complete the active workspace's onboarding step and record its discovery-source choices. The referral choice requires source_referrer (who referred you); the other choice requires source_other.", { sources: arr(enumOf(["linkedin", "youtube", "x", "instagram", "tiktok", "google", "ai_assistant", "email", "referral", "word_of_mouth", "event", "other"])), source_other: text(), source_referrer: text(), redirect_url: text() }, ["sources"]),
139
139
  operation("onboarding.finish", "/api/cli/onboarding/finish", "POST", "onboarding finish", "oxygen_onboarding_finish", "workspace", "Finish agent-led onboarding once a play is chosen: the onboarding Oxygent chat opens as an ordinary chat, without the Knowledge pane. If the chat holds your sent play, records your activation once. Spends nothing."),
140
140
  operation("onboarding.start", "/api/cli/onboarding/start", "POST", "onboarding start", "oxygen_onboarding_start", "workspace", "Answer onboarding's choice card. own_agent continues to connecting your own agent. copilot opens the Workspace Copilot with the onboarding conversation already started, billed in credits like any Copilot turn; choosing again reopens that conversation. restart (copilot) shows a finished onboarding again and asks the Oxygent to start over, as an ordinary send.", { path: enumOf(["own_agent", "copilot"]), play: text("A play slug carried to the install step."), restart: bool() }, ["path"], { spends: true }),
141
141
  ];
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The Unibox keyset cursor: where a newest-first conversation list resumes.
3
+ *
4
+ * One definition for every reader of the format. The `/api/cli/inbox` route
5
+ * writes and reads it, and the MCP inbox tool re-points it at the last row a
6
+ * context-budget cut kept: a cursor that still named the route's last row sent
7
+ * an agent past every row the cut dropped (T-317, 2026-11-10).
8
+ */
9
+ export type InboxCursorChannelGroup = "email" | "linkedin" | "whatsapp";
10
+ export type InboxCursor = {
11
+ lastMessageAt: string | null;
12
+ channelGroup: InboxCursorChannelGroup;
13
+ id: string;
14
+ };
15
+ export declare function encodeInboxCursor(row: InboxCursor): string;
16
+ export declare function decodeInboxCursor(value: string): InboxCursor | null;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The Unibox keyset cursor: where a newest-first conversation list resumes.
3
+ *
4
+ * One definition for every reader of the format. The `/api/cli/inbox` route
5
+ * writes and reads it, and the MCP inbox tool re-points it at the last row a
6
+ * context-budget cut kept: a cursor that still named the route's last row sent
7
+ * an agent past every row the cut dropped (T-317, 2026-11-10).
8
+ */
9
+ export function encodeInboxCursor(row) {
10
+ return Buffer.from(JSON.stringify({
11
+ v: 1,
12
+ lastMessageAt: row.lastMessageAt,
13
+ channelGroup: row.channelGroup,
14
+ id: row.id,
15
+ }), "utf8").toString("base64url");
16
+ }
17
+ export function decodeInboxCursor(value) {
18
+ try {
19
+ const parsed = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
20
+ const channelGroup = parsed.channelGroup;
21
+ const lastMessageAt = parsed.lastMessageAt;
22
+ if (parsed.v !== 1
23
+ || typeof parsed.id !== "string"
24
+ || !(channelGroup === "email" || channelGroup === "linkedin" || channelGroup === "whatsapp")
25
+ || !(typeof lastMessageAt === "string" || lastMessageAt === null)
26
+ || (typeof lastMessageAt === "string" && Number.isNaN(Date.parse(lastMessageAt)))) {
27
+ return null;
28
+ }
29
+ return { id: parsed.id, channelGroup, lastMessageAt };
30
+ }
31
+ catch {
32
+ return null;
33
+ }
34
+ }
@@ -160,6 +160,7 @@ function buildSignupAttribution(metadata) {
160
160
  const result = compactRecord({
161
161
  self_reported_sources: selfReported.length > 0 ? selfReported : undefined,
162
162
  self_reported_other: normalizeString(combined.attribution_other) ?? undefined,
163
+ self_reported_referrer: normalizeString(combined.attribution_referrer) ?? undefined,
163
164
  linkedin_url: firstStringValue(combined.linkedin_url, combined.linkedin_profile_url) ?? undefined,
164
165
  landing_page: firstStringValue(combined.landing_page, combined.landing_page_url) ?? undefined,
165
166
  referrer: firstStringValue(combined.referrer, combined.referrer_url) ?? undefined,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An Instagram Story: one photo or video for 24 hours, posted as a `STORIES`
3
+ * container on Meta's `POST /<IG_ID>/media`. Meta takes no caption on a Story
4
+ * and nobody can comment on one, so the post's text stays OXYGEN's own label
5
+ * for it and a first comment is refused.
6
+ */
7
+ export declare const INSTAGRAM_STORY_MEDIA_TYPE = "STORIES";
8
+ /** Whether stored Instagram content is a Story (`media_type: "STORIES"`). */
9
+ export declare function isInstagramStoryContent(content: Record<string, unknown> | null | undefined): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * An Instagram Story: one photo or video for 24 hours, posted as a `STORIES`
3
+ * container on Meta's `POST /<IG_ID>/media`. Meta takes no caption on a Story
4
+ * and nobody can comment on one, so the post's text stays OXYGEN's own label
5
+ * for it and a first comment is refused.
6
+ */
7
+ export const INSTAGRAM_STORY_MEDIA_TYPE = "STORIES";
8
+ /** Whether stored Instagram content is a Story (`media_type: "STORIES"`). */
9
+ export function isInstagramStoryContent(content) {
10
+ const mediaType = content?.media_type;
11
+ return typeof mediaType === "string" && mediaType.trim().toUpperCase() === INSTAGRAM_STORY_MEDIA_TYPE;
12
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * An Instagram trial Reel: shown to non-followers first. Meta's
3
+ * `POST /<IG_ID>/media` takes `trial_params: { graduation_strategy }` on a
4
+ * REELS container (changelog 2025-12-03). MANUAL leaves sharing it to followers
5
+ * to the creator in the Instagram app; SS_PERFORMANCE lets Instagram share it
6
+ * to followers when it performs well. Meta's API has no way to graduate one or
7
+ * to read whether a Reel is still a trial.
8
+ */
9
+ export declare const INSTAGRAM_TRIAL_REEL_CONTENT_KEY = "trial_params";
10
+ export declare const INSTAGRAM_TRIAL_GRADUATION_STRATEGIES: readonly ["MANUAL", "SS_PERFORMANCE"];
11
+ export type InstagramTrialGraduationStrategy = (typeof INSTAGRAM_TRIAL_GRADUATION_STRATEGIES)[number];
12
+ export type InstagramTrialReelParams = {
13
+ graduation_strategy: InstagramTrialGraduationStrategy;
14
+ };
15
+ export declare function isInstagramTrialReelParams(value: unknown): value is InstagramTrialReelParams;
16
+ /** The stored strategy of a post's content, or null when it is not a trial Reel. */
17
+ export declare function readInstagramTrialGraduationStrategy(content: Record<string, unknown> | null | undefined): InstagramTrialGraduationStrategy | null;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * An Instagram trial Reel: shown to non-followers first. Meta's
3
+ * `POST /<IG_ID>/media` takes `trial_params: { graduation_strategy }` on a
4
+ * REELS container (changelog 2025-12-03). MANUAL leaves sharing it to followers
5
+ * to the creator in the Instagram app; SS_PERFORMANCE lets Instagram share it
6
+ * to followers when it performs well. Meta's API has no way to graduate one or
7
+ * to read whether a Reel is still a trial.
8
+ */
9
+ export const INSTAGRAM_TRIAL_REEL_CONTENT_KEY = "trial_params";
10
+ export const INSTAGRAM_TRIAL_GRADUATION_STRATEGIES = ["MANUAL", "SS_PERFORMANCE"];
11
+ export function isInstagramTrialReelParams(value) {
12
+ if (!value || typeof value !== "object" || Array.isArray(value))
13
+ return false;
14
+ const entries = Object.entries(value);
15
+ return entries.length === 1
16
+ && entries[0][0] === "graduation_strategy"
17
+ && INSTAGRAM_TRIAL_GRADUATION_STRATEGIES.includes(entries[0][1]);
18
+ }
19
+ /** The stored strategy of a post's content, or null when it is not a trial Reel. */
20
+ export function readInstagramTrialGraduationStrategy(content) {
21
+ const params = content?.[INSTAGRAM_TRIAL_REEL_CONTENT_KEY];
22
+ return isInstagramTrialReelParams(params) ? params.graduation_strategy : null;
23
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TikTok posts through its Content Posting API (via Composio): a video, or a
3
+ * photo post of 1 to 35 images that people swipe through. The keys below are
4
+ * the post's stored `content` and mirror TikTok's own field names.
5
+ *
6
+ * TikTok takes no designed cover image: a video's cover is a frame of it
7
+ * (`video_cover_timestamp_ms`) and a photo post's cover is one of its photos
8
+ * (`photo_cover_index`).
9
+ */
10
+ export declare const TIKTOK_PRIVACY_LEVELS: readonly ["PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "FOLLOWER_OF_CREATOR", "SELF_ONLY"];
11
+ export type TikTokPrivacyLevel = (typeof TIKTOK_PRIVACY_LEVELS)[number];
12
+ /** `content.media_type` of a photo post; a post without it is a video. */
13
+ export declare const TIKTOK_PHOTO_MEDIA_TYPE = "photo";
14
+ export declare const TIKTOK_PHOTO_MAX_IMAGES = 35;
15
+ /** TikTok takes JPEG and WebP photos only. */
16
+ export declare const TIKTOK_PHOTO_CONTENT_TYPES: readonly ["image/jpeg", "image/webp"];
17
+ export declare const TIKTOK_VIDEO_CAPTION_MAX_CHARS = 2200;
18
+ export declare const TIKTOK_PHOTO_TITLE_MAX_CHARS = 90;
19
+ export declare const TIKTOK_PHOTO_DESCRIPTION_MAX_CHARS = 4000;
20
+ export declare function isTikTokPrivacyLevel(value: unknown): value is TikTokPrivacyLevel;
21
+ /** Whether stored TikTok content is a photo post. */
22
+ export declare function isTikTokPhotoContent(content: Record<string, unknown> | null | undefined): boolean;
23
+ /** The caption limit TikTok applies to this post: a video's caption or a photo post's description. */
24
+ export declare function tiktokCaptionMaxChars(content: Record<string, unknown> | null | undefined): number;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * TikTok posts through its Content Posting API (via Composio): a video, or a
3
+ * photo post of 1 to 35 images that people swipe through. The keys below are
4
+ * the post's stored `content` and mirror TikTok's own field names.
5
+ *
6
+ * TikTok takes no designed cover image: a video's cover is a frame of it
7
+ * (`video_cover_timestamp_ms`) and a photo post's cover is one of its photos
8
+ * (`photo_cover_index`).
9
+ */
10
+ export const TIKTOK_PRIVACY_LEVELS = [
11
+ "PUBLIC_TO_EVERYONE",
12
+ "MUTUAL_FOLLOW_FRIENDS",
13
+ "FOLLOWER_OF_CREATOR",
14
+ "SELF_ONLY",
15
+ ];
16
+ /** `content.media_type` of a photo post; a post without it is a video. */
17
+ export const TIKTOK_PHOTO_MEDIA_TYPE = "photo";
18
+ export const TIKTOK_PHOTO_MAX_IMAGES = 35;
19
+ /** TikTok takes JPEG and WebP photos only. */
20
+ export const TIKTOK_PHOTO_CONTENT_TYPES = ["image/jpeg", "image/webp"];
21
+ export const TIKTOK_VIDEO_CAPTION_MAX_CHARS = 2200;
22
+ export const TIKTOK_PHOTO_TITLE_MAX_CHARS = 90;
23
+ export const TIKTOK_PHOTO_DESCRIPTION_MAX_CHARS = 4000;
24
+ export function isTikTokPrivacyLevel(value) {
25
+ return typeof value === "string" && TIKTOK_PRIVACY_LEVELS.includes(value);
26
+ }
27
+ /** Whether stored TikTok content is a photo post. */
28
+ export function isTikTokPhotoContent(content) {
29
+ const mediaType = content?.media_type;
30
+ if (typeof mediaType === "string" && mediaType.trim().toLowerCase() === TIKTOK_PHOTO_MEDIA_TYPE)
31
+ return true;
32
+ return Array.isArray(content?.photo_images);
33
+ }
34
+ /** The caption limit TikTok applies to this post: a video's caption or a photo post's description. */
35
+ export function tiktokCaptionMaxChars(content) {
36
+ return isTikTokPhotoContent(content) ? TIKTOK_PHOTO_DESCRIPTION_MAX_CHARS : TIKTOK_VIDEO_CAPTION_MAX_CHARS;
37
+ }
@@ -1,3 +1,3 @@
1
1
  export declare const OXYGEN_VERSION: string;
2
- export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.1013.94";
2
+ export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.1014.86";
3
3
  export declare const GEO_EXPORT_MINIMUM_CLI_VERSION = "1.1013.0";
@@ -1 +1 @@
1
- export declare const OXYGEN_BUILD_VERSION = "1.1037.21";
1
+ export declare const OXYGEN_BUILD_VERSION = "1.1038.33";
@@ -1,2 +1,2 @@
1
1
  // GENERATED by scripts/ci/version-stamp.mjs from VERSION + git history. Do not edit; do not commit.
2
- export const OXYGEN_BUILD_VERSION = "1.1037.21";
2
+ export const OXYGEN_BUILD_VERSION = "1.1038.33";
@@ -49,7 +49,7 @@ export const OXYGEN_VERSION = OXYGEN_BUILD_VERSION;
49
49
  // Since 2026-09-28 the release-preparation step advances this literal to the
50
50
  // highest CLI version published on npm for at least 30 days. It never lowers
51
51
  // the floor. The source change lands on dev before the next production release.
52
- export const OXYGEN_MINIMUM_CLI_VERSION = "1.1013.94";
52
+ export const OXYGEN_MINIMUM_CLI_VERSION = "1.1014.86";
53
53
  // The internal GEO export first gains required pagination in this dev version.
54
54
  // Earlier pilot clients would save a partial file without its continuation.
55
55
  export const GEO_EXPORT_MINIMUM_CLI_VERSION = "1.1013.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxygen-agent/cli",
3
- "version": "1.1037.21",
3
+ "version": "1.1038.33",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",