@vellumai/assistant 0.8.7-dev.202606052232.2ddc989 → 0.8.8
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/bun.lock +2 -2
- package/docs/plugins.md +832 -0
- package/examples/plugins/echo/README.md +60 -61
- package/examples/plugins/echo/package.json +2 -1
- package/examples/plugins/echo/register.ts +143 -0
- package/node_modules/@vellumai/skill-host-contracts/src/skill-host.ts +6 -7
- package/openapi.yaml +5 -15
- package/package.json +2 -2
- package/src/__tests__/agent-loop-exit-reason.test.ts +56 -3
- package/src/__tests__/anthropic-provider.test.ts +1 -1
- package/src/__tests__/app-control-flow.test.ts +1 -1
- package/src/__tests__/app-dir-path-guard.test.ts +0 -1
- package/src/__tests__/approval-routes-http.test.ts +1 -4
- package/src/__tests__/channel-approval-routes.test.ts +1 -1
- package/src/__tests__/channel-approvals.test.ts +1 -1
- package/src/__tests__/circuit-breaker-pipeline.test.ts +405 -0
- package/src/__tests__/compaction-pipeline.test.ts +210 -0
- package/src/__tests__/compaction-timeout-recovery.test.ts +251 -0
- package/src/__tests__/conversation-agent-loop-disk-pressure.test.ts +3 -0
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +3 -0
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +7 -3
- package/src/__tests__/conversation-agent-loop.test.ts +39 -42
- package/src/__tests__/conversation-clean-command.test.ts +2 -5
- package/src/__tests__/conversation-provider-retry-repair.test.ts +5 -4
- package/src/__tests__/conversation-runtime-assembly.test.ts +71 -140
- package/src/__tests__/conversation-runtime-workspace.test.ts +27 -108
- package/src/__tests__/conversation-starter-routes.test.ts +6 -14
- package/src/__tests__/conversation-workspace-cache-state.test.ts +16 -17
- package/src/__tests__/conversation-workspace-injection.test.ts +1 -61
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +6 -7
- package/src/__tests__/db-acp-history.test.ts +0 -101
- package/src/__tests__/dynamic-page-surface.test.ts +0 -31
- package/src/__tests__/file-write-tool.test.ts +0 -63
- package/src/__tests__/gateway-only-guard.test.ts +2 -12
- package/src/__tests__/guardian-grant-minting.test.ts +1 -1
- package/src/__tests__/guardian-routing-invariants.test.ts +4 -2
- package/src/__tests__/handlers-user-message-approval-consumption.test.ts +1 -1
- package/src/__tests__/heartbeat-disk-pressure.test.ts +0 -1
- package/src/__tests__/heartbeat-service.test.ts +0 -1
- package/src/__tests__/host-app-control-routes.test.ts +1 -1
- package/src/__tests__/host-cu-routes-targeted.test.ts +3 -3
- package/src/__tests__/injector-background-turn.test.ts +1 -1
- package/src/__tests__/injector-chain.test.ts +6 -34
- package/src/__tests__/injector-disk-pressure.test.ts +34 -77
- package/src/__tests__/injector-document-comments.test.ts +1 -1
- package/src/__tests__/list-messages-hidden-metadata.test.ts +0 -38
- package/src/__tests__/memory-v2-static-injector.test.ts +1 -1
- package/src/__tests__/{overflow-reduction-loop.test.ts → overflow-reduce-pipeline.test.ts} +284 -64
- package/src/__tests__/pipeline-runner.test.ts +554 -0
- package/src/__tests__/plugin-api-shim.test.ts +6 -3
- package/src/__tests__/plugin-bootstrap.test.ts +23 -12
- package/src/__tests__/plugin-registry.test.ts +49 -3
- package/src/__tests__/plugin-types.test.ts +70 -0
- package/src/__tests__/reaction-persistence.test.ts +1 -1
- package/src/__tests__/send-endpoint-busy.test.ts +1 -4
- package/src/__tests__/skill-feature-flags-integration.test.ts +0 -33
- package/src/__tests__/subagent-call-site-routing.test.ts +1 -1
- package/src/__tests__/subagent-fork-notifications.test.ts +3 -1
- package/src/__tests__/subagent-fork-spawn.test.ts +1 -1
- package/src/__tests__/subagent-manager-notify.test.ts +3 -1
- package/src/__tests__/subagent-notify-parent.test.ts +3 -1
- package/src/__tests__/subagent-spawn-tool-fork.test.ts +1 -1
- package/src/__tests__/user-plugin-loader.test.ts +286 -54
- package/src/acp/__tests__/client-handler.test.ts +0 -40
- package/src/acp/__tests__/prepare-agent-env.test.ts +0 -137
- package/src/acp/__tests__/session-manager-persistence.test.ts +28 -95
- package/src/acp/agent-process.ts +1 -61
- package/src/acp/client-handler.ts +0 -31
- package/src/acp/prepare-agent-env.ts +29 -83
- package/src/acp/resolve-agent.test.ts +7 -320
- package/src/acp/resolve-agent.ts +18 -182
- package/src/acp/session-manager.ts +73 -495
- package/src/acp/types.ts +0 -8
- package/src/agent/compaction-circuit.ts +102 -60
- package/src/agent/loop.ts +59 -32
- package/src/api/responses/conversation-message.ts +1 -7
- package/src/approvals/guardian-request-resolvers.ts +1 -1
- package/src/background-wake/next-wake.ts +0 -1
- package/src/config/__tests__/feature-flag-registry-guard.test.ts +2 -2
- package/src/config/acp-defaults.test.ts +0 -10
- package/src/config/acp-defaults.ts +0 -6
- package/src/config/bundled-skills/acp/SKILL.md +31 -83
- package/src/config/bundled-skills/acp/TOOLS.json +4 -4
- package/src/config/bundled-skills/app-builder/SKILL.md +381 -224
- package/src/config/bundled-skills/app-builder/TOOLS.json +0 -29
- package/src/config/bundled-skills/document-editor/SKILL.md +23 -28
- package/src/config/bundled-skills/document-editor/TOOLS.json +1 -1
- package/src/config/bundled-tool-registry.ts +0 -2
- package/src/config/feature-flag-registry.json +5 -14
- package/src/config/schemas/heartbeat.ts +0 -9
- package/src/context/strip-injections.ts +2 -8
- package/src/context/window-manager.ts +1 -2
- package/src/daemon/conversation-agent-loop-handlers.ts +11 -0
- package/src/daemon/conversation-agent-loop.ts +279 -62
- package/src/daemon/conversation-runtime-assembly.ts +69 -106
- package/src/daemon/conversation-store.ts +90 -9
- package/src/daemon/conversation-workspace.ts +0 -17
- package/src/daemon/conversation.ts +6 -0
- package/src/daemon/external-plugins-bootstrap.ts +11 -11
- package/src/daemon/handlers/conversations.ts +1 -3
- package/src/daemon/handlers/skills.ts +1 -4
- package/src/daemon/lifecycle.ts +0 -21
- package/src/daemon/server.ts +0 -2
- package/src/heartbeat/__tests__/heartbeat-service.test.ts +0 -3
- package/src/heartbeat/heartbeat-run-store.ts +1 -23
- package/src/heartbeat/heartbeat-service.ts +0 -26
- package/src/ipc/__tests__/browser-ipc.test.ts +1 -1
- package/src/ipc/__tests__/ui-request-route.test.ts +3 -3
- package/src/ipc/skill-routes/__tests__/memory.test.ts +0 -15
- package/src/ipc/skill-routes/memory.ts +2 -4
- package/src/memory/conversation-starter-checkpoints.ts +0 -1
- package/src/memory/db-init.ts +0 -2
- package/src/memory/job-handlers/conversation-starters.ts +2 -13
- package/src/memory/jobs-worker.ts +1 -1
- package/src/memory/migrations/index.ts +0 -1
- package/src/memory/schema/acp.ts +0 -4
- package/src/memory/v2/__tests__/consolidation-job.test.ts +3 -3
- package/src/memory/v2/consolidation-job.ts +4 -13
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/assign.test.ts +4 -4
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/live-integration.test.ts +4 -4
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/maintain-job.test.ts +5 -5
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/orchestrate.test.ts +3 -3
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/reconcile.test.ts +2 -2
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/render-injection.test.ts +1 -1
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/router.test.ts +3 -3
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/selection-log-store.test.ts +8 -8
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/selector.test.ts +3 -3
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/shadow-plugin.test.ts +12 -12
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/assign.ts +5 -5
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/capabilities.ts +2 -2
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/maintain-job.ts +8 -8
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/page-content.ts +2 -2
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/provider-blocks.ts +1 -1
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/reconcile.ts +3 -3
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/render-injection.ts +1 -1
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/router.ts +3 -3
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/selection-log-store.ts +4 -4
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/selector.ts +4 -4
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/shadow-plugin.ts +90 -28
- package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/tree.ts +1 -1
- package/src/plugin-api/index.ts +5 -0
- package/src/plugins/defaults/circuit-breaker/middlewares/circuitBreaker.ts +93 -0
- package/src/plugins/defaults/{memory-v3-shadow → circuit-breaker}/package.json +2 -2
- package/src/plugins/defaults/circuit-breaker/register.ts +39 -0
- package/src/plugins/defaults/compaction/middlewares/compaction.ts +25 -0
- package/src/plugins/defaults/compaction/package.json +1 -1
- package/src/plugins/defaults/compaction/register.ts +19 -8
- package/src/plugins/defaults/compaction/terminal.ts +73 -0
- package/src/plugins/defaults/index.ts +5 -3
- package/src/plugins/defaults/{memory-retrieval/injectors.ts → injectors/register.ts} +7 -45
- package/src/plugins/defaults/memory-retrieval/hooks/post-compact.ts +7 -11
- package/src/plugins/defaults/memory-retrieval/injector-chain.ts +2 -2
- package/src/plugins/defaults/overflow-reduce/middlewares/overflowReduce.ts +126 -0
- package/src/plugins/defaults/overflow-reduce/package.json +15 -0
- package/src/plugins/defaults/overflow-reduce/register.ts +42 -0
- package/src/plugins/external-api.ts +2 -2
- package/src/plugins/pipeline.ts +293 -6
- package/src/plugins/registry.ts +37 -9
- package/src/plugins/types.ts +336 -32
- package/src/plugins/user-loader.ts +127 -30
- package/src/proactive-artifact/aux-message-injector.ts +1 -1
- package/src/proactive-artifact/job.test.ts +1 -1
- package/src/prompts/__tests__/system-prompt.test.ts +0 -6
- package/src/prompts/templates/BOOTSTRAP-ACTIVATION-RAIL.md +2 -4
- package/src/runtime/__tests__/agent-wake.test.ts +5 -5
- package/src/runtime/__tests__/interactive-ui.test.ts +1 -1
- package/src/runtime/agent-wake.ts +3 -0
- package/src/runtime/assistant-event-hub.ts +1 -1
- package/src/runtime/channel-approvals.ts +1 -1
- package/src/runtime/interactive-ui.ts +1 -1
- package/src/runtime/routes/__tests__/acp-routes.test.ts +55 -283
- package/src/runtime/routes/__tests__/conversation-list-routes.test.ts +1 -1
- package/src/runtime/routes/__tests__/surface-action-routes.test.ts +4 -5
- package/src/runtime/routes/__tests__/surface-content-routes.test.ts +1 -4
- package/src/runtime/routes/acp-routes.test.ts +25 -89
- package/src/runtime/routes/acp-routes.ts +29 -81
- package/src/runtime/routes/approval-routes.ts +1 -1
- package/src/runtime/routes/browser-routes.ts +1 -1
- package/src/runtime/routes/browser-tabs-routes.ts +10 -6
- package/src/runtime/routes/conversation-cli-routes.ts +1 -1
- package/src/runtime/routes/conversation-list-routes.ts +1 -1
- package/src/runtime/routes/conversation-query-routes.ts +1 -1
- package/src/runtime/routes/conversation-routes.ts +2 -15
- package/src/runtime/routes/conversation-starter-routes.ts +7 -13
- package/src/runtime/routes/conversations-import-routes.ts +7 -24
- package/src/runtime/routes/host-app-control-routes.ts +1 -1
- package/src/runtime/routes/host-cu-routes.ts +1 -1
- package/src/runtime/routes/identity-routes.ts +3 -18
- package/src/runtime/routes/inbound-message-handler.ts +1 -1
- package/src/runtime/routes/memory-v3-routes.ts +6 -16
- package/src/runtime/routes/playground/helpers.ts +1 -1
- package/src/runtime/routes/surface-conversation-resolver.ts +3 -4
- package/src/runtime/routes/work-items-routes.ts +4 -2
- package/src/runtime/services/conversation-serializer.ts +1 -1
- package/src/signals/cancel.ts +4 -2
- package/src/subagent/manager.ts +5 -17
- package/src/tools/acp/list-agents.test.ts +1 -7
- package/src/tools/acp/spawn.test.ts +55 -158
- package/src/tools/acp/spawn.ts +72 -47
- package/src/tools/acp/steer.test.ts +8 -105
- package/src/tools/acp/steer.ts +17 -48
- package/src/tools/apps/executors.ts +8 -13
- package/src/tools/filesystem/write.ts +0 -34
- package/src/tools/subagent/spawn.ts +4 -2
- package/src/tools/ui-surface/definitions.ts +4 -25
- package/src/workspace/migrations/051-seed-conversation-summarization-callsite.ts +5 -4
- package/src/workspace/migrations/097-enable-adaptive-thinking-managed-profiles.ts +45 -69
- package/examples/plugins/echo/hooks/post-tool-use.ts +0 -18
- package/examples/plugins/echo/hooks/stop.ts +0 -16
- package/examples/plugins/echo/hooks/user-prompt-submit.ts +0 -18
- package/examples/plugins/echo/src/emit.ts +0 -19
- package/src/__tests__/compaction-circuit.test.ts +0 -258
- package/src/__tests__/compaction-direct.test.ts +0 -132
- package/src/__tests__/conversations-import-system-filter.test.ts +0 -101
- package/src/acp/__tests__/agent-process.test.ts +0 -161
- package/src/acp/__tests__/helpers/acp-history-db.ts +0 -82
- package/src/acp/__tests__/helpers/exec-file-stub.ts +0 -101
- package/src/acp/__tests__/session-manager-resume.test.ts +0 -736
- package/src/acp/auto-install.test.ts +0 -196
- package/src/acp/auto-install.ts +0 -177
- package/src/acp/feature-gate.test.ts +0 -48
- package/src/acp/feature-gate.ts +0 -34
- package/src/acp/resume-hint.ts +0 -25
- package/src/config/bundled-skills/app-builder/references/DESIGN_SYSTEM.md +0 -48
- package/src/config/bundled-skills/app-builder/references/RESPONSIVE.md +0 -57
- package/src/config/bundled-skills/app-builder/references/SLIDES.md +0 -38
- package/src/config/bundled-skills/app-builder/tools/app-list.ts +0 -62
- package/src/daemon/conversation-registry.ts +0 -159
- package/src/daemon/overflow-reduction-loop.ts +0 -230
- package/src/memory/migrations/272-acp-session-history-cwd.ts +0 -36
- package/src/plugins/defaults/compaction/compact.ts +0 -59
- package/src/plugins/defaults/memory-v3-shadow/hooks/post-compact.ts +0 -14
- package/src/plugins/defaults/memory-v3-shadow/hooks/user-prompt-submit.ts +0 -19
- package/src/plugins/defaults/memory-v3-shadow/injector.ts +0 -75
- package/src/plugins/defaults/memory-v3-shadow/register.ts +0 -26
- package/src/tools/acp/context.ts +0 -20
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/capabilities.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/core.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/fixtures/eval-turns.json +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/fixtures/live-turns.json +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/health.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/needle.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/provider-blocks.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/snapshot.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/tree.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/types.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/working-set-eviction.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/__tests__/working-set-skeleton.test.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/core.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/README.md +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/assignments.json +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/core.json +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/leaves/domain-a/topic-x.md +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/leaves/domain-a/topic-y.md +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/data/leaves/domain-b/topic-z.md +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/health.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/llm-retry.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/needle.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/orchestrate.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/snapshot.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/types.ts +0 -0
- /package/src/{plugins/defaults/memory-v3-shadow → memory/v3}/working-set.ts +0 -0
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
* Exposes spawn, steer, cancel, close, sessions, and permission operations
|
|
5
5
|
* over HTTP and IPC.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { desc, eq, inArray } from "drizzle-orm";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
10
|
-
import { resolveAgentWithAutoInstall } from "../../acp/auto-install.js";
|
|
11
10
|
import { getAcpSessionManager } from "../../acp/index.js";
|
|
12
11
|
import { prepareAgentEnv } from "../../acp/prepare-agent-env.js";
|
|
13
|
-
import {
|
|
14
|
-
import { AcpResumeError } from "../../acp/session-manager.js";
|
|
12
|
+
import { resolveAcpAgent } from "../../acp/resolve-agent.js";
|
|
15
13
|
import type { AcpSessionState } from "../../acp/types.js";
|
|
16
14
|
import { getDb } from "../../memory/db-connection.js";
|
|
17
15
|
import { rawChanges } from "../../memory/raw-query.js";
|
|
@@ -63,19 +61,26 @@ async function spawnSession({ body }: RouteHandlerArgs) {
|
|
|
63
61
|
throw new BadRequestError("agent, task, and conversationId are required");
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
// adapter binary (see acp/auto-install.ts). Shared with the skill-tool
|
|
68
|
-
// path in tools/acp/spawn.ts; only the transport mapping differs.
|
|
69
|
-
const { resolved, failureMessage } = await resolveAgentWithAutoInstall(agent);
|
|
70
|
-
if (failureMessage) {
|
|
71
|
-
throw new FailedDependencyError(failureMessage);
|
|
72
|
-
}
|
|
64
|
+
const resolved = resolveAcpAgent(agent);
|
|
73
65
|
if (!resolved.ok) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
switch (resolved.reason) {
|
|
67
|
+
case "acp_disabled":
|
|
68
|
+
throw new BadRequestError(resolved.hint);
|
|
69
|
+
case "unknown_agent":
|
|
70
|
+
throw new BadRequestError(
|
|
71
|
+
`Unknown agent "${agent}". Available: ${resolved.available.join(", ")}.`,
|
|
72
|
+
);
|
|
73
|
+
case "binary_not_found":
|
|
74
|
+
throw new FailedDependencyError(
|
|
75
|
+
`${resolved.command} is not on PATH. ${resolved.hint}`,
|
|
76
|
+
);
|
|
77
|
+
default: {
|
|
78
|
+
const _exhaustive: never = resolved;
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Unexpected acp resolver reason: ${(_exhaustive as { reason: string }).reason}`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
77
83
|
}
|
|
78
|
-
throw new BadRequestError(message);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
// Inject required env vars and preflight via the shared helper. See
|
|
@@ -111,31 +116,13 @@ async function steerSession({ pathParams, body }: RouteHandlerArgs) {
|
|
|
111
116
|
throw new BadRequestError("instruction is required");
|
|
112
117
|
}
|
|
113
118
|
|
|
114
|
-
// Sessions no longer in memory (completed, or lost to a daemon restart)
|
|
115
|
-
// are transparently resumed from persisted history with the instruction
|
|
116
|
-
// fired in the same call, mirroring the acp_steer skill tool.
|
|
117
|
-
// broadcastMessage plays the sender role spawnSession gives it, so
|
|
118
|
-
// connected clients render the session.
|
|
119
119
|
const manager = getAcpSessionManager();
|
|
120
120
|
try {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
instruction,
|
|
124
|
-
broadcastMessage,
|
|
125
|
-
);
|
|
126
|
-
return resumed
|
|
127
|
-
? { acpSessionId: id, steered: true, resumed: true }
|
|
128
|
-
: { acpSessionId: id, steered: true };
|
|
129
|
-
} catch (err) {
|
|
130
|
-
// Resume errors carry the actionable hint (legacy row without cwd,
|
|
131
|
-
// agent capability missing, resolver failures, ...).
|
|
132
|
-
if (err instanceof AcpResumeError) {
|
|
133
|
-
throw new FailedDependencyError(err.message);
|
|
134
|
-
}
|
|
135
|
-
// Unknown ids (no in-memory session, no history row) and plain steer
|
|
136
|
-
// failures both map to 404, as before.
|
|
121
|
+
await manager.steer(id, instruction);
|
|
122
|
+
} catch {
|
|
137
123
|
throw new NotFoundError("ACP session not found");
|
|
138
124
|
}
|
|
125
|
+
return { acpSessionId: id, steered: true };
|
|
139
126
|
}
|
|
140
127
|
|
|
141
128
|
async function cancelSession({ pathParams }: RouteHandlerArgs) {
|
|
@@ -174,25 +161,9 @@ function bulkDeleteSessions({ queryParams }: RouteHandlerArgs) {
|
|
|
174
161
|
"status query param is required and must be 'completed'",
|
|
175
162
|
);
|
|
176
163
|
}
|
|
177
|
-
// Exclude sessions currently active in memory AND ids with a resume in
|
|
178
|
-
// flight (reserved but not yet registered): a resumed session reuses its
|
|
179
|
-
// original id, and its history row keeps the old terminal status until
|
|
180
|
-
// the next terminal upsert - a status-only delete would remove the row
|
|
181
|
-
// out from under the live (or resuming) session, and the later terminal
|
|
182
|
-
// upsert would resurrect it. Mirrors the 409 guard on the single-id
|
|
183
|
-
// delete route.
|
|
184
|
-
const activeIds = getAcpSessionManager().getActiveAndPendingIds();
|
|
185
|
-
const terminalFilter = inArray(
|
|
186
|
-
acpSessionHistory.status,
|
|
187
|
-
TERMINAL_SESSION_STATUSES,
|
|
188
|
-
);
|
|
189
164
|
getDb()
|
|
190
165
|
.delete(acpSessionHistory)
|
|
191
|
-
.where(
|
|
192
|
-
activeIds.length > 0
|
|
193
|
-
? and(terminalFilter, notInArray(acpSessionHistory.id, activeIds))
|
|
194
|
-
: terminalFilter,
|
|
195
|
-
)
|
|
166
|
+
.where(inArray(acpSessionHistory.status, TERMINAL_SESSION_STATUSES))
|
|
196
167
|
.run();
|
|
197
168
|
const deleted = rawChanges();
|
|
198
169
|
log.info({ deleted }, "Bulk-cleared terminal ACP session history");
|
|
@@ -201,10 +172,9 @@ function bulkDeleteSessions({ queryParams }: RouteHandlerArgs) {
|
|
|
201
172
|
|
|
202
173
|
function deleteSession({ pathParams }: RouteHandlerArgs) {
|
|
203
174
|
const id = pathParams?.id as string;
|
|
204
|
-
const manager = getAcpSessionManager();
|
|
205
175
|
|
|
206
176
|
try {
|
|
207
|
-
const state =
|
|
177
|
+
const state = getAcpSessionManager().getStatus(id);
|
|
208
178
|
if (
|
|
209
179
|
!Array.isArray(state) &&
|
|
210
180
|
(state.status === "running" || state.status === "initializing")
|
|
@@ -215,16 +185,7 @@ function deleteSession({ pathParams }: RouteHandlerArgs) {
|
|
|
215
185
|
}
|
|
216
186
|
} catch (err) {
|
|
217
187
|
if (err instanceof ConflictError) throw err;
|
|
218
|
-
// Not
|
|
219
|
-
// while awaiting env preparation). Its history row must survive until
|
|
220
|
-
// the resume lands - the later terminal upsert would resurrect a
|
|
221
|
-
// deleted row.
|
|
222
|
-
if (manager.getActiveAndPendingIds().includes(id)) {
|
|
223
|
-
throw new ConflictError(
|
|
224
|
-
`ACP session "${id}" has a resume in flight. Wait for it to finish before deleting.`,
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
// Otherwise fall through to the (idempotent) DB delete.
|
|
188
|
+
// Not in memory — fall through to the (idempotent) DB delete.
|
|
228
189
|
}
|
|
229
190
|
|
|
230
191
|
getDb().delete(acpSessionHistory).where(eq(acpSessionHistory.id, id)).run();
|
|
@@ -272,11 +233,7 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
272
233
|
},
|
|
273
234
|
handler: steerSession,
|
|
274
235
|
summary: "Steer ACP session",
|
|
275
|
-
description:
|
|
276
|
-
"Send a steering instruction to an ACP session. Sessions no longer " +
|
|
277
|
-
"in memory (completed, or lost to a daemon restart) are " +
|
|
278
|
-
"transparently resumed from persisted history first, when the agent " +
|
|
279
|
-
"supports ACP session loading.",
|
|
236
|
+
description: "Send a steering instruction to an active ACP session.",
|
|
280
237
|
tags: ["acp"],
|
|
281
238
|
requestBody: z.object({
|
|
282
239
|
instruction: z.string(),
|
|
@@ -284,12 +241,6 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
284
241
|
responseBody: z.object({
|
|
285
242
|
acpSessionId: z.string(),
|
|
286
243
|
steered: z.boolean(),
|
|
287
|
-
resumed: z
|
|
288
|
-
.boolean()
|
|
289
|
-
.optional()
|
|
290
|
-
.describe(
|
|
291
|
-
"True when the session was resumed from persisted history before steering.",
|
|
292
|
-
),
|
|
293
244
|
}),
|
|
294
245
|
},
|
|
295
246
|
{
|
|
@@ -373,9 +324,7 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
373
324
|
summary: "Bulk-clear terminal ACP sessions",
|
|
374
325
|
description:
|
|
375
326
|
"Remove every terminal-state row (completed/failed/cancelled) from " +
|
|
376
|
-
"the persisted acp_session_history table.
|
|
377
|
-
"currently active in memory (e.g. resumed) or has a resume in " +
|
|
378
|
-
"flight are excluded.",
|
|
327
|
+
"the persisted acp_session_history table.",
|
|
379
328
|
tags: ["acp"],
|
|
380
329
|
queryParams: [
|
|
381
330
|
{
|
|
@@ -401,8 +350,7 @@ export const ROUTES: RouteDefinition[] = [
|
|
|
401
350
|
summary: "Delete ACP session from history",
|
|
402
351
|
description:
|
|
403
352
|
"Remove a persisted ACP session row. Rejects with 409 when the " +
|
|
404
|
-
"session is still active in memory
|
|
405
|
-
"idempotent for unknown ids.",
|
|
353
|
+
"session is still active in memory; idempotent for unknown ids.",
|
|
406
354
|
tags: ["acp"],
|
|
407
355
|
responseBody: z.object({
|
|
408
356
|
deleted: z.boolean(),
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
-
import { findConversation } from "../../daemon/conversation-
|
|
12
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
13
13
|
import { getConversationByKey } from "../../memory/conversation-key-store.js";
|
|
14
14
|
import type { UserDecision } from "../../permissions/types.js";
|
|
15
15
|
import { getLogger } from "../../util/logger.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
BROWSER_OPERATIONS,
|
|
17
17
|
type BrowserOperation,
|
|
18
18
|
} from "../../browser/types.js";
|
|
19
|
-
import { findConversation } from "../../daemon/conversation-
|
|
19
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
20
20
|
import type { ContentBlock } from "../../providers/types.js";
|
|
21
21
|
import { LOCAL_PRINCIPALS } from "../auth/route-policy.js";
|
|
22
22
|
import type { RouteDefinition, RouteHandlerArgs } from "./types.js";
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
10
|
-
import { findConversation } from "../../daemon/conversation-
|
|
10
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
11
11
|
import { getCdpClient } from "../../tools/browser/cdp-client/factory.js";
|
|
12
12
|
import {
|
|
13
13
|
clearPinnedTab,
|
|
@@ -73,7 +73,11 @@ async function handleBrowserTabs({ body = {} }: RouteHandlerArgs) {
|
|
|
73
73
|
? result.clientId
|
|
74
74
|
: undefined;
|
|
75
75
|
if (result?.tabId !== undefined) {
|
|
76
|
-
setPinnedTab(
|
|
76
|
+
setPinnedTab(
|
|
77
|
+
resolvedConversationId,
|
|
78
|
+
String(result.tabId),
|
|
79
|
+
clientId,
|
|
80
|
+
);
|
|
77
81
|
}
|
|
78
82
|
return { ok: true, tab: result };
|
|
79
83
|
} finally {
|
|
@@ -84,10 +88,10 @@ async function handleBrowserTabs({ body = {} }: RouteHandlerArgs) {
|
|
|
84
88
|
if (command === "new") {
|
|
85
89
|
const cdp = getCdpClient(context, cdpOptions);
|
|
86
90
|
try {
|
|
87
|
-
const result = await cdp.send<{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
const result = await cdp.send<{ tabId?: number | string; clientId?: string }>(
|
|
92
|
+
"Vellum.createTab",
|
|
93
|
+
{},
|
|
94
|
+
);
|
|
91
95
|
// Normalise to string for internal use (setCdpSessionId / setPinnedTab)
|
|
92
96
|
// and keep the numeric form for the API response.
|
|
93
97
|
const newTabIdStr: string | undefined =
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { v4 as uuid } from "uuid";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
-
import { findConversation } from "../../daemon/conversation-
|
|
12
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
13
13
|
import { clearAllConversations as clearAllActive } from "../../daemon/handlers/conversations.js";
|
|
14
14
|
import { formatJson, formatMarkdown } from "../../export/formatter.js";
|
|
15
15
|
import { ipcCall as ipcCallGateway } from "../../ipc/gateway-client.js";
|
|
@@ -72,7 +72,7 @@ import { type LogRow } from "../../memory/llm-request-log-store.js";
|
|
|
72
72
|
import { getMemoryRecallLogByMessageIds } from "../../memory/memory-recall-log-store.js";
|
|
73
73
|
import { getMemoryV2ActivationLogByMessageIds } from "../../memory/memory-v2-activation-log-store.js";
|
|
74
74
|
import { MEMORY_V2_CONSOLIDATION_SOURCE } from "../../memory/v2/constants.js";
|
|
75
|
-
import { getMemoryV3SelectionForInspector } from "../../
|
|
75
|
+
import { getMemoryV3SelectionForInspector } from "../../memory/v3/selection-log-store.js";
|
|
76
76
|
import {
|
|
77
77
|
createConnection,
|
|
78
78
|
listConnections,
|
|
@@ -680,14 +680,7 @@ export function handleListMessages({
|
|
|
680
680
|
// assistant message has tool_use blocks but its matching user tool_result
|
|
681
681
|
// is left visible, the result will render as a standalone orphan because
|
|
682
682
|
// `mergeToolResultsIntoAssistantMessages` has nothing to merge it into.
|
|
683
|
-
|
|
684
|
-
// Only renderable roles reach this UI-facing transcript. `system` rows (a
|
|
685
|
-
// permitted `MessageRole`, e.g. skill-authored context) are agent-context
|
|
686
|
-
// scaffolding, never a displayed turn, so they are dropped here at the
|
|
687
|
-
// source rather than narrowed away per-client.
|
|
688
|
-
const visibleFilter = (m: MessageRow) =>
|
|
689
|
-
!isHiddenMessage(m.metadata) &&
|
|
690
|
-
(m.role === "user" || m.role === "assistant");
|
|
683
|
+
const visibleFilter = (m: MessageRow) => !isHiddenMessage(m.metadata);
|
|
691
684
|
|
|
692
685
|
if (isPaginated) {
|
|
693
686
|
const result = getMessagesPaginated(
|
|
@@ -779,15 +772,9 @@ export function handleListMessages({
|
|
|
779
772
|
},
|
|
780
773
|
);
|
|
781
774
|
|
|
782
|
-
// `visibleFilter` has already dropped every non-renderable role, so the
|
|
783
|
-
// only values reaching here are `user` and `assistant`; narrow the raw DB
|
|
784
|
-
// `string` to the wire union.
|
|
785
|
-
const role: "user" | "assistant" =
|
|
786
|
-
msg.role === "assistant" ? "assistant" : "user";
|
|
787
|
-
|
|
788
775
|
return {
|
|
789
776
|
id: msg.id,
|
|
790
|
-
role,
|
|
777
|
+
role: msg.role,
|
|
791
778
|
content,
|
|
792
779
|
createdAt: msg.createdAt,
|
|
793
780
|
sentAt,
|
|
@@ -11,7 +11,6 @@ import { z } from "zod";
|
|
|
11
11
|
import {
|
|
12
12
|
checkpointKey,
|
|
13
13
|
CK_ITEM_COUNT,
|
|
14
|
-
CK_LAST_ATTEMPT_AT,
|
|
15
14
|
CK_LAST_GEN_AT,
|
|
16
15
|
countActiveMemoryNodes,
|
|
17
16
|
getCheckpointValue,
|
|
@@ -43,11 +42,10 @@ const starterItemSchema = z.object({
|
|
|
43
42
|
|
|
44
43
|
type StarterItem = z.infer<typeof starterItemSchema>;
|
|
45
44
|
|
|
46
|
-
export const CONVERSATION_STARTERS_STALE_TTL_MS =
|
|
45
|
+
export const CONVERSATION_STARTERS_STALE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
47
46
|
|
|
48
|
-
/** Minimum interval between re-enqueue attempts
|
|
49
|
-
|
|
50
|
-
const REFRESH_COOLDOWN_MS = 5 * 60 * 1000;
|
|
47
|
+
/** Minimum interval between re-enqueue attempts triggered by invalid items. */
|
|
48
|
+
const REFRESH_COOLDOWN_MS = 60_000;
|
|
51
49
|
|
|
52
50
|
function hasActiveConversationStarterJob(
|
|
53
51
|
db: ReturnType<typeof getDb>,
|
|
@@ -201,16 +199,12 @@ function handleListConversationStarters({
|
|
|
201
199
|
Date.now() - lastGenAt >= CONVERSATION_STARTERS_STALE_TTL_MS;
|
|
202
200
|
const checkpointAhead = lastCount != null && totalActive < lastCount;
|
|
203
201
|
let hasActiveJob = hasActiveConversationStarterJob(db, scopeId);
|
|
204
|
-
const lastAttemptAt = parseCheckpointInt(
|
|
205
|
-
getCheckpointValue(checkpointKey(CK_LAST_ATTEMPT_AT, scopeId)),
|
|
206
|
-
);
|
|
207
202
|
const withinCooldown =
|
|
208
|
-
|
|
203
|
+
lastGenAt != null && Date.now() - lastGenAt < REFRESH_COOLDOWN_MS;
|
|
209
204
|
const shouldRefresh =
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
(invalidItemCount > 0 && totalActive > 0));
|
|
205
|
+
staleByAge ||
|
|
206
|
+
checkpointAhead ||
|
|
207
|
+
(invalidItemCount > 0 && totalActive > 0 && !withinCooldown);
|
|
214
208
|
|
|
215
209
|
if (shouldRefresh && !hasActiveJob && isMemoryEnabled()) {
|
|
216
210
|
enqueueMemoryJob("generate_conversation_starters", { scopeId });
|
|
@@ -46,10 +46,7 @@ interface ImportPayload {
|
|
|
46
46
|
|
|
47
47
|
// -- Helpers (ported from CLI) --
|
|
48
48
|
|
|
49
|
-
function resolveTimestamps(
|
|
50
|
-
conv: ImportConversation,
|
|
51
|
-
messages: ImportMessage[],
|
|
52
|
-
): {
|
|
49
|
+
function resolveTimestamps(conv: ImportConversation): {
|
|
53
50
|
convCreatedAt: number;
|
|
54
51
|
convUpdatedAt: number;
|
|
55
52
|
messageTimestamps: number[];
|
|
@@ -57,23 +54,13 @@ function resolveTimestamps(
|
|
|
57
54
|
const now = Date.now();
|
|
58
55
|
const convCreatedAt = conv.createdAt ?? now;
|
|
59
56
|
const convUpdatedAt = conv.updatedAt ?? conv.createdAt ?? now;
|
|
60
|
-
const messageTimestamps = messages.map((msg, i) => {
|
|
57
|
+
const messageTimestamps = conv.messages.map((msg, i) => {
|
|
61
58
|
if (msg.createdAt != null) return msg.createdAt;
|
|
62
59
|
return convCreatedAt + i;
|
|
63
60
|
});
|
|
64
61
|
return { convCreatedAt, convUpdatedAt, messageTimestamps };
|
|
65
62
|
}
|
|
66
63
|
|
|
67
|
-
/**
|
|
68
|
-
* The messages store is UI-facing (`ConversationMessage`), so only renderable
|
|
69
|
-
* turns are persisted. Non-renderable roles (e.g. agent-context `system`
|
|
70
|
-
* rows an export might carry) are dropped here rather than imported — the
|
|
71
|
-
* import still succeeds with the displayable turns.
|
|
72
|
-
*/
|
|
73
|
-
function isRenderableRole(role: string): role is "user" | "assistant" {
|
|
74
|
-
return role === "user" || role === "assistant";
|
|
75
|
-
}
|
|
76
|
-
|
|
77
64
|
// -- Handler --
|
|
78
65
|
|
|
79
66
|
async function handleConversationsImport({ body }: RouteHandlerArgs) {
|
|
@@ -112,16 +99,12 @@ async function handleConversationsImport({ body }: RouteHandlerArgs) {
|
|
|
112
99
|
}
|
|
113
100
|
}
|
|
114
101
|
|
|
115
|
-
const messages = conv.messages.filter((msg) =>
|
|
116
|
-
isRenderableRole(msg.role),
|
|
117
|
-
);
|
|
118
|
-
|
|
119
102
|
const { convCreatedAt, convUpdatedAt, messageTimestamps } =
|
|
120
|
-
resolveTimestamps(conv
|
|
103
|
+
resolveTimestamps(conv);
|
|
121
104
|
|
|
122
105
|
const conversation = createConversation(conv.title);
|
|
123
106
|
|
|
124
|
-
for (const msg of messages) {
|
|
107
|
+
for (const msg of conv.messages) {
|
|
125
108
|
const contentStr =
|
|
126
109
|
typeof msg.content === "string"
|
|
127
110
|
? msg.content
|
|
@@ -161,8 +144,8 @@ async function handleConversationsImport({ body }: RouteHandlerArgs) {
|
|
|
161
144
|
}
|
|
162
145
|
|
|
163
146
|
// Index messages
|
|
164
|
-
for (let i = 0; i < dbMessages.length && i < messages.length; i++) {
|
|
165
|
-
const msg = messages[i];
|
|
147
|
+
for (let i = 0; i < dbMessages.length && i < conv.messages.length; i++) {
|
|
148
|
+
const msg = conv.messages[i];
|
|
166
149
|
const contentStr =
|
|
167
150
|
typeof msg.content === "string"
|
|
168
151
|
? msg.content
|
|
@@ -193,7 +176,7 @@ async function handleConversationsImport({ body }: RouteHandlerArgs) {
|
|
|
193
176
|
}
|
|
194
177
|
|
|
195
178
|
imported++;
|
|
196
|
-
totalMessages += messages.length;
|
|
179
|
+
totalMessages += conv.messages.length;
|
|
197
180
|
} catch (err) {
|
|
198
181
|
errors.push({
|
|
199
182
|
index: idx,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
|
|
17
|
-
import { findConversation } from "../../daemon/conversation-
|
|
17
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
18
18
|
import type {
|
|
19
19
|
HostAppControlResultPayload,
|
|
20
20
|
HostAppControlState,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
9
|
-
import { findConversation } from "../../daemon/conversation-
|
|
9
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
10
10
|
import { ACTOR_PRINCIPALS } from "../auth/route-policy.js";
|
|
11
11
|
import {
|
|
12
12
|
enforceSameActorOrThrow,
|
|
@@ -33,7 +33,6 @@ import { NotFoundError } from "./errors.js";
|
|
|
33
33
|
import {
|
|
34
34
|
getCachedIntro,
|
|
35
35
|
readWorkspaceGreetings,
|
|
36
|
-
readWorkspaceIdentityIntro,
|
|
37
36
|
setCachedIntro,
|
|
38
37
|
} from "./identity-intro-cache.js";
|
|
39
38
|
import type { RouteDefinition } from "./types.js";
|
|
@@ -456,30 +455,16 @@ function getIdentityIntro(): IdentityIntroResponse {
|
|
|
456
455
|
return identityIntroResponse(FALLBACK_GREETINGS, "fallback");
|
|
457
456
|
}
|
|
458
457
|
|
|
459
|
-
// 2. Cached LLM-generated greetings
|
|
458
|
+
// 2. Cached LLM-generated greetings
|
|
460
459
|
const cached = getCachedIntro();
|
|
461
460
|
if (cached) {
|
|
462
461
|
return identityIntroResponse(cached.greetings, "cache");
|
|
463
462
|
}
|
|
464
463
|
|
|
465
|
-
// 3.
|
|
466
|
-
// (written during onboarding by BOOTSTRAP.md instructions)
|
|
467
|
-
const identityIntro = readWorkspaceIdentityIntro();
|
|
468
|
-
if (identityIntro) {
|
|
469
|
-
// Still trigger background generation so the next request gets
|
|
470
|
-
// LLM-generated greetings instead of the static tagline.
|
|
471
|
-
const refreshing = triggerEmptyStateGreetingGeneration();
|
|
472
|
-
return identityIntroResponse(
|
|
473
|
-
[identityIntro, ...FALLBACK_GREETINGS],
|
|
474
|
-
"workspace",
|
|
475
|
-
refreshing,
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// 4. Trigger fresh generation without blocking the empty-state UI.
|
|
464
|
+
// 3. Trigger fresh generation without blocking the empty-state UI.
|
|
480
465
|
const refreshing = triggerEmptyStateGreetingGeneration();
|
|
481
466
|
|
|
482
|
-
//
|
|
467
|
+
// 4. Generic fallback only when generation is unavailable.
|
|
483
468
|
return identityIntroResponse(FALLBACK_GREETINGS, "fallback", refreshing);
|
|
484
469
|
}
|
|
485
470
|
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
createApprovalConversationGenerator,
|
|
21
21
|
createApprovalCopyGenerator,
|
|
22
22
|
} from "../../daemon/approval-generators.js";
|
|
23
|
-
import { findConversation } from "../../daemon/conversation-
|
|
23
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
24
24
|
import {
|
|
25
25
|
canonicalizeTimeZone,
|
|
26
26
|
resolveTurnTimezoneContext,
|
|
@@ -21,26 +21,16 @@ import { join } from "node:path";
|
|
|
21
21
|
import { z } from "zod";
|
|
22
22
|
|
|
23
23
|
import { getPageIndex } from "../../memory/v2/page-index.js";
|
|
24
|
-
import { loadCore } from "../../
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "../../plugins/defaults/memory-v3-shadow/health.js";
|
|
29
|
-
import {
|
|
30
|
-
type LeafRef,
|
|
31
|
-
reconcileTree,
|
|
32
|
-
} from "../../plugins/defaults/memory-v3-shadow/reconcile.js";
|
|
33
|
-
import { invalidateLanes } from "../../plugins/defaults/memory-v3-shadow/shadow-plugin.js";
|
|
24
|
+
import { loadCore } from "../../memory/v3/core.js";
|
|
25
|
+
import { computeV3Health, renderV3Health } from "../../memory/v3/health.js";
|
|
26
|
+
import { type LeafRef, reconcileTree } from "../../memory/v3/reconcile.js";
|
|
27
|
+
import { invalidateLanes } from "../../memory/v3/shadow-plugin.js";
|
|
34
28
|
import {
|
|
35
29
|
coreSlugs,
|
|
36
30
|
loadLeafTree,
|
|
37
31
|
resolveDataDir,
|
|
38
|
-
} from "../../
|
|
39
|
-
import type {
|
|
40
|
-
LeafPath,
|
|
41
|
-
LeafTree,
|
|
42
|
-
Slug,
|
|
43
|
-
} from "../../plugins/defaults/memory-v3-shadow/types.js";
|
|
32
|
+
} from "../../memory/v3/tree.js";
|
|
33
|
+
import type { LeafPath, LeafTree, Slug } from "../../memory/v3/types.js";
|
|
44
34
|
import { getLogger } from "../../util/logger.js";
|
|
45
35
|
import { getWorkspaceDir } from "../../util/platform.js";
|
|
46
36
|
import { ACTOR_PRINCIPALS, type RoutePolicy } from "../auth/route-policy.js";
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { Conversation } from "../../../daemon/conversation.js";
|
|
10
|
-
import { findConversation } from "../../../daemon/conversation-registry.js";
|
|
11
10
|
import {
|
|
12
11
|
destroyActiveConversation,
|
|
12
|
+
findConversation,
|
|
13
13
|
getOrCreateConversation,
|
|
14
14
|
} from "../../../daemon/conversation-store.js";
|
|
15
15
|
import {
|
|
@@ -18,8 +18,8 @@ import type { Conversation } from "../../daemon/conversation.js";
|
|
|
18
18
|
import {
|
|
19
19
|
findConversation,
|
|
20
20
|
findConversationBySurfaceId,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
getOrCreateConversation,
|
|
22
|
+
} from "../../daemon/conversation-store.js";
|
|
23
23
|
import { rawGet } from "../../memory/raw-query.js";
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -60,7 +60,6 @@ export async function resolveSurfaceConversation(
|
|
|
60
60
|
`%"surfaceId":"${escaped}"%`,
|
|
61
61
|
);
|
|
62
62
|
if (!row) return undefined;
|
|
63
|
-
if (conversationId && conversationId !== row.conversation_id)
|
|
64
|
-
return undefined;
|
|
63
|
+
if (conversationId && conversationId !== row.conversation_id) return undefined;
|
|
65
64
|
return await getOrCreateConversation(row.conversation_id);
|
|
66
65
|
}
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
10
10
|
import type { Conversation } from "../../daemon/conversation.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
findConversation,
|
|
13
|
+
getOrCreateConversation,
|
|
14
|
+
} from "../../daemon/conversation-store.js";
|
|
13
15
|
import type { ServerMessage } from "../../daemon/message-protocol.js";
|
|
14
16
|
import { getMessages } from "../../memory/conversation-crud.js";
|
|
15
17
|
import { check, classifyRisk } from "../../permissions/checker.js";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { parseChannelId } from "../../channels/types.js";
|
|
11
11
|
import { getConfig } from "../../config/loader.js";
|
|
12
|
-
import { findConversation } from "../../daemon/conversation-
|
|
12
|
+
import { findConversation } from "../../daemon/conversation-store.js";
|
|
13
13
|
import { normalizeConversationType } from "../../daemon/message-types/shared.js";
|
|
14
14
|
import {
|
|
15
15
|
type AttentionState,
|
package/src/signals/cancel.ts
CHANGED
|
@@ -11,8 +11,10 @@ import { readFileSync } from "node:fs";
|
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
|
|
13
13
|
import { getIsContainerized } from "../config/env-registry.js";
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
findConversation,
|
|
16
|
+
touchConversation,
|
|
17
|
+
} from "../daemon/conversation-store.js";
|
|
16
18
|
import { getSubagentManager } from "../subagent/index.js";
|
|
17
19
|
import { createAbortReason } from "../util/abort-reasons.js";
|
|
18
20
|
import { getLogger } from "../util/logger.js";
|