@open-tomato/rafa 0.49.0 → 0.50.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.
@@ -13,10 +13,10 @@ import {
13
13
  openNdjsonStore,
14
14
  openSqliteStore,
15
15
  selectEffortStore
16
- } from "../../index-vfny3ryr.js";
16
+ } from "../../index-kcbs6fp9.js";
17
17
  import {
18
18
  TRUSTED_PERMISSIONS
19
- } from "../../index-thqpre1b.js";
19
+ } from "../../index-7rg3jbsz.js";
20
20
  import"../../index-2a7nb3an.js";
21
21
  import"../../index-m672ptpg.js";
22
22
  import {
@@ -220,7 +220,7 @@ var HINT_FLAG_SPEC = Object.freeze({
220
220
  });
221
221
  var DEFAULT_CI_TIMEOUT_MIN = 20;
222
222
  // package.json
223
- var version = "0.49.0";
223
+ var version = "0.50.0";
224
224
 
225
225
  // packages/rafa/src/core/command/version.ts
226
226
  var RAFA_VERSION = version;
@@ -8,7 +8,7 @@ import {
8
8
  createGitRunner,
9
9
  normalizeRemote,
10
10
  runningCommand
11
- } from "./index-thqpre1b.js";
11
+ } from "./index-7rg3jbsz.js";
12
12
  import {
13
13
  activeOutput,
14
14
  activeOutputMode,
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  normalizeRemote,
22
22
  setActiveStoreSettings
23
- } from "./index-thqpre1b.js";
23
+ } from "./index-7rg3jbsz.js";
24
24
  import {
25
25
  activeOutput,
26
26
  activeOutputMode
@@ -3847,6 +3847,7 @@ var NEVER_RETRIED = Object.freeze([
3847
3847
  var RETRIED = Object.freeze([
3848
3848
  /operation timed out|i\/o timeout|TLS handshake timeout/u,
3849
3849
  /connection reset|\bEOF\b/u,
3850
+ /unexpected end of JSON input/u,
3850
3851
  /\bHTTP 50[234]\b/u
3851
3852
  ]);
3852
3853
  var UNKNOWN_REASON = "unknown error";
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  withSqliteStore,
83
83
  writeNames,
84
84
  writeSqliteStore
85
- } from "./index-vfny3ryr.js";
85
+ } from "./index-kcbs6fp9.js";
86
86
  import {
87
87
  ACTION_SHAPE,
88
88
  CONFIG_DEFAULTS,
@@ -269,7 +269,7 @@ import {
269
269
  writeHopRecord,
270
270
  writePositionFile,
271
271
  writeRefsBlock
272
- } from "./index-j154qpbj.js";
272
+ } from "./index-q1tkqxnh.js";
273
273
  import {
274
274
  BLOCKER_GAP,
275
275
  PLAN_BLOCK_KINDS,
@@ -321,7 +321,7 @@ import {
321
321
  parseWorkingTree,
322
322
  registerAdapters,
323
323
  restoreAdapters
324
- } from "./index-thqpre1b.js";
324
+ } from "./index-7rg3jbsz.js";
325
325
  import {
326
326
  activeOutput,
327
327
  activeOutputMode,
@@ -8274,6 +8274,7 @@ function renderLessonsSection(lessons) {
8274
8274
  }
8275
8275
  // packages/rafa-inventory/src/task/select-lessons.ts
8276
8276
  var LESSON_LIMIT = 5;
8277
+ var TRIGGER_WORD_FLOOR = 2;
8277
8278
  function isArtifactPath(artifact) {
8278
8279
  return artifact !== "" && !/\s/.test(artifact) && /[/.]/.test(artifact);
8279
8280
  }
@@ -8308,7 +8309,7 @@ function triggerCandidate(lesson) {
8308
8309
  return { record, description: null, body: "" };
8309
8310
  }
8310
8311
  function triggerMatches(lesson, words) {
8311
- return words.length > 0 && scoreCandidate(triggerCandidate(lesson), words).score > RANK_FLOOR;
8312
+ return scoreCandidate(triggerCandidate(lesson), words).words.length >= TRIGGER_WORD_FLOOR;
8312
8313
  }
8313
8314
  function selectLessons(task, bundle) {
8314
8315
  const words = questionWords(task.text);
@@ -8316,7 +8317,9 @@ function selectLessons(task, bundle) {
8316
8317
  return [...kept].sort((a, b) => b.confidence - a.confidence).slice(0, LESSON_LIMIT);
8317
8318
  }
8318
8319
  // packages/rafa-effort/src/effort/skill-use.ts
8319
- var SKILL_USE_CLI_VERSION = "2.1.280";
8320
+ var SKILL_USE_CLI_FLOOR = "2.1.280";
8321
+ var SKILL_USE_FIXTURE_VERSION = "2.1.280";
8322
+ var CLI_VERSION_SHAPE = /^(\d+)\.(\d+)\.(\d+)$/u;
8320
8323
  var SKILL_TOOL = "Skill";
8321
8324
  var SUBAGENT_LOG_NAME = /^agent-.+\.jsonl$/;
8322
8325
  function asObject3(value) {
@@ -8335,14 +8338,35 @@ function subagentLogPaths(sessionLogPath) {
8335
8338
  return [];
8336
8339
  return readdirSync5(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && SUBAGENT_LOG_NAME.test(entry.name)).map((entry) => join21(dir, entry.name)).sort((a, b) => a.localeCompare(b));
8337
8340
  }
8338
- function applyVersion(tally, record, cliVersion) {
8341
+ function versionFields(version) {
8342
+ if (typeof version !== "string")
8343
+ return null;
8344
+ const match = CLI_VERSION_SHAPE.exec(version);
8345
+ return match === null ? null : match.slice(1).map(Number);
8346
+ }
8347
+ function compareCliVersions(a, b) {
8348
+ const left = versionFields(a);
8349
+ const right = versionFields(b);
8350
+ if (left === null || right === null) {
8351
+ if (left !== right) {
8352
+ return left === null ? -1 : 1;
8353
+ }
8354
+ return a.localeCompare(b);
8355
+ }
8356
+ const differing = left.findIndex((field3, index) => field3 !== right[index]);
8357
+ return differing === -1 ? 0 : (left[differing] ?? 0) - (right[differing] ?? 0);
8358
+ }
8359
+ function applyVersion(tally, record, floor) {
8339
8360
  const version = record["version"];
8340
8361
  if (version === undefined)
8341
8362
  return;
8342
- if (version === cliVersion)
8343
- tally.pinned += 1;
8344
- else
8345
- tally.mismatched += 1;
8363
+ const text = String(version);
8364
+ tally.versions.add(text);
8365
+ if (typeof version === "string" && compareCliVersions(version, floor) >= 0) {
8366
+ tally.atOrAbove += 1;
8367
+ } else {
8368
+ tally.belowFloor += 1;
8369
+ }
8346
8370
  }
8347
8371
  function applyCalls(tally, record, sidechain) {
8348
8372
  if (record["type"] !== "assistant")
@@ -8363,7 +8387,7 @@ function applyCalls(tally, record, sidechain) {
8363
8387
  tally.counts.set(key, (tally.counts.get(key) ?? 0) + 1);
8364
8388
  }
8365
8389
  }
8366
- async function applySource(tally, source, cliVersion) {
8390
+ async function applySource(tally, source, floor) {
8367
8391
  for await (const rawLine of source.lines) {
8368
8392
  const line = rawLine.trim();
8369
8393
  if (line.length === 0)
@@ -8373,7 +8397,7 @@ async function applySource(tally, source, cliVersion) {
8373
8397
  tally.unreadable += 1;
8374
8398
  continue;
8375
8399
  }
8376
- applyVersion(tally, record, cliVersion);
8400
+ applyVersion(tally, record, floor);
8377
8401
  applyCalls(tally, record, source.subagent || record["isSidechain"] === true);
8378
8402
  }
8379
8403
  }
@@ -8384,27 +8408,36 @@ function usesOf(counts) {
8384
8408
  });
8385
8409
  return uses.sort((a, b) => a.name.localeCompare(b.name) || Number(a.sidechain) - Number(b.sidechain));
8386
8410
  }
8387
- async function collectSkillUse(sessionId, sources, cliVersion = SKILL_USE_CLI_VERSION) {
8388
- const tally = { counts: new Map, mismatched: 0, pinned: 0, unreadable: 0 };
8411
+ async function collectSkillUse(sessionId, sources, floor = SKILL_USE_CLI_FLOOR) {
8412
+ if (versionFields(floor) === null)
8413
+ throw new TypeError(`skill-use floor ${JSON.stringify(floor)} is not an X.Y.Z version`);
8414
+ const tally = { counts: new Map, belowFloor: 0, atOrAbove: 0, versions: new Set, unreadable: 0 };
8389
8415
  for (const source of sources)
8390
- await applySource(tally, source, cliVersion);
8391
- if (tally.mismatched > 0 || tally.pinned === 0 || tally.unreadable > 0) {
8392
- return { sessionId, uses: UNKNOWN_SKILL_COUNT };
8416
+ await applySource(tally, source, floor);
8417
+ const versions = [...tally.versions].sort(compareCliVersions);
8418
+ if (tally.belowFloor > 0 || tally.atOrAbove === 0 || tally.unreadable > 0) {
8419
+ return { sessionId, uses: UNKNOWN_SKILL_COUNT, vouched: false, versions };
8393
8420
  }
8394
- return { sessionId, uses: usesOf(tally.counts) };
8421
+ const vouched = versions.length === 1 && versions[0] === SKILL_USE_FIXTURE_VERSION;
8422
+ return { sessionId, uses: usesOf(tally.counts), vouched, versions };
8395
8423
  }
8396
- async function readSkillUse(sessionLogPath, cliVersion = SKILL_USE_CLI_VERSION) {
8424
+ async function readSkillUse(sessionLogPath, floor = SKILL_USE_CLI_FLOOR) {
8397
8425
  const sources = [
8398
8426
  { lines: readLines(sessionLogPath), subagent: false },
8399
8427
  ...subagentLogPaths(sessionLogPath).map((path2) => ({ lines: readLines(path2), subagent: true }))
8400
8428
  ];
8401
- return collectSkillUse(sessionIdFromPath(sessionLogPath), sources, cliVersion);
8429
+ return collectSkillUse(sessionIdFromPath(sessionLogPath), sources, floor);
8402
8430
  }
8403
8431
 
8404
8432
  // packages/rafa-effort/src/effort/collect-skills.ts
8405
8433
  function messageOf3(error) {
8406
8434
  return error instanceof Error ? error.message : String(error);
8407
8435
  }
8436
+ function readingNote(reading) {
8437
+ const versions = reading.versions.length === 0 ? "no version" : reading.versions.join(", ");
8438
+ const standing = reading.uses === UNKNOWN_SKILL_COUNT ? "unknown" : reading.vouched ? "vouched" : "unvouched";
8439
+ return `skills: read ${reading.sessionId} (${versions}, ${standing})`;
8440
+ }
8408
8441
  function countedSessions(repoRoot) {
8409
8442
  return new Set(readSkillInvocations(repoRoot).map((row) => row.sessionId));
8410
8443
  }
@@ -8415,8 +8448,9 @@ async function collectSkillHalf(input) {
8415
8448
  let failed2 = 0;
8416
8449
  for (const log of pending) {
8417
8450
  try {
8418
- readings.push(await readSkillUse(log.path));
8419
- input.note(`skills: read ${log.sessionId}`);
8451
+ const reading = await readSkillUse(log.path);
8452
+ readings.push(reading);
8453
+ input.note(readingNote(reading));
8420
8454
  } catch (error) {
8421
8455
  failed2 += 1;
8422
8456
  input.log(`skills: FAILED ${log.path}: ${messageOf3(error)}`);
@@ -8429,6 +8463,7 @@ async function collectSkillHalf(input) {
8429
8463
  candidates: input.logs.length,
8430
8464
  alreadyCounted: input.logs.length - pending.length,
8431
8465
  read: readings.length,
8466
+ unvouched: readings.filter((reading) => reading.uses !== UNKNOWN_SKILL_COUNT && !reading.vouched).length,
8432
8467
  unknown: readings.filter((reading) => reading.uses === UNKNOWN_SKILL_COUNT).length,
8433
8468
  failed: failed2,
8434
8469
  appended: written.appended,
@@ -8439,7 +8474,7 @@ function formatSkillSummary(skills) {
8439
8474
  if (skills === null)
8440
8475
  return " skills skipped (--no-sessions)";
8441
8476
  const scope = skills.scope === "held" ? "stored" : "appended";
8442
- return ` skills ${skills.candidates} ${scope} sessions` + `, ${skills.alreadyCounted} already counted` + `, ${skills.read} read` + `, ${skills.unknown} unknown` + `, ${skills.failed} failed` + `, +${skills.appended} rows`;
8477
+ return ` skills ${skills.candidates} ${scope} sessions` + `, ${skills.alreadyCounted} already counted` + `, ${skills.read} read` + `, ${skills.unvouched} unvouched` + `, ${skills.unknown} unknown` + `, ${skills.failed} failed` + `, +${skills.appended} rows`;
8443
8478
  }
8444
8479
 
8445
8480
  // packages/rafa-effort/src/effort/commits.ts
@@ -28673,7 +28708,7 @@ function createPlanBlockedOffer(seams = DEFAULT_BLOCKED_SEAMS) {
28673
28708
 
28674
28709
  // src/commands/plan/ready-offer.ts
28675
28710
  var runIssueReadyLazily = async (options) => {
28676
- const { runIssueReady: run } = await import("./ready-mh5wdzq5.js");
28711
+ const { runIssueReady: run } = await import("./ready-stwsr9ws.js");
28677
28712
  return run(options);
28678
28713
  };
28679
28714
  var DEFAULT_OFFER_SEAMS = Object.freeze({});
@@ -24,14 +24,14 @@ import {
24
24
  requireCompleteSpec,
25
25
  requireTrustedBoardAuthor,
26
26
  typeOfLabels
27
- } from "./index-j154qpbj.js";
27
+ } from "./index-q1tkqxnh.js";
28
28
  import"./index-ajv88fkm.js";
29
29
  import {
30
30
  CommandExit,
31
31
  createGitRunner,
32
32
  createLinePrompter,
33
33
  lazyPrompter
34
- } from "./index-thqpre1b.js";
34
+ } from "./index-7rg3jbsz.js";
35
35
  import"./index-2a7nb3an.js";
36
36
  import"./index-g91ys6kw.js";
37
37
  import"./index-m672ptpg.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tomato/rafa",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Alpha. Runs a plan through the ralph loop: one Claude Code session per task, one commit per task, then a pull request and a CI wait.",
5
5
  "private": false,
6
6
  "publishConfig": {