@fractalsynapse/dsh-chapters 0.2.38 → 0.2.39

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.
@@ -567,7 +567,9 @@ not inherit it: `create_goal` requires a direct-human turn, and the child's firs
567
567
  `plugin:dsh-chapters`. Before this, the objective stopped driving the work exactly where the plugin's own
568
568
  promise begins, and AGENTS' rule to "carry the authorized outcome" was left to the model's prose.
569
569
 
570
- **The rule now: carry the goal as text, and state aloud that it is not armed.** One selector
570
+ **The rule now (maintainer decision 2026-11-19 applied): carry the goal as text, AND re-arm a live goal
571
+ at birth through the goal SERVICE — explicitly, documented, and configurable** (`goalRearmOnCarry`, default
572
+ on; off restores the notice-only wording). One selector
571
573
  (`foldGoalFromLog`) folds the parent's durable `goal/change` events — operations `create`, `edit`, `pause`,
572
574
  `resume`, `block`, `complete`, `clear`, with `{id, revision, objective, phase, maxGoalRounds, blockedReason}`
573
575
  — and one renderer (`renderGoalCarriage`) emits the child's `## Goal (carried from the parent session)`
@@ -590,13 +592,18 @@ Invariants this respects:
590
592
  - **`phase` is foldable; `activation` is not.** The host keeps armed/disarmed process-local and the plugin
591
593
  reads it from the live service for its own driver decisions, so the notice says who CAN change the driver
592
594
  and never claims what the driver currently IS. Recovering armedness from history would be a guess in a
593
- record's clothing.
594
-
595
- **Deliberately not done, pending a maintainer decision (#349):** the underlying goal *service* has no
596
- direct-human gate, so the plugin could arm a goal on the child unilaterally. Reaching a seam is not having
597
- authority to use it; silently routing around a gate because the tool wrapper is the only thing enforcing it
598
- is the kind of unexamined authority widening this whole release was a study in. If the answer is yes, it
599
- becomes an explicit, documented, configurable step — not a side effect of the birth path.
595
+ record's clothing. THE RE-ARM RESPECTS THIS: the birth step creates a fresh goal (armed by the service's
596
+ own semantics, revision restarts, round counts start on the child) — it never CLAIMS the parent's
597
+ activation, and the notice wording is true whether the step succeeds or is refused.
598
+
599
+ **The decision, recorded (maintainer, 2026-11-19):** the earlier paragraph reserved plugin-authored goal
600
+ creation as a maintainer call; the call is YES, scoped as this section now states — the ONE predicate
601
+ (`goalRearmDecision`) arms exactly ACTIVE, unfinished goals (a paused/blocked goal stays notice-only:
602
+ the human stopped it; a completed/cleared one stays closed), the service is called on the child's live
603
+ handle AFTER a successful birth, and every failure mode is loud: no goals service or a refused create
604
+ lands in the door's warning channel naming `/goal resume` as the human fallback — never a silence, never
605
+ a rollback of the birth. Reaching a seam was not authority to use it; this paragraph is the authority,
606
+ written before the code that cites it.
600
607
 
601
608
  ## Storage
602
609
 
@@ -772,6 +779,14 @@ warned "N event(s) rendered no output", `planSummarize` counted the oversize cha
772
779
  catch built a full diagnostic — and then the value was discarded. So the rule is not "add checks", it is
773
780
  **deliver what the checks already say**:
774
781
 
782
+ - **Client visibility follows the command plane (#372).** The two door buttons are realm-scoped
783
+ affordances, so the client renders them ONLY when the host's own per-session projection
784
+ (`SessionSummary.projectionValues.agentPreset` — the fact the host's preset label reads, measured
785
+ in `dsh-client-ui-agent-preset` client bytes) says the session composes `chapters`. An unreadable
786
+ projection keeps the buttons and the click answers with the preset-specific refusal — fail-open
787
+ visibly, never silently dead. One id source: `CHAPTERS_PRESET_ID` lives in `src/preset-id.ts`
788
+ (client-safe, cordis-free); `src/preset.ts` re-exports it, and the client predicate is
789
+ `doorActionsVisibleFor` — one predicate per decision, per the hard rules.
775
790
  - **The diagnostics sink defaults ON.** `DSH_CHAPTERS_ENGINE_ERRORS` unset now means
776
791
  `<store-root>/diagnostics.log`, not "nowhere". All three SAIP compaction finalization failures left
777
792
  zero trace on disk, and door 5 logged `saved` to a logger nobody reads for three days. The env var
package/docs/contract.md CHANGED
@@ -374,9 +374,16 @@ symptom. Recorded here so the omission is closed rather than inherited, and note
374
374
  schemas**.
375
375
 
376
376
  - `isSeeded` means "contains a fork-inherited event prefix"; our one-event synthetic seed is not that.
377
- - `parentSession` is documented as *seed lineage*. Setting it to fake a relationship would be a misuse.
378
- - Therefore **our storage-domain registry is the sole authority on ancestry**, and the web UI's branch
379
- graph will show our child as an unrelated root. A chain/manifest view is this plugin's job.
377
+ - `parentSession` is documented upstream as *seed lineage*. **DSH amendment (maintainer decision
378
+ 2026-11-19, #397): our birth seam sets it to the TRUE parent on every child it creates** —
379
+ `chapters_continue`/`chapters_fork` name the caller session; `chapters-restore` names the TARGET it
380
+ was born from. The relationship is real, so naming it in the kernel header is durable lineage the
381
+ child can read without our registry. The prohibition stands for every other writer: never claim a
382
+ parent that did not birth you.
383
+ - The storage-domain registry REMAINS the ancestry authority for children born before the amendment
384
+ (they carry no header field), and the seventh archive moment reads header-first with registry
385
+ fallback (`shouldForceChildArchive`). A header-parented child may appear differently in the web
386
+ UI's branch graph (host-scope, unmeasured here); the chain/manifest view stays this plugin's job.
380
387
  - The header being composed per request from the preset plus plugin contributions is *why* invariant 3
381
388
  holds, and why cache validity is per-process-generation: a restart or config edit recomposes it for
382
389
  everyone.
@@ -1100,3 +1100,26 @@ artifact never contained the booted home's session logs. `scripts/chain-replay.s
1100
1100
  `session.v4.jsonl.zstd` files and registry into `var/e2e-session-logs/<leg>-<port>` (six files, under 4 MB each) so
1101
1101
  the runner's own history sits next to the tape diffs and the misses. When a miss claims "the conversation had
1102
1102
  already taken a different shape", the answer is in that transcript — read it, don't theorize about it.
1103
+
1104
+ ### The rig-band ephemeral collision (CORRECTED same day — the teardown theory was WRONG)
1105
+
1106
+ `plans` (0.2.37 cut), `enrich` (0.2.38 cut), `fanout` twice (0.2.39 cut): `listen EADDRINUSE` on the
1107
+ leg's own port, boot dying at the 120s readiness ceiling, different leg each time. The first theory
1108
+ here (and in two ship records) said "previous host child outlives its wrapper" — a bind test disproved
1109
+ it on the spot: **`bind(41736)` refused while `ss -tln` and `/proc/net/tcp` showed NO LISTENER** —
1110
+ `lsof` named the holder: an ESTABLISHED outbound socket of the developer's own tooling using the rig
1111
+ port as its EPHEMERAL SOURCE. The machine's `ip_local_port_range` (32768-60999) swallows the entire
1112
+ rig band (41731-41746), so ANY local connection can squat any leg port at any time — which is also why
1113
+ the rerun-gave-green pattern: ephemeral allocation is luck, not drift. Wrong-theory trail kept
1114
+ deliberately: the first guard shipped minutes ago polled CONNECT-REFUSED, the wrong predicate
1115
+ (free-to-connect ≠ free-to-bind); it now asks for a real `listen()` per leg port, holds up to 90s,
1116
+ and fails the leg by name rather than booting into a refusal the ceiling will call a mystery.
1117
+
1118
+ **The real fix, for the maintainer's machine (needs root or a re-distill, so it is recorded not
1119
+ done here):** either reserve the band for the rig — `sysctl net.ipv4.ip_local_reserved_ports=41731-41746`
1120
+ (zero bytes moved, zero tapes touched) — or relocate the band entirely (needs a FULL corpus
1121
+ re-distill, because every tape's regime, homes and header paths are port-keyed; NOT free, not
1122
+ tonight). Until one lands, the honest release sentence stays: first-attempt collisions are named,
1123
+ the recorded rerun is green, and the guard now measures the right thing. The wrong-teardown theory
1124
+ in the 0.2.37/0.2.38 ship records stands corrected here rather than silently rewritten — immutable
1125
+ tags, mutable understanding, one line in the right place.
@@ -1169,3 +1169,42 @@ locally (every leg under its own boot, compose included), then `npm run corpus:s
1169
1169
  debt · #349 remainder (browser rig) · #372 (unbuilt) · #397 (contract.md § Lineage decision) ·
1170
1170
  #411 residual (record-time regeneration pattern) · host option-(d) todo row · five
1171
1171
  credential-gated TreeDX live rows.
1172
+
1173
+
1174
+ **fd7e7e6..69729f7 SHIPPED — 0.2.38, published and registry-proven.** PR #424 merged to main at
1175
+ `69729f7`, all four CI jobs green at the head (coverage gate, preset-rows probe, env parity, and the
1176
+ acceptance chain now replaying compose on the runner); annotated tag `0.2.38` at the merge commit;
1177
+ release run `44479863717` success. Registry proof: `latest` = **0.2.38**; unpacked tarball answers
1178
+ manifest `0.2.38` AND bundled `PLUGIN_VERSION = '0.2.38'`; provenance attestation present
1179
+ (`slsa.dev/provenance/v1`). Candidate evidence per the record above: twelve-leg replay chain green
1180
+ locally at the release head (the one `enrich` boot that died on `EADDRINUSE :41734` was the transient
1181
+ teardown race, port verified free, rerun fully green), stamp `lib=a2d63947fa0e8da7` moved only on the
1182
+ version literal with `promptAnchor` unchanged — and the stamp's own first commit message got amended
1183
+ before merge for saying "lib unchanged" when the honest reading is "lib changed ONLY by the version
1184
+ string": the amend is disclosed here because the bytes that moved are exactly what the release
1185
+ verifies.
1186
+
1187
+ C3 is retired. The oldest open verification debt in this file's history became a replay leg.
1188
+
1189
+ ## 2026-11-19 — 0.2.39: the release that carried the objective across
1190
+
1191
+ **Candidate = staging at `70fb605`.** The range `0.2.38..staging` is one arc in three issues: **#397**
1192
+ (durable birth lineage in the kernel header, contract amended first — merged `PR #425`), **#372**
1193
+ (the dock reads the host's preset projection; resolved-foreign hides the realm-scoped buttons, unknown
1194
+ refuses by name — merged `PR #426` after a six-run browser-measurement chain, one wrong premise killed
1195
+ per run), **#349** (the maintainer authority decision implemented: ACTIVE carried goals re-arm at birth
1196
+ through the goal service, one predicate, warning-never-refusal, `goalRearmOnCarry`; five-run live chain
1197
+ including two stale-lib lessons and the cordis inject-gate discovery — merged `PR #427`). C3's
1198
+ successor facts are now regression corpus: the compose leg replays the composed path model-free (0.2.38)
1199
+ and the goal/lineage claims carry live-host witnesses in their legs.
1200
+
1201
+ **Open-list corrections this cut makes:** #411 was already closed at 0.2.36 (its 'residual' line here
1202
+ was stale prose); #349, #372, #397, C3 all now closed/retired. Open after this cut: #349's sibling from
1203
+ #138 (an armed goal has no rest state — unchanged) · #372's host-side sibling: the gateway session-list
1204
+ shape warning (`attach:gatewayList`, pre-existing, non-fatal, observed while measuring) is NOT yet
1205
+ filed — it is recorded here so the next audit does not re-derive it · #349 remainder: none ·
1206
+ #397 remainder: none · host option-(d) todo row · five credential-gated TreeDX live rows.
1207
+
1208
+ **Ship gate at the candidate before stamp:** full unit+integration ledger baseline shape
1209
+ (1,696/1,702 — 5 credential-gated `live:` + 1 todo); typecheck clean; ratchet 58=58; the TWELVE-leg
1210
+ replay chain run locally green at this head; `corpus:stamp` on green with `promptAnchor` unchanged.
package/lib/client.js CHANGED
@@ -1046,6 +1046,54 @@ window.__ModuleLoader__.load({
1046
1046
  }))));
1047
1047
  }
1048
1048
  // src/client/doors.ts
1049
+ /**
1050
+ * The client door runner: the two deterministic archive doors, executed over
1051
+ * `remote.commands` and followed by a SWITCH to the fresh child.
1052
+ *
1053
+ * ONE runner, two rows. The server side keeps the same discipline — both doors
1054
+ * come from `deterministicCommand(door)` in src/tools.ts, and a unit row pins
1055
+ * that they archive identically. Copy-pasting this body is how the two would
1056
+ * drift apart, so there is exactly one implementation and a table of rows.
1057
+ *
1058
+ * `chapters-continue` ships only as a composer command; without a button here
1059
+ * the child is created correctly and the UI shows nothing, which reads as
1060
+ * "nothing happened". The row is the missing affordance, not new logic.
1061
+ *
1062
+ * React-free on purpose: the primitives package pulls CSS modules the node
1063
+ * test runner cannot load, so the testable half lives here and index.ts is the
1064
+ * thin chrome that renders these rows as buttons (tests/unit/client-doors.test.ts).
1065
+ *
1066
+ * @module dsh-chapters/src/client/doors
1067
+ */
1068
+ /** Structural slice of the aggregated remote service (@deepseek-ai/dsh-api-remotes).
1069
+ * `remote.commands` must ALSO appear in inject — the federation gates each
1070
+ * sub-service individually (the live feedback package declares
1071
+ * remote.messageFeedback beside remote for exactly this reason). */
1072
+ /**
1073
+ * #372 — the host's OWN per-session preset fact. The shape is measured, not invented:
1074
+ * `dsh-client-ui-agent-preset/lib/client.js` resolves its label through
1075
+ * `session?.projectionValues?.agentPreset`, and `dsh-api-session-controller` documents the field as
1076
+ * "current host-computed projection values retained by the object layer". We read the SAME row the
1077
+ * list store already gives us (rosterIds' shape) — no inference, no hardcoded preset name.
1078
+ * null means the fact is NOT READABLE — which is UNKNOWN, never "standard" (#77's roster
1079
+ * discipline applied to the preset: absence invented from unreadability is the same lie).
1080
+ */
1081
+ function presetOfSession(sessions, sessionId) {
1082
+ try {
1083
+ const value = ((sessions?.list?.getSnapshot?.())?.byId?.[sessionId])?.projectionValues?.agentPreset;
1084
+ return typeof value === "string" && value !== "" ? value : null;
1085
+ } catch {
1086
+ return null;
1087
+ }
1088
+ }
1089
+ /**
1090
+ * The ONE visibility predicate for the realm-scoped door rows (#372). Unknown keeps the rows —
1091
+ * the click path answers with the named refusal, so fail-open is never fail-silent; a RESOLVED
1092
+ * foreign preset hides them, because those commands genuinely do not exist in that session.
1093
+ */
1094
+ function doorActionsVisibleFor(preset) {
1095
+ return preset === null || preset === "chapters";
1096
+ }
1049
1097
  const DOOR_ACTIONS = [{
1050
1098
  id: "chapters-fork",
1051
1099
  order: 30,
@@ -1235,11 +1283,18 @@ window.__ModuleLoader__.load({
1235
1283
  ok: false,
1236
1284
  message: "commands remote unavailable"
1237
1285
  };
1286
+ {
1287
+ const preset = presetOfSession(sessions, sessionId);
1288
+ if (preset !== null && !doorActionsVisibleFor(preset)) return {
1289
+ ok: false,
1290
+ message: `Chapters ${door.noun} needs the chapters preset realm — this session composes "${preset}". Switch this session's preset or run the door from a chapters session.`.slice(0, 140)
1291
+ };
1292
+ }
1238
1293
  const line = typeof anchorSeq === "number" && Number.isFinite(anchorSeq) ? `${door.command} ${String(Math.trunc(anchorSeq))}` : door.command;
1239
1294
  const res = await remote.commands.execute(sessionId, line, []);
1240
1295
  if (res.ok !== true) return {
1241
1296
  ok: false,
1242
- message: (res.error?.message ?? `the ${door.noun} call failed`).slice(0, 90)
1297
+ message: (res.error?.message ?? `the ${door.noun} failed — its command lives in the chapters preset realm`).slice(0, 90)
1243
1298
  };
1244
1299
  const result = res.value?.result;
1245
1300
  const text = typeof result?.text === "string" ? result.text : "";
@@ -1396,7 +1451,8 @@ window.__ModuleLoader__.load({
1396
1451
  }
1397
1452
  /** One component body for every door row; only the label and glyph differ. */
1398
1453
  function makeDoorAction(door) {
1399
- return function ChaptersDoorAction({ run }) {
1454
+ return function ChaptersDoorAction({ run, visible }) {
1455
+ if (visible !== void 0 && !visible()) return null;
1400
1456
  const [busy, setBusy] = (0, react.useState)(false);
1401
1457
  const [note, setNote] = (0, react.useState)(null);
1402
1458
  const alive = (0, react.useRef)(true);
@@ -1479,16 +1535,19 @@ window.__ModuleLoader__.load({
1479
1535
  name: "conversation.chat.assistant-actions",
1480
1536
  id: door.id,
1481
1537
  label: door.label,
1482
- inject: (sessionId, owner) => ({ run: async () => {
1483
- let anchor = null;
1484
- const mid = typeof owner?.messageId === "string" ? owner.messageId : "";
1485
- if (mid !== "") try {
1486
- const out = await runCommandText(remote, sessionId, `/chapters-anchor ${mid}`);
1487
- const n = Number.parseInt(out.trim(), 10);
1488
- if (Number.isFinite(n) && n > 0) anchor = n;
1489
- } catch {}
1490
- return run(sessionId, anchor);
1491
- } })
1538
+ inject: (sessionId, owner) => ({
1539
+ visible: () => doorActionsVisibleFor(presetOfSession(sessions, sessionId)),
1540
+ run: async () => {
1541
+ let anchor = null;
1542
+ const mid = typeof owner?.messageId === "string" ? owner.messageId : "";
1543
+ if (mid !== "") try {
1544
+ const out = await runCommandText(remote, sessionId, `/chapters-anchor ${mid}`);
1545
+ const n = Number.parseInt(out.trim(), 10);
1546
+ if (Number.isFinite(n) && n > 0) anchor = n;
1547
+ } catch {}
1548
+ return run(sessionId, anchor);
1549
+ }
1550
+ })
1492
1551
  }, component));
1493
1552
  console.info(`[client:chapters] door factory ran: ${String(effects.length)} register effect(s), types: ${effects.map((e) => typeof e).join(",")}`);
1494
1553
  return effects;