@byokit/herdr 0.1.0-next.dbe7142
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 +17 -0
- package/LICENSE +202 -0
- package/README.md +18 -0
- package/dist/agents.d.ts +7 -0
- package/dist/agents.js +141 -0
- package/dist/approvals.d.ts +24 -0
- package/dist/approvals.js +81 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +89 -0
- package/dist/close.d.ts +4 -0
- package/dist/close.js +85 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +5 -0
- package/dist/device.d.ts +40 -0
- package/dist/device.js +128 -0
- package/dist/generated/events.d.ts +371 -0
- package/dist/generated/events.js +3 -0
- package/dist/generated/methods.d.ts +2299 -0
- package/dist/generated/methods.js +3 -0
- package/dist/generated/report.json +50 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/kit.d.ts +73 -0
- package/dist/kit.js +209 -0
- package/dist/link.d.ts +24 -0
- package/dist/link.js +324 -0
- package/dist/notices.d.ts +14 -0
- package/dist/notices.js +88 -0
- package/dist/socket.d.ts +2 -0
- package/dist/socket.js +137 -0
- package/dist/supervise.d.ts +17 -0
- package/dist/supervise.js +137 -0
- package/dist/terminal.d.ts +6 -0
- package/dist/terminal.js +105 -0
- package/dist/testing/contract.d.ts +9 -0
- package/dist/testing/contract.js +308 -0
- package/dist/testing/fake-herdr/bin.d.ts +5 -0
- package/dist/testing/fake-herdr/bin.js +210 -0
- package/dist/testing/fake-herdr/server.d.ts +21 -0
- package/dist/testing/fake-herdr/server.js +604 -0
- package/dist/testing/fake-herdr/world.d.ts +84 -0
- package/dist/testing/fake-herdr/world.js +85 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +7 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.js +3 -0
- package/dist/words.d.ts +10 -0
- package/dist/words.js +18 -0
- package/dist/words.json +19 -0
- package/package.json +60 -0
package/dist/close.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const codeOf = (error) => {
|
|
2
|
+
const code = error?.code;
|
|
3
|
+
if (typeof code === 'string')
|
|
4
|
+
return code;
|
|
5
|
+
return /herdr: ([a-z0-9_]+):/i.exec(error instanceof Error ? error.message : String(error))?.[1];
|
|
6
|
+
};
|
|
7
|
+
const fail = (code, message) => Object.assign(new Error(message), { code });
|
|
8
|
+
const unavailable = (kind) => fail(`${kind}-unavailable`, `That ${kind} is no longer available.`);
|
|
9
|
+
const count = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
|
|
10
|
+
export async function closePane(call, paneId) {
|
|
11
|
+
let tabId;
|
|
12
|
+
try {
|
|
13
|
+
const made = (await call('pane.get', { pane_id: paneId }));
|
|
14
|
+
tabId = made?.pane?.tab_id;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (codeOf(error) === 'pane_not_found')
|
|
18
|
+
throw unavailable('pane');
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
if (typeof tabId !== 'string')
|
|
22
|
+
throw unavailable('pane');
|
|
23
|
+
let paneCount = 0;
|
|
24
|
+
try {
|
|
25
|
+
const made = (await call('tab.get', { tab_id: tabId }));
|
|
26
|
+
paneCount = count(made?.tab?.pane_count);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (codeOf(error) === 'tab_not_found')
|
|
30
|
+
throw unavailable('pane');
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
if (paneCount <= 1)
|
|
34
|
+
throw fail('pane-close-would-widen', 'Closing this pane would close its tab; close the tab instead.');
|
|
35
|
+
await call('pane.close', { pane_id: paneId });
|
|
36
|
+
}
|
|
37
|
+
export async function closeTab(call, tabId) {
|
|
38
|
+
let workspaceId;
|
|
39
|
+
try {
|
|
40
|
+
const made = (await call('tab.get', { tab_id: tabId }));
|
|
41
|
+
workspaceId = made?.tab?.workspace_id;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (codeOf(error) === 'tab_not_found')
|
|
45
|
+
throw unavailable('tab');
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
if (typeof workspaceId !== 'string')
|
|
49
|
+
throw unavailable('tab');
|
|
50
|
+
let tabCount = 0;
|
|
51
|
+
try {
|
|
52
|
+
const made = (await call('workspace.get', { workspace_id: workspaceId }));
|
|
53
|
+
tabCount = count(made?.workspace?.tab_count);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (codeOf(error) === 'workspace_not_found')
|
|
57
|
+
throw unavailable('tab');
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
if (tabCount <= 1)
|
|
61
|
+
throw fail('tab-close-would-widen', 'Closing this tab would close its workspace; close the workspace instead.');
|
|
62
|
+
await call('tab.close', { tab_id: tabId });
|
|
63
|
+
}
|
|
64
|
+
export async function closeWorkspace(call, workspaceId) {
|
|
65
|
+
let worktree;
|
|
66
|
+
try {
|
|
67
|
+
const made = (await call('workspace.get', { workspace_id: workspaceId }));
|
|
68
|
+
worktree = made?.workspace?.worktree;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (codeOf(error) === 'workspace_not_found')
|
|
72
|
+
throw unavailable('workspace');
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
// The root of a worktree group — a non-linked checkout whose repo key a linked one shares — widens.
|
|
76
|
+
if (worktree?.is_linked_worktree === false && typeof worktree.repo_key === 'string') {
|
|
77
|
+
const made = (await call('workspace.list', {}));
|
|
78
|
+
const group = (Array.isArray(made?.workspaces) ? made.workspaces : [])
|
|
79
|
+
.filter((w) => w?.worktree?.repo_key === worktree.repo_key).length;
|
|
80
|
+
if (group >= 2) {
|
|
81
|
+
throw fail('workspace-close-would-widen', 'Closing this workspace would close its worktree group; close the linked checkouts instead.');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
await call('workspace.close', { workspace_id: workspaceId });
|
|
85
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The pinned Herdr release (docs/runtime-kits.md D5) and the protocol this kit speaks.
|
|
2
|
+
export const HERDR_VERSION = '0.9.1';
|
|
3
|
+
// From the v0.9.1 schema snapshot (schema/herdr-api-0.9.1.json, docs/runtime-kits.md 6.7);
|
|
4
|
+
// regenerated by scripts/gen-types.ts and pinned by test/generated.test.ts.
|
|
5
|
+
export const HERDR_PROTOCOL = 22;
|
package/dist/device.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DeviceLink } from '@byokit/link';
|
|
2
|
+
import type { AgentRef, BlockedAgent, HerdrSnapshot, HerdrState, PromptReceipt, StartAgent } from './types.ts';
|
|
3
|
+
export { openNotice } from './notices.ts';
|
|
4
|
+
export declare function herdrDevice(link: DeviceLink): {
|
|
5
|
+
state(): Promise<{
|
|
6
|
+
state: HerdrState;
|
|
7
|
+
words: string;
|
|
8
|
+
}>;
|
|
9
|
+
tree(): Promise<HerdrSnapshot>;
|
|
10
|
+
startAgent(o: StartAgent): Promise<AgentRef>;
|
|
11
|
+
prompt(paneId: string, text: string): Promise<PromptReceipt>;
|
|
12
|
+
keys(paneId: string, keys: string[]): Promise<void>;
|
|
13
|
+
read(paneId: string, o?: {
|
|
14
|
+
source?: 'visible' | 'recent' | 'recent_unwrapped' | 'detection';
|
|
15
|
+
lines?: number;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
text: string;
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
blocked(): Promise<BlockedAgent[]>;
|
|
21
|
+
answer(paneId: string, keys: string[], revision: number): Promise<void>;
|
|
22
|
+
close(o: {
|
|
23
|
+
pane?: string;
|
|
24
|
+
tab?: string;
|
|
25
|
+
workspace?: string;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
events(): AsyncIterable<unknown>;
|
|
28
|
+
registerNotices(seed: Uint8Array): Promise<void>;
|
|
29
|
+
openNotice(data: Record<string, unknown>, seed: Uint8Array): BlockedAgent | null;
|
|
30
|
+
call(method: string, params?: unknown): Promise<unknown>;
|
|
31
|
+
terminal(paneId: string, o: {
|
|
32
|
+
mode: 'control' | 'observe';
|
|
33
|
+
cols: number;
|
|
34
|
+
rows: number;
|
|
35
|
+
}): {
|
|
36
|
+
onFrame(fn: (line: string) => void): () => void;
|
|
37
|
+
send(line: string): void;
|
|
38
|
+
close(): void;
|
|
39
|
+
};
|
|
40
|
+
};
|
package/dist/device.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export { openNotice } from "./notices.js";
|
|
2
|
+
import { boxPublicKeyB64, openNotice } from "./notices.js";
|
|
3
|
+
const decodeLines = () => {
|
|
4
|
+
const text = new TextDecoder();
|
|
5
|
+
let pending = '';
|
|
6
|
+
return {
|
|
7
|
+
push: (chunk) => {
|
|
8
|
+
pending += text.decode(chunk, { stream: true });
|
|
9
|
+
const lines = pending.split('\n');
|
|
10
|
+
pending = lines.pop() ?? '';
|
|
11
|
+
return lines.filter((line) => line.length > 0);
|
|
12
|
+
},
|
|
13
|
+
flush: () => {
|
|
14
|
+
pending += text.decode();
|
|
15
|
+
const rest = pending;
|
|
16
|
+
pending = '';
|
|
17
|
+
return rest.length > 0 ? [rest] : [];
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** A link stream as newline-delimited JSON frames; unparsed lines surface as `{ type: 'raw', line }`. */
|
|
22
|
+
async function* streamFrames(link, op, args) {
|
|
23
|
+
const s = await link.stream(op, args);
|
|
24
|
+
const ready = [];
|
|
25
|
+
let wake;
|
|
26
|
+
let ended = false;
|
|
27
|
+
const lines = decodeLines();
|
|
28
|
+
const emit = (frame) => {
|
|
29
|
+
ready.push(frame);
|
|
30
|
+
wake?.();
|
|
31
|
+
wake = undefined;
|
|
32
|
+
};
|
|
33
|
+
s.onData = (chunk) => {
|
|
34
|
+
for (const line of lines.push(chunk)) {
|
|
35
|
+
try {
|
|
36
|
+
emit(JSON.parse(line));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
emit({ type: 'raw', line });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
s.onEnd = () => {
|
|
44
|
+
for (const line of lines.flush())
|
|
45
|
+
emit({ type: 'raw', line });
|
|
46
|
+
ended = true;
|
|
47
|
+
wake?.();
|
|
48
|
+
wake = undefined;
|
|
49
|
+
};
|
|
50
|
+
for (;;) {
|
|
51
|
+
while (ready.length > 0)
|
|
52
|
+
yield ready.shift();
|
|
53
|
+
if (ended)
|
|
54
|
+
return;
|
|
55
|
+
await new Promise((resolve) => { wake = resolve; });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const terminalHandle = (opening) => {
|
|
59
|
+
const listeners = new Set();
|
|
60
|
+
const lines = decodeLines();
|
|
61
|
+
let s;
|
|
62
|
+
const queued = [];
|
|
63
|
+
let dead = false;
|
|
64
|
+
// The frozen H7 signature returns the handle synchronously; the stream opens underneath and
|
|
65
|
+
// sends made before it opens queue until then (frames cannot arrive before the open anyway).
|
|
66
|
+
opening.then((opened) => {
|
|
67
|
+
if (dead) {
|
|
68
|
+
opened.end();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
s = opened;
|
|
72
|
+
opened.onData = (chunk) => {
|
|
73
|
+
for (const line of lines.push(chunk)) {
|
|
74
|
+
for (const fn of listeners)
|
|
75
|
+
fn(line);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
opened.onEnd = () => {
|
|
79
|
+
for (const line of lines.flush()) {
|
|
80
|
+
for (const fn of listeners)
|
|
81
|
+
fn(line);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
for (const line of queued.splice(0))
|
|
85
|
+
void opened.write(`${line}\n`).catch(() => { });
|
|
86
|
+
}, () => { dead = true; });
|
|
87
|
+
return {
|
|
88
|
+
onFrame: (fn) => {
|
|
89
|
+
listeners.add(fn);
|
|
90
|
+
return () => { listeners.delete(fn); };
|
|
91
|
+
},
|
|
92
|
+
send: (line) => {
|
|
93
|
+
if (s !== undefined)
|
|
94
|
+
void s.write(`${line}\n`).catch(() => { });
|
|
95
|
+
else if (!dead)
|
|
96
|
+
queued.push(line);
|
|
97
|
+
},
|
|
98
|
+
close: () => { dead = true; s?.end(); },
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export function herdrDevice(link) {
|
|
102
|
+
if (!link)
|
|
103
|
+
throw new Error('herdr: herdrDevice needs a link');
|
|
104
|
+
return {
|
|
105
|
+
state: () => link.request('hd.state', {}),
|
|
106
|
+
tree: () => link.request('hd.tree', {}),
|
|
107
|
+
startAgent: (o) => link.request('hd.agent.start', o),
|
|
108
|
+
prompt: (paneId, text) => link.request('hd.prompt', { paneId, text }),
|
|
109
|
+
keys: async (paneId, keys) => {
|
|
110
|
+
await link.request('hd.keys', { paneId, keys });
|
|
111
|
+
},
|
|
112
|
+
read: (paneId, o) => link.request('hd.read', { paneId, ...o }),
|
|
113
|
+
blocked: () => link.request('hd.blocked', {}),
|
|
114
|
+
answer: async (paneId, keys, revision) => {
|
|
115
|
+
await link.request('hd.answer', { paneId, keys, revision });
|
|
116
|
+
},
|
|
117
|
+
close: async (o) => {
|
|
118
|
+
await link.request('hd.close', o);
|
|
119
|
+
},
|
|
120
|
+
events: () => streamFrames(link, 'hd.events', {}),
|
|
121
|
+
registerNotices: async (seed) => {
|
|
122
|
+
await link.request('hd.notices.register', { boxPublicKey: boxPublicKeyB64(seed) });
|
|
123
|
+
},
|
|
124
|
+
openNotice: (data, seed) => openNotice(data, seed),
|
|
125
|
+
call: (method, params) => link.request('hd.call', { method, params }),
|
|
126
|
+
terminal: (paneId, o) => terminalHandle(link.stream('hd.terminal', { paneId, ...o })),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
export interface HerdrEvents {
|
|
2
|
+
'layout.updated': LayoutUpdatedData;
|
|
3
|
+
'pane.agent_detected': PaneAgentDetectedData;
|
|
4
|
+
'pane.agent_status_changed': PaneAgentStatusChangedEvent;
|
|
5
|
+
'pane.closed': PaneClosedData;
|
|
6
|
+
'pane.created': PaneCreatedData;
|
|
7
|
+
'pane.exited': PaneExitedData;
|
|
8
|
+
'pane.focused': PaneFocusedData;
|
|
9
|
+
'pane.moved': PaneMovedData;
|
|
10
|
+
'pane.output_matched': PaneOutputMatchedEvent;
|
|
11
|
+
'pane.scroll_changed': PaneScrollChangedEvent;
|
|
12
|
+
'pane.updated': PaneUpdatedData;
|
|
13
|
+
'tab.closed': TabClosedData;
|
|
14
|
+
'tab.created': TabCreatedData;
|
|
15
|
+
'tab.focused': TabFocusedData;
|
|
16
|
+
'tab.moved': TabMovedData;
|
|
17
|
+
'tab.renamed': TabRenamedData;
|
|
18
|
+
'workspace.closed': WorkspaceClosedData;
|
|
19
|
+
'workspace.created': WorkspaceCreatedData;
|
|
20
|
+
'workspace.focused': WorkspaceFocusedData;
|
|
21
|
+
'workspace.metadata_updated': WorkspaceMetadataUpdatedData;
|
|
22
|
+
'workspace.moved': WorkspaceMovedData;
|
|
23
|
+
'workspace.renamed': WorkspaceRenamedData;
|
|
24
|
+
'workspace.reordered': WorkspaceReorderedData;
|
|
25
|
+
'workspace.updated': WorkspaceUpdatedData;
|
|
26
|
+
'worktree.created': WorktreeCreatedData;
|
|
27
|
+
'worktree.opened': WorktreeOpenedData;
|
|
28
|
+
'worktree.removed': WorktreeRemovedData;
|
|
29
|
+
}
|
|
30
|
+
export interface HerdrEventFilters {
|
|
31
|
+
'pane.agent_status_changed': PaneAgentStatusChangedFilter;
|
|
32
|
+
'pane.output_matched': PaneOutputMatchedFilter;
|
|
33
|
+
'pane.scroll_changed': PaneScrollChangedFilter;
|
|
34
|
+
}
|
|
35
|
+
export type HerdrEventName = keyof HerdrEvents;
|
|
36
|
+
export type HerdrEventOf<E extends HerdrEventName> = HerdrEvents[E];
|
|
37
|
+
export type HerdrSubscription<E extends HerdrEventName = HerdrEventName> = {
|
|
38
|
+
type: E;
|
|
39
|
+
} & (E extends keyof HerdrEventFilters ? HerdrEventFilters[E] : unknown);
|
|
40
|
+
export type SplitDirection = "right" | "down";
|
|
41
|
+
export type AgentStatus = "idle" | "working" | "blocked" | "done" | "unknown";
|
|
42
|
+
export type AgentSessionRefKind = "id" | "path";
|
|
43
|
+
export type ReadFormat = "text" | "ansi";
|
|
44
|
+
export type ReadSource = "visible" | "recent" | "recent_unwrapped" | "detection";
|
|
45
|
+
export type OutputMatch = {
|
|
46
|
+
type: "substring";
|
|
47
|
+
value: string;
|
|
48
|
+
[k: string]: unknown;
|
|
49
|
+
} | {
|
|
50
|
+
type: "regex";
|
|
51
|
+
value: string;
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
export interface LayoutUpdatedData {
|
|
55
|
+
layout: EventPaneLayoutSnapshot;
|
|
56
|
+
type: "layout_updated";
|
|
57
|
+
[k: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface EventPaneLayoutSnapshot {
|
|
60
|
+
area: PaneLayoutRect;
|
|
61
|
+
focused_pane_id: string;
|
|
62
|
+
panes: EventPaneLayoutPane[];
|
|
63
|
+
splits: EventPaneLayoutSplit[];
|
|
64
|
+
tab_id: string;
|
|
65
|
+
workspace_id: string;
|
|
66
|
+
zoomed: boolean;
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface PaneLayoutRect {
|
|
70
|
+
height: number;
|
|
71
|
+
width: number;
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
export interface EventPaneLayoutPane {
|
|
77
|
+
focused: boolean;
|
|
78
|
+
pane_id: string;
|
|
79
|
+
rect: PaneLayoutRect;
|
|
80
|
+
[k: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface EventPaneLayoutSplit {
|
|
83
|
+
direction: SplitDirection;
|
|
84
|
+
id: string;
|
|
85
|
+
ratio: number;
|
|
86
|
+
rect: PaneLayoutRect;
|
|
87
|
+
[k: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface PaneAgentDetectedData {
|
|
90
|
+
agent?: string | null;
|
|
91
|
+
final_status?: AgentStatus | null;
|
|
92
|
+
pane_id: string;
|
|
93
|
+
released?: boolean;
|
|
94
|
+
type: "pane_agent_detected";
|
|
95
|
+
workspace_id: string;
|
|
96
|
+
[k: string]: unknown;
|
|
97
|
+
}
|
|
98
|
+
export interface PaneAgentStatusChangedEvent {
|
|
99
|
+
agent?: string | null;
|
|
100
|
+
agent_status: AgentStatus;
|
|
101
|
+
display_agent?: string | null;
|
|
102
|
+
pane_id: string;
|
|
103
|
+
state_labels?: {
|
|
104
|
+
[k: string]: string;
|
|
105
|
+
};
|
|
106
|
+
title?: string | null;
|
|
107
|
+
workspace_id: string;
|
|
108
|
+
[k: string]: unknown;
|
|
109
|
+
}
|
|
110
|
+
export interface PaneAgentStatusChangedFilter {
|
|
111
|
+
agent_status?: AgentStatus | null;
|
|
112
|
+
pane_id: string;
|
|
113
|
+
[k: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
export interface PaneClosedData {
|
|
116
|
+
pane_id: string;
|
|
117
|
+
type: "pane_closed";
|
|
118
|
+
workspace_id: string;
|
|
119
|
+
[k: string]: unknown;
|
|
120
|
+
}
|
|
121
|
+
export interface PaneCreatedData {
|
|
122
|
+
pane: EventPaneInfo;
|
|
123
|
+
type: "pane_created";
|
|
124
|
+
[k: string]: unknown;
|
|
125
|
+
}
|
|
126
|
+
export interface EventPaneInfo {
|
|
127
|
+
agent?: string | null;
|
|
128
|
+
agent_session?: EventAgentSessionInfo | null;
|
|
129
|
+
agent_status: AgentStatus;
|
|
130
|
+
cwd?: string | null;
|
|
131
|
+
display_agent?: string | null;
|
|
132
|
+
focused: boolean;
|
|
133
|
+
foreground_cwd?: string | null;
|
|
134
|
+
label?: string | null;
|
|
135
|
+
pane_id: string;
|
|
136
|
+
revision: number;
|
|
137
|
+
scroll?: PaneScrollInfo | null;
|
|
138
|
+
state_labels?: {
|
|
139
|
+
[k: string]: string;
|
|
140
|
+
};
|
|
141
|
+
tab_id: string;
|
|
142
|
+
terminal_id: string;
|
|
143
|
+
terminal_title?: string | null;
|
|
144
|
+
terminal_title_stripped?: string | null;
|
|
145
|
+
title?: string | null;
|
|
146
|
+
tokens?: {
|
|
147
|
+
[k: string]: string;
|
|
148
|
+
};
|
|
149
|
+
workspace_id: string;
|
|
150
|
+
[k: string]: unknown;
|
|
151
|
+
}
|
|
152
|
+
export interface EventAgentSessionInfo {
|
|
153
|
+
agent: string;
|
|
154
|
+
kind: AgentSessionRefKind;
|
|
155
|
+
source: string;
|
|
156
|
+
value: string;
|
|
157
|
+
[k: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
export interface PaneScrollInfo {
|
|
160
|
+
max_offset_from_bottom: number;
|
|
161
|
+
offset_from_bottom: number;
|
|
162
|
+
viewport_rows: number;
|
|
163
|
+
[k: string]: unknown;
|
|
164
|
+
}
|
|
165
|
+
export interface PaneExitedData {
|
|
166
|
+
pane_id: string;
|
|
167
|
+
type: "pane_exited";
|
|
168
|
+
workspace_id: string;
|
|
169
|
+
[k: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
export interface PaneFocusedData {
|
|
172
|
+
pane_id: string;
|
|
173
|
+
type: "pane_focused";
|
|
174
|
+
workspace_id: string;
|
|
175
|
+
[k: string]: unknown;
|
|
176
|
+
}
|
|
177
|
+
export interface PaneMovedData {
|
|
178
|
+
closed_tab_id?: string | null;
|
|
179
|
+
closed_workspace_id?: string | null;
|
|
180
|
+
created_tab?: EventTabInfo | null;
|
|
181
|
+
created_workspace?: EventWorkspaceInfo | null;
|
|
182
|
+
pane: EventPaneInfo;
|
|
183
|
+
previous_pane_id: string;
|
|
184
|
+
previous_tab_id: string;
|
|
185
|
+
previous_workspace_id: string;
|
|
186
|
+
type: "pane_moved";
|
|
187
|
+
[k: string]: unknown;
|
|
188
|
+
}
|
|
189
|
+
export interface EventTabInfo {
|
|
190
|
+
agent_status: AgentStatus;
|
|
191
|
+
focused: boolean;
|
|
192
|
+
label: string;
|
|
193
|
+
number: number;
|
|
194
|
+
pane_count: number;
|
|
195
|
+
tab_id: string;
|
|
196
|
+
workspace_id: string;
|
|
197
|
+
[k: string]: unknown;
|
|
198
|
+
}
|
|
199
|
+
export interface EventWorkspaceInfo {
|
|
200
|
+
active_tab_id: string;
|
|
201
|
+
agent_status: AgentStatus;
|
|
202
|
+
focused: boolean;
|
|
203
|
+
label: string;
|
|
204
|
+
number: number;
|
|
205
|
+
pane_count: number;
|
|
206
|
+
tab_count: number;
|
|
207
|
+
tokens?: {
|
|
208
|
+
[k: string]: string;
|
|
209
|
+
};
|
|
210
|
+
workspace_id: string;
|
|
211
|
+
worktree?: WorkspaceWorktreeInfo | null;
|
|
212
|
+
[k: string]: unknown;
|
|
213
|
+
}
|
|
214
|
+
export interface WorkspaceWorktreeInfo {
|
|
215
|
+
checkout_path: string;
|
|
216
|
+
is_linked_worktree: boolean;
|
|
217
|
+
repo_key: string;
|
|
218
|
+
repo_name: string;
|
|
219
|
+
repo_root: string;
|
|
220
|
+
[k: string]: unknown;
|
|
221
|
+
}
|
|
222
|
+
export interface PaneOutputMatchedEvent {
|
|
223
|
+
matched_line: string;
|
|
224
|
+
pane_id: string;
|
|
225
|
+
read: SubscriptionPaneReadResult;
|
|
226
|
+
[k: string]: unknown;
|
|
227
|
+
}
|
|
228
|
+
export interface SubscriptionPaneReadResult {
|
|
229
|
+
format: ReadFormat;
|
|
230
|
+
pane_id: string;
|
|
231
|
+
revision: number;
|
|
232
|
+
source: ReadSource;
|
|
233
|
+
tab_id: string;
|
|
234
|
+
text: string;
|
|
235
|
+
truncated: boolean;
|
|
236
|
+
workspace_id: string;
|
|
237
|
+
[k: string]: unknown;
|
|
238
|
+
}
|
|
239
|
+
export interface PaneOutputMatchedFilter {
|
|
240
|
+
lines?: number | null;
|
|
241
|
+
match: OutputMatch;
|
|
242
|
+
pane_id: string;
|
|
243
|
+
source: ReadSource;
|
|
244
|
+
strip_ansi?: boolean;
|
|
245
|
+
[k: string]: unknown;
|
|
246
|
+
}
|
|
247
|
+
export interface PaneScrollChangedEvent {
|
|
248
|
+
pane_id: string;
|
|
249
|
+
scroll: PaneScrollInfo;
|
|
250
|
+
workspace_id: string;
|
|
251
|
+
[k: string]: unknown;
|
|
252
|
+
}
|
|
253
|
+
export interface PaneScrollChangedFilter {
|
|
254
|
+
pane_id: string;
|
|
255
|
+
[k: string]: unknown;
|
|
256
|
+
}
|
|
257
|
+
export interface PaneUpdatedData {
|
|
258
|
+
pane: EventPaneInfo;
|
|
259
|
+
type: "pane_updated";
|
|
260
|
+
[k: string]: unknown;
|
|
261
|
+
}
|
|
262
|
+
export interface TabClosedData {
|
|
263
|
+
tab_id: string;
|
|
264
|
+
type: "tab_closed";
|
|
265
|
+
workspace_id: string;
|
|
266
|
+
[k: string]: unknown;
|
|
267
|
+
}
|
|
268
|
+
export interface TabCreatedData {
|
|
269
|
+
tab: EventTabInfo;
|
|
270
|
+
type: "tab_created";
|
|
271
|
+
[k: string]: unknown;
|
|
272
|
+
}
|
|
273
|
+
export interface TabFocusedData {
|
|
274
|
+
tab_id: string;
|
|
275
|
+
type: "tab_focused";
|
|
276
|
+
workspace_id: string;
|
|
277
|
+
[k: string]: unknown;
|
|
278
|
+
}
|
|
279
|
+
export interface TabMovedData {
|
|
280
|
+
insert_index: number;
|
|
281
|
+
tab_id: string;
|
|
282
|
+
tabs: EventTabInfo[];
|
|
283
|
+
type: "tab_moved";
|
|
284
|
+
workspace_id: string;
|
|
285
|
+
[k: string]: unknown;
|
|
286
|
+
}
|
|
287
|
+
export interface TabRenamedData {
|
|
288
|
+
label: string;
|
|
289
|
+
tab_id: string;
|
|
290
|
+
type: "tab_renamed";
|
|
291
|
+
workspace_id: string;
|
|
292
|
+
[k: string]: unknown;
|
|
293
|
+
}
|
|
294
|
+
export interface WorkspaceClosedData {
|
|
295
|
+
type: "workspace_closed";
|
|
296
|
+
workspace?: EventWorkspaceInfo | null;
|
|
297
|
+
workspace_id: string;
|
|
298
|
+
[k: string]: unknown;
|
|
299
|
+
}
|
|
300
|
+
export interface WorkspaceCreatedData {
|
|
301
|
+
type: "workspace_created";
|
|
302
|
+
workspace: EventWorkspaceInfo;
|
|
303
|
+
[k: string]: unknown;
|
|
304
|
+
}
|
|
305
|
+
export interface WorkspaceFocusedData {
|
|
306
|
+
type: "workspace_focused";
|
|
307
|
+
workspace_id: string;
|
|
308
|
+
[k: string]: unknown;
|
|
309
|
+
}
|
|
310
|
+
export interface WorkspaceMetadataUpdatedData {
|
|
311
|
+
type: "workspace_metadata_updated";
|
|
312
|
+
workspace: EventWorkspaceInfo;
|
|
313
|
+
[k: string]: unknown;
|
|
314
|
+
}
|
|
315
|
+
export interface WorkspaceMovedData {
|
|
316
|
+
insert_index: number;
|
|
317
|
+
type: "workspace_moved";
|
|
318
|
+
workspace_id: string;
|
|
319
|
+
workspaces: EventWorkspaceInfo[];
|
|
320
|
+
[k: string]: unknown;
|
|
321
|
+
}
|
|
322
|
+
export interface WorkspaceRenamedData {
|
|
323
|
+
label: string;
|
|
324
|
+
type: "workspace_renamed";
|
|
325
|
+
workspace_id: string;
|
|
326
|
+
[k: string]: unknown;
|
|
327
|
+
}
|
|
328
|
+
export interface WorkspaceReorderedData {
|
|
329
|
+
before_workspace_id?: string | null;
|
|
330
|
+
type: "workspace_reordered";
|
|
331
|
+
workspace_ids: string[];
|
|
332
|
+
workspaces: EventWorkspaceInfo[];
|
|
333
|
+
[k: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
export interface WorkspaceUpdatedData {
|
|
336
|
+
type: "workspace_updated";
|
|
337
|
+
workspace: EventWorkspaceInfo;
|
|
338
|
+
[k: string]: unknown;
|
|
339
|
+
}
|
|
340
|
+
export interface WorktreeCreatedData {
|
|
341
|
+
type: "worktree_created";
|
|
342
|
+
workspace: EventWorkspaceInfo;
|
|
343
|
+
worktree: WorktreeInfo;
|
|
344
|
+
[k: string]: unknown;
|
|
345
|
+
}
|
|
346
|
+
export interface WorktreeInfo {
|
|
347
|
+
branch?: string | null;
|
|
348
|
+
is_bare: boolean;
|
|
349
|
+
is_detached: boolean;
|
|
350
|
+
is_linked_worktree: boolean;
|
|
351
|
+
is_prunable: boolean;
|
|
352
|
+
label: string;
|
|
353
|
+
open_workspace_id?: string | null;
|
|
354
|
+
path: string;
|
|
355
|
+
[k: string]: unknown;
|
|
356
|
+
}
|
|
357
|
+
export interface WorktreeOpenedData {
|
|
358
|
+
already_open: boolean;
|
|
359
|
+
type: "worktree_opened";
|
|
360
|
+
workspace: EventWorkspaceInfo;
|
|
361
|
+
worktree: WorktreeInfo;
|
|
362
|
+
[k: string]: unknown;
|
|
363
|
+
}
|
|
364
|
+
export interface WorktreeRemovedData {
|
|
365
|
+
forced: boolean;
|
|
366
|
+
type: "worktree_removed";
|
|
367
|
+
workspace?: EventWorkspaceInfo | null;
|
|
368
|
+
workspace_id: string;
|
|
369
|
+
worktree: WorktreeInfo;
|
|
370
|
+
[k: string]: unknown;
|
|
371
|
+
}
|