pi-dev-flow 0.85.0 → 0.85.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.85.1] - 2026-11-08
8
+
9
+ **dev-flow's bash timeout says so when it kills a command, and a command's own `timeout N` sets the cap.**
10
+
11
+ ### Fixed
12
+ - **A command's own `timeout N` sets its cap.** `timeout 600 bun test` used to get the 120s default class, because `timeout` was read as the command, so dev-flow would kill a long test run at two minutes even though the agent had asked for ten. A `timeout`/`gtimeout` wrapper now gives N + 15s, so the shell's own timer fires first. Option forms such as `-k 5` and `-s KILL` and `s`/`m`/`h` suffixes are understood, and an unreadable N falls back to the wrapped command's class.
13
+ - **dev-flow loads outside pi on pi 1.5.0.** The extension imported TypeBox's `Type` from `@earendil-works/pi-ai`, which the published 1.5.0 package no longer exports; only pi's own loader still provided it. It now imports from `typebox`, which is declared as a peer dependency, and the tests run against pi 1.5.0, the version pi-web runs.
14
+
15
+ ### Changed
16
+ - **dev-flow's silent bash timeout says so when it kills a command.** The timeout dev-flow arms on a call that states none never appears in the transcript or pi-web's tool card, so since 0.73.0 it looked as if no timeout was being set. It was: an end-to-end run under pi 1.5.0 killed a 60s command at 30s. Now a kill by that default appends `[dev-flow] stopped at <N>s: dev-flow's default for <class> commands…` to the result, and the always-on ground rules tell the agent the default exists and how to ask for longer. A new end-to-end test drives a real pi session to prove the kill happens.
17
+
7
18
  ## [0.85.0] - 2026-11-08
8
19
 
9
20
  **`flow verify` deploys for review without a dialog, catches up with main first, and asks before taking another flow's dev port.**
@@ -14,7 +14,7 @@ While a feature is active, the extension intercepts every tool call:
14
14
  - **Your project's own rules**: every `deny`/`confirm`/`protect`/`forbid` rule from the `flow-guard` block in project.md `## global` runs on every bash command and every edit/write path — in every stage and binding, ahead of dev-flow's own verdicts. A block always carries the reason you wrote.
15
15
  - **The rules reach the agent, they are not left in a file it may never read**: pi advertises a skill and loads it only if the model chooses to, so the ground rules of the dev-flow skill are injected into every session once (and again after a compaction that summarized them away), and each stage's turn names the one playbook file that stage needs. The guards enforce the same discipline either way — this is what makes the agent follow it without being stuck.
16
16
  - **A forced push asks the operator**: `git push` carrying `--force`, `--force-with-lease…` or `-f` is confirmed before it runs — a rewritten branch is history CI and other sessions already have. The one spelling that answers for it is the prefix the refusal prints (`DEV_FLOW_ALLOW_REWRITE=1 git push -f …`), the same "the operator said so" contract as `DEV_FLOW_ALLOW_MAIN`. Local history rewrites (`git filter-branch --force`) are not pushes and stay free, so a project never needs a blunt flag-only deny of its own.
17
- - **Shell calls can't hang forever**: pi kills a shell command only when the model passed a `timeout` — it omits one in ~75% of calls, so a `gh` waiting on a prompt or a dead `curl` froze sessions for hours. In an initiated repo (`.dev-flow/project.md` exists) every shell call without one therefore gets the class default armed silently (30s quick inspection · 120s local git and unknown · 180s network · 300s containers/services · 900s builds/tests/installs · 1,200s watchers like `gh run watch`), and absurd explicit values clamp to 1,800s. A project that wants the timeout visible on every call line sets `bashTimeout = require` in `## global` — then a call without one is refused, naming the value it would have armed (each refusal costs a turn, which is why it is no longer the default). Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
17
+ - **Shell calls can't hang forever**: pi kills a shell command only when the model passed a `timeout` — it omits one in ~75% of calls, so a `gh` waiting on a prompt or a dead `curl` froze sessions for hours. In an initiated repo (`.dev-flow/project.md` exists) every shell call without one therefore gets the class default armed silently (30s quick inspection · 120s local git and unknown · 180s network · 300s containers/services · 900s builds/tests/installs · 1,200s watchers like `gh run watch`), and absurd explicit values clamp to 1,800s. A command that carries its own `timeout N` (coreutils, any option form, `s`/`m`/`h` suffixes) gets N + 15s, so its own timer fires first; an unreadable N falls back to the wrapped command's class. The armed value is **invisible in the call's arguments**: the transcript and pi-web's tool card show what the model wrote, and dev-flow sets the timeout after that. So when it is dev-flow's default that kills a command, the result gets a line saying so (`[dev-flow] stopped at 30s: dev-flow's default for quick commands, armed because the call stated no timeout…`), and the session's injected ground rules tell the agent the default exists. `test/e2e-timeout.test.ts` proves the kill end to end through a real pi session, so a host release that stopped honouring the hook would fail the suite. A project that wants the timeout visible on every call line sets `bashTimeout = require` in `## global` — then a call without one is refused, naming the value it would have armed (each refusal costs a turn, which is why it is no longer the default). Uninitiated folders hear nothing at all: without the playbook dev-flow enforces no rules.
18
18
  - **Compact-aware**: dev-flow paces compaction the way pi counts it: the self-compaction trigger uses the *effective* `reserveTokens` (settings and per-model overrides, not the built-in default) and is checked at every turn end, not only when a run settles. When pi force-compacts on its threshold anyway — the chat-only states (open tier-2 dialog, plan discussion not yet in `plan/`) refuse to self-compact by design — dev-flow takes the compaction over and redoes it with flow-aware summary instructions (overflow recovery keeps pi's compact-and-retry and is left alone). Auto-compaction turned off in settings is honored.
19
19
  - The active stage is injected into the model's context every turn; the bundled `dev-flow` skill is the agent's playbook, including the recommended sequences: pre-release — review (`/flow-review`) → fixes → docs → changelog/version bump; release — PR → merge → tag → `release-done`. The package also bundles the review skills themselves — `/flow-review` (a change, read against its `plan/plan.md`), `/flow-audit` (the whole repo) and `/flow-simplify` (the operative cut: deletes dead and duplicated code, one verified commit at a time) — and injects a built-in senior-discipline guidance at implement stage unless the playbook sets its own `prose.implement`.
20
20
  - **Status bar**: an initiated repo (`.dev-flow/project.md` exists) always carries the dev-flow footer; while the session **is bound** to a feature it shows `<stage glyph> <slug>` plus mode markers — stages 📝 plan, 🔨 implement, 🔍 pre-release, 🚀 release; markers ⚡ patch, 📚 docs, 🎱 yolo, `💬` while a checkpoint (Approve?/Verified?/Release?/Finish?) still waits on the operator's word — the legend's "operator, your turn" glyph, the same one stage lines open with — and `⚠️` while a check of the bound feature fails (emoji render in their own color, so the footer carries no theme coloring). An **unbound** session never sees a slug — it shows `💬 N flow(s) open` (unfinished-feature count only, no warning marker) or `💬 no flows` when nothing is in flight: the pre-flow glyph, because an unbound session is parked on the operator by definition; a session binds only via `flow start`/`flow use`, never by opening. In **pi-web** status text is not clickable, so there the footer is a widget chip instead: the chip carries the footer's content packed to fit pi-web's fixed-width chip — bound: every glyph up front with no spaces, then the slug (`🔨⚡⚠️my-feature`, so only the slug's tail can clip); unbound: `💬 2 open` (hover shows a clipped label whole) and expands (click again to collapse) to one lean line per *other* unfinished flow — the bound flow is already the chip's label, so it is not repeated (alone in the repo, the panel says `no other flows open`); the stage word is spelled out, markers and `⚠️` follow the footer vocabulary; with nothing open (`💬 no flows`) it is a plain chip with nothing to expand. The TUI never shows it: a widget there is an always-present block, and in a terminal the footer stays the legend. The footer repaints at session start, at the start of every agent run (the earliest a late-attaching web client is listening) and after every gate; an uninitiated folder gets no footer at all. `flow status` is the spelled-out surface: `stage=implement`, the per-feature mode tags (`[ui]`, `[yolo]`, `[no-version]`), the `💬 <word>` marker of a checkpoint the operator has not answered, and the `flow=<ver>` stamp of the build that started the feature.
@@ -25,7 +25,7 @@ import { createServer } from "node:net";
25
25
  import { freemem } from "node:os";
26
26
  import path from "node:path";
27
27
  import { promisify } from "node:util";
28
- import { Type } from "@earendil-works/pi-ai";
28
+ import { Type } from "typebox";
29
29
  import { compact, createAgentSession, DefaultResourceLoader, defineTool, getAgentDir, isToolCallEventType, SessionManager, SettingsManager, type AgentSession, type ExtensionContext } from "@earendil-works/pi-coding-agent";
30
30
  import type { ExtensionAPI, ToolCallEvent, ToolCallEventResult } from "@earendil-works/pi-coding-agent";
31
31
  import {
@@ -161,7 +161,7 @@ import {
161
161
  } from "../src/core.ts";
162
162
  import { applyAnswers, buildDraft, doctorFindings, ghostFeatureDirs, lineDiff, loadProject, mdDigest, parseAnswers, parseProjectMd, setPlaybookKey } from "../src/projectmd.ts";
163
163
  import { dedupeReflections, linkedTag, parseGhIssues, similarNote, type FoldResult, type GhIssue } from "../src/fold.ts";
164
- import { bashTimeout, requireTimeout } from "../src/timeouts.ts";
164
+ import { bashTimeout, requireTimeout, timeoutClass } from "../src/timeouts.ts";
165
165
  import { detectProject, type Detection } from "../src/detect.ts";
166
166
 
167
167
  const execAsync = promisify(exec);
@@ -241,7 +241,7 @@ function copyWarning(): string | null {
241
241
  }
242
242
  /** Test seam: the smoke suite cannot load a second copy of this module, so it plants registry
243
243
  * entries and asserts the warnings the real duplicate would print. */
244
- export const testSeams = { copies: COPIES, skillCore: { value: undefined as string | null | undefined }, piweb: { meta: piwebWorkerMeta, stamp: piwebStamp, liveClaim: piwebLiveClaim, workerName } };
244
+ export const testSeams = { copies: COPIES, skillCore: { value: undefined as string | null | undefined }, bashTimeout: { cap: undefined as number | undefined }, piweb: { meta: piwebWorkerMeta, stamp: piwebStamp, liveClaim: piwebLiveClaim, workerName } };
245
245
 
246
246
  interface Ui {
247
247
  hasUI: boolean;
@@ -2708,6 +2708,14 @@ async function askOperator(ctx: ExtensionContext, what: string, why: string): Pr
2708
2708
  return ok ? null : `operator declined — ${why}`;
2709
2709
  }
2710
2710
 
2711
+ /** What a kill by dev-flow's own timeout tells the agent (and the operator reading the transcript). */
2712
+ export function timeoutKillNote(armed: { s: number; cls: string }): string {
2713
+ const why = armed.cls.startsWith("its own timeout")
2714
+ ? `the command's ${armed.cls.replace(/^its own /, "")} plus a 15s margin — it outlived its own timer`
2715
+ : `dev-flow's default for ${armed.cls} commands, armed because the call stated no timeout`;
2716
+ return `[dev-flow] stopped at ${armed.s}s: ${why}. If it needs longer, rerun with an explicit timeout (seconds) on the call.`;
2717
+ }
2718
+
2711
2719
  export default function devFlow(pi: ExtensionAPI) {
2712
2720
  registerCopy(); // which copy of dev-flow this is — see COPIES
2713
2721
  /** Parse "flow <sub> [slug] [--flags]" args shared by command and tool. */
@@ -3171,6 +3179,26 @@ export default function devFlow(pi: ExtensionAPI) {
3171
3179
  return undefined;
3172
3180
  });
3173
3181
 
3182
+ // A kill by dev-flow's silent default must say so: the transcript shows the call without a timeout, so
3183
+ // "Command timed out after 30 seconds" otherwise reads like pi misbehaving, and the agent cannot tell a
3184
+ // policy cap from a hang. Keyed by tool call id; a call blocked before it ran never reports, so the map
3185
+ // is bounded rather than trusted to drain.
3186
+ const armedTimeouts = new Map<string, { s: number; cls: string }>();
3187
+ const rememberArmed = (id: string, v: { s: number; cls: string }) => {
3188
+ armedTimeouts.set(id, v);
3189
+ if (armedTimeouts.size > 500) armedTimeouts.delete(armedTimeouts.keys().next().value as string);
3190
+ };
3191
+ pi.on("tool_result", async (event) => {
3192
+ const armed = armedTimeouts.get(event.toolCallId);
3193
+ if (!armed) return undefined;
3194
+ armedTimeouts.delete(event.toolCallId);
3195
+ if (!event.isError) return undefined;
3196
+ const text = event.content.map((c) => (c.type === "text" ? c.text : "")).join("");
3197
+ const m = text.match(/timed out after (\d+) seconds/);
3198
+ if (!m || Number(m[1]) !== armed.s) return undefined;
3199
+ return { content: [...event.content, { type: "text" as const, text: `\n${timeoutKillNote(armed)}` }] };
3200
+ });
3201
+
3174
3202
  async function guardToolCall(event: ToolCallEvent, ctx: ExtensionContext): Promise<ToolCallEventResult | undefined> {
3175
3203
  if (!guardsAreMine()) return undefined; // election: only the newest loaded copy judges
3176
3204
  // pi kills a shell call only when a timeout was passed, and the model omits it in ~75% of
@@ -3182,7 +3210,14 @@ export default function devFlow(pi: ExtensionAPI) {
3182
3210
  const noDf = !initiated(ctx.cwd);
3183
3211
  // in an initiated repo the silent default stays armed either way: it is the safety net for an
3184
3212
  // `inject` project and the number the refusal quotes; an uninitiated folder is not touched at all
3185
- if (shellCmd && shellInput && !noDf) shellInput.timeout = bashTimeout(shellCmd, explicitTimeout);
3213
+ if (shellCmd && shellInput && !noDf) {
3214
+ // the e2e test shortens only the silent default — an explicit timeout is never touched
3215
+ const cls = explicitTimeout === undefined && testSeams.bashTimeout.cap !== undefined ? { ...timeoutClass(shellCmd), s: testSeams.bashTimeout.cap } : timeoutClass(shellCmd);
3216
+ shellInput.timeout = explicitTimeout === undefined ? cls.s : bashTimeout(shellCmd, explicitTimeout);
3217
+ // the armed value never reaches the transcript (the call records what the model wrote), so a kill
3218
+ // by it would read as a mystery hang — remember it, and the tool_result hook names it on a kill
3219
+ if (explicitTimeout === undefined) rememberArmed(event.toolCallId, cls);
3220
+ }
3186
3221
  // an uninitiated folder hears nothing from dev-flow at all — flow init is the opt-in that arms
3187
3222
  // the guards, the no-playbook bash-timeout default included
3188
3223
  if (noDf) return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-dev-flow",
3
- "version": "0.85.0",
3
+ "version": "0.85.1",
4
4
  "description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -46,13 +46,15 @@
46
46
  "peerDependencies": {
47
47
  "@earendil-works/pi-ai": "*",
48
48
  "@earendil-works/pi-coding-agent": "*",
49
- "@earendil-works/pi-tui": "*"
49
+ "@earendil-works/pi-tui": "*",
50
+ "typebox": "*"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@earendil-works/pi-ai": "*",
53
54
  "@earendil-works/pi-coding-agent": "*",
54
55
  "@earendil-works/pi-tui": "*",
55
56
  "@types/node": "^22.0.0",
57
+ "typebox": "*",
56
58
  "typescript": "^7.0.2"
57
59
  },
58
60
  "scripts": {
@@ -54,10 +54,8 @@ Ground rules:
54
54
  version heading (default is versioned: bump + tag).
55
55
  - **One session = exactly one feature** (flow + branch + worktree); parallel
56
56
  sessions, one feature each, are the model. A session binds **explicitly and
57
- only**: `flow start <slug>` binds its own feature (main checkout must be on
58
- the default branch); `flow use <slug>` takes one over. Nothing auto-binds.
59
- Both bind commands rename the Pi session to the slug, so the picker names each
60
- session after its feature. Unbound: gates demand an explicit slug and main-checkout writes stay
57
+ only**: `flow start <slug>` binds its own feature; `flow use <slug>` takes
58
+ one over. Nothing auto-binds. Unbound: gates demand an explicit slug and main-checkout writes stay
61
59
  blocked — there is no bypass, an unbound session cannot edit source.
62
60
  - **Project `flow-guard` rules** (`deny`/`confirm`/`protect`/`forbid` in
63
61
  project.md `## global`) apply at **every** stage and are judged ahead of
@@ -67,12 +65,15 @@ Ground rules:
67
65
  - **`.dev-flow/<slug>/state.json` is flow-owned** — never read or write it;
68
66
  `flow status` is your view. **project.md is the operator-owned playbook**:
69
67
  read freely, **never edit** — it changes through `flow init --write` on the
70
- operator's word (`flow doctor` reviews what it lacks).
68
+ operator's word.
71
69
  - **A guard blocking you means you are skipping a stage or writing outside your
72
70
  feature** — run the gate instead of working around it. The guard reads
73
71
  **commands**: quoted text is an argument's prose (a PR body discussing a
74
72
  commit is not a commit), and a wrapper that execs its argument
75
73
  (`sh -c "git push origin main"`) is judged on its payload.
74
+ - **Every bash call has a timeout**: none stated → dev-flow arms its class
75
+ default (quick 30s … build 900s, a `timeout N` wrapper → N+15s). Pass
76
+ `timeout` (seconds) when a run needs longer.
76
77
  - Abandon a feature with `flow abort <slug>` — never unbind by hand. A gate
77
78
  refusal lists exactly what is missing: fix that, rerun the gate.
78
79
  - Also obey the repo's own AGENTS.md and project skills: dev-flow sequences
package/src/timeouts.ts CHANGED
@@ -31,28 +31,65 @@ const GIT_NETWORK = new Set(["push", "pull", "fetch", "clone", "ls-remote", "sub
31
31
  // wrappers/prefixes that never decide the class of a segment
32
32
  const SKIP_HEADS = new Set(["cd", "export", "source", ".", "set", "unset", "if", "then", "else", "fi", "do", "done", "while", "for", "case", "esac", "{", "}", "(", "!", "test", "[[", "time", "nohup", "env", "command", "sudo"]);
33
33
 
34
- /** Timeout class of one command segment; 0 = contributes nothing (wrapper like `cd x`). */
35
- function segTimeout(seg: string): number {
34
+ /** Margin over a command's own `timeout N`: the shell's timer fires first, with its own message;
35
+ * dev-flow's kill stays the backstop. */
36
+ export const WRAPPER_MARGIN_S = 15;
37
+
38
+ /** `timeout`'s options that take a value as the next token (`-s KILL`, `-k 5`). */
39
+ const TIMEOUT_VALUE_OPTS = new Set(["-s", "--signal", "-k", "--kill-after"]);
40
+
41
+ /** A coreutils duration (`600`, `90s`, `2m`, `1.5h`, `1d`) in seconds; null when unreadable or 0 (= no limit). */
42
+ function parseDuration(tok: string): number | null {
43
+ const m = tok.match(/^(\d+(?:\.\d+)?)([smhd]?)$/);
44
+ if (!m) return null;
45
+ const n = Number(m[1]) * { "": 1, s: 1, m: 60, h: 3600, d: 86400 }[m[2] as "" | "s" | "m" | "h" | "d"];
46
+ return n > 0 ? Math.ceil(n) : null;
47
+ }
48
+
49
+ /** Class of one command segment: its ceiling in seconds and the class name the timeout note reports;
50
+ * 0 = contributes nothing (a wrapper like `cd x`). */
51
+ function segClass(seg: string): { s: number; cls: string } {
36
52
  // watchers run by design until done — they get their own ceiling no matter what head they carry
37
- if (/\bgh\s+run\s+watch\b/.test(seg)) return WATCH_S;
38
- if (/(logs?|tail|journalctl)/.test(seg) && /(^|\s)(-f|--follow)(\s|$)/.test(seg)) return WATCH_S;
39
- if (/\bcompose\b.*\bup\b/.test(seg) && !/(^|\s)(-d|--detach)(\s|$)/.test(seg)) return WATCH_S;
53
+ if (/\bgh\s+run\s+watch\b/.test(seg)) return { s: WATCH_S, cls: "watch" };
54
+ if (/(logs?|tail|journalctl)/.test(seg) && /(^|\s)(-f|--follow)(\s|$)/.test(seg)) return { s: WATCH_S, cls: "watch" };
55
+ if (/\bcompose\b.*\bup\b/.test(seg) && !/(^|\s)(-d|--detach)(\s|$)/.test(seg)) return { s: WATCH_S, cls: "watch" };
40
56
  const tok = seg.trim().split(/\s+/);
41
57
  let i = 0;
42
58
  while (i < tok.length && (/^[\w.]+=/.test(tok[i]) || SKIP_HEADS.has(tok[i]))) i++;
43
59
  const base = (tok[i] ?? "").split("/").pop() ?? "";
44
- if (SKIP_HEADS.has(base) || !base) return 0;
60
+ if (SKIP_HEADS.has(base) || !base) return { s: 0, cls: "" };
61
+ // `timeout N cmd`: the command already says how long it may run — honour that, plus a margin, instead
62
+ // of judging the segment by the head `timeout` (which fell to the 120s default and killed a
63
+ // `timeout 600 bun test` at two minutes). An unreadable duration falls back to the wrapped command.
64
+ if (base === "timeout" || base === "gtimeout") {
65
+ let j = i + 1;
66
+ while (j < tok.length && tok[j].startsWith("-")) j += TIMEOUT_VALUE_OPTS.has(tok[j]) ? 2 : 1;
67
+ const n = parseDuration(tok[j] ?? "");
68
+ if (n !== null) return { s: Math.min(n + WRAPPER_MARGIN_S, CLAMP_S), cls: `its own timeout ${tok[j]}` };
69
+ const inner = segClass(tok.slice(j + 1).join(" "));
70
+ return inner.s ? inner : { s: DEFAULT_S, cls: "default" };
71
+ }
45
72
  if (base === "git") {
46
73
  const sub = tok[i + 1] ?? "";
47
- if (GIT_QUICK.has(sub)) return QUICK_S;
48
- if (GIT_NETWORK.has(sub)) return NETWORK_S;
49
- return LOCAL_GIT_S;
74
+ if (GIT_QUICK.has(sub)) return { s: QUICK_S, cls: "quick" };
75
+ if (GIT_NETWORK.has(sub)) return { s: NETWORK_S, cls: "network" };
76
+ return { s: LOCAL_GIT_S, cls: "local git" };
77
+ }
78
+ if (NETWORK.has(base)) return { s: NETWORK_S, cls: "network" };
79
+ if (SERVICE.has(base)) return /\bbuild\b/.test(seg) ? { s: BUILD_S, cls: "build" } : { s: SERVICE_S, cls: "service" }; // docker/compose build is an image build, not a service poke
80
+ if (BUILD.has(base)) return { s: BUILD_S, cls: "build" };
81
+ if (QUICK.has(base)) return { s: QUICK_S, cls: "quick" };
82
+ return { s: DEFAULT_S, cls: "default" };
83
+ }
84
+
85
+ /** The slowest segment's class — what decides a command's default timeout, and what the kill note names. */
86
+ export function timeoutClass(command: string): { s: number; cls: string } {
87
+ let best = { s: 0, cls: "" };
88
+ for (const seg of bashSegments(command)) {
89
+ const c = segClass(seg);
90
+ if (c.s > best.s) best = c;
50
91
  }
51
- if (NETWORK.has(base)) return NETWORK_S;
52
- if (SERVICE.has(base)) return /\bbuild\b/.test(seg) ? BUILD_S : SERVICE_S; // docker/compose build is an image build, not a service poke
53
- if (BUILD.has(base)) return BUILD_S;
54
- if (QUICK.has(base)) return QUICK_S;
55
- return DEFAULT_S;
92
+ return best.s ? best : { s: DEFAULT_S, cls: "default" };
56
93
  }
57
94
 
58
95
  /**
@@ -61,9 +98,7 @@ function segTimeout(seg: string): number {
61
98
  */
62
99
  export function bashTimeout(command: string, explicit?: number): number {
63
100
  if (typeof explicit === "number" && Number.isFinite(explicit) && explicit > 0) return Math.min(explicit, CLAMP_S);
64
- let t = 0;
65
- for (const seg of bashSegments(command)) t = Math.max(t, segTimeout(seg));
66
- return t || DEFAULT_S;
101
+ return timeoutClass(command).s;
67
102
  }
68
103
 
69
104
  /**