wildcrane 0.11.42 → 0.11.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.
Files changed (2) hide show
  1. package/dist/kanban.mjs +36 -10
  2. package/package.json +1 -1
package/dist/kanban.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.42 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.44 — 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)
@@ -3619,7 +3619,7 @@ function renderStarted(item) {
3619
3619
  function renderCompleted(item) {
3620
3620
  switch (item.type) {
3621
3621
  case "agent_message": {
3622
- const said2 = str(item.text).trim();
3622
+ const said2 = imageSafeText(str(item.text)).trim();
3623
3623
  return said2 ? `${said2}
3624
3624
 
3625
3625
  ` : "";
@@ -3669,7 +3669,7 @@ function callResult(item) {
3669
3669
  const error = str(obj(item.error).message);
3670
3670
  if (error) return error;
3671
3671
  const content = obj(item.result).content;
3672
- return (Array.isArray(content) ? content : []).map((b) => str(obj(b).text)).filter(Boolean).join("\n");
3672
+ return (Array.isArray(content) ? content : []).map((b) => imageSafeText(str(obj(b).text))).filter(Boolean).join("\n");
3673
3673
  }
3674
3674
  if (item.type === "file_change") {
3675
3675
  return (Array.isArray(item.changes) ? item.changes : []).map((c) => `${str(obj(c).kind) || "change"} ${str(obj(c).path)}`).join("\n");
@@ -3679,7 +3679,7 @@ function callResult(item) {
3679
3679
  function itemEvents(events, started, item, done2) {
3680
3680
  const id = str(item.id);
3681
3681
  if (item.type === "agent_message") {
3682
- if (done2) events.message(str(item.text));
3682
+ if (done2) events.message(imageSafeText(str(item.text)));
3683
3683
  return;
3684
3684
  }
3685
3685
  if (item.type === "todo_list") {
@@ -3706,6 +3706,7 @@ function itemEvents(events, started, item, done2) {
3706
3706
  }
3707
3707
  function createCodexStreamRenderer(carried = false) {
3708
3708
  let final;
3709
+ const pictures = [];
3709
3710
  let total;
3710
3711
  let threadId;
3711
3712
  let failure;
@@ -3746,10 +3747,23 @@ function createCodexStreamRenderer(carried = false) {
3746
3747
  return "";
3747
3748
  case "item.completed": {
3748
3749
  const item = obj(ev.item);
3750
+ if (item.type === "mcp_tool_call" && !/view_image|read_image|open_image/.test(str(item.tool))) {
3751
+ const content = obj(item.result).content;
3752
+ for (const block of Array.isArray(content) ? content : []) {
3753
+ const b = obj(block);
3754
+ const audience = obj(b.annotations).audience;
3755
+ if (Array.isArray(audience) && !audience.includes("user")) continue;
3756
+ if (b.type === "resource_link" && str(b.uri).startsWith("file:") && /^image\/(png|jpeg|gif|webp)$/.test(str(b.mimeType)) && pictures.length < 100) {
3757
+ pictures.push({ type: "image", path: str(b.uri), mime: str(b.mimeType), registered: true });
3758
+ }
3759
+ 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" });
3760
+ }
3761
+ }
3762
+ if (item.type === "image_generation" && typeof item.path === "string") pictures.push({ type: "image", path: item.path, registered: true });
3749
3763
  itemEvents(events, started, item, true);
3750
3764
  if (item.type === "agent_message") {
3751
3765
  const said2 = str(item.text).trim();
3752
- if (said2) final = said2;
3766
+ if (said2 || pictures.length) final = said2;
3753
3767
  }
3754
3768
  return renderCompleted(item);
3755
3769
  }
@@ -3786,6 +3800,7 @@ function createCodexStreamRenderer(carried = false) {
3786
3800
  return out;
3787
3801
  },
3788
3802
  result: () => final,
3803
+ replyParts: () => [...pictures, ...final ? [{ type: "text", text: final }] : []],
3789
3804
  usage: own,
3790
3805
  // Off the rollout, not the stream: no thread event carries a count, and the rollout
3791
3806
  // gains a `token_count` every time a request comes back — so a long run's ring climbs
@@ -3807,7 +3822,7 @@ function createCodexStreamRenderer(carried = false) {
3807
3822
  events: events.events
3808
3823
  };
3809
3824
  }
3810
- var CALLS, LOOK_EVERY_MS;
3825
+ var imageSafeText, CALLS, LOOK_EVERY_MS;
3811
3826
  var init_codex_stream = __esm({
3812
3827
  "src/lib/agent/wire/codex-stream.ts"() {
3813
3828
  "use strict";
@@ -3816,6 +3831,7 @@ var init_codex_stream = __esm({
3816
3831
  init_json();
3817
3832
  init_stream();
3818
3833
  init_prices();
3834
+ imageSafeText = (text4) => text4.replace(/data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+/gi, "[image]").replace(/!\[([^\]]*)\]\((?:<)?(?:\/|[A-Za-z]:[\\/]|file:)[^\n)]*\)/g, "[$1]");
3819
3835
  CALLS = { command_execution: "execute", mcp_tool_call: "other", file_change: "edit", web_search: "fetch" };
3820
3836
  LOOK_EVERY_MS = 3e3;
3821
3837
  }
@@ -4208,7 +4224,7 @@ var init_package = __esm({
4208
4224
  "package.json"() {
4209
4225
  package_default = {
4210
4226
  name: "wildcrane",
4211
- version: "0.11.42",
4227
+ version: "0.11.44",
4212
4228
  akbContract: 11,
4213
4229
  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.",
4214
4230
  keywords: [
@@ -16838,7 +16854,7 @@ var init_prompts = __esm({
16838
16854
  // src/lib/agent/stop.ts
16839
16855
  import { spawnSync as spawnSync4 } from "node:child_process";
16840
16856
  import fs52 from "node:fs";
16841
- function markedInProc(entry, strict = false) {
16857
+ function markedInProc(entry, strict = false, since) {
16842
16858
  const pids = [];
16843
16859
  for (const name of fs52.readdirSync("/proc")) {
16844
16860
  if (!/^\d+$/.test(name)) continue;
@@ -16847,12 +16863,22 @@ function markedInProc(entry, strict = false) {
16847
16863
  } catch (error) {
16848
16864
  if (strict && !["ENOENT", "ESRCH"].includes(error.code ?? "")) {
16849
16865
  const stat = fs52.statSync(`/proc/${name}`, { throwIfNoEntry: false });
16850
- if (stat?.uid === process.getuid?.()) throw error;
16866
+ if (stat?.uid === process.getuid?.() && !startedBefore(Number(name), since)) throw error;
16851
16867
  }
16852
16868
  }
16853
16869
  }
16854
16870
  return pids;
16855
16871
  }
16872
+ function startedBefore(pid, since) {
16873
+ if (since === void 0) return false;
16874
+ const result = spawnSync4("ps", ["-p", String(pid), "-o", "lstart="], {
16875
+ encoding: "utf8",
16876
+ timeout: 5e3,
16877
+ env: { ...process.env, LC_ALL: "C" }
16878
+ });
16879
+ const birth = Date.parse(result.stdout?.trim() ?? "");
16880
+ return result.status === 0 && Number.isFinite(birth) && birth + 2e3 <= since;
16881
+ }
16856
16882
  function markedInPs(entry, roots) {
16857
16883
  const ps = spawnSync4("ps", ["-A", "-E", "-ww", "-o", "pid=,ppid=,command="], {
16858
16884
  encoding: "utf8",
@@ -16988,7 +17014,7 @@ var init_stop = __esm({
16988
17014
  "use strict";
16989
17015
  init_env();
16990
17016
  init_paths();
16991
- runMark = (sessionId) => ({ name: RUN_ENV, value: sessionId });
17017
+ runMark = (sessionId, since) => ({ name: RUN_ENV, value: sessionId, ...since === void 0 ? {} : { since } });
16992
17018
  WINDOWS3 = process.platform === "win32";
16993
17019
  KILL_ROUND_MS = 300;
16994
17020
  KILL_ROUNDS = 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wildcrane",
3
- "version": "0.11.42",
3
+ "version": "0.11.44",
4
4
  "akbContract": 11,
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": [