@bakers-build/addon-herdr 0.6.1-next.5 → 0.6.1-next.6
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/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +1 -2
- package/dist/src/panes.d.ts +2 -20
- package/dist/src/panes.js +4 -66
- package/dist/src/workspace.d.ts +0 -3
- package/dist/src/workspace.js +0 -4
- package/package.json +5 -5
- package/dist/src/agent-host.d.ts +0 -45
- package/dist/src/agent-host.js +0 -9
- package/dist/src/agents.d.ts +0 -3
- package/dist/src/agents.js +0 -132
package/dist/src/index.d.ts
CHANGED
|
@@ -2,10 +2,8 @@ import type { BbExecutor, ExecutorCapabilities, ExecutorPlugin, HookContext, Hoo
|
|
|
2
2
|
import type { ConductorLogger } from '@bakers-build/core';
|
|
3
3
|
import { type HerdrExecutorOptions } from './config.js';
|
|
4
4
|
import { type HerdrExec } from './pane-layout.js';
|
|
5
|
-
export type { AgentLaunchHost, AgentLaunchHostProvider, HostedAgent, } from './agent-host.js';
|
|
6
|
-
export { herdrAgentHost } from './agents.js';
|
|
7
5
|
export type { HerdrExec } from './pane-layout.js';
|
|
8
|
-
export { envArgs
|
|
6
|
+
export { envArgs } from './panes.js';
|
|
9
7
|
export { herdrProcessHost } from './process-host.js';
|
|
10
8
|
export { HerdrWorkspace, type HerdrWorkspaceOptions, herdrWorkspace, type OpenLayout, } from './workspace.js';
|
|
11
9
|
export { parseWorkspaceList, type WorkspaceEntry, } from './workspace-list.js';
|
package/dist/src/index.js
CHANGED
|
@@ -7,8 +7,7 @@ import { applyPaneLayout, isRecord, parseJson, } from './pane-layout.js';
|
|
|
7
7
|
import { AGENT_SHELL_ENV, envArgs } from './panes.js';
|
|
8
8
|
import { deriveHerdrRoot } from './root-anchor.js';
|
|
9
9
|
import { parseWorkspaceList } from './workspace-list.js';
|
|
10
|
-
export {
|
|
11
|
-
export { envArgs, findTabIdByLabel, parsePaneInfo, parsePanesInTab, parseTabCreate, } from './panes.js';
|
|
10
|
+
export { envArgs } from './panes.js';
|
|
12
11
|
// BB-139: the herdr workspace lives in the same package now (the separate
|
|
13
12
|
// @bakers-build/addon-herdr-workspace was merged in). The package DEFAULT export
|
|
14
13
|
// stays the executor (below); herdrWorkspace + HerdrWorkspace are named exports.
|
package/dist/src/panes.d.ts
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
/** A herdr pane and the tab it sits in. */
|
|
2
|
-
export interface HerdrPaneRef {
|
|
3
|
-
paneId: string;
|
|
4
|
-
tabId: string;
|
|
5
|
-
}
|
|
6
|
-
/** A herdr pane plus its label. */
|
|
7
|
-
export interface HerdrPaneInfo extends HerdrPaneRef {
|
|
8
|
-
label: string;
|
|
9
|
-
}
|
|
10
1
|
/**
|
|
11
2
|
* Marker exported into an AGENT pane's interactive shell, so a user's opt-in
|
|
12
3
|
* shell init can recognise an agent-run pane at startup and isolate its history
|
|
13
4
|
* (BB-64). It is a plain `BB_*` env entry on purpose: it rides {@link envArgs}
|
|
14
5
|
* like every other pane var instead of adding a second mechanism.
|
|
15
6
|
*
|
|
16
|
-
* AGENT panes only — the executor's per-run tab and its layout panes
|
|
17
|
-
*
|
|
18
|
-
* human's landing pane, and the opt-in unsets `HISTFILE`. See
|
|
7
|
+
* AGENT panes only — the executor's per-run tab and its layout panes. NOT the
|
|
8
|
+
* workspace's own open-layout pane: that one is the human's landing pane, and the opt-in unsets `HISTFILE`. See
|
|
19
9
|
* `docs/conductor/node.md` § Agent-pane shell marker.
|
|
20
10
|
*/
|
|
21
11
|
export declare const AGENT_SHELL_ENV: Record<string, string>;
|
|
22
12
|
/** BB_* env vars as `--env KEY=VALUE` args (never dump the full environment). */
|
|
23
13
|
export declare function envArgs(env: Record<string, string | undefined>): string[];
|
|
24
|
-
/** `{ paneId, tabId }` from a `herdr tab create` envelope. */
|
|
25
|
-
export declare function parseTabCreate(output: string): HerdrPaneRef;
|
|
26
|
-
/** `{ paneId, tabId }` from a `result.pane` envelope (pane current / split). */
|
|
27
|
-
export declare function parsePaneInfo(output: string): HerdrPaneRef;
|
|
28
|
-
/** The id of the first tab whose label equals `label`, else null. */
|
|
29
|
-
export declare function findTabIdByLabel(output: string, label: string): string | null;
|
|
30
|
-
/** Panes in `tabId` as `[{ paneId, tabId, label }]` from a `pane list` envelope. */
|
|
31
|
-
export declare function parsePanesInTab(output: string, tabId: string): HerdrPaneInfo[];
|
package/dist/src/panes.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
// Herdr pane
|
|
2
|
-
//
|
|
3
|
-
// and herdr-internal; the conductor/TUI never see these pane shapes.
|
|
4
|
-
function isRecord(v) {
|
|
5
|
-
return typeof v === 'object' && v !== null;
|
|
6
|
-
}
|
|
1
|
+
// Herdr pane env helpers (BB-190, BB-64): the agent-shell marker and the
|
|
2
|
+
// `--env` args every pane launch passes. Kept small and herdr-internal.
|
|
7
3
|
/**
|
|
8
4
|
* Marker exported into an AGENT pane's interactive shell, so a user's opt-in
|
|
9
5
|
* shell init can recognise an agent-run pane at startup and isolate its history
|
|
10
6
|
* (BB-64). It is a plain `BB_*` env entry on purpose: it rides {@link envArgs}
|
|
11
7
|
* like every other pane var instead of adding a second mechanism.
|
|
12
8
|
*
|
|
13
|
-
* AGENT panes only — the executor's per-run tab and its layout panes
|
|
14
|
-
*
|
|
15
|
-
* human's landing pane, and the opt-in unsets `HISTFILE`. See
|
|
9
|
+
* AGENT panes only — the executor's per-run tab and its layout panes. NOT the
|
|
10
|
+
* workspace's own open-layout pane: that one is the human's landing pane, and the opt-in unsets `HISTFILE`. See
|
|
16
11
|
* `docs/conductor/node.md` § Agent-pane shell marker.
|
|
17
12
|
*/
|
|
18
13
|
export const AGENT_SHELL_ENV = {
|
|
@@ -28,60 +23,3 @@ export function envArgs(env) {
|
|
|
28
23
|
}
|
|
29
24
|
return out;
|
|
30
25
|
}
|
|
31
|
-
/** `{ paneId, tabId }` from a `herdr tab create` envelope. */
|
|
32
|
-
export function parseTabCreate(output) {
|
|
33
|
-
const parsed = JSON.parse(output);
|
|
34
|
-
const result = isRecord(parsed)
|
|
35
|
-
? parsed.result
|
|
36
|
-
: undefined;
|
|
37
|
-
const paneId = result?.root_pane?.pane_id;
|
|
38
|
-
const tabId = result?.tab?.tab_id;
|
|
39
|
-
if (typeof paneId !== 'string' || typeof tabId !== 'string') {
|
|
40
|
-
throw new Error('herdr tab create returned invalid schema');
|
|
41
|
-
}
|
|
42
|
-
return { paneId, tabId };
|
|
43
|
-
}
|
|
44
|
-
/** `{ paneId, tabId }` from a `result.pane` envelope (pane current / split). */
|
|
45
|
-
export function parsePaneInfo(output) {
|
|
46
|
-
const parsed = JSON.parse(output);
|
|
47
|
-
const pane = isRecord(parsed)
|
|
48
|
-
? parsed.result
|
|
49
|
-
?.pane
|
|
50
|
-
: undefined;
|
|
51
|
-
const paneId = pane?.pane_id;
|
|
52
|
-
const tabId = pane?.tab_id;
|
|
53
|
-
if (typeof paneId !== 'string' || typeof tabId !== 'string') {
|
|
54
|
-
throw new Error('herdr returned no pane info');
|
|
55
|
-
}
|
|
56
|
-
return { paneId, tabId };
|
|
57
|
-
}
|
|
58
|
-
/** The id of the first tab whose label equals `label`, else null. */
|
|
59
|
-
export function findTabIdByLabel(output, label) {
|
|
60
|
-
const parsed = JSON.parse(output);
|
|
61
|
-
const tabs = isRecord(parsed)
|
|
62
|
-
? parsed.result?.tabs
|
|
63
|
-
: undefined;
|
|
64
|
-
if (!Array.isArray(tabs))
|
|
65
|
-
return null;
|
|
66
|
-
const match = tabs
|
|
67
|
-
.filter(isRecord)
|
|
68
|
-
.find((t) => t.label === label && typeof t.tab_id === 'string');
|
|
69
|
-
return match ? match.tab_id : null;
|
|
70
|
-
}
|
|
71
|
-
/** Panes in `tabId` as `[{ paneId, tabId, label }]` from a `pane list` envelope. */
|
|
72
|
-
export function parsePanesInTab(output, tabId) {
|
|
73
|
-
const parsed = JSON.parse(output);
|
|
74
|
-
const panes = isRecord(parsed)
|
|
75
|
-
? parsed.result?.panes
|
|
76
|
-
: undefined;
|
|
77
|
-
if (!Array.isArray(panes))
|
|
78
|
-
return [];
|
|
79
|
-
return panes
|
|
80
|
-
.filter(isRecord)
|
|
81
|
-
.filter((p) => typeof p.pane_id === 'string' && p.tab_id === tabId)
|
|
82
|
-
.map((p) => ({
|
|
83
|
-
paneId: p.pane_id,
|
|
84
|
-
tabId,
|
|
85
|
-
label: typeof p.label === 'string' ? p.label : '',
|
|
86
|
-
}));
|
|
87
|
-
}
|
package/dist/src/workspace.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BbWorkspace, EnsuredWorkspace, WorkspacePlugin } from '@bakers-build/conductor/contract';
|
|
2
2
|
import type { ConductorLogger } from '@bakers-build/core';
|
|
3
|
-
import type { AgentLaunchHost } from './agent-host.js';
|
|
4
3
|
import { type PaneSpec } from './config.js';
|
|
5
4
|
import { type RootGitExec } from './root-anchor.js';
|
|
6
5
|
export type HerdrExec = (args: string[]) => Promise<string>;
|
|
@@ -110,8 +109,6 @@ export declare class HerdrWorkspace implements BbWorkspace {
|
|
|
110
109
|
* Optional `tabId` powers the BB-374 overview tab rename.
|
|
111
110
|
*/
|
|
112
111
|
private readonly pendingRootPanes;
|
|
113
|
-
/** Herdr-backed intent-level agent host for `bakers ui` (BB-190). */
|
|
114
|
-
readonly agentHost: AgentLaunchHost;
|
|
115
112
|
constructor(options: HerdrWorkspaceOptions);
|
|
116
113
|
/**
|
|
117
114
|
* Ensure the branch's worktree + herdr workspace exist.
|
package/dist/src/workspace.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { loadInstructions, runBranchGit, } from '@bakers-build/addon-workspace-git';
|
|
3
3
|
import { exec } from '@bakers-build/core';
|
|
4
|
-
import { herdrAgentHost } from './agents.js';
|
|
5
4
|
import { renderTemplate } from './config.js';
|
|
6
5
|
import { applyPaneLayout, isRecord, parseJson } from './pane-layout.js';
|
|
7
6
|
import { deriveHerdrRoot } from './root-anchor.js';
|
|
@@ -116,8 +115,6 @@ export class HerdrWorkspace {
|
|
|
116
115
|
* Optional `tabId` powers the BB-374 overview tab rename.
|
|
117
116
|
*/
|
|
118
117
|
pendingRootPanes = new Map();
|
|
119
|
-
/** Herdr-backed intent-level agent host for `bakers ui` (BB-190). */
|
|
120
|
-
agentHost;
|
|
121
118
|
constructor(options) {
|
|
122
119
|
this.options = options;
|
|
123
120
|
this.execHerdr = options.execHerdr ?? defaultExec;
|
|
@@ -127,7 +124,6 @@ export class HerdrWorkspace {
|
|
|
127
124
|
// `??`, not `||`: an explicit `open: {}` must survive as the opt-out.
|
|
128
125
|
this.open = options.open ?? DEFAULT_OPEN_LAYOUT;
|
|
129
126
|
this.logger = options.logger ?? noopLogger;
|
|
130
|
-
this.agentHost = herdrAgentHost(this.execHerdr);
|
|
131
127
|
}
|
|
132
128
|
/**
|
|
133
129
|
* Ensure the branch's worktree + herdr workspace exist.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-herdr",
|
|
3
|
-
"version": "0.6.1-next.
|
|
3
|
+
"version": "0.6.1-next.6",
|
|
4
4
|
"description": "bakers.build herdr integration: spawn executor + per-ticket worktree workspace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"directory": "bakers-cli/addons/herdr"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@bakers-build/addon-workspace-git": "^0.6.1-next.
|
|
24
|
+
"@bakers-build/addon-workspace-git": "^0.6.1-next.6"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@bakers-build/conductor": "^0.6.1-next.
|
|
28
|
-
"@bakers-build/core": "^0.6.1-next.
|
|
27
|
+
"@bakers-build/conductor": "^0.6.1-next.6",
|
|
28
|
+
"@bakers-build/core": "^0.6.1-next.6"
|
|
29
29
|
},
|
|
30
30
|
"bakersBuild": {
|
|
31
|
-
"commit": "
|
|
31
|
+
"commit": "12b97ff4aa2422d69dab286141f3234609f32351",
|
|
32
32
|
"channel": "next"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/dist/src/agent-host.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** A hosted agent as reported by the host. `id` is the host-owned stable handle
|
|
2
|
-
* (survives a TUI restart); `group` is the opaque grouping key it was launched
|
|
3
|
-
* under; `label` is a human tag for the list. */
|
|
4
|
-
export interface HostedAgent {
|
|
5
|
-
id: string;
|
|
6
|
-
group: string;
|
|
7
|
-
label: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* The INTENT-level agent host herdr provides. The caller says "launch an agent
|
|
11
|
-
* in this group", "show that agent", "list this group" — it never names panes,
|
|
12
|
-
* tabs, splits or zoom. The host (herdr) owns the whole layout policy. `group`
|
|
13
|
-
* is OPAQUE (bakers passes the project slug). `command` is the resolved shell
|
|
14
|
-
* command the agent runs (the renderer's prompt is turned into a command by the
|
|
15
|
-
* `bakers ui` entry before it reaches here — herdr stays agent-binary-agnostic).
|
|
16
|
-
*/
|
|
17
|
-
export interface AgentLaunchHost {
|
|
18
|
-
/**
|
|
19
|
-
* Start an agent and return its stable handle. The host decides where the
|
|
20
|
-
* session is placed and shows it; the caller only supplies intent + a group.
|
|
21
|
-
*/
|
|
22
|
-
launch(opts: {
|
|
23
|
-
group: string;
|
|
24
|
-
cwd: string;
|
|
25
|
-
command: string;
|
|
26
|
-
env?: Record<string, string | undefined> | undefined;
|
|
27
|
-
label?: string | undefined;
|
|
28
|
-
}): Promise<HostedAgent>;
|
|
29
|
-
/** The live agents of a group — the source of truth for the list, rebuilt
|
|
30
|
-
* from the host on demand so sessions survive a TUI restart. */
|
|
31
|
-
list(group: string): Promise<HostedAgent[]>;
|
|
32
|
-
/** Bring one agent to the foreground (the host zooms/switches as it sees fit). */
|
|
33
|
-
focus(id: string): Promise<void>;
|
|
34
|
-
/** Stop showing a group's agents and return focus to the caller. Durable —
|
|
35
|
-
* the agents keep running; this never terminates them. */
|
|
36
|
-
hide(group: string): Promise<void>;
|
|
37
|
-
/** Terminate one agent for good. */
|
|
38
|
-
kill(id: string): Promise<void>;
|
|
39
|
-
/** Send literal text to an agent's input. */
|
|
40
|
-
sendText(id: string, text: string): Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
/** A workspace (or other plugin) that can host agents at the intent level. */
|
|
43
|
-
export interface AgentLaunchHostProvider {
|
|
44
|
-
agentHost: AgentLaunchHost;
|
|
45
|
-
}
|
package/dist/src/agent-host.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Herdr's own agent-host contract (BB-194 AC-3). It used to live in
|
|
2
|
-
// `@bakers-build/core` as `AgentLaunchHost`/`HostedAgent`, but the agent-host seam is
|
|
3
|
-
// a TUI/renderer concern, not a conductor-engine one — so core dropped it and
|
|
4
|
-
// herdr types its impl LOCALLY. This interface imports nothing removed and
|
|
5
|
-
// nothing from `@bakers-build/addon-bakers-ui`: the renderer owns its own
|
|
6
|
-
// prompt-level `TuiAgentService`, and the conductor `bakers ui` entry adapts this
|
|
7
|
-
// mechanism-level (`command`-based) host to it. Structurally compatible, no
|
|
8
|
-
// cross-package type coupling.
|
|
9
|
-
export {};
|
package/dist/src/agents.d.ts
DELETED
package/dist/src/agents.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Herdr-backed AgentLaunchHost (BB-190) — the INTENT-level agent host. It owns
|
|
2
|
-
// the whole layout policy the bakers-ui plugin used to drive from the conductor:
|
|
3
|
-
// one durable herdr tab per group, a new agent splits off a live pane, the shown
|
|
4
|
-
// agent is zoomed, hiding un-zooms and returns to the caller. The caller speaks
|
|
5
|
-
// only launch/list/focus/hide/kill/sendText — never panes, tabs or zoom.
|
|
6
|
-
//
|
|
7
|
-
// `group` is opaque (bakers passes a project slug); it maps to one tab labelled
|
|
8
|
-
// `bakers-agents:<group>`, so a group's agents are listed + hidden together and
|
|
9
|
-
// survive a TUI restart (rediscovered from the live tab).
|
|
10
|
-
import { rmSync } from 'node:fs';
|
|
11
|
-
import { writeLaunchScript } from './launch-script.js';
|
|
12
|
-
import { AGENT_SHELL_ENV, envArgs, findTabIdByLabel, parsePaneInfo, parsePanesInTab, parseTabCreate, } from './panes.js';
|
|
13
|
-
/** The single tab that holds a group's agent panes. */
|
|
14
|
-
const groupTabLabel = (group) => `bakers-agents:${group}`;
|
|
15
|
-
export function herdrAgentHost(execHerdr) {
|
|
16
|
-
// The caller's home tab, returned to on hide. Captured lazily on the first
|
|
17
|
-
// launch — that is when the caller is focused on its own tab (pressing `n`),
|
|
18
|
-
// and it keeps construction side-effect-free. Best-effort: a probe failure
|
|
19
|
-
// just leaves hide without a home to return to.
|
|
20
|
-
let homeTab = null;
|
|
21
|
-
const captureHome = async () => {
|
|
22
|
-
if (homeTab !== null)
|
|
23
|
-
return;
|
|
24
|
-
try {
|
|
25
|
-
homeTab = parsePaneInfo(await execHerdr(['pane', 'current'])).tabId;
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// no home tab known; hide() becomes a no-op focus
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
// Cache each group's tab id to skip the `tab list` round-trip once known.
|
|
32
|
-
const tabByGroup = new Map();
|
|
33
|
-
const resolveTab = async (group) => {
|
|
34
|
-
const cached = tabByGroup.get(group);
|
|
35
|
-
if (cached)
|
|
36
|
-
return cached;
|
|
37
|
-
const found = findTabIdByLabel(await execHerdr(['tab', 'list']), groupTabLabel(group));
|
|
38
|
-
if (found)
|
|
39
|
-
tabByGroup.set(group, found);
|
|
40
|
-
return found;
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
async launch({ group, cwd, command, env, label }) {
|
|
44
|
-
await captureHome();
|
|
45
|
-
// Every pane this host opens holds an agent, so all of them carry the
|
|
46
|
-
// agent-shell marker (BB-64) — this is the pane a `bakers ui` user actually
|
|
47
|
-
// attaches to. The caller's own env wins on a key clash; the marker is
|
|
48
|
-
// merged in, never substituted for it.
|
|
49
|
-
const e = { ...AGENT_SHELL_ENV, ...(env ?? {}) };
|
|
50
|
-
// Find the group's tab and split off a LIVE pane (newest-first; a stale
|
|
51
|
-
// pane — a previous agent died/was closed — is skipped). None survive, or
|
|
52
|
-
// no tab yet → create the group tab (its root pane is the agent).
|
|
53
|
-
let pane = null;
|
|
54
|
-
const tabId = await resolveTab(group);
|
|
55
|
-
if (tabId) {
|
|
56
|
-
const panes = parsePanesInTab(await execHerdr(['pane', 'list']), tabId);
|
|
57
|
-
for (const p of [...panes].reverse()) {
|
|
58
|
-
try {
|
|
59
|
-
pane = parsePaneInfo(await execHerdr([
|
|
60
|
-
'pane',
|
|
61
|
-
'split',
|
|
62
|
-
p.paneId,
|
|
63
|
-
'--direction',
|
|
64
|
-
'right',
|
|
65
|
-
'--no-focus',
|
|
66
|
-
'--cwd',
|
|
67
|
-
cwd,
|
|
68
|
-
...envArgs(e),
|
|
69
|
-
]));
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// stale pane — try the next
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!pane)
|
|
77
|
-
tabByGroup.delete(group);
|
|
78
|
-
}
|
|
79
|
-
if (!pane) {
|
|
80
|
-
pane = parseTabCreate(await execHerdr([
|
|
81
|
-
'tab',
|
|
82
|
-
'create',
|
|
83
|
-
'--cwd',
|
|
84
|
-
cwd,
|
|
85
|
-
'--no-focus',
|
|
86
|
-
'--label',
|
|
87
|
-
groupTabLabel(group),
|
|
88
|
-
...envArgs(e),
|
|
89
|
-
]));
|
|
90
|
-
tabByGroup.set(group, pane.tabId);
|
|
91
|
-
}
|
|
92
|
-
const launch = writeLaunchScript(command);
|
|
93
|
-
// ponytail: on success the wrapper's started/exit markers stay in tmp
|
|
94
|
-
// (no secrets); a sweep is only worth it if they ever pile up.
|
|
95
|
-
await execHerdr(['pane', 'run', pane.paneId, launch.typedCommand]).catch((err) => {
|
|
96
|
-
rmSync(launch.dir, { recursive: true, force: true });
|
|
97
|
-
throw err;
|
|
98
|
-
});
|
|
99
|
-
const human = label ?? 'agent';
|
|
100
|
-
await execHerdr(['pane', 'rename', pane.paneId, human]).catch(() => { });
|
|
101
|
-
await execHerdr(['pane', 'zoom', pane.paneId, '--on']).catch(() => { });
|
|
102
|
-
return { id: pane.paneId, group, label: human };
|
|
103
|
-
},
|
|
104
|
-
async list(group) {
|
|
105
|
-
const tabId = await resolveTab(group);
|
|
106
|
-
if (!tabId)
|
|
107
|
-
return [];
|
|
108
|
-
return parsePanesInTab(await execHerdr(['pane', 'list']), tabId).map((p) => ({ id: p.paneId, group, label: p.label }));
|
|
109
|
-
},
|
|
110
|
-
async focus(id) {
|
|
111
|
-
await execHerdr(['pane', 'zoom', id, '--on']);
|
|
112
|
-
},
|
|
113
|
-
async hide(group) {
|
|
114
|
-
// Un-zoom the group's panes (so it reads as the tiled overview next time)
|
|
115
|
-
// and return focus to the caller's home tab. The agents keep running.
|
|
116
|
-
const tabId = await resolveTab(group);
|
|
117
|
-
if (tabId) {
|
|
118
|
-
for (const p of parsePanesInTab(await execHerdr(['pane', 'list']), tabId)) {
|
|
119
|
-
await execHerdr(['pane', 'zoom', p.paneId, '--off']).catch(() => { });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (homeTab)
|
|
123
|
-
await execHerdr(['tab', 'focus', homeTab]).catch(() => { });
|
|
124
|
-
},
|
|
125
|
-
async kill(id) {
|
|
126
|
-
await execHerdr(['pane', 'close', id]);
|
|
127
|
-
},
|
|
128
|
-
async sendText(id, text) {
|
|
129
|
-
await execHerdr(['pane', 'send-text', id, text]);
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|