@vellumai/assistant 0.10.0-dev.202606200539.c052d10 → 0.10.0-dev.202606201539.0cebd50
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-callsite-precedence.test.ts +1 -40
- package/src/__tests__/agent-wake-override-profile.test.ts +2 -0
- package/src/__tests__/app-source-watcher.test.ts +30 -10
- package/src/__tests__/config-schema.test.ts +34 -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 +3 -0
- package/src/__tests__/conversation-agent-loop.test.ts +3 -0
- package/src/__tests__/conversation-process-callsite.test.ts +0 -14
- package/src/__tests__/db-llm-request-log-provider-migration.test.ts +6 -1
- package/src/__tests__/db-migration-rollback.test.ts +69 -1
- package/src/__tests__/heartbeat-disk-pressure.test.ts +3 -0
- package/src/__tests__/heartbeat-service.test.ts +6 -0
- package/src/__tests__/list-messages-attachments.test.ts +41 -0
- package/src/__tests__/plugin-source-watcher.test.ts +33 -1
- package/src/__tests__/usage-cache-backfill-migration.test.ts +17 -2
- package/src/acp/__tests__/session-manager.test.ts +72 -1
- package/src/acp/index.ts +10 -0
- package/src/acp/session-manager.ts +35 -0
- package/src/agent/loop.ts +28 -22
- package/src/cli/commands/db/status.ts +35 -1
- package/src/config/schemas/memory-lifecycle.ts +5 -3
- package/src/config/schemas/timeouts.ts +24 -0
- package/src/daemon/app-source-watcher.ts +31 -18
- package/src/daemon/conversation-agent-loop.ts +8 -5
- package/src/daemon/conversation.ts +30 -41
- package/src/daemon/handlers/conversations.ts +7 -0
- package/src/daemon/plugin-source-watcher.ts +5 -0
- package/src/daemon/workspace-tools-watcher.ts +4 -0
- package/src/heartbeat/__tests__/heartbeat-service.test.ts +6 -0
- package/src/heartbeat/heartbeat-service.ts +3 -4
- package/src/memory/__tests__/db-maintenance.test.ts +27 -35
- package/src/memory/__tests__/db-memory-attach.test.ts +126 -0
- package/src/memory/conversation-crud.ts +9 -3
- package/src/memory/db-connection.ts +49 -0
- package/src/memory/db-init.ts +50 -14
- package/src/memory/db-maintenance.ts +43 -38
- package/src/memory/job-handlers/cleanup.ts +6 -0
- package/src/memory/migrations/{100-core-tables.ts → 000-core-tables.ts} +6 -10
- package/src/memory/migrations/103-complex-migrations.ts +13 -12
- package/src/memory/migrations/104-core-indexes.ts +1 -1
- package/src/memory/migrations/113-late-migrations.ts +16 -14
- package/src/memory/migrations/297-move-llm-request-logs-to-logs-db.ts +130 -0
- package/src/memory/migrations/__tests__/297-move-llm-request-logs.test.ts +159 -0
- package/src/memory/migrations/__tests__/run-migrations.test.ts +147 -5
- package/src/memory/migrations/index.ts +5 -4
- package/src/memory/migrations/run-migrations.ts +162 -12
- package/src/memory/migrations/validate-migration-state.ts +14 -56
- package/src/plugin-api/index.ts +7 -0
- package/src/plugin-api/vision-support.ts +75 -0
- package/src/prompts/system-prompt.ts +1 -1
- package/src/runtime/__tests__/agent-wake.test.ts +6 -4
- package/src/runtime/agent-wake.ts +15 -7
- package/src/runtime/routes/conversation-routes.ts +24 -3
- package/src/runtime/routes/migration-routes.ts +35 -39
- package/src/schedule/scheduler.ts +5 -9
- package/src/tools/ask-question/ask-question-tool.test.ts +60 -52
- package/src/tools/ask-question/ask-question-tool.ts +14 -73
- package/src/util/fs-watcher-error.ts +36 -0
- package/src/util/memory-db-path.ts +23 -0
|
@@ -59,7 +59,9 @@ beforeEach(() => {
|
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
// A single question used to build batches. The tool only accepts the
|
|
63
|
+
// batched `{ questions: [...] }` shape.
|
|
64
|
+
const singleQ = {
|
|
63
65
|
question: "Which fruit?",
|
|
64
66
|
description: "Pick one to add to the smoothie.",
|
|
65
67
|
options: [
|
|
@@ -69,12 +71,7 @@ const validInput = {
|
|
|
69
71
|
freeTextPlaceholder: "Type a fruit",
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
const
|
|
73
|
-
question: validInput.question,
|
|
74
|
-
description: validInput.description,
|
|
75
|
-
options: validInput.options,
|
|
76
|
-
freeTextPlaceholder: validInput.freeTextPlaceholder,
|
|
77
|
-
};
|
|
74
|
+
const validInput = { questions: [singleQ] };
|
|
78
75
|
|
|
79
76
|
describe("askQuestionTool definition", () => {
|
|
80
77
|
test("exposes the expected schema shape and description language", () => {
|
|
@@ -91,7 +88,6 @@ describe("askQuestionTool definition", () => {
|
|
|
91
88
|
expect(def.description).toContain("remove guessing");
|
|
92
89
|
expect(def.description).toContain("a question is skipped");
|
|
93
90
|
expect(def.description).toContain("every question in the batch is skipped");
|
|
94
|
-
// Batching language is back now that the prompter handles batches.
|
|
95
91
|
expect(def.description).toContain("Batch related clarifications");
|
|
96
92
|
expect(def.description).toContain("up to 5");
|
|
97
93
|
expect(def.description).toContain("Skip button");
|
|
@@ -99,13 +95,23 @@ describe("askQuestionTool definition", () => {
|
|
|
99
95
|
const schema = def.input_schema as {
|
|
100
96
|
properties: Record<
|
|
101
97
|
string,
|
|
102
|
-
{
|
|
98
|
+
{
|
|
99
|
+
type?: string;
|
|
100
|
+
items?: {
|
|
101
|
+
properties?: Record<
|
|
102
|
+
string,
|
|
103
|
+
{ type?: string; minItems?: number; maxItems?: number }
|
|
104
|
+
>;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
103
107
|
>;
|
|
104
108
|
required?: string[];
|
|
105
109
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
expect(
|
|
110
|
+
const optionsSchema =
|
|
111
|
+
schema.properties.questions?.items?.properties?.options;
|
|
112
|
+
expect(optionsSchema?.type).toBe("array");
|
|
113
|
+
expect(optionsSchema?.minItems).toBe(2);
|
|
114
|
+
expect(optionsSchema?.maxItems).toBe(4);
|
|
109
115
|
});
|
|
110
116
|
});
|
|
111
117
|
|
|
@@ -132,17 +138,17 @@ describe("AskQuestionTool.execute", () => {
|
|
|
132
138
|
expect(calls).toHaveLength(1);
|
|
133
139
|
expect(calls[0]?.conversationId).toBe("conv-1");
|
|
134
140
|
expect(calls[0]?.questions).toHaveLength(1);
|
|
135
|
-
expect(calls[0]?.questions[0]?.question).toBe(
|
|
136
|
-
expect(calls[0]?.questions[0]?.description).toBe(
|
|
137
|
-
expect(calls[0]?.questions[0]?.options).toEqual(
|
|
141
|
+
expect(calls[0]?.questions[0]?.question).toBe(singleQ.question);
|
|
142
|
+
expect(calls[0]?.questions[0]?.description).toBe(singleQ.description);
|
|
143
|
+
expect(calls[0]?.questions[0]?.options).toEqual(singleQ.options);
|
|
138
144
|
expect(calls[0]?.questions[0]?.freeTextPlaceholder).toBe(
|
|
139
|
-
|
|
145
|
+
singleQ.freeTextPlaceholder,
|
|
140
146
|
);
|
|
141
147
|
expect(calls[0]?.toolUseId).toBe("tu-1");
|
|
142
148
|
|
|
143
149
|
expect(result.isError).toBe(false);
|
|
144
150
|
expect(result.content).toBe(
|
|
145
|
-
`Question "${
|
|
151
|
+
`Question "${singleQ.question}" → Option: a (Apple)`,
|
|
146
152
|
);
|
|
147
153
|
});
|
|
148
154
|
|
|
@@ -150,7 +156,7 @@ describe("AskQuestionTool.execute", () => {
|
|
|
150
156
|
setNextResult(singleCompleted({ decision: "option", optionId: "b" }));
|
|
151
157
|
const result = await askQuestionTool.execute(validInput, makeContext());
|
|
152
158
|
expect(result.content).toBe(
|
|
153
|
-
`Question "${
|
|
159
|
+
`Question "${singleQ.question}" → Option: b (Banana)`,
|
|
154
160
|
);
|
|
155
161
|
expect(result.isError).toBe(false);
|
|
156
162
|
});
|
|
@@ -159,7 +165,7 @@ describe("AskQuestionTool.execute", () => {
|
|
|
159
165
|
setNextResult(singleCompleted({ decision: "option", optionId: "ghost" }));
|
|
160
166
|
const result = await askQuestionTool.execute(validInput, makeContext());
|
|
161
167
|
expect(result.content).toBe(
|
|
162
|
-
`Question "${
|
|
168
|
+
`Question "${singleQ.question}" → Option: ghost ((unknown))`,
|
|
163
169
|
);
|
|
164
170
|
expect(result.isError).toBe(false);
|
|
165
171
|
});
|
|
@@ -168,7 +174,7 @@ describe("AskQuestionTool.execute", () => {
|
|
|
168
174
|
setNextResult(singleCompleted({ decision: "free_text", text: "Cherry" }));
|
|
169
175
|
const result = await askQuestionTool.execute(validInput, makeContext());
|
|
170
176
|
expect(result.content).toBe(
|
|
171
|
-
`Question "${
|
|
177
|
+
`Question "${singleQ.question}" → Free text: Cherry`,
|
|
172
178
|
);
|
|
173
179
|
expect(result.isError).toBe(false);
|
|
174
180
|
});
|
|
@@ -176,7 +182,7 @@ describe("AskQuestionTool.execute", () => {
|
|
|
176
182
|
test("formats skipped result", async () => {
|
|
177
183
|
setNextResult(singleCompleted({ decision: "skipped" }));
|
|
178
184
|
const result = await askQuestionTool.execute(validInput, makeContext());
|
|
179
|
-
expect(result.content).toBe(`Question "${
|
|
185
|
+
expect(result.content).toBe(`Question "${singleQ.question}" → Skipped`);
|
|
180
186
|
expect(result.isError).toBe(false);
|
|
181
187
|
});
|
|
182
188
|
|
|
@@ -200,10 +206,10 @@ describe("AskQuestionTool.execute", () => {
|
|
|
200
206
|
expect(result.content).toBe("Question aborted");
|
|
201
207
|
});
|
|
202
208
|
|
|
203
|
-
test("rejects
|
|
209
|
+
test("rejects a question with fewer than 2 options", async () => {
|
|
204
210
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
205
211
|
const result = await askQuestionTool.execute(
|
|
206
|
-
{ ...
|
|
212
|
+
{ questions: [{ ...singleQ, options: [{ id: "a", label: "Apple" }] }] },
|
|
207
213
|
makeContext(),
|
|
208
214
|
);
|
|
209
215
|
expect(result.isError).toBe(true);
|
|
@@ -211,17 +217,21 @@ describe("AskQuestionTool.execute", () => {
|
|
|
211
217
|
expect(calls).toHaveLength(0);
|
|
212
218
|
});
|
|
213
219
|
|
|
214
|
-
test("rejects
|
|
220
|
+
test("rejects a question with more than 4 options", async () => {
|
|
215
221
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
216
222
|
const result = await askQuestionTool.execute(
|
|
217
223
|
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
questions: [
|
|
225
|
+
{
|
|
226
|
+
...singleQ,
|
|
227
|
+
options: [
|
|
228
|
+
{ id: "a", label: "A" },
|
|
229
|
+
{ id: "b", label: "B" },
|
|
230
|
+
{ id: "c", label: "C" },
|
|
231
|
+
{ id: "d", label: "D" },
|
|
232
|
+
{ id: "e", label: "E" },
|
|
233
|
+
],
|
|
234
|
+
},
|
|
225
235
|
],
|
|
226
236
|
},
|
|
227
237
|
makeContext(),
|
|
@@ -230,10 +240,10 @@ describe("AskQuestionTool.execute", () => {
|
|
|
230
240
|
expect(calls).toHaveLength(0);
|
|
231
241
|
});
|
|
232
242
|
|
|
233
|
-
test("rejects
|
|
243
|
+
test("rejects a question with empty text", async () => {
|
|
234
244
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
235
245
|
const result = await askQuestionTool.execute(
|
|
236
|
-
{ ...
|
|
246
|
+
{ questions: [{ ...singleQ, question: "" }] },
|
|
237
247
|
makeContext(),
|
|
238
248
|
);
|
|
239
249
|
expect(result.isError).toBe(true);
|
|
@@ -254,18 +264,6 @@ describe("AskQuestionTool.execute", () => {
|
|
|
254
264
|
// ── Batched input ───────────────────────────────────────────────────
|
|
255
265
|
|
|
256
266
|
describe("AskQuestionTool batched input", () => {
|
|
257
|
-
test("normalizes legacy flat input into a one-element batch forwarded to the prompter", async () => {
|
|
258
|
-
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
259
|
-
|
|
260
|
-
const result = await askQuestionTool.execute(validInput, makeContext());
|
|
261
|
-
|
|
262
|
-
expect(calls).toHaveLength(1);
|
|
263
|
-
expect(calls[0]?.questions).toHaveLength(1);
|
|
264
|
-
expect(calls[0]?.questions[0]?.question).toBe(validInput.question);
|
|
265
|
-
expect(calls[0]?.questions[0]?.options).toEqual(validInput.options);
|
|
266
|
-
expect(result.isError).toBe(false);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
267
|
test("accepts a single-element `questions` batch", async () => {
|
|
270
268
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
271
269
|
|
|
@@ -454,7 +452,7 @@ describe("AskQuestionTool batched input", () => {
|
|
|
454
452
|
expect(calls).toHaveLength(0);
|
|
455
453
|
});
|
|
456
454
|
|
|
457
|
-
test("rejects input missing
|
|
455
|
+
test("rejects input missing `questions`", async () => {
|
|
458
456
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
459
457
|
|
|
460
458
|
const result = await askQuestionTool.execute({}, makeContext());
|
|
@@ -464,11 +462,17 @@ describe("AskQuestionTool batched input", () => {
|
|
|
464
462
|
expect(calls).toHaveLength(0);
|
|
465
463
|
});
|
|
466
464
|
|
|
467
|
-
test("rejects
|
|
465
|
+
test("rejects the dropped flat single-question shape", async () => {
|
|
468
466
|
setNextResult(singleCompleted({ decision: "option", optionId: "a" }));
|
|
469
467
|
|
|
470
468
|
const result = await askQuestionTool.execute(
|
|
471
|
-
{
|
|
469
|
+
{
|
|
470
|
+
question: "Hi?",
|
|
471
|
+
options: [
|
|
472
|
+
{ id: "a", label: "A" },
|
|
473
|
+
{ id: "b", label: "B" },
|
|
474
|
+
],
|
|
475
|
+
},
|
|
472
476
|
makeContext(),
|
|
473
477
|
);
|
|
474
478
|
|
|
@@ -479,7 +483,7 @@ describe("AskQuestionTool batched input", () => {
|
|
|
479
483
|
});
|
|
480
484
|
|
|
481
485
|
describe("askQuestionTool definition (batched schema)", () => {
|
|
482
|
-
test("exposes `questions[]` shape,
|
|
486
|
+
test("exposes `questions[]` shape, requires it, and drops the flat fields", () => {
|
|
483
487
|
const def = askQuestionTool;
|
|
484
488
|
const schema = def.input_schema as unknown as {
|
|
485
489
|
properties: Record<
|
|
@@ -517,8 +521,12 @@ describe("askQuestionTool definition (batched schema)", () => {
|
|
|
517
521
|
|
|
518
522
|
expect(questions?.items?.required).toEqual(["question", "options"]);
|
|
519
523
|
|
|
520
|
-
//
|
|
521
|
-
expect(schema.
|
|
522
|
-
expect(schema.properties
|
|
524
|
+
// `questions` is the only top-level input now.
|
|
525
|
+
expect(schema.required).toEqual(["questions"]);
|
|
526
|
+
expect(Object.keys(schema.properties)).toEqual(["questions"]);
|
|
527
|
+
|
|
528
|
+
// The legacy flat fields are gone.
|
|
529
|
+
expect(schema.properties.question).toBeUndefined();
|
|
530
|
+
expect(schema.properties.options).toBeUndefined();
|
|
523
531
|
});
|
|
524
532
|
});
|
|
@@ -40,35 +40,16 @@ const SingleQuestionSchema = z.object({
|
|
|
40
40
|
// input with ≥6 entries is rejected with a clear Zod error.
|
|
41
41
|
const MAX_QUESTIONS_PER_BATCH = 5;
|
|
42
42
|
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
.optional(),
|
|
55
|
-
// Legacy flat fields. Optional so batched callers can omit them; when
|
|
56
|
-
// present and `questions` is absent, they are normalized into a
|
|
57
|
-
// one-element batch in `execute()`.
|
|
58
|
-
question: z.string().min(1).optional(),
|
|
59
|
-
description: z.string().optional(),
|
|
60
|
-
options: z.array(OptionSchema).min(2).max(4).optional(),
|
|
61
|
-
freeTextPlaceholder: z.string().optional(),
|
|
62
|
-
})
|
|
63
|
-
.refine(
|
|
64
|
-
(v) =>
|
|
65
|
-
v.questions !== undefined ||
|
|
66
|
-
(v.question !== undefined && v.options !== undefined),
|
|
67
|
-
{
|
|
68
|
-
message:
|
|
69
|
-
"Provide `questions` (preferred) or the legacy flat fields (`question` + `options`).",
|
|
70
|
-
},
|
|
71
|
-
);
|
|
43
|
+
// Callers pass a (possibly single-element) batch of questions. `execute()`
|
|
44
|
+
// forwards them straight to the prompter.
|
|
45
|
+
const InputSchema = z.object({
|
|
46
|
+
questions: z
|
|
47
|
+
.array(SingleQuestionSchema)
|
|
48
|
+
.min(1)
|
|
49
|
+
.max(MAX_QUESTIONS_PER_BATCH, {
|
|
50
|
+
message: `At most ${MAX_QUESTIONS_PER_BATCH} questions per batch; split into multiple turns if you need more.`,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
72
53
|
|
|
73
54
|
export type SingleQuestion = z.infer<typeof SingleQuestionSchema>;
|
|
74
55
|
export type AskQuestionInput = z.infer<typeof InputSchema>;
|
|
@@ -111,8 +92,7 @@ const DESCRIPTION = [
|
|
|
111
92
|
"context shown beneath the label.",
|
|
112
93
|
].join("\n");
|
|
113
94
|
|
|
114
|
-
//
|
|
115
|
-
// shape and the legacy flat `options` field.
|
|
95
|
+
// Option-schema fragment for the items in `questions[].options`.
|
|
116
96
|
const OPTION_ITEMS_SCHEMA = {
|
|
117
97
|
type: "object",
|
|
118
98
|
properties: {
|
|
@@ -150,12 +130,11 @@ export const askQuestionTool = {
|
|
|
150
130
|
input_schema: {
|
|
151
131
|
type: "object",
|
|
152
132
|
properties: {
|
|
153
|
-
// ── Recommended shape ─────────────────────────────────────
|
|
154
133
|
questions: {
|
|
155
134
|
type: "array",
|
|
156
135
|
minItems: 1,
|
|
157
136
|
maxItems: MAX_QUESTIONS_PER_BATCH,
|
|
158
|
-
description: `
|
|
137
|
+
description: `1–${MAX_QUESTIONS_PER_BATCH} clarifying questions to ask in a single turn. Use a batch when several independent ambiguities block progress; ask one at a time when they're sequentially dependent. Past ${MAX_QUESTIONS_PER_BATCH} questions you should be implementing, not asking.`,
|
|
159
138
|
items: {
|
|
160
139
|
type: "object",
|
|
161
140
|
properties: {
|
|
@@ -185,35 +164,8 @@ export const askQuestionTool = {
|
|
|
185
164
|
required: ["question", "options"],
|
|
186
165
|
},
|
|
187
166
|
},
|
|
188
|
-
// ── Legacy single-question fields ─────────────────────────
|
|
189
|
-
// Kept optional so existing prompt caches and any single-question
|
|
190
|
-
// callers continue to work. New callers should use `questions`.
|
|
191
|
-
question: {
|
|
192
|
-
type: "string",
|
|
193
|
-
description:
|
|
194
|
-
"Legacy: the single clarifying question. Prefer `questions[]` for new code.",
|
|
195
|
-
},
|
|
196
|
-
description: {
|
|
197
|
-
type: "string",
|
|
198
|
-
description:
|
|
199
|
-
"Legacy: optional one-line context shown beneath the question. Prefer `questions[].description`.",
|
|
200
|
-
},
|
|
201
|
-
options: {
|
|
202
|
-
type: "array",
|
|
203
|
-
minItems: 2,
|
|
204
|
-
maxItems: 4,
|
|
205
|
-
description:
|
|
206
|
-
"Legacy: 2–4 structured options. Prefer `questions[].options`. The UI always appends a free-text fallback slot, so do not include a 'something else' option here.",
|
|
207
|
-
items: OPTION_ITEMS_SCHEMA,
|
|
208
|
-
},
|
|
209
|
-
freeTextPlaceholder: {
|
|
210
|
-
type: "string",
|
|
211
|
-
description:
|
|
212
|
-
"Legacy: optional placeholder text for the free-text fallback input. Prefer `questions[].freeTextPlaceholder`.",
|
|
213
|
-
},
|
|
214
167
|
},
|
|
215
|
-
|
|
216
|
-
// or the legacy flat trio (`question` + `options`). Enforced in Zod.
|
|
168
|
+
required: ["questions"],
|
|
217
169
|
},
|
|
218
170
|
|
|
219
171
|
async execute(
|
|
@@ -228,18 +180,7 @@ export const askQuestionTool = {
|
|
|
228
180
|
};
|
|
229
181
|
}
|
|
230
182
|
|
|
231
|
-
|
|
232
|
-
// downstream code only has to deal with the batched shape. The refine
|
|
233
|
-
// above guarantees `question` and `options` are present whenever
|
|
234
|
-
// `questions` is absent.
|
|
235
|
-
const questions: SingleQuestion[] = parsed.data.questions ?? [
|
|
236
|
-
{
|
|
237
|
-
question: parsed.data.question!,
|
|
238
|
-
description: parsed.data.description,
|
|
239
|
-
options: parsed.data.options!,
|
|
240
|
-
freeTextPlaceholder: parsed.data.freeTextPlaceholder,
|
|
241
|
-
},
|
|
242
|
-
];
|
|
183
|
+
const questions: SingleQuestion[] = parsed.data.questions;
|
|
243
184
|
|
|
244
185
|
const prompter = new QuestionPrompter();
|
|
245
186
|
const result = await prompter.prompt({
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `'error'`-event handler for `fs.watch()` FSWatchers.
|
|
3
|
+
*
|
|
4
|
+
* An `FSWatcher` is an EventEmitter. When the underlying inotify/FSEvents
|
|
5
|
+
* backend fails *after* the watch was established — e.g. ENOSPC when the
|
|
6
|
+
* kernel's `fs.inotify.max_user_watches` limit is exhausted while walking a
|
|
7
|
+
* recursive watch into a large subtree (a plugin's `node_modules`), or ENXIO
|
|
8
|
+
* when a Unix socket file appears in a watched directory — the failure is
|
|
9
|
+
* delivered asynchronously as an `'error'` event rather than a synchronous
|
|
10
|
+
* throw from `watch()`. An emitter with no `'error'` listener rethrows, which
|
|
11
|
+
* surfaces as an `uncaughtException` and takes the whole daemon down (→
|
|
12
|
+
* CrashLoopBackOff).
|
|
13
|
+
*
|
|
14
|
+
* Attaching this handler degrades the failure to "this watcher stops
|
|
15
|
+
* delivering events", in line with the daemon startup philosophy: a subsystem
|
|
16
|
+
* failure must never crash the process.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { FSWatcher } from "node:fs";
|
|
20
|
+
|
|
21
|
+
import type { Logger } from "pino";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attach a resilient `'error'` listener so async FSWatcher failures are logged
|
|
25
|
+
* instead of crashing the process. Pass the owning module's logger and the
|
|
26
|
+
* watched directory for diagnostic context.
|
|
27
|
+
*/
|
|
28
|
+
export function attachFsWatcherErrorHandler(
|
|
29
|
+
watcher: FSWatcher,
|
|
30
|
+
log: Logger,
|
|
31
|
+
dir: string,
|
|
32
|
+
): void {
|
|
33
|
+
watcher.on("error", (err) => {
|
|
34
|
+
log.warn({ err, dir }, "FSWatcher error (non-fatal, continuing)");
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
|
|
3
|
+
import { getDataDir } from "./platform.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Path to the secondary SQLite file that houses the high-churn memory
|
|
7
|
+
* subsystem tables (starting with the `memory_jobs` work queue). It lives in
|
|
8
|
+
* the same `data/db` directory as the main DB and is ATTACHed to the daemon's
|
|
9
|
+
* connection as the `memory` schema (see `memory/db-connection.ts`). Splitting
|
|
10
|
+
* these tables into their own file keeps the main DB — and its WAL — small and
|
|
11
|
+
* lets the two files VACUUM/checkpoint independently, so a runaway queue can no
|
|
12
|
+
* longer bloat the main database.
|
|
13
|
+
*
|
|
14
|
+
* Kept in its own leaf module rather than alongside `getDbPath()` in
|
|
15
|
+
* `platform.ts`: `platform.ts` is imported very early and widely, and adding an
|
|
16
|
+
* export to it that low-level consumers (e.g. `db-connection.ts`) pull in
|
|
17
|
+
* across the daemon's large, cyclic import graph trips a Bun link-order bug
|
|
18
|
+
* ("Export named 'getMemoryDbPath' not found"). Isolating it here keeps
|
|
19
|
+
* `platform.ts`'s module shape stable — same reasoning as `logs-db-path.ts`.
|
|
20
|
+
*/
|
|
21
|
+
export function getMemoryDbPath(): string {
|
|
22
|
+
return join(getDataDir(), "db", "assistant-memory.db");
|
|
23
|
+
}
|