wildcrane-runner 0.6.126 → 0.6.127
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/akb/dist/kanban.mjs +2829 -1818
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-retained.mjs +1 -1
- package/dist/flow-worker-main.mjs +2056 -995
- package/dist/launcher.mjs +113 -29
- package/dist/plugin.mjs +14056 -7357
- package/dist/runner.mjs +2780 -1705
- package/dist/settings.mjs +373 -289
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.127 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -41121,8 +41121,8 @@ function saveAlphaUpdates(value) {
|
|
|
41121
41121
|
}
|
|
41122
41122
|
|
|
41123
41123
|
// src/protocol.ts
|
|
41124
|
-
var VERSION = true ? "0.6.
|
|
41125
|
-
var AKB_VERSION = true ? "0.11.
|
|
41124
|
+
var VERSION = true ? "0.6.127" : "0.0.0";
|
|
41125
|
+
var AKB_VERSION = true ? "0.11.109" : "0.0.0";
|
|
41126
41126
|
var EXIT_REFUSED = 10;
|
|
41127
41127
|
var EXIT_OUTDATED = 11;
|
|
41128
41128
|
var EXIT_UPDATE = 12;
|
|
@@ -42368,7 +42368,7 @@ var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray
|
|
|
42368
42368
|
var hasText = (value) => typeof value === "string" && !!value.trim();
|
|
42369
42369
|
function temporaryCloudFailure({ code, status: status2 }) {
|
|
42370
42370
|
if (code && ["unauthenticated", "machine_offline", "quota_exceeded", "daily_write_budget_reached", "storage_limit_reached"].includes(code)) return false;
|
|
42371
|
-
return ["unreachable", "invalid_response", "idempotency_in_progress", "service_unavailable", "artifacts_unavailable"].includes(code ?? "") || status2 === 408 || (status2 !== void 0 ? status2 >= 500 : !code);
|
|
42371
|
+
return ["unreachable", "invalid_response", "idempotency_in_progress", "service_unavailable", "artifacts_unavailable", "board-busy"].includes(code ?? "") || status2 === 408 || (status2 !== void 0 ? status2 >= 500 : !code);
|
|
42372
42372
|
}
|
|
42373
42373
|
var invalidResponse = (expected) => ({ code: "invalid_response", message: `Cloud did not return ${expected}.`, retryable: true });
|
|
42374
42374
|
async function readCloudJson(response) {
|
|
@@ -43593,7 +43593,7 @@ function createTail(log) {
|
|
|
43593
43593
|
// ../cli/package.json
|
|
43594
43594
|
var package_default = {
|
|
43595
43595
|
name: "wildcrane",
|
|
43596
|
-
version: "0.11.
|
|
43596
|
+
version: "0.11.109",
|
|
43597
43597
|
akbContract: 41,
|
|
43598
43598
|
canonicalCommands: true,
|
|
43599
43599
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
@@ -44981,37 +44981,63 @@ function dayDir(root2, at) {
|
|
|
44981
44981
|
const pad = (n) => String(n).padStart(2, "0");
|
|
44982
44982
|
return join2(root2, String(day.getFullYear()), pad(day.getMonth() + 1), pad(day.getDate()));
|
|
44983
44983
|
}
|
|
44984
|
-
function
|
|
44985
|
-
|
|
44984
|
+
function matchesRollout(name, threadId) {
|
|
44985
|
+
return name.startsWith("rollout-") && name.endsWith(".jsonl") && (name.endsWith(`-${threadId}.jsonl`) || name.includes(`-${threadId}_`));
|
|
44986
|
+
}
|
|
44987
|
+
function findCodexRollout(threadId, codexHome) {
|
|
44988
|
+
if (!threadId) return void 0;
|
|
44989
|
+
const customHome = codexHome?.trim() || process.env.CODEX_HOME?.trim();
|
|
44990
|
+
const home3 = customHome || join2(homedir2(), ".codex");
|
|
44986
44991
|
const root2 = join2(home3, "sessions");
|
|
44987
|
-
const
|
|
44988
|
-
const minted = parseInt(threadId.replace(/-/g, "").slice(0, 12), 16);
|
|
44992
|
+
const uuidLike = /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(threadId);
|
|
44993
|
+
const minted = uuidLike ? parseInt(threadId.replace(/-/g, "").slice(0, 12), 16) : Number.NaN;
|
|
44989
44994
|
const days = /* @__PURE__ */ new Set();
|
|
44990
44995
|
for (const at of [Date.now(), ...Number.isFinite(minted) && minted > 0 ? [minted] : []]) {
|
|
44991
44996
|
for (const shift of [0, -1, 1]) days.add(dayDir(root2, at + shift * 864e5));
|
|
44992
44997
|
}
|
|
44993
|
-
let
|
|
44994
|
-
|
|
44998
|
+
let newestPath;
|
|
44999
|
+
let newestAt = -1;
|
|
45000
|
+
const considerDir = (dir) => {
|
|
44995
45001
|
let names;
|
|
44996
45002
|
try {
|
|
44997
45003
|
names = readdirSync(dir);
|
|
44998
45004
|
} catch {
|
|
44999
|
-
|
|
45005
|
+
return;
|
|
45000
45006
|
}
|
|
45001
45007
|
for (const name of names) {
|
|
45002
|
-
if (!name
|
|
45008
|
+
if (!matchesRollout(name, threadId)) continue;
|
|
45003
45009
|
const path39 = join2(dir, name);
|
|
45004
45010
|
try {
|
|
45005
45011
|
const at = statSync2(path39).mtimeMs;
|
|
45006
|
-
if (
|
|
45012
|
+
if (at > newestAt) {
|
|
45013
|
+
newestPath = path39;
|
|
45014
|
+
newestAt = at;
|
|
45015
|
+
}
|
|
45007
45016
|
} catch {
|
|
45008
45017
|
}
|
|
45009
45018
|
}
|
|
45019
|
+
};
|
|
45020
|
+
for (const dir of days) considerDir(dir);
|
|
45021
|
+
if (newestPath || !customHome && !uuidLike) return newestPath;
|
|
45022
|
+
const subdirs = (dir) => {
|
|
45023
|
+
try {
|
|
45024
|
+
return readdirSync(dir).map((n) => join2(dir, n));
|
|
45025
|
+
} catch {
|
|
45026
|
+
return [];
|
|
45027
|
+
}
|
|
45028
|
+
};
|
|
45029
|
+
for (const year of subdirs(root2)) {
|
|
45030
|
+
for (const month of subdirs(year)) {
|
|
45031
|
+
for (const day of subdirs(month)) {
|
|
45032
|
+
if (!days.has(day)) considerDir(day);
|
|
45033
|
+
}
|
|
45034
|
+
}
|
|
45010
45035
|
}
|
|
45011
|
-
|
|
45036
|
+
considerDir(join2(home3, "archived_sessions"));
|
|
45037
|
+
return newestPath;
|
|
45012
45038
|
}
|
|
45013
45039
|
function readCodexRunFacts(threadId) {
|
|
45014
|
-
const path39 =
|
|
45040
|
+
const path39 = findCodexRollout(threadId);
|
|
45015
45041
|
if (!path39) return void 0;
|
|
45016
45042
|
let raw;
|
|
45017
45043
|
try {
|
|
@@ -46012,6 +46038,13 @@ async function* terminals(rpc, threadId, alive2, verify2 = false) {
|
|
|
46012
46038
|
cursor = typeof page.nextCursor === "string" ? page.nextCursor : void 0;
|
|
46013
46039
|
} while (cursor !== void 0);
|
|
46014
46040
|
}
|
|
46041
|
+
async function activeTerminalHandles(rpc, threadId, alive2) {
|
|
46042
|
+
const handles = /* @__PURE__ */ new Map();
|
|
46043
|
+
for await (const { itemId, processId } of terminals(rpc, threadId, alive2, true)) {
|
|
46044
|
+
handles.set(terminalKey(threadId, itemId), processId);
|
|
46045
|
+
}
|
|
46046
|
+
return handles;
|
|
46047
|
+
}
|
|
46015
46048
|
function codexWork() {
|
|
46016
46049
|
const children = /* @__PURE__ */ new Set();
|
|
46017
46050
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -46225,17 +46258,21 @@ function createCodexConnection(argv) {
|
|
|
46225
46258
|
}
|
|
46226
46259
|
function createCodexClient(options = { images: [] }) {
|
|
46227
46260
|
let background = 0;
|
|
46261
|
+
let commandCheck = () => false;
|
|
46228
46262
|
return {
|
|
46229
46263
|
structured: true,
|
|
46230
46264
|
managedProcess: true,
|
|
46231
46265
|
idleRecovery: true,
|
|
46232
46266
|
background: () => background,
|
|
46267
|
+
activeCommand: () => commandCheck(),
|
|
46233
46268
|
turn: (io) => run(io, options, (count2) => {
|
|
46234
46269
|
background = count2;
|
|
46270
|
+
}, (check) => {
|
|
46271
|
+
commandCheck = check;
|
|
46235
46272
|
})
|
|
46236
46273
|
};
|
|
46237
46274
|
}
|
|
46238
|
-
async function run(io, options, count2) {
|
|
46275
|
+
async function run(io, options, count2, commandCheck) {
|
|
46239
46276
|
const since = Date.now();
|
|
46240
46277
|
const renderer = createCodexStreamRenderer();
|
|
46241
46278
|
let idling = false;
|
|
@@ -46284,12 +46321,17 @@ async function run(io, options, count2) {
|
|
|
46284
46321
|
const seenItems = /* @__PURE__ */ new Set();
|
|
46285
46322
|
const completedTurns = /* @__PURE__ */ new Set();
|
|
46286
46323
|
const historicalTurns = /* @__PURE__ */ new Set();
|
|
46324
|
+
const ownCommands = /* @__PURE__ */ new Set();
|
|
46287
46325
|
let currentTurn2 = "";
|
|
46288
46326
|
let threadId = "";
|
|
46289
46327
|
let active = true;
|
|
46290
46328
|
let timer;
|
|
46291
46329
|
let ended = false;
|
|
46292
46330
|
let checking = false;
|
|
46331
|
+
let checkingCommands = false;
|
|
46332
|
+
let commandProbeFailed = false;
|
|
46333
|
+
let commandCheckedAt = -Infinity;
|
|
46334
|
+
let commandHandles = /* @__PURE__ */ new Map();
|
|
46293
46335
|
let context;
|
|
46294
46336
|
let total;
|
|
46295
46337
|
let baseline;
|
|
@@ -46350,9 +46392,9 @@ async function run(io, options, count2) {
|
|
|
46350
46392
|
};
|
|
46351
46393
|
const cancelled = () => {
|
|
46352
46394
|
work.freeze();
|
|
46353
|
-
|
|
46354
|
-
|
|
46355
|
-
|
|
46395
|
+
for (const [id, entry2] of work.entries) if (!itemTerminal(entry2)) work.background.add(id);
|
|
46396
|
+
if (submitted && !started) note("Execution stopped before turn startup was confirmed.");
|
|
46397
|
+
else if (work.work().some((w) => !itemTerminal(w))) note(STOPPED_CLEANUP_DETAIL);
|
|
46356
46398
|
end("Codex execution stopped.");
|
|
46357
46399
|
};
|
|
46358
46400
|
io.signal?.addEventListener("abort", cancelled, { once: true });
|
|
@@ -46613,6 +46655,11 @@ async function run(io, options, count2) {
|
|
|
46613
46655
|
if (msg.method === "item/started" || msg.method === "item/completed") {
|
|
46614
46656
|
const raw = obj2(p.item);
|
|
46615
46657
|
work.observe(source, raw);
|
|
46658
|
+
const itemTurn = str2(p.turnId);
|
|
46659
|
+
if (source === threadId && submitted && active && itemTurn === currentTurn2 && itemTurn && raw.type === "commandExecution" && str2(raw.id)) {
|
|
46660
|
+
const id = terminalKey(source, str2(raw.id));
|
|
46661
|
+
if (!retained.has(id)) ownCommands.add(id);
|
|
46662
|
+
}
|
|
46616
46663
|
if (source === threadId && active) {
|
|
46617
46664
|
if (raw.type === "commandExecution") visible.add(terminalKey(source, str2(raw.id)));
|
|
46618
46665
|
if (raw.type === "collabAgentToolCall") for (const id of Object.keys(obj2(raw.agentsStates))) visible.add(`agent:${id}`);
|
|
@@ -46715,6 +46762,33 @@ async function run(io, options, count2) {
|
|
|
46715
46762
|
void check();
|
|
46716
46763
|
}
|
|
46717
46764
|
});
|
|
46765
|
+
commandCheck(() => {
|
|
46766
|
+
if (ended || idling || !threadId || commandProbeFailed) return false;
|
|
46767
|
+
const running = (id) => ownCommands.has(id) && work.entries.get(id)?.status === "running";
|
|
46768
|
+
const now = Date.now();
|
|
46769
|
+
if (!checkingCommands && now - commandCheckedAt >= 1e3 && [...ownCommands].some(running)) {
|
|
46770
|
+
checkingCommands = true;
|
|
46771
|
+
let settled = false;
|
|
46772
|
+
void bounded(
|
|
46773
|
+
activeTerminalHandles(rpc, threadId, () => !ended && !idling && !settled),
|
|
46774
|
+
2e3,
|
|
46775
|
+
"Codex background verification timed out."
|
|
46776
|
+
).then((handles) => {
|
|
46777
|
+
commandHandles = handles;
|
|
46778
|
+
commandCheckedAt = Date.now();
|
|
46779
|
+
}, () => {
|
|
46780
|
+
commandProbeFailed = true;
|
|
46781
|
+
}).finally(() => {
|
|
46782
|
+
settled = true;
|
|
46783
|
+
checkingCommands = false;
|
|
46784
|
+
});
|
|
46785
|
+
}
|
|
46786
|
+
return now - commandCheckedAt <= 3e3 && [...commandHandles].some(([id, handle]) => {
|
|
46787
|
+
if (!running(id)) return false;
|
|
46788
|
+
const observed = work.entries.get(id)?.processId;
|
|
46789
|
+
return !observed || observed === handle;
|
|
46790
|
+
});
|
|
46791
|
+
});
|
|
46718
46792
|
try {
|
|
46719
46793
|
if (io.signal?.aborted) {
|
|
46720
46794
|
cancelled();
|
|
@@ -49659,8 +49733,10 @@ var PAGE = (outcome, lang, links) => {
|
|
|
49659
49733
|
return `<!doctype html><html lang="${lang === "zh" ? "zh-CN" : "en"}"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title} \xB7 WildCrane</title><style>*{margin:0;box-sizing:border-box}body{display:flex;flex-direction:column;min-height:100dvh;background:#fff;color:#24231f;font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}header{padding:16px 36px 0}main{flex:1;display:flex;align-items:center;justify-content:center;padding:0 36px 64px;text-align:center}.icon{display:flex;margin:0 auto;width:44px;height:44px;border-radius:50%;align-items:center;justify-content:center;background:${ok ? "#e4f3ea" : "#f7ddce"};color:${ok ? "#2f6b46" : "#b83a12"}}h1{font-size:24px;font-weight:850;line-height:1.25;letter-spacing:-0.02em}h1.below{margin-top:16px}p{margin:8px auto 0;max-width:38ch;font-size:13px;line-height:19px;color:#565550}main>div.choose{width:100%;max-width:320px}nav{margin-top:28px;display:flex;flex-direction:column;gap:12px}nav a{display:flex;height:44px;align-items:center;justify-content:center;gap:8px;border-radius:10px;font-size:14.5px;font-weight:600;color:#24231f;text-decoration:none;background:#fff;border:1px solid rgba(36,35,31,0.14)}nav a.dark{background:#24231f;color:#fff;border-color:#24231f}form{margin-top:28px;display:flex;flex-direction:column;gap:12px}input{height:44px;padding:0 14px;border-radius:10px;border:1px solid rgba(36,35,31,0.14);font:inherit;font-size:14.5px}button{height:44px;border-radius:10px;border:0;font:inherit;font-size:14.5px;font-weight:600;cursor:pointer}button.dark{background:#24231f;color:#fff}button:disabled{opacity:.6}button.link{height:auto;background:none;color:#565550;font-size:13px;font-weight:500}small{font-size:13px;line-height:19px;color:#565550}small.bad{color:#b83a12}small:empty{display:none}.or{margin-top:20px;display:flex;align-items:center;gap:12px;font-size:13px;color:#8a8984}.or::before,.or::after{content:"";flex:1;height:1px;background:rgba(36,35,31,0.12)}.or+nav{margin-top:20px}</style><header><svg viewBox="2 4 56 52" width="23.7" height="22" aria-hidden="true"><path d="${CRANE}" fill="#24231f"/><path d="${CREST}" fill="#dd4f1e"/></svg></header><main><div${links ? ' class="choose"' : ""}>${top}</div></main></html>`;
|
|
49660
49734
|
};
|
|
49661
49735
|
function sameToken(a, b) {
|
|
49662
|
-
if (!a
|
|
49663
|
-
|
|
49736
|
+
if (!a) return false;
|
|
49737
|
+
const received = Buffer.from(a);
|
|
49738
|
+
const expected = Buffer.from(b);
|
|
49739
|
+
return received.length === expected.length && crypto9.timingSafeEqual(received, expected);
|
|
49664
49740
|
}
|
|
49665
49741
|
async function signIn(options = {}) {
|
|
49666
49742
|
const generation = accountGeneration();
|
|
@@ -49718,11 +49794,18 @@ async function signIn(options = {}) {
|
|
|
49718
49794
|
const params = asked.searchParams;
|
|
49719
49795
|
const code = params.get("code");
|
|
49720
49796
|
const error = params.get("error");
|
|
49721
|
-
const
|
|
49722
|
-
|
|
49723
|
-
|
|
49724
|
-
|
|
49725
|
-
}
|
|
49797
|
+
const errorCode = params.get("error_code");
|
|
49798
|
+
let failure3;
|
|
49799
|
+
if (!sameToken(params.get("state"), oauthState)) {
|
|
49800
|
+
failure3 = { why: "other", detail: "invalid oauth state" };
|
|
49801
|
+
} else if (code && !error && errorCode === null) {
|
|
49802
|
+
failure3 = await exchange(code, verifier, generation, options.signal);
|
|
49803
|
+
} else {
|
|
49804
|
+
failure3 = {
|
|
49805
|
+
why: error === "access_denied" && errorCode === null ? "denied" : "other",
|
|
49806
|
+
detail: params.get("error_description") || errorCode || error || "no code came back"
|
|
49807
|
+
};
|
|
49808
|
+
}
|
|
49726
49809
|
const outcome = !failure3 ? "ok" : failure3.why === "denied" ? "denied" : "failed";
|
|
49727
49810
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
|
|
49728
49811
|
res.end(PAGE(outcome, lang));
|
|
@@ -49732,14 +49815,15 @@ async function signIn(options = {}) {
|
|
|
49732
49815
|
const { port } = server.address();
|
|
49733
49816
|
expectedOrigin = `http://127.0.0.1:${port}`;
|
|
49734
49817
|
const { supabaseUrl } = cloudEndpoints();
|
|
49818
|
+
const callback2 = new URL("/signed-in", expectedOrigin);
|
|
49819
|
+
callback2.searchParams.set("state", oauthState);
|
|
49735
49820
|
const authorize = (provider) => {
|
|
49736
49821
|
const url = new URL(`${supabaseUrl}/auth/v1/authorize`);
|
|
49737
49822
|
url.searchParams.set("provider", provider);
|
|
49738
|
-
url.searchParams.set("redirect_to",
|
|
49823
|
+
url.searchParams.set("redirect_to", callback2.toString());
|
|
49739
49824
|
if (provider === "github") url.searchParams.set("scopes", "user:email");
|
|
49740
49825
|
url.searchParams.set("code_challenge", challenge);
|
|
49741
49826
|
url.searchParams.set("code_challenge_method", "s256");
|
|
49742
|
-
url.searchParams.set("state", oauthState);
|
|
49743
49827
|
return url.toString().replace(/&/g, "&");
|
|
49744
49828
|
};
|
|
49745
49829
|
const choose = `http://127.0.0.1:${port}/`;
|