@hugex/artifact 0.4.1 → 0.6.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.
Files changed (76) hide show
  1. package/dist/artifact/mcp/domains/draftAccess.d.ts +6 -0
  2. package/dist/artifact/mcp/domains/guide.d.ts +11 -0
  3. package/dist/{mcp → artifact/mcp}/domains/read.d.ts +18 -0
  4. package/dist/artifact/mcp/domains/secrets.d.ts +5 -0
  5. package/dist/{mcp → artifact/mcp}/domains/tools.d.ts +3 -2
  6. package/dist/artifact/mcp/domains/worker-authoring-io.d.ts +19 -0
  7. package/dist/artifact/mcp/domains/worker-authoring.d.ts +22 -0
  8. package/dist/artifact/mcp/domains/worker-write.d.ts +109 -0
  9. package/dist/{mcp → artifact/mcp}/index.d.ts +1 -1
  10. package/dist/artifact/mcp/registry.d.ts +13 -0
  11. package/dist/artifact/mcp/scopes.d.ts +37 -0
  12. package/dist/{mcp → artifact/mcp}/tools.d.ts +3 -0
  13. package/dist/common/constants/clef-models.d.ts +48 -0
  14. package/dist/common/constants/tools-registry.d.ts +8 -0
  15. package/dist/common/flow-graph/catalog.d.ts +40 -0
  16. package/dist/common/flow-graph/classifier.d.ts +2 -0
  17. package/dist/common/flow-graph/composio.d.ts +2 -0
  18. package/dist/common/flow-graph/credentials.d.ts +3 -0
  19. package/dist/common/flow-graph/index.d.ts +11 -0
  20. package/dist/common/flow-graph/ops.d.ts +21 -0
  21. package/dist/common/flow-graph/refs.d.ts +18 -0
  22. package/dist/common/flow-graph/schema.d.ts +570 -0
  23. package/dist/common/flow-graph/templates.d.ts +2 -0
  24. package/dist/common/flow-graph/validate.d.ts +77 -0
  25. package/dist/common/types/classifier-types.d.ts +57 -0
  26. package/dist/common/types/classifier-validation.d.ts +2 -0
  27. package/dist/common/types/crawl-types.d.ts +59 -0
  28. package/dist/common/types/node-types.d.ts +12 -0
  29. package/dist/common/types/trigger-types.d.ts +106 -0
  30. package/dist/common/types/var-scope.d.ts +43 -0
  31. package/dist/common/utils/agentMemory.d.ts +31 -0
  32. package/dist/common/utils/crawlClient.d.ts +38 -0
  33. package/dist/common/utils/flowInputs.d.ts +19 -0
  34. package/dist/common/utils/flowScope.d.ts +16 -0
  35. package/dist/common/utils/httpPayload.d.ts +4 -0
  36. package/dist/common/utils/outVars.d.ts +6 -0
  37. package/dist/common/utils/templateUtils.d.ts +37 -0
  38. package/dist/index.js +45 -45
  39. package/package.json +3 -3
  40. package/dist/mcp/registry.d.ts +0 -3
  41. package/dist/mcp/scopes.d.ts +0 -12
  42. /package/dist/{catalog.d.ts → artifact/catalog.d.ts} +0 -0
  43. /package/dist/{dev-prefix.d.ts → artifact/dev-prefix.d.ts} +0 -0
  44. /package/dist/{do → artifact/do}/ArtifactDO.d.ts +0 -0
  45. /package/dist/{do → artifact/do}/ArtifactIndexDO.d.ts +0 -0
  46. /package/dist/{do → artifact/do}/file-storage.d.ts +0 -0
  47. /package/dist/{do → artifact/do}/index-upsert.d.ts +0 -0
  48. /package/dist/{do → artifact/do}/meta-migrate.d.ts +0 -0
  49. /package/dist/{do → artifact/do}/ora-index.d.ts +0 -0
  50. /package/dist/{hash.d.ts → artifact/hash.d.ts} +0 -0
  51. /package/dist/{host-route.d.ts → artifact/host-route.d.ts} +0 -0
  52. /package/dist/{host.d.ts → artifact/host.d.ts} +0 -0
  53. /package/dist/{index.d.ts → artifact/index.d.ts} +0 -0
  54. /package/dist/{inject.d.ts → artifact/inject.d.ts} +0 -0
  55. /package/dist/{internal.d.ts → artifact/internal.d.ts} +0 -0
  56. /package/dist/{limits.d.ts → artifact/limits.d.ts} +0 -0
  57. /package/dist/{mcp → artifact/mcp}/access.d.ts +0 -0
  58. /package/dist/{mcp → artifact/mcp}/auth.d.ts +0 -0
  59. /package/dist/{mcp → artifact/mcp}/authz.d.ts +0 -0
  60. /package/dist/{mcp → artifact/mcp}/context.d.ts +0 -0
  61. /package/dist/{mcp → artifact/mcp}/domains/artifacts.d.ts +0 -0
  62. /package/dist/{mcp → artifact/mcp}/domains/memos.d.ts +0 -0
  63. /package/dist/{mcp → artifact/mcp}/domains/skills.d.ts +0 -0
  64. /package/dist/{mcp → artifact/mcp}/domains/workers.d.ts +0 -0
  65. /package/dist/{mcp → artifact/mcp}/oauth/config.d.ts +0 -0
  66. /package/dist/{mcp → artifact/mcp}/oauth/contract.d.ts +0 -0
  67. /package/dist/{mcp → artifact/mcp}/oauth/provider.d.ts +0 -0
  68. /package/dist/{rpc.d.ts → artifact/rpc.d.ts} +0 -0
  69. /package/dist/{runtime → artifact/runtime}/artifact-app-source.d.ts +0 -0
  70. /package/dist/{sql.d.ts → artifact/sql.d.ts} +0 -0
  71. /package/dist/{templates.d.ts → artifact/templates.d.ts} +0 -0
  72. /package/dist/{types.d.ts → artifact/types.d.ts} +0 -0
  73. /package/dist/{url.d.ts → artifact/url.d.ts} +0 -0
  74. /package/dist/{validate.d.ts → artifact/validate.d.ts} +0 -0
  75. /package/dist/{version.d.ts → artifact/version.d.ts} +0 -0
  76. /package/dist/{worker-client.d.ts → artifact/worker-client.d.ts} +0 -0
@@ -0,0 +1,57 @@
1
+ import type { OutVar } from './var-scope';
2
+ export type ClefModel = 'clef-omni' | 'clef' | 'clef-flash';
3
+ export type ClassifierRoute = 'class' | 'uncertain' | 'blocked' | 'error';
4
+ export type ClassifierCheck = {
5
+ id: string;
6
+ type: 'noul';
7
+ instructions: string;
8
+ criteria?: {
9
+ true?: string;
10
+ false?: string;
11
+ };
12
+ guard?: {
13
+ threshold: number;
14
+ };
15
+ } | {
16
+ id: string;
17
+ type: 'score';
18
+ instructions: string;
19
+ levels: string[];
20
+ };
21
+ export interface ClassifierData {
22
+ label?: string;
23
+ model: ClefModel;
24
+ question: string;
25
+ input: {
26
+ message: string;
27
+ historyTurns: number;
28
+ vars: string[];
29
+ };
30
+ options: Array<{
31
+ id: string;
32
+ label: string;
33
+ criteria: string;
34
+ }>;
35
+ checks: ClassifierCheck[];
36
+ confidence: {
37
+ threshold: number;
38
+ margin: number;
39
+ };
40
+ outVars?: OutVar[];
41
+ }
42
+ export interface ClassifierScore {
43
+ score: number;
44
+ /** Description of the highest probability level (levels are zero indexed). */
45
+ level: string;
46
+ confidence: number;
47
+ probabilities: Record<string, number>;
48
+ }
49
+ export interface ClassifierResult {
50
+ classification: string;
51
+ label: string;
52
+ confidence: number;
53
+ margin: number;
54
+ probabilities: Record<string, number>;
55
+ route: ClassifierRoute;
56
+ checks: Record<string, number | ClassifierScore>;
57
+ }
@@ -0,0 +1,2 @@
1
+ /** Runtime-safe shared validation; returns all authoring errors without throwing. */
2
+ export declare function validateClassifierData(data: unknown): string[];
@@ -0,0 +1,59 @@
1
+ import type { OutVar } from './var-scope';
2
+ export type CrawlFormat = 'markdown' | 'json';
3
+ export type CrawlOutputMode = 'pages' | 'single' | 'concat';
4
+ export type CrawlPageField = 'url' | 'title' | 'markdown' | 'json';
5
+ export interface CrawlOutputConfig {
6
+ mode: CrawlOutputMode;
7
+ select?: {
8
+ url?: string;
9
+ pattern?: string;
10
+ index?: number;
11
+ };
12
+ fields?: CrawlPageField[];
13
+ maxCharsPerPage?: number;
14
+ }
15
+ export interface CrawlNodeData {
16
+ url: string;
17
+ source?: 'all' | 'sitemaps' | 'links';
18
+ limit?: number;
19
+ depth?: number;
20
+ render?: boolean;
21
+ format?: CrawlFormat;
22
+ jsonPrompt?: string;
23
+ jsonSchema?: Record<string, unknown>;
24
+ includePatterns?: string[];
25
+ excludePatterns?: string[];
26
+ includeSubdomains?: boolean;
27
+ output?: CrawlOutputConfig;
28
+ waitTimeoutMs?: number;
29
+ maxAgeS?: number;
30
+ outVars?: OutVar[];
31
+ }
32
+ export interface CrawlPage {
33
+ url: string;
34
+ title?: string;
35
+ status: string;
36
+ httpStatus?: number;
37
+ markdown?: string;
38
+ json?: unknown;
39
+ truncated?: boolean;
40
+ }
41
+ export interface CrawlNodeResult {
42
+ ok: boolean;
43
+ error: string | null;
44
+ data: {
45
+ jobId: string | null;
46
+ status: string;
47
+ total: number;
48
+ finished: number;
49
+ browserSeconds: number;
50
+ elapsedMs: number;
51
+ truncated: boolean;
52
+ pages: CrawlPage[];
53
+ text?: string;
54
+ } | null;
55
+ }
56
+ export interface CrawlCredentials {
57
+ accountId: string;
58
+ apiToken: string;
59
+ }
@@ -0,0 +1,12 @@
1
+ export declare enum NodeType {
2
+ START_NODE = "startNode",
3
+ CLASSIFIER_NODE = "classifierNode",
4
+ MEMO_NODE = "memoNode",
5
+ LLM_NODE = "llmNode",
6
+ ANSWER_NODE = "answerNode",
7
+ API_NODE = "apiNode",
8
+ TOOL_NODE = "toolNode",
9
+ WORKER_NODE = "workerNode",
10
+ CRAWL_NODE = "crawlNode"
11
+ }
12
+ export type NODETYPES = NodeType.START_NODE | NodeType.CLASSIFIER_NODE | NodeType.MEMO_NODE | NodeType.LLM_NODE | NodeType.ANSWER_NODE | NodeType.API_NODE | NodeType.TOOL_NODE | NodeType.WORKER_NODE | NodeType.CRAWL_NODE;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Trigger Core — shared execution contract.
3
+ * Provider details (QStash, webhooks, Composio, etc.) stay outside this surface.
4
+ */
5
+ export type FlowInputType = 'string' | 'number' | 'boolean' | 'json';
6
+ /** A declarative input declared on the Start node and supplied by a trigger. */
7
+ export interface FlowInputDef {
8
+ name: string;
9
+ label?: string;
10
+ type: FlowInputType;
11
+ required?: boolean;
12
+ /** Serialized default: JSON inputs keep their raw text so the designer can edit it. */
13
+ default?: string | number | boolean | null;
14
+ }
15
+ export type FlowInputValues = Record<string, unknown>;
16
+ /** Kind of persistent trigger. */
17
+ export type TriggerKind = 'schedule' | 'webhook' | 'composio';
18
+ /** How a trigger activation was requested. Manual chat turns are not activators. */
19
+ export type InvocationMode = 'automatic' | 'run_now' | 'test';
20
+ export type SessionPolicy = 'owner';
21
+ export type OverlapPolicy = 'queue';
22
+ /** Lifecycle of a single run. Mirrored by its notification record. */
23
+ export type RunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'skipped';
24
+ /** Functional config for a schedule trigger. */
25
+ export interface ScheduleSourceConfig {
26
+ cron: string;
27
+ timezone: string;
28
+ }
29
+ /** Functional config for a webhook trigger. */
30
+ export interface WebhookSourceConfig {
31
+ contentType: 'application/json';
32
+ }
33
+ /** Functional config for a Composio trigger. No toolId — Tools and Triggers are separate domains. */
34
+ export interface ComposioSourceConfig {
35
+ toolkitSlug: string;
36
+ triggerSlug: string;
37
+ /** Pinned Composio toolkit contract. Missing only on pre-versioning triggers. */
38
+ toolkitVersion?: string;
39
+ triggerConfig: Record<string, unknown>;
40
+ }
41
+ export interface TriggerSourceConfigMap {
42
+ schedule: ScheduleSourceConfig;
43
+ webhook: WebhookSourceConfig;
44
+ composio: ComposioSourceConfig;
45
+ }
46
+ export type TriggerSourceConfig<K extends TriggerKind = TriggerKind> = TriggerSourceConfigMap[K];
47
+ export type WebhookInputBinding = {
48
+ source: 'fixed';
49
+ value: unknown;
50
+ } | {
51
+ source: 'body';
52
+ pointer: string;
53
+ };
54
+ export type WebhookInputMapping = Record<string, WebhookInputBinding>;
55
+ /** Mapping over Composio V3 event `data` (not the webhook-generic `body` name). */
56
+ export type ComposioInputBinding = {
57
+ source: 'fixed';
58
+ value: unknown;
59
+ } | {
60
+ source: 'data';
61
+ pointer: string;
62
+ };
63
+ export type ComposioInputMapping = Record<string, ComposioInputBinding>;
64
+ /** Adapter-declared capabilities; UI and admin routes derive actions from these. */
65
+ export interface TriggerSourceCapabilities {
66
+ canPause: boolean;
67
+ canRunNow: boolean;
68
+ canTest: boolean;
69
+ canResync: boolean;
70
+ canRotateSecret: boolean;
71
+ exposesDestination: boolean;
72
+ }
73
+ export interface TriggerAllowedActions {
74
+ pause: boolean;
75
+ resume: boolean;
76
+ runNow: boolean;
77
+ test: boolean;
78
+ resync: boolean;
79
+ rotateSecret: boolean;
80
+ delete: boolean;
81
+ edit: boolean;
82
+ }
83
+ /**
84
+ * Normalized unit of work handed to the tenant runtime and AgentDO.
85
+ * One activation produces at most one effective run.
86
+ */
87
+ export interface TriggerActivation {
88
+ activationId: string;
89
+ triggerId: string;
90
+ triggerKind: TriggerKind;
91
+ invocationMode: InvocationMode;
92
+ tenant: string;
93
+ flowId: string;
94
+ runAsUserId: string;
95
+ sessionId: string;
96
+ runId: string;
97
+ inputs: FlowInputValues;
98
+ externalDeliveryId?: string;
99
+ correlationKey?: string;
100
+ /** Original run when this activation was explicitly replayed from the operations panel. */
101
+ replayOf?: string;
102
+ label?: string;
103
+ nonce?: string;
104
+ }
105
+ /** Signed hx-ora → tenant dispatch payload. */
106
+ export type TriggerDispatchRequest = TriggerActivation;
@@ -0,0 +1,43 @@
1
+ export interface FlowNode {
2
+ id: string;
3
+ type?: string;
4
+ data?: any;
5
+ }
6
+ export interface FlowEdge {
7
+ source: string;
8
+ target: string;
9
+ sourceHandle?: string | null;
10
+ }
11
+ export type OutVarType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'image' | 'file';
12
+ /** A named, public value exposed by a node result. */
13
+ export interface OutVar {
14
+ name: string;
15
+ path?: string;
16
+ type?: OutVarType;
17
+ description?: string;
18
+ }
19
+ export interface EffectiveOutVar extends OutVar {
20
+ source: 'default' | 'user';
21
+ }
22
+ /** Only Answer nodes use this: it maps runtime values into persisted JSON output. */
23
+ export interface OutputMapping {
24
+ key: string;
25
+ from: string;
26
+ default?: string;
27
+ }
28
+ export interface ResolveInput {
29
+ context: Record<string, any>;
30
+ results: Record<string, any>;
31
+ nodes: FlowNode[];
32
+ edges: FlowEdge[];
33
+ currentNodeId: string;
34
+ secrets?: Record<string, string>;
35
+ /** Design-time values keyed by complete canonical refs. Never supplied in production. */
36
+ refOverrides?: Record<string, unknown>;
37
+ }
38
+ export interface ResolveOptions {
39
+ callerTag?: string;
40
+ serializeNonStrings?: boolean;
41
+ onError?: (msg: string) => void;
42
+ }
43
+ export declare const OUT_VAR_NAME_RE: RegExp;
@@ -0,0 +1,31 @@
1
+ export type MemoryLength = 'short' | 'medium' | 'long';
2
+ /** One markdown document line ≈ 80 chars ≈ 20 tokens (CHARS_PER_TOKEN = 4). */
3
+ export declare const MEMORY_LENGTH_MD_LINES: {
4
+ readonly short: 100;
5
+ readonly medium: 250;
6
+ readonly long: 1000;
7
+ };
8
+ export declare const MEMORY_LENGTH_TOKENS: {
9
+ readonly short: 2000;
10
+ readonly medium: 5000;
11
+ readonly long: 20000;
12
+ };
13
+ export declare const DEFAULT_MEMORY_LENGTH: MemoryLength;
14
+ export declare const DEFAULT_MEMORY_MODEL = "gpt_5_nano";
15
+ export declare function parseMemoryLength(value: unknown): MemoryLength;
16
+ export declare function memoryTokenLimit(length?: MemoryLength): number;
17
+ export declare function memoryMdLineLimit(length?: MemoryLength): number;
18
+ export declare function estimateTokens(text: string): number;
19
+ export declare function capMemoryContent(content: string, maxTokens: number): {
20
+ content: string;
21
+ truncated: boolean;
22
+ };
23
+ export declare function isStartMemoryEnabled(data: Record<string, unknown> | undefined | null): boolean;
24
+ export declare function startMemoryModel(data: Record<string, unknown> | undefined | null): string;
25
+ export declare function startMemoryLength(data: Record<string, unknown> | undefined | null): MemoryLength;
26
+ /** Reasoning models spend output budget on thinking; request extra tokens then cap the document. */
27
+ export declare function memoryGenerationMaxTokens(length: MemoryLength, reasoningKind?: string): number;
28
+ export declare function looksLikeTranscript(content: string): boolean;
29
+ export declare function sanitizeMemoryDocument(content: string): string;
30
+ export declare function extractUserKeypoints(userText: string): string[];
31
+ export declare function mergeKeypointMemory(previous: string, additions: string[], maxTokens: number): string;
@@ -0,0 +1,38 @@
1
+ import type { CrawlCredentials, CrawlFormat, CrawlNodeData, CrawlNodeResult, CrawlOutputConfig, CrawlPage } from '../types/crawl-types';
2
+ export declare const CRAWL_DEFAULTS: {
3
+ readonly source: 'all';
4
+ readonly limit: 5;
5
+ readonly depth: 2;
6
+ readonly render: false;
7
+ readonly format: 'markdown';
8
+ readonly includeSubdomains: false;
9
+ readonly waitTimeoutMs: 60000;
10
+ readonly maxAgeS: 86400;
11
+ readonly maxCharsPerPage: 4000;
12
+ };
13
+ export declare const CRAWL_LIMITS: {
14
+ readonly limit: 50;
15
+ readonly depth: 10;
16
+ readonly waitTimeoutMs: 120000;
17
+ readonly maxAgeS: 604800;
18
+ readonly maxOutputBytes: number;
19
+ };
20
+ export declare function buildCrawlRequestBody(data: CrawlNodeData, resolvedUrl: string, opts?: {
21
+ maxAgeOverrideS?: number;
22
+ }): Record<string, unknown>;
23
+ export declare function crawlRequestKey(body: Record<string, unknown>): Promise<string>;
24
+ export declare function shapeCrawlOutput(pages: CrawlPage[], output: CrawlOutputConfig | undefined, format: CrawlFormat): {
25
+ pages: CrawlPage[];
26
+ text?: string;
27
+ truncated: boolean;
28
+ };
29
+ export declare function runCrawl(creds: CrawlCredentials, data: CrawlNodeData, opts: {
30
+ url: string;
31
+ resumeJobId?: string;
32
+ maxAgeOverrideS?: number;
33
+ fetchImpl?: typeof fetch;
34
+ sleep?: (ms: number) => Promise<void>;
35
+ }): Promise<{
36
+ result: CrawlNodeResult;
37
+ allPages: CrawlPage[];
38
+ }>;
@@ -0,0 +1,19 @@
1
+ import type { FlowInputDef, FlowInputValues } from '../types/trigger-types';
2
+ export declare const FLOW_INPUT_NAME_RE: RegExp;
3
+ /** Reads and sanitizes the declarative inputs stored on a Start node's `data.inputs`. */
4
+ export declare function getFlowInputDefs(startNodeData: any): FlowInputDef[];
5
+ export interface FlowInputResolution {
6
+ values: FlowInputValues;
7
+ errors: string[];
8
+ }
9
+ /**
10
+ * Validates a trigger's raw inputs against the Start node declaration. Applies defaults,
11
+ * coerces to the declared type and drops values that were never declared, so a stale
12
+ * schedule cannot inject variables into a flow that no longer expects them.
13
+ */
14
+ export declare function normalizeFlowInputs(defs: FlowInputDef[], raw: FlowInputValues | undefined): FlowInputResolution;
15
+ /**
16
+ * Builds the chat turn text for a headless trigger. Schedules and hooks reuse the
17
+ * conversation history of `flowId::userId`, so every run has to read as a user turn.
18
+ */
19
+ export declare function buildTriggerMessageText(defs: FlowInputDef[], values: FlowInputValues, label?: string): string;
@@ -0,0 +1,16 @@
1
+ import type { EffectiveOutVar, FlowEdge, FlowNode, OutVar } from '../types/var-scope';
2
+ export interface ScopedVar extends EffectiveOutVar {
3
+ ref: string;
4
+ nodeId: string;
5
+ }
6
+ export declare function getAncestorNodeIds(edges: FlowEdge[], nodeId: string): Set<string>;
7
+ export declare function getUpstreamOutVars(nodes: FlowNode[], edges: FlowEdge[], nodeId: string): ScopedVar[];
8
+ export declare function buildScope(nodes: FlowNode[], edges: FlowEdge[], nodeId: string): Set<string>;
9
+ /** Finds the longest real ancestor ID that prefixes a qualified ref. */
10
+ export declare function findScopedSourceNode(ref: string, input: {
11
+ nodes: FlowNode[];
12
+ edges: FlowEdge[];
13
+ currentNodeId: string;
14
+ }): FlowNode | undefined;
15
+ export declare function getRefTail(ref: string, nodeId: string): string;
16
+ export declare function isBinaryOutVar(outVar: Pick<OutVar, 'type'>): boolean;
@@ -0,0 +1,4 @@
1
+ /** True for `application/json` and JSON:API / other `+json` types (`application/vnd.api+json`). */
2
+ export declare function isJsonContentType(contentType: string | null | undefined): boolean;
3
+ export declare function parsePayloadText(text: string, contentType?: string | null): unknown;
4
+ export declare function readFetchPayload(response: Response): Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ import { NodeType } from '../types/node-types';
2
+ import type { EffectiveOutVar, FlowNode, OutVar } from '../types/var-scope';
3
+ export declare function getDefaultOutVars(nodeType: NodeType): OutVar[];
4
+ /** Validates every public output name, including collisions with built-ins and Start inputs. */
5
+ export declare function validateOutVars(node: FlowNode): string[];
6
+ export declare function getEffectiveOutVars(node: FlowNode): EffectiveOutVar[];
@@ -0,0 +1,37 @@
1
+ import type { FlowNode, ResolveInput, ResolveOptions } from '../types/var-scope';
2
+ export { getDefaultOutVars, getEffectiveOutVars, validateOutVars } from './outVars';
3
+ export type VariableResolutionCode = 'OUT_OF_SCOPE' | 'UNKNOWN_OUTPUT' | 'UNKNOWN_CONTEXT_REF' | 'ANCESTOR_NOT_EXECUTED' | 'PATH_NOT_FOUND' | 'UNSAFE_PATH' | 'INVALID_EXPRESSION' | 'MISSING_SECRET';
4
+ export declare class VariableResolutionError extends Error {
5
+ readonly code: VariableResolutionCode;
6
+ constructor(code: VariableResolutionCode, message: string);
7
+ }
8
+ export interface RefResolution {
9
+ value: unknown;
10
+ missing?: 'ancestor_not_executed' | 'path_not_found';
11
+ }
12
+ export interface ParsedTemplateExpression {
13
+ ref: string;
14
+ defaultValue?: string;
15
+ }
16
+ export declare function walkPath(obj: any, path: string): any;
17
+ /**
18
+ * User outVars on API/tool/worker nodes are relative to the HTTP/tool payload
19
+ * (`result.data`), so JSON:API bodies map as `data.attributes.name` instead of
20
+ * `data.data.attributes.name`. Default outVars (`ok`, `status`, `data`) still
21
+ * walk the node envelope. Legacy envelope paths like `data.customer` fall back
22
+ * when the payload walk misses.
23
+ */
24
+ export declare function resolveOutVarValue(result: unknown, outVar: {
25
+ path?: string;
26
+ source?: 'default' | 'user';
27
+ }, nodeType?: string): unknown;
28
+ export declare function extractOutVarValues(node: FlowNode, result: unknown): Record<string, unknown>;
29
+ /** Resolves one canonical direct reference. Structural errors throw; absent values return missing metadata. */
30
+ export declare function resolveReference(ref: string, input: ResolveInput): RefResolution;
31
+ /** Kept as a concise public helper for callers that do not need missing diagnostics. */
32
+ export declare function resolveOutVarRef(ref: string, input: ResolveInput): unknown | undefined;
33
+ export declare function parseTemplateExpression(expression: string): ParsedTemplateExpression;
34
+ export declare function extractTemplateReferences(template: string): string[];
35
+ /** Rewrites only the source-node segment at the beginning of a template expression. */
36
+ export declare function rewriteTemplateNodeRefs(template: string, oldNodeId: string, newNodeId: string): string;
37
+ export declare function resolveTemplate(template: string, node: FlowNode, input: ResolveInput, options?: ResolveOptions): string;