coaia-visualizer 1.6.0 → 1.6.2

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 (58) hide show
  1. package/.dockerignore +9 -0
  2. package/COMPLETE_IMPLEMENTATION_REPORT.md +215 -0
  3. package/QUICK_START_MCP_TESTING.md +236 -0
  4. package/README.md +1 -1
  5. package/README_TELESCOPED_NAVIGATION.md +247 -0
  6. package/STC.md +24 -0
  7. package/STCGOAL.md +0 -0
  8. package/STCISSUE.md +48 -0
  9. package/STCKIN.md +0 -0
  10. package/STCMASTERY.md +0 -0
  11. package/STUDY_REPORT.md +510 -0
  12. package/app/page.tsx +4 -23
  13. package/cli.ts +8 -0
  14. package/components/chart-detail-editable.tsx +3 -2
  15. package/components/chart-detail.tsx +1 -6
  16. package/components/edit-action-step.tsx +0 -2
  17. package/components/metadata-projections.tsx +208 -0
  18. package/components/relation-graph.tsx +27 -91
  19. package/components.json +21 -0
  20. package/direct-test.sh +180 -0
  21. package/dist/cli.js +7 -0
  22. package/dist/skill.js +342 -0
  23. package/docker-compose.test.yml +69 -0
  24. package/index.tsx +0 -26
  25. package/jgwill.coaia-visualizer-8--496dca71-d476-4ac9-ba9f-376add118dd8--260208.txt +2612 -0
  26. package/lib/chart-editor.ts +13 -13
  27. package/lib/jsonl-parser.ts +55 -8
  28. package/lib/jsonl-preservation.ts +405 -0
  29. package/lib/types.ts +32 -15
  30. package/mcp/dist/api-client.d.ts +138 -0
  31. package/mcp/dist/api-client.d.ts.map +1 -0
  32. package/mcp/dist/api-client.js +115 -0
  33. package/mcp/dist/api-client.js.map +1 -0
  34. package/mcp/dist/index.d.ts +2 -0
  35. package/mcp/dist/index.d.ts.map +1 -0
  36. package/mcp/dist/index.js +286 -0
  37. package/mcp/dist/index.js.map +1 -0
  38. package/mcp/dist/tools/index.d.ts +18 -0
  39. package/mcp/dist/tools/index.d.ts.map +1 -0
  40. package/mcp/dist/tools/index.js +322 -0
  41. package/mcp/dist/tools/index.js.map +1 -0
  42. package/mcp/package-lock.json +210 -0
  43. package/package.json +2 -27
  44. package/rispecs/github-project-runtime-memory-integration.spec.md +381 -0
  45. package/skill.ts +385 -0
  46. package/test-data/test-master.jsonl +11 -0
  47. package/test-results/.last-run.json +4 -0
  48. package/test-scripts/README.md +325 -0
  49. package/test-scripts/rich-jsonl-preservation.spec.ts +118 -0
  50. package/test-scripts/run-all-tests.sh +38 -0
  51. package/test-scripts/test-01-basic-operations.sh +87 -0
  52. package/test-scripts/test-02-telescope-creation.sh +91 -0
  53. package/test-scripts/test-03-navigation.sh +87 -0
  54. package/test-scripts/test-global-cli.spec.ts +220 -0
  55. package/test-scripts/verify-global-cli.sh +87 -0
  56. package/tsconfig.json +41 -0
  57. package/components/github-provenance.tsx +0 -226
  58. package/lib/github-provenance.ts +0 -316
@@ -0,0 +1,381 @@
1
+ # 🔮 Future Integration: GitHub Project Runtime-Memory Visualization
2
+
3
+ > How coaia-visualizer COULD render GitHub-Project sync state, project-field
4
+ > provenance, and GitHub-linked action steps so charts produced and synced by
5
+ > the `coaia-github` bridge gain a living "Project lens" without breaking
6
+ > the current rendering pipeline.
7
+
8
+ **Status**: 🔮 FUTURE / ASPIRATIONAL · spec-only · additive
9
+ **Last Updated**: 2026-05-09
10
+ **Framework**: RISE (Reverse-engineer · Intent-extract · Specify · Export)
11
+ **Cross-references**:
12
+ - [`README.md`](./README.md) — visualizer pillars, 4-pass parse, current components
13
+ - [`pde-integration.spec.md`](./pde-integration.spec.md) — companion future spec, PDE source rendering
14
+ - [`planning-integration.spec.md`](./planning-integration.spec.md) — companion future spec, plan source + sync state rendering
15
+ - [`relation-graph-visualization.spec.md`](./relation-graph-visualization.spec.md) — current relation rendering, grouping by `relationType`
16
+ - `coaia-narrative/rispecs/coaia-github/github-project-runtime-memory-schema-bridge.spec.md` — schema-bridge proposal that produces the metadata this spec consumes
17
+ - `coaia-narrative/rispecs/coaia-github/README.md` — canonical Amun field map
18
+ - `coaia-narrative/rispecs/schema-evolution-and-ecosystem-metadata.spec.md` — typed sub-object pattern (`metadata.pde`, `metadata.plan`, `metadata.accountability`, `metadata.source`)
19
+ - mightyeagle worktree proposal: `rispecs/miadi-code/miadi-agent/orchestration-proposals/260509-github-projects-structural-runtime-memory.md`
20
+ - `jgwill/coaia-agent#18` — runtime/visualizer container context (informational; this spec does not depend on it)
21
+
22
+ ---
23
+
24
+ ## 1. Position Among Future-Integration Specs
25
+
26
+ This spec is the third in a small family that all share the same posture:
27
+
28
+ | Spec | Surfaces | Source metadata it reads |
29
+ |---|---|---|
30
+ | `pde-integration.spec.md` | Four-Directions quadrant, PDE provenance breadcrumb, implicit-intent badges, confidence bars | `pde_session` line, `metadata.pde.*` (per schema-evolution spec) |
31
+ | `planning-integration.spec.md` | Plan source badge, parse-confidence color, plan-sync state, source-line link, re-sync action | `metadata.plan.*` |
32
+ | **this spec** — `github-project-runtime-memory-integration.spec.md` | Project source badge, project-field provenance trail, sync-state indicator, project lens switcher, GitHub-linked action step badges | `metadata.github.*`, `metadata.source.system === 'coaia-github'` |
33
+
34
+ The three specs **compose**: a single chart can carry PDE provenance, a
35
+ plan link, and a GitHub Project mirror simultaneously. None of them
36
+ replaces or hides the others. This spec is the GitHub layer of the same
37
+ provenance trail.
38
+
39
+ ---
40
+
41
+ ## 2. Structural Tension
42
+
43
+ ### 2.1 Current Reality
44
+ - coaia-visualizer treats every chart identically. A chart with
45
+ `metadata.github.issue` populated looks the same as a hand-authored
46
+ chart. The 4-pass parse algorithm (`organizeData()`) does not look at
47
+ `metadata.github.*`, `metadata.source.system === 'coaia-github'`, nor at
48
+ any `gh:<owner>/<repo>#<num>` virtual entity Encoding B might produce.
49
+ - coaia-visualizer does not write to GitHub at all. Today this is the
50
+ correct boundary — the visualizer is a renderer, not a bridge — but it
51
+ also means a practitioner inside the visualizer cannot see whether a
52
+ chart they are looking at has drifted from its GitHub Project mirror.
53
+ - The relation graph component groups by `relationType` only. Custom-typed
54
+ relations carrying canonical names like `synced_to_github` (per the
55
+ schema-bridge spec §4) appear as a generic `custom` group with no
56
+ affordance.
57
+ - Issue `jgwill/coaia-agent#18` ships the visualizer alongside
58
+ `coaia-narrative` inside the same `coaia-agent` runtime; that means once
59
+ the GitHub-bridge metadata is being written, the visualizer is the
60
+ natural surface to inspect it.
61
+
62
+ ### 2.2 Desired Outcome
63
+ A chart that has been mirrored to a GitHub Project carries that fact
64
+ **visibly** in the visualizer:
65
+ - A `🪐 Project` source badge appears alongside the existing `🔬 PDE` and
66
+ `📋 Plan` badges.
67
+ - A small sync-state pill (`✅ synced`, `⚠️ diverged`, `❌ conflict`,
68
+ `🌐 project-only`, `📂 chart-only`) sits under the badge.
69
+ - A "Project lens" dropdown lets the practitioner switch between project
70
+ contexts when more than one Project mirrors the same chart.
71
+ - Action steps with their own `metadata.github.issue` show a small issue
72
+ ref badge inline.
73
+ - The relation-graph panel surfaces `synced_to_github` (and adjacent
74
+ bridge relations) under a dedicated section — not buried in `custom`.
75
+ - A provenance trail row at the chart header reads:
76
+ `💬 Original Prompt → 🔬 PDE Decomposition → 📊 STC Chart → 🪐 GitHub Project Item`
77
+ whenever each segment is present.
78
+
79
+ ### 2.3 Tension
80
+ The tension is between **the existing 4-pass parse algorithm** (which
81
+ treats JSONL as a flat stream of entities and relations) and **the new
82
+ provenance dimension** GitHub-bridge metadata adds. Resolution: the parse
83
+ algorithm stays unchanged; rendering reads `metadata.github.*` opportunistically;
84
+ no schema authority moves into the visualizer.
85
+
86
+ ---
87
+
88
+ ## 3. Non-Breaking Posture
89
+
90
+ This spec commits to four invariants:
91
+
92
+ 1. **No change to the 4-pass parse algorithm in `organizeData()`.** New
93
+ visualizer logic reads `metadata.github` after parsing, never during.
94
+ 2. **No new entity-type rendering path.** Encoding B virtual entities
95
+ (`entityType: "custom"`, `name: "gh:<owner>/<repo>#<num>"`) render via
96
+ the existing `custom` entity branch with a new optional badge — they do
97
+ not become first-class chart components.
98
+ 3. **No new relation-type enum reliance.** Bridge relations land via
99
+ `relationType: "custom"` with `metadata.context` carrying the canonical
100
+ name; the visualizer reads `metadata.context` to group them under a
101
+ "GitHub bridge" section. If `coaia-narrative` later promotes those
102
+ names, the visualizer reads the promoted form transparently.
103
+ 4. **No write path to GitHub.** The visualizer never calls `sync_*` tools.
104
+ Re-sync triggers are *advisory UI* (a button) that surface the bridge
105
+ tool name and arguments for the user to invoke through the runtime
106
+ (coaia-agent / coaia-narrative MCP). This mirrors the planning
107
+ integration's "re-sync trigger" affordance.
108
+
109
+ ---
110
+
111
+ ## 4. Visual Surfaces
112
+
113
+ ### 4.1 Project Source Badge
114
+
115
+ Component: `ProjectSourceBadge` (new, sibling to the proposed
116
+ `PdeSourceBadge` and `PlanSourceBadge`).
117
+
118
+ ```
119
+ 🪐 Project: <ownerLogin>/<projectNumber> · <projectTitle> [✅ synced]
120
+ ```
121
+
122
+ | Element | Source | Style |
123
+ |---|---|---|
124
+ | `🪐` icon | constant | `indigo-500` to distinguish from `🔬` (amber, PDE) and `📋` (violet, plan) |
125
+ | project ref | `metadata.github.projectItem.{projectOwner,projectNumber}` | tooltip exposes `itemId`, `url`, `projectTitle` |
126
+ | sync pill | `metadata.github.syncState` | green `synced`, amber `diverged`, red `conflict`, slate `project-only`/`chart-only` |
127
+ | lens switcher | when `metadata.github.projectItems` (plural) is present | small dropdown under the badge |
128
+
129
+ **Trigger**: render only when `metadata.github.issue` exists on the chart
130
+ entity OR when `metadata.source.system === 'coaia-github'` is set.
131
+
132
+ ### 4.2 Issue Ref Badge on Action Steps
133
+
134
+ Component: `ActionStepIssueBadge`.
135
+
136
+ ```
137
+ ☐ Implement field hash routine [🪐 #142]
138
+ ```
139
+
140
+ The badge shows `#<number>` only; tooltip expands to
141
+ `<owner>/<repo>#<number>` and the issue URL. Render when an action_step
142
+ entity has `metadata.github.issue`.
143
+
144
+ ### 4.3 Sync-State Pill (chart and action step)
145
+
146
+ Same pill component reused at chart level (under the project source
147
+ badge) and at action-step level (next to the issue ref badge, only when
148
+ the per-action `metadata.github.syncState` exists). Identical color
149
+ language as the planning-integration sync indicator (§ 1 of
150
+ `planning-integration.spec.md`), so the practitioner reads sync state the
151
+ same way for plans and projects.
152
+
153
+ ### 4.4 Provenance Trail Extension
154
+
155
+ `pde-integration.spec.md` already proposes the breadcrumb component
156
+ `ProvenanceTrail`. This spec extends it with a final segment when GitHub
157
+ metadata is present:
158
+
159
+ ```
160
+ 💬 Original Prompt → 🔬 PDE Decomposition → 📊 STC Chart → 🪐 GitHub Project Item
161
+ ```
162
+
163
+ Each segment remains independently optional. If only PDE and Project
164
+ exist (no plan), the breadcrumb has three segments. Rendering rule: a
165
+ segment appears iff its source metadata exists.
166
+
167
+ ### 4.5 Relation-Graph Section
168
+
169
+ `relation-graph-visualization.spec.md` groups relations by `relationType`.
170
+ Proposed extension: when grouping, peek at `metadata.context` for
171
+ `custom`-typed relations and pull canonical bridge names into a separate
172
+ "GitHub bridge" header section.
173
+
174
+ ```
175
+ [GitHub bridge] (2)
176
+ synced_to_github
177
+ chart_42 → gh:jgwill/coaia-narrative#187 [✅ synced]
178
+ linked_to_issue
179
+ chart_42_action_2 → gh:jgwill/coaia-agent#18 [(unstored)]
180
+ ```
181
+
182
+ This section appears only when at least one bridge relation exists. It
183
+ keeps the existing flat-list rendering for charts with no GitHub metadata
184
+ unchanged.
185
+
186
+ ### 4.6 Project Lens Switcher (multi-lens, deferred shape)
187
+
188
+ When a chart's `metadata.github.projectItems` carries multiple project
189
+ items, the project source badge gains a dropdown that lets the user pick
190
+ which project's lens is "active" in the current visualizer view.
191
+ "Active lens" is a UI state only — it does not change the JSONL. Switching
192
+ lenses changes:
193
+
194
+ - which `projectTitle` and `projectNumber` show in the badge,
195
+ - which `Status` value the visualizer reads (Status is per project-item),
196
+ - which `accountable_to` / `responsible_for` fields the visualizer prefers
197
+ if multiple project items disagree (rare but possible).
198
+
199
+ Default lens: the first item in `projectItems`, OR `projectItem` (singular).
200
+ Deferred until plural form is observed in real JSONL.
201
+
202
+ ---
203
+
204
+ ## 5. Metadata Required From `coaia-narrative`
205
+
206
+ This is the contract the schema-bridge spec must keep. The visualizer can
207
+ do its job iff `metadata.github` follows the schema-bridge spec §3 shape.
208
+ Concretely the visualizer reads, in this order of preference:
209
+
210
+ 1. `entity.metadata?.github?.issue` (canonical)
211
+ 2. `entity.metadata?.sync_target` (deprecated shorthand on chart)
212
+ 3. `entity.metadata?.github_ref` (deprecated shorthand on action step)
213
+
214
+ For sync state:
215
+
216
+ 1. `entity.metadata?.github?.syncState`
217
+ 2. otherwise: visualizer renders no sync pill (silence is data — same
218
+ convention as `coaia-github` field resolution §9).
219
+
220
+ For project context:
221
+
222
+ 1. `entity.metadata?.github?.projectItem`
223
+ 2. `entity.metadata?.github?.projectItems[0]`
224
+ 3. `entity.metadata?.sync_target` (legacy fallback)
225
+
226
+ For source attribution:
227
+
228
+ 1. `entity.metadata?.source?.system === 'coaia-github'` → render
229
+ "Last synced by `coaia-github` (`<toolName>`) at `<lastSyncedAt>`" on hover.
230
+
231
+ The visualizer MUST NOT invent any of the above. If metadata is absent,
232
+ the corresponding surface is absent.
233
+
234
+ ---
235
+
236
+ ## 6. What Is Not Stored in the Visualizer
237
+
238
+ To keep the boundary clean, the visualizer:
239
+
240
+ - Does not cache GitHub responses. Each render reads only what's in JSONL.
241
+ - Does not maintain a separate "project view" data structure. Project lens
242
+ rendering is computed per-render from the chart's `metadata.github.*`.
243
+ - Does not ship API tokens or auth flows. Those live in whichever runtime
244
+ hosts `coaia-github` MCP tools.
245
+ - Does not show "live" GitHub state. If the practitioner needs live state,
246
+ they invoke `sync_project_to_chart` through the runtime; the visualizer
247
+ then reflects the refreshed JSONL on the next reload.
248
+
249
+ This matches the existing pillar from `README.md`: the visualizer is a
250
+ ceremonial instrument for holding tension visible — not a network client.
251
+
252
+ ---
253
+
254
+ ## 7. Connection to `jgwill/coaia-agent#18`
255
+
256
+ Issue #18 ships the visualizer inside the `coaia-agent` runtime so the
257
+ runtime can act as a service. That makes the visualizer the **natural
258
+ surface** to inspect what the GitHub bridge has done. Two specific
259
+ implications:
260
+
261
+ 1. The visualizer process can rely on whatever JSONL `coaia-agent` writes
262
+ (per `pde-stc-session-lifecycle.spec.md` and
263
+ `visualizer-planning-narrative-flow.spec.md`). When `coaia-agent` later
264
+ invokes `coaia-github` MCP tools, the resulting `metadata.github.*`
265
+ appears in the same JSONL the visualizer is already watching (envs
266
+ `COAIAN_MF`, `COAIAV_PORT`, `COAIAV_AUDIO_DIR`).
267
+ 2. The "re-sync trigger" UI (§ 4) sends the canonical MCP tool name and
268
+ arguments back to the runtime. It does not call GitHub directly. This
269
+ keeps the visualizer port-bound (`4421:4321`, `4422:4422`) and free of
270
+ credentials.
271
+
272
+ This spec does not require issue #18 to land before it can be implemented.
273
+ The metadata it consumes can come from any runtime that uses the
274
+ `coaia-github` bridge.
275
+
276
+ ---
277
+
278
+ ## 8. Composition With PDE and Plan Specs (no duplication)
279
+
280
+ | Concern | Owned by |
281
+ |---|---|
282
+ | Four-Directions quadrant view | `pde-integration.spec.md` |
283
+ | Implicit-intent / confidence rendering | `pde-integration.spec.md` |
284
+ | Plan source badge / parse confidence color | `planning-integration.spec.md` |
285
+ | Plan ↔ chart sync indicator | `planning-integration.spec.md` |
286
+ | Project source badge / project field provenance | **this spec** |
287
+ | Project ↔ chart sync indicator | **this spec** |
288
+ | Project lens switcher (multi-perspective) | **this spec** |
289
+ | Provenance trail breadcrumb | `pde-integration.spec.md` (defines), this spec (extends) |
290
+ | Relation-graph rendering | `relation-graph-visualization.spec.md` (defines), this spec (extends with GitHub-bridge section) |
291
+ | 4-pass parse algorithm | `jsonl-parsing-data-types.spec.md` (unchanged) |
292
+
293
+ When two indicators apply (e.g. a chart with both plan-sync state and
294
+ project-sync state), they render side-by-side in the chart header. They
295
+ do not collapse, because they describe different bridges.
296
+
297
+ ---
298
+
299
+ ## 9. First Implementation Slice (3–5 steps)
300
+
301
+ Each step is named with a RISE phase.
302
+
303
+ 1. **Specify**: land this document. Add a row to the `Future Integration
304
+ Specs` section of `README.md` linking it (one-line entry, additive).
305
+ *(Spec-only.)*
306
+ 2. **Reverse-engineer**: read one real `.coaia/pde/<uuid>.jsonl` file
307
+ produced after the schema-bridge spec's §10 step 5 ("smallest end-to-
308
+ end exercise"). Confirm that `metadata.github.*` is present and
309
+ matches the bridge spec §3 shape. If it does not, file findings into
310
+ the bridge spec's open questions before any UI work begins.
311
+ 3. **Intent-extract**: decide which surface lands first. Recommendation:
312
+ project source badge + sync-state pill (§4.1, §4.3). They are the
313
+ smallest visible win and exercise the dual-read fallback in §5.
314
+ 4. **Specify**: write a tight component-level rispec
315
+ `components/project-source-badge.spec.md` here in
316
+ `coaia-visualizer/rispecs/` that names the component shape, props, and
317
+ trigger conditions. *(Still spec-only — implementation is a later
318
+ issue.)*
319
+ 5. **Export**: when steps 2–4 hold, produce a single PR that adds the
320
+ `ProjectSourceBadge` and the sync-state pill, gated behind a feature
321
+ flag (`COAIAV_GITHUB_BRIDGE=1`). The flag protects existing JSONL
322
+ renders from any visual change. Do not ship the lens switcher,
323
+ provenance-trail extension, or relation-graph section in the same PR.
324
+
325
+ Steps 1, 3, and 4 are spec-only. Step 2 is a single-file inspection. Step
326
+ 5 is the smallest UI exercise that does not require the relation-graph
327
+ section or lens switcher.
328
+
329
+ ---
330
+
331
+ ## 10. Quality Criteria
332
+
333
+ - [x] No change required to `jsonl-parsing-data-types.spec.md` or to the
334
+ 4-pass parse algorithm.
335
+ - [x] No new `entityType` reliance. Encoding B virtual entities render via
336
+ the existing `custom` entity branch.
337
+ - [x] No new `relationType` enum reliance. Bridge relations enter via
338
+ `relationType: "custom"` plus `metadata.context`.
339
+ - [x] All UI surfaces are conditional on metadata existence.
340
+ - [x] No write path to GitHub from the visualizer.
341
+ - [x] Composition with `pde-integration.spec.md` and
342
+ `planning-integration.spec.md` is explicit and side-by-side, not
343
+ replacement.
344
+ - [x] Required metadata shape is identical to the bridge spec §3 — no
345
+ visualizer-specific schema.
346
+ - [x] First slice is small enough to ship behind a feature flag.
347
+
348
+ ---
349
+
350
+ ## 11. Open Questions
351
+
352
+ 1. **Color choice for `🪐` Project badge.** Indigo proposed to distinguish
353
+ from PDE-amber and Plan-violet; final choice deferred to the design
354
+ pass that produces real component CSS.
355
+ 2. **What does sync-state `project-only` show on a chart card?**
356
+ Recommendation: render the chart with a slate "ghost" treatment and a
357
+ "Imported from project — chart not yet established" hint. Decision
358
+ deferred until the `sync_project_to_chart` MCP tool ships and produces
359
+ real `project-only` entities.
360
+ 3. **Relation-graph section for bridge relations.** Should
361
+ `synced_to_github` to a virtual `gh:` target render as an external
362
+ node (Encoding B) or as a metadata badge on the chart card (Encoding
363
+ A)? Per bridge spec §4.1, encoding is per-session config — the
364
+ visualizer reads whichever is present.
365
+ 4. **Lens switcher trigger threshold.** Show the dropdown only when
366
+ `projectItems.length >= 2`. When exactly one item exists, render it as
367
+ a flat badge.
368
+
369
+ ---
370
+
371
+ ## 12. Out of Scope (defer)
372
+
373
+ - Writing to GitHub from the visualizer.
374
+ - Live GitHub-state polling, webhooks, or push-triggered re-renders.
375
+ - Project lens switcher implementation (open question §11.4 must close
376
+ first).
377
+ - Authentication, rate-limit, or token refresh UI.
378
+ - Editing of `metadata.github.*` from the visualizer (ownership stays
379
+ with `coaia-github` per bridge spec §8).
380
+ - A "lens entity" rendering pattern beyond the dropdown — see bridge
381
+ spec §4 promotion criterion.