wildcrane-runner 0.6.122 → 0.6.123
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 +87967 -3491
- 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 +10531 -10346
- package/dist/launcher.mjs +87 -8
- package/dist/plugin.mjs +102 -23
- package/dist/runner.mjs +10646 -10382
- package/dist/settings.mjs +34 -6
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.123 — 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.123" : "0.0.0";
|
|
41125
|
+
var AKB_VERSION = true ? "0.11.105" : "0.0.0";
|
|
41126
41126
|
var EXIT_REFUSED = 10;
|
|
41127
41127
|
var EXIT_OUTDATED = 11;
|
|
41128
41128
|
var EXIT_UPDATE = 12;
|
|
@@ -41134,26 +41134,71 @@ import fs3 from "node:fs";
|
|
|
41134
41134
|
import path3 from "node:path";
|
|
41135
41135
|
import zlib from "node:zlib";
|
|
41136
41136
|
var PACKAGE = "wildcrane-runner";
|
|
41137
|
+
var OFFICIAL_REGISTRY = "https://registry.npmjs.org";
|
|
41137
41138
|
var TIMEOUT_MS = 6e4;
|
|
41138
41139
|
var versionsDir = () => path3.join(runnerHome(), "bin", "runner");
|
|
41139
41140
|
var legacyVersionsDir = () => path3.join(runnerHome(), "runner");
|
|
41140
41141
|
var versionDir = (version) => path3.join(versionsDir(), version);
|
|
41141
41142
|
var entryOf = (dir) => path3.join(dir, "dist", "runner.mjs");
|
|
41142
41143
|
var RUNNER = { name: PACKAGE, dirOf: versionDir, entryOf };
|
|
41143
|
-
var
|
|
41144
|
+
var testRegistryOverride = null;
|
|
41145
|
+
var cachedKeys = null;
|
|
41146
|
+
function resolveRegistry() {
|
|
41147
|
+
if (testRegistryOverride) return { ok: true, url: testRegistryOverride };
|
|
41148
|
+
const configured = process.env.npm_config_registry?.trim().replace(/\/+$/, "");
|
|
41149
|
+
if (configured && configured !== OFFICIAL_REGISTRY) {
|
|
41150
|
+
return { ok: false, detail: `untrusted npm_config_registry: ${configured}` };
|
|
41151
|
+
}
|
|
41152
|
+
return { ok: true, url: OFFICIAL_REGISTRY };
|
|
41153
|
+
}
|
|
41154
|
+
async function registryKeys(registryUrl) {
|
|
41155
|
+
if (cachedKeys?.source === registryUrl) return cachedKeys.keys;
|
|
41156
|
+
const answer = await fetch(`${registryUrl}/-/npm/v1/keys`, { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
41157
|
+
if (!answer.ok) throw new Error(`keys answered ${answer.status}`);
|
|
41158
|
+
const body = await answer.json();
|
|
41159
|
+
const keys = /* @__PURE__ */ new Map();
|
|
41160
|
+
for (const entry2 of body.keys ?? []) {
|
|
41161
|
+
if (!entry2.keyid || !entry2.key) continue;
|
|
41162
|
+
if (entry2.expires && Date.parse(entry2.expires) <= Date.now()) continue;
|
|
41163
|
+
keys.set(entry2.keyid, crypto4.createPublicKey({ key: Buffer.from(entry2.key, "base64"), format: "der", type: "spki" }));
|
|
41164
|
+
}
|
|
41165
|
+
cachedKeys = { source: registryUrl, keys };
|
|
41166
|
+
return keys;
|
|
41167
|
+
}
|
|
41168
|
+
async function verifySignature(registryUrl, pkgName, version, integrity, signatures) {
|
|
41169
|
+
if (!Array.isArray(signatures) || signatures.length === 0) return false;
|
|
41170
|
+
const keys = await registryKeys(registryUrl);
|
|
41171
|
+
const payload = Buffer.from(`${pkgName}@${version}:${integrity}`);
|
|
41172
|
+
for (const entry2 of signatures) {
|
|
41173
|
+
if (!entry2.keyid || !entry2.sig) continue;
|
|
41174
|
+
const key = keys.get(entry2.keyid);
|
|
41175
|
+
if (!key) continue;
|
|
41176
|
+
try {
|
|
41177
|
+
if (crypto4.verify("sha256", payload, key, Buffer.from(entry2.sig, "base64"))) return true;
|
|
41178
|
+
} catch {
|
|
41179
|
+
}
|
|
41180
|
+
}
|
|
41181
|
+
return false;
|
|
41182
|
+
}
|
|
41144
41183
|
var install2 = (version, nodeVersion) => installPackage(RUNNER, version, nodeVersion);
|
|
41145
41184
|
async function installPackage(pkg, version, nodeVersion = process.versions.node) {
|
|
41146
41185
|
const dir = pkg.dirOf(version);
|
|
41147
41186
|
if (fs3.existsSync(pkg.entryOf(dir))) return { ok: true, dir };
|
|
41187
|
+
const reg = resolveRegistry();
|
|
41188
|
+
if (!reg.ok) return { ok: false, why: "integrity", detail: reg.detail };
|
|
41189
|
+
const registryUrl = reg.url;
|
|
41148
41190
|
let meta;
|
|
41149
41191
|
let tarball;
|
|
41150
41192
|
try {
|
|
41151
|
-
const answer = await fetch(`${
|
|
41193
|
+
const answer = await fetch(`${registryUrl}/${pkg.name}/${encodeURIComponent(version)}`, { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
41152
41194
|
if (!answer.ok) return { ok: false, why: "unreachable", detail: `registry answered ${answer.status}` };
|
|
41153
41195
|
meta = await answer.json();
|
|
41154
41196
|
const range = meta.engines?.node;
|
|
41155
41197
|
if (range && !satisfies(nodeVersion, range)) return { ok: false, why: "node", detail: range };
|
|
41156
41198
|
if (!meta.dist?.tarball) return { ok: false, why: "unreachable", detail: "no tarball" };
|
|
41199
|
+
if (!testRegistryOverride && !meta.dist.tarball.startsWith(`${OFFICIAL_REGISTRY}/`)) {
|
|
41200
|
+
return { ok: false, why: "integrity", detail: "tarball outside official registry" };
|
|
41201
|
+
}
|
|
41157
41202
|
const download = await fetch(meta.dist.tarball, { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
41158
41203
|
if (!download.ok) return { ok: false, why: "unreachable", detail: `download answered ${download.status}` };
|
|
41159
41204
|
tarball = Buffer.from(await download.arrayBuffer());
|
|
@@ -41163,6 +41208,12 @@ async function installPackage(pkg, version, nodeVersion = process.versions.node)
|
|
|
41163
41208
|
const expected = /^sha512-(.+)$/.exec(meta.dist.integrity ?? "")?.[1];
|
|
41164
41209
|
const actual = crypto4.createHash("sha512").update(tarball).digest("base64");
|
|
41165
41210
|
if (!expected || expected !== actual) return { ok: false, why: "integrity", detail: "sha512 mismatch" };
|
|
41211
|
+
try {
|
|
41212
|
+
const signed = await verifySignature(registryUrl, pkg.name, version, meta.dist.integrity, meta.dist.signatures);
|
|
41213
|
+
if (!signed) return { ok: false, why: "integrity", detail: "dist.signatures verification failed" };
|
|
41214
|
+
} catch (e) {
|
|
41215
|
+
return { ok: false, why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
41216
|
+
}
|
|
41166
41217
|
const staging = `${dir}.${process.pid}.tmp`;
|
|
41167
41218
|
try {
|
|
41168
41219
|
fs3.rmSync(staging, { recursive: true, force: true });
|
|
@@ -43542,7 +43593,7 @@ function createTail(log) {
|
|
|
43542
43593
|
// ../cli/package.json
|
|
43543
43594
|
var package_default = {
|
|
43544
43595
|
name: "wildcrane",
|
|
43545
|
-
version: "0.11.
|
|
43596
|
+
version: "0.11.105",
|
|
43546
43597
|
akbContract: 39,
|
|
43547
43598
|
canonicalCommands: true,
|
|
43548
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.",
|
|
@@ -49563,16 +49614,36 @@ var PAGE = (outcome, lang, links) => {
|
|
|
49563
49614
|
const top = links ? `<h1>${title}</h1><p>${body}</p><form id="f" novalidate><input id="e" type="email" autocomplete="email" placeholder="${c.email}" required><input id="c" inputmode="numeric" autocomplete="one-time-code" maxlength="10" placeholder="${c.code}" hidden><button id="b" class="dark">${c.send}</button><small id="m"></small><button id="x" type="button" class="link" hidden>${c.change}</button></form><div class="or">${c.or}</div><nav><a href="${links.github}">${GITHUB_ICON}${c.github}</a><a href="${links.google}">${GOOGLE_ICON}${c.google}</a></nav><script>${EMAIL_SCRIPT(c)}</script>` : `<span class="icon"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icon2}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
49564
49615
|
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>`;
|
|
49565
49616
|
};
|
|
49617
|
+
function sameToken(a, b) {
|
|
49618
|
+
if (!a || a.length !== b.length) return false;
|
|
49619
|
+
return crypto9.timingSafeEqual(Buffer.from(a), Buffer.from(b));
|
|
49620
|
+
}
|
|
49566
49621
|
async function signIn(options = {}) {
|
|
49567
49622
|
const generation = accountGeneration();
|
|
49568
49623
|
const verifier = base64url(crypto9.randomBytes(32));
|
|
49569
49624
|
const challenge = base64url(crypto9.createHash("sha256").update(verifier).digest());
|
|
49625
|
+
const oauthState = base64url(crypto9.randomBytes(24));
|
|
49570
49626
|
let finish = () => {
|
|
49571
49627
|
};
|
|
49572
49628
|
const answered = new Promise((resolve2) => finish = resolve2);
|
|
49573
49629
|
let answering = false;
|
|
49630
|
+
let expectedOrigin = "";
|
|
49574
49631
|
const server = http2.createServer(async (req, res) => {
|
|
49632
|
+
res.setHeader("cache-control", "no-store");
|
|
49633
|
+
res.setHeader("referrer-policy", "no-referrer");
|
|
49634
|
+
res.setHeader("x-content-type-options", "nosniff");
|
|
49635
|
+
const expectedHost = expectedOrigin.slice(7);
|
|
49636
|
+
const secFetchSite = req.headers["sec-fetch-site"] ? String(req.headers["sec-fetch-site"]) : null;
|
|
49637
|
+
if (req.headers.host !== expectedHost || req.headers.origin && req.headers.origin !== expectedOrigin) {
|
|
49638
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
49639
|
+
return;
|
|
49640
|
+
}
|
|
49575
49641
|
const asked = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
49642
|
+
const isCallback = asked.pathname === "/signed-in";
|
|
49643
|
+
if (secFetchSite && !(isCallback ? ["same-origin", "none", "cross-site"] : ["same-origin", "none"]).includes(secFetchSite)) {
|
|
49644
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
49645
|
+
return;
|
|
49646
|
+
}
|
|
49576
49647
|
const lang = langOf(req.headers["accept-language"]);
|
|
49577
49648
|
if (asked.pathname === "/" && !answering) {
|
|
49578
49649
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" });
|
|
@@ -49580,6 +49651,10 @@ async function signIn(options = {}) {
|
|
|
49580
49651
|
return;
|
|
49581
49652
|
}
|
|
49582
49653
|
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
49654
|
+
if (req.headers.origin !== expectedOrigin) {
|
|
49655
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
49656
|
+
return;
|
|
49657
|
+
}
|
|
49583
49658
|
const asks = await readJson2(req);
|
|
49584
49659
|
const answer = asked.pathname === "/send" ? await sendCode(asks.email ?? "", lang) : await verifyCode(asks.email ?? "", asks.code ?? "", generation, options.signal);
|
|
49585
49660
|
const done = answer.ok && asked.pathname === "/verify";
|
|
@@ -49599,7 +49674,8 @@ async function signIn(options = {}) {
|
|
|
49599
49674
|
const params = asked.searchParams;
|
|
49600
49675
|
const code = params.get("code");
|
|
49601
49676
|
const error = params.get("error");
|
|
49602
|
-
const
|
|
49677
|
+
const stateOk = sameToken(params.get("state"), oauthState);
|
|
49678
|
+
const failure3 = !stateOk ? { why: "other", detail: "invalid oauth state" } : code ? await exchange(code, verifier, generation, options.signal) : {
|
|
49603
49679
|
why: error === "access_denied" ? "denied" : "other",
|
|
49604
49680
|
detail: params.get("error_description") || error || "no code came back"
|
|
49605
49681
|
};
|
|
@@ -49610,6 +49686,7 @@ async function signIn(options = {}) {
|
|
|
49610
49686
|
});
|
|
49611
49687
|
await new Promise((resolve2) => server.listen(0, "127.0.0.1", resolve2));
|
|
49612
49688
|
const { port } = server.address();
|
|
49689
|
+
expectedOrigin = `http://127.0.0.1:${port}`;
|
|
49613
49690
|
const { supabaseUrl } = cloudEndpoints();
|
|
49614
49691
|
const authorize = (provider) => {
|
|
49615
49692
|
const url = new URL(`${supabaseUrl}/auth/v1/authorize`);
|
|
@@ -49618,18 +49695,20 @@ async function signIn(options = {}) {
|
|
|
49618
49695
|
if (provider === "github") url.searchParams.set("scopes", "user:email");
|
|
49619
49696
|
url.searchParams.set("code_challenge", challenge);
|
|
49620
49697
|
url.searchParams.set("code_challenge_method", "s256");
|
|
49698
|
+
url.searchParams.set("state", oauthState);
|
|
49621
49699
|
return url.toString().replace(/&/g, "&");
|
|
49622
49700
|
};
|
|
49623
49701
|
const choose = `http://127.0.0.1:${port}/`;
|
|
49624
49702
|
const onUrl = options.onUrl ?? ((u) => status(t.signIn(u)));
|
|
49625
49703
|
onUrl(choose);
|
|
49626
|
-
openBrowser2(choose);
|
|
49704
|
+
if (!options.noBrowser) openBrowser2(choose);
|
|
49627
49705
|
const timer = setTimeout(() => finish({ why: "timeout", detail: "timed out" }), WAIT_MS);
|
|
49628
49706
|
const cancel = () => finish({ why: "cancelled", detail: "cancelled" });
|
|
49629
49707
|
options.signal?.addEventListener("abort", cancel);
|
|
49630
49708
|
const failure2 = await answered;
|
|
49631
49709
|
clearTimeout(timer);
|
|
49632
49710
|
options.signal?.removeEventListener("abort", cancel);
|
|
49711
|
+
server.closeAllConnections();
|
|
49633
49712
|
server.close();
|
|
49634
49713
|
return failure2;
|
|
49635
49714
|
}
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.123 — 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;
|
|
@@ -22405,7 +22405,7 @@ var require_registries = __commonJS({
|
|
|
22405
22405
|
var _a5;
|
|
22406
22406
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22407
22407
|
exports.globalRegistry = exports.$ZodRegistry = exports.$input = exports.$output = void 0;
|
|
22408
|
-
exports.registry =
|
|
22408
|
+
exports.registry = registry3;
|
|
22409
22409
|
exports.$output = /* @__PURE__ */ Symbol("ZodOutput");
|
|
22410
22410
|
exports.$input = /* @__PURE__ */ Symbol("ZodInput");
|
|
22411
22411
|
var $ZodRegistry3 = class {
|
|
@@ -22449,10 +22449,10 @@ var require_registries = __commonJS({
|
|
|
22449
22449
|
}
|
|
22450
22450
|
};
|
|
22451
22451
|
exports.$ZodRegistry = $ZodRegistry3;
|
|
22452
|
-
function
|
|
22452
|
+
function registry3() {
|
|
22453
22453
|
return new $ZodRegistry3();
|
|
22454
22454
|
}
|
|
22455
|
-
(_a5 = globalThis).__zod_globalRegistry ?? (_a5.__zod_globalRegistry =
|
|
22455
|
+
(_a5 = globalThis).__zod_globalRegistry ?? (_a5.__zod_globalRegistry = registry3());
|
|
22456
22456
|
exports.globalRegistry = globalThis.__zod_globalRegistry;
|
|
22457
22457
|
(function() {
|
|
22458
22458
|
var keys = Object.getOwnPropertyNames(exports);
|
|
@@ -26737,21 +26737,21 @@ var require_json_schema_processors = __commonJS({
|
|
|
26737
26737
|
};
|
|
26738
26738
|
function toJSONSchema3(input2, params) {
|
|
26739
26739
|
if ("_idmap" in input2) {
|
|
26740
|
-
const
|
|
26740
|
+
const registry3 = input2;
|
|
26741
26741
|
const ctx2 = (0, to_json_schema_js_1.initializeContext)({ ...params, processors: exports.allProcessors });
|
|
26742
26742
|
const defs = {};
|
|
26743
|
-
for (const entry of
|
|
26743
|
+
for (const entry of registry3._idmap.entries()) {
|
|
26744
26744
|
const [_, schema] = entry;
|
|
26745
26745
|
(0, to_json_schema_js_1.processSchema)(schema, ctx2);
|
|
26746
26746
|
}
|
|
26747
26747
|
const schemas = {};
|
|
26748
26748
|
const external = {
|
|
26749
|
-
registry:
|
|
26749
|
+
registry: registry3,
|
|
26750
26750
|
uri: params?.uri,
|
|
26751
26751
|
defs
|
|
26752
26752
|
};
|
|
26753
26753
|
ctx2.external = external;
|
|
26754
|
-
for (const entry of
|
|
26754
|
+
for (const entry of registry3._idmap.entries()) {
|
|
26755
26755
|
const [key, schema] = entry;
|
|
26756
26756
|
(0, to_json_schema_js_1.extractDefs)(ctx2, schema);
|
|
26757
26757
|
(0, util_js_1.assignProp)(schemas, key, (0, to_json_schema_js_1.finalize)(ctx2, schema));
|
|
@@ -88256,21 +88256,21 @@ var allProcessors = {
|
|
|
88256
88256
|
};
|
|
88257
88257
|
function toJSONSchema(input2, params) {
|
|
88258
88258
|
if ("_idmap" in input2) {
|
|
88259
|
-
const
|
|
88259
|
+
const registry3 = input2;
|
|
88260
88260
|
const ctx2 = initializeContext({ ...params, processors: allProcessors });
|
|
88261
88261
|
const defs = {};
|
|
88262
|
-
for (const entry of
|
|
88262
|
+
for (const entry of registry3._idmap.entries()) {
|
|
88263
88263
|
const [_, schema] = entry;
|
|
88264
88264
|
processSchema(schema, ctx2);
|
|
88265
88265
|
}
|
|
88266
88266
|
const schemas = {};
|
|
88267
88267
|
const external = {
|
|
88268
|
-
registry:
|
|
88268
|
+
registry: registry3,
|
|
88269
88269
|
uri: params?.uri,
|
|
88270
88270
|
defs
|
|
88271
88271
|
};
|
|
88272
88272
|
ctx2.external = external;
|
|
88273
|
-
for (const entry of
|
|
88273
|
+
for (const entry of registry3._idmap.entries()) {
|
|
88274
88274
|
const [key, schema] = entry;
|
|
88275
88275
|
extractDefs(ctx2, schema);
|
|
88276
88276
|
assignProp(schemas, key, finalize(ctx2, schema));
|
|
@@ -100753,21 +100753,21 @@ var allProcessors2 = {
|
|
|
100753
100753
|
};
|
|
100754
100754
|
function toJSONSchema2(input2, params) {
|
|
100755
100755
|
if ("_idmap" in input2) {
|
|
100756
|
-
const
|
|
100756
|
+
const registry3 = input2;
|
|
100757
100757
|
const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
|
|
100758
100758
|
const defs = {};
|
|
100759
|
-
for (const entry of
|
|
100759
|
+
for (const entry of registry3._idmap.entries()) {
|
|
100760
100760
|
const [_, schema] = entry;
|
|
100761
100761
|
processSchema2(schema, ctx2);
|
|
100762
100762
|
}
|
|
100763
100763
|
const schemas = {};
|
|
100764
100764
|
const external = {
|
|
100765
|
-
registry:
|
|
100765
|
+
registry: registry3,
|
|
100766
100766
|
uri: params?.uri,
|
|
100767
100767
|
defs
|
|
100768
100768
|
};
|
|
100769
100769
|
ctx2.external = external;
|
|
100770
|
-
for (const entry of
|
|
100770
|
+
for (const entry of registry3._idmap.entries()) {
|
|
100771
100771
|
const [key, schema] = entry;
|
|
100772
100772
|
extractDefs2(ctx2, schema);
|
|
100773
100773
|
assignProp2(schemas, key, finalize2(ctx2, schema));
|
|
@@ -109812,7 +109812,7 @@ function createTail(log) {
|
|
|
109812
109812
|
// ../cli/package.json
|
|
109813
109813
|
var package_default = {
|
|
109814
109814
|
name: "wildcrane",
|
|
109815
|
-
version: "0.11.
|
|
109815
|
+
version: "0.11.105",
|
|
109816
109816
|
akbContract: 39,
|
|
109817
109817
|
canonicalCommands: true,
|
|
109818
109818
|
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.",
|
|
@@ -114364,8 +114364,8 @@ function machineId() {
|
|
|
114364
114364
|
var machineName = () => os4.hostname().replace(/\.local$/, "");
|
|
114365
114365
|
|
|
114366
114366
|
// src/protocol.ts
|
|
114367
|
-
var VERSION = true ? "0.6.
|
|
114368
|
-
var AKB_VERSION = true ? "0.11.
|
|
114367
|
+
var VERSION = true ? "0.6.123" : "0.0.0";
|
|
114368
|
+
var AKB_VERSION = true ? "0.11.105" : "0.0.0";
|
|
114369
114369
|
var EXIT_OUTDATED = 11;
|
|
114370
114370
|
var EXIT_UPDATE = 12;
|
|
114371
114371
|
var EXIT_ALREADY_RUNNING = 13;
|
|
@@ -114811,26 +114811,71 @@ import fs24 from "node:fs";
|
|
|
114811
114811
|
import path28 from "node:path";
|
|
114812
114812
|
import zlib from "node:zlib";
|
|
114813
114813
|
var PACKAGE = "wildcrane-runner";
|
|
114814
|
+
var OFFICIAL_REGISTRY = "https://registry.npmjs.org";
|
|
114814
114815
|
var TIMEOUT_MS2 = 6e4;
|
|
114815
114816
|
var versionsDir = () => path28.join(runnerHome(), "bin", "runner");
|
|
114816
114817
|
var legacyVersionsDir = () => path28.join(runnerHome(), "runner");
|
|
114817
114818
|
var versionDir = (version3) => path28.join(versionsDir(), version3);
|
|
114818
114819
|
var entryOf = (dir) => path28.join(dir, "dist", "runner.mjs");
|
|
114819
114820
|
var RUNNER = { name: PACKAGE, dirOf: versionDir, entryOf };
|
|
114820
|
-
var
|
|
114821
|
+
var testRegistryOverride = null;
|
|
114822
|
+
var cachedKeys = null;
|
|
114823
|
+
function resolveRegistry() {
|
|
114824
|
+
if (testRegistryOverride) return { ok: true, url: testRegistryOverride };
|
|
114825
|
+
const configured = process.env.npm_config_registry?.trim().replace(/\/+$/, "");
|
|
114826
|
+
if (configured && configured !== OFFICIAL_REGISTRY) {
|
|
114827
|
+
return { ok: false, detail: `untrusted npm_config_registry: ${configured}` };
|
|
114828
|
+
}
|
|
114829
|
+
return { ok: true, url: OFFICIAL_REGISTRY };
|
|
114830
|
+
}
|
|
114831
|
+
async function registryKeys(registryUrl) {
|
|
114832
|
+
if (cachedKeys?.source === registryUrl) return cachedKeys.keys;
|
|
114833
|
+
const answer = await fetch(`${registryUrl}/-/npm/v1/keys`, { signal: AbortSignal.timeout(TIMEOUT_MS2) });
|
|
114834
|
+
if (!answer.ok) throw new Error(`keys answered ${answer.status}`);
|
|
114835
|
+
const body = await answer.json();
|
|
114836
|
+
const keys = /* @__PURE__ */ new Map();
|
|
114837
|
+
for (const entry of body.keys ?? []) {
|
|
114838
|
+
if (!entry.keyid || !entry.key) continue;
|
|
114839
|
+
if (entry.expires && Date.parse(entry.expires) <= Date.now()) continue;
|
|
114840
|
+
keys.set(entry.keyid, crypto6.createPublicKey({ key: Buffer.from(entry.key, "base64"), format: "der", type: "spki" }));
|
|
114841
|
+
}
|
|
114842
|
+
cachedKeys = { source: registryUrl, keys };
|
|
114843
|
+
return keys;
|
|
114844
|
+
}
|
|
114845
|
+
async function verifySignature(registryUrl, pkgName, version3, integrity, signatures) {
|
|
114846
|
+
if (!Array.isArray(signatures) || signatures.length === 0) return false;
|
|
114847
|
+
const keys = await registryKeys(registryUrl);
|
|
114848
|
+
const payload = Buffer.from(`${pkgName}@${version3}:${integrity}`);
|
|
114849
|
+
for (const entry of signatures) {
|
|
114850
|
+
if (!entry.keyid || !entry.sig) continue;
|
|
114851
|
+
const key = keys.get(entry.keyid);
|
|
114852
|
+
if (!key) continue;
|
|
114853
|
+
try {
|
|
114854
|
+
if (crypto6.verify("sha256", payload, key, Buffer.from(entry.sig, "base64"))) return true;
|
|
114855
|
+
} catch {
|
|
114856
|
+
}
|
|
114857
|
+
}
|
|
114858
|
+
return false;
|
|
114859
|
+
}
|
|
114821
114860
|
var install2 = (version3, nodeVersion) => installPackage(RUNNER, version3, nodeVersion);
|
|
114822
114861
|
async function installPackage(pkg, version3, nodeVersion = process.versions.node) {
|
|
114823
114862
|
const dir = pkg.dirOf(version3);
|
|
114824
114863
|
if (fs24.existsSync(pkg.entryOf(dir))) return { ok: true, dir };
|
|
114864
|
+
const reg = resolveRegistry();
|
|
114865
|
+
if (!reg.ok) return { ok: false, why: "integrity", detail: reg.detail };
|
|
114866
|
+
const registryUrl = reg.url;
|
|
114825
114867
|
let meta4;
|
|
114826
114868
|
let tarball;
|
|
114827
114869
|
try {
|
|
114828
|
-
const answer = await fetch(`${
|
|
114870
|
+
const answer = await fetch(`${registryUrl}/${pkg.name}/${encodeURIComponent(version3)}`, { signal: AbortSignal.timeout(TIMEOUT_MS2) });
|
|
114829
114871
|
if (!answer.ok) return { ok: false, why: "unreachable", detail: `registry answered ${answer.status}` };
|
|
114830
114872
|
meta4 = await answer.json();
|
|
114831
114873
|
const range = meta4.engines?.node;
|
|
114832
114874
|
if (range && !satisfies(nodeVersion, range)) return { ok: false, why: "node", detail: range };
|
|
114833
114875
|
if (!meta4.dist?.tarball) return { ok: false, why: "unreachable", detail: "no tarball" };
|
|
114876
|
+
if (!testRegistryOverride && !meta4.dist.tarball.startsWith(`${OFFICIAL_REGISTRY}/`)) {
|
|
114877
|
+
return { ok: false, why: "integrity", detail: "tarball outside official registry" };
|
|
114878
|
+
}
|
|
114834
114879
|
const download = await fetch(meta4.dist.tarball, { signal: AbortSignal.timeout(TIMEOUT_MS2) });
|
|
114835
114880
|
if (!download.ok) return { ok: false, why: "unreachable", detail: `download answered ${download.status}` };
|
|
114836
114881
|
tarball = Buffer.from(await download.arrayBuffer());
|
|
@@ -114840,6 +114885,12 @@ async function installPackage(pkg, version3, nodeVersion = process.versions.node
|
|
|
114840
114885
|
const expected = /^sha512-(.+)$/.exec(meta4.dist.integrity ?? "")?.[1];
|
|
114841
114886
|
const actual = crypto6.createHash("sha512").update(tarball).digest("base64");
|
|
114842
114887
|
if (!expected || expected !== actual) return { ok: false, why: "integrity", detail: "sha512 mismatch" };
|
|
114888
|
+
try {
|
|
114889
|
+
const signed = await verifySignature(registryUrl, pkg.name, version3, meta4.dist.integrity, meta4.dist.signatures);
|
|
114890
|
+
if (!signed) return { ok: false, why: "integrity", detail: "dist.signatures verification failed" };
|
|
114891
|
+
} catch (e) {
|
|
114892
|
+
return { ok: false, why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
114893
|
+
}
|
|
114843
114894
|
const staging = `${dir}.${process.pid}.tmp`;
|
|
114844
114895
|
try {
|
|
114845
114896
|
fs24.rmSync(staging, { recursive: true, force: true });
|
|
@@ -115966,16 +116017,36 @@ var PAGE = (outcome, lang, links) => {
|
|
|
115966
116017
|
const top = links ? `<h1>${title}</h1><p>${body}</p><form id="f" novalidate><input id="e" type="email" autocomplete="email" placeholder="${c.email}" required><input id="c" inputmode="numeric" autocomplete="one-time-code" maxlength="10" placeholder="${c.code}" hidden><button id="b" class="dark">${c.send}</button><small id="m"></small><button id="x" type="button" class="link" hidden>${c.change}</button></form><div class="or">${c.or}</div><nav><a href="${links.github}">${GITHUB_ICON}${c.github}</a><a href="${links.google}">${GOOGLE_ICON}${c.google}</a></nav><script>${EMAIL_SCRIPT(c)}</script>` : `<span class="icon"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icon2}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
115967
116018
|
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>`;
|
|
115968
116019
|
};
|
|
116020
|
+
function sameToken(a, b) {
|
|
116021
|
+
if (!a || a.length !== b.length) return false;
|
|
116022
|
+
return crypto8.timingSafeEqual(Buffer.from(a), Buffer.from(b));
|
|
116023
|
+
}
|
|
115969
116024
|
async function signIn(options = {}) {
|
|
115970
116025
|
const generation = accountGeneration();
|
|
115971
116026
|
const verifier = base64url4(crypto8.randomBytes(32));
|
|
115972
116027
|
const challenge = base64url4(crypto8.createHash("sha256").update(verifier).digest());
|
|
116028
|
+
const oauthState = base64url4(crypto8.randomBytes(24));
|
|
115973
116029
|
let finish = () => {
|
|
115974
116030
|
};
|
|
115975
116031
|
const answered = new Promise((resolve2) => finish = resolve2);
|
|
115976
116032
|
let answering = false;
|
|
116033
|
+
let expectedOrigin = "";
|
|
115977
116034
|
const server2 = http.createServer(async (req, res) => {
|
|
116035
|
+
res.setHeader("cache-control", "no-store");
|
|
116036
|
+
res.setHeader("referrer-policy", "no-referrer");
|
|
116037
|
+
res.setHeader("x-content-type-options", "nosniff");
|
|
116038
|
+
const expectedHost = expectedOrigin.slice(7);
|
|
116039
|
+
const secFetchSite = req.headers["sec-fetch-site"] ? String(req.headers["sec-fetch-site"]) : null;
|
|
116040
|
+
if (req.headers.host !== expectedHost || req.headers.origin && req.headers.origin !== expectedOrigin) {
|
|
116041
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
116042
|
+
return;
|
|
116043
|
+
}
|
|
115978
116044
|
const asked = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
116045
|
+
const isCallback = asked.pathname === "/signed-in";
|
|
116046
|
+
if (secFetchSite && !(isCallback ? ["same-origin", "none", "cross-site"] : ["same-origin", "none"]).includes(secFetchSite)) {
|
|
116047
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
116048
|
+
return;
|
|
116049
|
+
}
|
|
115979
116050
|
const lang = langOf(req.headers["accept-language"]);
|
|
115980
116051
|
if (asked.pathname === "/" && !answering) {
|
|
115981
116052
|
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" });
|
|
@@ -115983,6 +116054,10 @@ async function signIn(options = {}) {
|
|
|
115983
116054
|
return;
|
|
115984
116055
|
}
|
|
115985
116056
|
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
116057
|
+
if (req.headers.origin !== expectedOrigin) {
|
|
116058
|
+
res.writeHead(403, { "content-type": "application/json; charset=utf-8" }).end(JSON.stringify({ error: "forbidden" }));
|
|
116059
|
+
return;
|
|
116060
|
+
}
|
|
115986
116061
|
const asks = await readJson2(req);
|
|
115987
116062
|
const answer = asked.pathname === "/send" ? await sendCode(asks.email ?? "", lang) : await verifyCode(asks.email ?? "", asks.code ?? "", generation, options.signal);
|
|
115988
116063
|
const done = answer.ok && asked.pathname === "/verify";
|
|
@@ -116002,7 +116077,8 @@ async function signIn(options = {}) {
|
|
|
116002
116077
|
const params = asked.searchParams;
|
|
116003
116078
|
const code = params.get("code");
|
|
116004
116079
|
const error63 = params.get("error");
|
|
116005
|
-
const
|
|
116080
|
+
const stateOk = sameToken(params.get("state"), oauthState);
|
|
116081
|
+
const failure6 = !stateOk ? { why: "other", detail: "invalid oauth state" } : code ? await exchange(code, verifier, generation, options.signal) : {
|
|
116006
116082
|
why: error63 === "access_denied" ? "denied" : "other",
|
|
116007
116083
|
detail: params.get("error_description") || error63 || "no code came back"
|
|
116008
116084
|
};
|
|
@@ -116013,6 +116089,7 @@ async function signIn(options = {}) {
|
|
|
116013
116089
|
});
|
|
116014
116090
|
await new Promise((resolve2) => server2.listen(0, "127.0.0.1", resolve2));
|
|
116015
116091
|
const { port } = server2.address();
|
|
116092
|
+
expectedOrigin = `http://127.0.0.1:${port}`;
|
|
116016
116093
|
const { supabaseUrl } = cloudEndpoints();
|
|
116017
116094
|
const authorize = (provider) => {
|
|
116018
116095
|
const url2 = new URL(`${supabaseUrl}/auth/v1/authorize`);
|
|
@@ -116021,18 +116098,20 @@ async function signIn(options = {}) {
|
|
|
116021
116098
|
if (provider === "github") url2.searchParams.set("scopes", "user:email");
|
|
116022
116099
|
url2.searchParams.set("code_challenge", challenge);
|
|
116023
116100
|
url2.searchParams.set("code_challenge_method", "s256");
|
|
116101
|
+
url2.searchParams.set("state", oauthState);
|
|
116024
116102
|
return url2.toString().replace(/&/g, "&");
|
|
116025
116103
|
};
|
|
116026
116104
|
const choose = `http://127.0.0.1:${port}/`;
|
|
116027
116105
|
const onUrl = options.onUrl ?? ((u) => status(t.signIn(u)));
|
|
116028
116106
|
onUrl(choose);
|
|
116029
|
-
openBrowser(choose);
|
|
116107
|
+
if (!options.noBrowser) openBrowser(choose);
|
|
116030
116108
|
const timer = setTimeout(() => finish({ why: "timeout", detail: "timed out" }), WAIT_MS);
|
|
116031
116109
|
const cancel = () => finish({ why: "cancelled", detail: "cancelled" });
|
|
116032
116110
|
options.signal?.addEventListener("abort", cancel);
|
|
116033
116111
|
const failure5 = await answered;
|
|
116034
116112
|
clearTimeout(timer);
|
|
116035
116113
|
options.signal?.removeEventListener("abort", cancel);
|
|
116114
|
+
server2.closeAllConnections();
|
|
116036
116115
|
server2.close();
|
|
116037
116116
|
return failure5;
|
|
116038
116117
|
}
|