instar 1.3.437 → 1.3.439
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.
- package/.claude/skills/autonomous/SKILL.md +24 -6
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +14 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +20 -10
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/SessionManager.d.ts +21 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +43 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +21 -21
- package/upgrades/1.3.438.md +25 -0
- package/upgrades/1.3.439.md +23 -0
- package/upgrades/side-effects/autonomous-setup-race-hardening.md +56 -0
- package/upgrades/side-effects/subscription-pin-sessions.md +25 -0
|
@@ -75,7 +75,20 @@ if json.dumps(hooks) != before:
|
|
|
75
75
|
|
|
76
76
|
**2b. Write the state file DIRECTLY** (do NOT shell out to bash — the session ID env var is only available inside Claude Code):
|
|
77
77
|
|
|
78
|
-
Use the **Write tool** to create `.instar/autonomous
|
|
78
|
+
Use the **Write tool** to create the **per-topic** state file `.instar/autonomous/<topicId>.local.md`,
|
|
79
|
+
where `<topicId>` is the `report_topic` value you set below (the Telegram topic id you already know
|
|
80
|
+
in-context). For example, if `report_topic` is `19437`, write `.instar/autonomous/19437.local.md`.
|
|
81
|
+
|
|
82
|
+
**WHY PER-TOPIC (setup-race hardening):** the stop hook reads this per-topic file **directly**
|
|
83
|
+
(`.instar/autonomous/<topicId>.local.md`) — it is the canonical state path, keyed on topic so
|
|
84
|
+
multiple topics run concurrent autonomous jobs without collision. Writing the per-topic path here
|
|
85
|
+
closes a boot-window race: two autonomous sessions starting near-simultaneously must NOT both write
|
|
86
|
+
the single legacy file `.instar/autonomous-state.local.md` (the hook still migrates that legacy file
|
|
87
|
+
for in-flight older jobs, but new jobs write the per-topic file from the start so there is nothing to
|
|
88
|
+
collide on). If you somehow have no `report_topic`, fall back to `.instar/autonomous-state.local.md`
|
|
89
|
+
(one-at-a-time, back-compat only).
|
|
90
|
+
|
|
91
|
+
Write this content:
|
|
79
92
|
|
|
80
93
|
```markdown
|
|
81
94
|
---
|
|
@@ -197,17 +210,20 @@ The stop hook detects the promise and allows exit.
|
|
|
197
210
|
The user can always stop autonomous mode:
|
|
198
211
|
|
|
199
212
|
1. **Via messaging**: Send "stop everything" or "emergency stop" — the MessageSentinel intercepts
|
|
200
|
-
2. **Via file**: `touch .instar/autonomous-emergency-stop` — the stop hook checks for this
|
|
201
|
-
|
|
213
|
+
2. **Via file**: `touch .instar/autonomous-emergency-stop` — the stop hook checks for this (this flag is
|
|
214
|
+
global, so it halts EVERY topic's autonomous job at once)
|
|
215
|
+
3. **Via cancel**: `/cancel-autonomous` — removes this topic's state file
|
|
202
216
|
|
|
203
217
|
The stop hook checks for emergency stop on EVERY iteration. User safety is never compromised.
|
|
204
218
|
|
|
205
219
|
### /cancel-autonomous
|
|
206
220
|
|
|
207
|
-
To manually cancel:
|
|
221
|
+
To manually cancel THIS topic's job, remove its per-topic state file (substitute the topic id):
|
|
208
222
|
```bash
|
|
209
|
-
rm -f .instar/autonomous
|
|
223
|
+
rm -f .instar/autonomous/<topicId>.local.md
|
|
210
224
|
```
|
|
225
|
+
(Older one-at-a-time jobs may still live at the legacy `.instar/autonomous-state.local.md` — remove
|
|
226
|
+
that instead if the per-topic file is absent.)
|
|
211
227
|
|
|
212
228
|
---
|
|
213
229
|
|
|
@@ -259,7 +275,9 @@ Feeling tired (as an AI) and deferring. **You don't get tired. The hook knows th
|
|
|
259
275
|
|
|
260
276
|
The stop hook is at `.claude/skills/autonomous/hooks/autonomous-stop-hook.sh`.
|
|
261
277
|
|
|
262
|
-
It reads state from `.instar/autonomous
|
|
278
|
+
It reads state from the per-topic file `.instar/autonomous/<topicId>.local.md` (resolving the topic
|
|
279
|
+
from the tmux session), and migrates the legacy single file `.instar/autonomous-state.local.md` into
|
|
280
|
+
the per-topic path on first run for any in-flight older job. It then:
|
|
263
281
|
- Blocks exit if tasks are incomplete
|
|
264
282
|
- Feeds the task list + goal back as the next prompt
|
|
265
283
|
- Increments the iteration counter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAiG7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA6JtD,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA05BD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,GAC/F,IAAI,CAyUN;AA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;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -9425,6 +9425,20 @@ export async function startServer(options) {
|
|
|
9425
9425
|
});
|
|
9426
9426
|
});
|
|
9427
9427
|
}
|
|
9428
|
+
// Subscription-pool session PINNING (Subscription & Auth Standard): when
|
|
9429
|
+
// enabled, new claude-code spawns launch on the scheduler-picked optimal
|
|
9430
|
+
// account (reset-date / headroom score) and carry its id. This is the
|
|
9431
|
+
// prerequisite that makes auto-swap functional — without a session→account
|
|
9432
|
+
// tag, the swap engine has nothing to move. Default off → spawns use the
|
|
9433
|
+
// default config exactly as before (the resolver stays unwired).
|
|
9434
|
+
if (config.subscriptionPool?.pinSessionsToPool) {
|
|
9435
|
+
const { selectAccount } = await import('../core/QuotaAwareScheduler.js');
|
|
9436
|
+
sessionManager.setSpawnAccountResolver(() => {
|
|
9437
|
+
const acct = selectAccount(subscriptionPool.list(), { nowMs: Date.now() });
|
|
9438
|
+
return acct ? { configHome: acct.configHome, accountId: acct.id } : null;
|
|
9439
|
+
});
|
|
9440
|
+
console.log(pc.green(' Subscription-pool session pinning enabled'));
|
|
9441
|
+
}
|
|
9428
9442
|
}
|
|
9429
9443
|
// ── SessionReaper (SESSION-REAPER-SPEC) ──────────────────────────────
|
|
9430
9444
|
// Pressure-aware reaper of idle-but-alive sessions. Ships OFF + dry-run by
|