frizz 0.12.2 → 0.12.4

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/dev-child.js +61 -2
  2. package/package.json +1 -1
package/dist/dev-child.js CHANGED
@@ -16464,7 +16464,14 @@ function resolveProjectIdentity(dir, home = homedir5()) {
16464
16464
  return { id: ensureProjectIdFile(root, home, git2?.id), scope: git2?.scope ?? "repository", root };
16465
16465
  }
16466
16466
  function cwdSlug(absPath) {
16467
- return absPath.replace(/[/.]/g, "-");
16467
+ const slug = absPath.replace(/[^A-Za-z0-9]/g, "-");
16468
+ if (slug.length <= CWD_SLUG_MAX) return slug;
16469
+ return `${slug.slice(0, CWD_SLUG_MAX)}-${Math.abs(cwdSlugHash(absPath)).toString(36)}`;
16470
+ }
16471
+ function cwdSlugHash(absPath) {
16472
+ let hash = 0;
16473
+ for (let i = 0; i < absPath.length; i++) hash = (hash << 5) - hash + absPath.charCodeAt(i) | 0;
16474
+ return hash;
16468
16475
  }
16469
16476
  function registerAndReconcile(dir, id, home) {
16470
16477
  const remoteOwner = resolveProjectLabel(dir)?.split("/")[0];
@@ -16547,6 +16554,7 @@ function projectFromLaunchTarget(target, env = process.env) {
16547
16554
  ...target.identityScope === "worktree" ? { identityScope: "worktree" } : {}
16548
16555
  };
16549
16556
  }
16557
+ var CWD_SLUG_MAX;
16550
16558
  var init_project = __esm({
16551
16559
  "packages/server/src/project.ts"() {
16552
16560
  "use strict";
@@ -16557,6 +16565,7 @@ var init_project = __esm({
16557
16565
  init_project_identity();
16558
16566
  init_github();
16559
16567
  init_project_identity();
16568
+ CWD_SLUG_MAX = 200;
16560
16569
  }
16561
16570
  });
16562
16571
 
@@ -24753,8 +24762,44 @@ ${detail2}
24753
24762
  } catch {
24754
24763
  }
24755
24764
  }
24765
+ function relocatedTranscript(state) {
24766
+ const name = `${state.nativeSessionId}.jsonl`;
24767
+ const home = join18(logDir, name);
24768
+ const homeAt = home === state.path ? void 0 : mtimeOfNonEmpty(home);
24769
+ const dir = discoverTranscriptDir(logDir, state.nativeSessionId);
24770
+ const sibling = dir ? join18(dir, name) : void 0;
24771
+ const siblingAt = sibling && sibling !== state.path ? mtimeOfNonEmpty(sibling) : void 0;
24772
+ if (homeAt === void 0) return siblingAt === void 0 ? void 0 : sibling;
24773
+ if (siblingAt === void 0) return home;
24774
+ return siblingAt > homeAt ? sibling : home;
24775
+ }
24756
24776
  function resolveTranscript(state, row, nowMs) {
24757
- if (state.offset > 0) return true;
24777
+ if (state.offset > 0) {
24778
+ if (existsSync5(state.path)) {
24779
+ state.discoverMisses = 0;
24780
+ state.nextDiscoverMs = 0;
24781
+ return true;
24782
+ }
24783
+ if (nowMs < state.nextDiscoverMs) return true;
24784
+ const moved = relocatedTranscript(state);
24785
+ if (!moved) {
24786
+ state.discoverMisses++;
24787
+ state.nextDiscoverMs = nowMs + Math.min(
24788
+ DISCOVER_RETRY_MS * 2 ** (state.discoverMisses - 1),
24789
+ DISCOVER_RETRY_MAX_MS
24790
+ );
24791
+ return true;
24792
+ }
24793
+ state.path = moved;
24794
+ state.offset = 0;
24795
+ state.partial = "";
24796
+ state.primed = false;
24797
+ state.noTranscript = false;
24798
+ state.stallLogged = false;
24799
+ state.discoverMisses = 0;
24800
+ state.nextDiscoverMs = 0;
24801
+ return true;
24802
+ }
24758
24803
  let size = 0;
24759
24804
  try {
24760
24805
  size = statSync8(state.path).size;
@@ -24765,6 +24810,7 @@ ${detail2}
24765
24810
  state.noTranscript = false;
24766
24811
  state.stallLogged = false;
24767
24812
  state.discoverMisses = 0;
24813
+ state.nextDiscoverMs = 0;
24768
24814
  return true;
24769
24815
  }
24770
24816
  const spawnedMs = Date.parse(row.spawned_at);
@@ -24780,6 +24826,7 @@ ${detail2}
24780
24826
  state.noTranscript = false;
24781
24827
  state.stallLogged = false;
24782
24828
  state.discoverMisses = 0;
24829
+ state.nextDiscoverMs = 0;
24783
24830
  return true;
24784
24831
  }
24785
24832
  const found = discoverTranscriptId(logDir, row.session_id, { nowMs, exclude: claimedIds(row.slug) });
@@ -24803,6 +24850,7 @@ ${detail2}
24803
24850
  state.noTranscript = false;
24804
24851
  state.stallLogged = false;
24805
24852
  state.discoverMisses = 0;
24853
+ state.nextDiscoverMs = 0;
24806
24854
  return true;
24807
24855
  }
24808
24856
  state.discoverMisses++;
@@ -24884,6 +24932,7 @@ ${detail2}
24884
24932
  drainUnretiredOps(state, row);
24885
24933
  if (state.offset !== primeOffset) transcriptDirty.push(row.slug);
24886
24934
  state.turn = turnFor(row, state, nowMs);
24935
+ onPrimedAtRest(row, state);
24887
24936
  const pane2 = sniffPane(
24888
24937
  state,
24889
24938
  row,
@@ -25054,6 +25103,16 @@ ${detail2}
25054
25103
  body: state.lastAssistant
25055
25104
  });
25056
25105
  }
25106
+ function onPrimedAtRest(row, state) {
25107
+ if (state.turn !== "idle" || !state.sawRecords) return;
25108
+ const eventAt = state.lastAssistantAt;
25109
+ if (!eventAt) return;
25110
+ const at = Date.parse(eventAt);
25111
+ if (!Number.isFinite(at)) return;
25112
+ const stamped = row.rested_at ? Date.parse(row.rested_at) : NaN;
25113
+ if (Number.isFinite(stamped) && at <= stamped) return;
25114
+ deps.storage.setRestedAtIfCurrent(row.slug, row.session_id, row.runtime_generation ?? 0, eventAt);
25115
+ }
25057
25116
  function onPaneDeath(row) {
25058
25117
  const generation = row.runtime_generation ?? 0;
25059
25118
  const eventAt = new Date(now()).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frizz",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "private": false,
5
5
  "description": "A local web UI for running many coding agents at once",
6
6
  "keywords": [