@valerypopoff/rivet2-core 2.15.0 → 2.19.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 +7906 -3980
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +62 -7
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/interpolationSyntax.cjs +9 -5
- package/dist/cjs/interpolationSyntax.cjs.map +2 -2
- package/dist/cjs/serialization.cjs +1880 -0
- package/dist/cjs/serialization.cjs.map +7 -0
- package/dist/cjs/webAppRuntime.cjs +168 -6
- package/dist/cjs/webAppRuntime.cjs.map +3 -3
- package/dist/esm/api/createProcessor.js +5 -2
- package/dist/esm/api/processSettings.js +1 -0
- package/dist/esm/exports.js +4 -0
- package/dist/esm/model/AgentResponseTrace.js +99 -34
- package/dist/esm/model/AgentResponseTracePresentation.js +130 -0
- package/dist/esm/model/DataValue.js +11 -2
- package/dist/esm/model/GlobalVariables.js +2 -1
- package/dist/esm/model/GraphBoundaryCache.js +2 -1
- package/dist/esm/model/GraphBoundaryEffects.js +38 -1
- package/dist/esm/model/GraphExecutionState.js +81 -0
- package/dist/esm/model/GraphProcessor.js +825 -884
- package/dist/esm/model/GraphSchedulerBoundaryState.js +64 -0
- package/dist/esm/model/Nodes.js +15 -0
- package/dist/esm/model/ProjectBundle.js +248 -0
- package/dist/esm/model/ProjectBundleRuntime.js +54 -0
- package/dist/esm/model/SchedulerBoundaryPlanner.js +233 -0
- package/dist/esm/model/SplitRunProcessor.js +28 -7
- package/dist/esm/model/StreamingWatchTopology.js +118 -8
- package/dist/esm/model/SubgraphProjectTarget.js +7 -0
- package/dist/esm/model/SubprocessorBridge.js +125 -87
- package/dist/esm/model/ToolCallContinuationCoordinator.js +1 -1
- package/dist/esm/model/chat-v2/aiSdkBridge.js +22 -17
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +2 -4
- package/dist/esm/model/chat-v2/chatV2CredentialNames.js +5 -1
- package/dist/esm/model/chat-v2/chatV2Outputs.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +24 -9
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +3 -2
- package/dist/esm/model/chat-v2/chatV2ProviderRegistry.js +46 -6
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +26 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
- package/dist/esm/model/chat-v2/chatV2UsageAccounting.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2Body.js +13 -10
- package/dist/esm/model/chat-v2/llmChatV2CacheBoundary.js +5 -2
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +3 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +33 -9
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +10 -2
- package/dist/esm/model/chat-v2/llmInvocationResultProjector.js +17 -0
- package/dist/esm/model/chat-v2/llmModelCandidate.js +2 -1
- package/dist/esm/model/chat-v2/llmProfile.js +5 -1
- package/dist/esm/model/chat-v2/llmProfileBody.js +11 -2
- package/dist/esm/model/chat-v2/llmProfileFallback.js +7 -4
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +2 -1
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +16 -3
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
- package/dist/esm/model/chat-v2/messageConverter.js +18 -16
- package/dist/esm/model/chat-v2/modelRegistry.js +14 -4
- package/dist/esm/model/chat-v2/openRouterModel.js +73 -0
- package/dist/esm/model/chat-v2/parallelToolCalls.js +2 -0
- package/dist/esm/model/chat-v2/providerOptions.js +30 -25
- package/dist/esm/model/chat-v2/temperature.js +9 -0
- package/dist/esm/model/classifier/credentials.js +42 -6
- package/dist/esm/model/classifier/images.js +176 -0
- package/dist/esm/model/classifier/json.js +57 -0
- package/dist/esm/model/classifier/limits.js +300 -0
- package/dist/esm/model/classifier/openai.js +118 -0
- package/dist/esm/model/classifier/perplexity.js +63 -0
- package/dist/esm/model/classifier/preparation.js +74 -0
- package/dist/esm/model/classifier/profile.js +151 -0
- package/dist/esm/model/classifier/profileExecution.js +294 -0
- package/dist/esm/model/classifier/providers.js +454 -192
- package/dist/esm/model/classifier/questionHelpers.js +29 -45
- package/dist/esm/model/classifier/questions.js +53 -0
- package/dist/esm/model/classifier/response.js +75 -0
- package/dist/esm/model/classifier/state.js +207 -0
- package/dist/esm/model/classifier/types.js +11 -1
- package/dist/esm/model/nodeRunFailure.js +54 -0
- package/dist/esm/model/nodes/CallGraphNode.js +6 -0
- package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +385 -154
- package/dist/esm/model/nodes/ClassifierProfileNode.js +133 -0
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +1 -1
- package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
- package/dist/esm/model/nodes/HttpCallNode.js +44 -75
- package/dist/esm/model/nodes/ImageNode.js +44 -3
- package/dist/esm/model/nodes/LLMChatV2Node.js +26 -4
- package/dist/esm/model/nodes/ObjectNode.js +29 -18
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
- package/dist/esm/model/nodes/StreamValueNode.js +38 -0
- package/dist/esm/model/nodes/SubGraphNode.js +199 -35
- package/dist/esm/model/nodes/ToBase64Node.js +106 -0
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
- package/dist/esm/model/nodes/toolCallDelegation.js +5 -1
- package/dist/esm/model/profileSuspensionHints.js +8 -0
- package/dist/esm/recording/ExecutionRecorder.js +26 -0
- package/dist/esm/serialization.js +2 -0
- package/dist/esm/utils/base64.js +18 -15
- package/dist/esm/utils/coerceType.js +11 -1
- package/dist/esm/utils/errors.js +41 -0
- package/dist/esm/utils/interpolation.js +44 -22
- package/dist/esm/utils/interpolationSyntax.js +15 -6
- package/dist/esm/utils/serialization/serialization.js +3 -2
- package/dist/esm/utils/serialization/serializationUtils.js +6 -0
- package/dist/esm/utils/serialization/serialization_v4.js +15 -3
- package/dist/esm/webAppRuntime.js +1 -0
- package/dist/types/api/createProcessor.d.ts +7 -1
- package/dist/types/exports.d.ts +4 -0
- package/dist/types/model/AgentResponseTrace.d.ts +15 -4
- package/dist/types/model/AgentResponseTracePresentation.d.ts +15 -0
- package/dist/types/model/CycleDetector.d.ts +1 -2
- package/dist/types/model/DataValue.d.ts +12 -8
- package/dist/types/model/ExecutorProtocol.d.ts +9 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +10 -1
- package/dist/types/model/GraphExecutionState.d.ts +68 -0
- package/dist/types/model/GraphProcessor.d.ts +2 -0
- package/dist/types/model/GraphSchedulerBoundaryState.d.ts +96 -0
- package/dist/types/model/Nodes.d.ts +11 -4
- package/dist/types/model/ProcessContext.d.ts +24 -3
- package/dist/types/model/ProjectBundle.d.ts +59 -0
- package/dist/types/model/ProjectBundleRuntime.d.ts +24 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
- package/dist/types/model/RivetUIContext.d.ts +1 -1
- package/dist/types/model/SchedulerBoundaryPlanner.d.ts +42 -0
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
- package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2CredentialNames.d.ts +4 -0
- package/dist/types/model/chat-v2/chatV2Outputs.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2ProviderRegistry.d.ts +79 -1
- package/dist/types/model/chat-v2/chatV2ProviderTypes.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
- package/dist/types/model/chat-v2/chatV2UsageAccounting.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +4 -1
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +2 -0
- package/dist/types/model/chat-v2/llmInvocationResultProjector.d.ts +2 -0
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +51 -3
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +10 -7
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +6 -2
- package/dist/types/model/chat-v2/modelRegistry.d.ts +5 -4
- package/dist/types/model/chat-v2/openRouterModel.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -13
- package/dist/types/model/chat-v2/temperature.d.ts +2 -0
- package/dist/types/model/classifier/credentials.d.ts +7 -1
- package/dist/types/model/classifier/images.d.ts +18 -0
- package/dist/types/model/classifier/json.d.ts +19 -0
- package/dist/types/model/classifier/limits.d.ts +45 -0
- package/dist/types/model/classifier/openai.d.ts +5 -0
- package/dist/types/model/classifier/perplexity.d.ts +7 -0
- package/dist/types/model/classifier/preparation.d.ts +16 -0
- package/dist/types/model/classifier/profile.d.ts +46 -0
- package/dist/types/model/classifier/profileExecution.d.ts +32 -0
- package/dist/types/model/classifier/providers.d.ts +98 -9
- package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
- package/dist/types/model/classifier/questions.d.ts +4 -0
- package/dist/types/model/classifier/response.d.ts +4 -0
- package/dist/types/model/classifier/state.d.ts +37 -0
- package/dist/types/model/classifier/types.d.ts +11 -0
- package/dist/types/model/nodeRunFailure.d.ts +13 -0
- package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +17 -12
- package/dist/types/model/nodes/ClassifierProfileNode.d.ts +20 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
- package/dist/types/model/nodes/ImageNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
- package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
- package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +3 -1
- package/dist/types/model/profileSuspensionHints.d.ts +8 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
- package/dist/types/serialization.d.ts +2 -0
- package/dist/types/utils/base64.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +4 -0
- package/dist/types/utils/interpolation.d.ts +13 -2
- package/dist/types/utils/interpolationSyntax.d.ts +1 -1
- package/dist/types/utils/serialization/serialization.d.ts +3 -1
- package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
- package/dist/types/webAppRuntime.d.ts +1 -0
- package/package.json +7 -1
|
@@ -41,6 +41,7 @@ __export(webAppRuntime_exports, {
|
|
|
41
41
|
applyUiGraphWebAppStorageActionPatch: () => applyUiGraphWebAppStorageActionPatch,
|
|
42
42
|
applyUiGraphWebAppStorageActionPatchAsync: () => applyUiGraphWebAppStorageActionPatchAsync,
|
|
43
43
|
applyUiGraphWebAppStoragePatch: () => applyUiGraphWebAppStoragePatch,
|
|
44
|
+
buildAgentProfileAttemptInspectorRows: () => buildAgentProfileAttemptInspectorRows,
|
|
44
45
|
clearUiGraphChatSearchMatches: () => clearUiGraphChatSearchMatches,
|
|
45
46
|
copyUiGraphText: () => copyUiGraphText,
|
|
46
47
|
createUiGraphActionExecutionController: () => createUiGraphActionExecutionController,
|
|
@@ -55,6 +56,9 @@ __export(webAppRuntime_exports, {
|
|
|
55
56
|
downloadUiGraphJsonOutput: () => downloadUiGraphJsonOutput,
|
|
56
57
|
encodeRivetWebAppStorageBinaryFrame: () => encodeRivetWebAppStorageBinaryFrame,
|
|
57
58
|
enhanceUiGraphChatJsonCodeBlocks: () => enhanceUiGraphChatJsonCodeBlocks,
|
|
59
|
+
formatClassifierRequestCount: () => formatClassifierRequestCount,
|
|
60
|
+
getClassifierRequestCount: () => getClassifierRequestCount,
|
|
61
|
+
getProfileAttemptOmissionNotice: () => getProfileAttemptOmissionNotice,
|
|
58
62
|
getUiGraphActionState: () => getUiGraphActionState,
|
|
59
63
|
getUiGraphChatDraftStateKey: () => getUiGraphChatDraftStateKey,
|
|
60
64
|
getUiGraphChatMessagePresentations: () => getUiGraphChatMessagePresentations,
|
|
@@ -70,6 +74,7 @@ __export(webAppRuntime_exports, {
|
|
|
70
74
|
hasUiGraphChatPersistentStateChanged: () => hasUiGraphChatPersistentStateChanged,
|
|
71
75
|
highlightUiGraphChatSearchMatches: () => highlightUiGraphChatSearchMatches,
|
|
72
76
|
isAgentResponseTrace: () => isAgentResponseTrace,
|
|
77
|
+
isClassifierRequest: () => isClassifierRequest,
|
|
73
78
|
loadUiGraphChatPersistentState: () => loadUiGraphChatPersistentState,
|
|
74
79
|
loadUiGraphResponseTrace: () => loadUiGraphResponseTrace,
|
|
75
80
|
loadUiGraphWebAppStorage: () => loadUiGraphWebAppStorage,
|
|
@@ -89,6 +94,18 @@ __export(webAppRuntime_exports, {
|
|
|
89
94
|
});
|
|
90
95
|
module.exports = __toCommonJS(webAppRuntime_exports);
|
|
91
96
|
|
|
97
|
+
// src/model/classifier/types.ts
|
|
98
|
+
var classifierFailureKinds = [
|
|
99
|
+
"configuration",
|
|
100
|
+
"capability",
|
|
101
|
+
"authentication",
|
|
102
|
+
"transport",
|
|
103
|
+
"http",
|
|
104
|
+
"timeout",
|
|
105
|
+
"response-parsing",
|
|
106
|
+
"response-validation"
|
|
107
|
+
];
|
|
108
|
+
|
|
92
109
|
// src/model/AgentResponseTrace.ts
|
|
93
110
|
var AGENT_RESPONSE_TRACE_SCHEMA_VERSION = 1;
|
|
94
111
|
var AGENT_RESPONSE_TRACE_MAX_MODEL_CALLS = 250;
|
|
@@ -122,7 +139,8 @@ function isAgentResponseTrace(value) {
|
|
|
122
139
|
return false;
|
|
123
140
|
if (typeof value.traceId !== "string" || typeof value.rootRunId !== "string") return false;
|
|
124
141
|
if (typeof value.graphRunId !== "string" || typeof value.graphId !== "string") return false;
|
|
125
|
-
if (value.scope !== "response" && value.scope !== "llm-invocation"
|
|
142
|
+
if (value.scope !== "response" && value.scope !== "llm-invocation" && value.scope !== "classifier-invocation")
|
|
143
|
+
return false;
|
|
126
144
|
if (!isRecord(value.summary) || !Array.isArray(value.modelCalls) || !Array.isArray(value.toolCalls)) return false;
|
|
127
145
|
if (value.profileAttempts !== void 0 && !Array.isArray(value.profileAttempts)) return false;
|
|
128
146
|
if (value.modelCalls.length > AGENT_RESPONSE_TRACE_MAX_MODEL_CALLS) return false;
|
|
@@ -174,10 +192,16 @@ function isAgentLLMProfileAttemptTrace(value) {
|
|
|
174
192
|
"healthDisposition",
|
|
175
193
|
"healthOutcome",
|
|
176
194
|
"retryAt",
|
|
177
|
-
"timeoutKind"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
195
|
+
"timeoutKind",
|
|
196
|
+
"family",
|
|
197
|
+
"failureKind",
|
|
198
|
+
"skipReason",
|
|
199
|
+
"classifierUsage",
|
|
200
|
+
"durationMs"
|
|
201
|
+
]) && typeof value.eventId === "string" && isNonNegativeInteger(value.roundIndex) && isOptionalNonNegativeInteger(value.profileIndex) && isOptionalString(value.profileName) && isOptionalNonNegativeFiniteNumber(value.durationMs) && (value.family === void 0 || value.family === "llm" || value.family === "classifier") && (value.skipReason === void 0 || value.skipReason === "unreached" && value.outcome === "skipped") && (value.classifierUsage === void 0 || value.family === "classifier" && isClassifierAttemptUsage(value.classifierUsage)) && (value.failureKind === void 0 || classifierFailureKinds.includes(value.failureKind)) && typeof value.nodeId === "string" && typeof value.processId === "string" && typeof value.provider === "string" && typeof value.model === "string" && (value.customProviderApi === void 0 || value.customProviderApi === "completions" || value.customProviderApi === "responses") && ["configuration", "request", "response-validation", "health-gate", "health-update"].includes(String(value.stage)) && ["success", "failure", "aborted", "skipped"].includes(String(value.outcome)) && isOptionalNonNegativeInteger(value.attemptIndex) && isOptionalNonNegativeFiniteNumber(value.status) && isOptionalString(value.error) && isOptionalString(value.profileHealthKey) && (value.healthState === void 0 || value.healthState === "closed" || value.healthState === "open" || value.healthState === "half-open") && (value.healthDisposition === void 0 || value.healthDisposition === "allow" || value.healthDisposition === "deny" || value.healthDisposition === "fail-open") && (value.healthOutcome === void 0 || value.healthOutcome === "healthy" || value.healthOutcome === "unhealthy" || value.healthOutcome === "ignored") && isOptionalNonNegativeFiniteNumber(value.retryAt) && (value.timeoutKind === void 0 || value.timeoutKind === "first-output" || value.timeoutKind === "stream-inactivity" || value.timeoutKind === "response");
|
|
202
|
+
}
|
|
203
|
+
function isClassifierAttemptUsage(value) {
|
|
204
|
+
return isRecord(value) && hasOnlyKeys(value, ["inputTokens", "outputTokens", "estimatedCostUsd"]) && Number.isSafeInteger(value.inputTokens) && value.inputTokens >= 0 && Number.isSafeInteger(value.outputTokens) && value.outputTokens >= 0 && isOptionalNonNegativeFiniteNumber(value.estimatedCostUsd);
|
|
181
205
|
}
|
|
182
206
|
function isAgentToolCallTrace(value) {
|
|
183
207
|
const hasKnownOutcome = isRecord(value) && (value.outcome === "success" || value.outcome === "passthrough-error" || value.outcome === "failure" || value.outcome === "aborted");
|
|
@@ -204,6 +228,7 @@ function isAgentToolResultOwner(value) {
|
|
|
204
228
|
function isAgentTraceSummary(value) {
|
|
205
229
|
return hasOnlyKeys(value, [
|
|
206
230
|
"modelCallCount",
|
|
231
|
+
"classifierRequestCount",
|
|
207
232
|
"toolCallCount",
|
|
208
233
|
"retryCount",
|
|
209
234
|
"fallbackCount",
|
|
@@ -214,7 +239,7 @@ function isAgentTraceSummary(value) {
|
|
|
214
239
|
"reasoningTokens",
|
|
215
240
|
"knownCostUsd",
|
|
216
241
|
"costStatus"
|
|
217
|
-
]) && isNonNegativeInteger(value.modelCallCount) && isNonNegativeInteger(value.toolCallCount) && isNonNegativeInteger(value.retryCount) && isNonNegativeInteger(value.fallbackCount) && isOptionalNonNegativeFiniteNumber(value.promptTokens) && isOptionalNonNegativeFiniteNumber(value.completionTokens) && isOptionalNonNegativeFiniteNumber(value.totalTokens) && isOptionalNonNegativeFiniteNumber(value.cachedTokens) && isOptionalNonNegativeFiniteNumber(value.reasoningTokens) && isNonNegativeFiniteNumber(value.knownCostUsd) && (value.costStatus === "known" || value.costStatus === "partial" || value.costStatus === "unknown");
|
|
242
|
+
]) && isNonNegativeInteger(value.modelCallCount) && isOptionalNonNegativeInteger(value.classifierRequestCount) && isNonNegativeInteger(value.toolCallCount) && isNonNegativeInteger(value.retryCount) && isNonNegativeInteger(value.fallbackCount) && isOptionalNonNegativeFiniteNumber(value.promptTokens) && isOptionalNonNegativeFiniteNumber(value.completionTokens) && isOptionalNonNegativeFiniteNumber(value.totalTokens) && isOptionalNonNegativeFiniteNumber(value.cachedTokens) && isOptionalNonNegativeFiniteNumber(value.reasoningTokens) && isNonNegativeFiniteNumber(value.knownCostUsd) && (value.costStatus === "known" || value.costStatus === "partial" || value.costStatus === "unknown");
|
|
218
243
|
}
|
|
219
244
|
function isAgentTraceUsage(value) {
|
|
220
245
|
return isRecord(value) && hasOnlyKeys(value, ["promptTokens", "completionTokens", "totalTokens", "cachedTokens", "reasoningTokens"]) && Object.values(value).every(isNonNegativeFiniteNumber);
|
|
@@ -251,6 +276,138 @@ function isRecord(value) {
|
|
|
251
276
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
252
277
|
}
|
|
253
278
|
|
|
279
|
+
// src/model/chat-v2/customProviderApi.ts
|
|
280
|
+
var customProviderApiContracts = {
|
|
281
|
+
completions: {
|
|
282
|
+
api: "completions",
|
|
283
|
+
adapter: "openai-compatible",
|
|
284
|
+
endpointPath: "/chat/completions",
|
|
285
|
+
label: "Custom Completions",
|
|
286
|
+
structuredOutput: "raw-response-format",
|
|
287
|
+
parallelToolCalls: "enabled-only-raw-field"
|
|
288
|
+
},
|
|
289
|
+
responses: {
|
|
290
|
+
api: "responses",
|
|
291
|
+
adapter: "openai-responses",
|
|
292
|
+
endpointPath: "/responses",
|
|
293
|
+
label: "Custom Responses",
|
|
294
|
+
structuredOutput: "sdk-output",
|
|
295
|
+
parallelToolCalls: "openai-option"
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
function parseCustomProviderApi(value) {
|
|
299
|
+
switch (value) {
|
|
300
|
+
case void 0:
|
|
301
|
+
case "completions":
|
|
302
|
+
return "completions";
|
|
303
|
+
case "responses":
|
|
304
|
+
return "responses";
|
|
305
|
+
default:
|
|
306
|
+
throw new Error(`Unsupported Custom provider API: ${String(value)}.`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function getCustomProviderApiContract(value) {
|
|
310
|
+
return customProviderApiContracts[parseCustomProviderApi(value)];
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// src/model/AgentResponseTracePresentation.ts
|
|
314
|
+
function buildAgentProfileAttemptInspectorRows(attempts) {
|
|
315
|
+
return attempts.map((attempt) => {
|
|
316
|
+
var _a;
|
|
317
|
+
return {
|
|
318
|
+
eventId: attempt.eventId,
|
|
319
|
+
providerAndModel: [
|
|
320
|
+
...attempt.profileName == null || attempt.profileName.trim() === "" ? [] : [`Profile: ${attempt.profileName.trim()}`],
|
|
321
|
+
`${formatProvider(attempt)} / ${attempt.model}`
|
|
322
|
+
].join(" \xB7 "),
|
|
323
|
+
context: [
|
|
324
|
+
((_a = attempt.failureKind) == null ? void 0 : _a.replaceAll("-", " ")) ?? describeStage(attempt.stage),
|
|
325
|
+
describeOutcome(attempt),
|
|
326
|
+
attempt.profileIndex == null ? void 0 : `profile ${attempt.profileIndex + 1}`,
|
|
327
|
+
attempt.family === "classifier" ? void 0 : `round ${attempt.roundIndex + 1}`,
|
|
328
|
+
attempt.attemptIndex == null ? void 0 : `attempt ${attempt.attemptIndex + 1}`,
|
|
329
|
+
attempt.status == null ? void 0 : `HTTP ${attempt.status}`,
|
|
330
|
+
attempt.durationMs == null ? isClassifierRequest(attempt) ? "duration unavailable" : void 0 : `${(attempt.durationMs / 1e3).toFixed(2)} sec`,
|
|
331
|
+
attempt.classifierUsage == null ? isClassifierRequest(attempt) ? "usage not reported" : void 0 : `${attempt.classifierUsage.inputTokens} input / ${attempt.classifierUsage.outputTokens} output tokens`,
|
|
332
|
+
attempt.classifierUsage == null ? isClassifierRequest(attempt) ? "cost unknown" : void 0 : attempt.classifierUsage.estimatedCostUsd == null ? "cost unknown" : `estimated $${attempt.classifierUsage.estimatedCostUsd.toPrecision(4)}`
|
|
333
|
+
].filter((value) => value != null).join(" / "),
|
|
334
|
+
...attempt.error == null ? {} : { error: attempt.error }
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function isClassifierRequest(attempt) {
|
|
339
|
+
return attempt.family === "classifier" && attempt.attemptIndex != null;
|
|
340
|
+
}
|
|
341
|
+
function getClassifierRequestCount(trace) {
|
|
342
|
+
var _a;
|
|
343
|
+
if (trace.summary.classifierRequestCount != null) return trace.summary.classifierRequestCount;
|
|
344
|
+
const attempts = (_a = trace.profileAttempts) == null ? void 0 : _a.filter((attempt) => attempt.family === "classifier");
|
|
345
|
+
if (trace.scope !== "classifier-invocation" && !(attempts == null ? void 0 : attempts.length)) return void 0;
|
|
346
|
+
return (attempts == null ? void 0 : attempts.filter(isClassifierRequest).length) ?? 0;
|
|
347
|
+
}
|
|
348
|
+
function formatClassifierRequestCount(trace) {
|
|
349
|
+
const count = getClassifierRequestCount(trace);
|
|
350
|
+
if (count == null) return void 0;
|
|
351
|
+
return trace.summary.classifierRequestCount == null && (trace.omittedProfileAttemptCount ?? 0) > 0 ? `${count} (retained evidence only)` : String(count);
|
|
352
|
+
}
|
|
353
|
+
function getProfileAttemptOmissionNotice(trace) {
|
|
354
|
+
const omitted = trace.omittedProfileAttemptCount ?? 0;
|
|
355
|
+
return omitted > 0 ? `${omitted} additional profile-attempt rows (requests or decisions) omitted by the trace limit.` : void 0;
|
|
356
|
+
}
|
|
357
|
+
function formatProvider(attempt) {
|
|
358
|
+
return attempt.provider === "custom" ? getCustomProviderApiContract(attempt.customProviderApi).label : attempt.provider;
|
|
359
|
+
}
|
|
360
|
+
function describeStage(stage) {
|
|
361
|
+
switch (stage) {
|
|
362
|
+
case "health-gate":
|
|
363
|
+
return "reliability check";
|
|
364
|
+
case "health-update":
|
|
365
|
+
return "reliability update";
|
|
366
|
+
case "response-validation":
|
|
367
|
+
return "response validation";
|
|
368
|
+
default:
|
|
369
|
+
return stage;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function describeOutcome(attempt) {
|
|
373
|
+
if (attempt.skipReason === "unreached") return "not reached";
|
|
374
|
+
if (attempt.healthDisposition === "deny") {
|
|
375
|
+
return attempt.retryAt == null ? "profile suspended; skipped" : `profile suspended until ${new Date(attempt.retryAt).toLocaleString()}`;
|
|
376
|
+
}
|
|
377
|
+
if (attempt.healthDisposition === "fail-open") {
|
|
378
|
+
return "reliability service unavailable; profile request continued";
|
|
379
|
+
}
|
|
380
|
+
if (attempt.timeoutKind === "first-output") return "first output timed out";
|
|
381
|
+
if (attempt.timeoutKind === "stream-inactivity") return "stream became inactive";
|
|
382
|
+
if (attempt.timeoutKind === "response") return "response timed out";
|
|
383
|
+
if (attempt.stage === "health-update" && attempt.healthOutcome) {
|
|
384
|
+
return `recorded ${describeReliabilityOutcome(attempt.healthOutcome)}${describeReliabilityState(attempt.healthState)}`;
|
|
385
|
+
}
|
|
386
|
+
return `${attempt.outcome}${describeReliabilityState(attempt.healthState)}`;
|
|
387
|
+
}
|
|
388
|
+
function describeReliabilityOutcome(outcome) {
|
|
389
|
+
switch (outcome) {
|
|
390
|
+
case "healthy":
|
|
391
|
+
return "success";
|
|
392
|
+
case "unhealthy":
|
|
393
|
+
return "failure";
|
|
394
|
+
default:
|
|
395
|
+
return "ignored result";
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function describeReliabilityState(state) {
|
|
399
|
+
switch (state) {
|
|
400
|
+
case "open":
|
|
401
|
+
return "; profile suspended";
|
|
402
|
+
case "half-open":
|
|
403
|
+
return "; recovery attempt in progress";
|
|
404
|
+
case "closed":
|
|
405
|
+
return "; profile available";
|
|
406
|
+
default:
|
|
407
|
+
return "";
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
254
411
|
// src/model/StoredValueStore.ts
|
|
255
412
|
function normalizeRivetStoredValueKey(value) {
|
|
256
413
|
if (typeof value !== "string" || !value.trim()) {
|
|
@@ -3017,6 +3174,7 @@ function isStringArray(value) {
|
|
|
3017
3174
|
applyUiGraphWebAppStorageActionPatch,
|
|
3018
3175
|
applyUiGraphWebAppStorageActionPatchAsync,
|
|
3019
3176
|
applyUiGraphWebAppStoragePatch,
|
|
3177
|
+
buildAgentProfileAttemptInspectorRows,
|
|
3020
3178
|
clearUiGraphChatSearchMatches,
|
|
3021
3179
|
copyUiGraphText,
|
|
3022
3180
|
createUiGraphActionExecutionController,
|
|
@@ -3031,6 +3189,9 @@ function isStringArray(value) {
|
|
|
3031
3189
|
downloadUiGraphJsonOutput,
|
|
3032
3190
|
encodeRivetWebAppStorageBinaryFrame,
|
|
3033
3191
|
enhanceUiGraphChatJsonCodeBlocks,
|
|
3192
|
+
formatClassifierRequestCount,
|
|
3193
|
+
getClassifierRequestCount,
|
|
3194
|
+
getProfileAttemptOmissionNotice,
|
|
3034
3195
|
getUiGraphActionState,
|
|
3035
3196
|
getUiGraphChatDraftStateKey,
|
|
3036
3197
|
getUiGraphChatMessagePresentations,
|
|
@@ -3046,6 +3207,7 @@ function isStringArray(value) {
|
|
|
3046
3207
|
hasUiGraphChatPersistentStateChanged,
|
|
3047
3208
|
highlightUiGraphChatSearchMatches,
|
|
3048
3209
|
isAgentResponseTrace,
|
|
3210
|
+
isClassifierRequest,
|
|
3049
3211
|
loadUiGraphChatPersistentState,
|
|
3050
3212
|
loadUiGraphResponseTrace,
|
|
3051
3213
|
loadUiGraphWebAppStorage,
|