@vellumai/assistant 0.10.1-dev.202606240917.ea25efe → 0.10.1-dev.202606241257.d4f0dcf
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__/agent-loop-override-profile.test.ts +1 -0
- package/src/__tests__/agent-wake-disk-pressure-callsite.test.ts +2 -0
- package/src/__tests__/agent-wake-override-profile.test.ts +2 -0
- package/src/__tests__/annotate-activity-metadata.test.ts +2 -0
- package/src/__tests__/annotate-risk-options.test.ts +2 -0
- package/src/__tests__/approval-cascade.test.ts +2 -0
- package/src/__tests__/background-workers-disk-pressure.test.ts +2 -0
- package/src/__tests__/btw-routes.test.ts +2 -0
- package/src/__tests__/build-persisted-content.test.ts +2 -0
- package/src/__tests__/channel-reply-delivery.test.ts +2 -0
- package/src/__tests__/compaction-events.test.ts +2 -0
- package/src/__tests__/compaction.benchmark.test.ts +2 -0
- package/src/__tests__/compactor-call-site-logging.test.ts +2 -0
- package/src/__tests__/compactor-low-watermark-cut.test.ts +2 -0
- package/src/__tests__/compactor-preserved-tail-count.test.ts +2 -0
- package/src/__tests__/compactor-summary-call-truncation.test.ts +2 -0
- package/src/__tests__/compactor-web-search-strip.test.ts +2 -0
- package/src/__tests__/conversation-abort-tool-results.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-disk-pressure.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-inference-profile.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop-overflow.test.ts +2 -0
- package/src/__tests__/conversation-agent-loop.test.ts +3 -0
- package/src/__tests__/conversation-analysis-routes.test.ts +2 -0
- package/src/__tests__/conversation-app-control-lifecycle.test.ts +2 -0
- package/src/__tests__/conversation-confirmation-signals.test.ts +2 -0
- package/src/__tests__/conversation-history-web-search.test.ts +2 -0
- package/src/__tests__/conversation-load-history-repair.test.ts +2 -0
- package/src/__tests__/conversation-load-history-stripped.test.ts +2 -0
- package/src/__tests__/conversation-pairing.test.ts +2 -0
- package/src/__tests__/conversation-process-app-control-preactivation.test.ts +2 -0
- package/src/__tests__/conversation-process-callsite.test.ts +2 -0
- package/src/__tests__/conversation-provider-retry-repair.test.ts +2 -0
- package/src/__tests__/conversation-queue.test.ts +2 -0
- package/src/__tests__/conversation-routes-guardian-reply.test.ts +2 -0
- package/src/__tests__/conversation-routes-slash-commands.test.ts +2 -0
- package/src/__tests__/conversation-slash-queue.test.ts +2 -0
- package/src/__tests__/conversation-slash-unknown.test.ts +2 -0
- package/src/__tests__/conversation-speed-override.test.ts +2 -0
- package/src/__tests__/conversation-title-service.test.ts +2 -0
- package/src/__tests__/conversation-usage.test.ts +2 -0
- package/src/__tests__/conversation-workspace-cache-state.test.ts +2 -0
- package/src/__tests__/conversation-workspace-injection.test.ts +2 -0
- package/src/__tests__/conversation-workspace-tool-tracking.test.ts +2 -0
- package/src/__tests__/db-migration-rollback.test.ts +205 -171
- package/src/__tests__/dm-persistence.test.ts +2 -0
- package/src/__tests__/filing-service.test.ts +2 -0
- package/src/__tests__/heartbeat-disk-pressure.test.ts +2 -0
- package/src/__tests__/heartbeat-service.test.ts +2 -0
- package/src/__tests__/http-user-message-parity.test.ts +2 -0
- package/src/__tests__/inbound-slack-persistence.test.ts +2 -0
- package/src/__tests__/memory-retrieval-hook.test.ts +2 -0
- package/src/__tests__/messaging-send-tool.test.ts +2 -0
- package/src/__tests__/migration-import-from-url.test.ts +2 -2
- package/src/__tests__/native-web-search.test.ts +2 -0
- package/src/__tests__/notification-deep-link.test.ts +2 -0
- package/src/__tests__/outbound-slack-persistence.test.ts +2 -0
- package/src/__tests__/persistence-secret-redaction.test.ts +2 -0
- package/src/__tests__/process-message-background-slack.test.ts +2 -0
- package/src/__tests__/process-message-display-content.test.ts +2 -0
- package/src/__tests__/regenerate-fire-and-forget-trace.test.ts +2 -0
- package/src/__tests__/secret-ingress-http.test.ts +2 -0
- package/src/__tests__/subagent-notify-parent.test.ts +2 -0
- package/src/__tests__/subagent-spawn-tool-fork.test.ts +2 -0
- package/src/__tests__/subagent-tools.test.ts +2 -0
- package/src/__tests__/suggestion-routes.test.ts +2 -0
- package/src/__tests__/title-generate-hook.test.ts +2 -0
- package/src/__tests__/tool-executor-lifecycle-events.test.ts +2 -0
- package/src/__tests__/tool-preview-lifecycle.test.ts +2 -0
- package/src/__tests__/tool-result-metadata-plumbing.test.ts +2 -0
- package/src/__tests__/tool-start-timestamp.test.ts +2 -0
- package/src/__tests__/verification-control-plane-policy.test.ts +2 -0
- package/src/__tests__/web-search-backend-failure.test.ts +2 -0
- package/src/cli/lib/__tests__/install-from-github.test.ts +102 -0
- package/src/config/schemas/memory-lifecycle.ts +1 -1
- package/src/daemon/conversation.ts +8 -0
- package/src/daemon/lifecycle.ts +6 -28
- package/src/memory/__tests__/memory-retrospective-job.test.ts +8 -0
- package/src/memory/conversation-crud.ts +38 -0
- package/src/memory/db-init.ts +8 -493
- package/src/memory/jobs-worker.ts +58 -0
- package/src/memory/memory-retrospective-job.ts +9 -8
- package/src/memory/migrations/300-add-processing-started-at.ts +30 -0
- package/src/memory/migrations/__tests__/run-migrations.test.ts +2 -2
- package/src/memory/migrations/run-migrations.ts +90 -6
- package/src/memory/migrations/validate-migration-state.ts +101 -66
- package/src/memory/schema/conversations.ts +9 -0
- package/src/memory/steps.ts +571 -0
- package/src/memory/worker-process.ts +2 -2
- package/src/runtime/routes/conversation-cli-routes.ts +4 -5
- package/src/runtime/routes/conversation-list-routes.ts +4 -7
- package/src/runtime/routes/identity-routes.ts +3 -2
- package/src/runtime/routes/migration-rollback-routes.ts +4 -3
- package/src/runtime/routes/migration-routes.ts +2 -1
- package/src/runtime/services/__tests__/conversation-serializer.test.ts +1 -0
- package/src/runtime/services/conversation-serializer.ts +7 -9
- package/src/memory/migrations/registry.ts +0 -573
|
@@ -79,6 +79,8 @@ const getBindingByChannelChatMock = mock(
|
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
82
|
+
setConversationProcessingStartedAt: () => {},
|
|
83
|
+
isConversationProcessing: () => false,
|
|
82
84
|
addMessage: addMessageMock,
|
|
83
85
|
getConversation: getConversationMock,
|
|
84
86
|
reserveMessage: mock(async () => ({ id: "msg-reserve" })),
|
|
@@ -421,8 +421,8 @@ describe("handleMigrationImport — JSON {url} body", () => {
|
|
|
421
421
|
describe("handleMigrationImport — no-swap path omits newer-migration warning", () => {
|
|
422
422
|
test("credentials-only bundle does not inherit live-DB migration warnings", async () => {
|
|
423
423
|
// Seed the live workspace DB with a step:* checkpoint that's NOT
|
|
424
|
-
// in the
|
|
425
|
-
// version" and would otherwise push a warning into the report. With
|
|
424
|
+
// in the known step list. validateMigrationState treats this as a
|
|
425
|
+
// "newer version" and would otherwise push a warning into the report. With
|
|
426
426
|
// the gate in appendNewerMigrationWarningsIfAny the warning must be
|
|
427
427
|
// suppressed when the import didn't modify the workspace.
|
|
428
428
|
const dbDir = join(testWorkspaceRoot, "data", "db");
|
|
@@ -95,6 +95,8 @@ mock.module("../config/loader.js", () => ({
|
|
|
95
95
|
}));
|
|
96
96
|
|
|
97
97
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
98
|
+
setConversationProcessingStartedAt: () => {},
|
|
99
|
+
isConversationProcessing: () => false,
|
|
98
100
|
addMessage: () => ({ id: "mock-msg-id" }),
|
|
99
101
|
getMessageById: () => null,
|
|
100
102
|
updateMessageContent: () => {},
|
|
@@ -46,6 +46,8 @@ mock.module("../notifications/deliveries-store.js", () => ({
|
|
|
46
46
|
// can be driven from tests without DB access.
|
|
47
47
|
let mockExistingConversations: Record<string, { id: string }> = {};
|
|
48
48
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
49
|
+
setConversationProcessingStartedAt: () => {},
|
|
50
|
+
isConversationProcessing: () => false,
|
|
49
51
|
getConversation: (id: string) => mockExistingConversations[id] ?? null,
|
|
50
52
|
}));
|
|
51
53
|
|
|
@@ -72,6 +72,8 @@ const persistedRows: Array<{
|
|
|
72
72
|
metadata: string | null;
|
|
73
73
|
}> = [];
|
|
74
74
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
75
|
+
setConversationProcessingStartedAt: () => {},
|
|
76
|
+
isConversationProcessing: () => false,
|
|
75
77
|
addMessage: (
|
|
76
78
|
conversationId: string,
|
|
77
79
|
role: string,
|
|
@@ -48,6 +48,8 @@ interface AddMessageCall {
|
|
|
48
48
|
}
|
|
49
49
|
const addMessageCalls: AddMessageCall[] = [];
|
|
50
50
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
51
|
+
setConversationProcessingStartedAt: () => {},
|
|
52
|
+
isConversationProcessing: () => false,
|
|
51
53
|
addMessage: (
|
|
52
54
|
conversationId: string,
|
|
53
55
|
role: string,
|
|
@@ -19,6 +19,8 @@ mock.module("../memory/canonical-guardian-store.js", () => ({
|
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
22
|
+
setConversationProcessingStartedAt: () => {},
|
|
23
|
+
isConversationProcessing: () => false,
|
|
22
24
|
addMessage: async () => ({ id: "message-id" }),
|
|
23
25
|
getConversation: () => null,
|
|
24
26
|
provenanceFromTrustContext: () => ({}),
|
|
@@ -37,6 +37,8 @@ mock.module("../memory/attachments-store.js", () => ({
|
|
|
37
37
|
}));
|
|
38
38
|
|
|
39
39
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
40
|
+
setConversationProcessingStartedAt: () => {},
|
|
41
|
+
isConversationProcessing: () => false,
|
|
40
42
|
addMessage: async (
|
|
41
43
|
conversationId: string,
|
|
42
44
|
role: string,
|
|
@@ -23,6 +23,8 @@ let dbMessages: Array<{
|
|
|
23
23
|
}> = [];
|
|
24
24
|
|
|
25
25
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
26
|
+
setConversationProcessingStartedAt: () => {},
|
|
27
|
+
isConversationProcessing: () => false,
|
|
26
28
|
getMessages: (conversationId: string) =>
|
|
27
29
|
dbMessages.filter((m) => m.conversationId === conversationId),
|
|
28
30
|
deleteMessageById: (messageId: string) => {
|
|
@@ -4,6 +4,8 @@ import { describe, expect, mock, test } from "bun:test";
|
|
|
4
4
|
|
|
5
5
|
// Mock conversation-crud before importing tool executors that depend on it.
|
|
6
6
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
7
|
+
setConversationProcessingStartedAt: () => {},
|
|
8
|
+
isConversationProcessing: () => false,
|
|
7
9
|
setConversationOriginChannelIfUnset: () => {},
|
|
8
10
|
updateConversationContextWindow: () => {},
|
|
9
11
|
deleteMessageById: () => {},
|
|
@@ -3,6 +3,8 @@ import { mock } from "bun:test";
|
|
|
3
3
|
|
|
4
4
|
// Mock conversation-crud before importing tool executors that depend on it.
|
|
5
5
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
6
|
+
setConversationProcessingStartedAt: () => {},
|
|
7
|
+
isConversationProcessing: () => false,
|
|
6
8
|
setConversationOriginChannelIfUnset: () => {},
|
|
7
9
|
updateConversationContextWindow: () => {},
|
|
8
10
|
deleteMessageById: () => {},
|
|
@@ -29,6 +29,8 @@ mock.module("../config/loader.js", () => ({
|
|
|
29
29
|
}),
|
|
30
30
|
}));
|
|
31
31
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
32
|
+
setConversationProcessingStartedAt: () => {},
|
|
33
|
+
isConversationProcessing: () => false,
|
|
32
34
|
setConversationOriginChannelIfUnset: () => {},
|
|
33
35
|
updateConversationContextWindow: () => {},
|
|
34
36
|
deleteMessageById: () => {},
|
|
@@ -50,6 +50,8 @@ const mockGetMessages = mock((_conversationId: string) => [
|
|
|
50
50
|
]);
|
|
51
51
|
|
|
52
52
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
53
|
+
setConversationProcessingStartedAt: () => {},
|
|
54
|
+
isConversationProcessing: () => false,
|
|
53
55
|
getMessages: mockGetMessages,
|
|
54
56
|
getConversation: (_id: string) => null,
|
|
55
57
|
reserveMessage: mock(async () => ({ id: "msg-reserve" })),
|
|
@@ -78,6 +78,8 @@ mock.module("../permissions/checker.js", () => ({
|
|
|
78
78
|
}));
|
|
79
79
|
|
|
80
80
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
81
|
+
setConversationProcessingStartedAt: () => {},
|
|
82
|
+
isConversationProcessing: () => false,
|
|
81
83
|
createConversation: (title: string) => ({ id: "conversation-1", title }),
|
|
82
84
|
reserveMessage: mock(async () => ({ id: "msg-reserve" })),
|
|
83
85
|
}));
|
|
@@ -60,6 +60,8 @@ const reserveMessageMock = mock(
|
|
|
60
60
|
const updateMessageContentMock = mock((_id: string, _content: string) => {});
|
|
61
61
|
|
|
62
62
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
63
|
+
setConversationProcessingStartedAt: () => {},
|
|
64
|
+
isConversationProcessing: () => false,
|
|
63
65
|
getConversation: () => null,
|
|
64
66
|
getMessageById: () => null,
|
|
65
67
|
updateMessageContent: updateMessageContentMock,
|
|
@@ -40,6 +40,8 @@ mock.module("../config/loader.js", () => ({
|
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
42
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
43
|
+
setConversationProcessingStartedAt: () => {},
|
|
44
|
+
isConversationProcessing: () => false,
|
|
43
45
|
addMessage: () => ({ id: "mock-msg-id" }),
|
|
44
46
|
getMessageById: () => null,
|
|
45
47
|
updateMessageContent: () => {},
|
|
@@ -43,6 +43,8 @@ let mockedRowContent = "";
|
|
|
43
43
|
const updates: Array<{ id: string; content: string }> = [];
|
|
44
44
|
|
|
45
45
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
46
|
+
setConversationProcessingStartedAt: () => {},
|
|
47
|
+
isConversationProcessing: () => false,
|
|
46
48
|
addMessage: () => ({ id: "mock-msg-id" }),
|
|
47
49
|
getMessageById: (id: string) =>
|
|
48
50
|
mockedRowContent ? { id, content: mockedRowContent } : null,
|
|
@@ -72,6 +72,8 @@ mock.module("../permissions/checker.js", () => ({
|
|
|
72
72
|
}));
|
|
73
73
|
|
|
74
74
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
75
|
+
setConversationProcessingStartedAt: () => {},
|
|
76
|
+
isConversationProcessing: () => false,
|
|
75
77
|
createConversation: (title: string) => ({ id: "conversation-1", title }),
|
|
76
78
|
reserveMessage: mock(async () => ({ id: "msg-reserve" })),
|
|
77
79
|
}));
|
|
@@ -57,6 +57,8 @@ mock.module("../config/loader.js", () => ({
|
|
|
57
57
|
}));
|
|
58
58
|
|
|
59
59
|
mock.module("../memory/conversation-crud.js", () => ({
|
|
60
|
+
setConversationProcessingStartedAt: () => {},
|
|
61
|
+
isConversationProcessing: () => false,
|
|
60
62
|
addMessage: () => ({ id: "mock-msg-id" }),
|
|
61
63
|
getMessageById: () => null,
|
|
62
64
|
updateMessageContent: () => {},
|
|
@@ -436,6 +436,108 @@ describe("installPlugin — marketplace resolution", () => {
|
|
|
436
436
|
expect(meta.contentHash).toMatch(/^v2:[0-9a-f]{64}$/);
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
+
test("installs a plugin rooted at a sub-path, copying only that subtree", async () => {
|
|
440
|
+
// GIVEN a marketplace entry whose source pins a directory *within* a repo
|
|
441
|
+
// (a monorepo that ships several plugins) rather than the repo root.
|
|
442
|
+
const NESTED_SHA = "0f".repeat(20);
|
|
443
|
+
const NESTED_MANIFEST = {
|
|
444
|
+
name: "vellum-assistant",
|
|
445
|
+
plugins: [
|
|
446
|
+
{
|
|
447
|
+
name: "nested-plugin",
|
|
448
|
+
source: {
|
|
449
|
+
source: "github",
|
|
450
|
+
repo: "example-org/monorepo",
|
|
451
|
+
path: "packages/my-plugin",
|
|
452
|
+
ref: NESTED_SHA,
|
|
453
|
+
},
|
|
454
|
+
description: "A plugin that lives in a monorepo sub-directory.",
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
};
|
|
458
|
+
const fetch = makeContentsFetch({ tree: {}, manifest: NESTED_MANIFEST });
|
|
459
|
+
// The clone carries files both at the repo root and under the pinned
|
|
460
|
+
// sub-path; only the sub-path subtree should be materialized.
|
|
461
|
+
const runGit = fakeGitRunner({
|
|
462
|
+
tree: {
|
|
463
|
+
"package.json": '{"name":"monorepo-root"}',
|
|
464
|
+
"README.md": "# monorepo root",
|
|
465
|
+
"packages/my-plugin/package.json": '{"name":"nested-plugin"}',
|
|
466
|
+
"packages/my-plugin/README.md": "# nested plugin",
|
|
467
|
+
"packages/my-plugin/hooks/init.ts": "export default async () => {};",
|
|
468
|
+
"packages/other-plugin/package.json": '{"name":"other"}',
|
|
469
|
+
},
|
|
470
|
+
commit: NESTED_SHA,
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// WHEN we install by name
|
|
474
|
+
const result = await installPlugin(
|
|
475
|
+
{ name: "nested-plugin", ref: "main" },
|
|
476
|
+
{ fetch, runGit, workspacePluginsDir: pluginsDir },
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
// THEN only the sub-path subtree lands, rooted at <pluginsDir>/nested-plugin
|
|
480
|
+
const target = join(pluginsDir, "nested-plugin");
|
|
481
|
+
expect(result.target).toBe(target);
|
|
482
|
+
expect(readFileSync(join(target, "package.json"), "utf-8")).toBe(
|
|
483
|
+
'{"name":"nested-plugin"}',
|
|
484
|
+
);
|
|
485
|
+
expect(existsSync(join(target, "README.md"))).toBe(true);
|
|
486
|
+
expect(existsSync(join(target, "hooks", "init.ts"))).toBe(true);
|
|
487
|
+
// AND the repo-root and sibling-package files are NOT copied in — the
|
|
488
|
+
// install is scoped to the pinned directory.
|
|
489
|
+
expect(result.fileCount).toBe(3);
|
|
490
|
+
expect(readFileSync(join(target, "package.json"), "utf-8")).not.toContain(
|
|
491
|
+
"monorepo-root",
|
|
492
|
+
);
|
|
493
|
+
expect(existsSync(join(target, "packages"))).toBe(false);
|
|
494
|
+
|
|
495
|
+
// AND provenance records the sub-path so an upgrade/diff re-resolves the
|
|
496
|
+
// same directory rather than the repo root.
|
|
497
|
+
const meta = readInstallMeta(target);
|
|
498
|
+
expect(meta?.source.owner).toBe("example-org");
|
|
499
|
+
expect(meta?.source.repo).toBe("monorepo");
|
|
500
|
+
expect(meta?.source.path).toBe("packages/my-plugin");
|
|
501
|
+
expect(meta?.source.ref).toBe(NESTED_SHA);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
test("a sub-path that does not exist in the clone surfaces a clean not-found", async () => {
|
|
505
|
+
// GIVEN an entry pinning a directory the cloned ref doesn't contain
|
|
506
|
+
const MISSING_SHA = "1a".repeat(20);
|
|
507
|
+
const MISSING_PATH_MANIFEST = {
|
|
508
|
+
name: "vellum-assistant",
|
|
509
|
+
plugins: [
|
|
510
|
+
{
|
|
511
|
+
name: "nested-plugin",
|
|
512
|
+
source: {
|
|
513
|
+
source: "github",
|
|
514
|
+
repo: "example-org/monorepo",
|
|
515
|
+
path: "packages/does-not-exist",
|
|
516
|
+
ref: MISSING_SHA,
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
};
|
|
521
|
+
const fetch = makeContentsFetch({
|
|
522
|
+
tree: {},
|
|
523
|
+
manifest: MISSING_PATH_MANIFEST,
|
|
524
|
+
});
|
|
525
|
+
const runGit = fakeGitRunner({
|
|
526
|
+
tree: { "package.json": '{"name":"monorepo-root"}' },
|
|
527
|
+
commit: MISSING_SHA,
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
// WHEN we install
|
|
531
|
+
// THEN the absent sub-path yields a hard not-found and nothing is staged
|
|
532
|
+
await expect(
|
|
533
|
+
installPlugin(
|
|
534
|
+
{ name: "nested-plugin", ref: "main" },
|
|
535
|
+
{ fetch, runGit, workspacePluginsDir: pluginsDir },
|
|
536
|
+
),
|
|
537
|
+
).rejects.toBeInstanceOf(PluginNotFoundError);
|
|
538
|
+
expect(readdirSync(pluginsDir)).toEqual([]);
|
|
539
|
+
});
|
|
540
|
+
|
|
439
541
|
test("refuses to install when the checked-out commit differs from the pinned SHA", async () => {
|
|
440
542
|
// GIVEN a clone whose resolved HEAD does not match the manifest's pinned
|
|
441
543
|
// commit SHA — i.e. the upstream object served something unexpected
|
|
@@ -84,7 +84,7 @@ export const MemoryWorkerConfigSchema = z
|
|
|
84
84
|
.boolean({ error: "memory.worker.enabled must be a boolean" })
|
|
85
85
|
.default(false)
|
|
86
86
|
.describe(
|
|
87
|
-
"Whether the memory jobs worker runs as a separate OS process spawned at
|
|
87
|
+
"Whether the memory jobs worker runs as a separate OS process spawned at assistant startup (the `assistant memory worker` implementation) instead of on the assistant's main event loop. Only affects startup; shutdown stops whichever worker is actually running.",
|
|
88
88
|
),
|
|
89
89
|
})
|
|
90
90
|
.describe("Memory jobs worker process configuration");
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
getMessages,
|
|
51
51
|
resolveOverrideProfile,
|
|
52
52
|
setConversationHistoryStrippedAt,
|
|
53
|
+
setConversationProcessingStartedAt,
|
|
53
54
|
} from "../memory/conversation-crud.js";
|
|
54
55
|
import { getResolvedConversationDirPath } from "../memory/conversation-directories.js";
|
|
55
56
|
import { ConversationGraphMemory } from "../memory/graph/conversation-graph-memory.js";
|
|
@@ -1339,6 +1340,13 @@ export class Conversation {
|
|
|
1339
1340
|
setProcessing(value: boolean): void {
|
|
1340
1341
|
const wasProcessing = this._processing;
|
|
1341
1342
|
this._processing = value;
|
|
1343
|
+
// Persist the cross-process source of truth so out-of-process callers
|
|
1344
|
+
// (retrospective CLI, future detached workers) can detect mid-turn state
|
|
1345
|
+
// by reading the conversations row directly.
|
|
1346
|
+
setConversationProcessingStartedAt(
|
|
1347
|
+
this.conversationId,
|
|
1348
|
+
value ? Date.now() : null,
|
|
1349
|
+
);
|
|
1342
1350
|
if (wasProcessing && !value) {
|
|
1343
1351
|
void publishSyncInvalidation([
|
|
1344
1352
|
conversationMetadataSyncTag(this.conversationId),
|
package/src/daemon/lifecycle.ts
CHANGED
|
@@ -58,7 +58,6 @@ import { initQdrantClient, resolveQdrantUrl } from "../memory/qdrant-client.js";
|
|
|
58
58
|
import { QdrantManager } from "../memory/qdrant-manager.js";
|
|
59
59
|
import { rotateToolInvocations } from "../memory/tool-usage-store.js";
|
|
60
60
|
import { sweepConceptPageFrontmatter } from "../memory/v2/frontmatter-sweep.js";
|
|
61
|
-
import { spawnMemoryWorkerProcess } from "../memory/worker-control.js";
|
|
62
61
|
import { emitNotificationSignal } from "../notifications/emit-signal.js";
|
|
63
62
|
import { backfillManualTokenConnections } from "../oauth/manual-token-connection.js";
|
|
64
63
|
import { seedOAuthProviders } from "../oauth/seed-providers.js";
|
|
@@ -967,33 +966,12 @@ export async function runDaemon(): Promise<void> {
|
|
|
967
966
|
}
|
|
968
967
|
}
|
|
969
968
|
|
|
970
|
-
// `
|
|
971
|
-
//
|
|
972
|
-
//
|
|
973
|
-
//
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
log.info(
|
|
977
|
-
"Daemon startup: starting memory worker as a separate process",
|
|
978
|
-
);
|
|
979
|
-
try {
|
|
980
|
-
const { pid, alreadyRunning } = await spawnMemoryWorkerProcess();
|
|
981
|
-
log.info(
|
|
982
|
-
{ pid, alreadyRunning },
|
|
983
|
-
alreadyRunning
|
|
984
|
-
? "Memory worker process already running — reusing it"
|
|
985
|
-
: "Memory worker process started",
|
|
986
|
-
);
|
|
987
|
-
} catch (err) {
|
|
988
|
-
log.warn(
|
|
989
|
-
{ err },
|
|
990
|
-
"Failed to start memory worker process — memory jobs will not be processed",
|
|
991
|
-
);
|
|
992
|
-
}
|
|
993
|
-
} else {
|
|
994
|
-
log.info("Daemon startup: starting memory worker");
|
|
995
|
-
bgRefs.memoryWorker = startMemoryJobsWorker();
|
|
996
|
-
}
|
|
969
|
+
// `startMemoryJobsWorker` selects the worker implementation based on
|
|
970
|
+
// `memory.worker.enabled` (in-process vs. a separate OS process).
|
|
971
|
+
// Shutdown stops whichever worker is actually running — see
|
|
972
|
+
// shutdown-handlers.ts.
|
|
973
|
+
log.info("Daemon startup: starting memory worker");
|
|
974
|
+
bgRefs.memoryWorker = startMemoryJobsWorker();
|
|
997
975
|
|
|
998
976
|
// Seed capability graph nodes (new memory graph system)
|
|
999
977
|
try {
|
|
@@ -161,6 +161,14 @@ mock.module("../conversation-crud.js", () => ({
|
|
|
161
161
|
title: "Source conversation",
|
|
162
162
|
};
|
|
163
163
|
},
|
|
164
|
+
// Mirrors the real `isConversationProcessing` which reads the persisted
|
|
165
|
+
// `processing_started_at` column. In tests, the mock registry
|
|
166
|
+
// (`loadedConversations`) is the source of truth — a conversation id
|
|
167
|
+
// present with `processing: true` simulates a mid-turn conversation.
|
|
168
|
+
isConversationProcessing: (id: string) => {
|
|
169
|
+
const entry = loadedConversations[id];
|
|
170
|
+
return entry?.processing ?? false;
|
|
171
|
+
},
|
|
164
172
|
forkConversationForRetrospective: async (params: {
|
|
165
173
|
conversationId: string;
|
|
166
174
|
throughMessageId?: string;
|
|
@@ -25,6 +25,7 @@ import { parseChannelId, parseInterfaceId } from "../channels/types.js";
|
|
|
25
25
|
import { CHANNEL_IDS, isChannelId } from "../channels/types.js";
|
|
26
26
|
import { getConfig } from "../config/loader.js";
|
|
27
27
|
import { findDisplayTurnEndIndex } from "../conversations/message-consolidation.js";
|
|
28
|
+
import { findConversation } from "../daemon/conversation-registry.js";
|
|
28
29
|
import { conversationMetadataSyncTag } from "../daemon/message-types/sync.js";
|
|
29
30
|
import type { TrustContext } from "../daemon/trust-context.js";
|
|
30
31
|
import { clearAllConversationIds } from "../home/feed-writer.js";
|
|
@@ -304,6 +305,7 @@ export interface ConversationRow {
|
|
|
304
305
|
inferenceProfileSessionId: string | null;
|
|
305
306
|
inferenceProfileExpiresAt: number | null;
|
|
306
307
|
lastNotifiedInferenceProfile: string | null;
|
|
308
|
+
processingStartedAt: number | null;
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
export const parseConversation = createRowMapper<
|
|
@@ -339,6 +341,7 @@ export const parseConversation = createRowMapper<
|
|
|
339
341
|
inferenceProfileSessionId: "inferenceProfileSessionId",
|
|
340
342
|
inferenceProfileExpiresAt: "inferenceProfileExpiresAt",
|
|
341
343
|
lastNotifiedInferenceProfile: "lastNotifiedInferenceProfile",
|
|
344
|
+
processingStartedAt: "processingStartedAt",
|
|
342
345
|
});
|
|
343
346
|
|
|
344
347
|
/** Allowed values for the `role` column on `messages`. */
|
|
@@ -2180,6 +2183,41 @@ export function unarchiveConversation(id: string): boolean {
|
|
|
2180
2183
|
return true;
|
|
2181
2184
|
}
|
|
2182
2185
|
|
|
2186
|
+
/**
|
|
2187
|
+
* Persist the processing-start timestamp for a conversation. Called by
|
|
2188
|
+
* `Conversation.setProcessing(true)` so out-of-process callers can detect
|
|
2189
|
+
* mid-turn state by reading the `conversations` row directly. Pass `null`
|
|
2190
|
+
* to clear (turn ended).
|
|
2191
|
+
*/
|
|
2192
|
+
export function setConversationProcessingStartedAt(
|
|
2193
|
+
id: string,
|
|
2194
|
+
startedAt: number | null,
|
|
2195
|
+
): void {
|
|
2196
|
+
rawRun(
|
|
2197
|
+
"UPDATE conversations SET processing_started_at = ? WHERE id = ?",
|
|
2198
|
+
startedAt,
|
|
2199
|
+
id,
|
|
2200
|
+
);
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* Read whether a conversation is currently processing. Checks the in-memory
|
|
2205
|
+
* `Conversation._processing` flag first (hot path for resident conversations),
|
|
2206
|
+
* falling back to the persisted `processing_started_at` column for cold
|
|
2207
|
+
* (evicted / never-loaded) conversations. This is the single entry point for
|
|
2208
|
+
* processing state — callers don't need to layer `findConversation` themselves.
|
|
2209
|
+
* Returns `false` when the conversation row doesn't exist.
|
|
2210
|
+
*/
|
|
2211
|
+
export function isConversationProcessing(id: string): boolean {
|
|
2212
|
+
const inMemory = findConversation(id)?.isProcessing();
|
|
2213
|
+
if (inMemory != null) return inMemory;
|
|
2214
|
+
const row = rawGet<{ processing_started_at: number | null }>(
|
|
2215
|
+
"SELECT processing_started_at FROM conversations WHERE id = ?",
|
|
2216
|
+
id,
|
|
2217
|
+
);
|
|
2218
|
+
return row?.processing_started_at != null;
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2183
2221
|
/**
|
|
2184
2222
|
* Set or clear the `surfaced_at` promotion marker for a conversation.
|
|
2185
2223
|
*
|