kantban-cli 0.1.12 → 0.1.14

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.
@@ -113,6 +113,9 @@ function classifyTrajectory(snapshots) {
113
113
  if (meaningful.length === 0) {
114
114
  return { status: "progressing", evidence: "only initial checks", confidence: 0.5 };
115
115
  }
116
+ if (meaningful.length < 2) {
117
+ return { status: "progressing", evidence: "insufficient data for trajectory", confidence: 0.3 };
118
+ }
116
119
  if (meaningful.every((d) => d === "same")) {
117
120
  return { status: "spinning", evidence: "identical gate results", confidence: 1 };
118
121
  }
@@ -720,7 +723,7 @@ var PromoteSignalSchema = z19.object({
720
723
 
721
724
  // ../types/dist/pipeline-session.schema.js
722
725
  import { z as z20 } from "zod";
723
- var InvocationTypeSchema = z20.enum(["heavy", "light", "advisor", "stuck_detection", "orchestrator"]);
726
+ var InvocationTypeSchema = z20.enum(["heavy", "light", "advisor", "stuck_detection", "orchestrator", "replanner"]);
724
727
  var ExitReasonSchema = z20.enum(["moved", "stalled", "error", "max_iterations", "stopped", "deleted"]);
725
728
  var PipelineSessionSchema = z20.object({
726
729
  id: z20.string().uuid(),
@@ -3284,6 +3287,8 @@ var PROMPT_BUDGETS = {
3284
3287
  ticket_details: 1500,
3285
3288
  comments: 2e3,
3286
3289
  transition_rules: 500,
3290
+ transition_history: 1e3,
3291
+ dependency_requirements: 500,
3287
3292
  linked_documents: 2e3,
3288
3293
  metadata: 200
3289
3294
  };
@@ -3467,91 +3472,92 @@ After completing your work, commit all changes to your worktree branch.
3467
3472
  `);
3468
3473
  parts.push(truncateToTokens(meta.runMemoryContent, PROMPT_BUDGETS.run_memory));
3469
3474
  }
3470
- parts.push(`## Current Ticket
3475
+ const ticketParts = [];
3476
+ ticketParts.push(`## Current Ticket
3471
3477
  `);
3472
- parts.push(`**Title:** ${ticketContext.ticket.title}`);
3473
- parts.push(`**Ticket ID:** ${ticketContext.ticket.id}`);
3474
- parts.push(`**Ticket Number:** ${String(ticketContext.ticket.ticket_number)}`);
3478
+ ticketParts.push(`**Title:** ${ticketContext.ticket.title}`);
3479
+ ticketParts.push(`**Ticket ID:** ${ticketContext.ticket.id}`);
3480
+ ticketParts.push(`**Ticket Number:** ${String(ticketContext.ticket.ticket_number)}`);
3475
3481
  if (ticketContext.ticket.description) {
3476
- parts.push(`
3477
- ${truncateToTokens(ticketContext.ticket.description, PROMPT_BUDGETS.ticket_details)}`);
3482
+ ticketParts.push(`
3483
+ ${ticketContext.ticket.description}`);
3478
3484
  }
3479
3485
  if (ticketContext.ticket.assignee) {
3480
- parts.push(`**Assignee:** ${ticketContext.ticket.assignee.name}`);
3486
+ ticketParts.push(`**Assignee:** ${ticketContext.ticket.assignee.name}`);
3481
3487
  }
3482
3488
  if (ticketContext.ticket.column) {
3483
- parts.push(`**Current Column:** ${ticketContext.ticket.column.name} (${ticketContext.ticket.column.type})`);
3489
+ ticketParts.push(`**Current Column:** ${ticketContext.ticket.column.name} (${ticketContext.ticket.column.type})`);
3484
3490
  }
3485
3491
  if (ticketContext.ticket.backward_transitions > 0) {
3486
- parts.push(`**Backward Transitions:** ${String(ticketContext.ticket.backward_transitions)}`);
3492
+ ticketParts.push(`**Backward Transitions:** ${String(ticketContext.ticket.backward_transitions)}`);
3487
3493
  }
3488
3494
  if (ticketContext.field_values.length > 0) {
3489
- parts.push(`
3495
+ ticketParts.push(`
3490
3496
  ## Field Values
3491
3497
  `);
3492
3498
  for (const fv of ticketContext.field_values) {
3493
- parts.push(`- **${fv.field_name}:** ${fv.value !== null ? JSON.stringify(fv.value) : "(not set)"}`);
3499
+ ticketParts.push(`- **${fv.field_name}:** ${fv.value !== null ? JSON.stringify(fv.value) : "(not set)"}`);
3494
3500
  }
3495
3501
  }
3496
3502
  if (ticketContext.parent) {
3497
- parts.push(`
3503
+ ticketParts.push(`
3498
3504
  ## Parent Ticket
3499
3505
  `);
3500
- parts.push(`- #${String(ticketContext.parent.ticket_number)}: ${ticketContext.parent.title}`);
3506
+ ticketParts.push(`- #${String(ticketContext.parent.ticket_number)}: ${ticketContext.parent.title}`);
3501
3507
  }
3502
3508
  if (ticketContext.children.length > 0) {
3503
- parts.push(`
3509
+ ticketParts.push(`
3504
3510
  ## Child Tickets
3505
3511
  `);
3506
3512
  for (const child of ticketContext.children) {
3507
- parts.push(`- #${String(child.ticket_number)}: ${child.title}${child.column_name ? ` (${child.column_name})` : ""}`);
3513
+ ticketParts.push(`- #${String(child.ticket_number)}: ${child.title}${child.column_name ? ` (${child.column_name})` : ""}`);
3508
3514
  }
3509
3515
  }
3510
3516
  if (ticketContext.transitions.length > 0) {
3511
- parts.push(`
3517
+ ticketParts.push(`
3512
3518
  ## Transition History
3513
3519
  `);
3514
3520
  let transitionTokens = 0;
3515
- const TRANSITION_BUDGET = 1e3;
3516
3521
  for (const t of ticketContext.transitions) {
3517
3522
  let line = `- ${t.from ?? "Backlog"} \u2192 ${t.to}`;
3518
3523
  if (t.handoff) line += ` (handoff: ${JSON.stringify(t.handoff)})`;
3519
3524
  const lineTokens = estimateTokens(line);
3520
- if (transitionTokens + lineTokens > TRANSITION_BUDGET) {
3521
- parts.push(`- [...truncated \u2014 ${String(ticketContext.transitions.length)} total transitions]`);
3525
+ if (transitionTokens + lineTokens > PROMPT_BUDGETS.transition_history) {
3526
+ ticketParts.push(`- [...truncated \u2014 ${String(ticketContext.transitions.length)} total transitions]`);
3522
3527
  break;
3523
3528
  }
3524
- parts.push(line);
3529
+ ticketParts.push(line);
3525
3530
  transitionTokens += lineTokens;
3526
3531
  }
3527
3532
  }
3528
3533
  if (ticketContext.ticket_links.length > 0) {
3529
- parts.push(`
3534
+ ticketParts.push(`
3530
3535
  ## Ticket Links
3531
3536
  `);
3532
3537
  const blockers = ticketContext.ticket_links.filter((l) => l.direction === "inward" && l.link_type === "blocks");
3533
3538
  const blocking = ticketContext.ticket_links.filter((l) => l.direction === "outward" && l.link_type === "blocks");
3534
3539
  const related = ticketContext.ticket_links.filter((l) => l.link_type === "relates_to");
3535
3540
  if (blockers.length > 0) {
3536
- parts.push(`**Blocked by:**`);
3541
+ ticketParts.push(`**Blocked by:**`);
3537
3542
  for (const l of blockers) {
3538
3543
  const status = l.resolved ? "(resolved)" : "UNRESOLVED";
3539
- parts.push(`- #${String(l.ticket_number)}: ${l.title} [${l.column_name ?? "backlog"}] ${status}`);
3544
+ ticketParts.push(`- #${String(l.ticket_number)}: ${l.title} [${l.column_name ?? "backlog"}] ${status}`);
3540
3545
  }
3541
3546
  }
3542
3547
  if (blocking.length > 0) {
3543
- parts.push(`**Blocks:**`);
3548
+ ticketParts.push(`**Blocks:**`);
3544
3549
  for (const l of blocking) {
3545
- parts.push(`- #${String(l.ticket_number)}: ${l.title} [${l.column_name ?? "backlog"}]`);
3550
+ ticketParts.push(`- #${String(l.ticket_number)}: ${l.title} [${l.column_name ?? "backlog"}]`);
3546
3551
  }
3547
3552
  }
3548
3553
  if (related.length > 0) {
3549
- parts.push(`**Related:**`);
3554
+ ticketParts.push(`**Related:**`);
3550
3555
  for (const l of related) {
3551
- parts.push(`- #${String(l.ticket_number)}: ${l.title}`);
3556
+ ticketParts.push(`- #${String(l.ticket_number)}: ${l.title}`);
3552
3557
  }
3553
3558
  }
3554
3559
  }
3560
+ parts.push(truncateToTokens(ticketParts.join("\n"), PROMPT_BUDGETS.ticket_details));
3555
3561
  if (ticketContext.comments.length > 0) {
3556
3562
  parts.push(`
3557
3563
  ## Comments
@@ -3568,7 +3574,7 @@ ${truncateToTokens(ticketContext.ticket.description, PROMPT_BUDGETS.ticket_detai
3568
3574
  parts.push(`
3569
3575
  ## Dependency & Field Requirements
3570
3576
  `);
3571
- parts.push(ticketContext.dependency_requirements);
3577
+ parts.push(truncateToTokens(ticketContext.dependency_requirements, PROMPT_BUDGETS.dependency_requirements));
3572
3578
  }
3573
3579
  if (ticketContext.linked_documents.length > 0) {
3574
3580
  parts.push(`
@@ -3804,6 +3810,7 @@ var RalphLoop = class {
3804
3810
  log(`Ticket moved to column ${afterFp.column_id ?? "null"}`);
3805
3811
  return withCosts({ reason: "moved", iterations: i, gutterCount, model: resolvedModel, output: lastOutput });
3806
3812
  }
3813
+ const gutterBeforeGates = gutterCount;
3807
3814
  if (this.config.onPostIterationGates) {
3808
3815
  try {
3809
3816
  const snapshot = await this.config.onPostIterationGates(this.ticketId, i);
@@ -3891,8 +3898,8 @@ var RalphLoop = class {
3891
3898
  }
3892
3899
  break;
3893
3900
  case "spinning":
3894
- gutterCount += 2;
3895
- log(`Stuck detection: spinning \u2014 gutter accelerated to ${String(gutterCount)}/${String(this.config.gutterThreshold)}`);
3901
+ gutterCount = gutterBeforeGates + 2;
3902
+ log(`Stuck detection: spinning \u2014 gutter set to ${String(gutterCount)}/${String(this.config.gutterThreshold)}`);
3896
3903
  break;
3897
3904
  case "blocked":
3898
3905
  log(`Stuck detection: blocked \u2014 exiting immediately`);
@@ -4057,4 +4064,4 @@ export {
4057
4064
  generateGateProxyMcpConfig,
4058
4065
  cleanupGateProxyConfigs
4059
4066
  };
4060
- //# sourceMappingURL=chunk-MTPUHYZV.js.map
4067
+ //# sourceMappingURL=chunk-KGS3M2MY.js.map