@vellumai/assistant 0.10.12-dev.202607250140.9979030 → 0.10.12-dev.202607250508.d09ff97
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__/request-secret-standalone-channel-gate.test.ts +2 -2
- package/src/config/feature-flag-registry.json +0 -24
- package/src/config/schemas/memory-v3.ts +3 -4
- package/src/plugins/defaults/memory/v3/__tests__/shadow-plugin.test.ts +10 -35
- package/src/plugins/defaults/memory/v3/gate.ts +4 -4
- package/src/plugins/defaults/memory/v3/orchestrate.ts +3 -3
- package/src/plugins/defaults/memory/v3/shadow-plugin.ts +4 -10
- package/src/runtime/routes/credential-request-routes.ts +0 -1
- package/src/plugins/defaults/memory/v3/__tests__/gate-flag.test.ts +0 -69
- package/src/plugins/defaults/memory/v3/gate-flag.ts +0 -20
package/package.json
CHANGED
|
@@ -177,11 +177,11 @@ describe("requestSecretStandalone channel gate", () => {
|
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
test("falls back to a plain unsupported_channel when minting is refused", async () => {
|
|
180
|
-
// GIVEN the gateway refuses to mint (
|
|
180
|
+
// GIVEN the gateway refuses to mint (no public URL)
|
|
181
181
|
registeredConversation = {
|
|
182
182
|
channelCapabilities: { supportsDynamicUi: false },
|
|
183
183
|
};
|
|
184
|
-
gatewayMintResult = { ok: false, error: "
|
|
184
|
+
gatewayMintResult = { ok: false, error: "no_public_base_url" };
|
|
185
185
|
|
|
186
186
|
// WHEN a standalone prompt is scoped to that conversation
|
|
187
187
|
const result = await requestSecretStandalone({
|
|
@@ -293,14 +293,6 @@
|
|
|
293
293
|
"description": "Expose the developer-only Memory Router Playground tab in macOS Settings and the /assistant/memory-router-playground web page for dry-running v4 router config overrides against the live page index. Dev-only; default off.",
|
|
294
294
|
"defaultEnabled": false
|
|
295
295
|
},
|
|
296
|
-
{
|
|
297
|
-
"id": "memory-v3-injection-gate",
|
|
298
|
-
"scope": "assistant",
|
|
299
|
-
"key": "memory-v3-injection-gate",
|
|
300
|
-
"label": "Memory v3 injection gate",
|
|
301
|
-
"description": "Per-turn injection gate for memory v3: after the BM25F needle + dense cosine finder lanes run, skip the selectPool LLM call (inject nothing) when finder-lane scores fall below the configured thresholds (memory.v3.gate). Default on (flipped remotely July 2026); this registry value is the fallback when no platform snapshot is available.",
|
|
302
|
-
"defaultEnabled": true
|
|
303
|
-
},
|
|
304
296
|
{
|
|
305
297
|
"id": "self-intro-greeting",
|
|
306
298
|
"scope": "both",
|
|
@@ -349,22 +341,6 @@
|
|
|
349
341
|
"description": "Surface the Security settings page where users enroll and manage TOTP two-factor authentication for their Vellum (WorkOS) account. Applies to email/password sign-in only.",
|
|
350
342
|
"defaultEnabled": false
|
|
351
343
|
},
|
|
352
|
-
{
|
|
353
|
-
"id": "credentials-settings",
|
|
354
|
-
"scope": "assistant",
|
|
355
|
-
"key": "credentials-settings",
|
|
356
|
-
"label": "Credentials settings page",
|
|
357
|
-
"description": "Show the Credentials page in web settings for listing, adding, and deleting stored credentials.",
|
|
358
|
-
"defaultEnabled": false
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
"id": "credential-requests",
|
|
362
|
-
"scope": "assistant",
|
|
363
|
-
"key": "credential-requests",
|
|
364
|
-
"label": "One-time credential request links",
|
|
365
|
-
"description": "Enable one-time credential-request links: the generate-link action in settings, the public credential entry page, and assistant-initiated links on channels without secure input.",
|
|
366
|
-
"defaultEnabled": false
|
|
367
|
-
},
|
|
368
344
|
{
|
|
369
345
|
"id": "chat-credential-reveal",
|
|
370
346
|
"scope": "assistant",
|
|
@@ -252,8 +252,7 @@ export const MemoryV3EntitySchema = z
|
|
|
252
252
|
/**
|
|
253
253
|
* Per-turn injection-gate tuning: thresholds the retrieval signals must clear
|
|
254
254
|
* for the gate to open and run the selector. The gate runs only when the
|
|
255
|
-
* `
|
|
256
|
-
* `enabled` kill-switch below are both on.
|
|
255
|
+
* `enabled` kill-switch below is on.
|
|
257
256
|
*/
|
|
258
257
|
export const MemoryV3GateSchema = z
|
|
259
258
|
.object({
|
|
@@ -261,7 +260,7 @@ export const MemoryV3GateSchema = z
|
|
|
261
260
|
.boolean({ error: "memory.v3.gate.enabled must be a boolean" })
|
|
262
261
|
.default(true)
|
|
263
262
|
.describe(
|
|
264
|
-
"Whether the injection gate may run at all. false forces the full selection process every turn
|
|
263
|
+
"Whether the injection gate may run at all. false forces the full selection process every turn; true (default) lets the gate run when the thresholds are met.",
|
|
265
264
|
),
|
|
266
265
|
denseThreshold: z
|
|
267
266
|
.number({ error: "memory.v3.gate.denseThreshold must be a number" })
|
|
@@ -327,7 +326,7 @@ export const MemoryV3GateSchema = z
|
|
|
327
326
|
),
|
|
328
327
|
})
|
|
329
328
|
.describe(
|
|
330
|
-
"Memory v3 per-turn injection gate tuning (thresholds; the gate runs when
|
|
329
|
+
"Memory v3 per-turn injection gate tuning (thresholds; the gate runs when `enabled` is on).",
|
|
331
330
|
);
|
|
332
331
|
|
|
333
332
|
// NOTE: a retired `workingSet` sub-config (maxPages/evictWindow for the old
|
|
@@ -102,9 +102,6 @@ let extraRealConceptPages = 0;
|
|
|
102
102
|
// Mutable mocked config knob (orchestrate-only) for asserting per-turn tuning
|
|
103
103
|
// re-resolution from a live config edit.
|
|
104
104
|
let selectorEnabledCfg = false;
|
|
105
|
-
// Drives the `memory-v3-injection-gate` feature flag through the shared
|
|
106
|
-
// assistant-feature-flags mock below (default off).
|
|
107
|
-
let gateFlagEnabled = false;
|
|
108
105
|
// Mutable `memory.v3.gate.enabled` config kill-switch carried by the mocked
|
|
109
106
|
// config (default on, mirroring the schema default).
|
|
110
107
|
let gateEnabledCfg = true;
|
|
@@ -112,8 +109,7 @@ let messages: Array<{ role: string; content: string }> = [];
|
|
|
112
109
|
|
|
113
110
|
// Schema defaults for `memory.v3.gate` (the tuning the mocked config carries
|
|
114
111
|
// and the gate-config threading test asserts against). Includes the default-on
|
|
115
|
-
// `enabled` kill-switch
|
|
116
|
-
// flag AND config value.
|
|
112
|
+
// `enabled` kill-switch that `observeTurn` threads through to orchestrate.
|
|
117
113
|
const GATE_DEFAULTS = MemoryV3GateSchema.parse({});
|
|
118
114
|
|
|
119
115
|
// A synthetic skill capability slug the page index carries. Its rendered
|
|
@@ -217,11 +213,7 @@ const FAKE_SECTION_INDEX: SectionIndex = {
|
|
|
217
213
|
|
|
218
214
|
mock.module("../../../../../config/assistant-feature-flags.js", () => ({
|
|
219
215
|
isAssistantFeatureFlagEnabled: (key: string) =>
|
|
220
|
-
key === "memory-v3-live"
|
|
221
|
-
? liveEnabled
|
|
222
|
-
: key === "memory-v3-injection-gate"
|
|
223
|
-
? gateFlagEnabled
|
|
224
|
-
: false,
|
|
216
|
+
key === "memory-v3-live" ? liveEnabled : false,
|
|
225
217
|
}));
|
|
226
218
|
|
|
227
219
|
// `observeTurn` and the injector resolve their tuning through the real
|
|
@@ -251,9 +243,8 @@ function seedMemoryConfig(): void {
|
|
|
251
243
|
},
|
|
252
244
|
edge: { hubDegree: 30, seedCount: 6, perSeed: 1, cap: 6 },
|
|
253
245
|
entity: { enabled: true, idfFloor: 4, cap: 8 },
|
|
254
|
-
// Gate tuning (schema defaults) with the mutable `enabled` kill-switch
|
|
255
|
-
//
|
|
256
|
-
// flag AND config value before passing to orchestrate.
|
|
246
|
+
// Gate tuning (schema defaults) with the mutable `enabled` kill-switch,
|
|
247
|
+
// threaded through to orchestrate as-is.
|
|
257
248
|
gate: { ...GATE_DEFAULTS, enabled: gateEnabledCfg },
|
|
258
249
|
},
|
|
259
250
|
qdrant: { vectorSize: 8, onDisk: false },
|
|
@@ -523,7 +514,6 @@ beforeEach(() => {
|
|
|
523
514
|
learnedEdgesCap = 0;
|
|
524
515
|
extraRealConceptPages = 0;
|
|
525
516
|
selectorEnabledCfg = false;
|
|
526
|
-
gateFlagEnabled = false;
|
|
527
517
|
gateEnabledCfg = true;
|
|
528
518
|
messages = [
|
|
529
519
|
{
|
|
@@ -775,41 +765,26 @@ describe("memory-v3 engine", () => {
|
|
|
775
765
|
expect(secondDeps.selectorEnabled).toBe(true);
|
|
776
766
|
});
|
|
777
767
|
|
|
778
|
-
test("
|
|
779
|
-
gateFlagEnabled = true;
|
|
768
|
+
test("gate enabled (default) → threads the gate tuning plus enabled:true into orchestrate", async () => {
|
|
780
769
|
await observeTurn("conv-1", 0);
|
|
781
770
|
|
|
782
771
|
const deps = (
|
|
783
772
|
orchestrateSpy.mock.calls as unknown as unknown[][]
|
|
784
773
|
)[0]![1] as { gateConfig?: unknown };
|
|
785
|
-
// The
|
|
786
|
-
//
|
|
774
|
+
// The live gate config is the `memory.v3.gate` tuning, including the
|
|
775
|
+
// default-on `enabled` kill-switch.
|
|
787
776
|
expect(deps.gateConfig).toEqual({ ...GATE_DEFAULTS, enabled: true });
|
|
788
777
|
});
|
|
789
778
|
|
|
790
|
-
test("
|
|
791
|
-
// gateFlagEnabled defaults to false in beforeEach.
|
|
792
|
-
await observeTurn("conv-1", 0);
|
|
793
|
-
|
|
794
|
-
const deps = (
|
|
795
|
-
orchestrateSpy.mock.calls as unknown as unknown[][]
|
|
796
|
-
)[0]![1] as { gateConfig?: { enabled?: boolean } };
|
|
797
|
-
// Flag off → the gate is wired in but inert, and the tuning fields are the
|
|
798
|
-
// schema defaults the config carries.
|
|
799
|
-
expect(deps.gateConfig?.enabled).toBe(false);
|
|
800
|
-
expect(deps.gateConfig).toEqual({ ...GATE_DEFAULTS, enabled: false });
|
|
801
|
-
});
|
|
802
|
-
|
|
803
|
-
test("flag on + gate.enabled:false config kill-switch → gate threads inert", async () => {
|
|
804
|
-
gateFlagEnabled = true;
|
|
779
|
+
test("gate.enabled:false config kill-switch → gate threads inert", async () => {
|
|
805
780
|
gateEnabledCfg = false;
|
|
806
781
|
await observeTurn("conv-1", 0);
|
|
807
782
|
|
|
808
783
|
const deps = (
|
|
809
784
|
orchestrateSpy.mock.calls as unknown as unknown[][]
|
|
810
785
|
)[0]![1] as { gateConfig?: unknown };
|
|
811
|
-
// The
|
|
812
|
-
//
|
|
786
|
+
// The kill-switch makes the effective `enabled` false, so selection
|
|
787
|
+
// always runs.
|
|
813
788
|
expect(deps.gateConfig).toEqual({ ...GATE_DEFAULTS, enabled: false });
|
|
814
789
|
});
|
|
815
790
|
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
// regardless of how the thresholds are tuned.
|
|
18
18
|
//
|
|
19
19
|
// This module is intentionally PURE — no async, no I/O, no logging, and no
|
|
20
|
-
// imports beyond the two scored-hit types. `config.enabled` is the
|
|
21
|
-
//
|
|
22
|
-
//
|
|
20
|
+
// imports beyond the two scored-hit types. `config.enabled` is the
|
|
21
|
+
// `memory.v3.gate.enabled` kill-switch supplied by the caller, which also
|
|
22
|
+
// feeds in the finder-lane hits.
|
|
23
23
|
|
|
24
24
|
import type { DenseHitScored } from "./dense.js";
|
|
25
25
|
import type { SectionNeedleScoredHit } from "./section-needle.js";
|
|
@@ -37,7 +37,7 @@ export type V3GateReason =
|
|
|
37
37
|
| "disabled";
|
|
38
38
|
|
|
39
39
|
export interface V3GateConfig {
|
|
40
|
-
enabled: boolean; //
|
|
40
|
+
enabled: boolean; // the `memory.v3.gate.enabled` kill-switch, threaded through by observeTurn
|
|
41
41
|
denseThreshold: number;
|
|
42
42
|
sparseThreshold: number;
|
|
43
43
|
sparseOnlyThreshold: number;
|
|
@@ -232,9 +232,9 @@ export interface OrchestrateDeps {
|
|
|
232
232
|
/** Whether to run the selector LLM. False passes all pooled candidates
|
|
233
233
|
* straight through as selections, preserving pool-order slug dedup. */
|
|
234
234
|
selectorEnabled?: boolean;
|
|
235
|
-
/** Per-turn injection gate config (`memory.v3.gate` tuning
|
|
236
|
-
*
|
|
237
|
-
*
|
|
235
|
+
/** Per-turn injection gate config (the `memory.v3.gate` tuning, threaded
|
|
236
|
+
* through by observeTurn). Omitted/disabled → the gate never runs and every
|
|
237
|
+
* turn proceeds to selectPool as before. */
|
|
238
238
|
gateConfig?: V3GateConfig;
|
|
239
239
|
/** Real concept-page count at lane build — the same corpus-size signal
|
|
240
240
|
* `resolveV3Tuning` switches the lean/full profile on. Reported with each
|
|
@@ -53,7 +53,6 @@ import type { EntityIndex } from "./entity-lane.js";
|
|
|
53
53
|
import { buildEntityIndex } from "./entity-lane.js";
|
|
54
54
|
import { getActiveSlugs } from "./ever-injected-store.js";
|
|
55
55
|
import { computeFreshSet } from "./fresh-set.js";
|
|
56
|
-
import { isMemoryV3InjectionGateEnabled } from "./gate-flag.js";
|
|
57
56
|
import { computeHotSet } from "./hot-set.js";
|
|
58
57
|
import { bumpLanesVersion, readLanesVersion } from "./lanes-version-store.js";
|
|
59
58
|
import { computeLearnedEdgeGraph } from "./learned-edges.js";
|
|
@@ -702,10 +701,6 @@ export async function observeTurn(
|
|
|
702
701
|
() => getLanes(cfg),
|
|
703
702
|
);
|
|
704
703
|
const v3 = cfg.memory.v3;
|
|
705
|
-
// Resolve the effective gate enable once for the turn: the feature flag
|
|
706
|
-
// AND the `memory.v3.gate.enabled` config kill-switch. Tuning lives in
|
|
707
|
-
// `memory.v3.gate`.
|
|
708
|
-
const gateEnabled = isMemoryV3InjectionGateEnabled(cfg);
|
|
709
704
|
// Re-resolve the corpus-adaptive tuning each turn from the CURRENT config
|
|
710
705
|
// (with the lane-build corpus-size signal) so a live config.json edit to a
|
|
711
706
|
// per-turn knob (selectorEnabled, denseK, replyQueryK, edge.*) takes effect
|
|
@@ -745,11 +740,10 @@ export async function observeTurn(
|
|
|
745
740
|
v3.selectorPromptPath,
|
|
746
741
|
getWorkspaceDir(),
|
|
747
742
|
),
|
|
748
|
-
// Per-turn injection gate: the `memory.v3.gate` tuning
|
|
749
|
-
//
|
|
750
|
-
//
|
|
751
|
-
|
|
752
|
-
gateConfig: { ...v3.gate, enabled: gateEnabled },
|
|
743
|
+
// Per-turn injection gate: the `memory.v3.gate` tuning, `enabled`
|
|
744
|
+
// kill-switch included. Read-only downstream, so the config object is
|
|
745
|
+
// passed as-is.
|
|
746
|
+
gateConfig: v3.gate,
|
|
753
747
|
});
|
|
754
748
|
|
|
755
749
|
// A zero-selection turn over a non-trivial pool is unusual enough to be
|
|
@@ -25,7 +25,6 @@ type GatewayMintResult =
|
|
|
25
25
|
| { ok: false; error: string };
|
|
26
26
|
|
|
27
27
|
const MINT_ERROR_MESSAGES: Record<string, string> = {
|
|
28
|
-
flag_disabled: "One-time credential links are not enabled",
|
|
29
28
|
no_public_base_url:
|
|
30
29
|
"No public ingress URL is configured — set ingress.publicBaseUrl first",
|
|
31
30
|
rate_limited: "Too many credential links created — try again in a minute",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for `gate-flag.ts` — the on/off predicate gating the memory-v3
|
|
3
|
-
* per-turn injection gate. The assistant flag resolver is mocked so the test
|
|
4
|
-
* asserts the composition: the predicate forwards `MEMORY_V3_INJECTION_GATE_FLAG`
|
|
5
|
-
* and the config to `isAssistantFeatureFlagEnabled` and ANDs its boolean with
|
|
6
|
-
* the `memory.v3.gate.enabled` config kill-switch.
|
|
7
|
-
*/
|
|
8
|
-
import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
9
|
-
|
|
10
|
-
import type { AssistantConfig } from "../../../../../config/schema.js";
|
|
11
|
-
|
|
12
|
-
// The resolver is mocked BEFORE importing the module under test so the import
|
|
13
|
-
// observes the spy at load time. The specifier is resolved relative to THIS
|
|
14
|
-
// test file (one level deeper than gate-flag.ts's own import path).
|
|
15
|
-
const isAssistantFeatureFlagEnabled = mock(
|
|
16
|
-
(_flag: string, _config: AssistantConfig): boolean => false,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
mock.module("../../../../../config/assistant-feature-flags.js", () => ({
|
|
20
|
-
isAssistantFeatureFlagEnabled,
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
const { isMemoryV3InjectionGateEnabled, MEMORY_V3_INJECTION_GATE_FLAG } =
|
|
24
|
-
await import("../gate-flag.js");
|
|
25
|
-
|
|
26
|
-
// The predicate reads only `memory.v3.gate.enabled` from the config.
|
|
27
|
-
const cfgWithGateEnabled = (enabled: boolean): AssistantConfig =>
|
|
28
|
-
({ memory: { v3: { gate: { enabled } } } }) as AssistantConfig;
|
|
29
|
-
|
|
30
|
-
describe("gate-flag", () => {
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
isAssistantFeatureFlagEnabled.mockReset();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test("constant is the kebab-case flag id", () => {
|
|
36
|
-
expect(MEMORY_V3_INJECTION_GATE_FLAG).toBe("memory-v3-injection-gate");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("flag on + config enabled → true, resolver called with the flag id + config", () => {
|
|
40
|
-
isAssistantFeatureFlagEnabled.mockReturnValue(true);
|
|
41
|
-
|
|
42
|
-
const cfg = cfgWithGateEnabled(true);
|
|
43
|
-
expect(isMemoryV3InjectionGateEnabled(cfg)).toBe(true);
|
|
44
|
-
expect(isAssistantFeatureFlagEnabled).toHaveBeenCalledTimes(1);
|
|
45
|
-
expect(isAssistantFeatureFlagEnabled).toHaveBeenCalledWith(
|
|
46
|
-
MEMORY_V3_INJECTION_GATE_FLAG,
|
|
47
|
-
cfg,
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("returns false when the resolver returns false", () => {
|
|
52
|
-
isAssistantFeatureFlagEnabled.mockReturnValue(false);
|
|
53
|
-
|
|
54
|
-
const cfg = cfgWithGateEnabled(true);
|
|
55
|
-
expect(isMemoryV3InjectionGateEnabled(cfg)).toBe(false);
|
|
56
|
-
expect(isAssistantFeatureFlagEnabled).toHaveBeenCalledWith(
|
|
57
|
-
MEMORY_V3_INJECTION_GATE_FLAG,
|
|
58
|
-
cfg,
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test("config kill-switch: flag on + gate.enabled false → false", () => {
|
|
63
|
-
isAssistantFeatureFlagEnabled.mockReturnValue(true);
|
|
64
|
-
|
|
65
|
-
expect(isMemoryV3InjectionGateEnabled(cfgWithGateEnabled(false))).toBe(
|
|
66
|
-
false,
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { isAssistantFeatureFlagEnabled } from "../../../../config/assistant-feature-flags.js";
|
|
2
|
-
import type { AssistantConfig } from "../../../../config/schema.js";
|
|
3
|
-
|
|
4
|
-
/** Feature-flag id (kebab-case) gating the memory-v3 per-turn injection gate. */
|
|
5
|
-
export const MEMORY_V3_INJECTION_GATE_FLAG =
|
|
6
|
-
"memory-v3-injection-gate" as const;
|
|
7
|
-
|
|
8
|
-
/** Whether the memory-v3 injection gate is enabled for this config: the
|
|
9
|
-
* feature flag (resolved via the standard assistant flag resolver — gateway
|
|
10
|
-
* override → registry default → false) AND the `memory.v3.gate.enabled`
|
|
11
|
-
* config kill-switch. `enabled: false` forces the full selection process
|
|
12
|
-
* every turn even with the flag on. Thresholds live in `memory.v3.gate`. */
|
|
13
|
-
export function isMemoryV3InjectionGateEnabled(
|
|
14
|
-
config: AssistantConfig,
|
|
15
|
-
): boolean {
|
|
16
|
-
return (
|
|
17
|
-
isAssistantFeatureFlagEnabled(MEMORY_V3_INJECTION_GATE_FLAG, config) &&
|
|
18
|
-
config.memory.v3.gate.enabled
|
|
19
|
-
);
|
|
20
|
-
}
|