@valerypopoff/rivet2-core 2.12.0 → 2.15.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/dist/cjs/bundle.cjs +3188 -592
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +5 -0
- package/dist/esm/api/processSettings.js +1 -0
- package/dist/esm/exports.js +5 -0
- package/dist/esm/model/GraphInputStream.js +70 -0
- package/dist/esm/model/GraphProcessor.js +264 -29
- package/dist/esm/model/MarkdownSanitizationPolicy.js +2 -0
- package/dist/esm/model/NodeExecutionPlanner.js +4 -4
- package/dist/esm/model/NodeImpl.js +1 -1
- package/dist/esm/model/Nodes.js +9 -0
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/StreamingOutputWatch.js +5 -0
- package/dist/esm/model/StreamingWatchTopology.js +228 -0
- package/dist/esm/model/classifier/credentials.js +81 -0
- package/dist/esm/model/classifier/migration.js +97 -0
- package/dist/esm/model/classifier/providers.js +347 -0
- package/dist/esm/model/classifier/questionHelpers.js +125 -0
- package/dist/esm/model/classifier/types.js +1 -0
- package/dist/esm/model/nodeBodyMarkdown.js +37 -0
- package/dist/esm/model/nodes/AssembleMessageNode.js +2 -2
- package/dist/esm/model/nodes/AssemblePromptNode.js +46 -17
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +392 -0
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +569 -0
- package/dist/esm/model/nodes/CodeNewNode.js +33 -9
- package/dist/esm/model/nodes/GraphInputNode.js +15 -19
- package/dist/esm/model/nodes/LLMChatV2Node.js +3 -12
- package/dist/esm/model/nodes/LLMProfileNode.js +6 -12
- package/dist/esm/model/nodes/MatchCaseNode.js +78 -3
- package/dist/esm/model/nodes/MatchCaseNodeBase.js +24 -2
- package/dist/esm/model/nodes/ObjectNode.js +48 -41
- package/dist/esm/model/nodes/PassthroughNode.js +1 -1
- package/dist/esm/model/nodes/ProjectNameNode.js +37 -0
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +1 -0
- package/dist/esm/model/nodes/SubGraphNode.js +1 -0
- package/dist/esm/model/nodes/codeOutputInference.js +292 -0
- package/dist/esm/model/nodes/variadicPortIndex.js +1 -1
- package/dist/esm/utils/serialization/serialization.js +4 -0
- package/dist/types/exports.d.ts +6 -0
- package/dist/types/model/EditorDefinition.d.ts +24 -0
- package/dist/types/model/GraphInputStream.d.ts +23 -0
- package/dist/types/model/GraphProcessor.d.ts +3 -0
- package/dist/types/model/MarkdownSanitizationPolicy.d.ts +1 -1
- package/dist/types/model/NodeExecutionPlanner.d.ts +1 -1
- package/dist/types/model/NodeImpl.d.ts +3 -1
- package/dist/types/model/Nodes.d.ts +7 -4
- package/dist/types/model/ProcessContext.d.ts +3 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/Settings.d.ts +4 -0
- package/dist/types/model/StreamingOutputWatch.d.ts +2 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +26 -0
- package/dist/types/model/classifier/credentials.d.ts +24 -0
- package/dist/types/model/classifier/migration.d.ts +18 -0
- package/dist/types/model/classifier/providers.d.ts +78 -0
- package/dist/types/model/classifier/questionHelpers.d.ts +31 -0
- package/dist/types/model/classifier/types.d.ts +58 -0
- package/dist/types/model/nodeBodyMarkdown.d.ts +19 -0
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +4 -3
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +47 -0
- package/dist/types/model/nodes/ClassifierQuestionNode.d.ts +60 -0
- package/dist/types/model/nodes/CodeNewNode.d.ts +6 -0
- package/dist/types/model/nodes/GraphInputNode.d.ts +2 -0
- package/dist/types/model/nodes/MatchCaseNode.d.ts +9 -2
- package/dist/types/model/nodes/MatchCaseNodeBase.d.ts +13 -1
- package/dist/types/model/nodes/ObjectNode.d.ts +5 -0
- package/dist/types/model/nodes/ProjectNameNode.d.ts +12 -0
- package/dist/types/model/nodes/codeOutputInference.d.ts +31 -0
- package/dist/types/model/nodes/variadicPortIndex.d.ts +1 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import type { ChartNode, PortId } from './NodeBase.js';
|
|
|
4
4
|
import type { GraphId } from './NodeGraph.js';
|
|
5
5
|
import type { Project } from './Project.js';
|
|
6
6
|
import type { AttachedNodeData, ExternalFunction, Outputs } from './GraphProcessor.js';
|
|
7
|
-
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'acceptStreamingWatchStop' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onGraphOutputPartial' | 'onPartialOutputs' | 'setFailureOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'splitIndex' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
7
|
+
export type NodeProcessContextBase = Omit<InternalProcessContext, 'attachedData' | 'activeOutputPortIds' | 'acceptStreamingWatchStop' | 'createSubProcessor' | 'execution' | 'externalFunctions' | 'getPluginConfig' | 'node' | 'onGraphOutputPartial' | 'graphInputStreams' | 'onPartialOutputs' | 'setFailureOutputs' | 'processId' | 'requestUserInput' | 'reportProgress' | 'isDirectRunTarget' | 'markResultAsEditorCacheHit' | 'setGlobal' | 'signal' | 'splitIndex' | 'toolCallContinuation' | 'toolCallTraceSource' | 'waitEvent'>;
|
|
8
8
|
export declare function buildNodeProcessContext(options: {
|
|
9
9
|
activeOutputPortIds: ReadonlySet<PortId>;
|
|
10
10
|
acceptStreamingWatchStop?: InternalProcessContext['acceptStreamingWatchStop'];
|
|
@@ -22,6 +22,7 @@ export declare function buildNodeProcessContext(options: {
|
|
|
22
22
|
node: ChartNode;
|
|
23
23
|
nodeAbortController: AbortController;
|
|
24
24
|
onGraphOutputPartial?: (partialOutputs: Outputs) => void;
|
|
25
|
+
graphInputStreams?: InternalProcessContext['graphInputStreams'];
|
|
25
26
|
onPartialOutputs: (partialOutputs: Outputs) => void;
|
|
26
27
|
setFailureOutputs?: InternalProcessContext['setFailureOutputs'];
|
|
27
28
|
processId: ProcessId;
|
|
@@ -10,6 +10,10 @@ export interface Settings<PluginSettings = Record<string, Record<string, unknown
|
|
|
10
10
|
pluginEnv?: {
|
|
11
11
|
[key: string]: string | undefined;
|
|
12
12
|
};
|
|
13
|
+
/** First-party credentials used by built-in classifier providers. */
|
|
14
|
+
classifierProviders?: Record<string, {
|
|
15
|
+
apiKey?: string | undefined;
|
|
16
|
+
}>;
|
|
13
17
|
openAiApiKey?: string;
|
|
14
18
|
openAiKey?: string;
|
|
15
19
|
anthropicApiKey?: string;
|
|
@@ -55,6 +55,8 @@ export declare const streamingOutputWatchLimits: {
|
|
|
55
55
|
export declare class StreamingOutputWatch {
|
|
56
56
|
#private;
|
|
57
57
|
constructor(options: Partial<StreamingOutputWatchOptions>, run: (snapshot: StreamingOutputWatchSnapshot, registerCancel: (cancel: () => void) => void) => Promise<void>, onFailure: (error: Error) => void);
|
|
58
|
+
/** Updates superseded before the receiving graph could start. */
|
|
59
|
+
accountCoalescedUpdates(count: number): void;
|
|
58
60
|
get hasPending(): boolean;
|
|
59
61
|
get isAwaitingProducer(): boolean;
|
|
60
62
|
get stopped(): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChartNode, NodeConnection, NodeId } from './NodeBase.js';
|
|
2
|
+
import type { FrozenNodeOutputsByGraph } from './GraphProcessor.js';
|
|
3
|
+
import type { GraphInputNode } from './nodes/GraphInputNode.js';
|
|
4
|
+
import type { GraphOutputNode } from './nodes/GraphOutputNode.js';
|
|
5
|
+
import type { NodeGraph } from './NodeGraph.js';
|
|
6
|
+
import type { NodeRegistration } from './NodeRegistration.js';
|
|
7
|
+
import type { Project, ProjectId } from './Project.js';
|
|
8
|
+
import type { ReferencedGraphAliasNode } from './nodes/ReferencedGraphAliasNode.js';
|
|
9
|
+
import type { SubGraphNode } from './nodes/SubGraphNode.js';
|
|
10
|
+
/** An executing caller may forward outputs after its condition has passed. */
|
|
11
|
+
export declare function canForwardGraphCallerOutputPartials(node: ChartNode): node is SubGraphNode | ReferencedGraphAliasNode;
|
|
12
|
+
/** Early input delivery must not bypass the caller's ordinary readiness/condition gate. */
|
|
13
|
+
export declare function canStreamThroughGraphCaller(node: ChartNode): node is SubGraphNode | ReferencedGraphAliasNode;
|
|
14
|
+
export declare function canStreamThroughGraphInput(node: ChartNode): node is GraphInputNode;
|
|
15
|
+
/** A named output may forward only when one direct producer determines its terminal value. */
|
|
16
|
+
export declare function canForwardGraphOutputPartials(graphOutput: ChartNode, sourceNode: ChartNode, graphOutputIsFrozen: boolean): graphOutput is GraphOutputNode;
|
|
17
|
+
/** Trace Watch demand through named boundaries without making ordinary nodes repeatable. */
|
|
18
|
+
export declare function getProjectStreamingOutputWatchConnections({ project, graph, referencedProjects, registry, frozenNodeOutputs, isNodeFrozen, fullGraphCallers, }: {
|
|
19
|
+
project: Project;
|
|
20
|
+
graph: NodeGraph;
|
|
21
|
+
referencedProjects: Record<ProjectId, Project>;
|
|
22
|
+
registry: NodeRegistration<any, any>;
|
|
23
|
+
frozenNodeOutputs?: FrozenNodeOutputsByGraph;
|
|
24
|
+
isNodeFrozen?: (owner: Project, candidate: NodeGraph, node: ChartNode) => boolean;
|
|
25
|
+
fullGraphCallers?: ReadonlySet<NodeId>;
|
|
26
|
+
}): ReadonlySet<NodeConnection>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
2
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
3
|
+
export type ClassifierApiKeySource = 'configured' | 'input';
|
|
4
|
+
export type ClassifierCredentialNames = {
|
|
5
|
+
programmaticName: string;
|
|
6
|
+
environmentVariableName: string;
|
|
7
|
+
};
|
|
8
|
+
export type ClassifierProviderCredentials = Record<string, {
|
|
9
|
+
apiKey?: string | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const JEV_DEFAULT_CREDENTIAL_NAMES: ClassifierCredentialNames;
|
|
12
|
+
export declare function isValidClassifierProgrammaticCredentialName(name: string): boolean;
|
|
13
|
+
export declare function isValidClassifierEnvironmentCredentialName(name: string): boolean;
|
|
14
|
+
export declare function normalizeClassifierCredentialNames(value: unknown, defaults?: ClassifierCredentialNames): ClassifierCredentialNames;
|
|
15
|
+
export declare function getClassifierCredentialNamesForDisplay(value: unknown, defaults?: ClassifierCredentialNames): ClassifierCredentialNames;
|
|
16
|
+
export declare function isDefaultClassifierCredentialNames(names: ClassifierCredentialNames, defaults?: ClassifierCredentialNames): boolean;
|
|
17
|
+
export declare function resolveClassifierApiKey({ apiKeyNames, apiKeySource, context, defaults, inputs, providerId, }: {
|
|
18
|
+
apiKeyNames?: ClassifierCredentialNames | undefined;
|
|
19
|
+
apiKeySource?: ClassifierApiKeySource | undefined;
|
|
20
|
+
context: Pick<InternalProcessContext, 'settings'>;
|
|
21
|
+
defaults: ClassifierCredentialNames;
|
|
22
|
+
inputs: Inputs;
|
|
23
|
+
providerId: string;
|
|
24
|
+
}): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChartNode } from '../NodeBase.js';
|
|
2
|
+
import type { NodeGraph } from '../NodeGraph.js';
|
|
3
|
+
import type { Project } from '../Project.js';
|
|
4
|
+
/**
|
|
5
|
+
* Converts the former TypeSafe plugin node family into the first-party
|
|
6
|
+
* classifier contract. It is intentionally idempotent because project data
|
|
7
|
+
* reaches Core through imports, hosted snapshots, recordings, and copies.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeClassifierProject(project: Project): void;
|
|
10
|
+
/**
|
|
11
|
+
* Checks whether a project still needs the in-place legacy migration. Hosts
|
|
12
|
+
* which receive a caller-owned project object use this before cloning, so a
|
|
13
|
+
* compatibility repair never mutates the caller's snapshot.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasLegacyClassifierProjectData(project: Project): boolean;
|
|
16
|
+
export declare function normalizeClassifierGraph(graph: NodeGraph): void;
|
|
17
|
+
export declare function hasLegacyClassifierGraphData(graph: NodeGraph): boolean;
|
|
18
|
+
export declare function normalizeClassifierNode(node: ChartNode): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ClassifierCredentialNames } from './credentials.js';
|
|
2
|
+
import type { ClassifierEvaluationResponse, ClassifierQuestionDefinition } from './types.js';
|
|
3
|
+
export declare const JEV_SYSTEM_ONE_ENDPOINT = "https://api.typesafe.ai/v1/systemone";
|
|
4
|
+
/** Jev's published USD rates. Keep this Core-owned rather than graph-authored. */
|
|
5
|
+
export declare const JEV_TOKEN_PRICING: {
|
|
6
|
+
readonly inputPerMillionTokens: 0.042;
|
|
7
|
+
readonly outputPerMillionTokens: 0;
|
|
8
|
+
};
|
|
9
|
+
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_REPEAT_TIMES = 1;
|
|
10
|
+
export declare const DEFAULT_CLASSIFIER_RETRY_ON_NON_200_COOLDOWN_MS = 0;
|
|
11
|
+
export type ClassifierProvider = {
|
|
12
|
+
id: string;
|
|
13
|
+
label: string;
|
|
14
|
+
defaultModel: string;
|
|
15
|
+
credentialNames: ClassifierCredentialNames;
|
|
16
|
+
browserExecutionSupported: boolean;
|
|
17
|
+
/** Static USD token pricing used only for optional Usage accounting. */
|
|
18
|
+
pricing?: ClassifierTokenPricing;
|
|
19
|
+
/**
|
|
20
|
+
* The response used by the node plus the exact JSON bodies that crossed the
|
|
21
|
+
* provider boundary. Request headers deliberately do not belong here: they
|
|
22
|
+
* carry the API key and must never become graph outputs.
|
|
23
|
+
*/
|
|
24
|
+
evaluate(args: ClassifierProviderEvaluateArgs): Promise<ClassifierProviderEvaluationResult>;
|
|
25
|
+
};
|
|
26
|
+
export type ClassifierTokenPricing = {
|
|
27
|
+
inputPerMillionTokens: number;
|
|
28
|
+
outputPerMillionTokens: number;
|
|
29
|
+
};
|
|
30
|
+
export type ClassifierProviderEvaluationResult = {
|
|
31
|
+
requestBody: Record<string, unknown>;
|
|
32
|
+
response: ClassifierEvaluationResponse;
|
|
33
|
+
responseBody: Record<string, unknown>;
|
|
34
|
+
};
|
|
35
|
+
export type ClassifierProviderEvaluateArgs = {
|
|
36
|
+
apiKey: string;
|
|
37
|
+
model: string;
|
|
38
|
+
questions: readonly ClassifierQuestionDefinition[];
|
|
39
|
+
signal: AbortSignal;
|
|
40
|
+
state: string | Record<string, unknown> | unknown[];
|
|
41
|
+
timeoutMs: number;
|
|
42
|
+
/** Opt-in retry policy for non-authentication, non-validation HTTP errors. */
|
|
43
|
+
retryOnNon200?: boolean;
|
|
44
|
+
retryOnNon200RepeatTimes?: number;
|
|
45
|
+
retryOnNon200CooldownMs?: number;
|
|
46
|
+
fetchImplementation?: typeof fetch;
|
|
47
|
+
};
|
|
48
|
+
export type ApiCompatibleClassifierProviderConfig = {
|
|
49
|
+
id: string;
|
|
50
|
+
label: string;
|
|
51
|
+
defaultModel: string;
|
|
52
|
+
credentialNames: ClassifierCredentialNames;
|
|
53
|
+
/** Static, provider-owned endpoint. It must never come from graph data. */
|
|
54
|
+
endpoint: string;
|
|
55
|
+
browserExecutionSupported?: boolean;
|
|
56
|
+
/** Static USD token pricing used only for optional Usage accounting. */
|
|
57
|
+
pricing?: ClassifierTokenPricing;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Builds a provider for the shared System One-compatible protocol. Provider
|
|
61
|
+
* descriptors remain static Core code, while the Evaluate node stays agnostic
|
|
62
|
+
* to which compatible provider is selected.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createApiCompatibleClassifierProvider(config: ApiCompatibleClassifierProviderConfig): ClassifierProvider;
|
|
65
|
+
export declare const jevClassifierProvider: ClassifierProvider;
|
|
66
|
+
/** Ordered so adding later API-compatible providers does not alter authored provider IDs. */
|
|
67
|
+
export declare const classifierProviders: readonly ClassifierProvider[];
|
|
68
|
+
export declare function getClassifierProvider(id: string | undefined): ClassifierProvider;
|
|
69
|
+
export declare function getClassifierProviderEnvironmentVariableNames(): string[];
|
|
70
|
+
/**
|
|
71
|
+
* Returns a USD cost only when the selected provider has static pricing and
|
|
72
|
+
* the token counts are safe non-negative integers. Callers must not treat an
|
|
73
|
+
* unpriced provider as free.
|
|
74
|
+
*/
|
|
75
|
+
export declare function calculateClassifierUsageCost(provider: Pick<ClassifierProvider, 'pricing'>, usage: ClassifierEvaluationResponse['usage']): number | undefined;
|
|
76
|
+
export declare function normalizeClassifierNon200RetryCount(value: number | undefined): number;
|
|
77
|
+
export declare function normalizeClassifierNon200RetryCooldownMs(value: number | undefined): number;
|
|
78
|
+
export declare function validateApiCompatibleClassifierResponse(body: unknown, questions: readonly ClassifierQuestionDefinition[], providerLabel?: string): ClassifierEvaluationResponse;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
2
|
+
import type { NodeInputDefinition } from '../NodeBase.js';
|
|
3
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
|
+
import type { ClassifierEntry, ClassifierEntryEditorType } from './types.js';
|
|
5
|
+
export type ClassifierQuestionBaseData = {
|
|
6
|
+
questionId: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
instructionsType?: ClassifierEntryEditorType;
|
|
9
|
+
instructionsLines?: string[];
|
|
10
|
+
instructionsObjectTemplate?: string;
|
|
11
|
+
useInstructionsInput?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function getInstructionsInputDefinition(): NodeInputDefinition;
|
|
14
|
+
export declare function getCriteriaInputDefinition(dataTypes: NodeInputDefinition['dataType']): NodeInputDefinition;
|
|
15
|
+
export declare function getInterpolationInputDefinitions(templates: readonly string[], reserved: ReadonlySet<string>): NodeInputDefinition[];
|
|
16
|
+
export declare function interpolateQuestionText(template: string, inputs: Inputs, context: InternalProcessContext): string;
|
|
17
|
+
export declare function resolveAuthoredClassifierEntry({ type, text, lines, objectTemplate, inputs, context, label, }: {
|
|
18
|
+
type: ClassifierEntryEditorType | undefined;
|
|
19
|
+
text: string | undefined;
|
|
20
|
+
lines: readonly string[] | undefined;
|
|
21
|
+
objectTemplate: string | undefined;
|
|
22
|
+
inputs: Inputs;
|
|
23
|
+
context: InternalProcessContext;
|
|
24
|
+
label: string;
|
|
25
|
+
}): Exclude<ClassifierEntry, null>;
|
|
26
|
+
export declare function getStringInput(inputs: Inputs, portId: string, label: string): string;
|
|
27
|
+
export declare function requireQuestionId(questionId: string): string;
|
|
28
|
+
export declare function getStructuredInput(inputs: Inputs, portId: string, label: string): ClassifierEntry;
|
|
29
|
+
export declare function assertClassifierEntry(value: unknown, label: string): asserts value is ClassifierEntry;
|
|
30
|
+
export declare function assertClassifierInstructions(value: unknown, label?: string): asserts value is Exclude<ClassifierEntry, null>;
|
|
31
|
+
export declare function abbreviate(value: string, maximum?: number): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type ClassifierQuestionType = 'choice' | 'score' | 'noul';
|
|
2
|
+
export type ClassifierEntryEditorType = 'text' | 'lines' | 'object';
|
|
3
|
+
export type ClassifierStructuredValue = string | number | boolean | null | {
|
|
4
|
+
[key: string]: ClassifierStructuredValue;
|
|
5
|
+
} | ClassifierStructuredValue[];
|
|
6
|
+
export type ClassifierEntry = string | null | {
|
|
7
|
+
[key: string]: ClassifierStructuredValue;
|
|
8
|
+
} | ClassifierStructuredValue[];
|
|
9
|
+
export type ClassifierScoreCriterionData = {
|
|
10
|
+
/** Editor-only stable identity; never leaves Rivet in the provider request. */
|
|
11
|
+
id?: string;
|
|
12
|
+
type: ClassifierEntryEditorType;
|
|
13
|
+
text: string;
|
|
14
|
+
lines: string[];
|
|
15
|
+
objectTemplate: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* An authored Choice criterion keeps one value for each supported editor
|
|
19
|
+
* representation. Switching the shared criteria type is therefore
|
|
20
|
+
* non-destructive, just like the Question's Instructions type switch.
|
|
21
|
+
*/
|
|
22
|
+
export type ClassifierChoiceCriterionData = {
|
|
23
|
+
/** Editor-only stable identity; never leaves Rivet in the provider request. */
|
|
24
|
+
id?: string;
|
|
25
|
+
key: string;
|
|
26
|
+
text: string;
|
|
27
|
+
lines: string[];
|
|
28
|
+
objectTemplate: string;
|
|
29
|
+
};
|
|
30
|
+
export type ClassifierQuestionDefinition = {
|
|
31
|
+
questionId: string;
|
|
32
|
+
type: ClassifierQuestionType;
|
|
33
|
+
instructions: ClassifierEntry;
|
|
34
|
+
criteria?: unknown;
|
|
35
|
+
};
|
|
36
|
+
export type ClassifierChoiceQuestionDefinition = ClassifierQuestionDefinition & {
|
|
37
|
+
type: 'choice';
|
|
38
|
+
criteria: Record<string, ClassifierEntry>;
|
|
39
|
+
};
|
|
40
|
+
export type ClassifierScoreQuestionDefinition = ClassifierQuestionDefinition & {
|
|
41
|
+
type: 'score';
|
|
42
|
+
criteria: ClassifierEntry[];
|
|
43
|
+
};
|
|
44
|
+
export type ClassifierNoulQuestionDefinition = ClassifierQuestionDefinition & {
|
|
45
|
+
type: 'noul';
|
|
46
|
+
criteria?: {
|
|
47
|
+
true: ClassifierEntry;
|
|
48
|
+
false: ClassifierEntry;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type ClassifierEvaluationResponse = {
|
|
52
|
+
model: string;
|
|
53
|
+
answers: Record<string, unknown>;
|
|
54
|
+
usage: {
|
|
55
|
+
input_tokens: number;
|
|
56
|
+
output_tokens: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const NODE_BODY_FIELD_LABEL_CLASS = "rivet-node-body-field-label";
|
|
2
|
+
export declare const NODE_BODY_FIELD_VALUE_CLASS = "rivet-node-body-field-value";
|
|
3
|
+
export declare const NODE_BODY_FIELD_ROW_CLASS = "rivet-node-body-field-row";
|
|
4
|
+
export declare const NODE_BODY_TEXT_ROW_CLASS = "rivet-node-body-text-row";
|
|
5
|
+
export declare const NODE_BODY_SEPARATOR_CLASS = "rivet-node-body-separator";
|
|
6
|
+
/**
|
|
7
|
+
* Renders a label/value pair for a Markdown node body without letting authored
|
|
8
|
+
* values become Markdown. Class-based styling is deliberately used instead of
|
|
9
|
+
* inline styles because node-body Markdown is sanitized before it reaches DOM.
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatNodeBodyMarkdownField(label: string, value: unknown): string;
|
|
12
|
+
/** Renders a sanitized, styled field label without adding an empty value node. */
|
|
13
|
+
export declare function formatNodeBodyMarkdownLabel(label: string): string;
|
|
14
|
+
/** Wraps authored text in a raw HTML span so Markdown punctuation stays literal. */
|
|
15
|
+
export declare function formatNodeBodyMarkdownValue(value: unknown): string;
|
|
16
|
+
/** Renders unlabelled authored text as a standalone Markdown body row. */
|
|
17
|
+
export declare function formatNodeBodyMarkdownTextRow(value: unknown): string;
|
|
18
|
+
/** A block separator that does not cause Markdown to create empty paragraphs. */
|
|
19
|
+
export declare function formatNodeBodyMarkdownSeparator(): string;
|
|
@@ -2,11 +2,12 @@ import { type ChartNode, type NodeConnection, type NodeInputDefinition, type Nod
|
|
|
2
2
|
import { NodeImpl, type NodeBody, type NodeUIData } from '../NodeImpl.js';
|
|
3
3
|
import { type Inputs, type Outputs } from '../GraphProcessor.js';
|
|
4
4
|
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
5
|
-
import type { RivetUIContext } from '../RivetUIContext.js';
|
|
6
5
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
6
|
export type AssemblePromptNode = ChartNode<'assemblePrompt', AssemblePromptNodeData>;
|
|
8
7
|
export type AssemblePromptNodeData = {
|
|
9
8
|
computeTokenCount?: boolean;
|
|
9
|
+
/** Remove messages that contain no meaningful text or rich content. */
|
|
10
|
+
filterEmptyPrompts?: boolean;
|
|
10
11
|
isLastMessageCacheBreakpoint?: boolean;
|
|
11
12
|
useIsLastMessageCacheBreakpointInput?: boolean;
|
|
12
13
|
};
|
|
@@ -15,8 +16,8 @@ export declare class AssemblePromptNodeImpl extends NodeImpl<AssemblePromptNode>
|
|
|
15
16
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
16
17
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
17
18
|
static getUIData(): NodeUIData;
|
|
18
|
-
getEditors(
|
|
19
|
-
getBody(
|
|
19
|
+
getEditors(): EditorDefinition<AssemblePromptNode>[];
|
|
20
|
+
getBody(): NodeBody | Promise<NodeBody>;
|
|
20
21
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
21
22
|
}
|
|
22
23
|
export declare const assemblePromptNode: import("../NodeDefinition.js").NodeDefinition<AssemblePromptNode>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
2
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
|
+
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
4
|
+
import type { ChartNode, NodeConnection, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
5
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
6
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
|
+
import { type ClassifierApiKeySource, type ClassifierCredentialNames } from '../classifier/credentials.js';
|
|
8
|
+
export type ClassifierEvaluateNodeData = {
|
|
9
|
+
provider?: string;
|
|
10
|
+
/** Empty or absent uses the selected provider's default model. */
|
|
11
|
+
model?: string;
|
|
12
|
+
useModelInput?: boolean;
|
|
13
|
+
/** Adds the exact JSON body sent to the provider, excluding its auth header. */
|
|
14
|
+
outputRequestBody?: boolean;
|
|
15
|
+
/** Adds the complete parsed JSON body returned by the provider. */
|
|
16
|
+
outputResponseBody?: boolean;
|
|
17
|
+
/** Adds calculated provider cost details to the existing Usage output. */
|
|
18
|
+
outputUsage?: boolean;
|
|
19
|
+
retryOnNon200?: boolean;
|
|
20
|
+
retryOnNon200RepeatTimes?: number;
|
|
21
|
+
retryOnNon200CooldownMs?: number;
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
apiKeySource?: ClassifierApiKeySource;
|
|
24
|
+
apiKeyNamesByProvider?: Record<string, ClassifierCredentialNames | undefined>;
|
|
25
|
+
/** @deprecated Migrated into apiKeyNamesByProvider. */
|
|
26
|
+
apiKeyNames?: ClassifierCredentialNames;
|
|
27
|
+
};
|
|
28
|
+
export type ClassifierEvaluateNode = ChartNode<'classifierEvaluate', ClassifierEvaluateNodeData>;
|
|
29
|
+
export type ClassifierEvaluateBodySection = Readonly<{
|
|
30
|
+
id: 'configuration' | 'error-behavior';
|
|
31
|
+
fields: readonly Readonly<{
|
|
32
|
+
label: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}>[];
|
|
35
|
+
}>;
|
|
36
|
+
export declare class ClassifierEvaluateNodeImpl extends NodeImpl<ClassifierEvaluateNode> {
|
|
37
|
+
static create(): ClassifierEvaluateNode;
|
|
38
|
+
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
39
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
40
|
+
getEditors(): EditorDefinition<ClassifierEvaluateNode>[];
|
|
41
|
+
getBody(): NodeBodySpec;
|
|
42
|
+
static getUIData(): NodeUIData;
|
|
43
|
+
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
44
|
+
}
|
|
45
|
+
/** Shared presentation model for the app's Classifier Evaluate card. */
|
|
46
|
+
export declare function getClassifierEvaluateBodySections(data: ClassifierEvaluateNodeData): readonly ClassifierEvaluateBodySection[];
|
|
47
|
+
export declare const classifierEvaluateNode: import("../NodeDefinition.js").NodeDefinition<ClassifierEvaluateNode>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
2
|
+
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
4
|
+
import type { NodeBodySpec } from '../NodeBodySpec.js';
|
|
5
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
6
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
|
+
import { type ClassifierQuestionBaseData } from '../classifier/questionHelpers.js';
|
|
8
|
+
import type { ClassifierChoiceCriterionData, ClassifierEntryEditorType, ClassifierQuestionType, ClassifierScoreCriterionData } from '../classifier/types.js';
|
|
9
|
+
export type ClassifierQuestionNodeData = ClassifierQuestionBaseData & {
|
|
10
|
+
questionType: ClassifierQuestionType;
|
|
11
|
+
/** One representation shared by all authored criteria for the active question type. */
|
|
12
|
+
criteriaType?: ClassifierEntryEditorType;
|
|
13
|
+
options?: {
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
}[];
|
|
17
|
+
choiceCriteria?: ClassifierChoiceCriterionData[];
|
|
18
|
+
scoreCriteria?: ClassifierScoreCriterionData[];
|
|
19
|
+
/** @deprecated Compatibility for projects created before structured Score criteria. */
|
|
20
|
+
levels?: string[];
|
|
21
|
+
noulTrueCriteria?: string;
|
|
22
|
+
noulFalseCriteria?: string;
|
|
23
|
+
noulTrueCriteriaLines?: string[];
|
|
24
|
+
noulFalseCriteriaLines?: string[];
|
|
25
|
+
noulTrueCriteriaObjectTemplate?: string;
|
|
26
|
+
noulFalseCriteriaObjectTemplate?: string;
|
|
27
|
+
useNoulTrueCriteriaInput?: boolean;
|
|
28
|
+
useNoulFalseCriteriaInput?: boolean;
|
|
29
|
+
/** @deprecated Compatibility for projects created before named Noul criteria. */
|
|
30
|
+
yesMeans?: string;
|
|
31
|
+
/** @deprecated Compatibility for projects created before named Noul criteria. */
|
|
32
|
+
noMeans?: string;
|
|
33
|
+
/** Complete Choice/Score criteria input, plus legacy Noul object input. */
|
|
34
|
+
useCriteriaInput?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type ClassifierQuestionNode = ChartNode<'classifierQuestion', ClassifierQuestionNodeData>;
|
|
37
|
+
export type ClassifierQuestionBodySection = Readonly<{
|
|
38
|
+
id: 'identity' | 'instructions' | 'criteria';
|
|
39
|
+
fields: readonly Readonly<{
|
|
40
|
+
label: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}>[];
|
|
43
|
+
summary?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export declare class ClassifierQuestionNodeImpl extends NodeImpl<ClassifierQuestionNode> {
|
|
46
|
+
static create(): ClassifierQuestionNode;
|
|
47
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
48
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
49
|
+
getEditors(): EditorDefinition<ClassifierQuestionNode>[];
|
|
50
|
+
getBody(): NodeBodySpec;
|
|
51
|
+
static getUIData(): NodeUIData;
|
|
52
|
+
process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Shared presentation model for the app's Classifier card. Keep this data-only
|
|
56
|
+
* so the Core Markdown fallback and the app's LLM-style React body cannot
|
|
57
|
+
* disagree about what a saved question represents.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getClassifierQuestionBodySections(data: ClassifierQuestionNodeData): readonly ClassifierQuestionBodySection[];
|
|
60
|
+
export declare const classifierQuestionNode: import("../NodeDefinition.js").NodeDefinition<ClassifierQuestionNode>;
|
|
@@ -4,9 +4,15 @@ import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
|
4
4
|
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
5
5
|
import { type NodeBodySpec } from '../NodeBodySpec.js';
|
|
6
6
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
|
+
import { type CodeOutputField } from './codeOutputInference.js';
|
|
8
|
+
export { analyzeCodeOutputs, getCodeOutputFields, getCodeOutputKeys, prepareCodeOutputEdit, type CodeOutputField, } from './codeOutputInference.js';
|
|
7
9
|
export type CodeNewNode = ChartNode<'codeNew', CodeNewNodeData>;
|
|
8
10
|
export type CodeNewNodeData = {
|
|
9
11
|
code: string;
|
|
12
|
+
inferredOutputFields?: CodeOutputField[];
|
|
13
|
+
inferredOutputKeys?: string[];
|
|
14
|
+
inferredOutputRetiredFields?: CodeOutputField[];
|
|
15
|
+
inferredOutputLastValidCode?: string;
|
|
10
16
|
};
|
|
11
17
|
export declare const CODE_NEW_OUTPUT_PORT_ID: PortId;
|
|
12
18
|
export declare function interpolateCodeNewSource(code: string, inputs: Inputs): string;
|
|
@@ -21,4 +21,6 @@ export declare class GraphInputNodeImpl extends NodeImpl<GraphInputNode> {
|
|
|
21
21
|
static getUIData(): NodeUIData;
|
|
22
22
|
process(inputs: Inputs, context: InternalProcessContext): Promise<Record<string, DataValue>>;
|
|
23
23
|
}
|
|
24
|
+
/** One coercion/default policy for ordinary and live graph inputs. */
|
|
25
|
+
export declare function resolveGraphInputValue(data: GraphInputNodeData, input: DataValue | undefined, inputs?: Inputs): DataValue;
|
|
24
26
|
export declare const graphInputNode: import("../NodeDefinition.js").NodeDefinition<GraphInputNode>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type NodeUIData } from '../NodeImpl.js';
|
|
2
|
-
import { type ChartNode } from '../NodeBase.js';
|
|
2
|
+
import { type ChartNode, type NodeInputDefinition } from '../NodeBase.js';
|
|
3
3
|
import { type EditorDefinition } from '../EditorDefinition.js';
|
|
4
|
+
import { type Inputs } from '../GraphProcessor.js';
|
|
5
|
+
import { type InternalProcessContext } from '../ProcessContext.js';
|
|
4
6
|
import { MatchCaseNodeBase, type MatchCaseReturnValueMode, type MatchCaseRoutingData } from './MatchCaseNodeBase.js';
|
|
5
7
|
export type MatchCaseMode = 'plainText' | 'regex';
|
|
6
8
|
export type MatchCaseReturnValue = MatchCaseReturnValueMode;
|
|
@@ -17,6 +19,9 @@ export type MatchCaseNode = ChartNode<'matchCase', MatchCaseNodeData>;
|
|
|
17
19
|
export declare class MatchCaseNodeImpl extends MatchCaseNodeBase<MatchCaseNode> {
|
|
18
20
|
protected readonly caseEditorLabel = "Cases";
|
|
19
21
|
protected readonly caseEditorPlaceholder = "Case";
|
|
22
|
+
protected readonly caseEditorHighlightsInterpolation = true;
|
|
23
|
+
protected readonly caseEditorInputFontFamily: "monospace";
|
|
24
|
+
protected readonly caseEditorBoxed = true;
|
|
20
25
|
protected readonly casesEditorPlacement = "before-trigger";
|
|
21
26
|
protected readonly customCaseValuesEditorLabel = "";
|
|
22
27
|
protected readonly defaultExclusive = true;
|
|
@@ -26,7 +31,7 @@ export declare class MatchCaseNodeImpl extends MatchCaseNodeBase<MatchCaseNode>
|
|
|
26
31
|
value: boolean;
|
|
27
32
|
label: string;
|
|
28
33
|
}[];
|
|
29
|
-
protected readonly sharedCustomValueInputTitle = "
|
|
34
|
+
protected readonly sharedCustomValueInputTitle = "Output value";
|
|
30
35
|
protected readonly triggerEditorLabel = "Trigger";
|
|
31
36
|
static create(): MatchCaseNode;
|
|
32
37
|
protected matchesCase(input: string, caseValue: string): boolean;
|
|
@@ -35,6 +40,8 @@ export declare class MatchCaseNodeImpl extends MatchCaseNodeBase<MatchCaseNode>
|
|
|
35
40
|
protected getReturnValueMode(): MatchCaseReturnValue;
|
|
36
41
|
protected getEditorsAfterTrigger(): EditorDefinition<MatchCaseNode>[];
|
|
37
42
|
protected shouldHideCustomCaseValues(data: MatchCaseNodeData): boolean;
|
|
43
|
+
protected getInterpolationInputDefinitions(): NodeInputDefinition[];
|
|
44
|
+
protected resolveCaseValues(inputs: Inputs, context?: InternalProcessContext): readonly string[];
|
|
38
45
|
getEditors(): EditorDefinition<MatchCaseNode>[];
|
|
39
46
|
static getUIData(): NodeUIData;
|
|
40
47
|
private getMatchMode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type EditorDefinition } from '../EditorDefinition.js';
|
|
2
2
|
import { type Inputs, type Outputs } from '../GraphProcessor.js';
|
|
3
|
+
import { type InternalProcessContext } from '../ProcessContext.js';
|
|
3
4
|
import { NodeImpl } from '../NodeImpl.js';
|
|
4
5
|
import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
|
|
5
6
|
/** Shared saved routing and custom-value settings for Match case node variants. */
|
|
@@ -20,6 +21,10 @@ export type MatchCaseReturnValueMode = 'true' | 'testValue' | 'custom';
|
|
|
20
21
|
export declare abstract class MatchCaseNodeBase<T extends ChartNode<string, MatchCaseRoutingData>> extends NodeImpl<T> {
|
|
21
22
|
protected abstract readonly caseEditorLabel: string;
|
|
22
23
|
protected abstract readonly caseEditorPlaceholder: string;
|
|
24
|
+
protected readonly caseEditorHelperMessage: string | undefined;
|
|
25
|
+
protected readonly caseEditorHighlightsInterpolation: boolean;
|
|
26
|
+
protected readonly caseEditorInputFontFamily: 'monospace' | undefined;
|
|
27
|
+
protected readonly caseEditorBoxed: boolean;
|
|
23
28
|
protected readonly casesEditorPlacement: 'before-trigger' | 'after-custom-values';
|
|
24
29
|
protected readonly customCaseValuesEditorLabel: string;
|
|
25
30
|
protected readonly defaultExclusive: boolean;
|
|
@@ -37,11 +42,18 @@ export declare abstract class MatchCaseNodeBase<T extends ChartNode<string, Matc
|
|
|
37
42
|
protected getReturnValueMode(): MatchCaseReturnValueMode;
|
|
38
43
|
protected getEditorsAfterTrigger(): EditorDefinition<T>[];
|
|
39
44
|
protected shouldHideCustomCaseValues(_data: T['data']): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Current Match case resolves its saved case templates at execution time.
|
|
47
|
+
* The legacy Regex Match node deliberately leaves its saved expressions raw.
|
|
48
|
+
*/
|
|
49
|
+
protected resolveCaseValues(_inputs: Inputs, _context?: InternalProcessContext): readonly string[];
|
|
50
|
+
/** Additional inputs that sit between the tested value and custom return values. */
|
|
51
|
+
protected getInterpolationInputDefinitions(): NodeInputDefinition[];
|
|
40
52
|
getInputDefinitions(): NodeInputDefinition[];
|
|
41
53
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
42
54
|
getBody(): string;
|
|
43
55
|
getEditors(): EditorDefinition<T>[];
|
|
44
|
-
process(inputs: Inputs): Promise<Outputs>;
|
|
56
|
+
process(inputs: Inputs, context?: InternalProcessContext): Promise<Outputs>;
|
|
45
57
|
protected getValueInputMode(): 'shared' | 'per-output';
|
|
46
58
|
protected getExclusive(): boolean;
|
|
47
59
|
private getMatchingOutputDescription;
|
|
@@ -7,6 +7,11 @@ export type ObjectNode = ChartNode<'object', ObjectNodeData>;
|
|
|
7
7
|
export type ObjectNodeData = {
|
|
8
8
|
jsonTemplate: string;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Interpolates a JSON template without parsing it. Shared by Object and other
|
|
12
|
+
* first-party nodes which author structured EntryType values.
|
|
13
|
+
*/
|
|
14
|
+
export declare function interpolateJsonTemplate(baseString: string, values: Record<string, unknown>, graphInputNodeValues?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, unknown>): string;
|
|
10
15
|
export declare class ObjectNodeImpl extends NodeImpl<ObjectNode> {
|
|
11
16
|
static create(): ObjectNode;
|
|
12
17
|
getInputDefinitions(): NodeInputDefinition[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartNode, EditorDefinition, Inputs, InternalProcessContext, NodeInputDefinition, NodeOutputDefinition, NodeUIData, Outputs } from '../../index.js';
|
|
2
|
+
import { NodeImpl } from '../NodeImpl.js';
|
|
3
|
+
export type ProjectNameNode = ChartNode<'projectName', Record<string, never>>;
|
|
4
|
+
export declare class ProjectNameNodeImpl extends NodeImpl<ProjectNameNode> {
|
|
5
|
+
static create(): ProjectNameNode;
|
|
6
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
7
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
8
|
+
getEditors(): EditorDefinition<ProjectNameNode>[];
|
|
9
|
+
static getUIData(): NodeUIData;
|
|
10
|
+
process(_inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
|
|
11
|
+
}
|
|
12
|
+
export declare const projectNameNode: import("../NodeDefinition.js").NodeDefinition<ProjectNameNode>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type CodeOutputAnalysis = {
|
|
2
|
+
readonly valid: true;
|
|
3
|
+
readonly keys: readonly string[];
|
|
4
|
+
} | {
|
|
5
|
+
readonly valid: false;
|
|
6
|
+
};
|
|
7
|
+
/** A persisted output-port identity and the returned object property it currently reads. */
|
|
8
|
+
export type CodeOutputField = {
|
|
9
|
+
id: string;
|
|
10
|
+
key: string;
|
|
11
|
+
};
|
|
12
|
+
type CodeOutputData = {
|
|
13
|
+
code: string;
|
|
14
|
+
inferredOutputFields?: CodeOutputField[];
|
|
15
|
+
inferredOutputKeys?: string[];
|
|
16
|
+
inferredOutputRetiredFields?: CodeOutputField[];
|
|
17
|
+
/** Last valid source while the current edit is syntactically incomplete. */
|
|
18
|
+
inferredOutputLastValidCode?: string;
|
|
19
|
+
};
|
|
20
|
+
/** Syntax-only analysis of explicit object returns in the authored function. */
|
|
21
|
+
export declare function analyzeCodeOutputs(code: string): CodeOutputAnalysis;
|
|
22
|
+
/** Resolves the displayed fields and their stable port identities without mutating node data. */
|
|
23
|
+
export declare function getCodeOutputFields(data: CodeOutputData): readonly CodeOutputField[];
|
|
24
|
+
export declare function getCodeOutputKeys(data: CodeOutputData): readonly string[];
|
|
25
|
+
/**
|
|
26
|
+
* Prepares persisted output identities as part of an editor transaction.
|
|
27
|
+
* Valid source owns the visible fields. Invalid source retains the last valid
|
|
28
|
+
* identities and source so a completed key-only rename can still be proved.
|
|
29
|
+
*/
|
|
30
|
+
export declare function prepareCodeOutputEdit(previous: CodeOutputData, patch: Partial<CodeOutputData>): CodeOutputData;
|
|
31
|
+
export {};
|
|
@@ -2,3 +2,4 @@ import type { NodeConnection, NodeId } from '../NodeBase.js';
|
|
|
2
2
|
export type VariadicPortIndexPolicy = 'legacy' | 'decimal' | 'strict-positive';
|
|
3
3
|
export declare function getHighestVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
4
4
|
export declare function getNextVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
5
|
+
export declare function parseVariadicPortIndex(portId: string, prefix: string, policy: VariadicPortIndexPolicy): number | undefined;
|