@vellumai/assistant 0.11.8-dev.202609031226.a37d2ae → 0.11.8-dev.202609031519.e55839f
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/openapi.yaml +38 -3
- package/package.json +1 -1
- package/src/__tests__/compactor-assistant-tail-preview.test.ts +111 -0
- package/src/__tests__/compactor-tail-resolution.test.ts +116 -0
- package/src/__tests__/config-loader-validation-reset-notice.test.ts +47 -15
- package/src/__tests__/gemini-provider.test.ts +46 -0
- package/src/__tests__/llm-schema.test.ts +38 -2
- package/src/__tests__/pricing.test.ts +11 -0
- package/src/cli/__tests__/catalog-search-help.test.ts +6 -0
- package/src/cli/commands/channels/index.help.ts +4 -5
- package/src/cli/commands/platform/__tests__/credits-format.test.ts +63 -0
- package/src/cli/commands/platform/__tests__/credits.test.ts +10 -0
- package/src/cli/commands/platform/credits-format.ts +51 -0
- package/src/cli/commands/platform/index.help.ts +17 -11
- package/src/cli/commands/platform/index.ts +7 -18
- package/src/cli/lib/__tests__/cli-output.test.ts +5 -0
- package/src/cli/lib/cli-output.ts +6 -6
- package/src/config/schemas/llm.ts +34 -7
- package/src/context/compactor.ts +12 -13
- package/src/daemon/handlers/config-model.test.ts +1 -0
- package/src/plugins/defaults/memory/substrate/__tests__/skill-content.test.ts +17 -0
- package/src/plugins/defaults/memory/substrate/skill-content.ts +7 -0
- package/src/plugins/defaults/memory/v3/__tests__/render-injection.test.ts +22 -0
- package/src/plugins/defaults/memory/v3/prune.test.ts +20 -2
- package/src/plugins/defaults/memory/v3/render-injection.ts +10 -1
- package/src/providers/gemini/client.ts +3 -2
- package/src/providers/model-catalog.ts +16 -0
- package/src/runtime/routes/__tests__/platform-credits-routes.test.ts +145 -0
- package/src/runtime/routes/platform-routes.ts +58 -3
package/openapi.yaml
CHANGED
|
@@ -24453,10 +24453,12 @@ paths:
|
|
|
24453
24453
|
/v1/platform/credits:
|
|
24454
24454
|
get:
|
|
24455
24455
|
operationId: platform_credits_get
|
|
24456
|
-
summary: Get the organization's remaining credit balance
|
|
24456
|
+
summary: Get the organization's remaining credit balance and daily-limit state
|
|
24457
24457
|
description:
|
|
24458
|
-
Fetches the org's settled, pending, and effective (remaining) credit balance in USD from the platform
|
|
24459
|
-
billing summary
|
|
24458
|
+
"Fetches the org's settled, pending, and effective (remaining) credit balance in USD from the platform
|
|
24459
|
+
billing summary, plus the daily-limit state: today's spend counted against the daily credit limit (which
|
|
24460
|
+
excludes spend covered by plan-included credits, so it is not total spend), the limit itself, and the
|
|
24461
|
+
low-balance warning state."
|
|
24460
24462
|
tags:
|
|
24461
24463
|
- platform
|
|
24462
24464
|
responses:
|
|
@@ -24480,6 +24482,33 @@ paths:
|
|
|
24480
24482
|
type: boolean
|
|
24481
24483
|
as_of:
|
|
24482
24484
|
type: string
|
|
24485
|
+
daily_spend:
|
|
24486
|
+
anyOf:
|
|
24487
|
+
- type: number
|
|
24488
|
+
- type: "null"
|
|
24489
|
+
description:
|
|
24490
|
+
Today's (UTC) spend counted against the daily credit limit, in USD. Excludes spend covered by plan-included
|
|
24491
|
+
credits (initial credit, Pro credit bundle), so it is not total spend. Null when the platform did
|
|
24492
|
+
not report it.
|
|
24493
|
+
daily_limit:
|
|
24494
|
+
anyOf:
|
|
24495
|
+
- type: number
|
|
24496
|
+
- type: "null"
|
|
24497
|
+
description: Daily credit limit in USD, or null when none is set.
|
|
24498
|
+
daily_limit_reached:
|
|
24499
|
+
type: boolean
|
|
24500
|
+
description: True when today's spend has reached the daily limit and the limit is being enforced.
|
|
24501
|
+
daily_limit_snoozed:
|
|
24502
|
+
type: boolean
|
|
24503
|
+
description: True when the daily limit has been skipped for the rest of the current UTC day.
|
|
24504
|
+
low_balance_threshold:
|
|
24505
|
+
anyOf:
|
|
24506
|
+
- type: number
|
|
24507
|
+
- type: "null"
|
|
24508
|
+
description: Low-balance alert threshold in USD.
|
|
24509
|
+
low_balance_warning:
|
|
24510
|
+
type: boolean
|
|
24511
|
+
description: True when the balance is above zero but below the low-balance threshold and auto top-up is not enabled.
|
|
24483
24512
|
required:
|
|
24484
24513
|
- remaining
|
|
24485
24514
|
- settled
|
|
@@ -24487,6 +24516,12 @@ paths:
|
|
|
24487
24516
|
- unit
|
|
24488
24517
|
- stale
|
|
24489
24518
|
- as_of
|
|
24519
|
+
- daily_spend
|
|
24520
|
+
- daily_limit
|
|
24521
|
+
- daily_limit_reached
|
|
24522
|
+
- daily_limit_snoozed
|
|
24523
|
+
- low_balance_threshold
|
|
24524
|
+
- low_balance_warning
|
|
24490
24525
|
additionalProperties: false
|
|
24491
24526
|
/v1/platform/disconnect:
|
|
24492
24527
|
post:
|
package/package.json
CHANGED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-chosen `<tail_start>` can point at an assistant turn (preview of
|
|
3
|
+
* assistant text, timestamp that matches no `<turn_context>`). Preview
|
|
4
|
+
* matching must accept that hit and let the tool-pairing walk land on the
|
|
5
|
+
* preceding clean user message, instead of aborting the compaction.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, mock, test } from "bun:test";
|
|
8
|
+
|
|
9
|
+
mock.module("../persistence/conversation-crud.js", () => ({
|
|
10
|
+
setConversationProcessingStartedAt: () => {},
|
|
11
|
+
isConversationProcessing: () => false,
|
|
12
|
+
getMessages: () => [],
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
mock.module("../persistence/attachments-store.js", () => ({
|
|
16
|
+
getAttachmentMetadataForMessage: () => [],
|
|
17
|
+
getAttachmentContent: () => null,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
mock.module("../persistence/llm-request-log-store.js", () => ({
|
|
21
|
+
recordRequestLog: () => {},
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
import { runAssistantDrivenCompaction } from "../context/compactor.js";
|
|
25
|
+
import type { Message, Provider } from "../providers/types.js";
|
|
26
|
+
|
|
27
|
+
function userTurn(body: string): Message {
|
|
28
|
+
return {
|
|
29
|
+
role: "user",
|
|
30
|
+
content: [
|
|
31
|
+
{
|
|
32
|
+
type: "text",
|
|
33
|
+
text: `<turn_context>\ncurrent_time: 2026-05-21 (Thursday) 10:00:00 -05:00 (America/Chicago)\n</turn_context>\n${body}`,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function assistantTurn(body: string): Message {
|
|
40
|
+
return {
|
|
41
|
+
role: "assistant",
|
|
42
|
+
content: [{ type: "text", text: body }],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function makeProvider(response: string): Provider {
|
|
47
|
+
return {
|
|
48
|
+
name: "mock-provider",
|
|
49
|
+
sendMessage: async () => ({
|
|
50
|
+
content: [{ type: "text", text: response }],
|
|
51
|
+
model: "mock-model",
|
|
52
|
+
usage: { inputTokens: 100, outputTokens: 50 },
|
|
53
|
+
stopReason: "end_turn",
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const ASSISTANT_PREVIEW =
|
|
59
|
+
"Found the duplicate. Let me fix it - replace one duplicate w";
|
|
60
|
+
|
|
61
|
+
describe("runAssistantDrivenCompaction: assistant tail_start preview", () => {
|
|
62
|
+
test("compacts when the model previews an assistant turn and the timestamp misses", async () => {
|
|
63
|
+
const messages: Message[] = [
|
|
64
|
+
userTurn("Alice: please set this up"),
|
|
65
|
+
assistantTurn("Setup is done."),
|
|
66
|
+
userTurn("Alice: please dedupe the list"),
|
|
67
|
+
assistantTurn(
|
|
68
|
+
"Found the duplicate. Let me fix it - replace one duplicate with a single entry.",
|
|
69
|
+
),
|
|
70
|
+
userTurn("Alice: thanks"),
|
|
71
|
+
assistantTurn("Done."),
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const provider = makeProvider(`<compaction_result>
|
|
75
|
+
<summary>
|
|
76
|
+
Alice asked to dedupe a list. Earlier setup is complete.
|
|
77
|
+
</summary>
|
|
78
|
+
<key_state>
|
|
79
|
+
- Dedupe in progress
|
|
80
|
+
</key_state>
|
|
81
|
+
<tail_start timestamp="1999-01-01 00:00:00" preview="${ASSISTANT_PREVIEW}" />
|
|
82
|
+
</compaction_result>`);
|
|
83
|
+
|
|
84
|
+
const result = await runAssistantDrivenCompaction({
|
|
85
|
+
conversationId: "conv-test",
|
|
86
|
+
messages,
|
|
87
|
+
provider,
|
|
88
|
+
systemPrompt: "system",
|
|
89
|
+
compaction: { enabled: true, autoThreshold: 0.7 },
|
|
90
|
+
maxInputTokens: 100_000,
|
|
91
|
+
previousEstimatedInputTokens: 90_000,
|
|
92
|
+
force: true,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
expect(result.reason).not.toBe("tail_start unresolved");
|
|
96
|
+
expect(result.compacted).toBe(true);
|
|
97
|
+
// Assistant hit at index 3 walks back to the preceding user at index 2.
|
|
98
|
+
expect(result.compactedMessages).toBe(2);
|
|
99
|
+
const tail = result.messages.slice(1);
|
|
100
|
+
expect(tail[0]?.role).toBe("user");
|
|
101
|
+
const tailText =
|
|
102
|
+
tail[0] && "content" in tail[0]
|
|
103
|
+
? tail[0].content
|
|
104
|
+
.filter((b) => b.type === "text")
|
|
105
|
+
.map((b) => ("text" in b ? b.text : ""))
|
|
106
|
+
.join("")
|
|
107
|
+
: "";
|
|
108
|
+
expect(tailText).toContain("please dedupe the list");
|
|
109
|
+
expect(tail[1]?.role).toBe("assistant");
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -3,6 +3,9 @@ import { describe, expect, it } from "bun:test";
|
|
|
3
3
|
import {
|
|
4
4
|
adjustTailIndexForToolPairing,
|
|
5
5
|
canonicalDateTimeKey,
|
|
6
|
+
parseCompactionResult,
|
|
7
|
+
type ParsedCompactionResult,
|
|
8
|
+
resolveTailStartIndex,
|
|
6
9
|
} from "../context/compactor.js";
|
|
7
10
|
import type { Message } from "../providers/types.js";
|
|
8
11
|
|
|
@@ -145,3 +148,116 @@ describe("adjustTailIndexForToolPairing", () => {
|
|
|
145
148
|
expect(adjustTailIndexForToolPairing(messages, 0)).toBe(0);
|
|
146
149
|
});
|
|
147
150
|
});
|
|
151
|
+
|
|
152
|
+
function parsedTail(
|
|
153
|
+
timestamp: string,
|
|
154
|
+
preview: string,
|
|
155
|
+
): ParsedCompactionResult {
|
|
156
|
+
return {
|
|
157
|
+
summary: "summary",
|
|
158
|
+
keyState: "",
|
|
159
|
+
retainedImageFilenames: [],
|
|
160
|
+
tailStartTimestamp: timestamp,
|
|
161
|
+
tailStartPreview: preview,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
describe("resolveTailStartIndex", () => {
|
|
166
|
+
const storedTs = "2026-04-02 (Thursday) 01:52:33 -05:00 (America/Chicago)";
|
|
167
|
+
const userWithTs: Message = {
|
|
168
|
+
role: "user",
|
|
169
|
+
content: [
|
|
170
|
+
{
|
|
171
|
+
type: "text",
|
|
172
|
+
text: `<turn_context>\ncurrent_time: ${storedTs}\n</turn_context>\nACK received. Continue.`,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
it("matches a user preview", () => {
|
|
178
|
+
const messages: Message[] = [
|
|
179
|
+
userText("setup"),
|
|
180
|
+
assistantText("ok"),
|
|
181
|
+
userWithTs,
|
|
182
|
+
assistantText("working"),
|
|
183
|
+
];
|
|
184
|
+
const timestamps = messages.map((m) =>
|
|
185
|
+
m.role === "user" && m === userWithTs ? storedTs : null,
|
|
186
|
+
);
|
|
187
|
+
expect(
|
|
188
|
+
resolveTailStartIndex(
|
|
189
|
+
messages,
|
|
190
|
+
timestamps,
|
|
191
|
+
parsedTail("", "ACK received. Continue."),
|
|
192
|
+
),
|
|
193
|
+
).toBe(2);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it("matches an assistant preview when the timestamp misses", () => {
|
|
197
|
+
const assistant = assistantText(
|
|
198
|
+
"Found the duplicate. Let me fix it - replace one duplicate with a single entry.",
|
|
199
|
+
);
|
|
200
|
+
const messages: Message[] = [
|
|
201
|
+
userText("setup"),
|
|
202
|
+
assistantText("earlier reply"),
|
|
203
|
+
userText("please dedupe"),
|
|
204
|
+
assistant,
|
|
205
|
+
userText("thanks"),
|
|
206
|
+
];
|
|
207
|
+
const timestamps = messages.map(() => null);
|
|
208
|
+
expect(
|
|
209
|
+
resolveTailStartIndex(
|
|
210
|
+
messages,
|
|
211
|
+
timestamps,
|
|
212
|
+
parsedTail(
|
|
213
|
+
"1999-01-01 00:00:00",
|
|
214
|
+
"Found the duplicate. Let me fix it - replace one duplicate w",
|
|
215
|
+
),
|
|
216
|
+
),
|
|
217
|
+
).toBe(3);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("returns null when neither timestamp nor preview matches", () => {
|
|
221
|
+
const messages: Message[] = [
|
|
222
|
+
userText("hello"),
|
|
223
|
+
assistantText("hi there"),
|
|
224
|
+
];
|
|
225
|
+
expect(
|
|
226
|
+
resolveTailStartIndex(
|
|
227
|
+
messages,
|
|
228
|
+
[null, null],
|
|
229
|
+
parsedTail("1999-01-01 00:00:00", "no such text in this history"),
|
|
230
|
+
),
|
|
231
|
+
).toBeNull();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe("parseCompactionResult tail_start", () => {
|
|
236
|
+
const summaryBlock = `<compaction_result>
|
|
237
|
+
<summary>
|
|
238
|
+
Earlier work, in my voice.
|
|
239
|
+
</summary>
|
|
240
|
+
<key_state>
|
|
241
|
+
- pending
|
|
242
|
+
</key_state>
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
it("accepts a preview-only tail_start", () => {
|
|
246
|
+
const parsed = parseCompactionResult(
|
|
247
|
+
`${summaryBlock}<tail_start preview="Found the duplicate. Let me fix it" />
|
|
248
|
+
</compaction_result>`,
|
|
249
|
+
);
|
|
250
|
+
expect(parsed).not.toBeNull();
|
|
251
|
+
expect(parsed?.tailStartTimestamp).toBe("");
|
|
252
|
+
expect(parsed?.tailStartPreview).toBe(
|
|
253
|
+
"Found the duplicate. Let me fix it",
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("rejects a tail_start with neither timestamp nor preview", () => {
|
|
258
|
+
expect(
|
|
259
|
+
parseCompactionResult(`${summaryBlock}<tail_start />
|
|
260
|
+
</compaction_result>`),
|
|
261
|
+
).toBeNull();
|
|
262
|
+
});
|
|
263
|
+
});
|
|
@@ -7,12 +7,10 @@
|
|
|
7
7
|
* the agent so a setting that silently reverted (e.g. a managed Outlook/OAuth
|
|
8
8
|
* service mode) becomes explainable — matching LUM-2758.
|
|
9
9
|
*
|
|
10
|
-
* The revealing case:
|
|
11
|
-
* `
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* `superRefine` violation (here an `activeProfile` referencing a profile that
|
|
15
|
-
* doesn't exist); the retry fails and the whole config resets to defaults.
|
|
10
|
+
* The revealing case: a wrong-type `llm.profiles` fails the first parse so
|
|
11
|
+
* `superRefine` never runs. The loader strips it and re-parses, which unmasks
|
|
12
|
+
* a latent `activeProfile` / call-site reference to a profile that does not
|
|
13
|
+
* exist; the retry fails and the whole config resets to defaults.
|
|
16
14
|
*/
|
|
17
15
|
|
|
18
16
|
import {
|
|
@@ -65,10 +63,10 @@ function readNotice(): { resetAt: string; invalidPaths: string[] } {
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
|
-
* A config.json that parses as JSON but forces the
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
66
|
+
* A config.json that parses as JSON but forces the salvage ladder: a
|
|
67
|
+
* wrong-type `llm.profiles` fails the first parse (so superRefine never
|
|
68
|
+
* runs), and stripping it unmasks ghost `activeProfile` / call-site refs
|
|
69
|
+
* on the retry.
|
|
72
70
|
*/
|
|
73
71
|
function writeFullResetConfig(): void {
|
|
74
72
|
writeFileSync(
|
|
@@ -78,9 +76,10 @@ function writeFullResetConfig(): void {
|
|
|
78
76
|
provider: "anthropic",
|
|
79
77
|
model: "claude-opus-4-7",
|
|
80
78
|
llm: {
|
|
79
|
+
profiles: "not-an-object",
|
|
81
80
|
activeProfile: "ghostActive",
|
|
82
81
|
callSites: {
|
|
83
|
-
|
|
82
|
+
mainAgent: { profile: "ghostActive" },
|
|
84
83
|
},
|
|
85
84
|
},
|
|
86
85
|
},
|
|
@@ -110,11 +109,9 @@ describe("config-validation-reset notice sentinel", () => {
|
|
|
110
109
|
expect(existsSync(NOTICE_PATH)).toBe(true);
|
|
111
110
|
const notice = readNotice();
|
|
112
111
|
expect(Number.isNaN(Date.parse(notice.resetAt))).toBe(false);
|
|
113
|
-
// Records both the
|
|
112
|
+
// Records both the first-parse type error and the unmasked retry violation.
|
|
114
113
|
expect(notice.invalidPaths).toContain("llm.activeProfile");
|
|
115
|
-
expect(notice.invalidPaths).toContain(
|
|
116
|
-
"llm.callSites.proactiveArtifactDecision",
|
|
117
|
-
);
|
|
114
|
+
expect(notice.invalidPaths).toContain("llm.profiles");
|
|
118
115
|
// The on-disk config is left intact for recovery — not quarantined/rewritten.
|
|
119
116
|
expect(existsSync(CONFIG_PATH)).toBe(true);
|
|
120
117
|
});
|
|
@@ -165,6 +162,41 @@ describe("config-validation-reset notice sentinel", () => {
|
|
|
165
162
|
expect(existsSync(NOTICE_PATH)).toBe(false);
|
|
166
163
|
});
|
|
167
164
|
|
|
165
|
+
test("unknown call-site keys with a defined profile do not write a sentinel", () => {
|
|
166
|
+
writeFileSync(
|
|
167
|
+
CONFIG_PATH,
|
|
168
|
+
JSON.stringify(
|
|
169
|
+
{
|
|
170
|
+
llm: {
|
|
171
|
+
profiles: {
|
|
172
|
+
"glm-default": {
|
|
173
|
+
provider: "vellum",
|
|
174
|
+
model: "accounts/fireworks/models/glm-5p2",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
activeProfile: "glm-default",
|
|
178
|
+
callSites: {
|
|
179
|
+
mainAgent: { profile: "glm-default" },
|
|
180
|
+
proactiveArtifactDecision: { profile: "glm-default" },
|
|
181
|
+
meetConsentMonitor: { profile: "glm-default" },
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
null,
|
|
186
|
+
2,
|
|
187
|
+
),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const config = loadConfig();
|
|
191
|
+
|
|
192
|
+
expect(existsSync(NOTICE_PATH)).toBe(false);
|
|
193
|
+
expect(config.llm.activeProfile).toBe("glm-default");
|
|
194
|
+
expect(config.llm.callSites.mainAgent?.profile).toBe("glm-default");
|
|
195
|
+
expect(config.llm.profiles["glm-default"]?.model).toBe(
|
|
196
|
+
"accounts/fireworks/models/glm-5p2",
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
168
200
|
test("a later clean load clears a stale reset sentinel", () => {
|
|
169
201
|
// First: force a reset so the sentinel exists.
|
|
170
202
|
writeFullResetConfig();
|
|
@@ -467,6 +467,52 @@ describe("GeminiProvider", () => {
|
|
|
467
467
|
});
|
|
468
468
|
});
|
|
469
469
|
|
|
470
|
+
test("3.8 Flash: disabled maps to the LOW floor, not MINIMAL", async () => {
|
|
471
|
+
fakeChunks = [textChunk("OK"), finishChunk("STOP", 10, 2)];
|
|
472
|
+
|
|
473
|
+
const flash38Provider = new GeminiProvider(
|
|
474
|
+
"test-api-key",
|
|
475
|
+
"gemini-3.8-flash",
|
|
476
|
+
);
|
|
477
|
+
await flash38Provider.sendMessage(
|
|
478
|
+
[{ role: "user", content: [{ type: "text", text: "Hi" }] }],
|
|
479
|
+
{ config: { thinking: { type: "disabled" } } },
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
const config = lastStreamParams!.config as Record<string, unknown>;
|
|
483
|
+
expect(config.thinkingConfig).toEqual({
|
|
484
|
+
thinkingLevel: "LOW",
|
|
485
|
+
includeThoughts: false,
|
|
486
|
+
});
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
test("3.8 Flash: an explicit minimal level is clamped up to LOW", async () => {
|
|
490
|
+
fakeChunks = [textChunk("OK"), finishChunk("STOP", 10, 2)];
|
|
491
|
+
|
|
492
|
+
const flash38Provider = new GeminiProvider(
|
|
493
|
+
"test-api-key",
|
|
494
|
+
"models/gemini-3.8-flash",
|
|
495
|
+
);
|
|
496
|
+
await flash38Provider.sendMessage(
|
|
497
|
+
[{ role: "user", content: [{ type: "text", text: "Hi" }] }],
|
|
498
|
+
{
|
|
499
|
+
config: {
|
|
500
|
+
thinking: {
|
|
501
|
+
type: "adaptive",
|
|
502
|
+
level: "minimal",
|
|
503
|
+
streamThinking: false,
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
const config = lastStreamParams!.config as Record<string, unknown>;
|
|
510
|
+
expect(config.thinkingConfig).toEqual({
|
|
511
|
+
thinkingLevel: "LOW",
|
|
512
|
+
includeThoughts: false,
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
|
|
470
516
|
test("Pro: a supported explicit level passes through unchanged", async () => {
|
|
471
517
|
fakeChunks = [textChunk("OK"), finishChunk("STOP", 10, 2)];
|
|
472
518
|
|
|
@@ -177,14 +177,50 @@ describe("LLMSchema", () => {
|
|
|
177
177
|
expect(result.success).toBe(true);
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
test("unknown call-site key (typo)
|
|
180
|
+
test("unknown call-site key is ignored (version-skew / typo)", () => {
|
|
181
181
|
const result = LLMSchema.safeParse({
|
|
182
182
|
callSites: {
|
|
183
183
|
// typo of `mainAgent`
|
|
184
184
|
mainAgnt: { temperature: 0.5 },
|
|
185
185
|
},
|
|
186
186
|
});
|
|
187
|
-
expect(result.success).toBe(
|
|
187
|
+
expect(result.success).toBe(true);
|
|
188
|
+
if (result.success) {
|
|
189
|
+
expect(
|
|
190
|
+
(result.data.callSites as Record<string, unknown>).mainAgnt,
|
|
191
|
+
).toBeUndefined();
|
|
192
|
+
expect(result.data.callSites.mainAgent).toBeUndefined();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test("unknown call-site keys do not mask a defined profile referenced by known sites", () => {
|
|
197
|
+
const result = LLMSchema.safeParse({
|
|
198
|
+
profiles: {
|
|
199
|
+
"glm-default": {
|
|
200
|
+
provider: "vellum",
|
|
201
|
+
model: "accounts/fireworks/models/glm-5p2",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
activeProfile: "glm-default",
|
|
205
|
+
callSites: {
|
|
206
|
+
mainAgent: { profile: "glm-default" },
|
|
207
|
+
heartbeatAgent: { profile: "glm-default" },
|
|
208
|
+
proactiveArtifactDecision: { profile: "glm-default" },
|
|
209
|
+
proactiveArtifactBuild: { profile: "glm-default" },
|
|
210
|
+
meetConsentMonitor: { profile: "glm-default" },
|
|
211
|
+
meetChatOpportunity: { profile: "glm-default" },
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
expect(result.success).toBe(true);
|
|
215
|
+
if (result.success) {
|
|
216
|
+
expect(result.data.activeProfile).toBe("glm-default");
|
|
217
|
+
expect(result.data.callSites.mainAgent?.profile).toBe("glm-default");
|
|
218
|
+
expect(result.data.callSites.heartbeatAgent?.profile).toBe("glm-default");
|
|
219
|
+
expect(
|
|
220
|
+
(result.data.callSites as Record<string, unknown>)
|
|
221
|
+
.proactiveArtifactDecision,
|
|
222
|
+
).toBeUndefined();
|
|
223
|
+
}
|
|
188
224
|
});
|
|
189
225
|
|
|
190
226
|
test("thinking partial override accepted (only `enabled`, no `streamThinking`)", () => {
|
|
@@ -224,6 +224,17 @@ describe("resolvePricing", () => {
|
|
|
224
224
|
);
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
+
test("returns priced for gemini-3.8-flash", () => {
|
|
228
|
+
const result = resolvePricing(
|
|
229
|
+
"gemini",
|
|
230
|
+
"gemini-3.8-flash",
|
|
231
|
+
1_000_000,
|
|
232
|
+
1_000_000,
|
|
233
|
+
);
|
|
234
|
+
expect(result.pricingStatus).toBe("priced");
|
|
235
|
+
expect(result.estimatedCostUsd).toBe(1.5 + 7.5);
|
|
236
|
+
});
|
|
237
|
+
|
|
227
238
|
test("returns priced for gemini-3-flash-preview", () => {
|
|
228
239
|
const result = resolvePricing(
|
|
229
240
|
"gemini",
|
|
@@ -58,5 +58,11 @@ describe("catalog search help for setup-intent retrieval", () => {
|
|
|
58
58
|
expect(list?.helpText).toBeDefined();
|
|
59
59
|
expect(indexed).toContain("assistant plugins search <name>");
|
|
60
60
|
expect(indexed).toContain("not listed");
|
|
61
|
+
expect(channelsHelp.description).toBe(
|
|
62
|
+
"Inspect and repair messaging channels",
|
|
63
|
+
);
|
|
64
|
+
expect(channelsHelp.description.toLowerCase()).not.toContain("slack");
|
|
65
|
+
expect(channelsHelp.description.toLowerCase()).not.toContain("telegram");
|
|
66
|
+
expect(channelsHelp.description.toLowerCase()).not.toContain("email");
|
|
61
67
|
});
|
|
62
68
|
});
|
|
@@ -19,12 +19,11 @@ export const CHANNELS_PLUGIN_SEARCH_HINT =
|
|
|
19
19
|
|
|
20
20
|
export const channelsHelp: CliCommandHelp = {
|
|
21
21
|
name: "channels",
|
|
22
|
-
description:
|
|
23
|
-
"Inspect and repair messaging channels (slack, telegram, email, etc.)",
|
|
22
|
+
description: "Inspect and repair messaging channels",
|
|
24
23
|
helpText: `
|
|
25
|
-
Channels are the messaging surfaces the assistant talks over
|
|
26
|
-
telegram, whatsapp, email, phone, vellum,
|
|
27
|
-
|
|
24
|
+
Channels are the messaging surfaces the assistant talks over. Built-in
|
|
25
|
+
readiness probes cover slack, telegram, whatsapp, email, phone, vellum,
|
|
26
|
+
platform, and a2a.
|
|
28
27
|
|
|
29
28
|
${CHANNELS_PLUGIN_SEARCH_HINT} Plugins can bundle additional channels
|
|
30
29
|
from other Vellum users.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
formatCreditsLines,
|
|
5
|
+
type PlatformCreditsResult,
|
|
6
|
+
} from "../credits-format.js";
|
|
7
|
+
|
|
8
|
+
const BASE: PlatformCreditsResult = {
|
|
9
|
+
remaining: 42.17,
|
|
10
|
+
settled: 50,
|
|
11
|
+
pending: 7.83,
|
|
12
|
+
unit: "USD",
|
|
13
|
+
stale: false,
|
|
14
|
+
as_of: "2026-07-06T00:00:00.000Z",
|
|
15
|
+
daily_spend: 3.25,
|
|
16
|
+
daily_limit: 10,
|
|
17
|
+
daily_limit_reached: false,
|
|
18
|
+
daily_limit_snoozed: false,
|
|
19
|
+
low_balance_threshold: 5,
|
|
20
|
+
low_balance_warning: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("formatCreditsLines", () => {
|
|
24
|
+
test("labels daily spend as counted against the daily limit, never as total spend", () => {
|
|
25
|
+
const lines = formatCreditsLines(BASE);
|
|
26
|
+
|
|
27
|
+
expect(lines[2]).toBe(
|
|
28
|
+
"Today: $3.25 counted against the $10.00 daily limit",
|
|
29
|
+
);
|
|
30
|
+
expect(lines.join("\n")).not.toContain("spent");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("says when no daily limit is set and flags a reached or skipped limit", () => {
|
|
34
|
+
expect(formatCreditsLines({ ...BASE, daily_limit: null })[2]).toBe(
|
|
35
|
+
"Today: $3.25 counted against the daily limit (none set)",
|
|
36
|
+
);
|
|
37
|
+
expect(
|
|
38
|
+
formatCreditsLines({ ...BASE, daily_limit_reached: true })[2],
|
|
39
|
+
).toEndWith(" (limit reached)");
|
|
40
|
+
expect(
|
|
41
|
+
formatCreditsLines({ ...BASE, daily_limit_snoozed: true })[2],
|
|
42
|
+
).toEndWith(" (limit skipped for today)");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("omits the daily line without daily spend and adds the low-balance warning", () => {
|
|
46
|
+
const lines = formatCreditsLines({
|
|
47
|
+
...BASE,
|
|
48
|
+
daily_spend: null,
|
|
49
|
+
low_balance_warning: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(lines).toHaveLength(3);
|
|
53
|
+
expect(lines[2]).toBe(
|
|
54
|
+
"Warning: balance is below the low-balance threshold of $5.00",
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("formats a negative remaining balance with the sign first", () => {
|
|
59
|
+
expect(formatCreditsLines({ ...BASE, remaining: -2.5 })[0]).toStartWith(
|
|
60
|
+
"Remaining: -$2.50 USD",
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -16,6 +16,12 @@ describe("assistant platform credits", () => {
|
|
|
16
16
|
unit: "USD",
|
|
17
17
|
stale: false,
|
|
18
18
|
as_of: "2026-07-06T00:00:00.000Z",
|
|
19
|
+
daily_spend: 3.25,
|
|
20
|
+
daily_limit: 10,
|
|
21
|
+
daily_limit_reached: false,
|
|
22
|
+
daily_limit_snoozed: false,
|
|
23
|
+
low_balance_threshold: 5,
|
|
24
|
+
low_balance_warning: false,
|
|
19
25
|
},
|
|
20
26
|
};
|
|
21
27
|
});
|
|
@@ -31,6 +37,10 @@ describe("assistant platform credits", () => {
|
|
|
31
37
|
expect(parsed.pending).toBe(7.83);
|
|
32
38
|
expect(parsed.unit).toBe("USD");
|
|
33
39
|
expect(parsed.stale).toBe(false);
|
|
40
|
+
expect(parsed.daily_spend).toBe(3.25);
|
|
41
|
+
expect(parsed.daily_limit).toBe(10);
|
|
42
|
+
expect(parsed.daily_limit_reached).toBe(false);
|
|
43
|
+
expect(parsed.low_balance_warning).toBe(false);
|
|
34
44
|
});
|
|
35
45
|
|
|
36
46
|
test("plain text mode does not emit JSON to stdout", async () => {
|