coaia-visualizer 1.6.1 โ 1.6.3
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/README.md +1 -1
- package/app/page.tsx +4 -23
- package/components/chart-detail-editable.tsx +3 -0
- package/components/metadata-projections.tsx +208 -0
- package/lib/chart-editor.ts +13 -13
- package/lib/jsonl-parser.ts +55 -8
- package/lib/jsonl-preservation.ts +405 -0
- package/lib/types.ts +30 -0
- package/package.json +31 -1
- package/.dockerignore +0 -9
- package/COMPLETE_IMPLEMENTATION_REPORT.md +0 -215
- package/Dockerfile +0 -61
- package/Dockerfile.app +0 -50
- package/QUICK_START_MCP_TESTING.md +0 -236
- package/STC.md +0 -18
- package/STCGOAL.md +0 -0
- package/STCISSUE.md +0 -36
- package/STCKIN.md +0 -0
- package/STCMASTERY.md +0 -0
- package/STUDY_REPORT.md +0 -510
- package/direct-test.sh +0 -180
- package/docker-build-push.sh +0 -20
- package/docker-compose.test.yml +0 -69
- package/docker-entrypoint.sh +0 -27
- package/jgwill.coaia-visualizer-8--496dca71-d476-4ac9-ba9f-376add118dd8--260208.txt +0 -2612
- package/mcp/test_mcp/.gemini/settings.json +0 -18
- package/rispecs/README.md +0 -170
- package/rispecs/accountability-responsibility.rispec.md +0 -110
- package/rispecs/api-mcp-interface.spec.md +0 -287
- package/rispecs/app.spec.md +0 -364
- package/rispecs/chart-editing-workflow.spec.md +0 -297
- package/rispecs/chart-visualization-hierarchy.spec.md +0 -235
- package/rispecs/cli-mode.spec.md +0 -224
- package/rispecs/github-project-runtime-memory-integration.spec.md +0 -381
- package/rispecs/jsonl-parsing-data-types.spec.md +0 -243
- package/rispecs/narrative-beats-display.spec.md +0 -189
- package/rispecs/pde-integration.spec.md +0 -280
- package/rispecs/planning-integration.spec.md +0 -329
- package/rispecs/relation-graph-visualization.spec.md +0 -171
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +0 -65
- package/rispecs/ui-component-library.spec.md +0 -258
- package/test-data/test-master.jsonl +0 -11
- package/test-scripts/README.md +0 -325
- package/test-scripts/run-all-tests.sh +0 -38
- package/test-scripts/test-01-basic-operations.sh +0 -87
- package/test-scripts/test-02-telescope-creation.sh +0 -91
- package/test-scripts/test-03-navigation.sh +0 -87
- package/test-scripts/test-global-cli.spec.ts +0 -220
- package/test-scripts/verify-global-cli.sh +0 -87
|
@@ -1,381 +0,0 @@
|
|
|
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.
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
# JSONL Parsing & Data Types
|
|
2
|
-
## RISE Specification for Data Ingestion and Type System
|
|
3
|
-
|
|
4
|
-
**Component Purpose**: Transform flat JSONL text into structured chart hierarchies through a 4-pass parsing algorithm, backed by a rigorous Entity/Relation type system that models structural tension.
|
|
5
|
-
|
|
6
|
-
**Source Files**: `lib/types.ts`, `lib/jsonl-parser.ts`
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## ๐ฏ What This Component Enables Users to Create
|
|
11
|
-
|
|
12
|
-
- Structured, navigable chart hierarchies from raw JSONL text files
|
|
13
|
-
- Knowledge graphs with typed entities and relational connections
|
|
14
|
-
- Telescoped parent-child chart hierarchies with automatic nesting
|
|
15
|
-
- Resilient data structures that gracefully handle malformed input
|
|
16
|
-
- Round-trip serialization: JSONL โ ParsedData โ JSONL without data loss
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## ๐ Structural Tension Dynamics
|
|
21
|
-
|
|
22
|
-
### Current Reality
|
|
23
|
-
- coaia-narrative outputs flat JSONL files โ one JSON object per line, no hierarchical structure
|
|
24
|
-
- Each line is either an entity (5 types) or a relation (4 types)
|
|
25
|
-
- Chart hierarchy exists only implicitly through naming conventions and metadata
|
|
26
|
-
- Entity names follow patterns like `chart_1_desired_outcome` that encode relationships
|
|
27
|
-
- Telescoped charts reference parents via `metadata.parentChart`
|
|
28
|
-
|
|
29
|
-
### Desired Result
|
|
30
|
-
- A fully assembled `ParsedData` structure where:
|
|
31
|
-
- Each `Chart` object contains its desired outcome, current reality, actions, and narrative beats
|
|
32
|
-
- Sub-charts are nested within their parent's `subCharts` array
|
|
33
|
-
- Root charts (level 0) are separately available for top-level navigation
|
|
34
|
-
- All entities are accessible by name via a Map
|
|
35
|
-
- All relations are collected in a flat array for graph operations
|
|
36
|
-
|
|
37
|
-
### Natural Resolution
|
|
38
|
-
The 4-pass `organizeData()` algorithm progressively builds structure from flat records, each pass resolving one layer of complexity until the full hierarchy emerges.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## ๐ Type System
|
|
43
|
-
|
|
44
|
-
### EntityRecord
|
|
45
|
-
```typescript
|
|
46
|
-
interface EntityRecord {
|
|
47
|
-
type: "entity"
|
|
48
|
-
name: string // Unique identifier, e.g. "chart_1_desired_outcome"
|
|
49
|
-
entityType:
|
|
50
|
-
| "structural_tension_chart" // Root chart container
|
|
51
|
-
| "desired_outcome" // What the user wants to create
|
|
52
|
-
| "current_reality" // Honest assessment of what is
|
|
53
|
-
| "action_step" // Step toward desired outcome
|
|
54
|
-
| "narrative_beat" // Story documentation
|
|
55
|
-
observations: string[] // Array of text descriptions
|
|
56
|
-
metadata: Record<string, any> // chartId, level, dueDate, completionStatus, timestamps
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### RelationRecord
|
|
61
|
-
```typescript
|
|
62
|
-
interface RelationRecord {
|
|
63
|
-
type: "relation"
|
|
64
|
-
from: string // Source entity name
|
|
65
|
-
to: string // Target entity name
|
|
66
|
-
relationType:
|
|
67
|
-
| "contains" // Chart contains outcome/reality/action
|
|
68
|
-
| "creates_tension_with" // Reality creates tension with outcome
|
|
69
|
-
| "advances_toward" // Action/sub-chart advances toward parent outcome
|
|
70
|
-
| "documents" // Beat documents chart activity
|
|
71
|
-
metadata: Record<string, any> // createdAt timestamp
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Chart (Assembled)
|
|
76
|
-
```typescript
|
|
77
|
-
interface Chart {
|
|
78
|
-
id: string // e.g. "chart_1"
|
|
79
|
-
chartEntity: EntityRecord // The structural_tension_chart entity
|
|
80
|
-
desiredOutcome?: EntityRecord // Optional desired_outcome entity
|
|
81
|
-
currentReality?: EntityRecord // Optional current_reality entity
|
|
82
|
-
actions: EntityRecord[] // Array of action_step entities
|
|
83
|
-
narrativeBeats: EntityRecord[] // Array of narrative_beat entities
|
|
84
|
-
subCharts: Chart[] // Telescoped child charts
|
|
85
|
-
level: number // 0 = root, 1+ = sub-chart depth
|
|
86
|
-
parentChart?: string // Parent chart ID reference
|
|
87
|
-
relations: RelationRecord[] // Relations scoped to this chart
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### ParsedData (Top-Level)
|
|
92
|
-
```typescript
|
|
93
|
-
interface ParsedData {
|
|
94
|
-
charts: Chart[] // All chart objects
|
|
95
|
-
entities: Map<string, EntityRecord> // All entities by name
|
|
96
|
-
relations: RelationRecord[] // All relations
|
|
97
|
-
rootCharts: Chart[] // Level 0 charts only
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## ๐ Parsing Algorithm: `parseJSONL(content: string): JSONLRecord[]`
|
|
104
|
-
|
|
105
|
-
**Input**: Raw JSONL text (multi-line string)
|
|
106
|
-
**Output**: Array of validated JSONLRecord objects
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
1. Split content by newlines
|
|
110
|
-
2. For each line:
|
|
111
|
-
a. Trim whitespace
|
|
112
|
-
b. Skip empty lines
|
|
113
|
-
c. Attempt JSON.parse()
|
|
114
|
-
d. If parse succeeds โ include in result
|
|
115
|
-
e. If parse fails โ log error via console.error("Failed to parse line:", line, error) and skip
|
|
116
|
-
3. Return array of parsed records
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Resilience**: Malformed lines never crash the parser โ they are logged via `console.error` and skipped. This allows partial files and hand-edited JSONL to be safely ingested.
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## ๐ Organization Algorithm: `organizeData(records: JSONLRecord[]): ParsedData`
|
|
124
|
-
|
|
125
|
-
**Input**: Flat array of entity and relation records
|
|
126
|
-
**Output**: Fully assembled ParsedData with chart hierarchy
|
|
127
|
-
|
|
128
|
-
### Pass 1: Separate Records
|
|
129
|
-
```
|
|
130
|
-
For each record:
|
|
131
|
-
If record.type === "entity" โ add to entities Map (keyed by name)
|
|
132
|
-
If record.type === "relation" โ add to relations array
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Pass 2: Assemble Chart Shells
|
|
136
|
-
```
|
|
137
|
-
For each entity where entityType === "structural_tension_chart":
|
|
138
|
-
Extract chartId from metadata.chartId OR entity.name.replace("_chart", "")
|
|
139
|
-
Create Chart object with:
|
|
140
|
-
- id = chartId
|
|
141
|
-
- chartEntity = this entity
|
|
142
|
-
- level = metadata.level || 0
|
|
143
|
-
- parentChart = metadata.parentChart (with "_chart" suffix stripped)
|
|
144
|
-
- Empty arrays for actions, narrativeBeats, subCharts, relations
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Pass 3: Populate Chart Components
|
|
148
|
-
```
|
|
149
|
-
For each entity (non-chart):
|
|
150
|
-
Extract chartId from name prefix (regex /^(chart_\d+)/)
|
|
151
|
-
Find matching chart
|
|
152
|
-
Based on entityType:
|
|
153
|
-
"desired_outcome" โ chart.desiredOutcome = entity
|
|
154
|
-
"current_reality" โ chart.currentReality = entity
|
|
155
|
-
"action_step" โ chart.actions.push(entity)
|
|
156
|
-
"narrative_beat" โ chart.narrativeBeats.push(entity)
|
|
157
|
-
|
|
158
|
-
Collect relations where from or to references this chart's entities
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Pass 3.5: Recognize Telescoped Charts as Parent Actions
|
|
162
|
-
```
|
|
163
|
-
For each chart where level > 0 AND parentChart exists AND desiredOutcome exists:
|
|
164
|
-
Find parent chart by normalizing parentChart reference
|
|
165
|
-
If parent found:
|
|
166
|
-
Create synthetic action entity from chart's desiredOutcome with:
|
|
167
|
-
- isTelescopedChart = true
|
|
168
|
-
- telescopedChartId = this chart's ID
|
|
169
|
-
- completionStatus from chart metadata
|
|
170
|
-
- dueDate from chart metadata
|
|
171
|
-
Add to parent's actions (if not already present by name)
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Pass 4: Build Hierarchy
|
|
175
|
-
```
|
|
176
|
-
For each chart where level > 0:
|
|
177
|
-
Find parent chart by parentChart reference
|
|
178
|
-
If parent found:
|
|
179
|
-
parent.subCharts.push(this chart)
|
|
180
|
-
|
|
181
|
-
Identify rootCharts = charts where level === 0 OR parentChart is undefined/null
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
## ๐ Helper Functions
|
|
187
|
-
|
|
188
|
-
### `getChartSummary(chart: Chart): string`
|
|
189
|
-
Returns first observation of desiredOutcome, truncated to 100 characters with "..." suffix.
|
|
190
|
-
Falls back to "No desired outcome" if absent.
|
|
191
|
-
|
|
192
|
-
### `getChartProgress(chart: Chart): number`
|
|
193
|
-
Calculates `(completedActions / totalActions) * 100`, rounded to nearest integer.
|
|
194
|
-
Returns 0 when no actions exist.
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
## ๐ File Upload & Export
|
|
199
|
-
|
|
200
|
-
### Upload Flow
|
|
201
|
-
1. `FileUpload` component accepts `.jsonl` and `.txt` files via click or drag-drop
|
|
202
|
-
2. `FileReader` API reads file contents as text
|
|
203
|
-
3. `parseJSONL()` โ `organizeData()` โ `ParsedData` delivered to parent component
|
|
204
|
-
4. Toast notification confirms successful load with chart count
|
|
205
|
-
|
|
206
|
-
### Export Flow
|
|
207
|
-
1. `ChartEditor.exportToJSONL()` serializes all entities and relations
|
|
208
|
-
2. One JSON object per line (JSONL format)
|
|
209
|
-
3. Entities first, then relations
|
|
210
|
-
4. Result available as downloadable blob or POST body to API
|
|
211
|
-
|
|
212
|
-
### Live Reload (useLivePolling hook)
|
|
213
|
-
1. When `NEXT_PUBLIC_LIVE_MODE=true`, polls `/api/watch` at configurable interval
|
|
214
|
-
2. Compares `beatCount` with cached value
|
|
215
|
-
3. If count increased โ triggers full data reload from filesystem
|
|
216
|
-
4. `isLive` flag flashes the LiveIndicator component for 2 seconds
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## โ
Quality Criteria
|
|
221
|
-
|
|
222
|
-
โ
**Parse Resilience**
|
|
223
|
-
- Malformed JSONL lines never throw โ they are logged via `console.error` and skipped
|
|
224
|
-
- Empty lines and whitespace-only lines are filtered
|
|
225
|
-
- Partial files produce partial but valid ParsedData
|
|
226
|
-
|
|
227
|
-
โ
**Hierarchy Integrity**
|
|
228
|
-
- Every sub-chart references its parent correctly
|
|
229
|
-
- Telescoped actions appear in parent's action list with `isTelescopedChart` flag
|
|
230
|
-
- Root charts always identified correctly (level 0)
|
|
231
|
-
|
|
232
|
-
โ
**Round-Trip Fidelity**
|
|
233
|
-
- `parseJSONL(exportToJSONL(data))` produces equivalent ParsedData
|
|
234
|
-
- All metadata timestamps preserved through serialization
|
|
235
|
-
- Entity names and relation references maintain referential integrity
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
## ๐ Related Components
|
|
240
|
-
|
|
241
|
-
- [chart-visualization-hierarchy.spec.md](./chart-visualization-hierarchy.spec.md) โ consumes ParsedData for display
|
|
242
|
-
- [chart-editing-workflow.spec.md](./chart-editing-workflow.spec.md) โ mutates entities and relations via ChartEditor
|
|
243
|
-
- [api-mcp-interface.spec.md](./api-mcp-interface.spec.md) โ serves and receives ParsedData over HTTP
|