@raysonmeng/agentbridge 0.1.18 → 0.1.19

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.
@@ -12,7 +12,7 @@
12
12
  {
13
13
  "name": "agentbridge",
14
14
  "description": "Bridge Claude Code and Codex through a shared daemon, push channel delivery, and reply/get_messages tools.",
15
- "version": "0.1.18",
15
+ "version": "0.1.19",
16
16
  "author": {
17
17
  "name": "AgentBridge Contributors",
18
18
  "email": "raysonmeng@qq.com"
package/dist/cli.js CHANGED
@@ -126,6 +126,9 @@ class StateDirResolver {
126
126
  get killedFile() {
127
127
  return join(this.stateDir, "killed");
128
128
  }
129
+ get admissionQuotaFile() {
130
+ return join(this.stateDir, "admission-quota.json");
131
+ }
129
132
  get updateCheckFile() {
130
133
  return join(this.stateDir, "update-check.json");
131
134
  }
@@ -176,7 +179,7 @@ function parsePositiveIntEnv(name, fallback, log = () => {}, env = process.env)
176
179
  var require_package = __commonJS((exports, module) => {
177
180
  module.exports = {
178
181
  name: "@raysonmeng/agentbridge",
179
- version: "0.1.18",
182
+ version: "0.1.19",
180
183
  description: "Bridge between Claude Code and Codex \u2014 bidirectional agent communication via MCP Channel + JSON-RPC",
181
184
  type: "module",
182
185
  packageManager: "bun@1.3.11",
@@ -511,7 +514,9 @@ function findShapeViolation(raw) {
511
514
  "reserveSlopePctPerHour",
512
515
  "reserveMaxPct",
513
516
  "finishingHorizonMinutes",
514
- "resumeHysteresisPct"
517
+ "resumeHysteresisPct",
518
+ "admissionAt",
519
+ "wrapUpQuota"
515
520
  ]) {
516
521
  if (key in maximize && !isCoercibleNumber(maximize[key])) {
517
522
  return `budget.maximize.${key} is present but not a number`;
@@ -536,7 +541,7 @@ function hasCustomDecisionValues(config) {
536
541
  const d = DEFAULT_CONFIG;
537
542
  const b = config.budget;
538
543
  const db = d.budget;
539
- return config.idleShutdownSeconds !== d.idleShutdownSeconds || config.turnCoordination.attentionWindowSeconds !== d.turnCoordination.attentionWindowSeconds || config.codex.appPort !== d.codex.appPort || config.codex.proxyPort !== d.codex.proxyPort || b.enabled !== db.enabled || b.pollSeconds !== db.pollSeconds || b.pauseAt !== db.pauseAt || b.resumeBelow !== db.resumeBelow || b.syncDriftPct !== db.syncDriftPct || b.parallel.minRemainingPct !== db.parallel.minRemainingPct || b.parallel.timeWindowSec !== db.parallel.timeWindowSec || b.codexTierControl !== db.codexTierControl || b.maximize.targetUtil !== db.maximize.targetUtil || b.maximize.reserveSlopePctPerHour !== db.maximize.reserveSlopePctPerHour || b.maximize.reserveMaxPct !== db.maximize.reserveMaxPct || b.maximize.finishingHorizonMinutes !== db.maximize.finishingHorizonMinutes || b.maximize.resumeHysteresisPct !== db.maximize.resumeHysteresisPct || b.allocation.minRunwayRatio !== db.allocation.minRunwayRatio || b.allocation.minRunwayGapHours !== db.allocation.minRunwayGapHours;
544
+ return config.idleShutdownSeconds !== d.idleShutdownSeconds || config.turnCoordination.attentionWindowSeconds !== d.turnCoordination.attentionWindowSeconds || config.codex.appPort !== d.codex.appPort || config.codex.proxyPort !== d.codex.proxyPort || b.enabled !== db.enabled || b.pollSeconds !== db.pollSeconds || b.pauseAt !== db.pauseAt || b.resumeBelow !== db.resumeBelow || b.syncDriftPct !== db.syncDriftPct || b.parallel.minRemainingPct !== db.parallel.minRemainingPct || b.parallel.timeWindowSec !== db.parallel.timeWindowSec || b.codexTierControl !== db.codexTierControl || b.maximize.targetUtil !== db.maximize.targetUtil || b.maximize.reserveSlopePctPerHour !== db.maximize.reserveSlopePctPerHour || b.maximize.reserveMaxPct !== db.maximize.reserveMaxPct || b.maximize.finishingHorizonMinutes !== db.maximize.finishingHorizonMinutes || b.maximize.resumeHysteresisPct !== db.maximize.resumeHysteresisPct || b.maximize.admissionAt !== db.maximize.admissionAt || b.maximize.wrapUpQuota !== db.maximize.wrapUpQuota || b.allocation.minRunwayRatio !== db.allocation.minRunwayRatio || b.allocation.minRunwayGapHours !== db.allocation.minRunwayGapHours;
540
545
  }
541
546
  function normalizeInteger(value, fallback) {
542
547
  if (typeof value === "number" && Number.isFinite(value))
@@ -576,9 +581,11 @@ function normalizeMaximizeConfig(raw, pauseAt, fallback = DEFAULT_BUDGET_CONFIG.
576
581
  reserveSlopePctPerHour: normalizeBoundedNumber(m.reserveSlopePctPerHour, fallback.reserveSlopePctPerHour, 0, 5),
577
582
  reserveMaxPct: normalizeBoundedInteger(m.reserveMaxPct, fallback.reserveMaxPct, 0, 30),
578
583
  finishingHorizonMinutes: normalizeBoundedInteger(m.finishingHorizonMinutes, fallback.finishingHorizonMinutes, 5, 180),
579
- resumeHysteresisPct: normalizeBoundedInteger(m.resumeHysteresisPct, fallback.resumeHysteresisPct, 1, 30)
584
+ resumeHysteresisPct: normalizeBoundedInteger(m.resumeHysteresisPct, fallback.resumeHysteresisPct, 1, 30),
585
+ admissionAt: normalizeBoundedInteger(m.admissionAt, fallback.admissionAt, 50, 99),
586
+ wrapUpQuota: Math.floor(normalizeBoundedInteger(m.wrapUpQuota, fallback.wrapUpQuota, 0, 10))
580
587
  };
581
- if (normalized.targetUtil <= pauseAt) {
588
+ if (normalized.targetUtil <= pauseAt || normalized.admissionAt >= normalized.targetUtil) {
582
589
  return { ...DEFAULT_BUDGET_CONFIG.maximize };
583
590
  }
584
591
  return normalized;
@@ -661,7 +668,9 @@ function applyBudgetEnvOverrides(budget, env = process.env) {
661
668
  reserveSlopePctPerHour: env.AGENTBRIDGE_BUDGET_RESERVE_SLOPE_PCT_PER_HOUR ?? budget.maximize.reserveSlopePctPerHour,
662
669
  reserveMaxPct: env.AGENTBRIDGE_BUDGET_RESERVE_MAX_PCT ?? budget.maximize.reserveMaxPct,
663
670
  finishingHorizonMinutes: env.AGENTBRIDGE_BUDGET_FINISHING_HORIZON_MINUTES ?? budget.maximize.finishingHorizonMinutes,
664
- resumeHysteresisPct: env.AGENTBRIDGE_BUDGET_RESUME_HYSTERESIS_PCT ?? budget.maximize.resumeHysteresisPct
671
+ resumeHysteresisPct: env.AGENTBRIDGE_BUDGET_RESUME_HYSTERESIS_PCT ?? budget.maximize.resumeHysteresisPct,
672
+ admissionAt: env.AGENTBRIDGE_BUDGET_ADMISSION_AT ?? budget.maximize.admissionAt,
673
+ wrapUpQuota: env.AGENTBRIDGE_BUDGET_WRAP_UP_QUOTA ?? budget.maximize.wrapUpQuota
665
674
  },
666
675
  allocation: {
667
676
  minRunwayRatio: env.AGENTBRIDGE_BUDGET_MIN_RUNWAY_RATIO ?? budget.allocation.minRunwayRatio,
@@ -802,7 +811,9 @@ var init_config_service = __esm(() => {
802
811
  reserveSlopePctPerHour: 0.4,
803
812
  reserveMaxPct: 7,
804
813
  finishingHorizonMinutes: 30,
805
- resumeHysteresisPct: 5
814
+ resumeHysteresisPct: 5,
815
+ admissionAt: 85,
816
+ wrapUpQuota: 2
806
817
  },
807
818
  allocation: {
808
819
  minRunwayRatio: 50,
@@ -1533,7 +1544,7 @@ var init_daemon_client = __esm(() => {
1533
1544
  this.ws = null;
1534
1545
  this.rejectPendingReplies("Daemon connection closed");
1535
1546
  }
1536
- async sendReply(message, requireReply, onBusy, idempotencyKey) {
1547
+ async sendReply(message, requireReply, onBusy, idempotencyKey, wrapUp) {
1537
1548
  if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
1538
1549
  return { success: false, error: "AgentBridge daemon is not connected." };
1539
1550
  }
@@ -1548,7 +1559,8 @@ var init_daemon_client = __esm(() => {
1548
1559
  message,
1549
1560
  ...requireReply ? { requireReply: true } : {},
1550
1561
  ...onBusy && onBusy !== "reject" ? { onBusy } : {},
1551
- ...idempotencyKey ? { idempotencyKey } : {}
1562
+ ...idempotencyKey ? { idempotencyKey } : {},
1563
+ ...wrapUp ? { wrapUp: true } : {}
1552
1564
  });
1553
1565
  return pending;
1554
1566
  }
@@ -1670,11 +1682,11 @@ function formatBuildInfo(build) {
1670
1682
  var CODE_HASH_SENTINEL = "source", BUILD_INFO;
1671
1683
  var init_build_info = __esm(() => {
1672
1684
  BUILD_INFO = Object.freeze({
1673
- version: defineString("0.1.18", "0.0.0-source"),
1674
- commit: defineString("9db0aa3", "source"),
1685
+ version: defineString("0.1.19", "0.0.0-source"),
1686
+ commit: defineString("dee06ce", "source"),
1675
1687
  bundle: defineBundle("dist"),
1676
1688
  contractVersion: defineNumber(1, CONTRACT_VERSION),
1677
- codeHash: defineString("46a6407023f0", "source")
1689
+ codeHash: defineString("9ddee00c61f9", "source")
1678
1690
  });
1679
1691
  });
1680
1692