@danypops/papyrus 0.21.6 → 0.23.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.
@@ -10,7 +10,7 @@
10
10
  * into this module or introducing a premature "modules call each other through the
11
11
  * registry" convention.
12
12
  */
13
- import { assignRuleProject, createRule, gateTaskWithRule, listRules, previewRule, showRule, transitionRule } from "../domain-services.ts";
13
+ import { assignRuleProject, createRule, gateTaskWithRule, listRules, previewRule, showRule, transitionRule, updateRule } from "../domain-services.ts";
14
14
  import type { OperationDefinition } from "../module-registry.ts";
15
15
  import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
16
16
  import type { ArtifactStore } from "../ports/artifact-store.ts";
@@ -55,7 +55,7 @@ const artifactFilter = (input: OperationInput) => ({
55
55
  /** Registers every rules.* operation except rules.injectable (see module comment). Behavior is unchanged from the prior inline handlers in src/service.ts. */
56
56
  /** This module's own operation names, the single source of truth src/service.ts's EXPECTED_OPERATION_NAMES spreads in rather than re-listing by hand. rules.injectable is deliberately absent -- see the module comment above. */
57
57
  export const RULES_OPERATION_NAMES = [
58
- "rules.create", "rules.list", "rules.show", "rules.preview", "rules.enable", "rules.disable", "rules.gate", "rules.assign_project",
58
+ "rules.create", "rules.list", "rules.show", "rules.preview", "rules.enable", "rules.disable", "rules.gate", "rules.assign_project", "rules.update",
59
59
  ] as const;
60
60
 
61
61
  export function rulesOperations(artifacts: ArtifactStore, scopes: ArtifactScopeStore): OperationDefinition[] {
@@ -77,5 +77,8 @@ export function rulesOperations(artifacts: ArtifactStore, scopes: ArtifactScopeS
77
77
  define("rules.disable", (input: OperationInput) => transitionRule(artifacts, string(input, "id"), "disable", eventContext(input))),
78
78
  define("rules.gate", (input: OperationInput) => gateTaskWithRule(artifacts, string(input, "id"), string(input, "task_id"), eventContext(input))),
79
79
  define("rules.assign_project", (input: OperationInput) => assignRuleProject(artifacts, scopes, string(input, "id"), optionalString(input, "project_root"))),
80
+ define("rules.update", (input: OperationInput) => updateRule(artifacts, string(input, "id"), {
81
+ title: optionalString(input, "title"), body: optionalString(input, "body"), labels: input["labels"] as string[] | undefined,
82
+ }, eventContext(input))),
80
83
  ];
81
84
  }
@@ -17,7 +17,7 @@
17
17
  * extraction.
18
18
  */
19
19
  import type { AuthorityRegistry } from "../authority-registry.ts";
20
- import { assignSkillProject, createArtifactTemplate, createSkill, listSkills, showSkill, skillInvocation, transitionSkill } from "../domain-services.ts";
20
+ import { assignSkillProject, createArtifactTemplate, createSkill, listSkills, showSkill, skillInvocation, transitionSkill, updateSkill } from "../domain-services.ts";
21
21
  import type { OperationDefinition } from "../module-registry.ts";
22
22
  import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
23
23
  import type { ArtifactStore } from "../ports/artifact-store.ts";
@@ -79,7 +79,7 @@ export interface SkillsModuleDeps {
79
79
  /** Registers every skills.* operation except skills.instantiate (see module comment). Behavior is unchanged from the prior inline handlers in src/service.ts. */
80
80
  /** This module's own operation names, the single source of truth src/service.ts's EXPECTED_OPERATION_NAMES spreads in rather than re-listing by hand. skills.instantiate is deliberately absent -- see the module comment above. */
81
81
  export const SKILLS_OPERATION_NAMES = [
82
- "skills.create", "skills.create_template", "skills.list", "skills.show", "skills.invoke", "skills.run", "skills.enable", "skills.disable", "skills.assign_project",
82
+ "skills.create", "skills.create_template", "skills.list", "skills.show", "skills.invoke", "skills.run", "skills.enable", "skills.disable", "skills.assign_project", "skills.update",
83
83
  ] as const;
84
84
 
85
85
  export function skillsOperations({ artifacts, events, scopes, artifactScopes, authority }: SkillsModuleDeps): OperationDefinition[] {
@@ -109,5 +109,8 @@ export function skillsOperations({ artifacts, events, scopes, artifactScopes, au
109
109
  define("skills.enable", (input: OperationInput) => transitionSkill(artifacts, string(input, "id"), "enable", eventContext(input))),
110
110
  define("skills.disable", (input: OperationInput) => transitionSkill(artifacts, string(input, "id"), "disable", eventContext(input))),
111
111
  define("skills.assign_project", (input: OperationInput) => assignSkillProject(artifacts, artifactScopes, string(input, "id"), optionalString(input, "project_root"))),
112
+ define("skills.update", (input: OperationInput) => updateSkill(artifacts, string(input, "id"), {
113
+ title: optionalString(input, "title"), body: optionalString(input, "body"), labels: input["labels"] as string[] | undefined,
114
+ }, eventContext(input))),
112
115
  ];
113
116
  }
package/src/service.ts CHANGED
@@ -33,6 +33,7 @@ import { logsOperations, LOGS_OPERATION_NAMES } from "./modules/logs.ts";
33
33
  import { notesOperations, NOTES_OPERATION_NAMES } from "./modules/notes.ts";
34
34
  import { rulesOperations, RULES_OPERATION_NAMES } from "./modules/rules.ts";
35
35
  import { skillsOperations, SKILLS_OPERATION_NAMES } from "./modules/skills.ts";
36
+ import { playbooksOperations, PLAYBOOKS_OPERATION_NAMES } from "./modules/playbooks.ts";
36
37
  import { sessionIdentityOperations, SESSION_IDENTITY_OPERATION_NAMES } from "./modules/session-identity.ts";
37
38
  import { discussOperations, DISCUSS_OPERATION_NAMES } from "./modules/discuss.ts";
38
39
  import { tasksOperations, TASKS_OPERATION_NAMES } from "./modules/tasks.ts";
@@ -73,6 +74,7 @@ export const EXPECTED_OPERATION_NAMES = [
73
74
  ...NOTES_OPERATION_NAMES,
74
75
  ...RULES_OPERATION_NAMES,
75
76
  ...SKILLS_OPERATION_NAMES,
77
+ ...PLAYBOOKS_OPERATION_NAMES,
76
78
  ...GRAPH_PROJECTION_OPERATION_NAMES,
77
79
  ...LOGS_OPERATION_NAMES,
78
80
  ...SESSION_IDENTITY_OPERATION_NAMES,
@@ -144,6 +146,7 @@ const notesAuthorityClaim: AuthorityClaim = {
144
146
  denyMessage: (action) => {
145
147
  if (action === "link") return "note relationships require a notes.* operation so disposition provenance is preserved";
146
148
  if (action === "status") return "note lifecycle changes require a notes.* operation so disposition provenance is preserved";
149
+ if (action === "update") return "note content changes require a notes.* operation so disposition provenance is preserved";
147
150
  return "note creation requires notes.capture";
148
151
  },
149
152
  };
@@ -341,6 +344,7 @@ function handlers(
341
344
  "docs.reopen": forwardToModule("docs.reopen"),
342
345
  "docs.link": forwardToModule("docs.link"),
343
346
  "docs.assign_project": forwardToModule("docs.assign_project"),
347
+ "docs.update": forwardToModule("docs.update"),
344
348
  "notes.capture": forwardToModule("notes.capture"),
345
349
  "notes.list": forwardToModule("notes.list"),
346
350
  "notes.show": forwardToModule("notes.show"),
@@ -355,6 +359,7 @@ function handlers(
355
359
  "rules.disable": forwardToModule("rules.disable"),
356
360
  "rules.gate": forwardToModule("rules.gate"),
357
361
  "rules.assign_project": forwardToModule("rules.assign_project"),
362
+ "rules.update": forwardToModule("rules.update"),
358
363
  "skills.create": forwardToModule("skills.create"),
359
364
  "skills.create_template": forwardToModule("skills.create_template"),
360
365
  "skills.list": forwardToModule("skills.list"),
@@ -364,6 +369,15 @@ function handlers(
364
369
  "skills.enable": forwardToModule("skills.enable"),
365
370
  "skills.disable": forwardToModule("skills.disable"),
366
371
  "skills.assign_project": forwardToModule("skills.assign_project"),
372
+ "skills.update": forwardToModule("skills.update"),
373
+ "playbooks.create": forwardToModule("playbooks.create"),
374
+ "playbooks.list": forwardToModule("playbooks.list"),
375
+ "playbooks.show": forwardToModule("playbooks.show"),
376
+ "playbooks.invoke": forwardToModule("playbooks.invoke"),
377
+ "playbooks.enable": forwardToModule("playbooks.enable"),
378
+ "playbooks.disable": forwardToModule("playbooks.disable"),
379
+ "playbooks.assign_project": forwardToModule("playbooks.assign_project"),
380
+ "playbooks.update": forwardToModule("playbooks.update"),
367
381
  "skills.instantiate": (input) => {
368
382
  const templateId = string(input, "template_id");
369
383
  const template = artifacts.get(templateId);
@@ -425,6 +439,7 @@ export function createPapyrusService(path: string): PapyrusService {
425
439
  moduleRegistry.registerAll(docsOperations(artifacts, artifactScopes, authority));
426
440
  moduleRegistry.registerAll(rulesOperations(artifacts, artifactScopes));
427
441
  moduleRegistry.registerAll(skillsOperations({ artifacts, events, scopes, artifactScopes, authority }));
442
+ moduleRegistry.registerAll(playbooksOperations(artifacts, artifactScopes));
428
443
  moduleRegistry.registerAll(graphProjectionOperations(artifacts, projections, authority));
429
444
  const registry = handlers(artifacts, gates, tasks, notes, events, scopes, () => migrateDb(db), moduleRegistry, authority);
430
445
  const state = (): SchemaState => {