@dadado/agent-kit-cli 6.5.1 → 6.7.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.
- package/dashboard/lib/semantic-model.mjs +49 -2
- package/dist/{add-IT6XFPKT.js → add-NQILLNYA.js} +3 -2
- package/dist/{chunk-GIZNM73K.js → chunk-26KXYR5T.js} +1 -1
- package/dist/{chunk-I2D75F4I.js → chunk-2DETOPCK.js} +11 -9
- package/dist/{chunk-IN4MQ3P3.js → chunk-2KIOZMTV.js} +1 -48
- package/dist/{chunk-TNO7GTAJ.js → chunk-54T36ZDX.js} +5 -3
- package/dist/{chunk-2OIPMQHA.js → chunk-5WDFOFL4.js} +2 -2
- package/dist/{chunk-EI3VQ7FU.js → chunk-5YU3BSCN.js} +2 -2
- package/dist/{chunk-2TCRKQHD.js → chunk-6UKI4CAN.js} +63 -2
- package/dist/{chunk-MEZUW3LL.js → chunk-A3OJLKPH.js} +1 -1
- package/dist/{chunk-4XZXM2ZA.js → chunk-BB22FGQ4.js} +14 -6
- package/dist/{chunk-FM32XR7A.js → chunk-BSYQJ5WF.js} +1 -1
- package/dist/{chunk-U7XOLYDG.js → chunk-BZI5G3OZ.js} +33 -1
- package/dist/chunk-EHY2UZP3.js +52 -0
- package/dist/{chunk-YIOTJQHL.js → chunk-FLP2YVRO.js} +2 -2
- package/dist/{chunk-5LQP4JGH.js → chunk-GSCTZOS7.js} +7 -5
- package/dist/{chunk-34BBPQKI.js → chunk-HOFZX4M2.js} +1 -1
- package/dist/{chunk-WOGBBJCX.js → chunk-NSOWSTAL.js} +5 -3
- package/dist/{chunk-236IYK6L.js → chunk-QE4L2PVJ.js} +20 -135
- package/dist/chunk-QH33EIMD.js +125 -0
- package/dist/{chunk-HKYJG2FJ.js → chunk-S7XAV6JK.js} +4 -4
- package/dist/chunk-TL7AXLEU.js +967 -0
- package/dist/chunk-VZ3O4OKE.js +522 -0
- package/dist/commands-SIM2UP5W.js +92 -0
- package/dist/{contribute-V7PV5UMK.js → contribute-WEYAE7CE.js} +7 -4
- package/dist/{countdown-YONBTSJ2.js → countdown-XYRE4GZU.js} +6 -6
- package/dist/{diff-GWIHGH65.js → diff-ETCHVI7X.js} +6 -4
- package/dist/{doctor-FLIQCVFN.js → doctor-YRHSU3L2.js} +10 -7
- package/dist/{ground-control-6W2AKTKI.js → ground-control-726LRB6Q.js} +3 -3
- package/dist/{hook-2SX2V2T6.js → hook-MUTYISDL.js} +6 -4
- package/dist/index.js +21 -19
- package/dist/{init-4B2IRH27.js → init-7IOQCK6T.js} +13 -10
- package/dist/{install-3JVTG35O.js → install-LUFSJOYK.js} +13 -10
- package/dist/{run-AYT6CRHI.js → run-QG7XQ3XF.js} +7 -7
- package/dist/{run-plan-5XIISG3W.js → run-plan-P7VTOWYI.js} +4 -4
- package/dist/{setup-global-6JM5XTAT.js → setup-global-6JE6LSPE.js} +7 -5
- package/dist/{status-PMAI7NH3.js → status-YZRSVZM2.js} +8 -6
- package/dist/{update-3PLY4FZA.js → update-ZEYO6ZS7.js} +15 -10
- package/package.json +1 -1
- package/dist/chunk-5WSFO35Y.js +0 -1473
|
@@ -1780,6 +1780,40 @@ export function planQueueRole(plan, runQueueView) {
|
|
|
1780
1780
|
return "none";
|
|
1781
1781
|
}
|
|
1782
1782
|
|
|
1783
|
+
/**
|
|
1784
|
+
* In /run-plan-all mode, resolve the queue cursor plan as active when HANDOFF
|
|
1785
|
+
* `Plan:` still names a terminal (or missing) plan, e.g. a /hotfix mini plan the
|
|
1786
|
+
* queue resumed past without handing `Plan:` back. Narrowest condition only:
|
|
1787
|
+
* the cursor resolves, its plan exists with open to-dos, is not parked, and has
|
|
1788
|
+
* no terminal queue outcome. Every other case returns the HANDOFF unchanged
|
|
1789
|
+
* (false negative over guessing).
|
|
1790
|
+
* @param {object[]} plans
|
|
1791
|
+
* @param {object|null} handoff
|
|
1792
|
+
* @returns {object|null} the same handoff, or a copy with `plan`/`planPath` swapped
|
|
1793
|
+
*/
|
|
1794
|
+
export function resolveQueueActiveHandoff(plans, handoff) {
|
|
1795
|
+
if (!handoffPlanKey(handoff)) return handoff;
|
|
1796
|
+
const view = buildRunQueueView(handoff);
|
|
1797
|
+
if (!view || view.cursor === null) return handoff;
|
|
1798
|
+
const cursorKey = view.queue[view.cursor];
|
|
1799
|
+
if (!cursorKey || cursorKey === handoffPlanKey(handoff)) return handoff;
|
|
1800
|
+
if (TERMINAL_QUEUE_OUTCOMES.has(view.outcomes[cursorKey])) return handoff;
|
|
1801
|
+
|
|
1802
|
+
const cursorPlan = (plans || []).find((p) => planFileKey(p) === cursorKey);
|
|
1803
|
+
if (!cursorPlan || todoStats(cursorPlan).open === 0) return handoff;
|
|
1804
|
+
if (isParkedPlan(cursorPlan, handoff)) return handoff;
|
|
1805
|
+
|
|
1806
|
+
const named = (plans || []).find((p) => isExactActivePlan(p, handoff));
|
|
1807
|
+
if (named && todoStats(named).open > 0) return handoff;
|
|
1808
|
+
|
|
1809
|
+
return {
|
|
1810
|
+
...handoff,
|
|
1811
|
+
plan: cursorKey,
|
|
1812
|
+
planPath: cursorPlan.path || `.cursor/plans/${cursorKey}`,
|
|
1813
|
+
planFromQueueCursor: true,
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1783
1817
|
function planFileKey(plan) {
|
|
1784
1818
|
if (!plan) return "";
|
|
1785
1819
|
return String(plan.file || plan.path || plan.id || "")
|
|
@@ -1807,6 +1841,14 @@ function isActivePlan(plan, handoff) {
|
|
|
1807
1841
|
);
|
|
1808
1842
|
}
|
|
1809
1843
|
|
|
1844
|
+
/** Exact basename match with HANDOFF `Plan:` (no substring fallback). */
|
|
1845
|
+
function isExactActivePlan(plan, handoff) {
|
|
1846
|
+
const active = handoffPlanKey(handoff);
|
|
1847
|
+
const key = planFileKey(plan);
|
|
1848
|
+
if (!active || !key) return false;
|
|
1849
|
+
return key === active || key === `${active}.plan.md`;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1810
1852
|
function planListedIn(plan, list) {
|
|
1811
1853
|
if (!Array.isArray(list) || list.length === 0) return false;
|
|
1812
1854
|
const key = planFileKey(plan);
|
|
@@ -1881,17 +1923,21 @@ function modeImpliesExecuting(mode) {
|
|
|
1881
1923
|
* Active plan: terminal todos (open === 0) are always completed, even when Mode
|
|
1882
1924
|
* still says run-plan before Final HANDOFF writes STOPPED/exhausted. Open work
|
|
1883
1925
|
* never classifies as completed (pending/in_progress hold the mission live).
|
|
1926
|
+
* The plan HANDOFF `Plan:` names exactly wins over a Parked/Backlog row: a plan
|
|
1927
|
+
* cannot be active and parked/queued at once, so that row is stale (left behind
|
|
1928
|
+
* when a queue or hotfix activated the plan without removing it).
|
|
1884
1929
|
* @returns {'executing'|'awaiting_user'|'parked'|'backlog'|'incomplete'|'completed'}
|
|
1885
1930
|
*/
|
|
1886
1931
|
export function classifyPlan(plan, handoff) {
|
|
1887
1932
|
const stats = todoStats(plan);
|
|
1933
|
+
const exactActive = isExactActivePlan(plan, handoff);
|
|
1888
1934
|
|
|
1889
|
-
if (isParkedPlan(plan, handoff)) {
|
|
1935
|
+
if (!exactActive && isParkedPlan(plan, handoff)) {
|
|
1890
1936
|
if (stats.open === 0) return "completed";
|
|
1891
1937
|
return "parked";
|
|
1892
1938
|
}
|
|
1893
1939
|
|
|
1894
|
-
if (isBacklogPlan(plan, handoff)) {
|
|
1940
|
+
if (!exactActive && isBacklogPlan(plan, handoff)) {
|
|
1895
1941
|
if (stats.open === 0) return "completed";
|
|
1896
1942
|
return "backlog";
|
|
1897
1943
|
}
|
|
@@ -3838,6 +3884,7 @@ export function buildMissionControlView({
|
|
|
3838
3884
|
gateExitTickets = [],
|
|
3839
3885
|
nowMs = Date.now(),
|
|
3840
3886
|
} = {}) {
|
|
3887
|
+
handoff = resolveQueueActiveHandoff(plans, handoff);
|
|
3841
3888
|
const nowBase = buildCurrentExecution(plans, handoff);
|
|
3842
3889
|
const activeForTiming = (plans || []).find((p) => isActivePlan(p, handoff)) || null;
|
|
3843
3890
|
const { ledger: nextTimingLedger, timing } = observeMissionTiming(
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
REGISTRY_CLI_ARGS,
|
|
7
7
|
resolveRegistryFromCli
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HOFZX4M2.js";
|
|
9
9
|
import {
|
|
10
10
|
logger
|
|
11
11
|
} from "./chunk-ZB43YMHW.js";
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
resolveProtectedGlobs,
|
|
23
23
|
saveManifest,
|
|
24
24
|
upsertIdList
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TL7AXLEU.js";
|
|
26
|
+
import "./chunk-VZ3O4OKE.js";
|
|
26
27
|
import {
|
|
27
28
|
KIT_VERSION
|
|
28
29
|
} from "./chunk-7HDQEK6T.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
formatStaleCliRefusal,
|
|
7
7
|
installL0,
|
|
8
8
|
syncFromManifest
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GSCTZOS7.js";
|
|
10
10
|
import {
|
|
11
11
|
SkippedSymlinkError,
|
|
12
12
|
formatPersonalizationSkippedSymlinks,
|
|
@@ -15,19 +15,21 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
REGISTRY_CLI_ARGS,
|
|
17
17
|
resolveRegistryFromCli
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HOFZX4M2.js";
|
|
19
19
|
import {
|
|
20
20
|
assessClaudeCommandAdapters,
|
|
21
21
|
executeSafeReadinessFixes
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NSOWSTAL.js";
|
|
23
23
|
import {
|
|
24
24
|
writeReadinessSnapshot
|
|
25
25
|
} from "./chunk-HAFRAXGV.js";
|
|
26
26
|
import {
|
|
27
|
-
CLAUDE_HITL_FALLBACK,
|
|
28
|
-
generateClaudeCommandAdapters,
|
|
29
27
|
writeClaudeSessionStartHook
|
|
30
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QE4L2PVJ.js";
|
|
29
|
+
import {
|
|
30
|
+
CLAUDE_HITL_FALLBACK,
|
|
31
|
+
generateClaudeCommandAdapters
|
|
32
|
+
} from "./chunk-QH33EIMD.js";
|
|
31
33
|
import {
|
|
32
34
|
shouldUseWelcomeColor,
|
|
33
35
|
withCliProgress
|
|
@@ -54,13 +56,13 @@ import {
|
|
|
54
56
|
npxPinned,
|
|
55
57
|
pathCliStatus,
|
|
56
58
|
syncPathCliToRuntime
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-5YU3BSCN.js";
|
|
58
60
|
import {
|
|
59
61
|
assessEnvironment
|
|
60
62
|
} from "./chunk-B3VR5YBQ.js";
|
|
61
63
|
import {
|
|
62
64
|
warnIfRunningCliBehindNpm
|
|
63
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-FLP2YVRO.js";
|
|
64
66
|
import {
|
|
65
67
|
DOMAIN_PACK_IDS,
|
|
66
68
|
allPacks,
|
|
@@ -77,7 +79,7 @@ import {
|
|
|
77
79
|
resolveProtectedGlobs,
|
|
78
80
|
saveManifest,
|
|
79
81
|
skillTargetDir
|
|
80
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-TL7AXLEU.js";
|
|
81
83
|
import {
|
|
82
84
|
KIT_VERSION,
|
|
83
85
|
pinnedCliSpec
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
allSkills,
|
|
3
|
-
loadPackManifest,
|
|
4
|
-
loadRegistry,
|
|
5
|
-
packMemberFileTargets,
|
|
6
|
-
skillFileTargets
|
|
7
|
-
} from "./chunk-5WSFO35Y.js";
|
|
8
|
-
|
|
9
1
|
// src/lifecycle/l0.ts
|
|
10
2
|
var L0_ARTIFACTS = [
|
|
11
3
|
// Rules
|
|
@@ -305,45 +297,6 @@ var L0_ARTIFACTS = [
|
|
|
305
297
|
}
|
|
306
298
|
];
|
|
307
299
|
|
|
308
|
-
// src/lifecycle/targets.ts
|
|
309
|
-
import path from "path";
|
|
310
|
-
var toPosix = (rel) => rel.split(path.sep).join("/");
|
|
311
|
-
async function managedPairs(registryRoot, manifest, index) {
|
|
312
|
-
const pairs = [];
|
|
313
|
-
const missingSkills = [];
|
|
314
|
-
const push = (sourceRel, targetRel, origin) => {
|
|
315
|
-
pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
|
|
316
|
-
};
|
|
317
|
-
for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
|
|
318
|
-
for (const packId of manifest.packs ?? []) {
|
|
319
|
-
const pack = await loadPackManifest(registryRoot, packId);
|
|
320
|
-
for (const member of pack.members) {
|
|
321
|
-
for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
|
|
322
|
-
push(sourceRel, targetRel, "pack");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if ((manifest.skills ?? []).length > 0) {
|
|
327
|
-
const pool = allSkills(index ?? await loadRegistry(registryRoot));
|
|
328
|
-
for (const id of manifest.skills ?? []) {
|
|
329
|
-
const skill = pool.find((s) => s.id === id);
|
|
330
|
-
if (!skill) {
|
|
331
|
-
missingSkills.push(id);
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
for (const { sourceRel, targetRel } of await skillFileTargets(
|
|
335
|
-
registryRoot,
|
|
336
|
-
skill.path,
|
|
337
|
-
skill.id
|
|
338
|
-
)) {
|
|
339
|
-
push(sourceRel, targetRel, "skill");
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
return { pairs, missingSkills };
|
|
344
|
-
}
|
|
345
|
-
|
|
346
300
|
export {
|
|
347
|
-
L0_ARTIFACTS
|
|
348
|
-
managedPairs
|
|
301
|
+
L0_ARTIFACTS
|
|
349
302
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
managedPairs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EHY2UZP3.js";
|
|
4
4
|
import {
|
|
5
5
|
isProtectedPath,
|
|
6
|
-
resolveContained,
|
|
7
6
|
resolveProtectedGlobs
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TL7AXLEU.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveContained
|
|
10
|
+
} from "./chunk-VZ3O4OKE.js";
|
|
9
11
|
|
|
10
12
|
// src/lifecycle/diff.ts
|
|
11
13
|
import { readFile } from "fs/promises";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
classifyGateExit,
|
|
9
9
|
landGateExit
|
|
10
|
-
} from "./chunk-
|
|
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-
|
|
28
|
+
} from "./chunk-6UKI4CAN.js";
|
|
29
29
|
import {
|
|
30
30
|
LineSplitter,
|
|
31
31
|
formatHitlSummary,
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
compareSemver,
|
|
6
6
|
normalizeSemver
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FLP2YVRO.js";
|
|
8
8
|
import {
|
|
9
9
|
MANIFEST_RELATIVE_PATH
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TL7AXLEU.js";
|
|
11
11
|
import {
|
|
12
12
|
KIT_VERSION,
|
|
13
13
|
pinnedCliSpec
|
|
@@ -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 [
|
|
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-
|
|
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
|
}
|
|
@@ -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-
|
|
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();
|
|
@@ -180,6 +211,7 @@ async function ensureDispatchLogPath(root) {
|
|
|
180
211
|
}
|
|
181
212
|
|
|
182
213
|
export {
|
|
214
|
+
RUN_CATALOG,
|
|
183
215
|
normalizeSlashName,
|
|
184
216
|
classifySlash,
|
|
185
217
|
rewriteRootArgvToRun,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
L0_ARTIFACTS
|
|
3
|
+
} from "./chunk-2KIOZMTV.js";
|
|
4
|
+
import {
|
|
5
|
+
allSkills,
|
|
6
|
+
loadPackManifest,
|
|
7
|
+
loadRegistry,
|
|
8
|
+
packMemberFileTargets,
|
|
9
|
+
skillFileTargets
|
|
10
|
+
} from "./chunk-TL7AXLEU.js";
|
|
11
|
+
|
|
12
|
+
// src/lifecycle/targets.ts
|
|
13
|
+
import path from "path";
|
|
14
|
+
var toPosix = (rel) => rel.split(path.sep).join("/");
|
|
15
|
+
async function managedPairs(registryRoot, manifest, index) {
|
|
16
|
+
const pairs = [];
|
|
17
|
+
const missingSkills = [];
|
|
18
|
+
const push = (sourceRel, targetRel, origin) => {
|
|
19
|
+
pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
|
|
20
|
+
};
|
|
21
|
+
for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
|
|
22
|
+
for (const packId of manifest.packs ?? []) {
|
|
23
|
+
const pack = await loadPackManifest(registryRoot, packId);
|
|
24
|
+
for (const member of pack.members) {
|
|
25
|
+
for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
|
|
26
|
+
push(sourceRel, targetRel, "pack");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if ((manifest.skills ?? []).length > 0) {
|
|
31
|
+
const pool = allSkills(index ?? await loadRegistry(registryRoot));
|
|
32
|
+
for (const id of manifest.skills ?? []) {
|
|
33
|
+
const skill = pool.find((s) => s.id === id);
|
|
34
|
+
if (!skill) {
|
|
35
|
+
missingSkills.push(id);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
for (const { sourceRel, targetRel } of await skillFileTargets(
|
|
39
|
+
registryRoot,
|
|
40
|
+
skill.path,
|
|
41
|
+
skill.id
|
|
42
|
+
)) {
|
|
43
|
+
push(sourceRel, targetRel, "skill");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { pairs, missingSkills };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
managedPairs
|
|
52
|
+
};
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
diffAgainstRegistry,
|
|
8
8
|
summarizeDiff
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-54T36ZDX.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_REGISTRY_URL,
|
|
12
12
|
assertSafeRegistrySource,
|
|
13
13
|
loadAgentKitManifest,
|
|
14
14
|
resolveRegistryRoot
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TL7AXLEU.js";
|
|
16
16
|
import {
|
|
17
17
|
KIT_PACKAGE_SPEC,
|
|
18
18
|
KIT_VERSION
|
|
@@ -2,22 +2,24 @@ import {
|
|
|
2
2
|
compareSemver,
|
|
3
3
|
normalizeSemver,
|
|
4
4
|
readLocalKitVersion
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FLP2YVRO.js";
|
|
6
6
|
import {
|
|
7
7
|
L0_ARTIFACTS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2KIOZMTV.js";
|
|
9
9
|
import {
|
|
10
10
|
copyRegistryFile,
|
|
11
11
|
emptyStats,
|
|
12
12
|
installPack,
|
|
13
13
|
installSkillsByIds,
|
|
14
|
-
loadManagedHashLedger,
|
|
15
14
|
loadRegistry,
|
|
16
15
|
mergeStats,
|
|
17
16
|
recordOutcome,
|
|
18
|
-
resolveProtectedGlobs
|
|
17
|
+
resolveProtectedGlobs
|
|
18
|
+
} from "./chunk-TL7AXLEU.js";
|
|
19
|
+
import {
|
|
20
|
+
loadManagedHashLedger,
|
|
19
21
|
saveManagedHashLedger
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VZ3O4OKE.js";
|
|
21
23
|
import {
|
|
22
24
|
KIT_PACKAGE_SPEC,
|
|
23
25
|
KIT_VERSION
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CLAUDE_COMMANDS_DIR_REL,
|
|
3
2
|
CLAUDE_SETTINGS_REL,
|
|
4
3
|
GUARD_SHELL_HOOK_MARKER,
|
|
5
4
|
RESOLVE_AGENT_KIT_REL,
|
|
6
|
-
SESSION_START_HOOK_MARKER
|
|
5
|
+
SESSION_START_HOOK_MARKER
|
|
6
|
+
} from "./chunk-QE4L2PVJ.js";
|
|
7
|
+
import {
|
|
8
|
+
CLAUDE_COMMANDS_DIR_REL,
|
|
7
9
|
discoverInstalledCommands
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QH33EIMD.js";
|
|
9
11
|
import {
|
|
10
12
|
findOnPath
|
|
11
13
|
} from "./chunk-WGLPZXNU.js";
|