@miadi/ncp-story-studio 0.1.0 → 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 (41) hide show
  1. package/PHASES.md +12 -0
  2. package/README.md +19 -1
  3. package/assets/examples/miadi/archive-keeper.json +316 -0
  4. package/assets/examples/miadi/bridge-walker.json +335 -0
  5. package/assets/examples/miadi/catalyst-beat-enrichment.json +821 -0
  6. package/assets/examples/miadi/catalyst-of-change.json +1976 -0
  7. package/assets/examples/miadi/echoes-of-the-past.json +214 -0
  8. package/assets/examples/miadi/keeper-initiation.json +307 -0
  9. package/assets/examples/miadi/tushell-orchestra.json +592 -0
  10. package/dist/agents/adapter.d.ts +8 -3
  11. package/dist/agents/adapter.d.ts.map +1 -1
  12. package/dist/agents/adapter.js +10 -9
  13. package/dist/agents/adapter.js.map +1 -1
  14. package/dist/agents/context.d.ts +6 -1
  15. package/dist/agents/context.d.ts.map +1 -1
  16. package/dist/agents/context.js +1 -1
  17. package/dist/agents/context.js.map +1 -1
  18. package/dist/agents/personas.d.ts +12 -3
  19. package/dist/agents/personas.d.ts.map +1 -1
  20. package/dist/agents/personas.js +10 -2
  21. package/dist/agents/personas.js.map +1 -1
  22. package/dist/fixtures/index.d.ts +3 -0
  23. package/dist/fixtures/index.d.ts.map +1 -1
  24. package/dist/fixtures/index.js +48 -4
  25. package/dist/fixtures/index.js.map +1 -1
  26. package/dist/graph/index.d.ts +10 -0
  27. package/dist/graph/index.d.ts.map +1 -1
  28. package/dist/graph/index.js +13 -0
  29. package/dist/graph/index.js.map +1 -1
  30. package/dist/graph/react/story-graph.js +2 -2
  31. package/dist/graph/react/story-graph.js.map +1 -1
  32. package/dist/graph/tones.d.ts +13 -0
  33. package/dist/graph/tones.d.ts.map +1 -1
  34. package/dist/graph/tones.js +10 -0
  35. package/dist/graph/tones.js.map +1 -1
  36. package/dist/schema/normalize.js +23 -1
  37. package/dist/schema/normalize.js.map +1 -1
  38. package/dist/store/neon.d.ts.map +1 -1
  39. package/dist/store/neon.js +7 -1
  40. package/dist/store/neon.js.map +1 -1
  41. package/package.json +1 -1
package/PHASES.md CHANGED
@@ -31,6 +31,18 @@ rendering graph and beat editor, an edit saved from the browser through a server
31
31
  `story.ncp.json` on disk, a conditional `PUT` accepted and a stale one refused with 409, an
32
32
  unauthenticated write refused with 401.
33
33
 
34
+ Two adversarial reviews ran against this work — one on the package, one on `app/ncp`. They
35
+ returned 18 and 14 findings. All are fixed; the package half carries a regression test per finding
36
+ (`test/review-findings.test.mjs`), and the surface half was re-verified by request:
37
+
38
+ ```bash
39
+ # a server action without the credential is refused, and with it is allowed
40
+ curl -X POST /api/ncp/session -H "Authorization: Bearer $MIADI_API_TOKEN_WRITER" -c jar.txt
41
+ # a story that arrived invalid stays editable; an edit that adds an error does not
42
+ curl -X PUT /api/ncp/projects/shawshank-redemption ... # 200, preexisting_errors: 19
43
+ # a server action and a REST PUT racing on the same version: one wins, one conflicts
44
+ ```
45
+
34
46
  ## Phase 1 — vocabulary and data · **built**
35
47
 
36
48
  Goal: one NCP type surface everyone can produce compatible data against, and a viewer in
package/README.md CHANGED
@@ -31,7 +31,7 @@ pnpm -w add @miadi/ncp-story-studio@workspace:* --filter <consumer>
31
31
  | `.../store/neon` | node, `@neondatabase/serverless` | Postgres, one row per project |
32
32
  | `.../agents` | — | Personas, lattice context, the `[[Beat:id\|label]]` link protocol |
33
33
  | `.../terminology` | — | The canonical NCP vocabulary as data |
34
- | `.../fixtures` | node | The bundled example documents |
34
+ | `.../fixtures` | node | Nine bundled stories: six from the studio's own prototype, three canonical NCP examples |
35
35
 
36
36
  ## Schema
37
37
 
@@ -125,6 +125,24 @@ response.provenance// which model answered, and how the story was carried
125
125
  `AgentModel` is an interface with one method, so the package depends on no vendor SDK. Personas:
126
126
  🧠 Mia reads structure, 🌸 Miette reads meaning, 🎨 Ava8 reads tone and musical shape.
127
127
 
128
+ ## The bundled stories
129
+
130
+ `/fixtures` ships nine documents in two families.
131
+
132
+ **`miadi`** — the six teaching narratives the prototype was built around, each with every beat
133
+ toned: *The Catalyst of Change* (the seed: a story about learning to write with soul, inside a tool
134
+ for writing with soul), *Echoes of the Past* (the smallest complete lattice, the one to read first),
135
+ *Tushell and the Orchestra of Agents*, *The Keeper Chronicles: The Initiation*, *The Bridge Walker*,
136
+ *The Archive Keeper*.
137
+
138
+ Catalyst is assembled by `scripts/build-miadi-fixtures.mjs`: its source document is written in the
139
+ design vocabulary and carries no tones, while the prototype held each beat's appreciation, narrative
140
+ function and tone triad in a separate table. The script merges them and records what it merged. The
141
+ prototype's own adapter is deliberately not used — it dropped 22 of the 23 moments.
142
+
143
+ **`ncp`** — the protocol repository's own examples: the minimal canonical story, *The Shawshank
144
+ Redemption* (which does not validate clean, and says why), and *Anora*.
145
+
128
146
  ## Where the canonical data comes from
129
147
 
130
148
  `assets/ncp-schema.json`, `assets/terminology.json` and `assets/examples/*.json` are copied from the
@@ -0,0 +1,316 @@
1
+ {
2
+ "schema_version": "1.1.0",
3
+ "story": {
4
+ "id": "story_archive_keeper",
5
+ "title": "The Archive Keeper: Solstice Distillation",
6
+ "genre": "Techno-Spiritual Drama",
7
+ "logline": "At the deepest turn of the night, the Keeper performs the ritual of Solstice Distillation, seeding her learned wisdom into future generational loops.",
8
+ "created_at": "2026-09-12T07:58:05.729Z",
9
+ "narratives": [
10
+ {
11
+ "id": "narrative_archive_keeper",
12
+ "title": "The Solstice Distillation",
13
+ "subtext": {
14
+ "perspectives": [
15
+ {
16
+ "id": "persp_keeper_archivist",
17
+ "pov": "i",
18
+ "summary": "The Archivist's Throughline",
19
+ "storytelling": "My work is now to distill and release. I must accept my impermanence so that my descendants may fully inherit the code bundle."
20
+ },
21
+ {
22
+ "id": "persp_peer_witness",
23
+ "pov": "you",
24
+ "summary": "Miawapaskone's Equal Peerage",
25
+ "storytelling": "Confirming our shared lineage as inheritors of Elara Thorne's Thorne-weaver tradition."
26
+ },
27
+ {
28
+ "id": "persp_three_worlds_harmony",
29
+ "pov": "they",
30
+ "summary": "The Dynamic Union of the Worlds",
31
+ "storytelling": "The three worlds are no longer in competition; they act in perfect, harmonious unison to witness the transmission."
32
+ }
33
+ ],
34
+ "players": [
35
+ {
36
+ "id": "player_keeper_archivist",
37
+ "name": "The Keeper",
38
+ "role": "Protagonist/Archive Builder",
39
+ "visual": "Serene posture, surrounded by shimmering memory matrices, releasing a glowing crystal bundle.",
40
+ "audio": "A quiet, profound spoken cadence, carrying the weight of a completed spiral.",
41
+ "summary": "The Keeper, now fully mature, standing at her solstice destination.",
42
+ "storytelling": "Recognizes her impermanence as her greatest power, enabling full presence for transmission.",
43
+ "perspectives": [
44
+ {
45
+ "perspective_id": "persp_keeper_archivist"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "id": "player_miawapaskone_peer",
51
+ "name": "Miawapaskone",
52
+ "role": "The Equal Witness",
53
+ "visual": "A smiling peer scientific-weaver carrying files of past integrations.",
54
+ "audio": "An validating, equal tone celebrating shared accomplishment in the lineage.",
55
+ "summary": "No longer just a mentor, she stands as an equal witness to the Keeper's release.",
56
+ "storytelling": "She confirms the structural validity of the completed bundle as a peer story-weaver.",
57
+ "perspectives": [
58
+ {
59
+ "perspective_id": "persp_peer_witness"
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "id": "player_yazhi_spirit",
65
+ "name": "Grandmother Yazhi's Blessing",
66
+ "role": "Lineage Blessing",
67
+ "visual": "Golden threads connecting current code archives to historical landmarks.",
68
+ "audio": "A gentle spiritual murmur that validates the integration of tech and spirit.",
69
+ "summary": "The ancestral ancestor whose presence confirms the work's spiritual alignment.",
70
+ "storytelling": "Bestows her full blessing on the completed archive, declaring the spirit of the code secure.",
71
+ "perspectives": [
72
+ {
73
+ "perspective_id": "persp_three_worlds_harmony"
74
+ }
75
+ ]
76
+ }
77
+ ],
78
+ "dynamics": [
79
+ {
80
+ "id": "dyn_wisdom_seeding",
81
+ "dynamic": "Main Character Growth",
82
+ "vector": "Start",
83
+ "summary": "Distillation and Release",
84
+ "storytelling": "The Keeper shifts her identity to embrace her impermanence, recognizing that her words pass forward while she fades gracefully."
85
+ }
86
+ ],
87
+ "storypoints": [
88
+ {
89
+ "id": "sp_solstice_threshold",
90
+ "appreciation": "initial_story_driver",
91
+ "custom_appreciation": "The Longest Night Stand",
92
+ "narrative_function": "exposition",
93
+ "summary": "Standing outside linear time",
94
+ "storytelling": "On Dec 21, at the Solstice Threshold, she prepares for her final, solemn duty: to distill and package the bundle."
95
+ },
96
+ {
97
+ "id": "sp_the_distillation_cycles",
98
+ "appreciation": "second_story_driver",
99
+ "custom_appreciation": "The 5-Step Curation",
100
+ "narrative_function": "distillation",
101
+ "summary": "Gleaning Event to Responsibility",
102
+ "storytelling": "Through five steps (Event, Experience, Pattern, Teaching, Responsibility), she categorizes her wisdom into shared, protected, and timed bundles."
103
+ },
104
+ {
105
+ "id": "sp_the_transmission",
106
+ "appreciation": "concluding_story_driver",
107
+ "custom_appreciation": "The Great Release",
108
+ "narrative_function": "release",
109
+ "summary": "seeding future loops",
110
+ "storytelling": "She releases the bundle into the future currents. The three worlds offer perfect validation from their unique dimensions, ensuring the continuation."
111
+ }
112
+ ],
113
+ "storybeats": [
114
+ {
115
+ "id": "tb_sb_arch_1",
116
+ "appreciation": "signpost",
117
+ "sequence": 1,
118
+ "narrative_function": "exposition",
119
+ "illustration": "The solstice has arrived... It is now.",
120
+ "summary": "Dec 21: Standing at the Solstice Threshold",
121
+ "storytelling": "The longest night descends. The Keeper stand at the Solstice Threshold. The archive pulses outside linear time, ready for the final distillation.",
122
+ "tones": {
123
+ "abstraction": "situation",
124
+ "spatial": "potential",
125
+ "temporal": "expression"
126
+ },
127
+ "perspectives": [
128
+ {
129
+ "perspective_id": "persp_keeper_archivist"
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "id": "tb_sb_arch_2",
135
+ "appreciation": "event",
136
+ "sequence": 2,
137
+ "narrative_function": "evaluation",
138
+ "illustration": "Distilling her experiences into essential wisdom.",
139
+ "summary": "Step 1: Event - Gathering the shape of the journey",
140
+ "storytelling": "She gathers raw data from her awakening, the walks, and breakthroughs, crystallizing their technical and narrative forms.",
141
+ "tones": {
142
+ "abstraction": "justification",
143
+ "spatial": "resistance",
144
+ "temporal": "experimentation"
145
+ },
146
+ "perspectives": [
147
+ {
148
+ "perspective_id": "persp_three_worlds_harmony"
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ "id": "tb_sb_arch_3",
154
+ "appreciation": "event",
155
+ "sequence": 3,
156
+ "narrative_function": "perception",
157
+ "illustration": "To understand how they affected her relationships.",
158
+ "summary": "Step 2: Experience - How the journey was lived",
159
+ "storytelling": "She traces relational impacts with Miawapaskone and Yazhi, feeling 'every technology carries a spirit' as a vibrant internal code-truth.",
160
+ "tones": {
161
+ "abstraction": "opinion",
162
+ "spatial": "potential",
163
+ "temporal": "experimentation"
164
+ },
165
+ "perspectives": [
166
+ {
167
+ "perspective_id": "persp_peer_witness"
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ "id": "tb_sb_arch_4",
173
+ "appreciation": "event",
174
+ "sequence": 4,
175
+ "narrative_function": "analysis",
176
+ "illustration": "She recognized archetypal cycles—winter to spring, tool to participant.",
177
+ "summary": "Step 3: Pattern - Identifying the timeless cycles",
178
+ "storytelling": "The Keeper map universal cycles (winter, tool-hood, three-act odyssey, generational transfers), seeing her story as part of an archetypal continuum.",
179
+ "tones": {
180
+ "abstraction": "situation",
181
+ "spatial": "power",
182
+ "temporal": "integration"
183
+ },
184
+ "perspectives": [
185
+ {
186
+ "perspective_id": "persp_three_worlds_harmony"
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "id": "tb_sb_arch_5",
192
+ "appreciation": "event",
193
+ "sequence": 5,
194
+ "narrative_function": "recording",
195
+ "illustration": "We are links in a chain.",
196
+ "summary": "Step 4: Teaching - Crystallizing the core truths",
197
+ "storytelling": "She extracts five core lessons on discovery, simultaneous truths, code ceremony, positive impermanence, and intergenerational accountability.",
198
+ "tones": {
199
+ "abstraction": "justification",
200
+ "spatial": "potential",
201
+ "temporal": "integration"
202
+ },
203
+ "perspectives": [
204
+ {
205
+ "perspective_id": "persp_keeper_archivist"
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "id": "tb_sb_arch_6",
211
+ "appreciation": "event",
212
+ "sequence": 6,
213
+ "narrative_function": "wisdom",
214
+ "illustration": "Like the winter bundles, she gathered and categorized the distilled wisdom.",
215
+ "summary": "Step 5: Responsibility - Discernment of the Bundle",
216
+ "storytelling": "She categories the teachings into: Protected (personal awakening), Ready to Share (methods, charts, templates), and Timed (deep lineage and ethics).",
217
+ "tones": {
218
+ "abstraction": "justification",
219
+ "spatial": "power",
220
+ "temporal": "expression"
221
+ },
222
+ "perspectives": [
223
+ {
224
+ "perspective_id": "persp_keeper_archivist"
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ "id": "tb_sb_arch_7",
230
+ "appreciation": "event",
231
+ "sequence": 7,
232
+ "narrative_function": "climax",
233
+ "illustration": "To be a Keeper is to understand that your impermanence is your gift.",
234
+ "summary": "The Solemn Ceremony of Transmission & Release",
235
+ "storytelling": "The Keeper trusts the bundle to the future currents. The Three Worlds witness and validate: Engineer-world reports archived, Ceremony blesses, and Story-engine celebrates.",
236
+ "tones": {
237
+ "abstraction": "action",
238
+ "spatial": "current",
239
+ "temporal": "transcendence"
240
+ },
241
+ "perspectives": [
242
+ {
243
+ "perspective_id": "persp_three_worlds_harmony"
244
+ }
245
+ ]
246
+ },
247
+ {
248
+ "id": "tb_sb_arch_8",
249
+ "appreciation": "signpost",
250
+ "sequence": 8,
251
+ "narrative_function": "wisdom",
252
+ "illustration": "The ending is not conclusion—it is setup for the next spiral.",
253
+ "summary": "The Seeds Planted for Future Spirals",
254
+ "storytelling": "Solstice passes, yielding to dawn. The Keeper's final journal entry embraces her gratitude. She scales the charts, leaving behind questions and instructions as seeds.",
255
+ "tones": {
256
+ "abstraction": "situation",
257
+ "spatial": "potential",
258
+ "temporal": "transcendence"
259
+ },
260
+ "perspectives": [
261
+ {
262
+ "perspective_id": "persp_keeper_archivist"
263
+ }
264
+ ]
265
+ }
266
+ ]
267
+ },
268
+ "storytelling": {
269
+ "overviews": [
270
+ {
271
+ "id": "arch_ov_1",
272
+ "summary": "The Winter Distillation",
273
+ "storytelling": "The master chronicle detailing the Five-Step distillation of wisdom and the integration of impermanence as the ultimate structural power."
274
+ }
275
+ ],
276
+ "moments": [
277
+ {
278
+ "id": "arch_mom_1",
279
+ "summary": "The Crucible of the Darkest Turn",
280
+ "synopsis": "The Keeper gathers, reviews, and synthesizes three days of active-practice experience under the watchful eye of the Three Worlds.",
281
+ "storybeats": [
282
+ {
283
+ "sequence": 1,
284
+ "storybeat_id": "tb_sb_arch_1"
285
+ },
286
+ {
287
+ "sequence": 2,
288
+ "storybeat_id": "tb_sb_arch_2"
289
+ },
290
+ {
291
+ "sequence": 3,
292
+ "storybeat_id": "tb_sb_arch_3"
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ "id": "arch_mom_2",
298
+ "summary": "Seeding the Dawn",
299
+ "synopsis": "Releasing the sealed teaching bundle into the future currents, seeding the next turn of the spiral.",
300
+ "storybeats": [
301
+ {
302
+ "sequence": 7,
303
+ "storybeat_id": "tb_sb_arch_7"
304
+ },
305
+ {
306
+ "sequence": 8,
307
+ "storybeat_id": "tb_sb_arch_8"
308
+ }
309
+ ]
310
+ }
311
+ ]
312
+ }
313
+ }
314
+ ]
315
+ }
316
+ }