@vellumai/assistant 0.8.9-staging.2 → 0.8.9-staging.4
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/docs/activation-funnel-telemetry.md +310 -0
- package/openapi.yaml +16 -115
- package/package.json +1 -1
- package/src/__tests__/activation-early-marking.test.ts +120 -0
- package/src/__tests__/agent-loop-output-hooks.test.ts +13 -13
- package/src/__tests__/anthropic-provider.test.ts +23 -8
- package/src/__tests__/approval-cascade.test.ts +1 -1
- package/src/__tests__/compaction-direct.test.ts +32 -18
- package/src/__tests__/compaction-events.test.ts +2 -2
- package/src/__tests__/compaction.benchmark.test.ts +1 -1
- package/src/__tests__/context-overflow-reducer.test.ts +5 -5
- package/src/__tests__/context-window-manager-compact-retry.test.ts +121 -15
- package/src/__tests__/conversation-abort-tool-results.test.ts +1 -1
- package/src/__tests__/conversation-confirmation-signals.test.ts +1 -1
- package/src/__tests__/conversation-error.test.ts +15 -1
- package/src/__tests__/conversation-history-web-search.test.ts +5 -0
- package/src/__tests__/conversation-media-retry.test.ts +1 -1
- package/src/__tests__/conversation-process-app-control-preactivation.test.ts +40 -0
- package/src/__tests__/conversation-process-callsite.test.ts +1 -1
- package/src/__tests__/conversation-provider-retry-repair.test.ts +1 -1
- package/src/__tests__/conversation-queue.test.ts +1 -1
- package/src/__tests__/conversation-runtime-assembly.test.ts +71 -0
- package/src/__tests__/conversation-slash-queue.test.ts +1 -1
- package/src/__tests__/conversation-slash-unknown.test.ts +1 -1
- package/src/__tests__/conversation-speed-override.test.ts +1 -1
- package/src/__tests__/conversation-surfaces-activation-emit.test.ts +395 -0
- package/src/__tests__/conversation-surfaces-app-control.test.ts +44 -0
- package/src/__tests__/conversation-tool-setup-app-refresh.test.ts +73 -4
- package/src/__tests__/conversation-undo.test.ts +2 -2
- package/src/__tests__/conversation-workspace-cache-state.test.ts +1 -1
- package/src/__tests__/conversation-workspace-injection.test.ts +1 -1
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +1 -1
- package/src/__tests__/credential-security-invariants.test.ts +1 -0
- package/src/__tests__/cu-unified-flow.test.ts +36 -0
- package/src/__tests__/history-repair-hook.test.ts +2 -0
- package/src/__tests__/llm-resolver.test.ts +73 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +1 -2
- package/src/__tests__/persist-unsendable-image-downscale.test.ts +145 -0
- package/src/__tests__/persist-unsendable-image.test.ts +97 -1
- package/src/__tests__/plugin-external-api.test.ts +68 -0
- package/src/__tests__/post-turn-tool-result-truncation.test.ts +69 -0
- package/src/__tests__/published-app-updater.test.ts +138 -0
- package/src/__tests__/skill-feature-flags-integration.test.ts +5 -7
- package/src/__tests__/title-generate-hook.test.ts +2 -0
- package/src/__tests__/web-fetch.test.ts +45 -0
- package/src/acp/__tests__/helpers/acp-config-stub.ts +0 -2
- package/src/acp/resolve-agent.test.ts +0 -56
- package/src/acp/resolve-agent.ts +10 -38
- package/src/agent/loop.ts +13 -27
- 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/cli/lib/__tests__/install-from-github.test.ts +232 -29
- package/src/cli/lib/__tests__/plugin-details.test.ts +28 -19
- package/src/cli/lib/__tests__/plugin-marketplace.test.ts +57 -7
- package/src/cli/lib/__tests__/search-plugins.test.ts +17 -10
- package/src/cli/lib/install-from-github.ts +258 -41
- package/src/cli/lib/plugin-details.ts +20 -13
- package/src/cli/lib/plugin-marketplace.ts +23 -5
- package/src/cli/lib/search-plugins.ts +14 -8
- package/src/config/acp-defaults.ts +3 -3
- package/src/config/acp-schema.ts +1 -7
- package/src/config/bundled-skills/acp/SKILL.md +4 -17
- package/src/config/bundled-skills/acp/TOOLS.json +2 -2
- package/src/config/call-site-defaults.ts +0 -1
- package/src/config/feature-flag-registry.json +3 -18
- package/src/config/llm-resolver.ts +39 -7
- 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 +17 -1
- package/src/config/schemas/memory-v3.ts +58 -8
- package/src/config/seed-inference-profiles.ts +18 -0
- package/src/context/post-turn-tool-result-truncation.ts +39 -1
- package/src/daemon/conversation-agent-loop-handlers.ts +8 -1
- package/src/daemon/conversation-agent-loop.ts +87 -95
- package/src/daemon/conversation-error.ts +31 -4
- package/src/daemon/conversation-history.ts +1 -1
- package/src/daemon/conversation-media-retry.ts +19 -6
- package/src/daemon/conversation-messaging.ts +17 -0
- package/src/daemon/conversation-process.ts +14 -5
- package/src/daemon/conversation-queue-manager.ts +8 -0
- package/src/daemon/conversation-runtime-assembly.ts +37 -1
- package/src/daemon/conversation-surfaces.ts +141 -3
- package/src/daemon/conversation.ts +48 -13
- package/src/daemon/external-plugins-bootstrap.ts +8 -3
- package/src/daemon/persist-unsendable-image.ts +62 -25
- package/src/daemon/process-message.ts +1 -1
- package/src/daemon/tool-side-effects.ts +15 -0
- package/src/memory/__tests__/activation-session-store.test.ts +41 -0
- package/src/memory/__tests__/onboarding-events-store.test.ts +80 -0
- package/src/memory/activation-session-store.ts +43 -0
- package/src/memory/db-init.ts +4 -0
- package/src/memory/migrations/273-onboarding-events-funnel-columns.ts +46 -0
- package/src/memory/migrations/274-create-activation-sessions.ts +15 -0
- package/src/memory/migrations/index.ts +2 -0
- package/src/memory/onboarding-events-store.ts +66 -18
- package/src/memory/schema/infrastructure.ts +13 -0
- 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/messaging/providers/telegram-bot/api.ts +14 -5
- package/src/notifications/adapters/telegram.ts +7 -1
- package/src/plugin-api/constants.ts +2 -2
- package/src/plugin-api/index.ts +2 -2
- package/src/plugin-api/types.ts +19 -5
- package/src/plugins/defaults/compaction/compact.ts +24 -15
- package/src/plugins/defaults/compaction/context-overflow-reducer.ts +4 -4
- package/src/plugins/defaults/compaction/manager-store.ts +1 -1
- package/src/{context → plugins/defaults/compaction}/window-manager.ts +68 -12
- package/src/plugins/defaults/memory-retrieval/hooks/user-prompt-submit-temp.ts +12 -18
- 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/plugins/external-api.ts +114 -0
- package/src/prompts/system-prompt.ts +61 -10
- package/src/prompts/templates/BOOTSTRAP-ACTIVATION-RAIL.md +37 -2
- package/src/providers/anthropic/client.ts +9 -10
- package/src/providers/inference/kimi-cjk-token-ids.ts +493 -0
- package/src/providers/inference/logit-bias.ts +55 -0
- package/src/providers/openai/__tests__/vision-not-supported.test.ts +75 -0
- package/src/providers/openai/chat-completions-provider.ts +44 -1
- package/src/providers/retry.ts +22 -0
- package/src/providers/types.ts +6 -0
- package/src/runtime/routes/__tests__/stt-routes.test.ts +112 -0
- package/src/runtime/routes/acp-routes.test.ts +3 -20
- package/src/runtime/routes/app-management-routes.ts +3 -0
- package/src/runtime/routes/conversation-routes.ts +2 -0
- package/src/runtime/routes/memory-v3-routes.ts +64 -314
- package/src/runtime/routes/playground/__tests__/force-compact.test.ts +1 -1
- package/src/runtime/routes/stt-routes.ts +45 -12
- package/src/runtime/routes/workspace-routes.ts +50 -15
- package/src/services/published-app-updater.ts +30 -8
- package/src/telemetry/__tests__/activation-funnel.test.ts +95 -0
- package/src/telemetry/activation-funnel.ts +167 -0
- package/src/telemetry/types.ts +13 -0
- package/src/telemetry/usage-telemetry-reporter.test.ts +154 -0
- package/src/telemetry/usage-telemetry-reporter.ts +26 -1
- package/src/tools/acp/list-agents.test.ts +2 -18
- package/src/tools/acp/list-agents.ts +3 -15
- package/src/tools/acp/spawn.test.ts +0 -10
- package/src/tools/browser/browser-execution.ts +12 -2
- package/src/tools/network/web-fetch.ts +65 -24
- package/src/tools/skills/load.ts +1 -1
- package/src/tools/ui-surface/definitions.ts +7 -0
- package/src/acp/feature-gate.test.ts +0 -48
- package/src/acp/feature-gate.ts +0 -34
- 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
|
@@ -1,47 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `assistant memory v3` CLI subgroup.
|
|
3
3
|
*
|
|
4
|
-
* Operator-facing
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* write). The read-only `health` report and the `set-core` cost preview also
|
|
9
|
-
* route through the daemon so it stays the single source of truth for the live
|
|
10
|
-
* workspace tree.
|
|
4
|
+
* Operator-facing live-lane maintenance subcommands for the v3 memory subsystem
|
|
5
|
+
* (section-lane retrieval model). The daemon owns the live shadow lanes, so the
|
|
6
|
+
* verbs route through `cliIpcCall` to handlers that run inside the assistant
|
|
7
|
+
* process (where the in-memory lanes can be invalidated/rebuilt after a write).
|
|
11
8
|
*
|
|
12
9
|
* Subcommands:
|
|
13
10
|
*
|
|
14
|
-
* - `health` — print the structural health report (read-only).
|
|
15
|
-
* - `reconcile` — v1 convergence pass: rewrites any dangling page/core ref to
|
|
16
|
-
* the current on-disk tree and prunes stale core entries. It does NOT yet
|
|
17
|
-
* detect renames/moves/splits — that requires a captured prior leaf
|
|
18
|
-
* snapshot (a follow-up), so `renames` is always empty in v1.
|
|
19
|
-
* - `set-core` — add/remove always-on core leaves. Validates that every added
|
|
20
|
-
* leaf exists, previews the resulting always-on page count, and writes only
|
|
21
|
-
* on `--yes`.
|
|
22
11
|
* - `rebuild-index` — invalidate the v3 lanes so the next turn rebuilds.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
12
|
+
* - `backfill-sections` — one-time: embed every page's sections (including
|
|
13
|
+
* synthetic skill/CLI rows) into the dense store, then advance the maintain
|
|
14
|
+
* checkpoint. For the transition before A/B/cutover, since the collection
|
|
15
|
+
* starts empty and the incremental maintain pass only re-embeds deltas.
|
|
26
16
|
*/
|
|
27
17
|
|
|
28
18
|
import type { Command } from "commander";
|
|
29
19
|
|
|
30
20
|
import { cliIpcCall } from "../../ipc/cli-client.js";
|
|
31
21
|
import type {
|
|
32
|
-
|
|
22
|
+
MemoryV3BackfillSectionsResult,
|
|
33
23
|
MemoryV3RebuildIndexResult,
|
|
34
|
-
MemoryV3ReconcileResult,
|
|
35
|
-
MemoryV3SetCoreResult,
|
|
36
24
|
} from "../../runtime/routes/memory-v3-routes.js";
|
|
37
25
|
import { registerCommand } from "../lib/register-command.js";
|
|
38
26
|
import { log } from "../logger.js";
|
|
39
27
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
/**
|
|
29
|
+
* IPC timeout for `backfill-sections`. The one-time full-corpus section embed
|
|
30
|
+
* runs every page's chunks through the embedder sequentially, which easily
|
|
31
|
+
* outlasts `cliIpcCall`'s default 60s — so we give it a generous 30-minute
|
|
32
|
+
* ceiling rather than report a spurious "Request timed out" while the assistant
|
|
33
|
+
* keeps working.
|
|
34
|
+
*/
|
|
35
|
+
const BACKFILL_IPC_TIMEOUT_MS = 30 * 60 * 1000;
|
|
45
36
|
|
|
46
37
|
export function registerMemoryV3Command(program: Command): void {
|
|
47
38
|
// Reuse an existing `memory` parent if some other registrar attached to it
|
|
@@ -54,97 +45,80 @@ export function registerMemoryV3Command(program: Command): void {
|
|
|
54
45
|
registerCommand(memory, {
|
|
55
46
|
name: "v3",
|
|
56
47
|
transport: "ipc",
|
|
57
|
-
description: "Memory v3
|
|
48
|
+
description: "Memory v3 live-lane maintenance (section-lane model)",
|
|
58
49
|
build: (v3) => {
|
|
59
50
|
v3.addHelpText(
|
|
60
51
|
"after",
|
|
61
52
|
`
|
|
62
|
-
The v3 memory subsystem
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
fail-closed validates before committing, and invalidates the live lanes so
|
|
66
|
-
the next turn rebuilds from the reconciled state.
|
|
53
|
+
The v3 memory subsystem retrieves concept pages over section-grain lanes and
|
|
54
|
+
caches them as live shadow lanes inside the assistant. These commands maintain
|
|
55
|
+
that live state safely.
|
|
67
56
|
|
|
68
57
|
Examples:
|
|
69
|
-
$ assistant memory v3
|
|
70
|
-
$ assistant memory v3
|
|
71
|
-
$ assistant memory v3 set-core --remove domain-a/topic-y --yes
|
|
72
|
-
$ assistant memory v3 reconcile
|
|
73
|
-
$ assistant memory v3 rebuild-index`,
|
|
58
|
+
$ assistant memory v3 rebuild-index
|
|
59
|
+
$ assistant memory v3 backfill-sections`,
|
|
74
60
|
);
|
|
75
61
|
|
|
76
|
-
// ──
|
|
62
|
+
// ── rebuild-index ─────────────────────────────────────────────────────
|
|
77
63
|
|
|
78
|
-
v3.command("
|
|
79
|
-
.description("
|
|
80
|
-
.option("--json", "Emit raw JSON instead of the rendered report")
|
|
64
|
+
v3.command("rebuild-index")
|
|
65
|
+
.description("Invalidate the v3 lanes so the next turn rebuilds")
|
|
81
66
|
.addHelpText(
|
|
82
67
|
"after",
|
|
83
68
|
`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"all green" when no maintenance is warranted.
|
|
69
|
+
Drops the assistant's cached v3 shadow lanes so the section index is rebuilt
|
|
70
|
+
from the current on-disk state on the next turn. Useful after editing concept
|
|
71
|
+
pages out-of-band.
|
|
88
72
|
|
|
89
73
|
Examples:
|
|
90
|
-
$ assistant memory v3
|
|
91
|
-
$ assistant memory v3 health --json | jq '.counts'`,
|
|
74
|
+
$ assistant memory v3 rebuild-index`,
|
|
92
75
|
)
|
|
93
|
-
.action(async (
|
|
94
|
-
const result = await cliIpcCall<
|
|
95
|
-
"
|
|
76
|
+
.action(async () => {
|
|
77
|
+
const result = await cliIpcCall<MemoryV3RebuildIndexResult>(
|
|
78
|
+
"memory_v3_rebuild_index",
|
|
96
79
|
{ body: {} },
|
|
97
80
|
);
|
|
98
81
|
if (!result.ok) {
|
|
99
|
-
log.error(result.error ?? "Failed to
|
|
82
|
+
log.error(result.error ?? "Failed to invalidate the v3 lanes");
|
|
100
83
|
process.exitCode = 1;
|
|
101
84
|
return;
|
|
102
85
|
}
|
|
103
|
-
|
|
104
|
-
if (opts.json === true) {
|
|
105
|
-
log.info(JSON.stringify(payload, null, 2));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
log.info(
|
|
109
|
-
payload.rendered === ""
|
|
110
|
-
? "memory-v3 health: all green"
|
|
111
|
-
: payload.rendered,
|
|
112
|
-
);
|
|
86
|
+
log.info("v3 lanes invalidated; next turn will rebuild.");
|
|
113
87
|
});
|
|
114
88
|
|
|
115
|
-
// ──
|
|
89
|
+
// ── backfill-sections ─────────────────────────────────────────────────
|
|
116
90
|
|
|
117
|
-
v3.command("
|
|
91
|
+
v3.command("backfill-sections")
|
|
118
92
|
.description(
|
|
119
|
-
"
|
|
93
|
+
"One-time: embed every page's sections into the dense store (incl skills/CLI)",
|
|
120
94
|
)
|
|
121
95
|
.option("--json", "Emit raw JSON instead of a formatted summary")
|
|
122
96
|
.addHelpText(
|
|
123
97
|
"after",
|
|
124
98
|
`
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
99
|
+
Embeds EVERY concept page's sections — including synthetic skill and CLI
|
|
100
|
+
capability rows — into the section dense store in one pass, then advances
|
|
101
|
+
the maintain checkpoint so the next incremental pass only re-embeds future
|
|
102
|
+
edits. Use this once on an existing install before the section-lane A/B and
|
|
103
|
+
cutover: the dense collection starts empty, and the periodic maintenance
|
|
104
|
+
pass only re-embeds pages edited since its last run (and never the synthetic
|
|
105
|
+
rows), so most of the corpus would otherwise never be embedded.
|
|
130
106
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
so renames always report as empty and a true rename surfaces as a
|
|
134
|
-
delete + add. Full rename/move/split detection requires persisting a prior
|
|
135
|
-
leaf snapshot and is a planned follow-up.
|
|
107
|
+
Idempotent and safe to re-run. Runs inside the assistant so it uses the live
|
|
108
|
+
configuration and advances the checkpoint the assistant reads.
|
|
136
109
|
|
|
137
110
|
Examples:
|
|
138
|
-
$ assistant memory v3
|
|
139
|
-
$ assistant memory v3
|
|
111
|
+
$ assistant memory v3 backfill-sections
|
|
112
|
+
$ assistant memory v3 backfill-sections --json | jq '.sections'`,
|
|
140
113
|
)
|
|
141
114
|
.action(async (opts: { json?: boolean }) => {
|
|
142
|
-
const result = await cliIpcCall<
|
|
143
|
-
"
|
|
115
|
+
const result = await cliIpcCall<MemoryV3BackfillSectionsResult>(
|
|
116
|
+
"memory_v3_backfill_sections",
|
|
144
117
|
{ body: {} },
|
|
118
|
+
{ timeoutMs: BACKFILL_IPC_TIMEOUT_MS },
|
|
145
119
|
);
|
|
146
120
|
if (!result.ok) {
|
|
147
|
-
log.error(result.error ?? "Failed to
|
|
121
|
+
log.error(result.error ?? "Failed to backfill section embeddings");
|
|
148
122
|
process.exitCode = 1;
|
|
149
123
|
return;
|
|
150
124
|
}
|
|
@@ -154,127 +128,11 @@ Examples:
|
|
|
154
128
|
return;
|
|
155
129
|
}
|
|
156
130
|
log.info(
|
|
157
|
-
`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
log.info(
|
|
163
|
-
`Deleted: ${payload.deleted.length === 0 ? "none" : payload.deleted.join(", ")}`,
|
|
131
|
+
`Embedded ${payload.sections} sections across ${payload.articles} pages` +
|
|
132
|
+
(payload.failures > 0
|
|
133
|
+
? ` (${payload.failures} page(s) failed — see assistant logs).`
|
|
134
|
+
: "."),
|
|
164
135
|
);
|
|
165
|
-
log.info(
|
|
166
|
-
`Pruned core: ${payload.prunedCore.length === 0 ? "none" : payload.prunedCore.join(", ")}`,
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
// ── set-core ──────────────────────────────────────────────────────────
|
|
171
|
-
|
|
172
|
-
v3.command("set-core")
|
|
173
|
-
.description(
|
|
174
|
-
"Add/remove always-on core leaves (previews cost; writes on --yes)",
|
|
175
|
-
)
|
|
176
|
-
.option(
|
|
177
|
-
"--add <leaf>",
|
|
178
|
-
"Leaf path to add to the always-on core set (repeatable)",
|
|
179
|
-
collect,
|
|
180
|
-
[] as string[],
|
|
181
|
-
)
|
|
182
|
-
.option(
|
|
183
|
-
"--remove <leaf>",
|
|
184
|
-
"Leaf path to remove from the always-on core set (repeatable)",
|
|
185
|
-
collect,
|
|
186
|
-
[] as string[],
|
|
187
|
-
)
|
|
188
|
-
.option("--yes", "Apply the change (otherwise preview only)")
|
|
189
|
-
.option("--json", "Emit raw JSON instead of a formatted summary")
|
|
190
|
-
.addHelpText(
|
|
191
|
-
"after",
|
|
192
|
-
`
|
|
193
|
-
Edits the always-on core leaf set in core.json. Every --add entry must
|
|
194
|
-
exist in the live tree (unknown leaves are rejected). Without --yes this
|
|
195
|
-
PREVIEWS the resulting core set and the number of unique page slugs it
|
|
196
|
-
would pin always-on, WITHOUT writing. Pass --yes to persist and invalidate
|
|
197
|
-
the lanes.
|
|
198
|
-
|
|
199
|
-
Examples:
|
|
200
|
-
$ assistant memory v3 set-core --add domain-a/topic-x # preview
|
|
201
|
-
$ assistant memory v3 set-core --add domain-a/topic-x --yes # apply
|
|
202
|
-
$ assistant memory v3 set-core --remove domain-b/topic-z --yes`,
|
|
203
|
-
)
|
|
204
|
-
.action(
|
|
205
|
-
async (opts: {
|
|
206
|
-
add: string[];
|
|
207
|
-
remove: string[];
|
|
208
|
-
yes?: boolean;
|
|
209
|
-
json?: boolean;
|
|
210
|
-
}) => {
|
|
211
|
-
if (opts.add.length === 0 && opts.remove.length === 0) {
|
|
212
|
-
log.error("Pass at least one --add or --remove leaf path.");
|
|
213
|
-
process.exitCode = 1;
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const result = await cliIpcCall<MemoryV3SetCoreResult>(
|
|
218
|
-
"memory_v3_set_core",
|
|
219
|
-
{
|
|
220
|
-
body: {
|
|
221
|
-
add: opts.add,
|
|
222
|
-
remove: opts.remove,
|
|
223
|
-
write: opts.yes === true,
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
);
|
|
227
|
-
if (!result.ok) {
|
|
228
|
-
log.error(result.error ?? "Failed to update the v3 core set");
|
|
229
|
-
process.exitCode = 1;
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const payload = result.result!;
|
|
233
|
-
if (opts.json === true) {
|
|
234
|
-
log.info(JSON.stringify(payload, null, 2));
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
log.info(
|
|
238
|
-
`Core leaves (${payload.nextCore.length}): ${
|
|
239
|
-
payload.nextCore.length === 0
|
|
240
|
-
? "none"
|
|
241
|
-
: payload.nextCore.join(", ")
|
|
242
|
-
}`,
|
|
243
|
-
);
|
|
244
|
-
log.info(`Always-on page count: ${payload.alwaysOnPageCount}`);
|
|
245
|
-
if (payload.written) {
|
|
246
|
-
log.info("Written to core.json; lanes invalidated.");
|
|
247
|
-
} else {
|
|
248
|
-
log.info("Preview only — re-run with --yes to apply.");
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
// ── rebuild-index ─────────────────────────────────────────────────────
|
|
254
|
-
|
|
255
|
-
v3.command("rebuild-index")
|
|
256
|
-
.description("Invalidate the v3 lanes so the next turn rebuilds")
|
|
257
|
-
.addHelpText(
|
|
258
|
-
"after",
|
|
259
|
-
`
|
|
260
|
-
Drops the daemon's cached v3 shadow lanes so the tree + needle are rebuilt
|
|
261
|
-
from the current on-disk state on the next turn. Useful after editing leaf
|
|
262
|
-
files or assignments out-of-band.
|
|
263
|
-
|
|
264
|
-
Examples:
|
|
265
|
-
$ assistant memory v3 rebuild-index`,
|
|
266
|
-
)
|
|
267
|
-
.action(async () => {
|
|
268
|
-
const result = await cliIpcCall<MemoryV3RebuildIndexResult>(
|
|
269
|
-
"memory_v3_rebuild_index",
|
|
270
|
-
{ body: {} },
|
|
271
|
-
);
|
|
272
|
-
if (!result.ok) {
|
|
273
|
-
log.error(result.error ?? "Failed to invalidate the v3 lanes");
|
|
274
|
-
process.exitCode = 1;
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
log.info("v3 lanes invalidated; next turn will rebuild.");
|
|
278
136
|
});
|
|
279
137
|
},
|
|
280
138
|
});
|