wildcrane 0.11.45 → 0.11.46
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/kanban.mjs +98 -14
- package/package.json +1 -1
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.46 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
|
|
3
3
|
// Do not edit: every change belongs in cli/src/, and a build overwrites this file.
|
|
4
4
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
5
5
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
@@ -4188,6 +4188,27 @@ var init_kimi_stream = __esm({
|
|
|
4188
4188
|
}
|
|
4189
4189
|
});
|
|
4190
4190
|
|
|
4191
|
+
// src/lib/shared/conversation.ts
|
|
4192
|
+
function bounded(work, ms, reason) {
|
|
4193
|
+
return new Promise((resolve2, reject) => {
|
|
4194
|
+
const timer = setTimeout(() => reject(new Error(reason)), Math.max(0, ms));
|
|
4195
|
+
work.then((value) => {
|
|
4196
|
+
clearTimeout(timer);
|
|
4197
|
+
resolve2(value);
|
|
4198
|
+
}, (error) => {
|
|
4199
|
+
clearTimeout(timer);
|
|
4200
|
+
reject(error);
|
|
4201
|
+
});
|
|
4202
|
+
});
|
|
4203
|
+
}
|
|
4204
|
+
var CONVERSATION_MS;
|
|
4205
|
+
var init_conversation = __esm({
|
|
4206
|
+
"src/lib/shared/conversation.ts"() {
|
|
4207
|
+
"use strict";
|
|
4208
|
+
CONVERSATION_MS = { send: 15e3, claim: 3e4, prepare: 6e4, start: 15e3, startup: 12e4, quiet: 6e4, stop: 1e4 };
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4211
|
+
|
|
4191
4212
|
// src/lib/agent/wire/rpc.ts
|
|
4192
4213
|
function connect(stdout, stdin, onCall, dialect = {}) {
|
|
4193
4214
|
let buf = "";
|
|
@@ -4334,7 +4355,7 @@ var init_package = __esm({
|
|
|
4334
4355
|
"package.json"() {
|
|
4335
4356
|
package_default = {
|
|
4336
4357
|
name: "wildcrane",
|
|
4337
|
-
version: "0.11.
|
|
4358
|
+
version: "0.11.46",
|
|
4338
4359
|
akbContract: 12,
|
|
4339
4360
|
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.",
|
|
4340
4361
|
keywords: [
|
|
@@ -4489,6 +4510,11 @@ function createAcpClient(options = {}) {
|
|
|
4489
4510
|
}
|
|
4490
4511
|
async function oneTurn(io, options) {
|
|
4491
4512
|
const tail = createTail(io.log);
|
|
4513
|
+
const preparingUntil = Math.min(io.prepareUntil ?? Infinity, Date.now() + CONVERSATION_MS.prepare);
|
|
4514
|
+
const phase = (phase2) => io.event?.({ kind: "phase", data: { phase: phase2, at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
4515
|
+
let started = false;
|
|
4516
|
+
let contentAt = 0;
|
|
4517
|
+
let currentSession = "";
|
|
4492
4518
|
const events = createEventCollector();
|
|
4493
4519
|
const emit = () => {
|
|
4494
4520
|
for (const e of events.events()) io.event?.(e);
|
|
@@ -4501,7 +4527,16 @@ async function oneTurn(io, options) {
|
|
|
4501
4527
|
io.stdin,
|
|
4502
4528
|
(msg) => {
|
|
4503
4529
|
if (msg.method === "session/update") {
|
|
4504
|
-
if (live) {
|
|
4530
|
+
if (live && (!obj(msg.params).sessionId || obj(msg.params).sessionId === currentSession)) {
|
|
4531
|
+
const kind = str(obj(obj(msg.params).update).sessionUpdate);
|
|
4532
|
+
if (!started && ["agent_message_chunk", "tool_call", "plan"].includes(kind)) {
|
|
4533
|
+
started = true;
|
|
4534
|
+
phase("started");
|
|
4535
|
+
}
|
|
4536
|
+
if (kind === "agent_message_chunk" && Date.now() - contentAt >= 1e3) {
|
|
4537
|
+
contentAt = Date.now();
|
|
4538
|
+
io.event?.({ kind: "phase", data: { phase: "started", at: (/* @__PURE__ */ new Date()).toISOString(), contentAt: new Date(contentAt).toISOString() } });
|
|
4539
|
+
}
|
|
4505
4540
|
update(obj(msg.params).update, tail, (usd) => costUsd = usd, (window) => context = window);
|
|
4506
4541
|
events.update(obj(msg.params).update);
|
|
4507
4542
|
emit();
|
|
@@ -4529,20 +4564,22 @@ async function oneTurn(io, options) {
|
|
|
4529
4564
|
);
|
|
4530
4565
|
try {
|
|
4531
4566
|
const mcpServers = options.mcpConfig ? mcpServersIn(options.mcpConfig) : [];
|
|
4532
|
-
|
|
4567
|
+
phase("preparing");
|
|
4568
|
+
await bounded(rpc.call("initialize", {
|
|
4533
4569
|
protocolVersion: PROTOCOL_VERSION,
|
|
4534
4570
|
clientCapabilities: CLIENT_CAPABILITIES,
|
|
4535
4571
|
clientInfo: { name: "ai4kanban", version: SKILL_VERSION }
|
|
4536
|
-
});
|
|
4572
|
+
}), preparingUntil - Date.now(), "ACP initialize timed out.");
|
|
4573
|
+
phase("initialized");
|
|
4537
4574
|
let sessionId = io.resumeId ?? "";
|
|
4538
4575
|
let prompt = io.prompt;
|
|
4539
4576
|
let opened;
|
|
4540
4577
|
if (sessionId) {
|
|
4541
4578
|
try {
|
|
4542
|
-
opened = await rpc.call("session/load", { sessionId, cwd: io.cwd, mcpServers });
|
|
4579
|
+
opened = await bounded(rpc.call("session/load", { sessionId, cwd: io.cwd, mcpServers }), preparingUntil - Date.now(), "ACP session/load timed out.");
|
|
4543
4580
|
} catch (e) {
|
|
4544
4581
|
if (!sessionGone(e) || !io.restartPrompt) throw e;
|
|
4545
|
-
const fresh = await newSession(rpc, io.cwd, mcpServers);
|
|
4582
|
+
const fresh = await bounded(newSession(rpc, io.cwd, mcpServers), preparingUntil - Date.now(), "ACP session/new timed out.");
|
|
4546
4583
|
opened = fresh.opened;
|
|
4547
4584
|
sessionId = fresh.sessionId;
|
|
4548
4585
|
prompt = io.restartPrompt;
|
|
@@ -4552,7 +4589,7 @@ async function oneTurn(io, options) {
|
|
|
4552
4589
|
emit();
|
|
4553
4590
|
}
|
|
4554
4591
|
} else {
|
|
4555
|
-
const fresh = await newSession(rpc, io.cwd, mcpServers);
|
|
4592
|
+
const fresh = await bounded(newSession(rpc, io.cwd, mcpServers), preparingUntil - Date.now(), "ACP session/new timed out.");
|
|
4556
4593
|
opened = fresh.opened;
|
|
4557
4594
|
sessionId = fresh.sessionId;
|
|
4558
4595
|
io.gotResumeId(sessionId);
|
|
@@ -4561,11 +4598,15 @@ async function oneTurn(io, options) {
|
|
|
4561
4598
|
if (options.model) {
|
|
4562
4599
|
const listed = obj(opened.models).currentModelId !== void 0;
|
|
4563
4600
|
const picked = listed ? pickedModel(opened, options.model) : void 0;
|
|
4564
|
-
const set = listed ? await rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }) : await rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model });
|
|
4601
|
+
const set = listed ? await bounded(rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }), preparingUntil - Date.now(), "ACP session/set_model timed out.") : await bounded(rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model }), preparingUntil - Date.now(), "ACP session/set_config_option timed out.");
|
|
4565
4602
|
model = picked?.name ?? modelOf(set) ?? options.model;
|
|
4566
4603
|
}
|
|
4567
4604
|
if (model) io.gotModel(model);
|
|
4605
|
+
if (Date.now() >= preparingUntil) throw Error("ACP preparation timed out.");
|
|
4606
|
+
phase("ready");
|
|
4607
|
+
currentSession = sessionId;
|
|
4568
4608
|
live = true;
|
|
4609
|
+
phase("submitted");
|
|
4569
4610
|
const done2 = await rpc.call("session/prompt", {
|
|
4570
4611
|
sessionId,
|
|
4571
4612
|
prompt: [{ type: "text", text: prompt }]
|
|
@@ -4646,6 +4687,7 @@ var PROTOCOL_VERSION, CLIENT_CAPABILITIES, INVALID_PARAMS, RESTARTED, TICKS_PER_
|
|
|
4646
4687
|
var init_acp = __esm({
|
|
4647
4688
|
"src/lib/agent/wire/acp.ts"() {
|
|
4648
4689
|
"use strict";
|
|
4690
|
+
init_conversation();
|
|
4649
4691
|
init_events();
|
|
4650
4692
|
init_json();
|
|
4651
4693
|
init_rpc();
|
|
@@ -5012,10 +5054,24 @@ function createCodexClient(options = { images: [] }) {
|
|
|
5012
5054
|
}
|
|
5013
5055
|
async function run(io, options, tasks) {
|
|
5014
5056
|
const renderer = createCodexStreamRenderer();
|
|
5057
|
+
const preparingUntil = Math.min(io.prepareUntil ?? Infinity, Date.now() + CONVERSATION_MS.prepare);
|
|
5058
|
+
const phase = (phase2) => io.event?.({ kind: "phase", data: { phase: phase2, at: (/* @__PURE__ */ new Date()).toISOString() } });
|
|
5059
|
+
let submitted = false;
|
|
5060
|
+
let started = false;
|
|
5061
|
+
let contentAt = 0;
|
|
5062
|
+
let startupTimer;
|
|
5063
|
+
const began = () => {
|
|
5064
|
+
if (!submitted || started || ended) return;
|
|
5065
|
+
started = true;
|
|
5066
|
+
clearTimeout(startupTimer);
|
|
5067
|
+
phase("started");
|
|
5068
|
+
};
|
|
5015
5069
|
const children = /* @__PURE__ */ new Set();
|
|
5016
5070
|
const commands = /* @__PURE__ */ new Set();
|
|
5017
5071
|
const seenItems = /* @__PURE__ */ new Set();
|
|
5018
5072
|
const completedTurns = /* @__PURE__ */ new Set();
|
|
5073
|
+
const historicalTurns = /* @__PURE__ */ new Set();
|
|
5074
|
+
let currentTurn2 = "";
|
|
5019
5075
|
let threadId = "";
|
|
5020
5076
|
let active2 = true;
|
|
5021
5077
|
let waiting = false;
|
|
@@ -5041,6 +5097,7 @@ async function run(io, options, tasks) {
|
|
|
5041
5097
|
if (ended) return;
|
|
5042
5098
|
ended = true;
|
|
5043
5099
|
clearTimeout(timer);
|
|
5100
|
+
clearTimeout(startupTimer);
|
|
5044
5101
|
deadline.close();
|
|
5045
5102
|
io.stdout.off("close", closed2);
|
|
5046
5103
|
io.log(renderer.flush());
|
|
@@ -5072,10 +5129,11 @@ async function run(io, options, tasks) {
|
|
|
5072
5129
|
io.event?.({ kind: "tool_call_update", data: { toolCallId: `agent:${id}`, status: failed ? "failed" : "completed", result: str(state.message) } });
|
|
5073
5130
|
}
|
|
5074
5131
|
};
|
|
5075
|
-
const item = (raw, completed) => {
|
|
5132
|
+
const item = (raw, completed, proof = true) => {
|
|
5076
5133
|
if (ended) return;
|
|
5077
5134
|
const id = str(raw.id);
|
|
5078
5135
|
if (raw.type === "collabAgentToolCall") {
|
|
5136
|
+
if (proof) began();
|
|
5079
5137
|
const key2 = `${id}:${completed}`;
|
|
5080
5138
|
if (seenItems.has(key2)) return;
|
|
5081
5139
|
seenItems.add(key2);
|
|
@@ -5103,6 +5161,7 @@ async function run(io, options, tasks) {
|
|
|
5103
5161
|
const types = { agentMessage: "agent_message", commandExecution: "command_execution", fileChange: "file_change", mcpToolCall: "mcp_tool_call", webSearch: "web_search", imageGeneration: "image_generation" };
|
|
5104
5162
|
const type = types[str(raw.type)];
|
|
5105
5163
|
if (!type) return;
|
|
5164
|
+
if (proof) began();
|
|
5106
5165
|
emit(completed ? "item.completed" : "item.started", { item: {
|
|
5107
5166
|
...raw,
|
|
5108
5167
|
type,
|
|
@@ -5116,7 +5175,16 @@ async function run(io, options, tasks) {
|
|
|
5116
5175
|
const start = async (text4, images = []) => {
|
|
5117
5176
|
active2 = true;
|
|
5118
5177
|
waiting = false;
|
|
5119
|
-
|
|
5178
|
+
submitted = true;
|
|
5179
|
+
currentTurn2 = "";
|
|
5180
|
+
started = false;
|
|
5181
|
+
phase("submitted");
|
|
5182
|
+
startupTimer = setTimeout(() => {
|
|
5183
|
+
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
5184
|
+
}, CONVERSATION_MS.start);
|
|
5185
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text4 }, ...images.map((path86) => ({ type: "localImage", path: path86 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
|
|
5186
|
+
if (!started) throw error;
|
|
5187
|
+
});
|
|
5120
5188
|
};
|
|
5121
5189
|
const schedule = () => {
|
|
5122
5190
|
if (ended || timer) return;
|
|
@@ -5201,11 +5269,21 @@ async function run(io, options, tasks) {
|
|
|
5201
5269
|
}
|
|
5202
5270
|
const p = obj(msg.params);
|
|
5203
5271
|
if (str(p.threadId) !== threadId) return;
|
|
5272
|
+
const turnId = str(p.turnId) || str(obj(p.turn).id);
|
|
5273
|
+
if (historicalTurns.has(turnId) || currentTurn2 && turnId && currentTurn2 !== turnId) return;
|
|
5204
5274
|
if (msg.method === "turn/started") {
|
|
5275
|
+
if (!submitted || completedTurns.has(turnId)) return;
|
|
5276
|
+
currentTurn2 = turnId;
|
|
5205
5277
|
active2 = true;
|
|
5278
|
+
began();
|
|
5206
5279
|
return;
|
|
5207
5280
|
}
|
|
5208
|
-
if (msg.method === "item/
|
|
5281
|
+
if (submitted && msg.method === "item/agentMessage/delta" && Date.now() - contentAt >= 1e3) {
|
|
5282
|
+
began();
|
|
5283
|
+
contentAt = Date.now();
|
|
5284
|
+
io.event?.({ kind: "phase", data: { phase: "started", at: (/* @__PURE__ */ new Date()).toISOString(), contentAt: new Date(contentAt).toISOString() } });
|
|
5285
|
+
}
|
|
5286
|
+
if (msg.method === "item/started" || msg.method === "item/completed") item(obj(p.item), msg.method === "item/completed", !completedTurns.has(turnId));
|
|
5209
5287
|
if (msg.method === "thread/tokenUsage/updated") {
|
|
5210
5288
|
const token2 = obj(p.tokenUsage);
|
|
5211
5289
|
const counts = obj(token2.total);
|
|
@@ -5236,17 +5314,20 @@ async function run(io, options, tasks) {
|
|
|
5236
5314
|
}
|
|
5237
5315
|
});
|
|
5238
5316
|
try {
|
|
5239
|
-
|
|
5317
|
+
phase("preparing");
|
|
5318
|
+
await bounded(rpc.call("initialize", { clientInfo: { name: "wildcrane", version: "1" }, capabilities: { experimentalApi: true } }), preparingUntil - Date.now(), "Codex initialize timed out.");
|
|
5319
|
+
phase("initialized");
|
|
5240
5320
|
rpc.notify("initialized");
|
|
5241
5321
|
const mode = options.mode ?? (io.resumeId ? "resume" : void 0);
|
|
5242
5322
|
let response;
|
|
5243
5323
|
try {
|
|
5244
|
-
response = await rpc.call(`thread/${mode ?? "start"}`, { cwd: options.cwd ?? io.cwd, ...mode ? { threadId: options.threadId ?? io.resumeId } : {} });
|
|
5324
|
+
response = await bounded(rpc.call(`thread/${mode ?? "start"}`, { cwd: options.cwd ?? io.cwd, ...mode ? { threadId: options.threadId ?? io.resumeId } : {} }), preparingUntil - Date.now(), `Codex thread/${mode ?? "start"} timed out.`);
|
|
5245
5325
|
} catch (e) {
|
|
5246
5326
|
if (mode && e instanceof RpcError && /no rollout found for thread id/i.test(e.message)) throw Error(`Thread not found: ${e.message}`);
|
|
5247
5327
|
throw e;
|
|
5248
5328
|
}
|
|
5249
5329
|
const thread = obj(response.thread);
|
|
5330
|
+
for (const turn2 of list(thread.turns)) historicalTurns.add(str(turn2.id));
|
|
5250
5331
|
threadId = str(thread.id);
|
|
5251
5332
|
if (!threadId) throw Error("Codex did not return a thread id.");
|
|
5252
5333
|
provider = str(thread.modelProvider) || void 0;
|
|
@@ -5255,6 +5336,8 @@ async function run(io, options, tasks) {
|
|
|
5255
5336
|
io.gotResumeId(threadId);
|
|
5256
5337
|
baseline = readCodexRunFacts(threadId)?.turns?.at(-1)?.total;
|
|
5257
5338
|
emit("thread.started", { thread_id: threadId });
|
|
5339
|
+
if (Date.now() >= preparingUntil) throw Error("Codex preparation timed out.");
|
|
5340
|
+
phase("ready");
|
|
5258
5341
|
await start(io.prompt, options.images);
|
|
5259
5342
|
} catch (e) {
|
|
5260
5343
|
end2(e instanceof Error ? e.message : String(e));
|
|
@@ -5265,6 +5348,7 @@ var list;
|
|
|
5265
5348
|
var init_codex = __esm({
|
|
5266
5349
|
"src/lib/agent/wire/codex.ts"() {
|
|
5267
5350
|
"use strict";
|
|
5351
|
+
init_conversation();
|
|
5268
5352
|
init_settings();
|
|
5269
5353
|
init_background();
|
|
5270
5354
|
init_codex_stream();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.46",
|
|
4
4
|
"akbContract": 12,
|
|
5
5
|
"description": "WildCrane's `akb` command — scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
6
6
|
"keywords": [
|