@danypops/papyrus 0.42.0 → 0.42.2
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 +2 -2
- package/src/adapters/sqlite-artifact-scope-store.ts +18 -9
- package/src/adapters/sqlite-artifact-store.ts +7 -5
- package/src/adapters/sqlite-discussion-round-store.ts +26 -17
- package/src/adapters/sqlite-gate-runner.ts +1 -1
- package/src/adapters/sqlite-graph-projection-store.ts +14 -10
- package/src/adapters/sqlite-log-store.ts +36 -17
- package/src/adapters/sqlite-note-event-store.ts +20 -16
- package/src/adapters/sqlite-session-identity-store.ts +13 -7
- package/src/adapters/sqlite-task-event-store.ts +29 -21
- package/src/adapters/sqlite-task-focus-store.ts +36 -10
- package/src/adapters/sqlite-task-lease-store.ts +12 -6
- package/src/adapters/sqlite-task-scope-store.ts +25 -14
- package/src/artifact-relationship-view.ts +3 -3
- package/src/artifact-subtree.ts +4 -2
- package/src/authority-registry.ts +2 -1
- package/src/cli.ts +785 -179
- package/src/client.ts +46 -20
- package/src/constants.ts +15 -4
- package/src/daemon-state.ts +4 -12
- package/src/daemon.ts +31 -9
- package/src/db.ts +119 -98
- package/src/discussion-service.ts +109 -44
- package/src/domain/artifact-event.ts +17 -4
- package/src/domain/artifact.ts +3 -1
- package/src/domain/blueprint-definition.ts +26 -31
- package/src/domain/checklist.ts +20 -17
- package/src/domain/discussion.ts +37 -18
- package/src/domain/gate.ts +7 -7
- package/src/domain/log-entry.ts +1 -1
- package/src/domain/note-event.ts +20 -7
- package/src/domain/task-event.ts +17 -7
- package/src/domain-services.ts +241 -110
- package/src/graph-projection-service.ts +34 -8
- package/src/id-migration.ts +17 -4
- package/src/index.ts +16 -11
- package/src/log-service.ts +6 -5
- package/src/log.ts +19 -0
- package/src/modules/discuss.ts +63 -28
- package/src/modules/docs.ts +74 -17
- package/src/modules/graph-projection.ts +20 -9
- package/src/modules/logs.ts +33 -21
- package/src/modules/notes.ts +66 -28
- package/src/modules/playbooks.ts +88 -29
- package/src/modules/rules.ts +57 -15
- package/src/modules/session-identity.ts +6 -2
- package/src/modules/tasks.ts +142 -67
- package/src/note-service.ts +11 -7
- package/src/ops.ts +131 -68
- package/src/playbook-definition.ts +56 -17
- package/src/playbook-execution.ts +13 -3
- package/src/ports/note-event-store.ts +6 -4
- package/src/ports/task-event-store.ts +9 -6
- package/src/ports/task-focus-store.ts +17 -4
- package/src/ports/task-lease-store.ts +9 -4
- package/src/ports/task-scope-store.ts +3 -1
- package/src/service.ts +143 -89
- package/src/session-identity-service.ts +10 -2
- package/src/task-context.ts +28 -16
- package/src/task-execution.ts +4 -12
- package/src/task-graph-view.ts +12 -12
- package/src/task-relationship-view.ts +1 -3
- package/src/task-service.ts +167 -72
- package/src/vehicle/artifact-trash-vehicle.ts +25 -13
- package/src/vehicle/artifact-vehicle-shared.ts +28 -7
- package/src/vehicle/docs-vehicle.ts +48 -16
- package/src/vehicle/notes-vehicle.ts +24 -6
- package/src/vehicle/papyrus-vehicle.ts +14 -3
- package/src/vehicle/playbooks-vehicle.ts +87 -18
- package/src/vehicle/rules-vehicle.ts +58 -21
- package/src/vehicle/tasks-vehicle.ts +366 -54
- package/src/version.ts +1 -1
- package/src/workflow-execution.ts +71 -52
|
@@ -8,36 +8,45 @@ export class SQLiteTaskScopeStore implements TaskScopeStore {
|
|
|
8
8
|
|
|
9
9
|
assign(taskId: string, projectRoot: string | undefined, source: TaskScopeSource): TaskProjectScope {
|
|
10
10
|
inTransaction(this.db, () => {
|
|
11
|
-
this.db
|
|
11
|
+
this.db
|
|
12
|
+
.prepare(`
|
|
12
13
|
INSERT INTO task_scopes (task_id, project_root, source, assigned_at)
|
|
13
14
|
VALUES (?, ?, ?, ?)
|
|
14
15
|
ON CONFLICT(task_id) DO UPDATE SET
|
|
15
16
|
project_root = excluded.project_root,
|
|
16
17
|
source = excluded.source,
|
|
17
18
|
assigned_at = excluded.assigned_at
|
|
18
|
-
`)
|
|
19
|
+
`)
|
|
20
|
+
.run(taskId, projectRoot ?? null, source, new Date().toISOString());
|
|
19
21
|
});
|
|
20
22
|
return { taskId, ...(projectRoot === undefined ? {} : { projectRoot }), source };
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
get(taskId: string): TaskProjectScope | undefined {
|
|
24
|
-
const row = this.db.prepare("SELECT task_id, project_root, source FROM task_scopes WHERE task_id = ?").get(taskId) as
|
|
25
|
-
|
|
26
|
-
| null;
|
|
27
|
-
|
|
26
|
+
const row = this.db.prepare("SELECT task_id, project_root, source FROM task_scopes WHERE task_id = ?").get(taskId) as {
|
|
27
|
+
task_id: string;
|
|
28
|
+
project_root: string | null;
|
|
29
|
+
source: TaskScopeSource;
|
|
30
|
+
} | null;
|
|
31
|
+
return row
|
|
32
|
+
? { taskId: row.task_id, ...(row.project_root === null ? {} : { projectRoot: row.project_root }), source: row.source }
|
|
33
|
+
: undefined;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
taskIds(projectRoot: string | undefined, limit: number): string[] {
|
|
31
|
-
const rows =
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
const rows =
|
|
38
|
+
projectRoot === undefined
|
|
39
|
+
? this.db.prepare("SELECT task_id FROM task_scopes WHERE project_root IS NULL ORDER BY task_id LIMIT ?").all(limit)
|
|
40
|
+
: this.db.prepare("SELECT task_id FROM task_scopes WHERE project_root = ? ORDER BY task_id LIMIT ?").all(projectRoot, limit);
|
|
34
41
|
return (rows as Array<{ task_id: string }>).map((row) => row.task_id);
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
view(projectRoot: string): TaskViewPreference {
|
|
38
|
-
const row = this.db.prepare("SELECT project_root, mode, root_task_id FROM task_views WHERE project_root = ?").get(projectRoot) as
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
const row = this.db.prepare("SELECT project_root, mode, root_task_id FROM task_views WHERE project_root = ?").get(projectRoot) as {
|
|
46
|
+
project_root: string;
|
|
47
|
+
mode: TaskViewMode;
|
|
48
|
+
root_task_id: string | null;
|
|
49
|
+
} | null;
|
|
41
50
|
return row
|
|
42
51
|
? { projectRoot: row.project_root, mode: row.mode, ...(row.root_task_id === null ? {} : { rootTaskId: row.root_task_id }) }
|
|
43
52
|
: { projectRoot, mode: "project" };
|
|
@@ -45,14 +54,16 @@ export class SQLiteTaskScopeStore implements TaskScopeStore {
|
|
|
45
54
|
|
|
46
55
|
setView(projectRoot: string, mode: TaskViewMode, rootTaskId?: string): TaskViewPreference {
|
|
47
56
|
inTransaction(this.db, () => {
|
|
48
|
-
this.db
|
|
57
|
+
this.db
|
|
58
|
+
.prepare(`
|
|
49
59
|
INSERT INTO task_views (project_root, mode, root_task_id, updated_at)
|
|
50
60
|
VALUES (?, ?, ?, ?)
|
|
51
61
|
ON CONFLICT(project_root) DO UPDATE SET
|
|
52
62
|
mode = excluded.mode,
|
|
53
63
|
root_task_id = excluded.root_task_id,
|
|
54
64
|
updated_at = excluded.updated_at
|
|
55
|
-
`)
|
|
65
|
+
`)
|
|
66
|
+
.run(projectRoot, mode, rootTaskId ?? null, new Date().toISOString());
|
|
56
67
|
});
|
|
57
68
|
return { projectRoot, mode, ...(rootTaskId === undefined ? {} : { rootTaskId }) };
|
|
58
69
|
}
|
|
@@ -16,8 +16,8 @@ export function projectArtifactRelationships(artifact: Artifact): DisplayGraph {
|
|
|
16
16
|
nodeIds.add(edge.from);
|
|
17
17
|
nodeIds.add(edge.to);
|
|
18
18
|
}
|
|
19
|
-
const nodes: DisplayGraphNode[] = [...nodeIds].map((id) =>
|
|
20
|
-
? { id, label: artifact.title, status: artifact.status }
|
|
21
|
-
|
|
19
|
+
const nodes: DisplayGraphNode[] = [...nodeIds].map((id) =>
|
|
20
|
+
id === artifact.id ? { id, label: artifact.title, status: artifact.status } : { id, label: fallbackLabel(id) },
|
|
21
|
+
);
|
|
22
22
|
return { direction: "LR", nodes, edges };
|
|
23
23
|
}
|
package/src/artifact-subtree.ts
CHANGED
|
@@ -38,8 +38,10 @@ export function removeArtifactSubtree(
|
|
|
38
38
|
const current = queue.shift()!;
|
|
39
39
|
if (visited.has(current)) continue;
|
|
40
40
|
visited.add(current);
|
|
41
|
-
if (visited.size > ARTIFACT_REMOVE_SUBTREE_MAX_NODES)
|
|
42
|
-
|
|
41
|
+
if (visited.size > ARTIFACT_REMOVE_SUBTREE_MAX_NODES)
|
|
42
|
+
throw new Error(`remove_subtree exceeds ${ARTIFACT_REMOVE_SUBTREE_MAX_NODES} artifacts`);
|
|
43
|
+
const childIds = store
|
|
44
|
+
.relationships({ artifactIds: [current] })
|
|
43
45
|
.filter((edge) => edge.from === current && edge.relation === "contains")
|
|
44
46
|
.map((edge) => edge.to);
|
|
45
47
|
queue.push(...childIds);
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* claims are constructed at the composition root (src/service.ts) where that knowledge
|
|
19
19
|
* already lives, matching "the core has generic registries" from the decision doc.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
import type { Artifact, ArtifactLink } from "./domain/artifact.ts";
|
|
23
|
+
import type { ArtifactEventContext } from "./domain/artifact-event.ts";
|
|
23
24
|
import type { ArtifactStore } from "./ports/artifact-store.ts";
|
|
24
25
|
|
|
25
26
|
export type ArtifactAction = "create" | "link" | "status" | "update";
|