@valerypopoff/rivet2-core 2.1.2 → 2.1.3
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 +904 -434
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/api/processSettings.js +5 -0
- package/dist/esm/exports.js +2 -0
- package/dist/esm/model/GraphProcessor.js +24 -45
- package/dist/esm/model/GraphRunLifecycle.js +67 -0
- package/dist/esm/model/MarkdownSanitizationPolicy.js +38 -0
- package/dist/esm/model/UiGraph.js +57 -0
- package/dist/esm/model/UiGraphRendererStyles.js +82 -0
- package/dist/esm/model/UiGraphRuntimeModel.js +71 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +1 -1
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +35 -48
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +98 -0
- package/dist/esm/model/chat-v2/chatV2RequestPlan.js +64 -0
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +11 -39
- package/dist/esm/model/chat-v2/index.js +2 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +1 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +31 -11
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +21 -9
- package/dist/esm/model/chat-v2/providerOptions.js +9 -35
- package/dist/esm/model/nodes/LLMChatV2Node.js +3 -3
- package/dist/esm/plugins/autoevals/AutoEvalsNode.js +3 -1
- package/dist/esm/plugins/gentrace/gentraceSdk.js +8 -0
- package/dist/esm/plugins/gentrace/plugin.js +5 -4
- package/dist/esm/plugins/google/google.js +9 -7
- package/dist/esm/utils/pQueueCompat.js +1 -1
- package/dist/esm/utils/serialization/serializationUtils.js +35 -0
- package/dist/esm/utils/serialization/serialization_v4.js +5 -4
- package/dist/esm/webAppRuntime.js +2 -0
- package/dist/types/api/createProcessor.d.ts +1 -1
- package/dist/types/api/processSettings.d.ts +3 -4
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/model/GraphRunLifecycle.d.ts +22 -0
- package/dist/types/model/MarkdownSanitizationPolicy.d.ts +9 -0
- package/dist/types/model/ProcessContext.d.ts +2 -2
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/UiGraph.d.ts +12 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/UiGraphRuntimeModel.d.ts +52 -0
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +46 -0
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +42 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +1 -0
- package/dist/types/model/chat-v2/index.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +1 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -2
- package/dist/types/plugins/gentrace/gentraceSdk.d.ts +5 -0
- package/dist/types/plugins/gentrace/plugin.d.ts +1 -1
- package/dist/types/utils/pQueueCompat.d.ts +1 -1
- package/dist/types/webAppRuntime.d.ts +4 -0
- package/package.json +15 -9
|
@@ -2,7 +2,6 @@ import { createAnthropic } from '@ai-sdk/anthropic';
|
|
|
2
2
|
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
3
3
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
4
4
|
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
|
|
5
|
-
import { DEFAULT_CHAT_ENDPOINT } from '../../utils/defaults.js';
|
|
6
5
|
import { cleanHeaders } from '../../utils/inputs.js';
|
|
7
6
|
import { getChatV2ModelRegistry } from './modelRegistry.js';
|
|
8
7
|
export const chatV2ProviderOptions = [
|
|
@@ -100,17 +99,6 @@ function openAIEndpointToBaseURL(endpoint) {
|
|
|
100
99
|
export function openAICompatibleEndpointToBaseURL(endpoint) {
|
|
101
100
|
return openAIEndpointToBaseURL(endpoint);
|
|
102
101
|
}
|
|
103
|
-
function openAIBaseURLToEndpoint(baseURL) {
|
|
104
|
-
const normalizedBaseURL = removeTrailingSlash(baseURL);
|
|
105
|
-
try {
|
|
106
|
-
const url = new URL(normalizedBaseURL);
|
|
107
|
-
url.pathname = `${url.pathname.replace(/\/$/, '')}/chat/completions`;
|
|
108
|
-
return url.toString();
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return `${normalizedBaseURL}/chat/completions`;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
102
|
function parseBodyText(text) {
|
|
115
103
|
try {
|
|
116
104
|
return JSON.parse(text);
|
|
@@ -166,39 +154,25 @@ function createRequestBodyCapturingFetch(onRequestBody) {
|
|
|
166
154
|
function maybeCreateRequestBodyCapturingFetch(options) {
|
|
167
155
|
return options.onRequestBody == null ? undefined : createRequestBodyCapturingFetch(options.onRequestBody);
|
|
168
156
|
}
|
|
169
|
-
export async function resolveChatV2ProviderConfig(provider,
|
|
157
|
+
export async function resolveChatV2ProviderConfig(provider, _modelId, context, options = {}) {
|
|
170
158
|
const headers = cleanHeaders({
|
|
171
159
|
...context.settings.chatNodeHeaders,
|
|
172
160
|
...options.headers,
|
|
173
161
|
});
|
|
174
162
|
switch (provider) {
|
|
175
|
-
case 'openai':
|
|
176
|
-
const configuredBaseURL = options.baseURL
|
|
177
|
-
? options.baseURL
|
|
178
|
-
: openAIEndpointToBaseURL(context.settings.openAiEndpoint || DEFAULT_CHAT_ENDPOINT);
|
|
179
|
-
if (context.getChatNodeEndpoint == null) {
|
|
180
|
-
return {
|
|
181
|
-
baseURL: configuredBaseURL,
|
|
182
|
-
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
const resolved = await context.getChatNodeEndpoint(openAIBaseURLToEndpoint(configuredBaseURL), modelId);
|
|
163
|
+
case 'openai':
|
|
186
164
|
return {
|
|
187
|
-
baseURL:
|
|
188
|
-
headers:
|
|
189
|
-
...headers,
|
|
190
|
-
...resolved.headers,
|
|
191
|
-
}),
|
|
165
|
+
baseURL: undefined,
|
|
166
|
+
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
192
167
|
};
|
|
193
|
-
}
|
|
194
168
|
case 'anthropic':
|
|
195
169
|
return {
|
|
196
|
-
baseURL:
|
|
170
|
+
baseURL: undefined,
|
|
197
171
|
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
198
172
|
};
|
|
199
173
|
case 'google':
|
|
200
174
|
return {
|
|
201
|
-
baseURL:
|
|
175
|
+
baseURL: undefined,
|
|
202
176
|
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
203
177
|
};
|
|
204
178
|
case 'custom': {
|
|
@@ -219,7 +193,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
219
193
|
const providerInstance = createOpenAI({
|
|
220
194
|
apiKey: options.apiKey || context.settings.openAiApiKey || context.settings.openAiKey || undefined,
|
|
221
195
|
organization: context.settings.openAiOrganization || undefined,
|
|
222
|
-
baseURL:
|
|
196
|
+
baseURL: undefined,
|
|
223
197
|
headers: options.headers,
|
|
224
198
|
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
225
199
|
});
|
|
@@ -228,7 +202,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
228
202
|
case 'anthropic': {
|
|
229
203
|
const providerInstance = createAnthropic({
|
|
230
204
|
apiKey: options.apiKey || context.settings.anthropicApiKey || context.getPluginConfig('anthropicApiKey') || undefined,
|
|
231
|
-
baseURL:
|
|
205
|
+
baseURL: undefined,
|
|
232
206
|
headers: options.headers,
|
|
233
207
|
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
234
208
|
});
|
|
@@ -237,7 +211,7 @@ export function createChatV2Model(provider, modelId, context, options = {}) {
|
|
|
237
211
|
case 'google': {
|
|
238
212
|
const providerInstance = createGoogleGenerativeAI({
|
|
239
213
|
apiKey: options.apiKey || context.settings.googleApiKey || context.getPluginConfig('googleApiKey') || undefined,
|
|
240
|
-
baseURL:
|
|
214
|
+
baseURL: undefined,
|
|
241
215
|
headers: options.headers,
|
|
242
216
|
fetch: maybeCreateRequestBodyCapturingFetch(options),
|
|
243
217
|
});
|
|
@@ -14,7 +14,7 @@ import { runChatV2PipelineWithToolContinuation } from '../chat-v2/toolContinuati
|
|
|
14
14
|
import { delegateToolCall } from './toolCallDelegation.js';
|
|
15
15
|
export { buildLLMChatV2EditorCacheKey, resolveLLMChatV2RuntimeProviderOptions };
|
|
16
16
|
function usesBaseURLInput(data) {
|
|
17
|
-
return data.provider === 'custom'
|
|
17
|
+
return data.provider === 'custom' && data.useCustomProviderBaseURLInput;
|
|
18
18
|
}
|
|
19
19
|
function getCustomProviderBaseURLBodyValue(data) {
|
|
20
20
|
if (data.provider !== 'custom') {
|
|
@@ -100,8 +100,8 @@ export class LLMChatV2NodeImpl extends NodeImpl {
|
|
|
100
100
|
}
|
|
101
101
|
if (usesBaseURLInput(this.data)) {
|
|
102
102
|
inputs.unshift({
|
|
103
|
-
id:
|
|
104
|
-
title:
|
|
103
|
+
id: 'customProviderBaseURL',
|
|
104
|
+
title: 'Provider base URL',
|
|
105
105
|
dataType: 'string',
|
|
106
106
|
required: false,
|
|
107
107
|
});
|
|
@@ -207,7 +207,9 @@ export const AutoEvalsNodeImpl = {
|
|
|
207
207
|
return {
|
|
208
208
|
['score']: {
|
|
209
209
|
type: 'number',
|
|
210
|
-
|
|
210
|
+
// Newer AutoEvals versions represent unavailable scores as null, while
|
|
211
|
+
// this node's declared port remains numeric.
|
|
212
|
+
value: result.score ?? 0,
|
|
211
213
|
},
|
|
212
214
|
['rationale']: {
|
|
213
215
|
type: 'string',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Gentrace's package root also exports its Node-only job runner. Keep the
|
|
2
|
+
// browser-compatible APIs behind this adapter so app bundles do not pull in
|
|
3
|
+
// async_hooks and ws through exports that Rivet never uses.
|
|
4
|
+
export { init } from '@gentrace/core/dist/providers/init.mjs';
|
|
5
|
+
export { getPipelines } from '@gentrace/core/dist/providers/pipeline-methods.mjs';
|
|
6
|
+
export { Pipeline } from '@gentrace/core/dist/providers/pipeline.mjs';
|
|
7
|
+
export { runTest } from '@gentrace/core/dist/providers/run-test.mjs';
|
|
8
|
+
export { StepRun } from '@gentrace/core/dist/providers/step-run.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Pipeline, StepRun, init, runTest, getPipelines } from '
|
|
1
|
+
import { Pipeline, StepRun, init, runTest, getPipelines } from './gentraceSdk.js';
|
|
2
2
|
import { globalRivetNodeRegistry } from '../../model/Nodes.js';
|
|
3
3
|
import { cloneDeep, mapValues } from 'lodash-es';
|
|
4
4
|
import { GptTokenizerTokenizer } from '../../integrations/GptTokenizerTokenizer.js';
|
|
@@ -6,6 +6,7 @@ import { ExecutionRecorder } from '../../recording/ExecutionRecorder.js';
|
|
|
6
6
|
import { inferType } from '../../utils/coerceType.js';
|
|
7
7
|
// eslint-disable-next-line import/no-cycle -- Local Gentrace execution intentionally depends on GraphProcessor.
|
|
8
8
|
import { GraphProcessor } from '../../model/GraphProcessor.js';
|
|
9
|
+
import { resolveProcessSettings } from '../../api/processSettings.js';
|
|
9
10
|
const apiKeyConfigSpec = {
|
|
10
11
|
type: 'secret',
|
|
11
12
|
label: 'Gentrace API Key',
|
|
@@ -47,7 +48,7 @@ export const runGentraceTests = async (gentracePipelineSlug, settings, project,
|
|
|
47
48
|
recorder.record(processor);
|
|
48
49
|
const runContextValues = cloneDeep(contextValues);
|
|
49
50
|
await processor.processGraph({
|
|
50
|
-
settings,
|
|
51
|
+
settings: resolveProcessSettings(settings),
|
|
51
52
|
nativeApi,
|
|
52
53
|
tokenizer: new GptTokenizerTokenizer(),
|
|
53
54
|
}, rivetFormattedInputs, runContextValues);
|
|
@@ -175,11 +176,11 @@ function convertRecordingToStepRuns(recording, project, graphId) {
|
|
|
175
176
|
},
|
|
176
177
|
};
|
|
177
178
|
});
|
|
178
|
-
stepRuns.push(new StepRun('openai', 'openai_createChatCompletion', pair.end - pair.start, new Date(pair.start).toISOString(), new Date(pair.end).toISOString(), gentraceOpenAIInputs, gentraceOpenAIModelParams, gentraceOpenAIOutputs, {}));
|
|
179
|
+
stepRuns.push(new StepRun('openai', 'openai_createChatCompletion', pair.end - pair.start, new Date(pair.start).toISOString(), new Date(pair.end).toISOString(), gentraceOpenAIInputs, gentraceOpenAIModelParams, gentraceOpenAIOutputs, {}, undefined));
|
|
179
180
|
continue;
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
|
-
stepRuns.push(new StepRun('rivet', nodeType ? `rivet_operation_${nodeType}` : 'rivet_operation', pair.end - pair.start, new Date(pair.start).toISOString(), new Date(pair.end).toISOString(), pair.inputs, pair.modelParams, pair.outputs, {}));
|
|
183
|
+
stepRuns.push(new StepRun('rivet', nodeType ? `rivet_operation_${nodeType}` : 'rivet_operation', pair.end - pair.start, new Date(pair.start).toISOString(), new Date(pair.end).toISOString(), pair.inputs, pair.modelParams, pair.outputs, {}, undefined));
|
|
183
184
|
}
|
|
184
185
|
return stepRuns;
|
|
185
186
|
}
|
|
@@ -135,11 +135,11 @@ export async function* streamChatCompletions({ project, location, applicationCre
|
|
|
135
135
|
const vertexAi = new VertexAI({ project, location });
|
|
136
136
|
const generativeModel = vertexAi.preview.getGenerativeModel({
|
|
137
137
|
model,
|
|
138
|
-
|
|
139
|
-
max_output_tokens,
|
|
138
|
+
generationConfig: {
|
|
139
|
+
maxOutputTokens: max_output_tokens,
|
|
140
140
|
temperature,
|
|
141
|
-
top_p,
|
|
142
|
-
top_k,
|
|
141
|
+
topP: top_p,
|
|
142
|
+
topK: top_k,
|
|
143
143
|
},
|
|
144
144
|
});
|
|
145
145
|
const response = await generativeModel.generateContentStream({
|
|
@@ -148,10 +148,12 @@ export async function* streamChatCompletions({ project, location, applicationCre
|
|
|
148
148
|
let hadChunks = false;
|
|
149
149
|
for await (const chunk of response.stream) {
|
|
150
150
|
hadChunks = true;
|
|
151
|
-
|
|
151
|
+
const candidate = chunk.candidates?.[0];
|
|
152
|
+
const completion = candidate?.content.parts[0]?.text;
|
|
153
|
+
if (!signal?.aborted && completion) {
|
|
152
154
|
yield {
|
|
153
|
-
completion
|
|
154
|
-
finish_reason:
|
|
155
|
+
completion,
|
|
156
|
+
finish_reason: candidate.finishReason,
|
|
155
157
|
model,
|
|
156
158
|
};
|
|
157
159
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PQueueImport from 'p-queue';
|
|
2
2
|
/**
|
|
3
|
-
* p-queue v7+ is ESM-only. The CJS bundle (built by bundle.esbuild.
|
|
3
|
+
* p-queue v7+ is ESM-only. The CJS bundle (built by bundle.esbuild.cjs) aliases
|
|
4
4
|
* `p-queue` to `p-queue-6` (a CJS-compatible older version). That version wraps
|
|
5
5
|
* the default export so that `import PQueue from 'p-queue'` resolves to
|
|
6
6
|
* `{ default: PQueue }` instead of the class directly. This module normalizes
|
|
@@ -63,8 +63,43 @@ export function validateProject(project) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
if (p.uiGraphs != null) {
|
|
67
|
+
validateUiGraphs(p.uiGraphs, errors);
|
|
68
|
+
}
|
|
66
69
|
return { valid: errors.length === 0, errors, warnings };
|
|
67
70
|
}
|
|
71
|
+
function validateUiGraphs(uiGraphs, errors) {
|
|
72
|
+
if (!uiGraphs || typeof uiGraphs !== 'object' || Array.isArray(uiGraphs)) {
|
|
73
|
+
errors.push('Project uiGraphs is not an object');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
for (const [uiGraphId, uiGraph] of Object.entries(uiGraphs)) {
|
|
77
|
+
if (!uiGraph || typeof uiGraph !== 'object' || Array.isArray(uiGraph)) {
|
|
78
|
+
errors.push(`UI graph "${uiGraphId}" is not an object`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const components = uiGraph.components;
|
|
82
|
+
if (!Array.isArray(components)) {
|
|
83
|
+
errors.push(`UI graph "${uiGraphId}" components is not an array`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const componentIds = new Set();
|
|
87
|
+
for (const [index, component] of components.entries()) {
|
|
88
|
+
const componentId = component && typeof component === 'object' && !Array.isArray(component)
|
|
89
|
+
? component.id
|
|
90
|
+
: undefined;
|
|
91
|
+
if (typeof componentId !== 'string' || !componentId.trim()) {
|
|
92
|
+
errors.push(`UI graph "${uiGraphId}" component at index ${index} missing id`);
|
|
93
|
+
}
|
|
94
|
+
else if (componentIds.has(componentId)) {
|
|
95
|
+
errors.push(`UI graph "${uiGraphId}" component "${componentId}" has a duplicate id`);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
componentIds.add(componentId);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
68
103
|
/** Quick structural check - throws on invalid project. */
|
|
69
104
|
export function doubleCheckProject(project) {
|
|
70
105
|
const result = validateProject(project);
|
|
@@ -2,6 +2,7 @@ import { mapValues } from 'lodash-es';
|
|
|
2
2
|
import { doubleCheckProject } from './serializationUtils.js';
|
|
3
3
|
import { entries } from '../typeSafety.js';
|
|
4
4
|
import {} from '../../model/Project.js';
|
|
5
|
+
import { normalizeUiGraphComponentIds } from '../../model/UiGraph.js';
|
|
5
6
|
import { serializeConnection, deserializeConnection, parseVisualData, packVisualDataV4, wrapInYamlEnvelope, unwrapYamlEnvelope, } from './serializationHelpers.js';
|
|
6
7
|
export function projectV4Deserializer(data) {
|
|
7
8
|
const serializedProject = unwrapYamlEnvelope(data, 4, 'Project v4');
|
|
@@ -31,11 +32,12 @@ function toSerializedProject(project, attachedData) {
|
|
|
31
32
|
id: prefab.id,
|
|
32
33
|
sourceNode: toSerializedIsolatedNode(prefab.sourceNode),
|
|
33
34
|
}));
|
|
35
|
+
const uiGraphs = mapValues(project.uiGraphs ?? {}, normalizeUiGraphComponentIds);
|
|
34
36
|
return {
|
|
35
37
|
metadata: project.metadata,
|
|
36
38
|
graphs: mapValues(project.graphs, (graph) => toSerializedGraph(graph)),
|
|
37
39
|
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : undefined,
|
|
38
|
-
uiGraphs:
|
|
40
|
+
uiGraphs: Object.keys(uiGraphs).length > 0 ? uiGraphs : undefined,
|
|
39
41
|
attachedData,
|
|
40
42
|
plugins: project.plugins ?? [],
|
|
41
43
|
references: project.references ?? [],
|
|
@@ -46,14 +48,13 @@ function fromSerializedProject(serializedProject) {
|
|
|
46
48
|
id: prefab.id,
|
|
47
49
|
sourceNode: fromSerializedIsolatedNode(prefab.sourceNode),
|
|
48
50
|
}));
|
|
51
|
+
const uiGraphs = mapValues(serializedProject.uiGraphs ?? {}, normalizeUiGraphComponentIds);
|
|
49
52
|
return [
|
|
50
53
|
{
|
|
51
54
|
metadata: serializedProject.metadata,
|
|
52
55
|
graphs: mapValues(serializedProject.graphs, (graph) => fromSerializedGraph(graph)),
|
|
53
56
|
nodePrefabs: Object.keys(nodePrefabs).length > 0 ? nodePrefabs : undefined,
|
|
54
|
-
uiGraphs:
|
|
55
|
-
? serializedProject.uiGraphs
|
|
56
|
-
: undefined,
|
|
57
|
+
uiGraphs: Object.keys(uiGraphs).length > 0 ? uiGraphs : undefined,
|
|
57
58
|
plugins: serializedProject.plugins ?? [],
|
|
58
59
|
references: serializedProject.references ?? [],
|
|
59
60
|
},
|
|
@@ -42,7 +42,7 @@ export type RunGraphOptions = {
|
|
|
42
42
|
editorExecutionCache?: ProcessContext['editorExecutionCache'];
|
|
43
43
|
} & {
|
|
44
44
|
[P in keyof ProcessEvents as `on${PascalCase<P>}`]?: (params: ProcessEvents[P]) => void;
|
|
45
|
-
} & Settings
|
|
45
|
+
} & Settings & Record<string, unknown>;
|
|
46
46
|
export type CoreCreateProcessorInternalOptions = {
|
|
47
47
|
cacheLoadedProjects?: boolean;
|
|
48
48
|
executionPlanCacheMode?: GraphProcessorExecutionPlanCacheMode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Settings } from '../model/Settings.js';
|
|
2
|
-
|
|
3
|
-
export declare function resolveProcessSettings(settings?: Settings, fallbacks?: Partial<
|
|
4
|
-
export {};
|
|
1
|
+
import type { RuntimeSettings, Settings } from '../model/Settings.js';
|
|
2
|
+
export declare function resolveProcessSettings(settings?: Settings, fallbacks?: Partial<RuntimeSettings>): RuntimeSettings;
|
|
3
|
+
export declare function resolveProcessSettings<T extends Record<string, unknown>>(settings?: Settings & T, fallbacks?: Partial<RuntimeSettings>): RuntimeSettings & T;
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export * from './model/NodePrefabResolver.js';
|
|
|
7
7
|
export { getGraphBoundary } from './model/GraphBoundaryCache.js';
|
|
8
8
|
export type { GraphBoundary } from './model/GraphBoundaryCache.js';
|
|
9
9
|
export * from './model/UiGraph.js';
|
|
10
|
+
export * from './model/UiGraphRuntimeModel.js';
|
|
10
11
|
export * from './model/UiGraphRendererStyles.js';
|
|
12
|
+
export * from './model/MarkdownSanitizationPolicy.js';
|
|
11
13
|
export * from './model/NodeImpl.js';
|
|
12
14
|
export * from './model/NodeDefinition.js';
|
|
13
15
|
export * from './model/Nodes.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type GraphRunLifecyclePhase = 'idle' | 'running' | 'aborting' | 'finished';
|
|
2
|
+
export type GraphRunAbortDecision = {
|
|
3
|
+
successful: boolean;
|
|
4
|
+
error?: Error | string | undefined;
|
|
5
|
+
};
|
|
6
|
+
/** Owns run-level state only. Scheduling and event emission remain in GraphProcessor. */
|
|
7
|
+
export declare class GraphRunLifecycle {
|
|
8
|
+
#private;
|
|
9
|
+
get phase(): GraphRunLifecyclePhase;
|
|
10
|
+
get isRunning(): boolean;
|
|
11
|
+
get isPaused(): boolean;
|
|
12
|
+
get isAborted(): boolean;
|
|
13
|
+
get abortSuccessful(): boolean;
|
|
14
|
+
get abortError(): Error | string | undefined;
|
|
15
|
+
begin(): void;
|
|
16
|
+
complete(): void;
|
|
17
|
+
requestAbort(successful: boolean, error?: Error | string): GraphRunAbortDecision | undefined;
|
|
18
|
+
pause(): boolean;
|
|
19
|
+
resume(): boolean;
|
|
20
|
+
claimRootFinish(isSubProcessor: boolean): boolean;
|
|
21
|
+
getAbortError(): Error;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const RIVET_MARKDOWN_ALLOWED_TAGS: readonly ["a", "blockquote", "br", "code", "del", "em", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "li", "ol", "p", "pre", "strong", "sub", "sup", "table", "tbody", "td", "th", "thead", "tr", "ul"];
|
|
2
|
+
export declare const RIVET_MARKDOWN_ALLOWED_ATTRIBUTES: readonly ["class", "href", "title"];
|
|
3
|
+
export declare const RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE = "^(?:https?:|mailto:|#|\\?(?:[^/]|$)|/(?!/)|\\.{1,2}/|[a-z0-9._~-]+(?:[/?#]|$))";
|
|
4
|
+
export type RivetMarkdownSanitizerPolicy = {
|
|
5
|
+
allowedAttributes: readonly string[];
|
|
6
|
+
allowedTags: readonly string[];
|
|
7
|
+
allowedUriRegExpSource: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const RIVET_MARKDOWN_SANITIZER_POLICY: RivetMarkdownSanitizerPolicy;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Opaque } from 'type-fest';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RuntimeSettings, type NativeApi, type Project, type DataValue, type ExternalFunction, type Outputs, type GraphId, type GraphProcessor, type ScalarOrArrayDataValue, type DatasetProvider, type ChartNode, type NodeId, type PortId, type AttachedNodeData, type AudioProvider, type StringArrayDataValue, type ProjectId, type MCPProvider } from '../index.js';
|
|
3
3
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
4
4
|
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
5
5
|
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
6
6
|
import type { GraphBoundary } from './GraphBoundaryCache.js';
|
|
7
7
|
export type ProcessContext = {
|
|
8
|
-
settings:
|
|
8
|
+
settings: RuntimeSettings;
|
|
9
9
|
nativeApi?: NativeApi;
|
|
10
10
|
/** Sets the dataset provider to be used for all dataset node calls. */
|
|
11
11
|
datasetProvider?: DatasetProvider;
|
|
@@ -22,3 +22,4 @@ export interface Settings<PluginSettings = Record<string, Record<string, unknown
|
|
|
22
22
|
chatNodeHeaders?: Record<string, string>;
|
|
23
23
|
throttleChatNode?: number;
|
|
24
24
|
}
|
|
25
|
+
export type RuntimeSettings<PluginSettings = Record<string, Record<string, unknown>>> = Required<Settings<PluginSettings>> & Record<string, unknown>;
|
|
@@ -69,6 +69,13 @@ export type UiGraph = {
|
|
|
69
69
|
description?: string;
|
|
70
70
|
components: UiGraphComponent[];
|
|
71
71
|
};
|
|
72
|
+
export declare function hasValidUiGraphComponentIds(uiGraph: UiGraph): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Returns an immutable repair for legacy or externally assembled UI graphs.
|
|
75
|
+
* Repaired IDs are deterministic so separately rendered HTML and action calls agree
|
|
76
|
+
* without mutating a host-owned project snapshot.
|
|
77
|
+
*/
|
|
78
|
+
export declare function normalizeUiGraphComponentIds(uiGraph: UiGraph): UiGraph;
|
|
72
79
|
export declare function createDefaultUiGraph(options?: {
|
|
73
80
|
graphId?: GraphId;
|
|
74
81
|
name?: string;
|
|
@@ -78,6 +85,11 @@ export declare function getUiGraphActionComponent(uiGraph: UiGraph, componentId:
|
|
|
78
85
|
type: 'button';
|
|
79
86
|
}> | undefined;
|
|
80
87
|
export declare function resolveUiGraphActionInputs(action: UiGraphRunGraphAction, state: Record<string, unknown>): Record<string, unknown>;
|
|
88
|
+
/**
|
|
89
|
+
* Selects the UI state that a button action is explicitly allowed to send.
|
|
90
|
+
* Outputs and unrelated form fields stay local to the rendered web app.
|
|
91
|
+
*/
|
|
92
|
+
export declare function getUiGraphActionState(action: UiGraphRunGraphAction, state: Record<string, unknown>): Record<string, unknown>;
|
|
81
93
|
export declare function resolveUiGraphActionOutputStateValue(action: UiGraphRunGraphAction, outputs: UiGraphOutputs): unknown;
|
|
82
94
|
export declare function resolveUiGraphActionOutputStatePatch(action: UiGraphRunGraphAction, outputs: UiGraphOutputs): Record<string, unknown>;
|
|
83
95
|
export declare function getUiGraphActionOutputBindings(action: UiGraphRunGraphAction): UiGraphOutputBinding[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RIVET_WEB_APP_RENDERER_CSS = "\n.rivet-web-app-root {\n --rivet-web-app-background: var(--grey-dark-colorish, #1c222b);\n --rivet-web-app-foreground: var(--foreground, #ffffff);\n --rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);\n --rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));\n --rivet-web-app-control-background: var(--form-control-bg, #20252d);\n --rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));\n --rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);\n --rivet-web-app-button-background: var(--success, #3ba85b);\n --rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);\n --rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);\n --rivet-web-app-error-color: var(--error, #ff6b5f);\n --rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);\n box-sizing: border-box;\n height: 100%;\n background: var(--rivet-web-app-background);\n color: var(--rivet-web-app-foreground);\n overflow: auto;\n font-family: Inter, system-ui, sans-serif;\n font-size: var(--rivet-web-app-font-size);\n line-height: 1.4;\n}\n\n.rivet-web-app-root *,\n.rivet-web-app-root *::before,\n.rivet-web-app-root *::after {\n box-sizing: border-box;\n}\n\n.rivet-web-app-surface {\n display: grid;\n gap: 16px;\n margin: 0 auto;\n max-width: 760px;\n padding: 48px 20px;\n}\n\n.rivet-web-app-card,\n.rivet-web-app-field {\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 10px;\n background: var(--rivet-web-app-card-background);\n padding: 16px;\n}\n\n.rivet-web-app-component-frame {\n border-radius: 12px;\n margin: -5px;\n padding: 4px;\n}\n\n.rivet-web-app-component-frame.active {\n background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);\n}\n\n.rivet-web-app-field {\n display: grid;\n gap: 8px;\n color: var(--rivet-web-app-foreground);\n font-size: inherit;\n font-weight: 600;\n}\n\n.rivet-web-app-field input,\n.rivet-web-app-field textarea {\n appearance: none;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--rivet-web-app-control-border);\n border-radius: 8px;\n background: var(--rivet-web-app-control-background);\n color: var(--rivet-web-app-foreground);\n font: inherit;\n font-weight: 400;\n padding: 10px 12px;\n}\n\n.rivet-web-app-field textarea {\n min-height: 110px;\n resize: vertical;\n}\n\n.rivet-web-app-button {\n width: fit-content;\n border: 0;\n border-radius: var(--rivet-web-app-button-radius);\n background: var(--rivet-web-app-button-background);\n color: var(--rivet-web-app-button-foreground);\n cursor: pointer;\n font: inherit;\n font-weight: 700;\n padding: 10px 16px;\n}\n\n.rivet-web-app-button:disabled {\n cursor: wait;\n opacity: 0.72;\n}\n\n.rivet-web-app-output {\n display: grid;\n gap: 8px;\n}\n\n.rivet-web-app-output-title {\n color: var(--rivet-web-app-output-title);\n font-weight: 700;\n}\n\n.rivet-web-app-output pre {\n margin: 0;\n background: transparent;\n border-radius: 0;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n font-size: inherit;\n padding: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.rivet-web-app-markdown,\n.rivet-web-app-output-markdown {\n word-break: break-word;\n}\n\n.rivet-web-app-markdown.markdown-body {\n background: var(--rivet-web-app-card-background);\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-output-markdown.markdown-body {\n background: transparent;\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-markdown h1,\n.rivet-web-app-output-markdown h1 {\n margin: 0 0 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid var(--rivet-web-app-card-border);\n font-size: 24px;\n line-height: 1.22;\n}\n\n.rivet-web-app-markdown h2,\n.rivet-web-app-output-markdown h2 {\n margin: 0 0 10px;\n font-size: 20px;\n line-height: 1.25;\n}\n\n.rivet-web-app-markdown p,\n.rivet-web-app-output-markdown p,\n.rivet-web-app-markdown ul,\n.rivet-web-app-output-markdown ul {\n margin: 0 0 12px;\n}\n\n.rivet-web-app-markdown.markdown-body code,\n.rivet-web-app-output-markdown.markdown-body code {\n border-radius: 4px;\n background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 1px 4px;\n}\n\n.rivet-web-app-markdown.markdown-body pre,\n.rivet-web-app-output-markdown.markdown-body pre {\n background: transparent;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 0;\n white-space: pre-wrap;\n}\n\n.rivet-web-app-markdown > :first-child,\n.rivet-web-app-output-markdown > :first-child {\n margin-top: 0;\n}\n\n.rivet-web-app-markdown > :last-child,\n.rivet-web-app-output-markdown > :last-child {\n margin-bottom: 0;\n}\n\n.rivet-web-app-error {\n color: var(--rivet-web-app-error-color);\n font-weight: 700;\n}\n\n.rivet-web-app-modal-backdrop {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: grid;\n place-items: center;\n background: rgba(0, 0, 0, 0.46);\n background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);\n padding: 20px;\n}\n\n.rivet-web-app-modal {\n display: grid;\n gap: 18px;\n width: min(420px, 100%);\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 12px;\n background: var(--rivet-web-app-card-background);\n box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);\n color: var(--rivet-web-app-foreground);\n padding: 22px;\n}\n\n.rivet-web-app-modal-message {\n font-size: 18px;\n font-weight: 700;\n line-height: 1.3;\n}\n\n.rivet-web-app-modal-button {\n justify-self: start;\n}\n";
|
|
1
|
+
export declare const RIVET_WEB_APP_RENDERER_CSS = "\n.rivet-web-app-root {\n --rivet-web-app-background: var(--grey-dark-colorish, #1c222b);\n --rivet-web-app-foreground: var(--foreground, #ffffff);\n --rivet-web-app-card-background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 88%, var(--foreground, #ffffff) 4%);\n --rivet-web-app-card-border: var(--foldable-section-border, rgba(255, 255, 255, 0.04));\n --rivet-web-app-control-background: var(--form-control-bg, #20252d);\n --rivet-web-app-control-border: var(--form-control-border, rgba(255, 255, 255, 0.14));\n --rivet-web-app-button-radius: var(--rivet-web-app-host-button-radius, 6px);\n --rivet-web-app-button-background: var(--success, #3ba85b);\n --rivet-web-app-button-foreground: var(--grey-lightest, #ffffff);\n --rivet-web-app-output-title: var(--rivet-web-app-foreground, #ffffff);\n --rivet-web-app-error-color: var(--error, #ff6b5f);\n --rivet-web-app-font-size: var(--rivet-web-app-host-font-size, 15px);\n box-sizing: border-box;\n height: 100%;\n background: var(--rivet-web-app-background);\n color: var(--rivet-web-app-foreground);\n overflow: auto;\n font-family: Inter, system-ui, sans-serif;\n font-size: var(--rivet-web-app-font-size);\n line-height: 1.4;\n}\n\n.rivet-web-app-root *,\n.rivet-web-app-root *::before,\n.rivet-web-app-root *::after {\n box-sizing: border-box;\n}\n\n.rivet-web-app-surface {\n display: grid;\n gap: 16px;\n margin: 0 auto;\n max-width: 760px;\n padding: 48px 20px;\n}\n\n.rivet-web-app-card,\n.rivet-web-app-field {\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 10px;\n background: var(--rivet-web-app-card-background);\n padding: 16px;\n}\n\n.rivet-web-app-component-frame {\n border-radius: 12px;\n margin: -5px;\n padding: 4px;\n}\n\n.rivet-web-app-component-frame.active {\n background: color-mix(in srgb, var(--modal-surface-bg, #252b34) 75%, var(--primary, #ff9e2c) 16%);\n}\n\n.rivet-web-app-field {\n display: grid;\n gap: 8px;\n color: var(--rivet-web-app-foreground);\n font-size: inherit;\n font-weight: 600;\n}\n\n.rivet-web-app-field input,\n.rivet-web-app-field textarea {\n appearance: none;\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--rivet-web-app-control-border);\n border-radius: 8px;\n background: var(--rivet-web-app-control-background);\n color: var(--rivet-web-app-foreground);\n font: inherit;\n font-weight: 400;\n padding: 10px 12px;\n}\n\n.rivet-web-app-field textarea {\n min-height: 110px;\n resize: vertical;\n}\n\n.rivet-web-app-button {\n width: fit-content;\n border: 0;\n border-radius: var(--rivet-web-app-button-radius);\n background: var(--rivet-web-app-button-background);\n color: var(--rivet-web-app-button-foreground);\n cursor: pointer;\n font: inherit;\n font-weight: 700;\n padding: 10px 16px;\n}\n\n.rivet-web-app-button:disabled {\n cursor: wait;\n opacity: 0.72;\n}\n\n.rivet-web-app-output {\n display: grid;\n gap: 8px;\n position: relative;\n}\n\n.rivet-web-app-output-title {\n color: var(--rivet-web-app-output-title);\n font-weight: 700;\n padding-right: 32px;\n}\n\n.rivet-web-app-output-has-download .rivet-web-app-output-title {\n padding-right: 64px;\n}\n\n.rivet-web-app-output-action-button {\n position: absolute;\n top: 11px;\n width: 24px;\n height: 24px;\n border: 0;\n border-radius: 5px;\n background: transparent;\n color: color-mix(in srgb, var(--rivet-web-app-foreground) 68%, transparent);\n cursor: pointer;\n padding: 0;\n}\n\n.rivet-web-app-output-copy-button {\n right: 11px;\n}\n\n.rivet-web-app-output-download-button {\n right: 39px;\n}\n\n.rivet-web-app-output-copy-button::before,\n.rivet-web-app-output-copy-button::after {\n content: \"\";\n position: absolute;\n width: 10px;\n height: 12px;\n border: 1.5px solid currentColor;\n border-radius: 2px;\n}\n\n.rivet-web-app-output-copy-button::before {\n top: 5px;\n left: 8px;\n}\n\n.rivet-web-app-output-copy-button::after {\n top: 8px;\n left: 5px;\n background: var(--rivet-web-app-card-background);\n}\n\n.rivet-web-app-output-download-button::before,\n.rivet-web-app-output-download-button::after {\n content: \"\";\n position: absolute;\n}\n\n.rivet-web-app-output-download-button::before {\n top: 5px;\n left: 8px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid currentColor;\n border-bottom: 1.5px solid currentColor;\n transform: rotate(45deg);\n}\n\n.rivet-web-app-output-download-button::after {\n top: 16px;\n left: 6px;\n width: 12px;\n height: 4px;\n border-right: 1.5px solid currentColor;\n border-bottom: 1.5px solid currentColor;\n border-left: 1.5px solid currentColor;\n border-radius: 0 0 2px 2px;\n}\n\n.rivet-web-app-output-action-button:hover,\n.rivet-web-app-output-action-button:focus-visible {\n color: var(--primary, #ff9e2c);\n outline: none;\n background: color-mix(in srgb, var(--rivet-web-app-foreground) 8%, transparent);\n}\n\n.rivet-web-app-output pre {\n margin: 0;\n background: transparent;\n border-radius: 0;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n font-size: inherit;\n padding: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.rivet-web-app-markdown,\n.rivet-web-app-output-markdown {\n word-break: break-word;\n}\n\n.rivet-web-app-markdown.markdown-body {\n background: var(--rivet-web-app-card-background);\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-output-markdown.markdown-body {\n background: transparent;\n font-family: inherit;\n min-width: 0;\n}\n\n.rivet-web-app-markdown h1,\n.rivet-web-app-output-markdown h1 {\n margin: 0 0 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid var(--rivet-web-app-card-border);\n font-size: 24px;\n line-height: 1.22;\n}\n\n.rivet-web-app-markdown h2,\n.rivet-web-app-output-markdown h2 {\n margin: 0 0 10px;\n font-size: 20px;\n line-height: 1.25;\n}\n\n.rivet-web-app-markdown p,\n.rivet-web-app-output-markdown p,\n.rivet-web-app-markdown ul,\n.rivet-web-app-output-markdown ul {\n margin: 0 0 12px;\n}\n\n.rivet-web-app-markdown.markdown-body code,\n.rivet-web-app-output-markdown.markdown-body code {\n border-radius: 4px;\n background: color-mix(in srgb, var(--rivet-web-app-control-background) 70%, var(--rivet-web-app-foreground) 6%);\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 1px 4px;\n}\n\n.rivet-web-app-markdown.markdown-body pre,\n.rivet-web-app-output-markdown.markdown-body pre {\n background: transparent;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n padding: 0;\n white-space: pre-wrap;\n}\n\n.rivet-web-app-markdown > :first-child,\n.rivet-web-app-output-markdown > :first-child {\n margin-top: 0;\n}\n\n.rivet-web-app-markdown > :last-child,\n.rivet-web-app-output-markdown > :last-child {\n margin-bottom: 0;\n}\n\n.rivet-web-app-error {\n color: var(--rivet-web-app-error-color);\n font-weight: 700;\n}\n\n.rivet-web-app-modal-backdrop {\n position: fixed;\n inset: 0;\n z-index: 1000;\n display: grid;\n place-items: center;\n background: rgba(0, 0, 0, 0.46);\n background: color-mix(in srgb, var(--rivet-web-app-background) 78%, transparent);\n padding: 20px;\n}\n\n.rivet-web-app-modal {\n display: grid;\n gap: 18px;\n width: min(420px, 100%);\n border: 1px solid var(--rivet-web-app-card-border);\n border-radius: 12px;\n background: var(--rivet-web-app-card-background);\n box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);\n color: var(--rivet-web-app-foreground);\n padding: 22px;\n}\n\n.rivet-web-app-modal-message {\n font-size: 18px;\n font-weight: 700;\n line-height: 1.3;\n}\n\n.rivet-web-app-modal-button {\n justify-self: start;\n}\n";
|
|
2
2
|
export declare const RIVET_WEB_APP_DOCUMENT_CSS = "\nhtml,\nbody {\n height: 100%;\n margin: 0;\n}\n\nbody {\n min-height: 100vh;\n background: #1c222b;\n}\n\n#app {\n min-height: 100vh;\n}\n";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { UiGraphComponent } from './UiGraph.js';
|
|
2
|
+
export type UiGraphOutputRenderMode = 'text' | 'json' | 'markdown';
|
|
3
|
+
export type UiGraphOutputRenderModel = {
|
|
4
|
+
hasValue: boolean;
|
|
5
|
+
jsonDownloadValue?: string;
|
|
6
|
+
renderedValue: string;
|
|
7
|
+
renderAs: UiGraphOutputRenderMode;
|
|
8
|
+
};
|
|
9
|
+
export type UiGraphComponentRenderModel = {
|
|
10
|
+
component: Extract<UiGraphComponent, {
|
|
11
|
+
type: 'text';
|
|
12
|
+
}>;
|
|
13
|
+
text: string;
|
|
14
|
+
type: 'text';
|
|
15
|
+
} | {
|
|
16
|
+
component: Extract<UiGraphComponent, {
|
|
17
|
+
type: 'markdown';
|
|
18
|
+
}>;
|
|
19
|
+
markdown: string;
|
|
20
|
+
type: 'markdown';
|
|
21
|
+
} | {
|
|
22
|
+
component: Extract<UiGraphComponent, {
|
|
23
|
+
type: 'input' | 'textarea';
|
|
24
|
+
}>;
|
|
25
|
+
label: string;
|
|
26
|
+
type: 'input' | 'textarea';
|
|
27
|
+
value: string;
|
|
28
|
+
} | {
|
|
29
|
+
component: Extract<UiGraphComponent, {
|
|
30
|
+
type: 'button';
|
|
31
|
+
}>;
|
|
32
|
+
label: string;
|
|
33
|
+
type: 'button';
|
|
34
|
+
} | {
|
|
35
|
+
component: Extract<UiGraphComponent, {
|
|
36
|
+
type: 'output';
|
|
37
|
+
}>;
|
|
38
|
+
label: string;
|
|
39
|
+
output: UiGraphOutputRenderModel;
|
|
40
|
+
type: 'output';
|
|
41
|
+
};
|
|
42
|
+
export declare function getUiGraphComponentRenderModel(component: UiGraphComponent, state: Record<string, unknown>): UiGraphComponentRenderModel;
|
|
43
|
+
export declare function getUiGraphComponentLabel(component: Extract<UiGraphComponent, {
|
|
44
|
+
type: 'input' | 'textarea' | 'output';
|
|
45
|
+
}>): string;
|
|
46
|
+
export declare function getUiGraphOutputRenderModel(state: Record<string, unknown>, stateKey: string, renderAs: UiGraphOutputRenderMode): UiGraphOutputRenderModel;
|
|
47
|
+
export declare function hasUiGraphStateValue(state: Record<string, unknown>, key: string): boolean;
|
|
48
|
+
export declare function renderUiGraphOutputValue(value: unknown, renderAs: UiGraphOutputRenderMode): string;
|
|
49
|
+
export declare function stringifyUiGraphValue(value: unknown): string | undefined;
|
|
50
|
+
export declare function getUiGraphJsonOutputFilename(appName: string, date?: Date): string;
|
|
51
|
+
export declare function formatUiGraphDownloadDateTime(date: Date): string;
|
|
52
|
+
export declare function applyUiGraphStatePatch(state: Record<string, unknown>, statePatch: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
2
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
3
|
+
import { type CreateChatV2ModelOptions, type ResolvedChatV2ProviderConfig } from './providerOptions.js';
|
|
4
|
+
import type { ChatV2Model, ChatV2Provider } from './chatV2Types.js';
|
|
5
|
+
export type ChatV2CredentialReference = {
|
|
6
|
+
source: 'input' | 'settings' | 'plugin' | 'programmatic' | 'environment' | 'none';
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export type ChatV2CredentialResult = {
|
|
10
|
+
value?: string | undefined;
|
|
11
|
+
reference: ChatV2CredentialReference;
|
|
12
|
+
};
|
|
13
|
+
export type ChatV2ProviderProfile = {
|
|
14
|
+
provider: ChatV2Provider;
|
|
15
|
+
modelId: string;
|
|
16
|
+
baseURL?: string | undefined;
|
|
17
|
+
hasCustomHeaders: boolean;
|
|
18
|
+
credential: ChatV2CredentialReference;
|
|
19
|
+
capabilities: {
|
|
20
|
+
builtInTools: boolean;
|
|
21
|
+
structuredOutput: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type ProviderContext = Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
|
|
25
|
+
export declare function resolveChatV2Credential(options: {
|
|
26
|
+
provider: ChatV2Provider;
|
|
27
|
+
context: ProviderContext;
|
|
28
|
+
apiKeySource?: 'configured' | 'input' | undefined;
|
|
29
|
+
inputs?: Inputs | undefined;
|
|
30
|
+
customProgrammaticName?: string | undefined;
|
|
31
|
+
customEnvironmentName?: string | undefined;
|
|
32
|
+
}): ChatV2CredentialResult;
|
|
33
|
+
export declare function createResolvedChatV2Provider(options: {
|
|
34
|
+
provider: ChatV2Provider;
|
|
35
|
+
modelId: string;
|
|
36
|
+
context: ProviderContext;
|
|
37
|
+
baseURL?: string | undefined;
|
|
38
|
+
headers?: Record<string, string> | undefined;
|
|
39
|
+
credential: ChatV2CredentialResult;
|
|
40
|
+
onRequestBody?: CreateChatV2ModelOptions['onRequestBody'];
|
|
41
|
+
}): Promise<{
|
|
42
|
+
profile: ChatV2ProviderProfile;
|
|
43
|
+
model: ChatV2Model;
|
|
44
|
+
config: ResolvedChatV2ProviderConfig;
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ChatV2MessageList, ChatV2Provider, ChatV2ToolSet, RunChatV2PipelineOptions, StreamChatV2Options } from './chatV2Types.js';
|
|
2
|
+
export type ChatV2TransportMode = 'stream' | 'generate';
|
|
3
|
+
export type ChatV2RequestPlan = {
|
|
4
|
+
provider: ChatV2Provider;
|
|
5
|
+
modelId: string;
|
|
6
|
+
transportMode: ChatV2TransportMode;
|
|
7
|
+
retry: {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
repeatTimes: number;
|
|
10
|
+
cooldownMs: number;
|
|
11
|
+
};
|
|
12
|
+
request: Omit<StreamChatV2Options, 'abortSignal' | 'executeStream' | 'executeGenerate' | 'onPartialOutput'>;
|
|
13
|
+
output: Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'functionCallMode'>;
|
|
14
|
+
};
|
|
15
|
+
type BuildChatV2RequestPlanOptions = Pick<RunChatV2PipelineOptions, 'provider' | 'model' | 'modelId' | 'maxTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'responseOutput' | 'responseFormat' | 'providerOptions' | 'toolChoice' | 'retryOnNon200' | 'retryOnNon200RepeatTimes' | 'retryOnNon200CooldownMs' | 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'emitPartialOutputs' | 'functionCallMode'> & {
|
|
16
|
+
messages: ChatV2MessageList;
|
|
17
|
+
tools?: ChatV2ToolSet | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ChatV2RequestPlanSummary = {
|
|
20
|
+
provider: ChatV2Provider;
|
|
21
|
+
modelId: string;
|
|
22
|
+
transportMode: ChatV2TransportMode;
|
|
23
|
+
sdkMaxRetries: 0;
|
|
24
|
+
retry: ChatV2RequestPlan['retry'];
|
|
25
|
+
messageCount: number;
|
|
26
|
+
toolNames: string[];
|
|
27
|
+
responseFormat: RunChatV2PipelineOptions['responseFormat'];
|
|
28
|
+
generation: {
|
|
29
|
+
maxTokens?: number | undefined;
|
|
30
|
+
temperature?: number | undefined;
|
|
31
|
+
topP?: number | undefined;
|
|
32
|
+
topK?: number | undefined;
|
|
33
|
+
presencePenalty?: number | undefined;
|
|
34
|
+
frequencyPenalty?: number | undefined;
|
|
35
|
+
stopSequences?: string[] | undefined;
|
|
36
|
+
seed?: number | undefined;
|
|
37
|
+
};
|
|
38
|
+
output: ChatV2RequestPlan['output'];
|
|
39
|
+
};
|
|
40
|
+
export declare function buildChatV2RequestPlan(options: BuildChatV2RequestPlanOptions): ChatV2RequestPlan;
|
|
41
|
+
export declare function summarizeChatV2RequestPlan(plan: ChatV2RequestPlan): ChatV2RequestPlanSummary;
|
|
42
|
+
export {};
|
|
@@ -56,6 +56,7 @@ export type ChatV2GenerateExecutor = (args: GenerateTextArgs) => ChatV2GenerateH
|
|
|
56
56
|
export type StreamChatV2Options = {
|
|
57
57
|
model: ChatV2Model;
|
|
58
58
|
messages: ChatV2MessageList;
|
|
59
|
+
maxRetries?: 0 | undefined;
|
|
59
60
|
tools?: ChatV2ToolSet | undefined;
|
|
60
61
|
maxTokens?: number | undefined;
|
|
61
62
|
temperature?: number | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './aiSdkBridge.js';
|
|
2
2
|
export * from './chatV2FeatureCompatibility.js';
|
|
3
3
|
export * from './chatV2Pipeline.js';
|
|
4
|
+
export * from './chatV2ProviderProfile.js';
|
|
5
|
+
export * from './chatV2RequestPlan.js';
|
|
4
6
|
export * from './chatV2ResponseFormat.js';
|
|
5
7
|
export * from './chatV2Shared.js';
|
|
6
8
|
export * from './chatV2Types.js';
|
|
@@ -7,6 +7,7 @@ export type LLMChatV2ApiKeySource = 'environment' | 'input';
|
|
|
7
7
|
export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
|
|
8
8
|
provider: ChatV2Provider;
|
|
9
9
|
apiKeySource?: LLMChatV2ApiKeySource;
|
|
10
|
+
customProviderApiKeyProgrammaticName?: string;
|
|
10
11
|
customProviderApiKeyEnvVarName?: string;
|
|
11
12
|
customProviderBaseURL: string;
|
|
12
13
|
useCustomProviderBaseURLInput: boolean;
|