instar 1.3.200 → 1.3.201

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.
@@ -1451,16 +1451,16 @@ export class PostUpdateMigrator {
1451
1451
  }
1452
1452
  };
1453
1453
  // Marker = the latest capability signature (bumped each time the bundled hook/
1454
- // setup gains a feature, so prior installs upgrade): now `p13_stop_allowed` —
1455
- // the autonomous stop-hook now consults the P13 "The Stop Reason Is the Work"
1456
- // guard (POST /autonomous/evaluate-stop) before approving a completion, so a stop
1457
- // resting on a judgment-call / needs-engineering deferral keeps working instead of
1458
- // exiting. This marker is ABSENT from prior installs (which carry the older
1459
- // `codex-stdout-json-safe` signature but not the P13 guard), so bumping to it
1460
- // re-deploys the updated hook to every existing agent; the bundled hook retains all
1461
- // prior features (codex stdout-safe, native /goal); customized hooks (no stock
1462
- // fingerprint) are still left untouched.
1463
- upgrade('.claude/skills/autonomous/hooks/autonomous-stop-hook.sh', 'p13_stop_allowed', 'Autonomous Mode Stop Hook', 'skills/autonomous/hooks/autonomous-stop-hook.sh (P13 stop-reason guard — evaluate-stop before approving a completion)');
1454
+ // setup gains a feature, so prior installs upgrade): now `CLOCK_SEG` — the
1455
+ // autonomous stop-hook now injects a rich SESSION CLOCK line ("Nh elapsed · Mh
1456
+ // remaining (NN%)") into every continuation, rendered by emit-session-clock.sh
1457
+ // from the hook's OWN computed elapsed/remaining (Step 2 of robust session
1458
+ // time-awareness; fixes the wind-down-early-with-hours-left class). This marker
1459
+ // is ABSENT from prior installs (which carry `p13_stop_allowed` but not the clock
1460
+ // injection), so bumping to it re-deploys the updated hook to every existing agent;
1461
+ // the bundled hook retains all prior features (P13 guard, codex stdout-safe, native
1462
+ // /goal); customized hooks (no stock fingerprint) are still left untouched.
1463
+ upgrade('.claude/skills/autonomous/hooks/autonomous-stop-hook.sh', 'CLOCK_SEG', 'Autonomous Mode Stop Hook', 'skills/autonomous/hooks/autonomous-stop-hook.sh (SESSION CLOCK injection — rich elapsed/remaining each continuation)');
1464
1464
  // setup-autonomous.sh marker bumped `native-goal/set` → `IS_CODEX_AGENT`: the bundled
1465
1465
  // setup now ALSO auto-delegates to native /goal for CODEX agents (the prior native /goal
1466
1466
  // wiring was gated on `claude --version >= 2.1.139`, which is empty for a codex agent, so
@@ -3982,6 +3982,22 @@ Create worktrees for collaborator repos with \`instar worktree create <branch>\`
3982
3982
  catch (err) {
3983
3983
  result.errors.push(`secret-drop-retrieve.mjs: ${err instanceof Error ? err.message : String(err)}`);
3984
3984
  }
3985
+ // Session-clock injector — always overwrite. New, non-customizable shared
3986
+ // routine (docs/specs/ROBUST-SESSION-TIME-AWARENESS-SPEC.md Component 2):
3987
+ // renders the SESSION CLOCK line (render mode for the autonomous-stop-hook,
3988
+ // query mode via GET /session/clock for UserPromptSubmit) so an agent always
3989
+ // sees elapsed/remaining and never winds down a timed run early. Existing
3990
+ // agents must get it on update without a manual install.
3991
+ try {
3992
+ const clockContent = this.loadRelayTemplate('emit-session-clock.sh');
3993
+ if (clockContent) {
3994
+ fs.writeFileSync(path.join(instarScriptsDir, 'emit-session-clock.sh'), clockContent, { mode: 0o755 });
3995
+ result.upgraded.push('scripts/emit-session-clock.sh (session time-awareness injector)');
3996
+ }
3997
+ }
3998
+ catch (err) {
3999
+ result.errors.push(`emit-session-clock.sh: ${err instanceof Error ? err.message : String(err)}`);
4000
+ }
3985
4001
  }
3986
4002
  /**
3987
4003
  * Secret-externalization survivability migration.
@@ -5947,6 +5963,15 @@ if [ -z "\$AUTH_TOKEN" ] && [ -f "\$CONFIG_FILE" ]; then
5947
5963
  AUTH_TOKEN=\$(python3 -c "import json; v=json.load(open('\$CONFIG_FILE')).get('authToken',''); print(v if isinstance(v, str) else '')" 2>/dev/null)
5948
5964
  fi
5949
5965
 
5966
+ # Session-clock injection (query mode) — surface elapsed/remaining for an active
5967
+ # time-boxed session on this user turn too (not just autonomous continuations),
5968
+ # so the agent quotes the real clock instead of guessing. Signal-only: emits
5969
+ # nothing when no time-boxed session is active or the server is unreachable.
5970
+ # Spec: docs/specs/ROBUST-SESSION-TIME-AWARENESS-SPEC.md (Component 2, query mode).
5971
+ if [ -f "\$INSTAR_DIR/scripts/emit-session-clock.sh" ]; then
5972
+ bash "\$INSTAR_DIR/scripts/emit-session-clock.sh" query "\$TOPIC_ID" "\$PORT" "\$AUTH_TOKEN" 2>/dev/null
5973
+ fi
5974
+
5950
5975
  # Fetch recent messages for this topic
5951
5976
  if [ -n "\$AUTH_TOKEN" ]; then
5952
5977
  RECENT_MSGS=\$(curl -s \\