@danypops/papyrus 0.29.7 → 0.30.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.
@@ -238,7 +238,7 @@ const checklistCriterionSchema = Type.Object({
238
238
  proof: Type.Array(proofReferenceSchema, { minItems: 1 }),
239
239
  });
240
240
 
241
- export function registerDomainTools(pi: ExtensionAPI): void {
241
+ export function registerTasksTool(pi: ExtensionAPI): void {
242
242
  pi.registerTool({
243
243
  name: "tasks",
244
244
  label: "Tasks",
@@ -445,7 +445,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
445
445
  }
446
446
  },
447
447
  });
448
+ }
448
449
 
450
+ export function registerNotesTool(pi: ExtensionAPI): void {
449
451
  pi.registerTool({
450
452
  name: "notes",
451
453
  label: "Notes",
@@ -496,7 +498,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
496
498
  }
497
499
  },
498
500
  });
501
+ }
499
502
 
503
+ export function registerDocsTool(pi: ExtensionAPI): void {
500
504
  pi.registerTool({
501
505
  name: "docs",
502
506
  label: "Documents",
@@ -556,7 +560,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
556
560
  }
557
561
  },
558
562
  });
563
+ }
559
564
 
565
+ export function registerRulesTool(pi: ExtensionAPI): void {
560
566
  pi.registerTool({
561
567
  name: "rules",
562
568
  label: "Rules",
@@ -604,7 +610,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
604
610
  }
605
611
  },
606
612
  });
613
+ }
607
614
 
615
+ export function registerPlaybooksTool(pi: ExtensionAPI): void {
608
616
  pi.registerTool({
609
617
  name: "playbooks",
610
618
  label: "Playbooks",
@@ -652,7 +660,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
652
660
  }
653
661
  },
654
662
  });
663
+ }
655
664
 
665
+ export function registerSkillsTool(pi: ExtensionAPI): void {
656
666
  pi.registerTool({
657
667
  name: "skills",
658
668
  label: "Skills",
@@ -729,7 +739,9 @@ export function registerDomainTools(pi: ExtensionAPI): void {
729
739
  }
730
740
  },
731
741
  });
742
+ }
732
743
 
744
+ export function registerDiscussTool(pi: ExtensionAPI): void {
733
745
  pi.registerTool({
734
746
  name: "discuss",
735
747
  label: "Discuss",
@@ -827,3 +839,14 @@ export function registerDomainTools(pi: ExtensionAPI): void {
827
839
  },
828
840
  });
829
841
  }
842
+
843
+ /** Thin orchestrator: each domain's tool is independently navigable/testable via its own registerXTool function. */
844
+ export function registerDomainTools(pi: ExtensionAPI): void {
845
+ registerTasksTool(pi);
846
+ registerNotesTool(pi);
847
+ registerDocsTool(pi);
848
+ registerRulesTool(pi);
849
+ registerPlaybooksTool(pi);
850
+ registerSkillsTool(pi);
851
+ registerDiscussTool(pi);
852
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/papyrus",
3
- "version": "0.29.7",
3
+ "version": "0.30.0",
4
4
  "description": "Daemon-backed graph artifacts, evidence-bearing tasks, rules, skills, and native TUI workflows for Pi",
5
5
  "type": "module",
6
6
  "keywords": ["pi-package"],
@@ -1,6 +1,8 @@
1
1
  import type { Db } from "../db.ts";
2
2
  import { inTransaction } from "../db.ts";
3
3
  import type { AtomicArtifactStore } from "../ports/atomic-artifact-store.ts";
4
+ import type { ArtifactEventReader } from "../ports/artifact-event-reader.ts";
5
+ import type { ArtifactTrashStore } from "../ports/artifact-trash-store.ts";
4
6
  import type {
5
7
  Artifact,
6
8
  ArtifactEdge,
@@ -30,7 +32,7 @@ import {
30
32
  updateStatus,
31
33
  } from "../ops.ts";
32
34
 
33
- export class SQLiteArtifactStore implements AtomicArtifactStore {
35
+ export class SQLiteArtifactStore implements AtomicArtifactStore, ArtifactTrashStore, ArtifactEventReader {
34
36
  constructor(private readonly db: Db) {}
35
37
 
36
38
  atomic<T>(operation: () => T): T {
@@ -0,0 +1,8 @@
1
+ import type { ArtifactEventPage, ArtifactEventQuery } from "../domain/artifact-event.ts";
2
+
3
+ /** Read access to the generic mutation event log shared by every kind -- split out of
4
+ * ArtifactStore since only service.ts's graph.history operation reads it. */
5
+ export interface ArtifactEventReader {
6
+ /** Bounded query over the generic mutation event log shared by every kind. */
7
+ events(query: ArtifactEventQuery): ArtifactEventPage;
8
+ }
@@ -8,9 +8,11 @@ import type {
8
8
  RelationshipQuery,
9
9
  UpdateArtifactInput,
10
10
  } from "../domain/artifact.ts";
11
- import type { ArtifactEventContext, ArtifactEventPage, ArtifactEventQuery } from "../domain/artifact-event.ts";
12
- import type { ArtifactTrashRecord } from "../domain/artifact-trash.ts";
11
+ import type { ArtifactEventContext } from "../domain/artifact-event.ts";
13
12
 
13
+ /** Core CRUD/graph operations every domain-service module needs. Trash lifecycle and event-log
14
+ * reading are separate ports (ArtifactTrashStore, ArtifactEventReader) -- only the composition
15
+ * root (daemon.ts, service.ts) needs those, not every consumer of this store. */
14
16
  export interface ArtifactStore {
15
17
  create(input: CreateArtifactInput, context?: ArtifactEventContext): Artifact;
16
18
  get(id: string, options?: ArtifactGraphOptions): Artifact | null;
@@ -22,14 +24,4 @@ export interface ArtifactStore {
22
24
  setExtra(id: string, extra: Record<string, unknown>, context?: ArtifactEventContext): Artifact | null;
23
25
  updateContent(id: string, input: UpdateArtifactInput, context?: ArtifactEventContext): Artifact | null;
24
26
  relationships(filter?: RelationshipQuery): ArtifactEdge[];
25
- /** Bounded query over the generic mutation event log shared by every kind. */
26
- events(query: ArtifactEventQuery): ArtifactEventPage;
27
- /** See domain/artifact-trash.ts. Moves an artifact to the trash; throws if it does not exist or is the live Task Focus in any scope. */
28
- trash(id: string, options?: { reason?: string; context?: ArtifactEventContext }): ArtifactTrashRecord;
29
- /** Idempotent: restoring an artifact that is not currently trashed is a real no-op. */
30
- restore(id: string, context?: ArtifactEventContext): { restored: boolean };
31
- trashStatus(id: string): ArtifactTrashRecord | null;
32
- listTrash(): ArtifactTrashRecord[];
33
- /** Real, cascading, irreversible deletion of every artifact past its purge deadline; returns how many were purged. */
34
- purgeDueTrash(): number;
35
27
  }
@@ -0,0 +1,15 @@
1
+ import type { ArtifactEventContext } from "../domain/artifact-event.ts";
2
+ import type { ArtifactTrashRecord } from "../domain/artifact-trash.ts";
3
+
4
+ /** Trash lifecycle for artifacts -- split out of ArtifactStore since only the composition root
5
+ * (daemon.ts, service.ts) needs it; every domain-service module depends on core CRUD/graph only. */
6
+ export interface ArtifactTrashStore {
7
+ /** See domain/artifact-trash.ts. Moves an artifact to the trash; throws if it does not exist or is the live Task Focus in any scope. */
8
+ trash(id: string, options?: { reason?: string; context?: ArtifactEventContext }): ArtifactTrashRecord;
9
+ /** Idempotent: restoring an artifact that is not currently trashed is a real no-op. */
10
+ restore(id: string, context?: ArtifactEventContext): { restored: boolean };
11
+ trashStatus(id: string): ArtifactTrashRecord | null;
12
+ listTrash(): ArtifactTrashRecord[];
13
+ /** Real, cascading, irreversible deletion of every artifact past its purge deadline; returns how many were purged. */
14
+ purgeDueTrash(): number;
15
+ }
package/src/service.ts CHANGED
@@ -14,6 +14,8 @@ import { AuthorityRegistry, AuthorizedArtifactWriter, type AuthorityClaim } from
14
14
  import type { TaskEventContext } from "./domain/task-event.ts";
15
15
  import type { TaskViewMode } from "./domain/task-scope.ts";
16
16
  import type { ArtifactStore } from "./ports/artifact-store.ts";
17
+ import type { ArtifactEventReader } from "./ports/artifact-event-reader.ts";
18
+ import type { ArtifactTrashStore } from "./ports/artifact-trash-store.ts";
17
19
  import type { GateRunner } from "./ports/gate-runner.ts";
18
20
  import type { TaskEventStore } from "./ports/task-event-store.ts";
19
21
  import type { TaskScopeStore } from "./ports/task-scope-store.ts";
@@ -187,7 +189,10 @@ export interface PapyrusService {
187
189
  }
188
190
 
189
191
  function handlers(
190
- artifacts: ArtifactStore,
192
+ // The composition root's own handler table -- the one place that genuinely needs trash
193
+ // lifecycle and event-log reading alongside core CRUD/graph, unlike every domain-service
194
+ // module (which only ever depends on the narrower ArtifactStore).
195
+ artifacts: ArtifactStore & ArtifactTrashStore & ArtifactEventReader,
191
196
  gates: GateRunner,
192
197
  tasks: Tasks,
193
198
  notes: Notes,