@danypops/papyrus 0.44.10 → 0.44.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/papyrus",
3
- "version": "0.44.10",
3
+ "version": "0.44.11",
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"],
@@ -20,6 +20,29 @@ export interface Artifact {
20
20
  edges?: ArtifactEdge[];
21
21
  }
22
22
 
23
+ /**
24
+ * A list operation's default projection: everything needed to identify, browse, and pick
25
+ * one artifact out of many, without its body/extra -- the same fields show()'s own full
26
+ * Artifact carries minus the two that make listing dozens of rows as expensive as showing
27
+ * each one individually (a Playbook's full runbook body, a Rule's condition/action text).
28
+ */
29
+ export interface ArtifactSummary {
30
+ id: string;
31
+ kind: string;
32
+ title: string;
33
+ status: string;
34
+ subtype: string;
35
+ labels: string[];
36
+ created_at: string;
37
+ updated_at: string;
38
+ alias: string;
39
+ }
40
+
41
+ export function summarizeArtifact(artifact: Artifact): ArtifactSummary {
42
+ const { id, kind, title, status, subtype, labels, created_at, updated_at, alias } = artifact;
43
+ return { id, kind, title, status, subtype, labels, created_at, updated_at, alias };
44
+ }
45
+
23
46
  export interface CreateArtifactInput {
24
47
  kind?: string;
25
48
  title?: string;
@@ -9,7 +9,7 @@ import type { ArtifactStore } from "../artifact/artifact-store.ts";
9
9
  import type { AuthorityRegistry } from "../authority-registry.ts";
10
10
  import { listDocuments } from "../domain-services.ts";
11
11
  import { docsOperations } from "../modules/docs.ts";
12
- import { createOperationDefiner, numberProp, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
12
+ import { booleanProp, createOperationDefiner, numberProp, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
13
13
 
14
14
  const OWNER = "docs";
15
15
 
@@ -66,9 +66,9 @@ export function registerDocsVehicleOperations(
66
66
 
67
67
  define(
68
68
  "list",
69
- "Lists Docs matching an optional status/text filter, scoped to project_root when given.",
69
+ "Lists Docs matching an optional status/text filter, scoped to project_root when given. Returns a lean summary (no body) by default -- pass full: true for the complete artifact.",
70
70
  "read",
71
- { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp },
71
+ { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp, full: booleanProp },
72
72
  [],
73
73
  (input) => input,
74
74
  );
@@ -29,6 +29,7 @@ import type { TaskEventStore } from "../stores/task-event-store.ts";
29
29
  import type { TaskScopeStore } from "../stores/task-scope-store.ts";
30
30
  import type { Tasks } from "../task/task-service.ts";
31
31
  import {
32
+ booleanProp,
32
33
  buildWorkflowRunContent,
33
34
  classifyPlaybookComposition,
34
35
  classifySessionAuthorization,
@@ -107,9 +108,9 @@ export function registerPlaybooksVehicleOperations(registry: VehicleRegistry, de
107
108
 
108
109
  define(
109
110
  "list",
110
- "Lists Playbooks matching an optional status/text filter, scoped to project_root when given.",
111
+ "Lists Playbooks matching an optional status/text filter, scoped to project_root when given. Returns a lean summary (no body/steps) by default -- pass full: true for the complete artifact.",
111
112
  "read",
112
- { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp },
113
+ { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp, full: booleanProp },
113
114
  [],
114
115
  (input) => input,
115
116
  );
@@ -9,7 +9,7 @@ import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
9
9
  import type { ArtifactStore } from "../artifact/artifact-store.ts";
10
10
  import { listRules } from "../domain-services.ts";
11
11
  import { rulesOperations } from "../modules/rules.ts";
12
- import { createOperationDefiner, numberProp, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
12
+ import { booleanProp, createOperationDefiner, numberProp, resolveArtifactIdWidened, stringProp, validationError } from "./shared.ts";
13
13
 
14
14
  const OWNER = "rules";
15
15
 
@@ -70,9 +70,9 @@ export function registerRulesVehicleOperations(registry: VehicleRegistry, artifa
70
70
 
71
71
  define(
72
72
  "list",
73
- "Lists Rules matching an optional status/text filter, scoped to project_root when given.",
73
+ "Lists Rules matching an optional status/text filter, scoped to project_root when given. Returns a lean summary (no condition/action/body) by default -- pass full: true for the complete artifact.",
74
74
  "read",
75
- { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp },
75
+ { status: stringProp, text: stringProp, limit: numberProp, project_root: stringProp, full: booleanProp },
76
76
  [],
77
77
  (input) => input,
78
78
  );
@@ -57,6 +57,7 @@ export const passthroughOutput: VehicleSchemaCodec<unknown> = defineVehicleSchem
57
57
 
58
58
  export const stringProp = { type: "string" } as const;
59
59
  export const numberProp = { type: "number" } as const;
60
+ export const booleanProp = { type: "boolean" } as const;
60
61
 
61
62
  /**
62
63
  * A plain `throw new Error(...)` inside any resolve()/execute() step here is caught by
@@ -7,6 +7,7 @@
7
7
  * ArtifactStore-based with no other module's concrete class dependency.
8
8
  */
9
9
 
10
+ import { summarizeArtifact } from "../artifact/artifact.ts";
10
11
  import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
11
12
  import type { ArtifactStore } from "../artifact/artifact-store.ts";
12
13
  import type { AuthorityRegistry } from "../authority-registry.ts";
@@ -21,7 +22,7 @@ import {
21
22
  updateDocument,
22
23
  } from "../domain-services.ts";
23
24
  import type { OperationDefinition } from "../module-registry.ts";
24
- import { type OperationInput, optionalNumber, optionalString, string } from "./operation-input.ts";
25
+ import { type OperationInput, optionalBoolean, optionalNumber, optionalString, string } from "./operation-input.ts";
25
26
 
26
27
  const MODULE_ID = "docs";
27
28
 
@@ -76,7 +77,10 @@ export function docsOperations(artifacts: ArtifactStore, scopes: ArtifactScopeSt
76
77
  eventContext(input),
77
78
  ),
78
79
  ),
79
- define("docs.list", (input: OperationInput) => listDocuments(artifacts, scopes, artifactFilter(input))),
80
+ define("docs.list", (input: OperationInput) => {
81
+ const docs = listDocuments(artifacts, scopes, artifactFilter(input));
82
+ return optionalBoolean(input, "full") === true ? docs : docs.map(summarizeArtifact);
83
+ }),
80
84
  define("docs.show", (input: OperationInput) => showDocument(artifacts, string(input, "id"))),
81
85
  define("docs.activate", (input: OperationInput) =>
82
86
  transitionDocument(artifacts, string(input, "id"), "activate", authority, eventContext(input)),
@@ -33,3 +33,10 @@ export function optionalNumber(input: OperationInput, key: string): number | und
33
33
  if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${key} must be a number`);
34
34
  return value;
35
35
  }
36
+
37
+ export function optionalBoolean(input: OperationInput, key: string): boolean | undefined {
38
+ const value = input[key];
39
+ if (value === undefined) return undefined;
40
+ if (typeof value !== "boolean") throw new Error(`${key} must be a boolean`);
41
+ return value;
42
+ }
@@ -10,6 +10,7 @@
10
10
  * playbook/playbook-definition.ts for the full rationale.
11
11
  */
12
12
 
13
+ import { summarizeArtifact } from "../artifact/artifact.ts";
13
14
  import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
14
15
  import type { ArtifactStore } from "../artifact/artifact-store.ts";
15
16
  import {
@@ -31,7 +32,7 @@ import type { SessionIdentity } from "../session-identity/session-identity-servi
31
32
  import type { TaskEventStore } from "../stores/task-event-store.ts";
32
33
  import type { TaskScopeStore } from "../stores/task-scope-store.ts";
33
34
  import type { Tasks } from "../task/task-service.ts";
34
- import { type OperationInput, optionalNumber, optionalString, string } from "./operation-input.ts";
35
+ import { type OperationInput, optionalBoolean, optionalNumber, optionalString, string } from "./operation-input.ts";
35
36
 
36
37
  const MODULE_ID = "playbooks";
37
38
 
@@ -114,7 +115,10 @@ export function playbooksOperations({
114
115
  eventContext(input),
115
116
  ),
116
117
  ),
117
- define("playbooks.list", (input: OperationInput) => listPlaybooks(artifacts, artifactScopes, artifactFilter(input))),
118
+ define("playbooks.list", (input: OperationInput) => {
119
+ const playbooks = listPlaybooks(artifacts, artifactScopes, artifactFilter(input));
120
+ return optionalBoolean(input, "full") === true ? playbooks : playbooks.map(summarizeArtifact);
121
+ }),
118
122
  define("playbooks.show", (input: OperationInput) => showPlaybook(artifacts, string(input, "id"))),
119
123
  define("playbooks.preview", (input: OperationInput) =>
120
124
  playbookInvocation(artifacts, string(input, "id"), input.arguments as Record<string, unknown> | undefined),
@@ -11,6 +11,7 @@
11
11
  * registry" convention.
12
12
  */
13
13
 
14
+ import { summarizeArtifact } from "../artifact/artifact.ts";
14
15
  import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
15
16
  import type { ArtifactStore } from "../artifact/artifact-store.ts";
16
17
  import {
@@ -24,7 +25,7 @@ import {
24
25
  updateRule,
25
26
  } from "../domain-services.ts";
26
27
  import type { OperationDefinition } from "../module-registry.ts";
27
- import { type OperationInput, optionalNumber, optionalString, string } from "./operation-input.ts";
28
+ import { type OperationInput, optionalBoolean, optionalNumber, optionalString, string } from "./operation-input.ts";
28
29
 
29
30
  const MODULE_ID = "rules";
30
31
 
@@ -79,7 +80,10 @@ export function rulesOperations(artifacts: ArtifactStore, scopes: ArtifactScopeS
79
80
  eventContext(input),
80
81
  ),
81
82
  ),
82
- define("rules.list", (input: OperationInput) => listRules(artifacts, scopes, artifactFilter(input))),
83
+ define("rules.list", (input: OperationInput) => {
84
+ const rules = listRules(artifacts, scopes, artifactFilter(input));
85
+ return optionalBoolean(input, "full") === true ? rules : rules.map(summarizeArtifact);
86
+ }),
83
87
  define("rules.show", (input: OperationInput) => showRule(artifacts, string(input, "id"))),
84
88
  define("rules.preview", (input: OperationInput) => previewRule(artifacts, string(input, "id"))),
85
89
  define("rules.enable", (input: OperationInput) => transitionRule(artifacts, string(input, "id"), "enable", eventContext(input))),