@feigi/fleet-ctl 3.30.15 → 3.30.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.30.15",
3
+ "version": "3.30.17",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -112,11 +112,13 @@ export function resolveMainCheckout(cwd = process.cwd(), env = process.env) {
112
112
 
113
113
  export const baselinePath = (root) => join(root, ".fleet", BASELINE_FILE);
114
114
 
115
- // A content hash of one path porcelain named, relative to the main checkout.
116
- // Gone is an answer (a deleted tracked file is a ` D` entry), and so is a
117
- // directory (an untracked nested repository is listed as `dir/`); anything
118
- // else that fails to read throws, and the caller's answer is `unknown`.
119
- function hashPath(root, rel) {
115
+ // A content hash of one path porcelain named, relative to `root`. Gone is an
116
+ // answer (a deleted tracked file is a ` D` entry); anything else that fails
117
+ // to read throws, and the caller's answer is `unknown`. A directory holding
118
+ // `.git` is a nested repository (an untracked one is listed as `dir/`, a
119
+ // submodule by its own path), hashed as `nestedHash` below; any other
120
+ // directory hashes as `dir`.
121
+ function hashPath(root, rel, env) {
120
122
  const abs = join(root, rel);
121
123
  let st;
122
124
  try {
@@ -125,13 +127,38 @@ function hashPath(root, rel) {
125
127
  if (e?.code === "ENOENT" || e?.code === "ENOTDIR") return "absent";
126
128
  throw e;
127
129
  }
128
- const sha = (buf) => createHash("sha256").update(buf).digest("hex");
129
130
  if (st.isSymbolicLink()) return `link:${sha(readlinkSync(abs))}`;
130
- if (st.isDirectory()) return "dir";
131
+ if (st.isDirectory()) {
132
+ try {
133
+ lstatSync(join(abs, ".git"));
134
+ } catch (e) {
135
+ if (e?.code === "ENOENT") return "dir";
136
+ throw e;
137
+ }
138
+ return nestedHash(abs, env);
139
+ }
131
140
  if (st.isFile()) return `sha256:${sha(readFileSync(abs))}`;
132
141
  return "other";
133
142
  }
134
143
 
144
+ const sha = (buf) => createHash("sha256").update(buf).digest("hex");
145
+
146
+ // A nested repository's own snapshot — its porcelain entries and the hash of
147
+ // every path they name, so a further edit to a file already dirty in it moves
148
+ // the hash where its status line would not — folded with its HEAD, so a
149
+ // commit in it moves the hash too. A commitless repository's HEAD is the
150
+ // branch it names. Nothing is left out: the run's bookkeeping is the main
151
+ // checkout's two paths, not a nested repository's. Any git that fails
152
+ // throws: `unknown`, never a hash that reads clean.
153
+ function nestedHash(abs, env) {
154
+ const now = entriesAt(abs, env, new Set());
155
+ if (!now.ok) throw new Error(now.why);
156
+ let head = git("git rev-parse HEAD", ["rev-parse", "-q", "--verify", "HEAD^{commit}"], abs, env);
157
+ if (!head.ok) head = git("git symbolic-ref HEAD", ["symbolic-ref", "-q", "HEAD"], abs, env);
158
+ if (!head.ok) throw new Error(head.why);
159
+ return `repo:${sha(`${head.stdout}${formatBaseline(now.entries)}`)}`;
160
+ }
161
+
135
162
  /**
136
163
  * The main checkout as it stands: `{ok, entries}` — a Map from each porcelain
137
164
  * entry (`XY path`) to its path's hash, the run's own bookkeeping left out
@@ -141,6 +168,11 @@ function hashPath(root, rel) {
141
168
  * `--no-renames` so every entry names exactly one path.
142
169
  */
143
170
  export function snapshot(root, env = process.env) {
171
+ return entriesAt(root, env, RUN_BOOKKEEPING);
172
+ }
173
+
174
+ // `snapshot` of the repository at `root`, leaving out the paths in `skip`.
175
+ function entriesAt(root, env, skip) {
144
176
  const r = git("git status --porcelain -uall", ["--no-optional-locks", "status", "--porcelain", "-uall", "-z", "--no-renames"], root, env);
145
177
  if (!r.ok) return r;
146
178
  const entries = new Map();
@@ -148,9 +180,9 @@ export function snapshot(root, env = process.env) {
148
180
  if (!line) continue;
149
181
  if (line.length < 4 || line[2] !== " ") return { ok: false, why: `git status printed an entry it does not document: ${JSON.stringify(line)}` };
150
182
  const rel = line.slice(3);
151
- if (RUN_BOOKKEEPING.has(rel)) continue;
183
+ if (skip.has(rel)) continue;
152
184
  try {
153
- entries.set(line, hashPath(root, rel));
185
+ entries.set(line, hashPath(root, rel, env));
154
186
  } catch (e) {
155
187
  return { ok: false, why: `cannot hash ${rel}: ${e?.code ?? e?.message ?? e}` };
156
188
  }
@@ -297,7 +297,14 @@ function createdPrNumbers(text) {
297
297
  // `resolvedModelIdentity` (measured `anthropic/claude-opus-5` (61),
298
298
  // `anthropic/claude-sonnet-5` (103), `anthropic/claude-haiku-4-5` (68)
299
299
  // across real `~/.omp/agent/sessions/**` — always provider-prefixed, never a
300
- // bare alias). `model` itself is left untouched by this addition: board.mjs
300
+ // bare alias). Current omp writes the same dispatch-time fact under
301
+ // `resolvedModel` instead (measured 2026-10-09 on omp 18.8.6: of the 300
302
+ // most recently written transcripts, the 299 with a `session_init` line all
303
+ // carried `resolvedModel`, e.g. `anthropic/claude-opus-5-5:high` with its
304
+ // level suffix, and none carried `resolvedModelIdentity`), so the fold takes
305
+ // `resolvedModel` when `resolvedModelIdentity` is absent and
306
+ // `resolvedModelIdentity` when a line carries both.
307
+ // `model` itself is left untouched by this addition: board.mjs
301
308
  // and member-outcomes.mjs read `model` for cost/spend attribution, where the
302
309
  // per-turn value (which can in principle change mid-run) is the fact they
303
310
  // want, not the dispatch-time identity.
@@ -375,6 +382,7 @@ export function foldOmpTranscript(jsonlText, filePath) {
375
382
  if (d.type === "session_init") {
376
383
  if (typeof d.task === "string") task = d.task;
377
384
  if (typeof d.resolvedModelIdentity === "string") resolvedModelIdentity = d.resolvedModelIdentity;
385
+ else if (typeof d.resolvedModel === "string") resolvedModelIdentity = d.resolvedModel;
378
386
  if (typeof d.agent === "string") agent = d.agent;
379
387
  }
380
388
  const m = d.message;
@@ -111,12 +111,13 @@ export function declaredPairFor(frontmatter) {
111
111
  // reported as `null` (a `null` reaching `formatMismatch` would print
112
112
  // `resolved .../null`, a lie about a field nobody asked was absent).
113
113
  //
114
- // The transcript-derived model prefers `resolvedModelIdentity`
115
- // (`session_init`, written at DISPATCH) over the assistant turn's own
116
- // `model`: the identity exists before the member's first turn, where the
117
- // per-turn model does not, so preferring it is what makes this check usable
118
- // immediately after a background dispatch rather than only once a member has
119
- // already produced output.
114
+ // The transcript-derived model prefers the fold's `resolvedModelIdentity`
115
+ // (`session_init`'s `resolvedModelIdentity`, or its `resolvedModel` where
116
+ // the line carries no identity — both written at DISPATCH) over the
117
+ // assistant turn's own `model`: the identity exists before the member's
118
+ // first turn, where the per-turn model does not, so preferring it is what
119
+ // makes this check usable immediately after a background dispatch rather
120
+ // than only once a member has already produced output.
120
121
  export function resolveActual({ transcriptText, resolvedModel, resolvedThinkingLevel }) {
121
122
  if (resolvedModel && resolvedThinkingLevel) {
122
123
  return { model: resolvedModel, level: resolvedThinkingLevel, viaJobRecord: true };