@gtheys/pi-flow 0.0.0-stage → 0.2.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.
Files changed (164) hide show
  1. package/README.md +833 -2
  2. package/adhoc/tracker.ts +360 -0
  3. package/aven/client.ts +996 -0
  4. package/aven/status.ts +395 -0
  5. package/brainstorm/args.ts +24 -0
  6. package/brainstorm/artifact.ts +67 -0
  7. package/brainstorm/paths.ts +43 -0
  8. package/brainstorm/prompt.ts +172 -0
  9. package/brainstorm/refs.ts +41 -0
  10. package/config.schema.json +161 -0
  11. package/config.ts +577 -0
  12. package/feedback/args.ts +21 -0
  13. package/feedback/prompt.ts +177 -0
  14. package/feedback/triage.ts +88 -0
  15. package/flow/agent-role.ts +46 -0
  16. package/flow/answer-wake.ts +212 -0
  17. package/flow/answer.ts +183 -0
  18. package/flow/args.ts +48 -0
  19. package/flow/ask-emitter.ts +331 -0
  20. package/flow/attribution.ts +145 -0
  21. package/flow/aven-resolve-exec.ts +95 -0
  22. package/flow/aven-resolve.ts +80 -0
  23. package/flow/awaiting-approval.ts +32 -0
  24. package/flow/binding-heal.ts +68 -0
  25. package/flow/cost-autopush.ts +162 -0
  26. package/flow/cost-command.ts +122 -0
  27. package/flow/cost-rows-journal.ts +296 -0
  28. package/flow/cost-rows-push.ts +112 -0
  29. package/flow/cost-rows-rows.ts +209 -0
  30. package/flow/cost-rows.ts +228 -0
  31. package/flow/cost.ts +173 -0
  32. package/flow/durable-refs.ts +287 -0
  33. package/flow/effect-gate.ts +137 -0
  34. package/flow/ensure-labels.ts +44 -0
  35. package/flow/frame.ts +172 -0
  36. package/flow/gates.ts +211 -0
  37. package/flow/jira-ref.ts +212 -0
  38. package/flow/label-gate.ts +149 -0
  39. package/flow/land-gate.ts +98 -0
  40. package/flow/lifecycle-policy.ts +162 -0
  41. package/flow/live-wait.ts +52 -0
  42. package/flow/liveness.ts +408 -0
  43. package/flow/loop-deps.ts +210 -0
  44. package/flow/loop-settle.ts +531 -0
  45. package/flow/loop.ts +437 -0
  46. package/flow/orchestrate.ts +45 -0
  47. package/flow/phase-command.ts +287 -0
  48. package/flow/phase-emoji.ts +13 -0
  49. package/flow/phase-prompts.ts +251 -0
  50. package/flow/picker.ts +307 -0
  51. package/flow/push.ts +475 -0
  52. package/flow/reconcile-command.ts +253 -0
  53. package/flow/reconcile-deps.ts +329 -0
  54. package/flow/reconcile.ts +738 -0
  55. package/flow/ref-kind.ts +80 -0
  56. package/flow/resume-picker.ts +222 -0
  57. package/flow/resume.ts +116 -0
  58. package/flow/run-health.ts +252 -0
  59. package/flow/run-liveness.ts +33 -0
  60. package/flow/state-metrics.ts +559 -0
  61. package/flow/status.ts +105 -0
  62. package/flow/step-output.ts +416 -0
  63. package/flow/steps.ts +73 -0
  64. package/flow/terminal-purge.ts +281 -0
  65. package/flow/turn-generation.ts +19 -0
  66. package/flow/v2-emission.ts +381 -0
  67. package/flow/v2-resume.ts +100 -0
  68. package/flow/vocabulary.ts +261 -0
  69. package/flow/widget.ts +448 -0
  70. package/flow/worktree-context.ts +136 -0
  71. package/flow-diagram/assemble.ts +27 -0
  72. package/flow-diagram/command.ts +252 -0
  73. package/flow-diagram/translate.ts +862 -0
  74. package/flow-diagram/vendor/harness-profiler/LICENSE +21 -0
  75. package/flow-diagram/vendor/harness-profiler/PIN.md +64 -0
  76. package/flow-diagram/vendor/harness-profiler/hp.js +960 -0
  77. package/flow-diagram/vendor/harness-profiler/load.ts +66 -0
  78. package/flow-diagram/vendor/harness-profiler/view.html +436 -0
  79. package/gates.ts +20 -0
  80. package/herdr/sync.ts +355 -0
  81. package/herdr/viewer.ts +432 -0
  82. package/implement/args.ts +21 -0
  83. package/implement/prompt.ts +98 -0
  84. package/implement/retry.ts +57 -0
  85. package/implement/routing.ts +31 -0
  86. package/index.ts +3206 -0
  87. package/mode-profile.ts +56 -0
  88. package/package.json +205 -4
  89. package/phase-state.ts +18 -0
  90. package/plan/args.ts +20 -0
  91. package/plan/prompt.ts +251 -0
  92. package/plan/size-check.ts +46 -0
  93. package/plan-tools/helpers.ts +177 -0
  94. package/plan-tools/jira-branch-tool.ts +54 -0
  95. package/plan-tools/jira-branch.ts +109 -0
  96. package/plan-tools/jira-issue.ts +85 -0
  97. package/plan-tools/resolve-feature-path.ts +30 -0
  98. package/plan-tools/resolve-notes-path.ts +37 -0
  99. package/plan-tools/resolve-spec-path.ts +31 -0
  100. package/pr-quality/index.ts +908 -0
  101. package/review/LICENSE +19 -0
  102. package/review/deviation.ts +252 -0
  103. package/review/review.ts +3053 -0
  104. package/review/sem-guidance.d.mts +8 -0
  105. package/review/sem-guidance.mjs +89 -0
  106. package/review/verdict.ts +13 -0
  107. package/run-state.ts +2046 -0
  108. package/run-title.ts +91 -0
  109. package/server/consumer.ts +146 -0
  110. package/server/daemon.ts +1094 -0
  111. package/server/lifecycle.ts +679 -0
  112. package/server/pending.ts +267 -0
  113. package/server/staleness.ts +320 -0
  114. package/server/writer.ts +86 -0
  115. package/shared/diff-base.ts +138 -0
  116. package/shared/flow-base.ts +210 -0
  117. package/shared/sonarqube-utils.ts +415 -0
  118. package/shared/stable-range.ts +102 -0
  119. package/slugify.ts +13 -0
  120. package/sonarqube/sonarqube.ts +821 -0
  121. package/spec-review/approve.ts +91 -0
  122. package/spec-review/args.ts +21 -0
  123. package/spec-review/aven-spec.ts +142 -0
  124. package/spec-review/commands.ts +336 -0
  125. package/spec-review/escape-regexp.ts +7 -0
  126. package/spec-review/open-in-pane.ts +166 -0
  127. package/spec-review/picker.ts +74 -0
  128. package/spec-review/prompt.ts +72 -0
  129. package/spec-review/publish-args.ts +33 -0
  130. package/spec-review/publish.ts +210 -0
  131. package/telemetry/attributes.ts +118 -0
  132. package/telemetry/content.ts +140 -0
  133. package/telemetry/dispatch.ts +521 -0
  134. package/telemetry/exporter.ts +124 -0
  135. package/telemetry/index.ts +776 -0
  136. package/telemetry/loki.ts +224 -0
  137. package/tools/code-review-parse.ts +518 -0
  138. package/tools/code-review.ts +312 -0
  139. package/tools/deviation.ts +737 -0
  140. package/tools/flow-submit.ts +302 -0
  141. package/tools/land.ts +608 -0
  142. package/tools/phase-complete.ts +476 -0
  143. package/tools/result.ts +18 -0
  144. package/tools/review-deps.ts +44 -0
  145. package/tools/run-attempt.ts +312 -0
  146. package/tools/spec-approve.ts +265 -0
  147. package/validate/args.ts +22 -0
  148. package/validate/deviation-gate.ts +229 -0
  149. package/validate/gate-target.ts +371 -0
  150. package/validate/gate.ts +79 -0
  151. package/validate/paths.ts +20 -0
  152. package/validate/personal.ts +104 -0
  153. package/validate/prompt.ts +525 -0
  154. package/validate/review-gate.ts +134 -0
  155. package/validate/subtask-range.ts +113 -0
  156. package/work-mode.ts +19 -0
  157. package/worktree/bootstrap.ts +243 -0
  158. package/worktree/branch.ts +168 -0
  159. package/worktree/herdr.ts +447 -0
  160. package/worktree/index.ts +1447 -0
  161. package/worktree/orphan.ts +384 -0
  162. package/worktree/remove-guards.ts +99 -0
  163. package/worktree/residue.ts +216 -0
  164. package/worktree/sweep.ts +526 -0
@@ -0,0 +1,172 @@
1
+ // AIDEV-NOTE: Prompt handed to the pi agent via sendUserMessage after the
2
+ // command resolves args/mode/path. The agent drives the question loop
3
+ // (ask_user_question), scouts (subagent tool from pi-interactive-subagents),
4
+ // writes the artifact, then runs the ticket-creation gate. Routing-only reuse
5
+ // of the user's debug skill (referenced by name, never imported).
6
+ // Ticket research (brainstorm/refs.ts classified a jira-shaped ref) SKIPS the
7
+ // creation gate: the ticket exists — aven epic first, acli fallback.
8
+
9
+ export interface PromptInput {
10
+ kind: 'feature' | 'debug'
11
+ input: string
12
+ artifactPath: string
13
+ mode: 'work' | 'personal'
14
+ }
15
+
16
+ export interface TicketPromptInput {
17
+ jiraId: string
18
+ /** Where the ticket content lives. epic = local epic (jira-ref) — the
19
+ * confirmed ticket; synced = aven synced ticket (jira-key). null = not
20
+ * aven-managed, acli fallback. */
21
+ target: { kind: 'epic' | 'synced'; ref: string } | null
22
+ artifactPath: string
23
+ mode: 'work' | 'personal'
24
+ }
25
+
26
+ // AIDEV-NOTE: the metadata key stays 'research-path' (NOT 'brainstorm-path')
27
+ // despite the /research -> /brainstorm rename (PMR-H7RW): existing tickets
28
+ // already carry 'research-path' and the artifact is still a research
29
+ // artifact conceptually. Renaming would orphan them.
30
+ // AIDEV-NOTE (PMR-VQ6R): personal mode must VERIFY the aven destination with
31
+ // aven itself before proposing (doctor/list/project list) — the PMR-3E1Z
32
+ // brainstorm proposed a workspace from memory ("personal" instead of the
33
+ // routed "projects"). Keep the verification commands and the explicit
34
+ // --workspace/--project fallback in the gate text.
35
+ const GATE_INSTRUCTIONS = `
36
+ TICKET CREATION GATE — after the artifact is written:
37
+ 1. Use the ask_user_question tool to propose a ticket destination and require an
38
+ explicit "Confirm" before anything is created. Propose:
39
+ - work mode: the Jira project (pick the most likely project key, let the user
40
+ confirm or override).
41
+ - personal mode: the aven workspace AND project (a named project may exist in
42
+ several workspaces — confirm both). VERIFY the destination with aven itself
43
+ BEFORE proposing — never from memory or repo-location conventions:
44
+ - \`aven doctor\` — the "Workspace" section prints the active workspace
45
+ (e.g. "ok active workspace projects (projects)").
46
+ - \`aven list 2>&1 | head -1\` — the scope line (printed on stderr) shows
47
+ the resolved project.
48
+ - \`aven project list\` — confirms the project exists in that workspace.
49
+ The proposal shown to the user must state what aven resolved, and ticket
50
+ creation passes --workspace/--project explicitly when the resolved target
51
+ differs from the intended one.
52
+ 2. ONLY if the user explicitly confirms, create the ticket:
53
+ - work mode: acli jira workitem create in the confirmed project.
54
+ - personal mode: aven ticket create in the confirmed workspace+project.
55
+ 3. Set the type label at creation: "bug" for debug flow, "feature" for the
56
+ feature flow (default).
57
+ 4. Record the confirmation: aven tickets get a note "confirmed by user,
58
+ destination <destination>"; for Jira tickets append a line
59
+ "> confirmed by user, destination <destination>" to the artifact header.
60
+ 5. Link the research artifact on aven tickets (personal mode): run
61
+ \`aven edit <ref> --metadata research-path=<absolute artifact path>\` so a
62
+ later /validate can read the findings from the ticket itself. Jira tickets
63
+ instead record provenance in the artifact header — Jira has no metadata
64
+ fields to write.
65
+ 6. If the user declines, create nothing and say so.
66
+ NEVER call acli or aven create before the explicit confirm answer.
67
+
68
+ COMPLETION — the brainstorm is done when the artifact is written and the gate
69
+ is answered. Brainstorming no longer lands a lifecycle label (PMR-Z2K7);
70
+ /flow and /plan gate on the "planned" label instead. If the gate declined
71
+ ticket creation, skip this.`
72
+
73
+ // AIDEV-NOTE: scout fan-out contract — codegraph MCP, when available, must
74
+ // be initialized and fresh (codegraph init on "not initialized", then sync)
75
+ // and named in scout tasks so scouts use codegraph_explore instead of a
76
+ // ripgrep-only sweep.
77
+ const CODEGRAPH_INSTRUCTIONS = `
78
+ CODEGRAPH — before spawning scouts: if the mcp__codegraph__codegraph_explore
79
+ tool is available, run "codegraph sync" (bash) in the repo so the index is
80
+ current. If sync fails with "CodeGraph not initialized", run "codegraph init
81
+ -y" once, then sync again. Then mention in each scout task that
82
+ codegraph_explore is available and preferred for code search. If the tool is
83
+ not available, skip this and let scouts fall back to ripgrep.`
84
+
85
+ // AIDEV-NOTE: shared feature steps so the topic flow and the ticket flow can
86
+ // never drift on the loop/scouts/artifact instructions.
87
+ function featureSteps(artifactPath: string): string {
88
+ return `1. Use the ask_user_question tool in a loop, one question at a time, until the
89
+ mechanism, scope, and constraints are understood.
90
+ 2. Spawn scout subagents (subagent tool, in parallel) to map the relevant code
91
+ and report findings.
92
+ ${CODEGRAPH_INSTRUCTIONS}
93
+ 3. Write a markdown artifact to: ${artifactPath}
94
+ Sections: Questions (with answers), Findings, Diagrams (mermaid code fences
95
+ for architecture/data/flow diagrams), Ticket implications (what the future
96
+ ticket must contain: scope, risks, touched areas).`
97
+ }
98
+
99
+ export function buildBrainstormPrompt(input: PromptInput): string {
100
+ const header = `Brainstorm phase. Mode: ${input.mode}.`
101
+ if (input.kind === 'debug') {
102
+ return `${header}
103
+ Debug flow: symptom = "${input.input}".
104
+
105
+ Drive the user's existing debug skill (invoke /engineering:debug) to find the
106
+ root cause of the symptom. Follow its workflow; use ask_user_question whenever
107
+ you need information from the user.
108
+
109
+ When the root cause is understood:
110
+ 1. Optionally spawn scout subagents (subagent tool, parallel) to gather
111
+ evidence from the codebase.
112
+ ${CODEGRAPH_INSTRUCTIONS}
113
+ 2. Write a markdown artifact to: ${input.artifactPath}
114
+ Sections: Questions, Findings, Hypothesis chain (ordered hypotheses with
115
+ the root cause marked), Evidence (logs, traces, code refs).
116
+ ${GATE_INSTRUCTIONS}`
117
+ }
118
+ return `${header}
119
+ Feature flow: topic = "${input.input}".
120
+
121
+ Understand the mechanism before proposing anything:
122
+ ${featureSteps(input.artifactPath)}
123
+ ${GATE_INSTRUCTIONS}`
124
+ }
125
+
126
+ export function buildTicketBrainstormPrompt(input: TicketPromptInput): string {
127
+ const header = `Brainstorm phase. Mode: ${input.mode}. Ticket: ${input.jiraId}.`
128
+ const noCreate = `The ticket already exists. Do NOT run the ticket-creation gate and do
129
+ NOT create anything.
130
+
131
+ Brief: fetch the brainstorm subject FIRST. Quote its summary/description in the
132
+ artifact's Ticket section.`
133
+ if (input.target !== null) {
134
+ const isEpic = input.target.kind === 'epic'
135
+ const source = isEpic
136
+ ? `The ticket exists as local epic ${input.target.ref} (jira-ref metadata,
137
+ dep-linked to the synced Jira ticket).
138
+ ${noCreate}
139
+ Run \`aven show ${input.target.ref} --json\` and take the dep-linked synced
140
+ ticket ref from \`epic_children\`, then \`aven show <synced-ref> --full\` for
141
+ its description — plain --json output has no description field.
142
+ \`acli jira workitem view ${input.jiraId}\` also works when you want the live
143
+ Jira view.`
144
+ : `The ticket exists as synced aven ticket ${input.target.ref} (jira-key
145
+ metadata — the Jira content was synced into it).
146
+ ${noCreate}
147
+ Run \`aven show ${input.target.ref} --full\` — the synced description is in
148
+ there (plain --json output has no description field). The content is already
149
+ in aven — no Jira fetch needed.`
150
+ // AIDEV-NOTE: PMR-Z2K7 - no flow_phase_complete call here anymore:
151
+ // research left the lifecycle, so completion is just the artifact.
152
+ // AIDEV-NOTE (PMR-85RV): the "> brainstormed by pi-flow" marker
153
+ // instruction is gone with the dead /flow pull-in rediscovery contract.
154
+ const completion = `COMPLETION - the brainstorm phase is done when the artifact is written.`
155
+ return `${header}
156
+ ${source}
157
+
158
+ ${featureSteps(input.artifactPath)}
159
+
160
+ ${completion}`
161
+ }
162
+ return `${header}
163
+ The ticket exists in Jira but is not aven-managed (no local epic and no
164
+ synced ticket).
165
+ ${noCreate}
166
+ Run \`acli jira workitem view ${input.jiraId}\`. If that fails, stop and
167
+ report the failure — do not guess the contents and do not create any ticket.
168
+
169
+ ${featureSteps(input.artifactPath)}
170
+
171
+ COMPLETION — the brainstorm phase is done when the artifact is written.`
172
+ }
@@ -0,0 +1,41 @@
1
+ // AIDEV-NOTE: Pure /brainstorm ticket-ref classification — unit-testable
2
+ // without pi. Shared by the /brainstorm command and the /flow loop via
3
+ // brainstormPrompt, so a human invocation and a flow-driven one can never
4
+ // drift. Same Jira-ID pattern as flow/args.ts (duplication deliberate —
5
+ // that file owns /flow parsing, this owns /brainstorm targets).
6
+ import { MODE_PROFILE } from '../mode-profile.ts'
7
+
8
+ export type BrainstormTarget =
9
+ | { kind: 'topic'; text: string }
10
+ | { kind: 'ticket'; jiraId: string }
11
+
12
+ const JIRA_ID_RE = /^([a-zA-Z][a-zA-Z0-9]+)-(\d+)$/
13
+
14
+ export interface ClassifyInput {
15
+ /** 'force': text is a known Jira ID (ID= prefix or /flow jira kind). */
16
+ force: boolean
17
+ /** 'explicit': text came from a bare /brainstorm topic argument. */
18
+ explicit: boolean
19
+ mode: 'work' | 'personal'
20
+ }
21
+
22
+ // AIDEV-NOTE: bare jira-shaped refs auto-detect ONLY in work mode — in
23
+ // personal repos an aven ref (e.g. PMR-5900) matches the same pattern, so
24
+ // bare stays topic there (PMR-PCVK ambiguity). ID= forces the ticket path
25
+ // everywhere as the escape hatch. The mode rule is data: mode-profile.ts.
26
+ export function classifyBrainstormTarget(
27
+ text: string,
28
+ opts: ClassifyInput,
29
+ ): BrainstormTarget {
30
+ const trimmed = text.trim()
31
+ if (opts.force) {
32
+ return { kind: 'ticket', jiraId: trimmed.toUpperCase() }
33
+ }
34
+ if (!JIRA_ID_RE.test(trimmed)) {
35
+ return { kind: 'topic', text: trimmed }
36
+ }
37
+ if (opts.explicit && MODE_PROFILE[opts.mode].acceptsJiraRefs) {
38
+ return { kind: 'ticket', jiraId: trimmed.toUpperCase() }
39
+ }
40
+ return { kind: 'topic', text: trimmed }
41
+ }
@@ -0,0 +1,161 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "pi-flow Extension Config",
4
+ "type": "object",
5
+ "properties": {
6
+ "$schema": {
7
+ "type": "string"
8
+ },
9
+ "workRoots": {
10
+ "type": "array",
11
+ "description": "Git toplevels under any prefix are \"work\" mode. The first entry is also the parent of the sh-devctl repo: the /validate gate resolves its scripts as <workRoot>/sh-devctl/scripts.",
12
+ "items": {
13
+ "type": "string",
14
+ "description": "Absolute path prefix of a work repo root"
15
+ },
16
+ "minItems": 0
17
+ },
18
+ "avenWorkspace": {
19
+ "type": "string",
20
+ "description": "Aven workspace name or key forced on every aven call pi-flow makes (skips cwd inference and the search fallback)."
21
+ },
22
+ "yolo": {
23
+ "type": "boolean",
24
+ "description": "Run /flow phases without confirmation gates (personal mode only — work-mode runs refuse yolo at loop start). Only applies when the --yolo flag is absent on the /flow invocation — an explicit flag wins over config"
25
+ },
26
+ "viewerPlacement": {
27
+ "type": "string",
28
+ "enum": ["right", "below", "left", "above", "tab"],
29
+ "description": "Default Herdr pane placement for /flow-view when no placement argument is given"
30
+ },
31
+ "landTestCommand": {
32
+ "type": "array",
33
+ "description": "Argv of the test command flow_land runs before authorizing a landing (default [\"bun\",\"run\",\"test\"]). PMR-05HX: the landing gate never trusts a claimed-green suite.",
34
+ "items": { "type": "string" },
35
+ "minItems": 1
36
+ },
37
+ "telemetry": {
38
+ "type": "object",
39
+ "description": "Optional OTLP telemetry export (PMR-R8AG)",
40
+ "properties": {
41
+ "enabled": {
42
+ "type": "boolean",
43
+ "description": "Master switch — telemetry subscribes to nothing when false/absent (PMR-R8AG)"
44
+ },
45
+ "otlpEndpoint": {
46
+ "type": "string",
47
+ "description": "OTLP/HTTP base URL (e.g. https://host:4478); spans POST to <endpoint>/v1/traces. Required when telemetry.enabled is true (PMR-VSST); omit for a loki-only setup"
48
+ },
49
+ "headers": {
50
+ "type": "object",
51
+ "description": "Static extra headers for OTLP export. Secrets belong in env (PI_FLOW_OTLP_TOKEN), not config",
52
+ "additionalProperties": { "type": "string" }
53
+ },
54
+ "captureContent": {
55
+ "type": "string",
56
+ "enum": ["off", "text", "tools", "all"],
57
+ "description": "Content captured on spans (cumulative): off = metadata only (default), text = assistant text, tools = + tool calls the model made and tool input/output, all = + model reasoning. Captured content can contain secrets and lands in the trace backend"
58
+ },
59
+ "jiraBaseUrl": {
60
+ "type": "string",
61
+ "description": "Base URL for Jira issue links, e.g. https://example.atlassian.net/browse/ — work-mode spans then carry flow.url = <base><jira key> so dashboards can link tickets. Absent = no links"
62
+ },
63
+ "maxContentChars": {
64
+ "type": "integer",
65
+ "minimum": 100,
66
+ "maximum": 100000,
67
+ "description": "Max characters per captured content attribute (default 2000). Tempo truncates attribute values beyond max_attribute_bytes (default 2048) silently — raise both together"
68
+ },
69
+ "loki": {
70
+ "type": "object",
71
+ "description": "Optional Loki transition-event stream, session-side only (PMR-ZV9Y 4.2)",
72
+ "properties": {
73
+ "enabled": {
74
+ "type": "boolean",
75
+ "default": false,
76
+ "description": "Push flow transition-event streams to Loki. Default false (disabled — zero network calls)"
77
+ },
78
+ "endpoint": {
79
+ "type": "string",
80
+ "description": "Loki base URL (user-provided, e.g. http://loki.example.com:3100); events POST to <endpoint>/loki/api/v1/push. Required with telemetry.loki.enabled"
81
+ },
82
+ "headers": {
83
+ "type": "object",
84
+ "description": "Static extra headers for the Loki push. Secrets belong in env, not config",
85
+ "additionalProperties": { "type": "string" }
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ }
90
+ },
91
+ "required": ["enabled"],
92
+ "additionalProperties": false
93
+ },
94
+ "notify": {
95
+ "type": "object",
96
+ "description": "Flow-state notifications (PMR-ZV9Y 5.2). The desktop channel pages on waiting_human / halted transitions through the desktop-notify extension (rifle-batteries); Grafana alerting is the independent second channel (paused/muted in Grafana).",
97
+ "properties": {
98
+ "desktop": {
99
+ "type": "object",
100
+ "description": "Desktop channel via @gtheys/rifle-batteries/notify (optional dependency — absent package degrades to one journal note)",
101
+ "properties": {
102
+ "enabled": {
103
+ "type": "boolean",
104
+ "default": true,
105
+ "description": "Send a desktop notification on waiting_human / halted flow transitions through the desktop-notify extension (rifle-batteries). Default true (opt-out)"
106
+ }
107
+ },
108
+ "additionalProperties": false
109
+ }
110
+ },
111
+ "additionalProperties": false
112
+ },
113
+ "runServer": {
114
+ "type": "object",
115
+ "description": "Durable run server (daemon) settings",
116
+ "properties": {
117
+ "enabled": {
118
+ "type": "boolean",
119
+ "description": "Kill switch for the durable run server (PMR-XTQQ). false = never spawn the daemon and journal writers permanently use today’s full in-session path. Default true"
120
+ }
121
+ },
122
+ "additionalProperties": false
123
+ },
124
+ "reconcile": {
125
+ "type": "object",
126
+ "description": "Pushgateway liveness reconcile (PMR-V36Y). Tombstones the v2 pi_flow_state / pi_flow_state_start_seconds series (state halted/waiting_human/waiting_machine -> stale) whose aven ticket is not live (neither active nor todo), so the alerts stop firing on closed runs.",
127
+ "properties": {
128
+ "enabled": {
129
+ "type": "boolean",
130
+ "description": "Reconcile stale run-liveness metrics (tombstone the v2 pi_flow_state series whose aven ticket is not live (neither active nor todo): state halted/waiting_human/waiting_machine becomes stale). Default true"
131
+ },
132
+ "intervalMinutes": {
133
+ "type": "integer",
134
+ "minimum": 1,
135
+ "description": "Daemon reconcile interval in minutes. Default 360 (6h)"
136
+ }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "liveness": {
141
+ "type": "object",
142
+ "description": "Run-liveness pushes while flows are in flight (PMR-8MQH). Every interval the daemon stamps the current loop state of each running flow onto its v2 pi_flow_state{state=\"running\"} series (via the shared buildPushBody render), so `running` alerts and dashboards reflect a live loop instead of the last journal write.",
143
+ "properties": {
144
+ "enabled": {
145
+ "type": "boolean",
146
+ "default": true,
147
+ "description": "Push run-liveness metrics for flows in flight. Default true"
148
+ },
149
+ "intervalMinutes": {
150
+ "type": "integer",
151
+ "minimum": 1,
152
+ "default": 5,
153
+ "description": "Daemon liveness push interval in minutes. Default 5. An interval change applies on the next cycle — no daemon restart needed"
154
+ }
155
+ },
156
+ "additionalProperties": false
157
+ }
158
+ },
159
+ "required": ["workRoots"],
160
+ "additionalProperties": false
161
+ }