instar 1.3.344 → 1.3.345

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 (49) hide show
  1. package/dist/commands/reflect.d.ts.map +1 -1
  2. package/dist/commands/reflect.js +7 -0
  3. package/dist/commands/reflect.js.map +1 -1
  4. package/dist/commands/server.d.ts.map +1 -1
  5. package/dist/commands/server.js +79 -8
  6. package/dist/commands/server.js.map +1 -1
  7. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  8. package/dist/core/PostUpdateMigrator.js +43 -0
  9. package/dist/core/PostUpdateMigrator.js.map +1 -1
  10. package/dist/core/SessionManager.d.ts +130 -0
  11. package/dist/core/SessionManager.d.ts.map +1 -1
  12. package/dist/core/SessionManager.js +510 -9
  13. package/dist/core/SessionManager.js.map +1 -1
  14. package/dist/core/types.d.ts +70 -1
  15. package/dist/core/types.d.ts.map +1 -1
  16. package/dist/core/types.js.map +1 -1
  17. package/dist/messaging/SpawnRequestManager.d.ts +14 -0
  18. package/dist/messaging/SpawnRequestManager.d.ts.map +1 -1
  19. package/dist/messaging/SpawnRequestManager.js +17 -0
  20. package/dist/messaging/SpawnRequestManager.js.map +1 -1
  21. package/dist/monitoring/ApprenticeshipCycleStore.d.ts +59 -1
  22. package/dist/monitoring/ApprenticeshipCycleStore.d.ts.map +1 -1
  23. package/dist/monitoring/ApprenticeshipCycleStore.js +77 -2
  24. package/dist/monitoring/ApprenticeshipCycleStore.js.map +1 -1
  25. package/dist/monitoring/ReapLog.d.ts +6 -0
  26. package/dist/monitoring/ReapLog.d.ts.map +1 -1
  27. package/dist/monitoring/ReapLog.js +1 -0
  28. package/dist/monitoring/ReapLog.js.map +1 -1
  29. package/dist/scaffold/templates.d.ts.map +1 -1
  30. package/dist/scaffold/templates.js +2 -1
  31. package/dist/scaffold/templates.js.map +1 -1
  32. package/dist/scheduler/JobScheduler.d.ts.map +1 -1
  33. package/dist/scheduler/JobScheduler.js +22 -0
  34. package/dist/scheduler/JobScheduler.js.map +1 -1
  35. package/dist/server/routes.d.ts.map +1 -1
  36. package/dist/server/routes.js +10 -3
  37. package/dist/server/routes.js.map +1 -1
  38. package/dist/threadline/PipeSessionSpawner.d.ts +23 -0
  39. package/dist/threadline/PipeSessionSpawner.d.ts.map +1 -1
  40. package/dist/threadline/PipeSessionSpawner.js +27 -0
  41. package/dist/threadline/PipeSessionSpawner.js.map +1 -1
  42. package/package.json +2 -2
  43. package/scripts/lint-no-direct-destructive.js +3 -0
  44. package/scripts/lint-no-unfunneled-headless-launch.js +128 -0
  45. package/src/data/builtin-manifest.json +65 -65
  46. package/src/scaffold/templates.ts +2 -1
  47. package/upgrades/1.3.345.md +154 -0
  48. package/upgrades/side-effects/apprenticeship-layer-balance.md +50 -0
  49. package/upgrades/side-effects/june15-headless-spawn-reroute.md +105 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PostUpdateMigrator.d.ts","sourceRoot":"","sources":["../../src/core/PostUpdateMigrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAsCH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAejC,MAAM,WAAW,eAAe;IAC9B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAiB;IAC/B;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,CAAiC;gBAEvC,MAAM,EAAE,c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C,mBAAmB;IAyd3B,OAAO,CAAC,wBAAwB;IAuJhC,OAAO,CAAC,2BAA2B;IAwEnC,OAAO,CAAC,yBAAyB;IA8IjC,OAAO,CAAC,2BAA2B;IAqKnC,OAAO,CAAC,qBAAqB;IAqS7B,OAAO,CAAC,uBAAuB;IAqJ/B,OAAO,CAAC,oBAAoB;IAgG5B,OAAO,CAAC,qBAAqB;IA8H7B,OAAO,CAAC,2BAA2B;IAoHnC,OAAO,CAAC,iCAAiC;IA6DzC,OAAO,CAAC,4BAA4B;IA0MpC;;;;;;;;;;OAUG;IACH;;;;;;;;;;;OAWG;IAEH,gBAAuB,iCAAiC,EAAE,WAAW,CAAC,MAAM,CAAC,CAgC1E;IAEH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,8BAA8B;IAiHtC,OAAO,CAAC,uBAAuB;IAwC/B;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,sBAAsB;IAwC9B,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,8BAA8B;IA6HtC,OAAO,CAAC,+BAA+B;IAuKvC,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,qBAAqB;IAqO7B,OAAO,CAAC,qBAAqB;IAwI7B,OAAO,CAAC,qBAAqB;IAyN7B,OAAO,CAAC,6BAA6B;IAkLrC,OAAO,CAAC,0BAA0B;IAgClC,OAAO,CAAC,gBAAgB;IAmJxB,OAAO,CAAC,6BAA6B;CAoCtC"}
@@ -2774,11 +2774,26 @@ The standing program that each apprenticeship/mentorship instance plugs into (e.
2774
2774
  - Transition status (the ONLY way it changes — runs the gate): \`POST /apprenticeship/instances/:id/transition\` \`{"to":"active"}\` (refused + 409 on a failed gate or illegal transition; \`complete\` is terminal). Preview without mutating: \`.../can-start\` · \`.../can-complete\`.
2775
2775
  - Record a manual cycle: \`POST /apprenticeship/cycles\` with \`instanceId\`, positive \`cycleNumber\`, \`task\`, \`menteeOutput\`, optional \`mentorFlagged\` / \`overseerDifferential\` / \`coaching\` / \`infraItems\`, \`kind\` (\`mentor-mentee-differential\`, \`overseer-apprentice-devreview\`, \`overseer-mentee-direct\`), and \`channel\` (\`telegram-playwright\`, \`threadline-backup\`, \`direct-shortcut\`, \`unknown\`). A \`telegram-playwright\` cycle additionally REQUIRES a \`transcriptAudit\` block — \`{ topicIds, window: {start,end}, summary, findingDedupKeys, generatedAt, ledger: 'local'|'remote'|'dry-run'|'failed' }\` — built from \`instar dev:post-drive-transcript-audit\` run over the drive window (use \`--history-base-url\` when the transcript lives on the mentee's server; \`ledger:'local'\` claims are cross-checked against the real framework ledger). Use this when the overseer or manual loop found a differential outside the automated mentor tick.
2776
2776
  - **When to use** (PROACTIVE): when starting or closing a mentorship/apprenticeship instance, drive it through the registry + transitions so the retro-harvest is reviewed before the next instance starts and the lessons are captured before this one closes — never track the lifecycle by memory.
2777
+ - Layer-balance health: \`GET /apprenticeship/instances/:id/role-coverage\` returns a \`keystoneBalance\` block — \`{ keystoneAxis, keystoneCycleCount, lastKeystoneAt, oversightSinceKeystone, starved, reason }\` — answering "is my deepest layer (the real mentor→mentee drive) actually firing, or have I drifted into just reviewing/overseeing?" \`starved:true\` = the mentee layer is under-firing relative to ongoing activity (the silent "mentor-heavy/mentee-light" drift). Observe-only; tune via \`?oversightStarvationThreshold=N\`. **When to use** (PROACTIVE): before deciding the loop is healthy — if starved, drive the mentee layer (a real \`mentor-mentee-differential\` cycle through the dogfooded channel), not another review.
2777
2778
  `;
2778
2779
  content += '\n' + apprenticeshipSection;
2779
2780
  patched = true;
2780
2781
  result.upgraded.push('CLAUDE.md: added Apprenticeship Program section');
2781
2782
  }
2783
+ // Layer-balance signal (2026-06-06): agents that ALREADY carry the
2784
+ // Apprenticeship Program section need the keystoneBalance health line — an
2785
+ // agent that doesn't know to CHECK the balance can't notice the mentee
2786
+ // layer starving. Content-sniffed insertion; idempotent (only when the
2787
+ // section exists AND the line is absent).
2788
+ if (content.includes('**Apprenticeship Program**') && !content.includes('keystoneBalance')) {
2789
+ const anchor = '- **When to use** (PROACTIVE): when starting or closing a mentorship/apprenticeship instance, drive it through the registry + transitions so the retro-harvest is reviewed before the next instance starts and the lessons are captured before this one closes — never track the lifecycle by memory.';
2790
+ if (content.includes(anchor)) {
2791
+ const balanceLine = '\n- Layer-balance health: `GET /apprenticeship/instances/:id/role-coverage` returns a `keystoneBalance` block — `{ keystoneAxis, keystoneCycleCount, lastKeystoneAt, oversightSinceKeystone, starved, reason }` — answering "is my deepest layer (the real mentor→mentee drive) actually firing, or have I drifted into just reviewing/overseeing?" `starved:true` = the mentee layer is under-firing relative to ongoing activity (the silent "mentor-heavy/mentee-light" drift). Observe-only; tune via `?oversightStarvationThreshold=N`. **When to use** (PROACTIVE): before deciding the loop is healthy — if starved, drive the mentee layer (a real `mentor-mentee-differential` cycle through the dogfooded channel), not another review.';
2792
+ content = content.replace(anchor, anchor + balanceLine);
2793
+ patched = true;
2794
+ result.upgraded.push('CLAUDE.md: added apprenticeship layer-balance (keystoneBalance) awareness');
2795
+ }
2796
+ }
2782
2797
  // Transcript-audit gate (#864 follow-through): agents that ALREADY carry the
2783
2798
  // Apprenticeship Program section have the pre-gate "Record a manual cycle"
2784
2799
  // line, which no longer teaches the full required shape — telegram-playwright
@@ -2930,6 +2945,34 @@ Your internal background LLM calls (sentinels, gates, extractors) normally run a
2930
2945
  patched = true;
2931
2946
  result.upgraded.push('CLAUDE.md: added Anthropic Subscription-Path Routing (/providers/registry) awareness (provider-substrate-live-wiring)');
2932
2947
  }
2948
+ // subscription-path SCOPE correction (june15-headless-spawn-reroute,
2949
+ // review finding F2): PR 1's block scoped the lever to "internal
2950
+ // background LLM calls" — after PR 2 the SAME mode key also reroutes
2951
+ // headless job / A2A / dispatch spawns, so the deployed wording is
2952
+ // factually incomplete. The PR-1 sniff ('/providers/registry') is
2953
+ // already satisfied on every deployed agent and CANNOT gate this patch —
2954
+ // sniff on the NEW phrase instead, and splice the corrected scope line
2955
+ // into the existing section. Idempotent: skips once the phrase exists.
2956
+ if (content.includes('/providers/registry') &&
2957
+ !content.includes('headless job / agent-to-agent / dispatch spawns')) {
2958
+ // PR 1 shipped TWO wordings: the migrator section said "routes them",
2959
+ // the fresh-init template said "can route them" — match either.
2960
+ const oldScopeSentences = [
2961
+ 'Your internal background LLM calls (sentinels, gates, extractors) normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever routes them through a pool of long-lived interactive Claude sessions instead — the path that keeps working when the pot is empty.',
2962
+ 'Your internal background LLM calls (sentinels, gates, extractors) normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever can route them through a pool of long-lived interactive Claude sessions instead — the path that keeps working when the pot is empty.',
2963
+ ];
2964
+ const newScopeSentence = 'Your internal background LLM calls (sentinels, gates, extractors) AND your headless job / agent-to-agent / dispatch spawns normally run as \`claude -p\` one-shots, which bill the Agent SDK credit pot after 2026-06-15. The subscription-path lever routes BOTH through interactive Claude sessions instead — the path that keeps working when the pot is empty. (Rerouted job/A2A spawns run as normal interactive sessions with a completion marker, a concurrency cap, and quota backpressure — each session\'s \`launchLane\` in \`GET /sessions\` shows which billing lane it used.)';
2965
+ for (const oldScopeSentence of oldScopeSentences) {
2966
+ if (content.includes(oldScopeSentence)) {
2967
+ content = content.replace(oldScopeSentence, newScopeSentence);
2968
+ patched = true;
2969
+ result.upgraded.push('CLAUDE.md: corrected Subscription-Path Routing scope — lever now covers job/A2A/dispatch spawns too (june15-headless-spawn-reroute)');
2970
+ break;
2971
+ }
2972
+ }
2973
+ // A hand-edited section that no longer carries either PR-1 sentence is
2974
+ // left untouched — never clobber user-customized wording.
2975
+ }
2933
2976
  // session-clock (Agent Awareness + Migration Parity): existing agents must
2934
2977
  // learn they can ask how long they've been running / how much is left,
2935
2978
  // instead of guessing. Content-sniff on the route marker.