overlord-cli 0.2608011442.0 → 0.2608031719.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +344 -235
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3143,12 +3143,12 @@ function createBackendClient() {
|
|
|
3143
3143
|
const clientDevice = clientDeviceIdentity();
|
|
3144
3144
|
async function request({
|
|
3145
3145
|
method,
|
|
3146
|
-
path:
|
|
3146
|
+
path: path32,
|
|
3147
3147
|
body,
|
|
3148
3148
|
extraHeaders,
|
|
3149
3149
|
rawBody
|
|
3150
3150
|
}) {
|
|
3151
|
-
const url = `${baseUrl}${
|
|
3151
|
+
const url = `${baseUrl}${path32.startsWith("/") ? path32 : `/${path32}`}`;
|
|
3152
3152
|
const auth = resolveAuthHeaders({ baseUrl });
|
|
3153
3153
|
let response;
|
|
3154
3154
|
try {
|
|
@@ -3175,14 +3175,14 @@ Start the Desktop/local backend or run \`ovld config set cloud <url>\`.
|
|
|
3175
3175
|
const payload = await readResponseJson2(response);
|
|
3176
3176
|
if (!response.ok) {
|
|
3177
3177
|
if (response.status === 401 && auth.headers.Authorization) {
|
|
3178
|
-
const detail = errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${
|
|
3178
|
+
const detail = errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${path32} (${response.status})`;
|
|
3179
3179
|
throw new CliError({
|
|
3180
3180
|
message: `${detail}
|
|
3181
3181
|
` + (auth.fromStored ? "Your saved credentials were rejected. Run `ovld auth login` to sign in again." : "Run `ovld auth login` or refresh your USER_TOKEN environment variable.")
|
|
3182
3182
|
});
|
|
3183
3183
|
}
|
|
3184
3184
|
throw new CliError({
|
|
3185
|
-
message: errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${
|
|
3185
|
+
message: errorMessageFromJson2(payload) ?? `Backend request failed: ${method} ${path32} (${response.status})`
|
|
3186
3186
|
});
|
|
3187
3187
|
}
|
|
3188
3188
|
return payload;
|
|
@@ -3190,13 +3190,13 @@ Start the Desktop/local backend or run \`ovld config set cloud <url>\`.
|
|
|
3190
3190
|
return {
|
|
3191
3191
|
baseUrl,
|
|
3192
3192
|
health: () => request({ method: "GET", path: "/api/health" }),
|
|
3193
|
-
get: (
|
|
3194
|
-
post: ({ path:
|
|
3195
|
-
patch: ({ path:
|
|
3196
|
-
delete: (
|
|
3197
|
-
postRaw: ({ path:
|
|
3193
|
+
get: (path32) => request({ method: "GET", path: path32 }),
|
|
3194
|
+
post: ({ path: path32, body }) => request({ method: "POST", path: path32, body }),
|
|
3195
|
+
patch: ({ path: path32, body }) => request({ method: "PATCH", path: path32, body }),
|
|
3196
|
+
delete: (path32) => request({ method: "DELETE", path: path32 }),
|
|
3197
|
+
postRaw: ({ path: path32, body, contentType, filename }) => request({
|
|
3198
3198
|
method: "POST",
|
|
3199
|
-
path:
|
|
3199
|
+
path: path32,
|
|
3200
3200
|
rawBody: body,
|
|
3201
3201
|
extraHeaders: {
|
|
3202
3202
|
"Content-Type": contentType || "application/octet-stream",
|
|
@@ -6394,11 +6394,11 @@ function createChannelClient({
|
|
|
6394
6394
|
token
|
|
6395
6395
|
}) {
|
|
6396
6396
|
const root = `${baseUrl.replace(/\/+$/, "")}/api/agent-session-channels/v1`;
|
|
6397
|
-
async function request(method,
|
|
6397
|
+
async function request(method, path32, body, timeoutMs) {
|
|
6398
6398
|
const controller = new AbortController();
|
|
6399
6399
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
6400
6400
|
try {
|
|
6401
|
-
const response = await fetch(`${root}${
|
|
6401
|
+
const response = await fetch(`${root}${path32}`, {
|
|
6402
6402
|
method,
|
|
6403
6403
|
// The credential travels here and only here: an Authorization header on a request the
|
|
6404
6404
|
// CLI itself constructs. Not in the URL, which lands in access logs; not in the body,
|
|
@@ -6424,8 +6424,8 @@ function createChannelClient({
|
|
|
6424
6424
|
}
|
|
6425
6425
|
}
|
|
6426
6426
|
return {
|
|
6427
|
-
post: (
|
|
6428
|
-
get: (
|
|
6427
|
+
post: (path32, body, options) => request("POST", path32, body ?? {}, options?.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
6428
|
+
get: (path32, options) => request("GET", path32, void 0, options?.timeoutMs ?? DEFAULT_TIMEOUT_MS)
|
|
6429
6429
|
};
|
|
6430
6430
|
}
|
|
6431
6431
|
var DEFAULT_TIMEOUT_MS;
|
|
@@ -6524,9 +6524,9 @@ function reduceUrl(rawUrl) {
|
|
|
6524
6524
|
try {
|
|
6525
6525
|
const url = new URL(raw);
|
|
6526
6526
|
const hadQuery = url.search !== "" || url.hash !== "";
|
|
6527
|
-
const
|
|
6527
|
+
const path32 = url.pathname === "/" ? "" : url.pathname;
|
|
6528
6528
|
return {
|
|
6529
|
-
display: safeText(`${url.protocol}//${url.host}${
|
|
6529
|
+
display: safeText(`${url.protocol}//${url.host}${path32}`).text,
|
|
6530
6530
|
host: url.host || null,
|
|
6531
6531
|
scheme: url.protocol.replace(/:$/, ""),
|
|
6532
6532
|
hadQuery
|
|
@@ -6691,17 +6691,17 @@ var init_mcp = __esm({
|
|
|
6691
6691
|
function describeRead({ input, projectRoot }) {
|
|
6692
6692
|
const record = input && typeof input === "object" ? input : {};
|
|
6693
6693
|
const raw = typeof record.file_path === "string" && record.file_path || typeof record.filePath === "string" && record.filePath || typeof record.path === "string" && record.path || typeof record.notebook_path === "string" && record.notebook_path || null;
|
|
6694
|
-
const
|
|
6694
|
+
const path32 = reducePath(raw, projectRoot);
|
|
6695
6695
|
const markers = [
|
|
6696
|
-
|
|
6697
|
-
|
|
6696
|
+
path32?.outsideProject && "outside-project-directory",
|
|
6697
|
+
path32?.nonAscii && "non-ascii-path"
|
|
6698
6698
|
];
|
|
6699
|
-
if (
|
|
6699
|
+
if (path32 && /(^|\/)(\.env|\.npmrc|\.netrc|id_rsa|id_ed25519|credentials)(\.|$)/.test(path32.display)) {
|
|
6700
6700
|
markers.push("secret-adjacent");
|
|
6701
6701
|
}
|
|
6702
6702
|
return {
|
|
6703
6703
|
action: "Read a file",
|
|
6704
|
-
subject:
|
|
6704
|
+
subject: path32?.display ?? null,
|
|
6705
6705
|
detail: null,
|
|
6706
6706
|
riskMarkers: normalizeMarkers(markers)
|
|
6707
6707
|
};
|
|
@@ -6843,21 +6843,21 @@ function isOverwrite(record) {
|
|
|
6843
6843
|
}
|
|
6844
6844
|
function describeWrite({ input, projectRoot }) {
|
|
6845
6845
|
const record = input && typeof input === "object" ? input : {};
|
|
6846
|
-
const
|
|
6846
|
+
const path32 = reducePath(readPath(record), projectRoot);
|
|
6847
6847
|
const overwrite = isOverwrite(record);
|
|
6848
6848
|
const bytes = byteLength(readContent(record));
|
|
6849
6849
|
const markers = [
|
|
6850
6850
|
overwrite && "overwrites-existing",
|
|
6851
|
-
|
|
6852
|
-
|
|
6851
|
+
path32?.outsideProject && "outside-project-directory",
|
|
6852
|
+
path32?.nonAscii && "non-ascii-path"
|
|
6853
6853
|
];
|
|
6854
|
-
if (
|
|
6854
|
+
if (path32 && /(^|\/)(\.env|\.npmrc|\.netrc|id_rsa|id_ed25519|credentials)(\.|$)/.test(path32.display)) {
|
|
6855
6855
|
markers.push("secret-adjacent");
|
|
6856
6856
|
}
|
|
6857
6857
|
const detail = bytes === null ? overwrite ? "replacing existing text" : null : `${bytes} byte${bytes === 1 ? "" : "s"}${overwrite ? ", replacing existing text" : ""}`;
|
|
6858
6858
|
return {
|
|
6859
6859
|
action: overwrite ? "Overwrite a file" : "Write a file",
|
|
6860
|
-
subject:
|
|
6860
|
+
subject: path32?.display ?? null,
|
|
6861
6861
|
detail,
|
|
6862
6862
|
riskMarkers: normalizeMarkers(markers)
|
|
6863
6863
|
};
|
|
@@ -7058,8 +7058,8 @@ function readPath2(source, dotted) {
|
|
|
7058
7058
|
return current;
|
|
7059
7059
|
}
|
|
7060
7060
|
function firstString(source, paths) {
|
|
7061
|
-
for (const
|
|
7062
|
-
const value = readPath2(source,
|
|
7061
|
+
for (const path32 of paths ?? []) {
|
|
7062
|
+
const value = readPath2(source, path32);
|
|
7063
7063
|
if (typeof value === "string" && value.trim() !== "")
|
|
7064
7064
|
return value.trim();
|
|
7065
7065
|
}
|
|
@@ -7135,9 +7135,9 @@ function normalizeNativeEvent({ codec, payload, nativeEventName, nativeSessionId
|
|
|
7135
7135
|
sealedInput.formatterVersion = FORMATTER_VERSION;
|
|
7136
7136
|
if (rule.fileEditKind && (tool === "write" || tool === "edit")) {
|
|
7137
7137
|
kind = rule.fileEditKind;
|
|
7138
|
-
const
|
|
7139
|
-
if (
|
|
7140
|
-
sealedInput.paths = [
|
|
7138
|
+
const path32 = reducePath(readPath2(input, "file_path") ?? readPath2(input, "filePath") ?? readPath2(input, "path") ?? readPath2(input, "notebook_path"), projectRoot);
|
|
7139
|
+
if (path32)
|
|
7140
|
+
sealedInput.paths = [path32.display];
|
|
7141
7141
|
}
|
|
7142
7142
|
idParts.push(tool, description.subject ?? "", description.detail ?? "");
|
|
7143
7143
|
}
|
|
@@ -7527,8 +7527,8 @@ async function runAgentSessionInbox({
|
|
|
7527
7527
|
const scope = resolveAgentSessionScope({ agent, env });
|
|
7528
7528
|
if (!scope) return emptyResult("Empty");
|
|
7529
7529
|
const payload = payloadRaw === void 0 ? parseNativePayload(readBoundedStdin()) : parseNativePayload(payloadRaw);
|
|
7530
|
-
const
|
|
7531
|
-
if (
|
|
7530
|
+
const path32 = resolveInjectPath({ agent, payload });
|
|
7531
|
+
if (path32 === "unsupported") return emptyResult("Unsupported");
|
|
7532
7532
|
const baseUrl = env.OVERLORD_BACKEND_URL?.trim();
|
|
7533
7533
|
if (!baseUrl && !injectedClient) return emptyResult("Empty");
|
|
7534
7534
|
const client = injectedClient ?? createChannelClient({ baseUrl, channelId: scope.channelId, token: scope.token });
|
|
@@ -7542,15 +7542,15 @@ async function runAgentSessionInbox({
|
|
|
7542
7542
|
);
|
|
7543
7543
|
if (!claimed.ok || !claimed.value.input) return emptyResult("Empty");
|
|
7544
7544
|
const input = claimed.value.input;
|
|
7545
|
-
return await emitClaimedInput({ agent, path:
|
|
7545
|
+
return await emitClaimedInput({ agent, path: path32, input, client });
|
|
7546
7546
|
}
|
|
7547
7547
|
async function emitClaimedInput({
|
|
7548
7548
|
agent,
|
|
7549
|
-
path:
|
|
7549
|
+
path: path32,
|
|
7550
7550
|
input,
|
|
7551
7551
|
client
|
|
7552
7552
|
}) {
|
|
7553
|
-
if (
|
|
7553
|
+
if (path32 === "claude-mid-turn") {
|
|
7554
7554
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
7555
7555
|
leaseId: input.leaseId,
|
|
7556
7556
|
deliveryOutcome: "delivered"
|
|
@@ -7565,7 +7565,7 @@ async function emitClaimedInput({
|
|
|
7565
7565
|
inputId: input.id
|
|
7566
7566
|
};
|
|
7567
7567
|
}
|
|
7568
|
-
if (
|
|
7568
|
+
if (path32 === "claude-turn-boundary") {
|
|
7569
7569
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
7570
7570
|
leaseId: input.leaseId,
|
|
7571
7571
|
deliveryOutcome: "delivered"
|
|
@@ -7580,7 +7580,7 @@ async function emitClaimedInput({
|
|
|
7580
7580
|
inputId: input.id
|
|
7581
7581
|
};
|
|
7582
7582
|
}
|
|
7583
|
-
if (
|
|
7583
|
+
if (path32 === "cursor-turn-boundary") {
|
|
7584
7584
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
7585
7585
|
leaseId: input.leaseId,
|
|
7586
7586
|
deliveryOutcome: "queued_turn_boundary"
|
|
@@ -7594,7 +7594,7 @@ async function emitClaimedInput({
|
|
|
7594
7594
|
inputId: input.id
|
|
7595
7595
|
};
|
|
7596
7596
|
}
|
|
7597
|
-
if (
|
|
7597
|
+
if (path32 === "codex-turn-boundary") {
|
|
7598
7598
|
const emitted = await client.post(`/inputs/${input.id}/emitted`, {
|
|
7599
7599
|
leaseId: input.leaseId,
|
|
7600
7600
|
deliveryOutcome: "delivered"
|
|
@@ -7609,7 +7609,7 @@ async function emitClaimedInput({
|
|
|
7609
7609
|
inputId: input.id
|
|
7610
7610
|
};
|
|
7611
7611
|
}
|
|
7612
|
-
if (
|
|
7612
|
+
if (path32 === "pi-mid-turn") {
|
|
7613
7613
|
return {
|
|
7614
7614
|
report: "Empty",
|
|
7615
7615
|
exitCode: 0,
|
|
@@ -7714,8 +7714,8 @@ var init_inbox = __esm({
|
|
|
7714
7714
|
|
|
7715
7715
|
// ../packages/core/dist/service/agent-session/pure/decision.js
|
|
7716
7716
|
function firstValue(source, paths) {
|
|
7717
|
-
for (const
|
|
7718
|
-
const value = readPath2(source,
|
|
7717
|
+
for (const path32 of paths ?? []) {
|
|
7718
|
+
const value = readPath2(source, path32);
|
|
7719
7719
|
if (value !== void 0 && value !== null)
|
|
7720
7720
|
return value;
|
|
7721
7721
|
}
|
|
@@ -8252,10 +8252,10 @@ async function reconcileState({
|
|
|
8252
8252
|
}) {
|
|
8253
8253
|
let posted = 0;
|
|
8254
8254
|
let duplicates = 0;
|
|
8255
|
-
for (const
|
|
8255
|
+
for (const path32 of ["/permission", "/question"]) {
|
|
8256
8256
|
let entries;
|
|
8257
8257
|
try {
|
|
8258
|
-
const response = await doFetch(`${controlPlaneBaseUrl(port)}${
|
|
8258
|
+
const response = await doFetch(`${controlPlaneBaseUrl(port)}${path32}`, {
|
|
8259
8259
|
headers: authHeaders(password)
|
|
8260
8260
|
});
|
|
8261
8261
|
if (!response.ok) continue;
|
|
@@ -8265,7 +8265,7 @@ async function reconcileState({
|
|
|
8265
8265
|
continue;
|
|
8266
8266
|
}
|
|
8267
8267
|
for (const entry of entries) {
|
|
8268
|
-
if (
|
|
8268
|
+
if (path32 === "/permission") {
|
|
8269
8269
|
await syncOpenCodePermission({
|
|
8270
8270
|
client,
|
|
8271
8271
|
frame: { event: "permission.updated", data: JSON.stringify(entry) },
|
|
@@ -8788,17 +8788,17 @@ var require_visit = __commonJS({
|
|
|
8788
8788
|
visit.BREAK = BREAK;
|
|
8789
8789
|
visit.SKIP = SKIP;
|
|
8790
8790
|
visit.REMOVE = REMOVE;
|
|
8791
|
-
function visit_(key, node, visitor,
|
|
8792
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
8791
|
+
function visit_(key, node, visitor, path32) {
|
|
8792
|
+
const ctrl = callVisitor(key, node, visitor, path32);
|
|
8793
8793
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
8794
|
-
replaceNode(key,
|
|
8795
|
-
return visit_(key, ctrl, visitor,
|
|
8794
|
+
replaceNode(key, path32, ctrl);
|
|
8795
|
+
return visit_(key, ctrl, visitor, path32);
|
|
8796
8796
|
}
|
|
8797
8797
|
if (typeof ctrl !== "symbol") {
|
|
8798
8798
|
if (identity.isCollection(node)) {
|
|
8799
|
-
|
|
8799
|
+
path32 = Object.freeze(path32.concat(node));
|
|
8800
8800
|
for (let i = 0; i < node.items.length; ++i) {
|
|
8801
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
8801
|
+
const ci = visit_(i, node.items[i], visitor, path32);
|
|
8802
8802
|
if (typeof ci === "number")
|
|
8803
8803
|
i = ci - 1;
|
|
8804
8804
|
else if (ci === BREAK)
|
|
@@ -8809,13 +8809,13 @@ var require_visit = __commonJS({
|
|
|
8809
8809
|
}
|
|
8810
8810
|
}
|
|
8811
8811
|
} else if (identity.isPair(node)) {
|
|
8812
|
-
|
|
8813
|
-
const ck = visit_("key", node.key, visitor,
|
|
8812
|
+
path32 = Object.freeze(path32.concat(node));
|
|
8813
|
+
const ck = visit_("key", node.key, visitor, path32);
|
|
8814
8814
|
if (ck === BREAK)
|
|
8815
8815
|
return BREAK;
|
|
8816
8816
|
else if (ck === REMOVE)
|
|
8817
8817
|
node.key = null;
|
|
8818
|
-
const cv = visit_("value", node.value, visitor,
|
|
8818
|
+
const cv = visit_("value", node.value, visitor, path32);
|
|
8819
8819
|
if (cv === BREAK)
|
|
8820
8820
|
return BREAK;
|
|
8821
8821
|
else if (cv === REMOVE)
|
|
@@ -8836,17 +8836,17 @@ var require_visit = __commonJS({
|
|
|
8836
8836
|
visitAsync.BREAK = BREAK;
|
|
8837
8837
|
visitAsync.SKIP = SKIP;
|
|
8838
8838
|
visitAsync.REMOVE = REMOVE;
|
|
8839
|
-
async function visitAsync_(key, node, visitor,
|
|
8840
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
8839
|
+
async function visitAsync_(key, node, visitor, path32) {
|
|
8840
|
+
const ctrl = await callVisitor(key, node, visitor, path32);
|
|
8841
8841
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
8842
|
-
replaceNode(key,
|
|
8843
|
-
return visitAsync_(key, ctrl, visitor,
|
|
8842
|
+
replaceNode(key, path32, ctrl);
|
|
8843
|
+
return visitAsync_(key, ctrl, visitor, path32);
|
|
8844
8844
|
}
|
|
8845
8845
|
if (typeof ctrl !== "symbol") {
|
|
8846
8846
|
if (identity.isCollection(node)) {
|
|
8847
|
-
|
|
8847
|
+
path32 = Object.freeze(path32.concat(node));
|
|
8848
8848
|
for (let i = 0; i < node.items.length; ++i) {
|
|
8849
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
8849
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path32);
|
|
8850
8850
|
if (typeof ci === "number")
|
|
8851
8851
|
i = ci - 1;
|
|
8852
8852
|
else if (ci === BREAK)
|
|
@@ -8857,13 +8857,13 @@ var require_visit = __commonJS({
|
|
|
8857
8857
|
}
|
|
8858
8858
|
}
|
|
8859
8859
|
} else if (identity.isPair(node)) {
|
|
8860
|
-
|
|
8861
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
8860
|
+
path32 = Object.freeze(path32.concat(node));
|
|
8861
|
+
const ck = await visitAsync_("key", node.key, visitor, path32);
|
|
8862
8862
|
if (ck === BREAK)
|
|
8863
8863
|
return BREAK;
|
|
8864
8864
|
else if (ck === REMOVE)
|
|
8865
8865
|
node.key = null;
|
|
8866
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
8866
|
+
const cv = await visitAsync_("value", node.value, visitor, path32);
|
|
8867
8867
|
if (cv === BREAK)
|
|
8868
8868
|
return BREAK;
|
|
8869
8869
|
else if (cv === REMOVE)
|
|
@@ -8890,23 +8890,23 @@ var require_visit = __commonJS({
|
|
|
8890
8890
|
}
|
|
8891
8891
|
return visitor;
|
|
8892
8892
|
}
|
|
8893
|
-
function callVisitor(key, node, visitor,
|
|
8893
|
+
function callVisitor(key, node, visitor, path32) {
|
|
8894
8894
|
if (typeof visitor === "function")
|
|
8895
|
-
return visitor(key, node,
|
|
8895
|
+
return visitor(key, node, path32);
|
|
8896
8896
|
if (identity.isMap(node))
|
|
8897
|
-
return visitor.Map?.(key, node,
|
|
8897
|
+
return visitor.Map?.(key, node, path32);
|
|
8898
8898
|
if (identity.isSeq(node))
|
|
8899
|
-
return visitor.Seq?.(key, node,
|
|
8899
|
+
return visitor.Seq?.(key, node, path32);
|
|
8900
8900
|
if (identity.isPair(node))
|
|
8901
|
-
return visitor.Pair?.(key, node,
|
|
8901
|
+
return visitor.Pair?.(key, node, path32);
|
|
8902
8902
|
if (identity.isScalar(node))
|
|
8903
|
-
return visitor.Scalar?.(key, node,
|
|
8903
|
+
return visitor.Scalar?.(key, node, path32);
|
|
8904
8904
|
if (identity.isAlias(node))
|
|
8905
|
-
return visitor.Alias?.(key, node,
|
|
8905
|
+
return visitor.Alias?.(key, node, path32);
|
|
8906
8906
|
return void 0;
|
|
8907
8907
|
}
|
|
8908
|
-
function replaceNode(key,
|
|
8909
|
-
const parent =
|
|
8908
|
+
function replaceNode(key, path32, node) {
|
|
8909
|
+
const parent = path32[path32.length - 1];
|
|
8910
8910
|
if (identity.isCollection(parent)) {
|
|
8911
8911
|
parent.items[key] = node;
|
|
8912
8912
|
} else if (identity.isPair(parent)) {
|
|
@@ -9516,10 +9516,10 @@ var require_Collection = __commonJS({
|
|
|
9516
9516
|
var createNode = require_createNode();
|
|
9517
9517
|
var identity = require_identity();
|
|
9518
9518
|
var Node = require_Node();
|
|
9519
|
-
function collectionFromPath(schema,
|
|
9519
|
+
function collectionFromPath(schema, path32, value) {
|
|
9520
9520
|
let v = value;
|
|
9521
|
-
for (let i =
|
|
9522
|
-
const k =
|
|
9521
|
+
for (let i = path32.length - 1; i >= 0; --i) {
|
|
9522
|
+
const k = path32[i];
|
|
9523
9523
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
9524
9524
|
const a = [];
|
|
9525
9525
|
a[k] = v;
|
|
@@ -9538,7 +9538,7 @@ var require_Collection = __commonJS({
|
|
|
9538
9538
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
9539
9539
|
});
|
|
9540
9540
|
}
|
|
9541
|
-
var isEmptyPath = (
|
|
9541
|
+
var isEmptyPath = (path32) => path32 == null || typeof path32 === "object" && !!path32[Symbol.iterator]().next().done;
|
|
9542
9542
|
var Collection = class extends Node.NodeBase {
|
|
9543
9543
|
constructor(type, schema) {
|
|
9544
9544
|
super(type);
|
|
@@ -9568,11 +9568,11 @@ var require_Collection = __commonJS({
|
|
|
9568
9568
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
9569
9569
|
* that already exists in the map.
|
|
9570
9570
|
*/
|
|
9571
|
-
addIn(
|
|
9572
|
-
if (isEmptyPath(
|
|
9571
|
+
addIn(path32, value) {
|
|
9572
|
+
if (isEmptyPath(path32))
|
|
9573
9573
|
this.add(value);
|
|
9574
9574
|
else {
|
|
9575
|
-
const [key, ...rest] =
|
|
9575
|
+
const [key, ...rest] = path32;
|
|
9576
9576
|
const node = this.get(key, true);
|
|
9577
9577
|
if (identity.isCollection(node))
|
|
9578
9578
|
node.addIn(rest, value);
|
|
@@ -9586,8 +9586,8 @@ var require_Collection = __commonJS({
|
|
|
9586
9586
|
* Removes a value from the collection.
|
|
9587
9587
|
* @returns `true` if the item was found and removed.
|
|
9588
9588
|
*/
|
|
9589
|
-
deleteIn(
|
|
9590
|
-
const [key, ...rest] =
|
|
9589
|
+
deleteIn(path32) {
|
|
9590
|
+
const [key, ...rest] = path32;
|
|
9591
9591
|
if (rest.length === 0)
|
|
9592
9592
|
return this.delete(key);
|
|
9593
9593
|
const node = this.get(key, true);
|
|
@@ -9601,8 +9601,8 @@ var require_Collection = __commonJS({
|
|
|
9601
9601
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
9602
9602
|
* `true` (collections are always returned intact).
|
|
9603
9603
|
*/
|
|
9604
|
-
getIn(
|
|
9605
|
-
const [key, ...rest] =
|
|
9604
|
+
getIn(path32, keepScalar) {
|
|
9605
|
+
const [key, ...rest] = path32;
|
|
9606
9606
|
const node = this.get(key, true);
|
|
9607
9607
|
if (rest.length === 0)
|
|
9608
9608
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -9620,8 +9620,8 @@ var require_Collection = __commonJS({
|
|
|
9620
9620
|
/**
|
|
9621
9621
|
* Checks if the collection includes a value with the key `key`.
|
|
9622
9622
|
*/
|
|
9623
|
-
hasIn(
|
|
9624
|
-
const [key, ...rest] =
|
|
9623
|
+
hasIn(path32) {
|
|
9624
|
+
const [key, ...rest] = path32;
|
|
9625
9625
|
if (rest.length === 0)
|
|
9626
9626
|
return this.has(key);
|
|
9627
9627
|
const node = this.get(key, true);
|
|
@@ -9631,8 +9631,8 @@ var require_Collection = __commonJS({
|
|
|
9631
9631
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
9632
9632
|
* boolean to add/remove the item from the set.
|
|
9633
9633
|
*/
|
|
9634
|
-
setIn(
|
|
9635
|
-
const [key, ...rest] =
|
|
9634
|
+
setIn(path32, value) {
|
|
9635
|
+
const [key, ...rest] = path32;
|
|
9636
9636
|
if (rest.length === 0) {
|
|
9637
9637
|
this.set(key, value);
|
|
9638
9638
|
} else {
|
|
@@ -12147,9 +12147,9 @@ var require_Document = __commonJS({
|
|
|
12147
12147
|
this.contents.add(value);
|
|
12148
12148
|
}
|
|
12149
12149
|
/** Adds a value to the document. */
|
|
12150
|
-
addIn(
|
|
12150
|
+
addIn(path32, value) {
|
|
12151
12151
|
if (assertCollection(this.contents))
|
|
12152
|
-
this.contents.addIn(
|
|
12152
|
+
this.contents.addIn(path32, value);
|
|
12153
12153
|
}
|
|
12154
12154
|
/**
|
|
12155
12155
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -12224,14 +12224,14 @@ var require_Document = __commonJS({
|
|
|
12224
12224
|
* Removes a value from the document.
|
|
12225
12225
|
* @returns `true` if the item was found and removed.
|
|
12226
12226
|
*/
|
|
12227
|
-
deleteIn(
|
|
12228
|
-
if (Collection.isEmptyPath(
|
|
12227
|
+
deleteIn(path32) {
|
|
12228
|
+
if (Collection.isEmptyPath(path32)) {
|
|
12229
12229
|
if (this.contents == null)
|
|
12230
12230
|
return false;
|
|
12231
12231
|
this.contents = null;
|
|
12232
12232
|
return true;
|
|
12233
12233
|
}
|
|
12234
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
12234
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path32) : false;
|
|
12235
12235
|
}
|
|
12236
12236
|
/**
|
|
12237
12237
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -12246,10 +12246,10 @@ var require_Document = __commonJS({
|
|
|
12246
12246
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
12247
12247
|
* `true` (collections are always returned intact).
|
|
12248
12248
|
*/
|
|
12249
|
-
getIn(
|
|
12250
|
-
if (Collection.isEmptyPath(
|
|
12249
|
+
getIn(path32, keepScalar) {
|
|
12250
|
+
if (Collection.isEmptyPath(path32))
|
|
12251
12251
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
12252
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
12252
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path32, keepScalar) : void 0;
|
|
12253
12253
|
}
|
|
12254
12254
|
/**
|
|
12255
12255
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -12260,10 +12260,10 @@ var require_Document = __commonJS({
|
|
|
12260
12260
|
/**
|
|
12261
12261
|
* Checks if the document includes a value at `path`.
|
|
12262
12262
|
*/
|
|
12263
|
-
hasIn(
|
|
12264
|
-
if (Collection.isEmptyPath(
|
|
12263
|
+
hasIn(path32) {
|
|
12264
|
+
if (Collection.isEmptyPath(path32))
|
|
12265
12265
|
return this.contents !== void 0;
|
|
12266
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
12266
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path32) : false;
|
|
12267
12267
|
}
|
|
12268
12268
|
/**
|
|
12269
12269
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -12280,13 +12280,13 @@ var require_Document = __commonJS({
|
|
|
12280
12280
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
12281
12281
|
* boolean to add/remove the item from the set.
|
|
12282
12282
|
*/
|
|
12283
|
-
setIn(
|
|
12284
|
-
if (Collection.isEmptyPath(
|
|
12283
|
+
setIn(path32, value) {
|
|
12284
|
+
if (Collection.isEmptyPath(path32)) {
|
|
12285
12285
|
this.contents = value;
|
|
12286
12286
|
} else if (this.contents == null) {
|
|
12287
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
12287
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path32), value);
|
|
12288
12288
|
} else if (assertCollection(this.contents)) {
|
|
12289
|
-
this.contents.setIn(
|
|
12289
|
+
this.contents.setIn(path32, value);
|
|
12290
12290
|
}
|
|
12291
12291
|
}
|
|
12292
12292
|
/**
|
|
@@ -14246,9 +14246,9 @@ var require_cst_visit = __commonJS({
|
|
|
14246
14246
|
visit.BREAK = BREAK;
|
|
14247
14247
|
visit.SKIP = SKIP;
|
|
14248
14248
|
visit.REMOVE = REMOVE;
|
|
14249
|
-
visit.itemAtPath = (cst,
|
|
14249
|
+
visit.itemAtPath = (cst, path32) => {
|
|
14250
14250
|
let item = cst;
|
|
14251
|
-
for (const [field, index] of
|
|
14251
|
+
for (const [field, index] of path32) {
|
|
14252
14252
|
const tok = item?.[field];
|
|
14253
14253
|
if (tok && "items" in tok) {
|
|
14254
14254
|
item = tok.items[index];
|
|
@@ -14257,23 +14257,23 @@ var require_cst_visit = __commonJS({
|
|
|
14257
14257
|
}
|
|
14258
14258
|
return item;
|
|
14259
14259
|
};
|
|
14260
|
-
visit.parentCollection = (cst,
|
|
14261
|
-
const parent = visit.itemAtPath(cst,
|
|
14262
|
-
const field =
|
|
14260
|
+
visit.parentCollection = (cst, path32) => {
|
|
14261
|
+
const parent = visit.itemAtPath(cst, path32.slice(0, -1));
|
|
14262
|
+
const field = path32[path32.length - 1][0];
|
|
14263
14263
|
const coll = parent?.[field];
|
|
14264
14264
|
if (coll && "items" in coll)
|
|
14265
14265
|
return coll;
|
|
14266
14266
|
throw new Error("Parent collection not found");
|
|
14267
14267
|
};
|
|
14268
|
-
function _visit(
|
|
14269
|
-
let ctrl = visitor(item,
|
|
14268
|
+
function _visit(path32, item, visitor) {
|
|
14269
|
+
let ctrl = visitor(item, path32);
|
|
14270
14270
|
if (typeof ctrl === "symbol")
|
|
14271
14271
|
return ctrl;
|
|
14272
14272
|
for (const field of ["key", "value"]) {
|
|
14273
14273
|
const token = item[field];
|
|
14274
14274
|
if (token && "items" in token) {
|
|
14275
14275
|
for (let i = 0; i < token.items.length; ++i) {
|
|
14276
|
-
const ci = _visit(Object.freeze(
|
|
14276
|
+
const ci = _visit(Object.freeze(path32.concat([[field, i]])), token.items[i], visitor);
|
|
14277
14277
|
if (typeof ci === "number")
|
|
14278
14278
|
i = ci - 1;
|
|
14279
14279
|
else if (ci === BREAK)
|
|
@@ -14284,10 +14284,10 @@ var require_cst_visit = __commonJS({
|
|
|
14284
14284
|
}
|
|
14285
14285
|
}
|
|
14286
14286
|
if (typeof ctrl === "function" && field === "key")
|
|
14287
|
-
ctrl = ctrl(item,
|
|
14287
|
+
ctrl = ctrl(item, path32);
|
|
14288
14288
|
}
|
|
14289
14289
|
}
|
|
14290
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
14290
|
+
return typeof ctrl === "function" ? ctrl(item, path32) : ctrl;
|
|
14291
14291
|
}
|
|
14292
14292
|
exports.visit = visit;
|
|
14293
14293
|
}
|
|
@@ -16363,8 +16363,8 @@ function accessModeToResourcePathPermission({ accessMode, isPrimary = false }) {
|
|
|
16363
16363
|
return "rw";
|
|
16364
16364
|
return accessMode === "read" ? "ro" : "rw";
|
|
16365
16365
|
}
|
|
16366
|
-
function formatResourcePathWithPermission({ path:
|
|
16367
|
-
const trimmed =
|
|
16366
|
+
function formatResourcePathWithPermission({ path: path32, accessMode, isPrimary = false }) {
|
|
16367
|
+
const trimmed = path32.trim();
|
|
16368
16368
|
if (!trimmed)
|
|
16369
16369
|
return "";
|
|
16370
16370
|
const permission = accessModeToResourcePathPermission({ accessMode, isPrimary });
|
|
@@ -16378,11 +16378,11 @@ function formatProjectResourcePathsFromManifest(projectResources) {
|
|
|
16378
16378
|
if (!entry || typeof entry !== "object")
|
|
16379
16379
|
continue;
|
|
16380
16380
|
const record = entry;
|
|
16381
|
-
const
|
|
16382
|
-
if (!
|
|
16381
|
+
const path32 = typeof record.path === "string" ? record.path.trim() : "";
|
|
16382
|
+
if (!path32)
|
|
16383
16383
|
continue;
|
|
16384
16384
|
paths.push(formatResourcePathWithPermission({
|
|
16385
|
-
path:
|
|
16385
|
+
path: path32,
|
|
16386
16386
|
accessMode: typeof record.accessMode === "string" ? record.accessMode : null,
|
|
16387
16387
|
isPrimary: record.isPrimary === true
|
|
16388
16388
|
}));
|
|
@@ -17978,10 +17978,10 @@ function primaryResourcePath(projectResources) {
|
|
|
17978
17978
|
for (const entry of projectResources) {
|
|
17979
17979
|
if (!entry || typeof entry !== "object") continue;
|
|
17980
17980
|
const record = entry;
|
|
17981
|
-
const
|
|
17982
|
-
if (!
|
|
17983
|
-
if (record.isPrimary === true) return
|
|
17984
|
-
if (record.isCurrent === true && !currentPath) currentPath =
|
|
17981
|
+
const path32 = typeof record.path === "string" ? record.path.trim() : "";
|
|
17982
|
+
if (!path32) continue;
|
|
17983
|
+
if (record.isPrimary === true) return path32;
|
|
17984
|
+
if (record.isCurrent === true && !currentPath) currentPath = path32;
|
|
17985
17985
|
}
|
|
17986
17986
|
return currentPath;
|
|
17987
17987
|
}
|
|
@@ -18698,9 +18698,73 @@ var init_launch = __esm({
|
|
|
18698
18698
|
}
|
|
18699
18699
|
});
|
|
18700
18700
|
|
|
18701
|
-
// src/
|
|
18702
|
-
import { readFileSync as readFileSync15 } from "node:fs";
|
|
18701
|
+
// src/launch-bootstrap.ts
|
|
18702
|
+
import { existsSync as existsSync21, readdirSync as readdirSync4, readFileSync as readFileSync15, statSync as statSync5 } from "node:fs";
|
|
18703
18703
|
import path23 from "node:path";
|
|
18704
|
+
function firstCapture(match) {
|
|
18705
|
+
if (!match) return null;
|
|
18706
|
+
const value = match[1] ?? match[2] ?? match[3] ?? null;
|
|
18707
|
+
return value && value.trim() ? value.trim() : null;
|
|
18708
|
+
}
|
|
18709
|
+
function safeMissionPart(missionId) {
|
|
18710
|
+
return missionId.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/^-+|-+$/g, "") || "launch";
|
|
18711
|
+
}
|
|
18712
|
+
function recoverLaunchBootstrapFromProjectTmp({
|
|
18713
|
+
workingDirectory,
|
|
18714
|
+
missionId
|
|
18715
|
+
}) {
|
|
18716
|
+
const empty = {
|
|
18717
|
+
sessionChannelId: null,
|
|
18718
|
+
executionRequestId: null,
|
|
18719
|
+
sourcePath: null
|
|
18720
|
+
};
|
|
18721
|
+
const trimmedMission = missionId.trim();
|
|
18722
|
+
if (!trimmedMission) return empty;
|
|
18723
|
+
const tmpDir = projectTmpDir(workingDirectory);
|
|
18724
|
+
if (!existsSync21(tmpDir)) return empty;
|
|
18725
|
+
const prefix = `launch-${safeMissionPart(trimmedMission)}-`;
|
|
18726
|
+
let newest = null;
|
|
18727
|
+
try {
|
|
18728
|
+
for (const name of readdirSync4(tmpDir)) {
|
|
18729
|
+
if (!name.startsWith(prefix) || !name.endsWith(".sh")) continue;
|
|
18730
|
+
const filePath = path23.join(tmpDir, name);
|
|
18731
|
+
try {
|
|
18732
|
+
const mtimeMs = statSync5(filePath).mtimeMs;
|
|
18733
|
+
if (!newest || mtimeMs > newest.mtimeMs) {
|
|
18734
|
+
newest = { path: filePath, mtimeMs };
|
|
18735
|
+
}
|
|
18736
|
+
} catch {
|
|
18737
|
+
}
|
|
18738
|
+
}
|
|
18739
|
+
} catch {
|
|
18740
|
+
return empty;
|
|
18741
|
+
}
|
|
18742
|
+
if (!newest) return empty;
|
|
18743
|
+
let contents = "";
|
|
18744
|
+
try {
|
|
18745
|
+
contents = readFileSync15(newest.path, "utf8");
|
|
18746
|
+
} catch {
|
|
18747
|
+
return empty;
|
|
18748
|
+
}
|
|
18749
|
+
return {
|
|
18750
|
+
sessionChannelId: firstCapture(contents.match(EXPORT_CHANNEL_ID_RE)),
|
|
18751
|
+
executionRequestId: firstCapture(contents.match(EXPORT_EXECUTION_REQUEST_ID_RE)),
|
|
18752
|
+
sourcePath: newest.path
|
|
18753
|
+
};
|
|
18754
|
+
}
|
|
18755
|
+
var EXPORT_CHANNEL_ID_RE, EXPORT_EXECUTION_REQUEST_ID_RE;
|
|
18756
|
+
var init_launch_bootstrap = __esm({
|
|
18757
|
+
"src/launch-bootstrap.ts"() {
|
|
18758
|
+
"use strict";
|
|
18759
|
+
init_project_tmp();
|
|
18760
|
+
EXPORT_CHANNEL_ID_RE = /(?:^|[;\s])export\s+OVERLORD_SESSION_CHANNEL_ID=(?:'([^']+)'|"([^"]+)"|([^\s;]+))/m;
|
|
18761
|
+
EXPORT_EXECUTION_REQUEST_ID_RE = /(?:^|[;\s])export\s+OVERLORD_EXECUTION_REQUEST_ID=(?:'([^']+)'|"([^"]+)"|([^\s;]+))/m;
|
|
18762
|
+
}
|
|
18763
|
+
});
|
|
18764
|
+
|
|
18765
|
+
// src/org-setup.ts
|
|
18766
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
18767
|
+
import path24 from "node:path";
|
|
18704
18768
|
import { createInterface as createInterface3 } from "node:readline";
|
|
18705
18769
|
function suggestSlug(name) {
|
|
18706
18770
|
const cleaned = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -18779,12 +18843,12 @@ async function runOrgSetupCommand({
|
|
|
18779
18843
|
let logoWarning = null;
|
|
18780
18844
|
if (logoPath) {
|
|
18781
18845
|
try {
|
|
18782
|
-
const resolvedPath =
|
|
18783
|
-
const bytes =
|
|
18846
|
+
const resolvedPath = path24.resolve(logoPath);
|
|
18847
|
+
const bytes = readFileSync16(resolvedPath);
|
|
18784
18848
|
const stored = await runtime.backend.postRaw({
|
|
18785
18849
|
path: "/api/uploads/organization-images",
|
|
18786
18850
|
body: bytes,
|
|
18787
|
-
filename:
|
|
18851
|
+
filename: path24.basename(resolvedPath)
|
|
18788
18852
|
});
|
|
18789
18853
|
await runtime.backend.patch({
|
|
18790
18854
|
path: `/api/organizations/${encodeURIComponent(organization.id)}`,
|
|
@@ -19274,17 +19338,17 @@ var init_protocol_help = __esm({
|
|
|
19274
19338
|
|
|
19275
19339
|
// src/vcs-sessions.ts
|
|
19276
19340
|
import { createHash as createHash8 } from "node:crypto";
|
|
19277
|
-
import { existsSync as
|
|
19278
|
-
import
|
|
19341
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync10, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "node:fs";
|
|
19342
|
+
import path25 from "node:path";
|
|
19279
19343
|
function manifestPath2(workingDirectory) {
|
|
19280
|
-
const key = createHash8("sha256").update(
|
|
19281
|
-
return
|
|
19344
|
+
const key = createHash8("sha256").update(path25.resolve(workingDirectory)).digest("hex");
|
|
19345
|
+
return path25.join(resolveGlobalDataDir(), "vcs-sessions", `${key}.json`);
|
|
19282
19346
|
}
|
|
19283
19347
|
function readEntries(workingDirectory) {
|
|
19284
19348
|
try {
|
|
19285
19349
|
const target = manifestPath2(workingDirectory);
|
|
19286
|
-
if (!
|
|
19287
|
-
const raw = JSON.parse(
|
|
19350
|
+
if (!existsSync22(target)) return [];
|
|
19351
|
+
const raw = JSON.parse(readFileSync17(target, "utf8"));
|
|
19288
19352
|
if (!Array.isArray(raw.entries)) return [];
|
|
19289
19353
|
const now = Date.now();
|
|
19290
19354
|
return raw.entries.flatMap((entry) => {
|
|
@@ -19303,7 +19367,7 @@ function readEntries(workingDirectory) {
|
|
|
19303
19367
|
function writeEntries(workingDirectory, entries) {
|
|
19304
19368
|
try {
|
|
19305
19369
|
const target = manifestPath2(workingDirectory);
|
|
19306
|
-
mkdirSync10(
|
|
19370
|
+
mkdirSync10(path25.dirname(target), { recursive: true });
|
|
19307
19371
|
writeFileSync9(target, JSON.stringify({ entries }));
|
|
19308
19372
|
} catch {
|
|
19309
19373
|
}
|
|
@@ -19357,20 +19421,20 @@ var init_vcs_sessions = __esm({
|
|
|
19357
19421
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
19358
19422
|
import { createHash as createHash9 } from "node:crypto";
|
|
19359
19423
|
import {
|
|
19360
|
-
existsSync as
|
|
19424
|
+
existsSync as existsSync23,
|
|
19361
19425
|
mkdirSync as mkdirSync11,
|
|
19362
|
-
readdirSync as
|
|
19363
|
-
readFileSync as
|
|
19426
|
+
readdirSync as readdirSync5,
|
|
19427
|
+
readFileSync as readFileSync18,
|
|
19364
19428
|
realpathSync as realpathSync2,
|
|
19365
19429
|
rmSync as rmSync5,
|
|
19366
19430
|
writeFileSync as writeFileSync10
|
|
19367
19431
|
} from "node:fs";
|
|
19368
|
-
import
|
|
19432
|
+
import path26 from "node:path";
|
|
19369
19433
|
function normalizePath(filePath) {
|
|
19370
19434
|
return filePath.replace(/\\/g, "/").trim();
|
|
19371
19435
|
}
|
|
19372
19436
|
function sameWorkingDirectory(left, right) {
|
|
19373
|
-
return typeof left === "string" &&
|
|
19437
|
+
return typeof left === "string" && path26.resolve(left) === path26.resolve(right);
|
|
19374
19438
|
}
|
|
19375
19439
|
function parsePorcelainLine(line) {
|
|
19376
19440
|
const trimmedEnd = line.replace(/\s+$/, "");
|
|
@@ -19421,13 +19485,13 @@ function sessionKeyHash({
|
|
|
19421
19485
|
workingDirectory,
|
|
19422
19486
|
missionId
|
|
19423
19487
|
}) {
|
|
19424
|
-
return createHash9("sha256").update(`${
|
|
19488
|
+
return createHash9("sha256").update(`${path26.resolve(workingDirectory)}\0${missionId}`).digest("hex");
|
|
19425
19489
|
}
|
|
19426
19490
|
function baselineFilePath({
|
|
19427
19491
|
workingDirectory,
|
|
19428
19492
|
missionId
|
|
19429
19493
|
}) {
|
|
19430
|
-
return
|
|
19494
|
+
return path26.join(
|
|
19431
19495
|
resolveGlobalDataDir(),
|
|
19432
19496
|
"vcs-baselines",
|
|
19433
19497
|
`${sessionKeyHash({ workingDirectory, missionId })}.json`
|
|
@@ -19437,7 +19501,7 @@ function touchedFilesPath({
|
|
|
19437
19501
|
workingDirectory,
|
|
19438
19502
|
missionId
|
|
19439
19503
|
}) {
|
|
19440
|
-
return
|
|
19504
|
+
return path26.join(
|
|
19441
19505
|
resolveGlobalDataDir(),
|
|
19442
19506
|
"vcs-touched",
|
|
19443
19507
|
`${sessionKeyHash({ workingDirectory, missionId })}.json`
|
|
@@ -19447,7 +19511,7 @@ function rationaleNotesPath({
|
|
|
19447
19511
|
workingDirectory,
|
|
19448
19512
|
missionId
|
|
19449
19513
|
}) {
|
|
19450
|
-
return
|
|
19514
|
+
return path26.join(
|
|
19451
19515
|
resolveGlobalDataDir(),
|
|
19452
19516
|
"vcs-rationale-notes",
|
|
19453
19517
|
`${sessionKeyHash({ workingDirectory, missionId })}.json`
|
|
@@ -19457,7 +19521,7 @@ function bashSnapshotPath({
|
|
|
19457
19521
|
workingDirectory,
|
|
19458
19522
|
missionId
|
|
19459
19523
|
}) {
|
|
19460
|
-
return
|
|
19524
|
+
return path26.join(
|
|
19461
19525
|
resolveGlobalDataDir(),
|
|
19462
19526
|
"vcs-touched",
|
|
19463
19527
|
`${sessionKeyHash({ workingDirectory, missionId })}.bash-snapshot.json`
|
|
@@ -19469,8 +19533,8 @@ function readBashSnapshot({
|
|
|
19469
19533
|
}) {
|
|
19470
19534
|
try {
|
|
19471
19535
|
const target = bashSnapshotPath({ workingDirectory, missionId });
|
|
19472
|
-
if (!
|
|
19473
|
-
const raw = JSON.parse(
|
|
19536
|
+
if (!existsSync23(target)) return /* @__PURE__ */ new Map();
|
|
19537
|
+
const raw = JSON.parse(readFileSync18(target, "utf8"));
|
|
19474
19538
|
const byPath = /* @__PURE__ */ new Map();
|
|
19475
19539
|
if (Array.isArray(raw.files)) {
|
|
19476
19540
|
for (const entry of raw.files) {
|
|
@@ -19495,7 +19559,7 @@ function writeBashSnapshot({
|
|
|
19495
19559
|
}) {
|
|
19496
19560
|
try {
|
|
19497
19561
|
const target = bashSnapshotPath({ workingDirectory, missionId });
|
|
19498
|
-
mkdirSync11(
|
|
19562
|
+
mkdirSync11(path26.dirname(target), { recursive: true });
|
|
19499
19563
|
writeFileSync10(target, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString(), files }));
|
|
19500
19564
|
} catch {
|
|
19501
19565
|
}
|
|
@@ -19529,12 +19593,12 @@ function recordBashObservedChanges({
|
|
|
19529
19593
|
}
|
|
19530
19594
|
}
|
|
19531
19595
|
function normalizeAbsolute(filePath) {
|
|
19532
|
-
const resolved =
|
|
19596
|
+
const resolved = path26.resolve(filePath);
|
|
19533
19597
|
try {
|
|
19534
19598
|
return realpathSync2(resolved).replace(/\\/g, "/");
|
|
19535
19599
|
} catch {
|
|
19536
19600
|
try {
|
|
19537
|
-
return
|
|
19601
|
+
return path26.join(realpathSync2(path26.dirname(resolved)), path26.basename(resolved)).replace(/\\/g, "/");
|
|
19538
19602
|
} catch {
|
|
19539
19603
|
return resolved.replace(/\\/g, "/");
|
|
19540
19604
|
}
|
|
@@ -19561,7 +19625,7 @@ function resetTouchedFiles({
|
|
|
19561
19625
|
touchedFilesPath({ workingDirectory, missionId }),
|
|
19562
19626
|
bashSnapshotPath({ workingDirectory, missionId })
|
|
19563
19627
|
]) {
|
|
19564
|
-
if (
|
|
19628
|
+
if (existsSync23(target)) rmSync5(target);
|
|
19565
19629
|
}
|
|
19566
19630
|
} catch {
|
|
19567
19631
|
}
|
|
@@ -19572,7 +19636,7 @@ function resetRationaleNotes({
|
|
|
19572
19636
|
}) {
|
|
19573
19637
|
try {
|
|
19574
19638
|
const target = rationaleNotesPath({ workingDirectory, missionId });
|
|
19575
|
-
if (
|
|
19639
|
+
if (existsSync23(target)) rmSync5(target);
|
|
19576
19640
|
} catch {
|
|
19577
19641
|
}
|
|
19578
19642
|
}
|
|
@@ -19587,8 +19651,8 @@ function readRationaleNotes({
|
|
|
19587
19651
|
}) {
|
|
19588
19652
|
try {
|
|
19589
19653
|
const target = rationaleNotesPath({ workingDirectory, missionId });
|
|
19590
|
-
if (!
|
|
19591
|
-
const raw = JSON.parse(
|
|
19654
|
+
if (!existsSync23(target)) return [];
|
|
19655
|
+
const raw = JSON.parse(readFileSync18(target, "utf8"));
|
|
19592
19656
|
if (!Array.isArray(raw.notes)) return [];
|
|
19593
19657
|
return raw.notes.flatMap((note) => {
|
|
19594
19658
|
if (typeof note !== "object" || note === null || typeof note.filePath !== "string") {
|
|
@@ -19622,7 +19686,7 @@ function recordRationaleNotes({
|
|
|
19622
19686
|
intent: truncateNoteText(note.intent),
|
|
19623
19687
|
transcriptContext: truncateNoteText(note.transcriptContext)
|
|
19624
19688
|
})).filter((note) => note.filePath).map((note) => {
|
|
19625
|
-
const absolute = normalizeAbsolute(
|
|
19689
|
+
const absolute = normalizeAbsolute(path26.resolve(workingDirectory, note.filePath));
|
|
19626
19690
|
return {
|
|
19627
19691
|
filePath: absolute,
|
|
19628
19692
|
toolName: note.toolName,
|
|
@@ -19630,14 +19694,14 @@ function recordRationaleNotes({
|
|
|
19630
19694
|
transcriptContext: note.transcriptContext,
|
|
19631
19695
|
contentHash: hashWorktreeFile({
|
|
19632
19696
|
workingDirectory,
|
|
19633
|
-
filePath:
|
|
19697
|
+
filePath: path26.relative(workingDirectory, absolute)
|
|
19634
19698
|
}),
|
|
19635
19699
|
recordedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
19636
19700
|
};
|
|
19637
19701
|
});
|
|
19638
19702
|
if (additions.length === 0) return;
|
|
19639
19703
|
const target = rationaleNotesPath({ workingDirectory, missionId });
|
|
19640
|
-
mkdirSync11(
|
|
19704
|
+
mkdirSync11(path26.dirname(target), { recursive: true });
|
|
19641
19705
|
const prior = readRationaleNotes({ workingDirectory, missionId });
|
|
19642
19706
|
const notesToKeep = [...prior, ...additions].slice(-200);
|
|
19643
19707
|
writeFileSync10(
|
|
@@ -19653,16 +19717,16 @@ function recordTouchedFiles({
|
|
|
19653
19717
|
files
|
|
19654
19718
|
}) {
|
|
19655
19719
|
try {
|
|
19656
|
-
const additions = files.map((filePath) => (filePath ?? "").trim()).filter(Boolean).map((filePath) => normalizeAbsolute(
|
|
19720
|
+
const additions = files.map((filePath) => (filePath ?? "").trim()).filter(Boolean).map((filePath) => normalizeAbsolute(path26.resolve(workingDirectory, filePath)));
|
|
19657
19721
|
if (additions.length === 0) return;
|
|
19658
19722
|
const target = touchedFilesPath({ workingDirectory, missionId });
|
|
19659
|
-
mkdirSync11(
|
|
19723
|
+
mkdirSync11(path26.dirname(target), { recursive: true });
|
|
19660
19724
|
const existing = readTouchedLog({ workingDirectory, missionId })?.paths ?? /* @__PURE__ */ new Set();
|
|
19661
19725
|
for (const filePath of additions) existing.add(filePath);
|
|
19662
19726
|
writeFileSync10(
|
|
19663
19727
|
target,
|
|
19664
19728
|
JSON.stringify({
|
|
19665
|
-
workingDirectory:
|
|
19729
|
+
workingDirectory: path26.resolve(workingDirectory),
|
|
19666
19730
|
missionId,
|
|
19667
19731
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19668
19732
|
paths: Array.from(existing)
|
|
@@ -19675,7 +19739,7 @@ function hasTouchedFilesLog({
|
|
|
19675
19739
|
workingDirectory,
|
|
19676
19740
|
missionId
|
|
19677
19741
|
}) {
|
|
19678
|
-
return
|
|
19742
|
+
return existsSync23(touchedFilesPath({ workingDirectory, missionId }));
|
|
19679
19743
|
}
|
|
19680
19744
|
function readTouchedLog({
|
|
19681
19745
|
workingDirectory,
|
|
@@ -19683,8 +19747,8 @@ function readTouchedLog({
|
|
|
19683
19747
|
}) {
|
|
19684
19748
|
try {
|
|
19685
19749
|
const target = touchedFilesPath({ workingDirectory, missionId });
|
|
19686
|
-
if (!
|
|
19687
|
-
const raw = JSON.parse(
|
|
19750
|
+
if (!existsSync23(target)) return null;
|
|
19751
|
+
const raw = JSON.parse(readFileSync18(target, "utf8"));
|
|
19688
19752
|
const result = /* @__PURE__ */ new Set();
|
|
19689
19753
|
if (Array.isArray(raw.paths)) {
|
|
19690
19754
|
for (const entry of raw.paths) {
|
|
@@ -19717,9 +19781,9 @@ function writeBaseline({
|
|
|
19717
19781
|
}) {
|
|
19718
19782
|
try {
|
|
19719
19783
|
const target = baselineFilePath({ workingDirectory, missionId });
|
|
19720
|
-
mkdirSync11(
|
|
19784
|
+
mkdirSync11(path26.dirname(target), { recursive: true });
|
|
19721
19785
|
const snapshot = {
|
|
19722
|
-
workingDirectory:
|
|
19786
|
+
workingDirectory: path26.resolve(workingDirectory),
|
|
19723
19787
|
missionId,
|
|
19724
19788
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19725
19789
|
files: snapshotBaselineFiles({ workingDirectory, files })
|
|
@@ -19736,13 +19800,13 @@ function readPeerTouchedClaims({
|
|
|
19736
19800
|
readActiveSessions(workingDirectory).map((entry) => entry.missionId.trim()).filter(Boolean)
|
|
19737
19801
|
);
|
|
19738
19802
|
if (activeMissionIds.size === 0) return [];
|
|
19739
|
-
const directory =
|
|
19740
|
-
if (!
|
|
19803
|
+
const directory = path26.join(resolveGlobalDataDir(), "vcs-touched");
|
|
19804
|
+
if (!existsSync23(directory)) return [];
|
|
19741
19805
|
const claims = [];
|
|
19742
|
-
for (const name of
|
|
19806
|
+
for (const name of readdirSync5(directory)) {
|
|
19743
19807
|
if (!name.endsWith(".json") || name.endsWith(".bash-snapshot.json")) continue;
|
|
19744
19808
|
try {
|
|
19745
|
-
const raw = JSON.parse(
|
|
19809
|
+
const raw = JSON.parse(readFileSync18(path26.join(directory, name), "utf8"));
|
|
19746
19810
|
const candidateMissionId = typeof raw.missionId === "string" && raw.missionId.trim() ? raw.missionId.trim() : null;
|
|
19747
19811
|
if (!candidateMissionId || candidateMissionId === missionId) continue;
|
|
19748
19812
|
if (!activeMissionIds.has(candidateMissionId)) continue;
|
|
@@ -19767,8 +19831,8 @@ function readBaselineSnapshot({
|
|
|
19767
19831
|
}) {
|
|
19768
19832
|
try {
|
|
19769
19833
|
const target = baselineFilePath({ workingDirectory, missionId });
|
|
19770
|
-
if (!
|
|
19771
|
-
const raw = JSON.parse(
|
|
19834
|
+
if (!existsSync23(target)) return /* @__PURE__ */ new Map();
|
|
19835
|
+
const raw = JSON.parse(readFileSync18(target, "utf8"));
|
|
19772
19836
|
if (Array.isArray(raw.files)) {
|
|
19773
19837
|
const byPath = /* @__PURE__ */ new Map();
|
|
19774
19838
|
for (const entry of raw.files) {
|
|
@@ -19862,10 +19926,10 @@ function compileIgnorePattern(rawPattern) {
|
|
|
19862
19926
|
}
|
|
19863
19927
|
function loadIgnoreRules(repoRoot) {
|
|
19864
19928
|
try {
|
|
19865
|
-
const target =
|
|
19866
|
-
if (!
|
|
19929
|
+
const target = path26.join(repoRoot, OVERLORD_IGNORE_FILENAME);
|
|
19930
|
+
if (!existsSync23(target)) return [];
|
|
19867
19931
|
const rules = [];
|
|
19868
|
-
for (const rawLine of
|
|
19932
|
+
for (const rawLine of readFileSync18(target, "utf8").split("\n")) {
|
|
19869
19933
|
const line = rawLine.replace(/\r$/, "").trim();
|
|
19870
19934
|
if (!line || line.startsWith("#")) continue;
|
|
19871
19935
|
const rule = compileIgnorePattern(line);
|
|
@@ -19899,7 +19963,7 @@ function filterRunAttributableChanges({
|
|
|
19899
19963
|
return [];
|
|
19900
19964
|
}
|
|
19901
19965
|
if (!touched) return [{ filePath: entry.filePath, vcsStatus: entry.vcsStatus }];
|
|
19902
|
-
const absolute = normalizeAbsolute(
|
|
19966
|
+
const absolute = normalizeAbsolute(path26.resolve(repoRoot, entry.filePath));
|
|
19903
19967
|
if (touched.paths.has(absolute)) {
|
|
19904
19968
|
return [
|
|
19905
19969
|
{
|
|
@@ -19930,7 +19994,7 @@ function filterRunAttributableChanges({
|
|
|
19930
19994
|
});
|
|
19931
19995
|
}
|
|
19932
19996
|
function titleFromPath(filePath) {
|
|
19933
|
-
const base =
|
|
19997
|
+
const base = path26.basename(filePath).replace(/\.[^.]+$/, "");
|
|
19934
19998
|
const words = base.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim();
|
|
19935
19999
|
if (!words) return `Update ${filePath}`;
|
|
19936
20000
|
return `Update ${words.replace(/\b\w/g, (char) => char.toUpperCase())}`;
|
|
@@ -19953,7 +20017,7 @@ function draftChangeRationalesFromNotes({
|
|
|
19953
20017
|
if (notes.length === 0 || files.length === 0) return [];
|
|
19954
20018
|
const repoRoot = gitRepoRoot(workingDirectory) ?? workingDirectory;
|
|
19955
20019
|
return files.flatMap((file) => {
|
|
19956
|
-
const absolute = normalizeAbsolute(
|
|
20020
|
+
const absolute = normalizeAbsolute(path26.resolve(repoRoot, file.filePath));
|
|
19957
20021
|
const currentHash = hashWorktreeFile({ workingDirectory, filePath: file.filePath });
|
|
19958
20022
|
const note = latestRelevantNote({ notes, filePath: absolute, currentHash });
|
|
19959
20023
|
if (!note) return [];
|
|
@@ -19993,8 +20057,8 @@ var init_vcs = __esm({
|
|
|
19993
20057
|
});
|
|
19994
20058
|
|
|
19995
20059
|
// src/record-touched.ts
|
|
19996
|
-
import { readFileSync as
|
|
19997
|
-
import
|
|
20060
|
+
import { readFileSync as readFileSync19 } from "node:fs";
|
|
20061
|
+
import path27 from "node:path";
|
|
19998
20062
|
function collectCandidates(toolInput) {
|
|
19999
20063
|
const counts = /* @__PURE__ */ new Map();
|
|
20000
20064
|
const order = [];
|
|
@@ -20043,7 +20107,7 @@ function editIntent({
|
|
|
20043
20107
|
function recentAssistantContext(transcriptPath) {
|
|
20044
20108
|
if (typeof transcriptPath !== "string" || !transcriptPath.trim()) return null;
|
|
20045
20109
|
try {
|
|
20046
|
-
const lines2 =
|
|
20110
|
+
const lines2 = readFileSync19(transcriptPath, "utf8").split("\n").slice(-200);
|
|
20047
20111
|
for (let index = lines2.length - 1; index >= 0; index -= 1) {
|
|
20048
20112
|
const line = lines2[index]?.trim();
|
|
20049
20113
|
if (!line) continue;
|
|
@@ -20093,7 +20157,7 @@ function recordTouchedFromPayload({
|
|
|
20093
20157
|
const toolInput = toolInputRaw && typeof toolInputRaw === "object" ? toolInputRaw : {};
|
|
20094
20158
|
const toolName = typeof payload.tool_name === "string" && payload.tool_name.trim() ? payload.tool_name.trim() : "file edit";
|
|
20095
20159
|
const cwd = typeof payload.cwd === "string" && payload.cwd.trim() ? payload.cwd.trim() : fallbackCwd;
|
|
20096
|
-
const workingDirectory =
|
|
20160
|
+
const workingDirectory = path27.resolve(cwd);
|
|
20097
20161
|
const trimmedOverride = missionOverride?.trim();
|
|
20098
20162
|
let missionId;
|
|
20099
20163
|
let ambiguous = false;
|
|
@@ -20197,23 +20261,23 @@ var init_resource_observations = __esm({
|
|
|
20197
20261
|
|
|
20198
20262
|
// src/runner-identity.ts
|
|
20199
20263
|
import { randomUUID } from "node:crypto";
|
|
20200
|
-
import { existsSync as
|
|
20264
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync20, writeFileSync as writeFileSync11 } from "node:fs";
|
|
20201
20265
|
import { hostname as hostname4 } from "node:os";
|
|
20202
|
-
import
|
|
20266
|
+
import path28 from "node:path";
|
|
20203
20267
|
function envValue(name) {
|
|
20204
20268
|
const value = process.env[name]?.trim();
|
|
20205
20269
|
return value && value.length > 0 ? value : null;
|
|
20206
20270
|
}
|
|
20207
20271
|
function runnerInstanceStatePath(dataDir = resolveGlobalDataDir()) {
|
|
20208
|
-
return
|
|
20272
|
+
return path28.join(dataDir, RUNNER_INSTANCE_STATE_FILENAME);
|
|
20209
20273
|
}
|
|
20210
20274
|
function resolveRunnerInstanceId(dataDir = resolveGlobalDataDir()) {
|
|
20211
20275
|
const pinned = envValue("OVERLORD_RUNNER_INSTANCE_ID");
|
|
20212
20276
|
if (pinned) return pinned;
|
|
20213
20277
|
const statePath = runnerInstanceStatePath(dataDir);
|
|
20214
|
-
if (
|
|
20278
|
+
if (existsSync24(statePath)) {
|
|
20215
20279
|
try {
|
|
20216
|
-
const parsed = JSON.parse(
|
|
20280
|
+
const parsed = JSON.parse(readFileSync20(statePath, "utf8"));
|
|
20217
20281
|
if (typeof parsed.runnerInstanceId === "string" && parsed.runnerInstanceId.trim()) {
|
|
20218
20282
|
return parsed.runnerInstanceId.trim();
|
|
20219
20283
|
}
|
|
@@ -20222,7 +20286,7 @@ function resolveRunnerInstanceId(dataDir = resolveGlobalDataDir()) {
|
|
|
20222
20286
|
}
|
|
20223
20287
|
const runnerInstanceId = randomUUID();
|
|
20224
20288
|
try {
|
|
20225
|
-
mkdirSync12(
|
|
20289
|
+
mkdirSync12(path28.dirname(statePath), { recursive: true });
|
|
20226
20290
|
writeFileSync11(statePath, `${JSON.stringify({ runnerInstanceId }, null, 2)}
|
|
20227
20291
|
`, { mode: 384 });
|
|
20228
20292
|
} catch {
|
|
@@ -20265,9 +20329,9 @@ var init_runner_identity = __esm({
|
|
|
20265
20329
|
|
|
20266
20330
|
// src/runner-service.ts
|
|
20267
20331
|
import { execFile } from "node:child_process";
|
|
20268
|
-
import { chmodSync as chmodSync6, existsSync as
|
|
20332
|
+
import { chmodSync as chmodSync6, existsSync as existsSync25, mkdirSync as mkdirSync13, readFileSync as readFileSync21, rmSync as rmSync6, writeFileSync as writeFileSync12 } from "node:fs";
|
|
20269
20333
|
import os4 from "node:os";
|
|
20270
|
-
import
|
|
20334
|
+
import path29 from "node:path";
|
|
20271
20335
|
import { promisify } from "node:util";
|
|
20272
20336
|
function writeServiceFile(filePath, contents) {
|
|
20273
20337
|
writeFileSync12(filePath, contents, { mode: 384 });
|
|
@@ -20289,13 +20353,13 @@ function emptyRunnerServiceState() {
|
|
|
20289
20353
|
};
|
|
20290
20354
|
}
|
|
20291
20355
|
function runnerServiceStatePath(dataDir = resolveGlobalDataDir()) {
|
|
20292
|
-
return
|
|
20356
|
+
return path29.join(dataDir, RUNNER_SERVICE_STATE_FILENAME);
|
|
20293
20357
|
}
|
|
20294
20358
|
function readRunnerServiceState(dataDir = resolveGlobalDataDir()) {
|
|
20295
20359
|
const filePath = runnerServiceStatePath(dataDir);
|
|
20296
|
-
if (!
|
|
20360
|
+
if (!existsSync25(filePath)) return emptyRunnerServiceState();
|
|
20297
20361
|
try {
|
|
20298
|
-
const parsed = JSON.parse(
|
|
20362
|
+
const parsed = JSON.parse(readFileSync21(filePath, "utf8"));
|
|
20299
20363
|
return { ...emptyRunnerServiceState(), ...parsed };
|
|
20300
20364
|
} catch {
|
|
20301
20365
|
return emptyRunnerServiceState();
|
|
@@ -20312,13 +20376,13 @@ function patchRunnerServiceState(patch, dataDir = resolveGlobalDataDir()) {
|
|
|
20312
20376
|
return next;
|
|
20313
20377
|
}
|
|
20314
20378
|
function runnerFocusStatePath(dataDir = resolveGlobalDataDir()) {
|
|
20315
|
-
return
|
|
20379
|
+
return path29.join(dataDir, RUNNER_FOCUS_STATE_FILENAME);
|
|
20316
20380
|
}
|
|
20317
20381
|
function readDesktopFocusState(dataDir = resolveGlobalDataDir()) {
|
|
20318
20382
|
const filePath = runnerFocusStatePath(dataDir);
|
|
20319
|
-
if (!
|
|
20383
|
+
if (!existsSync25(filePath)) return { lastFocusedAt: null };
|
|
20320
20384
|
try {
|
|
20321
|
-
const parsed = JSON.parse(
|
|
20385
|
+
const parsed = JSON.parse(readFileSync21(filePath, "utf8"));
|
|
20322
20386
|
return { lastFocusedAt: parsed.lastFocusedAt ?? null };
|
|
20323
20387
|
} catch {
|
|
20324
20388
|
return { lastFocusedAt: null };
|
|
@@ -20349,16 +20413,16 @@ function nextRunnerLastError(pollError) {
|
|
|
20349
20413
|
function resolveOverlordAppInvocation({
|
|
20350
20414
|
platform: platform2 = process.platform,
|
|
20351
20415
|
homedir: homedir2 = os4.homedir(),
|
|
20352
|
-
exists =
|
|
20416
|
+
exists = existsSync25
|
|
20353
20417
|
} = {}) {
|
|
20354
20418
|
if (platform2 !== "darwin") return null;
|
|
20355
20419
|
const appDirs = [
|
|
20356
20420
|
"/Applications/Overlord.app",
|
|
20357
|
-
|
|
20421
|
+
path29.join(homedir2, "Applications", "Overlord.app")
|
|
20358
20422
|
];
|
|
20359
20423
|
for (const appDir of appDirs) {
|
|
20360
|
-
const program =
|
|
20361
|
-
const script =
|
|
20424
|
+
const program = path29.join(appDir, "Contents", "MacOS", "Overlord");
|
|
20425
|
+
const script = path29.join(appDir, "Contents", "Resources", "cli", "bin", "ovld.mjs");
|
|
20362
20426
|
if (exists(program) && exists(script)) {
|
|
20363
20427
|
return { program, args: [script, "runner", "supervise"], runAsElectronNode: true };
|
|
20364
20428
|
}
|
|
@@ -20370,7 +20434,7 @@ function resolveOvldInvocation(argv = process.argv, execPath = process.execPath)
|
|
|
20370
20434
|
if (override) {
|
|
20371
20435
|
return { program: override, args: ["runner", "supervise"] };
|
|
20372
20436
|
}
|
|
20373
|
-
const scriptPath = argv[1] ?
|
|
20437
|
+
const scriptPath = argv[1] ? path29.resolve(argv[1]) : "";
|
|
20374
20438
|
if (process.env.ELECTRON_RUN_AS_NODE) {
|
|
20375
20439
|
return scriptPath ? { program: execPath, args: [scriptPath, "runner", "supervise"], runAsElectronNode: true } : { program: execPath, args: ["runner", "supervise"], runAsElectronNode: true };
|
|
20376
20440
|
}
|
|
@@ -20403,7 +20467,7 @@ function buildRunnerServiceEnv({
|
|
|
20403
20467
|
PATH: process.env.PATH?.trim() || "/usr/local/bin:/usr/bin:/bin"
|
|
20404
20468
|
};
|
|
20405
20469
|
const home = overlordHome?.trim() || process.env.OVLD_HOME?.trim();
|
|
20406
|
-
if (home) env.OVLD_HOME =
|
|
20470
|
+
if (home) env.OVLD_HOME = path29.resolve(home);
|
|
20407
20471
|
const token = process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim();
|
|
20408
20472
|
if (token) env.OVERLORD_USER_TOKEN = token;
|
|
20409
20473
|
if (runAsElectronNode || process.env.ELECTRON_RUN_AS_NODE) env.ELECTRON_RUN_AS_NODE = "1";
|
|
@@ -20442,9 +20506,9 @@ ${envEntries}
|
|
|
20442
20506
|
<key>KeepAlive</key>
|
|
20443
20507
|
<true/>
|
|
20444
20508
|
<key>StandardOutPath</key>
|
|
20445
|
-
<string>${xmlEscape(
|
|
20509
|
+
<string>${xmlEscape(path29.join(logDir, "runner-service.out.log"))}</string>
|
|
20446
20510
|
<key>StandardErrorPath</key>
|
|
20447
|
-
<string>${xmlEscape(
|
|
20511
|
+
<string>${xmlEscape(path29.join(logDir, "runner-service.err.log"))}</string>
|
|
20448
20512
|
<key>ProcessType</key>
|
|
20449
20513
|
<string>Background</string>
|
|
20450
20514
|
</dict>
|
|
@@ -20475,12 +20539,12 @@ WantedBy=default.target
|
|
|
20475
20539
|
`;
|
|
20476
20540
|
}
|
|
20477
20541
|
function launchAgentsDir() {
|
|
20478
|
-
return
|
|
20542
|
+
return path29.join(os4.homedir(), "Library", "LaunchAgents");
|
|
20479
20543
|
}
|
|
20480
20544
|
function systemdUserDir() {
|
|
20481
20545
|
const xdg = process.env.XDG_CONFIG_HOME?.trim();
|
|
20482
|
-
const base = xdg ?
|
|
20483
|
-
return
|
|
20546
|
+
const base = xdg ? path29.resolve(xdg) : path29.join(os4.homedir(), ".config");
|
|
20547
|
+
return path29.join(base, "systemd", "user");
|
|
20484
20548
|
}
|
|
20485
20549
|
async function runCommand(program, args) {
|
|
20486
20550
|
const { stdout } = await execFileAsync(program, args);
|
|
@@ -20509,19 +20573,19 @@ var init_runner_service = __esm({
|
|
|
20509
20573
|
kind = "launchd";
|
|
20510
20574
|
identifier = LAUNCHD_LABEL;
|
|
20511
20575
|
unitPath() {
|
|
20512
|
-
return
|
|
20576
|
+
return path29.join(launchAgentsDir(), `${LAUNCHD_LABEL}.plist`);
|
|
20513
20577
|
}
|
|
20514
20578
|
render(opts) {
|
|
20515
20579
|
return renderLaunchdPlist({
|
|
20516
20580
|
label: LAUNCHD_LABEL,
|
|
20517
20581
|
invocation: opts.invocation,
|
|
20518
20582
|
env: opts.env,
|
|
20519
|
-
logDir:
|
|
20583
|
+
logDir: path29.join(resolveGlobalDataDir(), "logs")
|
|
20520
20584
|
});
|
|
20521
20585
|
}
|
|
20522
20586
|
async install(opts) {
|
|
20523
20587
|
mkdirSync13(launchAgentsDir(), { recursive: true });
|
|
20524
|
-
mkdirSync13(
|
|
20588
|
+
mkdirSync13(path29.join(resolveGlobalDataDir(), "logs"), { recursive: true });
|
|
20525
20589
|
writeServiceFile(this.unitPath(), this.render(opts));
|
|
20526
20590
|
if (opts.autoStart) await this.start();
|
|
20527
20591
|
}
|
|
@@ -20551,10 +20615,10 @@ var init_runner_service = __esm({
|
|
|
20551
20615
|
await this.stop();
|
|
20552
20616
|
} catch {
|
|
20553
20617
|
}
|
|
20554
|
-
if (
|
|
20618
|
+
if (existsSync25(this.unitPath())) rmSync6(this.unitPath());
|
|
20555
20619
|
}
|
|
20556
20620
|
async status() {
|
|
20557
|
-
const installed =
|
|
20621
|
+
const installed = existsSync25(this.unitPath());
|
|
20558
20622
|
try {
|
|
20559
20623
|
const { stdout } = await runCommand("launchctl", ["list"]);
|
|
20560
20624
|
const line = stdout.split("\n").find((row) => row.includes(LAUNCHD_LABEL));
|
|
@@ -20570,7 +20634,7 @@ var init_runner_service = __esm({
|
|
|
20570
20634
|
kind = "systemd";
|
|
20571
20635
|
identifier = `${SYSTEMD_UNIT_NAME}.service`;
|
|
20572
20636
|
unitPath() {
|
|
20573
|
-
return
|
|
20637
|
+
return path29.join(systemdUserDir(), `${SYSTEMD_UNIT_NAME}.service`);
|
|
20574
20638
|
}
|
|
20575
20639
|
render(opts) {
|
|
20576
20640
|
return renderSystemdUnit(opts);
|
|
@@ -20597,14 +20661,14 @@ var init_runner_service = __esm({
|
|
|
20597
20661
|
await runCommand("systemctl", ["--user", "disable", this.identifier]);
|
|
20598
20662
|
} catch {
|
|
20599
20663
|
}
|
|
20600
|
-
if (
|
|
20664
|
+
if (existsSync25(this.unitPath())) rmSync6(this.unitPath());
|
|
20601
20665
|
try {
|
|
20602
20666
|
await runCommand("systemctl", ["--user", "daemon-reload"]);
|
|
20603
20667
|
} catch {
|
|
20604
20668
|
}
|
|
20605
20669
|
}
|
|
20606
20670
|
async status() {
|
|
20607
|
-
const installed =
|
|
20671
|
+
const installed = existsSync25(this.unitPath());
|
|
20608
20672
|
try {
|
|
20609
20673
|
const { stdout } = await runCommand("systemctl", ["--user", "is-active", this.identifier]);
|
|
20610
20674
|
return { installed, running: stdout.trim() === "active" ? "running" : "stopped" };
|
|
@@ -20671,14 +20735,14 @@ var init_select_prompt = __esm({
|
|
|
20671
20735
|
|
|
20672
20736
|
// src/session-key.ts
|
|
20673
20737
|
import { createHash as createHash10 } from "node:crypto";
|
|
20674
|
-
import { existsSync as
|
|
20675
|
-
import
|
|
20738
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync14, readFileSync as readFileSync22, rmSync as rmSync7, writeFileSync as writeFileSync13 } from "node:fs";
|
|
20739
|
+
import path30 from "node:path";
|
|
20676
20740
|
function sessionKeyCachePath({
|
|
20677
20741
|
missionId,
|
|
20678
20742
|
workingDirectory
|
|
20679
20743
|
}) {
|
|
20680
|
-
const key = createHash10("sha256").update(`${
|
|
20681
|
-
return
|
|
20744
|
+
const key = createHash10("sha256").update(`${path30.resolve(workingDirectory)}\0${missionId}`).digest("hex");
|
|
20745
|
+
return path30.join(resolveGlobalDataDir(), "protocol-session-keys", key);
|
|
20682
20746
|
}
|
|
20683
20747
|
function readCachedSessionKey({
|
|
20684
20748
|
missionId,
|
|
@@ -20686,8 +20750,8 @@ function readCachedSessionKey({
|
|
|
20686
20750
|
}) {
|
|
20687
20751
|
try {
|
|
20688
20752
|
const filePath = sessionKeyCachePath({ missionId, workingDirectory });
|
|
20689
|
-
if (!
|
|
20690
|
-
const raw = JSON.parse(
|
|
20753
|
+
if (!existsSync26(filePath)) return void 0;
|
|
20754
|
+
const raw = JSON.parse(readFileSync22(filePath, "utf8"));
|
|
20691
20755
|
return typeof raw.sessionKey === "string" && raw.sessionKey.trim() ? raw.sessionKey.trim() : void 0;
|
|
20692
20756
|
} catch {
|
|
20693
20757
|
return void 0;
|
|
@@ -20702,7 +20766,7 @@ function writeCachedSessionKey({
|
|
|
20702
20766
|
const trimmed = sessionKey.trim();
|
|
20703
20767
|
if (!trimmed) return;
|
|
20704
20768
|
const filePath = sessionKeyCachePath({ missionId, workingDirectory });
|
|
20705
|
-
mkdirSync14(
|
|
20769
|
+
mkdirSync14(path30.dirname(filePath), { recursive: true });
|
|
20706
20770
|
writeFileSync13(
|
|
20707
20771
|
filePath,
|
|
20708
20772
|
JSON.stringify({ sessionKey: trimmed, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
@@ -20717,7 +20781,7 @@ function clearCachedSessionKey({
|
|
|
20717
20781
|
}) {
|
|
20718
20782
|
try {
|
|
20719
20783
|
const filePath = sessionKeyCachePath({ missionId, workingDirectory });
|
|
20720
|
-
if (
|
|
20784
|
+
if (existsSync26(filePath)) rmSync7(filePath);
|
|
20721
20785
|
} catch {
|
|
20722
20786
|
}
|
|
20723
20787
|
}
|
|
@@ -20735,9 +20799,9 @@ __export(commands_exports, {
|
|
|
20735
20799
|
runManagementCommand: () => runManagementCommand,
|
|
20736
20800
|
runProtocolCommand: () => runProtocolCommand
|
|
20737
20801
|
});
|
|
20738
|
-
import { existsSync as
|
|
20802
|
+
import { existsSync as existsSync27, readFileSync as readFileSync23 } from "node:fs";
|
|
20739
20803
|
import os5 from "node:os";
|
|
20740
|
-
import
|
|
20804
|
+
import path31 from "node:path";
|
|
20741
20805
|
function resourceAccessModeBody(value) {
|
|
20742
20806
|
if (typeof value !== "string") return {};
|
|
20743
20807
|
const normalized = value.trim().toLowerCase();
|
|
@@ -20783,7 +20847,7 @@ function readChangedFilesFromFlags(flags, stdin) {
|
|
|
20783
20847
|
if (typeof fileFlag === "string") {
|
|
20784
20848
|
const raw = fileFlag === "-" ? stdin ?? "" : (() => {
|
|
20785
20849
|
try {
|
|
20786
|
-
return
|
|
20850
|
+
return readFileSync23(fileFlag, "utf8");
|
|
20787
20851
|
} catch {
|
|
20788
20852
|
return "";
|
|
20789
20853
|
}
|
|
@@ -20835,7 +20899,7 @@ function readJsonFlagContent({
|
|
|
20835
20899
|
if (typeof filePath === "string") {
|
|
20836
20900
|
if (fileInputs[fileFlag] !== void 0) return fileInputs[fileFlag];
|
|
20837
20901
|
try {
|
|
20838
|
-
return
|
|
20902
|
+
return readFileSync23(filePath, "utf8");
|
|
20839
20903
|
} catch {
|
|
20840
20904
|
return void 0;
|
|
20841
20905
|
}
|
|
@@ -21139,7 +21203,7 @@ async function resolveProtocolFileInputs({
|
|
|
21139
21203
|
} else if (process.stdin.isTTY) {
|
|
21140
21204
|
stdinContent = "";
|
|
21141
21205
|
} else {
|
|
21142
|
-
stdinContent =
|
|
21206
|
+
stdinContent = readFileSync23(0, "utf8");
|
|
21143
21207
|
}
|
|
21144
21208
|
return stdinContent;
|
|
21145
21209
|
};
|
|
@@ -21153,7 +21217,7 @@ async function resolveProtocolFileInputs({
|
|
|
21153
21217
|
fileInputs[flagName] = content;
|
|
21154
21218
|
stdinPayload = content;
|
|
21155
21219
|
} else {
|
|
21156
|
-
fileInputs[flagName] =
|
|
21220
|
+
fileInputs[flagName] = readFileSync23(filePath, "utf8");
|
|
21157
21221
|
}
|
|
21158
21222
|
}
|
|
21159
21223
|
if (stdinPayload === void 0 && stdin !== void 0 && Object.keys(fileInputs).length === 0) {
|
|
@@ -21190,8 +21254,27 @@ async function runProtocolCommand({
|
|
|
21190
21254
|
if (subcommand === "attach" && typeof flags["--execution-request-id"] !== "string" && process.env.OVERLORD_EXECUTION_REQUEST_ID) {
|
|
21191
21255
|
flags["--execution-request-id"] = process.env.OVERLORD_EXECUTION_REQUEST_ID;
|
|
21192
21256
|
}
|
|
21193
|
-
if (subcommand === "attach"
|
|
21194
|
-
flags["--session-channel-id"]
|
|
21257
|
+
if (subcommand === "attach") {
|
|
21258
|
+
const needsChannelId = typeof flags["--session-channel-id"] !== "string";
|
|
21259
|
+
const needsExecutionRequestId = typeof flags["--execution-request-id"] !== "string";
|
|
21260
|
+
if (needsChannelId && process.env.OVERLORD_SESSION_CHANNEL_ID) {
|
|
21261
|
+
flags["--session-channel-id"] = process.env.OVERLORD_SESSION_CHANNEL_ID;
|
|
21262
|
+
}
|
|
21263
|
+
if (needsChannelId && typeof flags["--session-channel-id"] !== "string" || needsExecutionRequestId && typeof flags["--execution-request-id"] !== "string") {
|
|
21264
|
+
const missionHint = (typeof missionId === "string" && missionId.trim() ? missionId.trim() : null) ?? process.env.MISSION_ID ?? process.env.OVERLORD_MISSION_ID ?? null;
|
|
21265
|
+
if (missionHint) {
|
|
21266
|
+
const recovered = recoverLaunchBootstrapFromProjectTmp({
|
|
21267
|
+
workingDirectory,
|
|
21268
|
+
missionId: missionHint
|
|
21269
|
+
});
|
|
21270
|
+
if (needsChannelId && recovered.sessionChannelId) {
|
|
21271
|
+
flags["--session-channel-id"] = recovered.sessionChannelId;
|
|
21272
|
+
}
|
|
21273
|
+
if (needsExecutionRequestId && recovered.executionRequestId) {
|
|
21274
|
+
flags["--execution-request-id"] = recovered.executionRequestId;
|
|
21275
|
+
}
|
|
21276
|
+
}
|
|
21277
|
+
}
|
|
21195
21278
|
}
|
|
21196
21279
|
const { fileInputs, stdin: protocolStdin } = await resolveProtocolFileInputs({
|
|
21197
21280
|
flags: parsed.flags,
|
|
@@ -21199,7 +21282,7 @@ async function runProtocolCommand({
|
|
|
21199
21282
|
});
|
|
21200
21283
|
if (subcommand === "record-touched") {
|
|
21201
21284
|
const missionOverride = flagValue(parsed.flags, "--mission-id") ?? process.env.MISSION_ID ?? process.env.OVERLORD_MISSION_ID;
|
|
21202
|
-
const rawPayload = stdin ?? (process.stdin.isTTY ? "" :
|
|
21285
|
+
const rawPayload = stdin ?? (process.stdin.isTTY ? "" : readFileSync23(0, "utf8"));
|
|
21203
21286
|
const result2 = recordTouchedFromPayload({
|
|
21204
21287
|
rawPayload,
|
|
21205
21288
|
missionOverride,
|
|
@@ -21345,8 +21428,8 @@ async function runProtocolCommand({
|
|
|
21345
21428
|
clearCachedSessionKey({ missionId, workingDirectory });
|
|
21346
21429
|
removeActiveSession({ workingDirectory, missionId });
|
|
21347
21430
|
clearActiveMissionPointer(workingDirectory);
|
|
21348
|
-
const connectorInstallsEditHook =
|
|
21349
|
-
|
|
21431
|
+
const connectorInstallsEditHook = existsSync27(path31.join(os5.homedir(), ".claude")) || existsSync27(
|
|
21432
|
+
path31.join(
|
|
21350
21433
|
os5.homedir(),
|
|
21351
21434
|
".cursor",
|
|
21352
21435
|
"plugins",
|
|
@@ -21446,7 +21529,7 @@ async function runManagementCommand({
|
|
|
21446
21529
|
case "add-cwd": {
|
|
21447
21530
|
const directory = flagValue(parsed.flags, "--directory") ?? process.cwd();
|
|
21448
21531
|
const existingProjectJson = readProjectJsonLink(
|
|
21449
|
-
|
|
21532
|
+
path31.join(directory, ".overlord", "project.json")
|
|
21450
21533
|
);
|
|
21451
21534
|
const resourceKey = flagValue(parsed.flags, "--key") ?? existingProjectJson?.resourceKey;
|
|
21452
21535
|
let projectId = flagValue(parsed.flags, "--project-id");
|
|
@@ -21837,13 +21920,13 @@ async function runManagementCommand({
|
|
|
21837
21920
|
rationales: `/api/missions/${encodeURIComponent(missionId)}/file-changes`,
|
|
21838
21921
|
deliveries: `/api/missions/${encodeURIComponent(missionId)}/deliveries`
|
|
21839
21922
|
};
|
|
21840
|
-
const
|
|
21841
|
-
if (!
|
|
21923
|
+
const path32 = sub ? pathBySub[sub] : void 0;
|
|
21924
|
+
if (!path32) {
|
|
21842
21925
|
throw new CliError({
|
|
21843
21926
|
message: "Usage: ovld mission context|events|deliveries|artifacts|rationales <missionId> [--json]"
|
|
21844
21927
|
});
|
|
21845
21928
|
}
|
|
21846
|
-
const result = await runtime.backend.get(
|
|
21929
|
+
const result = await runtime.backend.get(path32);
|
|
21847
21930
|
if (json || sub === "context") printJson(result);
|
|
21848
21931
|
else if (Array.isArray(result)) for (const row of result) console.log(JSON.stringify(row));
|
|
21849
21932
|
else printJson(result);
|
|
@@ -22209,6 +22292,7 @@ var init_commands = __esm({
|
|
|
22209
22292
|
init_discover_project_local();
|
|
22210
22293
|
init_errors();
|
|
22211
22294
|
init_launch();
|
|
22295
|
+
init_launch_bootstrap();
|
|
22212
22296
|
init_mission_link();
|
|
22213
22297
|
init_native_session();
|
|
22214
22298
|
init_org_setup();
|
|
@@ -22439,6 +22523,7 @@ Execution targets:
|
|
|
22439
22523
|
|
|
22440
22524
|
Missions:
|
|
22441
22525
|
${primaryCommand} create "<objective>" [--objectives-json '[...]'] [--json]
|
|
22526
|
+
${primaryCommand} inbox create --title "<title>" --objective "<objective>" [--json]
|
|
22442
22527
|
${primaryCommand} prompt "<objective>" [--json]
|
|
22443
22528
|
${primaryCommand} attach <missionId> [agent] [--json]
|
|
22444
22529
|
${primaryCommand} missions list [--status <csv>] [--project-id <id>] [--json]
|
|
@@ -22523,6 +22608,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
22523
22608
|
"missions",
|
|
22524
22609
|
"requests",
|
|
22525
22610
|
"inputs",
|
|
22611
|
+
"inbox",
|
|
22526
22612
|
"mission",
|
|
22527
22613
|
"changes",
|
|
22528
22614
|
"execution",
|
|
@@ -22612,6 +22698,29 @@ async function dispatchCommand({
|
|
|
22612
22698
|
}
|
|
22613
22699
|
return;
|
|
22614
22700
|
}
|
|
22701
|
+
case "inbox": {
|
|
22702
|
+
const [subcommand, ...rest] = args;
|
|
22703
|
+
if (subcommand !== "create") {
|
|
22704
|
+
throw new CliError({
|
|
22705
|
+
message: "Usage: ovld inbox create --title <title> --objective <objective>"
|
|
22706
|
+
});
|
|
22707
|
+
}
|
|
22708
|
+
const { openCliRuntime: openCliRuntime2 } = await Promise.resolve().then(() => (init_runtime(), runtime_exports));
|
|
22709
|
+
const { runProtocolCommand: runProtocolCommand2 } = await Promise.resolve().then(() => (init_commands(), commands_exports));
|
|
22710
|
+
const runtime = openCliRuntime2();
|
|
22711
|
+
try {
|
|
22712
|
+
await runProtocolCommand2({
|
|
22713
|
+
runtime,
|
|
22714
|
+
subcommand: "create",
|
|
22715
|
+
args: ["--inbox", ...rest],
|
|
22716
|
+
stdin,
|
|
22717
|
+
primaryCommand
|
|
22718
|
+
});
|
|
22719
|
+
} finally {
|
|
22720
|
+
runtime.close();
|
|
22721
|
+
}
|
|
22722
|
+
return;
|
|
22723
|
+
}
|
|
22615
22724
|
default: {
|
|
22616
22725
|
if (!KNOWN_COMMANDS.has(command)) {
|
|
22617
22726
|
throw new CliError({
|