@wrongstack/cli 0.6.6 → 0.6.7

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/index.js CHANGED
@@ -372,7 +372,7 @@ function getActiveBuilder() {
372
372
  return sddState.getBuilder();
373
373
  }
374
374
  function buildSddCommand(opts) {
375
- getSessionState(opts.context);
375
+ const sessionState = getSessionState(opts.context);
376
376
  return {
377
377
  name: "sdd",
378
378
  description: "AI-driven SDD: /sdd [new|approve|execute|cancel|status|list|show|templates]",
@@ -395,7 +395,7 @@ function buildSddCommand(opts) {
395
395
  case "create": {
396
396
  const forceFlag = rest.includes("--force") || rest.includes("-f");
397
397
  const title = rest.filter((a) => !a.startsWith("-")).join(" ").trim() || "Untitled Feature";
398
- if (!sddState.getBuilder() && !forceFlag) {
398
+ if (!sessionState.getBuilder() && !forceFlag) {
399
399
  const sessionPath = path23.join(projectRoot, ".wrongstack", "sdd-session.json");
400
400
  try {
401
401
  await fsp2.access(sessionPath);
@@ -1030,6 +1030,14 @@ Start executing the tasks one by one.`
1030
1030
  deletedFromDisk = true;
1031
1031
  } catch {
1032
1032
  }
1033
+ try {
1034
+ await fsp2.rm(path23.join(projectRoot, ".wrongstack", "specs"), { recursive: true, force: true });
1035
+ } catch {
1036
+ }
1037
+ try {
1038
+ await fsp2.rm(path23.join(projectRoot, ".wrongstack", "task-graphs"), { recursive: true, force: true });
1039
+ } catch {
1040
+ }
1033
1041
  const cancelBuilder = sddState.getBuilder();
1034
1042
  if (cancelBuilder) {
1035
1043
  const title = cancelBuilder.getSession().title;
@@ -6915,6 +6923,85 @@ var TerminalRenderer = class {
6915
6923
  this.out.write("\x1B[2J\x1B[H");
6916
6924
  this.lineStart = true;
6917
6925
  }
6926
+ /**
6927
+ * Write a flashy agent completion banner for delegate tool results.
6928
+ * Renders a box like:
6929
+ * ┌─────────────────────────────────────┐
6930
+ * │ ✓ [role] done in 4m 32s │
6931
+ * │ 127 iterations · 341 tools │
6932
+ * │ Found 14 bugs across 6 files... │
6933
+ * └─────────────────────────────────────┘
6934
+ */
6935
+ writeAgentSummary(summary, ok) {
6936
+ if (this.silent) return;
6937
+ if (!this.lineStart) this.out.write("\n");
6938
+ const lines = summary.split("\n");
6939
+ const icon = ok ? theme2.success("\u2713") : theme2.error("\u2718");
6940
+ const firstLine = `${icon} ${lines[0] ?? summary}`;
6941
+ const body = lines.slice(1);
6942
+ const maxWidth = Math.min(process.stdout.columns ?? 80, 120);
6943
+ const contentWidth = Math.max(
6944
+ firstLine.length,
6945
+ body.reduce((a, l) => Math.max(a, l.length), 0)
6946
+ );
6947
+ const boxWidth = Math.min(Math.max(contentWidth + 4, 44), maxWidth);
6948
+ const thick = "\u2501".repeat(boxWidth - 2);
6949
+ const thin = "\u2500".repeat(boxWidth - 2);
6950
+ this.out.write(`
6951
+ ${theme2.primary("\u250C")}${thick}${theme2.primary("\u2510")}
6952
+ `);
6953
+ const centre = (s) => {
6954
+ const inner = ` ${s} `;
6955
+ const padLen = Math.max(0, boxWidth - 2 - s.length);
6956
+ const left = Math.floor(padLen / 2);
6957
+ const right = padLen - left;
6958
+ return `${" ".repeat(left)}${inner}${" ".repeat(right)}`;
6959
+ };
6960
+ this.out.write(` ${theme2.primary("\u2502")}${centre(firstLine)}${theme2.primary("\u2502")}
6961
+ `);
6962
+ for (const l of body) {
6963
+ this.out.write(
6964
+ ` ${theme2.primary("\u2502")} ${l}${" ".repeat(Math.max(0, boxWidth - 3 - l.length))}${theme2.primary("\u2502")}
6965
+ `
6966
+ );
6967
+ }
6968
+ this.out.write(` ${theme2.primary("\u2514")}${thin}${theme2.primary("\u2518")}
6969
+ `);
6970
+ this.lineStart = true;
6971
+ }
6972
+ /**
6973
+ * Render subagent completion banners from a RunResult.
6974
+ * Uses `delegateSummaries` when available (populated by delegate tool),
6975
+ * otherwise falls back to scanning message history.
6976
+ */
6977
+ writeDelegateSummaries(result) {
6978
+ if (this.silent) return;
6979
+ if (result.delegateSummaries) {
6980
+ for (const { summary, ok } of result.delegateSummaries) {
6981
+ this.writeAgentSummary(summary, ok);
6982
+ }
6983
+ return;
6984
+ }
6985
+ if (!result.messages) return;
6986
+ for (const msg of result.messages) {
6987
+ const m = msg;
6988
+ if (!Array.isArray(m.content)) continue;
6989
+ for (const block of m.content) {
6990
+ const b = block;
6991
+ if (b.type !== "tool_result" || b.name !== "delegate") continue;
6992
+ let obj;
6993
+ try {
6994
+ obj = typeof b.content === "string" ? JSON.parse(b.content) : b.content;
6995
+ } catch {
6996
+ continue;
6997
+ }
6998
+ const o = obj;
6999
+ if (o.summary) {
7000
+ this.writeAgentSummary(o.summary, o.ok ?? true);
7001
+ }
7002
+ }
7003
+ }
7004
+ }
6918
7005
  };
6919
7006
  function renderMarkdown(s) {
6920
7007
  let out = s;
@@ -9225,11 +9312,13 @@ async function runRepl(opts) {
9225
9312
  await renderGoalBanner(opts);
9226
9313
  let activeCtrl;
9227
9314
  let interrupts = 0;
9315
+ let exiting = false;
9228
9316
  const onSigint = () => {
9229
9317
  interrupts++;
9230
9318
  if (interrupts >= 2) {
9231
9319
  opts.renderer.writeWarning("Exiting.");
9232
- process.exit(130);
9320
+ exiting = true;
9321
+ return;
9233
9322
  }
9234
9323
  if (opts.getAutonomy?.() === "eternal" || opts.getAutonomy?.() === "eternal-parallel") {
9235
9324
  opts.getEternalEngine?.()?.stop();
@@ -9250,6 +9339,7 @@ async function runRepl(opts) {
9250
9339
  const builder = new InputBuilder({ store: opts.attachments });
9251
9340
  try {
9252
9341
  for (; ; ) {
9342
+ if (exiting) break;
9253
9343
  if (opts.getAutonomy?.() === "eternal") {
9254
9344
  const engine = opts.getEternalEngine?.();
9255
9345
  if (!engine) {
@@ -9855,6 +9945,8 @@ async function execute(deps) {
9855
9945
  renderer.writeWarning(`Hit max iterations (${result.iterations}).`);
9856
9946
  }
9857
9947
  if (result.finalText) renderer.write("\n" + result.finalText + "\n");
9948
+ const r = result;
9949
+ renderer.writeDelegateSummaries(r);
9858
9950
  renderer.write(
9859
9951
  "\n" + color.dim(
9860
9952
  `[in: ${fmtTok(usage.input)} out: ${fmtTok(usage.output)} iters: ${usage.iterations} cost: ${usage.cost.toFixed(4)} ${(usage.elapsedMs / 1e3).toFixed(1)}s]`
@@ -10258,8 +10350,7 @@ var MultiAgentHost = class {
10258
10350
  }
10259
10351
  subagentToolRegistry(allow) {
10260
10352
  if (!allow || allow.length === 0) return this.deps.toolRegistry;
10261
- const cloneCtor = this.deps.toolRegistry.constructor;
10262
- const sub = new cloneCtor();
10353
+ const sub = this.deps.toolRegistry.clone();
10263
10354
  for (const t of this.filterTools(allow)) sub.register(t);
10264
10355
  return sub;
10265
10356
  }