@ouro.bot/cli 0.1.0-alpha.1024 → 0.1.0-alpha.1025

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1025",
6
+ "changes": [
7
+ "A Copilot account pool's refusals are shared by all of the agent's processes (state/account-refusals.json), so a spent account is skipped everywhere after one 402 or 429 instead of once per process."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1024",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1024",
2
+ "runtimeVersion": "0.1.0-alpha.1025",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1024</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1025</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -279,6 +279,46 @@ class AccountPool {
279
279
  throw new Error("an account pool needs at least one account");
280
280
  this.accounts = accounts;
281
281
  this.options = options;
282
+ this.loadSharedRefusals();
283
+ }
284
+ /** Take in refusals another of the agent's processes recorded; the later end wins. */
285
+ loadSharedRefusals() {
286
+ const file = this.options.refusalsFile;
287
+ if (!file)
288
+ return;
289
+ try {
290
+ const shared = JSON.parse(fs.readFileSync(file, "utf8"));
291
+ for (const [key, until] of Object.entries(shared)) {
292
+ if (typeof until === "number" && until > this.now() && !(this.refused[key] >= until))
293
+ this.refused[key] = until;
294
+ }
295
+ }
296
+ catch {
297
+ // No file yet, or another process is mid-write: nothing to take in.
298
+ }
299
+ }
300
+ saveSharedRefusals() {
301
+ const file = this.options.refusalsFile;
302
+ if (!file)
303
+ return;
304
+ this.loadSharedRefusals();
305
+ const live = Object.fromEntries(Object.entries(this.refused).filter(([, until]) => until > this.now()));
306
+ try {
307
+ fs.mkdirSync(path.dirname(file), { recursive: true });
308
+ const temp = `${file}.${process.pid}.tmp`;
309
+ fs.writeFileSync(temp, JSON.stringify(live));
310
+ fs.renameSync(temp, file);
311
+ }
312
+ catch (error) {
313
+ (0, runtime_1.emitNervesEvent)({
314
+ level: "warn",
315
+ component: "engine",
316
+ event: "engine.account_refusals_save_failed",
317
+ message: "could not share account refusals with the agent's other processes",
318
+ // fs only throws Errors.
319
+ meta: { agent: this.options.agent, error: error.message },
320
+ });
321
+ }
282
322
  }
283
323
  now() {
284
324
  return (this.options.now ?? Date.now)();
@@ -328,6 +368,7 @@ class AccountPool {
328
368
  /** Called between turns: stay on the current account until it reaches the tranche cap. */
329
369
  beforeTurn() {
330
370
  void this.refreshIfStale();
371
+ this.loadSharedRefusals();
331
372
  const previous = this.currentKey;
332
373
  const caps = this.options.caps ?? tranche_1.DEFAULT_TRANCHE_CAPS;
333
374
  const next = chooseAccount(this.accounts, this.readings, { current: previous, refused: this.refused, now: this.now(), caps })
@@ -348,6 +389,7 @@ class AccountPool {
348
389
  const reset = this.readings.find((reading) => reading.key === key)?.reset;
349
390
  const until = refusalUntil(status, error, reset, this.now());
350
391
  this.refused[key] = until;
392
+ this.saveSharedRefusals();
351
393
  const next = chooseAccount(this.accounts, this.readings, { current: null, refused: this.refused, now: this.now(), caps: this.options.caps });
352
394
  if (!next || (0, exports.accountKey)(next) === key) {
353
395
  (0, runtime_1.emitNervesEvent)({
@@ -85,6 +85,7 @@ function createGithubCopilotPooledCaller(config, owner) {
85
85
  machine: config.fleetMachine,
86
86
  switchLog: path.join(owner.agentRoot, "state", "account-switches.jsonl"),
87
87
  burnDir: path.join(owner.agentRoot, "state", "account-burn"),
88
+ refusalsFile: path.join(owner.agentRoot, "state", "account-refusals.json"),
88
89
  /* v8 ignore start -- network readers and publisher: each is tested in its own module @preserve */
89
90
  loadReadings: async () => (0, fleet_readings_1.mergeReadings)(await (0, fleet_readings_1.loadFleetQuota)(gist), await (0, account_pool_1.fetchDirectReadings)(accounts)),
90
91
  publishBurn: gist ? (burn) => (0, fleet_readings_1.publishAgentBurn)(gist, burn) : undefined,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1024",
3
+ "version": "0.1.0-alpha.1025",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1024",
9
+ "version": "0.1.0-alpha.1025",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.17",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1024",
3
+ "version": "0.1.0-alpha.1025",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },