@vellumai/assistant 0.10.12-dev.202607272227.bd2aa0b → 0.10.12-dev.202607280044.d57f000
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/AGENTS.md +1 -1
- package/openapi.yaml +0 -128
- package/package.json +1 -1
- package/src/__tests__/call-start-guardian-guard.test.ts +27 -0
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/db-schedule-syntax-migration.test.ts +0 -3
- package/src/__tests__/db-test-helpers.ts +13 -27
- package/src/__tests__/encrypted-store-test-helpers.ts +10 -20
- package/src/__tests__/feature-flag-test-helpers.ts +10 -20
- package/src/__tests__/followup-tools.test.ts +58 -0
- package/src/__tests__/heartbeat-disk-pressure.test.ts +1 -3
- package/src/__tests__/host-file-edit-tool.test.ts +3 -3
- package/src/__tests__/host-file-read-tool.test.ts +2 -2
- package/src/__tests__/host-file-write-tool.test.ts +7 -3
- package/src/__tests__/host-shell-tool.test.ts +17 -5
- package/src/__tests__/plugin-event-hub-facade.test.ts +3 -5
- package/src/__tests__/schedule-routes.test.ts +0 -88
- package/src/__tests__/schedule-tools.test.ts +0 -156
- package/src/__tests__/subagent-notify-parent.test.ts +48 -4
- package/src/__tests__/subagent-spawn-and-await.test.ts +50 -2
- package/src/__tests__/subagent-tools.test.ts +64 -0
- package/src/__tests__/terminal-tools.test.ts +12 -3
- package/src/__tests__/test-preload.ts +9 -0
- package/src/calls/__tests__/voice-session-bridge.test.ts +72 -0
- package/src/calls/voice-session-bridge.ts +49 -17
- package/src/config/bundled-skills/schedule/SKILL.md +3 -22
- package/src/config/bundled-skills/schedule/TOOLS.json +0 -16
- package/src/config/feature-flag-cache.ts +6 -16
- package/src/config/webhook-routing.ts +67 -0
- package/src/daemon/conversation-tool-setup.ts +2 -2
- package/src/daemon/conversation.ts +13 -0
- package/src/ipc/routes/__tests__/events-ipc-routes.test.ts +19 -0
- package/src/ipc/routes/events-ipc-routes.ts +7 -0
- package/src/live-voice/__tests__/live-voice-vad.test.ts +210 -3
- package/src/live-voice/live-voice-session.ts +374 -54
- package/src/notifications/home-feed-side-effect.ts +4 -0
- package/src/notifications/signal.ts +5 -0
- package/src/persistence/db-singleton.ts +14 -27
- package/src/persistence/migrations/352-drop-schedule-skill-script-handoff.test.ts +83 -0
- package/src/persistence/migrations/352-drop-schedule-skill-script-handoff.ts +36 -0
- package/src/persistence/schema/infrastructure.ts +0 -5
- package/src/persistence/steps.ts +2 -0
- package/src/plugin-api/__tests__/publish-event.test.ts +2 -4
- package/src/plugin-api/event-hub-facade.ts +3 -10
- package/src/runtime/__tests__/background-job-runner.test.ts +0 -5
- package/src/runtime/assistant-event-hub.ts +10 -0
- package/src/runtime/background-job-runner.ts +23 -10
- package/src/runtime/channel-readiness-service.ts +1 -40
- package/src/runtime/http-server.ts +8 -0
- package/src/runtime/process-role.ts +12 -3
- package/src/runtime/routes/schedule-routes.ts +6 -81
- package/src/schedule/run-script.ts +0 -69
- package/src/schedule/schedule-store.ts +7 -49
- package/src/schedule/scheduler.ts +169 -421
- package/src/security/store-path-override.ts +6 -16
- package/src/subagent/manager.ts +18 -4
- package/src/subagent/notify.ts +8 -0
- package/src/subagent/types.ts +13 -3
- package/src/telegram/__tests__/webhook-health.test.ts +442 -0
- package/src/telegram/webhook-health.ts +478 -0
- package/src/tools/__tests__/followup-call-acp-tool-input-schemas.test.ts +125 -0
- package/src/tools/__tests__/schedule-tool-input-schemas.test.ts +0 -3
- package/src/tools/__tests__/subagent-workflow-tool-input-schemas.test.ts +116 -0
- package/src/tools/__tests__/tool-input-schemas.test.ts +14 -0
- package/src/tools/acp/abort.ts +21 -1
- package/src/tools/acp/spawn.test.ts +15 -5
- package/src/tools/acp/spawn.ts +26 -3
- package/src/tools/acp/status.ts +20 -1
- package/src/tools/acp/steer.test.ts +20 -0
- package/src/tools/acp/steer.ts +23 -2
- package/src/tools/calls/call-end.ts +24 -3
- package/src/tools/calls/call-start.ts +35 -11
- package/src/tools/calls/call-status.ts +20 -1
- package/src/tools/executor.ts +15 -13
- package/src/tools/followups/followup_create.ts +41 -12
- package/src/tools/followups/followup_list.ts +34 -6
- package/src/tools/followups/followup_resolve.ts +26 -4
- package/src/tools/host-filesystem/edit.ts +50 -60
- package/src/tools/host-filesystem/read.ts +45 -39
- package/src/tools/host-filesystem/write.ts +31 -36
- package/src/tools/host-terminal/host-shell.ts +76 -62
- package/src/tools/schedule/create.ts +1 -26
- package/src/tools/schedule/update.ts +3 -42
- package/src/tools/subagent/abort.ts +12 -4
- package/src/tools/subagent/consult-deadline.ts +9 -3
- package/src/tools/subagent/message.ts +21 -5
- package/src/tools/subagent/notify-parent.ts +44 -23
- package/src/tools/subagent/read.ts +15 -4
- package/src/tools/subagent/resolve.ts +26 -4
- package/src/tools/subagent/spawn.ts +34 -10
- package/src/tools/subagent/status.ts +12 -4
- package/src/tools/system/request-permission.ts +35 -26
- package/src/tools/terminal/shell.ts +68 -55
- package/src/tools/tool-input-schemas.ts +14 -0
- package/src/tools/workflows/manage-workflows.ts +30 -2
- package/src/tools/workflows/run-workflow.test.ts +54 -2
- package/src/tools/workflows/run-workflow.ts +32 -4
- package/src/vellum-assistant-namespace.d.ts +80 -0
- package/src/__tests__/schedule-script-handoff.test.ts +0 -694
- package/src/runtime/assistant-sandwich.ts +0 -86
- package/src/schedule/skill-binding.ts +0 -217
package/AGENTS.md
CHANGED
|
@@ -89,7 +89,7 @@ The rule exists because test machinery and production code have **inverted invar
|
|
|
89
89
|
|
|
90
90
|
Concretely:
|
|
91
91
|
|
|
92
|
-
- **Test helpers** (e.g. `src/__tests__/*-test-helpers.ts`) use only node stdlib, `bun:test`, and sibling helpers. If they need to manipulate shared state that production code also reads, both sides
|
|
92
|
+
- **Test helpers** (e.g. `src/__tests__/*-test-helpers.ts`) use only node stdlib, `bun:test`, and sibling helpers. If they need to manipulate shared state that production code also reads, both sides read/write a typed slot under `globalThis.vellumAssistant.*`. The namespace shape is declared once, in the ambient `src/vellum-assistant-namespace.d.ts` (`VellumAssistantNamespace` and its slot value types) — the helper and the production module both refer to those global types by name, so they agree on the shape without either importing the other. Because that declaration is ambient (pure compile-time type info that reaches into no `src/` module), referring to it adds nothing to a helper's runtime import graph, so the no-`src/`-imports invariant still holds. To add a slot: declare its value type in that `.d.ts`, add the optional property to `VellumAssistantNamespace`, and have the owning module plus its test helper reference those globals instead of declaring their own copies.
|
|
93
93
|
- **The test preload** (`src/__tests__/test-preload.ts`) is the strictest: it must not import from `src/` at all. Its only static imports are node stdlib, `bun:test`, and helpers in `src/__tests__/`. Importing from a source module risks running its import-time side effects before the workspace override is set.
|
|
94
94
|
- **The preload verifier** (`src/__tests__/test-preload-verifier.ts`) runs after the main preload and asserts the override took effect (`VELLUM_WORKSPACE_DIR` must resolve under `os.tmpdir()`).
|
|
95
95
|
- **Destructive ops** (e.g. `rmSync(dbPath, ...)`) in tests must call `assertNotLiveDb(path)` from `src/__tests__/assert-not-live-db.js` immediately before the destructive call. The check is a per-callsite belt to the preload-verifier suspenders.
|
package/openapi.yaml
CHANGED
|
@@ -24723,16 +24723,6 @@ paths:
|
|
|
24723
24723
|
anyOf:
|
|
24724
24724
|
- type: string
|
|
24725
24725
|
- type: "null"
|
|
24726
|
-
thenExecute:
|
|
24727
|
-
type: boolean
|
|
24728
|
-
skillId:
|
|
24729
|
-
anyOf:
|
|
24730
|
-
- type: string
|
|
24731
|
-
- type: "null"
|
|
24732
|
-
skillVersionHash:
|
|
24733
|
-
anyOf:
|
|
24734
|
-
- type: string
|
|
24735
|
-
- type: "null"
|
|
24736
24726
|
nextRunAt:
|
|
24737
24727
|
type: number
|
|
24738
24728
|
lastRunAt:
|
|
@@ -24814,9 +24804,6 @@ paths:
|
|
|
24814
24804
|
- timezone
|
|
24815
24805
|
- message
|
|
24816
24806
|
- script
|
|
24817
|
-
- thenExecute
|
|
24818
|
-
- skillId
|
|
24819
|
-
- skillVersionHash
|
|
24820
24807
|
- nextRunAt
|
|
24821
24808
|
- lastRunAt
|
|
24822
24809
|
- lastStatus
|
|
@@ -24888,17 +24875,6 @@ paths:
|
|
|
24888
24875
|
script:
|
|
24889
24876
|
type: string
|
|
24890
24877
|
description: Shell command run on each fire (required for script mode)
|
|
24891
|
-
thenExecute:
|
|
24892
|
-
type: boolean
|
|
24893
|
-
description:
|
|
24894
|
-
"Script mode: hand a successful run's non-empty stdout to an assistant turn whose action prompt is
|
|
24895
|
-
`message` (which then becomes required). Empty stdout skips the turn."
|
|
24896
|
-
skillId:
|
|
24897
|
-
type: string
|
|
24898
|
-
description:
|
|
24899
|
-
"Script mode: bind the schedule to an installed managed skill. The command can reference the skill folder
|
|
24900
|
-
as $__SKILL_DIR, and the skill's current content is pinned so the schedule stops firing if it is
|
|
24901
|
-
later modified or uninstalled."
|
|
24902
24878
|
timeoutMs:
|
|
24903
24879
|
anyOf:
|
|
24904
24880
|
- type: number
|
|
@@ -24954,16 +24930,6 @@ paths:
|
|
|
24954
24930
|
anyOf:
|
|
24955
24931
|
- type: string
|
|
24956
24932
|
- type: "null"
|
|
24957
|
-
thenExecute:
|
|
24958
|
-
type: boolean
|
|
24959
|
-
skillId:
|
|
24960
|
-
anyOf:
|
|
24961
|
-
- type: string
|
|
24962
|
-
- type: "null"
|
|
24963
|
-
skillVersionHash:
|
|
24964
|
-
anyOf:
|
|
24965
|
-
- type: string
|
|
24966
|
-
- type: "null"
|
|
24967
24933
|
nextRunAt:
|
|
24968
24934
|
type: number
|
|
24969
24935
|
lastRunAt:
|
|
@@ -25045,9 +25011,6 @@ paths:
|
|
|
25045
25011
|
- timezone
|
|
25046
25012
|
- message
|
|
25047
25013
|
- script
|
|
25048
|
-
- thenExecute
|
|
25049
|
-
- skillId
|
|
25050
|
-
- skillVersionHash
|
|
25051
25014
|
- nextRunAt
|
|
25052
25015
|
- lastRunAt
|
|
25053
25016
|
- lastStatus
|
|
@@ -25128,16 +25091,6 @@ paths:
|
|
|
25128
25091
|
anyOf:
|
|
25129
25092
|
- type: string
|
|
25130
25093
|
- type: "null"
|
|
25131
|
-
thenExecute:
|
|
25132
|
-
type: boolean
|
|
25133
|
-
skillId:
|
|
25134
|
-
anyOf:
|
|
25135
|
-
- type: string
|
|
25136
|
-
- type: "null"
|
|
25137
|
-
skillVersionHash:
|
|
25138
|
-
anyOf:
|
|
25139
|
-
- type: string
|
|
25140
|
-
- type: "null"
|
|
25141
25094
|
nextRunAt:
|
|
25142
25095
|
type: number
|
|
25143
25096
|
lastRunAt:
|
|
@@ -25219,9 +25172,6 @@ paths:
|
|
|
25219
25172
|
- timezone
|
|
25220
25173
|
- message
|
|
25221
25174
|
- script
|
|
25222
|
-
- thenExecute
|
|
25223
|
-
- skillId
|
|
25224
|
-
- skillVersionHash
|
|
25225
25175
|
- nextRunAt
|
|
25226
25176
|
- lastRunAt
|
|
25227
25177
|
- lastStatus
|
|
@@ -25299,16 +25249,6 @@ paths:
|
|
|
25299
25249
|
anyOf:
|
|
25300
25250
|
- type: string
|
|
25301
25251
|
- type: "null"
|
|
25302
|
-
thenExecute:
|
|
25303
|
-
type: boolean
|
|
25304
|
-
skillId:
|
|
25305
|
-
anyOf:
|
|
25306
|
-
- type: string
|
|
25307
|
-
- type: "null"
|
|
25308
|
-
skillVersionHash:
|
|
25309
|
-
anyOf:
|
|
25310
|
-
- type: string
|
|
25311
|
-
- type: "null"
|
|
25312
25252
|
nextRunAt:
|
|
25313
25253
|
type: number
|
|
25314
25254
|
lastRunAt:
|
|
@@ -25390,9 +25330,6 @@ paths:
|
|
|
25390
25330
|
- timezone
|
|
25391
25331
|
- message
|
|
25392
25332
|
- script
|
|
25393
|
-
- thenExecute
|
|
25394
|
-
- skillId
|
|
25395
|
-
- skillVersionHash
|
|
25396
25333
|
- nextRunAt
|
|
25397
25334
|
- lastRunAt
|
|
25398
25335
|
- lastStatus
|
|
@@ -25452,19 +25389,6 @@ paths:
|
|
|
25452
25389
|
- type: string
|
|
25453
25390
|
- type: "null"
|
|
25454
25391
|
description: Shell command for script mode
|
|
25455
|
-
thenExecute:
|
|
25456
|
-
type: boolean
|
|
25457
|
-
description:
|
|
25458
|
-
"Script mode: turn the stdout-to-assistant handoff on or off. Requires the schedule to have a non-empty
|
|
25459
|
-
`message` (the action prompt)."
|
|
25460
|
-
skillId:
|
|
25461
|
-
anyOf:
|
|
25462
|
-
- type: string
|
|
25463
|
-
- type: "null"
|
|
25464
|
-
description:
|
|
25465
|
-
"Script mode: bind (or rebind) the schedule to a managed skill, re-pinning that skill's current content.
|
|
25466
|
-
This is how a schedule that stopped firing because its skill changed gets re-approved. Empty string
|
|
25467
|
-
or null unbinds. Editing other fields never re-pins."
|
|
25468
25392
|
mode:
|
|
25469
25393
|
type: string
|
|
25470
25394
|
description: notify, execute, script, wake, or workflow
|
|
@@ -25542,16 +25466,6 @@ paths:
|
|
|
25542
25466
|
anyOf:
|
|
25543
25467
|
- type: string
|
|
25544
25468
|
- type: "null"
|
|
25545
|
-
thenExecute:
|
|
25546
|
-
type: boolean
|
|
25547
|
-
skillId:
|
|
25548
|
-
anyOf:
|
|
25549
|
-
- type: string
|
|
25550
|
-
- type: "null"
|
|
25551
|
-
skillVersionHash:
|
|
25552
|
-
anyOf:
|
|
25553
|
-
- type: string
|
|
25554
|
-
- type: "null"
|
|
25555
25469
|
nextRunAt:
|
|
25556
25470
|
type: number
|
|
25557
25471
|
lastRunAt:
|
|
@@ -25633,9 +25547,6 @@ paths:
|
|
|
25633
25547
|
- timezone
|
|
25634
25548
|
- message
|
|
25635
25549
|
- script
|
|
25636
|
-
- thenExecute
|
|
25637
|
-
- skillId
|
|
25638
|
-
- skillVersionHash
|
|
25639
25550
|
- nextRunAt
|
|
25640
25551
|
- lastRunAt
|
|
25641
25552
|
- lastStatus
|
|
@@ -25716,16 +25627,6 @@ paths:
|
|
|
25716
25627
|
anyOf:
|
|
25717
25628
|
- type: string
|
|
25718
25629
|
- type: "null"
|
|
25719
|
-
thenExecute:
|
|
25720
|
-
type: boolean
|
|
25721
|
-
skillId:
|
|
25722
|
-
anyOf:
|
|
25723
|
-
- type: string
|
|
25724
|
-
- type: "null"
|
|
25725
|
-
skillVersionHash:
|
|
25726
|
-
anyOf:
|
|
25727
|
-
- type: string
|
|
25728
|
-
- type: "null"
|
|
25729
25630
|
nextRunAt:
|
|
25730
25631
|
type: number
|
|
25731
25632
|
lastRunAt:
|
|
@@ -25807,9 +25708,6 @@ paths:
|
|
|
25807
25708
|
- timezone
|
|
25808
25709
|
- message
|
|
25809
25710
|
- script
|
|
25810
|
-
- thenExecute
|
|
25811
|
-
- skillId
|
|
25812
|
-
- skillVersionHash
|
|
25813
25711
|
- nextRunAt
|
|
25814
25712
|
- lastRunAt
|
|
25815
25713
|
- lastStatus
|
|
@@ -25890,16 +25788,6 @@ paths:
|
|
|
25890
25788
|
anyOf:
|
|
25891
25789
|
- type: string
|
|
25892
25790
|
- type: "null"
|
|
25893
|
-
thenExecute:
|
|
25894
|
-
type: boolean
|
|
25895
|
-
skillId:
|
|
25896
|
-
anyOf:
|
|
25897
|
-
- type: string
|
|
25898
|
-
- type: "null"
|
|
25899
|
-
skillVersionHash:
|
|
25900
|
-
anyOf:
|
|
25901
|
-
- type: string
|
|
25902
|
-
- type: "null"
|
|
25903
25791
|
nextRunAt:
|
|
25904
25792
|
type: number
|
|
25905
25793
|
lastRunAt:
|
|
@@ -25981,9 +25869,6 @@ paths:
|
|
|
25981
25869
|
- timezone
|
|
25982
25870
|
- message
|
|
25983
25871
|
- script
|
|
25984
|
-
- thenExecute
|
|
25985
|
-
- skillId
|
|
25986
|
-
- skillVersionHash
|
|
25987
25872
|
- nextRunAt
|
|
25988
25873
|
- lastRunAt
|
|
25989
25874
|
- lastStatus
|
|
@@ -26201,16 +26086,6 @@ paths:
|
|
|
26201
26086
|
anyOf:
|
|
26202
26087
|
- type: string
|
|
26203
26088
|
- type: "null"
|
|
26204
|
-
thenExecute:
|
|
26205
|
-
type: boolean
|
|
26206
|
-
skillId:
|
|
26207
|
-
anyOf:
|
|
26208
|
-
- type: string
|
|
26209
|
-
- type: "null"
|
|
26210
|
-
skillVersionHash:
|
|
26211
|
-
anyOf:
|
|
26212
|
-
- type: string
|
|
26213
|
-
- type: "null"
|
|
26214
26089
|
nextRunAt:
|
|
26215
26090
|
type: number
|
|
26216
26091
|
lastRunAt:
|
|
@@ -26292,9 +26167,6 @@ paths:
|
|
|
26292
26167
|
- timezone
|
|
26293
26168
|
- message
|
|
26294
26169
|
- script
|
|
26295
|
-
- thenExecute
|
|
26296
|
-
- skillId
|
|
26297
|
-
- skillVersionHash
|
|
26298
26170
|
- nextRunAt
|
|
26299
26171
|
- lastRunAt
|
|
26300
26172
|
- lastStatus
|
package/package.json
CHANGED
|
@@ -111,3 +111,30 @@ describe("call_start guardian verification guard", () => {
|
|
|
111
111
|
expect(startCallInputs.length).toBe(1);
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
|
+
|
|
115
|
+
describe("call tools — model-input schema validation (LUM-2856)", () => {
|
|
116
|
+
test("call_start rejects a non-string phone_number before reaching startCall", async () => {
|
|
117
|
+
const before = startCallInputs.length;
|
|
118
|
+
const result = await executeCallStart(
|
|
119
|
+
{ phone_number: 4155550100, task: "call someone" },
|
|
120
|
+
makeContext(),
|
|
121
|
+
);
|
|
122
|
+
expect(result.isError).toBe(true);
|
|
123
|
+
expect(result.content).toContain('Invalid input for tool "call_start"');
|
|
124
|
+
expect(result.content).toContain("phone_number");
|
|
125
|
+
expect(startCallInputs.length).toBe(before);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test("call_start rejects an unknown caller_identity_mode", async () => {
|
|
129
|
+
const result = await executeCallStart(
|
|
130
|
+
{
|
|
131
|
+
phone_number: "+14155550100",
|
|
132
|
+
task: "call someone",
|
|
133
|
+
caller_identity_mode: "spoofed",
|
|
134
|
+
},
|
|
135
|
+
makeContext(),
|
|
136
|
+
);
|
|
137
|
+
expect(result.isError).toBe(true);
|
|
138
|
+
expect(result.content).toContain("caller_identity_mode");
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -170,6 +170,7 @@ describe("Invariant 2: no generic plaintext secret read API", () => {
|
|
|
170
170
|
"messaging/providers/slack/api.ts", // Slack Web API client (bot token for direct sends)
|
|
171
171
|
"messaging/providers/telegram-bot/api.ts", // Telegram Bot API client (bot token for direct sends)
|
|
172
172
|
"runtime/channel-readiness-service.ts", // channel readiness probes for Telegram connectivity
|
|
173
|
+
"telegram/webhook-health.ts", // Telegram webhook health sweep — reads bot_token to call getWebhookInfo (Bot API authenticates via the token in the URL path) and checks webhook_secret for existence only; neither value is logged, persisted, or returned
|
|
173
174
|
"messaging/providers/whatsapp/adapter.ts", // WhatsApp credential lookup for connectivity check
|
|
174
175
|
"messaging/providers/whatsapp/api.ts", // WhatsApp Cloud API client (bot token for direct sends)
|
|
175
176
|
"messaging/providers/slack/adapter.ts", // Slack bot token lookup for Socket Mode connectivity check
|
|
@@ -49,9 +49,6 @@ describe("schedule_syntax column migration", () => {
|
|
|
49
49
|
quiet INTEGER NOT NULL DEFAULT 0,
|
|
50
50
|
reuse_conversation INTEGER NOT NULL DEFAULT 0,
|
|
51
51
|
script TEXT,
|
|
52
|
-
then_execute INTEGER NOT NULL DEFAULT 0,
|
|
53
|
-
skill_id TEXT,
|
|
54
|
-
skill_version_hash TEXT,
|
|
55
52
|
wake_conversation_id TEXT,
|
|
56
53
|
workflow_name TEXT,
|
|
57
54
|
workflow_args_json TEXT,
|
|
@@ -7,43 +7,29 @@
|
|
|
7
7
|
*
|
|
8
8
|
* No source-module imports
|
|
9
9
|
* ------------------------
|
|
10
|
-
* This file has ZERO imports from `src/`. It accesses the DB
|
|
11
|
-
* state via the shared `globalThis.vellumAssistant.dbSingletons`
|
|
12
|
-
* that `src/
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
10
|
+
* This file has ZERO runtime imports from `src/`. It accesses the DB
|
|
11
|
+
* singletons' state via the shared `globalThis.vellumAssistant.dbSingletons`
|
|
12
|
+
* slots that `src/persistence/db-singleton.ts` also reads/writes, typed by the
|
|
13
|
+
* shared ambient `VellumDbSlots` (declared in
|
|
14
|
+
* `src/vellum-assistant-namespace.d.ts`). That ambient type is pure
|
|
15
|
+
* compile-time information — referencing it adds nothing to this file's runtime
|
|
16
|
+
* import graph — so keeping the helper off the production import graph (what
|
|
17
|
+
* protects the test preload from a broken `node_modules` symlink, DB ghost #3)
|
|
18
|
+
* still holds.
|
|
17
19
|
*
|
|
18
20
|
* Production code that needs to close + reopen the DBs (post-migration,
|
|
19
21
|
* post-restore, post-vbundle-import, on shutdown) should use `resetDb()`
|
|
20
|
-
* from `src/
|
|
22
|
+
* from `src/persistence/db-connection.ts` instead.
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
import { resetGatewayAclStore } from "./helpers/gateway-acl-store.js";
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
// "No source-module imports" section above.
|
|
27
|
-
type DbSlotKey = "main" | "main-readonly" | "logs" | "memory" | "telemetry";
|
|
28
|
-
|
|
29
|
-
type DbSlot = {
|
|
30
|
-
db: unknown;
|
|
31
|
-
closer: (() => void) | null;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
type DbSlots = Record<DbSlotKey, DbSlot>;
|
|
35
|
-
|
|
36
|
-
type VellumAssistantNamespace = {
|
|
37
|
-
dbSingletons?: DbSlots;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
function emptySlot(): DbSlot {
|
|
27
|
+
function emptySlot(): VellumDbSlot {
|
|
41
28
|
return { db: null, closer: null };
|
|
42
29
|
}
|
|
43
30
|
|
|
44
|
-
function dbSlots():
|
|
45
|
-
const
|
|
46
|
-
const ns = (g.vellumAssistant ??= {});
|
|
31
|
+
function dbSlots(): VellumDbSlots {
|
|
32
|
+
const ns = (globalThis.vellumAssistant ??= {});
|
|
47
33
|
return (ns.dbSingletons ??= {
|
|
48
34
|
main: emptySlot(),
|
|
49
35
|
"main-readonly": emptySlot(),
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
*
|
|
8
8
|
* No source-module imports
|
|
9
9
|
* ------------------------
|
|
10
|
-
* This file has ZERO imports from `src/`. It accesses the store-path
|
|
10
|
+
* This file has ZERO runtime imports from `src/`. It accesses the store-path
|
|
11
11
|
* override state via the shared `globalThis.vellumAssistant.storePathOverride`
|
|
12
|
-
* slot that `src/security/store-path-override.ts` also reads/writes
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* slot that `src/security/store-path-override.ts` also reads/writes, typed by
|
|
13
|
+
* the shared ambient `VellumStorePathOverride` (declared in
|
|
14
|
+
* `src/vellum-assistant-namespace.d.ts`). That ambient type is pure
|
|
15
|
+
* compile-time information — referencing it adds nothing to this file's runtime
|
|
16
|
+
* import graph — so keeping the helper off the production import graph (what
|
|
17
|
+
* protects the test preload from a broken `node_modules` symlink, DB ghost #3)
|
|
18
|
+
* still holds.
|
|
17
19
|
*
|
|
18
20
|
* Most tests no longer need these overrides: the test preload places
|
|
19
21
|
* `VELLUM_WORKSPACE_DIR` at `<tmpRoot>/workspace`, so `getProtectedDir()`
|
|
@@ -22,20 +24,8 @@
|
|
|
22
24
|
* (env-var fallbacks, migration corner cases, etc.).
|
|
23
25
|
*/
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
type PathSlot = {
|
|
28
|
-
storePath: string | null;
|
|
29
|
-
storeKeyPath: string | null;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type VellumAssistantNamespace = {
|
|
33
|
-
storePathOverride?: PathSlot;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
function pathSlot(): PathSlot {
|
|
37
|
-
const g = globalThis as { vellumAssistant?: VellumAssistantNamespace };
|
|
38
|
-
const ns = (g.vellumAssistant ??= {});
|
|
27
|
+
function pathSlot(): VellumStorePathOverride {
|
|
28
|
+
const ns = (globalThis.vellumAssistant ??= {});
|
|
39
29
|
return (ns.storePathOverride ??= { storePath: null, storeKeyPath: null });
|
|
40
30
|
}
|
|
41
31
|
|
|
@@ -7,29 +7,19 @@
|
|
|
7
7
|
*
|
|
8
8
|
* No source-module imports
|
|
9
9
|
* ------------------------
|
|
10
|
-
* This file has ZERO imports from `src/`. It accesses the feature flag
|
|
10
|
+
* This file has ZERO runtime imports from `src/`. It accesses the feature flag
|
|
11
11
|
* cache's state via the shared `globalThis.vellumAssistant.featureFlagCache`
|
|
12
|
-
* slot that `src/config/feature-flag-cache.ts` also reads/writes
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* slot that `src/config/feature-flag-cache.ts` also reads/writes, typed by the
|
|
13
|
+
* shared ambient `VellumFeatureFlagCache` (declared in
|
|
14
|
+
* `src/vellum-assistant-namespace.d.ts`). That ambient type is pure
|
|
15
|
+
* compile-time information — referencing it adds nothing to this file's runtime
|
|
16
|
+
* import graph — so keeping the helper off the production import graph (what
|
|
17
|
+
* protects the test preload from a broken `node_modules` symlink, DB ghost #3)
|
|
18
|
+
* still holds.
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
type FlagSlot = {
|
|
22
|
-
overrides: Record<string, boolean | string> | null;
|
|
23
|
-
fromGateway: boolean;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
type VellumAssistantNamespace = {
|
|
27
|
-
featureFlagCache?: FlagSlot;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function flagSlot(): FlagSlot {
|
|
31
|
-
const g = globalThis as { vellumAssistant?: VellumAssistantNamespace };
|
|
32
|
-
const ns = (g.vellumAssistant ??= {});
|
|
21
|
+
function flagSlot(): VellumFeatureFlagCache {
|
|
22
|
+
const ns = (globalThis.vellumAssistant ??= {});
|
|
33
23
|
return (ns.featureFlagCache ??= { overrides: null, fromGateway: false });
|
|
34
24
|
}
|
|
35
25
|
|
|
@@ -308,3 +308,61 @@ describe("followup_resolve tool", () => {
|
|
|
308
308
|
);
|
|
309
309
|
});
|
|
310
310
|
});
|
|
311
|
+
|
|
312
|
+
// ── model-input schema validation (LUM-2856) ────────────────────────
|
|
313
|
+
|
|
314
|
+
describe("followup tools — model-input schema validation", () => {
|
|
315
|
+
test("followup_create rejects a non-string contact_id", async () => {
|
|
316
|
+
const result = await executeFollowupCreate(
|
|
317
|
+
{ channel: "email", conversation_id: "conv-1", contact_id: 42 },
|
|
318
|
+
ctx,
|
|
319
|
+
);
|
|
320
|
+
expect(result.isError).toBe(true);
|
|
321
|
+
expect(result.content).toContain(
|
|
322
|
+
'Invalid input for tool "followup_create"',
|
|
323
|
+
);
|
|
324
|
+
expect(result.content).toContain("contact_id");
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test("followup_create keeps the bespoke positive-number error for expected_response_hours", async () => {
|
|
328
|
+
const result = await executeFollowupCreate(
|
|
329
|
+
{
|
|
330
|
+
channel: "email",
|
|
331
|
+
conversation_id: "conv-1",
|
|
332
|
+
expected_response_hours: "soon",
|
|
333
|
+
},
|
|
334
|
+
ctx,
|
|
335
|
+
);
|
|
336
|
+
expect(result.isError).toBe(true);
|
|
337
|
+
expect(result.content).toContain(
|
|
338
|
+
"expected_response_hours must be a positive number",
|
|
339
|
+
);
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
test("followup_create treats explicit null channel as missing (bespoke error)", async () => {
|
|
343
|
+
const result = await executeFollowupCreate(
|
|
344
|
+
{ channel: null, conversation_id: "conv-1" },
|
|
345
|
+
ctx,
|
|
346
|
+
);
|
|
347
|
+
expect(result.isError).toBe(true);
|
|
348
|
+
expect(result.content).toContain("channel is required");
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("followup_list rejects a non-boolean overdue_only but keeps the bespoke status error", async () => {
|
|
352
|
+
const bad = await executeFollowupList({ overdue_only: "yes" }, ctx);
|
|
353
|
+
expect(bad.isError).toBe(true);
|
|
354
|
+
expect(bad.content).toContain('Invalid input for tool "followup_list"');
|
|
355
|
+
|
|
356
|
+
const status = await executeFollowupList({ status: 42 }, ctx);
|
|
357
|
+
expect(status.isError).toBe(true);
|
|
358
|
+
expect(status.content).toContain("Invalid status");
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
test("followup_resolve rejects a non-string id", async () => {
|
|
362
|
+
const result = await executeFollowupResolve({ id: 42 }, ctx);
|
|
363
|
+
expect(result.isError).toBe(true);
|
|
364
|
+
expect(result.content).toContain(
|
|
365
|
+
'Invalid input for tool "followup_resolve"',
|
|
366
|
+
);
|
|
367
|
+
});
|
|
368
|
+
});
|
|
@@ -44,11 +44,9 @@ mock.module("../persistence/conversation-crud.js", () => ({
|
|
|
44
44
|
return { id: "conv-1", ...opts };
|
|
45
45
|
},
|
|
46
46
|
// runBackgroundJob (loaded transitively via heartbeat-service) imports
|
|
47
|
-
// addMessage
|
|
48
|
-
// deleteMessageById. Disk-pressure short-circuits before either ever runs,
|
|
47
|
+
// addMessage. Disk-pressure short-circuits before addMessage ever runs,
|
|
49
48
|
// but the mock module must still expose every name the real module does.
|
|
50
49
|
addMessage: () => Promise.resolve({ id: "mock-msg-id" }),
|
|
51
|
-
deleteMessageById: () => ({}),
|
|
52
50
|
reserveMessage: mock(async () => ({ id: "msg-reserve" })),
|
|
53
51
|
}));
|
|
54
52
|
|
|
@@ -152,7 +152,7 @@ describe("host_file_edit tool", () => {
|
|
|
152
152
|
makeContext(),
|
|
153
153
|
);
|
|
154
154
|
expect(result.isError).toBe(true);
|
|
155
|
-
expect(result.content).toContain(
|
|
155
|
+
expect(result.content).toContain('Invalid input for tool "host_file_edit"');
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
test("rejects non-string old_string", async () => {
|
|
@@ -170,7 +170,7 @@ describe("host_file_edit tool", () => {
|
|
|
170
170
|
makeContext(),
|
|
171
171
|
);
|
|
172
172
|
expect(result.isError).toBe(true);
|
|
173
|
-
expect(result.content).toContain(
|
|
173
|
+
expect(result.content).toContain('Invalid input for tool "host_file_edit"');
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
test("rejects non-string new_string", async () => {
|
|
@@ -188,7 +188,7 @@ describe("host_file_edit tool", () => {
|
|
|
188
188
|
makeContext(),
|
|
189
189
|
);
|
|
190
190
|
expect(result.isError).toBe(true);
|
|
191
|
-
expect(result.content).toContain(
|
|
191
|
+
expect(result.content).toContain('Invalid input for tool "host_file_edit"');
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
test("rejects empty old_string", async () => {
|
|
@@ -118,13 +118,13 @@ describe("host_file_read tool", () => {
|
|
|
118
118
|
test("rejects missing path parameter", async () => {
|
|
119
119
|
const result = await hostFileReadTool.execute({}, makeContext());
|
|
120
120
|
expect(result.isError).toBe(true);
|
|
121
|
-
expect(result.content).toContain(
|
|
121
|
+
expect(result.content).toContain('Invalid input for tool "host_file_read"');
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
test("rejects non-string path", async () => {
|
|
125
125
|
const result = await hostFileReadTool.execute({ path: 42 }, makeContext());
|
|
126
126
|
expect(result.isError).toBe(true);
|
|
127
|
-
expect(result.content).toContain(
|
|
127
|
+
expect(result.content).toContain('Invalid input for tool "host_file_read"');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
test("reads entire file when no offset or limit specified", async () => {
|
|
@@ -69,7 +69,7 @@ describe("host_file_write tool", () => {
|
|
|
69
69
|
);
|
|
70
70
|
expect(result.isError).toBe(true);
|
|
71
71
|
expect(result.content).toContain(
|
|
72
|
-
|
|
72
|
+
'Invalid input for tool "host_file_write"',
|
|
73
73
|
);
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -124,7 +124,9 @@ describe("host_file_write tool", () => {
|
|
|
124
124
|
makeContext(),
|
|
125
125
|
);
|
|
126
126
|
expect(result.isError).toBe(true);
|
|
127
|
-
expect(result.content).toContain(
|
|
127
|
+
expect(result.content).toContain(
|
|
128
|
+
'Invalid input for tool "host_file_write"',
|
|
129
|
+
);
|
|
128
130
|
});
|
|
129
131
|
|
|
130
132
|
test("rejects non-string path", async () => {
|
|
@@ -133,7 +135,9 @@ describe("host_file_write tool", () => {
|
|
|
133
135
|
makeContext(),
|
|
134
136
|
);
|
|
135
137
|
expect(result.isError).toBe(true);
|
|
136
|
-
expect(result.content).toContain(
|
|
138
|
+
expect(result.content).toContain(
|
|
139
|
+
'Invalid input for tool "host_file_write"',
|
|
140
|
+
);
|
|
137
141
|
});
|
|
138
142
|
|
|
139
143
|
test("success message contains the file path", async () => {
|