@vellumai/assistant 0.8.8-dev.202606090104.b75d235 → 0.8.8-dev.202606090218.6bcb462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/openapi.yaml +12 -114
- package/package.json +1 -1
- package/src/__tests__/anthropic-provider.test.ts +23 -8
- package/src/api/responses/memory-v3-selection-log.ts +19 -10
- package/src/cli/commands/__tests__/memory-v3.test.ts +191 -210
- package/src/cli/commands/memory-v3.ts +57 -199
- package/src/config/call-site-defaults.ts +0 -1
- package/src/config/schemas/__tests__/memory-v3.test.ts +25 -9
- package/src/config/schemas/call-site-catalog.ts +0 -7
- package/src/config/schemas/llm.ts +0 -1
- package/src/config/schemas/memory-v3.ts +58 -8
- package/src/memory/v2/__tests__/consolidation-job.test.ts +4 -97
- package/src/memory/v2/__tests__/page-store.test.ts +22 -0
- package/src/memory/v2/consolidation-job.ts +2 -72
- package/src/memory/v2/types.ts +5 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/capabilities.test.ts +19 -66
- package/src/plugins/defaults/memory-v3-shadow/__tests__/dense.test.ts +181 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/edge.test.ts +247 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/live-integration.test.ts +139 -129
- package/src/plugins/defaults/memory-v3-shadow/__tests__/maintain-job.test.ts +332 -164
- package/src/plugins/defaults/memory-v3-shadow/__tests__/orchestrate.test.ts +516 -293
- package/src/plugins/defaults/memory-v3-shadow/__tests__/pool-select.test.ts +306 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/render-injection.test.ts +51 -21
- package/src/plugins/defaults/memory-v3-shadow/__tests__/section-dense-store.test.ts +402 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/section-needle.test.ts +135 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/sections.test.ts +125 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/selection-log-store.test.ts +66 -11
- package/src/plugins/defaults/memory-v3-shadow/__tests__/shadow-integration.test.ts +446 -0
- package/src/plugins/defaults/memory-v3-shadow/__tests__/shadow-plugin.test.ts +271 -110
- package/src/plugins/defaults/memory-v3-shadow/__tests__/types.test.ts +0 -22
- package/src/plugins/defaults/memory-v3-shadow/capabilities.ts +26 -62
- package/src/plugins/defaults/memory-v3-shadow/dense.ts +97 -0
- package/src/plugins/defaults/memory-v3-shadow/edge.ts +252 -0
- package/src/plugins/defaults/memory-v3-shadow/injector.ts +3 -2
- package/src/plugins/defaults/memory-v3-shadow/maintain-job.ts +415 -181
- package/src/plugins/defaults/memory-v3-shadow/orchestrate.ts +196 -56
- package/src/plugins/defaults/memory-v3-shadow/page-content.ts +39 -2
- package/src/plugins/defaults/memory-v3-shadow/pool-select.ts +204 -0
- package/src/plugins/defaults/memory-v3-shadow/render-injection.ts +15 -7
- package/src/plugins/defaults/memory-v3-shadow/section-dense-store.ts +236 -0
- package/src/plugins/defaults/memory-v3-shadow/section-needle.ts +200 -0
- package/src/plugins/defaults/memory-v3-shadow/sections.ts +115 -0
- package/src/plugins/defaults/memory-v3-shadow/selection-log-store.ts +75 -3
- package/src/plugins/defaults/memory-v3-shadow/shadow-plugin.ts +111 -78
- package/src/plugins/defaults/memory-v3-shadow/types.ts +52 -19
- package/src/plugins/defaults/memory-v3-shadow/working-set.ts +4 -1
- package/src/providers/anthropic/client.ts +9 -10
- package/src/runtime/routes/memory-v3-routes.ts +64 -314
- package/src/plugins/defaults/memory-v3-shadow/__tests__/assign.test.ts +0 -242
- package/src/plugins/defaults/memory-v3-shadow/__tests__/core.test.ts +0 -39
- package/src/plugins/defaults/memory-v3-shadow/__tests__/health.test.ts +0 -219
- package/src/plugins/defaults/memory-v3-shadow/__tests__/needle.test.ts +0 -107
- package/src/plugins/defaults/memory-v3-shadow/__tests__/provider-blocks.test.ts +0 -13
- package/src/plugins/defaults/memory-v3-shadow/__tests__/reconcile.test.ts +0 -274
- package/src/plugins/defaults/memory-v3-shadow/__tests__/router.test.ts +0 -337
- package/src/plugins/defaults/memory-v3-shadow/__tests__/selector.test.ts +0 -470
- package/src/plugins/defaults/memory-v3-shadow/__tests__/snapshot.test.ts +0 -168
- package/src/plugins/defaults/memory-v3-shadow/__tests__/tree.test.ts +0 -192
- package/src/plugins/defaults/memory-v3-shadow/assign.ts +0 -272
- package/src/plugins/defaults/memory-v3-shadow/core.ts +0 -26
- package/src/plugins/defaults/memory-v3-shadow/health.ts +0 -0
- package/src/plugins/defaults/memory-v3-shadow/needle.ts +0 -115
- package/src/plugins/defaults/memory-v3-shadow/provider-blocks.ts +0 -26
- package/src/plugins/defaults/memory-v3-shadow/reconcile.ts +0 -527
- package/src/plugins/defaults/memory-v3-shadow/router.ts +0 -190
- package/src/plugins/defaults/memory-v3-shadow/selector.ts +0 -226
- package/src/plugins/defaults/memory-v3-shadow/snapshot.ts +0 -209
- package/src/plugins/defaults/memory-v3-shadow/tree.ts +0 -174
- package/src/util/map-limit.ts +0 -27
package/openapi.yaml
CHANGED
|
@@ -15857,10 +15857,10 @@ paths:
|
|
|
15857
15857
|
type: object
|
|
15858
15858
|
properties: {}
|
|
15859
15859
|
additionalProperties: false
|
|
15860
|
-
/v1/memory/v3/
|
|
15860
|
+
/v1/memory/v3/backfill-sections:
|
|
15861
15861
|
post:
|
|
15862
|
-
operationId:
|
|
15863
|
-
summary:
|
|
15862
|
+
operationId: memory_v3_backfillsections_post
|
|
15863
|
+
summary: "One-time: embed every page's sections (incl synthetic skill/CLI rows) into the dense store"
|
|
15864
15864
|
tags:
|
|
15865
15865
|
- memory
|
|
15866
15866
|
responses:
|
|
@@ -15871,31 +15871,16 @@ paths:
|
|
|
15871
15871
|
schema:
|
|
15872
15872
|
type: object
|
|
15873
15873
|
properties:
|
|
15874
|
-
|
|
15875
|
-
type:
|
|
15876
|
-
|
|
15877
|
-
type:
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
type: number
|
|
15881
|
-
danglingRefs:
|
|
15882
|
-
type: number
|
|
15883
|
-
novelClusters:
|
|
15884
|
-
type: number
|
|
15885
|
-
oversizedLeaves:
|
|
15886
|
-
type: number
|
|
15887
|
-
tinyLeaves:
|
|
15888
|
-
type: number
|
|
15889
|
-
required:
|
|
15890
|
-
- unassigned
|
|
15891
|
-
- danglingRefs
|
|
15892
|
-
- novelClusters
|
|
15893
|
-
- oversizedLeaves
|
|
15894
|
-
- tinyLeaves
|
|
15895
|
-
additionalProperties: false
|
|
15874
|
+
articles:
|
|
15875
|
+
type: number
|
|
15876
|
+
sections:
|
|
15877
|
+
type: number
|
|
15878
|
+
failures:
|
|
15879
|
+
type: number
|
|
15896
15880
|
required:
|
|
15897
|
-
-
|
|
15898
|
-
-
|
|
15881
|
+
- articles
|
|
15882
|
+
- sections
|
|
15883
|
+
- failures
|
|
15899
15884
|
additionalProperties: false
|
|
15900
15885
|
/v1/memory/v3/rebuild-index:
|
|
15901
15886
|
post:
|
|
@@ -15917,93 +15902,6 @@ paths:
|
|
|
15917
15902
|
required:
|
|
15918
15903
|
- ok
|
|
15919
15904
|
additionalProperties: false
|
|
15920
|
-
/v1/memory/v3/reconcile:
|
|
15921
|
-
post:
|
|
15922
|
-
operationId: memory_v3_reconcile_post
|
|
15923
|
-
summary: v1 convergence/prune pass over page+core refs (no rename detection without a prior snapshot)
|
|
15924
|
-
tags:
|
|
15925
|
-
- memory
|
|
15926
|
-
responses:
|
|
15927
|
-
"200":
|
|
15928
|
-
description: Successful response
|
|
15929
|
-
content:
|
|
15930
|
-
application/json:
|
|
15931
|
-
schema:
|
|
15932
|
-
type: object
|
|
15933
|
-
properties:
|
|
15934
|
-
renames:
|
|
15935
|
-
type: array
|
|
15936
|
-
items:
|
|
15937
|
-
type: object
|
|
15938
|
-
properties:
|
|
15939
|
-
id:
|
|
15940
|
-
type: string
|
|
15941
|
-
oldPath:
|
|
15942
|
-
type: string
|
|
15943
|
-
newPath:
|
|
15944
|
-
type: string
|
|
15945
|
-
required:
|
|
15946
|
-
- oldPath
|
|
15947
|
-
- newPath
|
|
15948
|
-
additionalProperties: false
|
|
15949
|
-
deleted:
|
|
15950
|
-
type: array
|
|
15951
|
-
items:
|
|
15952
|
-
type: string
|
|
15953
|
-
prunedCore:
|
|
15954
|
-
type: array
|
|
15955
|
-
items:
|
|
15956
|
-
type: string
|
|
15957
|
-
required:
|
|
15958
|
-
- renames
|
|
15959
|
-
- deleted
|
|
15960
|
-
- prunedCore
|
|
15961
|
-
additionalProperties: false
|
|
15962
|
-
/v1/memory/v3/set-core:
|
|
15963
|
-
post:
|
|
15964
|
-
operationId: memory_v3_setcore_post
|
|
15965
|
-
summary: Add/remove always-on core leaves (validates + previews cost)
|
|
15966
|
-
tags:
|
|
15967
|
-
- memory
|
|
15968
|
-
responses:
|
|
15969
|
-
"200":
|
|
15970
|
-
description: Successful response
|
|
15971
|
-
content:
|
|
15972
|
-
application/json:
|
|
15973
|
-
schema:
|
|
15974
|
-
type: object
|
|
15975
|
-
properties:
|
|
15976
|
-
nextCore:
|
|
15977
|
-
type: array
|
|
15978
|
-
items:
|
|
15979
|
-
type: string
|
|
15980
|
-
alwaysOnPageCount:
|
|
15981
|
-
type: number
|
|
15982
|
-
written:
|
|
15983
|
-
type: boolean
|
|
15984
|
-
required:
|
|
15985
|
-
- nextCore
|
|
15986
|
-
- alwaysOnPageCount
|
|
15987
|
-
- written
|
|
15988
|
-
additionalProperties: false
|
|
15989
|
-
requestBody:
|
|
15990
|
-
required: true
|
|
15991
|
-
content:
|
|
15992
|
-
application/json:
|
|
15993
|
-
schema:
|
|
15994
|
-
type: object
|
|
15995
|
-
properties:
|
|
15996
|
-
add:
|
|
15997
|
-
type: array
|
|
15998
|
-
items:
|
|
15999
|
-
type: string
|
|
16000
|
-
remove:
|
|
16001
|
-
type: array
|
|
16002
|
-
items:
|
|
16003
|
-
type: string
|
|
16004
|
-
write:
|
|
16005
|
-
type: boolean
|
|
16006
|
-
additionalProperties: false
|
|
16007
15905
|
/v1/messages:
|
|
16008
15906
|
get:
|
|
16009
15907
|
operationId: messages_get
|
package/package.json
CHANGED
|
@@ -2,7 +2,11 @@ import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
|
2
2
|
|
|
3
3
|
import type { Anthropic } from "@anthropic-ai/sdk";
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
ContentBlock,
|
|
7
|
+
Message,
|
|
8
|
+
ToolDefinition,
|
|
9
|
+
} from "../providers/types.js";
|
|
6
10
|
|
|
7
11
|
// ---------------------------------------------------------------------------
|
|
8
12
|
// Mock Anthropic SDK — must be before importing the provider
|
|
@@ -102,7 +106,6 @@ mock.module("@anthropic-ai/sdk", () => ({
|
|
|
102
106
|
}));
|
|
103
107
|
|
|
104
108
|
// Import after mocking
|
|
105
|
-
import { cachedTextBlock } from "../plugins/defaults/memory-v3-shadow/provider-blocks.js";
|
|
106
109
|
import { AnthropicProvider } from "../providers/anthropic/client.js";
|
|
107
110
|
import {
|
|
108
111
|
isPlaceholderSentinelText,
|
|
@@ -138,6 +141,18 @@ function toolResultMsg(toolUseId: string, content: string): Message {
|
|
|
138
141
|
};
|
|
139
142
|
}
|
|
140
143
|
|
|
144
|
+
// A stable prefix text block carrying a 1h-TTL cache_control breakpoint, as a
|
|
145
|
+
// caller may stamp before the provider sees it. The internal ContentBlock type
|
|
146
|
+
// omits cache_control (only the provider transforms it onto the wire), so reach
|
|
147
|
+
// it via a cast.
|
|
148
|
+
function cachedPrefixBlock(text: string): ContentBlock {
|
|
149
|
+
return {
|
|
150
|
+
type: "text",
|
|
151
|
+
text,
|
|
152
|
+
cache_control: { type: "ephemeral", ttl: "1h" },
|
|
153
|
+
} as unknown as ContentBlock;
|
|
154
|
+
}
|
|
155
|
+
|
|
141
156
|
const sampleTools: ToolDefinition[] = [
|
|
142
157
|
{
|
|
143
158
|
name: "file_read",
|
|
@@ -325,13 +340,13 @@ describe("AnthropicProvider — Cache-Control Characterization", () => {
|
|
|
325
340
|
});
|
|
326
341
|
|
|
327
342
|
test("preserves a caller's 1h block cache_control and sends the extended-cache beta (non-Haiku)", async () => {
|
|
328
|
-
//
|
|
329
|
-
//
|
|
343
|
+
// A caller that stamps a stable prefix block with a 1h TTL: the non-Haiku
|
|
344
|
+
// path must forward it unchanged and send the beta header.
|
|
330
345
|
await provider.sendMessage([
|
|
331
346
|
{
|
|
332
347
|
role: "user",
|
|
333
348
|
content: [
|
|
334
|
-
|
|
349
|
+
cachedPrefixBlock("stable pages block"),
|
|
335
350
|
{ type: "text", text: "volatile current message" },
|
|
336
351
|
],
|
|
337
352
|
},
|
|
@@ -349,7 +364,7 @@ describe("AnthropicProvider — Cache-Control Characterization", () => {
|
|
|
349
364
|
|
|
350
365
|
test("strips ttl from a caller's block cache_control and omits the beta for Haiku", async () => {
|
|
351
366
|
// Haiku doesn't support the extended-cache-ttl beta, so a caller-stamped
|
|
352
|
-
// 1h ttl
|
|
367
|
+
// 1h ttl on a message block must be stripped before sending.
|
|
353
368
|
const haiku = new AnthropicProvider(
|
|
354
369
|
"sk-ant-test",
|
|
355
370
|
"claude-haiku-4-5-20251001",
|
|
@@ -358,7 +373,7 @@ describe("AnthropicProvider — Cache-Control Characterization", () => {
|
|
|
358
373
|
{
|
|
359
374
|
role: "user",
|
|
360
375
|
content: [
|
|
361
|
-
|
|
376
|
+
cachedPrefixBlock("stable pages block"),
|
|
362
377
|
{ type: "text", text: "volatile current message" },
|
|
363
378
|
],
|
|
364
379
|
},
|
|
@@ -385,7 +400,7 @@ describe("AnthropicProvider — Cache-Control Characterization", () => {
|
|
|
385
400
|
{
|
|
386
401
|
role: "user",
|
|
387
402
|
content: [
|
|
388
|
-
|
|
403
|
+
cachedPrefixBlock("stable pages block"),
|
|
389
404
|
{ type: "text", text: "volatile current message" },
|
|
390
405
|
],
|
|
391
406
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wire contract for the memory v3 selection set surfaced in the inspector's
|
|
3
3
|
* Memory tab. Mirrors the return value of `getMemoryV3SelectionForInspector`
|
|
4
|
-
* in `assistant/src/memory
|
|
4
|
+
* in `assistant/src/plugins/defaults/memory-v3-shadow/selection-log-store.ts`.
|
|
5
5
|
*
|
|
6
6
|
* Canonical wire-contract source. Assistant code imports the types directly
|
|
7
7
|
* from this file via relative paths; external consumers (web client, gateway,
|
|
@@ -12,19 +12,27 @@
|
|
|
12
12
|
* `live` / `shadow` reflect the CURRENT `memory-v3-live` / `memory-v3-shadow`
|
|
13
13
|
* flag state, not the per-turn history (the selection rows don't record which
|
|
14
14
|
* mode was active when they were written). When `live` is true the rendered
|
|
15
|
-
* `injectedText`
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* `injectedText` reflects the live selection; when only `shadow` is true it is
|
|
16
|
+
* the block that WOULD have been injected.
|
|
17
|
+
*
|
|
18
|
+
* `injectedText` is APPROXIMATE, not a verbatim record. It is re-rendered from
|
|
19
|
+
* the persisted selection rows, which store slug/source/pinned but NOT the
|
|
20
|
+
* matched-section identity. A page that live injection sent as a single matched
|
|
21
|
+
* section is re-rendered here as its FULL page (the section ordinal isn't
|
|
22
|
+
* persisted), so the text can differ from what was actually sent to the model.
|
|
23
|
+
* The selected slug set is exact — only the rendered text is full-page
|
|
24
|
+
* approximate. Persisting the per-turn injected section is a documented
|
|
25
|
+
* follow-up.
|
|
19
26
|
*/
|
|
20
27
|
|
|
21
28
|
import { z } from "zod";
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
31
|
* One selected page in the v3 set. `source` is the lane that surfaced it —
|
|
25
|
-
* the daemon emits `
|
|
26
|
-
* schema stays a permissive string so a new lane label
|
|
27
|
-
* on the FE. `pinned` marks a slug carried
|
|
32
|
+
* the daemon emits `needle`, `dense`, `edge`, or `carry-forward` — but the
|
|
33
|
+
* schema stays a permissive string so a new lane label (or a historical
|
|
34
|
+
* pre-lane row) doesn't break parsing on the FE. `pinned` marks a slug carried
|
|
35
|
+
* forward across turns.
|
|
28
36
|
*/
|
|
29
37
|
export const MemoryV3SelectionRowSchema = z.object({
|
|
30
38
|
slug: z.string(),
|
|
@@ -36,8 +44,9 @@ export type MemoryV3SelectionRow = z.infer<typeof MemoryV3SelectionRowSchema>;
|
|
|
36
44
|
|
|
37
45
|
/**
|
|
38
46
|
* Memory v3 selection log shape. `injectedText` is the rendered
|
|
39
|
-
* `<memory>…</memory>` block for the selection
|
|
40
|
-
*
|
|
47
|
+
* `<memory>…</memory>` block for the selection — APPROXIMATE: re-rendered from
|
|
48
|
+
* the persisted rows, with full pages where live injection used a matched
|
|
49
|
+
* section (the section identity isn't persisted). See the file header.
|
|
41
50
|
*/
|
|
42
51
|
export const MemoryV3SelectionLogSchema = z.object({
|
|
43
52
|
turn: z.number(),
|