@oxygen-agent/cli 1.739.1 → 1.766.0
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-manifest.js +17 -2
- package/dist/help.js +8 -0
- package/dist/index.js +562 -125
- package/node_modules/@oxygen/shared/dist/billing.d.ts +88 -46
- package/node_modules/@oxygen/shared/dist/billing.js +134 -74
- package/node_modules/@oxygen/shared/dist/capability-discovery.js +12 -4
- package/node_modules/@oxygen/shared/dist/cli-result.js +1 -0
- package/node_modules/@oxygen/shared/dist/copilot-journeys.d.ts +8 -0
- package/node_modules/@oxygen/shared/dist/copilot-journeys.js +23 -5
- package/node_modules/@oxygen/shared/dist/future-signup-events.d.ts +13 -2
- package/node_modules/@oxygen/shared/dist/future-signup-events.js +17 -2
- package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.d.ts +106 -1
- package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.js +156 -45
- package/node_modules/@oxygen/shared/dist/index.d.ts +5 -1
- package/node_modules/@oxygen/shared/dist/index.js +5 -1
- package/node_modules/@oxygen/shared/dist/object-storage.d.ts +33 -0
- package/node_modules/@oxygen/shared/dist/object-storage.js +69 -4
- package/node_modules/@oxygen/shared/dist/person-name.d.ts +40 -0
- package/node_modules/@oxygen/shared/dist/person-name.js +23 -0
- package/node_modules/@oxygen/shared/dist/plan-capabilities.d.ts +82 -0
- package/node_modules/@oxygen/shared/dist/plan-capabilities.js +130 -0
- package/node_modules/@oxygen/shared/dist/plan-limits.d.ts +2 -2
- package/node_modules/@oxygen/shared/dist/plan-limits.js +18 -2
- package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +50 -56
- package/node_modules/@oxygen/shared/dist/pricing-sheet.js +77 -90
- package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.d.ts +62 -0
- package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.js +91 -0
- package/node_modules/@oxygen/shared/dist/provider-funding-errors.d.ts +44 -0
- package/node_modules/@oxygen/shared/dist/provider-funding-errors.js +81 -0
- package/node_modules/@oxygen/shared/dist/publishing-limits.d.ts +24 -0
- package/node_modules/@oxygen/shared/dist/publishing-limits.js +24 -0
- package/node_modules/@oxygen/shared/dist/spend-safety.d.ts +27 -6
- package/node_modules/@oxygen/shared/dist/spend-safety.js +34 -6
- package/node_modules/@oxygen/shared/dist/version.d.ts +2 -1
- package/node_modules/@oxygen/shared/dist/version.js +14 -3
- package/node_modules/@oxygen/shared/package.json +10 -0
- package/node_modules/@oxygen/workflows/dist/graph/expression.d.ts +29 -1
- package/node_modules/@oxygen/workflows/dist/graph/expression.js +307 -42
- package/node_modules/@oxygen/workflows/dist/graph/index.d.ts +1 -0
- package/node_modules/@oxygen/workflows/dist/graph/index.js +1 -0
- package/node_modules/@oxygen/workflows/dist/graph/lint.js +153 -19
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.d.ts +92 -0
- package/node_modules/@oxygen/workflows/dist/graph/manifest-schema.js +4 -0
- package/node_modules/@oxygen/workflows/dist/graph/mapping.d.ts +79 -0
- package/node_modules/@oxygen/workflows/dist/graph/mapping.js +436 -0
- package/node_modules/@oxygen/workflows/dist/graph/topology.d.ts +36 -0
- package/node_modules/@oxygen/workflows/dist/graph/topology.js +147 -0
- package/node_modules/@oxygen/workflows/dist/graph/types.d.ts +31 -0
- package/node_modules/@oxygen/workflows/dist/graph/types.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One vocabulary for "the provider refused because of money".
|
|
3
|
+
*
|
|
4
|
+
* A provider 402 has reached customers wearing four different costumes:
|
|
5
|
+
* - `provider_credits_exhausted` (tool runner, managed pool)
|
|
6
|
+
* - `connection_credits_exhausted` (tool runner, BYOK connection)
|
|
7
|
+
* - `provider_insufficient_credits` (enrichment column runner + waterfall)
|
|
8
|
+
* - `provider_credit_exhausted` (worker lane exclusion, singular)
|
|
9
|
+
* plus `provider_plan_limit` for the adjacent "your plan does not include this"
|
|
10
|
+
* refusal, which is also a money problem and also not retryable.
|
|
11
|
+
*
|
|
12
|
+
* Only the first two were known to the run-bottleneck classifier. The others
|
|
13
|
+
* fell through to a `/rate|limit|429/` test — which `provider_plan_limit`
|
|
14
|
+
* matches on the substring "limit" — or to the deferral branch, so a hard 402
|
|
15
|
+
* surfaced to the customer as `bottlenecks: [provider_rate_limit]`. That reads
|
|
16
|
+
* as "wait and retry": a partner agency spent hours lowering concurrency against
|
|
17
|
+
* an account that was simply out of credits, and the real 402 was only visible
|
|
18
|
+
* through a different command.
|
|
19
|
+
*
|
|
20
|
+
* The distinction that matters operationally: a rate limit clears by waiting, a
|
|
21
|
+
* funding failure never does. Anything that decides "should the customer wait?"
|
|
22
|
+
* must ask this predicate, not a regex over the code string.
|
|
23
|
+
*/
|
|
24
|
+
/** Codes meaning the provider refused for funding/entitlement reasons. Never retryable by waiting. */
|
|
25
|
+
export const PROVIDER_FUNDING_ERROR_CODES = [
|
|
26
|
+
"provider_credits_exhausted",
|
|
27
|
+
"provider_credits_exhausted_deferred",
|
|
28
|
+
"connection_credits_exhausted",
|
|
29
|
+
"provider_insufficient_credits",
|
|
30
|
+
"provider_credit_exhausted",
|
|
31
|
+
"provider_plan_limit",
|
|
32
|
+
"blocked_provider_funding",
|
|
33
|
+
];
|
|
34
|
+
const FUNDING_CODE_SET = new Set(PROVIDER_FUNDING_ERROR_CODES);
|
|
35
|
+
/**
|
|
36
|
+
* True when the code means "this failed over money", in any of its spellings.
|
|
37
|
+
*
|
|
38
|
+
* Matches on the exact code first, then falls back to a narrow shape test so a
|
|
39
|
+
* provider-specific variant (`peopledatalabs_credits_exhausted`) is still
|
|
40
|
+
* classified as funding rather than silently treated as retryable. Deliberately
|
|
41
|
+
* does NOT match on "limit" alone — `rate_limit_exceeded` is a real rate limit.
|
|
42
|
+
*/
|
|
43
|
+
export function isProviderFundingErrorCode(code) {
|
|
44
|
+
if (!code)
|
|
45
|
+
return false;
|
|
46
|
+
const normalized = code.trim().toLowerCase();
|
|
47
|
+
if (!normalized)
|
|
48
|
+
return false;
|
|
49
|
+
if (FUNDING_CODE_SET.has(normalized))
|
|
50
|
+
return true;
|
|
51
|
+
if (/_credits?_exhausted(_deferred)?$/.test(normalized))
|
|
52
|
+
return true;
|
|
53
|
+
if (/insufficient_credits?$/.test(normalized))
|
|
54
|
+
return true;
|
|
55
|
+
if (/^blocked_provider_funding/.test(normalized))
|
|
56
|
+
return true;
|
|
57
|
+
return /(?:payment_required|plan_limit|quota_exceeded)$/.test(normalized);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* True for a genuine rate limit — one that clears by waiting.
|
|
61
|
+
*
|
|
62
|
+
* A funding failure always wins: `provider_plan_limit` contains "limit" and
|
|
63
|
+
* would otherwise read as retryable.
|
|
64
|
+
*/
|
|
65
|
+
export function isProviderRateLimitErrorCode(code) {
|
|
66
|
+
if (!code)
|
|
67
|
+
return false;
|
|
68
|
+
if (isProviderFundingErrorCode(code))
|
|
69
|
+
return false;
|
|
70
|
+
return /rate|limit|429|capacity_deferred/i.test(code);
|
|
71
|
+
}
|
|
72
|
+
/** The customer-facing next step for a funding refusal, by credential ownership. */
|
|
73
|
+
export function providerFundingNextStep(credentialMode) {
|
|
74
|
+
if (credentialMode === "byok") {
|
|
75
|
+
return "Top up or upgrade the provider account behind your connected key, then retry. Waiting will not clear this.";
|
|
76
|
+
}
|
|
77
|
+
if (credentialMode === "managed") {
|
|
78
|
+
return "This is OXYGEN's managed provider account, not your credit balance — contact support. Waiting will not clear this; route the run to another provider in the meantime.";
|
|
79
|
+
}
|
|
80
|
+
return "Check the provider account's balance and plan entitlement, then retry. Waiting will not clear this.";
|
|
81
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Broadcast character caps, in one place.
|
|
3
|
+
*
|
|
4
|
+
* These were defined three times — the web composer, the tenant-db lint, and an
|
|
5
|
+
* implicit `maxLength` on the MCP tool schema — and the MCP copy had drifted to
|
|
6
|
+
* 20,000. An X Premium account may post 25,000 characters, so a post between the
|
|
7
|
+
* two numbers was rejected by OXYGEN's own schema before X ever saw it, with an
|
|
8
|
+
* error that blamed the length rather than our stale constant. A customer hit
|
|
9
|
+
* exactly that after we told them the Premium cap was supported.
|
|
10
|
+
*
|
|
11
|
+
* `PUBLISHING_CONTENT_MAX_CHARS` is the outermost bound any surface should
|
|
12
|
+
* enforce: it must be >= the largest per-channel cap, because per-channel
|
|
13
|
+
* validation is where a too-long post gets an accurate, channel-specific error.
|
|
14
|
+
*/
|
|
15
|
+
/** X free tier. */
|
|
16
|
+
export declare const X_FREE_MAX_CHARS = 280;
|
|
17
|
+
/** X Premium. The largest single-post cap across every supported channel. */
|
|
18
|
+
export declare const X_PREMIUM_MAX_CHARS = 25000;
|
|
19
|
+
/**
|
|
20
|
+
* Outermost content bound for any publishing surface (CLI/MCP schema, API).
|
|
21
|
+
* Never set a surface's cap below this — let the per-channel lint produce the
|
|
22
|
+
* specific error instead of a generic schema rejection.
|
|
23
|
+
*/
|
|
24
|
+
export declare const PUBLISHING_CONTENT_MAX_CHARS = 25000;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Broadcast character caps, in one place.
|
|
3
|
+
*
|
|
4
|
+
* These were defined three times — the web composer, the tenant-db lint, and an
|
|
5
|
+
* implicit `maxLength` on the MCP tool schema — and the MCP copy had drifted to
|
|
6
|
+
* 20,000. An X Premium account may post 25,000 characters, so a post between the
|
|
7
|
+
* two numbers was rejected by OXYGEN's own schema before X ever saw it, with an
|
|
8
|
+
* error that blamed the length rather than our stale constant. A customer hit
|
|
9
|
+
* exactly that after we told them the Premium cap was supported.
|
|
10
|
+
*
|
|
11
|
+
* `PUBLISHING_CONTENT_MAX_CHARS` is the outermost bound any surface should
|
|
12
|
+
* enforce: it must be >= the largest per-channel cap, because per-channel
|
|
13
|
+
* validation is where a too-long post gets an accurate, channel-specific error.
|
|
14
|
+
*/
|
|
15
|
+
/** X free tier. */
|
|
16
|
+
export const X_FREE_MAX_CHARS = 280;
|
|
17
|
+
/** X Premium. The largest single-post cap across every supported channel. */
|
|
18
|
+
export const X_PREMIUM_MAX_CHARS = 25_000;
|
|
19
|
+
/**
|
|
20
|
+
* Outermost content bound for any publishing surface (CLI/MCP schema, API).
|
|
21
|
+
* Never set a surface's cap below this — let the per-channel lint produce the
|
|
22
|
+
* specific error instead of a generic schema rejection.
|
|
23
|
+
*/
|
|
24
|
+
export const PUBLISHING_CONTENT_MAX_CHARS = X_PREMIUM_MAX_CHARS;
|
|
@@ -54,13 +54,34 @@ export declare function resolveByokProviderDailyCapEnforcementMode(configured?:
|
|
|
54
54
|
/**
|
|
55
55
|
* Implicit org-level DAILY budget guard, evaluated only when the org has no
|
|
56
56
|
* explicit org-scope daily budget policy and the plan has finite positive
|
|
57
|
-
* monthly credits.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
57
|
+
* monthly credits. Expressed as a MULTIPLE of the plan's monthly grant spent in
|
|
58
|
+
* one UTC day: warn past WARN_MULTIPLE, hard-block at BLOCK_MULTIPLE. Setting
|
|
59
|
+
* any explicit org-daily policy fully suppresses the implicit pair.
|
|
60
|
+
*
|
|
61
|
+
* This is a runaway-loop backstop, NOT a spend ceiling. The available balance is
|
|
62
|
+
* the real bound on what a workspace can spend, and legitimate single-day work
|
|
63
|
+
* routinely exceeds a month's grant: standing up cold-email infrastructure
|
|
64
|
+
* (a managed domain plus three warmed inboxes is ~31k credits, so a full sending
|
|
65
|
+
* estate is hundreds of thousands in an afternoon) and large enrichment bursts
|
|
66
|
+
* funded by a top-up are both deliberate purchases, not loops. Raised 20x on
|
|
67
|
+
* 2026-08-17 for exactly that reason — at the previous 1x the guard refused a
|
|
68
|
+
* customer who had already paid for the credits, and the refusal was invisible
|
|
69
|
+
* on every surface. 20x still stops an unattended loop within hours.
|
|
70
|
+
*/
|
|
71
|
+
export declare const DEFAULT_ORG_DAILY_SPEND_WARN_MULTIPLE = 5;
|
|
72
|
+
export declare const DEFAULT_ORG_DAILY_SPEND_BLOCK_MULTIPLE = 20;
|
|
73
|
+
/** Resolved credit thresholds of the implicit org-daily guard for one plan. */
|
|
74
|
+
export type OrgDailySpendGuard = {
|
|
75
|
+
warnCredits: number;
|
|
76
|
+
blockCredits: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Resolve the implicit guard's thresholds from a plan's monthly grant. `null`
|
|
80
|
+
* means the guard is suppressed because the plan has no finite positive grant to
|
|
81
|
+
* scale from (free at 0, enterprise/custom at null) — the single place that
|
|
82
|
+
* decision is made, so enforcement and the read surfaces cannot drift apart.
|
|
61
83
|
*/
|
|
62
|
-
export declare
|
|
63
|
-
export declare const DEFAULT_ORG_DAILY_SPEND_BLOCK_PCT = 1;
|
|
84
|
+
export declare function resolveOrgDailySpendGuard(monthlyCredits: number | null | undefined): OrgDailySpendGuard | null;
|
|
64
85
|
export declare function resolveDefaultTriggerRunCreditCeiling(tier: PlanTier): number | null;
|
|
65
86
|
export declare function resolveDefaultAutoRunBatchCreditCeiling(tier: PlanTier): number | null;
|
|
66
87
|
export declare function resolveDefaultByokColumnRunMaxRows(tier: PlanTier): number | null;
|
|
@@ -71,13 +71,41 @@ export function resolveByokProviderDailyCapEnforcementMode(configured = process.
|
|
|
71
71
|
/**
|
|
72
72
|
* Implicit org-level DAILY budget guard, evaluated only when the org has no
|
|
73
73
|
* explicit org-scope daily budget policy and the plan has finite positive
|
|
74
|
-
* monthly credits.
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
74
|
+
* monthly credits. Expressed as a MULTIPLE of the plan's monthly grant spent in
|
|
75
|
+
* one UTC day: warn past WARN_MULTIPLE, hard-block at BLOCK_MULTIPLE. Setting
|
|
76
|
+
* any explicit org-daily policy fully suppresses the implicit pair.
|
|
77
|
+
*
|
|
78
|
+
* This is a runaway-loop backstop, NOT a spend ceiling. The available balance is
|
|
79
|
+
* the real bound on what a workspace can spend, and legitimate single-day work
|
|
80
|
+
* routinely exceeds a month's grant: standing up cold-email infrastructure
|
|
81
|
+
* (a managed domain plus three warmed inboxes is ~31k credits, so a full sending
|
|
82
|
+
* estate is hundreds of thousands in an afternoon) and large enrichment bursts
|
|
83
|
+
* funded by a top-up are both deliberate purchases, not loops. Raised 20x on
|
|
84
|
+
* 2026-08-17 for exactly that reason — at the previous 1x the guard refused a
|
|
85
|
+
* customer who had already paid for the credits, and the refusal was invisible
|
|
86
|
+
* on every surface. 20x still stops an unattended loop within hours.
|
|
78
87
|
*/
|
|
79
|
-
export const
|
|
80
|
-
export const
|
|
88
|
+
export const DEFAULT_ORG_DAILY_SPEND_WARN_MULTIPLE = 5;
|
|
89
|
+
export const DEFAULT_ORG_DAILY_SPEND_BLOCK_MULTIPLE = 20;
|
|
90
|
+
/**
|
|
91
|
+
* Resolve the implicit guard's thresholds from a plan's monthly grant. `null`
|
|
92
|
+
* means the guard is suppressed because the plan has no finite positive grant to
|
|
93
|
+
* scale from (free at 0, enterprise/custom at null) — the single place that
|
|
94
|
+
* decision is made, so enforcement and the read surfaces cannot drift apart.
|
|
95
|
+
*/
|
|
96
|
+
export function resolveOrgDailySpendGuard(monthlyCredits) {
|
|
97
|
+
if (typeof monthlyCredits !== "number" || !Number.isFinite(monthlyCredits) || monthlyCredits <= 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
warnCredits: roundCredits(monthlyCredits * DEFAULT_ORG_DAILY_SPEND_WARN_MULTIPLE),
|
|
102
|
+
blockCredits: roundCredits(monthlyCredits * DEFAULT_ORG_DAILY_SPEND_BLOCK_MULTIPLE),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Credits carry 3 decimals everywhere (control-DB numeric(18,3)). */
|
|
106
|
+
function roundCredits(value) {
|
|
107
|
+
return Math.round(value * 1000) / 1000;
|
|
108
|
+
}
|
|
81
109
|
export function resolveDefaultTriggerRunCreditCeiling(tier) {
|
|
82
110
|
return DEFAULT_TRIGGER_RUN_CREDIT_CEILING[tier];
|
|
83
111
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const OXYGEN_VERSION = "1.
|
|
1
|
+
export declare const OXYGEN_VERSION = "1.766.0";
|
|
2
2
|
export declare const OXYGEN_MINIMUM_CLI_VERSION = "1.181.0";
|
|
3
3
|
export declare const MANAGED_INBOX_MINIMUM_CLI_VERSION = "1.326.2";
|
|
4
|
+
export declare const SUPPORT_AGENT_REPLY_MINIMUM_CLI_VERSION = "1.747.0";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const OXYGEN_VERSION = "1.
|
|
1
|
+
export const OXYGEN_VERSION = "1.766.0";
|
|
2
2
|
// The GLOBAL CLI compatibility floor: the oldest CLI allowed to call any
|
|
3
3
|
// operational route. Raising it hard-rejects every older CLI from the entire
|
|
4
4
|
// product, so it obeys one law, enforced by scripts/ci/cli-min-version-gate.mjs:
|
|
@@ -26,8 +26,11 @@ export const OXYGEN_VERSION = "1.739.1";
|
|
|
26
26
|
// (oxygen sequences|inbox|senders, /api/cli/{sequences,inbox,senders}) and
|
|
27
27
|
// removed the old /api/cli/linkedin/* routes — older CLIs would 404.
|
|
28
28
|
export const OXYGEN_MINIMUM_CLI_VERSION = "1.181.0";
|
|
29
|
-
// Per-surface floor for the whitelabel/managed-inbox purchase path, enforced
|
|
30
|
-
//
|
|
29
|
+
// Per-surface floor for the whitelabel/managed-inbox purchase path, enforced by
|
|
30
|
+
// BOTH paid inbox routes: /api/cli/managed-inboxes/subscribe and
|
|
31
|
+
// /api/cli/managed-inboxes/[domain]/mailboxes. (The comment used to say subscribe
|
|
32
|
+
// only; the expansion route has enforced it too since it shipped, and three
|
|
33
|
+
// separate reads of this file have since reasoned from the wrong half.)
|
|
31
34
|
//
|
|
32
35
|
// 1.326.2: Pricing Model 2.0 (2026-07-14) moved whitelabel inbox subscribe from the
|
|
33
36
|
// USD Stripe rail back to Oxygen credits: the preview now returns
|
|
@@ -39,3 +42,11 @@ export const OXYGEN_MINIMUM_CLI_VERSION = "1.181.0";
|
|
|
39
42
|
// so it can never exceed npm's newest CLI. (1.298.0 was the prior credits→Stripe
|
|
40
43
|
// contract move.) Do NOT raise the global OXYGEN_MINIMUM_CLI_VERSION for this.
|
|
41
44
|
export const MANAGED_INBOX_MINIMUM_CLI_VERSION = "1.326.2";
|
|
45
|
+
// Per-surface floor for guarded Plain agent reply + Done. CLI 1.747.0 is the
|
|
46
|
+
// first client that declares --agent, binds the latest customer message and
|
|
47
|
+
// body-authenticated preview token, carries the live agent_done_token into the
|
|
48
|
+
// separate Done confirmation, and never falls through to the retired resolve
|
|
49
|
+
// shape. This floor MUST remain dormant in production until 1.747.0 has been
|
|
50
|
+
// published by the preceding release per OXY-4091; the live feature gate is the
|
|
51
|
+
// rollout boundary that preserves that two-phase ordering.
|
|
52
|
+
export const SUPPORT_AGENT_REPLY_MINIMUM_CLI_VERSION = "1.747.0";
|
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
"import": "./dist/object-storage.js",
|
|
62
62
|
"default": "./dist/object-storage.js"
|
|
63
63
|
},
|
|
64
|
+
"./person-name": {
|
|
65
|
+
"types": "./dist/person-name.d.ts",
|
|
66
|
+
"import": "./dist/person-name.js",
|
|
67
|
+
"default": "./dist/person-name.js"
|
|
68
|
+
},
|
|
64
69
|
"./select-options": {
|
|
65
70
|
"types": "./dist/select-options.d.ts",
|
|
66
71
|
"import": "./dist/select-options.js",
|
|
@@ -145,6 +150,11 @@
|
|
|
145
150
|
"types": "./dist/schedule-label.d.ts",
|
|
146
151
|
"import": "./dist/schedule-label.js",
|
|
147
152
|
"default": "./dist/schedule-label.js"
|
|
153
|
+
},
|
|
154
|
+
"./publishing-limits": {
|
|
155
|
+
"types": "./dist/publishing-limits.d.ts",
|
|
156
|
+
"import": "./dist/publishing-limits.js",
|
|
157
|
+
"default": "./dist/publishing-limits.js"
|
|
148
158
|
}
|
|
149
159
|
},
|
|
150
160
|
"dependencies": {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkflowCompareOp, WorkflowCondition, WorkflowValueRef } from "./types.js";
|
|
1
|
+
import type { WorkflowCompareOp, WorkflowCondition, WorkflowValueCoercion, WorkflowValueRef } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* The data a v2 run exposes to its value refs.
|
|
4
4
|
*
|
|
@@ -22,6 +22,20 @@ export type WorkflowRunScope = {
|
|
|
22
22
|
contextProfile?: unknown;
|
|
23
23
|
contextAssets?: Record<string, unknown>;
|
|
24
24
|
};
|
|
25
|
+
/** A deterministic authoring/data error; retrying the same revision cannot repair it. */
|
|
26
|
+
export declare class WorkflowValueCoercionError extends Error {
|
|
27
|
+
readonly coercion: WorkflowValueCoercion;
|
|
28
|
+
readonly code = "workflow_value_coercion_failed";
|
|
29
|
+
constructor(coercion: WorkflowValueCoercion);
|
|
30
|
+
}
|
|
31
|
+
/** A direct mapping named data the run does not carry; sending undefined is never intentional. */
|
|
32
|
+
export declare class WorkflowValueRefUnresolvedError extends Error {
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly code = "workflow_value_ref_unresolved";
|
|
35
|
+
constructor(path: string);
|
|
36
|
+
}
|
|
37
|
+
/** Apply one explicit scalar conversion without lossy truthiness or truncation. */
|
|
38
|
+
export declare function coerceWorkflowValue(value: unknown, coercion: WorkflowValueCoercion): string | number | boolean;
|
|
25
39
|
/** The roots a `ref` path may start from. Anything else is not a scope path. */
|
|
26
40
|
export declare const SCOPE_PATH_ROOTS: ReadonlySet<string>;
|
|
27
41
|
export declare const WORKFLOW_COMPARE_OPS: ReadonlySet<WorkflowCompareOp>;
|
|
@@ -40,6 +54,8 @@ export declare const UNARY_COMPARE_OPS: ReadonlySet<WorkflowCompareOp>;
|
|
|
40
54
|
* typo surfaces in lint rather than as a silently empty value at run time.
|
|
41
55
|
*/
|
|
42
56
|
export declare function parseScopePath(path: string): string[] | null;
|
|
57
|
+
/** Canonical path formatter: dots for simple keys, JSON brackets for every other key. */
|
|
58
|
+
export declare function formatScopePath(segments: readonly string[]): string | null;
|
|
43
59
|
/** Resolve a dotted (+ `[n]`) scope path. Missing or malformed → undefined. */
|
|
44
60
|
export declare function resolvePath(path: string, scope: WorkflowRunScope): unknown;
|
|
45
61
|
/**
|
|
@@ -49,6 +65,16 @@ export declare function resolvePath(path: string, scope: WorkflowRunScope): unkn
|
|
|
49
65
|
*/
|
|
50
66
|
export declare function renderTemplate(template: string, scope: WorkflowRunScope): string;
|
|
51
67
|
export declare function resolveValueRef(ref: WorkflowValueRef, scope: WorkflowRunScope): unknown;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve a binding that is about to cross an execution boundary.
|
|
70
|
+
*
|
|
71
|
+
* Conditions and optional control-flow refs deliberately keep total lookup
|
|
72
|
+
* semantics: a missing path is `undefined`, so `is_empty` remains useful. Tool
|
|
73
|
+
* requests are different — silently handing `undefined` to a provider makes a
|
|
74
|
+
* stale mapping look like a provider bug. Call this stricter adapter at that
|
|
75
|
+
* boundary so the failure names the mapped path before any provider executes.
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveRequiredValueRef(ref: WorkflowValueRef, scope: WorkflowRunScope): unknown;
|
|
52
78
|
export declare function evaluateCondition(condition: WorkflowCondition, scope: WorkflowRunScope): boolean;
|
|
53
79
|
/**
|
|
54
80
|
* Compile a `matches` pattern, or return null when it is unsafe or invalid.
|
|
@@ -76,3 +102,5 @@ export declare function compileConditionPattern(pattern: string): RegExp | null;
|
|
|
76
102
|
* with the manifest's declared node ids.
|
|
77
103
|
*/
|
|
78
104
|
export declare function referencedNodeIds(ref: WorkflowValueRef | WorkflowCondition): string[];
|
|
105
|
+
/** Exact rooted scope paths a ref/condition can read, excluding ambiguous bare formula names. */
|
|
106
|
+
export declare function referencedScopePaths(ref: WorkflowValueRef | WorkflowCondition): string[];
|