@vellumai/assistant 0.11.8-dev.202609021714.e6590f4 → 0.11.8-dev.202609021821.6fc920a
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__/delete-propagation.test.ts +76 -0
- package/src/__tests__/openai-provider.test.ts +5 -5
- package/src/__tests__/workspace-migration-151-repair-renamed-fireworks-deepseek-pro-model-id.test.ts +235 -0
- package/src/api/README.md +9 -5
- package/src/config/feature-flag-registry.json +0 -8
- package/src/providers/model-catalog.ts +7 -3
- package/src/runtime/routes/inbound-message-handler.ts +5 -4
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +4 -3
- package/src/workspace/migrations/151-repair-renamed-fireworks-deepseek-pro-model-id.ts +195 -0
- package/src/workspace/migrations/__tests__/150-stt-flux-provider-to-model-family.test.ts +0 -10
- package/src/workspace/migrations/registry.ts +2 -0
package/package.json
CHANGED
|
@@ -615,6 +615,82 @@ describe("Slack delete propagation", () => {
|
|
|
615
615
|
expect(slackMeta!.displayName).toBe("Test User");
|
|
616
616
|
});
|
|
617
617
|
|
|
618
|
+
test("deleting the assistant's own Slack post is recorded without an actor", async () => {
|
|
619
|
+
// Slack names a deleted post's author and never who deleted it, so the
|
|
620
|
+
// gateway forwards a deletion of the assistant's own post unattributed
|
|
621
|
+
// (LUM-3521). The post opened no inbound event; the row resolves through
|
|
622
|
+
// the `channelTs` its Slack envelope carries, and the stamp lands on
|
|
623
|
+
// that envelope, where the Slack renderers read it.
|
|
624
|
+
const chatId = "C0123CHANNEL";
|
|
625
|
+
const postTs = "1725100000.000900";
|
|
626
|
+
const minted = recordInbound("slack", chatId, "evt-earlier-user-msg");
|
|
627
|
+
const messageId = "assistant-slack-reply-1";
|
|
628
|
+
getDb()
|
|
629
|
+
.insert(messages)
|
|
630
|
+
.values({
|
|
631
|
+
id: messageId,
|
|
632
|
+
conversationId: minted.conversationId,
|
|
633
|
+
role: "assistant",
|
|
634
|
+
content: "The reply that was later deleted from the thread",
|
|
635
|
+
metadata: JSON.stringify({
|
|
636
|
+
assistantMessageChannel: "slack",
|
|
637
|
+
slackMeta: writeSlackMetadata({
|
|
638
|
+
source: "slack",
|
|
639
|
+
channelId: chatId,
|
|
640
|
+
channelTs: postTs,
|
|
641
|
+
threadTs: "1725100000.000100",
|
|
642
|
+
eventKind: "message",
|
|
643
|
+
}),
|
|
644
|
+
}),
|
|
645
|
+
createdAt: Date.now(),
|
|
646
|
+
})
|
|
647
|
+
.run();
|
|
648
|
+
|
|
649
|
+
const req = new Request("http://localhost:8080/channels/inbound", {
|
|
650
|
+
method: "POST",
|
|
651
|
+
headers: {
|
|
652
|
+
"Content-Type": "application/json",
|
|
653
|
+
"X-Gateway-Origin": TEST_BEARER_TOKEN,
|
|
654
|
+
},
|
|
655
|
+
body: JSON.stringify({
|
|
656
|
+
sourceChannel: "slack",
|
|
657
|
+
interface: "slack",
|
|
658
|
+
conversationExternalId: chatId,
|
|
659
|
+
externalMessageId: "evt-del-own-post",
|
|
660
|
+
eventKind: "delete",
|
|
661
|
+
content: "",
|
|
662
|
+
actorExternalId: "slack-system",
|
|
663
|
+
sourceMetadata: {
|
|
664
|
+
messageId: postTs,
|
|
665
|
+
threadId: "1725100000.000100",
|
|
666
|
+
actorUnattributed: true,
|
|
667
|
+
},
|
|
668
|
+
}),
|
|
669
|
+
});
|
|
670
|
+
const resp = await handleChannelInbound(req, undefined, TEST_BEARER_TOKEN);
|
|
671
|
+
const json = (await resp.json()) as Record<string, unknown>;
|
|
672
|
+
|
|
673
|
+
expect(json.accepted).toBe(true);
|
|
674
|
+
expect(json.deleted).toBe(true);
|
|
675
|
+
expect(json.messageId).toBe(messageId);
|
|
676
|
+
|
|
677
|
+
const row = getDb()
|
|
678
|
+
.select()
|
|
679
|
+
.from(messages)
|
|
680
|
+
.where(eq(messages.id, messageId))
|
|
681
|
+
.get();
|
|
682
|
+
// Content survives: the stamp records loss of channel visibility, not an
|
|
683
|
+
// erasure of what the assistant said.
|
|
684
|
+
expect(row!.content).toBe(
|
|
685
|
+
"The reply that was later deleted from the thread",
|
|
686
|
+
);
|
|
687
|
+
const parsed = JSON.parse(row!.metadata!) as Record<string, unknown>;
|
|
688
|
+
const slackMeta = readSlackMetadata(parsed.slackMeta as string);
|
|
689
|
+
expect(slackMeta!.deletedAt).toBeDefined();
|
|
690
|
+
expect(slackMeta!.channelTs).toBe(postTs);
|
|
691
|
+
expect(readProviderMetadata(row!.metadata)!.deletedAt).toBeDefined();
|
|
692
|
+
});
|
|
693
|
+
|
|
618
694
|
test("delete for unknown ts is a no-op", async () => {
|
|
619
695
|
// Seed an unrelated message so the conversation exists but ts mismatches.
|
|
620
696
|
const seeded = seedSlackMessage({
|
|
@@ -1962,7 +1962,7 @@ describe("FireworksProvider reasoning_effort ceiling", () => {
|
|
|
1962
1962
|
test('DeepSeek V4 Pro accepts "max" unclamped', async () => {
|
|
1963
1963
|
const fw = new FireworksProvider(
|
|
1964
1964
|
"fw-key",
|
|
1965
|
-
"accounts/fireworks/models/deepseek-v4-pro",
|
|
1965
|
+
"accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
1966
1966
|
);
|
|
1967
1967
|
await fw.sendMessage([userMsg("hi")], {
|
|
1968
1968
|
systemPrompt: "system",
|
|
@@ -1974,7 +1974,7 @@ describe("FireworksProvider reasoning_effort ceiling", () => {
|
|
|
1974
1974
|
test('DeepSeek V4 Pro accepts "xhigh" unclamped', async () => {
|
|
1975
1975
|
const fw = new FireworksProvider(
|
|
1976
1976
|
"fw-key",
|
|
1977
|
-
"accounts/fireworks/models/deepseek-v4-pro",
|
|
1977
|
+
"accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
1978
1978
|
);
|
|
1979
1979
|
await fw.sendMessage([userMsg("hi")], {
|
|
1980
1980
|
systemPrompt: "system",
|
|
@@ -2015,7 +2015,7 @@ describe("FireworksProvider reasoning_effort ceiling", () => {
|
|
|
2015
2015
|
test("effort below ceiling is forwarded verbatim", async () => {
|
|
2016
2016
|
const fw = new FireworksProvider(
|
|
2017
2017
|
"fw-key",
|
|
2018
|
-
"accounts/fireworks/models/deepseek-v4-pro",
|
|
2018
|
+
"accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
2019
2019
|
);
|
|
2020
2020
|
await fw.sendMessage([userMsg("hi")], {
|
|
2021
2021
|
systemPrompt: "system",
|
|
@@ -2045,7 +2045,7 @@ describe("FireworksProvider reasoning_effort ceiling", () => {
|
|
|
2045
2045
|
systemPrompt: "system",
|
|
2046
2046
|
config: {
|
|
2047
2047
|
effort: "max",
|
|
2048
|
-
model: "accounts/fireworks/models/deepseek-v4-pro",
|
|
2048
|
+
model: "accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
2049
2049
|
},
|
|
2050
2050
|
});
|
|
2051
2051
|
expect(lastCreateParams!.reasoning_effort).toBe("max");
|
|
@@ -2110,7 +2110,7 @@ describe("FireworksProvider sparse reasoning_effort support (GLM 5.3)", () => {
|
|
|
2110
2110
|
|
|
2111
2111
|
test("models without supportedEfforts are unaffected", async () => {
|
|
2112
2112
|
expect(
|
|
2113
|
-
await send("accounts/fireworks/models/deepseek-v4-pro", "medium"),
|
|
2113
|
+
await send("accounts/fireworks/models/deepseek-v4-pro-0813", "medium"),
|
|
2114
2114
|
).toBe("medium");
|
|
2115
2115
|
});
|
|
2116
2116
|
});
|
package/src/__tests__/workspace-migration-151-repair-renamed-fireworks-deepseek-pro-model-id.test.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import {
|
|
2
|
+
existsSync,
|
|
3
|
+
mkdirSync,
|
|
4
|
+
readFileSync,
|
|
5
|
+
rmSync,
|
|
6
|
+
writeFileSync,
|
|
7
|
+
} from "node:fs";
|
|
8
|
+
import { tmpdir } from "node:os";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { Database } from "bun:sqlite";
|
|
11
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
12
|
+
|
|
13
|
+
import { repairRenamedFireworksDeepseekProModelIdMigration } from "../workspace/migrations/151-repair-renamed-fireworks-deepseek-pro-model-id.js";
|
|
14
|
+
import { WORKSPACE_MIGRATIONS } from "../workspace/migrations/registry.js";
|
|
15
|
+
import { assertNotLiveDb } from "./assert-not-live-db.js";
|
|
16
|
+
|
|
17
|
+
const STALE = "accounts/fireworks/models/deepseek-v4-pro";
|
|
18
|
+
const REPLACEMENT = "accounts/fireworks/models/deepseek-v4-pro-0813";
|
|
19
|
+
|
|
20
|
+
let workspaceDir: string;
|
|
21
|
+
|
|
22
|
+
function freshWorkspace(): void {
|
|
23
|
+
workspaceDir = join(
|
|
24
|
+
tmpdir(),
|
|
25
|
+
`vellum-migration-151-test-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
26
|
+
);
|
|
27
|
+
mkdirSync(workspaceDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function writeConfig(data: Record<string, unknown>): void {
|
|
31
|
+
writeFileSync(
|
|
32
|
+
join(workspaceDir, "config.json"),
|
|
33
|
+
JSON.stringify(data, null, 2) + "\n",
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readConfig(): Record<string, unknown> {
|
|
38
|
+
return JSON.parse(readFileSync(join(workspaceDir, "config.json"), "utf-8"));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function seedRows(rows: Array<{ name: string; provider: string }>): void {
|
|
42
|
+
mkdirSync(join(workspaceDir, "data", "db"), { recursive: true });
|
|
43
|
+
const db = new Database(join(workspaceDir, "data", "db", "assistant.db"));
|
|
44
|
+
db.run(`CREATE TABLE IF NOT EXISTS provider_connections (
|
|
45
|
+
name TEXT PRIMARY KEY,
|
|
46
|
+
provider TEXT NOT NULL,
|
|
47
|
+
auth TEXT NOT NULL,
|
|
48
|
+
created_at INTEGER NOT NULL,
|
|
49
|
+
updated_at INTEGER NOT NULL
|
|
50
|
+
)`);
|
|
51
|
+
for (const row of rows) {
|
|
52
|
+
db.query(
|
|
53
|
+
`INSERT INTO provider_connections (name, provider, auth, created_at, updated_at) VALUES (?, ?, '{"type":"api_key"}', 1, 1)`,
|
|
54
|
+
).run(row.name, row.provider);
|
|
55
|
+
}
|
|
56
|
+
db.close();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
freshWorkspace();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
afterEach(() => {
|
|
64
|
+
if (existsSync(workspaceDir)) {
|
|
65
|
+
assertNotLiveDb(workspaceDir);
|
|
66
|
+
rmSync(workspaceDir, { recursive: true, force: true });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe("151-repair-renamed-fireworks-deepseek-pro-model-id migration", () => {
|
|
71
|
+
test("has correct migration id and is registered", () => {
|
|
72
|
+
expect(repairRenamedFireworksDeepseekProModelIdMigration.id).toBe(
|
|
73
|
+
"151-repair-renamed-fireworks-deepseek-pro-model-id",
|
|
74
|
+
);
|
|
75
|
+
expect(WORKSPACE_MIGRATIONS.map((m) => m.id)).toContain(
|
|
76
|
+
"151-repair-renamed-fireworks-deepseek-pro-model-id",
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("repairs the stale ID in default, call sites, and profiles", () => {
|
|
81
|
+
writeConfig({
|
|
82
|
+
llm: {
|
|
83
|
+
default: { provider: "fireworks", model: STALE },
|
|
84
|
+
callSites: {
|
|
85
|
+
recall: { model: STALE, maxTokens: 4096 },
|
|
86
|
+
heartbeat: { model: `${STALE}-tuned` },
|
|
87
|
+
malformed: STALE,
|
|
88
|
+
},
|
|
89
|
+
profiles: {
|
|
90
|
+
"cost-optimized": { provider: "vellum", model: STALE },
|
|
91
|
+
legacy: { model: STALE },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
97
|
+
|
|
98
|
+
const llm = readConfig().llm as Record<string, any>;
|
|
99
|
+
expect(llm.default.model).toBe(REPLACEMENT);
|
|
100
|
+
expect(llm.callSites.recall.model).toBe(REPLACEMENT);
|
|
101
|
+
expect(llm.callSites.recall.maxTokens).toBe(4096);
|
|
102
|
+
// Non-exact matches and malformed leaves are untouched. The dated
|
|
103
|
+
// replacement itself extends the stale ID, so the exact match must not
|
|
104
|
+
// fire on already-repaired leaves.
|
|
105
|
+
expect(llm.callSites.heartbeat.model).toBe(`${STALE}-tuned`);
|
|
106
|
+
expect(llm.callSites.malformed).toBe(STALE);
|
|
107
|
+
// Managed profiles stamped provider "vellum" carry Fireworks model IDs.
|
|
108
|
+
expect(llm.profiles["cost-optimized"].model).toBe(REPLACEMENT);
|
|
109
|
+
expect(llm.profiles.legacy.model).toBe(REPLACEMENT);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("repairs entry-bound fragments whose row kind is fireworks or vellum", () => {
|
|
113
|
+
seedRows([
|
|
114
|
+
{ name: "my-fireworks", provider: "fireworks" },
|
|
115
|
+
{ name: "managed-alt", provider: "vellum" },
|
|
116
|
+
]);
|
|
117
|
+
writeConfig({
|
|
118
|
+
llm: {
|
|
119
|
+
profiles: {
|
|
120
|
+
bound: { provider: "my-fireworks", model: STALE },
|
|
121
|
+
managed: { provider: "managed-alt", model: STALE },
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
127
|
+
|
|
128
|
+
const llm = readConfig().llm as Record<string, any>;
|
|
129
|
+
expect(llm.profiles.bound.model).toBe(REPLACEMENT);
|
|
130
|
+
expect(llm.profiles.managed.model).toBe(REPLACEMENT);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("leaves fragments with an explicit other provider untouched", () => {
|
|
134
|
+
seedRows([{ name: "byo-compat", provider: "openai-compatible" }]);
|
|
135
|
+
writeConfig({
|
|
136
|
+
llm: {
|
|
137
|
+
default: { provider: "openai-compatible", model: STALE },
|
|
138
|
+
profiles: {
|
|
139
|
+
byo: { provider: "openai-compatible", model: STALE },
|
|
140
|
+
// Entry-bound profile whose row kind is not repairable.
|
|
141
|
+
compatBound: { provider: "byo-compat", model: STALE },
|
|
142
|
+
// Entry name with no row: dangling, so nothing proves it is a
|
|
143
|
+
// fireworks-kind route.
|
|
144
|
+
dangling: { provider: "ghost", model: STALE },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
150
|
+
|
|
151
|
+
const llm = readConfig().llm as Record<string, any>;
|
|
152
|
+
expect(llm.default.model).toBe(STALE);
|
|
153
|
+
expect(llm.profiles.byo.model).toBe(STALE);
|
|
154
|
+
expect(llm.profiles.compatBound.model).toBe(STALE);
|
|
155
|
+
expect(llm.profiles.dangling.model).toBe(STALE);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("leaves entry-name providers untouched when no DB file exists", () => {
|
|
159
|
+
writeConfig({
|
|
160
|
+
llm: {
|
|
161
|
+
profiles: { bound: { provider: "my-fireworks", model: STALE } },
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
166
|
+
|
|
167
|
+
const llm = readConfig().llm as Record<string, any>;
|
|
168
|
+
expect(llm.profiles.bound.model).toBe(STALE);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("throws when an entry-name provider needs rows and the DB is unreadable", () => {
|
|
172
|
+
// A DB file without the provider_connections table is unqueryable, so
|
|
173
|
+
// the run must fail (and retry later) instead of skipping the profile.
|
|
174
|
+
mkdirSync(join(workspaceDir, "data", "db"), { recursive: true });
|
|
175
|
+
writeFileSync(join(workspaceDir, "data", "db", "assistant.db"), "");
|
|
176
|
+
writeConfig({
|
|
177
|
+
llm: {
|
|
178
|
+
profiles: { bound: { provider: "my-fireworks", model: STALE } },
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
expect(() =>
|
|
183
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir),
|
|
184
|
+
).toThrow();
|
|
185
|
+
const llm = readConfig().llm as Record<string, any>;
|
|
186
|
+
expect(llm.profiles.bound.model).toBe(STALE);
|
|
187
|
+
|
|
188
|
+
// Vendor and absent providers never need the rows, so the same broken
|
|
189
|
+
// DB does not block their repair.
|
|
190
|
+
writeConfig({
|
|
191
|
+
llm: {
|
|
192
|
+
default: { provider: "fireworks", model: STALE },
|
|
193
|
+
profiles: { legacy: { model: STALE } },
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
197
|
+
const repaired = readConfig().llm as Record<string, any>;
|
|
198
|
+
expect(repaired.default.model).toBe(REPLACEMENT);
|
|
199
|
+
expect(repaired.profiles.legacy.model).toBe(REPLACEMENT);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("is idempotent and a no-op without the stale ID", () => {
|
|
203
|
+
writeConfig({
|
|
204
|
+
llm: {
|
|
205
|
+
default: { provider: "fireworks", model: STALE },
|
|
206
|
+
profiles: { fine: { provider: "fireworks", model: REPLACEMENT } },
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
211
|
+
const first = readConfig();
|
|
212
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
213
|
+
expect(readConfig()).toEqual(first);
|
|
214
|
+
|
|
215
|
+
const llm = first.llm as Record<string, any>;
|
|
216
|
+
expect(llm.default.model).toBe(REPLACEMENT);
|
|
217
|
+
expect(llm.profiles.fine.model).toBe(REPLACEMENT);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
test("handles missing config, missing llm block, and invalid JSON", () => {
|
|
221
|
+
// No config.json at all.
|
|
222
|
+
expect(() =>
|
|
223
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir),
|
|
224
|
+
).not.toThrow();
|
|
225
|
+
|
|
226
|
+
writeConfig({ theme: "dark" });
|
|
227
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir);
|
|
228
|
+
expect(readConfig()).toEqual({ theme: "dark" });
|
|
229
|
+
|
|
230
|
+
writeFileSync(join(workspaceDir, "config.json"), "{not json");
|
|
231
|
+
expect(() =>
|
|
232
|
+
repairRenamedFireworksDeepseekProModelIdMigration.run(workspaceDir),
|
|
233
|
+
).not.toThrow();
|
|
234
|
+
});
|
|
235
|
+
});
|
package/src/api/README.md
CHANGED
|
@@ -5,9 +5,12 @@ evals, future external clients. This directory is the **source of truth** for
|
|
|
5
5
|
the wire contracts the assistant exposes: schemas, types, and pure helpers.
|
|
6
6
|
|
|
7
7
|
Internal assistant code imports the files in this directory via relative paths
|
|
8
|
-
(e.g. `../../api/events/open-url.js`). External consumers import the
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
(e.g. `../../api/events/open-url.js`). External consumers import it as the
|
|
9
|
+
workspace package `@vellumai/assistant-api`, a `workspace:*` symlink to this
|
|
10
|
+
directory, so an edit here reaches them immediately. The generated HTTP
|
|
11
|
+
client is separate: it comes from `assistant/openapi.yaml`, regenerated with
|
|
12
|
+
`cd assistant && bun run generate:openapi` and consumed by
|
|
13
|
+
`cd clients/web && bun run openapi-ts`.
|
|
11
14
|
|
|
12
15
|
## Architecture
|
|
13
16
|
|
|
@@ -110,8 +113,9 @@ Handler-level tests in the consuming domain modules typically need no change
|
|
|
110
113
|
Run before push, in order:
|
|
111
114
|
|
|
112
115
|
```bash
|
|
113
|
-
#
|
|
114
|
-
bun run
|
|
116
|
+
# Regenerate the OpenAPI spec and the web client from it
|
|
117
|
+
( cd assistant && bun run generate:openapi )
|
|
118
|
+
( cd clients/web && bun run openapi-ts )
|
|
115
119
|
|
|
116
120
|
# Type-check both packages
|
|
117
121
|
( cd assistant && bunx tsc --noEmit )
|
|
@@ -398,14 +398,6 @@
|
|
|
398
398
|
"defaultEnabled": "glm-5p3-flash",
|
|
399
399
|
"values": ["glm-5p3-flash", "glm-5p3", "glm-5p2"]
|
|
400
400
|
},
|
|
401
|
-
{
|
|
402
|
-
"id": "ios-avatar-app-icon",
|
|
403
|
-
"scope": "client",
|
|
404
|
-
"key": "ios-avatar-app-icon",
|
|
405
|
-
"label": "iOS Avatar App Icon",
|
|
406
|
-
"description": "Shows the App icon picker in Settings -> General, where any user chooses an eyes-on-color home screen icon for iOS, seeds the picker from their assistant's character avatar, or resets to the default. Every change is a press, and iOS confirms each one with an alert of its own. Off hides the picker and leaves the default icon in place.",
|
|
407
|
-
"defaultEnabled": false
|
|
408
|
-
},
|
|
409
401
|
{
|
|
410
402
|
"id": "android-avatar-app-icon",
|
|
411
403
|
"scope": "client",
|
|
@@ -1018,16 +1018,20 @@ const RAW_PROVIDER_CATALOG: ProviderCatalogEntry[] = [
|
|
|
1018
1018
|
pricing: { inputPer1mTokens: 0.3, outputPer1mTokens: 1.2 },
|
|
1019
1019
|
},
|
|
1020
1020
|
{
|
|
1021
|
-
id: "accounts/fireworks/models/deepseek-v4-pro",
|
|
1021
|
+
id: "accounts/fireworks/models/deepseek-v4-pro-0813",
|
|
1022
1022
|
displayName: "DeepSeek V4 Pro",
|
|
1023
1023
|
contextWindowTokens: 1040000,
|
|
1024
1024
|
maxOutputTokens: 131072,
|
|
1025
1025
|
supportsThinking: true,
|
|
1026
|
-
supportsCaching:
|
|
1026
|
+
supportsCaching: true,
|
|
1027
1027
|
supportsVision: false,
|
|
1028
1028
|
supportsToolUse: true,
|
|
1029
1029
|
maxEffort: "max",
|
|
1030
|
-
pricing: {
|
|
1030
|
+
pricing: {
|
|
1031
|
+
inputPer1mTokens: 1.32,
|
|
1032
|
+
outputPer1mTokens: 3.96,
|
|
1033
|
+
cacheReadPer1mTokens: 0.044,
|
|
1034
|
+
},
|
|
1031
1035
|
},
|
|
1032
1036
|
{
|
|
1033
1037
|
id: "accounts/fireworks/models/deepseek-v4-flash-0731",
|
|
@@ -540,10 +540,11 @@ export async function handleChannelInbound({
|
|
|
540
540
|
// A delete names the original via `sourceMetadata.messageId` and
|
|
541
541
|
// short-circuits the rest of the pipeline: no agent loop, no approval
|
|
542
542
|
// routing. The stored row keeps its content for audit; rendering elides on
|
|
543
|
-
// the deletedAt marker. An attributed delete (the wire names
|
|
544
|
-
// message
|
|
545
|
-
// unattributed one bypassed it under the
|
|
546
|
-
// only to a row this daemon
|
|
543
|
+
// the deletedAt marker. An attributed delete (the wire names a human
|
|
544
|
+
// author for the deleted message, as Slack's does for a member's post)
|
|
545
|
+
// passed the ingress ACL above; an unattributed one bypassed it under the
|
|
546
|
+
// ACL's stated contract and applies only to a row this daemon already
|
|
547
|
+
// holds for the chat.
|
|
547
548
|
if (eventKind === "delete") {
|
|
548
549
|
const deletedMessageTs =
|
|
549
550
|
typeof sourceMetadata?.messageId === "string"
|
|
@@ -131,9 +131,10 @@ export interface AclEnforcementParams {
|
|
|
131
131
|
* The platform named no actor for this event (the id is a channel's
|
|
132
132
|
* synthetic system identity). There is no identity claim to enforce, so
|
|
133
133
|
* the ACL neither resolves a member nor denies: the family stage that
|
|
134
|
-
* consumes such an event applies it only to
|
|
135
|
-
*
|
|
136
|
-
*
|
|
134
|
+
* consumes such an event applies it only to a row the daemon already
|
|
135
|
+
* holds for that chat, one ingested from an author who cleared this ACL
|
|
136
|
+
* on arrival or one the assistant posted itself. Callers set this ONLY
|
|
137
|
+
* for event kinds that cannot start an agent turn.
|
|
137
138
|
*/
|
|
138
139
|
actorUnattributed?: boolean;
|
|
139
140
|
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { Database } from "bun:sqlite";
|
|
4
|
+
|
|
5
|
+
import type { WorkspaceMigration } from "./types.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Repair the renamed undated Fireworks DeepSeek V4 Pro model ID in
|
|
9
|
+
* workspace LLM config.
|
|
10
|
+
*
|
|
11
|
+
* Fireworks serves DeepSeek V4 Pro only under the dated official release
|
|
12
|
+
* ID `accounts/fireworks/models/deepseek-v4-pro-0813`; the undated
|
|
13
|
+
* `accounts/fireworks/models/deepseek-v4-pro` preview has no serverless
|
|
14
|
+
* deployment (the model page states "Serverless: Not supported"), so every
|
|
15
|
+
* serverless call to it fails. Existing configs can still pin the undated
|
|
16
|
+
* ID in `llm.default`, `llm.callSites.*`, and `llm.profiles.*`.
|
|
17
|
+
*
|
|
18
|
+
* Repair those leaves only on an exact stale match, replacing with the
|
|
19
|
+
* dated ID.
|
|
20
|
+
*
|
|
21
|
+
* Provider guard: the stale ID belongs to the `fireworks` provider and also
|
|
22
|
+
* appears in managed profiles stamped `provider: "vellum"` (which route
|
|
23
|
+
* Fireworks-account model IDs through the managed proxy). Under the entries
|
|
24
|
+
* model (migration 145) `provider` can also hold a `provider_connections`
|
|
25
|
+
* entry name whose row kind drives dispatch. A fragment is repaired when
|
|
26
|
+
* its `provider` is `"fireworks"`, `"vellum"`, absent, or an entry name
|
|
27
|
+
* whose row kind is one of those: every fireworks-kind route serves the
|
|
28
|
+
* dated ID and only the dated ID. Any other provider is left untouched: an
|
|
29
|
+
* `openai-compatible` endpoint may legitimately serve a model by the stale
|
|
30
|
+
* name.
|
|
31
|
+
*/
|
|
32
|
+
export const repairRenamedFireworksDeepseekProModelIdMigration: WorkspaceMigration =
|
|
33
|
+
{
|
|
34
|
+
id: "151-repair-renamed-fireworks-deepseek-pro-model-id",
|
|
35
|
+
description:
|
|
36
|
+
"Repair renamed Fireworks accounts/fireworks/models/deepseek-v4-pro model ID in workspace LLM config",
|
|
37
|
+
run(workspaceDir: string): void {
|
|
38
|
+
const configPath = join(workspaceDir, "config.json");
|
|
39
|
+
if (!existsSync(configPath)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Read outside the parse catch: a transient filesystem error (EIO,
|
|
44
|
+
// EACCES) must reach the runner so the migration retries, while
|
|
45
|
+
// malformed JSON is a permanent state this migration cannot repair.
|
|
46
|
+
const rawText = readFileSync(configPath, "utf-8");
|
|
47
|
+
|
|
48
|
+
let config: Record<string, unknown>;
|
|
49
|
+
try {
|
|
50
|
+
const raw = JSON.parse(rawText);
|
|
51
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
config = raw as Record<string, unknown>;
|
|
55
|
+
} catch {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const llm = readObject(config.llm);
|
|
60
|
+
if (llm === null) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Entry rows load lazily: only a stale fragment whose provider is
|
|
65
|
+
// neither a repairable vendor nor absent needs them. An unreadable DB
|
|
66
|
+
// then fails the run (retried next boot) rather than checkpointing a
|
|
67
|
+
// pass that skips entry-bound profiles.
|
|
68
|
+
let rows: Map<string, string> | null | undefined;
|
|
69
|
+
const isRepairableProvider = (provider: unknown): boolean => {
|
|
70
|
+
if (provider === undefined) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (typeof provider !== "string") {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (REPAIRABLE_PROVIDERS.has(provider)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (rows === undefined) {
|
|
80
|
+
rows = readConnectionRows(workspaceDir);
|
|
81
|
+
}
|
|
82
|
+
if (rows === null) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
"provider_connections is not readable; retrying the model-ID repair on the next run",
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
const kind = rows.get(provider);
|
|
88
|
+
return kind !== undefined && REPAIRABLE_PROVIDERS.has(kind);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
let changed = false;
|
|
92
|
+
|
|
93
|
+
changed =
|
|
94
|
+
repairFragment(readObject(llm.default), isRepairableProvider) ||
|
|
95
|
+
changed;
|
|
96
|
+
|
|
97
|
+
const callSites = readObject(llm.callSites);
|
|
98
|
+
if (callSites !== null) {
|
|
99
|
+
for (const rawConfig of Object.values(callSites)) {
|
|
100
|
+
changed =
|
|
101
|
+
repairFragment(readObject(rawConfig), isRepairableProvider) ||
|
|
102
|
+
changed;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const profiles = readObject(llm.profiles);
|
|
107
|
+
if (profiles !== null) {
|
|
108
|
+
for (const rawProfile of Object.values(profiles)) {
|
|
109
|
+
changed =
|
|
110
|
+
repairFragment(readObject(rawProfile), isRepairableProvider) ||
|
|
111
|
+
changed;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!changed) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Write-then-rename so an interrupted write cannot leave config.json
|
|
120
|
+
// truncated: a torn in-place write would parse as invalid JSON on the
|
|
121
|
+
// retry, which the catch above treats as "nothing to do", letting the
|
|
122
|
+
// runner checkpoint the migration as completed against a corrupt file.
|
|
123
|
+
const tmpPath = `${configPath}.migration-151.tmp`;
|
|
124
|
+
writeFileSync(tmpPath, JSON.stringify(config, null, 2) + "\n");
|
|
125
|
+
renameSync(tmpPath, configPath);
|
|
126
|
+
},
|
|
127
|
+
// The exact-match rewrite is idempotent, so a transient failure (full
|
|
128
|
+
// disk, I/O error) is safe to retry on later startups.
|
|
129
|
+
retryFailedCheckpoint: true,
|
|
130
|
+
down(_workspaceDir: string): void {
|
|
131
|
+
// Forward-only: reintroducing the undated model ID would break
|
|
132
|
+
// Fireworks calls.
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// Helpers: self-contained per workspace migrations AGENTS.md
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
const STALE_MODEL_ID = "accounts/fireworks/models/deepseek-v4-pro";
|
|
141
|
+
const REPLACEMENT_MODEL_ID = "accounts/fireworks/models/deepseek-v4-pro-0813";
|
|
142
|
+
const REPAIRABLE_PROVIDERS = new Set(["fireworks", "vellum"]);
|
|
143
|
+
|
|
144
|
+
function repairFragment(
|
|
145
|
+
fragment: Record<string, unknown> | null,
|
|
146
|
+
isRepairableProvider: (provider: unknown) => boolean,
|
|
147
|
+
): boolean {
|
|
148
|
+
if (fragment === null) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
if (fragment.model !== STALE_MODEL_ID) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
if (!isRepairableProvider(fragment.provider)) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
fragment.model = REPLACEMENT_MODEL_ID;
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Connection name -> provider kind, or null when the DB or table is not
|
|
163
|
+
* readable. The caller fails the run on null: entry-name providers must be
|
|
164
|
+
* judged against real rows, never guessed. An absent DB file is a real
|
|
165
|
+
* state (no rows, so every entry name is dangling and stays untouched).
|
|
166
|
+
*/
|
|
167
|
+
function readConnectionRows(workspaceDir: string): Map<string, string> | null {
|
|
168
|
+
const dbPath = join(workspaceDir, "data", "db", "assistant.db");
|
|
169
|
+
if (!existsSync(dbPath)) {
|
|
170
|
+
return new Map();
|
|
171
|
+
}
|
|
172
|
+
let db: Database;
|
|
173
|
+
try {
|
|
174
|
+
db = new Database(dbPath);
|
|
175
|
+
} catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
const rows = db
|
|
180
|
+
.query(`SELECT name, provider FROM provider_connections`)
|
|
181
|
+
.all() as Array<{ name: string; provider: string }>;
|
|
182
|
+
return new Map(rows.map((r) => [r.name, r.provider]));
|
|
183
|
+
} catch {
|
|
184
|
+
return null;
|
|
185
|
+
} finally {
|
|
186
|
+
db.close();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function readObject(value: unknown): Record<string, unknown> | null {
|
|
191
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return value as Record<string, unknown>;
|
|
195
|
+
}
|
|
@@ -4,7 +4,6 @@ import { join } from "node:path";
|
|
|
4
4
|
import { describe, expect, test } from "bun:test";
|
|
5
5
|
|
|
6
6
|
import { sttFluxProviderToModelFamilyMigration } from "../150-stt-flux-provider-to-model-family.js";
|
|
7
|
-
import { WORKSPACE_MIGRATIONS } from "../registry.js";
|
|
8
7
|
|
|
9
8
|
function workspaceWith(config: unknown): string {
|
|
10
9
|
const dir = mkdtempSync(join(tmpdir(), "stt-flux-migration-"));
|
|
@@ -17,15 +16,6 @@ function readConfig(dir: string): any {
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
describe("150-stt-flux-provider-to-model-family", () => {
|
|
20
|
-
test("is registered as the newest migration", () => {
|
|
21
|
-
expect(sttFluxProviderToModelFamilyMigration.id).toBe(
|
|
22
|
-
"150-stt-flux-provider-to-model-family",
|
|
23
|
-
);
|
|
24
|
-
expect(WORKSPACE_MIGRATIONS.at(-1)?.id).toBe(
|
|
25
|
-
"150-stt-flux-provider-to-model-family",
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
19
|
test("rewrites a Flux provider id to its parent plus a model family", () => {
|
|
30
20
|
const dir = workspaceWith({
|
|
31
21
|
services: { stt: { provider: "deepgram-flux", providers: {} } },
|
|
@@ -148,6 +148,7 @@ import { renameCollidingBackupProfileNamesMigration } from "./147-rename-collidi
|
|
|
148
148
|
import { stripUnsupportedFallbackProfilesMigration } from "./148-strip-unsupported-fallback-profiles.js";
|
|
149
149
|
import { repointBackupProfileSelectionsMigration } from "./149-repoint-backup-profile-selections.js";
|
|
150
150
|
import { sttFluxProviderToModelFamilyMigration } from "./150-stt-flux-provider-to-model-family.js";
|
|
151
|
+
import { repairRenamedFireworksDeepseekProModelIdMigration } from "./151-repair-renamed-fireworks-deepseek-pro-model-id.js";
|
|
151
152
|
import { migrateToWorkspaceVolumeMigration } from "./migrate-to-workspace-volume.js";
|
|
152
153
|
import type { WorkspaceMigration } from "./types.js";
|
|
153
154
|
|
|
@@ -311,4 +312,5 @@ export const WORKSPACE_MIGRATIONS: WorkspaceMigration[] = [
|
|
|
311
312
|
stripUnsupportedFallbackProfilesMigration,
|
|
312
313
|
repointBackupProfileSelectionsMigration,
|
|
313
314
|
sttFluxProviderToModelFamilyMigration,
|
|
315
|
+
repairRenamedFireworksDeepseekProModelIdMigration,
|
|
314
316
|
];
|