@hasna/todos 0.11.14 → 0.11.15
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/brains.d.ts +3 -0
- package/dist/cli/brains.d.ts.map +1 -0
- package/dist/cli/commands/dispatch.d.ts +3 -0
- package/dist/cli/commands/dispatch.d.ts.map +1 -0
- package/dist/cli/components/App.d.ts +2 -0
- package/dist/cli/components/App.d.ts.map +1 -0
- package/dist/cli/components/Dashboard.d.ts +7 -0
- package/dist/cli/components/Dashboard.d.ts.map +1 -0
- package/dist/cli/components/Header.d.ts +8 -0
- package/dist/cli/components/Header.d.ts.map +1 -0
- package/dist/cli/components/ProjectList.d.ts +8 -0
- package/dist/cli/components/ProjectList.d.ts.map +1 -0
- package/dist/cli/components/SearchView.d.ts +10 -0
- package/dist/cli/components/SearchView.d.ts.map +1 -0
- package/dist/cli/components/TaskDetail.d.ts +7 -0
- package/dist/cli/components/TaskDetail.d.ts.map +1 -0
- package/dist/cli/components/TaskForm.d.ts +15 -0
- package/dist/cli/components/TaskForm.d.ts.map +1 -0
- package/dist/cli/components/TaskList.d.ts +8 -0
- package/dist/cli/components/TaskList.d.ts.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4357 -4351
- package/dist/db/agent-metrics.d.ts +34 -0
- package/dist/db/agent-metrics.d.ts.map +1 -0
- package/dist/db/agents.d.ts +82 -0
- package/dist/db/agents.d.ts.map +1 -0
- package/dist/db/audit.d.ts +52 -0
- package/dist/db/audit.d.ts.map +1 -0
- package/dist/db/budgets.d.ts +27 -0
- package/dist/db/budgets.d.ts.map +1 -0
- package/dist/db/builtin-templates.d.ts +22 -0
- package/dist/db/builtin-templates.d.ts.map +1 -0
- package/dist/db/checklists.d.ts +13 -0
- package/dist/db/checklists.d.ts.map +1 -0
- package/dist/db/comments.d.ts +8 -0
- package/dist/db/comments.d.ts.map +1 -0
- package/dist/db/database.d.ts +12 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/dispatches.d.ts +15 -0
- package/dist/db/dispatches.d.ts.map +1 -0
- package/dist/db/file-locks.d.ts +43 -0
- package/dist/db/file-locks.d.ts.map +1 -0
- package/dist/db/handoffs.d.ts +25 -0
- package/dist/db/handoffs.d.ts.map +1 -0
- package/dist/db/kg.d.ts +70 -0
- package/dist/db/kg.d.ts.map +1 -0
- package/dist/db/locks.d.ts +14 -0
- package/dist/db/locks.d.ts.map +1 -0
- package/dist/db/orgs.d.ts +13 -0
- package/dist/db/orgs.d.ts.map +1 -0
- package/dist/db/patrol.d.ts +35 -0
- package/dist/db/patrol.d.ts.map +1 -0
- package/dist/db/pg-migrate.d.ts +14 -0
- package/dist/db/pg-migrate.d.ts.map +1 -0
- package/dist/db/pg-migrations.d.ts +8 -0
- package/dist/db/pg-migrations.d.ts.map +1 -0
- package/dist/db/plans.d.ts +8 -0
- package/dist/db/plans.d.ts.map +1 -0
- package/dist/db/project-agent-roles.d.ts +34 -0
- package/dist/db/project-agent-roles.d.ts.map +1 -0
- package/dist/db/projects.d.ts +16 -0
- package/dist/db/projects.d.ts.map +1 -0
- package/dist/db/schema.d.ts +6 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/sessions.d.ts +8 -0
- package/dist/db/sessions.d.ts.map +1 -0
- package/dist/db/snapshots.d.ts +37 -0
- package/dist/db/snapshots.d.ts.map +1 -0
- package/dist/db/task-claim.d.ts +7 -0
- package/dist/db/task-claim.d.ts.map +1 -0
- package/dist/db/task-commits.d.ts +31 -0
- package/dist/db/task-commits.d.ts.map +1 -0
- package/dist/db/task-files.d.ts +74 -0
- package/dist/db/task-files.d.ts.map +1 -0
- package/dist/db/task-lists.d.ts +10 -0
- package/dist/db/task-lists.d.ts.map +1 -0
- package/dist/db/task-relationships.d.ts +36 -0
- package/dist/db/task-relationships.d.ts.map +1 -0
- package/dist/db/task-workflow.d.ts +7 -0
- package/dist/db/task-workflow.d.ts.map +1 -0
- package/dist/db/tasks.d.ts +215 -0
- package/dist/db/tasks.d.ts.map +1 -0
- package/dist/db/templates.d.ts +98 -0
- package/dist/db/templates.d.ts.map +1 -0
- package/dist/db/traces.d.ts +38 -0
- package/dist/db/traces.d.ts.map +1 -0
- package/dist/db/webhooks.d.ts +19 -0
- package/dist/db/webhooks.d.ts.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +146 -140
- package/dist/lib/agent-tasks.d.ts +11 -0
- package/dist/lib/agent-tasks.d.ts.map +1 -0
- package/dist/lib/auto-assign.d.ts +25 -0
- package/dist/lib/auto-assign.d.ts.map +1 -0
- package/dist/lib/burndown.d.ts +18 -0
- package/dist/lib/burndown.d.ts.map +1 -0
- package/dist/lib/claude-tasks.d.ts +20 -0
- package/dist/lib/claude-tasks.d.ts.map +1 -0
- package/dist/lib/completion-guard.d.ts +17 -0
- package/dist/lib/completion-guard.d.ts.map +1 -0
- package/dist/lib/config.d.ts +44 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/dispatch-formatter.d.ts +21 -0
- package/dist/lib/dispatch-formatter.d.ts.map +1 -0
- package/dist/lib/dispatch.d.ts +28 -0
- package/dist/lib/dispatch.d.ts.map +1 -0
- package/dist/lib/extract.d.ts +51 -0
- package/dist/lib/extract.d.ts.map +1 -0
- package/dist/lib/gatherer.d.ts +16 -0
- package/dist/lib/gatherer.d.ts.map +1 -0
- package/dist/lib/github.d.ts +25 -0
- package/dist/lib/github.d.ts.map +1 -0
- package/dist/lib/model-config.d.ts +14 -0
- package/dist/lib/model-config.d.ts.map +1 -0
- package/dist/lib/recurrence.d.ts +10 -0
- package/dist/lib/recurrence.d.ts.map +1 -0
- package/dist/lib/search.d.ts +17 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/sync-types.d.ts +16 -0
- package/dist/lib/sync-types.d.ts.map +1 -0
- package/dist/lib/sync-utils.d.ts +12 -0
- package/dist/lib/sync-utils.d.ts.map +1 -0
- package/dist/lib/sync.d.ts +9 -0
- package/dist/lib/sync.d.ts.map +1 -0
- package/dist/lib/tmux.d.ts +28 -0
- package/dist/lib/tmux.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +1177 -1181
- package/dist/mcp/tools/agents.d.ts +16 -0
- package/dist/mcp/tools/agents.d.ts.map +1 -0
- package/dist/mcp/tools/dispatch.d.ts +9 -0
- package/dist/mcp/tools/dispatch.d.ts.map +1 -0
- package/dist/mcp/tools/templates.d.ts +9 -0
- package/dist/mcp/tools/templates.d.ts.map +1 -0
- package/dist/mcp/tools/webhooks.d.ts +8 -0
- package/dist/mcp/tools/webhooks.d.ts.map +1 -0
- package/dist/sdk.d.ts +186 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/serve.d.ts +10 -0
- package/dist/server/serve.d.ts.map +1 -0
- package/dist/types/index.d.ts +663 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { TaskTemplate, CreateTemplateInput, CreateTaskInput, TemplateTask, TemplateTaskInput, TemplateWithTasks, TemplateVariable, TemplateVersion, Task } from "../types/index.js";
|
|
3
|
+
export interface UpdateTemplateInput {
|
|
4
|
+
name?: string;
|
|
5
|
+
title_pattern?: string;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
priority?: "low" | "medium" | "high" | "critical";
|
|
8
|
+
tags?: string[];
|
|
9
|
+
variables?: TemplateVariable[];
|
|
10
|
+
project_id?: string | null;
|
|
11
|
+
plan_id?: string | null;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createTemplate(input: CreateTemplateInput, db?: Database): TaskTemplate;
|
|
15
|
+
export declare function getTemplate(id: string, db?: Database): TaskTemplate | null;
|
|
16
|
+
export declare function listTemplates(db?: Database): TaskTemplate[];
|
|
17
|
+
export declare function deleteTemplate(id: string, db?: Database): boolean;
|
|
18
|
+
export declare function updateTemplate(id: string, updates: UpdateTemplateInput, db?: Database): TaskTemplate | null;
|
|
19
|
+
export declare function taskFromTemplate(templateId: string, overrides?: Partial<CreateTaskInput>, db?: Database): CreateTaskInput;
|
|
20
|
+
/** Add tasks to a template, replacing any existing template tasks */
|
|
21
|
+
export declare function addTemplateTasks(templateId: string, tasks: TemplateTaskInput[], db?: Database): TemplateTask[];
|
|
22
|
+
/** Get a template with all its associated tasks, ordered by position */
|
|
23
|
+
export declare function getTemplateWithTasks(id: string, db?: Database): TemplateWithTasks | null;
|
|
24
|
+
/** Get just the template tasks for a given template ID */
|
|
25
|
+
export declare function getTemplateTasks(templateId: string, db?: Database): TemplateTask[];
|
|
26
|
+
/**
|
|
27
|
+
* Evaluate a condition string against a set of variables.
|
|
28
|
+
* Supported syntax:
|
|
29
|
+
* - "{var} == value" -- equals
|
|
30
|
+
* - "{var} != value" -- not equals
|
|
31
|
+
* - "{var}" -- truthy (exists and not empty/false)
|
|
32
|
+
* - "!{var}" -- falsy (doesn't exist, empty, or "false")
|
|
33
|
+
*/
|
|
34
|
+
export declare function evaluateCondition(condition: string, variables: Record<string, string>): boolean;
|
|
35
|
+
export interface TemplateExport {
|
|
36
|
+
name: string;
|
|
37
|
+
title_pattern: string;
|
|
38
|
+
description: string | null;
|
|
39
|
+
priority: string;
|
|
40
|
+
tags: string[];
|
|
41
|
+
variables: TemplateVariable[];
|
|
42
|
+
project_id: string | null;
|
|
43
|
+
plan_id: string | null;
|
|
44
|
+
metadata: Record<string, unknown>;
|
|
45
|
+
tasks: Array<{
|
|
46
|
+
position: number;
|
|
47
|
+
title_pattern: string;
|
|
48
|
+
description: string | null;
|
|
49
|
+
priority: string;
|
|
50
|
+
tags: string[];
|
|
51
|
+
task_type: string | null;
|
|
52
|
+
condition: string | null;
|
|
53
|
+
include_template_id: string | null;
|
|
54
|
+
depends_on_positions: number[];
|
|
55
|
+
metadata: Record<string, unknown>;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
/** Export a template as a full JSON-serializable object */
|
|
59
|
+
export declare function exportTemplate(id: string, db?: Database): TemplateExport;
|
|
60
|
+
/** Import a template from a JSON object, generating new IDs */
|
|
61
|
+
export declare function importTemplate(json: TemplateExport, db?: Database): TaskTemplate;
|
|
62
|
+
/** Get a specific version of a template */
|
|
63
|
+
export declare function getTemplateVersion(id: string, version: number, db?: Database): TemplateVersion | null;
|
|
64
|
+
/** List all versions of a template */
|
|
65
|
+
export declare function listTemplateVersions(id: string, db?: Database): TemplateVersion[];
|
|
66
|
+
/**
|
|
67
|
+
* Validate required variables are provided and fill in defaults.
|
|
68
|
+
* Returns the merged variables map ready for substitution.
|
|
69
|
+
* Throws if required variables are missing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveVariables(templateVars: TemplateVariable[], provided?: Record<string, string>): Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Create all tasks from a multi-task template.
|
|
74
|
+
* Supports conditional tasks, template composition, and variable substitution.
|
|
75
|
+
*/
|
|
76
|
+
export declare function tasksFromTemplate(templateId: string, projectId?: string, variables?: Record<string, string>, taskListId?: string, db?: Database, _visitedTemplateIds?: Set<string>): Task[];
|
|
77
|
+
/**
|
|
78
|
+
* Preview a template -- returns the resolved task list WITHOUT creating anything.
|
|
79
|
+
*/
|
|
80
|
+
export interface TemplatePreviewTask {
|
|
81
|
+
position: number;
|
|
82
|
+
title: string;
|
|
83
|
+
description: string | null;
|
|
84
|
+
priority: string;
|
|
85
|
+
tags: string[];
|
|
86
|
+
task_type: string | null;
|
|
87
|
+
depends_on_positions: number[];
|
|
88
|
+
}
|
|
89
|
+
export interface TemplatePreview {
|
|
90
|
+
template_id: string;
|
|
91
|
+
template_name: string;
|
|
92
|
+
description: string | null;
|
|
93
|
+
variables: TemplateVariable[];
|
|
94
|
+
resolved_variables: Record<string, string>;
|
|
95
|
+
tasks: TemplatePreviewTask[];
|
|
96
|
+
}
|
|
97
|
+
export declare function previewTemplate(templateId: string, variables?: Record<string, string>, db?: Database): TemplatePreview;
|
|
98
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/db/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzL,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AA6BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,YAAY,CAkBtF;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,IAAI,CAM1E;AAED,wBAAgB,aAAa,CAAC,EAAE,CAAC,EA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AiB,CAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,UAAU,CAAC,EAAE,MAAM,EACnB,EAAE,CAAC,EAAE,QAAQ,EACb,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAChC,IAAI,EAAE,CAwFR;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,EAAE,CAAC,EAAE,QAAQ,GACZ,eAAe,CA2CjB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export type TraceType = "tool_call" | "llm_call" | "error" | "handoff" | "custom";
|
|
3
|
+
export interface TaskTrace {
|
|
4
|
+
id: string;
|
|
5
|
+
task_id: string;
|
|
6
|
+
agent_id: string | null;
|
|
7
|
+
trace_type: TraceType;
|
|
8
|
+
name: string | null;
|
|
9
|
+
input_summary: string | null;
|
|
10
|
+
output_summary: string | null;
|
|
11
|
+
duration_ms: number | null;
|
|
12
|
+
tokens: number | null;
|
|
13
|
+
cost_usd: number | null;
|
|
14
|
+
created_at: string;
|
|
15
|
+
}
|
|
16
|
+
export interface LogTraceInput {
|
|
17
|
+
task_id: string;
|
|
18
|
+
agent_id?: string;
|
|
19
|
+
trace_type: TraceType;
|
|
20
|
+
name?: string;
|
|
21
|
+
input_summary?: string;
|
|
22
|
+
output_summary?: string;
|
|
23
|
+
duration_ms?: number;
|
|
24
|
+
tokens?: number;
|
|
25
|
+
cost_usd?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function logTrace(input: LogTraceInput, db?: Database): TaskTrace;
|
|
28
|
+
export declare function getTaskTraces(taskId: string, db?: Database): TaskTrace[];
|
|
29
|
+
export declare function getTraceStats(taskId: string, db?: Database): {
|
|
30
|
+
total: number;
|
|
31
|
+
tool_calls: number;
|
|
32
|
+
llm_calls: number;
|
|
33
|
+
errors: number;
|
|
34
|
+
total_tokens: number;
|
|
35
|
+
total_cost_usd: number;
|
|
36
|
+
total_duration_ms: number;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=traces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../src/db/traces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,SAAS,CAcvE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,SAAS,EAAE,CAGxE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAa9M"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { Webhook, CreateWebhookInput } from "../types/index.js";
|
|
3
|
+
export interface WebhookDelivery {
|
|
4
|
+
id: string;
|
|
5
|
+
webhook_id: string;
|
|
6
|
+
event: string;
|
|
7
|
+
payload: string;
|
|
8
|
+
status_code: number | null;
|
|
9
|
+
response: string | null;
|
|
10
|
+
attempt: number;
|
|
11
|
+
created_at: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createWebhook(input: CreateWebhookInput, db?: Database): Webhook;
|
|
14
|
+
export declare function getWebhook(id: string, db?: Database): Webhook | null;
|
|
15
|
+
export declare function listWebhooks(db?: Database): Webhook[];
|
|
16
|
+
export declare function deleteWebhook(id: string, db?: Database): boolean;
|
|
17
|
+
export declare function listDeliveries(webhookId?: string, limit?: number, db?: Database): WebhookDelivery[];
|
|
18
|
+
export declare function dispatchWebhook(event: string, payload: unknown, db?: Database): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/db/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAMrE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAcD,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAkB/E;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAIpE;AAED,wBAAgB,YAAY,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,EAAE,CAGrD;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAGhE;AAED,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,SAAK,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,eAAe,EAAE,CAM/F;AAuED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAanG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export { TodosClient, createClient } from "./sdk.js";
|
|
2
|
+
export type { TodosClientOptions } from "./sdk.js";
|
|
3
|
+
export { getDatabase, closeDatabase, resetDatabase, resolvePartialId, now, uuid } from "./db/database.js";
|
|
4
|
+
export { createTask, getTask, getTaskWithRelations, listTasks, countTasks, updateTask, deleteTask, startTask, completeTask, lockTask, unlockTask, addDependency, removeDependency, getTaskDependencies, getTaskDependents, getBlockingDeps, bulkUpdateTasks, bulkCreateTasks, cloneTask, getTaskStats, getTaskGraph, moveTask, getNextTask, claimNextTask, stealTask, claimOrSteal, logCost, getActiveWork, failTask, getTasksChangedSince, getStaleTasks, getStatus, decomposeTasks, setTaskStatus, setTaskPriority, redistributeStaleTasks, getOverdueTasks, } from "./db/tasks.js";
|
|
5
|
+
export type { TaskGraphNode, TaskGraph, BulkCreateTaskInput, ActiveWorkItem, StatusSummary, DecomposeSubtaskInput } from "./db/tasks.js";
|
|
6
|
+
export { createProject, getProject, getProjectByPath, getProjectWithSources, listProjects, updateProject, deleteProject, ensureProject, nextTaskShortId, slugify, addProjectSource, removeProjectSource, listProjectSources, } from "./db/projects.js";
|
|
7
|
+
export { createPlan, getPlan, listPlans, updatePlan, deletePlan, } from "./db/plans.js";
|
|
8
|
+
export { addComment, getComment, listComments, deleteComment, logProgress, } from "./db/comments.js";
|
|
9
|
+
export { registerAgent, isAgentConflict, releaseAgent, autoReleaseStaleAgents, getAgent, getAgentByName, listAgents, updateAgent, updateAgentActivity, deleteAgent, archiveAgent, unarchiveAgent, getDirectReports, getOrgChart, matchCapabilities, getCapableAgents, } from "./db/agents.js";
|
|
10
|
+
export type { OrgNode } from "./db/agents.js";
|
|
11
|
+
export { createTaskList, getTaskList, getTaskListBySlug, listTaskLists, updateTaskList, deleteTaskList, ensureTaskList, } from "./db/task-lists.js";
|
|
12
|
+
export { createSession, getSession, listSessions, updateSessionActivity, deleteSession, } from "./db/sessions.js";
|
|
13
|
+
export { logTaskChange, getTaskHistory, getRecentActivity, getRecap } from "./db/audit.js";
|
|
14
|
+
export type { RecapSummary } from "./db/audit.js";
|
|
15
|
+
export { gatherTrainingData } from "./lib/gatherer.js";
|
|
16
|
+
export { getActiveModel, setActiveModel, clearActiveModel, DEFAULT_MODEL, } from "./lib/model-config.js";
|
|
17
|
+
export { createWebhook, getWebhook, listWebhooks, deleteWebhook, dispatchWebhook, listDeliveries } from "./db/webhooks.js";
|
|
18
|
+
export type { WebhookDelivery } from "./db/webhooks.js";
|
|
19
|
+
export { createTemplate, getTemplate, listTemplates, deleteTemplate, updateTemplate, taskFromTemplate, addTemplateTasks, getTemplateWithTasks, getTemplateTasks, tasksFromTemplate, previewTemplate, resolveVariables, evaluateCondition, exportTemplate, importTemplate, getTemplateVersion, listTemplateVersions } from "./db/templates.js";
|
|
20
|
+
export type { TemplatePreview, TemplatePreviewTask, UpdateTemplateInput, TemplateExport } from "./db/templates.js";
|
|
21
|
+
export { initBuiltinTemplates, BUILTIN_TEMPLATES } from "./db/builtin-templates.js";
|
|
22
|
+
export type { BuiltinTemplate } from "./db/builtin-templates.js";
|
|
23
|
+
export { getChecklist, addChecklistItem, checkChecklistItem, updateChecklistItemText, removeChecklistItem, clearChecklist, getChecklistStats, } from "./db/checklists.js";
|
|
24
|
+
export { createHandoff, listHandoffs, getLatestHandoff } from "./db/handoffs.js";
|
|
25
|
+
export type { Handoff, CreateHandoffInput } from "./db/handoffs.js";
|
|
26
|
+
export { addTaskFile, getTaskFile, listTaskFiles, findTasksByFile, updateTaskFileStatus, removeTaskFile, bulkAddTaskFiles } from "./db/task-files.js";
|
|
27
|
+
export type { TaskFile, AddTaskFileInput } from "./db/task-files.js";
|
|
28
|
+
export { acquireLock, releaseLock, checkLock, cleanExpiredLocks } from "./db/locks.js";
|
|
29
|
+
export type { ResourceLock } from "./db/locks.js";
|
|
30
|
+
export { createOrg, getOrg, getOrgByName, listOrgs, updateOrg, deleteOrg } from "./db/orgs.js";
|
|
31
|
+
export { addTaskRelationship, getTaskRelationship, removeTaskRelationship, removeTaskRelationshipByPair, getTaskRelationships, findRelatedTaskIds, autoDetectFileRelationships, } from "./db/task-relationships.js";
|
|
32
|
+
export { RELATIONSHIP_TYPES } from "./db/task-relationships.js";
|
|
33
|
+
export type { TaskRelationship, AddTaskRelationshipInput, RelationshipType } from "./db/task-relationships.js";
|
|
34
|
+
export { syncKgEdges, getRelated, findPath, getImpactAnalysis, getCriticalPath, addKgEdge, removeKgEdges } from "./db/kg.js";
|
|
35
|
+
export type { KgEdge } from "./db/kg.js";
|
|
36
|
+
export { patrolTasks, getReviewQueue } from "./db/patrol.js";
|
|
37
|
+
export type { PatrolIssue, PatrolResult } from "./db/patrol.js";
|
|
38
|
+
export { getAgentMetrics, getLeaderboard, scoreTask } from "./db/agent-metrics.js";
|
|
39
|
+
export type { AgentMetrics, LeaderboardEntry } from "./db/agent-metrics.js";
|
|
40
|
+
export { searchTasks } from "./lib/search.js";
|
|
41
|
+
export type { SearchOptions } from "./lib/search.js";
|
|
42
|
+
export { defaultSyncAgents, syncWithAgent, syncWithAgents } from "./lib/sync.js";
|
|
43
|
+
export type { SyncResult } from "./lib/sync-types.js";
|
|
44
|
+
export { applyPgMigrations } from "./db/pg-migrate.js";
|
|
45
|
+
export type { PgMigrationResult } from "./db/pg-migrate.js";
|
|
46
|
+
export { extractTodos, extractFromSource, tagToPriority, EXTRACT_TAGS } from "./lib/extract.js";
|
|
47
|
+
export { getBurndown } from "./lib/burndown.js";
|
|
48
|
+
export type { BurndownData } from "./lib/burndown.js";
|
|
49
|
+
export { parseGitHubUrl, fetchGitHubIssue, issueToTask } from "./lib/github.js";
|
|
50
|
+
export type { GitHubIssue } from "./lib/github.js";
|
|
51
|
+
export { logTrace, getTaskTraces, getTraceStats } from "./db/traces.js";
|
|
52
|
+
export type { TaskTrace, LogTraceInput, TraceType } from "./db/traces.js";
|
|
53
|
+
export { saveSnapshot, getLatestSnapshot, listSnapshots } from "./db/snapshots.js";
|
|
54
|
+
export type { ContextSnapshot, SaveSnapshotInput, SnapshotType } from "./db/snapshots.js";
|
|
55
|
+
export { setBudget, getBudget, checkBudget } from "./db/budgets.js";
|
|
56
|
+
export type { AgentBudget, BudgetCheck } from "./db/budgets.js";
|
|
57
|
+
export type { ExtractedComment, ExtractOptions, ExtractResult, ExtractTag } from "./lib/extract.js";
|
|
58
|
+
export { loadConfig, getCompletionGuardConfig } from "./lib/config.js";
|
|
59
|
+
export type { TodosConfig, AgentConfig, CompletionGuardConfig } from "./lib/config.js";
|
|
60
|
+
export { checkCompletionGuard } from "./lib/completion-guard.js";
|
|
61
|
+
export { parseRecurrenceRule, isValidRecurrenceRule, nextOccurrence } from "./lib/recurrence.js";
|
|
62
|
+
export type { ParsedRule } from "./lib/recurrence.js";
|
|
63
|
+
export type { Task, TaskWithRelations, CreateTaskInput, UpdateTaskInput, TaskFilter, TaskStatus, TaskPriority, TaskDependency, TaskComment, CreateCommentInput, Project, CreateProjectInput, ProjectSource, ProjectSourceRow, CreateProjectSourceInput, ChecklistItem, ChecklistItemRow, CreateChecklistItemInput, Plan, CreatePlanInput, UpdatePlanInput, PlanStatus, Session, CreateSessionInput, Agent, AgentRow, RegisterAgentInput, TaskList, TaskListRow, CreateTaskListInput, UpdateTaskListInput, LockResult, TaskRow, SessionRow, TaskHistory, Webhook, CreateWebhookInput, TaskTemplate, CreateTemplateInput, TemplateTask, TemplateTaskInput, TemplateWithTasks, TemplateVariable, TemplateVersion, Org, CreateOrgInput, } from "./types/index.js";
|
|
64
|
+
export { TASK_STATUSES, TASK_PRIORITIES, PLAN_STATUSES, DISPATCH_STATUSES, VersionConflictError, TaskNotFoundError, ProjectNotFoundError, PlanNotFoundError, LockError, DependencyCycleError, AgentNotFoundError, TaskListNotFoundError, CompletionGuardError, DispatchNotFoundError, } from "./types/index.js";
|
|
65
|
+
export type { Dispatch, DispatchStatus, DispatchLog, TmuxTarget, CreateDispatchInput, ListDispatchesFilter, } from "./types/index.js";
|
|
66
|
+
export { createDispatch, getDispatch, listDispatches, cancelDispatch, updateDispatchStatus, createDispatchLog, listDispatchLogs, getDueDispatches, } from "./db/dispatches.js";
|
|
67
|
+
export { executeDispatch, runDueDispatches, dispatchToMultiple } from "./lib/dispatch.js";
|
|
68
|
+
export { formatDispatchMessage, formatSingleTask } from "./lib/dispatch-formatter.js";
|
|
69
|
+
export type { FormatOpts } from "./lib/dispatch-formatter.js";
|
|
70
|
+
export { parseTmuxTarget, formatTmuxTarget, validateTmuxTarget, sendToTmux, calculateDelay, DELAY_MIN, DELAY_MAX } from "./lib/tmux.js";
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EACL,UAAU,EACV,OAAO,EACP,oBAAoB,EACpB,SAAS,EACT,UA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U,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACtF,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,84 +15,7 @@ var __export = (target, all) => {
|
|
|
15
15
|
};
|
|
16
16
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
17
|
|
|
18
|
-
// src/db/
|
|
19
|
-
import { Database } from "bun:sqlite";
|
|
20
|
-
import { existsSync, mkdirSync } from "fs";
|
|
21
|
-
import { dirname, join, resolve } from "path";
|
|
22
|
-
function isInMemoryDb(path) {
|
|
23
|
-
return path === ":memory:" || path.startsWith("file::memory:");
|
|
24
|
-
}
|
|
25
|
-
function findNearestTodosDb(startDir) {
|
|
26
|
-
let dir = resolve(startDir);
|
|
27
|
-
while (true) {
|
|
28
|
-
const candidate = join(dir, ".todos", "todos.db");
|
|
29
|
-
if (existsSync(candidate))
|
|
30
|
-
return candidate;
|
|
31
|
-
const parent = dirname(dir);
|
|
32
|
-
if (parent === dir)
|
|
33
|
-
break;
|
|
34
|
-
dir = parent;
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
function findGitRoot(startDir) {
|
|
39
|
-
let dir = resolve(startDir);
|
|
40
|
-
while (true) {
|
|
41
|
-
if (existsSync(join(dir, ".git")))
|
|
42
|
-
return dir;
|
|
43
|
-
const parent = dirname(dir);
|
|
44
|
-
if (parent === dir)
|
|
45
|
-
break;
|
|
46
|
-
dir = parent;
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
function getDbPath() {
|
|
51
|
-
if (process.env["HASNA_TODOS_DB_PATH"]) {
|
|
52
|
-
return process.env["HASNA_TODOS_DB_PATH"];
|
|
53
|
-
}
|
|
54
|
-
if (process.env["TODOS_DB_PATH"]) {
|
|
55
|
-
return process.env["TODOS_DB_PATH"];
|
|
56
|
-
}
|
|
57
|
-
const cwd = process.cwd();
|
|
58
|
-
const nearest = findNearestTodosDb(cwd);
|
|
59
|
-
if (nearest)
|
|
60
|
-
return nearest;
|
|
61
|
-
if (process.env["TODOS_DB_SCOPE"] === "project") {
|
|
62
|
-
const gitRoot = findGitRoot(cwd);
|
|
63
|
-
if (gitRoot) {
|
|
64
|
-
return join(gitRoot, ".todos", "todos.db");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
68
|
-
const newPath = join(home, ".hasna", "todos", "todos.db");
|
|
69
|
-
const legacyPath = join(home, ".todos", "todos.db");
|
|
70
|
-
if (!existsSync(newPath) && existsSync(legacyPath)) {
|
|
71
|
-
return legacyPath;
|
|
72
|
-
}
|
|
73
|
-
return newPath;
|
|
74
|
-
}
|
|
75
|
-
function ensureDir(filePath) {
|
|
76
|
-
if (isInMemoryDb(filePath))
|
|
77
|
-
return;
|
|
78
|
-
const dir = dirname(resolve(filePath));
|
|
79
|
-
if (!existsSync(dir)) {
|
|
80
|
-
mkdirSync(dir, { recursive: true });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function getDatabase(dbPath) {
|
|
84
|
-
if (_db)
|
|
85
|
-
return _db;
|
|
86
|
-
const path = dbPath || getDbPath();
|
|
87
|
-
ensureDir(path);
|
|
88
|
-
_db = new Database(path);
|
|
89
|
-
_db.run("PRAGMA journal_mode = WAL");
|
|
90
|
-
_db.run("PRAGMA busy_timeout = 5000");
|
|
91
|
-
_db.run("PRAGMA foreign_keys = ON");
|
|
92
|
-
runMigrations(_db);
|
|
93
|
-
backfillTaskTags(_db);
|
|
94
|
-
return _db;
|
|
95
|
-
}
|
|
18
|
+
// src/db/schema.ts
|
|
96
19
|
function runMigrations(db) {
|
|
97
20
|
try {
|
|
98
21
|
const result = db.query("SELECT MAX(id) as max_id FROM _migrations").get();
|
|
@@ -411,68 +334,8 @@ function backfillTaskTags(db) {
|
|
|
411
334
|
}
|
|
412
335
|
} catch {}
|
|
413
336
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
_db.close();
|
|
417
|
-
_db = null;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function resetDatabase() {
|
|
421
|
-
_db = null;
|
|
422
|
-
}
|
|
423
|
-
function now() {
|
|
424
|
-
return new Date().toISOString();
|
|
425
|
-
}
|
|
426
|
-
function uuid() {
|
|
427
|
-
return crypto.randomUUID();
|
|
428
|
-
}
|
|
429
|
-
function isLockExpired(lockedAt) {
|
|
430
|
-
if (!lockedAt)
|
|
431
|
-
return true;
|
|
432
|
-
const lockTime = new Date(lockedAt).getTime();
|
|
433
|
-
const expiryMs = LOCK_EXPIRY_MINUTES * 60 * 1000;
|
|
434
|
-
return Date.now() - lockTime > expiryMs;
|
|
435
|
-
}
|
|
436
|
-
function lockExpiryCutoff(nowMs = Date.now()) {
|
|
437
|
-
const expiryMs = LOCK_EXPIRY_MINUTES * 60 * 1000;
|
|
438
|
-
return new Date(nowMs - expiryMs).toISOString();
|
|
439
|
-
}
|
|
440
|
-
function clearExpiredLocks(db) {
|
|
441
|
-
const cutoff = lockExpiryCutoff();
|
|
442
|
-
db.run("UPDATE tasks SET locked_by = NULL, locked_at = NULL WHERE locked_at IS NOT NULL AND locked_at < ?", [cutoff]);
|
|
443
|
-
}
|
|
444
|
-
function resolvePartialId(db, table, partialId) {
|
|
445
|
-
if (partialId.length >= 36) {
|
|
446
|
-
const row = db.query(`SELECT id FROM ${table} WHERE id = ?`).get(partialId);
|
|
447
|
-
return row?.id ?? null;
|
|
448
|
-
}
|
|
449
|
-
const rows = db.query(`SELECT id FROM ${table} WHERE id LIKE ?`).all(`${partialId}%`);
|
|
450
|
-
if (rows.length === 1) {
|
|
451
|
-
return rows[0].id;
|
|
452
|
-
}
|
|
453
|
-
if (rows.length > 1) {
|
|
454
|
-
return null;
|
|
455
|
-
}
|
|
456
|
-
if (table === "tasks") {
|
|
457
|
-
const shortIdRows = db.query("SELECT id FROM tasks WHERE short_id = ?").all(partialId);
|
|
458
|
-
if (shortIdRows.length === 1) {
|
|
459
|
-
return shortIdRows[0].id;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
if (table === "task_lists") {
|
|
463
|
-
const slugRow = db.query("SELECT id FROM task_lists WHERE slug = ?").get(partialId);
|
|
464
|
-
if (slugRow)
|
|
465
|
-
return slugRow.id;
|
|
466
|
-
}
|
|
467
|
-
if (table === "projects") {
|
|
468
|
-
const nameRow = db.query("SELECT id FROM projects WHERE lower(name) = ?").get(partialId.toLowerCase());
|
|
469
|
-
if (nameRow)
|
|
470
|
-
return nameRow.id;
|
|
471
|
-
}
|
|
472
|
-
return null;
|
|
473
|
-
}
|
|
474
|
-
var LOCK_EXPIRY_MINUTES = 30, MIGRATIONS, _db = null;
|
|
475
|
-
var init_database = __esm(() => {
|
|
337
|
+
var MIGRATIONS;
|
|
338
|
+
var init_schema = __esm(() => {
|
|
476
339
|
MIGRATIONS = [
|
|
477
340
|
`
|
|
478
341
|
CREATE TABLE IF NOT EXISTS projects (
|
|
@@ -1096,6 +959,149 @@ var init_database = __esm(() => {
|
|
|
1096
959
|
];
|
|
1097
960
|
});
|
|
1098
961
|
|
|
962
|
+
// src/db/database.ts
|
|
963
|
+
import { Database } from "bun:sqlite";
|
|
964
|
+
import { existsSync, mkdirSync } from "fs";
|
|
965
|
+
import { dirname, join, resolve } from "path";
|
|
966
|
+
function isInMemoryDb(path) {
|
|
967
|
+
return path === ":memory:" || path.startsWith("file::memory:");
|
|
968
|
+
}
|
|
969
|
+
function findNearestTodosDb(startDir) {
|
|
970
|
+
let dir = resolve(startDir);
|
|
971
|
+
while (true) {
|
|
972
|
+
const candidate = join(dir, ".todos", "todos.db");
|
|
973
|
+
if (existsSync(candidate))
|
|
974
|
+
return candidate;
|
|
975
|
+
const parent = dirname(dir);
|
|
976
|
+
if (parent === dir)
|
|
977
|
+
break;
|
|
978
|
+
dir = parent;
|
|
979
|
+
}
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
function findGitRoot(startDir) {
|
|
983
|
+
let dir = resolve(startDir);
|
|
984
|
+
while (true) {
|
|
985
|
+
if (existsSync(join(dir, ".git")))
|
|
986
|
+
return dir;
|
|
987
|
+
const parent = dirname(dir);
|
|
988
|
+
if (parent === dir)
|
|
989
|
+
break;
|
|
990
|
+
dir = parent;
|
|
991
|
+
}
|
|
992
|
+
return null;
|
|
993
|
+
}
|
|
994
|
+
function getDbPath() {
|
|
995
|
+
if (process.env["HASNA_TODOS_DB_PATH"]) {
|
|
996
|
+
return process.env["HASNA_TODOS_DB_PATH"];
|
|
997
|
+
}
|
|
998
|
+
if (process.env["TODOS_DB_PATH"]) {
|
|
999
|
+
return process.env["TODOS_DB_PATH"];
|
|
1000
|
+
}
|
|
1001
|
+
const cwd = process.cwd();
|
|
1002
|
+
const nearest = findNearestTodosDb(cwd);
|
|
1003
|
+
if (nearest)
|
|
1004
|
+
return nearest;
|
|
1005
|
+
if (process.env["TODOS_DB_SCOPE"] === "project") {
|
|
1006
|
+
const gitRoot = findGitRoot(cwd);
|
|
1007
|
+
if (gitRoot) {
|
|
1008
|
+
return join(gitRoot, ".todos", "todos.db");
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
1012
|
+
const newPath = join(home, ".hasna", "todos", "todos.db");
|
|
1013
|
+
const legacyPath = join(home, ".todos", "todos.db");
|
|
1014
|
+
if (!existsSync(newPath) && existsSync(legacyPath)) {
|
|
1015
|
+
return legacyPath;
|
|
1016
|
+
}
|
|
1017
|
+
return newPath;
|
|
1018
|
+
}
|
|
1019
|
+
function ensureDir(filePath) {
|
|
1020
|
+
if (isInMemoryDb(filePath))
|
|
1021
|
+
return;
|
|
1022
|
+
const dir = dirname(resolve(filePath));
|
|
1023
|
+
if (!existsSync(dir)) {
|
|
1024
|
+
mkdirSync(dir, { recursive: true });
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
function getDatabase(dbPath) {
|
|
1028
|
+
if (_db)
|
|
1029
|
+
return _db;
|
|
1030
|
+
const path = dbPath || getDbPath();
|
|
1031
|
+
ensureDir(path);
|
|
1032
|
+
_db = new Database(path);
|
|
1033
|
+
_db.run("PRAGMA journal_mode = WAL");
|
|
1034
|
+
_db.run("PRAGMA busy_timeout = 5000");
|
|
1035
|
+
_db.run("PRAGMA foreign_keys = ON");
|
|
1036
|
+
runMigrations(_db);
|
|
1037
|
+
backfillTaskTags(_db);
|
|
1038
|
+
return _db;
|
|
1039
|
+
}
|
|
1040
|
+
function closeDatabase() {
|
|
1041
|
+
if (_db) {
|
|
1042
|
+
_db.close();
|
|
1043
|
+
_db = null;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function resetDatabase() {
|
|
1047
|
+
_db = null;
|
|
1048
|
+
}
|
|
1049
|
+
function now() {
|
|
1050
|
+
return new Date().toISOString();
|
|
1051
|
+
}
|
|
1052
|
+
function uuid() {
|
|
1053
|
+
return crypto.randomUUID();
|
|
1054
|
+
}
|
|
1055
|
+
function isLockExpired(lockedAt) {
|
|
1056
|
+
if (!lockedAt)
|
|
1057
|
+
return true;
|
|
1058
|
+
const lockTime = new Date(lockedAt).getTime();
|
|
1059
|
+
const expiryMs = LOCK_EXPIRY_MINUTES * 60 * 1000;
|
|
1060
|
+
return Date.now() - lockTime > expiryMs;
|
|
1061
|
+
}
|
|
1062
|
+
function lockExpiryCutoff(nowMs = Date.now()) {
|
|
1063
|
+
const expiryMs = LOCK_EXPIRY_MINUTES * 60 * 1000;
|
|
1064
|
+
return new Date(nowMs - expiryMs).toISOString();
|
|
1065
|
+
}
|
|
1066
|
+
function clearExpiredLocks(db) {
|
|
1067
|
+
const cutoff = lockExpiryCutoff();
|
|
1068
|
+
db.run("UPDATE tasks SET locked_by = NULL, locked_at = NULL WHERE locked_at IS NOT NULL AND locked_at < ?", [cutoff]);
|
|
1069
|
+
}
|
|
1070
|
+
function resolvePartialId(db, table, partialId) {
|
|
1071
|
+
if (partialId.length >= 36) {
|
|
1072
|
+
const row = db.query(`SELECT id FROM ${table} WHERE id = ?`).get(partialId);
|
|
1073
|
+
return row?.id ?? null;
|
|
1074
|
+
}
|
|
1075
|
+
const rows = db.query(`SELECT id FROM ${table} WHERE id LIKE ?`).all(`${partialId}%`);
|
|
1076
|
+
if (rows.length === 1) {
|
|
1077
|
+
return rows[0].id;
|
|
1078
|
+
}
|
|
1079
|
+
if (rows.length > 1) {
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
if (table === "tasks") {
|
|
1083
|
+
const shortIdRows = db.query("SELECT id FROM tasks WHERE short_id = ?").all(partialId);
|
|
1084
|
+
if (shortIdRows.length === 1) {
|
|
1085
|
+
return shortIdRows[0].id;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
if (table === "task_lists") {
|
|
1089
|
+
const slugRow = db.query("SELECT id FROM task_lists WHERE slug = ?").get(partialId);
|
|
1090
|
+
if (slugRow)
|
|
1091
|
+
return slugRow.id;
|
|
1092
|
+
}
|
|
1093
|
+
if (table === "projects") {
|
|
1094
|
+
const nameRow = db.query("SELECT id FROM projects WHERE lower(name) = ?").get(partialId.toLowerCase());
|
|
1095
|
+
if (nameRow)
|
|
1096
|
+
return nameRow.id;
|
|
1097
|
+
}
|
|
1098
|
+
return null;
|
|
1099
|
+
}
|
|
1100
|
+
var LOCK_EXPIRY_MINUTES = 30, _db = null;
|
|
1101
|
+
var init_database = __esm(() => {
|
|
1102
|
+
init_schema();
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1099
1105
|
// src/types/index.ts
|
|
1100
1106
|
var TASK_STATUSES, TASK_PRIORITIES, PLAN_STATUSES, VersionConflictError, TaskNotFoundError, ProjectNotFoundError, PlanNotFoundError, LockError, AgentNotFoundError, TaskListNotFoundError, DependencyCycleError, CompletionGuardError, DISPATCH_STATUSES, DispatchNotFoundError;
|
|
1101
1107
|
var init_types = __esm(() => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SyncPrefer, SyncResult } from "./sync-types.js";
|
|
2
|
+
export declare function pushToAgentTaskList(agent: string, taskListId: string, projectId?: string, options?: {
|
|
3
|
+
prefer?: SyncPrefer;
|
|
4
|
+
}): SyncResult;
|
|
5
|
+
export declare function pullFromAgentTaskList(agent: string, taskListId: string, projectId?: string, options?: {
|
|
6
|
+
prefer?: SyncPrefer;
|
|
7
|
+
}): SyncResult;
|
|
8
|
+
export declare function syncAgentTaskList(agent: string, taskListId: string, projectId?: string, options?: {
|
|
9
|
+
prefer?: SyncPrefer;
|
|
10
|
+
}): SyncResult;
|
|
11
|
+
//# sourceMappingURL=agent-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tasks.d.ts","sourceRoot":"","sources":["../../src/lib/agent-tasks.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA+D9D,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAuFZ;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAoFZ;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAO,GACpC,UAAU,CAQZ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-assign tasks to agents using Cerebras LLM for intelligent routing.
|
|
3
|
+
* Falls back to capability-based matching when the API key is unavailable or the call fails.
|
|
4
|
+
*/
|
|
5
|
+
import type { Database } from "bun:sqlite";
|
|
6
|
+
import type { Task } from "../types/index.js";
|
|
7
|
+
export interface AutoAssignResult {
|
|
8
|
+
task_id: string;
|
|
9
|
+
assigned_to: string | null;
|
|
10
|
+
agent_name: string | null;
|
|
11
|
+
method: "cerebras" | "capability_match" | "no_agents";
|
|
12
|
+
reason?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Find the best agent to assign a task to (legacy simple version, no I/O).
|
|
16
|
+
* Strategy: least-loaded agent with role "agent" (not admin/observer).
|
|
17
|
+
*/
|
|
18
|
+
export declare function findBestAgent(_task: Task, db?: Database): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Auto-assign a task to the best available agent.
|
|
21
|
+
* Uses Cerebras LLM (llama-3.3-70b) if CEREBRAS_API_KEY is set,
|
|
22
|
+
* otherwise falls back to capability-based matching.
|
|
23
|
+
*/
|
|
24
|
+
export declare function autoAssignTask(taskId: string, db?: Database): Promise<AutoAssignResult>;
|
|
25
|
+
//# sourceMappingURL=auto-assign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-assign.d.ts","sourceRoot":"","sources":["../../src/lib/auto-assign.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,WAAW,CAAC;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAsBvE;AA8DD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8D7F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export interface BurndownData {
|
|
3
|
+
total: number;
|
|
4
|
+
completed: number;
|
|
5
|
+
remaining: number;
|
|
6
|
+
days: {
|
|
7
|
+
date: string;
|
|
8
|
+
completed_cumulative: number;
|
|
9
|
+
ideal: number;
|
|
10
|
+
}[];
|
|
11
|
+
chart: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getBurndown(opts: {
|
|
14
|
+
plan_id?: string;
|
|
15
|
+
project_id?: string;
|
|
16
|
+
task_list_id?: string;
|
|
17
|
+
}, db?: Database): BurndownData;
|
|
18
|
+
//# sourceMappingURL=burndown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burndown.d.ts","sourceRoot":"","sources":["../../src/lib/burndown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,oBAAoB,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,YAAY,CA8C/H"}
|