wildcrane-runner 0.6.51 → 0.6.54

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.42 — built by runner/scripts/build.mjs. Do not edit.
2
+ // ai4kanban 0.11.43 — 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;
@@ -3618,7 +3618,7 @@ function renderStarted(item) {
3618
3618
  function renderCompleted(item) {
3619
3619
  switch (item.type) {
3620
3620
  case "agent_message": {
3621
- const said2 = str(item.text).trim();
3621
+ const said2 = imageSafeText(str(item.text)).trim();
3622
3622
  return said2 ? `${said2}
3623
3623
 
3624
3624
  ` : "";
@@ -3668,7 +3668,7 @@ function callResult(item) {
3668
3668
  const error = str(obj(item.error).message);
3669
3669
  if (error) return error;
3670
3670
  const content = obj(item.result).content;
3671
- return (Array.isArray(content) ? content : []).map((b) => str(obj(b).text)).filter(Boolean).join("\n");
3671
+ return (Array.isArray(content) ? content : []).map((b) => imageSafeText(str(obj(b).text))).filter(Boolean).join("\n");
3672
3672
  }
3673
3673
  if (item.type === "file_change") {
3674
3674
  return (Array.isArray(item.changes) ? item.changes : []).map((c) => `${str(obj(c).kind) || "change"} ${str(obj(c).path)}`).join("\n");
@@ -3678,7 +3678,7 @@ function callResult(item) {
3678
3678
  function itemEvents(events, started, item, done2) {
3679
3679
  const id = str(item.id);
3680
3680
  if (item.type === "agent_message") {
3681
- if (done2) events.message(str(item.text));
3681
+ if (done2) events.message(imageSafeText(str(item.text)));
3682
3682
  return;
3683
3683
  }
3684
3684
  if (item.type === "todo_list") {
@@ -3705,6 +3705,7 @@ function itemEvents(events, started, item, done2) {
3705
3705
  }
3706
3706
  function createCodexStreamRenderer(carried = false) {
3707
3707
  let final;
3708
+ const pictures = [];
3708
3709
  let total;
3709
3710
  let threadId;
3710
3711
  let failure;
@@ -3745,10 +3746,23 @@ function createCodexStreamRenderer(carried = false) {
3745
3746
  return "";
3746
3747
  case "item.completed": {
3747
3748
  const item = obj(ev.item);
3749
+ if (item.type === "mcp_tool_call" && !/view_image|read_image|open_image/.test(str(item.tool))) {
3750
+ const content = obj(item.result).content;
3751
+ for (const block of Array.isArray(content) ? content : []) {
3752
+ const b = obj(block);
3753
+ const audience = obj(b.annotations).audience;
3754
+ if (Array.isArray(audience) && !audience.includes("user")) continue;
3755
+ if (b.type === "resource_link" && str(b.uri).startsWith("file:") && /^image\/(png|jpeg|gif|webp)$/.test(str(b.mimeType)) && pictures.length < 100) {
3756
+ pictures.push({ type: "image", path: str(b.uri), mime: str(b.mimeType), registered: true });
3757
+ }
3758
+ if (b.type === "image" && pictures.length < 100) pictures.push(str(b.data).length <= 14e7 ? { type: "image", data: str(b.data), mime: str(b.mimeType) } : { type: "image" });
3759
+ }
3760
+ }
3761
+ if (item.type === "image_generation" && typeof item.path === "string") pictures.push({ type: "image", path: item.path, registered: true });
3748
3762
  itemEvents(events, started, item, true);
3749
3763
  if (item.type === "agent_message") {
3750
3764
  const said2 = str(item.text).trim();
3751
- if (said2) final = said2;
3765
+ if (said2 || pictures.length) final = said2;
3752
3766
  }
3753
3767
  return renderCompleted(item);
3754
3768
  }
@@ -3785,6 +3799,7 @@ function createCodexStreamRenderer(carried = false) {
3785
3799
  return out;
3786
3800
  },
3787
3801
  result: () => final,
3802
+ replyParts: () => [...pictures, ...final ? [{ type: "text", text: final }] : []],
3788
3803
  usage: own,
3789
3804
  // Off the rollout, not the stream: no thread event carries a count, and the rollout
3790
3805
  // gains a `token_count` every time a request comes back — so a long run's ring climbs
@@ -3806,7 +3821,7 @@ function createCodexStreamRenderer(carried = false) {
3806
3821
  events: events.events
3807
3822
  };
3808
3823
  }
3809
- var CALLS, LOOK_EVERY_MS;
3824
+ var imageSafeText, CALLS, LOOK_EVERY_MS;
3810
3825
  var init_codex_stream = __esm({
3811
3826
  "../cli/src/lib/agent/wire/codex-stream.ts"() {
3812
3827
  "use strict";
@@ -3815,6 +3830,7 @@ var init_codex_stream = __esm({
3815
3830
  init_json();
3816
3831
  init_stream();
3817
3832
  init_prices();
3833
+ imageSafeText = (text4) => text4.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+/gi, "[image]").replace(/!\[([^\]]*)\]\((?:<)?(?:\/|[A-Za-z]:[\\/]|file:)[^\n)]*\)/g, "[$1]");
3818
3834
  CALLS = { command_execution: "execute", mcp_tool_call: "other", file_change: "edit", web_search: "fetch" };
3819
3835
  LOOK_EVERY_MS = 3e3;
3820
3836
  }
@@ -4207,7 +4223,7 @@ var init_package = __esm({
4207
4223
  "../cli/package.json"() {
4208
4224
  package_default = {
4209
4225
  name: "wildcrane",
4210
- version: "0.11.42",
4226
+ version: "0.11.43",
4211
4227
  akbContract: 11,
4212
4228
  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
4229
  keywords: [
@@ -10944,9 +10960,9 @@ var init_goal_cloud = __esm({
10944
10960
  }
10945
10961
  });
10946
10962
 
10947
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/error.js
10963
+ // ../cli/node_modules/commander/lib/error.js
10948
10964
  var require_error = __commonJS({
10949
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/error.js"(exports) {
10965
+ "../cli/node_modules/commander/lib/error.js"(exports) {
10950
10966
  var CommanderError2 = class extends Error {
10951
10967
  /**
10952
10968
  * Constructs the CommanderError class
@@ -10979,9 +10995,9 @@ var require_error = __commonJS({
10979
10995
  }
10980
10996
  });
10981
10997
 
10982
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/argument.js
10998
+ // ../cli/node_modules/commander/lib/argument.js
10983
10999
  var require_argument = __commonJS({
10984
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/argument.js"(exports) {
11000
+ "../cli/node_modules/commander/lib/argument.js"(exports) {
10985
11001
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
10986
11002
  var Argument2 = class {
10987
11003
  /**
@@ -11106,9 +11122,9 @@ var require_argument = __commonJS({
11106
11122
  }
11107
11123
  });
11108
11124
 
11109
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/help.js
11125
+ // ../cli/node_modules/commander/lib/help.js
11110
11126
  var require_help = __commonJS({
11111
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/help.js"(exports) {
11127
+ "../cli/node_modules/commander/lib/help.js"(exports) {
11112
11128
  var { humanReadableArgName } = require_argument();
11113
11129
  var Help2 = class {
11114
11130
  constructor() {
@@ -11675,9 +11691,9 @@ ${itemIndentStr}`);
11675
11691
  }
11676
11692
  });
11677
11693
 
11678
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/option.js
11694
+ // ../cli/node_modules/commander/lib/option.js
11679
11695
  var require_option = __commonJS({
11680
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/option.js"(exports) {
11696
+ "../cli/node_modules/commander/lib/option.js"(exports) {
11681
11697
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
11682
11698
  var Option2 = class {
11683
11699
  /**
@@ -11976,9 +11992,9 @@ var require_option = __commonJS({
11976
11992
  }
11977
11993
  });
11978
11994
 
11979
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/suggestSimilar.js
11995
+ // ../cli/node_modules/commander/lib/suggestSimilar.js
11980
11996
  var require_suggestSimilar = __commonJS({
11981
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/suggestSimilar.js"(exports) {
11997
+ "../cli/node_modules/commander/lib/suggestSimilar.js"(exports) {
11982
11998
  var maxDistance = 3;
11983
11999
  function editDistance2(a, b) {
11984
12000
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -12056,9 +12072,9 @@ var require_suggestSimilar = __commonJS({
12056
12072
  }
12057
12073
  });
12058
12074
 
12059
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/command.js
12075
+ // ../cli/node_modules/commander/lib/command.js
12060
12076
  var require_command = __commonJS({
12061
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/lib/command.js"(exports) {
12077
+ "../cli/node_modules/commander/lib/command.js"(exports) {
12062
12078
  var EventEmitter = __require("node:events").EventEmitter;
12063
12079
  var childProcess = __require("node:child_process");
12064
12080
  var path86 = __require("node:path");
@@ -14215,9 +14231,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
14215
14231
  }
14216
14232
  });
14217
14233
 
14218
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/index.js
14234
+ // ../cli/node_modules/commander/index.js
14219
14235
  var require_commander = __commonJS({
14220
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/index.js"(exports) {
14236
+ "../cli/node_modules/commander/index.js"(exports) {
14221
14237
  var { Argument: Argument2 } = require_argument();
14222
14238
  var { Command: Command2 } = require_command();
14223
14239
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -14237,10 +14253,10 @@ var require_commander = __commonJS({
14237
14253
  }
14238
14254
  });
14239
14255
 
14240
- // ../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/esm.mjs
14256
+ // ../cli/node_modules/commander/esm.mjs
14241
14257
  var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
14242
14258
  var init_esm = __esm({
14243
- "../../../../Users/wutao/git/ai4kanban/cli/node_modules/commander/esm.mjs"() {
14259
+ "../cli/node_modules/commander/esm.mjs"() {
14244
14260
  import_index = __toESM(require_commander(), 1);
14245
14261
  ({
14246
14262
  program,
@@ -16837,7 +16853,7 @@ var init_prompts = __esm({
16837
16853
  // ../cli/src/lib/agent/stop.ts
16838
16854
  import { spawnSync as spawnSync4 } from "node:child_process";
16839
16855
  import fs52 from "node:fs";
16840
- function markedInProc(entry, strict = false) {
16856
+ function markedInProc(entry, strict = false, since) {
16841
16857
  const pids = [];
16842
16858
  for (const name of fs52.readdirSync("/proc")) {
16843
16859
  if (!/^\d+$/.test(name)) continue;
@@ -16846,12 +16862,22 @@ function markedInProc(entry, strict = false) {
16846
16862
  } catch (error) {
16847
16863
  if (strict && !["ENOENT", "ESRCH"].includes(error.code ?? "")) {
16848
16864
  const stat = fs52.statSync(`/proc/${name}`, { throwIfNoEntry: false });
16849
- if (stat?.uid === process.getuid?.()) throw error;
16865
+ if (stat?.uid === process.getuid?.() && !startedBefore(Number(name), since)) throw error;
16850
16866
  }
16851
16867
  }
16852
16868
  }
16853
16869
  return pids;
16854
16870
  }
16871
+ function startedBefore(pid, since) {
16872
+ if (since === void 0) return false;
16873
+ const result = spawnSync4("ps", ["-p", String(pid), "-o", "lstart="], {
16874
+ encoding: "utf8",
16875
+ timeout: 5e3,
16876
+ env: { ...process.env, LC_ALL: "C" }
16877
+ });
16878
+ const birth = Date.parse(result.stdout?.trim() ?? "");
16879
+ return result.status === 0 && Number.isFinite(birth) && birth + 2e3 <= since;
16880
+ }
16855
16881
  function markedInPs(entry, roots) {
16856
16882
  const ps = spawnSync4("ps", ["-A", "-E", "-ww", "-o", "pid=,ppid=,command="], {
16857
16883
  encoding: "utf8",
@@ -16987,7 +17013,7 @@ var init_stop = __esm({
16987
17013
  "use strict";
16988
17014
  init_env();
16989
17015
  init_paths();
16990
- runMark = (sessionId) => ({ name: RUN_ENV, value: sessionId });
17016
+ runMark = (sessionId, since) => ({ name: RUN_ENV, value: sessionId, ...since === void 0 ? {} : { since } });
16991
17017
  WINDOWS3 = process.platform === "win32";
16992
17018
  KILL_ROUND_MS = 300;
16993
17019
  KILL_ROUNDS = 3;
@@ -1 +1 @@
1
- {"name":"wildcrane","version":"0.11.42","akbContract":11,"type":"module","private":true}
1
+ {"name":"wildcrane","version":"0.11.43","akbContract":11,"type":"module","private":true}