@oxygen-agent/cli 1.1014.1997 → 1.1014.2040
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 +1 -1
- package/dist/command-families/tables/options.d.ts +1 -0
- package/dist/command-families/tables/register-automation.js +3 -1
- package/dist/commands/observability.js +4 -4
- package/dist/commands/table-runs.js +10 -0
- package/dist/commands/tags.js +2 -2
- package/dist/commands/workflows.js +31 -10
- package/dist/http-client.d.ts +1 -1
- package/dist/http-client.js +1 -1
- package/node_modules/@oxygen/formula/dist/cross-row-function.d.ts +13 -0
- package/node_modules/@oxygen/formula/dist/cross-row-function.js +1 -0
- package/node_modules/@oxygen/formula/dist/{refactor-internals → cross-row-functions}/novelty-score.d.ts +2 -0
- package/node_modules/@oxygen/formula/dist/{refactor-internals → cross-row-functions}/novelty-score.js +1 -0
- package/node_modules/@oxygen/formula/dist/cross-row-functions.generated.d.ts +3 -0
- package/node_modules/@oxygen/formula/dist/cross-row-functions.generated.js +3 -0
- package/node_modules/@oxygen/formula/dist/evaluate.d.ts +12 -1
- package/node_modules/@oxygen/formula/dist/evaluate.js +28 -3
- package/node_modules/@oxygen/recipe-sdk/dist/index.d.ts +2 -0
- package/node_modules/@oxygen/shared/dist/capability-discovery.js +1 -1
- package/node_modules/@oxygen/shared/dist/cell-format.js +2 -2
- package/node_modules/@oxygen/shared/dist/collab.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/contracts/geo.js +1 -1
- package/node_modules/@oxygen/shared/dist/dnc-identities.js +1 -1
- package/node_modules/@oxygen/shared/dist/error-redaction.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/error-redaction.js +2 -2
- package/node_modules/@oxygen/shared/dist/esp-contract.d.ts +133 -0
- package/node_modules/@oxygen/shared/dist/esp-contract.js +121 -0
- package/node_modules/@oxygen/shared/dist/{geo.js → geo/geo.js} +2 -2
- package/node_modules/@oxygen/shared/dist/index.d.ts +6 -5
- package/node_modules/@oxygen/shared/dist/index.js +7 -5
- package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +1 -1
- package/node_modules/@oxygen/shared/dist/linkedin-connection-identity.js +1 -1
- package/node_modules/@oxygen/shared/dist/{sending-domain-rollout.js → mailboxes/sending-domain-rollout.js} +1 -1
- package/node_modules/@oxygen/shared/dist/mcp-event-contract.js +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-core.d.ts → posts/metrics-core.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-linkedin.d.ts → posts/metrics-linkedin.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-linkedin.js → posts/metrics-linkedin.js} +2 -2
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-series.d.ts → posts/metrics-series.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-series.js → posts/metrics-series.js} +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-x.d.ts → posts/metrics-x.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{social-post-metrics-x.js → posts/metrics-x.js} +2 -2
- package/node_modules/@oxygen/shared/dist/{social-post-metrics.d.ts → posts/metrics.d.ts} +3 -3
- package/node_modules/@oxygen/shared/dist/{social-post-metrics.js → posts/metrics.js} +3 -3
- package/node_modules/@oxygen/shared/dist/recipient-provider.d.ts +2 -10
- package/node_modules/@oxygen/shared/dist/recipient-provider.js +1 -9
- package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.d.ts +2 -118
- package/node_modules/@oxygen/shared/dist/sequence-internals/esp-policy.js +2 -107
- package/node_modules/@oxygen/shared/dist/sequences.d.ts +0 -1
- package/node_modules/@oxygen/shared/dist/sequences.js +0 -2
- package/node_modules/@oxygen/shared/dist/{native-chat-discovery.d.ts → support/native-chat-discovery.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{native-chat-discovery.js → support/native-chat-discovery.js} +1 -1
- package/node_modules/@oxygen/shared/dist/suppression-entries.js +1 -1
- package/node_modules/@oxygen/shared/dist/table-field-types.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/table-field-types.js +2 -2
- package/node_modules/@oxygen/shared/dist/{column-output-fields.js → tables/column-output-fields.js} +4 -4
- package/node_modules/@oxygen/shared/dist/{tags.d.ts → tags/tags.d.ts} +1 -1
- package/node_modules/@oxygen/shared/dist/{tags.js → tags/tags.js} +1 -1
- package/node_modules/@oxygen/shared/dist/ugc-amplification-identity.js +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -1
- package/node_modules/@oxygen/shared/dist/version.generated.js +1 -1
- package/node_modules/@oxygen/shared/dist/workspace-placement-bulk.d.ts +6 -0
- package/node_modules/@oxygen/shared/dist/workspace-placement-bulk.js +9 -2
- package/node_modules/@oxygen/shared/dist/workspace-placement-schedule.d.ts +44 -0
- package/node_modules/@oxygen/shared/dist/workspace-placement-schedule.js +90 -0
- package/node_modules/@oxygen/shared/dist/workspace-placement-view.d.ts +24 -0
- package/node_modules/@oxygen/shared/dist/workspace-placement-view.js +5 -4
- package/node_modules/@oxygen/shared/dist/workspace-placement.d.ts +4 -0
- package/node_modules/@oxygen/shared/dist/workspace-placement.js +7 -1
- package/node_modules/@oxygen/shared/package.json +0 -25
- package/node_modules/@oxygen/workflows/dist/cron.d.ts +42 -0
- package/node_modules/@oxygen/workflows/dist/cron.js +271 -0
- package/node_modules/@oxygen/workflows/dist/event-dispatch.d.ts +2 -1
- package/node_modules/@oxygen/workflows/dist/graph/condition.d.ts +3 -0
- package/node_modules/@oxygen/workflows/dist/graph/condition.js +19 -0
- package/node_modules/@oxygen/workflows/dist/graph/expression.d.ts +1 -2
- package/node_modules/@oxygen/workflows/dist/graph/expression.js +2 -19
- package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +4 -3
- package/node_modules/@oxygen/workflows/dist/index.d.ts +8 -985
- package/node_modules/@oxygen/workflows/dist/index.js +8 -1221
- package/node_modules/@oxygen/workflows/dist/manifest-builders.d.ts +73 -0
- package/node_modules/@oxygen/workflows/dist/manifest-builders.js +102 -0
- package/node_modules/@oxygen/workflows/dist/manifest-guards.d.ts +16 -0
- package/node_modules/@oxygen/workflows/dist/manifest-guards.js +34 -0
- package/node_modules/@oxygen/workflows/dist/manifest-hash.d.ts +47 -0
- package/node_modules/@oxygen/workflows/dist/manifest-hash.js +102 -0
- package/node_modules/@oxygen/workflows/dist/manifest-lint.d.ts +17 -0
- package/node_modules/@oxygen/workflows/dist/manifest-lint.js +474 -0
- package/node_modules/@oxygen/workflows/dist/manifest-types.d.ts +256 -0
- package/node_modules/@oxygen/workflows/dist/manifest-types.js +9 -0
- package/node_modules/@oxygen/workflows/dist/pure-function.d.ts +17 -0
- package/node_modules/@oxygen/workflows/dist/pure-function.js +130 -0
- package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.d.ts +1 -17
- package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-comparison.js +1 -93
- package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-pattern.d.ts +16 -0
- package/node_modules/@oxygen/workflows/dist/refactor-internals/condition-pattern.js +92 -0
- package/node_modules/@oxygen/workflows/dist/workflow-schemas.d.ts +545 -0
- package/node_modules/@oxygen/workflows/dist/workflow-schemas.js +135 -0
- package/node_modules/@oxygen/workflows/package.json +4 -0
- package/package.json +1 -1
- /package/node_modules/@oxygen/shared/dist/{geo.d.ts → geo/geo.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{sending-domain-rollout.d.ts → mailboxes/sending-domain-rollout.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{attempt-provenance.d.ts → observability/attempt-provenance.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{attempt-provenance.js → observability/attempt-provenance.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-mentions.d.ts → posts/linkedin-mentions.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-mentions.js → posts/linkedin-mentions.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-post-keywords.d.ts → posts/linkedin-post-keywords.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-post-keywords.js → posts/linkedin-post-keywords.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-post-url.d.ts → posts/linkedin-post-url.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-post-url.js → posts/linkedin-post-url.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{social-post-metrics-core.js → posts/metrics-core.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{native-chat.d.ts → support/native-chat.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{native-chat.js → support/native-chat.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{plain-support-events.d.ts → support/plain-support-events.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{plain-support-events.js → support/plain-support-events.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{column-output-fields.d.ts → tables/column-output-fields.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-url.d.ts → tables/linkedin-url.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{linkedin-url.js → tables/linkedin-url.js} +0 -0
- /package/node_modules/@oxygen/shared/dist/{select-options.d.ts → tables/select-options.d.ts} +0 -0
- /package/node_modules/@oxygen/shared/dist/{select-options.js → tables/select-options.js} +0 -0
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ export function registerAutomation({ tablesCommand, handleAsyncAction }) {
|
|
|
91
91
|
.option("--max-credits <n>", "Credit ceiling PER scheduled refresh; required with --approved for paid columns.")
|
|
92
92
|
.option("--approved", "Approve the recurring paid runs; required with --max-credits for paid columns.")
|
|
93
93
|
.option("--force", "Re-run cells that already have values on every tick (full refresh instead of fill-missing).")
|
|
94
|
+
.option("--pacing <mode>", "deadline (default): each run is queued and finishes by its deadline, spread across the day; immediate: start the moment the schedule fires.")
|
|
94
95
|
.option("--json", "Print a JSON envelope.")
|
|
95
96
|
.action((table, column, options) => {
|
|
96
97
|
const maxCredits = readPositiveNumber(options.maxCredits);
|
|
@@ -104,6 +105,7 @@ export function registerAutomation({ tablesCommand, handleAsyncAction }) {
|
|
|
104
105
|
...(maxCredits !== undefined ? { max_credits: maxCredits } : {}),
|
|
105
106
|
...(options.approved ? { approved: true } : {}),
|
|
106
107
|
...(options.force ? { force: true } : {}),
|
|
108
|
+
...(readOption(options.pacing) ? { pacing: readOption(options.pacing) } : {}),
|
|
107
109
|
},
|
|
108
110
|
}));
|
|
109
111
|
}))
|
|
@@ -116,7 +118,7 @@ export function registerAutomation({ tablesCommand, handleAsyncAction }) {
|
|
|
116
118
|
return requestOxygen(`/api/cli/tables/schedule?${params.toString()}`);
|
|
117
119
|
})))
|
|
118
120
|
.addCommand(new Command("remove")
|
|
119
|
-
.description("Remove a column's scheduled refresh (deletes the backing cron workflow; future scheduled runs stop).")
|
|
121
|
+
.description("Remove a column's scheduled refresh (deletes the backing cron workflow; future scheduled runs stop, and runs it already queued that have not started are canceled: held_runs_canceled).")
|
|
120
122
|
.argument("<table>", "Table id or slug.")
|
|
121
123
|
.argument("<column>", "Column key or id.")
|
|
122
124
|
.option("--json", "Print a JSON envelope.")
|
|
@@ -30,12 +30,12 @@ export function registerObservabilityFamily(program, handleAsyncAction) {
|
|
|
30
30
|
.addCommand(new Command("events")
|
|
31
31
|
.description("List recent redacted OXYGEN operation events and failures. Customer support triage and support-event history live in Plain Inbox.")
|
|
32
32
|
// Keep in sync with OBSERVABILITY_STATUS_FILTERS in
|
|
33
|
-
// apps/web/src/lib/observability.ts and the MCP tool enum in
|
|
33
|
+
// apps/web/src/lib/observability/observability.ts and the MCP tool enum in
|
|
34
34
|
// packages/mcp-server/src/tools/observability.ts. The API rejects any
|
|
35
35
|
// other value with invalid_request so a typo fails loudly.
|
|
36
36
|
.option("--status <status>", "Filter by success, error, completed, failed, completed_with_errors, queued, skipped, or blocked.")
|
|
37
37
|
// Keep --type / --source values in sync with OBSERVABILITY_TYPE_FILTERS /
|
|
38
|
-
// OBSERVABILITY_SOURCE_FILTERS in apps/web/src/lib/observability.ts and
|
|
38
|
+
// OBSERVABILITY_SOURCE_FILTERS in apps/web/src/lib/observability/observability.ts and
|
|
39
39
|
// the MCP tool enums. The API rejects any other value with
|
|
40
40
|
// invalid_request so a typo fails loudly.
|
|
41
41
|
.option("--type <type>", "Filter by operation or provider_request.")
|
|
@@ -72,7 +72,7 @@ export function registerObservabilityFamily(program, handleAsyncAction) {
|
|
|
72
72
|
.addCommand(new Command("runs")
|
|
73
73
|
.description("List active and failed runs across workflows and table action/ingestion runs — the cross-primitive runs lens. Read-only; each failed item carries the command that resolves it.")
|
|
74
74
|
// Keep --status / --source values in sync with OBSERVABILITY_CONSOLE_STATES
|
|
75
|
-
// and OBSERVABILITY_RUN_SOURCES in apps/web/src/lib/observability
|
|
75
|
+
// and OBSERVABILITY_RUN_SOURCES in apps/web/src/lib/observability/console.ts
|
|
76
76
|
// and the MCP tool enums. The API rejects any other value with
|
|
77
77
|
// invalid_request so a typo fails loudly.
|
|
78
78
|
.option("--status <statuses>", "Comma-separated normalized states: running, queued, waiting_approval, failed, completed, canceled. Defaults to active + failed.")
|
|
@@ -101,7 +101,7 @@ export function registerObservabilityFamily(program, handleAsyncAction) {
|
|
|
101
101
|
.addCommand(new Command("approvals")
|
|
102
102
|
.description("List everything waiting for a human decision across workflows, publishing, message reviews, inbox reply drafts, and collaboration approval requests — the cross-primitive approvals inbox. Read-only: each item includes the exact command to resolve it and a web link to decide.")
|
|
103
103
|
// Keep --source values in sync with OBSERVABILITY_APPROVAL_SOURCES in
|
|
104
|
-
// apps/web/src/lib/observability
|
|
104
|
+
// apps/web/src/lib/observability/console.ts and the MCP tool enum. The API
|
|
105
105
|
// rejects any other value with invalid_request so a typo fails loudly.
|
|
106
106
|
.option("--source <sources>", "Comma-separated sources: workflow, publishing, message_review, inbox_draft, collab_request.")
|
|
107
107
|
.option("--limit <n>", "Maximum items per source (default 25, max 100). Counts reflect the returned page only.")
|
|
@@ -228,6 +228,16 @@ export function registerTableRunsFamily(program, handleAsyncAction) {
|
|
|
228
228
|
method: "POST",
|
|
229
229
|
body: {},
|
|
230
230
|
}));
|
|
231
|
+
}))
|
|
232
|
+
.addCommand(new Command("run-now")
|
|
233
|
+
.description("Start a deadline-queued scheduled run now instead of waiting for its turn (scheduled runs are queued to finish by their deadline, usually 24 hours after the schedule fired). No effect on a run that already started.")
|
|
234
|
+
.argument("<run_id>", "Table action run UUID.")
|
|
235
|
+
.option("--json", "Print a JSON envelope.")
|
|
236
|
+
.action(async (runId, options) => {
|
|
237
|
+
await handleAsyncAction("table-runs run-now", options, () => requestOxygen(`/api/cli/table-action-runs/${encodeURIComponent(runId)}/run-now`, {
|
|
238
|
+
method: "POST",
|
|
239
|
+
body: {},
|
|
240
|
+
}));
|
|
231
241
|
}))
|
|
232
242
|
.addCommand(new Command("effect-unknown")
|
|
233
243
|
.description("List the items of a run whose external write was dispatched but never confirmed. Oxygen will not retry them on its own: verify each destination, then record what you found with `oxygen cells resolve`.")
|
package/dist/commands/tags.js
CHANGED
|
@@ -2,8 +2,8 @@ import { splitCommaList } from "../command-support.js";
|
|
|
2
2
|
import { requestOxygen } from "../http-client.js";
|
|
3
3
|
import { readOption } from "../util.js";
|
|
4
4
|
import { OxygenError } from "@oxygen/shared/cli-result";
|
|
5
|
-
import { TAG_COLORS } from "@oxygen/shared/select-options";
|
|
6
|
-
import { TAG_KINDS_PROSE } from "@oxygen/shared/tags";
|
|
5
|
+
import { TAG_COLORS } from "@oxygen/shared/tables/select-options";
|
|
6
|
+
import { TAG_KINDS_PROSE } from "@oxygen/shared/tags/tags";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
/**
|
|
9
9
|
* Build the registry patch body. An omitted field keeps its stored value; an
|
|
@@ -374,16 +374,37 @@ function scaffoldWorkflowProject(options) {
|
|
|
374
374
|
? scaffoldRecipeProject(options)
|
|
375
375
|
: scaffoldGraphProject(options);
|
|
376
376
|
}
|
|
377
|
+
const RELATIVE_DTS_SPECIFIER = /(?:\bfrom\s+|\bimport\(\s*)["'](\.{1,2}\/[^"']+)\.js["']/g;
|
|
378
|
+
/**
|
|
379
|
+
* The package's index.d.ts plus every declaration file it reaches through relative
|
|
380
|
+
* specifiers, as paths relative to dist/. An entry that re-exports its types from
|
|
381
|
+
* sibling modules is only typed when those siblings are vendored next to it.
|
|
382
|
+
*/
|
|
377
383
|
function readBundledSdkDts(pkg) {
|
|
378
384
|
for (const base of RECIPE_ESBUILD_NODE_PATHS) {
|
|
379
|
-
const
|
|
380
|
-
if (existsSync(
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
const dist = join(base, "@oxygen", pkg, "dist");
|
|
386
|
+
if (!existsSync(join(dist, "index.d.ts")))
|
|
387
|
+
continue;
|
|
388
|
+
try {
|
|
389
|
+
const files = [];
|
|
390
|
+
const queue = ["index.d.ts"];
|
|
391
|
+
const seen = new Set(queue);
|
|
392
|
+
while (queue.length) {
|
|
393
|
+
const file = queue.shift();
|
|
394
|
+
const content = readFileSync(join(dist, file), "utf8");
|
|
395
|
+
files.push({ file, content });
|
|
396
|
+
for (const match of content.matchAll(RELATIVE_DTS_SPECIFIER)) {
|
|
397
|
+
const next = join(dirname(file), `${match[1]}.d.ts`).replaceAll("\\", "/");
|
|
398
|
+
if (next.startsWith("..") || seen.has(next) || !existsSync(join(dist, next)))
|
|
399
|
+
continue;
|
|
400
|
+
seen.add(next);
|
|
401
|
+
queue.push(next);
|
|
402
|
+
}
|
|
386
403
|
}
|
|
404
|
+
return files;
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
// Unreadable copy — fall through to the next node path.
|
|
387
408
|
}
|
|
388
409
|
}
|
|
389
410
|
return null;
|
|
@@ -463,8 +484,8 @@ function scaffoldRecipeProject(options) {
|
|
|
463
484
|
const targets = [
|
|
464
485
|
{ path: join(directory, recipeFileName), content: renderStarterRecipe(recipeId, recipeName) },
|
|
465
486
|
{ path: join(directory, "tsconfig.json"), content: renderRecipeTsconfig() },
|
|
466
|
-
{ path: join(directory, RECIPE_TYPES_VENDOR_DIR, "@oxygen", "recipe-sdk",
|
|
467
|
-
{ path: join(directory, RECIPE_TYPES_VENDOR_DIR, "@oxygen", "workflows",
|
|
487
|
+
...recipeDts.map(({ file, content }) => ({ path: join(directory, RECIPE_TYPES_VENDOR_DIR, "@oxygen", "recipe-sdk", file), content })),
|
|
488
|
+
...workflowsDts.map(({ file, content }) => ({ path: join(directory, RECIPE_TYPES_VENDOR_DIR, "@oxygen", "workflows", file), content })),
|
|
468
489
|
];
|
|
469
490
|
const filesWritten = [];
|
|
470
491
|
const filesSkipped = [];
|
|
@@ -1597,7 +1618,7 @@ Full trigger schema: oxygen workflows schema --subject trigger --json
|
|
|
1597
1618
|
}
|
|
1598
1619
|
}))
|
|
1599
1620
|
.addCommand(new Command("disable")
|
|
1600
|
-
.description("Disable one or more workflow automations and their current triggers. Records who disabled it, from where, and why — the workspace sees it on the workflow. Pass several workflows to disable them in one bulk call.")
|
|
1621
|
+
.description("Disable one or more workflow automations and their current triggers. Records who disabled it, from where, and why — the workspace sees it on the workflow. Disabling a Table schedule also cancels the runs it queued that have not started. Pass several workflows to disable them in one bulk call.")
|
|
1601
1622
|
.argument("<workflows...>", "One or more workflow ids, slugs, or names.")
|
|
1602
1623
|
.option("--reason <text>", "Why you are disabling it. Recorded on the workflow and shown to the workspace.")
|
|
1603
1624
|
.option("--json", "Print a JSON envelope.")
|
package/dist/http-client.d.ts
CHANGED
package/dist/http-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readGeoExportPagination } from "@oxygen/shared/geo";
|
|
1
|
+
import { readGeoExportPagination } from "@oxygen/shared/geo/geo";
|
|
2
2
|
import { isCliResult, readEnvelopeCompatibility, vercelProtectionBypassHeaders, withRetryAfterDetails, } from "@oxygen/shared/cli-envelope";
|
|
3
3
|
import { OxygenError } from "@oxygen/shared/cli-result";
|
|
4
4
|
import { isVersionGreater, parseSemver } from "@oxygen/shared/semver";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One cross-row formula function (`novelty_score`, ...). Each lives in its own
|
|
3
|
+
* `cross-row-functions/<name>.ts`, exporting `crossRowFunction`, and is loaded
|
|
4
|
+
* through `cross-row-functions.generated.ts` (scripts/codegen/
|
|
5
|
+
* formula-cross-row-functions.mjs), so editing one does not reach every host
|
|
6
|
+
* that evaluates a formula. The evaluator keeps the host-facing contract:
|
|
7
|
+
* arity, the column-key argument and corpus availability.
|
|
8
|
+
*/
|
|
9
|
+
export type FormulaCrossRowFunction = {
|
|
10
|
+
/** Compute the row's value from its own cell and the column's corpus. */
|
|
11
|
+
evaluate(value: unknown, corpus: readonly string[]): unknown;
|
|
12
|
+
};
|
|
13
|
+
export type FormulaCrossRowFunctionLoaders = Record<string, () => Promise<FormulaCrossRowFunction>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { FormulaCrossRowFunction } from "../cross-row-function.js";
|
|
2
|
+
export declare const crossRowFunction: FormulaCrossRowFunction;
|
|
1
3
|
/** Score a value against a supplied column corpus, excluding one exact self row. */
|
|
2
4
|
export declare function evaluateNoveltyScore(value: unknown, corpus: readonly string[]): number | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Corpus scoring is independent of scope resolution, expression dispatch and
|
|
2
2
|
// corpus availability errors. The evaluator owns those host-facing contracts.
|
|
3
3
|
import { isRecord } from "../coerce.js";
|
|
4
|
+
export const crossRowFunction = { evaluate: evaluateNoveltyScore };
|
|
4
5
|
/** Score a value against a supplied column corpus, excluding one exact self row. */
|
|
5
6
|
export function evaluateNoveltyScore(value, corpus) {
|
|
6
7
|
const cellValue = stringifyNoveltyValue(value);
|
|
@@ -26,11 +26,22 @@ export type FormulaScope = {
|
|
|
26
26
|
* Omit it and the strict `resolve` is used, with its throw absorbed.
|
|
27
27
|
*/
|
|
28
28
|
resolveOptional?(identifier: string): unknown;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Cross-row corpus, required by `novelty_score`. A host that supplies one
|
|
31
|
+
* awaits `loadFormulaCrossRowFunctions` before evaluating.
|
|
32
|
+
*/
|
|
30
33
|
corpus?: FormulaCrossRowCorpus;
|
|
31
34
|
/** The key being computed — carried for self-reference guards. */
|
|
32
35
|
selfKey?: string;
|
|
33
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Load cross-row function implementations (`novelty_score`, ...) so evaluation
|
|
39
|
+
* can stay synchronous. A host that supplies `FormulaScope.corpus` awaits this
|
|
40
|
+
* once, with the names `analyzeFormulaCrossRowDependencies` returned, before
|
|
41
|
+
* evaluating. Omit `names` to load every cross-row function; unknown names are
|
|
42
|
+
* left for evaluation to reject.
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadFormulaCrossRowFunctions(names?: Iterable<string>): Promise<void>;
|
|
34
45
|
export declare function evaluateFormulaInScope(expression: string, scope: FormulaScope, options?: ParseOptions): unknown;
|
|
35
46
|
export declare function evaluateFormulaAst(node: FormulaAst, scope: FormulaScope): unknown;
|
|
36
47
|
/** Coerce a formula result to the boolean gate decision used for run conditions. */
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { OxygenError } from "@oxygen/shared/cli-result";
|
|
2
|
-
import {
|
|
2
|
+
import { FORMULA_CROSS_ROW_FUNCTION_LOADERS } from "./cross-row-functions.generated.js";
|
|
3
3
|
import { CROSS_ROW_FUNCTIONS, parseFormulaExpression, } from "./expression.js";
|
|
4
4
|
import { FORMULA_FUNCTION_REGISTRY, checkFormulaFunctionArity, compareFormulaValues, unsupportedFormulaFunctionError, formulaExpressionError, formulaValuesEqual, readFormulaNumber, toFormulaBoolean, } from "./formula-functions.js";
|
|
5
|
+
const loadedCrossRowFunctions = new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Load cross-row function implementations (`novelty_score`, ...) so evaluation
|
|
8
|
+
* can stay synchronous. A host that supplies `FormulaScope.corpus` awaits this
|
|
9
|
+
* once, with the names `analyzeFormulaCrossRowDependencies` returned, before
|
|
10
|
+
* evaluating. Omit `names` to load every cross-row function; unknown names are
|
|
11
|
+
* left for evaluation to reject.
|
|
12
|
+
*/
|
|
13
|
+
export async function loadFormulaCrossRowFunctions(names) {
|
|
14
|
+
const wanted = names
|
|
15
|
+
? [...names].map((name) => name.toLowerCase())
|
|
16
|
+
: Object.keys(FORMULA_CROSS_ROW_FUNCTION_LOADERS);
|
|
17
|
+
await Promise.all(wanted.map(async (name) => {
|
|
18
|
+
if (loadedCrossRowFunctions.has(name) || !isCrossRowFunctionName(name))
|
|
19
|
+
return;
|
|
20
|
+
loadedCrossRowFunctions.set(name, await FORMULA_CROSS_ROW_FUNCTION_LOADERS[name]());
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function isCrossRowFunctionName(name) {
|
|
24
|
+
return Object.hasOwn(FORMULA_CROSS_ROW_FUNCTION_LOADERS, name);
|
|
25
|
+
}
|
|
5
26
|
export function evaluateFormulaInScope(expression, scope, options = {}) {
|
|
6
27
|
return evaluateFormulaAst(parseFormulaExpression(expression, options), scope);
|
|
7
28
|
}
|
|
@@ -54,7 +75,7 @@ export function isTruthyFormulaResult(value) {
|
|
|
54
75
|
return value !== null && value !== undefined;
|
|
55
76
|
}
|
|
56
77
|
function evaluateCrossRowFunction(input) {
|
|
57
|
-
if (input.name
|
|
78
|
+
if (!isCrossRowFunctionName(input.name)) {
|
|
58
79
|
throw formulaExpressionError("Unsupported cross-row formula function.", {
|
|
59
80
|
function: input.name,
|
|
60
81
|
});
|
|
@@ -84,7 +105,11 @@ function evaluateCrossRowFunction(input) {
|
|
|
84
105
|
exitCode: 1,
|
|
85
106
|
});
|
|
86
107
|
}
|
|
87
|
-
|
|
108
|
+
const implementation = loadedCrossRowFunctions.get(input.name);
|
|
109
|
+
if (!implementation) {
|
|
110
|
+
throw new OxygenError("formula_cross_row_function_not_loaded", `${input.name} was evaluated before its implementation loaded. The host must await loadFormulaCrossRowFunctions() before evaluating with a corpus.`, { details: { function: input.name }, exitCode: 1 });
|
|
111
|
+
}
|
|
112
|
+
return implementation.evaluate(readOptionalValue(input.scope, targetColumnKey), corpus);
|
|
88
113
|
}
|
|
89
114
|
/**
|
|
90
115
|
* Cross-row functions take a column key, not an in-scope identifier: a column
|
|
@@ -80,6 +80,8 @@ export type RecipeColumnsApi = {
|
|
|
80
80
|
maxConcurrency?: number;
|
|
81
81
|
maxCredits?: number;
|
|
82
82
|
max_credits?: number;
|
|
83
|
+
/** "immediate" starts a scheduled run at once; "deadline" queues it to finish within 24 hours. */
|
|
84
|
+
pacing?: "deadline" | "immediate";
|
|
83
85
|
key?: string;
|
|
84
86
|
}) => Promise<T>;
|
|
85
87
|
};
|
|
@@ -6,7 +6,7 @@ import { isCompanySourcingIntent, sourcingPlaybookFor } from "./capability-inten
|
|
|
6
6
|
import { CAPABILITY_ROUTE_DEFINITIONS } from "./capability-routes/index.js";
|
|
7
7
|
import { findEnrichmentIntentByAlias } from "./enrichment-intents.js";
|
|
8
8
|
import { networkMiningEnabled } from "./network-mining.js";
|
|
9
|
-
import { nativeChatEnabled, withNativeChatDiscovery } from "./native-chat-discovery.js";
|
|
9
|
+
import { nativeChatEnabled, withNativeChatDiscovery } from "./support/native-chat-discovery.js";
|
|
10
10
|
import { RECIPE_PRIMITIVES } from "./recipes.js";
|
|
11
11
|
import { matchSkillPlay } from "./skill-play-routing.js";
|
|
12
12
|
export { matchSkillPlay, SKILL_PLAY_TRIGGERS } from "./skill-play-routing.js";
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* version strings, phone numbers, URLs): {@link rescueNumericText} returns
|
|
15
15
|
* null for those.
|
|
16
16
|
*/
|
|
17
|
-
import { columnOutputPrimaryField } from "./column-output-fields.js";
|
|
18
|
-
import { isMarkdownColumnSemantic } from "./select-options.js";
|
|
17
|
+
import { columnOutputPrimaryField } from "./tables/column-output-fields.js";
|
|
18
|
+
import { isMarkdownColumnSemantic } from "./tables/select-options.js";
|
|
19
19
|
const DEFAULT_LOCALE = "en-US";
|
|
20
20
|
const INTEGER_RE = /^-?\d{1,15}$/;
|
|
21
21
|
const DECIMAL_RE = /^-?\d{1,15}(?:\.\d{1,9})?$/;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeLinkedinProfileUrl } from "./linkedin-url.js";
|
|
1
|
+
import { normalizeLinkedinProfileUrl } from "./tables/linkedin-url.js";
|
|
2
2
|
import { LINKEDIN_MEMBER_URN_PATTERN } from "./suppression-entries.js";
|
|
3
3
|
/**
|
|
4
4
|
* Source-neutral identities accepted by the unified DNC write contract.
|
|
@@ -40,7 +40,7 @@ export declare function isSqlLikeMessage(message: string): boolean;
|
|
|
40
40
|
/**
|
|
41
41
|
* Redact a metadata / details payload for an operation event: cap the structure,
|
|
42
42
|
* blank secret-named fields, truncate long strings. Extracted verbatim from
|
|
43
|
-
* apps/web/src/lib/observability.ts so the web and the worker share one
|
|
43
|
+
* apps/web/src/lib/observability/observability.ts so the web and the worker share one
|
|
44
44
|
* implementation; behavior there is unchanged.
|
|
45
45
|
*/
|
|
46
46
|
export declare function redactForOperationEvent(value: unknown, depth?: number): unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The ONE redactor for error payloads we persist and show to a customer.
|
|
2
2
|
//
|
|
3
3
|
// Two callers, one implementation: the web API's operation-event writer
|
|
4
|
-
// (apps/web/src/lib/observability.ts) and the worker's durable-run failure
|
|
4
|
+
// (apps/web/src/lib/observability/observability.ts) and the worker's durable-run failure
|
|
5
5
|
// writers (workflow_runs.last_error, workflow_step_runs.last_error,
|
|
6
6
|
// workflow_step_attempts.error). Before this module the worker had no redaction
|
|
7
7
|
// at all and wrote `error.message` verbatim, which put internal detail in front
|
|
@@ -135,7 +135,7 @@ function scrubCustomerFacingString(value) {
|
|
|
135
135
|
/**
|
|
136
136
|
* Redact a metadata / details payload for an operation event: cap the structure,
|
|
137
137
|
* blank secret-named fields, truncate long strings. Extracted verbatim from
|
|
138
|
-
* apps/web/src/lib/observability.ts so the web and the worker share one
|
|
138
|
+
* apps/web/src/lib/observability/observability.ts so the web and the worker share one
|
|
139
139
|
* implementation; behavior there is unchanged.
|
|
140
140
|
*/
|
|
141
141
|
export function redactForOperationEvent(value, depth = 0) {
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ESP vocabulary: matching modes, routing-policy shapes and recipient families.
|
|
3
|
+
* Declarations only, so contracts and settings types can name them without loading
|
|
4
|
+
* the routing and MX-inference code in `sequence-internals/esp-policy.ts`, which re-exports all of it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* ESP (email service provider) MATCHING mode for a sequence (settings.esp_matching).
|
|
8
|
+
* Deliverability lore: a send lands better when the SENDING mailbox and the
|
|
9
|
+
* RECIPIENT sit on the same provider (Google→Google, Microsoft→Microsoft), so at
|
|
10
|
+
* mailbox-pick the dispatcher can bias rotation toward a same-ESP mailbox.
|
|
11
|
+
* - "off" — no ESP bias; rotation is pure LRU / domain-spread.
|
|
12
|
+
* - "prefer" — (DEFAULT) pick a same-ESP mailbox when one is available, else
|
|
13
|
+
* fall back to any sendable mailbox (never blocks a send). On by default
|
|
14
|
+
* because it only ever improves deliverability and cannot starve sends.
|
|
15
|
+
* - "strict" — require a same-ESP mailbox; when none is available the action is
|
|
16
|
+
* DEFERRED with a visible skipped_reason rather than sent cross-provider.
|
|
17
|
+
* Power-user setting, reachable via CLI/MCP; the web "Provider Matching"
|
|
18
|
+
* checkbox toggles off↔prefer only.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ESP_MATCHING_MODES: readonly ["off", "prefer", "strict"];
|
|
21
|
+
export type EspMatchingMode = (typeof ESP_MATCHING_MODES)[number];
|
|
22
|
+
export declare const DEFAULT_ESP_MATCHING_MODE: EspMatchingMode;
|
|
23
|
+
/**
|
|
24
|
+
* The MATCHABLE email-provider a recipient routes through — the narrow set ESP
|
|
25
|
+
* matching can act on. Kept intentionally aligned with EMAIL_MAILBOX_PROVIDERS in
|
|
26
|
+
* tenant-db so a mailbox's `provider` and a resolved recipient ESP compare
|
|
27
|
+
* directly: we can only bias rotation toward a provider we can actually SEND
|
|
28
|
+
* from, and the pool is Google/Microsoft only.
|
|
29
|
+
*
|
|
30
|
+
* This is deliberately NARROWER than RECIPIENT_ESP_FAMILIES (what we DISPLAY).
|
|
31
|
+
* A domain behind Proofpoint has family "proofpoint" but may still be matchable
|
|
32
|
+
* as "microsoft" — see resolveEspFamily.
|
|
33
|
+
*/
|
|
34
|
+
export declare const RECIPIENT_ESPS: readonly ["google", "microsoft"];
|
|
35
|
+
export type RecipientEsp = (typeof RECIPIENT_ESPS)[number];
|
|
36
|
+
/**
|
|
37
|
+
* WEIGHTED SENDER ROUTING — the object form of settings.esp_matching.
|
|
38
|
+
*
|
|
39
|
+
* The three scalar modes above answer one question ("bias toward the recipient's
|
|
40
|
+
* own provider, yes or no"), and they bake in the assumption that same-provider
|
|
41
|
+
* is always better. That assumption fails whenever one provider's senders are in
|
|
42
|
+
* bad standing: a workspace whose Google-hosted domains are refused by Gmail
|
|
43
|
+
* wants its Google-hosted RECIPIENTS served from Microsoft senders, which no
|
|
44
|
+
* scalar mode can express. "off" does not express it either, because free
|
|
45
|
+
* rotation still hands Google recipients a Google sender in proportion to the
|
|
46
|
+
* pool.
|
|
47
|
+
*
|
|
48
|
+
* So the object form states the routing directly, as SEND SHARES per recipient
|
|
49
|
+
* provider:
|
|
50
|
+
*
|
|
51
|
+
* { mode: "prefer",
|
|
52
|
+
* routes: { google: { microsoft: 100 }, microsoft: { microsoft: 100 } },
|
|
53
|
+
* exclude: [{ domain: "burned.example", from_recipients: ["google"] }] }
|
|
54
|
+
*
|
|
55
|
+
* `routes` is keyed by the RECIPIENT's resolved provider; the inner map is the
|
|
56
|
+
* SENDER provider. Weights are relative shares, so { google: 3, microsoft: 1 }
|
|
57
|
+
* and { google: 75, microsoft: 25 } are the same policy and nothing has to sum
|
|
58
|
+
* to 100. An omitted weight is zero. A bucket whose entry is explicitly present
|
|
59
|
+
* but carries no positive weight means "no opinion, rotate freely for this
|
|
60
|
+
* recipient class"; a bucket the operator never mentioned keeps the historical
|
|
61
|
+
* same-provider default, so editing Google routing cannot silently change how
|
|
62
|
+
* Microsoft recipients are served.
|
|
63
|
+
*
|
|
64
|
+
* `exclude` is a hard never, not a preference: a sender domain listed here is
|
|
65
|
+
* removed from the candidate pool for the named recipient buckets (all buckets
|
|
66
|
+
* when `from_recipients` is absent) in EVERY mode, including "off", and it
|
|
67
|
+
* survives the prefer-fallback. A deliverability guard that a matching toggle
|
|
68
|
+
* could disarm would not be a guard.
|
|
69
|
+
*
|
|
70
|
+
* The scalar modes remain valid values and are read as policies, so there is one
|
|
71
|
+
* routing code path rather than two: "prefer" becomes { mode: "prefer" } with no
|
|
72
|
+
* routes, which resolves to the same-provider default and behaves exactly as it
|
|
73
|
+
* did before.
|
|
74
|
+
*/
|
|
75
|
+
export declare const ESP_ROUTE_BUCKETS: readonly ["google", "microsoft", "unknown"];
|
|
76
|
+
/** The RECIPIENT side of a route: a matchable provider, or "unknown" when resolution failed. */
|
|
77
|
+
export type EspRouteBucket = (typeof ESP_ROUTE_BUCKETS)[number];
|
|
78
|
+
/** The SENDER side of a route: relative send shares per mailbox provider. */
|
|
79
|
+
export type EspRouteWeights = Partial<Record<RecipientEsp, number>>;
|
|
80
|
+
export type EspSenderExclusion = {
|
|
81
|
+
domain: string;
|
|
82
|
+
from_recipients?: EspRouteBucket[];
|
|
83
|
+
};
|
|
84
|
+
export type EspRoutingPolicy = {
|
|
85
|
+
mode?: EspMatchingMode;
|
|
86
|
+
routes?: Partial<Record<EspRouteBucket, EspRouteWeights>>;
|
|
87
|
+
exclude?: EspSenderExclusion[];
|
|
88
|
+
};
|
|
89
|
+
/** settings.esp_matching accepts either the legacy scalar or the routing policy. */
|
|
90
|
+
export type EspMatchingSetting = EspMatchingMode | EspRoutingPolicy;
|
|
91
|
+
/**
|
|
92
|
+
* A policy with every field present, which is what the dispatcher and the launch
|
|
93
|
+
* preview consume. Produced only by espPolicyFromSetting so both surfaces answer
|
|
94
|
+
* identically from the same stored value.
|
|
95
|
+
*/
|
|
96
|
+
export type ResolvedEspPolicy = {
|
|
97
|
+
mode: EspMatchingMode;
|
|
98
|
+
routes: Partial<Record<EspRouteBucket, EspRouteWeights>>;
|
|
99
|
+
exclude: Array<{
|
|
100
|
+
domain: string;
|
|
101
|
+
buckets: readonly EspRouteBucket[];
|
|
102
|
+
}>;
|
|
103
|
+
};
|
|
104
|
+
/** Cap on settings.esp_matching.exclude — a routing policy, not a suppression list. */
|
|
105
|
+
export declare const MAX_ESP_SENDER_EXCLUSIONS = 50;
|
|
106
|
+
/** Upper bound on a single route weight; relative shares never need more. */
|
|
107
|
+
export declare const MAX_ESP_ROUTE_WEIGHT = 1000000;
|
|
108
|
+
/**
|
|
109
|
+
* The DISPLAY taxonomy: the mail-infrastructure family a recipient domain sits
|
|
110
|
+
* on. Wider than RecipientEsp because "everything that isn't Google or Microsoft"
|
|
111
|
+
* is not one thing — a list that is 23% Proofpoint is a very different
|
|
112
|
+
* deliverability problem from one that is 23% self-hosted, and collapsing both to
|
|
113
|
+
* null (today's behavior) hides that. Split into three groups:
|
|
114
|
+
*
|
|
115
|
+
* - MAILBOX providers (google, microsoft) — imply a matchable ESP.
|
|
116
|
+
* - GATEWAY vendors (proofpoint, mimecast, ...) — security filters that sit IN
|
|
117
|
+
* FRONT of a mailbox provider. Their MX tells you the filter, NOT where the
|
|
118
|
+
* mailbox lives; the SPF fallback is what sees behind them.
|
|
119
|
+
* - OTHER mailbox hosts (zoho, yahoo, fastmail, ...) and self_hosted — real
|
|
120
|
+
* destinations we simply cannot send as, so never matchable.
|
|
121
|
+
*/
|
|
122
|
+
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"];
|
|
123
|
+
export type RecipientEspFamily = (typeof RECIPIENT_ESP_FAMILIES)[number];
|
|
124
|
+
/**
|
|
125
|
+
* The recipient side of a deliverability breakdown: which mail infrastructure accepted (or refused)
|
|
126
|
+
* a send. One vocabulary over the ESP-family tables in `sequence-internals/esp-policy.ts`, so MX
|
|
127
|
+
* suffixes and consumer domains are never listed twice. Google and Microsoft are mailbox hosts; the
|
|
128
|
+
* four named gateways front most enterprise mailboxes and filter differently from the host behind
|
|
129
|
+
* them. Every other resolved family (Zoho, Yahoo, other gateways, self-hosted) is `other`;
|
|
130
|
+
* an unresolved or failed lookup is `unknown`, never `other`.
|
|
131
|
+
*/
|
|
132
|
+
export declare const RECIPIENT_PROVIDERS: readonly ["google", "microsoft", "proofpoint", "mimecast", "barracuda", "cisco", "other", "unknown"];
|
|
133
|
+
export type RecipientProvider = (typeof RECIPIENT_PROVIDERS)[number];
|