@vellumai/assistant 0.10.3-dev.202606262135.fc770c1 → 0.10.3-dev.202606262232.b3e3aed
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/package.json +1 -1
- package/src/__tests__/plugin-disabled-state.test.ts +32 -0
- package/src/api/events/acp-session-completed.ts +2 -3
- package/src/api/events/acp-session-error.ts +2 -3
- package/src/api/events/acp-session-spawned.ts +2 -3
- package/src/api/events/acp-session-update.ts +2 -3
- package/src/api/events/acp-session-usage.ts +2 -3
- package/src/cli/commands/__tests__/ps.test.ts +205 -0
- package/src/cli/commands/ps.ts +89 -0
- package/src/cli/program.ts +2 -0
- package/src/memory/schema/acp.ts +2 -2
- package/src/providers/__tests__/retry-callsite.test.ts +30 -2
- package/src/providers/retry.ts +16 -0
- package/src/tools/registry.ts +11 -1
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from "../plugins/registry.js";
|
|
24
24
|
import { type HookFunction, type Plugin } from "../plugins/types.js";
|
|
25
25
|
import {
|
|
26
|
+
getAllToolDefinitions,
|
|
26
27
|
getPluginToolDefinitions,
|
|
27
28
|
registerPluginTools,
|
|
28
29
|
} from "../tools/registry.js";
|
|
@@ -148,6 +149,37 @@ describe("per-surface disabled-state filtering", () => {
|
|
|
148
149
|
expect(defs.some((d) => d.name === "test_tool")).toBe(true);
|
|
149
150
|
});
|
|
150
151
|
|
|
152
|
+
test("getAllToolDefinitions excludes tools from a disabled plugin", async () => {
|
|
153
|
+
// getAllToolDefinitions is the base tool snapshot the conversation tool
|
|
154
|
+
// resolver captures at creation. A plugin disabled BEFORE a new
|
|
155
|
+
// conversation starts must not leak its tools here — otherwise the
|
|
156
|
+
// resolver's core/plugin split (which reads the filtered
|
|
157
|
+
// getPluginToolDefinitions) misclassifies them as core and keeps them on
|
|
158
|
+
// the wire to the LLM, executable despite being hidden from the catalog.
|
|
159
|
+
const plugin: Plugin = {
|
|
160
|
+
manifest: { name: "default-test-base-snapshot", version: "1.0.0" },
|
|
161
|
+
tools: [makeFakeTool("base_snapshot_tool")],
|
|
162
|
+
};
|
|
163
|
+
registerPlugin(plugin);
|
|
164
|
+
registerPluginTools("default-test-base-snapshot", plugin.tools!);
|
|
165
|
+
|
|
166
|
+
// Before disabling: tool is part of the base snapshot.
|
|
167
|
+
let defs = getAllToolDefinitions();
|
|
168
|
+
expect(defs.some((d) => d.name === "base_snapshot_tool")).toBe(true);
|
|
169
|
+
|
|
170
|
+
// Disable via sentinel.
|
|
171
|
+
await createSentinel("default-test-base-snapshot");
|
|
172
|
+
|
|
173
|
+
// After disabling: tool drops from the base snapshot at read time.
|
|
174
|
+
defs = getAllToolDefinitions();
|
|
175
|
+
expect(defs.some((d) => d.name === "base_snapshot_tool")).toBe(false);
|
|
176
|
+
|
|
177
|
+
// Re-enable.
|
|
178
|
+
await removeSentinel("default-test-base-snapshot");
|
|
179
|
+
defs = getAllToolDefinitions();
|
|
180
|
+
expect(defs.some((d) => d.name === "base_snapshot_tool")).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
|
|
151
183
|
test("disabling one plugin does not affect others", async () => {
|
|
152
184
|
const pluginA = buildPlugin("default-test-alpha", {
|
|
153
185
|
"user-prompt-submit": () => Promise.resolve(),
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Server → client notification that an ACP session has finished its
|
|
5
5
|
* turn. `stopReason` mirrors the ACP `StopReason` set.
|
|
6
6
|
*
|
|
7
|
-
* Canonical wire-contract source.
|
|
8
|
-
*
|
|
9
|
-
* `@vellumai/assistant-api`.
|
|
7
|
+
* Canonical wire-contract source. Re-exported to external consumers via
|
|
8
|
+
* `@vellumai/assistant-api` (the `api/index.ts` barrel).
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
import { z } from "zod";
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Server → client notification that an ACP session has errored.
|
|
5
5
|
* Carries the session identity and a human-readable `error` message.
|
|
6
6
|
*
|
|
7
|
-
* Canonical wire-contract source.
|
|
8
|
-
*
|
|
9
|
-
* `@vellumai/assistant-api`.
|
|
7
|
+
* Canonical wire-contract source. Re-exported to external consumers via
|
|
8
|
+
* `@vellumai/assistant-api` (the `api/index.ts` barrel).
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
import { z } from "zod";
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* anchors the inline card to the `acp_spawn` tool-use block, and `task`
|
|
9
9
|
* carries the objective text.
|
|
10
10
|
*
|
|
11
|
-
* Canonical wire-contract source.
|
|
12
|
-
*
|
|
13
|
-
* `@vellumai/assistant-api`.
|
|
11
|
+
* Canonical wire-contract source. Re-exported to external consumers via
|
|
12
|
+
* `@vellumai/assistant-api` (the `api/index.ts` barrel).
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
import { z } from "zod";
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* since they apply only to the relevant `updateType`s. `messageId` and
|
|
8
8
|
* `seq` let clients correlate and order chunks within a session.
|
|
9
9
|
*
|
|
10
|
-
* Canonical wire-contract source.
|
|
11
|
-
*
|
|
12
|
-
* `@vellumai/assistant-api`.
|
|
10
|
+
* Canonical wire-contract source. Re-exported to external consumers via
|
|
11
|
+
* `@vellumai/assistant-api` (the `api/index.ts` barrel).
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import { z } from "zod";
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
* agent's cumulative cost. A side gauge, not part of the ordered update
|
|
10
10
|
* timeline — carries no `seq`.
|
|
11
11
|
*
|
|
12
|
-
* Canonical wire-contract source.
|
|
13
|
-
*
|
|
14
|
-
* `@vellumai/assistant-api`.
|
|
12
|
+
* Canonical wire-contract source. Re-exported to external consumers via
|
|
13
|
+
* `@vellumai/assistant-api` (the `api/index.ts` barrel).
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
16
|
import { z } from "zod";
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the `assistant ps` CLI command.
|
|
3
|
+
*
|
|
4
|
+
* Validates:
|
|
5
|
+
* - Calls the `ps` IPC method exactly once
|
|
6
|
+
* - Renders the daemon process tree (parent + indented children + status)
|
|
7
|
+
* - `--json` emits the raw route payload instead of the tree
|
|
8
|
+
* - IPC failures surface via exitFromIpcResult (non-zero exit)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
12
|
+
|
|
13
|
+
import { Command } from "commander";
|
|
14
|
+
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Mock state
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
let ipcCalls: Array<{ method: string }> = [];
|
|
20
|
+
let mockResponse: {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
result?: unknown;
|
|
23
|
+
error?: string;
|
|
24
|
+
statusCode?: number;
|
|
25
|
+
} = { ok: true, result: { processes: [] } };
|
|
26
|
+
|
|
27
|
+
let logLines: string[] = [];
|
|
28
|
+
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Mocks
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
mock.module("../../../ipc/cli-client.js", () => ({
|
|
34
|
+
cliIpcCall: async (method: string) => {
|
|
35
|
+
ipcCalls.push({ method });
|
|
36
|
+
return mockResponse;
|
|
37
|
+
},
|
|
38
|
+
exitFromIpcResult: (r: { error?: string }) => {
|
|
39
|
+
process.stderr.write((r.error ?? "error") + "\n");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
mock.module("../../../util/logger.js", () => ({
|
|
45
|
+
getLogger: () => ({
|
|
46
|
+
info: () => {},
|
|
47
|
+
warn: () => {},
|
|
48
|
+
error: () => {},
|
|
49
|
+
debug: () => {},
|
|
50
|
+
}),
|
|
51
|
+
getCliLogger: () => ({
|
|
52
|
+
info: (msg: string) => logLines.push(msg),
|
|
53
|
+
warn: () => {},
|
|
54
|
+
error: () => {},
|
|
55
|
+
debug: () => {},
|
|
56
|
+
}),
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Import module under test (after mocks)
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
const { registerPsCommand } = await import("../ps.js");
|
|
64
|
+
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Test helper
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
async function runPsCommand(
|
|
70
|
+
args: string[] = [],
|
|
71
|
+
): Promise<{ stdout: string; exitCode: number }> {
|
|
72
|
+
const stdoutChunks: string[] = [];
|
|
73
|
+
let capturedExitCode = 0;
|
|
74
|
+
let exitCalled = false;
|
|
75
|
+
|
|
76
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
77
|
+
const originalExit = process.exit.bind(process);
|
|
78
|
+
|
|
79
|
+
process.stdout.write = ((chunk: unknown) => {
|
|
80
|
+
stdoutChunks.push(typeof chunk === "string" ? chunk : String(chunk));
|
|
81
|
+
return true;
|
|
82
|
+
}) as typeof process.stdout.write;
|
|
83
|
+
|
|
84
|
+
(process as { exit: (code?: number) => never }).exit = ((code?: number) => {
|
|
85
|
+
capturedExitCode = code ?? 0;
|
|
86
|
+
exitCalled = true;
|
|
87
|
+
throw new Error(`process.exit(${code})`);
|
|
88
|
+
}) as typeof process.exit;
|
|
89
|
+
|
|
90
|
+
process.exitCode = 0;
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
const program = new Command();
|
|
94
|
+
program.exitOverride();
|
|
95
|
+
program.configureOutput({ writeErr: () => {}, writeOut: () => {} });
|
|
96
|
+
registerPsCommand(program);
|
|
97
|
+
await program.parseAsync(["node", "assistant", "ps", ...args]);
|
|
98
|
+
} catch (err) {
|
|
99
|
+
if (err instanceof Error && !err.message.startsWith("process.exit(")) {
|
|
100
|
+
// Commander parse errors; ignore
|
|
101
|
+
}
|
|
102
|
+
} finally {
|
|
103
|
+
process.stdout.write = originalStdoutWrite;
|
|
104
|
+
(process as { exit: (code?: number) => never }).exit = originalExit;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const exitCode = exitCalled ? capturedExitCode : (process.exitCode ?? 0);
|
|
108
|
+
process.exitCode = 0;
|
|
109
|
+
|
|
110
|
+
return { exitCode, stdout: stdoutChunks.join("") };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// Setup
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
beforeEach(() => {
|
|
118
|
+
ipcCalls = [];
|
|
119
|
+
logLines = [];
|
|
120
|
+
mockResponse = { ok: true, result: { processes: [] } };
|
|
121
|
+
process.exitCode = 0;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// Tests
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
describe("ps command — IPC wiring", () => {
|
|
129
|
+
test("calls the `ps` IPC method exactly once", async () => {
|
|
130
|
+
await runPsCommand();
|
|
131
|
+
expect(ipcCalls).toEqual([{ method: "ps" }]);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe("ps command — tree rendering", () => {
|
|
136
|
+
test("renders parent, indented children, and status labels", async () => {
|
|
137
|
+
mockResponse = {
|
|
138
|
+
ok: true,
|
|
139
|
+
result: {
|
|
140
|
+
processes: [
|
|
141
|
+
{
|
|
142
|
+
name: "assistant",
|
|
143
|
+
status: "running",
|
|
144
|
+
children: [
|
|
145
|
+
{ name: "qdrant", status: "running" },
|
|
146
|
+
{ name: "embed-worker", status: "not_running" },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
await runPsCommand();
|
|
154
|
+
const out = logLines.join("\n");
|
|
155
|
+
|
|
156
|
+
expect(out).toContain("assistant [running]");
|
|
157
|
+
expect(out).toContain(" qdrant [running]");
|
|
158
|
+
expect(out).toContain(" embed-worker [not running]");
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("appends info text when present", async () => {
|
|
162
|
+
mockResponse = {
|
|
163
|
+
ok: true,
|
|
164
|
+
result: {
|
|
165
|
+
processes: [
|
|
166
|
+
{ name: "qdrant", status: "unreachable", info: "probe timed out" },
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
await runPsCommand();
|
|
172
|
+
expect(logLines.join("\n")).toContain(
|
|
173
|
+
"qdrant [unreachable] — probe timed out",
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test("prints a placeholder when no processes are reported", async () => {
|
|
178
|
+
mockResponse = { ok: true, result: { processes: [] } };
|
|
179
|
+
await runPsCommand();
|
|
180
|
+
expect(logLines.join("\n")).toContain("No processes reported.");
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe("ps command — JSON output", () => {
|
|
185
|
+
test("--json emits the raw route payload, not the tree", async () => {
|
|
186
|
+
const result = {
|
|
187
|
+
processes: [{ name: "assistant", status: "running" }],
|
|
188
|
+
};
|
|
189
|
+
mockResponse = { ok: true, result };
|
|
190
|
+
|
|
191
|
+
const { stdout } = await runPsCommand(["--json"]);
|
|
192
|
+
|
|
193
|
+
expect(JSON.parse(stdout)).toEqual(result);
|
|
194
|
+
// Tree renderer should not have run.
|
|
195
|
+
expect(logLines.join("\n")).not.toContain("[running]");
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
describe("ps command — failures", () => {
|
|
200
|
+
test("exits non-zero when the IPC call fails", async () => {
|
|
201
|
+
mockResponse = { ok: false, error: "boom", statusCode: 500 };
|
|
202
|
+
const { exitCode } = await runPsCommand();
|
|
203
|
+
expect(exitCode).toBe(1);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command: `assistant ps`
|
|
3
|
+
*
|
|
4
|
+
* Thin IPC wrapper over the daemon's `ps` route. Renders the daemon's own
|
|
5
|
+
* process tree (the assistant runtime and its supervised subsystems —
|
|
6
|
+
* qdrant, embed-worker) to the console. The route owns the live probing;
|
|
7
|
+
* the CLI just forwards the request and formats the response.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Command } from "commander";
|
|
11
|
+
|
|
12
|
+
import { cliIpcCall, exitFromIpcResult } from "../../ipc/cli-client.js";
|
|
13
|
+
import { registerCommand } from "../lib/register-command.js";
|
|
14
|
+
import { log } from "../logger.js";
|
|
15
|
+
import { shouldOutputJson, writeOutput } from "../output.js";
|
|
16
|
+
|
|
17
|
+
interface ProcessEntry {
|
|
18
|
+
name: string;
|
|
19
|
+
status: "running" | "not_running" | "unreachable";
|
|
20
|
+
children?: ProcessEntry[];
|
|
21
|
+
info?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface PsResponse {
|
|
25
|
+
processes: ProcessEntry[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const STATUS_LABEL: Record<ProcessEntry["status"], string> = {
|
|
29
|
+
running: "running",
|
|
30
|
+
not_running: "not running",
|
|
31
|
+
unreachable: "unreachable",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Render one entry plus its children, indented to reflect tree depth. */
|
|
35
|
+
function renderEntry(entry: ProcessEntry, depth: number): void {
|
|
36
|
+
const indent = " ".repeat(depth);
|
|
37
|
+
const status = STATUS_LABEL[entry.status] ?? entry.status;
|
|
38
|
+
const info = entry.info ? ` — ${entry.info}` : "";
|
|
39
|
+
log.info(`${indent}${entry.name} [${status}]${info}`);
|
|
40
|
+
for (const child of entry.children ?? []) {
|
|
41
|
+
renderEntry(child, depth + 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function registerPsCommand(program: Command): void {
|
|
46
|
+
registerCommand(program, {
|
|
47
|
+
name: "ps",
|
|
48
|
+
transport: "ipc",
|
|
49
|
+
description:
|
|
50
|
+
"Show the assistant daemon's process tree and subsystem health",
|
|
51
|
+
build: (ps) => {
|
|
52
|
+
ps.option("--json", "Machine-readable JSON output").addHelpText(
|
|
53
|
+
"after",
|
|
54
|
+
`
|
|
55
|
+
Reports the daemon's own process tree: the assistant runtime plus its
|
|
56
|
+
supervised subsystems (qdrant vector store, embed-worker). Each subsystem
|
|
57
|
+
status is probed live — qdrant via its readiness endpoint, embed-worker via
|
|
58
|
+
PID-file liveness — so a status of "unreachable" means the probe itself
|
|
59
|
+
failed rather than the process being confirmed down.
|
|
60
|
+
|
|
61
|
+
Examples:
|
|
62
|
+
$ assistant ps
|
|
63
|
+
$ assistant ps --json`,
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
ps.action(async (_opts, cmd: Command) => {
|
|
67
|
+
const r = await cliIpcCall<PsResponse>("ps");
|
|
68
|
+
if (!r.ok) return exitFromIpcResult(r);
|
|
69
|
+
|
|
70
|
+
if (shouldOutputJson(cmd)) {
|
|
71
|
+
writeOutput(cmd, r.result);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const processes = r.result?.processes ?? [];
|
|
76
|
+
if (processes.length === 0) {
|
|
77
|
+
log.info("No processes reported.");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
log.info("");
|
|
82
|
+
for (const entry of processes) {
|
|
83
|
+
renderEntry(entry, 0);
|
|
84
|
+
}
|
|
85
|
+
log.info("");
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}
|
package/src/cli/program.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { registerOAuthCommand } from "./commands/oauth/index.js";
|
|
|
40
40
|
import { registerPendingCommand } from "./commands/pending.js";
|
|
41
41
|
import { registerPlatformCommand } from "./commands/platform/index.js";
|
|
42
42
|
import { registerPluginsCommand } from "./commands/plugins.js";
|
|
43
|
+
import { registerPsCommand } from "./commands/ps.js";
|
|
43
44
|
import { registerRoutesCommand } from "./commands/routes.js";
|
|
44
45
|
import { registerSchedulesCommand } from "./commands/schedules.js";
|
|
45
46
|
import { registerSequenceCommand } from "./commands/sequence.js";
|
|
@@ -137,6 +138,7 @@ Examples:
|
|
|
137
138
|
if (isExternalPluginsEnabled(getConfigReadOnly())) {
|
|
138
139
|
registerPluginsCommand(program);
|
|
139
140
|
}
|
|
141
|
+
registerPsCommand(program);
|
|
140
142
|
registerRoutesCommand(program);
|
|
141
143
|
registerSchedulesCommand(program);
|
|
142
144
|
registerSequenceCommand(program);
|
package/src/memory/schema/acp.ts
CHANGED
|
@@ -30,7 +30,7 @@ export const acpSessionHistory = sqliteTable(
|
|
|
30
30
|
// resume a persisted session; null for rows written before migration
|
|
31
31
|
// 272 (those sessions are not resumable).
|
|
32
32
|
cwd: text("cwd"),
|
|
33
|
-
// Usage metadata. Null for rows written before
|
|
33
|
+
// Usage metadata. Null for rows written before these columns existed.
|
|
34
34
|
task: text("task"),
|
|
35
35
|
parentToolUseId: text("parent_tool_use_id"),
|
|
36
36
|
usedTokens: integer("used_tokens"),
|
|
@@ -38,7 +38,7 @@ export const acpSessionHistory = sqliteTable(
|
|
|
38
38
|
costAmount: real("cost_amount"),
|
|
39
39
|
costCurrency: text("cost_currency"),
|
|
40
40
|
// Cumulative input/output tokens across all turns. Null for rows written
|
|
41
|
-
// before
|
|
41
|
+
// before these columns existed.
|
|
42
42
|
inputTokens: integer("input_tokens"),
|
|
43
43
|
outputTokens: integer("output_tokens"),
|
|
44
44
|
},
|
|
@@ -481,7 +481,7 @@ describe("RetryProvider — callSite resolution", () => {
|
|
|
481
481
|
expect("top_p" in config).toBe(false);
|
|
482
482
|
});
|
|
483
483
|
|
|
484
|
-
test("strips
|
|
484
|
+
test("strips unsupported speed and thinking fields for Fireworks", async () => {
|
|
485
485
|
setLlmConfig({
|
|
486
486
|
default: {
|
|
487
487
|
provider: "anthropic",
|
|
@@ -495,7 +495,8 @@ describe("RetryProvider — callSite resolution", () => {
|
|
|
495
495
|
});
|
|
496
496
|
|
|
497
497
|
let seen: SendMessageOptions | undefined;
|
|
498
|
-
//
|
|
498
|
+
// Fireworks uses the OpenAI-compatible transport; speed and thinking stay
|
|
499
|
+
// out of the downstream config.
|
|
499
500
|
const wrapped = new RetryProvider(
|
|
500
501
|
makeProvider("fireworks", (options) => {
|
|
501
502
|
seen = options;
|
|
@@ -513,6 +514,33 @@ describe("RetryProvider — callSite resolution", () => {
|
|
|
513
514
|
expect(config.model).toBe("claude-opus-4-7");
|
|
514
515
|
});
|
|
515
516
|
|
|
517
|
+
test("disabled thinking forces effort none before Fireworks strips thinking", async () => {
|
|
518
|
+
setLlmConfig({
|
|
519
|
+
default: {
|
|
520
|
+
provider: "fireworks",
|
|
521
|
+
model: "accounts/fireworks/models/glm-5p2",
|
|
522
|
+
effort: "high",
|
|
523
|
+
thinking: { enabled: false, streamThinking: false },
|
|
524
|
+
},
|
|
525
|
+
callSites: { mainAgent: {} },
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
let seen: SendMessageOptions | undefined;
|
|
529
|
+
const wrapped = new RetryProvider(
|
|
530
|
+
makeProvider("fireworks", (options) => {
|
|
531
|
+
seen = options;
|
|
532
|
+
}),
|
|
533
|
+
);
|
|
534
|
+
|
|
535
|
+
await wrapped.sendMessage(DUMMY_MESSAGES, {
|
|
536
|
+
config: { callSite: "mainAgent" },
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
const config = seen?.config as Record<string, unknown>;
|
|
540
|
+
expect(config.thinking).toBeUndefined();
|
|
541
|
+
expect(config.effort).toBe("none");
|
|
542
|
+
});
|
|
543
|
+
|
|
516
544
|
test("preserves thinking + level for Gemini provider", async () => {
|
|
517
545
|
setLlmConfig({
|
|
518
546
|
default: {
|
package/src/providers/retry.ts
CHANGED
|
@@ -47,6 +47,15 @@ const EFFORT_SUPPORTED_PROVIDERS = new Set([
|
|
|
47
47
|
"together",
|
|
48
48
|
]);
|
|
49
49
|
|
|
50
|
+
// For these providers, disabling reasoning is encoded through the same effort
|
|
51
|
+
// knob their transports send on the wire. Non-"none" tiers can still vary by
|
|
52
|
+
// model and are handled by the provider client.
|
|
53
|
+
const DISABLED_THINKING_USES_EFFORT_PROVIDERS = new Set([
|
|
54
|
+
"openai",
|
|
55
|
+
"fireworks",
|
|
56
|
+
"together",
|
|
57
|
+
]);
|
|
58
|
+
|
|
50
59
|
/**
|
|
51
60
|
* Providers that consume the `thinking` config. Anthropic uses it directly on
|
|
52
61
|
* the wire; OpenRouter either forwards it to its Anthropic-compatible path or
|
|
@@ -347,6 +356,13 @@ function normalizeSendMessageOptions(
|
|
|
347
356
|
}
|
|
348
357
|
}
|
|
349
358
|
|
|
359
|
+
if (
|
|
360
|
+
isThinkingConfigDisabled(nextConfig.thinking) &&
|
|
361
|
+
DISABLED_THINKING_USES_EFFORT_PROVIDERS.has(providerName)
|
|
362
|
+
) {
|
|
363
|
+
nextConfig.effort = "none";
|
|
364
|
+
}
|
|
365
|
+
|
|
350
366
|
// Claude Fable always reasons with adaptive thinking and rejects an explicit
|
|
351
367
|
// `thinking: { type: "disabled" }` (Anthropic 400s the request). Drop a
|
|
352
368
|
// disabled thinking config for these models so they fall back to their
|
package/src/tools/registry.ts
CHANGED
|
@@ -918,7 +918,17 @@ export function getAllToolDefinitions(): Tool[] {
|
|
|
918
918
|
// the base tool list, which is shared across sessions via the global
|
|
919
919
|
// registry. Including them here causes "Tool names must be unique"
|
|
920
920
|
// errors when the projection appends the same tools a second time.
|
|
921
|
-
|
|
921
|
+
//
|
|
922
|
+
// Build on `getEnabledTools()` so tools from a disabled plugin are also
|
|
923
|
+
// excluded. This is the base snapshot the conversation tool resolver
|
|
924
|
+
// captures at creation: a plugin disabled BEFORE a new conversation is
|
|
925
|
+
// created would otherwise leak its tools here, and because the resolver's
|
|
926
|
+
// core/plugin split reads the (filtered) `getPluginToolDefinitions()`, the
|
|
927
|
+
// disabled plugin's tools would be misclassified as core and stay on the
|
|
928
|
+
// wire to the LLM — executable even though `assistant tools list` reports
|
|
929
|
+
// them gone. Filtering here keeps the executable surface and the listing
|
|
930
|
+
// in lockstep.
|
|
931
|
+
return getEnabledTools().filter(
|
|
922
932
|
(t) => ownersByName.get(t.name)?.kind !== "skill",
|
|
923
933
|
);
|
|
924
934
|
}
|