wildcrane 0.11.74 → 0.11.75
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 +68 -14
- package/package.json +2 -2
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.75 — 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)
|
|
@@ -59,6 +59,11 @@ function insideRun() {
|
|
|
59
59
|
function runEnv(env2, value) {
|
|
60
60
|
return { ...env2, [RUN_ENV]: value };
|
|
61
61
|
}
|
|
62
|
+
function taskReviewContext() {
|
|
63
|
+
const { AI4KANBAN_TASK_REVIEW: review, AI4KANBAN_REVIEW_STAGES: assigned } = process.env;
|
|
64
|
+
if (!review) return void 0;
|
|
65
|
+
return { review: JSON.parse(review), assigned: assigned ? JSON.parse(assigned) : void 0 };
|
|
66
|
+
}
|
|
62
67
|
var RUN_ENV, SCHEDULED_AGENTS_ENV, SESSION_COST_ENV, STOP_ENV, SESSION_VARS;
|
|
63
68
|
var init_env = __esm({
|
|
64
69
|
"src/lib/agent/env.ts"() {
|
|
@@ -20852,11 +20857,49 @@ function parseReviewPlan(value, previews) {
|
|
|
20852
20857
|
function readReviewPlan(plan) {
|
|
20853
20858
|
return plan?.map(({ id: id2, after: after2, previews }) => ({ id: id2, after: after2, previews })) ?? null;
|
|
20854
20859
|
}
|
|
20860
|
+
function reviewAuthorization(review, assigned, dispatchRevision) {
|
|
20861
|
+
if (review.pending_plan) return { kind: "pending" };
|
|
20862
|
+
const states2 = new Map(review.stages.map((stage) => [stage.id, stage]));
|
|
20863
|
+
const nodes = (review.plan ?? []).filter((node2) => {
|
|
20864
|
+
const stage = states2.get(node2.id);
|
|
20865
|
+
if (!stage || assigned && !assigned.includes(node2.id)) return false;
|
|
20866
|
+
return stage.status === "running" || stage.status === "available" && (dispatchRevision === void 0 || stage.revision <= dispatchRevision);
|
|
20867
|
+
});
|
|
20868
|
+
if (assigned?.some((id2) => !nodes.some((node2) => node2.id === id2))) return { kind: "changed" };
|
|
20869
|
+
if (review.plan === null) return { kind: "plan" };
|
|
20870
|
+
if (review.plan.length === 0) return { kind: "unreviewed" };
|
|
20871
|
+
if (nodes.length) return { kind: "stages", nodes };
|
|
20872
|
+
if (review.plan.every((node2) => states2.get(node2.id)?.status === "approved")) return { kind: "delivery" };
|
|
20873
|
+
return { kind: "waiting" };
|
|
20874
|
+
}
|
|
20875
|
+
function reviewAllows(authorization, action) {
|
|
20876
|
+
return action === "refine" ? authorization.kind === "plan" || authorization.kind === "stages" : authorization.kind === "unreviewed" || authorization.kind === "delivery";
|
|
20877
|
+
}
|
|
20878
|
+
function reviewInstruction(authorization) {
|
|
20879
|
+
switch (authorization.kind) {
|
|
20880
|
+
case "plan":
|
|
20881
|
+
return "Planning only. Propose a review plan; wait for explicit plan approval.";
|
|
20882
|
+
case "pending":
|
|
20883
|
+
return "Wait for the proposed plan decision. Do not start new stages.";
|
|
20884
|
+
case "unreviewed":
|
|
20885
|
+
return "No extra review. Complete the authorized work and Studio delivery checks.";
|
|
20886
|
+
case "stages":
|
|
20887
|
+
return [
|
|
20888
|
+
"Work only on these unlocked stages: " + authorization.nodes.map((node2) => node2.id).join(", "),
|
|
20889
|
+
...authorization.nodes.map((node2) => `- ${node2.id}: ${node2.previews.length ? node2.previews.join(", ") : "card body"}`)
|
|
20890
|
+
].join("\n");
|
|
20891
|
+
case "delivery":
|
|
20892
|
+
return "Stages complete. Follow Studio delivery checks.";
|
|
20893
|
+
case "changed":
|
|
20894
|
+
return "Review authorization changed. Read the task again.";
|
|
20895
|
+
case "waiting":
|
|
20896
|
+
return "Wait for review. Do not execute locked stages.";
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20855
20899
|
function reviewBoundary(review, assigned) {
|
|
20856
|
-
const allowed = review.pending_plan ? [] : review.stages.filter((s) => (s.status === "available" || s.status === "running") && (!assigned || assigned.includes(s.id)));
|
|
20857
20900
|
return [
|
|
20858
20901
|
"Task review: " + JSON.stringify(review),
|
|
20859
|
-
|
|
20902
|
+
reviewInstruction(reviewAuthorization(review, assigned)),
|
|
20860
20903
|
"Read akb task review before reporting running/done with its revision. Sync content and assets before done. Revise a stage before changing its approved output. Questions and plan approval never approve outputs."
|
|
20861
20904
|
].join("\n");
|
|
20862
20905
|
}
|
|
@@ -41772,8 +41815,8 @@ var init_package = __esm({
|
|
|
41772
41815
|
"package.json"() {
|
|
41773
41816
|
package_default = {
|
|
41774
41817
|
name: "wildcrane",
|
|
41775
|
-
version: "0.11.
|
|
41776
|
-
akbContract:
|
|
41818
|
+
version: "0.11.75",
|
|
41819
|
+
akbContract: 22,
|
|
41777
41820
|
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.",
|
|
41778
41821
|
keywords: [
|
|
41779
41822
|
"kanban",
|
|
@@ -63438,18 +63481,15 @@ function refinementStep(card) {
|
|
|
63438
63481
|
function refinementRequest(req) {
|
|
63439
63482
|
const card = req.id === void 0 ? null : currentCard(req.id);
|
|
63440
63483
|
if (!card) return { error: `task #${req.id} does not exist` };
|
|
63441
|
-
const context =
|
|
63442
|
-
const
|
|
63443
|
-
|
|
63444
|
-
const authorized = review && !review.pending_plan && (review.plan === null || review.stages.some((s) => ["available", "running"].includes(s.status) && (!assigned || assigned.includes(s.id))));
|
|
63445
|
-
const step = review ? authorized && !card.questions.some((q) => q.options?.length) ? "clarify" : "done" : refinementStep(card);
|
|
63446
|
-
if (step === "done") {
|
|
63484
|
+
const context = taskReviewContext();
|
|
63485
|
+
const canStart = context ? reviewAllows(reviewAuthorization(context.review, context.assigned), "refine") && !card.questions.some((q) => q.options?.length) : refinementStep(card) === "clarify";
|
|
63486
|
+
if (!canStart) {
|
|
63447
63487
|
const waiting = card.questions.length > 0 && canRefine({ ...card, questions: [] });
|
|
63448
63488
|
return {
|
|
63449
63489
|
error: waiting ? `#${card.id} is waiting for the user to answer its open questions, so there is nothing to refine yet \u2014 the board refines it on its own once they are answered.` : `a refine would not move #${card.id}`
|
|
63450
63490
|
};
|
|
63451
63491
|
}
|
|
63452
|
-
return { action:
|
|
63492
|
+
return { action: "clarify", id: card.id, title: card.title, notes: req.notes, refineRound: 1, ...req.carry ? { carry: req.carry } : {} };
|
|
63453
63493
|
}
|
|
63454
63494
|
async function startRefinement(req) {
|
|
63455
63495
|
const next = refinementRequest(req);
|
|
@@ -63515,6 +63555,8 @@ var init_refine2 = __esm({
|
|
|
63515
63555
|
"use strict";
|
|
63516
63556
|
init_read();
|
|
63517
63557
|
init_rules();
|
|
63558
|
+
init_review_plan();
|
|
63559
|
+
init_env();
|
|
63518
63560
|
init_start();
|
|
63519
63561
|
init_stage_end();
|
|
63520
63562
|
init_stages();
|
|
@@ -63704,7 +63746,8 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
63704
63746
|
`);
|
|
63705
63747
|
const basePrompt = record2.resumedFrom ? spec.prompt || resumePrompt(record2.deliveryId, record2.action) : spec.prompt;
|
|
63706
63748
|
const recoveryPrompt = record2.harness === "antigravity" && record2.resumedFrom ? "First verify existing progress and operation results. Preserve user decisions and completed work; do not repeat completed operations. Check actual state before continuing any operation whose result is uncertain." : "";
|
|
63707
|
-
const
|
|
63749
|
+
const reviewContext = taskReviewContext();
|
|
63750
|
+
const boundary = reviewContext ? reviewBoundary(reviewContext.review, reviewContext.assigned) : "";
|
|
63708
63751
|
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", record2.retry ? `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "", conflictPrompt(KANBAN), boundary, basePrompt, recoveryPrompt, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
|
|
63709
63752
|
const before = markBoard();
|
|
63710
63753
|
const takes = active3.images;
|
|
@@ -64187,6 +64230,7 @@ var init_watch = __esm({
|
|
|
64187
64230
|
"src/lib/agent/watch.ts"() {
|
|
64188
64231
|
"use strict";
|
|
64189
64232
|
init_review_plan();
|
|
64233
|
+
init_env();
|
|
64190
64234
|
init_connection_process();
|
|
64191
64235
|
init_deliveries();
|
|
64192
64236
|
init_board_conflicts();
|
|
@@ -64674,11 +64718,21 @@ function deliveryOutcome(deliveryId) {
|
|
|
64674
64718
|
id: deliveryId,
|
|
64675
64719
|
status: delivery.status,
|
|
64676
64720
|
line,
|
|
64721
|
+
...delivery.status === "cancelled" ? {
|
|
64722
|
+
ending: { kind: delivery.steps.some((s) => s.step === "discarded") ? "discarded" : "stopped" }
|
|
64723
|
+
} : {},
|
|
64677
64724
|
...commit ? { commit, ...delivery.targetBranch ? { branch: delivery.targetBranch } : {} } : {}
|
|
64678
64725
|
};
|
|
64679
64726
|
}
|
|
64680
64727
|
const state = deliveryState(delivery, delivery.cardId === null ? 0 : openQuestions(delivery.cardId));
|
|
64681
|
-
|
|
64728
|
+
const reason = delivery.review?.stopped?.why;
|
|
64729
|
+
return {
|
|
64730
|
+
id: deliveryId,
|
|
64731
|
+
status: delivery.status,
|
|
64732
|
+
stage: state.stage,
|
|
64733
|
+
line: state.line,
|
|
64734
|
+
...reason ? { ending: { kind: "blocked", reason } } : {}
|
|
64735
|
+
};
|
|
64682
64736
|
}
|
|
64683
64737
|
function runLine(r, program2 = "akb", indent2 = "") {
|
|
64684
64738
|
const sub = r.action === "sub";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wildcrane",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"akbContract":
|
|
3
|
+
"version": "0.11.75",
|
|
4
|
+
"akbContract": 22,
|
|
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": [
|
|
7
7
|
"kanban",
|