@danypops/papyrus 0.44.7 → 0.44.9

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.
Files changed (77) hide show
  1. package/package.json +1 -1
  2. package/src/{ports → artifact}/artifact-event-reader.ts +1 -1
  3. package/src/{artifact-relationship-view.ts → artifact/artifact-relationship-view.ts} +3 -3
  4. package/src/{ports → artifact}/artifact-store.ts +2 -2
  5. package/src/{artifact-subtree.ts → artifact/artifact-subtree.ts} +4 -4
  6. package/src/{ports → artifact}/artifact-trash-store.ts +2 -2
  7. package/src/{adapters → artifact}/sqlite-artifact-scope-store.ts +1 -1
  8. package/src/{adapters → artifact}/sqlite-artifact-store.ts +15 -15
  9. package/src/authority-registry.ts +3 -3
  10. package/src/cli.ts +5 -5
  11. package/src/client.ts +2 -2
  12. package/src/{daemon-state.ts → daemon/daemon-state.ts} +1 -1
  13. package/src/{daemon.ts → daemon/daemon.ts} +3 -3
  14. package/src/db.ts +1 -1
  15. package/src/{discussion-service.ts → discussion/discussion-service.ts} +7 -6
  16. package/src/domain-services.ts +5 -5
  17. package/src/{graph-projection-service.ts → graph-projection/graph-projection-service.ts} +6 -6
  18. package/src/{vehicle/artifact-trash-vehicle.ts → handlers/artifact-trash.ts} +4 -4
  19. package/src/{vehicle/discuss-vehicle.ts → handlers/discuss.ts} +4 -11
  20. package/src/{vehicle/docs-vehicle.ts → handlers/docs.ts} +3 -10
  21. package/src/{vehicle/notes-vehicle.ts → handlers/notes.ts} +3 -10
  22. package/src/{vehicle/playbooks-vehicle.ts → handlers/playbooks.ts} +10 -10
  23. package/src/{vehicle/papyrus-vehicle.ts → handlers/registry.ts} +21 -16
  24. package/src/{vehicle/rules-vehicle.ts → handlers/rules.ts} +3 -10
  25. package/src/{vehicle/artifact-vehicle-shared.ts → handlers/shared.ts} +5 -5
  26. package/src/{vehicle/tasks-vehicle.ts → handlers/tasks.ts} +6 -6
  27. package/src/index.ts +13 -13
  28. package/src/{log-service.ts → log/log-service.ts} +2 -2
  29. package/src/modules/discuss.ts +2 -2
  30. package/src/modules/docs.ts +3 -2
  31. package/src/modules/graph-projection.ts +4 -3
  32. package/src/modules/logs.ts +1 -1
  33. package/src/modules/notes.ts +1 -1
  34. package/src/modules/playbooks.ts +12 -11
  35. package/src/modules/rules.ts +3 -2
  36. package/src/modules/session-identity.ts +1 -1
  37. package/src/modules/tasks.ts +6 -5
  38. package/src/{note-service.ts → note/note-service.ts} +6 -6
  39. package/src/ops.ts +6 -6
  40. package/src/{playbook-definition.ts → playbook/playbook-definition.ts} +7 -6
  41. package/src/{playbook-execution.ts → playbook/playbook-execution.ts} +5 -4
  42. package/src/{workflow-execution.ts → playbook/workflow-execution.ts} +12 -12
  43. package/src/service.ts +29 -29
  44. package/src/{session-identity-service.ts → session-identity/session-identity-service.ts} +2 -2
  45. package/src/{ports → stores}/session-identity-store.ts +1 -1
  46. package/src/{adapters → stores}/sqlite-discussion-round-store.ts +1 -1
  47. package/src/{adapters → stores}/sqlite-gate-runner.ts +1 -1
  48. package/src/{adapters → stores}/sqlite-graph-projection-store.ts +1 -1
  49. package/src/{adapters → stores}/sqlite-log-store.ts +1 -1
  50. package/src/{adapters → stores}/sqlite-note-event-store.ts +1 -1
  51. package/src/{adapters → stores}/sqlite-session-identity-store.ts +1 -1
  52. package/src/{adapters → stores}/sqlite-task-event-store.ts +1 -1
  53. package/src/{adapters → stores}/sqlite-task-focus-store.ts +1 -1
  54. package/src/{adapters → stores}/sqlite-task-lease-store.ts +1 -1
  55. package/src/{adapters → stores}/sqlite-task-scope-store.ts +1 -1
  56. package/src/{task-context.ts → task/task-context.ts} +4 -4
  57. package/src/{task-execution.ts → task/task-execution.ts} +1 -1
  58. package/src/{task-graph-view.ts → task/task-graph-view.ts} +1 -1
  59. package/src/{task-relationship-view.ts → task/task-relationship-view.ts} +3 -3
  60. package/src/{task-service.ts → task/task-service.ts} +14 -14
  61. /package/src/{domain → artifact}/artifact-alias.ts +0 -0
  62. /package/src/{domain → artifact}/artifact-event.ts +0 -0
  63. /package/src/{ports → artifact}/artifact-scope-store.ts +0 -0
  64. /package/src/{domain → artifact}/artifact-trash.ts +0 -0
  65. /package/src/{domain → artifact}/artifact.ts +0 -0
  66. /package/src/{ports → artifact}/atomic-artifact-store.ts +0 -0
  67. /package/src/{log.ts → log/log.ts} +0 -0
  68. /package/src/{ports → stores}/discussion-round-store.ts +0 -0
  69. /package/src/{ports → stores}/gate-runner.ts +0 -0
  70. /package/src/{ports → stores}/graph-projection-store.ts +0 -0
  71. /package/src/{ports → stores}/graph-renderer.ts +0 -0
  72. /package/src/{ports → stores}/log-store.ts +0 -0
  73. /package/src/{ports → stores}/note-event-store.ts +0 -0
  74. /package/src/{ports → stores}/task-event-store.ts +0 -0
  75. /package/src/{ports → stores}/task-focus-store.ts +0 -0
  76. /package/src/{ports → stores}/task-lease-store.ts +0 -0
  77. /package/src/{ports → stores}/task-scope-store.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/papyrus",
3
- "version": "0.44.7",
3
+ "version": "0.44.9",
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,4 +1,4 @@
1
- import type { ArtifactEventPage, ArtifactEventQuery } from "../domain/artifact-event.ts";
1
+ import type { ArtifactEventPage, ArtifactEventQuery } from "./artifact-event.ts";
2
2
 
3
3
  /** Read access to the generic mutation event log shared by every kind -- split out of
4
4
  * ArtifactStore since only service.ts's graph.history operation reads it. */
@@ -1,6 +1,6 @@
1
- import type { Artifact } from "./domain/artifact.ts";
2
- import type { DisplayGraph, DisplayGraphEdge, DisplayGraphNode } from "./domain/display-graph.ts";
3
- import { fallbackLabel } from "./task-relationship-view.ts";
1
+ import type { DisplayGraph, DisplayGraphEdge, DisplayGraphNode } from "../domain/display-graph.ts";
2
+ import { fallbackLabel } from "../task/task-relationship-view.ts";
3
+ import type { Artifact } from "./artifact.ts";
4
4
 
5
5
  /**
6
6
  * The generic-artifact counterpart to projectTaskRelationships: unlike a Task, which already
@@ -7,8 +7,8 @@ import type {
7
7
  CreateArtifactInput,
8
8
  RelationshipQuery,
9
9
  UpdateArtifactInput,
10
- } from "../domain/artifact.ts";
11
- import type { ArtifactEventContext } from "../domain/artifact-event.ts";
10
+ } from "./artifact.ts";
11
+ import type { ArtifactEventContext } from "./artifact-event.ts";
12
12
 
13
13
  /** Core CRUD/graph operations every domain-service module needs. Trash lifecycle and event-log
14
14
  * reading are separate ports (ArtifactTrashStore, ArtifactEventReader) -- only the composition
@@ -5,10 +5,10 @@
5
5
  * Tasks.cancelSubtree's traversal shape but performs trash(), not a lifecycle transition,
6
6
  * so it applies to any kind that participates in `contains` (task, playbook), not just Task.
7
7
  */
8
- import { ARTIFACT_REMOVE_SUBTREE_MAX_NODES } from "./constants.ts";
9
- import type { ArtifactEventContext } from "./domain/artifact-event.ts";
10
- import type { ArtifactStore } from "./ports/artifact-store.ts";
11
- import type { ArtifactTrashStore } from "./ports/artifact-trash-store.ts";
8
+ import { ARTIFACT_REMOVE_SUBTREE_MAX_NODES } from "../constants.ts";
9
+ import type { ArtifactEventContext } from "./artifact-event.ts";
10
+ import type { ArtifactStore } from "./artifact-store.ts";
11
+ import type { ArtifactTrashStore } from "./artifact-trash-store.ts";
12
12
 
13
13
  export interface RemoveSubtreeResult {
14
14
  removed: string[];
@@ -1,5 +1,5 @@
1
- import type { ArtifactEventContext } from "../domain/artifact-event.ts";
2
- import type { ArtifactTrashRecord } from "../domain/artifact-trash.ts";
1
+ import type { ArtifactEventContext } from "./artifact-event.ts";
2
+ import type { ArtifactTrashRecord } from "./artifact-trash.ts";
3
3
 
4
4
  /** Trash lifecycle for artifacts -- split out of ArtifactStore since only the composition root
5
5
  * (daemon.ts, service.ts) needs it; every domain-service module depends on core CRUD/graph only. */
@@ -1,7 +1,7 @@
1
1
  import type { Db } from "../db.ts";
2
2
  import { inTransaction } from "../db.ts";
3
3
  import type { TaskScopeSource } from "../domain/task-scope.ts";
4
- import type { ArtifactScope, ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
4
+ import type { ArtifactScope, ArtifactScopeStore } from "./artifact-scope-store.ts";
5
5
 
6
6
  export class SQLiteArtifactScopeStore implements ArtifactScopeStore {
7
7
  constructor(private readonly db: Db) {}
@@ -1,17 +1,5 @@
1
1
  import type { Db } from "../db.ts";
2
2
  import { inTransaction } from "../db.ts";
3
- import type {
4
- Artifact,
5
- ArtifactEdge,
6
- ArtifactGraphOptions,
7
- ArtifactLink,
8
- ArtifactQuery,
9
- CreateArtifactInput,
10
- RelationshipQuery,
11
- UpdateArtifactInput,
12
- } from "../domain/artifact.ts";
13
- import type { ArtifactEventContext, ArtifactEventPage, ArtifactEventQuery } from "../domain/artifact-event.ts";
14
- import type { ArtifactTrashRecord } from "../domain/artifact-trash.ts";
15
3
  import {
16
4
  createArtifact,
17
5
  getArtifact,
@@ -29,9 +17,21 @@ import {
29
17
  updateExtra,
30
18
  updateStatus,
31
19
  } from "../ops.ts";
32
- import type { ArtifactEventReader } from "../ports/artifact-event-reader.ts";
33
- import type { ArtifactTrashStore } from "../ports/artifact-trash-store.ts";
34
- import type { AtomicArtifactStore } from "../ports/atomic-artifact-store.ts";
20
+ import type {
21
+ Artifact,
22
+ ArtifactEdge,
23
+ ArtifactGraphOptions,
24
+ ArtifactLink,
25
+ ArtifactQuery,
26
+ CreateArtifactInput,
27
+ RelationshipQuery,
28
+ UpdateArtifactInput,
29
+ } from "./artifact.ts";
30
+ import type { ArtifactEventContext, ArtifactEventPage, ArtifactEventQuery } from "./artifact-event.ts";
31
+ import type { ArtifactEventReader } from "./artifact-event-reader.ts";
32
+ import type { ArtifactTrashRecord } from "./artifact-trash.ts";
33
+ import type { ArtifactTrashStore } from "./artifact-trash-store.ts";
34
+ import type { AtomicArtifactStore } from "./atomic-artifact-store.ts";
35
35
 
36
36
  export class SQLiteArtifactStore implements AtomicArtifactStore, ArtifactTrashStore, ArtifactEventReader {
37
37
  constructor(private readonly db: Db) {}
@@ -19,9 +19,9 @@
19
19
  * already lives, matching "the core has generic registries" from the decision doc.
20
20
  */
21
21
 
22
- import type { Artifact, ArtifactLink } from "./domain/artifact.ts";
23
- import type { ArtifactEventContext } from "./domain/artifact-event.ts";
24
- import type { ArtifactStore } from "./ports/artifact-store.ts";
22
+ import type { Artifact, ArtifactLink } from "./artifact/artifact.ts";
23
+ import type { ArtifactEventContext } from "./artifact/artifact-event.ts";
24
+ import type { ArtifactStore } from "./artifact/artifact-store.ts";
25
25
 
26
26
  export type ArtifactAction = "create" | "link" | "status" | "update";
27
27
 
package/src/cli.ts CHANGED
@@ -5,13 +5,13 @@ import { fileURLToPath } from "node:url";
5
5
  import { createNodeServiceInstallDeps, generateSystemdUnit, installUserService, type ServiceSpec } from "@danypops/vehicle-server/service";
6
6
  import { connectPapyrusClient, type PapyrusClient } from "./client.ts";
7
7
  import { DAEMON_UNIT_NAME, dbPath, TASK_EXECUTION_MAX_NODES } from "./constants.ts";
8
- import { serveMain } from "./daemon.ts";
9
- import { daemonStateDir, vehicleHandlePath } from "./daemon-state.ts";
8
+ import { serveMain } from "./daemon/daemon.ts";
9
+ import { daemonStateDir, vehicleHandlePath } from "./daemon/daemon-state.ts";
10
10
  import { openDb } from "./db.ts";
11
11
  import type { GateResult } from "./domain/gate.ts";
12
12
  import { applyIdMigration, type IdMigrationPlan, mirrorDatabase, planIdMigration, verifyIdMigration } from "./id-migration.ts";
13
- import type { TaskExecutionPlan } from "./task-execution.ts";
14
- import type { TaskBlockage, TaskCompletion } from "./task-service.ts";
13
+ import type { TaskExecutionPlan } from "./task/task-execution.ts";
14
+ import type { TaskBlockage, TaskCompletion } from "./task/task-service.ts";
15
15
  import { VERSION } from "./version.ts";
16
16
 
17
17
  export interface SystemdUnitOptions {
@@ -467,7 +467,7 @@ export async function runGraphCli(args: string[], client: TaskCliClient): Promis
467
467
  return json ? JSON.stringify(artifact) : `Updated ${artifact.id} → [${artifact.status}]`;
468
468
  }
469
469
  if (action !== "history") throw new Error("graph action must be link, unlink, tree, status, or history");
470
- const page = await client.call<Record<string, unknown>, import("./domain/artifact-event.ts").ArtifactEventPage>("graph.history", input);
470
+ const page = await client.call<Record<string, unknown>, import("./artifact/artifact-event.ts").ArtifactEventPage>("graph.history", input);
471
471
  if (json) return JSON.stringify(page);
472
472
  if (page.events.length === 0) return "No recorded events.";
473
473
  return page.events
package/src/client.ts CHANGED
@@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url";
3
3
  import { connectWithVersionCheck, type ExpectedVersion, spawnDetachedDaemon } from "@danypops/vehicle-client/daemon-client";
4
4
  import { createLiveVersionExpectation } from "@danypops/vehicle-client/version";
5
5
  import { DAEMON_CLIENT_TIMEOUT_MS, DAEMON_DIR_ENV, DAEMON_PROBE_TIMEOUT_MS } from "./constants.ts";
6
- import { type DaemonHandle, daemonStateDir, readDaemonHandle } from "./daemon-state.ts";
6
+ import { type DaemonHandle, daemonStateDir, readDaemonHandle } from "./daemon/daemon-state.ts";
7
7
  import type { OperationName, SchemaState } from "./service.ts";
8
8
 
9
9
  /**
@@ -161,7 +161,7 @@ export function resolvePushChannelTarget(dir: string = daemonStateDir()): PushCh
161
161
  }
162
162
 
163
163
  export interface VehicleClientTarget {
164
- /** Base URL for a domain migrated onto VehicleRegistry (see src/vehicle/*.ts) -- @danypops/vehicle-client's RemoteVehicleClient mounts its own /vehicle/manifest, /vehicle/invoke, /vehicle/cancel routes under this. */
164
+ /** Base URL for a domain migrated onto VehicleRegistry (see src/handlers/*.ts) -- @danypops/vehicle-client's RemoteVehicleClient mounts its own /vehicle/manifest, /vehicle/invoke, /vehicle/cancel routes under this. */
165
165
  baseUrl: string;
166
166
  token: string;
167
167
  }
@@ -3,7 +3,7 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { LOOPBACK_HOST, removeDaemonHandle, writeDaemonHandle } from "@danypops/vehicle-server/paths";
6
- import { DAEMON_DIR_ENV, DAEMON_HANDLE_FILE, DAEMON_HOST, DAEMON_PORT_FILE, DAEMON_TOKEN_FILE } from "./constants.ts";
6
+ import { DAEMON_DIR_ENV, DAEMON_HANDLE_FILE, DAEMON_HOST, DAEMON_PORT_FILE, DAEMON_TOKEN_FILE } from "../constants.ts";
7
7
 
8
8
  export interface DaemonHandle {
9
9
  baseUrl: string;
@@ -1,7 +1,9 @@
1
1
  import { join } from "node:path";
2
2
  import { acquireDaemonLock, releaseDaemonLock } from "@danypops/vehicle-server/paths";
3
3
  import { PushChannel } from "@danypops/vehicle-server/push-channel";
4
- import { DAEMON_HOST, DB_OPTIMIZE_INTERVAL_MS, dbPath, WAL_CHECKPOINT_INTERVAL_MS } from "./constants.ts";
4
+ import { DAEMON_HOST, DB_OPTIMIZE_INTERVAL_MS, dbPath, WAL_CHECKPOINT_INTERVAL_MS } from "../constants.ts";
5
+ import { logEvent, vehicleLogger } from "../log/log.ts";
6
+ import { createApp, createPapyrusService } from "../service.ts";
5
7
  import {
6
8
  clearDaemonPort,
7
9
  clearVehicleHandle,
@@ -10,8 +12,6 @@ import {
10
12
  writeDaemonPort,
11
13
  writeVehicleHandle,
12
14
  } from "./daemon-state.ts";
13
- import { logEvent, vehicleLogger } from "./log.ts";
14
- import { createApp, createPapyrusService } from "./service.ts";
15
15
 
16
16
  /**
17
17
  * Operations that never change what a Task-graph reader (the pi-papyrus widget's
package/src/db.ts CHANGED
@@ -2,8 +2,8 @@ import { mkdirSync } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import { dirname } from "node:path";
4
4
  import { runMigrations, type SqliteMigrationRunner } from "@danypops/vehicle-server/storage";
5
+ import { generateUniqueAlias, slugify } from "./artifact/artifact-alias.ts";
5
6
  import { SQLITE_BUSY_TIMEOUT_MS, SQLITE_SCHEMA_VERSION } from "./constants.ts";
6
- import { generateUniqueAlias, slugify } from "./domain/artifact-alias.ts";
7
7
 
8
8
  const require_ = createRequire(import.meta.url);
9
9
  const IS_BUN = typeof (globalThis as { Bun?: unknown }).Bun !== "undefined";
@@ -3,9 +3,11 @@
3
3
  * append-only rounds (via DiscussionRoundStore). See domain/discussion.ts for the full
4
4
  * design rationale.
5
5
  */
6
- import { DISCUSSION_LIST_DEFAULT_LIMIT, DISCUSSION_LIST_MAX_LIMIT, DISCUSSION_MAX_ROUNDS } from "./constants.ts";
7
- import type { Artifact } from "./domain/artifact.ts";
8
- import type { ArtifactEventContext } from "./domain/artifact-event.ts";
6
+
7
+ import type { Artifact } from "../artifact/artifact.ts";
8
+ import type { ArtifactEventContext } from "../artifact/artifact-event.ts";
9
+ import type { AtomicArtifactStore } from "../artifact/atomic-artifact-store.ts";
10
+ import { DISCUSSION_LIST_DEFAULT_LIMIT, DISCUSSION_LIST_MAX_LIMIT, DISCUSSION_MAX_ROUNDS } from "../constants.ts";
9
11
  import {
10
12
  DISCUSSION_SUBTYPE,
11
13
  type DiscussionExtra,
@@ -19,9 +21,8 @@ import {
19
21
  validateDiscussionOptions,
20
22
  validateSelectedOptions,
21
23
  validateSettlement,
22
- } from "./domain/discussion.ts";
23
- import type { AtomicArtifactStore } from "./ports/atomic-artifact-store.ts";
24
- import type { DiscussionRoundStore } from "./ports/discussion-round-store.ts";
24
+ } from "../domain/discussion.ts";
25
+ import type { DiscussionRoundStore } from "../stores/discussion-round-store.ts";
25
26
 
26
27
  export class DiscussionError extends Error {}
27
28
 
@@ -1,3 +1,7 @@
1
+ import { type Artifact, requireLocallyOwnedContent } from "./artifact/artifact.ts";
2
+ import type { ArtifactEventContext } from "./artifact/artifact-event.ts";
3
+ import type { ArtifactScopeStore } from "./artifact/artifact-scope-store.ts";
4
+ import type { ArtifactStore } from "./artifact/artifact-store.ts";
1
5
  import type { ArtifactAction, AuthorityRegistry } from "./authority-registry.ts";
2
6
  import {
3
7
  ARTIFACT_BODY_MAX_LENGTH,
@@ -14,8 +18,6 @@ import {
14
18
  RULE_TEXT_HARD_LIMIT_CHARACTERS,
15
19
  SKILL_MAX_ENUM_VALUES,
16
20
  } from "./constants.ts";
17
- import { type Artifact, requireLocallyOwnedContent } from "./domain/artifact.ts";
18
- import type { ArtifactEventContext } from "./domain/artifact-event.ts";
19
21
  import {
20
22
  BLUEPRINT_INPUT_TYPES,
21
23
  type BlueprintArgumentValue,
@@ -23,9 +25,7 @@ import {
23
25
  validateArgumentValue,
24
26
  } from "./domain/blueprint-definition.ts";
25
27
  import { normalizeProjectRoot } from "./domain/task-scope.ts";
26
- import { NOTE_SUBTYPE } from "./note-service.ts";
27
- import type { ArtifactScopeStore } from "./ports/artifact-scope-store.ts";
28
- import type { ArtifactStore } from "./ports/artifact-store.ts";
28
+ import { NOTE_SUBTYPE } from "./note/note-service.ts";
29
29
 
30
30
  export interface UpdateContentInput {
31
31
  title?: string;
@@ -4,16 +4,16 @@
4
4
  * documented, deliberate scope limits of this first walking-skeleton slice.
5
5
  */
6
6
 
7
- import type { AuthorityRegistry } from "./authority-registry.ts";
7
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
8
+ import { requireAtomicArtifactStore } from "../artifact/atomic-artifact-store.ts";
9
+ import type { AuthorityRegistry } from "../authority-registry.ts";
8
10
  import {
9
11
  GRAPH_PROJECTION_ID_MAX_LENGTH,
10
12
  GRAPH_PROJECTION_MAX_ARTIFACTS_PER_BATCH,
11
13
  GRAPH_PROJECTION_MAX_EDGES_PER_BATCH,
12
- } from "./constants.ts";
13
- import { GRAPH_PROJECTION_SCHEMA_VERSION, type GraphProjectionBatch, type GraphProjectionResult } from "./domain/graph-projection.ts";
14
- import type { ArtifactStore } from "./ports/artifact-store.ts";
15
- import { requireAtomicArtifactStore } from "./ports/atomic-artifact-store.ts";
16
- import type { GraphProjectionStore } from "./ports/graph-projection-store.ts";
14
+ } from "../constants.ts";
15
+ import { GRAPH_PROJECTION_SCHEMA_VERSION, type GraphProjectionBatch, type GraphProjectionResult } from "../domain/graph-projection.ts";
16
+ import type { GraphProjectionStore } from "../stores/graph-projection-store.ts";
17
17
 
18
18
  function boundedId(value: string, label: string): string {
19
19
  if (!value || value.length === 0) throw new Error(`${label} is required`);
@@ -5,10 +5,10 @@
5
5
  */
6
6
  import { bindVehicleOperation, defineVehicleOperation } from "@danypops/vehicle-core";
7
7
  import type { VehicleRegistry } from "@danypops/vehicle-server";
8
- import { removeArtifactSubtree } from "../artifact-subtree.ts";
9
- import type { ArtifactStore } from "../ports/artifact-store.ts";
10
- import type { ArtifactTrashStore } from "../ports/artifact-trash-store.ts";
11
- import { looseObjectSchema, numberProp, passthroughOutput, stringProp, validationError } from "./artifact-vehicle-shared.ts";
8
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
9
+ import { removeArtifactSubtree } from "../artifact/artifact-subtree.ts";
10
+ import type { ArtifactTrashStore } from "../artifact/artifact-trash-store.ts";
11
+ import { looseObjectSchema, numberProp, passthroughOutput, stringProp, validationError } from "./shared.ts";
12
12
 
13
13
  const OWNER = "artifact";
14
14
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
@@ -15,19 +15,12 @@
15
15
  */
16
16
  import { bindVehicleOperation, defineVehicleOperation, type VehicleContentBlock } from "@danypops/vehicle-core";
17
17
  import type { VehicleRegistry } from "@danypops/vehicle-server";
18
- import type { DiscussionAndRounds, Discussions } from "../discussion-service.ts";
19
- import type { Artifact } from "../domain/artifact.ts";
18
+ import type { Artifact } from "../artifact/artifact.ts";
19
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
20
+ import type { DiscussionAndRounds, Discussions } from "../discussion/discussion-service.ts";
20
21
  import { DISCUSSION_SUBTYPE, type DiscussionRound } from "../domain/discussion.ts";
21
22
  import { discussOperations } from "../modules/discuss.ts";
22
- import type { ArtifactStore } from "../ports/artifact-store.ts";
23
- import {
24
- looseObjectSchema,
25
- numberProp,
26
- passthroughOutput,
27
- resolveArtifactIdWidened,
28
- stringProp,
29
- validationError,
30
- } from "./artifact-vehicle-shared.ts";
23
+ import { looseObjectSchema, numberProp, passthroughOutput, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
31
24
 
32
25
  const OWNER = "discuss";
33
26
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
@@ -5,19 +5,12 @@
5
5
  */
6
6
  import { bindVehicleOperation, defineVehicleOperation } from "@danypops/vehicle-core";
7
7
  import type { VehicleRegistry } from "@danypops/vehicle-server";
8
+ import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
9
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
8
10
  import type { AuthorityRegistry } from "../authority-registry.ts";
9
11
  import { listDocuments } from "../domain-services.ts";
10
12
  import { docsOperations } from "../modules/docs.ts";
11
- import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
12
- import type { ArtifactStore } from "../ports/artifact-store.ts";
13
- import {
14
- looseObjectSchema,
15
- numberProp,
16
- passthroughOutput,
17
- resolveArtifactIdWidened,
18
- stringProp,
19
- validationError,
20
- } from "./artifact-vehicle-shared.ts";
13
+ import { looseObjectSchema, numberProp, passthroughOutput, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
21
14
 
22
15
  const OWNER = "docs";
23
16
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
@@ -9,17 +9,10 @@
9
9
  */
10
10
  import { bindVehicleOperation, defineVehicleOperation } from "@danypops/vehicle-core";
11
11
  import type { VehicleRegistry } from "@danypops/vehicle-server";
12
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
12
13
  import { notesOperations } from "../modules/notes.ts";
13
- import { NOTE_DISPOSITIONS, type Notes } from "../note-service.ts";
14
- import type { ArtifactStore } from "../ports/artifact-store.ts";
15
- import {
16
- looseObjectSchema,
17
- numberProp,
18
- passthroughOutput,
19
- resolveArtifactIdWidened,
20
- stringProp,
21
- validationError,
22
- } from "./artifact-vehicle-shared.ts";
14
+ import { NOTE_DISPOSITIONS, type Notes } from "../note/note-service.ts";
15
+ import { looseObjectSchema, numberProp, passthroughOutput, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
23
16
 
24
17
  const OWNER = "notes";
25
18
 
@@ -9,7 +9,7 @@
9
9
  * Those two fields never belong in this operation's model-visible inputSchema -- a model
10
10
  * has no business knowing or supplying a session secret. Instead they travel through
11
11
  * VehicleInvocationOptions.principal.claims, populated by pi-papyrus's own
12
- * resolveInvocation hook (see vehicle-notes-client.ts) from its own already-cached
12
+ * resolveInvocation hook (see pi-papyrus's tools/vehicle-notes-client.ts) from its own already-cached
13
13
  * session_secret, the same value the hand-rolled tool used to thread through as a raw
14
14
  * input field. A caller with no cached secret for this session (unregistered, or a non-Pi
15
15
  * Vehicle client) simply gets the guard's own no-op-when-unset default, unchanged.
@@ -20,15 +20,15 @@
20
20
  */
21
21
  import { bindVehicleOperation, defineVehicleOperation, type VehicleOperationContext } from "@danypops/vehicle-core";
22
22
  import type { VehicleRegistry } from "@danypops/vehicle-server";
23
+ import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
24
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
23
25
  import { listPlaybooks } from "../domain-services.ts";
24
26
  import { playbooksOperations } from "../modules/playbooks.ts";
25
- import type { PlaybookInvocationResult, PlaybookMissingArguments } from "../playbook-execution.ts";
26
- import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
27
- import type { ArtifactStore } from "../ports/artifact-store.ts";
28
- import type { TaskEventStore } from "../ports/task-event-store.ts";
29
- import type { TaskScopeStore } from "../ports/task-scope-store.ts";
30
- import type { SessionIdentity } from "../session-identity-service.ts";
31
- import type { Tasks } from "../task-service.ts";
27
+ import type { PlaybookInvocationResult, PlaybookMissingArguments } from "../playbook/playbook-execution.ts";
28
+ import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
29
+ import type { TaskEventStore } from "../stores/task-event-store.ts";
30
+ import type { TaskScopeStore } from "../stores/task-scope-store.ts";
31
+ import type { Tasks } from "../task/task-service.ts";
32
32
  import {
33
33
  buildWorkflowRunContent,
34
34
  classifyPlaybookComposition,
@@ -41,7 +41,7 @@ import {
41
41
  resolveArtifactIdWidened,
42
42
  stringProp,
43
43
  validationError,
44
- } from "./artifact-vehicle-shared.ts";
44
+ } from "./shared.ts";
45
45
 
46
46
  const OWNER = "playbooks";
47
47
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
@@ -70,7 +70,7 @@ export function registerPlaybooksVehicleOperations(registry: VehicleRegistry, de
70
70
  /**
71
71
  * Every playbooks.* action funnels through here. invoke's own module handler re-runs
72
72
  * sessionIdentity.assertAuthorized directly (see this file's own doc comment) and its
73
- * blueprint-materialization engine (workflow-execution.ts) can hit the same execution-graph
73
+ * blueprint-materialization engine (playbook/workflow-execution.ts) can hit the same execution-graph
74
74
  * bounds tasks-vehicle.ts's own operations do -- classifying both reviewed domain error classes
75
75
  * at this one choke point covers every action that can throw them. Anything else propagates
76
76
  * unchanged -- vehicle-registry's own secure-by-default handler-failed opacity still applies to a
@@ -6,23 +6,23 @@
6
6
  * per domain.
7
7
  */
8
8
  import { VehicleRegistry } from "@danypops/vehicle-server";
9
+ import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
10
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
11
+ import type { ArtifactTrashStore } from "../artifact/artifact-trash-store.ts";
9
12
  import type { AuthorityRegistry } from "../authority-registry.ts";
10
- import type { Discussions } from "../discussion-service.ts";
11
- import type { Notes } from "../note-service.ts";
12
- import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
13
- import type { ArtifactStore } from "../ports/artifact-store.ts";
14
- import type { ArtifactTrashStore } from "../ports/artifact-trash-store.ts";
15
- import type { TaskEventStore } from "../ports/task-event-store.ts";
16
- import type { TaskScopeStore } from "../ports/task-scope-store.ts";
17
- import type { SessionIdentity } from "../session-identity-service.ts";
18
- import type { Tasks } from "../task-service.ts";
19
- import { registerArtifactTrashOperations } from "./artifact-trash-vehicle.ts";
20
- import { registerDiscussVehicleOperations } from "./discuss-vehicle.ts";
21
- import { registerDocsVehicleOperations } from "./docs-vehicle.ts";
22
- import { registerNotesVehicleOperations } from "./notes-vehicle.ts";
23
- import { registerPlaybooksVehicleOperations } from "./playbooks-vehicle.ts";
24
- import { registerRulesVehicleOperations } from "./rules-vehicle.ts";
25
- import { registerTasksVehicleOperations } from "./tasks-vehicle.ts";
13
+ import type { Discussions } from "../discussion/discussion-service.ts";
14
+ import type { Notes } from "../note/note-service.ts";
15
+ import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
16
+ import type { TaskEventStore } from "../stores/task-event-store.ts";
17
+ import type { TaskScopeStore } from "../stores/task-scope-store.ts";
18
+ import type { Tasks } from "../task/task-service.ts";
19
+ import { registerArtifactTrashOperations } from "./artifact-trash.ts";
20
+ import { registerDiscussVehicleOperations } from "./discuss.ts";
21
+ import { registerDocsVehicleOperations } from "./docs.ts";
22
+ import { registerNotesVehicleOperations } from "./notes.ts";
23
+ import { registerPlaybooksVehicleOperations } from "./playbooks.ts";
24
+ import { registerRulesVehicleOperations } from "./rules.ts";
25
+ import { registerTasksVehicleOperations } from "./tasks.ts";
26
26
 
27
27
  export interface PapyrusVehicleDeps {
28
28
  artifacts: ArtifactStore & ArtifactTrashStore;
@@ -42,6 +42,11 @@ export function createPapyrusVehicleRegistry(deps: PapyrusVehicleDeps): VehicleR
42
42
  version: "1.0.0",
43
43
  description: "Papyrus's graph-artifact domains, one honest operation per real action.",
44
44
  });
45
+ // An unexpected handler exception's message becomes the classified failure's causeMessage
46
+ // instead of vanishing into an opaque "<op>@N handler failed". Safe here: no Papyrus domain
47
+ // error ever embeds a session_secret or other credential in its message (only a bare
48
+ // session_id, a correlation id, not a secret -- see session-identity-service.ts).
49
+ registry.setExposeHandlerFailureDetails(true);
45
50
  registerNotesVehicleOperations(registry, deps.notes, deps.artifacts);
46
51
  registerRulesVehicleOperations(registry, deps.artifacts, deps.scopes);
47
52
  registerDocsVehicleOperations(registry, deps.artifacts, deps.scopes, deps.authority);
@@ -6,18 +6,11 @@
6
6
  */
7
7
  import { bindVehicleOperation, defineVehicleOperation } from "@danypops/vehicle-core";
8
8
  import type { VehicleRegistry } from "@danypops/vehicle-server";
9
+ import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
10
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
9
11
  import { listRules } from "../domain-services.ts";
10
12
  import { rulesOperations } from "../modules/rules.ts";
11
- import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
12
- import type { ArtifactStore } from "../ports/artifact-store.ts";
13
- import {
14
- looseObjectSchema,
15
- numberProp,
16
- passthroughOutput,
17
- resolveArtifactIdWidened,
18
- stringProp,
19
- validationError,
20
- } from "./artifact-vehicle-shared.ts";
13
+ import { looseObjectSchema, numberProp, passthroughOutput, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
21
14
 
22
15
  const OWNER = "rules";
23
16
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
@@ -4,11 +4,11 @@
4
4
  * artifact-trash-vehicle.ts).
5
5
  */
6
6
  import { defineVehicleSchema, type VehicleContentBlock, VehicleError, type VehicleSchemaCodec } from "@danypops/vehicle-core";
7
- import type { Artifact } from "../domain/artifact.ts";
8
- import { PlaybookCompositionError } from "../playbook-definition.ts";
9
- import type { ArtifactStore } from "../ports/artifact-store.ts";
10
- import { InvalidSessionSecretError } from "../session-identity-service.ts";
11
- import { TaskDependencyCycleError, TaskExecutionBoundExceededError, type TaskExecutionPlan } from "../task-execution.ts";
7
+ import type { Artifact } from "../artifact/artifact.ts";
8
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
9
+ import { PlaybookCompositionError } from "../playbook/playbook-definition.ts";
10
+ import { InvalidSessionSecretError } from "../session-identity/session-identity-service.ts";
11
+ import { TaskDependencyCycleError, TaskExecutionBoundExceededError, type TaskExecutionPlan } from "../task/task-execution.ts";
12
12
 
13
13
  /**
14
14
  * VehicleRegistry only ever calls a schema's own safeParse -- jsonSchema is
@@ -10,7 +10,7 @@
10
10
  * - session_secret authorizes which session's Task Focus row gets mutated
11
11
  * (modules/tasks.ts's own guardFocusMutation). It must never be a model-visible
12
12
  * input field -- it travels through VehicleInvocationOptions.principal.claims,
13
- * the same mechanism playbooks.invoke uses (see vehicle-notes-client.ts).
13
+ * the same mechanism playbooks.invoke uses (see pi-papyrus's tools/vehicle-notes-client.ts).
14
14
  * - papyrus.task-focus.v1 is a same-process Pi extension event bus broadcast (a
15
15
  * token-cost router or similar can correlate its own telemetry with the
16
16
  * currently focused task) with no Vehicle-transport equivalent -- fired from
@@ -21,12 +21,12 @@
21
21
  */
22
22
  import { bindVehicleOperation, defineVehicleOperation, type VehicleOperationContext } from "@danypops/vehicle-core";
23
23
  import type { VehicleRegistry } from "@danypops/vehicle-server";
24
+ import type { ArtifactStore } from "../artifact/artifact-store.ts";
24
25
  import type { TaskViewMode } from "../domain/task-scope.ts";
25
26
  import { tasksOperations } from "../modules/tasks.ts";
26
- import type { ArtifactStore } from "../ports/artifact-store.ts";
27
- import type { SessionIdentity } from "../session-identity-service.ts";
28
- import type { TaskExecutionPlan } from "../task-execution.ts";
29
- import type { TaskCompletion, Tasks } from "../task-service.ts";
27
+ import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
28
+ import type { TaskExecutionPlan } from "../task/task-execution.ts";
29
+ import type { TaskCompletion, Tasks } from "../task/task-service.ts";
30
30
  import {
31
31
  classifySessionAuthorization,
32
32
  classifyTaskDependencyCycles,
@@ -38,7 +38,7 @@ import {
38
38
  resolveArtifactIdWidened,
39
39
  stringProp,
40
40
  validationError,
41
- } from "./artifact-vehicle-shared.ts";
41
+ } from "./shared.ts";
42
42
 
43
43
  const OWNER = "tasks";
44
44
  const LIMITS = { defaultTimeoutMs: 5_000, maxTimeoutMs: 30_000, maxRequestBytes: 65_536, maxResponseBytes: 262_144 };
package/src/index.ts CHANGED
@@ -5,7 +5,9 @@
5
5
  * purposeful API, not "everything happens to be reachable."
6
6
  */
7
7
 
8
- export { projectArtifactRelationships } from "./artifact-relationship-view.ts";
8
+ export type { Artifact, ArtifactEdge } from "./artifact/artifact.ts";
9
+ export { projectArtifactRelationships } from "./artifact/artifact-relationship-view.ts";
10
+ export type { ArtifactStore } from "./artifact/artifact-store.ts";
9
11
  export {
10
12
  connectPapyrusClient,
11
13
  type PapyrusClient,
@@ -15,8 +17,7 @@ export {
15
17
  type VehicleClientTarget,
16
18
  } from "./client.ts";
17
19
  export * from "./constants.ts";
18
- export type { DiscussionAndRounds } from "./discussion-service.ts";
19
- export type { Artifact, ArtifactEdge } from "./domain/artifact.ts";
20
+ export type { DiscussionAndRounds } from "./discussion/discussion-service.ts";
20
21
  export { checklistEntries, PROOF_TYPES, type ProofReference } from "./domain/checklist.ts";
21
22
  export { DISCUSSION_SUBTYPE, type DiscussionRound, readDiscussionExtra } from "./domain/discussion.ts";
22
23
  export type { DisplayGraph, DisplayGraphEdge, DisplayGraphNode, RenderedGraph } from "./domain/display-graph.ts";
@@ -25,14 +26,13 @@ export type { NoteHistoryPage } from "./domain/note-event.ts";
25
26
  export type { TaskEvent, TaskHistoryPage } from "./domain/task-event.ts";
26
27
  export type { TaskLease } from "./domain/task-lease.ts";
27
28
  export type { TaskViewSelection } from "./domain/task-scope.ts";
28
- export { NOTE_DISPOSITIONS } from "./note-service.ts";
29
- export type { PlaybookInvocationResult, PlaybookMissingArguments } from "./playbook-execution.ts";
30
- export type { ArtifactStore } from "./ports/artifact-store.ts";
31
- export type { GraphRenderer } from "./ports/graph-renderer.ts";
29
+ export { NOTE_DISPOSITIONS } from "./note/note-service.ts";
30
+ export type { PlaybookInvocationResult, PlaybookMissingArguments } from "./playbook/playbook-execution.ts";
31
+ export type { WorkflowRunResult } from "./playbook/workflow-execution.ts";
32
32
  export type { OperationName, SchemaState } from "./service.ts";
33
- export { taskContext } from "./task-context.ts";
34
- export { projectTaskExecution, type TaskExecutionPlan, type TaskExecutionState } from "./task-execution.ts";
35
- export { projectTaskGraph, type TaskGraphView } from "./task-graph-view.ts";
36
- export { fallbackLabel, projectTaskRelationships } from "./task-relationship-view.ts";
37
- export type { TaskCompletion, TaskGraph, TaskNode, TaskStatus } from "./task-service.ts";
38
- export type { WorkflowRunResult } from "./workflow-execution.ts";
33
+ export type { GraphRenderer } from "./stores/graph-renderer.ts";
34
+ export { taskContext } from "./task/task-context.ts";
35
+ export { projectTaskExecution, type TaskExecutionPlan, type TaskExecutionState } from "./task/task-execution.ts";
36
+ export { projectTaskGraph, type TaskGraphView } from "./task/task-graph-view.ts";
37
+ export { fallbackLabel, projectTaskRelationships } from "./task/task-relationship-view.ts";
38
+ export type { TaskCompletion, TaskGraph, TaskNode, TaskStatus } from "./task/task-service.ts";