@outerlayer/cli 0.11.0 → 0.13.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/CHANGELOG.md +23 -0
- package/README.md +16 -7
- package/dist/{agent-setup-YEFN74Y4.js → agent-setup-QE6PSCEZ.js} +8 -8
- package/dist/build-info.json +1 -1
- package/dist/{builder-PP436VGZ.js → builder-UUS4ORDH.js} +3 -3
- package/dist/{check-YDXOLVJ5.js → check-63IDCEEV.js} +31 -30
- package/dist/{chunk-XR3BJN33.js → chunk-22RMZBGW.js} +20 -1
- package/dist/{chunk-TB7EP24C.js → chunk-2M63GG56.js} +1 -1
- package/dist/{chunk-Y6P5XX2B.js → chunk-3D4OYFCD.js} +4 -4
- package/dist/{chunk-2GBCTEN4.js → chunk-3KTA5UU2.js} +1 -1
- package/dist/{chunk-USO2DKBD.js → chunk-4KSQKQXE.js} +8 -2
- package/dist/{chunk-UES67HLJ.js → chunk-4QVZCVWT.js} +5 -5
- package/dist/{chunk-I263FZ3A.js → chunk-6S3H3J6H.js} +3 -3
- package/dist/{chunk-BHOBM3IZ.js → chunk-C6IV5BV7.js} +10 -10
- package/dist/{chunk-VDI5POCC.js → chunk-CNFVHDHG.js} +1 -1
- package/dist/{chunk-EOWWTFUU.js → chunk-DPKX26LT.js} +92 -16
- package/dist/{chunk-SUMWRA7K.js → chunk-DXQ5MHCO.js} +1 -1
- package/dist/{chunk-ZQ5JGHUO.js → chunk-EFZLAYPE.js} +2 -2
- package/dist/{chunk-RWQWPZB4.js → chunk-GI4XXD4I.js} +3 -3
- package/dist/{chunk-YU5GL7QS.js → chunk-HDTVTA6I.js} +2 -2
- package/dist/{chunk-BFESLKPP.js → chunk-IP7BIBXJ.js} +19 -1
- package/dist/{chunk-YT35WGIP.js → chunk-J5M7BSJQ.js} +99 -7
- package/dist/{chunk-IU4NZROR.js → chunk-JXYVA45C.js} +1 -1
- package/dist/{chunk-BMX3L7CR.js → chunk-LCEXHCHD.js} +1 -1
- package/dist/{chunk-7C4T5BGN.js → chunk-MJXXRX4M.js} +54 -12
- package/dist/{chunk-E5DC4VZL.js → chunk-MZN7AQOB.js} +8 -8
- package/dist/{chunk-CJGQQZWB.js → chunk-NX57IBNK.js} +1 -1
- package/dist/{chunk-DTDZXDQ3.js → chunk-P4MM66C6.js} +31 -18
- package/dist/{chunk-BEZSECPA.js → chunk-P6FX4D43.js} +1 -1
- package/dist/{chunk-A56PYPDF.js → chunk-R7OQTKWT.js} +2 -1
- package/dist/{chunk-TFIOXPZT.js → chunk-RLYZLUQ7.js} +67 -5
- package/dist/chunk-RMWLBUCJ.js +50 -0
- package/dist/{chunk-4HMXH2OA.js → chunk-SFFHGX3G.js} +1 -1
- package/dist/{chunk-3YFCWYBU.js → chunk-SVEP7PVH.js} +14 -14
- package/dist/chunk-T5VPP6H7.js +65 -0
- package/dist/{chunk-BGWTYRSS.js → chunk-TCIW27FM.js} +1 -1
- package/dist/{chunk-R7BJYFD2.js → chunk-TOPDNXHZ.js} +5 -5
- package/dist/{chunk-HKUH5AR2.js → chunk-XJKL4BNU.js} +3 -3
- package/dist/{cli-RQZXTOEI.js → cli-WSBIAVZU.js} +176 -88
- package/dist/{command-U6UGIBVT.js → command-N7BAB4XJ.js} +21 -22
- package/dist/{config-MKBX2ZQD.js → config-N3C6DFQA.js} +1 -1
- package/dist/{connect-cmd-5MIUNYAY.js → connect-cmd-FGYRLLXL.js} +5 -5
- package/dist/{context-adopt-A77G67CP.js → context-adopt-B3PWGFHL.js} +5 -5
- package/dist/{context-materialize-KQZYATQZ.js → context-materialize-7S6NLLRO.js} +5 -5
- package/dist/{dist-3M3ZMEZF.js → dist-LKDWQWZ7.js} +2 -2
- package/dist/{docker-WVRRMK6R.js → docker-BZ55BMBJ.js} +4 -4
- package/dist/{doctor-ZF4PYWVN.js → doctor-3H25Q7WT.js} +23 -20
- package/dist/{emit-artifact-cmd-VKPW577P.js → emit-artifact-cmd-IQCRXOH7.js} +9 -9
- package/dist/{emit-cmd-SU62J2PB.js → emit-cmd-KDSM5VAO.js} +4 -4
- package/dist/{emit-criteria-cmd-U2TL6FYY.js → emit-criteria-cmd-EYUXME26.js} +7 -7
- package/dist/emit-finding-cmd-P4RKBPBB.js +465 -0
- package/dist/{emit-result-cmd-GKBVPMU4.js → emit-result-cmd-6XYENU6H.js} +9 -9
- package/dist/{hook-fast-AQCAQIA6.js → hook-fast-PXWKQPN6.js} +1 -1
- package/dist/{import-capture-cmd-5NJVL2HN.js → import-capture-cmd-2BKM5I2N.js} +3 -3
- package/dist/{import-ruler-cmd-TUK3MRPC.js → import-ruler-cmd-IXR7YK47.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/{init-PUY2BUHH.js → init-2LWVS4AH.js} +21 -17
- package/dist/{init-M5IBAGVE.js → init-ZL7ORPTF.js} +53 -32
- package/dist/{init-cmd-NPNR23UL.js → init-cmd-JXOBCOIB.js} +16 -14
- package/dist/{install-HKOVISUP.js → install-HDBIPHTX.js} +2 -4
- package/dist/{login-browser-7XGSV7MA.js → login-browser-QZCS3WW6.js} +2 -1
- package/dist/{loop-3FNROLW7.js → loop-XOAE6ZIY.js} +32 -30
- package/dist/{machine-RWDDJRWB.js → machine-G6PY2J2J.js} +16 -16
- package/dist/{mcp-install-cmd-XZARXNYT.js → mcp-install-cmd-VXVIH7PH.js} +1 -1
- package/dist/runner-env-XTC53CHN.js +15 -0
- package/dist/runner-key-TDTLNAKJ.js +154 -0
- package/dist/{session-sender-E3UHGSNV.js → session-sender-XVGZFWRK.js} +7 -7
- package/dist/{starter-pack-I35VNYAR.js → starter-pack-B7JPGEDO.js} +4 -4
- package/dist/{status-2OW5AKWL.js → status-MRTPG34B.js} +22 -22
- package/dist/{sync-cmd-ULKXCHO2.js → sync-cmd-UBUZMMDN.js} +6 -6
- package/dist/{watch-IU6NHB4K.js → watch-STNPEWD6.js} +6 -6
- package/dist/{work-claim-cmd-LXXSNEGF.js → work-claim-cmd-CWGYEIJE.js} +11 -11
- package/dist/{work-cmd-ZJY3NA2G.js → work-cmd-X7NMJDFL.js} +8 -8
- package/dist/{work-comment-cmd-34FTLPUO.js → work-comment-cmd-FI2TMAYQ.js} +8 -8
- package/dist/{work-open-pr-cmd-YZAENDP6.js → work-open-pr-cmd-OVHJ5I5H.js} +9 -9
- package/dist/{work-pr-cmd-EXTOGBJC.js → work-pr-cmd-Y5TDMQ4O.js} +8 -8
- package/package.json +1 -1
- package/skill-pack/maintained/reporting-findings/SKILL.md +84 -5
- package/skill-pack/template/build/SKILL.md +60 -33
- package/skill-pack/template/build/references/agent-briefs.md +4 -2
- package/skill-pack/template/build/references/release.md +1 -1
- package/skill-pack/template/build/references/review-loop.md +6 -2
- package/skill-pack/template/build/scripts/record-criteria.mjs +109 -143
- package/skill-pack/validators/code-review.yaml +4 -2
- package/dist/chunk-FBTE2A2X.js +0 -38
- package/dist/chunk-JKIWMRFH.js +0 -27
- package/dist/chunk-T6OIJQRT.js +0 -31
- package/dist/emit-finding-cmd-TMOOKHPD.js +0 -251
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { readStatuslineState, STATE_FRESH_MS } from './chunk-F47JBIAW.js';
|
|
4
|
-
import { resolveCredentials, getJson, WorkCommandError } from './chunk-
|
|
5
|
-
import { isLinkedRepository } from './chunk-
|
|
6
|
-
import { sanitizeTerminal } from './chunk-
|
|
7
|
-
import { resolveRepoIdentity, compareVersions, SUPPORTED_VERSIONS } from './chunk-
|
|
4
|
+
import { resolveCredentials, getJson, WorkCommandError } from './chunk-P4MM66C6.js';
|
|
5
|
+
import { isLinkedRepository } from './chunk-4QVZCVWT.js';
|
|
6
|
+
import { sanitizeTerminal } from './chunk-CNFVHDHG.js';
|
|
7
|
+
import { resolveRepoIdentity, compareVersions, SUPPORTED_VERSIONS } from './chunk-JXYVA45C.js';
|
|
8
8
|
import { C } from './chunk-YRYMNBGQ.js';
|
|
9
9
|
import { readSettings, settingsPath, isOurStatuslineSlot, statuslineWrappedOriginal, REGISTERED_EVENTS, isOurHookCommand, ourCommandBins, cliBinResolvable, ourDirectScriptBins, wrappedOriginalCommand } from './chunk-5QRP3MVS.js';
|
|
10
|
-
import { readPin, readContextManifest, readDegraded, readSourceCache } from './chunk-
|
|
10
|
+
import { readPin, readContextManifest, readDegraded, readSourceCache } from './chunk-LCEXHCHD.js';
|
|
11
11
|
import { defaultFetch } from './chunk-YO4PSLVB.js';
|
|
12
12
|
import { resolveGatewayCredentials } from './chunk-PLMTLGYH.js';
|
|
13
13
|
import { readCloudConfig } from './chunk-EABW6AJQ.js';
|
|
14
|
-
import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-
|
|
14
|
+
import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-SFFHGX3G.js';
|
|
15
15
|
import { deadHooksState, preparePackageManagerCommand, contextExcludesPresent } from './chunk-XCCLFVXM.js';
|
|
16
16
|
import { findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
17
17
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
18
|
-
import { readFileSync, mkdirSync, writeFileSync, renameSync, existsSync, accessSync, constants, statSync, readdirSync } from 'fs';
|
|
19
|
-
import { join, dirname } from 'path';
|
|
18
|
+
import { readFileSync, mkdirSync, writeFileSync, renameSync, existsSync, accessSync, constants, statSync, readdirSync, realpathSync } from 'fs';
|
|
19
|
+
import { join, dirname, resolve, delimiter } from 'path';
|
|
20
20
|
import { execFileSync } from 'child_process';
|
|
21
21
|
|
|
22
22
|
createRequire(import.meta.url);
|
|
@@ -113,6 +113,57 @@ function recordStatusline(home, settingsPath2, outcome, original, now = Date.now
|
|
|
113
113
|
};
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
var NAME = "MCP server";
|
|
117
|
+
var SERVER = "outerlayer";
|
|
118
|
+
var NPX_FIX = 'Change the "outerlayer" entry in .mcp.json to run `npx -y @outerlayer/cli mcp serve`, or install the CLI with `npm install -g @outerlayer/cli`.';
|
|
119
|
+
function expand(value, env) {
|
|
120
|
+
return value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_m, name) => env[name] ?? "");
|
|
121
|
+
}
|
|
122
|
+
function isExecutableFile(path, platform) {
|
|
123
|
+
try {
|
|
124
|
+
if (!statSync(path).isFile()) return false;
|
|
125
|
+
if (platform !== "win32") accessSync(path, constants.X_OK);
|
|
126
|
+
return true;
|
|
127
|
+
} catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function resolveCommand(command, root, env, platform) {
|
|
132
|
+
if (/[\\/]/.test(command)) {
|
|
133
|
+
const path = resolve(root, command);
|
|
134
|
+
return isExecutableFile(path, platform) ? path : void 0;
|
|
135
|
+
}
|
|
136
|
+
const exts = platform === "win32" ? ["", ...(env.PATHEXT ?? ".EXE;.CMD;.BAT").split(";")] : [""];
|
|
137
|
+
for (const dir of (env.PATH ?? "").split(delimiter)) {
|
|
138
|
+
for (const ext of exts) {
|
|
139
|
+
const candidate = join(dir, command + ext);
|
|
140
|
+
if (isExecutableFile(candidate, platform)) return candidate;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return void 0;
|
|
144
|
+
}
|
|
145
|
+
function checkMcpCommand(cwd, env = process.env, platform = process.platform) {
|
|
146
|
+
const root = findGitDirs(cwd ?? process.cwd())?.repoRoot;
|
|
147
|
+
if (root === void 0) return [];
|
|
148
|
+
const path = join(root, ".mcp.json");
|
|
149
|
+
if (!existsSync(path)) return [];
|
|
150
|
+
let entry;
|
|
151
|
+
try {
|
|
152
|
+
entry = JSON.parse(readFileSync(path, "utf8")).mcpServers?.[SERVER];
|
|
153
|
+
} catch {
|
|
154
|
+
return [{ name: NAME, status: "warn", detail: ".mcp.json is not valid JSON, so the agent starts none of its servers", fix: "Fix the JSON syntax in .mcp.json." }];
|
|
155
|
+
}
|
|
156
|
+
const command = entry?.command;
|
|
157
|
+
if (typeof command !== "string") return [];
|
|
158
|
+
const shown = sanitizeTerminal(command);
|
|
159
|
+
const resolved = resolveCommand(expand(command, env), root, env, platform);
|
|
160
|
+
if (resolved === void 0) {
|
|
161
|
+
return [{ name: NAME, status: "warn", detail: `the "outerlayer" server runs \`${shown}\`, which is not on PATH here, so the agent has no OuterLayer tools`, fix: NPX_FIX }];
|
|
162
|
+
}
|
|
163
|
+
return [{ name: NAME, status: "pass", detail: `the "outerlayer" server runs ${sanitizeTerminal(resolved)}` }];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/doctor.ts
|
|
116
167
|
var LAPTOP_CHECKS_NOT_APPLICABLE = {
|
|
117
168
|
name: "Laptop checks",
|
|
118
169
|
status: "skipped",
|
|
@@ -135,6 +186,7 @@ function runDoctor(env = {}) {
|
|
|
135
186
|
checkSettingsValid(home, env.cwd),
|
|
136
187
|
...laptop ? checkStatusline(home, now, env.cwd) : [],
|
|
137
188
|
...checkInstalls(env),
|
|
189
|
+
...laptop ? checkMcpCommand(env.cwd, env.processEnv) : [],
|
|
138
190
|
...checkContextSource(home, env.cwd),
|
|
139
191
|
...checkInstalledCli(home, env.cwd ?? process.cwd())
|
|
140
192
|
];
|
|
@@ -462,7 +514,9 @@ function checkDeadHooksState(cwd) {
|
|
|
462
514
|
function checkSpoolWritable(home) {
|
|
463
515
|
const dir = spoolDir(home);
|
|
464
516
|
try {
|
|
465
|
-
if (!existsSync(dir))
|
|
517
|
+
if (!existsSync(dir)) {
|
|
518
|
+
return { name: "Spool writable", status: "warn", detail: "spool not created yet", fix: "The first hook run creates it: start a Claude Code session in the repository." };
|
|
519
|
+
}
|
|
466
520
|
accessSync(dir, constants.W_OK);
|
|
467
521
|
return { name: "Spool writable", status: "pass", detail: dir };
|
|
468
522
|
} catch {
|
|
@@ -561,10 +615,25 @@ function checkSettingsValid(home, cwd) {
|
|
|
561
615
|
}
|
|
562
616
|
return { name: "Settings JSON valid", status: "pass", detail: "all settings files parse" };
|
|
563
617
|
}
|
|
618
|
+
function distinctInstalls(paths) {
|
|
619
|
+
const seen = /* @__PURE__ */ new Set();
|
|
620
|
+
const out = [];
|
|
621
|
+
for (const path of paths) {
|
|
622
|
+
let real = path;
|
|
623
|
+
try {
|
|
624
|
+
real = realpathSync(path);
|
|
625
|
+
} catch {
|
|
626
|
+
}
|
|
627
|
+
if (seen.has(real)) continue;
|
|
628
|
+
seen.add(real);
|
|
629
|
+
out.push(path);
|
|
630
|
+
}
|
|
631
|
+
return out;
|
|
632
|
+
}
|
|
564
633
|
function checkInstalls(env) {
|
|
565
634
|
let installs;
|
|
566
635
|
try {
|
|
567
|
-
installs = (env.claudeInstalls ?? defaultClaudeInstalls)();
|
|
636
|
+
installs = distinctInstalls((env.claudeInstalls ?? defaultClaudeInstalls)());
|
|
568
637
|
} catch {
|
|
569
638
|
return [];
|
|
570
639
|
}
|
|
@@ -708,7 +777,14 @@ async function githubAppChecks(options = {}) {
|
|
|
708
777
|
return [{ name: "GitHub App", status: "warn", detail: "the gateway's answer listed no repositories", fix: "Update the outerlayer CLI and the gateway to the same release." }];
|
|
709
778
|
}
|
|
710
779
|
if (data.length === 0) {
|
|
711
|
-
return [
|
|
780
|
+
return [
|
|
781
|
+
{
|
|
782
|
+
name: "GitHub App",
|
|
783
|
+
status: "warn",
|
|
784
|
+
detail: "the factory has no connected repositories, so it cannot build or check any work",
|
|
785
|
+
fix: `On the factory's Work page, choose Connect GitHub repository, then Link repository: ${CONNECT_REPOSITORY_DOCS}`
|
|
786
|
+
}
|
|
787
|
+
];
|
|
712
788
|
}
|
|
713
789
|
return data.map(repositoryAccessCheck);
|
|
714
790
|
}
|
|
@@ -1004,7 +1080,7 @@ function doctorExitCode(checks) {
|
|
|
1004
1080
|
|
|
1005
1081
|
// src/doctor-report.ts
|
|
1006
1082
|
async function gatherDoctorChecks() {
|
|
1007
|
-
const { defaultRunnerConfigPath, hasRunnerBlock, loadRunnerConfig, runnerVmOf } = await import('./config-
|
|
1083
|
+
const { defaultRunnerConfigPath, hasRunnerBlock, loadRunnerConfig, runnerVmOf } = await import('./config-N3C6DFQA.js');
|
|
1008
1084
|
const configPath = defaultRunnerConfigPath();
|
|
1009
1085
|
const checks = runDoctor({ runnerHost: hasRunnerBlock(configPath) });
|
|
1010
1086
|
const credential = await credentialChecks();
|
|
@@ -1016,7 +1092,7 @@ async function gatherDoctorChecks() {
|
|
|
1016
1092
|
const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
|
|
1017
1093
|
checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
|
|
1018
1094
|
} else if (hasRunnerBlock(configPath)) {
|
|
1019
|
-
const { runnerHostChecks } = await import('./doctor-
|
|
1095
|
+
const { runnerHostChecks } = await import('./doctor-3H25Q7WT.js');
|
|
1020
1096
|
const hooks = (() => {
|
|
1021
1097
|
try {
|
|
1022
1098
|
return loadRunnerConfig(configPath).hooks;
|
|
@@ -1048,10 +1124,10 @@ async function gatherDoctorChecks() {
|
|
|
1048
1124
|
}
|
|
1049
1125
|
})();
|
|
1050
1126
|
const service = await (async () => {
|
|
1051
|
-
const { existsSync:
|
|
1052
|
-
if (process.platform !== "linux" || !
|
|
1127
|
+
const { existsSync: existsSync3 } = await import('fs');
|
|
1128
|
+
if (process.platform !== "linux" || !existsSync3("/run/systemd/system")) return void 0;
|
|
1053
1129
|
const { inspectService, realInspectProbes } = await import('./inspect-6UYAAXH7.js');
|
|
1054
|
-
const { DEFAULT_UNIT_NAME } = await import('./install-
|
|
1130
|
+
const { DEFAULT_UNIT_NAME } = await import('./install-HDBIPHTX.js');
|
|
1055
1131
|
const { dirname: dirname2 } = await import('path');
|
|
1056
1132
|
return inspectService(DEFAULT_UNIT_NAME, dirname2(configPath), realInspectProbes());
|
|
1057
1133
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { C } from './chunk-YRYMNBGQ.js';
|
|
4
|
-
import { resolvePackRoot, loadTemplateFiles, loadMaintainedFiles, TEMPLATE_SKILLS, skillDir, writeMaintainedFiles, MAINTAINED_SKILLS } from './chunk-
|
|
4
|
+
import { resolvePackRoot, loadTemplateFiles, loadMaintainedFiles, TEMPLATE_SKILLS, skillDir, writeMaintainedFiles, MAINTAINED_SKILLS } from './chunk-TCIW27FM.js';
|
|
5
5
|
import { resolvePackageVersion } from './chunk-RA3O54FC.js';
|
|
6
6
|
import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
7
7
|
import { join, dirname } from 'path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-
|
|
4
|
-
import { resolveRepoIdentity } from './chunk-
|
|
3
|
+
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-4QVZCVWT.js';
|
|
4
|
+
import { resolveRepoIdentity } from './chunk-JXYVA45C.js';
|
|
5
5
|
import { resolveGatewayCredentials } from './chunk-PLMTLGYH.js';
|
|
6
6
|
import { findGitDirs, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
7
7
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { appendContextProvenance } from './chunk-ZJSNLVCE.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { normalizeRepoName, parseGoverns, CONTEXT_SOURCE_CONFIG_PATH, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-
|
|
4
|
+
import { loadMaintainedFiles, writeMaintainedFiles } from './chunk-TCIW27FM.js';
|
|
5
|
+
import { readPin, pinExists, readBuildHold, readContextManifest, manifestFilesPresent, writeDegraded, writeSourceCache, SOURCE_CACHE_TTL_RETRY_MS, SOURCE_CACHE_TTL_SUCCESS_MS, isLastCheckFresh, readDegraded, touchLastCheck, clearDegraded, writeContextManifest, writePinIfChanged, readSourceCache, isSourceCacheFresh } from './chunk-LCEXHCHD.js';
|
|
6
|
+
import { normalizeRepoName, parseGoverns, CONTEXT_SOURCE_CONFIG_PATH, parseOuterlayerConfig, classifyTree, emitTree } from './chunk-2M63GG56.js';
|
|
7
7
|
import { defaultFetch } from './chunk-YO4PSLVB.js';
|
|
8
8
|
import { resolveGatewayCredentials } from './chunk-PLMTLGYH.js';
|
|
9
9
|
import { withTokenHeader } from './chunk-BYT5O5RV.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { maintainedFilesForExistingSkills, loadMaintainedFiles, writeMaintainedFiles } from './chunk-
|
|
4
|
-
import { emitTree, parseOuterlayerConfig, classifyTree, generatedHeaderSource, CONTEXT_PIN_FILENAME, normalizePath } from './chunk-
|
|
3
|
+
import { maintainedFilesForExistingSkills, loadMaintainedFiles, writeMaintainedFiles } from './chunk-TCIW27FM.js';
|
|
4
|
+
import { emitTree, parseOuterlayerConfig, classifyTree, generatedHeaderSource, CONTEXT_PIN_FILENAME, normalizePath } from './chunk-2M63GG56.js';
|
|
5
5
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, copyFileSync, readdirSync } from 'fs';
|
|
6
6
|
import { join, dirname, relative, sep } from 'path';
|
|
7
7
|
|
|
@@ -57,5 +57,23 @@ function detectActiveSession(opts) {
|
|
|
57
57
|
}
|
|
58
58
|
return newest;
|
|
59
59
|
}
|
|
60
|
+
function transcriptPathForSession(sessionId, home, readTailImpl = readTail) {
|
|
61
|
+
const tail = readTailImpl(join(home, ".outerlayer", "spool", "events.jsonl"), SESSION_DETECT_TAIL_BYTES);
|
|
62
|
+
if (!tail) return void 0;
|
|
63
|
+
let lines = tail.data.toString("utf8").split("\n");
|
|
64
|
+
if (tail.truncated) lines = lines.slice(1);
|
|
65
|
+
let found;
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
try {
|
|
68
|
+
const record = JSON.parse(line);
|
|
69
|
+
if (record.sessionId === sessionId && typeof record.transcriptPath === "string" && record.transcriptPath !== "") {
|
|
70
|
+
found = record.transcriptPath;
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
60
78
|
|
|
61
|
-
export { detectActiveSession };
|
|
79
|
+
export { detectActiveSession, transcriptPathForSession };
|
|
@@ -22273,9 +22273,14 @@ var ArtifactTombstoneRecordSchema = external_exports.looseObject({
|
|
|
22273
22273
|
});
|
|
22274
22274
|
external_exports.union([ArtifactSpoolRecordSchema, ArtifactTombstoneRecordSchema]);
|
|
22275
22275
|
var EMITTED_RESULTS = ["pass", "fail"];
|
|
22276
|
-
var RESERVED_EMIT_NAMES = ["criteria"];
|
|
22277
|
-
var EmittedNameSchema = external_exports.string().regex(/^[a-z][a-z0-9._-]{0,63}$/).
|
|
22278
|
-
|
|
22276
|
+
var RESERVED_EMIT_NAMES = ["artifact", "criteria", "finding", "findings"];
|
|
22277
|
+
var EmittedNameSchema = external_exports.string().regex(/^[a-z][a-z0-9._-]{0,63}$/).superRefine((name, ctx) => {
|
|
22278
|
+
if (RESERVED_EMIT_NAMES.includes(name)) {
|
|
22279
|
+
ctx.addIssue({
|
|
22280
|
+
code: "custom",
|
|
22281
|
+
message: `is reserved: \`outerlayer emit ${name}\` is a subcommand, so a check cannot be recorded under that name`
|
|
22282
|
+
});
|
|
22283
|
+
}
|
|
22279
22284
|
});
|
|
22280
22285
|
var EMITTED_RESULT_MAX_LINK_LENGTH = 500;
|
|
22281
22286
|
var EMITTED_RESULT_MAX_BODY_LENGTH = 2e3;
|
|
@@ -22292,6 +22297,7 @@ var CriterionSchema = external_exports.object({
|
|
|
22292
22297
|
proof: external_exports.enum(ARTIFACT_KINDS).nullable()
|
|
22293
22298
|
}).strict();
|
|
22294
22299
|
var CriteriaArraySchema = external_exports.array(CriterionSchema).min(1).max(CRITERIA_MAX);
|
|
22300
|
+
var DraftedSchema = external_exports.boolean().optional();
|
|
22295
22301
|
function refuseDuplicateIds(criteria, ctx) {
|
|
22296
22302
|
const seen = /* @__PURE__ */ new Set();
|
|
22297
22303
|
criteria.forEach((criterion, index) => {
|
|
@@ -22305,9 +22311,10 @@ function refuseDuplicateIds(criteria, ctx) {
|
|
|
22305
22311
|
seen.add(criterion.id);
|
|
22306
22312
|
});
|
|
22307
22313
|
}
|
|
22308
|
-
var CriteriaListSchema = external_exports.object({ criteria: CriteriaArraySchema }).strict().superRefine((list, ctx) => refuseDuplicateIds(list.criteria, ctx));
|
|
22314
|
+
var CriteriaListSchema = external_exports.object({ criteria: CriteriaArraySchema, drafted: DraftedSchema }).strict().superRefine((list, ctx) => refuseDuplicateIds(list.criteria, ctx));
|
|
22309
22315
|
external_exports.object({
|
|
22310
22316
|
criteria: CriteriaArraySchema,
|
|
22317
|
+
drafted: DraftedSchema,
|
|
22311
22318
|
item: external_exports.object({ number: external_exports.number().int().positive() }).optional(),
|
|
22312
22319
|
sessionId: external_exports.string().optional()
|
|
22313
22320
|
}).superRefine((request, ctx) => refuseDuplicateIds(request.criteria, ctx));
|
|
@@ -22323,6 +22330,20 @@ var FINDING_WHERE_LABEL_MAX_LENGTH = 200;
|
|
|
22323
22330
|
var FINDING_TRACE_ID_MAX_LENGTH = 128;
|
|
22324
22331
|
var FINDING_BATCH_MAX = 500;
|
|
22325
22332
|
var FINDING_LINE_MAX = 2147483647;
|
|
22333
|
+
var FINDING_DETAIL_MAX_LENGTH = 4e3;
|
|
22334
|
+
var FINDING_CAUSE_MAX_LENGTH = 1e3;
|
|
22335
|
+
var FINDING_SUGGESTION_MAX_LENGTH = 1e3;
|
|
22336
|
+
var FINDING_COMMAND_MAX_LENGTH = 500;
|
|
22337
|
+
var FINDING_ERROR_MAX_LENGTH = 1e3;
|
|
22338
|
+
var FINDING_TEST_MAX_LENGTH = 500;
|
|
22339
|
+
var FINDING_SYMBOL_MAX_LENGTH = 300;
|
|
22340
|
+
var FINDING_EVENT_ID_MAX_LENGTH = 64;
|
|
22341
|
+
var FINDING_PROBLEMS_MAX = 5;
|
|
22342
|
+
var FINDING_LINK_REASON_MAX_LENGTH = 1e3;
|
|
22343
|
+
var FindingEventSchema = external_exports.strictObject({
|
|
22344
|
+
id: external_exports.string().min(1).max(FINDING_EVENT_ID_MAX_LENGTH),
|
|
22345
|
+
at: external_exports.iso.datetime({ offset: true })
|
|
22346
|
+
});
|
|
22326
22347
|
var FindingRuleSchema = external_exports.strictObject({
|
|
22327
22348
|
path: external_exports.string().min(1).max(FINDING_RULE_PATH_MAX_LENGTH),
|
|
22328
22349
|
line: external_exports.number().int().min(1).max(FINDING_LINE_MAX).nullish(),
|
|
@@ -22342,8 +22363,49 @@ var FindingRecordSchema = external_exports.strictObject({
|
|
|
22342
22363
|
file: external_exports.string().min(1).max(FINDING_FILE_MAX_LENGTH),
|
|
22343
22364
|
line: external_exports.number().int().min(1).max(FINDING_LINE_MAX).nullish(),
|
|
22344
22365
|
rule: FindingRuleSchema.nullish(),
|
|
22345
|
-
where: FindingWhereSchema
|
|
22366
|
+
where: FindingWhereSchema,
|
|
22367
|
+
detail: external_exports.string().min(1).max(FINDING_DETAIL_MAX_LENGTH).optional(),
|
|
22368
|
+
cause: external_exports.string().min(1).max(FINDING_CAUSE_MAX_LENGTH).optional(),
|
|
22369
|
+
suggestion: external_exports.string().min(1).max(FINDING_SUGGESTION_MAX_LENGTH).optional(),
|
|
22370
|
+
command: external_exports.string().min(1).max(FINDING_COMMAND_MAX_LENGTH).optional(),
|
|
22371
|
+
error: external_exports.string().min(1).max(FINDING_ERROR_MAX_LENGTH).optional(),
|
|
22372
|
+
test: external_exports.string().min(1).max(FINDING_TEST_MAX_LENGTH).optional(),
|
|
22373
|
+
symbol: external_exports.string().min(1).max(FINDING_SYMBOL_MAX_LENGTH).optional(),
|
|
22374
|
+
/** Where the problem began and where the agent got past it: two events of
|
|
22375
|
+
* the recording session. Both or neither. */
|
|
22376
|
+
startedAt: FindingEventSchema.optional(),
|
|
22377
|
+
endedAt: FindingEventSchema.optional(),
|
|
22378
|
+
/** Problems this finding reports, chosen by the agent. Needs `linkReason`. */
|
|
22379
|
+
problems: external_exports.array(external_exports.uuid()).min(1).max(FINDING_PROBLEMS_MAX).optional(),
|
|
22380
|
+
linkReason: external_exports.string().min(1).max(FINDING_LINK_REASON_MAX_LENGTH).optional(),
|
|
22381
|
+
/** Record a new problem instead of searching for an existing one. */
|
|
22382
|
+
new: external_exports.literal(true).optional()
|
|
22346
22383
|
}).superRefine((value, ctx) => {
|
|
22384
|
+
if (value.problems !== void 0 && value.linkReason === void 0) {
|
|
22385
|
+
ctx.addIssue({
|
|
22386
|
+
code: "custom",
|
|
22387
|
+
path: ["linkReason"],
|
|
22388
|
+
message: "linkReason is required with problems \u2014 say why the finding reports each problem"
|
|
22389
|
+
});
|
|
22390
|
+
}
|
|
22391
|
+
if (value.problems !== void 0 && value.new === true) {
|
|
22392
|
+
ctx.addIssue({
|
|
22393
|
+
code: "custom",
|
|
22394
|
+
path: ["new"],
|
|
22395
|
+
message: "new cannot be combined with problems \u2014 a finding either links problems or records a new one"
|
|
22396
|
+
});
|
|
22397
|
+
}
|
|
22398
|
+
if (value.startedAt === void 0 !== (value.endedAt === void 0)) {
|
|
22399
|
+
ctx.addIssue({
|
|
22400
|
+
code: "custom",
|
|
22401
|
+
path: [value.startedAt === void 0 ? "startedAt" : "endedAt"],
|
|
22402
|
+
message: "startedAt and endedAt come together \u2014 name both events or neither"
|
|
22403
|
+
});
|
|
22404
|
+
} else if (value.startedAt !== void 0 && value.endedAt !== void 0) {
|
|
22405
|
+
if (Date.parse(value.endedAt.at) < Date.parse(value.startedAt.at)) {
|
|
22406
|
+
ctx.addIssue({ code: "custom", path: ["endedAt"], message: "endedAt must not be earlier than startedAt" });
|
|
22407
|
+
}
|
|
22408
|
+
}
|
|
22347
22409
|
if (value.category !== "context") return;
|
|
22348
22410
|
if (value.rule === null || value.rule === void 0) {
|
|
22349
22411
|
ctx.addIssue({
|
|
@@ -22362,7 +22424,7 @@ var FindingRecordSchema = external_exports.strictObject({
|
|
|
22362
22424
|
}
|
|
22363
22425
|
});
|
|
22364
22426
|
var FindingBatchSchema = external_exports.object({
|
|
22365
|
-
schemaVersion: external_exports.literal(
|
|
22427
|
+
schemaVersion: external_exports.literal(3),
|
|
22366
22428
|
headSha: external_exports.string().min(1).optional(),
|
|
22367
22429
|
contextSourceSha: external_exports.string().min(1).optional(),
|
|
22368
22430
|
findings: external_exports.array(FindingRecordSchema).min(1).max(FINDING_BATCH_MAX)
|
|
@@ -22381,6 +22443,36 @@ var FindingBatchSchema = external_exports.object({
|
|
|
22381
22443
|
}
|
|
22382
22444
|
});
|
|
22383
22445
|
});
|
|
22446
|
+
var FindingProblemRefSchema = external_exports.object({ id: external_exports.string(), title: external_exports.string() });
|
|
22447
|
+
var FindingCandidateSchema = external_exports.object({
|
|
22448
|
+
id: external_exports.string(),
|
|
22449
|
+
title: external_exports.string(),
|
|
22450
|
+
reportCount: external_exports.number().int(),
|
|
22451
|
+
reports: external_exports.array(
|
|
22452
|
+
external_exports.object({ title: external_exports.string(), cause: external_exports.string().nullish(), file: external_exports.string().nullish() })
|
|
22453
|
+
)
|
|
22454
|
+
});
|
|
22455
|
+
var FINDING_JOIN_METHODS = ["strict_key", "agent_link", "new", "no_candidates", "kept"];
|
|
22456
|
+
var FindingResultSchema = external_exports.object({
|
|
22457
|
+
id: external_exports.string(),
|
|
22458
|
+
outcome: external_exports.enum(["stored", "needs_choice"]),
|
|
22459
|
+
method: external_exports.enum(FINDING_JOIN_METHODS).optional(),
|
|
22460
|
+
problems: external_exports.array(FindingProblemRefSchema).optional(),
|
|
22461
|
+
/** Problems the agent named that a strict key replaced. */
|
|
22462
|
+
overridden: external_exports.array(FindingProblemRefSchema).optional(),
|
|
22463
|
+
candidates: external_exports.array(FindingCandidateSchema).optional()
|
|
22464
|
+
});
|
|
22465
|
+
var FindingsResponseSchema = external_exports.object({
|
|
22466
|
+
workItemId: external_exports.string(),
|
|
22467
|
+
/** Findings stored by this request. */
|
|
22468
|
+
count: external_exports.number().int(),
|
|
22469
|
+
results: external_exports.array(FindingResultSchema)
|
|
22470
|
+
});
|
|
22471
|
+
var SAME_PROBLEM_RULES = [
|
|
22472
|
+
"1. Same problem means one fix resolves both. The same error or symptom is not enough.",
|
|
22473
|
+
"2. A gap in the instructions is its own problem, separate from the thing it fails to mention. They are fixed in different places.",
|
|
22474
|
+
"3. A finding can report more than one problem. Link each one, or record one finding per problem."
|
|
22475
|
+
].join("\n");
|
|
22384
22476
|
var WORK_ITEM_COMMENT_ACTIONS = ["pass", "fail", "attach", "ready", "request"];
|
|
22385
22477
|
var WORK_ITEM_COMMENT_MAX_BODY_LENGTH = 2e3;
|
|
22386
22478
|
var REVIEW_SEND_ID_PATTERN = /^[A-Za-z0-9_.-]{1,100}$/;
|
|
@@ -22433,4 +22525,4 @@ xmlchars/xmlns/1.0/ed3.js:
|
|
|
22433
22525
|
*)
|
|
22434
22526
|
*/
|
|
22435
22527
|
|
|
22436
|
-
export { ARTIFACT_KINDS, ARTIFACT_MAX_CAPTION_LENGTH, ARTIFACT_MAX_FILENAME_LENGTH, ARTIFACT_MAX_REPLACES_TARGETS, ArtifactCriterionIdSchema, ArtifactSpoolRecordSchema, ArtifactTombstoneRecordSchema, BUCKET_MODEL_MAX_LENGTH, CAPTURE_TIERS, CriteriaListSchema, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, EMITTED_RESULT_MAX_LINK_LENGTH, EVENT_TYPES, EmittedNameSchema, FindingBatchSchema, RESERVED_EMIT_NAMES, SCHEMA_VERSION, SPEED_MAX_LENGTH, bannedPathsForTier, bindTests, downconvertSession, inferArtifactKind, inputBandOf, isHumanUserTurn, mediaTypeForArtifactPath, parseAgentSession, parseJunit, parseTestSelector, turnCountBound };
|
|
22528
|
+
export { ARTIFACT_KINDS, ARTIFACT_MAX_CAPTION_LENGTH, ARTIFACT_MAX_FILENAME_LENGTH, ARTIFACT_MAX_REPLACES_TARGETS, ArtifactCriterionIdSchema, ArtifactSpoolRecordSchema, ArtifactTombstoneRecordSchema, BUCKET_MODEL_MAX_LENGTH, CAPTURE_TIERS, CriteriaListSchema, EMITTED_RESULTS, EMITTED_RESULT_MAX_BODY_LENGTH, EMITTED_RESULT_MAX_LINK_LENGTH, EVENT_TYPES, EmittedNameSchema, FindingBatchSchema, FindingsResponseSchema, RESERVED_EMIT_NAMES, SAME_PROBLEM_RULES, SCHEMA_VERSION, SPEED_MAX_LENGTH, bannedPathsForTier, bindTests, downconvertSession, inferArtifactKind, inputBandOf, isHumanUserTurn, mediaTypeForArtifactPath, parseAgentSession, parseJunit, parseTestSelector, turnCountBound };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { EVENT_TYPES, isHumanUserTurn, parseAgentSession, SCHEMA_VERSION, SPEED_MAX_LENGTH, inputBandOf, BUCKET_MODEL_MAX_LENGTH } from './chunk-
|
|
3
|
+
import { EVENT_TYPES, isHumanUserTurn, parseAgentSession, SCHEMA_VERSION, SPEED_MAX_LENGTH, inputBandOf, BUCKET_MODEL_MAX_LENGTH } from './chunk-J5M7BSJQ.js';
|
|
4
4
|
import { createHash } from 'crypto';
|
|
5
5
|
import { readFileSync, readdirSync, statSync, mkdirSync, copyFileSync, renameSync, unlinkSync, writeFileSync, stat as stat$1, unwatchFile, watchFile, watch as watch$1 } from 'fs';
|
|
6
6
|
import { type, homedir } from 'os';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { CONTEXT_PIN_SCHEMA_VERSION, CONTEXT_PIN_FILENAME } from './chunk-
|
|
3
|
+
import { CONTEXT_PIN_SCHEMA_VERSION, CONTEXT_PIN_FILENAME } from './chunk-2M63GG56.js';
|
|
4
4
|
import { readFileSync, existsSync, writeFileSync, mkdirSync, utimesSync, statSync, unlinkSync } from 'fs';
|
|
5
5
|
import { join, dirname } from 'path';
|
|
6
6
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-
|
|
4
|
-
import { MIN_ENGINE_MAJOR } from './chunk-
|
|
5
|
-
import {
|
|
3
|
+
import { detectMachine, supportsContainerBuilds, reachDockerStep, describeMachineDocker, supportsMicroVmBuilds } from './chunk-P6FX4D43.js';
|
|
4
|
+
import { MIN_ENGINE_MAJOR } from './chunk-MZN7AQOB.js';
|
|
5
|
+
import { hasStoredCredential, AGENT_COMMANDS, storeClaudeCredential, credentialFromStdin, isAgentName } from './chunk-T5VPP6H7.js';
|
|
6
|
+
import { runnerCredentialProblem } from './chunk-22RMZBGW.js';
|
|
7
|
+
import { runnerDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE } from './chunk-ZM2IMMYN.js';
|
|
6
8
|
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
7
9
|
import { dirname } from 'path';
|
|
8
10
|
|
|
@@ -38,6 +40,16 @@ function readConfigObject(configPath) {
|
|
|
38
40
|
throw new RunnerInitError(`${configPath}: not valid JSON (${err instanceof Error ? err.message : String(err)})`);
|
|
39
41
|
}
|
|
40
42
|
}
|
|
43
|
+
function handedCredential(value) {
|
|
44
|
+
if (value === void 0) return void 0;
|
|
45
|
+
if (typeof value !== "string") throw new RunnerInitError("the config on stdin carries a claudeCredential that is not text.");
|
|
46
|
+
return credentialFromStdin(value);
|
|
47
|
+
}
|
|
48
|
+
function handedAgent(value) {
|
|
49
|
+
if (value === void 0) return void 0;
|
|
50
|
+
if (!isAgentName(value)) throw new RunnerInitError("the config on stdin names an agent runner init does not know.");
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
41
53
|
function parseStdinConfig(configPath, text) {
|
|
42
54
|
if (existsSync(configPath)) {
|
|
43
55
|
throw new RunnerInitError(
|
|
@@ -50,23 +62,38 @@ function parseStdinConfig(configPath, text) {
|
|
|
50
62
|
} catch (err) {
|
|
51
63
|
throw new RunnerInitError(`the config on stdin is not valid JSON (${err instanceof Error ? err.message : String(err)})`);
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
65
|
+
const problem = runnerCredentialProblem(config);
|
|
66
|
+
if (problem !== void 0) throw new RunnerInitError(`the config on stdin: ${problem.field} ${problem.reason}.`);
|
|
56
67
|
const carried = config.runner;
|
|
68
|
+
const credential = handedCredential(config.claudeCredential);
|
|
69
|
+
const agent = handedAgent(config.agent);
|
|
57
70
|
delete config.runner;
|
|
58
|
-
|
|
71
|
+
delete config.claudeCredential;
|
|
72
|
+
delete config.agent;
|
|
73
|
+
return { config, carried, credential, agent };
|
|
59
74
|
}
|
|
60
75
|
function runRunnerInit(configPath, opts = {}) {
|
|
76
|
+
return writeRunnerInit(prepareRunnerInit(configPath, opts));
|
|
77
|
+
}
|
|
78
|
+
function prepareRunnerInit(configPath, opts = {}) {
|
|
61
79
|
let config;
|
|
62
80
|
let carried;
|
|
81
|
+
let credential = opts.credential;
|
|
82
|
+
let agent = opts.agent;
|
|
83
|
+
let needsKey = false;
|
|
63
84
|
if (opts.configFromStdin === void 0) {
|
|
64
|
-
config = readConfigObject(configPath);
|
|
85
|
+
config = opts.keyFromLogin === true && !existsSync(configPath) ? {} : readConfigObject(configPath);
|
|
65
86
|
if (config.runner !== void 0) {
|
|
66
87
|
throw new RunnerInitError(`${configPath}: a runner block is already here. Edit it, or remove it and run this again.`);
|
|
67
88
|
}
|
|
89
|
+
needsKey = opts.keyFromLogin === true && config.apiKey === void 0;
|
|
90
|
+
const problem = needsKey ? void 0 : runnerCredentialProblem(config);
|
|
91
|
+
if (problem !== void 0) throw new RunnerInitError(`${configPath}: ${problem.field} ${problem.reason}.`);
|
|
68
92
|
} else {
|
|
69
|
-
|
|
93
|
+
const handed = parseStdinConfig(configPath, opts.configFromStdin);
|
|
94
|
+
({ config, carried } = handed);
|
|
95
|
+
credential ??= handed.credential;
|
|
96
|
+
agent ??= handed.agent;
|
|
70
97
|
}
|
|
71
98
|
const machine = opts.machine ?? detectMachine();
|
|
72
99
|
if (opts.requireContainer === true && !supportsContainerBuilds(machine)) {
|
|
@@ -75,7 +102,19 @@ function runRunnerInit(configPath, opts = {}) {
|
|
|
75
102
|
}
|
|
76
103
|
const hooks = opts.requireContainer !== true && supportsMicroVmBuilds(machine) ? "builtin:vm" : supportsContainerBuilds(machine) ? "builtin:container" : "builtin:process";
|
|
77
104
|
if (hooks === "builtin:process" && opts.allowProcess !== true) throw new RunnerInitError(processRefusal(machine));
|
|
78
|
-
if (
|
|
105
|
+
if (agent === "claude" && credential === void 0 && !hasStoredCredential(configPath)) {
|
|
106
|
+
throw new RunnerInitError(
|
|
107
|
+
"--agent claude needs Claude's credential, and none was piped on stdin or is in the runner.env beside the config. Pipe a token from `claude setup-token`, or an Anthropic API key: printf '%s' \"$CLAUDE_CODE_OAUTH_TOKEN\" | outerlayer runner init --agent claude"
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return { configPath, config, carried, credential, agent, machine, hooks, needsKey };
|
|
111
|
+
}
|
|
112
|
+
function writeRunnerInit(prepared, runnerKey) {
|
|
113
|
+
const { configPath, config, carried, credential, agent, machine, hooks } = prepared;
|
|
114
|
+
if (prepared.needsKey && runnerKey === void 0) {
|
|
115
|
+
throw new RunnerInitError(`${configPath}: apiKey is missing, and no runner key was created from the login.`);
|
|
116
|
+
}
|
|
117
|
+
if (runnerKey !== void 0) Object.assign(config, { url: runnerKey.url, apiKey: runnerKey.apiKey, appId: runnerKey.appId });
|
|
79
118
|
mkdirSync(runnerDir(configPath), { recursive: true, mode: RUNNER_DIR_MODE });
|
|
80
119
|
config.runner = {
|
|
81
120
|
queues: ["implement", "amend"],
|
|
@@ -91,12 +130,15 @@ function runRunnerInit(configPath, opts = {}) {
|
|
|
91
130
|
amend: PLACEHOLDER_COMMAND
|
|
92
131
|
},
|
|
93
132
|
...carried,
|
|
133
|
+
// The agent was named on this command line, so its commands win over any the hand-off carried.
|
|
134
|
+
...agent === void 0 ? {} : { commands: { ...AGENT_COMMANDS[agent] } },
|
|
94
135
|
hooks: { provision: hooks, cleanup: hooks }
|
|
95
136
|
};
|
|
96
137
|
mkdirSync(dirname(configPath), { recursive: true });
|
|
138
|
+
const stored = credential === void 0 ? void 0 : { variable: credential.variable, path: storeClaudeCredential(configPath, credential) };
|
|
97
139
|
writeFileSync(configPath, `${JSON.stringify(config, null, 2)}
|
|
98
140
|
`, { mode: RUNNER_FILE_MODE });
|
|
99
|
-
return { configPath, hooks, ...hooks === "builtin:process" ? { note: isolationNote(machine) } : {} };
|
|
141
|
+
return { configPath, hooks, ...hooks === "builtin:process" ? { note: isolationNote(machine) } : {}, credential: stored };
|
|
100
142
|
}
|
|
101
143
|
|
|
102
|
-
export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, readConfigObject, runRunnerInit };
|
|
144
|
+
export { PLACEHOLDER_MARKER, RunnerInitError, isPlaceholderCommand, prepareRunnerInit, readConfigObject, runRunnerInit, writeRunnerInit };
|
|
@@ -3,22 +3,22 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { readDefaultBranchHead, cloneRepository, buildRepositoryImage } from './chunk-3FMPZPJQ.js';
|
|
4
4
|
import { startTimeOf, isSameProcess } from './chunk-N5FOE5PS.js';
|
|
5
5
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
6
|
-
import { createDockerHost, childEnvironment, spawnRun } from './chunk-
|
|
6
|
+
import { createDockerHost, childEnvironment, spawnRun } from './chunk-3KTA5UU2.js';
|
|
7
7
|
import { RecipeError } from './chunk-QOZKPLVJ.js';
|
|
8
|
-
import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-
|
|
8
|
+
import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-NX57IBNK.js';
|
|
9
9
|
import { CLAUDE_CODE_VERSION, firecrackerArch, MICROVM_ARCHES, DEFAULT_BASE_IMAGE, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, FIRECRACKER_VERSION, GUEST_ASSETS_VERSION } from './chunk-CX22S5BA.js';
|
|
10
10
|
import { execCapture } from './chunk-QKFB4K7X.js';
|
|
11
11
|
import { GUEST_CID } from './chunk-RSNSZ2LJ.js';
|
|
12
|
-
import { WorkCommandError, postJson } from './chunk-
|
|
13
|
-
import { setCustomScrubbers, setLocalIdentity, setRepoRoot, parseTranscript, scrubDeep, scrubText } from './chunk-
|
|
12
|
+
import { WorkCommandError, postJson } from './chunk-P4MM66C6.js';
|
|
13
|
+
import { setCustomScrubbers, setLocalIdentity, setRepoRoot, parseTranscript, scrubDeep, scrubText } from './chunk-JXYVA45C.js';
|
|
14
14
|
import { hostAllowed } from './chunk-UXYLWVTQ.js';
|
|
15
15
|
import { parseDuKilobytes } from './chunk-7RQ73DLO.js';
|
|
16
16
|
import { repositoriesOf, primaryOf, RELAY_PORT, CHECKOUT_DIR, JOB_MOUNT, claudeCredential, buildEnvironment, startBuildServices, checkEnvironment, AGENT_CREDENTIAL_MISSING, checkoutPath } from './chunk-4Q7OMKAT.js';
|
|
17
|
-
import { defaultGitRunner, materializeContext } from './chunk-
|
|
18
|
-
import { readContextManifest, readSourceCache } from './chunk-
|
|
19
|
-
import { orderSessions, extractFacts, sessionsToTimeline } from './chunk-
|
|
17
|
+
import { defaultGitRunner, materializeContext } from './chunk-GI4XXD4I.js';
|
|
18
|
+
import { readContextManifest, readSourceCache } from './chunk-LCEXHCHD.js';
|
|
19
|
+
import { orderSessions, extractFacts, sessionsToTimeline } from './chunk-2M63GG56.js';
|
|
20
20
|
import { signingFetchFor } from './chunk-YO4PSLVB.js';
|
|
21
|
-
import { downconvertSession } from './chunk-
|
|
21
|
+
import { downconvertSession } from './chunk-J5M7BSJQ.js';
|
|
22
22
|
import { signerFor } from './chunk-V7NIVOFD.js';
|
|
23
23
|
import { rootfsPathFor, diskTemplatesDir, RUNNER_FILE_MODE, stagedContextDir, contextHomeDir, ghConfigDir, runnerDirOfBuild, spoolDir, mirrorDir, buildDir, RUNNER_DIR_MODE, vmAssetsDir } from './chunk-ZM2IMMYN.js';
|
|
24
24
|
import { relative, join, dirname, basename } from 'path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { BUILDKIT_IMAGE } from './chunk-CX22S5BA.js';
|
|
4
|
-
import { compareVersions } from './chunk-
|
|
4
|
+
import { compareVersions } from './chunk-JXYVA45C.js';
|
|
5
5
|
import { parseSize } from './chunk-7RQ73DLO.js';
|
|
6
6
|
import { JOB_MOUNT, GATEWAY_PORT, GATEWAY_SOCKET, CLAUDE_PORT, CLAUDE_SOCKET, RELAY_PORT, DESTINATION_BASE_PORT } from './chunk-4Q7OMKAT.js';
|
|
7
7
|
import { runnerDir } from './chunk-ZM2IMMYN.js';
|