pi-straw-boss 0.123.1 → 0.124.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.
@@ -7355,9 +7355,19 @@ var BOARD = { now: 120, item: 80, items: 8, label: 40 };
7355
7355
  var ENDED_MS = 30 * 6e4;
7356
7356
  var DEAD_MS = 24 * 36e5;
7357
7357
  var STALE_MS3 = 2 * 36e5;
7358
+ var BAD = /[\p{Cc}\p{Cf}]/u;
7358
7359
  var BAD_ALL = /[\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/gu;
7359
7360
  var SAFE_SESSION = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
7360
7361
  var fold = (text4) => text4.replace(/\s+/gu, " ").trim();
7362
+ function checkText(what, text4, max) {
7363
+ if (typeof text4 !== "string") throw new Error(`${what} has to be text`);
7364
+ const folded = fold(text4);
7365
+ if (BAD.test(folded)) throw new Error(`${what} may not hold control or format characters (escapes, bidi overrides, zero-width marks)`);
7366
+ if (!folded) throw new Error(`${what} is empty`);
7367
+ const length = Array.from(folded).length;
7368
+ if (length > max) throw new Error(`${what} has ${length} characters; at most ${max} fit`);
7369
+ return folded;
7370
+ }
7361
7371
  function clean(text4, max) {
7362
7372
  if (typeof text4 !== "string") return "";
7363
7373
  const out = fold(text4.replace(/\s+/gu, " ").replace(BAD_ALL, ""));
@@ -7480,6 +7490,61 @@ function joinLocal(entries2, mains, now, o = {}) {
7480
7490
  return [...live, ...gone];
7481
7491
  }
7482
7492
 
7493
+ // src/procs/worktree.ts
7494
+ import { readFileSync as readFileSync25, realpathSync as realpathSync5, statSync as statSync14 } from "node:fs";
7495
+ import { basename as basename9, dirname as dirname14, join as join28, relative as relative3, isAbsolute as isAbsolute2, resolve as resolve4 } from "node:path";
7496
+ var realDisk = {
7497
+ kind: (path) => {
7498
+ try {
7499
+ return statSync14(path).isDirectory() ? "dir" : "file";
7500
+ } catch {
7501
+ return void 0;
7502
+ }
7503
+ },
7504
+ read: (path) => {
7505
+ try {
7506
+ return readFileSync25(path, "utf8");
7507
+ } catch {
7508
+ return void 0;
7509
+ }
7510
+ }
7511
+ };
7512
+ function physical(path) {
7513
+ const abs = resolve4(path), tail = [];
7514
+ for (let dir = abs; ; dir = dirname14(dir)) {
7515
+ try {
7516
+ return join28(realpathSync5.native(dir), ...tail.reverse());
7517
+ } catch {
7518
+ if (dirname14(dir) === dir) return abs;
7519
+ tail.push(basename9(dir));
7520
+ }
7521
+ }
7522
+ }
7523
+ function checkoutOf(cwd, disk = realDisk, real3 = physical) {
7524
+ for (let dir = real3(cwd); ; dir = dirname14(dir)) {
7525
+ const git = join28(dir, ".git"), kind = disk.kind(git);
7526
+ if (kind === "dir") return { kind: "main", root: dir };
7527
+ if (kind === "file") {
7528
+ const gitdir = /^gitdir:\s*(.+?)\s*$/m.exec(disk.read(git) ?? "")?.[1];
7529
+ if (gitdir && /[\\/]worktrees[\\/][^\\/]+[\\/]?$/.test(gitdir)) {
7530
+ const admin = resolve4(dir, gitdir), back = disk.read(join28(admin, "gitdir"))?.trim();
7531
+ if (disk.kind(admin) === "dir" && back && real3(resolve4(admin, back)) === join28(dir, ".git")) return { kind: "linked", root: dir, gitdir };
7532
+ return { kind: "none" };
7533
+ }
7534
+ if (gitdir && /[\\/]modules[\\/]/.test(gitdir)) return { kind: "submodule", root: dir };
7535
+ return { kind: "none" };
7536
+ }
7537
+ if (dirname14(dir) === dir) return { kind: "none" };
7538
+ }
7539
+ }
7540
+ function under(path, root) {
7541
+ const rel = relative3(resolve4(root), resolve4(path));
7542
+ return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
7543
+ }
7544
+ function rootOfRemoved(path, roots) {
7545
+ return roots.filter((root) => under(path, root)).sort((a, b) => b.length - a.length)[0];
7546
+ }
7547
+
7483
7548
  // src/server/operateroles.ts
7484
7549
  var UNIT_ROLES = ["main", "member", "train", "subagent", "outside", "tower", "ally", "run", "head"];
7485
7550
  var isHeadKey = (key2) => /^sb-head(-[0-9a-f]{8})?$/.test(key2);
@@ -7995,61 +8060,6 @@ function sanitizeReply(kind, status, body, rw) {
7995
8060
  return out === void 0 ? { ok: false, why: "shape" } : { ok: true, status, body: out };
7996
8061
  }
7997
8062
 
7998
- // src/procs/worktree.ts
7999
- import { readFileSync as readFileSync25, realpathSync as realpathSync5, statSync as statSync14 } from "node:fs";
8000
- import { basename as basename9, dirname as dirname14, join as join28, relative as relative3, isAbsolute as isAbsolute2, resolve as resolve4 } from "node:path";
8001
- var realDisk = {
8002
- kind: (path) => {
8003
- try {
8004
- return statSync14(path).isDirectory() ? "dir" : "file";
8005
- } catch {
8006
- return void 0;
8007
- }
8008
- },
8009
- read: (path) => {
8010
- try {
8011
- return readFileSync25(path, "utf8");
8012
- } catch {
8013
- return void 0;
8014
- }
8015
- }
8016
- };
8017
- function physical(path) {
8018
- const abs = resolve4(path), tail = [];
8019
- for (let dir = abs; ; dir = dirname14(dir)) {
8020
- try {
8021
- return join28(realpathSync5.native(dir), ...tail.reverse());
8022
- } catch {
8023
- if (dirname14(dir) === dir) return abs;
8024
- tail.push(basename9(dir));
8025
- }
8026
- }
8027
- }
8028
- function checkoutOf(cwd, disk = realDisk, real3 = physical) {
8029
- for (let dir = real3(cwd); ; dir = dirname14(dir)) {
8030
- const git = join28(dir, ".git"), kind = disk.kind(git);
8031
- if (kind === "dir") return { kind: "main", root: dir };
8032
- if (kind === "file") {
8033
- const gitdir = /^gitdir:\s*(.+?)\s*$/m.exec(disk.read(git) ?? "")?.[1];
8034
- if (gitdir && /[\\/]worktrees[\\/][^\\/]+[\\/]?$/.test(gitdir)) {
8035
- const admin = resolve4(dir, gitdir), back = disk.read(join28(admin, "gitdir"))?.trim();
8036
- if (disk.kind(admin) === "dir" && back && real3(resolve4(admin, back)) === join28(dir, ".git")) return { kind: "linked", root: dir, gitdir };
8037
- return { kind: "none" };
8038
- }
8039
- if (gitdir && /[\\/]modules[\\/]/.test(gitdir)) return { kind: "submodule", root: dir };
8040
- return { kind: "none" };
8041
- }
8042
- if (dirname14(dir) === dir) return { kind: "none" };
8043
- }
8044
- }
8045
- function under(path, root) {
8046
- const rel = relative3(resolve4(root), resolve4(path));
8047
- return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
8048
- }
8049
- function rootOfRemoved(path, roots) {
8050
- return roots.filter((root) => under(path, root)).sort((a, b) => b.length - a.length)[0];
8051
- }
8052
-
8053
8063
  // src/procs/killset.ts
8054
8064
  var overlaps = (a, b) => under(a, b) || under(b, a);
8055
8065
  function killSet({ owner, live, table, places, markers, protect, reapers, self, held: held2 = [], ownUid, children = "all" }) {
@@ -8761,6 +8771,7 @@ export {
8761
8771
  graphOf,
8762
8772
  BOARD,
8763
8773
  STALE_MS3 as STALE_MS,
8774
+ checkText,
8764
8775
  clean,
8765
8776
  cleanText,
8766
8777
  safeSession,
@@ -9031,6 +9042,10 @@ export {
9031
9042
  packageRoot,
9032
9043
  VERSION,
9033
9044
  serverCli,
9045
+ realDisk,
9046
+ physical,
9047
+ checkoutOf,
9048
+ under,
9034
9049
  MAIN_CAP_HINT,
9035
9050
  SNOOZE_HINT,
9036
9051
  ACT_ON_IT,
@@ -9119,9 +9134,6 @@ export {
9119
9134
  reviveHandoff,
9120
9135
  pruneState,
9121
9136
  startPrune,
9122
- physical,
9123
- checkoutOf,
9124
- under,
9125
9137
  killSet,
9126
9138
  ProcsRefusal,
9127
9139
  createProcs,
@@ -120,7 +120,7 @@ import {
120
120
  writeEnd,
121
121
  writeJson,
122
122
  writerAlive
123
- } from "./chunk-Y6GSLB2H.mjs";
123
+ } from "./chunk-2LYIU476.mjs";
124
124
 
125
125
  // src/server/cli.ts
126
126
  import { existsSync as existsSync3, realpathSync as realpathSync4 } from "node:fs";