@dadado/agent-kit-cli 6.5.1 → 6.6.0

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.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  claudeRedactions,
6
6
  redactSecrets
7
- } from "./chunk-2TCRKQHD.js";
7
+ } from "./chunk-6UKI4CAN.js";
8
8
  import {
9
9
  findHitlGateInText
10
10
  } from "./chunk-MTLQN57O.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  classifyGateExit,
9
9
  landGateExit
10
- } from "./chunk-GIZNM73K.js";
10
+ } from "./chunk-26KXYR5T.js";
11
11
  import {
12
12
  InputLine,
13
13
  ScrollRegion,
@@ -25,7 +25,7 @@ import {
25
25
  parseStreamLine,
26
26
  redactSecrets,
27
27
  renderStreamEvent
28
- } from "./chunk-2TCRKQHD.js";
28
+ } from "./chunk-6UKI4CAN.js";
29
29
  import {
30
30
  LineSplitter,
31
31
  formatHitlSummary,
@@ -1249,6 +1249,10 @@ var VENDOR_SECRET_ENV = [
1249
1249
  "CODEX_API_KEY",
1250
1250
  "CODEX_ACCESS_TOKEN"
1251
1251
  ];
1252
+ var OPENROUTER_SECRET_ENV = [
1253
+ "OPENROUTER_API_KEY",
1254
+ "ORI_HARNESS_CREDENTIAL_TOKEN"
1255
+ ];
1252
1256
  var FORGE_SECRET_ENV = ["GH_TOKEN", "GITHUB_TOKEN", "GITLAB_TOKEN", "GLAB_TOKEN"];
1253
1257
  var REDACT_DERIVED_MIN_CHARS = 4;
1254
1258
  var REDACT_DERIVED_SKIP = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"]);
@@ -1285,7 +1289,12 @@ function claudeRedactions(env) {
1285
1289
  seen.add(value);
1286
1290
  entries.push({ label, value });
1287
1291
  };
1288
- for (const key of [...CLAUDE_ENV_PASSTHROUGH, ...VENDOR_SECRET_ENV, ...FORGE_SECRET_ENV]) {
1292
+ for (const key of [
1293
+ ...CLAUDE_ENV_PASSTHROUGH,
1294
+ ...VENDOR_SECRET_ENV,
1295
+ ...OPENROUTER_SECRET_ENV,
1296
+ ...FORGE_SECRET_ENV
1297
+ ]) {
1289
1298
  const value = env[key];
1290
1299
  if (!value) continue;
1291
1300
  add(key, value, false);
@@ -1752,12 +1761,63 @@ var claudeBackend = {
1752
1761
  }
1753
1762
  }
1754
1763
  };
1764
+ var openrouterBackend = {
1765
+ id: "openrouter",
1766
+ async resolve() {
1767
+ return whichBinary("ori");
1768
+ },
1769
+ async run(opts) {
1770
+ const log = opts.log ?? ((line3) => console.log(line3));
1771
+ const env = claudeChildEnv(opts.env);
1772
+ const redact = claudeRedactions(env);
1773
+ const adapter = await missingClaudeAdapter(opts.workspace, opts.prompt);
1774
+ if (adapter) {
1775
+ throw new Error(
1776
+ `openrouter backend: ${adapter} is missing in the workspace, so the tick's leading slash would be sent as literal text. Generate the Claude Code adapters with \`agent-kit install --claude\` and retry.`
1777
+ );
1778
+ }
1779
+ const { caps, invalid } = claudeRunCaps(env);
1780
+ for (const problem of invalid)
1781
+ log(`openrouter tick: ignoring invalid ${problem}; running uncapped.`);
1782
+ const capText = [
1783
+ caps.maxTurns !== void 0 ? `max-turns=${caps.maxTurns}` : null,
1784
+ caps.maxBudgetUsd !== void 0 ? `max-budget-usd=${caps.maxBudgetUsd}` : null
1785
+ ].filter(Boolean).join(" ");
1786
+ const presence = [...CLAUDE_ENV_PASSTHROUGH, ...OPENROUTER_SECRET_ENV].map((key) => `${key}=${env[key] ? "set" : "unset"}`).join(" ");
1787
+ log(
1788
+ `openrouter tick: ori claude -p (OpenRouter credentials, bypass permissions, stream-json, stdin relay${capText ? `, ${capText}` : ""}). env: ${presence}`
1789
+ );
1790
+ const args = openrouterArgs({ model: opts.model, ...caps });
1791
+ try {
1792
+ return await spawnLogged("ori", args, opts.logPath, {
1793
+ cwd: opts.workspace,
1794
+ env,
1795
+ spawnFn: opts.spawnFn,
1796
+ redact,
1797
+ hitl: resolveHitlRunOptions(opts.hitl, {
1798
+ kind: "stdin-stream-json",
1799
+ firstPrompt: opts.prompt
1800
+ }),
1801
+ render: opts.render,
1802
+ onSpawn: opts.onSpawn,
1803
+ backendId: "openrouter"
1804
+ });
1805
+ } catch (err) {
1806
+ throw new Error(`openrouter backend failed to start: ${redactSecrets(String(err), redact)}`);
1807
+ }
1808
+ }
1809
+ };
1810
+ function openrouterArgs(opts = {}) {
1811
+ const { model, ...caps } = opts;
1812
+ return ["claude", ...model ? ["--model", model] : [], "--", ...claudeHeadlessArgs({ ...caps })];
1813
+ }
1755
1814
  function backends() {
1756
1815
  return {
1757
1816
  "cursor-agent": cursorAgentBackend,
1758
1817
  claude: claudeBackend,
1759
1818
  codex: codexBackend,
1760
- "cursor-acp": cursorAcpBackend
1819
+ "cursor-acp": cursorAcpBackend,
1820
+ openrouter: openrouterBackend
1761
1821
  };
1762
1822
  }
1763
1823
  function getBackend(id) {
@@ -1789,5 +1849,6 @@ export {
1789
1849
  checkClaudeVersion,
1790
1850
  claudeHeadlessArgs,
1791
1851
  claudeReviewArgs,
1852
+ openrouterArgs,
1792
1853
  getBackend
1793
1854
  };
@@ -1,18 +1,26 @@
1
1
  import {
2
2
  whichBinary
3
- } from "./chunk-2TCRKQHD.js";
3
+ } from "./chunk-6UKI4CAN.js";
4
4
 
5
5
  // src/plan-loop/detect.ts
6
6
  var DETECT_ORDER = ["cursor-agent", "claude"];
7
- var EXPLICIT_ONLY_BACKENDS = ["codex", "cursor-acp"];
7
+ var EXPLICIT_ONLY_BACKENDS = ["codex", "cursor-acp", "openrouter"];
8
8
  var INSTALL_HINTS = {
9
9
  "cursor-agent": "Install the Cursor Agent CLI and ensure `cursor-agent` is on PATH (https://cursor.com/docs/cli).",
10
10
  claude: "Install Claude Code and ensure `claude` is on PATH (https://code.claude.com/docs/en/quickstart).",
11
11
  "cursor-acp": "Install the Cursor Agent CLI and ensure `cursor-agent` is on PATH (https://cursor.com/docs/cli/acp); sign in with `cursor-agent login`.",
12
- codex: "Install the Codex CLI and ensure `codex` is on PATH (https://developers.openai.com/codex/cli)."
12
+ codex: "Install the Codex CLI and ensure `codex` is on PATH (https://developers.openai.com/codex/cli).",
13
+ openrouter: "Install Ori and ensure `ori` is on PATH, then sign in with `ori login` (OpenRouter credentials). The kit never falls back to a first-party `claude` here: that would bill Anthropic instead of OpenRouter."
14
+ };
15
+ var BACKEND_BIN = {
16
+ "cursor-agent": "cursor-agent",
17
+ claude: "claude",
18
+ codex: "codex",
19
+ "cursor-acp": "cursor-agent",
20
+ openrouter: "ori"
13
21
  };
14
22
  function isBackendId(id) {
15
- return id === "cursor-agent" || id === "claude" || id === "codex" || id === "cursor-acp";
23
+ return id === "cursor-agent" || id === "claude" || id === "codex" || id === "cursor-acp" || id === "openrouter";
16
24
  }
17
25
  function isRequestedBackend(id) {
18
26
  return id === "auto" || isBackendId(id);
@@ -48,9 +56,9 @@ async function detectAgentBackend(requested, whichFn = whichBinary) {
48
56
  ].join(" ")
49
57
  };
50
58
  }
51
- const bin = await whichFn(id);
59
+ const bin = await whichFn(BACKEND_BIN[id]);
52
60
  if (!bin) {
53
- return { ok: false, message: `${id} not found on PATH. ${INSTALL_HINTS[id]}` };
61
+ return { ok: false, message: `${BACKEND_BIN[id]} not found on PATH. ${INSTALL_HINTS[id]}` };
54
62
  }
55
63
  return { ok: true, id, bin };
56
64
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  gateExitNotePath
3
- } from "./chunk-GIZNM73K.js";
3
+ } from "./chunk-26KXYR5T.js";
4
4
 
5
5
  // src/plan-loop/merge-detect.ts
6
6
  async function isAncestor(git, ref, baseRef) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isBranchInBase
3
- } from "./chunk-FM32XR7A.js";
3
+ } from "./chunk-BSYQJ5WF.js";
4
4
  import {
5
5
  GATE_EXIT_BRANCH_PREFIX,
6
6
  GATE_EXIT_NOTE_DIR,
@@ -11,7 +11,7 @@ import {
11
11
  isSafeBaseRef,
12
12
  landGateExit,
13
13
  resolveGateExitRefs
14
- } from "./chunk-GIZNM73K.js";
14
+ } from "./chunk-26KXYR5T.js";
15
15
  import {
16
16
  ensurePathIgnored
17
17
  } from "./chunk-MUTTNRX4.js";
@@ -19,10 +19,10 @@ import {
19
19
  ensureDispatchLogPath,
20
20
  readCommandFile,
21
21
  runHeadlessDispatch
22
- } from "./chunk-U7XOLYDG.js";
22
+ } from "./chunk-WUEXATDP.js";
23
23
  import {
24
24
  redactSecrets
25
- } from "./chunk-2TCRKQHD.js";
25
+ } from "./chunk-6UKI4CAN.js";
26
26
  import {
27
27
  formatHitlSummary,
28
28
  hitlExitCode
@@ -9,10 +9,11 @@ import {
9
9
  cursorAcpBackend,
10
10
  cursorAgentHeadlessArgs,
11
11
  cursorAgentReviewArgs,
12
+ openrouterArgs,
12
13
  redactSecrets,
13
14
  resolveHitlRunOptions,
14
15
  spawnLogged
15
- } from "./chunk-2TCRKQHD.js";
16
+ } from "./chunk-6UKI4CAN.js";
16
17
  import {
17
18
  RESERVED_GATE_IDS
18
19
  } from "./chunk-MTLQN57O.js";
@@ -127,6 +128,36 @@ async function runHeadlessDispatch(opts) {
127
128
  onSpawn: opts.onSpawn
128
129
  });
129
130
  }
131
+ if (opts.backendId === "openrouter") {
132
+ const log = opts.log ?? ((line) => console.log(line));
133
+ const env = claudeChildEnv();
134
+ const redact = claudeRedactions(env);
135
+ const { caps, invalid } = claudeRunCaps(env);
136
+ for (const problem of invalid)
137
+ log(`openrouter dispatch: ignoring invalid ${problem}; running uncapped.`);
138
+ try {
139
+ return await spawnLogged(
140
+ "ori",
141
+ openrouterArgs({ model: opts.model, ...caps }),
142
+ opts.logPath,
143
+ {
144
+ cwd: opts.workspace,
145
+ env,
146
+ redact,
147
+ spawnFn: opts.spawnFn,
148
+ hitl: resolveHitlRunOptions(opts.hitl, {
149
+ kind: "stdin-stream-json",
150
+ firstPrompt: opts.prompt
151
+ }),
152
+ render: opts.render,
153
+ onSpawn: opts.onSpawn,
154
+ backendId: "openrouter"
155
+ }
156
+ );
157
+ } catch (err) {
158
+ throw new Error(`openrouter dispatch failed to start: ${redactSecrets(String(err), redact)}`);
159
+ }
160
+ }
130
161
  if (opts.backendId === "claude") {
131
162
  const log = opts.log ?? ((line) => console.log(line));
132
163
  const env = claudeChildEnv();
@@ -4,12 +4,12 @@ import {
4
4
  REVIEW_PACK_SLASH,
5
5
  parseReviewPackMaxBytes,
6
6
  reviewBackendMessage
7
- } from "./chunk-HKYJG2FJ.js";
7
+ } from "./chunk-U2IMEYGQ.js";
8
8
  import {
9
9
  detectAgentBackend,
10
10
  listDetectBackendIds
11
- } from "./chunk-4XZXM2ZA.js";
12
- import "./chunk-FM32XR7A.js";
11
+ } from "./chunk-BB22FGQ4.js";
12
+ import "./chunk-BSYQJ5WF.js";
13
13
  import {
14
14
  GATE_EXIT_MARKER_RELPATH,
15
15
  defaultExec,
@@ -20,20 +20,20 @@ import {
20
20
  readGateExitMarker,
21
21
  resolveGateExitRefs,
22
22
  writeGateExitMarker
23
- } from "./chunk-GIZNM73K.js";
23
+ } from "./chunk-26KXYR5T.js";
24
24
  import "./chunk-MUTTNRX4.js";
25
25
  import {
26
26
  classifySlash,
27
27
  normalizeSlashName,
28
28
  promoteBlockedMessage,
29
29
  unknownSlashMessage
30
- } from "./chunk-U7XOLYDG.js";
30
+ } from "./chunk-WUEXATDP.js";
31
31
  import {
32
32
  CLAUDE_MAX_BUDGET_USD_ENV,
33
33
  CLAUDE_MAX_TURNS_ENV,
34
34
  RedactingStreamBuffer,
35
35
  redactSecrets
36
- } from "./chunk-2TCRKQHD.js";
36
+ } from "./chunk-6UKI4CAN.js";
37
37
  import {
38
38
  HITL_UNANSWERED_EXIT_CODE
39
39
  } from "./chunk-MTLQN57O.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blobId,
3
3
  isTicketMerged
4
- } from "./chunk-FM32XR7A.js";
4
+ } from "./chunk-BSYQJ5WF.js";
5
5
  import {
6
6
  GATE_EXIT_BRANCH_PREFIX,
7
7
  GATE_EXIT_MARKER_RELPATH,
@@ -16,11 +16,11 @@ import {
16
16
  readGateExitMarker,
17
17
  resolveGateExitRefs,
18
18
  writeGateExitMarker
19
- } from "./chunk-GIZNM73K.js";
19
+ } from "./chunk-26KXYR5T.js";
20
20
  import "./chunk-MUTTNRX4.js";
21
21
  import {
22
22
  redactSecrets
23
- } from "./chunk-2TCRKQHD.js";
23
+ } from "./chunk-6UKI4CAN.js";
24
24
  import "./chunk-MTLQN57O.js";
25
25
  import {
26
26
  findOnPath
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  rewriteRootArgvToRun
4
- } from "./chunk-U7XOLYDG.js";
5
- import "./chunk-2TCRKQHD.js";
4
+ } from "./chunk-WUEXATDP.js";
5
+ import "./chunk-6UKI4CAN.js";
6
6
  import "./chunk-MTLQN57O.js";
7
7
  import "./chunk-WGLPZXNU.js";
8
8
  import "./chunk-6RRG3WOE.js";
@@ -239,11 +239,11 @@ var main = defineCommand({
239
239
  contribute: () => import("./contribute-V7PV5UMK.js").then((m) => m.contributeCommand),
240
240
  handoff: () => import("./handoff-5AGE2D3T.js").then((m) => m.handoffCommand),
241
241
  "plan-index": () => import("./plan-index-BNLUU6T5.js").then((m) => m.planIndexCommand),
242
- run: () => import("./run-AYT6CRHI.js").then((m) => m.runCommand),
243
- "run-plan": () => import("./run-plan-5XIISG3W.js").then((m) => m.runPlanCommand),
244
- "run-plan-all": () => import("./run-AYT6CRHI.js").then((m) => m.runPlanAllCommand),
245
- countdown: () => import("./countdown-YONBTSJ2.js").then((m) => m.countdownCommand),
246
- "ground-control": () => import("./ground-control-6W2AKTKI.js").then((m) => m.groundControlCommand),
242
+ run: () => import("./run-CWA6Q4TC.js").then((m) => m.runCommand),
243
+ "run-plan": () => import("./run-plan-P7VTOWYI.js").then((m) => m.runPlanCommand),
244
+ "run-plan-all": () => import("./run-CWA6Q4TC.js").then((m) => m.runPlanAllCommand),
245
+ countdown: () => import("./countdown-YZSJQXYS.js").then((m) => m.countdownCommand),
246
+ "ground-control": () => import("./ground-control-726LRB6Q.js").then((m) => m.groundControlCommand),
247
247
  dashboard: () => import("./dashboard-YNCFISNO.js").then((m) => m.dashboardCommand),
248
248
  "dashboard-broadcast": () => import("./dashboard-broadcast-NK7PU72L.js").then((m) => m.dashboardBroadcastCommand),
249
249
  "mission-control": () => import("./mission-control-MHQU73XC.js").then((m) => m.missionControlCommand),
@@ -2,22 +2,22 @@ import {
2
2
  runPlanLoop,
3
3
  shouldUseLiveTui,
4
4
  withLiveTui
5
- } from "./chunk-2OIPMQHA.js";
5
+ } from "./chunk-5WDFOFL4.js";
6
6
  import "./chunk-R6WH5P7R.js";
7
7
  import {
8
8
  REVIEW_PACK_SLASH,
9
9
  runReviewJob
10
- } from "./chunk-HKYJG2FJ.js";
10
+ } from "./chunk-U2IMEYGQ.js";
11
11
  import {
12
12
  detectAgentBackend,
13
13
  listDetectBackendIds
14
- } from "./chunk-4XZXM2ZA.js";
15
- import "./chunk-FM32XR7A.js";
14
+ } from "./chunk-BB22FGQ4.js";
15
+ import "./chunk-BSYQJ5WF.js";
16
16
  import {
17
17
  LAND_ON_GATE_DESCRIPTION,
18
18
  classifyGateExit,
19
19
  landGateExit
20
- } from "./chunk-GIZNM73K.js";
20
+ } from "./chunk-26KXYR5T.js";
21
21
  import "./chunk-3LLXDHIU.js";
22
22
  import {
23
23
  negatedFlag
@@ -33,10 +33,10 @@ import {
33
33
  readCommandFile,
34
34
  runHeadlessDispatch,
35
35
  unknownSlashMessage
36
- } from "./chunk-U7XOLYDG.js";
36
+ } from "./chunk-WUEXATDP.js";
37
37
  import {
38
38
  getBackend
39
- } from "./chunk-2TCRKQHD.js";
39
+ } from "./chunk-6UKI4CAN.js";
40
40
  import {
41
41
  HITL_UNANSWERED_EXIT_CODE,
42
42
  formatHitlSummary,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  runPlanLoop
3
- } from "./chunk-2OIPMQHA.js";
3
+ } from "./chunk-5WDFOFL4.js";
4
4
  import {
5
5
  DRIVER_EVENTS_FORMATS
6
6
  } from "./chunk-R6WH5P7R.js";
7
7
  import {
8
8
  detectAgentBackend,
9
9
  listDetectBackendIds
10
- } from "./chunk-4XZXM2ZA.js";
10
+ } from "./chunk-BB22FGQ4.js";
11
11
  import {
12
12
  LAND_ON_GATE_DESCRIPTION
13
- } from "./chunk-GIZNM73K.js";
13
+ } from "./chunk-26KXYR5T.js";
14
14
  import "./chunk-3LLXDHIU.js";
15
15
  import {
16
16
  negatedFlag
@@ -19,7 +19,7 @@ import "./chunk-L5V3W3DY.js";
19
19
  import "./chunk-MUTTNRX4.js";
20
20
  import {
21
21
  getBackend
22
- } from "./chunk-2TCRKQHD.js";
22
+ } from "./chunk-6UKI4CAN.js";
23
23
  import {
24
24
  HITL_UNANSWERED_EXIT_CODE
25
25
  } from "./chunk-MTLQN57O.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dadado/agent-kit-cli",
3
- "version": "6.5.1",
3
+ "version": "6.6.0",
4
4
  "description": "Agent Kit CLI: HITL framework install and tooling for AI-assisted IDEs (rules, skills, plan/handoff, context).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",