@outerlayer/cli 0.18.0 → 0.19.1
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 +33 -0
- package/README.md +21 -2
- package/dist/{agent-setup-RBTEACYU.js → agent-setup-AM42SA2D.js} +15 -16
- package/dist/{artifact-link-cmd-AVM2EKTV.js → artifact-link-cmd-OWRI5AJX.js} +2 -2
- package/dist/build-info.json +1 -1
- package/dist/{builder-DUI2ZH2H.js → builder-C4QNTYMS.js} +3 -3
- package/dist/{check-5C4YDZYV.js → check-W2JGXN3B.js} +44 -43
- package/dist/{chunk-S26M3YBJ.js → chunk-3UZTIRLF.js} +1 -1
- package/dist/{chunk-Y5MXET4M.js → chunk-3ZR7Y23Y.js} +11 -10
- package/dist/{chunk-47TTLEDX.js → chunk-5VML45HH.js} +35 -13
- package/dist/{chunk-F4XSVQJ4.js → chunk-6X4SQ5MY.js} +2 -2
- package/dist/{chunk-T4Y6SCG3.js → chunk-7UWVLZXD.js} +2 -2
- package/dist/{chunk-N3CUDFCW.js → chunk-7VUK5RFS.js} +15 -2
- package/dist/{chunk-SWCTGCSC.js → chunk-7YP7T6GV.js} +1 -1
- package/dist/{chunk-3OFZM4X6.js → chunk-B6SCN5NY.js} +151 -20
- package/dist/{chunk-KDVIU23F.js → chunk-BWSUPRDK.js} +1 -1
- package/dist/{chunk-S76AYB4M.js → chunk-CG36IONK.js} +5 -5
- package/dist/{chunk-RAZTWYZN.js → chunk-CGGPS7SI.js} +7 -8
- package/dist/chunk-CJJDJ7AT.js +56 -0
- package/dist/{chunk-W5VPCONO.js → chunk-EAEELQVQ.js} +33 -227
- package/dist/{chunk-QQM2UJ6T.js → chunk-F2KXHIFI.js} +182 -28
- package/dist/{chunk-KK4VBOH6.js → chunk-FBTGMSQF.js} +10 -11
- package/dist/{chunk-MQJSXHV7.js → chunk-G3IJ3N6F.js} +5 -3
- package/dist/{chunk-FUB7LRUE.js → chunk-GEMQLBMW.js} +5 -5
- package/dist/{chunk-Y5GE76XC.js → chunk-HOKXGFDR.js} +33 -81
- package/dist/{chunk-IP7BIBXJ.js → chunk-IF2OSI5T.js} +35 -1
- package/dist/{chunk-UYOYTKE2.js → chunk-JHGEBPLE.js} +3 -3
- package/dist/chunk-KYS3TQAG.js +296 -0
- package/dist/chunk-LLM3I5YU.js +89 -0
- package/dist/{chunk-B3UKB46N.js → chunk-LRG3ZMZD.js} +4 -5
- package/dist/{chunk-NL4XPC7W.js → chunk-LW7G5TJB.js} +1 -1
- package/dist/{chunk-MNTSH4CL.js → chunk-NNLA7LLQ.js} +1 -1
- package/dist/{chunk-GOBOJMOJ.js → chunk-PIZRPNKR.js} +4 -4
- package/dist/{chunk-ULSIJGLS.js → chunk-PSN33ERW.js} +56 -14
- package/dist/{chunk-WGAUY5LE.js → chunk-QEFKA2QD.js} +1 -1
- package/dist/{chunk-BMYGAGBJ.js → chunk-QNLX477Q.js} +155 -23
- package/dist/{chunk-JF42URPU.js → chunk-R22NZSGA.js} +33 -9
- package/dist/chunk-TUSYOL2O.js +113 -0
- package/dist/{chunk-ESC6UR76.js → chunk-TWF3RICI.js} +6 -6
- package/dist/{chunk-L2USZT6T.js → chunk-VMJPFQNE.js} +1 -1
- package/dist/{chunk-X5N6KC6V.js → chunk-WFSUUUAN.js} +2 -3
- package/dist/{chunk-6CHIYEZZ.js → chunk-XZ4H4X5F.js} +9 -83
- package/dist/{chunk-LXAY4A2G.js → chunk-YQR6E6OV.js} +34 -49
- package/dist/chunk-Z7K3L4FC.js +174 -0
- package/dist/{claude-launcher-YVXI76NX.js → claude-launcher-J5M44PFS.js} +20 -7
- package/dist/{cli-C77H54BV.js → cli-EXX2R73G.js} +206 -230
- package/dist/{command-H5CILO4S.js → command-ZQNEPDS6.js} +29 -30
- package/dist/{config-FXDG4NPJ.js → config-CLSGABD5.js} +2 -2
- package/dist/{connect-cmd-ZW5FV3ZW.js → connect-cmd-UNYKGDAL.js} +7 -7
- package/dist/context-cleanup-CHEWNYU6.js +11 -0
- package/dist/control-plane-launch-34LNRJWR.js +216 -0
- package/dist/{dist-QTX4RSCL.js → dist-WO7NOJNG.js} +2 -2
- package/dist/{docker-RC3PRX3Q.js → docker-BFU3AQGY.js} +4 -4
- package/dist/{doctor-2NQQML6P.js → doctor-DHUM5DBB.js} +32 -33
- package/dist/{emit-artifact-cmd-7MP63KXU.js → emit-artifact-cmd-XBHM647X.js} +17 -17
- package/dist/{emit-cmd-PPN4QQF2.js → emit-cmd-W55AEBCA.js} +6 -6
- package/dist/{emit-criteria-cmd-3RXPDLNK.js → emit-criteria-cmd-CRTYEF7D.js} +11 -12
- package/dist/{emit-finding-cmd-OL7JB6H3.js → emit-finding-cmd-7JHVRYOP.js} +12 -13
- package/dist/{emit-result-cmd-UZVMOCF4.js → emit-result-cmd-5NZMLCJK.js} +17 -17
- package/dist/emit-step-cmd-347XNGPQ.js +26 -0
- package/dist/{governing-source-BUU4IABS.js → governing-source-HAA4OW57.js} +21 -22
- package/dist/{hook-fast-W5MKHMJT.js → hook-fast-RL5E5OXE.js} +3 -3
- package/dist/{import-capture-cmd-ZO6KGHI2.js → import-capture-cmd-TK4XY7RD.js} +4 -4
- package/dist/{import-ruler-cmd-KJMWL5V6.js → import-ruler-cmd-T6LLO6Q7.js} +2 -2
- package/dist/index.js +4 -4
- package/dist/{init-WNXXYMO7.js → init-V6FOMD2V.js} +30 -31
- package/dist/{init-VWXIZEAN.js → init-XG47KCI4.js} +30 -31
- package/dist/{init-cmd-WS6TIRYT.js → init-cmd-Z4O4PPLZ.js} +70 -27
- package/dist/{init-update-E3J6TVIN.js → init-update-7DVAKWW3.js} +21 -22
- package/dist/{install-CBWIEF3R.js → install-4SEFIIW2.js} +3 -3
- package/dist/{login-browser-O63QZN7D.js → login-browser-DX35MARZ.js} +2 -2
- package/dist/{loop-UGI2BJOT.js → loop-TPUYUMSY.js} +44 -43
- package/dist/{machine-JOW4RNZ7.js → machine-TRHBT5NE.js} +26 -27
- package/dist/{mcp-serve-cmd-DOTY5FKY.js → mcp-serve-cmd-N3UTY6EE.js} +5 -5
- package/dist/{runner-env-4NB2GA7O.js → runner-env-FRZFFHDF.js} +4 -4
- package/dist/{runner-key-TC3NFWFV.js → runner-key-5FOWCW7J.js} +30 -31
- package/dist/{session-sender-NNVPSPY7.js → session-sender-U2BBUWNO.js} +19 -15
- package/dist/shell-function-NRD4KVUK.js +6 -0
- package/dist/{spec-cmd-OWVTBB4J.js → spec-cmd-FVLJOFGC.js} +12 -13
- package/dist/{starter-pack-OPWUDOWX.js → starter-pack-6LQVLBIA.js} +5 -5
- package/dist/{status-TKCLLKFG.js → status-BINH7MBG.js} +33 -32
- package/dist/{sync-cmd-Q6VYNPWG.js → sync-cmd-VXOUFS4I.js} +18 -14
- package/dist/{watch-ARAGADTF.js → watch-OH645CV2.js} +18 -14
- package/dist/{work-claim-cmd-34FERLYX.js → work-claim-cmd-ZRPSHMPT.js} +16 -17
- package/dist/{work-cmd-7S5B2H2P.js → work-cmd-5I3J2XQQ.js} +12 -13
- package/dist/{work-comment-cmd-SZJSPM5S.js → work-comment-cmd-UCCPWUSR.js} +12 -13
- package/dist/work-logs-cmd-7352CJPG.js +60 -0
- package/dist/{work-open-pr-cmd-RPXKCBWS.js → work-open-pr-cmd-LSH4VHJM.js} +13 -14
- package/dist/{work-pr-cmd-5LGANL32.js → work-pr-cmd-H4OQR26N.js} +12 -13
- package/package.json +2 -2
- package/skill-pack/maintained/outerlayer-cli/SKILL.md +9 -2
- package/skill-pack/maintained/outerlayer-cli/references/find-out-why-a-build-ended.md +76 -0
- package/skill-pack/shipped.json +1 -0
- package/skill-pack/template/build/references/release.md +3 -1
- package/dist/chunk-WBT5X3NH.js +0 -40
- package/dist/chunk-XCCLFVXM.js +0 -401
- package/dist/context-adopt-O5OFXMKI.js +0 -109
- package/dist/context-materialize-Y5IJ4MQT.js +0 -23
- package/dist/{chunk-NACDBXUG.js → chunk-BM63HB2M.js} +1 -1
- package/dist/{chunk-ZRL6HKBY.js → chunk-FVMYKL6L.js} +1 -1
- package/dist/{chunk-52NC2FIU.js → chunk-NTRCK4NH.js} +1 -1
- package/dist/{chunk-XGP3VYOG.js → chunk-P53VEAOF.js} +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { writeJobFile, readJobFile } from './chunk-SADUQSO4.js';
|
|
4
|
-
import { senderPidfile } from './chunk-
|
|
4
|
+
import { senderPidfile } from './chunk-JHGEBPLE.js';
|
|
5
5
|
import { DOCKERD_LOG, HELPER_PATH, HELPER_RECORD } from './chunk-XNGMQ27R.js';
|
|
6
|
-
import { installScrubContext } from './chunk-
|
|
7
|
-
import { AssetError, obtainImage, ensureRootfs, gitRemoteFor, startServicesFor, createBuildDisk, machineConfig, resolveAgentUser, AgentUserError, runBuildSteps, shellQuote, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, containerSenderCommand, syncInContainer, copyTranscriptsFromContainer, GH_CONFIG_YML, ghHostsYml, ADDED_USER, isLiteralAddress, signalInContainer, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, writeEvalInput, EVAL_INPUT_NAME, copyTranscripts, senderSignalScript, containerJudgeEnvironment, copyJudgeTree } from './chunk-
|
|
8
|
-
import { childEnvironment } from './chunk-
|
|
9
|
-
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR } from './chunk-
|
|
6
|
+
import { installScrubContext } from './chunk-R22NZSGA.js';
|
|
7
|
+
import { AssetError, obtainImage, ensureRootfs, gitRemoteFor, startServicesFor, createBuildDisk, machineConfig, resolveAgentUser, AgentUserError, runBuildSteps, shellQuote, createContainerRuntime, stopContainer, cleanupContainer, outOfMemoryReason, containerSenderCommand, syncInContainer, copyTranscriptsFromContainer, GH_CONFIG_YML, ghHostsYml, ADDED_USER, isLiteralAddress, signalInContainer, deleteBuildDisk, startCheckContainer, lifecycleSteps, lifecycleFailureReason, writeEvalInput, EVAL_INPUT_NAME, copyTranscripts, senderSignalScript, containerJudgeEnvironment, copyJudgeTree } from './chunk-3ZR7Y23Y.js';
|
|
8
|
+
import { childEnvironment } from './chunk-VMJPFQNE.js';
|
|
9
|
+
import { HASH_ARGV, parseProgramHash, JUDGE_PROGRAM, judgeCommand, MAX_REPORT_BYTES, JUDGE_MAX_TURNS, JUDGE_DIR } from './chunk-3UZTIRLF.js';
|
|
10
10
|
import { waitForAgent, vmExecArgs } from './chunk-GGOMT6KF.js';
|
|
11
11
|
import { socketPathProblem, vsockLinks, linkVsockSockets } from './chunk-X5H2WYMB.js';
|
|
12
|
-
import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, createRunnerLog, formatDuration, retrySend, formatClock } from './chunk-
|
|
13
|
-
import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-
|
|
14
|
-
import { planArtifactUpload } from './chunk-
|
|
15
|
-
import { isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-
|
|
12
|
+
import { describeCallFailure, resolveGoverningSource, refusalCode, removeStagedContext, stageGovernedContext, pinnedSourceOf, commandWithShim, logStamp, createRunnerLog, formatDuration, retrySend, formatClock } from './chunk-XZ4H4X5F.js';
|
|
13
|
+
import { WorkCommandError, postJson, isSignatureRefusal, getJson } from './chunk-FBTGMSQF.js';
|
|
14
|
+
import { planArtifactUpload } from './chunk-G3IJ3N6F.js';
|
|
15
|
+
import { isBuiltinContainer, isBuiltinProcess, isBuiltinVm, DEFAULT_CHECK_TIME_LIMIT_MINUTES } from './chunk-P53VEAOF.js';
|
|
16
16
|
import { parseSize } from './chunk-7RQ73DLO.js';
|
|
17
17
|
import { readBranchHead, fetchCommit, diffBetween } from './chunk-3CWUOFV6.js';
|
|
18
18
|
import { CLAUDE_CODE_VERSION } from './chunk-CX22S5BA.js';
|
|
19
19
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
20
|
-
import { scrubText } from './chunk-
|
|
21
|
-
import { resolvePackRoot } from './chunk-
|
|
22
|
-
import { parsePolicy } from './chunk-X5N6KC6V.js';
|
|
20
|
+
import { scrubText } from './chunk-QNLX477Q.js';
|
|
21
|
+
import { resolvePackRoot } from './chunk-NNLA7LLQ.js';
|
|
23
22
|
import { readCloudConfig } from './chunk-EABW6AJQ.js';
|
|
23
|
+
import { parsePolicy } from './chunk-WFSUUUAN.js';
|
|
24
|
+
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
24
25
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
25
26
|
import { signerFor } from './chunk-M2ZWWTWZ.js';
|
|
26
27
|
import { runnerDir, buildDir, vsockPath, RUNNER_FILE_MODE } from './chunk-N2PXGQRL.js';
|
|
27
28
|
import { claudeCredential, repositoriesOf, primaryOf, buildEnvironment, JOB_MOUNT, CHECKOUT_DIR, parseIsolation, proxyEnvironment, withProxyWarningHidden, containerLocalAddress, destinationEnvironment, CLAUDE_CREDENTIAL_VARIABLES, builtInEnvironment, withHooksPath, startBuildServices, BUILT_IN_NAMES, AGENT_CREDENTIAL_MISSING, sharedUserEnvironment, headerVariables, authorEnvironment, withTunnelRecord, commitIdentityRecord, RELAY_PORT, repositoryPath, lifecycleWorkdir, checkEnvironment, EVAL_INPUT_DIR } from './chunk-BQXFBI7T.js';
|
|
28
|
-
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
29
29
|
import { spawn, spawnSync } from 'child_process';
|
|
30
30
|
import { randomBytes, createHash } from 'crypto';
|
|
31
|
-
import { mkdirSync, chmodSync, writeFileSync, appendFileSync, statSync, accessSync, constants, openSync, existsSync, readFileSync, closeSync, rmSync, readdirSync, lstatSync, realpathSync } from 'fs';
|
|
31
|
+
import { mkdirSync, chmodSync, writeFileSync, appendFileSync, statSync, accessSync, constants, openSync, existsSync, readFileSync, closeSync, rmSync, readdirSync, lstatSync, fstatSync, readSync, realpathSync } from 'fs';
|
|
32
32
|
import { join, isAbsolute, dirname, delimiter, sep } from 'path';
|
|
33
33
|
import { pathToFileURL } from 'url';
|
|
34
34
|
|
|
@@ -989,6 +989,119 @@ async function settleVerdict(deps) {
|
|
|
989
989
|
await deps.sleep(everyMs);
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
|
+
var RUNNER_LOG_FILE = "runner.log";
|
|
993
|
+
var RUNNER_LOG_KEEP_BYTES = 65536;
|
|
994
|
+
function isTailedStage(stage) {
|
|
995
|
+
const tailed = ["provision", "sync", "cleanup", "report"];
|
|
996
|
+
return tailed.includes(stage);
|
|
997
|
+
}
|
|
998
|
+
var READ_LIMIT_BYTES = 1048576;
|
|
999
|
+
var ITEM_LINE = /^#(\d+)\b/;
|
|
1000
|
+
var AttemptLogBook = class {
|
|
1001
|
+
constructor(now = () => /* @__PURE__ */ new Date()) {
|
|
1002
|
+
this.now = now;
|
|
1003
|
+
this.dirs = /* @__PURE__ */ new Map();
|
|
1004
|
+
this.lastByKey = /* @__PURE__ */ new Map();
|
|
1005
|
+
}
|
|
1006
|
+
/** Starts keeping lines for `item` in `jobDirPath`. Idempotent. */
|
|
1007
|
+
open(item, jobDirPath) {
|
|
1008
|
+
this.dirs.set(Number(item), jobDirPath);
|
|
1009
|
+
}
|
|
1010
|
+
/** Stops keeping lines for `item`; its file stays on disk until housekeeping removes the job directory. */
|
|
1011
|
+
close(item) {
|
|
1012
|
+
const number = Number(item);
|
|
1013
|
+
this.dirs.delete(number);
|
|
1014
|
+
for (const key of [...this.lastByKey.keys()]) {
|
|
1015
|
+
if (key.startsWith(`${number}:`)) this.lastByKey.delete(key);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
/** The log with every line it writes for an open item also kept in that item's file. */
|
|
1019
|
+
wrap(log) {
|
|
1020
|
+
return {
|
|
1021
|
+
line: (text2) => {
|
|
1022
|
+
log.line(text2);
|
|
1023
|
+
this.keepItemLine(text2);
|
|
1024
|
+
},
|
|
1025
|
+
error: (text2) => {
|
|
1026
|
+
log.error(text2);
|
|
1027
|
+
this.keepItemLine(text2);
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
/** One line for `item` that does not itself start with its number. */
|
|
1032
|
+
note(item, text2) {
|
|
1033
|
+
this.append(Number(item), text2);
|
|
1034
|
+
}
|
|
1035
|
+
/** One line, written only when `text` differs from the last one written under `key` for the item. */
|
|
1036
|
+
noteChanged(item, key, text2) {
|
|
1037
|
+
const number = Number(item);
|
|
1038
|
+
const slot = `${number}:${key}`;
|
|
1039
|
+
if (this.lastByKey.get(slot) === text2) return;
|
|
1040
|
+
this.lastByKey.set(slot, text2);
|
|
1041
|
+
this.append(number, text2);
|
|
1042
|
+
}
|
|
1043
|
+
keepItemLine(text2) {
|
|
1044
|
+
const match = ITEM_LINE.exec(text2);
|
|
1045
|
+
if (match !== null) this.append(Number(match[1]), text2);
|
|
1046
|
+
}
|
|
1047
|
+
append(item, text2) {
|
|
1048
|
+
const dir = this.dirs.get(item);
|
|
1049
|
+
if (dir === void 0) return;
|
|
1050
|
+
try {
|
|
1051
|
+
appendFileSync(join(dir, RUNNER_LOG_FILE), `${logStamp(this.now())} ${text2.replace(/[\r\n]+/g, " ")}
|
|
1052
|
+
`, { mode: 384 });
|
|
1053
|
+
} catch {
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
function readEnd(path, maxBytes) {
|
|
1058
|
+
let fd;
|
|
1059
|
+
try {
|
|
1060
|
+
fd = openSync(path, "r");
|
|
1061
|
+
const size = fstatSync(fd).size;
|
|
1062
|
+
const length = Math.min(size, maxBytes);
|
|
1063
|
+
const buffer = Buffer.alloc(length);
|
|
1064
|
+
readSync(fd, buffer, 0, length, size - length);
|
|
1065
|
+
return buffer.toString("utf8");
|
|
1066
|
+
} catch {
|
|
1067
|
+
return void 0;
|
|
1068
|
+
} finally {
|
|
1069
|
+
if (fd !== void 0) closeSync(fd);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
function lastLines(text2, count) {
|
|
1073
|
+
const lines = text2.split("\n");
|
|
1074
|
+
if (lines.at(-1) === "") lines.pop();
|
|
1075
|
+
return lines.slice(-200);
|
|
1076
|
+
}
|
|
1077
|
+
function capRunnerLog(text2) {
|
|
1078
|
+
const bytes = Buffer.from(text2, "utf8");
|
|
1079
|
+
if (bytes.length <= RUNNER_LOG_KEEP_BYTES) return text2;
|
|
1080
|
+
let start = bytes.length - RUNNER_LOG_KEEP_BYTES;
|
|
1081
|
+
if (bytes[start - 1] !== 10) {
|
|
1082
|
+
const newline = bytes.indexOf(10, start);
|
|
1083
|
+
if (newline + 1 < bytes.length) {
|
|
1084
|
+
start = newline + 1;
|
|
1085
|
+
} else {
|
|
1086
|
+
while ((bytes[start] & 192) === 128) start++;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
return `[runner log truncated: the first ${start} bytes were cut]
|
|
1090
|
+
${bytes.subarray(start).toString("utf8")}`;
|
|
1091
|
+
}
|
|
1092
|
+
function buildReleaseLog(jobDirPath, endStage, scrub) {
|
|
1093
|
+
const parts = [];
|
|
1094
|
+
const own = readEnd(join(jobDirPath, RUNNER_LOG_FILE), READ_LIMIT_BYTES);
|
|
1095
|
+
if (own !== void 0 && own.trim() !== "") parts.push(own.endsWith("\n") ? own.slice(0, -1) : own);
|
|
1096
|
+
if (isTailedStage(endStage)) {
|
|
1097
|
+
const file = `${endStage}.log`;
|
|
1098
|
+
const stage = readEnd(join(jobDirPath, file), READ_LIMIT_BYTES);
|
|
1099
|
+
const tail = stage === void 0 ? [] : lastLines(stage);
|
|
1100
|
+
if (tail.length > 0) parts.push(`--- the last ${tail.length} lines of ${file} ---`, ...tail);
|
|
1101
|
+
}
|
|
1102
|
+
if (parts.length === 0) return void 0;
|
|
1103
|
+
return capRunnerLog(scrub(parts.join("\n")) + "\n");
|
|
1104
|
+
}
|
|
992
1105
|
var ENDED = "ended before provision finished";
|
|
993
1106
|
async function provisionProcess(input) {
|
|
994
1107
|
const { config, runtime, item, repository, jobDir } = input;
|
|
@@ -1898,6 +2011,14 @@ function transcriptScrub(config, secrets) {
|
|
|
1898
2011
|
function stripUnsendableReasonChars(text2) {
|
|
1899
2012
|
return text2.replace(/\u0000/g, "").replace(/\p{Cs}/gu, "");
|
|
1900
2013
|
}
|
|
2014
|
+
function stripTerminalControls(text2) {
|
|
2015
|
+
return text2.replace(/\u001b\[[0-?]*[ -\/]*[@-~]/g, "").replace(/\u001b\][^\u0007\u001b\r\n]*(?:\u0007|\u001b\\)?/g, "").replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g, "");
|
|
2016
|
+
}
|
|
2017
|
+
function releaseLogFor(jobDirPath, job, config) {
|
|
2018
|
+
const home = homeFromEnv();
|
|
2019
|
+
installScrubContext(home, transcriptScrub(config, [job.itemKey, config.apiKey]));
|
|
2020
|
+
return buildReleaseLog(jobDirPath, job.endStage, (text2) => scrubText(stripTerminalControls(stripUnsendableReasonChars(text2))));
|
|
2021
|
+
}
|
|
1901
2022
|
function readReasonLine(jobDirPath, config, home = homeFromEnv()) {
|
|
1902
2023
|
let raw;
|
|
1903
2024
|
try {
|
|
@@ -2032,28 +2153,31 @@ async function renewLease(config, item, fetchImpl) {
|
|
|
2032
2153
|
}
|
|
2033
2154
|
var ALREADY_RELEASED = "already released";
|
|
2034
2155
|
async function releaseLease(config, item, outcome, detail, fetchImpl) {
|
|
2035
|
-
const send = async (environment2, sent2) => postJson(
|
|
2156
|
+
const send = async (environment2, sent2, log2) => postJson(
|
|
2036
2157
|
config.url,
|
|
2037
2158
|
`/v1/work-items/${item}/claim/release`,
|
|
2038
2159
|
config.apiKey,
|
|
2039
2160
|
config.appId,
|
|
2040
|
-
{ host: config.host, outcome: sent2, stage: detail.stage, exitCode: detail.exitCode, reason: detail.reason, environment: environment2 },
|
|
2161
|
+
{ host: config.host, outcome: sent2, stage: detail.stage, exitCode: detail.exitCode, reason: detail.reason, environment: environment2, log: log2 },
|
|
2041
2162
|
fetchImpl,
|
|
2042
2163
|
void 0,
|
|
2043
2164
|
await signerFor(config.configPath)
|
|
2044
2165
|
);
|
|
2045
2166
|
let environment = detail.environment;
|
|
2046
2167
|
let sent = outcome;
|
|
2168
|
+
let log = detail.log;
|
|
2047
2169
|
let data;
|
|
2048
2170
|
for (; ; ) {
|
|
2049
2171
|
try {
|
|
2050
|
-
({ data } = await send(environment, sent));
|
|
2172
|
+
({ data } = await send(environment, sent, log));
|
|
2051
2173
|
break;
|
|
2052
2174
|
} catch (err) {
|
|
2053
2175
|
if (!(err instanceof WorkCommandError) || err.status !== 400 || err.code !== "invalid_request_body") throw err;
|
|
2054
2176
|
const namesOutcome = /\boutcome\b/.test(err.message);
|
|
2055
2177
|
if (sent === "incomplete" && namesOutcome) {
|
|
2056
2178
|
sent = "ok";
|
|
2179
|
+
} else if (log !== void 0 && /\blog\b/.test(err.message)) {
|
|
2180
|
+
log = void 0;
|
|
2057
2181
|
} else if (environment?.controlPlane !== void 0) {
|
|
2058
2182
|
const { controlPlane: _omittedPlane, ...withoutPlane } = environment;
|
|
2059
2183
|
environment = withoutPlane;
|
|
@@ -2150,6 +2274,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2150
2274
|
const jobFilePath = join(jobDirPath, "job.json");
|
|
2151
2275
|
const logPath = join(jobDirPath, "command.log");
|
|
2152
2276
|
const tag = `#${job.item}`;
|
|
2277
|
+
deps.attemptLogs?.open(job.item, jobDirPath);
|
|
2153
2278
|
if (job.sender !== void 0) {
|
|
2154
2279
|
await stopSender({ job, deps: { spawnFn, runtime: deps.container, log } });
|
|
2155
2280
|
delete job.sender;
|
|
@@ -2424,6 +2549,9 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2424
2549
|
} else if (ending?.reason === void 0) {
|
|
2425
2550
|
job.reason = (outcome === "ok" ? void 0 : held?.reason) ?? (isolated ? fromHook ?? job.reason : fromHook);
|
|
2426
2551
|
}
|
|
2552
|
+
if (outcome === "failed" && job.reason === void 0 && job.commandEndReason !== void 0) {
|
|
2553
|
+
job.reason = scrubReason(job.commandEndReason, config);
|
|
2554
|
+
}
|
|
2427
2555
|
const cliVersion = deps.cliVersion ?? resolveVersion();
|
|
2428
2556
|
const base = job.environment ?? (job.microvm !== void 0 ? { isolation: "vm", cliVersion } : job.container === void 0 ? sharedUserEnvironment(cliVersion) : { isolation: "container", cliVersion });
|
|
2429
2557
|
if (isolated || job.build !== void 0) {
|
|
@@ -2436,7 +2564,8 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2436
2564
|
writeJobFile(jobFilePath, job);
|
|
2437
2565
|
}
|
|
2438
2566
|
const sentAtMs = now().getTime();
|
|
2439
|
-
const
|
|
2567
|
+
const runnerLog = releaseLogFor(jobDirPath, job, config);
|
|
2568
|
+
const detail = outcome === void 0 ? { log: runnerLog } : { stage: job.endStage, exitCode: job.endExitCode, reason: job.reason, environment: job.environment, log: runnerLog };
|
|
2440
2569
|
const release = await retrySend(() => releaseLease(config, job.item, outcome, detail, deps.fetchImpl), {
|
|
2441
2570
|
now: deps.now,
|
|
2442
2571
|
sleep: deps.sleep
|
|
@@ -2447,6 +2576,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
2447
2576
|
job.endedAt = endedAt.toISOString();
|
|
2448
2577
|
job.releaseFailed = release.ok ? alreadyReleased ? ALREADY_RELEASED : void 0 : release.reason;
|
|
2449
2578
|
writeJobFile(jobFilePath, job);
|
|
2579
|
+
deps.attemptLogs?.close(job.item);
|
|
2450
2580
|
const total = formatDuration(endedAt.getTime() - new Date(job.startedAt).getTime());
|
|
2451
2581
|
if (alreadyReleased) {
|
|
2452
2582
|
log.line(
|
|
@@ -2492,7 +2622,8 @@ async function retryFailedReleases(jobsDirPath, config, deps) {
|
|
|
2492
2622
|
if (!job || job.releaseFailed === void 0 || job.releaseFailed === ALREADY_RELEASED || isUnfinished(job)) {
|
|
2493
2623
|
continue;
|
|
2494
2624
|
}
|
|
2495
|
-
const
|
|
2625
|
+
const runnerLog = releaseLogFor(dirPath, job, config);
|
|
2626
|
+
const detail = job.outcome === void 0 ? { log: runnerLog } : { stage: job.endStage, exitCode: job.endExitCode, reason: job.reason, environment: job.environment, log: runnerLog };
|
|
2496
2627
|
const release = await retrySend(() => releaseLease(config, job.item, job.outcome, detail, deps.fetchImpl), {
|
|
2497
2628
|
now: deps.now,
|
|
2498
2629
|
sleep: deps.sleep
|
|
@@ -2665,4 +2796,4 @@ async function stopSender(input) {
|
|
|
2665
2796
|
}
|
|
2666
2797
|
}
|
|
2667
2798
|
|
|
2668
|
-
export { ALREADY_RELEASED, LEASE_SECONDS, RENEW_INTERVAL_SECONDS, deliverCommitHooks, describeHookEnd, execArgv, execCommandLine, finishJob, hookLimitsFor, hostCommandEnvironment, hostEnvironment, isGroupAlive, isIdle, isTimedOut, isUnfinished, jobEnv, listAdoptableJobs, listenOnBroker, microVmCommandLine, needsRenew, outcomeFromExitCode, provisionEnvironment, provisionMicroVm, provisionProcess, readCpuUsec, readProvisionOut, recoverLostJobs, releaseLease, renewLease, resolveHostBuild, retryFailedReleases, runCommand, runHook, setStage, startHostServices, startSender, stopOrphanedMicroVms, unfinishedJobs, workdirProblem };
|
|
2799
|
+
export { ALREADY_RELEASED, AttemptLogBook, LEASE_SECONDS, RENEW_INTERVAL_SECONDS, deliverCommitHooks, describeHookEnd, execArgv, execCommandLine, finishJob, hookLimitsFor, hostCommandEnvironment, hostEnvironment, isGroupAlive, isIdle, isTimedOut, isUnfinished, jobEnv, listAdoptableJobs, listenOnBroker, microVmCommandLine, needsRenew, outcomeFromExitCode, provisionEnvironment, provisionMicroVm, provisionProcess, readCpuUsec, readProvisionOut, recoverLostJobs, releaseLease, renewLease, resolveHostBuild, retryFailedReleases, runCommand, runHook, setStage, startHostServices, startSender, stopOrphanedMicroVms, unfinishedJobs, workdirProblem };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { sanitizeTerminal } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { resolveGatewayCredentials } from './chunk-
|
|
7
|
-
import { readCloudConfig } from './chunk-EABW6AJQ.js';
|
|
3
|
+
import { sanitizeTerminal } from './chunk-G3IJ3N6F.js';
|
|
4
|
+
import { DEFAULT_DASHBOARD } from './chunk-BM63HB2M.js';
|
|
5
|
+
import { remoteLookupFailed } from './chunk-QNLX477Q.js';
|
|
6
|
+
import { resolveGatewayCredentials } from './chunk-NTRCK4NH.js';
|
|
8
7
|
import { writeRepoConnection, findGitDirs, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
8
|
+
import { readCloudConfig } from './chunk-EABW6AJQ.js';
|
|
9
9
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
10
10
|
import { execFileSync } from 'child_process';
|
|
11
11
|
import { createInterface } from 'readline/promises';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { runEmit } from './chunk-
|
|
3
|
+
import { runEmit } from './chunk-5VML45HH.js';
|
|
4
4
|
import { addStdioMcpEntryIfAbsent, addDocsMcpEntryIfAbsent, DOCS_MCP_SERVER_NAME } from './chunk-YVZJ6GKF.js';
|
|
5
|
-
import { installStarterPack } from './chunk-
|
|
5
|
+
import { installStarterPack } from './chunk-6X4SQ5MY.js';
|
|
6
6
|
import { C } from './chunk-ANPNT6PM.js';
|
|
7
|
-
import { resolveGitCommonDir, defaultGitRunner } from './chunk-
|
|
8
|
-
import {
|
|
9
|
-
import { loadTemplateFiles, loadMaintainedFiles, skillDir } from './chunk-MNTSH4CL.js';
|
|
10
|
-
import { generatedHeaderSource } from './chunk-X5N6KC6V.js';
|
|
7
|
+
import { resolveGitCommonDir, defaultGitRunner } from './chunk-EAEELQVQ.js';
|
|
8
|
+
import { loadTemplateFiles, loadMaintainedFiles, skillDir } from './chunk-NNLA7LLQ.js';
|
|
11
9
|
import { cliInvocation } from './chunk-CRB3POP4.js';
|
|
10
|
+
import { cloneIsGoverned } from './chunk-YQR6E6OV.js';
|
|
11
|
+
import { generatedHeaderSource } from './chunk-WFSUUUAN.js';
|
|
12
12
|
import { execFileSync } from 'child_process';
|
|
13
13
|
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
14
14
|
import { join, dirname } from 'path';
|
|
@@ -40,10 +40,9 @@ function gitTopLevel(cwd) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function contextComesFromControlPlane(repoRoot) {
|
|
43
|
-
if (pinExists(repoRoot)) return true;
|
|
44
43
|
const gitCommonDir = resolveGitCommonDir(defaultGitRunner, repoRoot);
|
|
45
44
|
if (gitCommonDir === void 0) throw new GitLookupError("git could not report this repository's git directory");
|
|
46
|
-
return
|
|
45
|
+
return cloneIsGoverned(gitCommonDir);
|
|
47
46
|
}
|
|
48
47
|
function mcpReplacementLosesNothing(existing, content) {
|
|
49
48
|
try {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
4
|
+
import { join, basename } from 'path';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
var BEGIN = "# BEGIN outerlayer claude";
|
|
8
|
+
var END = "# END outerlayer claude";
|
|
9
|
+
var SHELL_FUNCTION_LINE = 'claude() { outerlayer claude "$@"; }';
|
|
10
|
+
var STARTUP_FILES = { zsh: ".zshrc", bash: ".bashrc" };
|
|
11
|
+
function startupFileFor(home, shellPath) {
|
|
12
|
+
const name = STARTUP_FILES[basename(shellPath ?? "")];
|
|
13
|
+
return name === void 0 ? void 0 : join(home, name);
|
|
14
|
+
}
|
|
15
|
+
function blockLines() {
|
|
16
|
+
return [BEGIN, "# Added by `outerlayer init`. Remove this block, or run `outerlayer init --no-shell-function`, to undo it.", SHELL_FUNCTION_LINE, END];
|
|
17
|
+
}
|
|
18
|
+
function find(lines) {
|
|
19
|
+
let begin = -1;
|
|
20
|
+
for (let i = 0; i < lines.length; i++) {
|
|
21
|
+
if (lines[i] === BEGIN) begin = i;
|
|
22
|
+
else if (lines[i] === END && begin >= 0) return { begin, end: i };
|
|
23
|
+
}
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
function installShellFunction(input) {
|
|
27
|
+
const file = startupFileFor(input.home, input.shellPath);
|
|
28
|
+
if (file === void 0) return { status: "unsupported" };
|
|
29
|
+
const text = existsSync(file) ? readFileSync(file, "utf8") : "";
|
|
30
|
+
if (find(text.split("\n")) !== void 0) return { status: "unchanged", file };
|
|
31
|
+
const endsLine = text === "" || text.endsWith("\n");
|
|
32
|
+
writeFileSync(file, `${text}${endsLine ? "" : "\n"}
|
|
33
|
+
${blockLines().join("\n")}${endsLine ? "\n" : ""}`);
|
|
34
|
+
return { status: "added", file };
|
|
35
|
+
}
|
|
36
|
+
function removeShellFunction(input) {
|
|
37
|
+
const changed = [];
|
|
38
|
+
for (const name of Object.values(STARTUP_FILES)) {
|
|
39
|
+
const file = join(input.home, name);
|
|
40
|
+
if (!existsSync(file)) continue;
|
|
41
|
+
const lines = readFileSync(file, "utf8").split("\n");
|
|
42
|
+
const found = find(lines);
|
|
43
|
+
if (found === void 0) continue;
|
|
44
|
+
const from = found.begin > 0 && lines[found.begin - 1] === "" ? found.begin - 1 : found.begin;
|
|
45
|
+
lines.splice(from, found.end - from + 1);
|
|
46
|
+
writeFileSync(file, lines.join("\n"));
|
|
47
|
+
changed.push(file);
|
|
48
|
+
}
|
|
49
|
+
return changed;
|
|
50
|
+
}
|
|
51
|
+
function shellFunctionInstalled(input) {
|
|
52
|
+
const file = startupFileFor(input.home, input.shellPath);
|
|
53
|
+
return file !== void 0 && existsSync(file) && find(readFileSync(file, "utf8").split("\n")) !== void 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { SHELL_FUNCTION_LINE, installShellFunction, removeShellFunction, shellFunctionInstalled };
|