@oxygen-agent/cli 1.1023.41 → 1.1025.2

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 (39) hide show
  1. package/README.md +1 -1
  2. package/dist/command-families/program.js +0 -4
  3. package/dist/command-manifest.js +0 -2
  4. package/dist/commands/budget.js +9 -4
  5. package/dist/commands/companies.js +1 -1
  6. package/dist/commands/publishing.js +16 -7
  7. package/dist/commands/sequences.js +9 -1
  8. package/dist/commands/workflows.js +1 -1
  9. package/node_modules/@oxygen/shared/dist/access/permissions.d.ts +1 -1
  10. package/node_modules/@oxygen/shared/dist/access/permissions.js +1 -1
  11. package/node_modules/@oxygen/shared/dist/billing/budget-scopes.d.ts +2 -2
  12. package/node_modules/@oxygen/shared/dist/billing/budget-scopes.js +2 -2
  13. package/node_modules/@oxygen/shared/dist/billing/plan-capabilities.js +1 -1
  14. package/node_modules/@oxygen/shared/dist/capability-intents/index.generated.d.ts +0 -40
  15. package/node_modules/@oxygen/shared/dist/capability-intents/tables.d.ts +0 -20
  16. package/node_modules/@oxygen/shared/dist/capability-intents/tables.js +0 -3
  17. package/node_modules/@oxygen/shared/dist/capability-intents/tables.rules.js +6 -41
  18. package/node_modules/@oxygen/shared/dist/capability-routes/tables.js +3 -3
  19. package/node_modules/@oxygen/shared/dist/contracts/browser-operations.js +1 -0
  20. package/node_modules/@oxygen/shared/dist/contracts/geo.js +2 -2
  21. package/node_modules/@oxygen/shared/dist/copilot/plan-hold.d.ts +1 -0
  22. package/node_modules/@oxygen/shared/dist/copilot/plan-hold.js +5 -2
  23. package/node_modules/@oxygen/shared/dist/geo/geo.d.ts +168 -2
  24. package/node_modules/@oxygen/shared/dist/geo/geo.js +357 -70
  25. package/node_modules/@oxygen/shared/dist/onboarding-leads.js +9 -3
  26. package/node_modules/@oxygen/shared/dist/schedule-label.js +29 -1
  27. package/node_modules/@oxygen/shared/dist/sequences/enrollment-origin.d.ts +3 -1
  28. package/node_modules/@oxygen/shared/dist/sequences/enrollment-origin.js +2 -0
  29. package/node_modules/@oxygen/shared/dist/version.d.ts +1 -1
  30. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
  31. package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
  32. package/node_modules/@oxygen/shared/dist/version.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/commands/callables.d.ts +0 -3
  35. package/dist/commands/callables.js +0 -111
  36. package/dist/functions-commands.d.ts +0 -6
  37. package/dist/functions-commands.js +0 -85
  38. package/node_modules/@oxygen/shared/dist/contracts/function-library-read.d.ts +0 -14
  39. package/node_modules/@oxygen/shared/dist/contracts/function-library-read.js +0 -16
@@ -9,6 +9,31 @@ export const GEO_ENGINES = [
9
9
  "copilot",
10
10
  "claude",
11
11
  ];
12
+ /** Raises when extraction rules change; older stored answers are re-derived on read. */
13
+ export const GEO_EXTRACTION_VERSION = 3;
14
+ export const GEO_DOMAIN_TYPES = [
15
+ "owned",
16
+ "competitor",
17
+ "corporate",
18
+ "editorial",
19
+ "institutional",
20
+ "ugc",
21
+ "reference",
22
+ "other",
23
+ ];
24
+ export const GEO_PAGE_TYPES = [
25
+ "homepage",
26
+ "category",
27
+ "product",
28
+ "listicle",
29
+ "comparison",
30
+ "profile",
31
+ "alternative",
32
+ "discussion",
33
+ "how_to",
34
+ "article",
35
+ "other",
36
+ ];
12
37
  /** Binary exports carry this metadata to web, CLI and MCP, even for CSV/PDF. */
13
38
  export function readGeoExportPagination(headers) {
14
39
  const value = headers.get("x-oxygen-export-pagination");
@@ -59,7 +84,130 @@ function matchedTerm(text, term) {
59
84
  const match = new RegExp(`(^|[^\\p{L}\\p{N}])(${escaped})(?=$|[^\\p{L}\\p{N}])`, "iu").exec(text);
60
85
  return match ? match.index + (match[1]?.length ?? 0) : -1;
61
86
  }
62
- export function analyzeGeoAnswer(text, brand, competitors, urls) {
87
+ function belongsTo(domain, subject) {
88
+ return subject.domains.some((d) => {
89
+ const owned = geoDomain(d);
90
+ return Boolean(owned && (domain === owned || domain.endsWith(`.${owned}`)));
91
+ });
92
+ }
93
+ /** Normalized citation identity: no fragment or click-tracking parameters. */
94
+ export function normalizeGeoUrl(raw) {
95
+ try {
96
+ const url = new URL(raw);
97
+ const domain = geoDomain(raw);
98
+ if (!domain)
99
+ return null;
100
+ url.hash = "";
101
+ for (const key of [...url.searchParams.keys()])
102
+ if (/^(utm_|fbclid|gclid)/i.test(key))
103
+ url.searchParams.delete(key);
104
+ return { url: url.href, domain };
105
+ }
106
+ catch {
107
+ return null;
108
+ }
109
+ }
110
+ /** URLs the answer prose links inline (markdown targets or bare URLs), normalized. */
111
+ export function geoInlineUrls(text) {
112
+ const found = [
113
+ // Markdown link targets; image targets (`![alt](url)`) are pictures, not sources.
114
+ ...[...text.matchAll(/(?<!!)\[[^\]]*\]\((https?:\/\/[^\s)]+)\)/g)].map((m) => m[1]),
115
+ // Bare URLs, never one nested in another URL's query (favicon services wrap the site URL).
116
+ ...[...text.matchAll(/(?<![\w\]=/?&%(:-])https?:\/\/[^\s<>"'\])]+/g)].map((m) => m[0]),
117
+ ].map((url) => url.replace(/[.,;:!?]+$/, ""));
118
+ return [...new Set(found.flatMap((url) => (isGeoAssetUrl(url) ? [] : normalizeGeoUrl(url)?.url ?? [])))];
119
+ }
120
+ const ASSET_HOSTS = /(^|\.)(images\.openai\.com|gstatic\.com|googleusercontent\.com|ggpht\.com|bing\.net)$/;
121
+ const ASSET_PATH = /\.(png|jpe?g|gif|webp|svg|ico|avif)$|\/favicons?(\.ico)?(\/|$)|^\/s2\/favicons/;
122
+ /** Images, favicons and thumbnails an engine renders beside an answer: never a source. */
123
+ export function isGeoAssetUrl(raw) {
124
+ try {
125
+ const url = new URL(raw);
126
+ const host = url.hostname.toLowerCase().replace(/^www\./, "");
127
+ return ASSET_HOSTS.test(host) || ASSET_PATH.test(url.pathname.toLowerCase());
128
+ }
129
+ catch {
130
+ return false;
131
+ }
132
+ }
133
+ // Small curated rules; everything else falls back to the TLD. Per-project
134
+ // overrides are a later product decision.
135
+ const UGC = /(^|\.)(reddit\.com|quora\.com|youtube\.com|youtu\.be|linkedin\.com|x\.com|twitter\.com|facebook\.com|instagram\.com|tiktok\.com|medium\.com|stackoverflow\.com|stackexchange\.com|news\.ycombinator\.com|producthunt\.com|github\.com|discord\.com)$/;
136
+ const REFERENCE = /(^|\.)(wikipedia\.org|wikidata\.org|britannica\.com|investopedia\.com|merriam-webster\.com|dictionary\.com)$|^(docs|developers?|help|support|kb)\./;
137
+ const INSTITUTIONAL = /\.(gov|edu|mil|int)(\.[a-z]{2})?$|\.ac\.[a-z]{2}$|(^|\.)(europa\.eu|un\.org)$/;
138
+ const EDITORIAL = /(^|\.)(g2\.com|capterra\.com|trustradius\.com|trustpilot\.com|getapp\.com|softwareadvice\.com|gartner\.com|forbes\.com|techcrunch\.com|nytimes\.com|wsj\.com|bloomberg\.com|reuters\.com|theverge\.com|wired\.com|businessinsider\.com|cnbc\.com|bbc\.com|bbc\.co\.uk|theguardian\.com|zdnet\.com|techradar\.com|pcmag\.com|venturebeat\.com|hbr\.org|inc\.com|entrepreneur\.com|fastcompany\.com|substack\.com)$/;
139
+ const COMMERCIAL_TLD = /\.(com|io|ai|co|app|dev|so|tech|cloud|net|biz)$/;
140
+ /**
141
+ * Domain type: owned/competitor from the capture-time definition, then curated
142
+ * rules, then the TLD. Review platforms are editorial (moderated third-party
143
+ * publications); their product pages are page type "profile".
144
+ */
145
+ export function geoDomainType(domain, brand, competitors = []) {
146
+ if (brand && belongsTo(domain, brand))
147
+ return "owned";
148
+ if (competitors.some((c) => belongsTo(domain, c)))
149
+ return "competitor";
150
+ if (UGC.test(domain))
151
+ return "ugc";
152
+ if (REFERENCE.test(domain))
153
+ return "reference";
154
+ if (INSTITUTIONAL.test(domain))
155
+ return "institutional";
156
+ if (EDITORIAL.test(domain))
157
+ return "editorial";
158
+ return COMMERCIAL_TLD.test(domain) ? "corporate" : "other";
159
+ }
160
+ const PROFILE_HOSTS = /(^|\.)(g2|capterra|trustradius|getapp|softwareadvice|crunchbase|producthunt|yelp|trustpilot)\.com$/;
161
+ const DISCUSSION_HOSTS = /(^|\.)(reddit|quora|stackoverflow|stackexchange)\.com$|^news\.ycombinator\.com$|^(community|forum|forums|discuss)\./;
162
+ /** Page type from the URL alone; the first matching rule wins. */
163
+ export function geoPageType(raw, domainType) {
164
+ let url;
165
+ try {
166
+ url = new URL(raw);
167
+ }
168
+ catch {
169
+ return "other";
170
+ }
171
+ let path = url.pathname.toLowerCase();
172
+ try {
173
+ path = decodeURIComponent(path);
174
+ }
175
+ catch {
176
+ /* Keep the encoded path. */
177
+ }
178
+ path = path.replace(/\/+$/, "");
179
+ const host = url.hostname.toLowerCase().replace(/^www\./, "");
180
+ if (!path || /^\/(index\.html?|[a-z]{2}([-_][a-z]{2})?)$/.test(path))
181
+ return "homepage";
182
+ if (DISCUSSION_HOSTS.test(host) ||
183
+ /\/(comments|questions|discussions?|forums?|threads?|community|t)\//.test(`${path}/`))
184
+ return "discussion";
185
+ if ((PROFILE_HOSTS.test(host) &&
186
+ /^\/(products?|p|organization|company|reviews?|software|biz|apps?)\//.test(path)) ||
187
+ (host.endsWith("linkedin.com") && /^\/(company|in|showcase)\//.test(path)) ||
188
+ /\/(profiles?|vendors?)\//.test(path))
189
+ return "profile";
190
+ if (/alternative/.test(path))
191
+ return "alternative";
192
+ if (/(^|[-_/])(vs|versus)([-_/]|$)|compar(e|ison)/.test(path))
193
+ return "comparison";
194
+ if (/(^|[-_/])(best|top)([-_/]|$)|\/\d{1,3}[-_][a-z]/.test(path))
195
+ return "listicle";
196
+ if (/how[-_]to|tutorial|step[-_]by[-_]step|(^|[-_/])guides?([-_/]|$)|^\/(docs|help|learn|support)(\/|$)/.test(path))
197
+ return "how_to";
198
+ if (/^\/(category|categories|collections?|tags?|topics?|blog|news|articles|resources|products|solutions|integrations)$/.test(path) ||
199
+ /\/(category|categories|collections|tag|tags)\//.test(path))
200
+ return "category";
201
+ if (/^\/(products?|pricing|features?|platform|solutions|integrations|apps?|plans)(\/|$)/.test(path))
202
+ return "product";
203
+ if (/^\/(blog|news|articles?|posts?|insights|resources|stories|magazine)\//.test(path) ||
204
+ /\/\d{4}\/\d{2}\//.test(path) ||
205
+ domainType === "editorial" ||
206
+ domainType === "reference")
207
+ return "article";
208
+ return "other";
209
+ }
210
+ export function analyzeGeoAnswer(text, brand, competitors, urls, citedUrls = []) {
63
211
  const prose = text.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, (_link, label, url) => {
64
212
  // A domain-only citation label is source attribution, not a recommendation.
65
213
  return label.trim().includes(".") &&
@@ -68,7 +216,7 @@ export function analyzeGeoAnswer(text, brand, competitors, urls) {
68
216
  : label;
69
217
  });
70
218
  const subjects = [brand, ...competitors];
71
- const mentions = subjects.map((subject) => {
219
+ const detected = subjects.map((subject) => {
72
220
  const indices = [subject.name, ...subject.aliases, ...subject.domains]
73
221
  .map((term) => matchedTerm(prose, term))
74
222
  .filter((index) => index >= 0);
@@ -82,52 +230,41 @@ export function analyzeGeoAnswer(text, brand, competitors, urls) {
82
230
  break;
83
231
  }
84
232
  }
85
- return {
86
- brand: subject.name,
87
- present: first >= 0,
88
- evidence: first >= 0 ? prose.slice(Math.max(0, first - 60), first + 180) : null,
89
- recommendation_rank: rank,
90
- };
233
+ return { subject, first, rank };
91
234
  });
235
+ const offsets = detected.map((d) => d.first).filter((first) => first >= 0);
236
+ const mentions = detected.map(({ subject, first, rank }) => ({
237
+ brand: subject.name,
238
+ present: first >= 0,
239
+ evidence: first >= 0 ? prose.slice(Math.max(0, first - 60), first + 180) : null,
240
+ recommendation_rank: rank,
241
+ position: first >= 0 ? 1 + offsets.filter((o) => o < first).length : null,
242
+ }));
243
+ const inline = geoInlineUrls(text);
244
+ const cited = new Set([
245
+ ...citedUrls.flatMap((url) => normalizeGeoUrl(url)?.url ?? []),
246
+ ...inline,
247
+ ]);
92
248
  const citations = [];
93
249
  const seen = new Set();
94
- for (const raw of urls) {
95
- try {
96
- const url = new URL(raw);
97
- const domain = geoDomain(raw);
98
- if (!domain)
99
- continue;
100
- url.hash = "";
101
- for (const key of [...url.searchParams.keys()])
102
- if (/^(utm_|fbclid|gclid)/i.test(key))
103
- url.searchParams.delete(key);
104
- const normalized = url.href;
105
- if (seen.has(normalized))
106
- continue;
107
- seen.add(normalized);
108
- const belongs = (subject) => subject.domains.some((d) => {
109
- const owned = geoDomain(d);
110
- return owned && (domain === owned || domain.endsWith(`.${owned}`));
111
- });
112
- const category = belongs(brand)
113
- ? "owned"
114
- : competitors.some(belongs)
115
- ? "competitor"
116
- : /(^|\.)(reddit\.com|linkedin\.com|youtube\.com|quora\.com)$/.test(domain)
117
- ? "community"
118
- : /(^|\.)(g2\.com|capterra\.com|trustpilot\.com)$/.test(domain)
119
- ? "review"
120
- : "other";
121
- citations.push({
122
- url: normalized,
123
- domain,
124
- position: citations.length + 1,
125
- category,
126
- });
127
- }
128
- catch {
129
- /* An invalid provider URL is retained in raw evidence, not made clickable. */
130
- }
250
+ // Inline-only links were necessarily retrieved, so cited stays a subset of retrieved.
251
+ for (const raw of [...urls, ...citedUrls, ...inline]) {
252
+ if (isGeoAssetUrl(raw))
253
+ continue;
254
+ const normalized = normalizeGeoUrl(raw);
255
+ // An invalid provider URL is retained in raw evidence, not made clickable.
256
+ if (!normalized || seen.has(normalized.url))
257
+ continue;
258
+ seen.add(normalized.url);
259
+ const category = geoDomainType(normalized.domain, brand, competitors);
260
+ citations.push({
261
+ url: normalized.url,
262
+ domain: normalized.domain,
263
+ position: citations.length + 1,
264
+ category,
265
+ page_type: geoPageType(normalized.url, category),
266
+ cited_inline: cited.has(normalized.url),
267
+ });
131
268
  }
132
269
  return {
133
270
  mentions,
@@ -135,6 +272,59 @@ export function analyzeGeoAnswer(text, brand, competitors, urls) {
135
272
  measurement: structuredClone({ brand, competitors }),
136
273
  };
137
274
  }
275
+ /**
276
+ * Re-derives mentions and citations of an answer extracted by an earlier version
277
+ * from its stored text and supplier sources, using the capture-time definition.
278
+ * It never calls a supplier and never rewrites the stored document.
279
+ */
280
+ export function upgradeGeoAnswer(answer, sources) {
281
+ const version = Number(answer.extraction_version) || 1;
282
+ if (version >= GEO_EXTRACTION_VERSION)
283
+ return answer;
284
+ const text = typeof answer.text === "string" ? answer.text : "";
285
+ const stored = Array.isArray(answer.citations) ? answer.citations : [];
286
+ const citedUrls = sources?.cited_urls ?? [];
287
+ if (answer.measurement) {
288
+ const derived = analyzeGeoAnswer(text, answer.measurement.brand, answer.measurement.competitors, sources?.urls ?? stored.map((c) => c.url), citedUrls);
289
+ return {
290
+ ...answer,
291
+ mentions: derived.mentions,
292
+ citations: derived.citations,
293
+ extraction_version: GEO_EXTRACTION_VERSION,
294
+ derived_from_version: version,
295
+ };
296
+ }
297
+ // Without a capture-time definition, presence stays as stored and positions are unknown.
298
+ const cited = new Set([
299
+ ...citedUrls.flatMap((url) => normalizeGeoUrl(url)?.url ?? []),
300
+ ...geoInlineUrls(text),
301
+ ]);
302
+ const legacy = (category, domain) => category === "owned" || category === "competitor"
303
+ ? category
304
+ : category === "community"
305
+ ? "ugc"
306
+ : category === "review"
307
+ ? "editorial"
308
+ : geoDomainType(domain, null);
309
+ return {
310
+ ...answer,
311
+ mentions: (Array.isArray(answer.mentions) ? answer.mentions : []).map((m) => ({
312
+ ...m,
313
+ position: null,
314
+ })),
315
+ citations: stored.map((c) => {
316
+ const category = legacy(String(c.category), c.domain);
317
+ return {
318
+ ...c,
319
+ category,
320
+ page_type: geoPageType(c.url, category),
321
+ cited_inline: cited.has(c.url),
322
+ };
323
+ }),
324
+ extraction_version: GEO_EXTRACTION_VERSION,
325
+ derived_from_version: version,
326
+ };
327
+ }
138
328
  /** Exact capture-time configuration, canonicalized for matched comparisons. */
139
329
  export function geoMeasurementKey(answer) {
140
330
  if (!answer.measurement)
@@ -169,31 +359,97 @@ export function summarizeGeoAnswers(answers, brand, failedSamples = 0) {
169
359
  const samples = answers.filter(isGeoControlledAnswer);
170
360
  const measurementContexts = new Set(samples.map(geoMeasurementKey)).size;
171
361
  const comparable = measurementContexts <= 1;
362
+ // Brand-definition rates need one capture-time definition; source rates do not.
363
+ const brandRate = (count) => comparable && samples.length ? count / samples.length : null;
364
+ const sourceRate = (count) => samples.length ? count / samples.length : null;
172
365
  const brands = new Map();
173
- for (const sample of samples) {
174
- const presentBrands = new Set(sample.mentions
175
- .filter((m) => m.present)
176
- .map((m) => m.brand === sample.measurement?.brand.name ? brand : m.brand));
177
- for (const name of presentBrands)
178
- brands.set(name, (brands.get(name) ?? 0) + 1);
179
- }
180
- const totalMentions = [...brands.values()].reduce((a, b) => a + b, 0);
181
- const present = brands.get(brand) ?? 0;
182
- const cited = samples.filter((a) => a.citations.some((c) => c.category === "owned")).length;
366
+ const tally = (name) => {
367
+ let entry = brands.get(name);
368
+ if (!entry) {
369
+ entry = { mentioned: 0, positions: [], won: 0, retrieved: 0, cited: 0 };
370
+ brands.set(name, entry);
371
+ }
372
+ return entry;
373
+ };
183
374
  const sources = new Map();
184
- for (const answer of samples)
185
- for (const citation of answer.citations) {
186
- const source = sources.get(citation.domain) ?? {
187
- domain: citation.domain,
188
- count: 0,
189
- category: citation.category,
190
- urls: [],
191
- };
375
+ for (const sample of samples) {
376
+ const label = (name) => name === sample.measurement?.brand.name ? brand : name;
377
+ const positions = new Map();
378
+ for (const mention of sample.mentions) {
379
+ if (!mention.present)
380
+ continue;
381
+ const name = label(mention.brand);
382
+ const position = mention.position ?? null;
383
+ const previous = positions.get(name);
384
+ positions.set(name, previous === undefined || previous === null
385
+ ? position
386
+ : position === null ? previous : Math.min(previous, position));
387
+ }
388
+ for (const [name, position] of positions) {
389
+ const entry = tally(name);
390
+ entry.mentioned++;
391
+ if (position === null)
392
+ continue;
393
+ entry.positions.push(position);
394
+ if (position === 1)
395
+ entry.won++;
396
+ }
397
+ const subjects = new Map((sample.measurement
398
+ ? [sample.measurement.brand, ...sample.measurement.competitors]
399
+ : []).map((subject) => [label(subject.name), subject]));
400
+ for (const [name, subject] of subjects) {
401
+ const entry = tally(name);
402
+ const sourced = sample.citations.filter((c) => belongsTo(c.domain, subject));
403
+ if (sourced.length)
404
+ entry.retrieved++;
405
+ if (sourced.some((c) => c.cited_inline))
406
+ entry.cited++;
407
+ }
408
+ const retrievedDomains = new Set();
409
+ const citedDomains = new Set();
410
+ for (const citation of sample.citations) {
411
+ let source = sources.get(citation.domain);
412
+ if (!source) {
413
+ source = {
414
+ domain: citation.domain,
415
+ count: 0,
416
+ category: citation.category,
417
+ urls: [],
418
+ retrieved: 0,
419
+ cited: 0,
420
+ pages: new Map(),
421
+ };
422
+ sources.set(citation.domain, source);
423
+ }
192
424
  source.count++;
193
425
  if (!source.urls.includes(citation.url))
194
426
  source.urls.push(citation.url);
195
- sources.set(citation.domain, source);
427
+ let page = source.pages.get(citation.url);
428
+ if (!page) {
429
+ page = { url: citation.url, page_type: citation.page_type, retrieved: 0, cited: 0 };
430
+ source.pages.set(citation.url, page);
431
+ }
432
+ // Citations are unique per URL within an answer, so these count answers.
433
+ page.retrieved++;
434
+ if (citation.cited_inline)
435
+ page.cited++;
436
+ retrievedDomains.add(citation.domain);
437
+ if (citation.cited_inline)
438
+ citedDomains.add(citation.domain);
196
439
  }
440
+ for (const domain of retrievedDomains)
441
+ sources.get(domain).retrieved++;
442
+ for (const domain of citedDomains)
443
+ sources.get(domain).cited++;
444
+ }
445
+ const totalMentions = [...brands.values()].reduce((a, b) => a + b.mentioned, 0);
446
+ const own = brands.get(brand);
447
+ const present = own?.mentioned ?? 0;
448
+ const average = (positions) => comparable && positions.length
449
+ ? positions.reduce((a, b) => a + b, 0) / positions.length
450
+ : null;
451
+ const cited = samples.filter((a) => a.citations.some((c) => c.category === "owned")).length;
452
+ const ownedCited = samples.filter((a) => a.citations.some((c) => c.category === "owned" && c.cited_inline)).length;
197
453
  return {
198
454
  successful_samples: samples.length,
199
455
  measurement_contexts: measurementContexts,
@@ -203,16 +459,47 @@ export function summarizeGeoAnswers(answers, brand, failedSamples = 0) {
203
459
  no_overview_samples: answers.filter((a) => a.outcome === "no_overview")
204
460
  .length,
205
461
  mentioned_samples: present,
206
- visibility: comparable && samples.length ? present / samples.length : null,
462
+ visibility: brandRate(present),
463
+ position_samples: own?.positions.length ?? 0,
464
+ average_position: average(own?.positions ?? []),
465
+ won_samples: own?.won ?? 0,
466
+ win_rate: brandRate(own?.won ?? 0),
467
+ /** Owned domain among the answer's sources (retrieved or cited). */
207
468
  cited_samples: cited,
208
- citation_coverage: comparable && samples.length ? cited / samples.length : null,
469
+ citation_coverage: brandRate(cited),
470
+ owned_cited_samples: ownedCited,
471
+ owned_cited_rate: brandRate(ownedCited),
209
472
  share_of_voice: comparable && totalMentions ? present / totalMentions : null,
210
- competitors: [...brands].map(([name, count]) => ({
473
+ competitors: [...brands].map(([name, entry]) => ({
211
474
  name,
212
- mentioned_samples: count,
213
- share_of_voice: comparable && totalMentions ? count / totalMentions : null,
475
+ mentioned_samples: entry.mentioned,
476
+ share_of_voice: comparable && totalMentions ? entry.mentioned / totalMentions : null,
477
+ position_samples: entry.positions.length,
478
+ average_position: average(entry.positions),
479
+ won_samples: entry.won,
480
+ win_rate: brandRate(entry.won),
481
+ retrieved_samples: entry.retrieved,
482
+ retrieved_rate: brandRate(entry.retrieved),
483
+ cited_samples: entry.cited,
484
+ cited_rate: brandRate(entry.cited),
214
485
  })),
215
- sources: [...sources.values()].sort((a, b) => b.count - a.count),
486
+ sources: [...sources.values()]
487
+ .map(({ pages, retrieved, cited, ...source }) => ({
488
+ ...source,
489
+ retrieved_samples: retrieved,
490
+ retrieved_rate: sourceRate(retrieved),
491
+ cited_samples: cited,
492
+ cited_rate: sourceRate(cited),
493
+ pages: [...pages.values()]
494
+ .map((page) => ({
495
+ url: page.url,
496
+ page_type: page.page_type,
497
+ retrieved_samples: page.retrieved,
498
+ cited_samples: page.cited,
499
+ }))
500
+ .sort((a, b) => b.retrieved_samples - a.retrieved_samples),
501
+ }))
502
+ .sort((a, b) => b.count - a.count),
216
503
  };
217
504
  }
218
505
  /** No fetching or execution: customer wording and citations are evidence only. */
@@ -28,13 +28,15 @@ export const ONBOARDING_LEADS_ENRICH_CONCURRENCY = 8;
28
28
  export const ONBOARDING_LEADS_TABLE = "Lead list";
29
29
  export const ONBOARDING_LEADS_UPSERT_KEY = "lead_key";
30
30
  export const ONBOARDING_LEADS_COLUMNS = [
31
+ // Email and phone right after who and where, so the chat's preview, which
32
+ // shows the first columns, shows them (dev, 2026-10-31: 608 emails, none visible).
31
33
  ["name", "Name"],
32
34
  ["title", "Title"],
33
35
  ["company", "Company"],
34
- ["company_domain", "Company domain"],
35
- ["linkedin_url", "LinkedIn URL"],
36
36
  ["email", "Email"],
37
37
  ["phone", "Phone"],
38
+ ["linkedin_url", "LinkedIn URL"],
39
+ ["company_domain", "Company domain"],
38
40
  ["location", "Location"],
39
41
  [ONBOARDING_LEADS_UPSERT_KEY, "Lead key"],
40
42
  ].map(([key, label]) => ({ key, label, dataType: "text" }));
@@ -74,5 +76,9 @@ export function onboardingLeadsReportLine(leads) {
74
76
  const contact = leads.state === "done"
75
77
  ? `${leads.emails ?? 0} with a work email and ${leads.phones ?? 0} with a phone`
76
78
  : "their work emails and phones are being found now";
77
- return `[Lead list] OXYGEN sourced ${leads.sourced} decision makers matching the ICP into the "${ONBOARDING_LEADS_TABLE}" table${where}: ${contact}.`;
79
+ // While it still sources, the count is only the first pages of up to a thousand.
80
+ const count = leads.state === "sourcing"
81
+ ? `${leads.sourced} decision makers so far (filling up to ${ONBOARDING_LEADS_TARGET.toLocaleString("en-US")})`
82
+ : `${leads.sourced} decision makers`;
83
+ return `[Lead list] OXYGEN sourced ${count} matching the ICP into the "${ONBOARDING_LEADS_TABLE}" table${where}: ${contact}.`;
78
84
  }
@@ -72,6 +72,17 @@ function uniformStep(values, rangeSize) {
72
72
  }
73
73
  return gap;
74
74
  }
75
+ // Evenly spaced values with any start ({7, 10, 13} -> 3), or null.
76
+ function evenGap(values) {
77
+ if (values.length < 2)
78
+ return null;
79
+ const gap = values[1] - values[0];
80
+ for (let i = 1; i < values.length; i += 1) {
81
+ if (values[i] - values[i - 1] !== gap)
82
+ return null;
83
+ }
84
+ return gap > 0 ? gap : null;
85
+ }
75
86
  function pad2(value) {
76
87
  return String(value).padStart(2, "0");
77
88
  }
@@ -117,11 +128,15 @@ export function humanizeCronSchedule(cron) {
117
128
  const everyDayOfWeek = coversFullRange(daysOfWeek, DAY_OF_WEEK_RANGE);
118
129
  const everyHour = coversFullRange(hours, HOUR_RANGE);
119
130
  const everyMinute = coversFullRange(minutes, MINUTE_RANGE);
131
+ // A minute list that repeats on a fixed gap through the hour, from any
132
+ // offset: 12,27,42,57 is every 15 minutes.
133
+ const minuteCycle = evenGap(minutes);
134
+ const cycleGap = minuteCycle !== null && minuteCycle * minutes.length === 60 ? minuteCycle : null;
120
135
  // Sub-hourly cadences: "Every minute" / "Every N minutes".
121
136
  if (everyHour && everyDayOfMonth && everyDayOfWeek) {
122
137
  if (everyMinute)
123
138
  return "Every minute";
124
- const minuteGap = uniformStep(minutes, 60);
139
+ const minuteGap = uniformStep(minutes, 60) ?? cycleGap;
125
140
  if (minuteGap !== null)
126
141
  return `Every ${minuteGap} minutes`;
127
142
  if (minutes.length === 1) {
@@ -130,6 +145,12 @@ export function humanizeCronSchedule(cron) {
130
145
  }
131
146
  return null;
132
147
  }
148
+ // The same cadence inside a daily window: "Every 15 minutes from 07:12 to 23:57".
149
+ if (everyDayOfMonth && everyDayOfWeek && cycleGap !== null && evenGap(hours) === 1) {
150
+ const first = timeOfDay(hours[0], minutes[0]);
151
+ const last = timeOfDay(hours[hours.length - 1], minutes[minutes.length - 1]);
152
+ return `Every ${cycleGap} minutes from ${first} to ${last}`;
153
+ }
133
154
  if (minutes.length !== 1)
134
155
  return null;
135
156
  const minute = minutes[0];
@@ -145,6 +166,13 @@ export function humanizeCronSchedule(cron) {
145
166
  if (hours.length >= 2 && hours.length <= 3) {
146
167
  return `Daily at ${hours.map((hour) => timeOfDay(hour, minute)).join(", ")}`;
147
168
  }
169
+ // A cadence inside a daily window: "Every 3 hours from 07:33 to 22:33",
170
+ // "Hourly from 07:05 to 19:05".
171
+ const windowGap = evenGap(hours);
172
+ if (windowGap !== null) {
173
+ const span = `from ${timeOfDay(hours[0], minute)} to ${timeOfDay(hours[hours.length - 1], minute)}`;
174
+ return windowGap === 1 ? `Hourly ${span}` : `Every ${windowGap} hours ${span}`;
175
+ }
148
176
  }
149
177
  if (hours.length !== 1)
150
178
  return null;
@@ -18,7 +18,9 @@ export type EnrollmentActorType = typeof ENROLLMENT_ACTOR_TYPES[number];
18
18
  /** The surface the enroll call came through. */
19
19
  export declare const ENROLLMENT_GATEWAYS: readonly ["cli", "mcp", "web", "copilot", "agent", "workflow", "engagement_watch",
20
20
  /** The scheduled sync that enrolls new rows of a live campaign's bound table. */
21
- "table_sync"];
21
+ "table_sync",
22
+ /** The scheduled sync that enrolls the people who join an Automated newsletter's subscription list. */
23
+ "list_join"];
22
24
  export type EnrollmentGateway = typeof ENROLLMENT_GATEWAYS[number];
23
25
  export declare const ENROLLMENT_REF_TYPES: readonly ["workflow_run", "agent_run", "copilot_session", "engagement_watch", "guided_activation"];
24
26
  export type EnrollmentRefType = typeof ENROLLMENT_REF_TYPES[number];
@@ -33,6 +33,8 @@ export const ENROLLMENT_GATEWAYS = [
33
33
  "engagement_watch",
34
34
  /** The scheduled sync that enrolls new rows of a live campaign's bound table. */
35
35
  "table_sync",
36
+ /** The scheduled sync that enrolls the people who join an Automated newsletter's subscription list. */
37
+ "list_join",
36
38
  ];
37
39
  export const ENROLLMENT_REF_TYPES = [
38
40
  "workflow_run",
@@ -1,3 +1,3 @@
1
1
  export declare const OXYGEN_VERSION: string;
2
- export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.1011.440";
2
+ export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.1011.469";
3
3
  export declare const GEO_EXPORT_MINIMUM_CLI_VERSION = "1.1013.0";
@@ -1 +1 @@
1
- export declare const OXYGEN_BUILD_VERSION = "1.1023.41";
1
+ export declare const OXYGEN_BUILD_VERSION = "1.1025.2";
@@ -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.1023.41";
2
+ export const OXYGEN_BUILD_VERSION = "1.1025.2";
@@ -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.1011.440";
52
+ export const OXYGEN_MINIMUM_CLI_VERSION = "1.1011.469";
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.1023.41",
3
+ "version": "1.1025.2",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import { ExtractedCommandActionHandler } from "../command-support.js";
2
- import { Command } from "commander";
3
- export declare function registerCallablesFamily(program: Command, handleAsyncAction: ExtractedCommandActionHandler): void;