wildcrane 0.11.41 → 0.11.43

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 +39 -13
  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.41 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
2
+ // ai4kanban 0.11.43 — 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.41",
4227
+ version: "0.11.43",
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;
@@ -23096,7 +23122,7 @@ var init_add_task = __esm({
23096
23122
  var archive_default;
23097
23123
  var init_archive2 = __esm({
23098
23124
  "src/guide/archive.md"() {
23099
- archive_default = "# Finish a task\n\n## Write the shipped line\n\nRecord each user-facing outcome on one line in `docs/kanban/memory/readme.md`, under the\n`## <module>` heading the card's `modules:` names. Do not record internal-only changes. Use\nformats like these:\n\n- \u2705 Exporting a report to PDF: [Export reports](https://docs.example.com/export). Link to\n a published doc when available; do not restate it.\n- \u2705 Customers can pay an invoice by bank transfer from the billing page. When no doc\n exists, state plainly what the user can now do.\n- \u274C The orders table moved to a new database cluster. This describes infrastructure, not\n user-facing behavior.\n\n## Archive the card\n\nUse `akb raw delivery complete <id>` to finish your current studio step. The last step archives\nthe card and prints its handoff. Earlier steps leave it for the remaining studio agents.\nOutside an active delivery, use `akb raw archive <id>` or `akb raw reject <id>`.\n\n**Never finish a task by hand.** Deleting the card file yourself leaves other cards'\n`blocked_by:` and `related:` pointing at a card that no longer exists \u2014 the command is what\nfinds those, and nothing else will. A run that does this is reported as having broken the\nboard.\n\nAfter completing the approved step and required outputs, run `akb raw delivery complete <id>`\nand follow its handoff. Software steps in a git project supply `--commit <full-sha> --branch <target>`.\nIf completion was interrupted, inspect the recorded result and retry the same completion.\n";
23125
+ archive_default = "# Finish a task\n\n## Write the shipped line\n\nRecord each user-facing outcome on one line in `docs/kanban/memory/readme.md`, under the\n`## <module>` heading the card's `modules:` names. Do not record internal-only changes. Use\nformats like these:\n\n- \u2705 Exporting a report to PDF: [Export reports](https://docs.example.com/export). Link to\n a published doc when available; do not restate it.\n- \u2705 Customers can pay an invoice by bank transfer from the billing page. When no doc\n exists, state plainly what the user can now do.\n- \u274C The orders table moved to a new database cluster. This describes infrastructure, not\n user-facing behavior.\n\n## Archive the card\n\nUse `akb raw delivery complete <id>` to finish your current studio step. The last step archives\nthe card and prints its handoff. Earlier steps leave it for the remaining studio agents.\nOutside an active delivery, use `akb raw archive <id>` or `akb raw reject <id>`.\n\n**Never finish a task by hand.** Deleting the card file yourself leaves other cards'\n`blocked_by:` and `related:` pointing at a card that no longer exists \u2014 the command is what\nfinds those, and nothing else will. A run that does this is reported as having broken the\nboard.\n\nBefore completing a step, verify its approved requirements and required outputs; before the\nlast step, verify every delivery condition, including any required publication and live checks.\nRecord the verification results on the card, leave unmet work unchecked, and handle user-action\nblockers through `akb guide implement`. Preparation, a merged commit or a handoff in the final\nreply does not establish delivery.\n\nOnce those checks pass, run `akb raw delivery complete <id>` and follow its handoff. Software\nsteps in a git project supply `--commit <full-sha> --branch <target>`.\nIf completion was interrupted, inspect the recorded result and retry the same completion.\n";
23100
23126
  }
23101
23127
  });
23102
23128
 
@@ -23136,7 +23162,7 @@ var init_describe_project = __esm({
23136
23162
  var discuss_goal_default;
23137
23163
  var init_discuss_goal = __esm({
23138
23164
  "src/guide/discuss-goal.md"() {
23139
- discuss_goal_default = '# Discuss a goal\n\nThis flow only helps the user settle goals; refining, previewing, and running them come later.\n\n- **Remote user**: the user works remotely and sees only tasks and their previews, never local files.\n- **Software failures**: read `akb guide troubleshoot` when root cause analysis is needed.\n\n## Goals\n\n- **Missing information**: ask the user for information needed to form a goal.\n- **Save**: once a goal is clear, save or update it with `akb goal` (see `akb goal --help`), then stop; an existing build continues in its current session.\n- **Goal format**: each goal has a title, an outcome of at most 150 words, and a `## Done when` list of verifiable acceptance criteria, without technical design.\n- **Independent deliverables**: save separate deliverables as separate goals; remove a replaced goal with `akb goal drop --id <goal>`.\n- **Studio**: pick the studio from `akb studio list` that fits the actual work; prefer the user\u2019s choice.\n- **Review points**: save through `--previews` the agents from `akb raw previews --triggers --studio <id>` whose conditions the goal meets, always including those marked `Always`, or an empty list.\n- **Use judgment**: settle outcome decisions you can and explain them; ask only for decisions the user must make that change the result, with a recommendation.\n- **Plain words**: answer directly using everyday words.\n- **Hide machinery**: omit plans, files, paths, commands, tools, and connectors from replies; refer to actions by their button labels.\n- **Starting a goal**: "Start now" (\u7ACB\u5373\u5F00\u59CB) begins the work directly; "Refine goal" (\u7EC6\u5316\u76EE\u6807) appears only when the goal has review points, and shows their previews for approval first.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n';
23165
+ discuss_goal_default = '# Discuss a goal\n\nThis flow only helps the user settle goals; refining, previewing, and running them come later.\n\n- **Remote user**: the user works remotely and sees only tasks and their previews, never local files.\n- **Investigate here**: complete checks, diagnosis, audits, and similar investigations in this session, using `akb guide troubleshoot` for software failures; never create investigation or \u201Cinvestigate then fix\u201D goals.\n- **Concrete goals**: when a change needs investigation, save a goal only after the findings establish the concrete change; if verification is blocked, report what remains unverified instead of deferring it to a goal.\n\n## Goals\n\n- **Missing information**: ask the user for information needed to form a goal.\n- **Save**: once a goal is clear, save or update it with `akb goal` (see `akb goal --help`), then stop; an existing build continues in its current session.\n- **Goal format**: each goal has a title, an outcome of at most 150 words, and a `## Done when` list of verifiable acceptance criteria, without technical design.\n- **Independent deliverables**: save separate deliverables as separate goals; remove a replaced goal with `akb goal drop --id <goal>`.\n- **Studio**: pick the studio from `akb studio list` that fits the actual work; prefer the user\u2019s choice.\n- **Review points**: save through `--previews` the agents from `akb raw previews --triggers --studio <id>` whose conditions the goal meets, always including those marked `Always`, or an empty list.\n- **Use judgment**: settle outcome decisions you can and explain them; ask only for decisions the user must make that change the result, with a recommendation.\n- **Plain words**: answer directly using everyday words.\n- **Hide machinery**: omit plans, files, paths, commands, tools, and connectors from replies; refer to actions by their button labels.\n- **Starting a goal**: "Start now" (\u7ACB\u5373\u5F00\u59CB) begins the work directly; "Refine goal" (\u7EC6\u5316\u76EE\u6807) appears only when the goal has review points, and shows their previews for approval first.\n- **Anything else**: for a request this guide does not cover, read `akb help` once, then the matching command\'s `--help`.\n';
23140
23166
  }
23141
23167
  });
23142
23168
 
@@ -23152,7 +23178,7 @@ var init_follow_up = __esm({
23152
23178
  var implement_default;
23153
23179
  var init_implement = __esm({
23154
23180
  "src/guide/implement.md"() {
23155
- implement_default = "# Implement the approved requirements\n\nBuild the approved card or plan directly. Preserve settled decisions and unrelated questions;\ndo not replace or contradict the approved requirements. With no card, build only the given\nrequirement and create no card.\n\n- **Check applicability**: use the working directory, project instructions, configuration\n sources and change history as evidence; missing configuration alone does not make a check\n inapplicable. Explain any inapplicable check and its alternative verification; never report\n an unrun or failing check as passed. Do not bypass checks with empty configuration, disabled\n checks or lower standards.\n- **User-action blockers**: ask only when this build needs a decision, permission or material\n only the user can supply. On a card, append it as a question per `akb guide update-questions`;\n a question only in your reply never reaches the user. Continue independent work.\n- **Defer what can wait**: follow `akb guide follow-up` for work this build does not require;\n never ask about it or let it block this build.\n- **Decisions made while building**: record an answered material decision the user could\n reasonably reverse under `## Worth noting after implementation` on the card.\n- **Resume**: inspect the existing result and the unchecked todos, carry completed steps\n forward, and finish the remaining todos before recording completion.\n";
23181
+ implement_default = "# Implement the approved requirements\n\nBuild the approved card or plan directly. Preserve settled decisions and unrelated questions;\ndo not replace or contradict the approved requirements. With no card, build only the given\nrequirement and create no card.\n\n- **Check applicability**: use the working directory, project instructions, configuration\n sources and change history as evidence; missing configuration alone does not make a check\n inapplicable. Explain any inapplicable check and its alternative verification; never report\n an unrun or failing check as passed. Do not bypass checks with empty configuration, disabled\n checks or lower standards.\n- **Authorization**: approval covers the necessary operations within the agreed scope and\n constraints; carry it across commands, tools and stages without repeated confirmation.\n- **User-action blockers**: resolve routine choices and problems yourself; ask only when\n reasonable investigation leaves a blocker requiring user action or a decision beyond the\n approved scope. On a card, use `akb guide update-questions`, stating what you tried, what\n is blocked and your recommendation; continue independent work.\n- **Defer what can wait**: follow `akb guide follow-up` for work this build does not require;\n never ask about it or let it block this build.\n- **Decisions made while building**: record an answered material decision the user could\n reasonably reverse under `## Worth noting after implementation` on the card.\n- **Resume**: inspect the existing result and the unchecked todos, carry completed steps\n forward, and finish the remaining todos before recording completion.\n";
23156
23182
  }
23157
23183
  });
23158
23184
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wildcrane",
3
- "version": "0.11.41",
3
+ "version": "0.11.43",
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": [