@vellumai/assistant 0.11.2-dev.202608051734.355dff7 → 0.11.2-dev.202608051933.deffc0f
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/ARCHITECTURE.md +4 -2
- package/node_modules/@vellumai/ces-client/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
- package/node_modules/@vellumai/gateway-client/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
- package/node_modules/@vellumai/service-contracts/src/ingress.ts +10 -0
- package/openapi.yaml +22 -0
- package/package.json +1 -1
- package/src/__tests__/agent-loop-override-profile.test.ts +38 -48
- package/src/__tests__/assistant-feature-flags-integration.test.ts +0 -10
- package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +1 -0
- package/src/__tests__/conversation-tool-setup-attribution.test.ts +61 -0
- package/src/__tests__/cu-unified-flow.test.ts +2 -6
- package/src/__tests__/file-ops-service.test.ts +75 -4
- package/src/__tests__/host-bash-proxy.test.ts +10 -5
- package/src/__tests__/host-browser-proxy.test.ts +2 -2
- package/src/__tests__/host-cu-proxy.test.ts +3 -7
- package/src/__tests__/host-file-proxy.test.ts +3 -7
- package/src/__tests__/host-file-read-tool.test.ts +5 -1
- package/src/__tests__/host-transfer-proxy-targeted.test.ts +6 -4
- package/src/__tests__/llm-resolver-override-or-default.test.ts +141 -0
- package/src/__tests__/media-stream-server-integration.test.ts +36 -0
- package/src/__tests__/stt-language-catalog-parity.test.ts +38 -0
- package/src/__tests__/subagent-tool-gate-mode.test.ts +1 -0
- package/src/__tests__/subagent-tools.test.ts +48 -92
- package/src/__tests__/tool-result-spool.test.ts +74 -18
- package/src/agent/loop.ts +6 -3
- package/src/calls/media-stream-server.ts +9 -1
- package/src/config/bundled-skills/settings/TOOLS.json +2 -2
- package/src/config/bundled-skills/settings/tools/voice-config-update.ts +1 -0
- package/src/config/bundled-skills/subagent/SKILL.md +3 -3
- package/src/config/bundled-skills/subagent/TOOLS.json +1 -1
- package/src/config/feature-flag-registry.json +0 -16
- package/src/config/llm-resolver.ts +41 -12
- package/src/config/schemas/stt.ts +10 -4
- package/src/context/post-turn-tool-result-truncation.ts +32 -16
- package/src/context/tool-result-spool.ts +32 -18
- package/src/daemon/conversation-tool-setup.ts +1 -1
- package/src/persistence/conversation-attention-store.ts +30 -10
- package/src/persistence/conversation-queries.ts +74 -1
- package/src/platform/managed-speech.test.ts +20 -0
- package/src/platform/managed-speech.ts +9 -0
- package/src/providers/speech-to-text/__tests__/resolve.test.ts +164 -6
- package/src/providers/speech-to-text/deepgram.ts +1 -0
- package/src/providers/speech-to-text/resolve.ts +80 -10
- package/src/providers/speech-to-text/vellum-managed.ts +7 -1
- package/src/providers/speech-to-text/vellum-speech-relay-connection.ts +3 -1
- package/src/runtime/auth/__tests__/guard-tests.test.ts +2 -0
- package/src/runtime/auth/__tests__/scopes.test.ts +20 -0
- package/src/runtime/auth/same-actor.ts +38 -7
- package/src/runtime/auth/scopes.ts +12 -0
- package/src/runtime/auth/types.ts +2 -0
- package/src/runtime/routes/__tests__/conversation-list-routes.test.ts +279 -1
- package/src/runtime/routes/__tests__/conversation-query-routes.test.ts +14 -10
- package/src/runtime/routes/conversation-list-routes.ts +25 -0
- package/src/runtime/routes/conversation-query-routes.ts +0 -50
- package/src/stt/daemon-batch-transcriber.ts +8 -6
- package/src/tools/filesystem/read.ts +2 -2
- package/src/tools/host-filesystem/read.ts +14 -6
- package/src/tools/shared/filesystem/file-ops-service.ts +36 -3
- package/src/tools/subagent/spawn.ts +26 -78
- package/src/tools/types.ts +5 -3
|
@@ -107,7 +107,6 @@ import { executeSubagentMessage } from "../tools/subagent/message.js";
|
|
|
107
107
|
import { executeSubagentRead } from "../tools/subagent/read.js";
|
|
108
108
|
import { executeSubagentSpawn } from "../tools/subagent/spawn.js";
|
|
109
109
|
import { executeSubagentStatus } from "../tools/subagent/status.js";
|
|
110
|
-
import { setOverridesForTesting } from "./feature-flag-test-helpers.js";
|
|
111
110
|
|
|
112
111
|
// The tools fall back to the durable table for a subagent the manager does not
|
|
113
112
|
// hold, so every executor here reaches it. Idempotent; the table may already
|
|
@@ -637,7 +636,7 @@ describe("Subagent spawn success and failure", () => {
|
|
|
637
636
|
}
|
|
638
637
|
});
|
|
639
638
|
|
|
640
|
-
test("spawn
|
|
639
|
+
test("spawn passes no override, landing the child on the subagentSpawn default", async () => {
|
|
641
640
|
const manager = getSubagentManager();
|
|
642
641
|
const originalSpawn = manager.spawn.bind(manager);
|
|
643
642
|
let capturedConfig: Record<string, unknown> | undefined;
|
|
@@ -657,17 +656,17 @@ describe("Subagent spawn success and failure", () => {
|
|
|
657
656
|
);
|
|
658
657
|
|
|
659
658
|
expect(result.isError).toBe(false);
|
|
660
|
-
// No
|
|
661
|
-
//
|
|
662
|
-
//
|
|
663
|
-
expect(capturedConfig!.overrideProfile).
|
|
659
|
+
// No override travels with the spawn. The child runs its loop under
|
|
660
|
+
// `callSite: "subagentSpawn"` and resolves that call site's own profile,
|
|
661
|
+
// which also keeps its usage attribution off `conversation`.
|
|
662
|
+
expect(capturedConfig!.overrideProfile).toBeUndefined();
|
|
664
663
|
expect(capturedConfig!.forceOverrideProfile).toBeUndefined();
|
|
665
664
|
} finally {
|
|
666
665
|
manager.spawn = originalSpawn;
|
|
667
666
|
}
|
|
668
667
|
});
|
|
669
668
|
|
|
670
|
-
test("
|
|
669
|
+
test("a non-main invoker's call-site default does not reach the child", async () => {
|
|
671
670
|
const manager = getSubagentManager();
|
|
672
671
|
const originalSpawn = manager.spawn.bind(manager);
|
|
673
672
|
let capturedConfig: Record<string, unknown> | undefined;
|
|
@@ -687,15 +686,16 @@ describe("Subagent spawn success and failure", () => {
|
|
|
687
686
|
);
|
|
688
687
|
|
|
689
688
|
expect(result.isError).toBe(false);
|
|
690
|
-
// A subagent spawned from a heartbeat turn
|
|
691
|
-
// cost-optimized default
|
|
692
|
-
|
|
689
|
+
// A subagent spawned from a heartbeat turn does not pick up
|
|
690
|
+
// heartbeatAgent's cost-optimized default. Delegated work is priced by
|
|
691
|
+
// where it runs, not by which call site happened to delegate it.
|
|
692
|
+
expect(capturedConfig!.overrideProfile).toBeUndefined();
|
|
693
693
|
} finally {
|
|
694
694
|
manager.spawn = originalSpawn;
|
|
695
695
|
}
|
|
696
696
|
});
|
|
697
697
|
|
|
698
|
-
test("
|
|
698
|
+
test("a per-turn override profile does not reach the child", async () => {
|
|
699
699
|
const manager = getSubagentManager();
|
|
700
700
|
const originalSpawn = manager.spawn.bind(manager);
|
|
701
701
|
let capturedConfig: Record<string, unknown> | undefined;
|
|
@@ -716,9 +716,10 @@ describe("Subagent spawn success and failure", () => {
|
|
|
716
716
|
);
|
|
717
717
|
|
|
718
718
|
expect(result.isError).toBe(false);
|
|
719
|
-
//
|
|
720
|
-
// the
|
|
721
|
-
|
|
719
|
+
// A profile switched mid-conversation is a choice about that
|
|
720
|
+
// conversation, not about the work it delegates, so it stops at the
|
|
721
|
+
// spawn boundary.
|
|
722
|
+
expect(capturedConfig!.overrideProfile).toBeUndefined();
|
|
722
723
|
expect(capturedConfig!.forceOverrideProfile).toBeUndefined();
|
|
723
724
|
} finally {
|
|
724
725
|
manager.spawn = originalSpawn;
|
|
@@ -842,12 +843,8 @@ describe("Subagent spawn success and failure", () => {
|
|
|
842
843
|
// ── Profile isolation ───────────────────────────────────────────────
|
|
843
844
|
|
|
844
845
|
describe("Subagent spawn profile isolation", () => {
|
|
845
|
-
/**
|
|
846
|
-
|
|
847
|
-
* `subagent-profile-isolation` seeded on or off for the duration.
|
|
848
|
-
*/
|
|
849
|
-
async function spawnWithFlag(
|
|
850
|
-
enabled: boolean,
|
|
846
|
+
/** Capture the config `executeSubagentSpawn` hands the manager. */
|
|
847
|
+
async function spawnCapturingConfig(
|
|
851
848
|
input: Record<string, unknown>,
|
|
852
849
|
contextExtras: Record<string, unknown> = {},
|
|
853
850
|
): Promise<{
|
|
@@ -861,7 +858,6 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
861
858
|
capturedConfig = config;
|
|
862
859
|
return "isolation-subagent-id";
|
|
863
860
|
};
|
|
864
|
-
setOverridesForTesting({ "subagent-profile-isolation": enabled });
|
|
865
861
|
try {
|
|
866
862
|
const result = await executeSubagentSpawn(
|
|
867
863
|
input,
|
|
@@ -872,25 +868,14 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
872
868
|
);
|
|
873
869
|
return { result, config: capturedConfig };
|
|
874
870
|
} finally {
|
|
875
|
-
setOverridesForTesting({});
|
|
876
871
|
mockConversationOverrideProfile = undefined;
|
|
877
872
|
manager.spawn = originalSpawn;
|
|
878
873
|
}
|
|
879
874
|
}
|
|
880
875
|
|
|
881
|
-
test("
|
|
882
|
-
mockConversationOverrideProfile = "quality-optimized";
|
|
883
|
-
const { config } = await spawnWithFlag(false, {
|
|
884
|
-
label: "Pinned parent",
|
|
885
|
-
objective: "Do it",
|
|
886
|
-
});
|
|
887
|
-
expect(config.overrideProfile).toBe("quality-optimized");
|
|
888
|
-
expect(config.forceOverrideProfile).toBeUndefined();
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
test("flag on keeps the conversation-pinned profile away from the child", async () => {
|
|
876
|
+
test("keeps the conversation-pinned profile away from the child", async () => {
|
|
892
877
|
mockConversationOverrideProfile = "quality-optimized";
|
|
893
|
-
const { config } = await
|
|
878
|
+
const { config } = await spawnCapturingConfig({
|
|
894
879
|
label: "Pinned parent",
|
|
895
880
|
objective: "Do it",
|
|
896
881
|
});
|
|
@@ -901,18 +886,17 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
901
886
|
expect(config.forceOverrideProfile).toBeUndefined();
|
|
902
887
|
});
|
|
903
888
|
|
|
904
|
-
test("
|
|
905
|
-
const { config } = await
|
|
906
|
-
true,
|
|
889
|
+
test("keeps the per-turn override profile away from the child", async () => {
|
|
890
|
+
const { config } = await spawnCapturingConfig(
|
|
907
891
|
{ label: "Override parent", objective: "Do it" },
|
|
908
892
|
{ invokingCallSite: "mainAgent", overrideProfile: "quality-optimized" },
|
|
909
893
|
);
|
|
910
894
|
expect(config.overrideProfile).toBeUndefined();
|
|
911
895
|
});
|
|
912
896
|
|
|
913
|
-
test("
|
|
897
|
+
test("still honors an explicit inference_profile", async () => {
|
|
914
898
|
mockConversationOverrideProfile = "cost-optimized";
|
|
915
|
-
const { result, config } = await
|
|
899
|
+
const { result, config } = await spawnCapturingConfig({
|
|
916
900
|
label: "Explicit",
|
|
917
901
|
objective: "Do it",
|
|
918
902
|
inference_profile: "quality-optimized",
|
|
@@ -922,8 +906,8 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
922
906
|
expect(JSON.parse(result.content).note).toBeUndefined();
|
|
923
907
|
});
|
|
924
908
|
|
|
925
|
-
test("
|
|
926
|
-
const { result, config } = await
|
|
909
|
+
test("falls back with a note when the catalog denies tool use", async () => {
|
|
910
|
+
const { result, config } = await spawnCapturingConfig({
|
|
927
911
|
label: "No tools",
|
|
928
912
|
objective: "Do it",
|
|
929
913
|
inference_profile: "no-tool-model",
|
|
@@ -940,8 +924,8 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
940
924
|
);
|
|
941
925
|
});
|
|
942
926
|
|
|
943
|
-
test("
|
|
944
|
-
const { result, config } = await
|
|
927
|
+
test("fails open for a model the catalog does not list", async () => {
|
|
928
|
+
const { result, config } = await spawnCapturingConfig({
|
|
945
929
|
label: "BYOK",
|
|
946
930
|
objective: "Do it",
|
|
947
931
|
inference_profile: "byok-unknown-model",
|
|
@@ -950,16 +934,6 @@ describe("Subagent spawn profile isolation", () => {
|
|
|
950
934
|
expect(config.forceOverrideProfile).toBe(true);
|
|
951
935
|
expect(JSON.parse(result.content).note).toBeUndefined();
|
|
952
936
|
});
|
|
953
|
-
|
|
954
|
-
test("flag off leaves an unverified profile alone", async () => {
|
|
955
|
-
const { result, config } = await spawnWithFlag(false, {
|
|
956
|
-
label: "No tools",
|
|
957
|
-
objective: "Do it",
|
|
958
|
-
inference_profile: "no-tool-model",
|
|
959
|
-
});
|
|
960
|
-
expect(config.overrideProfile).toBe("no-tool-model");
|
|
961
|
-
expect(JSON.parse(result.content).note).toBeUndefined();
|
|
962
|
-
});
|
|
963
937
|
});
|
|
964
938
|
|
|
965
939
|
// ── Repeat-spawn guard ──────────────────────────────────────────────
|
|
@@ -1007,11 +981,10 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1007
981
|
}
|
|
1008
982
|
|
|
1009
983
|
/**
|
|
1010
|
-
* Run the spawn tool
|
|
1011
|
-
*
|
|
984
|
+
* Run the spawn tool, reporting whether the manager was actually asked to
|
|
985
|
+
* spawn.
|
|
1012
986
|
*/
|
|
1013
987
|
async function spawnWithGuard(
|
|
1014
|
-
enabled: boolean,
|
|
1015
988
|
input: Record<string, unknown>,
|
|
1016
989
|
conversationId = guardParent,
|
|
1017
990
|
) {
|
|
@@ -1022,7 +995,6 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1022
995
|
spawned = true;
|
|
1023
996
|
return "guard-subagent-id";
|
|
1024
997
|
};
|
|
1025
|
-
setOverridesForTesting({ "subagent-loop-guard": enabled });
|
|
1026
998
|
try {
|
|
1027
999
|
const result = await executeSubagentSpawn(
|
|
1028
1000
|
input,
|
|
@@ -1030,29 +1002,15 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1030
1002
|
);
|
|
1031
1003
|
return { result, spawned };
|
|
1032
1004
|
} finally {
|
|
1033
|
-
setOverridesForTesting({});
|
|
1034
1005
|
manager.spawn = originalSpawn;
|
|
1035
1006
|
}
|
|
1036
1007
|
}
|
|
1037
1008
|
|
|
1038
|
-
test("flag off spawns however often the objective has already run", async () => {
|
|
1039
|
-
const objective = "Audit the flag-off pipeline for drift";
|
|
1040
|
-
seedSpawns("guard-off", objective, 6);
|
|
1041
|
-
|
|
1042
|
-
const { result, spawned } = await spawnWithGuard(false, {
|
|
1043
|
-
label: "Repeat",
|
|
1044
|
-
objective,
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
|
-
expect(spawned).toBe(true);
|
|
1048
|
-
expect(JSON.parse(result.content).subagentId).toBe("guard-subagent-id");
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
1009
|
test("a conversation under the threshold spawns normally", async () => {
|
|
1052
1010
|
const objective = "Audit the under-threshold pipeline for drift";
|
|
1053
1011
|
seedSpawns("guard-under", objective, 2);
|
|
1054
1012
|
|
|
1055
|
-
const { spawned } = await spawnWithGuard(
|
|
1013
|
+
const { spawned } = await spawnWithGuard({
|
|
1056
1014
|
label: "Repeat",
|
|
1057
1015
|
objective,
|
|
1058
1016
|
});
|
|
@@ -1064,7 +1022,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1064
1022
|
const objective = "Audit the retention pipeline for drift";
|
|
1065
1023
|
seedSpawns("guard-conv", objective, 3);
|
|
1066
1024
|
|
|
1067
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1025
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1068
1026
|
label: "Repeat",
|
|
1069
1027
|
objective,
|
|
1070
1028
|
});
|
|
@@ -1087,7 +1045,6 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1087
1045
|
}
|
|
1088
1046
|
|
|
1089
1047
|
const { result, spawned } = await spawnWithGuard(
|
|
1090
|
-
true,
|
|
1091
1048
|
{ label: "Repeat", objective },
|
|
1092
1049
|
"guard-fresh-conversation",
|
|
1093
1050
|
);
|
|
@@ -1102,7 +1059,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1102
1059
|
const objective = "Audit the confirmed pipeline for drift";
|
|
1103
1060
|
seedSpawns("guard-confirm", objective, 5);
|
|
1104
1061
|
|
|
1105
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1062
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1106
1063
|
label: "Repeat",
|
|
1107
1064
|
objective,
|
|
1108
1065
|
confirm_repeat: true,
|
|
@@ -1116,7 +1073,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1116
1073
|
const objective = "Audit the advisor pipeline for drift";
|
|
1117
1074
|
seedSpawns("guard-advisor", objective, 6);
|
|
1118
1075
|
|
|
1119
|
-
const { result } = await spawnWithGuard(
|
|
1076
|
+
const { result } = await spawnWithGuard({
|
|
1120
1077
|
label: "Consult",
|
|
1121
1078
|
objective,
|
|
1122
1079
|
role: "advisor",
|
|
@@ -1135,7 +1092,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1135
1092
|
seedSpawn("guard-flight-0", objective, { status: "running" });
|
|
1136
1093
|
seedSpawn("guard-flight-1", objective, { status: "pending" });
|
|
1137
1094
|
|
|
1138
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1095
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1139
1096
|
label: "Repeat",
|
|
1140
1097
|
objective,
|
|
1141
1098
|
});
|
|
@@ -1155,7 +1112,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1155
1112
|
const objective = "Audit the single-flight pipeline for drift";
|
|
1156
1113
|
seedSpawn("guard-flight-solo", objective, { status: "running" });
|
|
1157
1114
|
|
|
1158
|
-
const { spawned } = await spawnWithGuard(
|
|
1115
|
+
const { spawned } = await spawnWithGuard({
|
|
1159
1116
|
label: "Repeat",
|
|
1160
1117
|
objective,
|
|
1161
1118
|
});
|
|
@@ -1173,7 +1130,6 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1173
1130
|
}
|
|
1174
1131
|
|
|
1175
1132
|
const { result, spawned } = await spawnWithGuard(
|
|
1176
|
-
true,
|
|
1177
1133
|
{ label: "Repeat", objective },
|
|
1178
1134
|
"guard-flight-fresh-conversation",
|
|
1179
1135
|
);
|
|
@@ -1192,7 +1148,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1192
1148
|
seedSpawn("guard-mixed-running-0", objective, { status: "running" });
|
|
1193
1149
|
seedSpawn("guard-mixed-running-1", objective, { status: "running" });
|
|
1194
1150
|
|
|
1195
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1151
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1196
1152
|
label: "Repeat",
|
|
1197
1153
|
objective,
|
|
1198
1154
|
});
|
|
@@ -1211,7 +1167,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1211
1167
|
seedSpawn(`guard-flight-confirm-${i}`, objective, { status: "running" });
|
|
1212
1168
|
}
|
|
1213
1169
|
|
|
1214
|
-
const { spawned } = await spawnWithGuard(
|
|
1170
|
+
const { spawned } = await spawnWithGuard({
|
|
1215
1171
|
label: "Repeat",
|
|
1216
1172
|
objective,
|
|
1217
1173
|
confirm_repeat: true,
|
|
@@ -1228,7 +1184,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1228
1184
|
}
|
|
1229
1185
|
}
|
|
1230
1186
|
|
|
1231
|
-
const { spawned } = await spawnWithGuard(
|
|
1187
|
+
const { spawned } = await spawnWithGuard({
|
|
1232
1188
|
label: "Retry",
|
|
1233
1189
|
objective,
|
|
1234
1190
|
});
|
|
@@ -1243,7 +1199,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1243
1199
|
seedSpawn("guard-norm-2", objective.replace(/ /gu, "\n"));
|
|
1244
1200
|
seedSpawn("guard-norm-3", objective.replace(/ /gu, " "));
|
|
1245
1201
|
|
|
1246
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1202
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1247
1203
|
label: "Repeat",
|
|
1248
1204
|
objective,
|
|
1249
1205
|
});
|
|
@@ -1256,7 +1212,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1256
1212
|
const objective = "Audit the distinct pipeline for drift";
|
|
1257
1213
|
seedSpawns("guard-distinct", objective, 5);
|
|
1258
1214
|
|
|
1259
|
-
const { spawned } = await spawnWithGuard(
|
|
1215
|
+
const { spawned } = await spawnWithGuard({
|
|
1260
1216
|
label: "Different",
|
|
1261
1217
|
objective: "Audit the payouts ledger for drift",
|
|
1262
1218
|
});
|
|
@@ -1278,7 +1234,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1278
1234
|
});
|
|
1279
1235
|
}
|
|
1280
1236
|
|
|
1281
|
-
const { spawned } = await spawnWithGuard(
|
|
1237
|
+
const { spawned } = await spawnWithGuard({
|
|
1282
1238
|
label: "Retry",
|
|
1283
1239
|
objective,
|
|
1284
1240
|
});
|
|
@@ -1294,7 +1250,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1294
1250
|
seedSpawns("guard-inflight-done", objective, 2);
|
|
1295
1251
|
seedSpawn("guard-inflight-0", objective, { status: "awaiting_input" });
|
|
1296
1252
|
|
|
1297
|
-
const { spawned } = await spawnWithGuard(
|
|
1253
|
+
const { spawned } = await spawnWithGuard({
|
|
1298
1254
|
label: "Repeat",
|
|
1299
1255
|
objective,
|
|
1300
1256
|
});
|
|
@@ -1308,7 +1264,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1308
1264
|
"what you found and what should change, focusing on ";
|
|
1309
1265
|
seedSpawns("guard-batch", `${preamble}the billing service`, 5);
|
|
1310
1266
|
|
|
1311
|
-
const { spawned } = await spawnWithGuard(
|
|
1267
|
+
const { spawned } = await spawnWithGuard({
|
|
1312
1268
|
label: "Next in batch",
|
|
1313
1269
|
objective: `${preamble}the payouts service`,
|
|
1314
1270
|
});
|
|
@@ -1322,7 +1278,7 @@ describe("Subagent spawn repeat-loop guard", () => {
|
|
|
1322
1278
|
"what you found and what should change, focusing on the ledger service";
|
|
1323
1279
|
seedSpawns("guard-long", objective, 3);
|
|
1324
1280
|
|
|
1325
|
-
const { result, spawned } = await spawnWithGuard(
|
|
1281
|
+
const { result, spawned } = await spawnWithGuard({
|
|
1326
1282
|
label: "Repeat",
|
|
1327
1283
|
objective,
|
|
1328
1284
|
});
|
|
@@ -2979,7 +2935,9 @@ describe("Subagent output contract", () => {
|
|
|
2979
2935
|
},
|
|
2980
2936
|
{ invokingCallSite: "mainAgent" },
|
|
2981
2937
|
);
|
|
2982
|
-
|
|
2938
|
+
// A report is the default contract, so it applies no preset of its own and
|
|
2939
|
+
// leaves the child on the subagentSpawn default like any other spawn.
|
|
2940
|
+
expect(config!.overrideProfile).toBeUndefined();
|
|
2983
2941
|
expect(
|
|
2984
2942
|
buildSubagentSystemPrompt(
|
|
2985
2943
|
{
|
|
@@ -3251,13 +3209,12 @@ describe("Subagent advisor-role consult", () => {
|
|
|
3251
3209
|
}
|
|
3252
3210
|
});
|
|
3253
3211
|
|
|
3254
|
-
test("advisor
|
|
3212
|
+
test("advisor uses llm.advisorProfile, not the conversation pin", async () => {
|
|
3255
3213
|
mockFindConversation = () => ({
|
|
3256
3214
|
messages: [{ role: "user", content: [{ type: "text", text: "Hi" }] }],
|
|
3257
3215
|
getCurrentSystemPrompt: () => "SYS",
|
|
3258
3216
|
});
|
|
3259
3217
|
mockConversationOverrideProfile = "quality-optimized";
|
|
3260
|
-
setOverridesForTesting({ "subagent-profile-isolation": true });
|
|
3261
3218
|
const { captured, restore } = stubAwait("advice");
|
|
3262
3219
|
try {
|
|
3263
3220
|
await executeSubagentSpawn(
|
|
@@ -3268,7 +3225,6 @@ describe("Subagent advisor-role consult", () => {
|
|
|
3268
3225
|
expect(captured.current!.config.forceOverrideProfile).toBe(true);
|
|
3269
3226
|
} finally {
|
|
3270
3227
|
restore();
|
|
3271
|
-
setOverridesForTesting({});
|
|
3272
3228
|
mockConversationOverrideProfile = undefined;
|
|
3273
3229
|
mockFindConversation = () => undefined;
|
|
3274
3230
|
}
|
|
@@ -49,7 +49,7 @@ const SHORT = "y".repeat(100);
|
|
|
49
49
|
|
|
50
50
|
describe("spoolAndStubOversizedToolResults", () => {
|
|
51
51
|
let convDir: string;
|
|
52
|
-
const
|
|
52
|
+
const noCall = () => undefined;
|
|
53
53
|
|
|
54
54
|
beforeEach(() => {
|
|
55
55
|
convDir = mkdtempSync(join(tmpdir(), "tool-result-spool-"));
|
|
@@ -64,7 +64,7 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
64
64
|
|
|
65
65
|
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
66
66
|
conversationDir: convDir,
|
|
67
|
-
|
|
67
|
+
toolCallById: noCall,
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
expect(count).toBe(1);
|
|
@@ -81,7 +81,7 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
81
81
|
const blocks = [makeToolResult(LONG, "tu_big")];
|
|
82
82
|
spoolAndStubOversizedToolResults(blocks, {
|
|
83
83
|
conversationDir: convDir,
|
|
84
|
-
|
|
84
|
+
toolCallById: noCall,
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
const { messages: postTurn } = postTurnTruncateToolResults(
|
|
@@ -98,7 +98,7 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
98
98
|
const blocks = [makeToolResult(LONG, "tu_big")];
|
|
99
99
|
spoolAndStubOversizedToolResults(blocks, {
|
|
100
100
|
conversationDir: convDir,
|
|
101
|
-
|
|
101
|
+
toolCallById: noCall,
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
const history: Message[] = [{ role: "user", content: [...blocks] }];
|
|
@@ -110,13 +110,11 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
110
110
|
expect(messages).toBe(history);
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
test("skips below-threshold, error, exempt,
|
|
113
|
+
test("skips below-threshold, error, exempt, web_fetch, marked, and ax-tree results", () => {
|
|
114
114
|
const blocks = [
|
|
115
115
|
makeToolResult(SHORT, "tu_short"),
|
|
116
116
|
makeToolResult(LONG, "tu_err", true),
|
|
117
117
|
makeToolResult(LONG, "tu_skill"),
|
|
118
|
-
makeToolResult(LONG, "tu_read"),
|
|
119
|
-
makeToolResult(LONG, "tu_host_read"),
|
|
120
118
|
makeToolResult(LONG, "tu_web_fetch"),
|
|
121
119
|
makeToolResult(`${LONG}${TRUNCATION_MARKER}`, "tu_marked"),
|
|
122
120
|
makeToolResult(`<ax-tree>${LONG}</ax-tree>`, "tu_ax"),
|
|
@@ -126,18 +124,12 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
126
124
|
|
|
127
125
|
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
128
126
|
conversationDir: convDir,
|
|
129
|
-
|
|
127
|
+
toolCallById: (id) => {
|
|
130
128
|
if (id === "tu_skill") {
|
|
131
|
-
return "skill_load";
|
|
132
|
-
}
|
|
133
|
-
if (id === "tu_read") {
|
|
134
|
-
return "file_read";
|
|
135
|
-
}
|
|
136
|
-
if (id === "tu_host_read") {
|
|
137
|
-
return "host_file_read";
|
|
129
|
+
return { name: "skill_load", input: {} };
|
|
138
130
|
}
|
|
139
131
|
if (id === "tu_web_fetch") {
|
|
140
|
-
return "web_fetch";
|
|
132
|
+
return { name: "web_fetch", input: {} };
|
|
141
133
|
}
|
|
142
134
|
return undefined;
|
|
143
135
|
},
|
|
@@ -148,6 +140,70 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
148
140
|
expect(existsSync(join(convDir, TOOL_RESULT_DIR))).toBe(false);
|
|
149
141
|
});
|
|
150
142
|
|
|
143
|
+
test("spools an oversized file read of an ordinary path", () => {
|
|
144
|
+
const blocks = [
|
|
145
|
+
makeToolResult(LONG, "tu_read"),
|
|
146
|
+
makeToolResult(LONG, "tu_host_read"),
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
150
|
+
conversationDir: convDir,
|
|
151
|
+
toolCallById: (id) =>
|
|
152
|
+
id === "tu_read"
|
|
153
|
+
? { name: "file_read", input: { path: "/workspace/src/big.ts" } }
|
|
154
|
+
: { name: "host_file_read", input: { path: "/Users/me/notes.md" } },
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
expect(count).toBe(2);
|
|
158
|
+
expect((blocks[0] as { content: string }).content).toContain(
|
|
159
|
+
TRUNCATION_MARKER,
|
|
160
|
+
);
|
|
161
|
+
expect((blocks[1] as { content: string }).content).toContain(
|
|
162
|
+
TRUNCATION_MARKER,
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test("leaves a file read of a spooled .tool-results path inline", () => {
|
|
167
|
+
// Stubbing this read would write a fresh copy and hand back another stub,
|
|
168
|
+
// so the spooled content could never be paged back into context.
|
|
169
|
+
const spooledPath = getToolResultFilePath(convDir, "tu_earlier");
|
|
170
|
+
const blocks = [
|
|
171
|
+
makeToolResult(LONG, "tu_read"),
|
|
172
|
+
makeToolResult(LONG, "tu_host_read"),
|
|
173
|
+
];
|
|
174
|
+
const originals = blocks.map((b) => b);
|
|
175
|
+
|
|
176
|
+
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
177
|
+
conversationDir: convDir,
|
|
178
|
+
toolCallById: (id) =>
|
|
179
|
+
id === "tu_read"
|
|
180
|
+
? { name: "file_read", input: { path: spooledPath } }
|
|
181
|
+
: { name: "host_file_read", input: { file_path: spooledPath } },
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(count).toBe(0);
|
|
185
|
+
expect(blocks).toEqual(originals);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test("recognizes a backslash-separated spooled path", () => {
|
|
189
|
+
// `getToolResultFilePath` builds the stub path with `join`, so on Windows
|
|
190
|
+
// it is backslash-separated. Missing that match would stub the read and
|
|
191
|
+
// put the saved content out of reach.
|
|
192
|
+
const blocks = [makeToolResult(LONG, "tu_read")];
|
|
193
|
+
const originals = blocks.map((b) => b);
|
|
194
|
+
|
|
195
|
+
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
196
|
+
conversationDir: convDir,
|
|
197
|
+
toolCallById: () => ({
|
|
198
|
+
name: "file_read",
|
|
199
|
+
input: { path: `C:\\conv\\${TOOL_RESULT_DIR}\\abc123.txt` },
|
|
200
|
+
}),
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
expect(count).toBe(0);
|
|
204
|
+
expect(blocks).toEqual(originals);
|
|
205
|
+
});
|
|
206
|
+
|
|
151
207
|
test("spools each eligible block in a mixed batch", () => {
|
|
152
208
|
const blocks = [
|
|
153
209
|
makeToolResult(LONG, "tu_a"),
|
|
@@ -157,7 +213,7 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
157
213
|
|
|
158
214
|
const count = spoolAndStubOversizedToolResults(blocks, {
|
|
159
215
|
conversationDir: convDir,
|
|
160
|
-
|
|
216
|
+
toolCallById: noCall,
|
|
161
217
|
});
|
|
162
218
|
|
|
163
219
|
expect(count).toBe(2);
|
|
@@ -184,7 +240,7 @@ describe("spoolAndStubOversizedToolResults", () => {
|
|
|
184
240
|
expect(() =>
|
|
185
241
|
spoolAndStubOversizedToolResults(blocks, {
|
|
186
242
|
conversationDir: fileAsDir,
|
|
187
|
-
|
|
243
|
+
toolCallById: noCall,
|
|
188
244
|
}),
|
|
189
245
|
).toThrow();
|
|
190
246
|
expect((blocks[0] as { content: string }).content).toBe(LONG);
|
package/src/agent/loop.ts
CHANGED
|
@@ -2212,13 +2212,16 @@ export class AgentLoop {
|
|
|
2212
2212
|
// message between calls would invalidate the prompt-cache prefix on
|
|
2213
2213
|
// every iteration).
|
|
2214
2214
|
if (conversationDir) {
|
|
2215
|
-
const
|
|
2216
|
-
toolUseBlocks.map((tu) => [
|
|
2215
|
+
const toolCallByUseId = new Map(
|
|
2216
|
+
toolUseBlocks.map((tu) => [
|
|
2217
|
+
tu.id,
|
|
2218
|
+
{ name: tu.name, input: tu.input },
|
|
2219
|
+
]),
|
|
2217
2220
|
);
|
|
2218
2221
|
try {
|
|
2219
2222
|
spoolAndStubOversizedToolResults(rawResultBlocks, {
|
|
2220
2223
|
conversationDir,
|
|
2221
|
-
|
|
2224
|
+
toolCallById: (id) => toolCallByUseId.get(id),
|
|
2222
2225
|
});
|
|
2223
2226
|
} catch (err) {
|
|
2224
2227
|
rlog.warn(
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
* - Media stream `stop` event / WebSocket close -> finalize call.
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
+
import { GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE } from "@vellumai/service-contracts/ingress";
|
|
41
42
|
import type { ServerWebSocket } from "bun";
|
|
42
43
|
|
|
43
44
|
import { revokeScopedApprovalGrantsForContext } from "../approvals/scoped-approval-grants.js";
|
|
@@ -344,9 +345,16 @@ export class MediaStreamCallSession {
|
|
|
344
345
|
);
|
|
345
346
|
}
|
|
346
347
|
} else {
|
|
348
|
+
// The gateway's close reason does not survive the relay (Bun's
|
|
349
|
+
// WebSocket client drops it), so tunnel loss is decoded from the
|
|
350
|
+
// dedicated close code.
|
|
347
351
|
const detail =
|
|
348
352
|
reason ||
|
|
349
|
-
(code
|
|
353
|
+
(code === GATEWAY_TUNNEL_LOST_WS_CLOSE_CODE
|
|
354
|
+
? "public ingress tunnel disconnected"
|
|
355
|
+
: code
|
|
356
|
+
? `media_stream_closed_${code}`
|
|
357
|
+
: "media_stream_closed_abnormal");
|
|
350
358
|
updateCallSession(this.callSessionId, {
|
|
351
359
|
status: "failed",
|
|
352
360
|
endedAt: Date.now(),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"tools": [
|
|
4
4
|
{
|
|
5
5
|
"name": "voice_config_update",
|
|
6
|
-
"description": "Update a voice configuration setting. Use tts_provider / stt_provider to switch the active TTS / STT provider. Provider \"vellum\" is Vellum-managed speech (billed to your organization; requires a Vellum platform connection via 'assistant platform connect'); any other provider uses the user's own API key. Valid TTS providers come from the provider catalog (vellum, elevenlabs, fish-audio, deepgram, xai); valid STT providers: vellum, deepgram, google-gemini, openai-whisper, xai. Use tts_voice_id to change the voice; it targets whichever TTS provider is currently active. For elevenlabs, pass an ElevenLabs voice ID. For vellum (managed), pass a managed voice model ID: this may be an ElevenLabs voice ID (managed speech serves the same ElevenLabs voices) or a Deepgram Aura model ID (e.g. aura-2-thalia-en); only rate-carded voices synthesize, so prefer models from the managed catalog (daemon route GET tts/managed-voices, also used by the web voice picker). For deepgram, pass a Deepgram Aura model ID. Use fish_audio_reference_id for Fish Audio voice reference. Use stt_language to set the spoken language for speech recognition: one of the
|
|
6
|
+
"description": "Update a voice configuration setting. Use tts_provider / stt_provider to switch the active TTS / STT provider. Provider \"vellum\" is Vellum-managed speech (billed to your organization; requires a Vellum platform connection via 'assistant platform connect'); any other provider uses the user's own API key. Valid TTS providers come from the provider catalog (vellum, elevenlabs, fish-audio, deepgram, xai); valid STT providers: vellum, deepgram, google-gemini, openai-whisper, xai. Use tts_voice_id to change the voice; it targets whichever TTS provider is currently active. For elevenlabs, pass an ElevenLabs voice ID. For vellum (managed), pass a managed voice model ID: this may be an ElevenLabs voice ID (managed speech serves the same ElevenLabs voices) or a Deepgram Aura model ID (e.g. aura-2-thalia-en); only rate-carded voices synthesize, so prefer models from the managed catalog (daemon route GET tts/managed-voices, also used by the web voice picker). For deepgram, pass a Deepgram Aura model ID. Use fish_audio_reference_id for Fish Audio voice reference. Use stt_language to set the spoken language for speech recognition: one of the 50 base language codes on the verified Deepgram nova-3 monolingual roster (e.g. en, es, hi, ta, zh, ko), or \"multi\" for code-switching mid-sentence across its 10-language roster (English, Spanish, French, German, Hindi, Russian, Portuguese, Japanese, Italian, Dutch; e.g. Hinglish); plain language names like \"tamil\" or \"multilingual\" are accepted and normalized. Accepted values follow the configured STT provider: vellum-managed and deepgram accept the full roster plus \"multi\"; xai accepts only the 10 multilingual-roster codes (en, es, fr, de, hi, ru, pt, ja, it, nl) and rejects \"multi\" and the extended codes (both are verified for Deepgram nova-3 only); google-gemini / openai-whisper auto-detect natively, so the value persists but is ignored while they are active. Deepgram uses the same API key for TTS and STT. Changes persist to services.stt / services.tts config and take effect immediately.",
|
|
7
7
|
"category": "system",
|
|
8
8
|
"risk": "low",
|
|
9
9
|
"input_schema": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"description": "The voice setting to change. tts_provider / stt_provider select the active provider for each service (\"vellum\" = Vellum-managed speech; anything else = the user's own API key). tts_voice_id sets the voice for the currently active TTS provider (ElevenLabs voice ID for elevenlabs; a managed voice model ID for vellum, meaning an ElevenLabs voice ID or a Deepgram Aura model ID like aura-2-thalia-en; a Deepgram Aura model ID for deepgram; voice ID for xai). fish_audio_reference_id sets the Fish Audio voice reference. stt_language sets the spoken language for speech recognition (vellum-managed/deepgram: the full roster plus \"multi\"; xai: only the 10 multilingual-roster codes, with \"multi\" and the extended codes rejected; google-gemini and openai-whisper auto-detect and ignore it). Deepgram shares one API key across TTS and STT."
|
|
24
24
|
},
|
|
25
25
|
"value": {
|
|
26
|
-
"description": "The new value for the setting. For tts_provider: one of vellum, elevenlabs, fish-audio, deepgram, xai. For stt_provider: one of vellum, deepgram, google-gemini, openai-whisper, xai. For tts_voice_id: a voice ID for the active TTS provider: an alphanumeric ElevenLabs voice ID (elevenlabs), a managed voice model ID which may be an ElevenLabs voice ID or a Deepgram Aura model ID like aura-2-thalia-en (vellum), or a Deepgram Aura model ID (deepgram). For fish_audio_reference_id: a Fish Audio voice reference ID. For stt_language: one of the
|
|
26
|
+
"description": "The new value for the setting. For tts_provider: one of vellum, elevenlabs, fish-audio, deepgram, xai. For stt_provider: one of vellum, deepgram, google-gemini, openai-whisper, xai. For tts_voice_id: a voice ID for the active TTS provider: an alphanumeric ElevenLabs voice ID (elevenlabs), a managed voice model ID which may be an ElevenLabs voice ID or a Deepgram Aura model ID like aura-2-thalia-en (vellum), or a Deepgram Aura model ID (deepgram). For fish_audio_reference_id: a Fish Audio voice reference ID. For stt_language: one of the 50 base codes on the nova-3 monolingual roster (e.g. en, es, hi, ta, zh, ko), or multi (code-switching across its 10-language roster); language names like \"hindi\", \"tamil\", or \"multilingual\" are also accepted and normalized; when the configured STT provider is xai, only the 10 multilingual-roster codes (en, es, fr, de, hi, ru, pt, ja, it, nl) are accepted. For conversation_timeout: seconds (5, 10, 15, 30, or 60). For activation_key: key identifier string."
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|