@hyperwindmill/caretaker-cli 0.21.0 → 0.23.0
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/dist/cli/web/scheduler/locks.d.ts +3 -3
- package/dist/cli/web/scheduler/task_roles.js +1 -1
- package/dist/cli/web/scheduler/task_strategy.js +4 -4
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +61 -26
- package/dist/harness/tools/builtin/email_tools.d.ts.map +1 -1
- package/dist/harness/tools/builtin/email_tools.js +33 -5
- package/dist/harness/tools/builtin/task_tools.js +37 -37
- package/dist/lib/docker.d.ts +1 -1
- package/dist/lib/docker.d.ts.map +1 -1
- package/dist/lib/docker.js +2 -2
- package/dist/lib/email.d.ts +17 -1
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +23 -1
- package/dist/lib/project_slug.d.ts +29 -0
- package/dist/lib/project_slug.d.ts.map +1 -0
- package/dist/lib/project_slug.js +41 -0
- package/dist/lib/task_git.d.ts +5 -5
- package/dist/lib/task_git.d.ts.map +1 -1
- package/dist/lib/task_git.js +8 -6
- package/dist/store/db.d.ts +12 -7
- package/dist/store/db.d.ts.map +1 -1
- package/dist/store/db.js +59 -15
- package/dist/store/json.d.ts +1 -0
- package/dist/store/json.d.ts.map +1 -1
- package/dist/store/json.js +6 -1
- package/dist/webview/standalone.js +45 -19
- package/dist/webview/standalone.js.map +2 -2
- package/package.json +4 -3
|
@@ -17,19 +17,19 @@ export const getTaskStateTool = {
|
|
|
17
17
|
parameters: {
|
|
18
18
|
type: 'object',
|
|
19
19
|
properties: {
|
|
20
|
-
task_id: { type: '
|
|
20
|
+
task_id: { type: 'string' },
|
|
21
21
|
},
|
|
22
22
|
required: ['task_id'],
|
|
23
23
|
},
|
|
24
24
|
execute: async (args) => {
|
|
25
25
|
const db = getDb();
|
|
26
|
-
const taskId =
|
|
26
|
+
const taskId = String(args.task_id);
|
|
27
27
|
const task = await getTaskById(taskId);
|
|
28
28
|
if (!task)
|
|
29
29
|
return err(`Task ${taskId} not found`);
|
|
30
30
|
const config = await loadConfig();
|
|
31
31
|
const project = (config.projects || []).find((p) => p.id === task.projectId) || null;
|
|
32
|
-
const messages = (await db.query(`SELECT * FROM task_messages WHERE taskId = ${taskId}`));
|
|
32
|
+
const messages = (await db.query(`SELECT * FROM task_messages WHERE taskId = '${taskId}'`));
|
|
33
33
|
messages.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
34
34
|
return {
|
|
35
35
|
content: JSON.stringify({
|
|
@@ -66,7 +66,7 @@ export const updateChecklistItemTool = {
|
|
|
66
66
|
parameters: {
|
|
67
67
|
type: 'object',
|
|
68
68
|
properties: {
|
|
69
|
-
task_id: { type: '
|
|
69
|
+
task_id: { type: 'string' },
|
|
70
70
|
item_id: { type: 'string' },
|
|
71
71
|
status: { type: 'string', enum: ['pending', 'in_progress', 'done', 'skipped'] },
|
|
72
72
|
},
|
|
@@ -74,7 +74,7 @@ export const updateChecklistItemTool = {
|
|
|
74
74
|
},
|
|
75
75
|
execute: async (args) => {
|
|
76
76
|
const db = getDb();
|
|
77
|
-
const taskId =
|
|
77
|
+
const taskId = String(args.task_id);
|
|
78
78
|
const itemId = String(args.item_id);
|
|
79
79
|
const statusInput = args.status;
|
|
80
80
|
const status = tryNormalizeChecklistStatus(statusInput);
|
|
@@ -97,7 +97,7 @@ export const updateChecklistTool = {
|
|
|
97
97
|
parameters: {
|
|
98
98
|
type: 'object',
|
|
99
99
|
properties: {
|
|
100
|
-
task_id: { type: '
|
|
100
|
+
task_id: { type: 'string' },
|
|
101
101
|
checklist: {
|
|
102
102
|
type: 'array',
|
|
103
103
|
items: {
|
|
@@ -115,7 +115,7 @@ export const updateChecklistTool = {
|
|
|
115
115
|
},
|
|
116
116
|
execute: async (args) => {
|
|
117
117
|
const db = getDb();
|
|
118
|
-
const taskId =
|
|
118
|
+
const taskId = String(args.task_id);
|
|
119
119
|
const checklistInput = args.checklist;
|
|
120
120
|
const task = await getTaskById(taskId);
|
|
121
121
|
if (!task)
|
|
@@ -146,14 +146,14 @@ export const taskUpdateDetailsTool = {
|
|
|
146
146
|
parameters: {
|
|
147
147
|
type: 'object',
|
|
148
148
|
properties: {
|
|
149
|
-
task_id: { type: '
|
|
149
|
+
task_id: { type: 'string' },
|
|
150
150
|
title: { type: 'string' },
|
|
151
151
|
objective: { type: 'string' },
|
|
152
152
|
},
|
|
153
153
|
required: ['task_id'],
|
|
154
154
|
},
|
|
155
155
|
execute: async (args) => {
|
|
156
|
-
const taskId =
|
|
156
|
+
const taskId = String(args.task_id);
|
|
157
157
|
const hasTitle = args.title !== undefined;
|
|
158
158
|
const hasObjective = args.objective !== undefined;
|
|
159
159
|
if (!hasTitle && !hasObjective)
|
|
@@ -214,14 +214,14 @@ export const addMessageTool = {
|
|
|
214
214
|
parameters: {
|
|
215
215
|
type: 'object',
|
|
216
216
|
properties: {
|
|
217
|
-
task_id: { type: '
|
|
217
|
+
task_id: { type: 'string' },
|
|
218
218
|
content: { type: 'string' },
|
|
219
219
|
},
|
|
220
220
|
required: ['task_id', 'content'],
|
|
221
221
|
},
|
|
222
222
|
execute: async (args) => {
|
|
223
223
|
const db = getDb();
|
|
224
|
-
const taskId =
|
|
224
|
+
const taskId = String(args.task_id);
|
|
225
225
|
const content = String(args.content);
|
|
226
226
|
await addTaskMessage({
|
|
227
227
|
taskId,
|
|
@@ -245,14 +245,14 @@ export const completeTaskTool = {
|
|
|
245
245
|
parameters: {
|
|
246
246
|
type: 'object',
|
|
247
247
|
properties: {
|
|
248
|
-
task_id: { type: '
|
|
248
|
+
task_id: { type: 'string' },
|
|
249
249
|
summary: { type: 'string' },
|
|
250
250
|
},
|
|
251
251
|
required: ['task_id'],
|
|
252
252
|
},
|
|
253
253
|
execute: async (args) => {
|
|
254
254
|
const db = getDb();
|
|
255
|
-
const taskId =
|
|
255
|
+
const taskId = String(args.task_id);
|
|
256
256
|
const summary = args.summary ? String(args.summary) : '';
|
|
257
257
|
const task = await getTaskById(taskId);
|
|
258
258
|
if (!task)
|
|
@@ -287,14 +287,14 @@ export const blockTaskTool = {
|
|
|
287
287
|
parameters: {
|
|
288
288
|
type: 'object',
|
|
289
289
|
properties: {
|
|
290
|
-
task_id: { type: '
|
|
290
|
+
task_id: { type: 'string' },
|
|
291
291
|
reason: { type: 'string' },
|
|
292
292
|
},
|
|
293
293
|
required: ['task_id', 'reason'],
|
|
294
294
|
},
|
|
295
295
|
execute: async (args) => {
|
|
296
296
|
const db = getDb();
|
|
297
|
-
const taskId =
|
|
297
|
+
const taskId = String(args.task_id);
|
|
298
298
|
const reason = String(args.reason);
|
|
299
299
|
const task = await getTaskById(taskId);
|
|
300
300
|
if (!task)
|
|
@@ -320,14 +320,14 @@ export const yieldTaskTool = {
|
|
|
320
320
|
parameters: {
|
|
321
321
|
type: 'object',
|
|
322
322
|
properties: {
|
|
323
|
-
task_id: { type: '
|
|
323
|
+
task_id: { type: 'string' },
|
|
324
324
|
notes: { type: 'string' },
|
|
325
325
|
},
|
|
326
326
|
required: ['task_id'],
|
|
327
327
|
},
|
|
328
328
|
execute: async (args) => {
|
|
329
329
|
const db = getDb();
|
|
330
|
-
const taskId =
|
|
330
|
+
const taskId = String(args.task_id);
|
|
331
331
|
const notes = args.notes ? String(args.notes) : '';
|
|
332
332
|
const task = await getTaskById(taskId);
|
|
333
333
|
if (!task)
|
|
@@ -380,7 +380,7 @@ export const taskCreateTool = {
|
|
|
380
380
|
parameters: {
|
|
381
381
|
type: 'object',
|
|
382
382
|
properties: {
|
|
383
|
-
project_id: { type: '
|
|
383
|
+
project_id: { type: 'string' },
|
|
384
384
|
title: { type: 'string' },
|
|
385
385
|
objective: { type: 'string' },
|
|
386
386
|
checklist: {
|
|
@@ -402,7 +402,7 @@ export const taskCreateTool = {
|
|
|
402
402
|
},
|
|
403
403
|
execute: async (args) => {
|
|
404
404
|
const db = getDb();
|
|
405
|
-
const projectId =
|
|
405
|
+
const projectId = String(args.project_id);
|
|
406
406
|
const title = String(args.title);
|
|
407
407
|
const objective = String(args.objective);
|
|
408
408
|
const checklistInput = args.checklist;
|
|
@@ -496,14 +496,14 @@ export const taskUnblockTool = {
|
|
|
496
496
|
parameters: {
|
|
497
497
|
type: 'object',
|
|
498
498
|
properties: {
|
|
499
|
-
task_id: { type: '
|
|
499
|
+
task_id: { type: 'string' },
|
|
500
500
|
message: { type: 'string' },
|
|
501
501
|
},
|
|
502
502
|
required: ['task_id'],
|
|
503
503
|
},
|
|
504
504
|
execute: async (args) => {
|
|
505
505
|
const db = getDb();
|
|
506
|
-
const taskId =
|
|
506
|
+
const taskId = String(args.task_id);
|
|
507
507
|
const message = args.message ? String(args.message) : '';
|
|
508
508
|
const task = await getTaskById(taskId);
|
|
509
509
|
if (!task)
|
|
@@ -533,13 +533,13 @@ export const taskActivateTool = {
|
|
|
533
533
|
parameters: {
|
|
534
534
|
type: 'object',
|
|
535
535
|
properties: {
|
|
536
|
-
task_id: { type: '
|
|
536
|
+
task_id: { type: 'string' },
|
|
537
537
|
},
|
|
538
538
|
required: ['task_id'],
|
|
539
539
|
},
|
|
540
540
|
execute: async (args) => {
|
|
541
541
|
const db = getDb();
|
|
542
|
-
const taskId =
|
|
542
|
+
const taskId = String(args.task_id);
|
|
543
543
|
const task = await getTaskById(taskId);
|
|
544
544
|
if (!task)
|
|
545
545
|
return err(`Task ${taskId} not found`);
|
|
@@ -566,14 +566,14 @@ export const taskUnpauseTool = {
|
|
|
566
566
|
parameters: {
|
|
567
567
|
type: 'object',
|
|
568
568
|
properties: {
|
|
569
|
-
task_id: { type: '
|
|
569
|
+
task_id: { type: 'string' },
|
|
570
570
|
message: { type: 'string' },
|
|
571
571
|
},
|
|
572
572
|
required: ['task_id'],
|
|
573
573
|
},
|
|
574
574
|
execute: async (args) => {
|
|
575
575
|
const db = getDb();
|
|
576
|
-
const taskId =
|
|
576
|
+
const taskId = String(args.task_id);
|
|
577
577
|
const message = args.message ? String(args.message) : '';
|
|
578
578
|
const task = await getTaskById(taskId);
|
|
579
579
|
if (!task)
|
|
@@ -603,12 +603,12 @@ export const taskDiscardWorktreeTool = {
|
|
|
603
603
|
parameters: {
|
|
604
604
|
type: 'object',
|
|
605
605
|
properties: {
|
|
606
|
-
task_id: { type: '
|
|
606
|
+
task_id: { type: 'string' },
|
|
607
607
|
},
|
|
608
608
|
required: ['task_id'],
|
|
609
609
|
},
|
|
610
610
|
execute: async (args) => {
|
|
611
|
-
const taskId =
|
|
611
|
+
const taskId = String(args.task_id);
|
|
612
612
|
const task = await getTaskById(taskId);
|
|
613
613
|
if (!task)
|
|
614
614
|
return err(`Task ${taskId} not found`);
|
|
@@ -646,12 +646,12 @@ export const taskArchiveTool = {
|
|
|
646
646
|
parameters: {
|
|
647
647
|
type: 'object',
|
|
648
648
|
properties: {
|
|
649
|
-
task_id: { type: '
|
|
649
|
+
task_id: { type: 'string' },
|
|
650
650
|
},
|
|
651
651
|
required: ['task_id'],
|
|
652
652
|
},
|
|
653
653
|
execute: async (args) => {
|
|
654
|
-
const taskId =
|
|
654
|
+
const taskId = String(args.task_id);
|
|
655
655
|
const task = await getTaskById(taskId);
|
|
656
656
|
if (!task)
|
|
657
657
|
return err(`Task ${taskId} not found`);
|
|
@@ -678,12 +678,12 @@ export const taskUnarchiveTool = {
|
|
|
678
678
|
parameters: {
|
|
679
679
|
type: 'object',
|
|
680
680
|
properties: {
|
|
681
|
-
task_id: { type: '
|
|
681
|
+
task_id: { type: 'string' },
|
|
682
682
|
},
|
|
683
683
|
required: ['task_id'],
|
|
684
684
|
},
|
|
685
685
|
execute: async (args) => {
|
|
686
|
-
const taskId =
|
|
686
|
+
const taskId = String(args.task_id);
|
|
687
687
|
const task = await getTaskById(taskId);
|
|
688
688
|
if (!task)
|
|
689
689
|
return err(`Task ${taskId} not found`);
|
|
@@ -706,12 +706,12 @@ export const taskDeleteTool = {
|
|
|
706
706
|
parameters: {
|
|
707
707
|
type: 'object',
|
|
708
708
|
properties: {
|
|
709
|
-
task_id: { type: '
|
|
709
|
+
task_id: { type: 'string' },
|
|
710
710
|
},
|
|
711
711
|
required: ['task_id'],
|
|
712
712
|
},
|
|
713
713
|
execute: async (args) => {
|
|
714
|
-
const taskId =
|
|
714
|
+
const taskId = String(args.task_id);
|
|
715
715
|
const task = await getTaskById(taskId);
|
|
716
716
|
if (!task)
|
|
717
717
|
return err(`Task ${taskId} not found`);
|
|
@@ -764,7 +764,7 @@ export const taskSetAgentTool = {
|
|
|
764
764
|
parameters: {
|
|
765
765
|
type: 'object',
|
|
766
766
|
properties: {
|
|
767
|
-
task_id: { type: '
|
|
767
|
+
task_id: { type: 'string' },
|
|
768
768
|
agent_id: { type: 'string', description: 'The agent ID to assign, or null to clear the override.' },
|
|
769
769
|
role: {
|
|
770
770
|
type: 'string',
|
|
@@ -775,7 +775,7 @@ export const taskSetAgentTool = {
|
|
|
775
775
|
required: ['task_id'],
|
|
776
776
|
},
|
|
777
777
|
execute: async (args) => {
|
|
778
|
-
const taskId =
|
|
778
|
+
const taskId = String(args.task_id);
|
|
779
779
|
const agentId = args.agent_id != null ? String(args.agent_id) : null;
|
|
780
780
|
const role = args.role === 'planner' || args.role === 'reviewer' ? args.role : 'developer';
|
|
781
781
|
const task = await getTaskById(taskId);
|
|
@@ -810,13 +810,13 @@ export const submitPlanTool = {
|
|
|
810
810
|
parameters: {
|
|
811
811
|
type: 'object',
|
|
812
812
|
properties: {
|
|
813
|
-
task_id: { type: '
|
|
813
|
+
task_id: { type: 'string' },
|
|
814
814
|
plan: { type: 'string', description: 'The full implementation plan, markdown.' },
|
|
815
815
|
},
|
|
816
816
|
required: ['task_id', 'plan'],
|
|
817
817
|
},
|
|
818
818
|
execute: async (args) => {
|
|
819
|
-
const taskId =
|
|
819
|
+
const taskId = String(args.task_id);
|
|
820
820
|
const plan = String(args.plan ?? '').trim();
|
|
821
821
|
if (!plan)
|
|
822
822
|
return err('Plan must not be empty.');
|
package/dist/lib/docker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Deterministic container name for a task — the caller's naming policy. */
|
|
2
|
-
export declare function containerName(
|
|
2
|
+
export declare function containerName(taskId: string): string;
|
|
3
3
|
/** `docker run` argv. Mount is identical-path (`-v <root>:<root>`) so host and
|
|
4
4
|
* container agree on absolute paths. `--user` keeps written files owned by the
|
|
5
5
|
* host user (else root-owned files break the host WIP commit / review diff).
|
package/dist/lib/docker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/lib/docker.ts"],"names":[],"mappings":"AASA,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/lib/docker.ts"],"names":[],"mappings":"AASA,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;;;;;;gHAegH;AAChH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,EACZ,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,EAAE,CAWV;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAElF;AAED,qEAAqE;AACrE,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,CAS5F;AAED,yFAAyF;AACzF,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAM,EAAO,GACzB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;4CAG4C;AAC5C,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGpE;AAED;sEACsE;AACtE,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAc/C;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,6DAA6D;AAC7D,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAErE;AAED;;qFAEqF;AACrF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;2DAE2D;AAC3D,wBAAsB,UAAU,CAC9B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAWf;AAKD,eAAO,MAAM,uBAAuB,ojBAYnC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB;AAED;;;;;;wFAMwF;AACxF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5D"}
|
package/dist/lib/docker.js
CHANGED
|
@@ -6,8 +6,8 @@ import { promisify } from 'node:util';
|
|
|
6
6
|
import { commandEnv } from '../harness/tools/builtin/shell-env.js';
|
|
7
7
|
const exec = promisify(execFile);
|
|
8
8
|
/** Deterministic container name for a task — the caller's naming policy. */
|
|
9
|
-
export function containerName(
|
|
10
|
-
return `caretaker-task-${
|
|
9
|
+
export function containerName(taskId) {
|
|
10
|
+
return `caretaker-task-${taskId}`;
|
|
11
11
|
}
|
|
12
12
|
/** `docker run` argv. Mount is identical-path (`-v <root>:<root>`) so host and
|
|
13
13
|
* container agree on absolute paths. `--user` keeps written files owned by the
|
package/dist/lib/email.d.ts
CHANGED
|
@@ -71,14 +71,30 @@ export declare function visibleAccounts(accounts: EmailAccount[], agentId?: stri
|
|
|
71
71
|
export declare function listEmailAccounts(agentId?: string): Promise<EmailAccount[]>;
|
|
72
72
|
/** Look an account up by service name, case-insensitively. */
|
|
73
73
|
export declare function findAccount(accounts: EmailAccount[], name: string): EmailAccount | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Render the markdown an agent already wrote as `body` into the HTML part, so a
|
|
76
|
+
* formatted mail costs one copy of the content instead of two. The wrapper is
|
|
77
|
+
* the whole styling story: `marked` emits bare `<p>`/`<h2>`, and mail clients
|
|
78
|
+
* have no sensible default for those. Inline styles only — clients strip
|
|
79
|
+
* `<style>` blocks and never fetch anything external.
|
|
80
|
+
*
|
|
81
|
+
* ponytail: no sanitizer. This is outbound mail written by the agent, which can
|
|
82
|
+
* already send arbitrary HTML through `email_send`'s `html` argument; the
|
|
83
|
+
* recipient's client is what sanitizes on render.
|
|
84
|
+
*/
|
|
85
|
+
export declare function markdownToHtml(markdown: string): string;
|
|
74
86
|
export type OutgoingMail = {
|
|
75
87
|
to: string[];
|
|
76
88
|
cc?: string[];
|
|
77
89
|
bcc?: string[];
|
|
78
90
|
subject: string;
|
|
91
|
+
/** Plain-text part. Always sent — the fallback when `html` is set. */
|
|
79
92
|
body: string;
|
|
93
|
+
/** Optional HTML part. Set together with `body` it makes a multipart/alternative. */
|
|
94
|
+
html?: string;
|
|
80
95
|
};
|
|
81
|
-
/** Send one plain
|
|
96
|
+
/** Send one message (plain text, plus an HTML alternative when given).
|
|
97
|
+
* Returns the SMTP message id. */
|
|
82
98
|
export declare function sendEmail(account: EmailAccount, mail: OutgoingMail, signal?: AbortSignal): Promise<string>;
|
|
83
99
|
/** Hard ceiling on messages per call, whatever the caller asks for. */
|
|
84
100
|
export declare const MAX_FETCH = 50;
|
package/dist/lib/email.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/lib/email.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/lib/email.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAS,CAAC;AAarC,4EAA4E;AAC5E,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qFAAqF;IACrF,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,oEAAoE;IACpE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,OAAO,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAEhD;AAED,yDAAyD;AACzD,wBAAgB,OAAO,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAEhD;AAOD,+DAA+D;AAC/D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,UAAU,CAC9B,OAAO,EAAE,YAAY,EACrB,IAAI,GAAE,YAAiB,GACtB,OAAO,CAAC;IAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA0FnF"}
|
package/dist/lib/email.js
CHANGED
|
@@ -15,6 +15,7 @@ import nodemailer from 'nodemailer';
|
|
|
15
15
|
import { ImapFlow } from 'imapflow';
|
|
16
16
|
import { simpleParser } from 'mailparser';
|
|
17
17
|
import TurndownService from 'turndown';
|
|
18
|
+
import { marked } from 'marked';
|
|
18
19
|
import { loadConfig } from '../store/json.js';
|
|
19
20
|
import { decrypt, isEncrypted } from './encryption.js';
|
|
20
21
|
/**
|
|
@@ -140,7 +141,26 @@ export function findAccount(accounts, name) {
|
|
|
140
141
|
const wanted = name.trim().toLowerCase();
|
|
141
142
|
return accounts.find((a) => a.name.trim().toLowerCase() === wanted);
|
|
142
143
|
}
|
|
143
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Render the markdown an agent already wrote as `body` into the HTML part, so a
|
|
146
|
+
* formatted mail costs one copy of the content instead of two. The wrapper is
|
|
147
|
+
* the whole styling story: `marked` emits bare `<p>`/`<h2>`, and mail clients
|
|
148
|
+
* have no sensible default for those. Inline styles only — clients strip
|
|
149
|
+
* `<style>` blocks and never fetch anything external.
|
|
150
|
+
*
|
|
151
|
+
* ponytail: no sanitizer. This is outbound mail written by the agent, which can
|
|
152
|
+
* already send arbitrary HTML through `email_send`'s `html` argument; the
|
|
153
|
+
* recipient's client is what sanitizes on render.
|
|
154
|
+
*/
|
|
155
|
+
export function markdownToHtml(markdown) {
|
|
156
|
+
const body = marked.parse(markdown, { async: false, gfm: true });
|
|
157
|
+
return ('<div style="font-family:-apple-system,Segoe UI,Helvetica,Arial,sans-serif;' +
|
|
158
|
+
'font-size:14px;line-height:1.5;color:#1a1a1a;max-width:40em">' +
|
|
159
|
+
body +
|
|
160
|
+
'</div>');
|
|
161
|
+
}
|
|
162
|
+
/** Send one message (plain text, plus an HTML alternative when given).
|
|
163
|
+
* Returns the SMTP message id. */
|
|
144
164
|
export async function sendEmail(account, mail, signal) {
|
|
145
165
|
if (signal?.aborted)
|
|
146
166
|
throw new Error('aborted before connecting');
|
|
@@ -161,6 +181,8 @@ export async function sendEmail(account, mail, signal) {
|
|
|
161
181
|
bcc: mail.bcc,
|
|
162
182
|
subject: mail.subject,
|
|
163
183
|
text: mail.body,
|
|
184
|
+
// Both parts → nodemailer builds multipart/alternative on its own.
|
|
185
|
+
...(mail.html ? { html: mail.html } : {}),
|
|
164
186
|
});
|
|
165
187
|
return info.messageId;
|
|
166
188
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative validation for project ids (slugs).
|
|
3
|
+
*
|
|
4
|
+
* Same contract as validateRepositoryUrl (lib/repo_url.ts): the webview may
|
|
5
|
+
* keep a copy of the regex for form feedback, but every write path into
|
|
6
|
+
* caretaker.json — POST /api/projects, the web server's saveConfig websocket
|
|
7
|
+
* handler, and the VSCode sidebar's saveConfig handler — must call THIS one,
|
|
8
|
+
* because clients can send any payload.
|
|
9
|
+
*
|
|
10
|
+
* The slug is embedded verbatim in docker container/image names, git ref
|
|
11
|
+
* names, and filesystem paths under ~/.caretaker/ (a trust boundary: the
|
|
12
|
+
* charset is what makes `..` and `/` unrepresentable). It must start AND end
|
|
13
|
+
* alphanumeric — the docker image reference grammar
|
|
14
|
+
* `[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*` rejects a component ending in a hyphen,
|
|
15
|
+
* so `foo-` would make `caretaker-project-foo-:latest` an invalid reference.
|
|
16
|
+
*
|
|
17
|
+
* Slugs are immutable after creation by construction: the two forms never
|
|
18
|
+
* change the id of an existing project and POST /api/projects only creates.
|
|
19
|
+
* A changed id arriving via saveConfig is indistinguishable from a
|
|
20
|
+
* delete+create, so it cannot be rejected here; the web handler additionally
|
|
21
|
+
* refuses to drop a project that still has tasks (Task 4).
|
|
22
|
+
*/
|
|
23
|
+
export declare const PROJECT_SLUG_RE: RegExp;
|
|
24
|
+
export declare function validateProjectSlug(id: string): string | null;
|
|
25
|
+
export declare function validateProjectIds(incoming: Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
}>): string | null;
|
|
29
|
+
//# sourceMappingURL=project_slug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project_slug.d.ts","sourceRoot":"","sources":["../../src/lib/project_slug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,QAA2C,CAAC;AAExE,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,GAAG,IAAI,CAS/F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative validation for project ids (slugs).
|
|
3
|
+
*
|
|
4
|
+
* Same contract as validateRepositoryUrl (lib/repo_url.ts): the webview may
|
|
5
|
+
* keep a copy of the regex for form feedback, but every write path into
|
|
6
|
+
* caretaker.json — POST /api/projects, the web server's saveConfig websocket
|
|
7
|
+
* handler, and the VSCode sidebar's saveConfig handler — must call THIS one,
|
|
8
|
+
* because clients can send any payload.
|
|
9
|
+
*
|
|
10
|
+
* The slug is embedded verbatim in docker container/image names, git ref
|
|
11
|
+
* names, and filesystem paths under ~/.caretaker/ (a trust boundary: the
|
|
12
|
+
* charset is what makes `..` and `/` unrepresentable). It must start AND end
|
|
13
|
+
* alphanumeric — the docker image reference grammar
|
|
14
|
+
* `[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*` rejects a component ending in a hyphen,
|
|
15
|
+
* so `foo-` would make `caretaker-project-foo-:latest` an invalid reference.
|
|
16
|
+
*
|
|
17
|
+
* Slugs are immutable after creation by construction: the two forms never
|
|
18
|
+
* change the id of an existing project and POST /api/projects only creates.
|
|
19
|
+
* A changed id arriving via saveConfig is indistinguishable from a
|
|
20
|
+
* delete+create, so it cannot be rejected here; the web handler additionally
|
|
21
|
+
* refuses to drop a project that still has tasks (Task 4).
|
|
22
|
+
*/
|
|
23
|
+
export const PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,37}[a-z0-9])?$/;
|
|
24
|
+
export function validateProjectSlug(id) {
|
|
25
|
+
if (!PROJECT_SLUG_RE.test(id)) {
|
|
26
|
+
return 'Project id must be 1-39 characters of a-z, 0-9 and hyphens, starting and ending with a letter or digit.';
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
export function validateProjectIds(incoming) {
|
|
31
|
+
const seen = new Set();
|
|
32
|
+
for (const p of incoming) {
|
|
33
|
+
const err = validateProjectSlug(String(p.id));
|
|
34
|
+
if (err)
|
|
35
|
+
return `Project "${p.name}": ${err}`;
|
|
36
|
+
if (seen.has(p.id))
|
|
37
|
+
return `Duplicate project id "${p.id}".`;
|
|
38
|
+
seen.add(p.id);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
package/dist/lib/task_git.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function pushBranch(worktreePath: string, branch: string, repo: {
|
|
|
6
6
|
token?: string | null;
|
|
7
7
|
}): Promise<void>;
|
|
8
8
|
export declare function projectWorkingDir(project: {
|
|
9
|
-
id:
|
|
9
|
+
id: string;
|
|
10
10
|
workingDir?: string | null;
|
|
11
11
|
repositoryUrl?: string | null;
|
|
12
12
|
}): string;
|
|
@@ -17,7 +17,7 @@ export declare function projectWorkingDir(project: {
|
|
|
17
17
|
* anything null must never be touched.
|
|
18
18
|
*/
|
|
19
19
|
export declare function managedRepoDir(project: {
|
|
20
|
-
id:
|
|
20
|
+
id: string;
|
|
21
21
|
workingDir?: string | null;
|
|
22
22
|
repositoryUrl?: string | null;
|
|
23
23
|
}): string | null;
|
|
@@ -27,7 +27,7 @@ export type ProjectRepoStatus = {
|
|
|
27
27
|
commit?: string;
|
|
28
28
|
};
|
|
29
29
|
export declare function projectRepoStatus(project: {
|
|
30
|
-
id:
|
|
30
|
+
id: string;
|
|
31
31
|
workingDir?: string | null;
|
|
32
32
|
repositoryUrl?: string | null;
|
|
33
33
|
}): Promise<ProjectRepoStatus>;
|
|
@@ -42,7 +42,7 @@ export type SyncProgress = {
|
|
|
42
42
|
* callers turn that into a blocked task / in-band error line.
|
|
43
43
|
*/
|
|
44
44
|
export declare function syncProjectRepo(project: {
|
|
45
|
-
id:
|
|
45
|
+
id: string;
|
|
46
46
|
workingDir?: string | null;
|
|
47
47
|
repositoryUrl?: string | null;
|
|
48
48
|
repositoryToken?: string | null;
|
|
@@ -56,7 +56,7 @@ export declare function syncProjectRepo(project: {
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function gitCommonDir(worktreePath: string): Promise<string | null>;
|
|
58
58
|
export declare function agentDirIn(worktreePath: string, projectWorkingDir: string): Promise<string>;
|
|
59
|
-
export declare function ensureWorktree(projectWorkingDir: string,
|
|
59
|
+
export declare function ensureWorktree(projectWorkingDir: string, taskId: string, title: string, existingBranch?: string | null): Promise<{
|
|
60
60
|
branch: string;
|
|
61
61
|
worktreePath: string;
|
|
62
62
|
agentWorkingDir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_git.d.ts","sourceRoot":"","sources":["../../src/lib/task_git.ts"],"names":[],"mappings":"AA2BA,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAM7D;AAOD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAKvD;AAED,wBAAgB,UAAU,CAAC,KAAK,CAAC,E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M,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM/E;AAED,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAsB,cAAc,CAClC,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAC7B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB5E;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAAE,EAClB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAwBf;AAcD,wBAAsB,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcrF;AAED,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBtE;AAED,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC5D,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
package/dist/lib/task_git.js
CHANGED
|
@@ -98,7 +98,7 @@ export function projectWorkingDir(project) {
|
|
|
98
98
|
// Remote-backed with no explicit dir: managed clone under the data dir.
|
|
99
99
|
// Resolved at call time (dataDir() follows CARETAKER_HOME), never persisted.
|
|
100
100
|
if ((project.repositoryUrl || '').trim())
|
|
101
|
-
return join(dataDir(), 'repos',
|
|
101
|
+
return join(dataDir(), 'repos', project.id);
|
|
102
102
|
return '';
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -218,8 +218,8 @@ function slug(title) {
|
|
|
218
218
|
.replace(/^-+|-+$/g, '')
|
|
219
219
|
.slice(0, 40) || 'task');
|
|
220
220
|
}
|
|
221
|
-
function worktreePathFor(
|
|
222
|
-
return join(dataDir(), 'worktrees',
|
|
221
|
+
function worktreePathFor(taskId) {
|
|
222
|
+
return join(dataDir(), 'worktrees', taskId); // task id is already <projectId>-<seq>
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
225
|
* Absolute git common dir for a (linked) worktree — the main repo's shared
|
|
@@ -242,10 +242,12 @@ export async function agentDirIn(worktreePath, projectWorkingDir) {
|
|
|
242
242
|
const rel = relative(repoRoot, projectWorkingDir);
|
|
243
243
|
return rel ? join(worktreePath, rel) : worktreePath;
|
|
244
244
|
}
|
|
245
|
-
export async function ensureWorktree(projectWorkingDir,
|
|
245
|
+
export async function ensureWorktree(projectWorkingDir, taskId, title, existingBranch) {
|
|
246
246
|
const repoRoot = await git(projectWorkingDir, ['rev-parse', '--show-toplevel']);
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
// The persisted branch is authoritative: re-deriving under the new id scheme
|
|
248
|
+
// would produce a different name and orphan a lost-path task's commits.
|
|
249
|
+
const branch = existingBranch || `caretaker/task-${taskId}-${slug(title)}`;
|
|
250
|
+
const worktreePath = worktreePathFor(taskId);
|
|
249
251
|
try {
|
|
250
252
|
await git(repoRoot, ['worktree', 'add', '-b', branch, worktreePath, 'HEAD']);
|
|
251
253
|
}
|
package/dist/store/db.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ChecklistItem {
|
|
|
6
6
|
order: number;
|
|
7
7
|
}
|
|
8
8
|
export interface Project {
|
|
9
|
-
id:
|
|
9
|
+
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
description: string;
|
|
12
12
|
workingDir: string;
|
|
@@ -19,8 +19,13 @@ export interface Project {
|
|
|
19
19
|
sddEnabled?: boolean | null;
|
|
20
20
|
}
|
|
21
21
|
export interface Task {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/** `<projectId>-<seq>`. OPAQUE — never parse it; projectId and seq below
|
|
23
|
+
* are the source of truth. Embedded verbatim in the worktree dir name
|
|
24
|
+
* (~/.caretaker/worktrees/<id>) and container name (caretaker-task-<id>). */
|
|
25
|
+
id: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
/** Per-project sequence number; stored, never derived from id. */
|
|
28
|
+
seq: number;
|
|
24
29
|
title: string;
|
|
25
30
|
objective: string;
|
|
26
31
|
checklist: ChecklistItem[];
|
|
@@ -48,7 +53,7 @@ export interface Task {
|
|
|
48
53
|
}
|
|
49
54
|
export interface TaskMessage {
|
|
50
55
|
id: number;
|
|
51
|
-
taskId:
|
|
56
|
+
taskId: string;
|
|
52
57
|
role: 'user' | 'assistant' | 'tool';
|
|
53
58
|
messageType: 'chat' | 'heartbeat' | 'heartbeat_live' | 'system' | 'block' | 'tool_call' | 'yield' | 'review' | 'plan';
|
|
54
59
|
content: string;
|
|
@@ -64,10 +69,10 @@ export declare function dbStoreDir(): string;
|
|
|
64
69
|
export declare function getDb(): Store;
|
|
65
70
|
export declare function tryNormalizeChecklistStatus(status: any): 'pending' | 'in_progress' | 'done' | 'skipped' | null;
|
|
66
71
|
export declare function runQuery(sql: string): Promise<any>;
|
|
67
|
-
export declare function getTaskById(id:
|
|
72
|
+
export declare function getTaskById(id: string): Promise<Task | null>;
|
|
68
73
|
export declare function saveTask(task: Task): Promise<void>;
|
|
69
|
-
export declare function createTask(task: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<Task>;
|
|
74
|
+
export declare function createTask(task: Omit<Task, 'id' | 'seq' | 'createdAt' | 'updatedAt'>): Promise<Task>;
|
|
70
75
|
export declare function addTaskMessage(msg: Omit<TaskMessage, 'id' | 'createdAt'>): Promise<TaskMessage>;
|
|
71
76
|
export declare function updateTaskMessageContent(id: number, content: string, type?: TaskMessage['messageType']): Promise<void>;
|
|
72
|
-
export declare function deleteTask(taskId:
|
|
77
|
+
export declare function deleteTask(taskId: string): Promise<void>;
|
|
73
78
|
//# sourceMappingURL=db.d.ts.map
|