pi-straw-boss 0.123.1 → 0.124.1

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 (45) hide show
  1. package/dist/server/{chunk-Y6GSLB2H.mjs → chunk-6URQ7VES.mjs} +71 -58
  2. package/dist/server/cli.mjs +1 -1
  3. package/dist/server/main.mjs +1159 -800
  4. package/package.json +1 -1
  5. package/prompts/main.md +1 -1
  6. package/prompts/planning.md +1 -1
  7. package/prompts/tower-run.md +1 -1
  8. package/prompts/tower.md +1 -1
  9. package/skills/pi-straw-boss-subagents/SKILL.md +3 -0
  10. package/src/boardread.ts +8 -1
  11. package/src/boss.ts +2 -2
  12. package/src/bridge.ts +10 -2
  13. package/src/control.ts +9 -8
  14. package/src/gui.ts +3 -3
  15. package/src/header.ts +8 -5
  16. package/src/herdr.ts +1 -0
  17. package/src/host/engine.ts +1 -0
  18. package/src/host/surface.ts +47 -5
  19. package/src/index.ts +9 -3
  20. package/src/link/waitcall.ts +13 -4
  21. package/src/moments.ts +3 -1
  22. package/src/opener.ts +12 -3
  23. package/src/owed.ts +136 -0
  24. package/src/reach.ts +5 -4
  25. package/src/reviver.ts +4 -0
  26. package/src/runallow.ts +1 -1
  27. package/src/runmode.ts +3 -3
  28. package/src/server/guihost.ts +2 -2
  29. package/src/server/ledger.ts +1 -1
  30. package/src/server/runtools.ts +13 -6
  31. package/src/server/topicroute.ts +36 -0
  32. package/src/server/towerbrief.ts +9 -5
  33. package/src/server/towergate.ts +17 -0
  34. package/src/spawn.ts +4 -3
  35. package/src/tools.ts +13 -5
  36. package/src/topic.ts +249 -0
  37. package/src/topicgate.ts +295 -0
  38. package/src/topicinput.ts +84 -0
  39. package/src/topicmain.ts +103 -0
  40. package/src/topicpending.ts +45 -0
  41. package/src/topictower.ts +68 -0
  42. package/src/waitask.ts +34 -11
  43. package/src/waitcmd.ts +24 -11
  44. package/src/waitpick.ts +41 -0
  45. package/src/waitquestion.ts +95 -0
@@ -253,6 +253,7 @@ var callOnce = (socketPath) => (method, params, timeoutMs = 5e3) => new Promise(
253
253
  try {
254
254
  const { result: result2, error } = JSON.parse(reply.split("\n")[0]);
255
255
  if (error) fail(error.code ?? "herdr_error", error.message ?? "");
256
+ else if (result2 === void 0) fail("bad_frame", "reply has no result");
256
257
  else resolve5(result2);
257
258
  } catch {
258
259
  fail("bad_frame", reply.slice(0, 200));
@@ -7355,9 +7356,19 @@ var BOARD = { now: 120, item: 80, items: 8, label: 40 };
7355
7356
  var ENDED_MS = 30 * 6e4;
7356
7357
  var DEAD_MS = 24 * 36e5;
7357
7358
  var STALE_MS3 = 2 * 36e5;
7359
+ var BAD = /[\p{Cc}\p{Cf}]/u;
7358
7360
  var BAD_ALL = /[\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/gu;
7359
7361
  var SAFE_SESSION = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
7360
7362
  var fold = (text4) => text4.replace(/\s+/gu, " ").trim();
7363
+ function checkText(what, text4, max) {
7364
+ if (typeof text4 !== "string") throw new Error(`${what} has to be text`);
7365
+ const folded = fold(text4);
7366
+ if (BAD.test(folded)) throw new Error(`${what} may not hold control or format characters (escapes, bidi overrides, zero-width marks)`);
7367
+ if (!folded) throw new Error(`${what} is empty`);
7368
+ const length = Array.from(folded).length;
7369
+ if (length > max) throw new Error(`${what} has ${length} characters; at most ${max} fit`);
7370
+ return folded;
7371
+ }
7361
7372
  function clean(text4, max) {
7362
7373
  if (typeof text4 !== "string") return "";
7363
7374
  const out = fold(text4.replace(/\s+/gu, " ").replace(BAD_ALL, ""));
@@ -7480,6 +7491,61 @@ function joinLocal(entries2, mains, now, o = {}) {
7480
7491
  return [...live, ...gone];
7481
7492
  }
7482
7493
 
7494
+ // src/procs/worktree.ts
7495
+ import { readFileSync as readFileSync25, realpathSync as realpathSync5, statSync as statSync14 } from "node:fs";
7496
+ import { basename as basename9, dirname as dirname14, join as join28, relative as relative3, isAbsolute as isAbsolute2, resolve as resolve4 } from "node:path";
7497
+ var realDisk = {
7498
+ kind: (path) => {
7499
+ try {
7500
+ return statSync14(path).isDirectory() ? "dir" : "file";
7501
+ } catch {
7502
+ return void 0;
7503
+ }
7504
+ },
7505
+ read: (path) => {
7506
+ try {
7507
+ return readFileSync25(path, "utf8");
7508
+ } catch {
7509
+ return void 0;
7510
+ }
7511
+ }
7512
+ };
7513
+ function physical(path) {
7514
+ const abs = resolve4(path), tail = [];
7515
+ for (let dir = abs; ; dir = dirname14(dir)) {
7516
+ try {
7517
+ return join28(realpathSync5.native(dir), ...tail.reverse());
7518
+ } catch {
7519
+ if (dirname14(dir) === dir) return abs;
7520
+ tail.push(basename9(dir));
7521
+ }
7522
+ }
7523
+ }
7524
+ function checkoutOf(cwd, disk = realDisk, real3 = physical) {
7525
+ for (let dir = real3(cwd); ; dir = dirname14(dir)) {
7526
+ const git = join28(dir, ".git"), kind = disk.kind(git);
7527
+ if (kind === "dir") return { kind: "main", root: dir };
7528
+ if (kind === "file") {
7529
+ const gitdir = /^gitdir:\s*(.+?)\s*$/m.exec(disk.read(git) ?? "")?.[1];
7530
+ if (gitdir && /[\\/]worktrees[\\/][^\\/]+[\\/]?$/.test(gitdir)) {
7531
+ const admin = resolve4(dir, gitdir), back = disk.read(join28(admin, "gitdir"))?.trim();
7532
+ if (disk.kind(admin) === "dir" && back && real3(resolve4(admin, back)) === join28(dir, ".git")) return { kind: "linked", root: dir, gitdir };
7533
+ return { kind: "none" };
7534
+ }
7535
+ if (gitdir && /[\\/]modules[\\/]/.test(gitdir)) return { kind: "submodule", root: dir };
7536
+ return { kind: "none" };
7537
+ }
7538
+ if (dirname14(dir) === dir) return { kind: "none" };
7539
+ }
7540
+ }
7541
+ function under(path, root) {
7542
+ const rel = relative3(resolve4(root), resolve4(path));
7543
+ return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
7544
+ }
7545
+ function rootOfRemoved(path, roots) {
7546
+ return roots.filter((root) => under(path, root)).sort((a, b) => b.length - a.length)[0];
7547
+ }
7548
+
7483
7549
  // src/server/operateroles.ts
7484
7550
  var UNIT_ROLES = ["main", "member", "train", "subagent", "outside", "tower", "ally", "run", "head"];
7485
7551
  var isHeadKey = (key2) => /^sb-head(-[0-9a-f]{8})?$/.test(key2);
@@ -7995,61 +8061,6 @@ function sanitizeReply(kind, status, body, rw) {
7995
8061
  return out === void 0 ? { ok: false, why: "shape" } : { ok: true, status, body: out };
7996
8062
  }
7997
8063
 
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
8064
  // src/procs/killset.ts
8054
8065
  var overlaps = (a, b) => under(a, b) || under(b, a);
8055
8066
  function killSet({ owner, live, table, places, markers, protect, reapers, self, held: held2 = [], ownUid, children = "all" }) {
@@ -8761,6 +8772,7 @@ export {
8761
8772
  graphOf,
8762
8773
  BOARD,
8763
8774
  STALE_MS3 as STALE_MS,
8775
+ checkText,
8764
8776
  clean,
8765
8777
  cleanText,
8766
8778
  safeSession,
@@ -9031,6 +9043,10 @@ export {
9031
9043
  packageRoot,
9032
9044
  VERSION,
9033
9045
  serverCli,
9046
+ realDisk,
9047
+ physical,
9048
+ checkoutOf,
9049
+ under,
9034
9050
  MAIN_CAP_HINT,
9035
9051
  SNOOZE_HINT,
9036
9052
  ACT_ON_IT,
@@ -9119,9 +9135,6 @@ export {
9119
9135
  reviveHandoff,
9120
9136
  pruneState,
9121
9137
  startPrune,
9122
- physical,
9123
- checkoutOf,
9124
- under,
9125
9138
  killSet,
9126
9139
  ProcsRefusal,
9127
9140
  createProcs,
@@ -120,7 +120,7 @@ import {
120
120
  writeEnd,
121
121
  writeJson,
122
122
  writerAlive
123
- } from "./chunk-Y6GSLB2H.mjs";
123
+ } from "./chunk-6URQ7VES.mjs";
124
124
 
125
125
  // src/server/cli.ts
126
126
  import { existsSync as existsSync3, realpathSync as realpathSync4 } from "node:fs";