@danypops/pi-papyrus 0.57.7 → 0.57.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.
@@ -42,6 +42,16 @@ export interface ArtifactBrowserConfig {
42
42
  handleAction(choice: string, row: Artifact, ctx: ExtensionCommandContext): Promise<void>;
43
43
  }
44
44
 
45
+ export function artifactActivationEnabled(artifact: Pick<Artifact, "extra">): boolean {
46
+ const activation = artifact.extra.activation;
47
+ return !(
48
+ typeof activation === "object" &&
49
+ activation !== null &&
50
+ !Array.isArray(activation) &&
51
+ (activation as Record<string, unknown>).enabled === false
52
+ );
53
+ }
54
+
45
55
  export function filterArtifactRows(rows: Artifact[], query: string): Artifact[] {
46
56
  const needle = query.trim().toLowerCase();
47
57
  if (!needle) return [...rows];
@@ -930,6 +930,7 @@ export default async function (pi: ExtensionAPI) {
930
930
  project_root: ctx.cwd,
931
931
  applicable: true,
932
932
  activated: true,
933
+ full: true,
933
934
  activation_context: activationContext,
934
935
  session_id: sessionId,
935
936
  limit: PLAYBOOK_BRIDGE_MAX_PLAYBOOKS,
@@ -37,6 +37,7 @@ function slugify(title: string): string {
37
37
  async function activePlaybooks(projectRoot?: string, capabilities: readonly string[] = []): Promise<Artifact[]> {
38
38
  return callService<Record<string, unknown>, Artifact[]>("playbooks.list", {
39
39
  status: "active",
40
+ full: true,
40
41
  limit: PLAYBOOK_BRIDGE_MAX_PLAYBOOKS,
41
42
  ...(projectRoot === undefined
42
43
  ? {}
@@ -1,7 +1,7 @@
1
1
  import type { Artifact } from "@danypops/papyrus";
2
2
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
3
3
  import type { AutocompleteItem } from "@earendil-works/pi-tui";
4
- import { showArtifactBrowser, showArtifactDetails } from "../artifact/artifact-browser.ts";
4
+ import { artifactActivationEnabled, showArtifactBrowser, showArtifactDetails } from "../artifact/artifact-browser.ts";
5
5
  import { PLAYBOOK_STATUS_PRESENTATION } from "../artifact/artifact-status-presentation.ts";
6
6
  import { parseLabelInput } from "../artifact/binder-navigation.ts";
7
7
  import { matchArtifactByName } from "../domain-tools.ts";
@@ -85,7 +85,14 @@ export async function showPlaybooks(ctx: ExtensionCommandContext): Promise<void>
85
85
  presentation: PLAYBOOK_STATUS_PRESENTATION,
86
86
  hierarchical: true,
87
87
  rowMeta: playbookRowMeta,
88
- actions: (playbook) => ["Show details", "Edit", "Invoke", "Link artifact", playbook.status === "active" ? "Disable" : "Enable"],
88
+ actions: (playbook) => [
89
+ "Show details",
90
+ "Edit",
91
+ "Invoke",
92
+ "Toggle activation flag",
93
+ "Link artifact",
94
+ playbook.status === "active" ? "Disable" : "Enable",
95
+ ],
89
96
  handleAction: async (choice, playbook, commandCtx) => {
90
97
  if (choice === "Show details") {
91
98
  await showArtifactDetails(commandCtx, playbook.id, "playbooks.show");
@@ -112,6 +119,13 @@ export async function showPlaybooks(ctx: ExtensionCommandContext): Promise<void>
112
119
  await invokeAndReport(playbook.id, playbook.title, commandCtx);
113
120
  return;
114
121
  }
122
+ if (choice === "Toggle activation flag") {
123
+ const current = await callService<Record<string, unknown>, Artifact>("playbooks.show", { id: playbook.id });
124
+ const enabled = artifactActivationEnabled(current);
125
+ await callService("playbooks.update", { id: playbook.id, activation_enabled: !enabled });
126
+ commandCtx.ui.notify(`${current.title} activation ${enabled ? "paused" : "resumed"}`, "info");
127
+ return;
128
+ }
115
129
  if (choice === "Link artifact") {
116
130
  const targetId = await commandCtx.ui.input("Target artifact id:", "");
117
131
  if (!targetId) return;
@@ -1,6 +1,6 @@
1
1
  import type { Artifact } from "@danypops/papyrus";
2
2
  import type { ExtensionCommandContext, Theme } from "@earendil-works/pi-coding-agent";
3
- import { showArtifactBrowser, showArtifactDetails } from "../artifact/artifact-browser.ts";
3
+ import { artifactActivationEnabled, showArtifactBrowser, showArtifactDetails } from "../artifact/artifact-browser.ts";
4
4
  import { RULE_STATUS_PRESENTATION, severityColor } from "../artifact/artifact-status-presentation.ts";
5
5
  import { parseLabelInput } from "../artifact/binder-navigation.ts";
6
6
  import { callService } from "../service-client.ts";
@@ -27,7 +27,14 @@ export async function showRules(ctx: ExtensionCommandContext): Promise<void> {
27
27
  presentation: RULE_STATUS_PRESENTATION,
28
28
  hierarchical: true,
29
29
  rowMeta: ruleRowMeta,
30
- actions: (rule) => ["Show details", "Edit", "Preview injection", "Link gated task", rule.status === "active" ? "Disable" : "Enable"],
30
+ actions: (rule) => [
31
+ "Show details",
32
+ "Edit",
33
+ "Preview injection",
34
+ "Toggle activation flag",
35
+ "Link gated task",
36
+ rule.status === "active" ? "Disable" : "Enable",
37
+ ],
31
38
  handleAction: async (choice, rule, commandCtx) => {
32
39
  if (choice === "Show details") await showArtifactDetails(commandCtx, rule.id, "rules.show");
33
40
  else if (choice === "Edit") {
@@ -52,6 +59,11 @@ export async function showRules(ctx: ExtensionCommandContext): Promise<void> {
52
59
  );
53
60
  const text = result.warning === undefined ? result.preview : `${result.preview}\n\n⚠ ${result.warning}`;
54
61
  commandCtx.ui.notify(text, result.warning === undefined ? "info" : "warning");
62
+ } else if (choice === "Toggle activation flag") {
63
+ const current = await callService<Record<string, unknown>, Artifact>("rules.show", { id: rule.id });
64
+ const enabled = artifactActivationEnabled(current);
65
+ await callService("rules.update", { id: rule.id, activation_enabled: !enabled });
66
+ commandCtx.ui.notify(`${current.title} activation ${enabled ? "paused" : "resumed"}`, "info");
55
67
  } else if (choice === "Link gated task") {
56
68
  const taskId = await commandCtx.ui.input("Task artifact id:", "");
57
69
  if (taskId) await callService("rules.gate", { id: rule.id, task_id: taskId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/pi-papyrus",
3
- "version": "0.57.7",
3
+ "version": "0.57.9",
4
4
  "description": "Pi host extension for Papyrus: native tools, TUI panels, and context injection over the daemon-backed graph store",
5
5
  "type": "module",
6
6
  "keywords": ["pi-package"],
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@danypops/jittor": "^0.19.2",
22
- "@danypops/papyrus": "^0.60.6",
22
+ "@danypops/papyrus": "^0.60.7",
23
23
  "@danypops/vehicle-client": "^0.10.3",
24
24
  "@danypops/vehicle-core": "^0.18.5",
25
25
  "@danypops/vehicle-server": "^0.25.2",