@vellumai/assistant 0.5.3 → 0.5.5
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/Dockerfile +18 -27
- package/docs/architecture/memory.md +105 -0
- package/node_modules/@vellumai/ces-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/ces-contracts/src/trust-rules.ts +42 -0
- package/package.json +1 -1
- package/src/__tests__/archive-recall.test.ts +560 -0
- package/src/__tests__/conversation-clear-safety.test.ts +259 -0
- package/src/__tests__/conversation-switch-memory-reduction.test.ts +474 -0
- package/src/__tests__/credential-security-invariants.test.ts +2 -0
- package/src/__tests__/db-schedule-syntax-migration.test.ts +3 -0
- package/src/__tests__/memory-reducer-job.test.ts +538 -0
- package/src/__tests__/memory-reducer-scheduling.test.ts +473 -0
- package/src/__tests__/memory-reducer-types.test.ts +12 -4
- package/src/__tests__/memory-reducer.test.ts +7 -1
- package/src/__tests__/memory-regressions.test.ts +24 -4
- package/src/__tests__/memory-simplified-config.test.ts +4 -4
- package/src/__tests__/openai-whisper.test.ts +93 -0
- package/src/__tests__/simplified-memory-e2e.test.ts +666 -0
- package/src/__tests__/simplified-memory-runtime.test.ts +616 -0
- package/src/__tests__/slack-messaging-token-resolution.test.ts +319 -0
- package/src/__tests__/volume-security-guard.test.ts +155 -0
- package/src/cli/commands/conversations.ts +18 -0
- package/src/config/bundled-skills/messaging/tools/shared.ts +1 -0
- package/src/config/bundled-skills/schedule/TOOLS.json +8 -0
- package/src/config/bundled-skills/transcribe/tools/transcribe-media.ts +16 -37
- package/src/config/env-registry.ts +9 -0
- package/src/config/feature-flag-registry.json +8 -0
- package/src/config/loader.ts +0 -1
- package/src/config/schemas/memory-simplified.ts +1 -1
- package/src/credential-execution/managed-catalog.ts +5 -15
- package/src/daemon/config-watcher.ts +4 -1
- package/src/daemon/conversation-memory.ts +117 -0
- package/src/daemon/conversation-runtime-assembly.ts +1 -0
- package/src/daemon/daemon-control.ts +7 -0
- package/src/daemon/handlers/conversations.ts +11 -0
- package/src/daemon/lifecycle.ts +51 -2
- package/src/daemon/providers-setup.ts +2 -1
- package/src/hooks/manager.ts +7 -0
- package/src/instrument.ts +33 -1
- package/src/memory/archive-recall.ts +516 -0
- package/src/memory/brief-time.ts +5 -4
- package/src/memory/conversation-crud.ts +210 -0
- package/src/memory/conversation-key-store.ts +33 -4
- package/src/memory/db-init.ts +4 -0
- package/src/memory/embedding-local.ts +11 -5
- package/src/memory/job-handlers/backfill-simplified-memory.ts +462 -0
- package/src/memory/job-handlers/conversation-starters.ts +24 -30
- package/src/memory/job-handlers/reduce-conversation-memory.ts +229 -0
- package/src/memory/jobs-store.ts +2 -0
- package/src/memory/jobs-worker.ts +8 -0
- package/src/memory/migrations/036-normalize-phone-identities.ts +49 -14
- package/src/memory/migrations/135-backfill-contact-interaction-stats.ts +9 -1
- package/src/memory/migrations/141-rename-verification-table.ts +8 -0
- package/src/memory/migrations/142-rename-verification-session-id-column.ts +7 -2
- package/src/memory/migrations/174-rename-thread-starters-table.ts +8 -0
- package/src/memory/migrations/188-schedule-quiet-flag.ts +13 -0
- package/src/memory/migrations/index.ts +1 -0
- package/src/memory/reducer-scheduler.ts +242 -0
- package/src/memory/reducer-types.ts +9 -2
- package/src/memory/reducer.ts +25 -11
- package/src/memory/schema/infrastructure.ts +1 -0
- package/src/messaging/provider.ts +9 -0
- package/src/messaging/providers/slack/adapter.ts +29 -2
- package/src/oauth/connection-resolver.test.ts +22 -18
- package/src/oauth/connection-resolver.ts +92 -7
- package/src/oauth/platform-connection.test.ts +78 -69
- package/src/oauth/platform-connection.ts +12 -19
- package/src/permissions/trust-client.ts +343 -0
- package/src/permissions/trust-store-interface.ts +105 -0
- package/src/permissions/trust-store.ts +523 -36
- package/src/platform/client.test.ts +148 -0
- package/src/platform/client.ts +71 -0
- package/src/providers/speech-to-text/openai-whisper.test.ts +190 -0
- package/src/providers/speech-to-text/openai-whisper.ts +68 -0
- package/src/providers/speech-to-text/resolve.ts +9 -0
- package/src/providers/speech-to-text/types.ts +17 -0
- package/src/runtime/auth/route-policy.ts +10 -1
- package/src/runtime/http-server.ts +2 -2
- package/src/runtime/routes/conversation-management-routes.ts +88 -2
- package/src/runtime/routes/guardian-bootstrap-routes.ts +19 -7
- package/src/runtime/routes/inbound-message-handler.ts +27 -3
- package/src/runtime/routes/inbound-stages/acl-enforcement.ts +16 -1
- package/src/runtime/routes/inbound-stages/transcribe-audio.test.ts +287 -0
- package/src/runtime/routes/inbound-stages/transcribe-audio.ts +122 -0
- package/src/runtime/routes/log-export-routes.ts +1 -0
- package/src/runtime/routes/secret-routes.ts +5 -1
- package/src/schedule/schedule-store.ts +7 -0
- package/src/schedule/scheduler.ts +6 -2
- package/src/security/ces-credential-client.ts +173 -0
- package/src/security/secure-keys.ts +65 -22
- package/src/signals/bash.ts +3 -0
- package/src/signals/cancel.ts +3 -0
- package/src/signals/confirm.ts +3 -0
- package/src/signals/conversation-undo.ts +3 -0
- package/src/signals/event-stream.ts +7 -0
- package/src/signals/shotgun.ts +3 -0
- package/src/signals/trust-rule.ts +3 -0
- package/src/telemetry/usage-telemetry-reporter.test.ts +23 -36
- package/src/telemetry/usage-telemetry-reporter.ts +22 -20
- package/src/tools/filesystem/edit.ts +6 -1
- package/src/tools/filesystem/read.ts +6 -1
- package/src/tools/filesystem/write.ts +6 -1
- package/src/tools/memory/handlers.ts +129 -1
- package/src/tools/schedule/create.ts +3 -0
- package/src/tools/schedule/list.ts +5 -1
- package/src/tools/schedule/update.ts +6 -0
- package/src/util/device-id.ts +70 -7
- package/src/util/logger.ts +35 -9
- package/src/util/platform.ts +29 -5
- package/src/workspace/migrations/migrate-to-workspace-volume.ts +113 -0
- package/src/workspace/migrations/registry.ts +2 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import { OpenAIWhisperProvider } from "../providers/speech-to-text/openai-whisper.js";
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Mock fetch — capture outgoing FormData so we can assert filenames
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
const originalFetch = globalThis.fetch;
|
|
10
|
+
|
|
11
|
+
let capturedFormData: FormData | null = null;
|
|
12
|
+
|
|
13
|
+
function mockFetch(
|
|
14
|
+
_url: string | URL | Request,
|
|
15
|
+
init?: RequestInit,
|
|
16
|
+
): Promise<Response> {
|
|
17
|
+
if (init?.body instanceof FormData) {
|
|
18
|
+
capturedFormData = init.body;
|
|
19
|
+
}
|
|
20
|
+
return Promise.resolve(
|
|
21
|
+
new Response(JSON.stringify({ text: "hello world" }), {
|
|
22
|
+
status: 200,
|
|
23
|
+
headers: { "Content-Type": "application/json" },
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
capturedFormData = null;
|
|
30
|
+
globalThis.fetch = mockFetch as typeof fetch;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
globalThis.fetch = originalFetch;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Tests
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
describe("OpenAIWhisperProvider", () => {
|
|
42
|
+
const provider = new OpenAIWhisperProvider("test-api-key");
|
|
43
|
+
const dummyAudio = Buffer.from("fake-audio-data");
|
|
44
|
+
|
|
45
|
+
describe("extensionFromMime (via transcribe filename)", () => {
|
|
46
|
+
test("plain MIME type resolves to correct extension", async () => {
|
|
47
|
+
await provider.transcribe(dummyAudio, "audio/ogg");
|
|
48
|
+
const file = capturedFormData?.get("file") as File;
|
|
49
|
+
expect(file.name).toBe("audio.ogg");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("MIME type with parameters resolves to correct extension", async () => {
|
|
53
|
+
await provider.transcribe(dummyAudio, "audio/ogg; codecs=opus");
|
|
54
|
+
const file = capturedFormData?.get("file") as File;
|
|
55
|
+
expect(file.name).toBe("audio.ogg");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("MIME type with extra whitespace around parameters", async () => {
|
|
59
|
+
await provider.transcribe(dummyAudio, "audio/mpeg ; bitrate=128");
|
|
60
|
+
const file = capturedFormData?.get("file") as File;
|
|
61
|
+
expect(file.name).toBe("audio.mp3");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("unknown MIME type falls back to .audio", async () => {
|
|
65
|
+
await provider.transcribe(dummyAudio, "audio/unknown-format");
|
|
66
|
+
const file = capturedFormData?.get("file") as File;
|
|
67
|
+
expect(file.name).toBe("audio.audio");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("unknown MIME type with parameters still falls back", async () => {
|
|
71
|
+
await provider.transcribe(dummyAudio, "audio/unknown; foo=bar");
|
|
72
|
+
const file = capturedFormData?.get("file") as File;
|
|
73
|
+
expect(file.name).toBe("audio.audio");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test.each([
|
|
77
|
+
["audio/wav", "audio.wav"],
|
|
78
|
+
["audio/x-wav", "audio.wav"],
|
|
79
|
+
["audio/mpeg", "audio.mp3"],
|
|
80
|
+
["audio/mp3", "audio.mp3"],
|
|
81
|
+
["audio/ogg", "audio.ogg"],
|
|
82
|
+
["audio/opus", "audio.opus"],
|
|
83
|
+
["audio/webm", "audio.webm"],
|
|
84
|
+
["audio/mp4", "audio.m4a"],
|
|
85
|
+
["audio/x-m4a", "audio.m4a"],
|
|
86
|
+
["audio/flac", "audio.flac"],
|
|
87
|
+
])("%s → %s", async (mime, expectedFilename) => {
|
|
88
|
+
await provider.transcribe(dummyAudio, mime);
|
|
89
|
+
const file = capturedFormData?.get("file") as File;
|
|
90
|
+
expect(file.name).toBe(expectedFilename);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|