@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
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"herdr": "0.9.1",
|
|
3
|
+
"protocol": 22,
|
|
4
|
+
"schemaVersion": 1,
|
|
5
|
+
"methods": 103,
|
|
6
|
+
"events": 27,
|
|
7
|
+
"missing": [],
|
|
8
|
+
"unmatched": [
|
|
9
|
+
{
|
|
10
|
+
"method": "agent.focus",
|
|
11
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"method": "agent.read",
|
|
15
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"method": "agent.send_keys",
|
|
19
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"method": "command.invoke",
|
|
23
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"method": "pane.graphics.set",
|
|
27
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"method": "popup.close",
|
|
31
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"method": "product_announcement.dismiss",
|
|
35
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"method": "release_notes.dismiss",
|
|
39
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"method": "server.live_handoff",
|
|
43
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"method": "server.stop",
|
|
47
|
+
"why": "result type not determined by the snapshot (naming rules, docs and lab probe)"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { HERDR_VERSION, HERDR_PROTOCOL } from './constants.ts';
|
|
2
|
+
export { HerdrKit } from './kit.ts';
|
|
3
|
+
export type { AgentRef, AgentStatus, BlockedAgent, HerdrEvent, HerdrEventName, HerdrEventOf, HerdrKitOptions, HerdrMethod, HerdrMethods, HerdrParams, HerdrResult, HerdrSnapshot, HerdrState, HerdrSubscription, HerdrTransport, PromptReceipt, StartAgent, TerminalSession, } from './types.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// `@byokit/herdr` — the Herdr runtime kit (Node host side). The phone and browser side lives in `./device`, the
|
|
2
|
+
// host-side link adapter in `./link`; the fake Herdr and contract suite arrive with H6 in `./testing`.
|
|
3
|
+
export { HERDR_VERSION, HERDR_PROTOCOL } from "./constants.js";
|
|
4
|
+
export { HerdrKit } from "./kit.js";
|
package/dist/kit.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AgentRef, AgentStatus, BlockedAgent, HerdrEventName, HerdrEventOf, HerdrKitOptions, HerdrMethod, HerdrParams, HerdrResult, HerdrSnapshot, HerdrState, HerdrSubscription, PromptReceipt, StartAgent, TerminalSession } from './types.ts';
|
|
2
|
+
export declare class HerdrKit {
|
|
3
|
+
private readonly supervisor;
|
|
4
|
+
private transport?;
|
|
5
|
+
private current;
|
|
6
|
+
private tree;
|
|
7
|
+
private listeners;
|
|
8
|
+
private stops;
|
|
9
|
+
private statusStops;
|
|
10
|
+
private generation;
|
|
11
|
+
private readonly o;
|
|
12
|
+
private readonly callAny;
|
|
13
|
+
private readonly agents;
|
|
14
|
+
private readonly blockedList;
|
|
15
|
+
constructor(o: HerdrKitOptions);
|
|
16
|
+
get state(): HerdrState;
|
|
17
|
+
private publish;
|
|
18
|
+
private update;
|
|
19
|
+
private bootstrap;
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
stop(): Promise<void>;
|
|
22
|
+
call<M extends HerdrMethod>(method: M, params: HerdrParams<M>, o?: {
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
}): Promise<HerdrResult<M>>;
|
|
25
|
+
subscribe<E extends HerdrEventName>(subs: HerdrSubscription<E>[], on: (e: HerdrEventOf<E>) => void): () => void;
|
|
26
|
+
cli(args: string[], o?: {
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
stdout: string;
|
|
30
|
+
stderr: string;
|
|
31
|
+
exitCode: number | null;
|
|
32
|
+
timedOut: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
terminal(paneId: string, o: {
|
|
35
|
+
mode: 'control' | 'observe';
|
|
36
|
+
cols: number;
|
|
37
|
+
rows: number;
|
|
38
|
+
}): TerminalSession;
|
|
39
|
+
snapshot(): HerdrSnapshot;
|
|
40
|
+
onChange(fn: (s: HerdrSnapshot) => void): () => void;
|
|
41
|
+
startAgent(o: StartAgent): Promise<AgentRef>;
|
|
42
|
+
prompt(target: AgentRef, text: string, o?: {
|
|
43
|
+
wait?: {
|
|
44
|
+
until?: AgentStatus[];
|
|
45
|
+
timeoutMs: number;
|
|
46
|
+
};
|
|
47
|
+
}): Promise<PromptReceipt>;
|
|
48
|
+
sendKeys(target: AgentRef, keys: string[]): Promise<void>;
|
|
49
|
+
wait(target: AgentRef, o: {
|
|
50
|
+
until?: AgentStatus[];
|
|
51
|
+
timeoutMs: number;
|
|
52
|
+
}): Promise<AgentStatus>;
|
|
53
|
+
read(paneId: string, o?: {
|
|
54
|
+
source?: 'visible' | 'recent' | 'recent_unwrapped' | 'detection';
|
|
55
|
+
lines?: number;
|
|
56
|
+
ansi?: boolean;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
text: string;
|
|
59
|
+
truncated: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
blocked(): BlockedAgent[];
|
|
62
|
+
onBlocked(fn: (b: BlockedAgent, change: 'added' | 'resolved') => void): () => void;
|
|
63
|
+
answer(paneId: string, keys: string[], o: {
|
|
64
|
+
revision: number;
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
closePane(paneId: string): Promise<void>;
|
|
67
|
+
closeTab(tabId: string): Promise<void>;
|
|
68
|
+
closeWorkspace(workspaceId: string): Promise<void>;
|
|
69
|
+
agentKinds(): Promise<string[]>;
|
|
70
|
+
installedAgentKinds(kinds: readonly string[], o: {
|
|
71
|
+
path: string[];
|
|
72
|
+
}): string[];
|
|
73
|
+
}
|
package/dist/kit.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createAgents } from "./agents.js";
|
|
2
|
+
import { Blocked } from "./approvals.js";
|
|
3
|
+
import { runCli } from "./cli.js";
|
|
4
|
+
import { openTerminal } from "./terminal.js";
|
|
5
|
+
import { HERDR_PROTOCOL } from "./constants.js";
|
|
6
|
+
import { closePane, closeTab, closeWorkspace } from "./close.js";
|
|
7
|
+
import { Supervisor } from "./supervise.js";
|
|
8
|
+
const kinds = ['pane.agent_detected', 'pane.created', 'pane.closed', 'pane.moved', 'pane.exited', 'pane.updated',
|
|
9
|
+
'workspace.created', 'workspace.closed', 'workspace.renamed', 'workspace.updated', 'tab.created', 'tab.closed', 'tab.renamed'];
|
|
10
|
+
const empty = () => ({ connected: false, workspaces: [] });
|
|
11
|
+
export class HerdrKit {
|
|
12
|
+
supervisor;
|
|
13
|
+
transport;
|
|
14
|
+
current = { phase: 'stopped' };
|
|
15
|
+
tree = empty();
|
|
16
|
+
listeners = new Set();
|
|
17
|
+
stops = new Set();
|
|
18
|
+
statusStops = new Set();
|
|
19
|
+
generation = 0;
|
|
20
|
+
o;
|
|
21
|
+
callAny = (method, params, timeoutMs) => this.call(method, params, timeoutMs === undefined ? undefined : { timeoutMs });
|
|
22
|
+
agents;
|
|
23
|
+
blockedList;
|
|
24
|
+
constructor(o) {
|
|
25
|
+
this.o = o;
|
|
26
|
+
this.supervisor = new Supervisor(o, (s) => { this.current = s; o.onState?.(s); });
|
|
27
|
+
this.agents = createAgents({ call: this.callAny, snapshot: () => this.snapshot() });
|
|
28
|
+
this.blockedList = new Blocked({ call: this.callAny });
|
|
29
|
+
}
|
|
30
|
+
get state() { return this.current; }
|
|
31
|
+
publish() { for (const fn of this.listeners)
|
|
32
|
+
fn(this.snapshot()); }
|
|
33
|
+
update(e) {
|
|
34
|
+
const raw = e;
|
|
35
|
+
const paneId = (raw.pane_id ?? raw.pane?.pane_id);
|
|
36
|
+
let owner;
|
|
37
|
+
let pane;
|
|
38
|
+
for (const w of this.tree.workspaces) {
|
|
39
|
+
for (const t of w.tabs) {
|
|
40
|
+
const found = t.panes.find((p) => p.id === paneId);
|
|
41
|
+
if (found !== undefined) {
|
|
42
|
+
pane = found;
|
|
43
|
+
owner = { workspaceId: w.id, tabId: t.id };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (pane !== undefined && owner !== undefined &&
|
|
48
|
+
(e.type === 'pane.agent_status_changed' || e.type === 'pane.agent_detected' || e.type === 'pane.updated')) {
|
|
49
|
+
const a = raw.agent ?? raw.pane ?? raw;
|
|
50
|
+
pane.agent = { status: 'unknown', revision: 0, ...pane.agent,
|
|
51
|
+
...(a.agent !== undefined ? { kind: a.agent } : {}),
|
|
52
|
+
...(a.agent_status !== undefined ? { status: a.agent_status } : {}),
|
|
53
|
+
...(a.revision !== undefined ? { revision: a.revision } : {}),
|
|
54
|
+
...(a.launch_pending !== undefined ? { launchPending: a.launch_pending } : {}),
|
|
55
|
+
...(a.interactive_ready !== undefined ? { interactiveReady: a.interactive_ready } : {}),
|
|
56
|
+
};
|
|
57
|
+
this.blockedList.update(paneId, pane.agent, owner);
|
|
58
|
+
}
|
|
59
|
+
if (e.type === 'pane.closed') {
|
|
60
|
+
this.blockedList.update(paneId, undefined, owner ?? { workspaceId: '', tabId: '' });
|
|
61
|
+
for (const tab of this.tree.workspaces.flatMap((w) => w.tabs))
|
|
62
|
+
tab.panes = tab.panes.filter((p) => p.id !== paneId);
|
|
63
|
+
}
|
|
64
|
+
if (e.type === 'tab.closed')
|
|
65
|
+
for (const w of this.tree.workspaces)
|
|
66
|
+
w.tabs = w.tabs.filter((t) => t.id !== raw.tab_id);
|
|
67
|
+
if (e.type === 'workspace.closed')
|
|
68
|
+
this.tree.workspaces = this.tree.workspaces.filter((w) => w.id !== raw.workspace_id);
|
|
69
|
+
this.publish();
|
|
70
|
+
}
|
|
71
|
+
async bootstrap(token, buffered) {
|
|
72
|
+
const result = await this.transport.call('session.snapshot', {});
|
|
73
|
+
if (token !== this.generation)
|
|
74
|
+
return;
|
|
75
|
+
const snap = result.snapshot;
|
|
76
|
+
if ((snap.protocol !== undefined && snap.protocol !== HERDR_PROTOCOL) ||
|
|
77
|
+
(result.protocol !== undefined && result.protocol !== HERDR_PROTOCOL)) {
|
|
78
|
+
this.current = { phase: 'needs-update', why: 'version' };
|
|
79
|
+
this.o.onState?.(this.current);
|
|
80
|
+
throw new Error('herdr: snapshot protocol mismatch');
|
|
81
|
+
}
|
|
82
|
+
const workspaces = snap.workspaces.map((w) => ({
|
|
83
|
+
id: w.workspace_id, label: w.label,
|
|
84
|
+
tabs: snap.tabs.filter((t) => t.workspace_id === w.workspace_id).map((t) => ({
|
|
85
|
+
id: t.tab_id, label: t.label,
|
|
86
|
+
panes: snap.panes.filter((p) => p.tab_id === t.tab_id).map((p) => {
|
|
87
|
+
const a = snap.agents.find((a) => a.pane_id === p.pane_id);
|
|
88
|
+
return { id: p.pane_id, cwd: p.cwd, ...(a ? { agent: {
|
|
89
|
+
kind: a.agent, name: a.name,
|
|
90
|
+
status: (a.agent_status ?? 'unknown'), revision: (a.revision ?? 0),
|
|
91
|
+
launchPending: a.launch_pending, interactiveReady: a.interactive_ready,
|
|
92
|
+
} } : {}) };
|
|
93
|
+
}),
|
|
94
|
+
})),
|
|
95
|
+
}));
|
|
96
|
+
for (const stop of this.statusStops) {
|
|
97
|
+
stop();
|
|
98
|
+
this.stops.delete(stop);
|
|
99
|
+
}
|
|
100
|
+
this.statusStops.clear();
|
|
101
|
+
this.tree = { connected: true, workspaces };
|
|
102
|
+
for (const event of buffered.splice(0))
|
|
103
|
+
this.update(event);
|
|
104
|
+
// Agents already blocked in the snapshot join the list; entries whose pane is gone resolve.
|
|
105
|
+
for (const entry of this.blockedList.list()) {
|
|
106
|
+
const still = this.tree.workspaces.some((w) => w.tabs.some((t) => t.panes.some((p) => p.id === entry.paneId)));
|
|
107
|
+
if (!still)
|
|
108
|
+
this.blockedList.update(entry.paneId, undefined, entry);
|
|
109
|
+
}
|
|
110
|
+
for (const w of this.tree.workspaces)
|
|
111
|
+
for (const t of w.tabs)
|
|
112
|
+
for (const p of t.panes) {
|
|
113
|
+
if (p.agent?.status === 'blocked')
|
|
114
|
+
this.blockedList.update(p.id, p.agent, { workspaceId: w.id, tabId: t.id });
|
|
115
|
+
}
|
|
116
|
+
this.publish();
|
|
117
|
+
for (const pane of this.tree.workspaces.flatMap((w) => w.tabs).flatMap((t) => t.panes)) {
|
|
118
|
+
if (!pane.agent)
|
|
119
|
+
continue;
|
|
120
|
+
const stop = this.transport.subscribe([{ type: 'pane.agent_status_changed', pane_id: pane.id }], (e) => this.update(e), () => { });
|
|
121
|
+
this.stops.add(stop);
|
|
122
|
+
this.statusStops.add(stop);
|
|
123
|
+
}
|
|
124
|
+
this.current = { phase: 'ready' };
|
|
125
|
+
this.o.onState?.(this.current);
|
|
126
|
+
}
|
|
127
|
+
async start() {
|
|
128
|
+
const token = ++this.generation;
|
|
129
|
+
this.transport = await this.supervisor.start();
|
|
130
|
+
const buffered = [];
|
|
131
|
+
let booting = true;
|
|
132
|
+
const refresh = () => {
|
|
133
|
+
if (token !== this.generation || booting)
|
|
134
|
+
return;
|
|
135
|
+
booting = true;
|
|
136
|
+
void this.bootstrap(token, buffered).then(() => { booting = false; }).catch(() => { booting = false; });
|
|
137
|
+
};
|
|
138
|
+
const stop = this.transport.subscribe(kinds.map((type) => ({ type })), (e) => {
|
|
139
|
+
if (booting)
|
|
140
|
+
buffered.push(e);
|
|
141
|
+
else if (e.type === 'pane.agent_detected' || /^(pane|tab|workspace)\.(created|closed|moved|renamed)$/.test(e.type)) {
|
|
142
|
+
buffered.push(e);
|
|
143
|
+
refresh();
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
this.update(e);
|
|
147
|
+
}, () => { });
|
|
148
|
+
this.stops.add(stop);
|
|
149
|
+
const control = stop;
|
|
150
|
+
control.onDisconnect?.(() => {
|
|
151
|
+
if (token !== this.generation)
|
|
152
|
+
return;
|
|
153
|
+
this.current = { phase: 'reconnecting' };
|
|
154
|
+
this.o.onState?.(this.current);
|
|
155
|
+
this.tree.connected = false;
|
|
156
|
+
this.publish();
|
|
157
|
+
});
|
|
158
|
+
control.onReconnect?.(refresh);
|
|
159
|
+
if (await control.ready === false)
|
|
160
|
+
throw new Error('herdr: event subscription rejected');
|
|
161
|
+
await this.bootstrap(token, buffered);
|
|
162
|
+
booting = false;
|
|
163
|
+
}
|
|
164
|
+
async stop() {
|
|
165
|
+
++this.generation;
|
|
166
|
+
for (const entry of this.blockedList.list())
|
|
167
|
+
this.blockedList.update(entry.paneId, undefined, entry);
|
|
168
|
+
for (const stop of this.stops)
|
|
169
|
+
stop();
|
|
170
|
+
this.stops.clear();
|
|
171
|
+
this.statusStops.clear();
|
|
172
|
+
await this.supervisor.stop();
|
|
173
|
+
this.transport = undefined;
|
|
174
|
+
this.tree = empty();
|
|
175
|
+
this.publish();
|
|
176
|
+
}
|
|
177
|
+
call(method, params, o) {
|
|
178
|
+
if (!this.transport)
|
|
179
|
+
return Promise.reject(new Error('herdr: not connected'));
|
|
180
|
+
const values = params;
|
|
181
|
+
const wait = values.wait;
|
|
182
|
+
const timeout = o?.timeoutMs ?? (method === 'agent.wait' && typeof values.timeout_ms === 'number'
|
|
183
|
+
? values.timeout_ms + 5000 : method === 'agent.prompt' && typeof wait?.timeout_ms === 'number'
|
|
184
|
+
? wait.timeout_ms + 5000 : undefined);
|
|
185
|
+
return this.transport.call(method, values, timeout);
|
|
186
|
+
}
|
|
187
|
+
subscribe(subs, on) {
|
|
188
|
+
if (!this.transport)
|
|
189
|
+
throw new Error('herdr: not connected');
|
|
190
|
+
return this.transport.subscribe(subs, on, () => { });
|
|
191
|
+
}
|
|
192
|
+
cli(args, o) { return runCli(this.o.bin, this.supervisor.env(), args, o?.timeoutMs); }
|
|
193
|
+
terminal(paneId, o) { return openTerminal(this.o.bin, this.supervisor.env(), paneId, o); }
|
|
194
|
+
snapshot() { return structuredClone(this.tree); }
|
|
195
|
+
onChange(fn) { this.listeners.add(fn); return () => { this.listeners.delete(fn); }; }
|
|
196
|
+
startAgent(o) { return this.agents.startAgent(o); }
|
|
197
|
+
prompt(target, text, o) { return this.agents.prompt(target, text, o); }
|
|
198
|
+
sendKeys(target, keys) { return this.agents.sendKeys(target, keys); }
|
|
199
|
+
wait(target, o) { return this.agents.wait(target, o); }
|
|
200
|
+
read(paneId, o) { return this.agents.read(paneId, o); }
|
|
201
|
+
blocked() { return this.blockedList.list(); }
|
|
202
|
+
onBlocked(fn) { return this.blockedList.on(fn); }
|
|
203
|
+
answer(paneId, keys, o) { return this.blockedList.answer(paneId, keys, o); }
|
|
204
|
+
closePane(paneId) { return closePane(this.callAny, paneId); }
|
|
205
|
+
closeTab(tabId) { return closeTab(this.callAny, tabId); }
|
|
206
|
+
closeWorkspace(workspaceId) { return closeWorkspace(this.callAny, workspaceId); }
|
|
207
|
+
agentKinds() { return this.agents.agentKinds(); }
|
|
208
|
+
installedAgentKinds(kinds, o) { return this.agents.installedAgentKinds(kinds, o); }
|
|
209
|
+
}
|
package/dist/link.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from 'node:http';
|
|
2
|
+
import { type Grant, type Host, type HostOptions } from '@byokit/link';
|
|
3
|
+
import { type ServeIngress, type Via } from '@byokit/reach';
|
|
4
|
+
import type { RelayClient } from '@byokit/relay';
|
|
5
|
+
import type { HerdrKit } from './kit.ts';
|
|
6
|
+
export type HerdrScope = {
|
|
7
|
+
workspaces: 'all' | string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function herdrLink(kit: HerdrKit, o: {
|
|
10
|
+
scopeOf: (grant: Grant) => HerdrScope;
|
|
11
|
+
passThrough?: (method: string, grant: Grant) => boolean;
|
|
12
|
+
relay?: RelayClient;
|
|
13
|
+
}): Pick<HostOptions, 'handle' | 'stream' | 'allow'>;
|
|
14
|
+
export declare function serve(o: {
|
|
15
|
+
host: Host;
|
|
16
|
+
port: number;
|
|
17
|
+
via?: Via;
|
|
18
|
+
previous?: ServeIngress;
|
|
19
|
+
http?: (req: IncomingMessage, res: ServerResponse) => void;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
urls: string[];
|
|
22
|
+
ingress?: ServeIngress;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}>;
|