@outerlayer/cli 0.40.0-next.20261116030912 → 0.40.0-next.20261116035218
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/dist/{agent-setup-KUOWKHAG.js → agent-setup-YTNSQJRL.js} +19 -19
- package/dist/{agent-subcommand-BIZMU7EZ.js → agent-subcommand-UKKTMST3.js} +4 -4
- package/dist/{bridge-6IBWOFEJ.js → bridge-NSKQ7OMW.js} +7 -7
- package/dist/{build-3BX3EJC3.js → build-QAJJNEHA.js} +13 -13
- package/dist/{build-disk-KN7OJLKB.js → build-disk-QJXWKNIT.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-DOJUSWGH.js → builder-BY3ICSMA.js} +10 -10
- package/dist/caller-QGY2IGAL.js +23 -0
- package/dist/{check-GR2WNESK.js → check-UPWM6AJX.js} +55 -55
- package/dist/{chunk-SYFVCV2V.js → chunk-2HGS4N64.js} +2 -2
- package/dist/{chunk-YDB72T5Z.js → chunk-2RXPL7QY.js} +9 -9
- package/dist/{chunk-RNCCRUT5.js → chunk-2ZF62BAK.js} +1 -1
- package/dist/{chunk-2PRLSABK.js → chunk-3JCZM2IZ.js} +3 -3
- package/dist/{chunk-E5PWV6H2.js → chunk-3Q3BM2MK.js} +6 -6
- package/dist/{chunk-WEUBA44W.js → chunk-3S6X6OJ5.js} +7 -7
- package/dist/{chunk-HFVTLCI7.js → chunk-4IYZRQ77.js} +5 -5
- package/dist/{chunk-IIYDYHS5.js → chunk-4JBEGQFS.js} +3 -3
- package/dist/{chunk-IRFN2ZHJ.js → chunk-4KCWAP5L.js} +1 -1
- package/dist/{chunk-ZBD2YOGH.js → chunk-4QXABXJR.js} +1 -1
- package/dist/{chunk-PIXDSHVH.js → chunk-5RKCQYXR.js} +4 -4
- package/dist/{chunk-RIITHK4F.js → chunk-5U6AUT4A.js} +1 -1
- package/dist/{chunk-BMMSIGV4.js → chunk-66DSYZNV.js} +1 -1
- package/dist/{chunk-PT3DOY6P.js → chunk-6TJD5B4O.js} +1 -1
- package/dist/{chunk-6FHMWJHK.js → chunk-754IBIFB.js} +1 -1
- package/dist/{chunk-ZCOIE7ZJ.js → chunk-A32NRZ74.js} +2 -2
- package/dist/{chunk-LPQJ5LXP.js → chunk-A43LWCIT.js} +1124 -282
- package/dist/{chunk-PSKNTGC3.js → chunk-A5DPSY2H.js} +3 -3
- package/dist/{chunk-EGYZGB2P.js → chunk-ASYPP2M6.js} +3 -3
- package/dist/{chunk-MGN525G6.js → chunk-BP2FEQPW.js} +1 -1
- package/dist/{chunk-5YEWBLLX.js → chunk-BXFR2IQJ.js} +3 -3
- package/dist/{chunk-EVMSDUK7.js → chunk-C2AA5SKC.js} +5 -5
- package/dist/{chunk-WMXJ3XBP.js → chunk-CA6WQIZX.js} +2 -2
- package/dist/{chunk-LCZGMJXD.js → chunk-DJCZ26UT.js} +3 -3
- package/dist/{chunk-R3RALX7H.js → chunk-DWUDIRL2.js} +5 -5
- package/dist/{chunk-D7S7PQT5.js → chunk-EJBO6QDQ.js} +10 -10
- package/dist/{chunk-IKGAVS5X.js → chunk-EM6PU2AC.js} +3 -1
- package/dist/{chunk-ZJ2PTV3I.js → chunk-EOE7QIQD.js} +3 -3
- package/dist/{chunk-VXU5IAEQ.js → chunk-EOFA37VL.js} +4 -4
- package/dist/{chunk-SF2TBJBP.js → chunk-F3J4UKBF.js} +1 -1
- package/dist/{chunk-XOJRFV3U.js → chunk-FWKYG2DQ.js} +3 -3
- package/dist/{chunk-U5PIM7JH.js → chunk-GN6TT6WD.js} +29 -29
- package/dist/{chunk-ZDXEZPRM.js → chunk-GWEDQ6WA.js} +6 -6
- package/dist/{chunk-YN6EKURT.js → chunk-HATKUSIR.js} +4 -4
- package/dist/{chunk-T5MBLAIO.js → chunk-HELCGKC3.js} +1 -1
- package/dist/{chunk-SEKJKOOB.js → chunk-HNQIZ3Z7.js} +3 -3
- package/dist/{chunk-PLVHIQJN.js → chunk-HS45JMDJ.js} +76 -14
- package/dist/{chunk-YYSW7OKI.js → chunk-HV3ERHDD.js} +4 -4
- package/dist/{chunk-BFZDVD7T.js → chunk-HW62ZXKA.js} +5 -5
- package/dist/{chunk-Y6FI3HCQ.js → chunk-IISG755E.js} +1 -1
- package/dist/{chunk-2YKSBXWU.js → chunk-IOPPIKGX.js} +4 -4
- package/dist/{chunk-4SAXGCD2.js → chunk-IS6JMEQQ.js} +5 -5
- package/dist/{chunk-XDBHRWPQ.js → chunk-JGUGZA3I.js} +2 -2
- package/dist/{chunk-7PZDPISM.js → chunk-JIMISJV2.js} +62 -2
- package/dist/{chunk-WKPOKOUQ.js → chunk-JTTFL5SB.js} +9 -9
- package/dist/{chunk-N7PG5JAD.js → chunk-KDASHEYT.js} +1 -1
- package/dist/{chunk-7GJGSADZ.js → chunk-KEQ6ZVKI.js} +1 -1
- package/dist/{chunk-M53UNEO6.js → chunk-LA66NWUO.js} +1 -1
- package/dist/{chunk-GODZ6QAN.js → chunk-LEYPTQSX.js} +3 -3
- package/dist/{chunk-QFAH525L.js → chunk-LZQN5PXB.js} +2 -2
- package/dist/{chunk-RRRW2M4B.js → chunk-MCXT33TK.js} +6 -6
- package/dist/{chunk-XOKGCNSG.js → chunk-MFRDSVMG.js} +1 -1
- package/dist/{chunk-IZHE3WOW.js → chunk-MP2Z5ALN.js} +2 -2
- package/dist/{chunk-TQ3PXYPJ.js → chunk-MUAHDK6Y.js} +8 -8
- package/dist/{chunk-ISRMDI2H.js → chunk-NFXQXWIL.js} +5 -5
- package/dist/{chunk-S3ZX2GTO.js → chunk-NOAJUMDK.js} +16 -16
- package/dist/{chunk-PG4UW6QW.js → chunk-NYXPJ2EM.js} +1 -1
- package/dist/{chunk-LFAJCUDD.js → chunk-O32OL4Z7.js} +27 -27
- package/dist/{chunk-5SKYWQ64.js → chunk-OH34EJKB.js} +1 -1
- package/dist/{chunk-BFKSIA3V.js → chunk-OHZC2YUD.js} +2 -2
- package/dist/{chunk-TCPWJBH5.js → chunk-P2DC7QO7.js} +8 -8
- package/dist/{chunk-OC3BSNNE.js → chunk-Q2P2PCQE.js} +2 -2
- package/dist/{chunk-TQPFWWND.js → chunk-Q7AP5O5B.js} +3 -3
- package/dist/{chunk-NDDXBJMX.js → chunk-QGAX44JA.js} +1 -1
- package/dist/{chunk-BAPRSDUR.js → chunk-QLNWEME3.js} +7 -7
- package/dist/{chunk-UTSBE4MP.js → chunk-RAKJRPPQ.js} +1 -1
- package/dist/{chunk-55GT5FLR.js → chunk-RLKCG6MX.js} +1 -1
- package/dist/{chunk-TZZU6IAM.js → chunk-RP4A25IW.js} +1 -1
- package/dist/{chunk-RNZQWJSI.js → chunk-SAS6ZL4X.js} +4 -4
- package/dist/{chunk-BD254PYH.js → chunk-UEB6ENFZ.js} +1 -1
- package/dist/{chunk-CG7326ET.js → chunk-VTFCX6IZ.js} +7 -7
- package/dist/{chunk-DYV2OC4S.js → chunk-VZPW4RPS.js} +1 -1
- package/dist/{chunk-SDLWJF6H.js → chunk-WSU5ADF2.js} +7 -7
- package/dist/{chunk-7PFRNOSF.js → chunk-X5TL4MVO.js} +3 -1
- package/dist/{chunk-2Q5OMKDK.js → chunk-XDQQ5SQE.js} +4 -4
- package/dist/{chunk-OUL5E5UC.js → chunk-XQ2FPOXF.js} +4 -4
- package/dist/{chunk-IQWBUZ75.js → chunk-ZKEPPOR6.js} +3 -3
- package/dist/{claude-launcher-ZSCQOG3G.js → claude-launcher-U6QXR47X.js} +27 -10
- package/dist/{cli-CNZMK32P.js → cli-CEQO7L2A.js} +165 -165
- package/dist/{command-DFRKPEN7.js → command-VM4LKQMJ.js} +51 -51
- package/dist/{config-TGFG7IID.js → config-RM7KS3VB.js} +12 -12
- package/dist/{connect-cmd-UYJV435V.js → connect-cmd-5Q2Z2LIF.js} +11 -11
- package/dist/{container-start-6CECWERV.js → container-start-JT36A3OE.js} +48 -48
- package/dist/{context-cleanup-VYUESYGU.js → context-cleanup-6LEQ2KKF.js} +4 -4
- package/dist/{context-show-cmd-XIPY7JXC.js → context-show-cmd-5BHU6JZQ.js} +12 -12
- package/dist/{control-plane-launch-HQPMYL7O.js → control-plane-launch-OIFEGFA6.js} +15 -15
- package/dist/{demo-record-cmd-UBYX2VAE.js → demo-record-cmd-MRZ5Z6GU.js} +8 -8
- package/dist/{demo-voice-cmd-ABTYSDTU.js → demo-voice-cmd-Y4DFOQQY.js} +20 -20
- package/dist/{docker-E35HTSGN.js → docker-YVMDE3NI.js} +10 -10
- package/dist/{doctor-2PHGAJBZ.js → doctor-ZESKTMJR.js} +50 -50
- package/dist/{emit-artifact-cmd-R5BOINKV.js → emit-artifact-cmd-VS73NUKN.js} +19 -19
- package/dist/{emit-cmd-CBCODUWX.js → emit-cmd-JDTZX5DQ.js} +7 -7
- package/dist/{emit-criteria-cmd-VWCPZ3TV.js → emit-criteria-cmd-4CDD2RUG.js} +14 -14
- package/dist/{emit-demo-cmd-QPF3MGY3.js → emit-demo-cmd-DUHHIUCF.js} +20 -20
- package/dist/{emit-finding-cmd-O2HNKNSU.js → emit-finding-cmd-6QHIKSTT.js} +14 -14
- package/dist/{emit-result-cmd-CFS2YAS5.js → emit-result-cmd-65SDT52A.js} +18 -18
- package/dist/{emit-step-cmd-Q43ESQ5J.js → emit-step-cmd-AUPTW6SU.js} +14 -14
- package/dist/{exec-client-QDEZML3U.js → exec-client-Z2ORBB7W.js} +8 -8
- package/dist/find-unit-5LWPI53X.js +24 -0
- package/dist/{findings-cmd-ZWNSAECA.js → findings-cmd-XIUMQTSY.js} +14 -14
- package/dist/{fleet-readiness-VSPHFYWE.js → fleet-readiness-I6IPCWYO.js} +14 -14
- package/dist/{governing-source-MIRABOUE.js → governing-source-JH7PYU5I.js} +20 -20
- package/dist/{guest-init-QYJVWDCD.js → guest-init-J5M336SR.js} +9 -9
- package/dist/{hook-fast-E2JV656K.js → hook-fast-7ZBDTVKP.js} +4 -4
- package/dist/{hook-install-ZZV5WVDH.js → hook-install-RXYTPBDL.js} +4 -4
- package/dist/{hook-wrap-fast-GVS5HF5C.js → hook-wrap-fast-Y5KKK67C.js} +3 -3
- package/dist/host-checks-YFNJUO46.js +82 -0
- package/dist/{host-key-4RD4MTJ2.js → host-key-F46AUWGU.js} +8 -8
- package/dist/{image-tag-SNXCNAGF.js → image-tag-HCLSC7NI.js} +8 -8
- package/dist/index.js +6 -6
- package/dist/{init-N4GNHORE.js → init-GPZVWNC4.js} +46 -46
- package/dist/init-Y6SAA4UN.js +82 -0
- package/dist/{init-agent-6K26WOFF.js → init-agent-KTITQSB3.js} +46 -46
- package/dist/init-cmd-ACOGV7H7.js +53 -0
- package/dist/{init-update-GHLRW7BP.js → init-update-4Y3XAWG2.js} +23 -23
- package/dist/install-cmd-LKVRFYRO.js +26 -0
- package/dist/launch-agent-7XNKDSV4.js +26 -0
- package/dist/{layout-QU4DUYQQ.js → layout-ANEVGSIG.js} +4 -4
- package/dist/{logs-N7TOXQWL.js → logs-FRYVEZNO.js} +7 -7
- package/dist/loop-BMUIHTJ4.js +92 -0
- package/dist/machine-YTKXLOBK.js +82 -0
- package/dist/{machine-skills-DLDDT4BE.js → machine-skills-ZDIGEJXS.js} +4 -4
- package/dist/{mcp-install-cmd-TFKCJSAH.js → mcp-install-cmd-ZESEU7X4.js} +4 -4
- package/dist/{mcp-serve-cmd-YWBSSEYK.js → mcp-serve-cmd-UWTWBJKJ.js} +9 -9
- package/dist/{paths-GUVGFCBQ.js → paths-I4QL5IY5.js} +7 -7
- package/dist/pending-7PMAF3IX.js +18 -0
- package/dist/{pidfile-AOQMDBSW.js → pidfile-BVALR6BG.js} +8 -8
- package/dist/{record-2RQWFYJ4.js → record-NMCBSQOG.js} +8 -8
- package/dist/{relay-VZEEKIKG.js → relay-UMN5CGTS.js} +5 -5
- package/dist/{relay-protocol-DF7PZPX2.js → relay-protocol-Z3WU3UEO.js} +5 -5
- package/dist/{run-cmd-W2XIBU2G.js → run-cmd-W2QHZXC7.js} +14 -14
- package/dist/{runner-agents-O7G6HTWI.js → runner-agents-LMOOIFHS.js} +4 -4
- package/dist/runner-env-6UYXCBB6.js +24 -0
- package/dist/{runner-identity-MU7HDFGF.js → runner-identity-AOUW4J6F.js} +10 -10
- package/dist/{runner-key-C7IELBJA.js → runner-key-OMFGRSVU.js} +46 -46
- package/dist/{session-sender-NDP6HVSG.js → session-sender-VOPQM2VU.js} +19 -19
- package/dist/{setup-cmd-PQTTUAXH.js → setup-cmd-YM2OSU5H.js} +12 -12
- package/dist/{setup-wiring-4GXHD73A.js → setup-wiring-FFVQTX2C.js} +55 -55
- package/dist/{shell-function-RBJR373S.js → shell-function-7N3ILFLG.js} +2 -2
- package/dist/{spec-cmd-LEU2PGWP.js → spec-cmd-YALZTLRU.js} +15 -15
- package/dist/{starter-pack-3HB74L6Q.js → starter-pack-5B3PQLKF.js} +5 -5
- package/dist/state-GXT2YMJ6.js +18 -0
- package/dist/{status-WJ5W32DG.js → status-HFJLKIIK.js} +46 -46
- package/dist/{statusline-fast-WUXKRABL.js → statusline-fast-ZWMTN36K.js} +3 -3
- package/dist/{sync-cmd-Q3FERZNI.js → sync-cmd-KZHUVTLQ.js} +18 -18
- package/dist/update-steps-62PSEKFT.js +83 -0
- package/dist/{watch-2Z2HFUIL.js → watch-APCEAC7T.js} +18 -18
- package/dist/{work-claim-cmd-Q4EXZDXE.js → work-claim-cmd-SLWQIUT2.js} +20 -20
- package/dist/{work-cmd-JNSI6X5D.js → work-cmd-VBWUUTMK.js} +14 -14
- package/dist/{work-comment-cmd-4AD66BWL.js → work-comment-cmd-XIT4UIZJ.js} +17 -17
- package/dist/{work-demo-cmd-BBNNMB4P.js → work-demo-cmd-YVSS46A2.js} +14 -14
- package/dist/{work-logs-cmd-EU2Z2P2F.js → work-logs-cmd-2J4Z5HU2.js} +14 -14
- package/dist/{work-mock-cmd-5W52S7J5.js → work-mock-cmd-OR4RXGD3.js} +14 -14
- package/dist/{work-needs-attention-cmd-6X3DMFB3.js → work-needs-attention-cmd-AUCX5CDX.js} +14 -14
- package/dist/{work-no-change-cmd-JS5GWIV5.js → work-no-change-cmd-LAX7IXTD.js} +14 -14
- package/dist/{work-open-pr-cmd-3KHOY5KT.js → work-open-pr-cmd-GDRGKMJA.js} +15 -15
- package/dist/{work-pr-cmd-LJDDDQS4.js → work-pr-cmd-QAJ2UGKM.js} +14 -14
- package/dist/{work-proofs-cmd-RE7JFHXA.js → work-proofs-cmd-T5YCQZJW.js} +16 -16
- package/dist/{work-proofs-record-R2V7AW6S.js → work-proofs-record-GNVISJ6H.js} +24 -24
- package/dist/{work-stop-cmd-WTKUFCEF.js → work-stop-cmd-Y5ORIVGV.js} +14 -14
- package/package.json +2 -2
- package/dist/caller-YHE7IHC7.js +0 -23
- package/dist/find-unit-HKCVRS7L.js +0 -24
- package/dist/host-checks-CVNA5FU6.js +0 -82
- package/dist/init-6CJYRUWL.js +0 -82
- package/dist/init-cmd-GPESZN5W.js +0 -53
- package/dist/install-cmd-PEFKMYGU.js +0 -26
- package/dist/launch-agent-P5KMBBB5.js +0 -26
- package/dist/loop-ZEQTRVB5.js +0 -92
- package/dist/machine-Y4DDIC7H.js +0 -82
- package/dist/pending-PXRZ7SIJ.js +0 -18
- package/dist/runner-env-TJE5WGPK.js +0 -24
- package/dist/state-YHPOHZ4I.js +0 -18
- package/dist/update-steps-DF275KW3.js +0 -83
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { CLAUDE_CODE_HOOKS, OPENCODE_CODEC } from './chunk-
|
|
4
|
-
import { CLAUDE_CODE, OPENCODE, NATIVE_AGENTS, LEGACY_AGENT, homeRelative } from './chunk-
|
|
3
|
+
import { CLAUDE_CODE_HOOKS, CODEX_CODEC, OPENCODE_CODEC } from './chunk-HS45JMDJ.js';
|
|
4
|
+
import { CLAUDE_CODE, CODEX, OPENCODE, NATIVE_AGENTS, LEGACY_AGENT, homeRelative } from './chunk-JIMISJV2.js';
|
|
5
5
|
import { MAINTAINED_SKILLS } from './chunk-VSBG7MMU.js';
|
|
6
6
|
import { resolvePackageVersion } from './chunk-RA3O54FC.js';
|
|
7
7
|
import { homeFromEnv } from './chunk-352DHUTP.js';
|
|
8
|
-
import { forkFor, RAW_MIRROR_SEGMENTS, WarningCollector, WARNING_CODES, isNewerThanSupported, bucketsFromTurns, costOfUsage } from './chunk-Y55ARAPE.js';
|
|
8
|
+
import { forkFor, RAW_MIRROR_SEGMENTS, compareVersions, WarningCollector, WARNING_CODES, isNewerThanSupported, bucketsFromTurns, costOfUsage } from './chunk-Y55ARAPE.js';
|
|
9
9
|
import { CODE_REVIEW_NAME, CRITERIA_JUDGE_NAME, RESERVED_EMIT_NAMES, EVENT_TYPES, isHumanUserTurn, INPUT_BAND_BOUNDARIES, parseAgentSession, SCHEMA_VERSION, ARTIFACT_KINDS, ArtifactCriterionIdSchema, SPEED_MAX_LENGTH } from './chunk-MCUI6RHU.js';
|
|
10
10
|
import { __commonJS, __require, __toESM } from './chunk-Z5GEFMRW.js';
|
|
11
11
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync, rmSync, renameSync, realpathSync, readlinkSync, symlinkSync, copyFileSync, statSync, accessSync, constants, lstatSync } from 'fs';
|
|
@@ -14,6 +14,7 @@ import { fileURLToPath } from 'url';
|
|
|
14
14
|
import { spawnSync } from 'child_process';
|
|
15
15
|
import { createHash } from 'crypto';
|
|
16
16
|
import { homedir } from 'os';
|
|
17
|
+
import * as zlib from 'zlib';
|
|
17
18
|
|
|
18
19
|
createRequire(import.meta.url);
|
|
19
20
|
|
|
@@ -952,13 +953,13 @@ var require_Collection = __commonJS({
|
|
|
952
953
|
// ../../node_modules/yaml/dist/stringify/stringifyComment.js
|
|
953
954
|
var require_stringifyComment = __commonJS({
|
|
954
955
|
"../../node_modules/yaml/dist/stringify/stringifyComment.js"(exports$1) {
|
|
955
|
-
var stringifyComment = (
|
|
956
|
+
var stringifyComment = (str2) => str2.replace(/^(?!$)(?: $)?/gm, "#");
|
|
956
957
|
function indentComment(comment, indent) {
|
|
957
958
|
if (/^\n+$/.test(comment))
|
|
958
959
|
return comment.substring(1);
|
|
959
960
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
960
961
|
}
|
|
961
|
-
var lineComment = (
|
|
962
|
+
var lineComment = (str2, indent, comment) => str2.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str2.endsWith(" ") ? "" : " ") + comment;
|
|
962
963
|
exports$1.indentComment = indentComment;
|
|
963
964
|
exports$1.lineComment = lineComment;
|
|
964
965
|
exports$1.stringifyComment = stringifyComment;
|
|
@@ -1110,16 +1111,16 @@ var require_stringifyString = __commonJS({
|
|
|
1110
1111
|
lineWidth: ctx.options.lineWidth,
|
|
1111
1112
|
minContentWidth: ctx.options.minContentWidth
|
|
1112
1113
|
});
|
|
1113
|
-
var containsDocumentMarker = (
|
|
1114
|
-
function lineLengthOverLimit(
|
|
1114
|
+
var containsDocumentMarker = (str2) => /^(%|---|\.\.\.)/m.test(str2);
|
|
1115
|
+
function lineLengthOverLimit(str2, lineWidth, indentLength) {
|
|
1115
1116
|
if (!lineWidth || lineWidth < 0)
|
|
1116
1117
|
return false;
|
|
1117
1118
|
const limit = lineWidth - indentLength;
|
|
1118
|
-
const strLen =
|
|
1119
|
+
const strLen = str2.length;
|
|
1119
1120
|
if (strLen <= limit)
|
|
1120
1121
|
return false;
|
|
1121
1122
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
1122
|
-
if (
|
|
1123
|
+
if (str2[i] === "\n") {
|
|
1123
1124
|
if (i - start > limit)
|
|
1124
1125
|
return true;
|
|
1125
1126
|
start = i + 1;
|
|
@@ -1136,11 +1137,11 @@ var require_stringifyString = __commonJS({
|
|
|
1136
1137
|
const { implicitKey } = ctx;
|
|
1137
1138
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
1138
1139
|
const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
|
|
1139
|
-
let
|
|
1140
|
+
let str2 = "";
|
|
1140
1141
|
let start = 0;
|
|
1141
1142
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
1142
1143
|
if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
|
|
1143
|
-
|
|
1144
|
+
str2 += json.slice(start, i) + "\\ ";
|
|
1144
1145
|
i += 1;
|
|
1145
1146
|
start = i;
|
|
1146
1147
|
ch = "\\";
|
|
@@ -1149,38 +1150,38 @@ var require_stringifyString = __commonJS({
|
|
|
1149
1150
|
switch (json[i + 1]) {
|
|
1150
1151
|
case "u":
|
|
1151
1152
|
{
|
|
1152
|
-
|
|
1153
|
+
str2 += json.slice(start, i);
|
|
1153
1154
|
const code = json.substr(i + 2, 4);
|
|
1154
1155
|
switch (code) {
|
|
1155
1156
|
case "0000":
|
|
1156
|
-
|
|
1157
|
+
str2 += "\\0";
|
|
1157
1158
|
break;
|
|
1158
1159
|
case "0007":
|
|
1159
|
-
|
|
1160
|
+
str2 += "\\a";
|
|
1160
1161
|
break;
|
|
1161
1162
|
case "000b":
|
|
1162
|
-
|
|
1163
|
+
str2 += "\\v";
|
|
1163
1164
|
break;
|
|
1164
1165
|
case "001b":
|
|
1165
|
-
|
|
1166
|
+
str2 += "\\e";
|
|
1166
1167
|
break;
|
|
1167
1168
|
case "0085":
|
|
1168
|
-
|
|
1169
|
+
str2 += "\\N";
|
|
1169
1170
|
break;
|
|
1170
1171
|
case "00a0":
|
|
1171
|
-
|
|
1172
|
+
str2 += "\\_";
|
|
1172
1173
|
break;
|
|
1173
1174
|
case "2028":
|
|
1174
|
-
|
|
1175
|
+
str2 += "\\L";
|
|
1175
1176
|
break;
|
|
1176
1177
|
case "2029":
|
|
1177
|
-
|
|
1178
|
+
str2 += "\\P";
|
|
1178
1179
|
break;
|
|
1179
1180
|
default:
|
|
1180
1181
|
if (code.substr(0, 2) === "00")
|
|
1181
|
-
|
|
1182
|
+
str2 += "\\x" + code.substr(2);
|
|
1182
1183
|
else
|
|
1183
|
-
|
|
1184
|
+
str2 += json.substr(i, 6);
|
|
1184
1185
|
}
|
|
1185
1186
|
i += 5;
|
|
1186
1187
|
start = i + 1;
|
|
@@ -1190,14 +1191,14 @@ var require_stringifyString = __commonJS({
|
|
|
1190
1191
|
if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
|
|
1191
1192
|
i += 1;
|
|
1192
1193
|
} else {
|
|
1193
|
-
|
|
1194
|
+
str2 += json.slice(start, i) + "\n\n";
|
|
1194
1195
|
while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
|
|
1195
|
-
|
|
1196
|
+
str2 += "\n";
|
|
1196
1197
|
i += 2;
|
|
1197
1198
|
}
|
|
1198
|
-
|
|
1199
|
+
str2 += indent;
|
|
1199
1200
|
if (json[i + 2] === " ")
|
|
1200
|
-
|
|
1201
|
+
str2 += "\\";
|
|
1201
1202
|
i += 1;
|
|
1202
1203
|
start = i + 1;
|
|
1203
1204
|
}
|
|
@@ -1206,8 +1207,8 @@ var require_stringifyString = __commonJS({
|
|
|
1206
1207
|
i += 1;
|
|
1207
1208
|
}
|
|
1208
1209
|
}
|
|
1209
|
-
|
|
1210
|
-
return implicitKey ?
|
|
1210
|
+
str2 = start ? str2 + json.slice(start) : json;
|
|
1211
|
+
return implicitKey ? str2 : foldFlowLines.foldFlowLines(str2, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
1211
1212
|
}
|
|
1212
1213
|
function singleQuotedString(value, ctx) {
|
|
1213
1214
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
|
|
@@ -1246,9 +1247,9 @@ ${indent}`) + "'";
|
|
|
1246
1247
|
return quotedString(value, ctx);
|
|
1247
1248
|
}
|
|
1248
1249
|
const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
|
|
1249
|
-
const
|
|
1250
|
+
const literal2 = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.Scalar.BLOCK_FOLDED ? false : type === Scalar.Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
1250
1251
|
if (!value)
|
|
1251
|
-
return
|
|
1252
|
+
return literal2 ? "|\n" : ">\n";
|
|
1252
1253
|
let chomp;
|
|
1253
1254
|
let endStart;
|
|
1254
1255
|
for (endStart = value.length; endStart > 0; --endStart) {
|
|
@@ -1297,7 +1298,7 @@ ${indent}`) + "'";
|
|
|
1297
1298
|
if (onComment)
|
|
1298
1299
|
onComment();
|
|
1299
1300
|
}
|
|
1300
|
-
if (!
|
|
1301
|
+
if (!literal2) {
|
|
1301
1302
|
const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
|
|
1302
1303
|
let literalFallback = false;
|
|
1303
1304
|
const foldOptions = getFoldOptions(ctx, true);
|
|
@@ -1335,15 +1336,15 @@ ${indent}${start}${value}${end}`;
|
|
|
1335
1336
|
return quotedString(value, ctx);
|
|
1336
1337
|
}
|
|
1337
1338
|
}
|
|
1338
|
-
const
|
|
1339
|
+
const str2 = value.replace(/\n+/g, `$&
|
|
1339
1340
|
${indent}`);
|
|
1340
1341
|
if (actualString) {
|
|
1341
|
-
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(
|
|
1342
|
+
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str2);
|
|
1342
1343
|
const { compat, tags } = ctx.doc.schema;
|
|
1343
1344
|
if (tags.some(test) || compat?.some(test))
|
|
1344
1345
|
return quotedString(value, ctx);
|
|
1345
1346
|
}
|
|
1346
|
-
return implicitKey ?
|
|
1347
|
+
return implicitKey ? str2 : foldFlowLines.foldFlowLines(str2, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
1347
1348
|
}
|
|
1348
1349
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
1349
1350
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -1494,11 +1495,11 @@ var require_stringify = __commonJS({
|
|
|
1494
1495
|
const props = stringifyProps(node, tagObj, ctx);
|
|
1495
1496
|
if (props.length > 0)
|
|
1496
1497
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
1497
|
-
const
|
|
1498
|
+
const str2 = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
1498
1499
|
if (!props)
|
|
1499
|
-
return
|
|
1500
|
-
return identity.isScalar(node) ||
|
|
1501
|
-
${ctx.indent}${
|
|
1500
|
+
return str2;
|
|
1501
|
+
return identity.isScalar(node) || str2[0] === "{" || str2[0] === "[" ? `${props} ${str2}` : `${props}
|
|
1502
|
+
${ctx.indent}${str2}`;
|
|
1502
1503
|
}
|
|
1503
1504
|
exports$1.createStringifyContext = createStringifyContext;
|
|
1504
1505
|
exports$1.stringify = stringify;
|
|
@@ -1532,8 +1533,8 @@ var require_stringifyPair = __commonJS({
|
|
|
1532
1533
|
});
|
|
1533
1534
|
let keyCommentDone = false;
|
|
1534
1535
|
let chompKeep = false;
|
|
1535
|
-
let
|
|
1536
|
-
if (!explicitKey && !ctx.inFlow &&
|
|
1536
|
+
let str2 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
1537
|
+
if (!explicitKey && !ctx.inFlow && str2.length > 1024) {
|
|
1537
1538
|
if (simpleKeys)
|
|
1538
1539
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
1539
1540
|
explicitKey = true;
|
|
@@ -1542,27 +1543,27 @@ var require_stringifyPair = __commonJS({
|
|
|
1542
1543
|
if (allNullValues || value == null) {
|
|
1543
1544
|
if (keyCommentDone && onComment)
|
|
1544
1545
|
onComment();
|
|
1545
|
-
return
|
|
1546
|
+
return str2 === "" ? "?" : explicitKey ? `? ${str2}` : str2;
|
|
1546
1547
|
}
|
|
1547
1548
|
} else if (allNullValues && !simpleKeys || value == null && explicitKey) {
|
|
1548
|
-
|
|
1549
|
+
str2 = `? ${str2}`;
|
|
1549
1550
|
if (keyComment && !keyCommentDone) {
|
|
1550
|
-
|
|
1551
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
1551
1552
|
} else if (chompKeep && onChompKeep)
|
|
1552
1553
|
onChompKeep();
|
|
1553
|
-
return
|
|
1554
|
+
return str2;
|
|
1554
1555
|
}
|
|
1555
1556
|
if (keyCommentDone)
|
|
1556
1557
|
keyComment = null;
|
|
1557
1558
|
if (explicitKey) {
|
|
1558
1559
|
if (keyComment)
|
|
1559
|
-
|
|
1560
|
-
|
|
1560
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
1561
|
+
str2 = `? ${str2}
|
|
1561
1562
|
${indent}:`;
|
|
1562
1563
|
} else {
|
|
1563
|
-
|
|
1564
|
+
str2 = `${str2}:`;
|
|
1564
1565
|
if (keyComment)
|
|
1565
|
-
|
|
1566
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(keyComment));
|
|
1566
1567
|
}
|
|
1567
1568
|
let vsb, vcb, valueComment;
|
|
1568
1569
|
if (identity.isNode(value)) {
|
|
@@ -1578,7 +1579,7 @@ ${indent}:`;
|
|
|
1578
1579
|
}
|
|
1579
1580
|
ctx.implicitKey = false;
|
|
1580
1581
|
if (!explicitKey && !keyComment && identity.isScalar(value))
|
|
1581
|
-
ctx.indentAtStart =
|
|
1582
|
+
ctx.indentAtStart = str2.length + 1;
|
|
1582
1583
|
chompKeep = false;
|
|
1583
1584
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
1584
1585
|
ctx.indent = ctx.indent.substring(2);
|
|
@@ -1622,16 +1623,16 @@ ${ctx.indent}`;
|
|
|
1622
1623
|
} else if (valueStr === "" || valueStr[0] === "\n") {
|
|
1623
1624
|
ws = "";
|
|
1624
1625
|
}
|
|
1625
|
-
|
|
1626
|
+
str2 += ws + valueStr;
|
|
1626
1627
|
if (ctx.inFlow) {
|
|
1627
1628
|
if (valueCommentDone && onComment)
|
|
1628
1629
|
onComment();
|
|
1629
1630
|
} else if (valueComment && !valueCommentDone) {
|
|
1630
|
-
|
|
1631
|
+
str2 += stringifyComment.lineComment(str2, ctx.indent, commentString(valueComment));
|
|
1631
1632
|
} else if (chompKeep && onChompKeep) {
|
|
1632
1633
|
onChompKeep();
|
|
1633
1634
|
}
|
|
1634
|
-
return
|
|
1635
|
+
return str2;
|
|
1635
1636
|
}
|
|
1636
1637
|
exports$1.stringifyPair = stringifyPair;
|
|
1637
1638
|
}
|
|
@@ -1853,31 +1854,31 @@ var require_stringifyCollection = __commonJS({
|
|
|
1853
1854
|
}
|
|
1854
1855
|
}
|
|
1855
1856
|
chompKeep = false;
|
|
1856
|
-
let
|
|
1857
|
+
let str3 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
1857
1858
|
if (comment2)
|
|
1858
|
-
|
|
1859
|
+
str3 += stringifyComment.lineComment(str3, itemIndent, commentString(comment2));
|
|
1859
1860
|
if (chompKeep && comment2)
|
|
1860
1861
|
chompKeep = false;
|
|
1861
|
-
lines.push(blockItemPrefix +
|
|
1862
|
+
lines.push(blockItemPrefix + str3);
|
|
1862
1863
|
}
|
|
1863
|
-
let
|
|
1864
|
+
let str2;
|
|
1864
1865
|
if (lines.length === 0) {
|
|
1865
|
-
|
|
1866
|
+
str2 = flowChars.start + flowChars.end;
|
|
1866
1867
|
} else {
|
|
1867
|
-
|
|
1868
|
+
str2 = lines[0];
|
|
1868
1869
|
for (let i = 1; i < lines.length; ++i) {
|
|
1869
1870
|
const line = lines[i];
|
|
1870
|
-
|
|
1871
|
+
str2 += line ? `
|
|
1871
1872
|
${indent}${line}` : "\n";
|
|
1872
1873
|
}
|
|
1873
1874
|
}
|
|
1874
1875
|
if (comment) {
|
|
1875
|
-
|
|
1876
|
+
str2 += "\n" + stringifyComment.indentComment(commentString(comment), indent);
|
|
1876
1877
|
if (onComment)
|
|
1877
1878
|
onComment();
|
|
1878
1879
|
} else if (chompKeep && onChompKeep)
|
|
1879
1880
|
onChompKeep();
|
|
1880
|
-
return
|
|
1881
|
+
return str2;
|
|
1881
1882
|
}
|
|
1882
1883
|
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
1883
1884
|
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
@@ -1920,21 +1921,21 @@ ${indent}${line}` : "\n";
|
|
|
1920
1921
|
}
|
|
1921
1922
|
if (comment)
|
|
1922
1923
|
reqNewline = true;
|
|
1923
|
-
let
|
|
1924
|
-
reqNewline || (reqNewline = lines.length > linesAtValue ||
|
|
1924
|
+
let str2 = stringify.stringify(item, itemCtx, () => comment = null);
|
|
1925
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str2.includes("\n"));
|
|
1925
1926
|
if (i < items.length - 1) {
|
|
1926
|
-
|
|
1927
|
+
str2 += ",";
|
|
1927
1928
|
} else if (ctx.options.trailingComma) {
|
|
1928
1929
|
if (ctx.options.lineWidth > 0) {
|
|
1929
|
-
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (
|
|
1930
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str2.length + 2) > ctx.options.lineWidth);
|
|
1930
1931
|
}
|
|
1931
1932
|
if (reqNewline) {
|
|
1932
|
-
|
|
1933
|
+
str2 += ",";
|
|
1933
1934
|
}
|
|
1934
1935
|
}
|
|
1935
1936
|
if (comment)
|
|
1936
|
-
|
|
1937
|
-
lines.push(
|
|
1937
|
+
str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment));
|
|
1938
|
+
lines.push(str2);
|
|
1938
1939
|
linesAtValue = lines.length;
|
|
1939
1940
|
}
|
|
1940
1941
|
const { start, end } = flowChars;
|
|
@@ -1946,11 +1947,11 @@ ${indent}${line}` : "\n";
|
|
|
1946
1947
|
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
|
|
1947
1948
|
}
|
|
1948
1949
|
if (reqNewline) {
|
|
1949
|
-
let
|
|
1950
|
+
let str2 = start;
|
|
1950
1951
|
for (const line of lines)
|
|
1951
|
-
|
|
1952
|
+
str2 += line ? `
|
|
1952
1953
|
${indentStep}${indent}${line}` : "\n";
|
|
1953
|
-
return `${
|
|
1954
|
+
return `${str2}
|
|
1954
1955
|
${indent}${end}`;
|
|
1955
1956
|
} else {
|
|
1956
1957
|
return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
@@ -2277,7 +2278,7 @@ var require_string = __commonJS({
|
|
|
2277
2278
|
identify: (value) => typeof value === "string",
|
|
2278
2279
|
default: true,
|
|
2279
2280
|
tag: "tag:yaml.org,2002:str",
|
|
2280
|
-
resolve: (
|
|
2281
|
+
resolve: (str2) => str2,
|
|
2281
2282
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
2282
2283
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
2283
2284
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
@@ -2313,7 +2314,7 @@ var require_bool = __commonJS({
|
|
|
2313
2314
|
default: true,
|
|
2314
2315
|
tag: "tag:yaml.org,2002:bool",
|
|
2315
2316
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
2316
|
-
resolve: (
|
|
2317
|
+
resolve: (str2) => new Scalar.Scalar(str2[0] === "t" || str2[0] === "T"),
|
|
2317
2318
|
stringify({ source, value }, ctx) {
|
|
2318
2319
|
if (source && boolTag.test.test(source)) {
|
|
2319
2320
|
const sv = source[0] === "t" || source[0] === "T";
|
|
@@ -2333,9 +2334,9 @@ var require_stringifyNumber = __commonJS({
|
|
|
2333
2334
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
2334
2335
|
if (typeof value === "bigint")
|
|
2335
2336
|
return String(value);
|
|
2336
|
-
const
|
|
2337
|
-
if (!isFinite(
|
|
2338
|
-
return isNaN(
|
|
2337
|
+
const num4 = typeof value === "number" ? value : Number(value);
|
|
2338
|
+
if (!isFinite(num4))
|
|
2339
|
+
return isNaN(num4) ? ".nan" : num4 < 0 ? "-.inf" : ".inf";
|
|
2339
2340
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
2340
2341
|
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
2341
2342
|
let i = n.indexOf(".");
|
|
@@ -2363,7 +2364,7 @@ var require_float = __commonJS({
|
|
|
2363
2364
|
default: true,
|
|
2364
2365
|
tag: "tag:yaml.org,2002:float",
|
|
2365
2366
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
2366
|
-
resolve: (
|
|
2367
|
+
resolve: (str2) => str2.slice(-3).toLowerCase() === "nan" ? NaN : str2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2367
2368
|
stringify: stringifyNumber.stringifyNumber
|
|
2368
2369
|
};
|
|
2369
2370
|
var floatExp = {
|
|
@@ -2372,10 +2373,10 @@ var require_float = __commonJS({
|
|
|
2372
2373
|
tag: "tag:yaml.org,2002:float",
|
|
2373
2374
|
format: "EXP",
|
|
2374
2375
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
2375
|
-
resolve: (
|
|
2376
|
+
resolve: (str2) => parseFloat(str2),
|
|
2376
2377
|
stringify(node) {
|
|
2377
|
-
const
|
|
2378
|
-
return isFinite(
|
|
2378
|
+
const num4 = Number(node.value);
|
|
2379
|
+
return isFinite(num4) ? num4.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2379
2380
|
}
|
|
2380
2381
|
};
|
|
2381
2382
|
var float = {
|
|
@@ -2383,11 +2384,11 @@ var require_float = __commonJS({
|
|
|
2383
2384
|
default: true,
|
|
2384
2385
|
tag: "tag:yaml.org,2002:float",
|
|
2385
2386
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
2386
|
-
resolve(
|
|
2387
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
2388
|
-
const dot =
|
|
2389
|
-
if (dot !== -1 &&
|
|
2390
|
-
node.minFractionDigits =
|
|
2387
|
+
resolve(str2) {
|
|
2388
|
+
const node = new Scalar.Scalar(parseFloat(str2));
|
|
2389
|
+
const dot = str2.indexOf(".");
|
|
2390
|
+
if (dot !== -1 && str2[str2.length - 1] === "0")
|
|
2391
|
+
node.minFractionDigits = str2.length - dot - 1;
|
|
2391
2392
|
return node;
|
|
2392
2393
|
},
|
|
2393
2394
|
stringify: stringifyNumber.stringifyNumber
|
|
@@ -2403,7 +2404,7 @@ var require_int = __commonJS({
|
|
|
2403
2404
|
"../../node_modules/yaml/dist/schema/core/int.js"(exports$1) {
|
|
2404
2405
|
var stringifyNumber = require_stringifyNumber();
|
|
2405
2406
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
2406
|
-
var intResolve = (
|
|
2407
|
+
var intResolve = (str2, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str2) : parseInt(str2.substring(offset), radix);
|
|
2407
2408
|
function intStringify(node, radix, prefix) {
|
|
2408
2409
|
const { value } = node;
|
|
2409
2410
|
if (intIdentify(value) && value >= 0)
|
|
@@ -2416,7 +2417,7 @@ var require_int = __commonJS({
|
|
|
2416
2417
|
tag: "tag:yaml.org,2002:int",
|
|
2417
2418
|
format: "OCT",
|
|
2418
2419
|
test: /^0o[0-7]+$/,
|
|
2419
|
-
resolve: (
|
|
2420
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 8, opt),
|
|
2420
2421
|
stringify: (node) => intStringify(node, 8, "0o")
|
|
2421
2422
|
};
|
|
2422
2423
|
var int = {
|
|
@@ -2424,7 +2425,7 @@ var require_int = __commonJS({
|
|
|
2424
2425
|
default: true,
|
|
2425
2426
|
tag: "tag:yaml.org,2002:int",
|
|
2426
2427
|
test: /^[-+]?[0-9]+$/,
|
|
2427
|
-
resolve: (
|
|
2428
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 0, 10, opt),
|
|
2428
2429
|
stringify: stringifyNumber.stringifyNumber
|
|
2429
2430
|
};
|
|
2430
2431
|
var intHex = {
|
|
@@ -2433,7 +2434,7 @@ var require_int = __commonJS({
|
|
|
2433
2434
|
tag: "tag:yaml.org,2002:int",
|
|
2434
2435
|
format: "HEX",
|
|
2435
2436
|
test: /^0x[0-9a-fA-F]+$/,
|
|
2436
|
-
resolve: (
|
|
2437
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 16, opt),
|
|
2437
2438
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
2438
2439
|
};
|
|
2439
2440
|
exports$1.int = int;
|
|
@@ -2484,7 +2485,7 @@ var require_schema2 = __commonJS({
|
|
|
2484
2485
|
identify: (value) => typeof value === "string",
|
|
2485
2486
|
default: true,
|
|
2486
2487
|
tag: "tag:yaml.org,2002:str",
|
|
2487
|
-
resolve: (
|
|
2488
|
+
resolve: (str2) => str2,
|
|
2488
2489
|
stringify: stringifyJSON
|
|
2489
2490
|
},
|
|
2490
2491
|
{
|
|
@@ -2501,7 +2502,7 @@ var require_schema2 = __commonJS({
|
|
|
2501
2502
|
default: true,
|
|
2502
2503
|
tag: "tag:yaml.org,2002:bool",
|
|
2503
2504
|
test: /^true$|^false$/,
|
|
2504
|
-
resolve: (
|
|
2505
|
+
resolve: (str2) => str2 === "true",
|
|
2505
2506
|
stringify: stringifyJSON
|
|
2506
2507
|
},
|
|
2507
2508
|
{
|
|
@@ -2509,7 +2510,7 @@ var require_schema2 = __commonJS({
|
|
|
2509
2510
|
default: true,
|
|
2510
2511
|
tag: "tag:yaml.org,2002:int",
|
|
2511
2512
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
2512
|
-
resolve: (
|
|
2513
|
+
resolve: (str2, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str2) : parseInt(str2, 10),
|
|
2513
2514
|
stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
|
|
2514
2515
|
},
|
|
2515
2516
|
{
|
|
@@ -2517,7 +2518,7 @@ var require_schema2 = __commonJS({
|
|
|
2517
2518
|
default: true,
|
|
2518
2519
|
tag: "tag:yaml.org,2002:float",
|
|
2519
2520
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
2520
|
-
resolve: (
|
|
2521
|
+
resolve: (str2) => parseFloat(str2),
|
|
2521
2522
|
stringify: stringifyJSON
|
|
2522
2523
|
}
|
|
2523
2524
|
];
|
|
@@ -2525,9 +2526,9 @@ var require_schema2 = __commonJS({
|
|
|
2525
2526
|
default: true,
|
|
2526
2527
|
tag: "",
|
|
2527
2528
|
test: /^/,
|
|
2528
|
-
resolve(
|
|
2529
|
-
onError(`Unresolved plain scalar ${JSON.stringify(
|
|
2530
|
-
return
|
|
2529
|
+
resolve(str2, onError) {
|
|
2530
|
+
onError(`Unresolved plain scalar ${JSON.stringify(str2)}`);
|
|
2531
|
+
return str2;
|
|
2531
2532
|
}
|
|
2532
2533
|
};
|
|
2533
2534
|
var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
|
@@ -2558,10 +2559,10 @@ var require_binary = __commonJS({
|
|
|
2558
2559
|
if (typeof node_buffer.Buffer === "function") {
|
|
2559
2560
|
return node_buffer.Buffer.from(src, "base64");
|
|
2560
2561
|
} else if (typeof atob === "function") {
|
|
2561
|
-
const
|
|
2562
|
-
const buffer = new Uint8Array(
|
|
2563
|
-
for (let i = 0; i <
|
|
2564
|
-
buffer[i] =
|
|
2562
|
+
const str2 = atob(src.replace(/[\n\r]/g, ""));
|
|
2563
|
+
const buffer = new Uint8Array(str2.length);
|
|
2564
|
+
for (let i = 0; i < str2.length; ++i)
|
|
2565
|
+
buffer[i] = str2.charCodeAt(i);
|
|
2565
2566
|
return buffer;
|
|
2566
2567
|
} else {
|
|
2567
2568
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
@@ -2572,28 +2573,28 @@ var require_binary = __commonJS({
|
|
|
2572
2573
|
if (!value)
|
|
2573
2574
|
return "";
|
|
2574
2575
|
const buf = value;
|
|
2575
|
-
let
|
|
2576
|
+
let str2;
|
|
2576
2577
|
if (typeof node_buffer.Buffer === "function") {
|
|
2577
|
-
|
|
2578
|
+
str2 = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
|
|
2578
2579
|
} else if (typeof btoa === "function") {
|
|
2579
2580
|
let s = "";
|
|
2580
2581
|
for (let i = 0; i < buf.length; ++i)
|
|
2581
2582
|
s += String.fromCharCode(buf[i]);
|
|
2582
|
-
|
|
2583
|
+
str2 = btoa(s);
|
|
2583
2584
|
} else {
|
|
2584
2585
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
2585
2586
|
}
|
|
2586
2587
|
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
|
|
2587
2588
|
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
|
|
2588
2589
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
2589
|
-
const n = Math.ceil(
|
|
2590
|
+
const n = Math.ceil(str2.length / lineWidth);
|
|
2590
2591
|
const lines = new Array(n);
|
|
2591
2592
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
2592
|
-
lines[i] =
|
|
2593
|
+
lines[i] = str2.substr(o, lineWidth);
|
|
2593
2594
|
}
|
|
2594
|
-
|
|
2595
|
+
str2 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
2595
2596
|
}
|
|
2596
|
-
return stringifyString.stringifyString({ comment, type, value:
|
|
2597
|
+
return stringifyString.stringifyString({ comment, type, value: str2 }, ctx, onComment, onChompKeep);
|
|
2597
2598
|
}
|
|
2598
2599
|
};
|
|
2599
2600
|
exports$1.binary = binary;
|
|
@@ -2795,7 +2796,7 @@ var require_float2 = __commonJS({
|
|
|
2795
2796
|
default: true,
|
|
2796
2797
|
tag: "tag:yaml.org,2002:float",
|
|
2797
2798
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
2798
|
-
resolve: (
|
|
2799
|
+
resolve: (str2) => str2.slice(-3).toLowerCase() === "nan" ? NaN : str2[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
2799
2800
|
stringify: stringifyNumber.stringifyNumber
|
|
2800
2801
|
};
|
|
2801
2802
|
var floatExp = {
|
|
@@ -2804,10 +2805,10 @@ var require_float2 = __commonJS({
|
|
|
2804
2805
|
tag: "tag:yaml.org,2002:float",
|
|
2805
2806
|
format: "EXP",
|
|
2806
2807
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
2807
|
-
resolve: (
|
|
2808
|
+
resolve: (str2) => parseFloat(str2.replace(/_/g, "")),
|
|
2808
2809
|
stringify(node) {
|
|
2809
|
-
const
|
|
2810
|
-
return isFinite(
|
|
2810
|
+
const num4 = Number(node.value);
|
|
2811
|
+
return isFinite(num4) ? num4.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2811
2812
|
}
|
|
2812
2813
|
};
|
|
2813
2814
|
var float = {
|
|
@@ -2815,11 +2816,11 @@ var require_float2 = __commonJS({
|
|
|
2815
2816
|
default: true,
|
|
2816
2817
|
tag: "tag:yaml.org,2002:float",
|
|
2817
2818
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
2818
|
-
resolve(
|
|
2819
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
2820
|
-
const dot =
|
|
2819
|
+
resolve(str2) {
|
|
2820
|
+
const node = new Scalar.Scalar(parseFloat(str2.replace(/_/g, "")));
|
|
2821
|
+
const dot = str2.indexOf(".");
|
|
2821
2822
|
if (dot !== -1) {
|
|
2822
|
-
const f =
|
|
2823
|
+
const f = str2.substring(dot + 1).replace(/_/g, "");
|
|
2823
2824
|
if (f[f.length - 1] === "0")
|
|
2824
2825
|
node.minFractionDigits = f.length;
|
|
2825
2826
|
}
|
|
@@ -2838,34 +2839,34 @@ var require_int2 = __commonJS({
|
|
|
2838
2839
|
"../../node_modules/yaml/dist/schema/yaml-1.1/int.js"(exports$1) {
|
|
2839
2840
|
var stringifyNumber = require_stringifyNumber();
|
|
2840
2841
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
2841
|
-
function intResolve(
|
|
2842
|
-
const sign =
|
|
2842
|
+
function intResolve(str2, offset, radix, { intAsBigInt }) {
|
|
2843
|
+
const sign = str2[0];
|
|
2843
2844
|
if (sign === "-" || sign === "+")
|
|
2844
2845
|
offset += 1;
|
|
2845
|
-
|
|
2846
|
+
str2 = str2.substring(offset).replace(/_/g, "");
|
|
2846
2847
|
if (intAsBigInt) {
|
|
2847
2848
|
switch (radix) {
|
|
2848
2849
|
case 2:
|
|
2849
|
-
|
|
2850
|
+
str2 = `0b${str2}`;
|
|
2850
2851
|
break;
|
|
2851
2852
|
case 8:
|
|
2852
|
-
|
|
2853
|
+
str2 = `0o${str2}`;
|
|
2853
2854
|
break;
|
|
2854
2855
|
case 16:
|
|
2855
|
-
|
|
2856
|
+
str2 = `0x${str2}`;
|
|
2856
2857
|
break;
|
|
2857
2858
|
}
|
|
2858
|
-
const n2 = BigInt(
|
|
2859
|
+
const n2 = BigInt(str2);
|
|
2859
2860
|
return sign === "-" ? BigInt(-1) * n2 : n2;
|
|
2860
2861
|
}
|
|
2861
|
-
const n = parseInt(
|
|
2862
|
+
const n = parseInt(str2, radix);
|
|
2862
2863
|
return sign === "-" ? -1 * n : n;
|
|
2863
2864
|
}
|
|
2864
2865
|
function intStringify(node, radix, prefix) {
|
|
2865
2866
|
const { value } = node;
|
|
2866
2867
|
if (intIdentify(value)) {
|
|
2867
|
-
const
|
|
2868
|
-
return value < 0 ? "-" + prefix +
|
|
2868
|
+
const str2 = value.toString(radix);
|
|
2869
|
+
return value < 0 ? "-" + prefix + str2.substr(1) : prefix + str2;
|
|
2869
2870
|
}
|
|
2870
2871
|
return stringifyNumber.stringifyNumber(node);
|
|
2871
2872
|
}
|
|
@@ -2875,7 +2876,7 @@ var require_int2 = __commonJS({
|
|
|
2875
2876
|
tag: "tag:yaml.org,2002:int",
|
|
2876
2877
|
format: "BIN",
|
|
2877
2878
|
test: /^[-+]?0b[0-1_]+$/,
|
|
2878
|
-
resolve: (
|
|
2879
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 2, opt),
|
|
2879
2880
|
stringify: (node) => intStringify(node, 2, "0b")
|
|
2880
2881
|
};
|
|
2881
2882
|
var intOct = {
|
|
@@ -2884,7 +2885,7 @@ var require_int2 = __commonJS({
|
|
|
2884
2885
|
tag: "tag:yaml.org,2002:int",
|
|
2885
2886
|
format: "OCT",
|
|
2886
2887
|
test: /^[-+]?0[0-7_]+$/,
|
|
2887
|
-
resolve: (
|
|
2888
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 1, 8, opt),
|
|
2888
2889
|
stringify: (node) => intStringify(node, 8, "0")
|
|
2889
2890
|
};
|
|
2890
2891
|
var int = {
|
|
@@ -2892,7 +2893,7 @@ var require_int2 = __commonJS({
|
|
|
2892
2893
|
default: true,
|
|
2893
2894
|
tag: "tag:yaml.org,2002:int",
|
|
2894
2895
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
2895
|
-
resolve: (
|
|
2896
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 0, 10, opt),
|
|
2896
2897
|
stringify: stringifyNumber.stringifyNumber
|
|
2897
2898
|
};
|
|
2898
2899
|
var intHex = {
|
|
@@ -2901,7 +2902,7 @@ var require_int2 = __commonJS({
|
|
|
2901
2902
|
tag: "tag:yaml.org,2002:int",
|
|
2902
2903
|
format: "HEX",
|
|
2903
2904
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
2904
|
-
resolve: (
|
|
2905
|
+
resolve: (str2, _onError, opt) => intResolve(str2, 2, 16, opt),
|
|
2905
2906
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
2906
2907
|
};
|
|
2907
2908
|
exports$1.int = int;
|
|
@@ -3003,26 +3004,26 @@ var require_set = __commonJS({
|
|
|
3003
3004
|
var require_timestamp = __commonJS({
|
|
3004
3005
|
"../../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports$1) {
|
|
3005
3006
|
var stringifyNumber = require_stringifyNumber();
|
|
3006
|
-
function parseSexagesimal(
|
|
3007
|
-
const sign =
|
|
3008
|
-
const parts = sign === "-" || sign === "+" ?
|
|
3009
|
-
const
|
|
3010
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 *
|
|
3011
|
-
return sign === "-" ?
|
|
3007
|
+
function parseSexagesimal(str2, asBigInt) {
|
|
3008
|
+
const sign = str2[0];
|
|
3009
|
+
const parts = sign === "-" || sign === "+" ? str2.substring(1) : str2;
|
|
3010
|
+
const num4 = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
3011
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num4(60) + num4(p), num4(0));
|
|
3012
|
+
return sign === "-" ? num4(-1) * res : res;
|
|
3012
3013
|
}
|
|
3013
3014
|
function stringifySexagesimal(node) {
|
|
3014
3015
|
let { value } = node;
|
|
3015
|
-
let
|
|
3016
|
+
let num4 = (n) => n;
|
|
3016
3017
|
if (typeof value === "bigint")
|
|
3017
|
-
|
|
3018
|
+
num4 = (n) => BigInt(n);
|
|
3018
3019
|
else if (isNaN(value) || !isFinite(value))
|
|
3019
3020
|
return stringifyNumber.stringifyNumber(node);
|
|
3020
3021
|
let sign = "";
|
|
3021
3022
|
if (value < 0) {
|
|
3022
3023
|
sign = "-";
|
|
3023
|
-
value *=
|
|
3024
|
+
value *= num4(-1);
|
|
3024
3025
|
}
|
|
3025
|
-
const _60 =
|
|
3026
|
+
const _60 = num4(60);
|
|
3026
3027
|
const parts = [value % _60];
|
|
3027
3028
|
if (value < 60) {
|
|
3028
3029
|
parts.unshift(0);
|
|
@@ -3042,7 +3043,7 @@ var require_timestamp = __commonJS({
|
|
|
3042
3043
|
tag: "tag:yaml.org,2002:int",
|
|
3043
3044
|
format: "TIME",
|
|
3044
3045
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
3045
|
-
resolve: (
|
|
3046
|
+
resolve: (str2, _onError, { intAsBigInt }) => parseSexagesimal(str2, intAsBigInt),
|
|
3046
3047
|
stringify: stringifySexagesimal
|
|
3047
3048
|
};
|
|
3048
3049
|
var floatTime = {
|
|
@@ -3051,7 +3052,7 @@ var require_timestamp = __commonJS({
|
|
|
3051
3052
|
tag: "tag:yaml.org,2002:float",
|
|
3052
3053
|
format: "TIME",
|
|
3053
3054
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
3054
|
-
resolve: (
|
|
3055
|
+
resolve: (str2) => parseSexagesimal(str2, false),
|
|
3055
3056
|
stringify: stringifySexagesimal
|
|
3056
3057
|
};
|
|
3057
3058
|
var timestamp = {
|
|
@@ -3062,8 +3063,8 @@ var require_timestamp = __commonJS({
|
|
|
3062
3063
|
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
3063
3064
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
3064
3065
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
3065
|
-
resolve(
|
|
3066
|
-
const match =
|
|
3066
|
+
resolve(str2) {
|
|
3067
|
+
const match = str2.match(timestamp.test);
|
|
3067
3068
|
if (!match)
|
|
3068
3069
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
3069
3070
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -7593,7 +7594,7 @@ function buildAgentsMd(input) {
|
|
|
7593
7594
|
}
|
|
7594
7595
|
return { files, copies: [], warnings };
|
|
7595
7596
|
}
|
|
7596
|
-
var REMOVED_TARGET_IDS = ["cursor", "
|
|
7597
|
+
var REMOVED_TARGET_IDS = ["cursor", "copilot", "factory"];
|
|
7597
7598
|
function parseOuterlayerConfig(json, knownTargets) {
|
|
7598
7599
|
let raw;
|
|
7599
7600
|
try {
|
|
@@ -9533,7 +9534,7 @@ function forkOptions(record, entry) {
|
|
|
9533
9534
|
}
|
|
9534
9535
|
function createClaudeCodeCapture(io) {
|
|
9535
9536
|
const rollup = createSubagentRollup(io);
|
|
9536
|
-
const
|
|
9537
|
+
const parseText3 = (text, options) => parseTranscript(text, { agentType: CLAUDE_CODE.id, ...options }, io.sha256);
|
|
9537
9538
|
return {
|
|
9538
9539
|
discover(roots) {
|
|
9539
9540
|
const liveRoot = roots.root ?? defaultProjectsDir(io);
|
|
@@ -9559,7 +9560,7 @@ function createClaudeCodeCapture(io) {
|
|
|
9559
9560
|
parse(entry, opts) {
|
|
9560
9561
|
const text = io.fs.readRawText(entry.file);
|
|
9561
9562
|
if (text === void 0) throw new Error(`cannot read the transcript ${entry.file}`);
|
|
9562
|
-
const result =
|
|
9563
|
+
const result = parseText3(text, {
|
|
9563
9564
|
fallbackId: sessionIdFromPath(entry.file),
|
|
9564
9565
|
isSubagent: entry.isSubagent,
|
|
9565
9566
|
...entry.parentSessionId ? { parentSessionId: entry.parentSessionId } : {},
|
|
@@ -9576,9 +9577,9 @@ function createClaudeCodeCapture(io) {
|
|
|
9576
9577
|
}
|
|
9577
9578
|
return result;
|
|
9578
9579
|
},
|
|
9579
|
-
parseText:
|
|
9580
|
+
parseText: parseText3,
|
|
9580
9581
|
tail(file, completeText, options) {
|
|
9581
|
-
const { session } =
|
|
9582
|
+
const { session } = parseText3(completeText, { fallbackId: sessionIdFromPath(file), ...options });
|
|
9582
9583
|
return !options.isSubagent && session ? rollup.applySubagentCommitRollup(session, file) : session;
|
|
9583
9584
|
},
|
|
9584
9585
|
identify(file) {
|
|
@@ -9672,20 +9673,20 @@ function filesOf(fs) {
|
|
|
9672
9673
|
return false;
|
|
9673
9674
|
}
|
|
9674
9675
|
};
|
|
9675
|
-
const
|
|
9676
|
+
const filesUnder4 = (dir, base = dir) => {
|
|
9676
9677
|
if (fs.kind(dir) !== "directory") return [];
|
|
9677
9678
|
const out = [];
|
|
9678
9679
|
for (const name of fs.list(dir)) {
|
|
9679
9680
|
const abs = join(dir, name);
|
|
9680
9681
|
const kind = fs.kind(abs);
|
|
9681
|
-
if (kind === "directory") out.push(...
|
|
9682
|
+
if (kind === "directory") out.push(...filesUnder4(abs, base));
|
|
9682
9683
|
else if (kind === "file") out.push(abs.slice(base.length + 1));
|
|
9683
9684
|
}
|
|
9684
9685
|
return out.sort();
|
|
9685
9686
|
};
|
|
9686
9687
|
const readText = (path) => fs.kind(path) === "file" ? fs.readText(path) : void 0;
|
|
9687
9688
|
const isFile = (path) => fs.kind(path) === "file";
|
|
9688
|
-
return { exists: exists2, filesUnder:
|
|
9689
|
+
return { exists: exists2, filesUnder: filesUnder4, readText, isFile };
|
|
9689
9690
|
}
|
|
9690
9691
|
function deliveredSettings(raw, dir) {
|
|
9691
9692
|
if (raw === void 0) return "{}\n";
|
|
@@ -9704,7 +9705,7 @@ function deliveredSettings(raw, dir) {
|
|
|
9704
9705
|
}
|
|
9705
9706
|
function createDelivery(io) {
|
|
9706
9707
|
const { fs } = io;
|
|
9707
|
-
const { exists: exists2, filesUnder:
|
|
9708
|
+
const { exists: exists2, filesUnder: filesUnder4, readText, isFile } = filesOf(fs);
|
|
9708
9709
|
return {
|
|
9709
9710
|
compose({ tree, dir, maintainedSkills }) {
|
|
9710
9711
|
const added = [];
|
|
@@ -9714,7 +9715,7 @@ function createDelivery(io) {
|
|
|
9714
9715
|
added.push(rel);
|
|
9715
9716
|
};
|
|
9716
9717
|
for (const skill of maintainedSkills) {
|
|
9717
|
-
for (const rel of
|
|
9718
|
+
for (const rel of filesUnder4(join(tree, ".outerlayer/skills", skill))) {
|
|
9718
9719
|
const target = `.claude/skills/${skill}/${rel}`;
|
|
9719
9720
|
if (exists2(join(tree, target))) continue;
|
|
9720
9721
|
fs.makeDir(parentOf(join(tree, target)));
|
|
@@ -9726,7 +9727,7 @@ function createDelivery(io) {
|
|
|
9726
9727
|
if (exists2(agentSkills) && fs.kind(agentSkills) === "directory") {
|
|
9727
9728
|
for (const name of fs.list(agentSkills)) {
|
|
9728
9729
|
if (fs.kind(join(agentSkills, name)) !== "directory" || exists2(join(tree, ".claude/skills", name))) continue;
|
|
9729
|
-
for (const rel of
|
|
9730
|
+
for (const rel of filesUnder4(join(agentSkills, name))) {
|
|
9730
9731
|
const target = `.claude/skills/${name}/${rel}`;
|
|
9731
9732
|
fs.makeDir(parentOf(join(tree, target)));
|
|
9732
9733
|
fs.copy(join(agentSkills, name, rel), join(tree, target));
|
|
@@ -9734,7 +9735,7 @@ function createDelivery(io) {
|
|
|
9734
9735
|
}
|
|
9735
9736
|
}
|
|
9736
9737
|
}
|
|
9737
|
-
for (const rel of [...
|
|
9738
|
+
for (const rel of [...filesUnder4(join(tree, ".claude/skills"), tree), ...filesUnder4(join(tree, ".claude/agents"), tree)]) {
|
|
9738
9739
|
const text = readText(join(tree, rel));
|
|
9739
9740
|
if (text === void 0) continue;
|
|
9740
9741
|
const rewritten = rewriteControlPlanePaths(text, dir);
|
|
@@ -10157,7 +10158,7 @@ var CLAUDE_CODE_HOOK_INSTALL = {
|
|
|
10157
10158
|
// ../agents/src/claude-code/diagnostics.ts
|
|
10158
10159
|
var NAME = CLAUDE_CODE.label;
|
|
10159
10160
|
var PROGRAM = CLAUDE_CODE.program;
|
|
10160
|
-
function
|
|
10161
|
+
function compareVersions2(a, b) {
|
|
10161
10162
|
const parse2 = (version) => version.split(".").map((part) => Number.isFinite(Number.parseInt(part, 10)) ? Number.parseInt(part, 10) : 0);
|
|
10162
10163
|
const left = parse2(a);
|
|
10163
10164
|
const right = parse2(b);
|
|
@@ -10217,10 +10218,10 @@ function versionCheck(io, input) {
|
|
|
10217
10218
|
const parsed = version.match(/\d+\.\d+\.\d+/)?.[0];
|
|
10218
10219
|
if (!parsed) return [{ name, status: "warn", detail: `unrecognized: ${version}` }];
|
|
10219
10220
|
const tested = input.tested ?? CLAUDE_CODE.versions.tested;
|
|
10220
|
-
if (
|
|
10221
|
+
if (compareVersions2(parsed, tested.to) > 0) {
|
|
10221
10222
|
return [{ name, status: "pass", detail: `${parsed} (newer than ${tested.to}, the latest version this release was tested with)` }];
|
|
10222
10223
|
}
|
|
10223
|
-
if (
|
|
10224
|
+
if (compareVersions2(parsed, tested.from) < 0) {
|
|
10224
10225
|
return [{ name, status: "warn", detail: `${parsed} is older than validated (${tested.from})` }];
|
|
10225
10226
|
}
|
|
10226
10227
|
return [{ name, status: "pass", detail: parsed }];
|
|
@@ -10680,39 +10681,854 @@ function createClaudeCodeAdapter(io) {
|
|
|
10680
10681
|
};
|
|
10681
10682
|
}
|
|
10682
10683
|
|
|
10684
|
+
// ../agents/src/codex/files.ts
|
|
10685
|
+
function join2(base, ...parts) {
|
|
10686
|
+
return parts.reduce((path, part) => path === "" || path.endsWith("/") ? `${path}${part}` : `${path}/${part}`, base);
|
|
10687
|
+
}
|
|
10688
|
+
function parentOf2(path) {
|
|
10689
|
+
const cut = path.lastIndexOf("/");
|
|
10690
|
+
return cut <= 0 ? path.slice(0, cut + 1) : path.slice(0, cut);
|
|
10691
|
+
}
|
|
10692
|
+
function filesUnder(fs, dir, base = dir) {
|
|
10693
|
+
if (fs.kind(dir) !== "directory") return [];
|
|
10694
|
+
const out = [];
|
|
10695
|
+
for (const name of fs.list(dir)) {
|
|
10696
|
+
const abs = join2(dir, name);
|
|
10697
|
+
const kind = fs.kind(abs);
|
|
10698
|
+
if (kind === "directory") out.push(...filesUnder(fs, abs, base));
|
|
10699
|
+
else if (kind === "file") out.push(abs.slice(base.length + 1));
|
|
10700
|
+
}
|
|
10701
|
+
return out.sort();
|
|
10702
|
+
}
|
|
10703
|
+
|
|
10704
|
+
// ../agents/src/codex/capture.ts
|
|
10705
|
+
var SHELL_TOOLS = /* @__PURE__ */ new Set(["exec_command", "shell", "shell_command", "local_shell"]);
|
|
10706
|
+
var EDIT_TOOLS2 = /* @__PURE__ */ new Set(["apply_patch"]);
|
|
10707
|
+
var ROLLOUT_NAME = /^rollout-.*\.jsonl(\.zst)?$/;
|
|
10708
|
+
var THREAD_ID = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl(?:\.zst)?$/;
|
|
10709
|
+
var HARNESS_TEXT = /^<(environment_context|user_instructions|skills_instructions|permissions instructions|collaboration_mode)/;
|
|
10710
|
+
var TITLE_LENGTH = 100;
|
|
10711
|
+
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10712
|
+
var num2 = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : 0;
|
|
10713
|
+
var str = (value) => typeof value === "string" ? value : void 0;
|
|
10714
|
+
var isoOf = (value) => typeof value === "string" && !Number.isNaN(Date.parse(value)) ? new Date(value).toISOString() : void 0;
|
|
10715
|
+
function emptyResult(lines = 0, reason, versions = []) {
|
|
10716
|
+
return { session: null, warnings: {}, stats: { lines, parsed: 0, skipped: lines, unmapped: 0 }, versions, blobs: [], ...reason === void 0 ? {} : { reason } };
|
|
10717
|
+
}
|
|
10718
|
+
function wordsOf(content) {
|
|
10719
|
+
if (!Array.isArray(content)) return "";
|
|
10720
|
+
return content.flatMap((part) => isObject2(part) && typeof part.text === "string" ? [part.text] : []).join("\n");
|
|
10721
|
+
}
|
|
10722
|
+
function exitCodeIn(output) {
|
|
10723
|
+
const found = /Process exited with code (-?\d+)/.exec(output);
|
|
10724
|
+
return found === null ? void 0 : Number(found[1]);
|
|
10725
|
+
}
|
|
10726
|
+
function argumentsOf(raw) {
|
|
10727
|
+
if (isObject2(raw)) return raw;
|
|
10728
|
+
if (typeof raw !== "string") return {};
|
|
10729
|
+
try {
|
|
10730
|
+
const parsed = JSON.parse(raw);
|
|
10731
|
+
return isObject2(parsed) ? parsed : { input: raw };
|
|
10732
|
+
} catch {
|
|
10733
|
+
return { input: raw };
|
|
10734
|
+
}
|
|
10735
|
+
}
|
|
10736
|
+
function shellInput(args) {
|
|
10737
|
+
const command = args.cmd ?? args.command;
|
|
10738
|
+
const text = Array.isArray(command) ? command.filter((part) => typeof part === "string").join(" ") : command;
|
|
10739
|
+
if (typeof text !== "string") return args;
|
|
10740
|
+
const { cmd: _cmd, command: _command, ...rest } = args;
|
|
10741
|
+
return { ...rest, command: text };
|
|
10742
|
+
}
|
|
10743
|
+
function patchFile(patch) {
|
|
10744
|
+
return typeof patch === "string" ? /^\*\*\* (?:Update|Add|Delete) File: (.+)$/m.exec(patch)?.[1] : void 0;
|
|
10745
|
+
}
|
|
10746
|
+
var sameTotals = (a, b) => a !== void 0 && JSON.stringify(a) === JSON.stringify(b);
|
|
10747
|
+
function sessionOf(records, options, meta) {
|
|
10748
|
+
const id = str(meta?.id) ?? str(meta?.session_id) ?? options.fallbackId;
|
|
10749
|
+
if (id === void 0 || id === "") return null;
|
|
10750
|
+
const turns = [];
|
|
10751
|
+
const models = /* @__PURE__ */ new Set();
|
|
10752
|
+
const totals = { in: 0, out: 0, cacheRead: 0, cacheCreate: 0 };
|
|
10753
|
+
let cost = 0;
|
|
10754
|
+
let anyCost = false;
|
|
10755
|
+
let model;
|
|
10756
|
+
let pending = { texts: [], thinking: [], calls: [] };
|
|
10757
|
+
let previousTotal;
|
|
10758
|
+
const calls = /* @__PURE__ */ new Map();
|
|
10759
|
+
let lastTs;
|
|
10760
|
+
const emptyPending = () => pending.texts.length === 0 && pending.thinking.length === 0 && pending.calls.length === 0;
|
|
10761
|
+
function flush(ts, usage) {
|
|
10762
|
+
if (emptyPending() && usage === void 0) return;
|
|
10763
|
+
const costUsd = usage === void 0 || model === void 0 ? null : costOfUsage(model, usage);
|
|
10764
|
+
if (usage !== void 0) {
|
|
10765
|
+
totals.in += usage.in;
|
|
10766
|
+
totals.out += usage.out;
|
|
10767
|
+
totals.cacheRead += usage.cacheRead;
|
|
10768
|
+
totals.cacheCreate += usage.cacheCreate;
|
|
10769
|
+
}
|
|
10770
|
+
if (costUsd !== null) {
|
|
10771
|
+
cost += costUsd;
|
|
10772
|
+
anyCost = true;
|
|
10773
|
+
}
|
|
10774
|
+
if (model !== void 0) models.add(model);
|
|
10775
|
+
const at = pending.ts ?? ts;
|
|
10776
|
+
turns.push({
|
|
10777
|
+
index: turns.length,
|
|
10778
|
+
role: "assistant",
|
|
10779
|
+
...at === void 0 ? {} : { ts: at },
|
|
10780
|
+
...model === void 0 ? {} : { model },
|
|
10781
|
+
...usage === void 0 ? {} : { usage },
|
|
10782
|
+
...usage === void 0 ? {} : { costUsd },
|
|
10783
|
+
toolCalls: pending.calls,
|
|
10784
|
+
text: pending.texts.length === 0 ? null : pending.texts.join("\n"),
|
|
10785
|
+
thinking: pending.thinking.length === 0 ? null : pending.thinking.join("\n")
|
|
10786
|
+
});
|
|
10787
|
+
pending = { texts: [], thinking: [], calls: [] };
|
|
10788
|
+
}
|
|
10789
|
+
for (const { ts, type, payload } of records) {
|
|
10790
|
+
if (ts !== void 0) lastTs = ts;
|
|
10791
|
+
if (type === "turn_context") {
|
|
10792
|
+
model = str(payload.model) ?? model;
|
|
10793
|
+
continue;
|
|
10794
|
+
}
|
|
10795
|
+
if (type === "response_item") {
|
|
10796
|
+
const kind = payload.type;
|
|
10797
|
+
if (kind === "message") {
|
|
10798
|
+
const words = wordsOf(payload.content);
|
|
10799
|
+
if (payload.role === "assistant") {
|
|
10800
|
+
pending.ts ??= ts;
|
|
10801
|
+
if (words !== "") pending.texts.push(words);
|
|
10802
|
+
} else if (payload.role === "user" && words !== "" && !HARNESS_TEXT.test(words)) {
|
|
10803
|
+
flush(ts);
|
|
10804
|
+
turns.push({ index: turns.length, role: "user", ...ts === void 0 ? {} : { ts }, text: words, toolCalls: [] });
|
|
10805
|
+
}
|
|
10806
|
+
} else if (kind === "reasoning") {
|
|
10807
|
+
const summary = Array.isArray(payload.summary) ? wordsOf(payload.summary) : "";
|
|
10808
|
+
pending.ts ??= ts;
|
|
10809
|
+
if (summary !== "") pending.thinking.push(summary);
|
|
10810
|
+
} else if (kind === "function_call" || kind === "custom_tool_call" || kind === "local_shell_call") {
|
|
10811
|
+
const rawName = str(payload.name) ?? (kind === "local_shell_call" ? "local_shell" : void 0);
|
|
10812
|
+
if (rawName === void 0) continue;
|
|
10813
|
+
const shell = SHELL_TOOLS.has(rawName);
|
|
10814
|
+
const edit = EDIT_TOOLS2.has(rawName);
|
|
10815
|
+
const args = kind === "local_shell_call" ? argumentsOf(payload.action) : argumentsOf(kind === "custom_tool_call" ? { input: payload.input } : payload.arguments);
|
|
10816
|
+
const file = edit ? patchFile(args.input) : void 0;
|
|
10817
|
+
const call = {
|
|
10818
|
+
name: shell ? "shell" : rawName,
|
|
10819
|
+
...ts === void 0 ? {} : { startTs: ts },
|
|
10820
|
+
status: "ok",
|
|
10821
|
+
isEdit: edit,
|
|
10822
|
+
...str(payload.call_id) === void 0 ? {} : { toolUseId: str(payload.call_id) },
|
|
10823
|
+
...file === void 0 ? {} : { file },
|
|
10824
|
+
input: shell ? shellInput(args) : args
|
|
10825
|
+
};
|
|
10826
|
+
pending.ts ??= ts;
|
|
10827
|
+
pending.calls.push(call);
|
|
10828
|
+
if (str(payload.call_id) !== void 0) calls.set(str(payload.call_id), call);
|
|
10829
|
+
} else if (kind === "function_call_output" || kind === "custom_tool_call_output") {
|
|
10830
|
+
const call = calls.get(str(payload.call_id) ?? "");
|
|
10831
|
+
if (call === void 0) continue;
|
|
10832
|
+
const output = typeof payload.output === "string" ? payload.output : JSON.stringify(payload.output ?? "");
|
|
10833
|
+
const body = output.includes("\nOutput:\n") ? output.slice(output.indexOf("\nOutput:\n") + "\nOutput:\n".length) : output;
|
|
10834
|
+
Object.assign(call, { output: body });
|
|
10835
|
+
const code = exitCodeIn(output);
|
|
10836
|
+
if (code !== void 0 && call.exitCode === void 0) Object.assign(call, { exitCode: code, status: code === 0 ? "ok" : "error" });
|
|
10837
|
+
}
|
|
10838
|
+
continue;
|
|
10839
|
+
}
|
|
10840
|
+
if (type !== "event_msg") continue;
|
|
10841
|
+
if (payload.type === "token_count") {
|
|
10842
|
+
const info = isObject2(payload.info) ? payload.info : void 0;
|
|
10843
|
+
const last = info !== void 0 && isObject2(info.last_token_usage) ? info.last_token_usage : void 0;
|
|
10844
|
+
if (info === void 0 || last === void 0 || sameTotals(previousTotal, info.total_token_usage)) continue;
|
|
10845
|
+
previousTotal = info.total_token_usage;
|
|
10846
|
+
const cached = num2(last.cached_input_tokens);
|
|
10847
|
+
const written = num2(last.cache_write_input_tokens);
|
|
10848
|
+
flush(ts, { in: Math.max(0, num2(last.input_tokens) - cached - written), out: num2(last.output_tokens), cacheRead: cached, cacheCreate: written });
|
|
10849
|
+
} else if (payload.type === "item_completed" && isObject2(payload.item) && payload.item.type === "CommandExecution") {
|
|
10850
|
+
const call = calls.get(str(payload.item.id) ?? "");
|
|
10851
|
+
if (call === void 0) continue;
|
|
10852
|
+
const exit = typeof payload.item.exit_code === "number" ? payload.item.exit_code : void 0;
|
|
10853
|
+
const failed = payload.item.status === "failed" || payload.item.status === "declined" || exit !== void 0 && exit !== 0;
|
|
10854
|
+
const duration = isObject2(payload.item.duration) ? Math.round(num2(payload.item.duration.secs) * 1e3 + num2(payload.item.duration.nanos) / 1e6) : void 0;
|
|
10855
|
+
Object.assign(call, { status: failed ? "error" : "ok", ...exit === void 0 ? {} : { exitCode: exit }, ...duration === void 0 ? {} : { durationMs: duration } });
|
|
10856
|
+
if (failed && typeof payload.item.aggregated_output === "string") Object.assign(call, { errorSignature: payload.item.aggregated_output.split("\n")[0].slice(0, 200) });
|
|
10857
|
+
}
|
|
10858
|
+
}
|
|
10859
|
+
flush(lastTs);
|
|
10860
|
+
if (turns.length === 0) return null;
|
|
10861
|
+
const first = turns.find((turn) => turn.ts !== void 0)?.ts;
|
|
10862
|
+
const startedAt = isoOf(meta?.timestamp) ?? first ?? (/* @__PURE__ */ new Date(0)).toISOString();
|
|
10863
|
+
const title = turns.find((turn) => turn.role === "user")?.text;
|
|
10864
|
+
const buckets = bucketsFromTurns(turns);
|
|
10865
|
+
const version = str(meta?.cli_version);
|
|
10866
|
+
const entrypoint = str(meta?.originator);
|
|
10867
|
+
const session = {
|
|
10868
|
+
schemaVersion: SCHEMA_VERSION,
|
|
10869
|
+
id,
|
|
10870
|
+
agent: { type: options.agentType ?? CODEX.id, ...version === void 0 ? {} : { version }, ...entrypoint === void 0 ? {} : { entrypoint } },
|
|
10871
|
+
env: { ...str(meta?.cwd) === void 0 ? {} : { cwd: str(meta?.cwd) } },
|
|
10872
|
+
startedAt,
|
|
10873
|
+
...lastTs === void 0 ? {} : { endedAt: lastTs },
|
|
10874
|
+
models: [...models].sort(),
|
|
10875
|
+
turns,
|
|
10876
|
+
events: [],
|
|
10877
|
+
totals: {
|
|
10878
|
+
inputTokens: totals.in,
|
|
10879
|
+
outputTokens: totals.out,
|
|
10880
|
+
cacheReadTokens: totals.cacheRead,
|
|
10881
|
+
cacheCreationTokens: totals.cacheCreate,
|
|
10882
|
+
costUsd: anyCost ? Math.round(cost * 1e6) / 1e6 : null,
|
|
10883
|
+
...buckets.length > 0 ? { buckets, bandBoundaries: [...INPUT_BAND_BOUNDARIES] } : {}
|
|
10884
|
+
},
|
|
10885
|
+
...typeof title === "string" && title.trim() !== "" ? { title: title.trim().slice(0, TITLE_LENGTH) } : {},
|
|
10886
|
+
captureTier: options.captureTier ?? "full",
|
|
10887
|
+
warnings: []
|
|
10888
|
+
};
|
|
10889
|
+
return parseAgentSession(session);
|
|
10890
|
+
}
|
|
10891
|
+
function parseText(text, options) {
|
|
10892
|
+
if (text.trim() === "") return emptyResult();
|
|
10893
|
+
const records = [];
|
|
10894
|
+
let meta;
|
|
10895
|
+
let lines = 0;
|
|
10896
|
+
let skipped = 0;
|
|
10897
|
+
for (const line of text.split("\n")) {
|
|
10898
|
+
if (line.trim() === "") continue;
|
|
10899
|
+
lines += 1;
|
|
10900
|
+
let record;
|
|
10901
|
+
try {
|
|
10902
|
+
record = JSON.parse(line);
|
|
10903
|
+
} catch {
|
|
10904
|
+
skipped += 1;
|
|
10905
|
+
continue;
|
|
10906
|
+
}
|
|
10907
|
+
if (!isObject2(record) || typeof record.type !== "string" || !isObject2(record.payload)) {
|
|
10908
|
+
skipped += 1;
|
|
10909
|
+
continue;
|
|
10910
|
+
}
|
|
10911
|
+
if (record.type === "session_meta") meta ??= record.payload;
|
|
10912
|
+
else records.push({ ts: isoOf(record.timestamp), type: record.type, payload: record.payload });
|
|
10913
|
+
}
|
|
10914
|
+
const { from, to } = CODEX.versions.tested;
|
|
10915
|
+
if (meta !== void 0) {
|
|
10916
|
+
const version = str(meta.cli_version);
|
|
10917
|
+
if (version === void 0) return emptyResult(lines, "the rollout names no Codex version in session_meta.cli_version, so it cannot be read");
|
|
10918
|
+
if (compareVersions(version, from) < 0 || compareVersions(version, to) > 0) {
|
|
10919
|
+
const range = from === to ? from : `${from} to ${to}`;
|
|
10920
|
+
return emptyResult(lines, `the rollout was written by Codex ${version}, and OuterLayer reads rollouts from Codex ${range}`, [version]);
|
|
10921
|
+
}
|
|
10922
|
+
}
|
|
10923
|
+
const session = sessionOf(records, options, meta);
|
|
10924
|
+
const versions = typeof meta?.cli_version === "string" ? [meta.cli_version] : [];
|
|
10925
|
+
if (session === null) return { ...emptyResult(lines), versions };
|
|
10926
|
+
return { session, warnings: {}, stats: { lines, parsed: lines - skipped, skipped, unmapped: 0 }, versions, blobs: [] };
|
|
10927
|
+
}
|
|
10928
|
+
function idOf(file) {
|
|
10929
|
+
const name = file.split(/[/\\]/).pop() ?? file;
|
|
10930
|
+
return THREAD_ID.exec(name)?.[1] ?? name.replace(/\.jsonl(\.zst)?$/, "");
|
|
10931
|
+
}
|
|
10932
|
+
function createCodexCapture(io) {
|
|
10933
|
+
const sessionsIn = (home) => {
|
|
10934
|
+
const own = io.env().CODEX_HOME;
|
|
10935
|
+
return own !== void 0 && own !== "" && home === io.home() && !own.includes("/.outerlayer/codex-home/") ? join2(own, "sessions") : join2(home, homeRelative(CODEX.capture.sessionFolder));
|
|
10936
|
+
};
|
|
10937
|
+
const rolloutsUnder = (folder) => {
|
|
10938
|
+
let names;
|
|
10939
|
+
try {
|
|
10940
|
+
names = io.fs.list(folder);
|
|
10941
|
+
} catch {
|
|
10942
|
+
return [];
|
|
10943
|
+
}
|
|
10944
|
+
return names.flatMap((name) => {
|
|
10945
|
+
const path = join2(folder, name);
|
|
10946
|
+
const stat = io.fs.stat(path);
|
|
10947
|
+
if (stat.kind === "directory") return rolloutsUnder(path);
|
|
10948
|
+
return stat.kind === "file" && ROLLOUT_NAME.test(name) ? [path] : [];
|
|
10949
|
+
});
|
|
10950
|
+
};
|
|
10951
|
+
const parseFile = (file) => {
|
|
10952
|
+
const text = file.endsWith(".zst") ? io.fs.readCompressedText(file) : io.fs.readRawText(file);
|
|
10953
|
+
if (text === void 0) throw new Error(`cannot read the rollout ${file}`);
|
|
10954
|
+
return text;
|
|
10955
|
+
};
|
|
10956
|
+
return {
|
|
10957
|
+
discover(roots) {
|
|
10958
|
+
const folder = roots.root ?? sessionsIn(io.home());
|
|
10959
|
+
return rolloutsUnder(folder).map((file) => {
|
|
10960
|
+
const stat = io.fs.stat(file);
|
|
10961
|
+
return { file, mtimeMs: stat.mtimeMs, bytes: stat.size, isSubagent: false };
|
|
10962
|
+
}).filter((entry) => entry.bytes > 0).sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
10963
|
+
},
|
|
10964
|
+
parse(entry, options) {
|
|
10965
|
+
return parseText(parseFile(entry.file), { fallbackId: idOf(entry.file), ...options.captureTier === void 0 ? {} : { captureTier: options.captureTier } });
|
|
10966
|
+
},
|
|
10967
|
+
parseText,
|
|
10968
|
+
tail(file, completeText, options) {
|
|
10969
|
+
return parseText(completeText, { fallbackId: idOf(file), ...options }).session;
|
|
10970
|
+
},
|
|
10971
|
+
sessionFiles({ home, sessionId }) {
|
|
10972
|
+
const folder = sessionsIn(home);
|
|
10973
|
+
const found = rolloutsUnder(folder).find((file) => idOf(file) === sessionId);
|
|
10974
|
+
if (found === void 0) return { dir: folder, entries: [`${sessionId}.jsonl`] };
|
|
10975
|
+
return { dir: found.slice(0, found.lastIndexOf("/")), entries: [found.slice(found.lastIndexOf("/") + 1)] };
|
|
10976
|
+
},
|
|
10977
|
+
identify: (file) => ({ sessionId: idOf(file), isSubagent: false })
|
|
10978
|
+
};
|
|
10979
|
+
}
|
|
10980
|
+
|
|
10981
|
+
// ../agents/src/codex/delivery.ts
|
|
10982
|
+
var SKILL_SOURCES = [".outerlayer/skills", ".agents/skills", ".claude/skills"];
|
|
10983
|
+
var CONTROL_PLANE_EVENTS = ["SessionStart", "PreToolUse", "PostToolUse", "UserPromptSubmit", "PermissionRequest", "Stop"];
|
|
10984
|
+
function deliverySection2(dir) {
|
|
10985
|
+
return `This repository's control plane is not in the checkout. Its files are in \`${dir}\`. When the instructions name a file under \`.agents/\` that this directory holds, or a path under \`.outerlayer/\` or \`.claude/\`, read it under \`${dir}\`.`;
|
|
10986
|
+
}
|
|
10987
|
+
var isObject3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10988
|
+
var outerlayerCommand = (event) => `outerlayer hook --agent codex ${event}`;
|
|
10989
|
+
function groupsOf(hooks, events) {
|
|
10990
|
+
if (!isObject3(hooks)) return {};
|
|
10991
|
+
const out = {};
|
|
10992
|
+
for (const [event, groups] of Object.entries(hooks)) {
|
|
10993
|
+
if (events !== void 0 && !events.includes(event) || !Array.isArray(groups)) continue;
|
|
10994
|
+
out[event] = groups.filter((group) => isObject3(group) && Array.isArray(group.hooks));
|
|
10995
|
+
}
|
|
10996
|
+
return out;
|
|
10997
|
+
}
|
|
10998
|
+
function hooksText(base, extra) {
|
|
10999
|
+
let parsed;
|
|
11000
|
+
try {
|
|
11001
|
+
parsed = base === void 0 ? void 0 : JSON.parse(base);
|
|
11002
|
+
} catch {
|
|
11003
|
+
parsed = void 0;
|
|
11004
|
+
}
|
|
11005
|
+
const document = isObject3(parsed) ? { ...parsed } : {};
|
|
11006
|
+
const hooks = groupsOf(document.hooks);
|
|
11007
|
+
for (const [event, groups] of Object.entries(extra ?? {})) hooks[event] = [...hooks[event] ?? [], ...groups];
|
|
11008
|
+
for (const event of CODEX_CODEC.events) hooks[event] = [...hooks[event] ?? [], { hooks: [{ type: "command", command: outerlayerCommand(event) }] }];
|
|
11009
|
+
return `${JSON.stringify({ ...document, hooks }, null, 2)}
|
|
11010
|
+
`;
|
|
11011
|
+
}
|
|
11012
|
+
function controlPlaneHooks(fs, source, dir) {
|
|
11013
|
+
const raw = fs.kind(join2(source, ".claude/settings.json")) === "file" ? fs.readText(join2(source, ".claude/settings.json")) : void 0;
|
|
11014
|
+
if (raw === void 0) return {};
|
|
11015
|
+
let settings;
|
|
11016
|
+
try {
|
|
11017
|
+
settings = JSON.parse(raw);
|
|
11018
|
+
} catch {
|
|
11019
|
+
return {};
|
|
11020
|
+
}
|
|
11021
|
+
const groups = groupsOf(isObject3(settings) ? settings.hooks : void 0, CONTROL_PLANE_EVENTS);
|
|
11022
|
+
return Object.fromEntries(
|
|
11023
|
+
Object.entries(groups).map(([event, list]) => [
|
|
11024
|
+
event,
|
|
11025
|
+
list.map((group) => ({ ...group, hooks: group.hooks.map((hook) => typeof hook.command === "string" ? { ...hook, command: rewriteHookCommand(hook.command, dir) } : hook) }))
|
|
11026
|
+
])
|
|
11027
|
+
);
|
|
11028
|
+
}
|
|
11029
|
+
function composeInto(io, source, out, dir, ownHooks) {
|
|
11030
|
+
const { fs } = io;
|
|
11031
|
+
const added = [];
|
|
11032
|
+
const put = (rel, content) => {
|
|
11033
|
+
fs.makeDir(parentOf2(join2(out, rel)));
|
|
11034
|
+
fs.write(join2(out, rel), content);
|
|
11035
|
+
added.push(rel);
|
|
11036
|
+
};
|
|
11037
|
+
const delivered = /* @__PURE__ */ new Set();
|
|
11038
|
+
for (const base of SKILL_SOURCES) {
|
|
11039
|
+
const root = join2(source, base);
|
|
11040
|
+
if (fs.kind(root) !== "directory") continue;
|
|
11041
|
+
for (const name of fs.list(root)) {
|
|
11042
|
+
if (delivered.has(name) || fs.kind(join2(root, name)) !== "directory") continue;
|
|
11043
|
+
delivered.add(name);
|
|
11044
|
+
for (const rel of filesUnder(fs, join2(root, name))) {
|
|
11045
|
+
const target = `skills/${name}/${rel}`;
|
|
11046
|
+
fs.makeDir(parentOf2(join2(out, target)));
|
|
11047
|
+
fs.copy(join2(root, name, rel), join2(out, target));
|
|
11048
|
+
const text = fs.readText(join2(out, target));
|
|
11049
|
+
const rewritten = text === void 0 ? void 0 : rewriteControlPlanePaths(text, dir);
|
|
11050
|
+
if (rewritten !== void 0 && rewritten !== text) fs.write(join2(out, target), rewritten);
|
|
11051
|
+
added.push(target);
|
|
11052
|
+
}
|
|
11053
|
+
}
|
|
11054
|
+
}
|
|
11055
|
+
const agents = fs.kind(join2(source, "AGENTS.md")) === "file" ? fs.readText(join2(source, "AGENTS.md")) : void 0;
|
|
11056
|
+
const instructions = agents === void 0 ? void 0 : rewriteAgentsFilePaths(rewriteControlPlanePaths(agents, dir), dir, (path) => fs.kind(join2(source, path)) === "file");
|
|
11057
|
+
put("AGENTS.md", instructions === void 0 ? `${deliverySection2(dir)}
|
|
11058
|
+
` : `${deliverySection2(dir)}
|
|
11059
|
+
|
|
11060
|
+
${instructions}`);
|
|
11061
|
+
put("hooks.json", hooksText(ownHooks, controlPlaneHooks(fs, source, dir)));
|
|
11062
|
+
return added;
|
|
11063
|
+
}
|
|
11064
|
+
function createDelivery2(io) {
|
|
11065
|
+
const { fs } = io;
|
|
11066
|
+
return {
|
|
11067
|
+
compose: ({ tree, dir }) => composeInto(io, tree, tree, dir),
|
|
11068
|
+
deliveredSkills(tree) {
|
|
11069
|
+
const dir = join2(tree, "skills");
|
|
11070
|
+
if (fs.kind(dir) !== "directory") return [];
|
|
11071
|
+
return fs.list(dir).filter((name) => fs.kind(join2(dir, name)) === "directory").sort();
|
|
11072
|
+
},
|
|
11073
|
+
escapesDelivery: hookCommandEscapesControlPlane
|
|
11074
|
+
};
|
|
11075
|
+
}
|
|
11076
|
+
|
|
11077
|
+
// ../agents/src/codex/diagnostics.ts
|
|
11078
|
+
var NAME2 = CODEX.label;
|
|
11079
|
+
var codexHome = (io, home) => {
|
|
11080
|
+
const own = io.env().CODEX_HOME;
|
|
11081
|
+
return own !== void 0 && own !== "" ? own : join2(home, ".codex");
|
|
11082
|
+
};
|
|
11083
|
+
function loginCheck(io, input) {
|
|
11084
|
+
const file = join2(codexHome(io, input.home), "auth.json");
|
|
11085
|
+
if (io.fs.stat(file).kind === "file") return { name: `${NAME2} login`, status: "pass", detail: file };
|
|
11086
|
+
return { name: `${NAME2} login`, status: "fail", detail: `${NAME2} has no login: ${file} not found`, fix: "Run `codex login`, or start Codex once and sign in." };
|
|
11087
|
+
}
|
|
11088
|
+
function versionCheck2(io, program) {
|
|
11089
|
+
const reported = /\d+\.\d+\.\d+/.exec(io.runSync(program, ["--version"], { timeoutMs: 15e3 }).stdout)?.[0];
|
|
11090
|
+
const { minimum } = CODEX.versions;
|
|
11091
|
+
if (reported === void 0) return { name: `${NAME2} version`, status: "warn", detail: `${program} did not report a version`, fix: `Install ${NAME2} ${minimum}: npm install -g @openai/codex@${minimum}` };
|
|
11092
|
+
if (compareVersions(reported, minimum) < 0) {
|
|
11093
|
+
return { name: `${NAME2} version`, status: "warn", detail: `${reported} is older than ${minimum}, the oldest version OuterLayer reads`, fix: `Update ${NAME2}: npm install -g @openai/codex@${minimum}` };
|
|
11094
|
+
}
|
|
11095
|
+
return { name: `${NAME2} version`, status: "pass", detail: `${reported} (minimum ${minimum})` };
|
|
11096
|
+
}
|
|
11097
|
+
function countRollouts(io, folder) {
|
|
11098
|
+
if (io.fs.kind(folder) === "missing") return void 0;
|
|
11099
|
+
let count = 0;
|
|
11100
|
+
let newest = 0;
|
|
11101
|
+
const walk = (dir) => {
|
|
11102
|
+
for (const name of io.fs.list(dir)) {
|
|
11103
|
+
const path = join2(dir, name);
|
|
11104
|
+
const stat = io.fs.stat(path);
|
|
11105
|
+
if (stat.kind === "directory") walk(path);
|
|
11106
|
+
else if (stat.kind === "file" && /^rollout-.*\.jsonl(\.zst)?$/.test(name)) {
|
|
11107
|
+
count += 1;
|
|
11108
|
+
newest = Math.max(newest, stat.mtimeMs);
|
|
11109
|
+
}
|
|
11110
|
+
}
|
|
11111
|
+
};
|
|
11112
|
+
try {
|
|
11113
|
+
walk(folder);
|
|
11114
|
+
} catch {
|
|
11115
|
+
return void 0;
|
|
11116
|
+
}
|
|
11117
|
+
return { count, newest };
|
|
11118
|
+
}
|
|
11119
|
+
function createCodexDiagnostics(io, launch) {
|
|
11120
|
+
return {
|
|
11121
|
+
checks(input) {
|
|
11122
|
+
const program = launch.findProgram(io.env().PATH, input.separator === "\\" ? ";" : ":");
|
|
11123
|
+
if (program === void 0) return {};
|
|
11124
|
+
const wants = (section) => input.sections === void 0 || input.sections.includes(section);
|
|
11125
|
+
return {
|
|
11126
|
+
...wants("home") && !input.runnerHost ? { home: [loginCheck(io, input)] } : {},
|
|
11127
|
+
...wants("version") ? { version: [versionCheck2(io, program)] } : {}
|
|
11128
|
+
};
|
|
11129
|
+
},
|
|
11130
|
+
sessions: (home) => countRollouts(io, join2(codexHome(io, home), "sessions"))
|
|
11131
|
+
};
|
|
11132
|
+
}
|
|
11133
|
+
|
|
11134
|
+
// ../agents/src/opencode/emit.ts
|
|
11135
|
+
function buildOpenCode(input) {
|
|
11136
|
+
const files = [];
|
|
11137
|
+
const copies = [];
|
|
11138
|
+
const warnings = [];
|
|
11139
|
+
for (const entry of input.entries) {
|
|
11140
|
+
const target = entry.kind === "instructions" ? joinPath(entry.scopePath, "AGENTS.md") : entry.kind === "skill" ? joinPath(entry.scopePath, ".agents/skills", entry.skillName, "SKILL.md") : entry.kind === "skill-reference" ? joinPath(entry.scopePath, ".agents/skills", entry.skillName, "references", skillReferenceRelPath(entry)) : void 0;
|
|
11141
|
+
if (target === void 0) continue;
|
|
11142
|
+
const content = contentForEntry(input.contents, entry, warnings);
|
|
11143
|
+
if (content !== void 0) files.push({ path: target, content: withHeader(entry.path, content) });
|
|
11144
|
+
}
|
|
11145
|
+
for (const assetPath of input.assetPaths) {
|
|
11146
|
+
const parsed = parseSkillAssetPath(assetPath);
|
|
11147
|
+
if (parsed) copies.push({ toPath: joinPath(parsed.scopePath, ".agents/skills", parsed.skillName, parsed.relPath), fromSourcePath: assetPath });
|
|
11148
|
+
}
|
|
11149
|
+
return { files, copies, warnings };
|
|
11150
|
+
}
|
|
11151
|
+
|
|
11152
|
+
// ../agents/src/codex/toml.ts
|
|
11153
|
+
var TomlTextError = class extends Error {
|
|
11154
|
+
};
|
|
11155
|
+
var HEADER = /^\s*(\[\[?)\s*([^\]]+?)\s*\]\]?\s*(?:#.*)?\s*$/;
|
|
11156
|
+
var BARE_KEY = /^[A-Za-z0-9_-]+$/;
|
|
11157
|
+
function linesOf(text) {
|
|
11158
|
+
return text.match(/[^\n]*\n|[^\n]+/g) ?? [];
|
|
11159
|
+
}
|
|
11160
|
+
function keyPath(text) {
|
|
11161
|
+
const parts = [];
|
|
11162
|
+
let rest = text.trim();
|
|
11163
|
+
while (rest !== "") {
|
|
11164
|
+
let part;
|
|
11165
|
+
if (rest.startsWith('"') || rest.startsWith("'")) {
|
|
11166
|
+
const quote = rest[0];
|
|
11167
|
+
const close = quote === '"' ? /^"((?:[^"\\]|\\.)*)"/.exec(rest) : /^'([^']*)'/.exec(rest);
|
|
11168
|
+
if (close === null) return void 0;
|
|
11169
|
+
part = quote === '"' ? JSON.parse(`"${close[1]}"`) : close[1];
|
|
11170
|
+
rest = rest.slice(close[0].length).trimStart();
|
|
11171
|
+
} else {
|
|
11172
|
+
const bare = /^[A-Za-z0-9_-]+/.exec(rest);
|
|
11173
|
+
if (bare === null) return void 0;
|
|
11174
|
+
part = bare[0];
|
|
11175
|
+
rest = rest.slice(part.length).trimStart();
|
|
11176
|
+
}
|
|
11177
|
+
parts.push(part);
|
|
11178
|
+
if (rest === "") break;
|
|
11179
|
+
if (!rest.startsWith(".")) return void 0;
|
|
11180
|
+
rest = rest.slice(1).trimStart();
|
|
11181
|
+
if (rest === "") return void 0;
|
|
11182
|
+
}
|
|
11183
|
+
return parts.length === 0 ? void 0 : parts;
|
|
11184
|
+
}
|
|
11185
|
+
function keyText(name) {
|
|
11186
|
+
return BARE_KEY.test(name) ? name : JSON.stringify(name);
|
|
11187
|
+
}
|
|
11188
|
+
function tablesOf(lines) {
|
|
11189
|
+
const tables = [];
|
|
11190
|
+
let multiline;
|
|
11191
|
+
let depth = 0;
|
|
11192
|
+
lines.forEach((line, index) => {
|
|
11193
|
+
const trimmed = line.trim();
|
|
11194
|
+
if (multiline !== void 0) {
|
|
11195
|
+
if (line.includes(multiline)) multiline = void 0;
|
|
11196
|
+
return;
|
|
11197
|
+
}
|
|
11198
|
+
if (depth > 0) {
|
|
11199
|
+
depth += (line.match(/\[/g)?.length ?? 0) - (line.match(/\]/g)?.length ?? 0);
|
|
11200
|
+
return;
|
|
11201
|
+
}
|
|
11202
|
+
if (trimmed === "" || trimmed.startsWith("#")) return;
|
|
11203
|
+
if (trimmed.startsWith("[")) {
|
|
11204
|
+
const header = HEADER.exec(line);
|
|
11205
|
+
const path = header === null ? void 0 : keyPath(header[2]);
|
|
11206
|
+
if (path === void 0) throw new TomlTextError(`line ${index + 1} is not a table header`);
|
|
11207
|
+
const last = tables[tables.length - 1];
|
|
11208
|
+
if (last !== void 0) last.end = index;
|
|
11209
|
+
tables.push({ path: header[1] === "[[" ? [...path, "[]"] : path, start: index, end: lines.length });
|
|
11210
|
+
return;
|
|
11211
|
+
}
|
|
11212
|
+
const equals = line.indexOf("=");
|
|
11213
|
+
if (equals < 1 || keyPath(line.slice(0, equals)) === void 0) throw new TomlTextError(`line ${index + 1} is not a key and a value`);
|
|
11214
|
+
const value = line.slice(equals + 1).trim();
|
|
11215
|
+
const triple = /^("""|''')/.exec(value);
|
|
11216
|
+
if (triple !== null && !value.slice(3).includes(triple[1])) multiline = triple[1];
|
|
11217
|
+
else if (value.startsWith("[")) depth = Math.max(0, (value.match(/\[/g)?.length ?? 0) - (value.match(/\]/g)?.length ?? 0));
|
|
11218
|
+
});
|
|
11219
|
+
return tables;
|
|
11220
|
+
}
|
|
11221
|
+
function valueOf(text) {
|
|
11222
|
+
const trimmed = text.replace(/\s+#.*$/, "").trim();
|
|
11223
|
+
if (trimmed.startsWith("'") && trimmed.endsWith("'") && trimmed.length >= 2) return trimmed.slice(1, -1);
|
|
11224
|
+
try {
|
|
11225
|
+
return JSON.parse(trimmed.replace(/,\s*]/g, "]").replace(/'([^'"]*)'/g, (_m, inner) => JSON.stringify(inner)));
|
|
11226
|
+
} catch {
|
|
11227
|
+
return trimmed;
|
|
11228
|
+
}
|
|
11229
|
+
}
|
|
11230
|
+
function pairsIn(lines, from, to) {
|
|
11231
|
+
const out = {};
|
|
11232
|
+
let index = from;
|
|
11233
|
+
while (index < to) {
|
|
11234
|
+
const line = lines[index];
|
|
11235
|
+
index += 1;
|
|
11236
|
+
const equals = line.indexOf("=");
|
|
11237
|
+
if (line.trim() === "" || line.trim().startsWith("#") || equals < 1) continue;
|
|
11238
|
+
const key = keyPath(line.slice(0, equals));
|
|
11239
|
+
let value = line.slice(equals + 1);
|
|
11240
|
+
let depth = (value.match(/\[/g)?.length ?? 0) - (value.match(/\]/g)?.length ?? 0);
|
|
11241
|
+
while (depth > 0 && index < to) {
|
|
11242
|
+
value += lines[index];
|
|
11243
|
+
depth += (lines[index].match(/\[/g)?.length ?? 0) - (lines[index].match(/\]/g)?.length ?? 0);
|
|
11244
|
+
index += 1;
|
|
11245
|
+
}
|
|
11246
|
+
if (key !== void 0) out[key.join(".")] = valueOf(value);
|
|
11247
|
+
}
|
|
11248
|
+
return out;
|
|
11249
|
+
}
|
|
11250
|
+
function topLevelPairs(text) {
|
|
11251
|
+
const lines = linesOf(text);
|
|
11252
|
+
const tables = tablesOf(lines);
|
|
11253
|
+
return pairsIn(lines, 0, tables[0]?.start ?? lines.length);
|
|
11254
|
+
}
|
|
11255
|
+
function withTopLevelKey(text, key, literal2) {
|
|
11256
|
+
const lines = linesOf(text);
|
|
11257
|
+
const first = tablesOf(lines)[0]?.start ?? lines.length;
|
|
11258
|
+
const at = lines.slice(0, first).findIndex((line2) => new RegExp(`^\\s*${key}\\s*=`).test(line2));
|
|
11259
|
+
const line = `${key} = ${literal2}
|
|
11260
|
+
`;
|
|
11261
|
+
if (at >= 0) {
|
|
11262
|
+
const out = [...lines];
|
|
11263
|
+
out[at] = line;
|
|
11264
|
+
return out.join("");
|
|
11265
|
+
}
|
|
11266
|
+
const head = lines.slice(0, first).join("");
|
|
11267
|
+
const tail = lines.slice(first).join("");
|
|
11268
|
+
return `${head}${head === "" || head.endsWith("\n") ? "" : "\n"}${line}${tail === "" ? "" : "\n"}${tail}`;
|
|
11269
|
+
}
|
|
11270
|
+
|
|
11271
|
+
// ../agents/src/codex/mcp.ts
|
|
11272
|
+
var isObject4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11273
|
+
var strings = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
11274
|
+
var literal = (value) => Array.isArray(value) ? `[${value.map((item) => JSON.stringify(item)).join(", ")}]` : JSON.stringify(value);
|
|
11275
|
+
var table = (header, pairs) => `[${header}]
|
|
11276
|
+
${pairs.map(([key, value]) => `${keyText(key)} = ${literal(value)}
|
|
11277
|
+
`).join("")}`;
|
|
11278
|
+
function serverBlock(name, entry) {
|
|
11279
|
+
const header = `mcp_servers.${keyText(name)}`;
|
|
11280
|
+
const isUrl = (entry.type === "http" || entry.type === "sse" || entry.command === void 0) && typeof entry.url === "string";
|
|
11281
|
+
const main = isUrl ? [["url", entry.url]] : [["command", entry.command], ...strings(entry.args).length > 0 ? [["args", strings(entry.args)]] : []];
|
|
11282
|
+
const sub = (field, tableName) => {
|
|
11283
|
+
const value = entry[field];
|
|
11284
|
+
const pairs = isObject4(value) ? Object.entries(value).filter((pair) => typeof pair[1] === "string") : [];
|
|
11285
|
+
return pairs.length === 0 ? [] : [table(`${header}.${tableName}`, pairs)];
|
|
11286
|
+
};
|
|
11287
|
+
return [table(header, main), ...sub("env", "env"), ...sub("headers", "http_headers")].join("\n").replace(/\n+$/, "");
|
|
11288
|
+
}
|
|
11289
|
+
function serverTables(tables, name) {
|
|
11290
|
+
return tables.filter((candidate) => candidate.path[0] === "mcp_servers" && candidate.path[1] === name);
|
|
11291
|
+
}
|
|
11292
|
+
function tablesOrThrow(lines) {
|
|
11293
|
+
try {
|
|
11294
|
+
return tablesOf(lines);
|
|
11295
|
+
} catch (error) {
|
|
11296
|
+
if (error instanceof TomlTextError) throw new McpFileError("not-toml");
|
|
11297
|
+
throw error;
|
|
11298
|
+
}
|
|
11299
|
+
}
|
|
11300
|
+
var CODEX_MCP = {
|
|
11301
|
+
file: ".codex/config.toml",
|
|
11302
|
+
servers(text) {
|
|
11303
|
+
let lines;
|
|
11304
|
+
let tables;
|
|
11305
|
+
try {
|
|
11306
|
+
lines = linesOf(text);
|
|
11307
|
+
tables = tablesOf(lines);
|
|
11308
|
+
} catch {
|
|
11309
|
+
return void 0;
|
|
11310
|
+
}
|
|
11311
|
+
const servers = {};
|
|
11312
|
+
for (const found of tables) {
|
|
11313
|
+
if (found.path[0] !== "mcp_servers" || found.path.length < 2 || found.path[1] === "[]") continue;
|
|
11314
|
+
const name = found.path[1];
|
|
11315
|
+
const pairs = pairsIn(lines, found.start + 1, found.end);
|
|
11316
|
+
const entry = servers[name] ??= {};
|
|
11317
|
+
if (found.path.length === 2) Object.assign(entry, pairs);
|
|
11318
|
+
else if (found.path.length === 3) entry[found.path[2]] = pairs;
|
|
11319
|
+
}
|
|
11320
|
+
return servers;
|
|
11321
|
+
},
|
|
11322
|
+
setServer(text, name, entry, mode) {
|
|
11323
|
+
const lines = linesOf(text ?? "");
|
|
11324
|
+
const tables = tablesOrThrow(lines);
|
|
11325
|
+
const existing = serverTables(tables, name);
|
|
11326
|
+
if (mode === "if-absent" && existing.length > 0) return { text: text ?? "", changed: false };
|
|
11327
|
+
const block = serverBlock(name, entry);
|
|
11328
|
+
if (existing.length === 0) {
|
|
11329
|
+
const body = lines.join("");
|
|
11330
|
+
const separator = body === "" ? "" : body.endsWith("\n\n") ? "" : body.endsWith("\n") ? "\n" : "\n\n";
|
|
11331
|
+
return { text: `${body}${separator}${block}
|
|
11332
|
+
`, changed: true };
|
|
11333
|
+
}
|
|
11334
|
+
const first = existing[0];
|
|
11335
|
+
const dropped = new Set(existing.flatMap((found) => Array.from({ length: found.end - found.start }, (_, offset) => found.start + offset)));
|
|
11336
|
+
const before = lines.slice(0, first.start).join("");
|
|
11337
|
+
const after = lines.filter((_, index) => index >= first.start && !dropped.has(index)).join("");
|
|
11338
|
+
const written = `${before}${block}
|
|
11339
|
+
${after === "" ? "" : `
|
|
11340
|
+
${after}`}`;
|
|
11341
|
+
return { text: written, changed: written !== (text ?? "") };
|
|
11342
|
+
}
|
|
11343
|
+
};
|
|
11344
|
+
|
|
11345
|
+
// ../agents/src/codex/launch.ts
|
|
11346
|
+
var SHIM_MAX_BYTES = 256;
|
|
11347
|
+
var SHIM = /^#!\/bin\/sh\nexec outerlayer [^\n]*"\$@"\n$/;
|
|
11348
|
+
var DEFAULT_DOC_BYTES = 32 * 1024;
|
|
11349
|
+
var STALE_MS = 24 * 60 * 60 * 1e3;
|
|
11350
|
+
var BYPASS_HOOK_TRUST = "--dangerously-bypass-hook-trust";
|
|
11351
|
+
var VALUE_OPTIONS = /* @__PURE__ */ new Set(["-c", "--config", "-m", "--model", "-p", "--profile", "-s", "--sandbox", "-C", "--cd", "-i", "--image", "--enable", "--disable", "-a", "--ask-for-approval", "--add-dir", "--color", "--output-schema", "-o", "--output-last-message", "--local-provider", "--remote"]);
|
|
11352
|
+
var MCP_ENTRY = { type: "stdio", command: "outerlayer", args: ["mcp", "serve"] };
|
|
11353
|
+
function isSkipped2(io, candidate) {
|
|
11354
|
+
try {
|
|
11355
|
+
const { size } = io.fs.stat(candidate);
|
|
11356
|
+
return size <= SHIM_MAX_BYTES && SHIM.test(io.fs.readText(candidate) ?? "");
|
|
11357
|
+
} catch {
|
|
11358
|
+
return true;
|
|
11359
|
+
}
|
|
11360
|
+
}
|
|
11361
|
+
function findProgram2(io, path, delimiter2) {
|
|
11362
|
+
for (const entry of (path ?? "").split(delimiter2)) {
|
|
11363
|
+
if (entry === "") continue;
|
|
11364
|
+
const candidate = join2(entry, CODEX.program);
|
|
11365
|
+
if (!io.fs.executable(candidate)) continue;
|
|
11366
|
+
if (isSkipped2(io, candidate)) continue;
|
|
11367
|
+
return candidate;
|
|
11368
|
+
}
|
|
11369
|
+
return void 0;
|
|
11370
|
+
}
|
|
11371
|
+
function createLaunch2(io) {
|
|
11372
|
+
const { fs } = io;
|
|
11373
|
+
const launches = /* @__PURE__ */ new Map();
|
|
11374
|
+
const foldersBase = (home) => join2(home, ".outerlayer", "codex-home");
|
|
11375
|
+
function removeStale(home) {
|
|
11376
|
+
const base = foldersBase(home);
|
|
11377
|
+
if (fs.kind(base) !== "directory") return;
|
|
11378
|
+
for (const name of fs.list(base)) {
|
|
11379
|
+
const folder = join2(base, name);
|
|
11380
|
+
const { mtimeMs } = fs.stat(folder);
|
|
11381
|
+
if (mtimeMs > 0 && io.now().getTime() - mtimeMs > STALE_MS) removeFolder(folder);
|
|
11382
|
+
}
|
|
11383
|
+
}
|
|
11384
|
+
function removeFolder(folder) {
|
|
11385
|
+
for (const name of fs.list(folder)) if (fs.kind(join2(folder, name)) === "link") fs.remove(join2(folder, name));
|
|
11386
|
+
fs.remove(folder);
|
|
11387
|
+
}
|
|
11388
|
+
function instructionsOf(folder, userHome) {
|
|
11389
|
+
const own = fs.kind(join2(userHome, "AGENTS.md")) === "file" ? fs.readText(join2(userHome, "AGENTS.md")) : void 0;
|
|
11390
|
+
if (own === void 0 || own.trim() === "") return;
|
|
11391
|
+
const delivered = fs.kind(join2(folder, "AGENTS.md")) === "file" ? fs.readText(join2(folder, "AGENTS.md")) : void 0;
|
|
11392
|
+
fs.write(join2(folder, "AGENTS.md"), delivered === void 0 ? own : `${delivered.endsWith("\n") ? delivered : `${delivered}
|
|
11393
|
+
`}
|
|
11394
|
+
${own}`);
|
|
11395
|
+
}
|
|
11396
|
+
function linkOwnSkills(folder, userHome) {
|
|
11397
|
+
const own = join2(userHome, "skills");
|
|
11398
|
+
if (fs.kind(own) !== "directory") return;
|
|
11399
|
+
for (const name of fs.list(own)) {
|
|
11400
|
+
if (name.startsWith(".") || fs.stat(join2(own, name)).kind !== "directory" || fs.kind(join2(folder, "skills", name)) !== "missing") continue;
|
|
11401
|
+
fs.makeDir(join2(folder, "skills"));
|
|
11402
|
+
fs.link(join2(own, name), join2(folder, "skills", name));
|
|
11403
|
+
}
|
|
11404
|
+
}
|
|
11405
|
+
function configOf(folder, userHome) {
|
|
11406
|
+
const own = fs.kind(join2(userHome, "config.toml")) === "file" ? fs.readText(join2(userHome, "config.toml")) ?? "" : "";
|
|
11407
|
+
try {
|
|
11408
|
+
let text = CODEX_MCP.setServer(own, "outerlayer", MCP_ENTRY, "if-absent").text;
|
|
11409
|
+
const agents = fs.kind(join2(folder, "AGENTS.md")) === "file" ? fs.readText(join2(folder, "AGENTS.md")) ?? "" : "";
|
|
11410
|
+
if (agents !== "") {
|
|
11411
|
+
const wanted = new TextEncoder().encode(agents).length + DEFAULT_DOC_BYTES;
|
|
11412
|
+
const set = topLevelPairs(text).project_doc_max_bytes;
|
|
11413
|
+
if (typeof set !== "number" || set < wanted) text = withTopLevelKey(text, "project_doc_max_bytes", String(wanted));
|
|
11414
|
+
}
|
|
11415
|
+
return text;
|
|
11416
|
+
} catch {
|
|
11417
|
+
return own;
|
|
11418
|
+
}
|
|
11419
|
+
}
|
|
11420
|
+
function withSkillMention(args, folder) {
|
|
11421
|
+
if (args.length === 0) return [];
|
|
11422
|
+
const last = args[args.length - 1];
|
|
11423
|
+
const before = args[args.length - 2];
|
|
11424
|
+
const name = /^\/([A-Za-z0-9][A-Za-z0-9._-]*)$/.exec(last)?.[1];
|
|
11425
|
+
if (name === void 0 || before !== void 0 && VALUE_OPTIONS.has(before)) return [...args];
|
|
11426
|
+
return fs.stat(join2(folder, "skills", name, "SKILL.md")).kind === "file" ? [...args.slice(0, -1), `$${name}`] : [...args];
|
|
11427
|
+
}
|
|
11428
|
+
function interactive3(input) {
|
|
11429
|
+
const home = input.env.HOME !== void 0 && input.env.HOME !== "" ? input.env.HOME : io.home();
|
|
11430
|
+
removeStale(home);
|
|
11431
|
+
const userHome = input.env.CODEX_HOME !== void 0 && input.env.CODEX_HOME !== "" ? input.env.CODEX_HOME : join2(home, ".codex");
|
|
11432
|
+
const folder = join2(foldersBase(home), `${io.now().getTime().toString(36)}-${Math.random().toString(36).slice(2, 10)}`);
|
|
11433
|
+
fs.makeDir(folder);
|
|
11434
|
+
const ownHooks = fs.kind(join2(userHome, "hooks.json")) === "file" ? fs.readText(join2(userHome, "hooks.json")) : void 0;
|
|
11435
|
+
if (input.controlPlane === void 0) fs.write(join2(folder, "hooks.json"), hooksText(ownHooks));
|
|
11436
|
+
else composeInto(io, input.controlPlane, folder, input.controlPlane, ownHooks);
|
|
11437
|
+
instructionsOf(folder, userHome);
|
|
11438
|
+
linkOwnSkills(folder, userHome);
|
|
11439
|
+
fs.write(join2(folder, "config.toml"), configOf(folder, userHome));
|
|
11440
|
+
const login = join2(userHome, "auth.json");
|
|
11441
|
+
const authText = fs.kind(login) === "file" ? fs.readText(login) : void 0;
|
|
11442
|
+
if (authText !== void 0) fs.copy(login, join2(folder, "auth.json"));
|
|
11443
|
+
fs.makeDir(join2(userHome, "sessions"));
|
|
11444
|
+
fs.link(join2(userHome, "sessions"), join2(folder, "sessions"));
|
|
11445
|
+
launches.set(folder, { userHome, authText });
|
|
11446
|
+
const env = Object.fromEntries(Object.entries({ ...input.env, CODEX_HOME: folder }).filter((entry) => entry[1] !== void 0));
|
|
11447
|
+
return { program: input.program, args: [BYPASS_HOOK_TRUST, ...withSkillMention(input.callerArgs, folder)], env, driver: "exec", exitFrom: "code" };
|
|
11448
|
+
}
|
|
11449
|
+
function finish(spec) {
|
|
11450
|
+
const folder = spec.env.CODEX_HOME;
|
|
11451
|
+
const launched = folder === void 0 ? void 0 : launches.get(folder);
|
|
11452
|
+
if (folder === void 0 || launched === void 0) return;
|
|
11453
|
+
launches.delete(folder);
|
|
11454
|
+
try {
|
|
11455
|
+
const refreshed = fs.kind(join2(folder, "auth.json")) === "file" ? fs.readText(join2(folder, "auth.json")) : void 0;
|
|
11456
|
+
if (refreshed !== void 0 && refreshed !== launched.authText) {
|
|
11457
|
+
const target = join2(launched.userHome, "auth.json");
|
|
11458
|
+
fs.makeDir(launched.userHome);
|
|
11459
|
+
fs.write(`${target}.outerlayer-new`, refreshed);
|
|
11460
|
+
fs.rename(`${target}.outerlayer-new`, target);
|
|
11461
|
+
}
|
|
11462
|
+
} finally {
|
|
11463
|
+
removeFolder(folder);
|
|
11464
|
+
}
|
|
11465
|
+
}
|
|
11466
|
+
return {
|
|
11467
|
+
findProgram: (path, delimiter2 = ":") => findProgram2(io, path, delimiter2),
|
|
11468
|
+
version: (program, env) => io.runSync(program, ["--version"], { env, timeoutMs: 15e3 }).stdout,
|
|
11469
|
+
interactive: interactive3,
|
|
11470
|
+
finish,
|
|
11471
|
+
minimumReason: "the oldest version whose rollouts and hooks OuterLayer reads"
|
|
11472
|
+
};
|
|
11473
|
+
}
|
|
11474
|
+
|
|
11475
|
+
// ../agents/src/codex/adapter.ts
|
|
11476
|
+
function createCodexAdapter(io) {
|
|
11477
|
+
const context = {
|
|
11478
|
+
emit: buildOpenCode,
|
|
11479
|
+
...createDelivery2(io),
|
|
11480
|
+
deliveredEntries: ["AGENTS.md", "skills", "hooks.json"],
|
|
11481
|
+
mcp: CODEX_MCP
|
|
11482
|
+
};
|
|
11483
|
+
const launch = createLaunch2(io);
|
|
11484
|
+
return {
|
|
11485
|
+
context,
|
|
11486
|
+
launch,
|
|
11487
|
+
lifecycle: {
|
|
11488
|
+
source: { kind: "hook-process", codec: CODEX_CODEC },
|
|
11489
|
+
// Codex sets CODEX_THREAD_ID for the shell commands it runs.
|
|
11490
|
+
detectInSession: (env) => env.CODEX_THREAD_ID !== void 0 && env.CODEX_THREAD_ID !== "",
|
|
11491
|
+
sessionIdFromEnv: (env) => env.CODEX_THREAD_ID === void 0 || env.CODEX_THREAD_ID === "" ? void 0 : env.CODEX_THREAD_ID
|
|
11492
|
+
},
|
|
11493
|
+
deliver: { kind: "none" },
|
|
11494
|
+
capture: createCodexCapture(io),
|
|
11495
|
+
diagnostics: createCodexDiagnostics(io, launch)
|
|
11496
|
+
};
|
|
11497
|
+
}
|
|
11498
|
+
|
|
10683
11499
|
// ../agents/src/opencode/capture.ts
|
|
10684
11500
|
var SUBAGENTS = "subagents";
|
|
10685
11501
|
var MAX_DEPTH = 4;
|
|
10686
11502
|
var SESSION_ID = /^[A-Za-z0-9_-]+$/;
|
|
10687
|
-
var
|
|
11503
|
+
var EDIT_TOOLS3 = /* @__PURE__ */ new Set(["edit", "write", "patch", "multiedit"]);
|
|
10688
11504
|
var PATH_DELIMITER = ":";
|
|
10689
|
-
var
|
|
10690
|
-
var
|
|
10691
|
-
var
|
|
10692
|
-
function
|
|
11505
|
+
var isObject5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11506
|
+
var num3 = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : 0;
|
|
11507
|
+
var isoOf2 = (ms) => typeof ms === "number" && Number.isFinite(ms) && ms > 0 ? new Date(ms).toISOString() : void 0;
|
|
11508
|
+
function emptyResult2(lines = 0) {
|
|
10693
11509
|
return { session: null, warnings: {}, stats: { lines, parsed: 0, skipped: lines, unmapped: 0 }, versions: [], blobs: [] };
|
|
10694
11510
|
}
|
|
10695
11511
|
function toolCallsOf(content) {
|
|
10696
11512
|
const calls = [];
|
|
10697
11513
|
for (const item of content) {
|
|
10698
|
-
if (!
|
|
10699
|
-
const state =
|
|
10700
|
-
const metadata =
|
|
11514
|
+
if (!isObject5(item) || item.type !== "tool" || typeof item.name !== "string" || item.name === "") continue;
|
|
11515
|
+
const state = isObject5(item.state) ? item.state : {};
|
|
11516
|
+
const metadata = isObject5(state.metadata) ? state.metadata : {};
|
|
10701
11517
|
const exitCode = typeof metadata.exit === "number" ? metadata.exit : void 0;
|
|
10702
11518
|
const failed = state.status === "error" || exitCode !== void 0 && exitCode !== 0;
|
|
10703
|
-
const time =
|
|
10704
|
-
const startTs =
|
|
11519
|
+
const time = isObject5(item.time) ? item.time : {};
|
|
11520
|
+
const startTs = isoOf2(time.ran) ?? isoOf2(time.created);
|
|
10705
11521
|
const durationMs = typeof time.completed === "number" && typeof time.created === "number" && time.completed >= time.created ? Math.round(time.completed - time.created) : void 0;
|
|
10706
|
-
const input =
|
|
10707
|
-
const file =
|
|
10708
|
-
const error =
|
|
10709
|
-
const output = Array.isArray(state.content) ? state.content.flatMap((part) =>
|
|
11522
|
+
const input = isObject5(state.input) ? state.input : void 0;
|
|
11523
|
+
const file = EDIT_TOOLS3.has(item.name) && input !== void 0 ? [input.path, input.filePath].find((candidate) => typeof candidate === "string") : void 0;
|
|
11524
|
+
const error = isObject5(state.error) ? state.error.message : state.error;
|
|
11525
|
+
const output = Array.isArray(state.content) ? state.content.flatMap((part) => isObject5(part) && typeof part.text === "string" ? [part.text] : []).join("\n") : void 0;
|
|
10710
11526
|
calls.push({
|
|
10711
11527
|
name: item.name,
|
|
10712
11528
|
...startTs === void 0 ? {} : { startTs },
|
|
10713
11529
|
...durationMs === void 0 ? {} : { durationMs },
|
|
10714
11530
|
status: failed ? "error" : "ok",
|
|
10715
|
-
isEdit:
|
|
11531
|
+
isEdit: EDIT_TOOLS3.has(item.name),
|
|
10716
11532
|
...typeof item.id === "string" ? { toolUseId: item.id } : {},
|
|
10717
11533
|
...file === void 0 ? {} : { file },
|
|
10718
11534
|
...failed && typeof error === "string" ? { errorSignature: error.split("\n")[0].slice(0, 200) } : {},
|
|
@@ -10723,18 +11539,18 @@ function toolCallsOf(content) {
|
|
|
10723
11539
|
}
|
|
10724
11540
|
return calls;
|
|
10725
11541
|
}
|
|
10726
|
-
function
|
|
11542
|
+
function wordsOf2(content) {
|
|
10727
11543
|
const texts = [];
|
|
10728
11544
|
const thinking = [];
|
|
10729
11545
|
for (const item of content) {
|
|
10730
|
-
if (!
|
|
11546
|
+
if (!isObject5(item) || typeof item.text !== "string") continue;
|
|
10731
11547
|
if (item.type === "text") texts.push(item.text);
|
|
10732
11548
|
else if (item.type === "reasoning" || item.type === "thinking") thinking.push(item.text);
|
|
10733
11549
|
}
|
|
10734
11550
|
return { text: texts.length === 0 ? null : texts.join("\n"), thinking: thinking.length === 0 ? null : thinking.join("\n") };
|
|
10735
11551
|
}
|
|
10736
|
-
function
|
|
10737
|
-
const info =
|
|
11552
|
+
function sessionOf2(exported, options) {
|
|
11553
|
+
const info = isObject5(exported.info) ? exported.info : {};
|
|
10738
11554
|
const messages = Array.isArray(exported.messages) ? exported.messages : [];
|
|
10739
11555
|
const id = typeof info.id === "string" && info.id !== "" ? info.id : options.fallbackId;
|
|
10740
11556
|
if (id === void 0 || id === "") return null;
|
|
@@ -10744,19 +11560,19 @@ function sessionOf(exported, options) {
|
|
|
10744
11560
|
let cost = 0;
|
|
10745
11561
|
let anyCost = false;
|
|
10746
11562
|
for (const message of messages) {
|
|
10747
|
-
if (!
|
|
10748
|
-
const created =
|
|
11563
|
+
if (!isObject5(message)) continue;
|
|
11564
|
+
const created = isObject5(message.time) ? message.time : {};
|
|
10749
11565
|
if (message.type === "user") {
|
|
10750
|
-
turns.push({ index: turns.length, role: "user", ...
|
|
11566
|
+
turns.push({ index: turns.length, role: "user", ...isoOf2(created.created) === void 0 ? {} : { ts: isoOf2(created.created) }, text: typeof message.text === "string" ? message.text : null, toolCalls: [] });
|
|
10751
11567
|
continue;
|
|
10752
11568
|
}
|
|
10753
11569
|
if (message.type !== "assistant") continue;
|
|
10754
|
-
const model =
|
|
10755
|
-
const tokens =
|
|
10756
|
-
const cache =
|
|
10757
|
-
const usage = { in:
|
|
11570
|
+
const model = isObject5(message.model) && typeof message.model.id === "string" ? message.model.id : void 0;
|
|
11571
|
+
const tokens = isObject5(message.tokens) ? message.tokens : {};
|
|
11572
|
+
const cache = isObject5(tokens.cache) ? tokens.cache : {};
|
|
11573
|
+
const usage = { in: num3(tokens.input), out: num3(tokens.output) + num3(tokens.reasoning), cacheRead: num3(cache.read), cacheCreate: num3(cache.write) };
|
|
10758
11574
|
const content = Array.isArray(message.content) ? message.content : [];
|
|
10759
|
-
const { text, thinking } =
|
|
11575
|
+
const { text, thinking } = wordsOf2(content);
|
|
10760
11576
|
const costUsd = model === void 0 ? null : costOfUsage(model, usage);
|
|
10761
11577
|
totals.in += usage.in;
|
|
10762
11578
|
totals.out += usage.out;
|
|
@@ -10771,7 +11587,7 @@ function sessionOf(exported, options) {
|
|
|
10771
11587
|
turns.push({
|
|
10772
11588
|
index: turns.length,
|
|
10773
11589
|
role: "assistant",
|
|
10774
|
-
...
|
|
11590
|
+
...isoOf2(created.created) === void 0 ? {} : { ts: isoOf2(created.created) },
|
|
10775
11591
|
...model === void 0 ? {} : { model },
|
|
10776
11592
|
usage,
|
|
10777
11593
|
costUsd,
|
|
@@ -10783,11 +11599,11 @@ function sessionOf(exported, options) {
|
|
|
10783
11599
|
});
|
|
10784
11600
|
}
|
|
10785
11601
|
if (turns.length === 0) return null;
|
|
10786
|
-
const time =
|
|
11602
|
+
const time = isObject5(info.time) ? info.time : {};
|
|
10787
11603
|
const lastTurnTs = [...turns].reverse().find((turn) => turn.ts !== void 0)?.ts;
|
|
10788
|
-
const startedAt =
|
|
10789
|
-
const endedAt =
|
|
10790
|
-
const location =
|
|
11604
|
+
const startedAt = isoOf2(time.created) ?? turns.find((turn) => turn.ts !== void 0)?.ts ?? (/* @__PURE__ */ new Date(0)).toISOString();
|
|
11605
|
+
const endedAt = isoOf2(time.updated) ?? lastTurnTs;
|
|
11606
|
+
const location = isObject5(info.location) ? info.location : {};
|
|
10791
11607
|
const parentId = typeof info.parentID === "string" && info.parentID !== "" ? info.parentID : options.parentSessionId;
|
|
10792
11608
|
const buckets = bucketsFromTurns(turns);
|
|
10793
11609
|
const session = {
|
|
@@ -10815,28 +11631,28 @@ function sessionOf(exported, options) {
|
|
|
10815
11631
|
};
|
|
10816
11632
|
return parseAgentSession(session);
|
|
10817
11633
|
}
|
|
10818
|
-
function
|
|
10819
|
-
if (text.trim() === "") return
|
|
11634
|
+
function parseText2(text, options) {
|
|
11635
|
+
if (text.trim() === "") return emptyResult2();
|
|
10820
11636
|
let exported;
|
|
10821
11637
|
try {
|
|
10822
11638
|
exported = JSON.parse(text);
|
|
10823
11639
|
} catch {
|
|
10824
|
-
return { ...
|
|
11640
|
+
return { ...emptyResult2(1), warnings: { "export-not-json": 1 } };
|
|
10825
11641
|
}
|
|
10826
|
-
if (!
|
|
10827
|
-
const session =
|
|
11642
|
+
if (!isObject5(exported)) return { ...emptyResult2(1), warnings: { "export-not-object": 1 } };
|
|
11643
|
+
const session = sessionOf2(exported, options);
|
|
10828
11644
|
const lines = Array.isArray(exported.messages) ? exported.messages.length : 0;
|
|
10829
|
-
if (session === null) return
|
|
11645
|
+
if (session === null) return emptyResult2(lines);
|
|
10830
11646
|
return { session, warnings: {}, stats: { lines, parsed: lines, skipped: 0, unmapped: 0 }, versions: [], blobs: [] };
|
|
10831
11647
|
}
|
|
10832
11648
|
var stemOf = (file) => (file.split(/[/\\]/).pop() ?? file).replace(/\.json$/, "");
|
|
10833
11649
|
function childIdsOf(exported) {
|
|
10834
|
-
if (!
|
|
11650
|
+
if (!isObject5(exported) || !Array.isArray(exported.messages)) return [];
|
|
10835
11651
|
const ids = [];
|
|
10836
11652
|
for (const message of exported.messages) {
|
|
10837
|
-
if (!
|
|
11653
|
+
if (!isObject5(message) || !Array.isArray(message.content)) continue;
|
|
10838
11654
|
for (const item of message.content) {
|
|
10839
|
-
if (!
|
|
11655
|
+
if (!isObject5(item) || item.type !== "tool" || item.name !== "subagent" || !isObject5(item.state) || !isObject5(item.state.metadata)) continue;
|
|
10840
11656
|
const child = item.state.metadata.sessionID;
|
|
10841
11657
|
if (typeof child === "string" && SESSION_ID.test(child)) ids.push(child);
|
|
10842
11658
|
}
|
|
@@ -10862,7 +11678,7 @@ function createOpenCodeCapture(io, launch) {
|
|
|
10862
11678
|
} catch {
|
|
10863
11679
|
throw new Error(`opencode session export ${id} printed no JSON`);
|
|
10864
11680
|
}
|
|
10865
|
-
if (!
|
|
11681
|
+
if (!isObject5(exported)) throw new Error(`opencode session export ${id} printed no session`);
|
|
10866
11682
|
const failures = [];
|
|
10867
11683
|
if (depth < MAX_DEPTH) {
|
|
10868
11684
|
for (const child of childIdsOf(exported)) {
|
|
@@ -10908,7 +11724,7 @@ function createOpenCodeCapture(io, launch) {
|
|
|
10908
11724
|
if (!Array.isArray(listed)) throw new Error("opencode session list printed no list");
|
|
10909
11725
|
const failures = [];
|
|
10910
11726
|
for (const item of listed) {
|
|
10911
|
-
if (!
|
|
11727
|
+
if (!isObject5(item) || typeof item.id !== "string" || !SESSION_ID.test(item.id) || typeof item.updated !== "number") continue;
|
|
10912
11728
|
const file = io.path.join(folder, `${item.id}.json`);
|
|
10913
11729
|
const stat = io.fs.stat(file);
|
|
10914
11730
|
if (stat.kind === "file" && stat.mtimeMs >= item.updated) continue;
|
|
@@ -10923,16 +11739,16 @@ function createOpenCodeCapture(io, launch) {
|
|
|
10923
11739
|
parse(entry, options) {
|
|
10924
11740
|
const text = io.fs.readRawText(entry.file);
|
|
10925
11741
|
if (text === void 0) throw new Error(`cannot read the export ${entry.file}`);
|
|
10926
|
-
return
|
|
11742
|
+
return parseText2(text, {
|
|
10927
11743
|
fallbackId: stemOf(entry.file),
|
|
10928
11744
|
...entry.isSubagent ? { isSubagent: true } : {},
|
|
10929
11745
|
...entry.parentSessionId === void 0 ? {} : { parentSessionId: entry.parentSessionId },
|
|
10930
11746
|
...options.captureTier === void 0 ? {} : { captureTier: options.captureTier }
|
|
10931
11747
|
});
|
|
10932
11748
|
},
|
|
10933
|
-
parseText,
|
|
11749
|
+
parseText: parseText2,
|
|
10934
11750
|
tail(file, completeText, options) {
|
|
10935
|
-
return
|
|
11751
|
+
return parseText2(completeText, { fallbackId: stemOf(file), ...options }).session;
|
|
10936
11752
|
},
|
|
10937
11753
|
sessionFiles: ({ home, sessionId }) => ({ dir: folderIn(home), entries: [`${sessionId}.json`] }),
|
|
10938
11754
|
identify(file) {
|
|
@@ -11035,26 +11851,26 @@ export default {
|
|
|
11035
11851
|
}
|
|
11036
11852
|
|
|
11037
11853
|
// ../agents/src/opencode/delivery.ts
|
|
11038
|
-
var
|
|
11039
|
-
function
|
|
11854
|
+
var SKILL_SOURCES2 = [".outerlayer/skills", ".agents/skills", ".claude/skills"];
|
|
11855
|
+
function join3(base, ...parts) {
|
|
11040
11856
|
return parts.reduce((path, part) => path === "" || path.endsWith("/") ? `${path}${part}` : `${path}/${part}`, base);
|
|
11041
11857
|
}
|
|
11042
|
-
function
|
|
11858
|
+
function parentOf3(path) {
|
|
11043
11859
|
const cut = path.lastIndexOf("/");
|
|
11044
11860
|
return cut <= 0 ? path.slice(0, cut + 1) : path.slice(0, cut);
|
|
11045
11861
|
}
|
|
11046
|
-
function
|
|
11862
|
+
function filesUnder2(fs, dir, base = dir) {
|
|
11047
11863
|
if (fs.kind(dir) !== "directory") return [];
|
|
11048
11864
|
const out = [];
|
|
11049
11865
|
for (const name of fs.list(dir)) {
|
|
11050
|
-
const abs =
|
|
11866
|
+
const abs = join3(dir, name);
|
|
11051
11867
|
const kind = fs.kind(abs);
|
|
11052
|
-
if (kind === "directory") out.push(...
|
|
11868
|
+
if (kind === "directory") out.push(...filesUnder2(fs, abs, base));
|
|
11053
11869
|
else if (kind === "file") out.push(abs.slice(base.length + 1));
|
|
11054
11870
|
}
|
|
11055
11871
|
return out.sort();
|
|
11056
11872
|
}
|
|
11057
|
-
function
|
|
11873
|
+
function deliverySection3(dir) {
|
|
11058
11874
|
return `This repository's control plane is not in the checkout. Its files are in \`${dir}\`. When the instructions name a file under \`.agents/\` that this directory holds, or a path under \`.outerlayer/\` or \`.claude/\`, read it under \`${dir}\`.`;
|
|
11059
11875
|
}
|
|
11060
11876
|
function escapesDelivery(pluginPath, controlPlaneVariable) {
|
|
@@ -11066,8 +11882,8 @@ function escapesDelivery(pluginPath, controlPlaneVariable) {
|
|
|
11066
11882
|
function writeRuntimeFiles(io, dir) {
|
|
11067
11883
|
const written = [];
|
|
11068
11884
|
const put = (rel, content) => {
|
|
11069
|
-
io.fs.makeDir(
|
|
11070
|
-
io.fs.write(
|
|
11885
|
+
io.fs.makeDir(parentOf3(join3(dir, rel)));
|
|
11886
|
+
io.fs.write(join3(dir, rel), content);
|
|
11071
11887
|
written.push(rel);
|
|
11072
11888
|
};
|
|
11073
11889
|
put("plugins/outerlayer/package.json", PLUGIN_PACKAGE_JSON);
|
|
@@ -11075,73 +11891,55 @@ function writeRuntimeFiles(io, dir) {
|
|
|
11075
11891
|
put("opencode.json", openCodeConfigText());
|
|
11076
11892
|
return written;
|
|
11077
11893
|
}
|
|
11078
|
-
function
|
|
11894
|
+
function createDelivery3(io) {
|
|
11079
11895
|
const { fs } = io;
|
|
11080
11896
|
return {
|
|
11081
11897
|
compose({ tree, dir }) {
|
|
11082
11898
|
const added = [];
|
|
11083
11899
|
const put = (rel, content) => {
|
|
11084
|
-
fs.makeDir(
|
|
11085
|
-
fs.write(
|
|
11900
|
+
fs.makeDir(parentOf3(join3(tree, rel)));
|
|
11901
|
+
fs.write(join3(tree, rel), content);
|
|
11086
11902
|
added.push(rel);
|
|
11087
11903
|
};
|
|
11088
11904
|
const delivered = /* @__PURE__ */ new Set();
|
|
11089
|
-
for (const source of
|
|
11090
|
-
const root =
|
|
11905
|
+
for (const source of SKILL_SOURCES2) {
|
|
11906
|
+
const root = join3(tree, source);
|
|
11091
11907
|
if (fs.kind(root) !== "directory") continue;
|
|
11092
11908
|
for (const name of fs.list(root)) {
|
|
11093
|
-
if (delivered.has(name) || fs.kind(
|
|
11909
|
+
if (delivered.has(name) || fs.kind(join3(root, name)) !== "directory") continue;
|
|
11094
11910
|
delivered.add(name);
|
|
11095
|
-
for (const rel of
|
|
11911
|
+
for (const rel of filesUnder2(fs, join3(root, name))) {
|
|
11096
11912
|
const target = `skills/${name}/${rel}`;
|
|
11097
|
-
fs.makeDir(
|
|
11098
|
-
fs.copy(
|
|
11913
|
+
fs.makeDir(parentOf3(join3(tree, target)));
|
|
11914
|
+
fs.copy(join3(root, name, rel), join3(tree, target));
|
|
11099
11915
|
added.push(target);
|
|
11100
11916
|
}
|
|
11101
11917
|
}
|
|
11102
11918
|
}
|
|
11103
|
-
for (const rel of
|
|
11104
|
-
const text = fs.readText(
|
|
11919
|
+
for (const rel of filesUnder2(fs, join3(tree, "skills"), tree)) {
|
|
11920
|
+
const text = fs.readText(join3(tree, rel));
|
|
11105
11921
|
if (text === void 0) continue;
|
|
11106
11922
|
const rewritten = rewriteControlPlanePaths(text, dir);
|
|
11107
|
-
if (rewritten !== text) fs.write(
|
|
11923
|
+
if (rewritten !== text) fs.write(join3(tree, rel), rewritten);
|
|
11108
11924
|
}
|
|
11109
|
-
const agents = fs.kind(
|
|
11110
|
-
const instructions = agents === void 0 ? void 0 : rewriteAgentsFilePaths(rewriteControlPlanePaths(agents, dir), dir, (path) => fs.kind(
|
|
11111
|
-
put("AGENTS.md", instructions === void 0 ? `${
|
|
11112
|
-
` : `${
|
|
11925
|
+
const agents = fs.kind(join3(tree, "AGENTS.md")) === "file" ? fs.readText(join3(tree, "AGENTS.md")) : void 0;
|
|
11926
|
+
const instructions = agents === void 0 ? void 0 : rewriteAgentsFilePaths(rewriteControlPlanePaths(agents, dir), dir, (path) => fs.kind(join3(tree, path)) === "file");
|
|
11927
|
+
put("AGENTS.md", instructions === void 0 ? `${deliverySection3(dir)}
|
|
11928
|
+
` : `${deliverySection3(dir)}
|
|
11113
11929
|
|
|
11114
11930
|
${instructions}`);
|
|
11115
11931
|
added.push(...writeRuntimeFiles(io, tree));
|
|
11116
11932
|
return added;
|
|
11117
11933
|
},
|
|
11118
11934
|
deliveredSkills(tree) {
|
|
11119
|
-
const dir =
|
|
11935
|
+
const dir = join3(tree, "skills");
|
|
11120
11936
|
if (fs.kind(dir) !== "directory") return [];
|
|
11121
|
-
return fs.list(dir).filter((name) => fs.kind(
|
|
11937
|
+
return fs.list(dir).filter((name) => fs.kind(join3(dir, name)) === "directory").sort();
|
|
11122
11938
|
},
|
|
11123
11939
|
escapesDelivery
|
|
11124
11940
|
};
|
|
11125
11941
|
}
|
|
11126
11942
|
|
|
11127
|
-
// ../agents/src/opencode/emit.ts
|
|
11128
|
-
function buildOpenCode(input) {
|
|
11129
|
-
const files = [];
|
|
11130
|
-
const copies = [];
|
|
11131
|
-
const warnings = [];
|
|
11132
|
-
for (const entry of input.entries) {
|
|
11133
|
-
const target = entry.kind === "instructions" ? joinPath(entry.scopePath, "AGENTS.md") : entry.kind === "skill" ? joinPath(entry.scopePath, ".agents/skills", entry.skillName, "SKILL.md") : entry.kind === "skill-reference" ? joinPath(entry.scopePath, ".agents/skills", entry.skillName, "references", skillReferenceRelPath(entry)) : void 0;
|
|
11134
|
-
if (target === void 0) continue;
|
|
11135
|
-
const content = contentForEntry(input.contents, entry, warnings);
|
|
11136
|
-
if (content !== void 0) files.push({ path: target, content: withHeader(entry.path, content) });
|
|
11137
|
-
}
|
|
11138
|
-
for (const assetPath of input.assetPaths) {
|
|
11139
|
-
const parsed = parseSkillAssetPath(assetPath);
|
|
11140
|
-
if (parsed) copies.push({ toPath: joinPath(parsed.scopePath, ".agents/skills", parsed.skillName, parsed.relPath), fromSourcePath: assetPath });
|
|
11141
|
-
}
|
|
11142
|
-
return { files, copies, warnings };
|
|
11143
|
-
}
|
|
11144
|
-
|
|
11145
11943
|
// ../agents/src/opencode/image.ts
|
|
11146
11944
|
var PREFIX2 = "/opt/outerlayer/opencode";
|
|
11147
11945
|
var PACKAGE2 = "@opencode/cli";
|
|
@@ -11211,7 +12009,7 @@ function judgeOf(io) {
|
|
|
11211
12009
|
return { program: createOpenCodeImage().program, args, env, driver: "exec", exitFrom: "code" };
|
|
11212
12010
|
};
|
|
11213
12011
|
}
|
|
11214
|
-
var
|
|
12012
|
+
var isObject6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11215
12013
|
function readJudgeOutput2(stdout) {
|
|
11216
12014
|
let sawEvent = false;
|
|
11217
12015
|
let stepLimit = false;
|
|
@@ -11225,10 +12023,10 @@ function readJudgeOutput2(stdout) {
|
|
|
11225
12023
|
} catch {
|
|
11226
12024
|
continue;
|
|
11227
12025
|
}
|
|
11228
|
-
if (!
|
|
12026
|
+
if (!isObject6(event) || typeof event.type !== "string" || typeof event.sessionID !== "string") continue;
|
|
11229
12027
|
sawEvent = true;
|
|
11230
|
-
const part =
|
|
11231
|
-
const state =
|
|
12028
|
+
const part = isObject6(event.part) ? event.part : {};
|
|
12029
|
+
const state = isObject6(part.state) ? part.state : {};
|
|
11232
12030
|
if (part.type === "text" && typeof part.text === "string") {
|
|
11233
12031
|
lastText = part.text;
|
|
11234
12032
|
lastFinish = void 0;
|
|
@@ -11249,23 +12047,23 @@ function createOpenCodeHeadless(io) {
|
|
|
11249
12047
|
}
|
|
11250
12048
|
|
|
11251
12049
|
// ../agents/src/opencode/launch.ts
|
|
11252
|
-
var
|
|
11253
|
-
var
|
|
12050
|
+
var SHIM_MAX_BYTES2 = 256;
|
|
12051
|
+
var SHIM2 = /^#!\/bin\/sh\nexec outerlayer [^\n]*"\$@"\n$/;
|
|
11254
12052
|
var joinPath4 = (...parts) => parts.join("/").replace(/\/{2,}/g, "/");
|
|
11255
|
-
function
|
|
12053
|
+
function isSkipped3(io, candidate) {
|
|
11256
12054
|
try {
|
|
11257
12055
|
const { size } = io.fs.stat(candidate);
|
|
11258
|
-
return size <=
|
|
12056
|
+
return size <= SHIM_MAX_BYTES2 && SHIM2.test(io.fs.readText(candidate) ?? "");
|
|
11259
12057
|
} catch {
|
|
11260
12058
|
return true;
|
|
11261
12059
|
}
|
|
11262
12060
|
}
|
|
11263
|
-
function
|
|
12061
|
+
function findProgram3(io, path, delimiter2) {
|
|
11264
12062
|
for (const entry of (path ?? "").split(delimiter2)) {
|
|
11265
12063
|
if (entry === "") continue;
|
|
11266
12064
|
const candidate = joinPath4(entry, OPENCODE.program);
|
|
11267
12065
|
if (!io.fs.executable(candidate)) continue;
|
|
11268
|
-
if (
|
|
12066
|
+
if (isSkipped3(io, candidate)) continue;
|
|
11269
12067
|
return candidate;
|
|
11270
12068
|
}
|
|
11271
12069
|
return void 0;
|
|
@@ -11274,13 +12072,13 @@ var REPOSITORY_SKILL_FOLDERS = [".outerlayer/skills", ".agents/skills", ".claude
|
|
|
11274
12072
|
var GOVERNANCE_VARIABLE = "OUTERLAYER_GOVERNANCE";
|
|
11275
12073
|
var SELF_CONFIG = ".outerlayer/opencode-config";
|
|
11276
12074
|
var SKILL_MESSAGE = "Follow the attached skill.";
|
|
11277
|
-
var
|
|
12075
|
+
var VALUE_OPTIONS2 = /* @__PURE__ */ new Set(["--session", "-s", "--model", "-m", "--agent", "--format", "--file", "-f", "--title", "--log-level", "--server"]);
|
|
11278
12076
|
function withSkillAttached(io, args, plane, cwd) {
|
|
11279
12077
|
if (args[0] !== "run" || args.length < 2) return [...args];
|
|
11280
12078
|
const last = args[args.length - 1];
|
|
11281
12079
|
const before = args[args.length - 2];
|
|
11282
12080
|
const name = /^\/([A-Za-z0-9][A-Za-z0-9._-]*)$/.exec(last)?.[1];
|
|
11283
|
-
if (name === void 0 ||
|
|
12081
|
+
if (name === void 0 || VALUE_OPTIONS2.has(before)) return [...args];
|
|
11284
12082
|
const candidates = plane === void 0 ? REPOSITORY_SKILL_FOLDERS.map((folder) => joinPath4(cwd, folder, name, "SKILL.md")) : [joinPath4(plane, "skills", name, "SKILL.md")];
|
|
11285
12083
|
const skill = candidates.find((candidate) => io.fs.kind(candidate) === "file");
|
|
11286
12084
|
if (skill === void 0) return [...args];
|
|
@@ -11302,9 +12100,9 @@ function interactive2(io, input) {
|
|
|
11302
12100
|
exitFrom: "code"
|
|
11303
12101
|
};
|
|
11304
12102
|
}
|
|
11305
|
-
function
|
|
12103
|
+
function createLaunch3(io) {
|
|
11306
12104
|
return {
|
|
11307
|
-
findProgram: (path, delimiter2 = ":") =>
|
|
12105
|
+
findProgram: (path, delimiter2 = ":") => findProgram3(io, path, delimiter2),
|
|
11308
12106
|
version: (program, env) => io.runSync(program, ["--version"], { env, timeoutMs: 15e3 }).stdout,
|
|
11309
12107
|
interactive: (input) => interactive2(io, input)
|
|
11310
12108
|
};
|
|
@@ -11319,19 +12117,19 @@ function documentOf2(text) {
|
|
|
11319
12117
|
} catch {
|
|
11320
12118
|
throw new McpFileError("not-json");
|
|
11321
12119
|
}
|
|
11322
|
-
if (!
|
|
12120
|
+
if (!isObject7(doc)) throw new McpFileError("not-object");
|
|
11323
12121
|
return doc;
|
|
11324
12122
|
}
|
|
11325
|
-
function
|
|
12123
|
+
function isObject7(value) {
|
|
11326
12124
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11327
12125
|
}
|
|
11328
12126
|
function openCodeEntry(entry) {
|
|
11329
12127
|
if (entry.type === "stdio" && typeof entry.command === "string") {
|
|
11330
12128
|
const args = Array.isArray(entry.args) ? entry.args.filter((arg) => typeof arg === "string") : [];
|
|
11331
|
-
return { type: "local", command: [entry.command, ...args], ...
|
|
12129
|
+
return { type: "local", command: [entry.command, ...args], ...isObject7(entry.env) ? { environment: entry.env } : {} };
|
|
11332
12130
|
}
|
|
11333
12131
|
if ((entry.type === "http" || entry.type === "sse") && typeof entry.url === "string") {
|
|
11334
|
-
return { type: "remote", url: entry.url, ...
|
|
12132
|
+
return { type: "remote", url: entry.url, ...isObject7(entry.headers) ? { headers: entry.headers } : {} };
|
|
11335
12133
|
}
|
|
11336
12134
|
return entry;
|
|
11337
12135
|
}
|
|
@@ -11346,20 +12144,20 @@ var OPENCODE_MCP = {
|
|
|
11346
12144
|
}
|
|
11347
12145
|
if (doc === null) return void 0;
|
|
11348
12146
|
const mcp = doc.mcp;
|
|
11349
|
-
const servers =
|
|
11350
|
-
return
|
|
12147
|
+
const servers = isObject7(mcp) ? mcp.servers : void 0;
|
|
12148
|
+
return isObject7(servers) ? servers : {};
|
|
11351
12149
|
},
|
|
11352
12150
|
setServer(text, name, entry, mode) {
|
|
11353
12151
|
const doc = documentOf2(text);
|
|
11354
12152
|
const mcp = doc.mcp;
|
|
11355
|
-
if (mode === "if-absent" && mcp !== void 0 && !
|
|
11356
|
-
const section =
|
|
12153
|
+
if (mode === "if-absent" && mcp !== void 0 && !isObject7(mcp)) throw new McpFileError("servers-not-object");
|
|
12154
|
+
const section = isObject7(mcp) ? mcp : {};
|
|
11357
12155
|
const servers = section.servers;
|
|
11358
12156
|
if (mode === "if-absent") {
|
|
11359
|
-
if (servers !== void 0 && !
|
|
11360
|
-
if (
|
|
12157
|
+
if (servers !== void 0 && !isObject7(servers)) throw new McpFileError("servers-not-object");
|
|
12158
|
+
if (isObject7(servers) && name in servers) return { text: text ?? "", changed: false };
|
|
11361
12159
|
}
|
|
11362
|
-
const existing =
|
|
12160
|
+
const existing = isObject7(servers) ? servers : {};
|
|
11363
12161
|
const written = openCodeEntry(entry);
|
|
11364
12162
|
const changed = JSON.stringify(existing[name] ?? null) !== JSON.stringify(written);
|
|
11365
12163
|
return { text: `${JSON.stringify({ ...doc, mcp: { ...section, servers: { ...existing, [name]: written } } }, null, 2)}
|
|
@@ -11371,11 +12169,11 @@ var OPENCODE_MCP = {
|
|
|
11371
12169
|
function createOpenCodeAdapter(io) {
|
|
11372
12170
|
const context = {
|
|
11373
12171
|
emit: buildOpenCode,
|
|
11374
|
-
...
|
|
12172
|
+
...createDelivery3(io),
|
|
11375
12173
|
deliveredEntries: ["AGENTS.md", "skills", "plugins", "opencode.json"],
|
|
11376
12174
|
mcp: OPENCODE_MCP
|
|
11377
12175
|
};
|
|
11378
|
-
const launch =
|
|
12176
|
+
const launch = createLaunch3(io);
|
|
11379
12177
|
return {
|
|
11380
12178
|
context,
|
|
11381
12179
|
launch,
|
|
@@ -11395,7 +12193,8 @@ function createOpenCodeAdapter(io) {
|
|
|
11395
12193
|
// ../agents/src/native/factories.ts
|
|
11396
12194
|
var ADAPTER_FACTORIES = {
|
|
11397
12195
|
"claude-code": createClaudeCodeAdapter,
|
|
11398
|
-
opencode: createOpenCodeAdapter
|
|
12196
|
+
opencode: createOpenCodeAdapter,
|
|
12197
|
+
codex: createCodexAdapter
|
|
11399
12198
|
};
|
|
11400
12199
|
|
|
11401
12200
|
// ../agents/src/claude-code/conformance-fixtures.ts
|
|
@@ -11429,6 +12228,44 @@ var PATHS = [".outerlayer/AGENTS.md", ".outerlayer/skills/build/SKILL.md", ".out
|
|
|
11429
12228
|
`}}
|
|
11430
12229
|
});
|
|
11431
12230
|
|
|
12231
|
+
// ../agents/src/codex/fixtures/rollout.ts
|
|
12232
|
+
var ROLLOUT_ID = "01a1df4f-70d8-74a3-8ad8-eda2b0e60065";
|
|
12233
|
+
var ROLLOUT_CWD = "/work/project";
|
|
12234
|
+
var USAGE = { input_tokens: 500, cached_input_tokens: 200, cache_write_input_tokens: 0, output_tokens: 20, reasoning_output_tokens: 5, total_tokens: 520 };
|
|
12235
|
+
var TOTAL = { input_tokens: 1e3, cached_input_tokens: 400, cache_write_input_tokens: 0, output_tokens: 40, reasoning_output_tokens: 10, total_tokens: 1040 };
|
|
12236
|
+
var TURN_ID = "01a1df4f-70fa-73b2-bb4c-01c7d80d0431";
|
|
12237
|
+
function rolloutLines(cliVersion = "0.169.0") {
|
|
12238
|
+
return [
|
|
12239
|
+
{ timestamp: "2026-11-15T13:04:47.845Z", ordinal: 0, type: "session_meta", payload: { id: ROLLOUT_ID, session_id: ROLLOUT_ID, timestamp: "2026-11-15T13:04:47.845Z", cwd: ROLLOUT_CWD, originator: "codex_exec", cli_version: cliVersion, source: "exec", model_provider: "openai" } },
|
|
12240
|
+
{ timestamp: "2026-11-15T13:04:47.850Z", ordinal: 1, type: "event_msg", payload: { type: "task_started", turn_id: TURN_ID, started_at: 1794747887, model_context_window: 258400 } },
|
|
12241
|
+
{ timestamp: "2026-11-15T13:04:47.860Z", ordinal: 2, type: "turn_context", payload: { turn_id: TURN_ID, cwd: ROLLOUT_CWD, model: "gpt-5.5", approval_policy: "never" } },
|
|
12242
|
+
{ timestamp: "2026-11-15T13:04:47.917Z", ordinal: 3, type: "response_item", payload: { type: "message", role: "user", content: [{ type: "input_text", text: "run echo hi" }] } },
|
|
12243
|
+
{ timestamp: "2026-11-15T13:04:47.950Z", ordinal: 4, type: "response_item", payload: { type: "function_call", name: "exec_command", arguments: JSON.stringify({ cmd: "echo hi" }), call_id: "call_1" } },
|
|
12244
|
+
{ timestamp: "2026-11-15T13:04:47.960Z", ordinal: 5, type: "event_msg", payload: { type: "item_completed", turn_id: TURN_ID, item: { type: "CommandExecution", id: "call_1", command: ["/bin/sh", "-lc", "echo hi"], status: "completed", aggregated_output: "hi\n", exit_code: 0, duration: { secs: 0, nanos: 12e6 } } } },
|
|
12245
|
+
{ timestamp: "2026-11-15T13:04:47.970Z", ordinal: 6, type: "response_item", payload: { type: "function_call_output", call_id: "call_1", output: "Chunk ID: 78a920\nWall time: 0.0000 seconds\nProcess exited with code 0\nOriginal token count: 1\nOutput:\nhi\n" } },
|
|
12246
|
+
{ timestamp: "2026-11-15T13:04:47.980Z", ordinal: 7, type: "event_msg", payload: { type: "token_count", info: { total_token_usage: { ...USAGE }, last_token_usage: { ...USAGE }, model_context_window: 258400 } } },
|
|
12247
|
+
{ timestamp: "2026-11-15T13:04:48.060Z", ordinal: 8, type: "response_item", payload: { type: "message", role: "assistant", content: [{ type: "output_text", text: "done" }] } },
|
|
12248
|
+
{ timestamp: "2026-11-15T13:04:48.070Z", ordinal: 9, type: "event_msg", payload: { type: "token_count", info: { total_token_usage: { ...TOTAL }, last_token_usage: { ...USAGE }, model_context_window: 258400 } } },
|
|
12249
|
+
{ timestamp: "2026-11-15T13:04:48.080Z", ordinal: 10, type: "event_msg", payload: { type: "task_complete", turn_id: TURN_ID, last_agent_message: "done", duration_ms: 200 } }
|
|
12250
|
+
];
|
|
12251
|
+
}
|
|
12252
|
+
function rolloutText(cliVersion = "0.169.0") {
|
|
12253
|
+
return `${rolloutLines(cliVersion).map((line) => JSON.stringify(line)).join("\n")}
|
|
12254
|
+
`;
|
|
12255
|
+
}
|
|
12256
|
+
var PATHS2 = [".outerlayer/AGENTS.md", ".outerlayer/skills/build/SKILL.md"];
|
|
12257
|
+
var ROLLOUT_FILE = `/home/test/.codex/sessions/2026/11/15/rollout-2026-11-15T13-04-47-${ROLLOUT_ID}.jsonl`;
|
|
12258
|
+
({
|
|
12259
|
+
capture: { text: rolloutText() },
|
|
12260
|
+
hooks: {
|
|
12261
|
+
payloads: Object.fromEntries(
|
|
12262
|
+
["SessionStart", "PostToolUse", "Stop"].map((name) => [name, JSON.stringify({ session_id: ROLLOUT_ID, cwd: "/work", hook_event_name: name, transcript_path: ROLLOUT_FILE, model: "gpt-5.5" })])
|
|
12263
|
+
)
|
|
12264
|
+
},
|
|
12265
|
+
context: {
|
|
12266
|
+
emitInput: { entries: classifyTree(PATHS2).entries}}
|
|
12267
|
+
});
|
|
12268
|
+
|
|
11432
12269
|
// ../agents/src/opencode/fixtures/session-export.ts
|
|
11433
12270
|
var SESSION_EXPORT = {
|
|
11434
12271
|
"info": {
|
|
@@ -11582,7 +12419,7 @@ var SESSION_EXPORT = {
|
|
|
11582
12419
|
]
|
|
11583
12420
|
};
|
|
11584
12421
|
JSON.stringify(SESSION_EXPORT);
|
|
11585
|
-
var
|
|
12422
|
+
var PATHS3 = [".outerlayer/AGENTS.md", ".outerlayer/skills/build/SKILL.md"];
|
|
11586
12423
|
var SESSION_ID2 = "ses_conformance";
|
|
11587
12424
|
`/home/test/.outerlayer/agent-sessions/opencode/${SESSION_EXPORT.info.id}.json`;
|
|
11588
12425
|
({
|
|
@@ -11595,7 +12432,7 @@ var SESSION_ID2 = "ses_conformance";
|
|
|
11595
12432
|
)
|
|
11596
12433
|
},
|
|
11597
12434
|
context: {
|
|
11598
|
-
emitInput: { entries: classifyTree(
|
|
12435
|
+
emitInput: { entries: classifyTree(PATHS3).entries}}
|
|
11599
12436
|
});
|
|
11600
12437
|
var TEMPLATE_SKILLS = ["spec", "writing-specs", "writing-tests", "build"];
|
|
11601
12438
|
function templateClassLine(version) {
|
|
@@ -11635,11 +12472,11 @@ ${content}`;
|
|
|
11635
12472
|
return `${block}${block.endsWith("\n") ? "" : "\n"}${line}
|
|
11636
12473
|
${body}`;
|
|
11637
12474
|
}
|
|
11638
|
-
function
|
|
12475
|
+
function filesUnder3(dir, base = dir) {
|
|
11639
12476
|
const out = [];
|
|
11640
12477
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
11641
12478
|
const abs = join$1(dir, entry.name);
|
|
11642
|
-
if (entry.isDirectory()) out.push(...
|
|
12479
|
+
if (entry.isDirectory()) out.push(...filesUnder3(abs, base));
|
|
11643
12480
|
else if (entry.isFile()) out.push(abs.slice(base.length + 1).split("\\").join("/"));
|
|
11644
12481
|
}
|
|
11645
12482
|
return out.sort();
|
|
@@ -11652,7 +12489,7 @@ function loadClass(packRoot, skillClass, names, version, base) {
|
|
|
11652
12489
|
for (const skill of names) {
|
|
11653
12490
|
const dir = join$1(packRoot, skillClass, skill);
|
|
11654
12491
|
if (!existsSync(dir)) throw new Error(`skill pack is missing ${skillClass}/${skill} under ${packRoot}`);
|
|
11655
|
-
for (const rel of orderSkillFiles(
|
|
12492
|
+
for (const rel of orderSkillFiles(filesUnder3(dir))) {
|
|
11656
12493
|
const raw = readFileSync(join$1(dir, rel), "utf8");
|
|
11657
12494
|
files.push({
|
|
11658
12495
|
skill,
|
|
@@ -11738,6 +12575,10 @@ function readBytes(path) {
|
|
|
11738
12575
|
throw err;
|
|
11739
12576
|
}
|
|
11740
12577
|
}
|
|
12578
|
+
function decompressedText(bytes, decompress) {
|
|
12579
|
+
if (bytes === void 0 || decompress === void 0) return void 0;
|
|
12580
|
+
return decompress(bytes).toString("utf8");
|
|
12581
|
+
}
|
|
11741
12582
|
function createNodeAgentFs() {
|
|
11742
12583
|
return {
|
|
11743
12584
|
kind(path) {
|
|
@@ -11772,6 +12613,7 @@ function createNodeAgentFs() {
|
|
|
11772
12613
|
return content === void 0 || content.includes(0) ? void 0 : content.toString("utf8");
|
|
11773
12614
|
},
|
|
11774
12615
|
readRawText: (path) => readBytes(path)?.toString("utf8"),
|
|
12616
|
+
readCompressedText: (path) => decompressedText(readBytes(path), zlib.zstdDecompressSync),
|
|
11775
12617
|
// Session exports hold transcripts, so only the owner reads them whatever the umask is.
|
|
11776
12618
|
write: (path, text) => writeFileSync(path, text, { mode: 384 }),
|
|
11777
12619
|
copy: (from, to) => copyFileSync(from, to),
|