instar 1.3.491 → 1.3.493

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 (59) hide show
  1. package/dashboard/index.html +126 -26
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +3 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/server.d.ts.map +1 -1
  6. package/dist/commands/server.js +56 -0
  7. package/dist/commands/server.js.map +1 -1
  8. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  9. package/dist/config/ConfigDefaults.js +11 -0
  10. package/dist/config/ConfigDefaults.js.map +1 -1
  11. package/dist/core/CartographerSweepEngine.d.ts +55 -11
  12. package/dist/core/CartographerSweepEngine.d.ts.map +1 -1
  13. package/dist/core/CartographerSweepEngine.js +276 -95
  14. package/dist/core/CartographerSweepEngine.js.map +1 -1
  15. package/dist/core/CartographerTree.d.ts +77 -1
  16. package/dist/core/CartographerTree.d.ts.map +1 -1
  17. package/dist/core/CartographerTree.js +257 -5
  18. package/dist/core/CartographerTree.js.map +1 -1
  19. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  20. package/dist/core/PostUpdateMigrator.js +30 -0
  21. package/dist/core/PostUpdateMigrator.js.map +1 -1
  22. package/dist/core/RemoteCloseAudit.d.ts +34 -0
  23. package/dist/core/RemoteCloseAudit.d.ts.map +1 -0
  24. package/dist/core/RemoteCloseAudit.js +47 -0
  25. package/dist/core/RemoteCloseAudit.js.map +1 -0
  26. package/dist/core/SessionManager.d.ts +4 -0
  27. package/dist/core/SessionManager.d.ts.map +1 -1
  28. package/dist/core/SessionManager.js +1 -1
  29. package/dist/core/SessionManager.js.map +1 -1
  30. package/dist/core/cartographerDetect.d.ts +133 -0
  31. package/dist/core/cartographerDetect.d.ts.map +1 -0
  32. package/dist/core/cartographerDetect.js +431 -0
  33. package/dist/core/cartographerDetect.js.map +1 -0
  34. package/dist/core/cartographerDetect.worker.d.ts +2 -0
  35. package/dist/core/cartographerDetect.worker.d.ts.map +1 -0
  36. package/dist/core/cartographerDetect.worker.js +37 -0
  37. package/dist/core/cartographerDetect.worker.js.map +1 -0
  38. package/dist/monitoring/ReapLog.d.ts +6 -0
  39. package/dist/monitoring/ReapLog.d.ts.map +1 -1
  40. package/dist/monitoring/ReapLog.js +1 -0
  41. package/dist/monitoring/ReapLog.js.map +1 -1
  42. package/dist/scaffold/templates.d.ts.map +1 -1
  43. package/dist/scaffold/templates.js +1 -0
  44. package/dist/scaffold/templates.js.map +1 -1
  45. package/dist/server/CapabilityIndex.js +1 -1
  46. package/dist/server/CapabilityIndex.js.map +1 -1
  47. package/dist/server/routes.d.ts.map +1 -1
  48. package/dist/server/routes.js +215 -25
  49. package/dist/server/routes.js.map +1 -1
  50. package/package.json +2 -2
  51. package/scripts/lint-no-direct-destructive.js +4 -0
  52. package/scripts/lint-no-mainthread-cartographer-walk.js +101 -0
  53. package/src/data/builtin-manifest.json +64 -64
  54. package/src/data/state-coherence-registry.json +12 -0
  55. package/src/scaffold/templates.ts +1 -0
  56. package/upgrades/1.3.492.md +31 -0
  57. package/upgrades/1.3.493.md +33 -0
  58. package/upgrades/side-effects/cartographer-sweep-eventloop-safety.md +110 -0
  59. package/upgrades/side-effects/remote-session-close.md +85 -0
@@ -3042,6 +3042,14 @@ setTimeout(() => process.exit(0), 2000);
3042
3042
  patched = true;
3043
3043
  result.upgraded.push('CLAUDE.md: added Cartographer Doc-Freshness section');
3044
3044
  }
3045
+ // Event-loop safety (fix instar#1069) — /health + /stale now serve a cached
3046
+ // snapshot; freshnessSweep.framework is the supported off-Claude routing knob.
3047
+ // Keyed on its OWN marker so it is idempotent and independent of the blocks above.
3048
+ if (!content.includes('serves a cached snapshot')) {
3049
+ content += `\n### Cartographer event-loop safety (fix instar#1069)\n\nThe cartographer never runs a whole-tree walk on the server's event loop: the freshness sweep's "what's stale?" detect runs in a worker thread, and every \`/cartographer/*\` read route **serves a cached snapshot** instead of recomputing live.\n- \`GET /cartographer/health\` + \`GET /cartographer/stale\` carry \`snapshot\` (\`present\`/\`absent\`/\`detect-failing\`), \`generatedAt\`, \`headSha\`, \`snapshotStale\`, and \`lastDetectStatus\`. \`absent\` just means no detect has run yet — not an error. \`/stale\` is a bounded sample with a \`total\` + \`truncated\` flag.\n- The off-Claude model is selected by \`cartographer.freshnessSweep.framework\` (default \`codex-cli\`) — a manual \`sessions.componentFrameworks\` override is no longer required. The boot log line \`Cartographer sweep routing: <fw> (source: …)\` shows what resolved.\n- Rollback knob: \`cartographer.freshnessSweep.detectInWorker: false\` runs the SAME bounded detect synchronously (still never the old full walk).\n`;
3050
+ patched = true;
3051
+ result.upgraded.push('CLAUDE.md: added Cartographer event-loop-safety section');
3052
+ }
3045
3053
  // Standards Enforcement Coverage (cartographer-conformance-audit spec #3) — the
3046
3054
  // registry-wide enforcement-coverage audit. Keyed on this spec's OWN marker
3047
3055
  // ('Standards Enforcement Coverage') so it is independent of specs #1/#2 and
@@ -3821,6 +3829,7 @@ Beyond the one-awake-machine model: with the pool enabled I run conversations ac
3821
3829
  - **Machine nicknames** are the user-facing handle (auto-assigned, editable). Rename via \`PATCH /pool/machines/:machineId\` with \`{"nickname":"the mini"}\`, or inline on the Machines tab.
3822
3830
  - **Which machine + WHY (never guess):** \`GET /pool/placement?topic=N\` → the owning machine + nickname, the **reason** (\`pinned\` = a deliberate move vs \`placed\` = load-balanced vs \`unowned\`), and the lease-holder. Answerable from ANY machine (a standby proxies to the holder). Running ON a machine does NOT mean a topic was deliberately moved there — read this instead of inferring.
3823
3831
  - **Reliable transfer (phrasing-independent):** \`POST /pool/transfer\` with \`{"topic":N,"to":"<nickname|machineId>"}\` runs the same validated planner as "move this to <nickname>" but deterministically. 404 unknown · 409 rate-limited · 409 \`needsConfirmation\` for an offline target (re-send with \`"confirm":true\`). The lever to call directly when a natural-language move didn't catch.
3832
+ - **Remote close (any machine, from here):** close a session on ANY machine in the pool from this one — \`POST /sessions/<name>/remote-close\` with \`{"machineId":"<id>","sessionUuid":"<uuid>"}\` (Bearer). Same operator authority as the local close: it WILL close a protected session (the dashboard's confirm dialog is the safety, not a server-side refusal). Outcomes are honest — already-closed comes back calm, and a relay timeout reports outcome-UNKNOWN, never "closed" or "nothing happened". The order is audited on BOTH machines: the relayer appends to \`logs/remote-close-audit.jsonl\`; the owning machine's reap-log entry carries \`viaClaim\`.
3824
3833
  - **Proactive triggers:** when the user says "run this on <nickname>" / "move this to <nickname>" → placement/transfer-by-nickname (the session moves to the named machine, resuming like a session restart). "where is this running / why?" → \`GET /pool/placement?topic=N\`. "move it reliably / it didn't move" → \`POST /pool/transfer\`. Deep mechanics: the Machines tab + \`docs/specs/MULTI-MACHINE-SESSION-POOL-SPEC.md\`.
3825
3834
  `;
3826
3835
  content += '\n' + section;
@@ -3880,6 +3889,22 @@ Beyond the one-awake-machine model: with the pool enabled I run conversations ac
3880
3889
  patched = true;
3881
3890
  result.upgraded.push('CLAUDE.md: added quota-aware placement line');
3882
3891
  }
3892
+ // Remote session close (REMOTE-SESSION-CLOSE-SPEC §2.4, 2026-06-12): agents
3893
+ // that ALREADY carry the pool section predate the relayed close — the one
3894
+ // agent-facing /sessions/* verb (§2.0 names "the operator's authenticated
3895
+ // agent" as a caller). Without it an agent asked "close the stale Mini
3896
+ // session from here" hand-issues curl against the peer's tunnel URL
3897
+ // (lived 2026-06-11) instead of the audited, allowlisted relay. Byte-
3898
+ // identical to the generateClaudeMd bullet (pinned by
3899
+ // PostUpdateMigrator-remoteCloseAwareness.test.ts). Idempotent via the
3900
+ // unique 'remote-close' marker.
3901
+ if (content.includes('Multi-Machine Session Pool (active-active') && !content.includes('remote-close')) {
3902
+ const remoteClose = `
3903
+ - **Remote close (any machine, from here):** close a session on ANY machine in the pool from this one — \`POST /sessions/<name>/remote-close\` with \`{"machineId":"<id>","sessionUuid":"<uuid>"}\` (Bearer). Same operator authority as the local close: it WILL close a protected session (the dashboard's confirm dialog is the safety, not a server-side refusal). Outcomes are honest — already-closed comes back calm, and a relay timeout reports outcome-UNKNOWN, never "closed" or "nothing happened". The order is audited on BOTH machines: the relayer appends to \`logs/remote-close-audit.jsonl\`; the owning machine's reap-log entry carries \`viaClaim\`.`;
3904
+ content += '\n' + remoteClose + '\n';
3905
+ patched = true;
3906
+ result.upgraded.push('CLAUDE.md: added pool remote session close line');
3907
+ }
3883
3908
  // Cross-Machine Secret Sync (spec Phase 4, 2026-06-04): deployed agents don't know
3884
3909
  // a secret can now follow them across machines, nor the two routes. Append the section
3885
3910
  // so an agent surfaces "drop once, usable everywhere" instead of asking the user to
@@ -6243,6 +6268,11 @@ Create worktrees for collaborator repos with \`instar worktree create <branch>\`
6243
6268
  // `git add .` path so contributors can't accidentally commit pr-gate
6244
6269
  // secrets from the project directory.
6245
6270
  this.addGitignoreEntry(projectGitignore, '.instar/secrets/pr-gate/', result, 'project .gitignore');
6271
+ // fix instar#1069: the cartographer index (67MB on a real tree) + the per-host
6272
+ // snapshot are per-machine runtime state, never committable. The header in
6273
+ // cartographer-freshness.mjs historically (wrongly) claimed this was gitignored;
6274
+ // this entry makes it true. Idempotent (addGitignoreEntry no-ops if present).
6275
+ this.addGitignoreEntry(projectGitignore, '.instar/cartographer/', result, 'project .gitignore');
6246
6276
  }
6247
6277
  /**
6248
6278
  * PR-REVIEW-HARDENING Phase A — ensure pr-gate state paths are backed up.