@linnlabs/linnkit 0.37.1 → 0.37.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/CHANGELOG.md +22 -0
- package/dist/cli.cjs +238 -242
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +238 -242
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +198 -200
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +198 -200
- package/dist/context-manager.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +30 -30
- package/dist/contracts/agentSpec.d.ts +30 -30
- package/dist/contracts/audit.d.cts +32 -32
- package/dist/contracts/audit.d.ts +32 -32
- package/dist/contracts/contextPolicy.d.cts +36 -36
- package/dist/contracts/contextPolicy.d.ts +36 -36
- package/dist/contracts/events.d.cts +1113 -1113
- package/dist/contracts/events.d.ts +1113 -1113
- package/dist/contracts/execution.d.cts +8 -8
- package/dist/contracts/execution.d.ts +8 -8
- package/dist/contracts/messages.d.cts +1178 -1178
- package/dist/contracts/messages.d.ts +1178 -1178
- package/dist/contracts/provider-continuation.d.cts +28 -28
- package/dist/contracts/provider-continuation.d.ts +28 -28
- package/dist/contracts/sse.d.cts +897 -897
- package/dist/contracts/sse.d.ts +897 -897
- package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
- package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
- package/dist/contracts/token-accounting.d.cts +38 -38
- package/dist/contracts/token-accounting.d.ts +38 -38
- package/dist/index.cjs +238 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +238 -242
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +238 -242
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +238 -242
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
- package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
- package/dist/runtime-kernel/events.cjs +1 -3
- package/dist/runtime-kernel/events.cjs.map +1 -1
- package/dist/runtime-kernel/events.js +1 -3
- package/dist/runtime-kernel/events.js.map +1 -1
- package/dist/runtime-kernel/graph-engine/executorContextBuilder.d.cts +1 -0
- package/dist/runtime-kernel/graph-engine/executorContextBuilder.d.ts +1 -0
- package/dist/runtime-kernel.cjs +238 -242
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +238 -242
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +238 -242
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +238 -242
- package/dist/testkit.js.map +1 -1
- package/docs/integration/llm-provider.md +1 -0
- package/docs/integration/persistence.md +10 -0
- package/docs/integration/realtime.md +5 -0
- package/package.json +2 -2
package/dist/context-manager.cjs
CHANGED
|
@@ -6681,6 +6681,199 @@ function createDefaultSystemReminderRegistry() {
|
|
|
6681
6681
|
});
|
|
6682
6682
|
}
|
|
6683
6683
|
createDefaultSystemReminderRegistry();
|
|
6684
|
+
|
|
6685
|
+
// src/runtime-kernel/events/eventGovernance.ts
|
|
6686
|
+
var RUNTIME_EVENT_TYPES_NEVER_REPLAYED_TO_UI = [
|
|
6687
|
+
"audit_envelope",
|
|
6688
|
+
"final_answer_chunk",
|
|
6689
|
+
"final_answer_reset",
|
|
6690
|
+
"subrun_trace",
|
|
6691
|
+
"context_usage_snapshot"
|
|
6692
|
+
];
|
|
6693
|
+
function isRecord2(value) {
|
|
6694
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
6695
|
+
}
|
|
6696
|
+
function isToolCallDecisionEvent(event) {
|
|
6697
|
+
return event.type === "tool_call_decision";
|
|
6698
|
+
}
|
|
6699
|
+
function isToolProcessEvent(event) {
|
|
6700
|
+
return event.type === "tool_process";
|
|
6701
|
+
}
|
|
6702
|
+
function isSubRunTraceRuntimeEvent(event) {
|
|
6703
|
+
return event.type === "subrun_trace";
|
|
6704
|
+
}
|
|
6705
|
+
function isRunExecutionMetricsRuntimeEvent(event) {
|
|
6706
|
+
return event.type === "run_execution_metrics";
|
|
6707
|
+
}
|
|
6708
|
+
function isContextUsageSnapshotRuntimeEvent(event) {
|
|
6709
|
+
return event.type === "context_usage_snapshot";
|
|
6710
|
+
}
|
|
6711
|
+
function isRequiresUserInteractionRuntimeEvent(event) {
|
|
6712
|
+
return event.type === "requires_user_interaction";
|
|
6713
|
+
}
|
|
6714
|
+
function isAuditEnvelopeRuntimeEvent(event) {
|
|
6715
|
+
return event.type === "audit_envelope";
|
|
6716
|
+
}
|
|
6717
|
+
function isControlRuntimeEvent(event) {
|
|
6718
|
+
return event.type === "control";
|
|
6719
|
+
}
|
|
6720
|
+
function isHiddenUserInputEvent(event) {
|
|
6721
|
+
if (event.type !== "user_input") {
|
|
6722
|
+
return false;
|
|
6723
|
+
}
|
|
6724
|
+
const metadata = isRecord2(event.metadata) ? event.metadata : void 0;
|
|
6725
|
+
const ui = metadata && isRecord2(metadata.ui) ? metadata.ui : void 0;
|
|
6726
|
+
return ui?.presentation === "hidden";
|
|
6727
|
+
}
|
|
6728
|
+
function isEmptyTerminalAssistantRuntimeEvent(event) {
|
|
6729
|
+
if (event.type !== "thought" && event.type !== "final_answer") {
|
|
6730
|
+
return false;
|
|
6731
|
+
}
|
|
6732
|
+
return event.content.trim().length === 0;
|
|
6733
|
+
}
|
|
6734
|
+
function isConversationUiRuntimeEvent(event) {
|
|
6735
|
+
return event.lane === "foreground" && event.visibility === "conversation";
|
|
6736
|
+
}
|
|
6737
|
+
function shouldPersistRuntimeEvent(event) {
|
|
6738
|
+
return describeRuntimeEventLifecycle(event).persist;
|
|
6739
|
+
}
|
|
6740
|
+
function requirePersistableRuntimeEvent(event) {
|
|
6741
|
+
if (!shouldPersistRuntimeEvent(event)) {
|
|
6742
|
+
throw new Error(`RuntimeEvent ${event.id} (${event.type}) is not eligible for persistence.`);
|
|
6743
|
+
}
|
|
6744
|
+
return event;
|
|
6745
|
+
}
|
|
6746
|
+
function requirePersistableRoutedRuntimeEvent(event) {
|
|
6747
|
+
requirePersistableRuntimeEvent(event);
|
|
6748
|
+
return parseRoutedRuntimeEvent(event);
|
|
6749
|
+
}
|
|
6750
|
+
function shouldReplayRuntimeEventToUi(event) {
|
|
6751
|
+
return describeRuntimeEventLifecycle(event).replayToUi;
|
|
6752
|
+
}
|
|
6753
|
+
function shouldEnterAgentContext(event) {
|
|
6754
|
+
return describeRuntimeEventLifecycle(event).enterAgentContext;
|
|
6755
|
+
}
|
|
6756
|
+
function getRuntimeEventUiProjectionKind(event) {
|
|
6757
|
+
if (isHiddenUserInputEvent(event)) {
|
|
6758
|
+
return "hidden";
|
|
6759
|
+
}
|
|
6760
|
+
switch (event.type) {
|
|
6761
|
+
case "user_input":
|
|
6762
|
+
return "user_input";
|
|
6763
|
+
case "thought":
|
|
6764
|
+
return "thought";
|
|
6765
|
+
case "final_answer":
|
|
6766
|
+
return "final_answer";
|
|
6767
|
+
case "final_answer_chunk":
|
|
6768
|
+
return "final_answer_chunk";
|
|
6769
|
+
case "final_answer_reset":
|
|
6770
|
+
return "final_answer_reset";
|
|
6771
|
+
case "tool_call_decision":
|
|
6772
|
+
return "tool_call_decision";
|
|
6773
|
+
case "tool_process":
|
|
6774
|
+
return "tool_process";
|
|
6775
|
+
case "tool_output":
|
|
6776
|
+
return "tool_output";
|
|
6777
|
+
case "requires_user_interaction":
|
|
6778
|
+
return "requires_user_interaction";
|
|
6779
|
+
case "audit_envelope":
|
|
6780
|
+
return "audit_envelope";
|
|
6781
|
+
case "subrun_trace":
|
|
6782
|
+
return "subrun_trace";
|
|
6783
|
+
case "error":
|
|
6784
|
+
return "error";
|
|
6785
|
+
case "context_usage_snapshot":
|
|
6786
|
+
return "context_usage_snapshot";
|
|
6787
|
+
case "run_execution_metrics":
|
|
6788
|
+
return "run_execution_metrics";
|
|
6789
|
+
case "history_summary":
|
|
6790
|
+
return "history_summary";
|
|
6791
|
+
default:
|
|
6792
|
+
return "unsupported";
|
|
6793
|
+
}
|
|
6794
|
+
}
|
|
6795
|
+
function describeRuntimeEventLifecycle(event) {
|
|
6796
|
+
const uiProjectionKind = getRuntimeEventUiProjectionKind(event);
|
|
6797
|
+
const persist = event.ephemeral !== true && !isToolProcessEvent(event) && !isSubRunTraceRuntimeEvent(event);
|
|
6798
|
+
const replayToUi = persist && isConversationUiRuntimeEvent(event) && uiProjectionKind !== "hidden" && uiProjectionKind !== "audit_envelope" && uiProjectionKind !== "final_answer_chunk" && uiProjectionKind !== "final_answer_reset" && uiProjectionKind !== "unsupported";
|
|
6799
|
+
const enterAgentContext = (() => {
|
|
6800
|
+
if (uiProjectionKind === "unsupported") {
|
|
6801
|
+
return false;
|
|
6802
|
+
}
|
|
6803
|
+
if (isSubRunTraceRuntimeEvent(event)) {
|
|
6804
|
+
return false;
|
|
6805
|
+
}
|
|
6806
|
+
if (isRunExecutionMetricsRuntimeEvent(event)) {
|
|
6807
|
+
return false;
|
|
6808
|
+
}
|
|
6809
|
+
if (isContextUsageSnapshotRuntimeEvent(event)) {
|
|
6810
|
+
return false;
|
|
6811
|
+
}
|
|
6812
|
+
if (event.type === "error") {
|
|
6813
|
+
return false;
|
|
6814
|
+
}
|
|
6815
|
+
if (isRequiresUserInteractionRuntimeEvent(event)) {
|
|
6816
|
+
return false;
|
|
6817
|
+
}
|
|
6818
|
+
if (isAuditEnvelopeRuntimeEvent(event)) {
|
|
6819
|
+
return false;
|
|
6820
|
+
}
|
|
6821
|
+
if (isControlRuntimeEvent(event)) {
|
|
6822
|
+
return false;
|
|
6823
|
+
}
|
|
6824
|
+
if (isHiddenUserInputEvent(event)) {
|
|
6825
|
+
return false;
|
|
6826
|
+
}
|
|
6827
|
+
if (isToolProcessEvent(event)) {
|
|
6828
|
+
return false;
|
|
6829
|
+
}
|
|
6830
|
+
if (event.type === "thought") {
|
|
6831
|
+
return false;
|
|
6832
|
+
}
|
|
6833
|
+
if (event.type === "final_answer_chunk") {
|
|
6834
|
+
return false;
|
|
6835
|
+
}
|
|
6836
|
+
if (event.type === "final_answer_reset") {
|
|
6837
|
+
return false;
|
|
6838
|
+
}
|
|
6839
|
+
if (isEmptyTerminalAssistantRuntimeEvent(event)) {
|
|
6840
|
+
return false;
|
|
6841
|
+
}
|
|
6842
|
+
return true;
|
|
6843
|
+
})();
|
|
6844
|
+
const realtimeChannel = (() => {
|
|
6845
|
+
switch (uiProjectionKind) {
|
|
6846
|
+
case "thought":
|
|
6847
|
+
case "final_answer":
|
|
6848
|
+
case "final_answer_chunk":
|
|
6849
|
+
case "final_answer_reset":
|
|
6850
|
+
case "tool_call_decision":
|
|
6851
|
+
case "tool_process":
|
|
6852
|
+
case "tool_output":
|
|
6853
|
+
case "requires_user_interaction":
|
|
6854
|
+
case "subrun_trace":
|
|
6855
|
+
case "error":
|
|
6856
|
+
case "context_usage_snapshot":
|
|
6857
|
+
case "run_execution_metrics":
|
|
6858
|
+
case "history_summary":
|
|
6859
|
+
return "event_bus_sse";
|
|
6860
|
+
case "audit_envelope":
|
|
6861
|
+
return "none";
|
|
6862
|
+
default:
|
|
6863
|
+
return "none";
|
|
6864
|
+
}
|
|
6865
|
+
})();
|
|
6866
|
+
return {
|
|
6867
|
+
uiProjectionKind,
|
|
6868
|
+
persist,
|
|
6869
|
+
replayToUi,
|
|
6870
|
+
enterAgentContext,
|
|
6871
|
+
realtimeChannel
|
|
6872
|
+
};
|
|
6873
|
+
}
|
|
6874
|
+
function shouldEmitRuntimeEventToSse(event) {
|
|
6875
|
+
return describeRuntimeEventLifecycle(event).realtimeChannel === "event_bus_sse";
|
|
6876
|
+
}
|
|
6684
6877
|
var UnknownRecord = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
6685
6878
|
var NonBlankIdentifier = zod.z.string().min(1).refine(
|
|
6686
6879
|
(value) => value === value.trim(),
|
|
@@ -6800,11 +6993,11 @@ var AgentEventSchema = zod.z.discriminatedUnion("type", [
|
|
|
6800
6993
|
});
|
|
6801
6994
|
|
|
6802
6995
|
// src/runtime-kernel/events/provider-sidecar.ts
|
|
6803
|
-
var
|
|
6996
|
+
var isRecord3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
6804
6997
|
function readMetaFromEvent(event) {
|
|
6805
|
-
if (!
|
|
6998
|
+
if (!isRecord3(event)) return void 0;
|
|
6806
6999
|
const value = event["meta"];
|
|
6807
|
-
return
|
|
7000
|
+
return isRecord3(value) ? value : void 0;
|
|
6808
7001
|
}
|
|
6809
7002
|
|
|
6810
7003
|
// src/runtime-kernel/events/agent-to-runtime.ts
|
|
@@ -6812,7 +7005,7 @@ function agentEventToRuntime(agentEvent, context, options = {}) {
|
|
|
6812
7005
|
return mapAgentEventToRuntime(agentEvent, context, options);
|
|
6813
7006
|
}
|
|
6814
7007
|
function mapAgentEventToRuntime(agentEvent, context, options) {
|
|
6815
|
-
if (
|
|
7008
|
+
if (isRecord3(agentEvent) && agentEvent["type"] === "history_summary") {
|
|
6816
7009
|
const event = RuntimeEvent.parse(agentEvent);
|
|
6817
7010
|
return context.metadata ? {
|
|
6818
7011
|
...event,
|
|
@@ -6953,9 +7146,7 @@ function mapToolProgressToRuntime(toolEvent, context, options, id, timestamp) {
|
|
|
6953
7146
|
return event;
|
|
6954
7147
|
}
|
|
6955
7148
|
function mapStreamChunkToRuntime(streamEvent, context, id, timestamp) {
|
|
6956
|
-
const
|
|
6957
|
-
if (!text) return null;
|
|
6958
|
-
const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, text, {
|
|
7149
|
+
const chunkEvent = createFinalAnswerChunkEvent(id, context.conversationId, context.turnId, streamEvent.answer_id, streamEvent.seq, streamEvent.content, {
|
|
6959
7150
|
timestamp,
|
|
6960
7151
|
is_last: streamEvent.is_last === true
|
|
6961
7152
|
});
|
|
@@ -7273,199 +7464,6 @@ __export(events_exports, {
|
|
|
7273
7464
|
shouldReplayRuntimeEventToUi: () => shouldReplayRuntimeEventToUi
|
|
7274
7465
|
});
|
|
7275
7466
|
|
|
7276
|
-
// src/runtime-kernel/events/eventGovernance.ts
|
|
7277
|
-
var RUNTIME_EVENT_TYPES_NEVER_REPLAYED_TO_UI = [
|
|
7278
|
-
"audit_envelope",
|
|
7279
|
-
"final_answer_chunk",
|
|
7280
|
-
"final_answer_reset",
|
|
7281
|
-
"subrun_trace",
|
|
7282
|
-
"context_usage_snapshot"
|
|
7283
|
-
];
|
|
7284
|
-
function isRecord4(value) {
|
|
7285
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
7286
|
-
}
|
|
7287
|
-
function isToolCallDecisionEvent(event) {
|
|
7288
|
-
return event.type === "tool_call_decision";
|
|
7289
|
-
}
|
|
7290
|
-
function isToolProcessEvent(event) {
|
|
7291
|
-
return event.type === "tool_process";
|
|
7292
|
-
}
|
|
7293
|
-
function isSubRunTraceRuntimeEvent(event) {
|
|
7294
|
-
return event.type === "subrun_trace";
|
|
7295
|
-
}
|
|
7296
|
-
function isRunExecutionMetricsRuntimeEvent(event) {
|
|
7297
|
-
return event.type === "run_execution_metrics";
|
|
7298
|
-
}
|
|
7299
|
-
function isContextUsageSnapshotRuntimeEvent(event) {
|
|
7300
|
-
return event.type === "context_usage_snapshot";
|
|
7301
|
-
}
|
|
7302
|
-
function isRequiresUserInteractionRuntimeEvent(event) {
|
|
7303
|
-
return event.type === "requires_user_interaction";
|
|
7304
|
-
}
|
|
7305
|
-
function isAuditEnvelopeRuntimeEvent(event) {
|
|
7306
|
-
return event.type === "audit_envelope";
|
|
7307
|
-
}
|
|
7308
|
-
function isControlRuntimeEvent(event) {
|
|
7309
|
-
return event.type === "control";
|
|
7310
|
-
}
|
|
7311
|
-
function isHiddenUserInputEvent(event) {
|
|
7312
|
-
if (event.type !== "user_input") {
|
|
7313
|
-
return false;
|
|
7314
|
-
}
|
|
7315
|
-
const metadata = isRecord4(event.metadata) ? event.metadata : void 0;
|
|
7316
|
-
const ui = metadata && isRecord4(metadata.ui) ? metadata.ui : void 0;
|
|
7317
|
-
return ui?.presentation === "hidden";
|
|
7318
|
-
}
|
|
7319
|
-
function isEmptyTerminalAssistantRuntimeEvent(event) {
|
|
7320
|
-
if (event.type !== "thought" && event.type !== "final_answer") {
|
|
7321
|
-
return false;
|
|
7322
|
-
}
|
|
7323
|
-
return event.content.trim().length === 0;
|
|
7324
|
-
}
|
|
7325
|
-
function isConversationUiRuntimeEvent(event) {
|
|
7326
|
-
return event.lane === "foreground" && event.visibility === "conversation";
|
|
7327
|
-
}
|
|
7328
|
-
function shouldPersistRuntimeEvent(event) {
|
|
7329
|
-
return describeRuntimeEventLifecycle(event).persist;
|
|
7330
|
-
}
|
|
7331
|
-
function requirePersistableRuntimeEvent(event) {
|
|
7332
|
-
if (!shouldPersistRuntimeEvent(event)) {
|
|
7333
|
-
throw new Error(`RuntimeEvent ${event.id} (${event.type}) is not eligible for persistence.`);
|
|
7334
|
-
}
|
|
7335
|
-
return event;
|
|
7336
|
-
}
|
|
7337
|
-
function requirePersistableRoutedRuntimeEvent(event) {
|
|
7338
|
-
requirePersistableRuntimeEvent(event);
|
|
7339
|
-
return parseRoutedRuntimeEvent(event);
|
|
7340
|
-
}
|
|
7341
|
-
function shouldReplayRuntimeEventToUi(event) {
|
|
7342
|
-
return describeRuntimeEventLifecycle(event).replayToUi;
|
|
7343
|
-
}
|
|
7344
|
-
function shouldEnterAgentContext(event) {
|
|
7345
|
-
return describeRuntimeEventLifecycle(event).enterAgentContext;
|
|
7346
|
-
}
|
|
7347
|
-
function getRuntimeEventUiProjectionKind(event) {
|
|
7348
|
-
if (isHiddenUserInputEvent(event)) {
|
|
7349
|
-
return "hidden";
|
|
7350
|
-
}
|
|
7351
|
-
switch (event.type) {
|
|
7352
|
-
case "user_input":
|
|
7353
|
-
return "user_input";
|
|
7354
|
-
case "thought":
|
|
7355
|
-
return "thought";
|
|
7356
|
-
case "final_answer":
|
|
7357
|
-
return "final_answer";
|
|
7358
|
-
case "final_answer_chunk":
|
|
7359
|
-
return "final_answer_chunk";
|
|
7360
|
-
case "final_answer_reset":
|
|
7361
|
-
return "final_answer_reset";
|
|
7362
|
-
case "tool_call_decision":
|
|
7363
|
-
return "tool_call_decision";
|
|
7364
|
-
case "tool_process":
|
|
7365
|
-
return "tool_process";
|
|
7366
|
-
case "tool_output":
|
|
7367
|
-
return "tool_output";
|
|
7368
|
-
case "requires_user_interaction":
|
|
7369
|
-
return "requires_user_interaction";
|
|
7370
|
-
case "audit_envelope":
|
|
7371
|
-
return "audit_envelope";
|
|
7372
|
-
case "subrun_trace":
|
|
7373
|
-
return "subrun_trace";
|
|
7374
|
-
case "error":
|
|
7375
|
-
return "error";
|
|
7376
|
-
case "context_usage_snapshot":
|
|
7377
|
-
return "context_usage_snapshot";
|
|
7378
|
-
case "run_execution_metrics":
|
|
7379
|
-
return "run_execution_metrics";
|
|
7380
|
-
case "history_summary":
|
|
7381
|
-
return "history_summary";
|
|
7382
|
-
default:
|
|
7383
|
-
return "unsupported";
|
|
7384
|
-
}
|
|
7385
|
-
}
|
|
7386
|
-
function describeRuntimeEventLifecycle(event) {
|
|
7387
|
-
const uiProjectionKind = getRuntimeEventUiProjectionKind(event);
|
|
7388
|
-
const persist = event.ephemeral !== true && !isToolProcessEvent(event) && !isSubRunTraceRuntimeEvent(event);
|
|
7389
|
-
const replayToUi = persist && isConversationUiRuntimeEvent(event) && uiProjectionKind !== "hidden" && uiProjectionKind !== "audit_envelope" && uiProjectionKind !== "final_answer_chunk" && uiProjectionKind !== "final_answer_reset" && uiProjectionKind !== "unsupported";
|
|
7390
|
-
const enterAgentContext = (() => {
|
|
7391
|
-
if (uiProjectionKind === "unsupported") {
|
|
7392
|
-
return false;
|
|
7393
|
-
}
|
|
7394
|
-
if (isSubRunTraceRuntimeEvent(event)) {
|
|
7395
|
-
return false;
|
|
7396
|
-
}
|
|
7397
|
-
if (isRunExecutionMetricsRuntimeEvent(event)) {
|
|
7398
|
-
return false;
|
|
7399
|
-
}
|
|
7400
|
-
if (isContextUsageSnapshotRuntimeEvent(event)) {
|
|
7401
|
-
return false;
|
|
7402
|
-
}
|
|
7403
|
-
if (event.type === "error") {
|
|
7404
|
-
return false;
|
|
7405
|
-
}
|
|
7406
|
-
if (isRequiresUserInteractionRuntimeEvent(event)) {
|
|
7407
|
-
return false;
|
|
7408
|
-
}
|
|
7409
|
-
if (isAuditEnvelopeRuntimeEvent(event)) {
|
|
7410
|
-
return false;
|
|
7411
|
-
}
|
|
7412
|
-
if (isControlRuntimeEvent(event)) {
|
|
7413
|
-
return false;
|
|
7414
|
-
}
|
|
7415
|
-
if (isHiddenUserInputEvent(event)) {
|
|
7416
|
-
return false;
|
|
7417
|
-
}
|
|
7418
|
-
if (isToolProcessEvent(event)) {
|
|
7419
|
-
return false;
|
|
7420
|
-
}
|
|
7421
|
-
if (event.type === "thought") {
|
|
7422
|
-
return false;
|
|
7423
|
-
}
|
|
7424
|
-
if (event.type === "final_answer_chunk") {
|
|
7425
|
-
return false;
|
|
7426
|
-
}
|
|
7427
|
-
if (event.type === "final_answer_reset") {
|
|
7428
|
-
return false;
|
|
7429
|
-
}
|
|
7430
|
-
if (isEmptyTerminalAssistantRuntimeEvent(event)) {
|
|
7431
|
-
return false;
|
|
7432
|
-
}
|
|
7433
|
-
return true;
|
|
7434
|
-
})();
|
|
7435
|
-
const realtimeChannel = (() => {
|
|
7436
|
-
switch (uiProjectionKind) {
|
|
7437
|
-
case "thought":
|
|
7438
|
-
case "final_answer":
|
|
7439
|
-
case "final_answer_chunk":
|
|
7440
|
-
case "final_answer_reset":
|
|
7441
|
-
case "tool_call_decision":
|
|
7442
|
-
case "tool_process":
|
|
7443
|
-
case "tool_output":
|
|
7444
|
-
case "requires_user_interaction":
|
|
7445
|
-
case "subrun_trace":
|
|
7446
|
-
case "error":
|
|
7447
|
-
case "context_usage_snapshot":
|
|
7448
|
-
case "run_execution_metrics":
|
|
7449
|
-
case "history_summary":
|
|
7450
|
-
return "event_bus_sse";
|
|
7451
|
-
case "audit_envelope":
|
|
7452
|
-
return "none";
|
|
7453
|
-
default:
|
|
7454
|
-
return "none";
|
|
7455
|
-
}
|
|
7456
|
-
})();
|
|
7457
|
-
return {
|
|
7458
|
-
uiProjectionKind,
|
|
7459
|
-
persist,
|
|
7460
|
-
replayToUi,
|
|
7461
|
-
enterAgentContext,
|
|
7462
|
-
realtimeChannel
|
|
7463
|
-
};
|
|
7464
|
-
}
|
|
7465
|
-
function shouldEmitRuntimeEventToSse(event) {
|
|
7466
|
-
return describeRuntimeEventLifecycle(event).realtimeChannel === "event_bus_sse";
|
|
7467
|
-
}
|
|
7468
|
-
|
|
7469
7467
|
// src/runtime-kernel/events/finalAnswerCompletion.ts
|
|
7470
7468
|
function findTerminalFinalAnswer(events) {
|
|
7471
7469
|
for (let index = events.length - 1; index >= 0; index -= 1) {
|