wildcrane-runner 0.6.43 → 0.6.44
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 +5 -5
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/launcher.mjs +102 -14
- package/dist/plugin.mjs +102 -14
- package/dist/runner.mjs +113 -17
- package/dist/settings.mjs +102 -14
- package/package.json +1 -1
package/dist/akb/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.38 — built by runner/scripts/build.mjs. Do not edit.
|
|
3
3
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
4
4
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
5
5
|
var __create = Object.create;
|
|
@@ -130,10 +130,10 @@ async function refresh() {
|
|
|
130
130
|
const now = readSession();
|
|
131
131
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
132
132
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
133
|
-
const {
|
|
133
|
+
const { api, anonKey } = cloudEndpoints();
|
|
134
134
|
let response;
|
|
135
135
|
try {
|
|
136
|
-
response = await fetch(`${
|
|
136
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
137
137
|
method: "POST",
|
|
138
138
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
139
139
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -4207,7 +4207,7 @@ var init_package = __esm({
|
|
|
4207
4207
|
"../cli/package.json"() {
|
|
4208
4208
|
package_default = {
|
|
4209
4209
|
name: "wildcrane",
|
|
4210
|
-
version: "0.11.
|
|
4210
|
+
version: "0.11.38",
|
|
4211
4211
|
akbContract: 9,
|
|
4212
4212
|
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.",
|
|
4213
4213
|
keywords: [
|
|
@@ -22944,7 +22944,7 @@ var init_card_chat = __esm({
|
|
|
22944
22944
|
var update_workflow_default;
|
|
22945
22945
|
var init_update_workflow = __esm({
|
|
22946
22946
|
"../cli/src/guide/update-workflow.md"() {
|
|
22947
|
-
update_workflow_default = "# Update a workflow\n\nChange one of this workspace's workflows so new tasks run the new version.\n\n## How a workflow works\n\nA workflow is steerable: agents do the work, and a person reviews and fine-tunes only the parts where precision matters most, so the result stays reliable.\n\n- **Previews**: usually one preview agent shows the first draft; add another only when a part needs precision and a mistake there is costly, such as a developer tool's screens. Each shows only what the person decides on, without overlapping another. With none, the card the `WORKFLOW.md` body writes is the only review.\n- **Unreviewable previews**: when the user finds a preview unneeded or cannot judge it, remove it; a land agent checks that part instead, or nobody does.\n- **Stages**: one stage by default. Add `after` only when a draft is too costly to make before another is approved, such as a video's storyboard, which waits for its script.\n- **Minimal**: when the user outlines the workflow, keep it that simple or simpler; add no review point or constraint they did not ask for, and let the trial show what else needs review.\n- **Judgment**: leave to an agent what it can judge; never add a hard rule for one case, and keep a rule only once real runs show it holds widely.\n- **Memory**: give an agent memory only where it has wide latitude and tends to err or be corrected to taste, naming those error-prone points as what it records; give a narrow agent none.\n- **Land**: everything else runs unattended after the last approval and follows the approved drafts, such as building and merging a change; leave `land` empty when the last approved preview is the deliverable.\n- **Scheduled**: repeating work runs as a scheduled agent without previews; a workflow may hold only scheduled agents.\n- **`WORKFLOW.md`**: list its agents under `previews`, `land` and `scheduled`; `description` says in one sentence what it does; `when` tells an agent which requests it is for, exceptions included; the body is how a card of this kind is written.\n- **Agents**: write each as `akb guide write-agent` says.\n\n## Versions\n\n- **Pinned**: a workflow and the agents it holds live in Cloud as numbered versions; a task\n keeps the version it started with, and only tasks started after a push take the new one.\n- **Project agents**: agents under the board's `agents/` folder are the project's own; a\n workflow may name them, but they are not part of its versions and an edit there applies to\n every card at once.\n- **Own workflows only**: only the workspace's own workflows take a new version; ask the user to\n copy a built-in or marketplace one on the web first.\n\n## Change it\n\n- **Standing preference**: when the user only wants a lasting rule for a workflow or one of its\n agents and the flow itself stays, set it with `akb workflow rule <workflow>` or\n `akb workflow instructions <agent>` instead of pushing; it reaches every task's later runs and\n works on built-in workflows too. Either replaces all of them, so run it bare first to read the\n current ones, and keep each unless the user asks to change or drop it.\n- **Direct or task**: push directly a change the user spelled out; start a Workflow builder task\n instead when the change adds, removes or restages agents, or when the user wants to
|
|
22947
|
+
update_workflow_default = "# Update a workflow\n\nChange one of this workspace's workflows so new tasks run the new version.\n\n## How a workflow works\n\nA workflow is steerable: agents do the work, and a person reviews and fine-tunes only the parts where precision matters most, so the result stays reliable.\n\n- **Previews**: usually one preview agent shows the first draft; add another only when a part needs precision and a mistake there is costly, such as a developer tool's screens. Each shows only what the person decides on, without overlapping another. With none, the card the `WORKFLOW.md` body writes is the only review.\n- **Unreviewable previews**: when the user finds a preview unneeded or cannot judge it, remove it; a land agent checks that part instead, or nobody does.\n- **Stages**: one stage by default. Add `after` only when a draft is too costly to make before another is approved, such as a video's storyboard, which waits for its script.\n- **Minimal**: when the user outlines the workflow, keep it that simple or simpler; add no review point or constraint they did not ask for, and let the trial show what else needs review.\n- **Judgment**: leave to an agent what it can judge; never add a hard rule for one case, and keep a rule only once real runs show it holds widely.\n- **Memory**: give an agent memory only where it has wide latitude and tends to err or be corrected to taste, naming those error-prone points as what it records; give a narrow agent none.\n- **Land**: everything else runs unattended after the last approval and follows the approved drafts, such as building and merging a change; leave `land` empty when the last approved preview is the deliverable.\n- **Scheduled**: repeating work runs as a scheduled agent without previews; a workflow may hold only scheduled agents.\n- **`WORKFLOW.md`**: list its agents under `previews`, `land` and `scheduled`; `description` says in one sentence what it does; `when` tells an agent which requests it is for, exceptions included; the body is how a card of this kind is written.\n- **Agents**: write each as `akb guide write-agent` says.\n\n## Versions\n\n- **Pinned**: a workflow and the agents it holds live in Cloud as numbered versions; a task\n keeps the version it started with, and only tasks started after a push take the new one.\n- **Project agents**: agents under the board's `agents/` folder are the project's own; a\n workflow may name them, but they are not part of its versions and an edit there applies to\n every card at once.\n- **Own workflows only**: only the workspace's own workflows take a new version; ask the user to\n copy a built-in or marketplace one on the web first.\n\n## Change it\n\n- **Standing preference**: when the user only wants a lasting rule for a workflow or one of its\n agents and the flow itself stays, set it with `akb workflow rule <workflow>` or\n `akb workflow instructions <agent>` instead of pushing; it reaches every task's later runs and\n works on built-in workflows too. Either replaces all of them, so run it bare first to read the\n current ones, and keep each unless the user asks to change or drop it.\n- **Direct or task**: push directly a change the user spelled out; start a Workflow builder task\n instead when the change adds, removes or restages agents, or when the user wants to review\n it before it applies.\n- **Steps**: `akb workflow pull <id> <folder>`, edit the files there and keep what the request\n leaves alone, fix every problem `akb raw workflow validate <folder>` reports, then\n `akb workflow push <folder>`.\n- **Moved on**: when push says Cloud has a newer version, pull again and redo the change.\n";
|
|
22948
22948
|
}
|
|
22949
22949
|
});
|
|
22950
22950
|
|
package/dist/akb/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"wildcrane","version":"0.11.
|
|
1
|
+
{"name":"wildcrane","version":"0.11.38","akbContract":9,"type":"module","private":true}
|
package/dist/akb-proxy.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.44 — 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;
|
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.44 — 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;
|
|
@@ -26889,8 +26889,8 @@ function saveAlphaUpdates(value) {
|
|
|
26889
26889
|
}
|
|
26890
26890
|
|
|
26891
26891
|
// src/protocol.ts
|
|
26892
|
-
var VERSION = true ? "0.6.
|
|
26893
|
-
var AKB_VERSION = true ? "0.11.
|
|
26892
|
+
var VERSION = true ? "0.6.44" : "0.0.0";
|
|
26893
|
+
var AKB_VERSION = true ? "0.11.38" : "0.0.0";
|
|
26894
26894
|
var EXIT_REFUSED = 10;
|
|
26895
26895
|
var EXIT_OUTDATED = 11;
|
|
26896
26896
|
var EXIT_UPDATE = 12;
|
|
@@ -27295,10 +27295,10 @@ async function refresh() {
|
|
|
27295
27295
|
const now = readSession();
|
|
27296
27296
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
27297
27297
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
27298
|
-
const {
|
|
27298
|
+
const { api, anonKey } = cloudEndpoints();
|
|
27299
27299
|
let response;
|
|
27300
27300
|
try {
|
|
27301
|
-
response = await fetch(`${
|
|
27301
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
27302
27302
|
method: "POST",
|
|
27303
27303
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
27304
27304
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -29615,7 +29615,7 @@ function createTail(log) {
|
|
|
29615
29615
|
// ../cli/package.json
|
|
29616
29616
|
var package_default = {
|
|
29617
29617
|
name: "wildcrane",
|
|
29618
|
-
version: "0.11.
|
|
29618
|
+
version: "0.11.38",
|
|
29619
29619
|
akbContract: 9,
|
|
29620
29620
|
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.",
|
|
29621
29621
|
keywords: [
|
|
@@ -31999,6 +31999,19 @@ var CREST = "M44.97 27.45C44.61 26.89 46.57 25.76 47.87 25.76C48.72 25.76 50.6 2
|
|
|
31999
31999
|
var COPY = {
|
|
32000
32000
|
zh: {
|
|
32001
32001
|
choose: ["\u767B\u5F55 WildCrane", "\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF0C\u5B8C\u6210\u540E\u56DE\u5230 WildCrane\u3002"],
|
|
32002
|
+
email: "name@company.com",
|
|
32003
|
+
send: "\u53D1\u9001\u9A8C\u8BC1\u7801",
|
|
32004
|
+
sending: "\u6B63\u5728\u53D1\u9001\u2026",
|
|
32005
|
+
or: "\u6216",
|
|
32006
|
+
sent: "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ",
|
|
32007
|
+
code: "6 \u4F4D\u9A8C\u8BC1\u7801",
|
|
32008
|
+
submit: "\u767B\u5F55",
|
|
32009
|
+
verifying: "\u6B63\u5728\u767B\u5F55\u2026",
|
|
32010
|
+
change: "\u6362\u4E2A\u90AE\u7BB1",
|
|
32011
|
+
badEmail: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u3002",
|
|
32012
|
+
badCode: "\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u6216\u91CD\u65B0\u53D1\u9001\u3002",
|
|
32013
|
+
tooMany: "\u8BF7\u6C42\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
32014
|
+
error: "\u767B\u5F55\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
32002
32015
|
github: "\u7528 GitHub \u767B\u5F55",
|
|
32003
32016
|
google: "\u7528 Google \u767B\u5F55",
|
|
32004
32017
|
ok: ["\u5DF2\u767B\u5F55 WildCrane", "\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u56DE\u5230 WildCrane \u7EE7\u7EED\u3002"],
|
|
@@ -32007,6 +32020,19 @@ var COPY = {
|
|
|
32007
32020
|
},
|
|
32008
32021
|
en: {
|
|
32009
32022
|
choose: ["Sign in to WildCrane", "Choose how to sign in, then return to WildCrane."],
|
|
32023
|
+
email: "name@company.com",
|
|
32024
|
+
send: "Send code",
|
|
32025
|
+
sending: "Sending\u2026",
|
|
32026
|
+
or: "or",
|
|
32027
|
+
sent: "We sent a code to ",
|
|
32028
|
+
code: "6-digit code",
|
|
32029
|
+
submit: "Sign in",
|
|
32030
|
+
verifying: "Signing in\u2026",
|
|
32031
|
+
change: "Use a different email",
|
|
32032
|
+
badEmail: "Enter a valid email.",
|
|
32033
|
+
badCode: "That code is wrong or has expired. Try again or resend it.",
|
|
32034
|
+
tooMany: "Too many attempts. Try again in a moment.",
|
|
32035
|
+
error: "Sign-in didn't finish. Try again.",
|
|
32010
32036
|
github: "Sign in with GitHub",
|
|
32011
32037
|
google: "Sign in with Google",
|
|
32012
32038
|
ok: ["Signed in to WildCrane", "You can close this page and return to WildCrane."],
|
|
@@ -32017,13 +32043,24 @@ var COPY = {
|
|
|
32017
32043
|
var langOf = (accept) => /^\s*zh\b/i.test(accept ?? "") ? "zh" : "en";
|
|
32018
32044
|
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>';
|
|
32019
32045
|
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>';
|
|
32046
|
+
var EMAIL_SCRIPT = (c) => `(()=>{const t=${JSON.stringify({
|
|
32047
|
+
send: c.send,
|
|
32048
|
+
sending: c.sending,
|
|
32049
|
+
sent: c.sent,
|
|
32050
|
+
submit: c.submit,
|
|
32051
|
+
verifying: c.verifying,
|
|
32052
|
+
badEmail: c.badEmail,
|
|
32053
|
+
badCode: c.badCode,
|
|
32054
|
+
tooMany: c.tooMany,
|
|
32055
|
+
error: c.error
|
|
32056
|
+
}).replace(/</g, "\\u003c")};const $=(i)=>document.getElementById(i),f=$('f'),e=$('e'),c=$('c'),b=$('b'),m=$('m'),x=$('x');let to='';const say=(s,bad)=>{m.textContent=s;m.className=bad?'bad':''};const step=(code)=>{to=code?e.value.trim():'';e.hidden=!!code;c.hidden=!code;x.hidden=!code;b.textContent=code?t.submit:t.send;if(code){say(t.sent+to);c.value='';c.focus()}else{say('');e.focus()}};x.onclick=()=>step(false);f.onsubmit=async(ev)=>{ev.preventDefault();const verify=!!to;if(!verify&&!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(e.value.trim()))return say(t.badEmail,true);b.disabled=true;b.textContent=verify?t.verifying:t.sending;let r={error:'failed'};try{r=await (await fetch(verify?'/verify':'/send',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(verify?{email:to,code:c.value.trim()}:{email:e.value.trim()})})).json()}catch{}b.disabled=false;if(r.ok){if(!verify)return step(true);document.open();document.write(r.page);return document.close()}b.textContent=verify?t.submit:t.send;say(r.error==='bad_code'?t.badCode:r.error==='too_many'?t.tooMany:t.error,true)}})()`;
|
|
32020
32057
|
var PAGE = (outcome, lang, links) => {
|
|
32021
32058
|
const c = COPY[lang];
|
|
32022
32059
|
const [title, body] = c[outcome];
|
|
32023
32060
|
const ok = outcome === "ok";
|
|
32024
32061
|
const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
32025
|
-
const top = links ? `<h1>${title}</h1><p>${body}</p><
|
|
32026
|
-
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>`;
|
|
32062
|
+
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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
32063
|
+
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>`;
|
|
32027
32064
|
};
|
|
32028
32065
|
async function signIn(options = {}) {
|
|
32029
32066
|
const generation = accountGeneration();
|
|
@@ -32041,6 +32078,18 @@ async function signIn(options = {}) {
|
|
|
32041
32078
|
res.end(PAGE("choose", lang, { github: authorize("github"), google: authorize("google") }));
|
|
32042
32079
|
return;
|
|
32043
32080
|
}
|
|
32081
|
+
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
32082
|
+
const asks = await readJson(req);
|
|
32083
|
+
const answer = asked.pathname === "/send" ? await sendCode(asks.email ?? "", lang) : await verifyCode(asks.email ?? "", asks.code ?? "", generation, options.signal);
|
|
32084
|
+
const done = answer.ok && asked.pathname === "/verify";
|
|
32085
|
+
res.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" });
|
|
32086
|
+
res.end(JSON.stringify(done ? { ...answer, page: PAGE("ok", lang) } : answer));
|
|
32087
|
+
if (done) {
|
|
32088
|
+
answering = true;
|
|
32089
|
+
finish(null);
|
|
32090
|
+
}
|
|
32091
|
+
return;
|
|
32092
|
+
}
|
|
32044
32093
|
if (asked.pathname !== "/signed-in" || answering) {
|
|
32045
32094
|
res.writeHead(404).end();
|
|
32046
32095
|
return;
|
|
@@ -32084,14 +32133,9 @@ async function signIn(options = {}) {
|
|
|
32084
32133
|
return failure2;
|
|
32085
32134
|
}
|
|
32086
32135
|
async function exchange(code, verifier, generation, signal) {
|
|
32087
|
-
const { supabaseUrl, anonKey } = cloudEndpoints();
|
|
32088
32136
|
let response;
|
|
32089
32137
|
try {
|
|
32090
|
-
response = await
|
|
32091
|
-
method: "POST",
|
|
32092
|
-
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
32093
|
-
body: JSON.stringify({ auth_code: code, code_verifier: verifier })
|
|
32094
|
-
});
|
|
32138
|
+
response = await authCall("token?grant_type=pkce", { auth_code: code, code_verifier: verifier });
|
|
32095
32139
|
} catch (e) {
|
|
32096
32140
|
return { why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
32097
32141
|
}
|
|
@@ -32101,6 +32145,50 @@ async function exchange(code, verifier, generation, signal) {
|
|
|
32101
32145
|
writeSession(session);
|
|
32102
32146
|
return null;
|
|
32103
32147
|
}
|
|
32148
|
+
var authCall = (path26, body) => {
|
|
32149
|
+
const { api, anonKey } = cloudEndpoints();
|
|
32150
|
+
return fetch(`${api}/auth/v1/${path26}`, {
|
|
32151
|
+
method: "POST",
|
|
32152
|
+
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
32153
|
+
body: JSON.stringify(body),
|
|
32154
|
+
signal: AbortSignal.timeout(2e4)
|
|
32155
|
+
});
|
|
32156
|
+
};
|
|
32157
|
+
var refusal2 = (status2) => ({ ok: false, error: status2 === 429 ? "too_many" : status2 === 400 || status2 === 401 || status2 === 403 ? "bad_code" : "failed" });
|
|
32158
|
+
async function sendCode(email, lang) {
|
|
32159
|
+
try {
|
|
32160
|
+
const response = await authCall("otp", { email: email.trim(), create_user: true, data: { lang } });
|
|
32161
|
+
return response.ok ? { ok: true } : { ok: false, error: response.status === 429 ? "too_many" : "failed" };
|
|
32162
|
+
} catch {
|
|
32163
|
+
return { ok: false, error: "failed" };
|
|
32164
|
+
}
|
|
32165
|
+
}
|
|
32166
|
+
async function verifyCode(email, code, generation, signal) {
|
|
32167
|
+
let response;
|
|
32168
|
+
try {
|
|
32169
|
+
response = await authCall("verify", { type: "email", email: email.trim(), token: code.trim() });
|
|
32170
|
+
} catch {
|
|
32171
|
+
return { ok: false, error: "failed" };
|
|
32172
|
+
}
|
|
32173
|
+
if (!response.ok) return refusal2(response.status);
|
|
32174
|
+
const session = sessionFrom(await response.json().catch(() => ({})));
|
|
32175
|
+
if (!session) return { ok: false, error: "failed" };
|
|
32176
|
+
if (signal?.aborted || accountGeneration() !== generation) return { ok: false, error: "failed" };
|
|
32177
|
+
writeSession(session);
|
|
32178
|
+
return { ok: true };
|
|
32179
|
+
}
|
|
32180
|
+
async function readJson(req) {
|
|
32181
|
+
let text2 = "";
|
|
32182
|
+
for await (const chunk of req) {
|
|
32183
|
+
text2 += chunk;
|
|
32184
|
+
if (text2.length > 1e4) break;
|
|
32185
|
+
}
|
|
32186
|
+
try {
|
|
32187
|
+
return JSON.parse(text2);
|
|
32188
|
+
} catch {
|
|
32189
|
+
return {};
|
|
32190
|
+
}
|
|
32191
|
+
}
|
|
32104
32192
|
function openBrowser2(url) {
|
|
32105
32193
|
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
32106
32194
|
try {
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.44 — 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;
|
|
@@ -73538,10 +73538,10 @@ async function refresh() {
|
|
|
73538
73538
|
const now = readSession();
|
|
73539
73539
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
73540
73540
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
73541
|
-
const {
|
|
73541
|
+
const { api, anonKey } = cloudEndpoints();
|
|
73542
73542
|
let response;
|
|
73543
73543
|
try {
|
|
73544
|
-
response = await fetch(`${
|
|
73544
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
73545
73545
|
method: "POST",
|
|
73546
73546
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
73547
73547
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -73760,8 +73760,8 @@ function machineId() {
|
|
|
73760
73760
|
var machineName = () => os2.hostname().replace(/\.local$/, "");
|
|
73761
73761
|
|
|
73762
73762
|
// src/protocol.ts
|
|
73763
|
-
var VERSION = true ? "0.6.
|
|
73764
|
-
var AKB_VERSION = true ? "0.11.
|
|
73763
|
+
var VERSION = true ? "0.6.44" : "0.0.0";
|
|
73764
|
+
var AKB_VERSION = true ? "0.11.38" : "0.0.0";
|
|
73765
73765
|
var EXIT_REFUSED = 10;
|
|
73766
73766
|
var EXIT_OUTDATED = 11;
|
|
73767
73767
|
var EXIT_UPDATE = 12;
|
|
@@ -76198,7 +76198,7 @@ function createTail(log) {
|
|
|
76198
76198
|
// ../cli/package.json
|
|
76199
76199
|
var package_default = {
|
|
76200
76200
|
name: "wildcrane",
|
|
76201
|
-
version: "0.11.
|
|
76201
|
+
version: "0.11.38",
|
|
76202
76202
|
akbContract: 9,
|
|
76203
76203
|
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.",
|
|
76204
76204
|
keywords: [
|
|
@@ -78608,6 +78608,19 @@ var CREST = "M44.97 27.45C44.61 26.89 46.57 25.76 47.87 25.76C48.72 25.76 50.6 2
|
|
|
78608
78608
|
var COPY = {
|
|
78609
78609
|
zh: {
|
|
78610
78610
|
choose: ["\u767B\u5F55 WildCrane", "\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF0C\u5B8C\u6210\u540E\u56DE\u5230 WildCrane\u3002"],
|
|
78611
|
+
email: "name@company.com",
|
|
78612
|
+
send: "\u53D1\u9001\u9A8C\u8BC1\u7801",
|
|
78613
|
+
sending: "\u6B63\u5728\u53D1\u9001\u2026",
|
|
78614
|
+
or: "\u6216",
|
|
78615
|
+
sent: "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ",
|
|
78616
|
+
code: "6 \u4F4D\u9A8C\u8BC1\u7801",
|
|
78617
|
+
submit: "\u767B\u5F55",
|
|
78618
|
+
verifying: "\u6B63\u5728\u767B\u5F55\u2026",
|
|
78619
|
+
change: "\u6362\u4E2A\u90AE\u7BB1",
|
|
78620
|
+
badEmail: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u3002",
|
|
78621
|
+
badCode: "\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u6216\u91CD\u65B0\u53D1\u9001\u3002",
|
|
78622
|
+
tooMany: "\u8BF7\u6C42\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
78623
|
+
error: "\u767B\u5F55\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
78611
78624
|
github: "\u7528 GitHub \u767B\u5F55",
|
|
78612
78625
|
google: "\u7528 Google \u767B\u5F55",
|
|
78613
78626
|
ok: ["\u5DF2\u767B\u5F55 WildCrane", "\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u56DE\u5230 WildCrane \u7EE7\u7EED\u3002"],
|
|
@@ -78616,6 +78629,19 @@ var COPY = {
|
|
|
78616
78629
|
},
|
|
78617
78630
|
en: {
|
|
78618
78631
|
choose: ["Sign in to WildCrane", "Choose how to sign in, then return to WildCrane."],
|
|
78632
|
+
email: "name@company.com",
|
|
78633
|
+
send: "Send code",
|
|
78634
|
+
sending: "Sending\u2026",
|
|
78635
|
+
or: "or",
|
|
78636
|
+
sent: "We sent a code to ",
|
|
78637
|
+
code: "6-digit code",
|
|
78638
|
+
submit: "Sign in",
|
|
78639
|
+
verifying: "Signing in\u2026",
|
|
78640
|
+
change: "Use a different email",
|
|
78641
|
+
badEmail: "Enter a valid email.",
|
|
78642
|
+
badCode: "That code is wrong or has expired. Try again or resend it.",
|
|
78643
|
+
tooMany: "Too many attempts. Try again in a moment.",
|
|
78644
|
+
error: "Sign-in didn't finish. Try again.",
|
|
78619
78645
|
github: "Sign in with GitHub",
|
|
78620
78646
|
google: "Sign in with Google",
|
|
78621
78647
|
ok: ["Signed in to WildCrane", "You can close this page and return to WildCrane."],
|
|
@@ -78626,13 +78652,24 @@ var COPY = {
|
|
|
78626
78652
|
var langOf = (accept) => /^\s*zh\b/i.test(accept ?? "") ? "zh" : "en";
|
|
78627
78653
|
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>';
|
|
78628
78654
|
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>';
|
|
78655
|
+
var EMAIL_SCRIPT = (c) => `(()=>{const t=${JSON.stringify({
|
|
78656
|
+
send: c.send,
|
|
78657
|
+
sending: c.sending,
|
|
78658
|
+
sent: c.sent,
|
|
78659
|
+
submit: c.submit,
|
|
78660
|
+
verifying: c.verifying,
|
|
78661
|
+
badEmail: c.badEmail,
|
|
78662
|
+
badCode: c.badCode,
|
|
78663
|
+
tooMany: c.tooMany,
|
|
78664
|
+
error: c.error
|
|
78665
|
+
}).replace(/</g, "\\u003c")};const $=(i)=>document.getElementById(i),f=$('f'),e=$('e'),c=$('c'),b=$('b'),m=$('m'),x=$('x');let to='';const say=(s,bad)=>{m.textContent=s;m.className=bad?'bad':''};const step=(code)=>{to=code?e.value.trim():'';e.hidden=!!code;c.hidden=!code;x.hidden=!code;b.textContent=code?t.submit:t.send;if(code){say(t.sent+to);c.value='';c.focus()}else{say('');e.focus()}};x.onclick=()=>step(false);f.onsubmit=async(ev)=>{ev.preventDefault();const verify=!!to;if(!verify&&!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(e.value.trim()))return say(t.badEmail,true);b.disabled=true;b.textContent=verify?t.verifying:t.sending;let r={error:'failed'};try{r=await (await fetch(verify?'/verify':'/send',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(verify?{email:to,code:c.value.trim()}:{email:e.value.trim()})})).json()}catch{}b.disabled=false;if(r.ok){if(!verify)return step(true);document.open();document.write(r.page);return document.close()}b.textContent=verify?t.submit:t.send;say(r.error==='bad_code'?t.badCode:r.error==='too_many'?t.tooMany:t.error,true)}})()`;
|
|
78629
78666
|
var PAGE = (outcome, lang, links) => {
|
|
78630
78667
|
const c = COPY[lang];
|
|
78631
78668
|
const [title, body] = c[outcome];
|
|
78632
78669
|
const ok = outcome === "ok";
|
|
78633
78670
|
const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
78634
|
-
const top = links ? `<h1>${title}</h1><p>${body}</p><
|
|
78635
|
-
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>`;
|
|
78671
|
+
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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
78672
|
+
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>`;
|
|
78636
78673
|
};
|
|
78637
78674
|
async function signIn(options = {}) {
|
|
78638
78675
|
const generation = accountGeneration();
|
|
@@ -78650,6 +78687,18 @@ async function signIn(options = {}) {
|
|
|
78650
78687
|
res.end(PAGE("choose", lang, { github: authorize("github"), google: authorize("google") }));
|
|
78651
78688
|
return;
|
|
78652
78689
|
}
|
|
78690
|
+
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
78691
|
+
const asks = await readJson(req);
|
|
78692
|
+
const answer = asked.pathname === "/send" ? await sendCode(asks.email ?? "", lang) : await verifyCode(asks.email ?? "", asks.code ?? "", generation, options.signal);
|
|
78693
|
+
const done = answer.ok && asked.pathname === "/verify";
|
|
78694
|
+
res.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" });
|
|
78695
|
+
res.end(JSON.stringify(done ? { ...answer, page: PAGE("ok", lang) } : answer));
|
|
78696
|
+
if (done) {
|
|
78697
|
+
answering = true;
|
|
78698
|
+
finish(null);
|
|
78699
|
+
}
|
|
78700
|
+
return;
|
|
78701
|
+
}
|
|
78653
78702
|
if (asked.pathname !== "/signed-in" || answering) {
|
|
78654
78703
|
res.writeHead(404).end();
|
|
78655
78704
|
return;
|
|
@@ -78693,14 +78742,9 @@ async function signIn(options = {}) {
|
|
|
78693
78742
|
return failure4;
|
|
78694
78743
|
}
|
|
78695
78744
|
async function exchange(code, verifier, generation, signal) {
|
|
78696
|
-
const { supabaseUrl, anonKey } = cloudEndpoints();
|
|
78697
78745
|
let response;
|
|
78698
78746
|
try {
|
|
78699
|
-
response = await
|
|
78700
|
-
method: "POST",
|
|
78701
|
-
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
78702
|
-
body: JSON.stringify({ auth_code: code, code_verifier: verifier })
|
|
78703
|
-
});
|
|
78747
|
+
response = await authCall("token?grant_type=pkce", { auth_code: code, code_verifier: verifier });
|
|
78704
78748
|
} catch (e) {
|
|
78705
78749
|
return { why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
78706
78750
|
}
|
|
@@ -78710,6 +78754,50 @@ async function exchange(code, verifier, generation, signal) {
|
|
|
78710
78754
|
writeSession(session);
|
|
78711
78755
|
return null;
|
|
78712
78756
|
}
|
|
78757
|
+
var authCall = (path27, body) => {
|
|
78758
|
+
const { api, anonKey } = cloudEndpoints();
|
|
78759
|
+
return fetch(`${api}/auth/v1/${path27}`, {
|
|
78760
|
+
method: "POST",
|
|
78761
|
+
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
78762
|
+
body: JSON.stringify(body),
|
|
78763
|
+
signal: AbortSignal.timeout(2e4)
|
|
78764
|
+
});
|
|
78765
|
+
};
|
|
78766
|
+
var refusal2 = (status2) => ({ ok: false, error: status2 === 429 ? "too_many" : status2 === 400 || status2 === 401 || status2 === 403 ? "bad_code" : "failed" });
|
|
78767
|
+
async function sendCode(email2, lang) {
|
|
78768
|
+
try {
|
|
78769
|
+
const response = await authCall("otp", { email: email2.trim(), create_user: true, data: { lang } });
|
|
78770
|
+
return response.ok ? { ok: true } : { ok: false, error: response.status === 429 ? "too_many" : "failed" };
|
|
78771
|
+
} catch {
|
|
78772
|
+
return { ok: false, error: "failed" };
|
|
78773
|
+
}
|
|
78774
|
+
}
|
|
78775
|
+
async function verifyCode(email2, code, generation, signal) {
|
|
78776
|
+
let response;
|
|
78777
|
+
try {
|
|
78778
|
+
response = await authCall("verify", { type: "email", email: email2.trim(), token: code.trim() });
|
|
78779
|
+
} catch {
|
|
78780
|
+
return { ok: false, error: "failed" };
|
|
78781
|
+
}
|
|
78782
|
+
if (!response.ok) return refusal2(response.status);
|
|
78783
|
+
const session = sessionFrom(await response.json().catch(() => ({})));
|
|
78784
|
+
if (!session) return { ok: false, error: "failed" };
|
|
78785
|
+
if (signal?.aborted || accountGeneration() !== generation) return { ok: false, error: "failed" };
|
|
78786
|
+
writeSession(session);
|
|
78787
|
+
return { ok: true };
|
|
78788
|
+
}
|
|
78789
|
+
async function readJson(req) {
|
|
78790
|
+
let text3 = "";
|
|
78791
|
+
for await (const chunk of req) {
|
|
78792
|
+
text3 += chunk;
|
|
78793
|
+
if (text3.length > 1e4) break;
|
|
78794
|
+
}
|
|
78795
|
+
try {
|
|
78796
|
+
return JSON.parse(text3);
|
|
78797
|
+
} catch {
|
|
78798
|
+
return {};
|
|
78799
|
+
}
|
|
78800
|
+
}
|
|
78713
78801
|
function openBrowser(url) {
|
|
78714
78802
|
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
78715
78803
|
try {
|
package/dist/runner.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.44 — 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;
|
|
@@ -111129,10 +111129,10 @@ async function refresh() {
|
|
|
111129
111129
|
const now = readSession();
|
|
111130
111130
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
111131
111131
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
111132
|
-
const {
|
|
111132
|
+
const { api, anonKey } = cloudEndpoints();
|
|
111133
111133
|
let response;
|
|
111134
111134
|
try {
|
|
111135
|
-
response = await fetch(`${
|
|
111135
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
111136
111136
|
method: "POST",
|
|
111137
111137
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
111138
111138
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -111406,8 +111406,8 @@ function status(line) {
|
|
|
111406
111406
|
}
|
|
111407
111407
|
|
|
111408
111408
|
// src/protocol.ts
|
|
111409
|
-
var VERSION = true ? "0.6.
|
|
111410
|
-
var AKB_VERSION = true ? "0.11.
|
|
111409
|
+
var VERSION = true ? "0.6.44" : "0.0.0";
|
|
111410
|
+
var AKB_VERSION = true ? "0.11.38" : "0.0.0";
|
|
111411
111411
|
var AKB_CONTRACT = true ? 9 : 0;
|
|
111412
111412
|
var EXIT_REFUSED = 10;
|
|
111413
111413
|
var EXIT_OUTDATED = 11;
|
|
@@ -113053,7 +113053,7 @@ function createTail(log) {
|
|
|
113053
113053
|
// ../cli/package.json
|
|
113054
113054
|
var package_default = {
|
|
113055
113055
|
name: "wildcrane",
|
|
113056
|
-
version: "0.11.
|
|
113056
|
+
version: "0.11.38",
|
|
113057
113057
|
akbContract: 9,
|
|
113058
113058
|
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.",
|
|
113059
113059
|
keywords: [
|
|
@@ -115882,8 +115882,8 @@ function connectCloudLive(handlers) {
|
|
|
115882
115882
|
if (!cloudConfigured() || !session || !handlers.topic) return null;
|
|
115883
115883
|
const Socket = globalThis.WebSocket;
|
|
115884
115884
|
if (!Socket) return null;
|
|
115885
|
-
const {
|
|
115886
|
-
const url = `${
|
|
115885
|
+
const { api, anonKey } = cloudEndpoints();
|
|
115886
|
+
const url = `${api.replace(/^http/, "ws")}/realtime/v1/websocket?apikey=${encodeURIComponent(anonKey)}&vsn=${VSN}`;
|
|
115887
115887
|
const topic = `realtime:${handlers.topic}`;
|
|
115888
115888
|
let socket = null;
|
|
115889
115889
|
let heartbeat = null;
|
|
@@ -119899,6 +119899,14 @@ async function placeDraft(ws, read4) {
|
|
|
119899
119899
|
}
|
|
119900
119900
|
return { ok: true, value: void 0 };
|
|
119901
119901
|
}
|
|
119902
|
+
function draftBase(ws) {
|
|
119903
|
+
try {
|
|
119904
|
+
const version = JSON.parse(fs36.readFileSync(path39.join(draftDir(ws), VERSION_FILE), "utf8")).version;
|
|
119905
|
+
return Number.isInteger(version) ? version : void 0;
|
|
119906
|
+
} catch {
|
|
119907
|
+
return void 0;
|
|
119908
|
+
}
|
|
119909
|
+
}
|
|
119902
119910
|
var named = (def) => [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))];
|
|
119903
119911
|
async function builtWorkflow(ws, akb) {
|
|
119904
119912
|
if (!isBuilder(ws)) return null;
|
|
@@ -121841,7 +121849,7 @@ async function finish(deps, id, lease, outcome, reason = "", report2) {
|
|
|
121841
121849
|
async function sendBack(deps, id, lease, ws, said, landed = () => {
|
|
121842
121850
|
}) {
|
|
121843
121851
|
const built = await builtWorkflow(ws, deps.akb);
|
|
121844
|
-
const report2 = built ? { ...said, workflow: { files: built } } : said;
|
|
121852
|
+
const report2 = built ? { ...said, workflow: { files: built, base: draftBase(ws) } } : said;
|
|
121845
121853
|
const pushed = await whileOffline(deps, id, lease, () => push(ws, { id, machineId: deps.machineId }));
|
|
121846
121854
|
if (!pushed) return;
|
|
121847
121855
|
if (pushed.ok) {
|
|
@@ -122358,6 +122366,19 @@ var CREST = "M44.97 27.45C44.61 26.89 46.57 25.76 47.87 25.76C48.72 25.76 50.6 2
|
|
|
122358
122366
|
var COPY = {
|
|
122359
122367
|
zh: {
|
|
122360
122368
|
choose: ["\u767B\u5F55 WildCrane", "\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF0C\u5B8C\u6210\u540E\u56DE\u5230 WildCrane\u3002"],
|
|
122369
|
+
email: "name@company.com",
|
|
122370
|
+
send: "\u53D1\u9001\u9A8C\u8BC1\u7801",
|
|
122371
|
+
sending: "\u6B63\u5728\u53D1\u9001\u2026",
|
|
122372
|
+
or: "\u6216",
|
|
122373
|
+
sent: "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ",
|
|
122374
|
+
code: "6 \u4F4D\u9A8C\u8BC1\u7801",
|
|
122375
|
+
submit: "\u767B\u5F55",
|
|
122376
|
+
verifying: "\u6B63\u5728\u767B\u5F55\u2026",
|
|
122377
|
+
change: "\u6362\u4E2A\u90AE\u7BB1",
|
|
122378
|
+
badEmail: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u3002",
|
|
122379
|
+
badCode: "\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u6216\u91CD\u65B0\u53D1\u9001\u3002",
|
|
122380
|
+
tooMany: "\u8BF7\u6C42\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
122381
|
+
error: "\u767B\u5F55\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
122361
122382
|
github: "\u7528 GitHub \u767B\u5F55",
|
|
122362
122383
|
google: "\u7528 Google \u767B\u5F55",
|
|
122363
122384
|
ok: ["\u5DF2\u767B\u5F55 WildCrane", "\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u56DE\u5230 WildCrane \u7EE7\u7EED\u3002"],
|
|
@@ -122366,6 +122387,19 @@ var COPY = {
|
|
|
122366
122387
|
},
|
|
122367
122388
|
en: {
|
|
122368
122389
|
choose: ["Sign in to WildCrane", "Choose how to sign in, then return to WildCrane."],
|
|
122390
|
+
email: "name@company.com",
|
|
122391
|
+
send: "Send code",
|
|
122392
|
+
sending: "Sending\u2026",
|
|
122393
|
+
or: "or",
|
|
122394
|
+
sent: "We sent a code to ",
|
|
122395
|
+
code: "6-digit code",
|
|
122396
|
+
submit: "Sign in",
|
|
122397
|
+
verifying: "Signing in\u2026",
|
|
122398
|
+
change: "Use a different email",
|
|
122399
|
+
badEmail: "Enter a valid email.",
|
|
122400
|
+
badCode: "That code is wrong or has expired. Try again or resend it.",
|
|
122401
|
+
tooMany: "Too many attempts. Try again in a moment.",
|
|
122402
|
+
error: "Sign-in didn't finish. Try again.",
|
|
122369
122403
|
github: "Sign in with GitHub",
|
|
122370
122404
|
google: "Sign in with Google",
|
|
122371
122405
|
ok: ["Signed in to WildCrane", "You can close this page and return to WildCrane."],
|
|
@@ -122376,13 +122410,24 @@ var COPY = {
|
|
|
122376
122410
|
var langOf = (accept) => /^\s*zh\b/i.test(accept ?? "") ? "zh" : "en";
|
|
122377
122411
|
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>';
|
|
122378
122412
|
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>';
|
|
122413
|
+
var EMAIL_SCRIPT = (c2) => `(()=>{const t=${JSON.stringify({
|
|
122414
|
+
send: c2.send,
|
|
122415
|
+
sending: c2.sending,
|
|
122416
|
+
sent: c2.sent,
|
|
122417
|
+
submit: c2.submit,
|
|
122418
|
+
verifying: c2.verifying,
|
|
122419
|
+
badEmail: c2.badEmail,
|
|
122420
|
+
badCode: c2.badCode,
|
|
122421
|
+
tooMany: c2.tooMany,
|
|
122422
|
+
error: c2.error
|
|
122423
|
+
}).replace(/</g, "\\u003c")};const $=(i)=>document.getElementById(i),f=$('f'),e=$('e'),c=$('c'),b=$('b'),m=$('m'),x=$('x');let to='';const say=(s,bad)=>{m.textContent=s;m.className=bad?'bad':''};const step=(code)=>{to=code?e.value.trim():'';e.hidden=!!code;c.hidden=!code;x.hidden=!code;b.textContent=code?t.submit:t.send;if(code){say(t.sent+to);c.value='';c.focus()}else{say('');e.focus()}};x.onclick=()=>step(false);f.onsubmit=async(ev)=>{ev.preventDefault();const verify=!!to;if(!verify&&!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(e.value.trim()))return say(t.badEmail,true);b.disabled=true;b.textContent=verify?t.verifying:t.sending;let r={error:'failed'};try{r=await (await fetch(verify?'/verify':'/send',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(verify?{email:to,code:c.value.trim()}:{email:e.value.trim()})})).json()}catch{}b.disabled=false;if(r.ok){if(!verify)return step(true);document.open();document.write(r.page);return document.close()}b.textContent=verify?t.submit:t.send;say(r.error==='bad_code'?t.badCode:r.error==='too_many'?t.tooMany:t.error,true)}})()`;
|
|
122379
122424
|
var PAGE = (outcome, lang, links) => {
|
|
122380
122425
|
const c2 = COPY[lang];
|
|
122381
122426
|
const [title, body] = c2[outcome];
|
|
122382
122427
|
const ok = outcome === "ok";
|
|
122383
122428
|
const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
122384
|
-
const top = links ? `<h1>${title}</h1><p>${body}</p><
|
|
122385
|
-
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>`;
|
|
122429
|
+
const top = links ? `<h1>${title}</h1><p>${body}</p><form id="f" novalidate><input id="e" type="email" autocomplete="email" placeholder="${c2.email}" required><input id="c" inputmode="numeric" autocomplete="one-time-code" maxlength="10" placeholder="${c2.code}" hidden><button id="b" class="dark">${c2.send}</button><small id="m"></small><button id="x" type="button" class="link" hidden>${c2.change}</button></form><div class="or">${c2.or}</div><nav><a href="${links.github}">${GITHUB_ICON}${c2.github}</a><a href="${links.google}">${GOOGLE_ICON}${c2.google}</a></nav><script>${EMAIL_SCRIPT(c2)}</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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
122430
|
+
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>`;
|
|
122386
122431
|
};
|
|
122387
122432
|
async function signIn(options = {}) {
|
|
122388
122433
|
const generation = accountGeneration();
|
|
@@ -122400,6 +122445,18 @@ async function signIn(options = {}) {
|
|
|
122400
122445
|
res.end(PAGE("choose", lang, { github: authorize("github"), google: authorize("google") }));
|
|
122401
122446
|
return;
|
|
122402
122447
|
}
|
|
122448
|
+
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
122449
|
+
const asks2 = await readJson2(req);
|
|
122450
|
+
const answer = asked.pathname === "/send" ? await sendCode(asks2.email ?? "", lang) : await verifyCode(asks2.email ?? "", asks2.code ?? "", generation, options.signal);
|
|
122451
|
+
const done = answer.ok && asked.pathname === "/verify";
|
|
122452
|
+
res.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" });
|
|
122453
|
+
res.end(JSON.stringify(done ? { ...answer, page: PAGE("ok", lang) } : answer));
|
|
122454
|
+
if (done) {
|
|
122455
|
+
answering = true;
|
|
122456
|
+
finish2(null);
|
|
122457
|
+
}
|
|
122458
|
+
return;
|
|
122459
|
+
}
|
|
122403
122460
|
if (asked.pathname !== "/signed-in" || answering) {
|
|
122404
122461
|
res.writeHead(404).end();
|
|
122405
122462
|
return;
|
|
@@ -122443,14 +122500,9 @@ async function signIn(options = {}) {
|
|
|
122443
122500
|
return failure2;
|
|
122444
122501
|
}
|
|
122445
122502
|
async function exchange(code, verifier, generation, signal2) {
|
|
122446
|
-
const { supabaseUrl, anonKey } = cloudEndpoints();
|
|
122447
122503
|
let response;
|
|
122448
122504
|
try {
|
|
122449
|
-
response = await
|
|
122450
|
-
method: "POST",
|
|
122451
|
-
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
122452
|
-
body: JSON.stringify({ auth_code: code, code_verifier: verifier })
|
|
122453
|
-
});
|
|
122505
|
+
response = await authCall("token?grant_type=pkce", { auth_code: code, code_verifier: verifier });
|
|
122454
122506
|
} catch (e2) {
|
|
122455
122507
|
return { why: "unreachable", detail: e2 instanceof Error ? e2.message : String(e2) };
|
|
122456
122508
|
}
|
|
@@ -122460,6 +122512,50 @@ async function exchange(code, verifier, generation, signal2) {
|
|
|
122460
122512
|
writeSession(session);
|
|
122461
122513
|
return null;
|
|
122462
122514
|
}
|
|
122515
|
+
var authCall = (path51, body) => {
|
|
122516
|
+
const { api, anonKey } = cloudEndpoints();
|
|
122517
|
+
return fetch(`${api}/auth/v1/${path51}`, {
|
|
122518
|
+
method: "POST",
|
|
122519
|
+
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
122520
|
+
body: JSON.stringify(body),
|
|
122521
|
+
signal: AbortSignal.timeout(2e4)
|
|
122522
|
+
});
|
|
122523
|
+
};
|
|
122524
|
+
var refusal3 = (status2) => ({ ok: false, error: status2 === 429 ? "too_many" : status2 === 400 || status2 === 401 || status2 === 403 ? "bad_code" : "failed" });
|
|
122525
|
+
async function sendCode(email, lang) {
|
|
122526
|
+
try {
|
|
122527
|
+
const response = await authCall("otp", { email: email.trim(), create_user: true, data: { lang } });
|
|
122528
|
+
return response.ok ? { ok: true } : { ok: false, error: response.status === 429 ? "too_many" : "failed" };
|
|
122529
|
+
} catch {
|
|
122530
|
+
return { ok: false, error: "failed" };
|
|
122531
|
+
}
|
|
122532
|
+
}
|
|
122533
|
+
async function verifyCode(email, code, generation, signal2) {
|
|
122534
|
+
let response;
|
|
122535
|
+
try {
|
|
122536
|
+
response = await authCall("verify", { type: "email", email: email.trim(), token: code.trim() });
|
|
122537
|
+
} catch {
|
|
122538
|
+
return { ok: false, error: "failed" };
|
|
122539
|
+
}
|
|
122540
|
+
if (!response.ok) return refusal3(response.status);
|
|
122541
|
+
const session = sessionFrom(await response.json().catch(() => ({})));
|
|
122542
|
+
if (!session) return { ok: false, error: "failed" };
|
|
122543
|
+
if (signal2?.aborted || accountGeneration() !== generation) return { ok: false, error: "failed" };
|
|
122544
|
+
writeSession(session);
|
|
122545
|
+
return { ok: true };
|
|
122546
|
+
}
|
|
122547
|
+
async function readJson2(req) {
|
|
122548
|
+
let text3 = "";
|
|
122549
|
+
for await (const chunk of req) {
|
|
122550
|
+
text3 += chunk;
|
|
122551
|
+
if (text3.length > 1e4) break;
|
|
122552
|
+
}
|
|
122553
|
+
try {
|
|
122554
|
+
return JSON.parse(text3);
|
|
122555
|
+
} catch {
|
|
122556
|
+
return {};
|
|
122557
|
+
}
|
|
122558
|
+
}
|
|
122463
122559
|
function openBrowser(url) {
|
|
122464
122560
|
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
122465
122561
|
try {
|
package/dist/settings.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.44 — 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;
|
|
@@ -26863,10 +26863,10 @@ async function refresh() {
|
|
|
26863
26863
|
const now = readSession();
|
|
26864
26864
|
if (!now) return { ok: false, reason: "signed-out" };
|
|
26865
26865
|
if (!expiringSoon(now)) return { ok: true, token: now.accessToken, session: now };
|
|
26866
|
-
const {
|
|
26866
|
+
const { api, anonKey } = cloudEndpoints();
|
|
26867
26867
|
let response;
|
|
26868
26868
|
try {
|
|
26869
|
-
response = await fetch(`${
|
|
26869
|
+
response = await fetch(`${api}/auth/v1/token?grant_type=refresh_token`, {
|
|
26870
26870
|
method: "POST",
|
|
26871
26871
|
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
26872
26872
|
body: JSON.stringify({ refresh_token: now.refreshToken })
|
|
@@ -26966,8 +26966,8 @@ function alive(pid) {
|
|
|
26966
26966
|
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
26967
26967
|
|
|
26968
26968
|
// src/protocol.ts
|
|
26969
|
-
var VERSION = true ? "0.6.
|
|
26970
|
-
var AKB_VERSION = true ? "0.11.
|
|
26969
|
+
var VERSION = true ? "0.6.44" : "0.0.0";
|
|
26970
|
+
var AKB_VERSION = true ? "0.11.38" : "0.0.0";
|
|
26971
26971
|
|
|
26972
26972
|
// src/api.ts
|
|
26973
26973
|
var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok"];
|
|
@@ -28897,7 +28897,7 @@ function createTail(log) {
|
|
|
28897
28897
|
// ../cli/package.json
|
|
28898
28898
|
var package_default = {
|
|
28899
28899
|
name: "wildcrane",
|
|
28900
|
-
version: "0.11.
|
|
28900
|
+
version: "0.11.38",
|
|
28901
28901
|
akbContract: 9,
|
|
28902
28902
|
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.",
|
|
28903
28903
|
keywords: [
|
|
@@ -31338,6 +31338,19 @@ var CREST = "M44.97 27.45C44.61 26.89 46.57 25.76 47.87 25.76C48.72 25.76 50.6 2
|
|
|
31338
31338
|
var COPY = {
|
|
31339
31339
|
zh: {
|
|
31340
31340
|
choose: ["\u767B\u5F55 WildCrane", "\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF0C\u5B8C\u6210\u540E\u56DE\u5230 WildCrane\u3002"],
|
|
31341
|
+
email: "name@company.com",
|
|
31342
|
+
send: "\u53D1\u9001\u9A8C\u8BC1\u7801",
|
|
31343
|
+
sending: "\u6B63\u5728\u53D1\u9001\u2026",
|
|
31344
|
+
or: "\u6216",
|
|
31345
|
+
sent: "\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001\u81F3 ",
|
|
31346
|
+
code: "6 \u4F4D\u9A8C\u8BC1\u7801",
|
|
31347
|
+
submit: "\u767B\u5F55",
|
|
31348
|
+
verifying: "\u6B63\u5728\u767B\u5F55\u2026",
|
|
31349
|
+
change: "\u6362\u4E2A\u90AE\u7BB1",
|
|
31350
|
+
badEmail: "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1\u3002",
|
|
31351
|
+
badCode: "\u9A8C\u8BC1\u7801\u9519\u8BEF\u6216\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u6216\u91CD\u65B0\u53D1\u9001\u3002",
|
|
31352
|
+
tooMany: "\u8BF7\u6C42\u592A\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
31353
|
+
error: "\u767B\u5F55\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
31341
31354
|
github: "\u7528 GitHub \u767B\u5F55",
|
|
31342
31355
|
google: "\u7528 Google \u767B\u5F55",
|
|
31343
31356
|
ok: ["\u5DF2\u767B\u5F55 WildCrane", "\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\uFF0C\u56DE\u5230 WildCrane \u7EE7\u7EED\u3002"],
|
|
@@ -31346,6 +31359,19 @@ var COPY = {
|
|
|
31346
31359
|
},
|
|
31347
31360
|
en: {
|
|
31348
31361
|
choose: ["Sign in to WildCrane", "Choose how to sign in, then return to WildCrane."],
|
|
31362
|
+
email: "name@company.com",
|
|
31363
|
+
send: "Send code",
|
|
31364
|
+
sending: "Sending\u2026",
|
|
31365
|
+
or: "or",
|
|
31366
|
+
sent: "We sent a code to ",
|
|
31367
|
+
code: "6-digit code",
|
|
31368
|
+
submit: "Sign in",
|
|
31369
|
+
verifying: "Signing in\u2026",
|
|
31370
|
+
change: "Use a different email",
|
|
31371
|
+
badEmail: "Enter a valid email.",
|
|
31372
|
+
badCode: "That code is wrong or has expired. Try again or resend it.",
|
|
31373
|
+
tooMany: "Too many attempts. Try again in a moment.",
|
|
31374
|
+
error: "Sign-in didn't finish. Try again.",
|
|
31349
31375
|
github: "Sign in with GitHub",
|
|
31350
31376
|
google: "Sign in with Google",
|
|
31351
31377
|
ok: ["Signed in to WildCrane", "You can close this page and return to WildCrane."],
|
|
@@ -31356,13 +31382,24 @@ var COPY = {
|
|
|
31356
31382
|
var langOf = (accept) => /^\s*zh\b/i.test(accept ?? "") ? "zh" : "en";
|
|
31357
31383
|
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>';
|
|
31358
31384
|
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>';
|
|
31385
|
+
var EMAIL_SCRIPT = (c) => `(()=>{const t=${JSON.stringify({
|
|
31386
|
+
send: c.send,
|
|
31387
|
+
sending: c.sending,
|
|
31388
|
+
sent: c.sent,
|
|
31389
|
+
submit: c.submit,
|
|
31390
|
+
verifying: c.verifying,
|
|
31391
|
+
badEmail: c.badEmail,
|
|
31392
|
+
badCode: c.badCode,
|
|
31393
|
+
tooMany: c.tooMany,
|
|
31394
|
+
error: c.error
|
|
31395
|
+
}).replace(/</g, "\\u003c")};const $=(i)=>document.getElementById(i),f=$('f'),e=$('e'),c=$('c'),b=$('b'),m=$('m'),x=$('x');let to='';const say=(s,bad)=>{m.textContent=s;m.className=bad?'bad':''};const step=(code)=>{to=code?e.value.trim():'';e.hidden=!!code;c.hidden=!code;x.hidden=!code;b.textContent=code?t.submit:t.send;if(code){say(t.sent+to);c.value='';c.focus()}else{say('');e.focus()}};x.onclick=()=>step(false);f.onsubmit=async(ev)=>{ev.preventDefault();const verify=!!to;if(!verify&&!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(e.value.trim()))return say(t.badEmail,true);b.disabled=true;b.textContent=verify?t.verifying:t.sending;let r={error:'failed'};try{r=await (await fetch(verify?'/verify':'/send',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(verify?{email:to,code:c.value.trim()}:{email:e.value.trim()})})).json()}catch{}b.disabled=false;if(r.ok){if(!verify)return step(true);document.open();document.write(r.page);return document.close()}b.textContent=verify?t.submit:t.send;say(r.error==='bad_code'?t.badCode:r.error==='too_many'?t.tooMany:t.error,true)}})()`;
|
|
31359
31396
|
var PAGE = (outcome, lang, links) => {
|
|
31360
31397
|
const c = COPY[lang];
|
|
31361
31398
|
const [title, body] = c[outcome];
|
|
31362
31399
|
const ok = outcome === "ok";
|
|
31363
31400
|
const icon = ok ? '<polyline points="20 6 9 17 4 12"/>' : '<path d="M18 6 6 18M6 6l12 12"/>';
|
|
31364
|
-
const top = links ? `<h1>${title}</h1><p>${body}</p><
|
|
31365
|
-
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>`;
|
|
31401
|
+
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">${icon}</svg></span><h1 class="below">${title}</h1><p>${body}</p>`;
|
|
31402
|
+
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>`;
|
|
31366
31403
|
};
|
|
31367
31404
|
async function signIn(options = {}) {
|
|
31368
31405
|
const generation = accountGeneration();
|
|
@@ -31380,6 +31417,18 @@ async function signIn(options = {}) {
|
|
|
31380
31417
|
res.end(PAGE("choose", lang, { github: authorize("github"), google: authorize("google") }));
|
|
31381
31418
|
return;
|
|
31382
31419
|
}
|
|
31420
|
+
if (req.method === "POST" && (asked.pathname === "/send" || asked.pathname === "/verify") && !answering) {
|
|
31421
|
+
const asks = await readJson(req);
|
|
31422
|
+
const answer = asked.pathname === "/send" ? await sendCode(asks.email ?? "", lang) : await verifyCode(asks.email ?? "", asks.code ?? "", generation, options.signal);
|
|
31423
|
+
const done = answer.ok && asked.pathname === "/verify";
|
|
31424
|
+
res.writeHead(200, { "content-type": "application/json", "cache-control": "no-store" });
|
|
31425
|
+
res.end(JSON.stringify(done ? { ...answer, page: PAGE("ok", lang) } : answer));
|
|
31426
|
+
if (done) {
|
|
31427
|
+
answering = true;
|
|
31428
|
+
finish(null);
|
|
31429
|
+
}
|
|
31430
|
+
return;
|
|
31431
|
+
}
|
|
31383
31432
|
if (asked.pathname !== "/signed-in" || answering) {
|
|
31384
31433
|
res.writeHead(404).end();
|
|
31385
31434
|
return;
|
|
@@ -31423,14 +31472,9 @@ async function signIn(options = {}) {
|
|
|
31423
31472
|
return failure2;
|
|
31424
31473
|
}
|
|
31425
31474
|
async function exchange(code, verifier, generation, signal) {
|
|
31426
|
-
const { supabaseUrl, anonKey } = cloudEndpoints();
|
|
31427
31475
|
let response;
|
|
31428
31476
|
try {
|
|
31429
|
-
response = await
|
|
31430
|
-
method: "POST",
|
|
31431
|
-
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
31432
|
-
body: JSON.stringify({ auth_code: code, code_verifier: verifier })
|
|
31433
|
-
});
|
|
31477
|
+
response = await authCall("token?grant_type=pkce", { auth_code: code, code_verifier: verifier });
|
|
31434
31478
|
} catch (e) {
|
|
31435
31479
|
return { why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
31436
31480
|
}
|
|
@@ -31440,6 +31484,50 @@ async function exchange(code, verifier, generation, signal) {
|
|
|
31440
31484
|
writeSession(session);
|
|
31441
31485
|
return null;
|
|
31442
31486
|
}
|
|
31487
|
+
var authCall = (path25, body) => {
|
|
31488
|
+
const { api, anonKey } = cloudEndpoints();
|
|
31489
|
+
return fetch(`${api}/auth/v1/${path25}`, {
|
|
31490
|
+
method: "POST",
|
|
31491
|
+
headers: { apikey: anonKey, "content-type": "application/json" },
|
|
31492
|
+
body: JSON.stringify(body),
|
|
31493
|
+
signal: AbortSignal.timeout(2e4)
|
|
31494
|
+
});
|
|
31495
|
+
};
|
|
31496
|
+
var refusal2 = (status2) => ({ ok: false, error: status2 === 429 ? "too_many" : status2 === 400 || status2 === 401 || status2 === 403 ? "bad_code" : "failed" });
|
|
31497
|
+
async function sendCode(email, lang) {
|
|
31498
|
+
try {
|
|
31499
|
+
const response = await authCall("otp", { email: email.trim(), create_user: true, data: { lang } });
|
|
31500
|
+
return response.ok ? { ok: true } : { ok: false, error: response.status === 429 ? "too_many" : "failed" };
|
|
31501
|
+
} catch {
|
|
31502
|
+
return { ok: false, error: "failed" };
|
|
31503
|
+
}
|
|
31504
|
+
}
|
|
31505
|
+
async function verifyCode(email, code, generation, signal) {
|
|
31506
|
+
let response;
|
|
31507
|
+
try {
|
|
31508
|
+
response = await authCall("verify", { type: "email", email: email.trim(), token: code.trim() });
|
|
31509
|
+
} catch {
|
|
31510
|
+
return { ok: false, error: "failed" };
|
|
31511
|
+
}
|
|
31512
|
+
if (!response.ok) return refusal2(response.status);
|
|
31513
|
+
const session = sessionFrom(await response.json().catch(() => ({})));
|
|
31514
|
+
if (!session) return { ok: false, error: "failed" };
|
|
31515
|
+
if (signal?.aborted || accountGeneration() !== generation) return { ok: false, error: "failed" };
|
|
31516
|
+
writeSession(session);
|
|
31517
|
+
return { ok: true };
|
|
31518
|
+
}
|
|
31519
|
+
async function readJson(req) {
|
|
31520
|
+
let text2 = "";
|
|
31521
|
+
for await (const chunk of req) {
|
|
31522
|
+
text2 += chunk;
|
|
31523
|
+
if (text2.length > 1e4) break;
|
|
31524
|
+
}
|
|
31525
|
+
try {
|
|
31526
|
+
return JSON.parse(text2);
|
|
31527
|
+
} catch {
|
|
31528
|
+
return {};
|
|
31529
|
+
}
|
|
31530
|
+
}
|
|
31443
31531
|
function openBrowser(url) {
|
|
31444
31532
|
const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
31445
31533
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane-runner",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.44",
|
|
4
4
|
"description": "WildCrane's Local Runner — connects this computer to WildCrane and runs its jobs on your local Claude Code, Codex, OpenCode or Cursor.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://wildcrane.ai/",
|