@dadado/agent-kit-cli 5.12.3 → 5.13.0

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/index.js +32 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7032,7 +7032,8 @@ var HANDOFF_MACHINE_FIELDS = /* @__PURE__ */ new Set([
7032
7032
  "Parked plans",
7033
7033
  "Run queue",
7034
7034
  "Queue cursor",
7035
- "Queue status"
7035
+ "Queue status",
7036
+ "Queue outcomes"
7036
7037
  ]);
7037
7038
  var FIELD_BULLET = /^- \*\*([^*\n]+?):\*\*/;
7038
7039
  function byteLength(s) {
@@ -7056,6 +7057,31 @@ function classify(lines) {
7056
7057
  }
7057
7058
  return entries;
7058
7059
  }
7060
+ function selectByFieldPriority(entries, maxLines) {
7061
+ if (entries.length <= maxLines) return entries;
7062
+ const mustKeep = /* @__PURE__ */ new Set();
7063
+ for (let i = 0; i < entries.length; i++) {
7064
+ const e = entries[i];
7065
+ if (!e) continue;
7066
+ if (e.kind === "machine") mustKeep.add(i);
7067
+ }
7068
+ if (entries[0] && /^#\s/.test(entries[0].text)) mustKeep.add(0);
7069
+ const selected = new Set(mustKeep);
7070
+ for (let i = 0; i < entries.length && selected.size < maxLines; i++) {
7071
+ selected.add(i);
7072
+ }
7073
+ if (mustKeep.size > maxLines) {
7074
+ const ordered = [...mustKeep].sort((a, b) => a - b).slice(0, maxLines);
7075
+ return ordered.flatMap((i) => {
7076
+ const e = entries[i];
7077
+ return e ? [e] : [];
7078
+ });
7079
+ }
7080
+ return [...selected].sort((a, b) => a - b).flatMap((i) => {
7081
+ const e = entries[i];
7082
+ return e ? [e] : [];
7083
+ });
7084
+ }
7059
7085
  function truncateToBytes(text, maxBytes) {
7060
7086
  let used = 0;
7061
7087
  let kept = "";
@@ -7096,8 +7122,8 @@ function capHandoffExcerpt(content, options = {}) {
7096
7122
  const maxLines = options.maxLines ?? HANDOFF_EXCERPT_MAX_LINES;
7097
7123
  const maxBytes = options.maxBytes ?? HANDOFF_EXCERPT_MAX_BYTES;
7098
7124
  const floor = options.proseLineMinBytes ?? HANDOFF_PROSE_LINE_MIN_BYTES;
7099
- const lines = content.split(/\r?\n/).slice(0, maxLines);
7100
- const entries = classify(lines);
7125
+ const allEntries = classify(content.split(/\r?\n/));
7126
+ const entries = selectByFieldPriority(allEntries, maxLines);
7101
7127
  const join2 = (items) => items.map((e) => e.text).join("\n").trim();
7102
7128
  const untouched = join2(entries);
7103
7129
  const untouchedBytes = byteLength(untouched);
@@ -7105,7 +7131,7 @@ function capHandoffExcerpt(content, options = {}) {
7105
7131
  return {
7106
7132
  text: untouched,
7107
7133
  bytes: untouchedBytes,
7108
- lines: lines.length,
7134
+ lines: entries.length,
7109
7135
  truncatedLines: 0,
7110
7136
  droppedLines: 0
7111
7137
  };
@@ -7140,10 +7166,10 @@ function capHandoffExcerpt(content, options = {}) {
7140
7166
  const remaining = shaped.filter((_, i) => keep.has(i));
7141
7167
  remaining.push({ text: droppedMarker(droppedLines), kind: "structural", bytes: 0 });
7142
7168
  const text2 = join2(remaining);
7143
- return { text: text2, bytes: byteLength(text2), lines: lines.length, truncatedLines, droppedLines };
7169
+ return { text: text2, bytes: byteLength(text2), lines: entries.length, truncatedLines, droppedLines };
7144
7170
  }
7145
7171
  const text = join2(shaped);
7146
- return { text, bytes: byteLength(text), lines: lines.length, truncatedLines, droppedLines };
7172
+ return { text, bytes: byteLength(text), lines: entries.length, truncatedLines, droppedLines };
7147
7173
  }
7148
7174
 
7149
7175
  // src/hooks/hard-rules.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dadado/agent-kit-cli",
3
- "version": "5.12.3",
3
+ "version": "5.13.0",
4
4
  "description": "Agent Kit CLI: HITL framework install and tooling for AI-assisted IDEs (rules, skills, plan/handoff, context).",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "type": "module",