wildcrane-runner 0.6.38 → 0.6.40

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/runner.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.38 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.40 — 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;
@@ -111400,8 +111400,8 @@ function status(line) {
111400
111400
  }
111401
111401
 
111402
111402
  // src/protocol.ts
111403
- var VERSION = true ? "0.6.38" : "0.0.0";
111404
- var AKB_VERSION = true ? "0.11.32" : "0.0.0";
111403
+ var VERSION = true ? "0.6.40" : "0.0.0";
111404
+ var AKB_VERSION = true ? "0.11.34" : "0.0.0";
111405
111405
  var AKB_CONTRACT = true ? 8 : 0;
111406
111406
  var EXIT_REFUSED = 10;
111407
111407
  var EXIT_OUTDATED = 11;
@@ -112936,7 +112936,7 @@ function createTail(log) {
112936
112936
  // ../cli/package.json
112937
112937
  var package_default = {
112938
112938
  name: "wildcrane",
112939
- version: "0.11.32",
112939
+ version: "0.11.34",
112940
112940
  akbContract: 8,
112941
112941
  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.",
112942
112942
  keywords: [
@@ -120068,10 +120068,6 @@ async function runFlow(job, ws, deps, io) {
120068
120068
  said = { title: task.value.title?.trim() ?? "", request: task.value.request?.trim() ?? "" };
120069
120069
  }
120070
120070
  const title = said.title || "Untitled";
120071
- if (isBuilder(ws)) {
120072
- const placed = await placeDraft(ws, deps.api);
120073
- if (!placed.ok) return fail(placed.error);
120074
- }
120075
120071
  const body = path39.join(ws.board, ".sync", `${ws.task}.request.md`);
120076
120072
  fs36.mkdirSync(path39.dirname(body), { recursive: true });
120077
120073
  if (!ws.number) return fail("This task has no number yet.");
@@ -120079,23 +120075,33 @@ async function runFlow(job, ws, deps, io) {
120079
120075
  ${isBuilder(ws) ? `
120080
120076
  ${draftLine(ws)}
120081
120077
  ` : ""}${pictures(job, ws, ws.number)}`);
120082
- const created = made(await akb([
120083
- "raw",
120084
- "create",
120085
- "--title",
120086
- title,
120087
- "--workflow",
120088
- workflowName(flow.workflow),
120089
- "--body-file",
120090
- body,
120091
- "--id",
120092
- String(ws.number),
120093
- ...cardFlags(ws, flow.metadata),
120094
- "--json"
120095
- ]));
120096
- fs36.rmSync(body, { force: true });
120078
+ const created = await withBoard(ws, async (push2) => {
120079
+ const card2 = made(await akb([
120080
+ "raw",
120081
+ "create",
120082
+ "--title",
120083
+ title,
120084
+ "--workflow",
120085
+ workflowName(flow.workflow),
120086
+ "--body-file",
120087
+ body,
120088
+ "--id",
120089
+ String(ws.number),
120090
+ ...cardFlags(ws, flow.metadata),
120091
+ "--json"
120092
+ ]));
120093
+ fs36.rmSync(body, { force: true });
120094
+ if (!card2.ok) return card2;
120095
+ const sent = await push2({ id: job.id, machineId: deps.machineId });
120096
+ if (!sent.ok) return { ok: false, error: sent.error };
120097
+ const placed = isBuilder(ws) ? await placeDraft(ws, deps.api) : card2;
120098
+ return placed.ok ? card2 : placed;
120099
+ });
120097
120100
  if (!created.ok) return fail(created.error);
120098
120101
  id = created.value;
120102
+ } else if (id && isBuilder(ws)) {
120103
+ const placed = await withBoard(ws, () => placeDraft(ws, deps.api));
120104
+ if (!placed.ok) return fail(placed.error);
120099
120105
  }
120100
120106
  if (!id) return fail("This task has no card on this computer.");
120101
120107
  const card = id;
@@ -122040,22 +122046,32 @@ var CRANE = "M2 55.75C2 55.69 2.69 55.09 3.55 54.37L5.09 53.1L6.61 53.1L8.13 53.
122040
122046
  var CREST = "M44.97 27.45C44.61 26.89 46.57 25.76 47.87 25.76C48.72 25.76 50.6 26.7 50.6 27.14C50.6 27.64 45.27 27.97 44.97 27.45Z";
122041
122047
  var COPY = {
122042
122048
  zh: {
122049
+ choose: ["\u767B\u5F55 WildCrane", "\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF0C\u5B8C\u6210\u540E\u56DE\u5230 WildCrane\u3002"],
122050
+ github: "\u7528 GitHub \u767B\u5F55",
122051
+ google: "\u7528 Google \u767B\u5F55",
122043
122052
  ok: ["\u5DF2\u767B\u5F55 WildCrane", "\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u56DE\u5230 WildCrane \u7EE7\u7EED\u3002"],
122044
- denied: ["\u767B\u5F55\u672A\u5B8C\u6210", "\u4F60\u53D6\u6D88\u4E86 GitHub \u6388\u6743\u3002\u8BF7\u56DE\u5230 WildCrane \u91CD\u65B0\u767B\u5F55\u3002"],
122053
+ denied: ["\u767B\u5F55\u672A\u5B8C\u6210", "\u4F60\u53D6\u6D88\u4E86\u6388\u6743\u3002\u8BF7\u56DE\u5230 WildCrane \u91CD\u65B0\u767B\u5F55\u3002"],
122045
122054
  failed: ["\u767B\u5F55\u672A\u5B8C\u6210", "\u767B\u5F55\u65F6\u51FA\u4E86\u70B9\u95EE\u9898\u3002\u8BF7\u56DE\u5230 WildCrane \u91CD\u8BD5\u3002"]
122046
122055
  },
122047
122056
  en: {
122057
+ choose: ["Sign in to WildCrane", "Choose how to sign in, then return to WildCrane."],
122058
+ github: "Sign in with GitHub",
122059
+ google: "Sign in with Google",
122048
122060
  ok: ["Signed in to WildCrane", "You can close this page and return to WildCrane."],
122049
- denied: ["Sign-in didn't finish", "GitHub access was cancelled. Return to WildCrane to sign in again."],
122061
+ denied: ["Sign-in didn't finish", "Access was cancelled. Return to WildCrane to sign in again."],
122050
122062
  failed: ["Sign-in didn't finish", "Something went wrong while signing in. Return to WildCrane to try again."]
122051
122063
  }
122052
122064
  };
122053
122065
  var langOf = (accept) => /^\s*zh\b/i.test(accept ?? "") ? "zh" : "en";
122054
- var PAGE = (outcome, lang) => {
122055
- const [title, body] = COPY[lang][outcome];
122066
+ var GITHUB_ICON = '<svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/></svg>';
122067
+ var GOOGLE_ICON = '<svg viewBox="0 0 48 48" width="17" height="17" aria-hidden="true"><path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"/><path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"/><path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"/><path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"/></svg>';
122068
+ var PAGE = (outcome, lang, links) => {
122069
+ const c2 = COPY[lang];
122070
+ const [title, body] = c2[outcome];
122056
122071
  const ok = outcome === "ok";
122057
122072
  const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
122058
- 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{margin-top:16px;font-size:24px;font-weight:850;line-height:1.25;letter-spacing:-0.02em}p{margin:8px auto 0;max-width:38ch;font-size:13px;line-height:19px;color:#565550}</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><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">${icon}</svg></span><h1>${title}</h1><p>${body}</p></div></main></html>`;
122073
+ const top = links ? `<h1>${title}</h1><p>${body}</p><nav><a class="dark" href="${links.github}">${GITHUB_ICON}${c2.github}</a><a href="${links.google}">${GOOGLE_ICON}${c2.google}</a></nav>` : `<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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
122074
+ 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}</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>`;
122059
122075
  };
122060
122076
  async function signIn(options = {}) {
122061
122077
  const generation = accountGeneration();
@@ -122067,6 +122083,12 @@ async function signIn(options = {}) {
122067
122083
  let answering = false;
122068
122084
  const server = http.createServer(async (req, res) => {
122069
122085
  const asked = new URL(req.url ?? "/", "http://127.0.0.1");
122086
+ const lang = langOf(req.headers["accept-language"]);
122087
+ if (asked.pathname === "/" && !answering) {
122088
+ res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" });
122089
+ res.end(PAGE("choose", lang, { github: authorize("github"), google: authorize("google") }));
122090
+ return;
122091
+ }
122070
122092
  if (asked.pathname !== "/signed-in" || answering) {
122071
122093
  res.writeHead(404).end();
122072
122094
  return;
@@ -122081,21 +122103,25 @@ async function signIn(options = {}) {
122081
122103
  };
122082
122104
  const outcome = !failure2 ? "ok" : failure2.why === "denied" ? "denied" : "failed";
122083
122105
  res.writeHead(200, { "content-type": "text/html; charset=utf-8" });
122084
- res.end(PAGE(outcome, langOf(req.headers["accept-language"])));
122106
+ res.end(PAGE(outcome, lang));
122085
122107
  finish2(failure2);
122086
122108
  });
122087
122109
  await new Promise((resolve2) => server.listen(0, "127.0.0.1", resolve2));
122088
122110
  const { port } = server.address();
122089
122111
  const { supabaseUrl } = cloudEndpoints();
122090
- const url = new URL(`${supabaseUrl}/auth/v1/authorize`);
122091
- url.searchParams.set("provider", "github");
122092
- url.searchParams.set("redirect_to", `http://127.0.0.1:${port}/signed-in`);
122093
- url.searchParams.set("scopes", "user:email");
122094
- url.searchParams.set("code_challenge", challenge);
122095
- url.searchParams.set("code_challenge_method", "s256");
122112
+ const authorize = (provider) => {
122113
+ const url = new URL(`${supabaseUrl}/auth/v1/authorize`);
122114
+ url.searchParams.set("provider", provider);
122115
+ url.searchParams.set("redirect_to", `http://127.0.0.1:${port}/signed-in`);
122116
+ if (provider === "github") url.searchParams.set("scopes", "user:email");
122117
+ url.searchParams.set("code_challenge", challenge);
122118
+ url.searchParams.set("code_challenge_method", "s256");
122119
+ return url.toString().replace(/&/g, "&amp;");
122120
+ };
122121
+ const choose = `http://127.0.0.1:${port}/`;
122096
122122
  const onUrl = options.onUrl ?? ((u2) => status(t.signIn(u2)));
122097
- onUrl(url.toString());
122098
- openBrowser(url.toString());
122123
+ onUrl(choose);
122124
+ openBrowser(choose);
122099
122125
  const timer = setTimeout(() => finish2({ why: "timeout", detail: "timed out" }), WAIT_MS);
122100
122126
  const cancel = () => finish2({ why: "cancelled", detail: "cancelled" });
122101
122127
  options.signal?.addEventListener("abort", cancel);