@phren/cli 0.3.11 → 0.3.13
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/bridge/account-usage.d.ts +124 -0
- package/dist/bridge/account-usage.js +258 -0
- package/dist/bridge/agent-hook-stores.d.ts +3 -0
- package/dist/bridge/agent-hook-stores.js +5 -0
- package/dist/bridge/agent-hooks.d.ts +162 -5
- package/dist/bridge/agent-hooks.js +682 -49
- package/dist/bridge/approval-summary.d.ts +16 -0
- package/dist/bridge/approval-summary.js +133 -0
- package/dist/bridge/authority-command.d.ts +20 -0
- package/dist/bridge/authority-command.js +120 -0
- package/dist/bridge/authority.d.ts +223 -0
- package/dist/bridge/authority.js +231 -0
- package/dist/bridge/claude-account-setup.d.ts +14 -0
- package/dist/bridge/claude-account-setup.js +69 -0
- package/dist/bridge/claude-accounts.d.ts +49 -0
- package/dist/bridge/claude-accounts.js +195 -0
- package/dist/bridge/code-routes.js +2 -2
- package/dist/bridge/codex-app-server.d.ts +144 -0
- package/dist/bridge/codex-app-server.js +319 -0
- package/dist/bridge/codex-auth-refresh.d.ts +33 -0
- package/dist/bridge/codex-auth-refresh.js +71 -0
- package/dist/bridge/codex-hook-trust.d.ts +27 -0
- package/dist/bridge/codex-hook-trust.js +237 -0
- package/dist/bridge/codex-question-reply.d.ts +16 -0
- package/dist/bridge/codex-question-reply.js +57 -0
- package/dist/bridge/codex-review-mode.d.ts +10 -0
- package/dist/bridge/codex-review-mode.js +74 -0
- package/dist/bridge/codex-servers.d.ts +217 -0
- package/dist/bridge/codex-servers.js +636 -0
- package/dist/bridge/command.js +97 -4
- package/dist/bridge/computer-identity.d.ts +75 -0
- package/dist/bridge/computer-identity.js +166 -0
- package/dist/bridge/conductor-group.d.ts +91 -8
- package/dist/bridge/conductor-group.js +105 -9
- package/dist/bridge/conductor-role.d.ts +94 -0
- package/dist/bridge/conductor-role.js +176 -0
- package/dist/bridge/conductor-sets.d.ts +20 -0
- package/dist/bridge/conductor-sets.js +59 -0
- package/dist/bridge/dispatch-command.d.ts +3 -0
- package/dist/bridge/dispatch-command.js +82 -12
- package/dist/bridge/dispatch-returns.d.ts +128 -19
- package/dist/bridge/dispatch-returns.js +371 -54
- package/dist/bridge/dispatch.d.ts +128 -3
- package/dist/bridge/dispatch.js +303 -42
- package/dist/bridge/fanouts.d.ts +7 -1
- package/dist/bridge/fanouts.js +39 -4
- package/dist/bridge/folder-trust.d.ts +56 -0
- package/dist/bridge/folder-trust.js +195 -0
- package/dist/bridge/grants.d.ts +22 -1
- package/dist/bridge/grants.js +57 -9
- package/dist/bridge/hand-off-queue.d.ts +74 -0
- package/dist/bridge/hand-off-queue.js +235 -0
- package/dist/bridge/hand-off.d.ts +30 -10
- package/dist/bridge/hand-off.js +79 -46
- package/dist/bridge/harness-status.d.ts +11 -0
- package/dist/bridge/harness-status.js +32 -0
- package/dist/bridge/harnesses.d.ts +39 -0
- package/dist/bridge/harnesses.js +65 -0
- package/dist/bridge/health.d.ts +2 -0
- package/dist/bridge/health.js +1 -1
- package/dist/bridge/herdr.d.ts +11 -2
- package/dist/bridge/herdr.js +98 -23
- package/dist/bridge/hook-fast.d.ts +4 -0
- package/dist/bridge/hook-fast.js +68 -0
- package/dist/bridge/install.d.ts +16 -1
- package/dist/bridge/install.js +102 -21
- package/dist/bridge/launch-brief.d.ts +96 -0
- package/dist/bridge/launch-brief.js +164 -0
- package/dist/bridge/model-switch.d.ts +3 -0
- package/dist/bridge/model-switch.js +17 -1
- package/dist/bridge/models.d.ts +8 -4
- package/dist/bridge/models.js +24 -8
- package/dist/bridge/mux-wire.d.ts +9 -0
- package/dist/bridge/mux-wire.js +19 -0
- package/dist/bridge/opencode-pane-server.d.ts +113 -0
- package/dist/bridge/opencode-pane-server.js +332 -0
- package/dist/bridge/opencode-panes.d.ts +111 -0
- package/dist/bridge/opencode-panes.js +295 -0
- package/dist/bridge/pane-accounts.d.ts +8 -0
- package/dist/bridge/pane-accounts.js +46 -0
- package/dist/bridge/pane-status.d.ts +12 -0
- package/dist/bridge/pane-status.js +50 -1
- package/dist/bridge/prompt-startup.d.ts +5 -0
- package/dist/bridge/prompt-startup.js +24 -0
- package/dist/bridge/protocol.d.ts +5 -0
- package/dist/bridge/protocol.js +4 -0
- package/dist/bridge/push.d.ts +11 -4
- package/dist/bridge/push.js +27 -4
- package/dist/bridge/questions.d.ts +37 -2
- package/dist/bridge/questions.js +158 -15
- package/dist/bridge/resources.d.ts +9 -3
- package/dist/bridge/resources.js +24 -8
- package/dist/bridge/schedule-format.d.ts +2 -0
- package/dist/bridge/schedule-format.js +3 -0
- package/dist/bridge/schedule-launch.d.ts +2 -1
- package/dist/bridge/schedule-launch.js +27 -53
- package/dist/bridge/schedule-watch.d.ts +24 -1
- package/dist/bridge/schedule-watch.js +89 -2
- package/dist/bridge/server-launch.d.ts +22 -5
- package/dist/bridge/server-launch.js +238 -32
- package/dist/bridge/server-overview.d.ts +10 -3
- package/dist/bridge/server-overview.js +32 -15
- package/dist/bridge/server-pane-routes.d.ts +3 -0
- package/dist/bridge/server-pane-routes.js +150 -18
- package/dist/bridge/server-routes.d.ts +11 -0
- package/dist/bridge/server-routes.js +214 -36
- package/dist/bridge/server-stream.d.ts +2 -0
- package/dist/bridge/server-stream.js +22 -8
- package/dist/bridge/server.d.ts +6 -1
- package/dist/bridge/server.js +58 -13
- package/dist/bridge/session-activity.d.ts +93 -0
- package/dist/bridge/session-activity.js +139 -0
- package/dist/bridge/session-rename.d.ts +48 -0
- package/dist/bridge/session-rename.js +190 -0
- package/dist/bridge/session-servers.js +2 -2
- package/dist/bridge/settings-switch.d.ts +60 -0
- package/dist/bridge/settings-switch.js +287 -0
- package/dist/bridge/speech-voice.d.ts +55 -0
- package/dist/bridge/speech-voice.js +132 -0
- package/dist/bridge/speech.d.ts +70 -11
- package/dist/bridge/speech.js +169 -41
- package/dist/bridge/stalls.d.ts +22 -0
- package/dist/bridge/stalls.js +57 -0
- package/dist/bridge/sudo.d.ts +209 -0
- package/dist/bridge/sudo.js +501 -0
- package/dist/bridge/terminal-herdr.js +9 -3
- package/dist/bridge/terminal-tmux.d.ts +15 -3
- package/dist/bridge/terminal-tmux.js +103 -13
- package/dist/bridge/terminal.d.ts +27 -4
- package/dist/bridge/terminal.js +8 -1
- package/dist/bridge/transcript-claude.d.ts +4 -0
- package/dist/bridge/transcript-claude.js +186 -16
- package/dist/bridge/transcript-codex.d.ts +0 -2
- package/dist/bridge/transcript-codex.js +29 -4
- package/dist/bridge/transcript-preview.d.ts +1 -0
- package/dist/bridge/transcript-preview.js +24 -4
- package/dist/bridge/transcripts.d.ts +15 -2
- package/dist/bridge/transcripts.js +47 -16
- package/dist/bridge/turn-records.d.ts +85 -0
- package/dist/bridge/turn-records.js +143 -0
- package/dist/bridge/uploads.d.ts +3 -0
- package/dist/bridge/uploads.js +14 -0
- package/dist/bridge/usage.d.ts +56 -10
- package/dist/bridge/usage.js +190 -45
- package/dist/bridge-hook.mjs +27975 -20636
- package/dist/cli/claude-unmanaged.d.ts +12 -0
- package/dist/cli/claude-unmanaged.js +105 -0
- package/dist/cli/schedules.js +2 -1
- package/dist/cli/session-start.js +10 -1
- package/dist/cli/session-stop.js +9 -1
- package/dist/cli-registry.js +31 -6
- package/dist/data/task-receipts.d.ts +19 -0
- package/dist/data/task-receipts.js +68 -0
- package/dist/data/tasks.js +4 -1
- package/dist/generated/memory-ui-graph.browser.js +63 -63
- package/dist/graph-core/model.js +24 -3
- package/dist/graph-core/types.d.ts +4 -1
- package/dist/graph-core/types.js +1 -0
- package/dist/init/init-preset.js +7 -3
- package/dist/init/init-uninstall.js +2 -11
- package/dist/init/teardown.d.ts +3 -0
- package/dist/init/teardown.js +47 -0
- package/dist/link/context.js +21 -9
- package/dist/mcp/plugin-mode.js +1 -1
- package/dist/memory-ui-graph.runtime.js +63 -63
- package/dist/modules/code-package.d.ts +1 -0
- package/dist/modules/code-package.js +36 -7
- package/dist/modules/registry.js +17 -16
- package/dist/profile-store.d.ts +6 -0
- package/dist/profile-store.js +25 -1
- package/dist/shell/graph/glyphs.js +4 -0
- package/dist/shell/graph/graph-view.js +2 -0
- package/dist/status.js +7 -1
- package/dist/sync/task-claim.js +3 -2
- package/dist/task/lifecycle.js +25 -4
- package/dist/test-global-setup.js +5 -0
- package/dist/tools/dispatch.js +52 -4
- package/dist/tools/tasks.js +10 -1
- package/package.json +1 -1
- package/plugins/opencode/phren-transcript.js +87 -4
- package/starter/global/AGENTS.md +4 -0
- package/starter/global/skills/conductor/SKILL.md +51 -4
package/dist/bridge/models.js
CHANGED
|
@@ -3,7 +3,8 @@ import { readdir, readFile, stat } from "node:fs/promises";
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { claudeConfigDir } from "../home-paths.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { object, objects } from "./protocol.js";
|
|
6
|
+
import { BridgeError, object, objects } from "./protocol.js";
|
|
7
|
+
import { claudeHome, DEFAULT_ACCOUNT } from "./claude-accounts.js";
|
|
7
8
|
import { codexExecutable } from "./codex-binary.js";
|
|
8
9
|
/** Only initialize and list. Never a thread, a prompt, or a login. */
|
|
9
10
|
export function readCodexModels(executable = codexExecutable()) {
|
|
@@ -237,23 +238,38 @@ export function claudeName(id) {
|
|
|
237
238
|
const name = family.charAt(0).toUpperCase() + family.slice(1) + (version ? ` ${version}` : "");
|
|
238
239
|
return id.endsWith("[1m]") ? `${name} (1M context)` : name;
|
|
239
240
|
}
|
|
240
|
-
/**
|
|
241
|
+
/** The account a request names is not one on this computer (or has no catalogue for that source). */
|
|
242
|
+
export const accountUnavailable = (account) => new BridgeError(404, `"${account}" is not an account on this computer.`, { code: "account_unavailable" });
|
|
243
|
+
/** Catalogues change rarely and app-server takes seconds to start. Cached per
|
|
244
|
+
* `${source}:${account}`; only Claude has accounts, each reading its own home. */
|
|
241
245
|
export class ModelCatalog {
|
|
242
246
|
codex;
|
|
243
247
|
claude;
|
|
244
248
|
opencode;
|
|
249
|
+
cacheMs;
|
|
245
250
|
cache = new Map();
|
|
246
|
-
constructor(codex = () => readCodexModels(), claude =
|
|
251
|
+
constructor(codex = () => readCodexModels(), claude = dir => readClaudeModels(dir), opencode = () => readOpenCodeModels(), cacheMs = 600_000) {
|
|
247
252
|
this.codex = codex;
|
|
248
253
|
this.claude = claude;
|
|
249
254
|
this.opencode = opencode;
|
|
255
|
+
this.cacheMs = cacheMs;
|
|
250
256
|
}
|
|
251
|
-
list(source) {
|
|
252
|
-
const
|
|
253
|
-
|
|
257
|
+
list(source, account) {
|
|
258
|
+
const id = account?.trim() || DEFAULT_ACCOUNT;
|
|
259
|
+
let dir;
|
|
260
|
+
if (source === "claude") {
|
|
261
|
+
const home = claudeHome(id);
|
|
262
|
+
if (!home)
|
|
263
|
+
return Promise.reject(accountUnavailable(id));
|
|
264
|
+
dir = home.isDefault ? undefined : home.dir;
|
|
265
|
+
}
|
|
266
|
+
else if (id !== DEFAULT_ACCOUNT)
|
|
267
|
+
return Promise.reject(accountUnavailable(id));
|
|
268
|
+
const key = `${source}:${id}`, cached = this.cache.get(key);
|
|
269
|
+
if (cached && Date.now() - cached.at < this.cacheMs)
|
|
254
270
|
return cached.value;
|
|
255
|
-
const value = (source === "codex" ? this.codex() : source === "claude" ? this.claude() : source === "opencode" ? this.opencode() : Promise.resolve([])).catch(() => []);
|
|
256
|
-
this.cache.set(
|
|
271
|
+
const value = (source === "codex" ? this.codex() : source === "claude" ? this.claude(dir) : source === "opencode" ? this.opencode() : Promise.resolve([])).catch(() => []);
|
|
272
|
+
this.cache.set(key, { at: Date.now(), value });
|
|
257
273
|
return value;
|
|
258
274
|
}
|
|
259
275
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Json } from "./protocol.js";
|
|
2
|
+
/** Installed phones require the historical Herdr envelope even for tmux.
|
|
3
|
+
* A typed tmux selector opts into the source kind; the additive descriptor
|
|
4
|
+
* remains accurate in both formats. */
|
|
5
|
+
export declare function typedMuxRequest(url: URL): boolean;
|
|
6
|
+
export declare function muxReplyForClient(reply: Json, typed: boolean): Json;
|
|
7
|
+
/** New clients request /v1/muxes?typed=1. Older Hooks ignore that query,
|
|
8
|
+
* so callers must also accept the legacy Herdr aliases. */
|
|
9
|
+
export declare function muxListForClient(muxes: Json[], typed: boolean): Json[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Installed phones require the historical Herdr envelope even for tmux.
|
|
2
|
+
* A typed tmux selector opts into the source kind; the additive descriptor
|
|
3
|
+
* remains accurate in both formats. */
|
|
4
|
+
export function typedMuxRequest(url) {
|
|
5
|
+
return url.searchParams.get("mux")?.startsWith("tmux:") === true;
|
|
6
|
+
}
|
|
7
|
+
export function muxReplyForClient(reply, typed) {
|
|
8
|
+
return !typed && reply.kind === "tmux" ? { ...reply, kind: "herdr" } : reply;
|
|
9
|
+
}
|
|
10
|
+
/** New clients request /v1/muxes?typed=1. Older Hooks ignore that query,
|
|
11
|
+
* so callers must also accept the legacy Herdr aliases. */
|
|
12
|
+
export function muxListForClient(muxes, typed) {
|
|
13
|
+
return muxes.map(mux => {
|
|
14
|
+
if (typed || mux.kind !== "tmux")
|
|
15
|
+
return mux;
|
|
16
|
+
return { ...mux, id: `herdr:${mux.session}`, kind: "herdr",
|
|
17
|
+
mux: { id: mux.id, kind: mux.kind, session: mux.session } };
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export interface PaneServerEntry {
|
|
2
|
+
server: string;
|
|
3
|
+
pane: string;
|
|
4
|
+
port: number;
|
|
5
|
+
password: string;
|
|
6
|
+
pid: number;
|
|
7
|
+
directory: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
/** What the TUI was started with (`--agent`, `--model`, `--variant`), for
|
|
10
|
+
* the first prompt of a session that has no earlier turn to follow. */
|
|
11
|
+
defaults?: {
|
|
12
|
+
agent?: string;
|
|
13
|
+
model?: string;
|
|
14
|
+
variant?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface OpenCodeSession {
|
|
18
|
+
id: string;
|
|
19
|
+
directory?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Set on a subagent's session; the TUI shows its root session. */
|
|
22
|
+
parentID?: string;
|
|
23
|
+
time?: {
|
|
24
|
+
created?: number;
|
|
25
|
+
updated?: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface OpenCodeMessage {
|
|
29
|
+
info?: {
|
|
30
|
+
id?: string;
|
|
31
|
+
role?: string;
|
|
32
|
+
agent?: string;
|
|
33
|
+
model?: {
|
|
34
|
+
providerID?: string;
|
|
35
|
+
modelID?: string;
|
|
36
|
+
variant?: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
parts?: Array<{
|
|
40
|
+
type?: string;
|
|
41
|
+
text?: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export interface OpenCodePermission {
|
|
45
|
+
id: string;
|
|
46
|
+
sessionID?: string;
|
|
47
|
+
permission?: string;
|
|
48
|
+
patterns?: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface OpenCodeQuestion {
|
|
51
|
+
id: string;
|
|
52
|
+
sessionID?: string;
|
|
53
|
+
questions?: unknown[];
|
|
54
|
+
}
|
|
55
|
+
/** The prompt never reached the server (refused, or nothing listening), so
|
|
56
|
+
* the caller may still send it another way without a duplicate. */
|
|
57
|
+
export declare class PromptNotSent extends Error {
|
|
58
|
+
}
|
|
59
|
+
export interface PaneEvent {
|
|
60
|
+
type: string;
|
|
61
|
+
properties?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export type PermissionReply = "once" | "always" | "reject";
|
|
64
|
+
export interface PromptOptions {
|
|
65
|
+
/** `provider/model`; split on the first slash. */
|
|
66
|
+
model?: string;
|
|
67
|
+
agent?: string;
|
|
68
|
+
/** A model variant (reasoning effort), as `opencode --variant` takes it. */
|
|
69
|
+
variant?: string;
|
|
70
|
+
/** Without an explicit model or agent, continue with the ones the
|
|
71
|
+
* session's last user turn used, as the TUI would. */
|
|
72
|
+
inherit?: boolean;
|
|
73
|
+
timeoutMs?: number;
|
|
74
|
+
}
|
|
75
|
+
export type PromptResult = {
|
|
76
|
+
delivered: true;
|
|
77
|
+
messageId: string;
|
|
78
|
+
} | {
|
|
79
|
+
delivered: false;
|
|
80
|
+
reason: "timeout";
|
|
81
|
+
};
|
|
82
|
+
export declare function registerPaneServer(dir: string, entry: PaneServerEntry): string;
|
|
83
|
+
export declare function readPaneServer(dir: string, server: string, pane: string): PaneServerEntry | undefined;
|
|
84
|
+
/** Every registered pane whose OpenCode process is still running. An entry
|
|
85
|
+
* whose process is gone is removed as it is found. */
|
|
86
|
+
export declare function listPaneServers(dir: string): PaneServerEntry[];
|
|
87
|
+
export declare function removePaneServer(dir: string, server: string, pane: string): void;
|
|
88
|
+
export declare function freePort(): Promise<number>;
|
|
89
|
+
export declare function newPassword(): string;
|
|
90
|
+
export interface PaneClient {
|
|
91
|
+
/** True once the server answers an authenticated request within `timeoutMs`. */
|
|
92
|
+
ready(timeoutMs?: number): Promise<boolean>;
|
|
93
|
+
sessions(): Promise<OpenCodeSession[]>;
|
|
94
|
+
session(id: string): Promise<OpenCodeSession | undefined>;
|
|
95
|
+
currentSession(): Promise<OpenCodeSession | undefined>;
|
|
96
|
+
/** A new root session in the pane's directory. The TUI does not show it
|
|
97
|
+
* until `selectSession` moves it there. */
|
|
98
|
+
createSession(): Promise<OpenCodeSession>;
|
|
99
|
+
/** Asks the TUI to show `id`. A TUI still starting drops the request, so
|
|
100
|
+
* the caller checks the pane and asks again. */
|
|
101
|
+
selectSession(id: string): Promise<void>;
|
|
102
|
+
/** Renames the session (`PATCH /session/{id}`) and returns the title the server now holds. */
|
|
103
|
+
setTitle(sessionId: string, title: string): Promise<string | undefined>;
|
|
104
|
+
prompt(sessionId: string, text: string, opts?: PromptOptions): Promise<PromptResult>;
|
|
105
|
+
permissions(): Promise<OpenCodePermission[]>;
|
|
106
|
+
replyPermission(id: string, reply: PermissionReply, message?: string): Promise<void>;
|
|
107
|
+
questions(): Promise<OpenCodeQuestion[]>;
|
|
108
|
+
replyQuestion(id: string, answers: string[][]): Promise<void>;
|
|
109
|
+
rejectQuestion(id: string): Promise<void>;
|
|
110
|
+
abort(sessionId: string): Promise<boolean>;
|
|
111
|
+
events(signal?: AbortSignal): AsyncGenerator<PaneEvent>;
|
|
112
|
+
}
|
|
113
|
+
export declare function openPaneClient(entry: PaneServerEntry, fetchImpl?: typeof fetch): PaneClient;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as net from "node:net";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { atomicWriteText } from "../phren-paths.js";
|
|
6
|
+
/**
|
|
7
|
+
* The HTTP API an OpenCode TUI serves when started as
|
|
8
|
+
* `OPENCODE_SERVER_PASSWORD=<pw> opencode --port <port>`. The Hook drives a
|
|
9
|
+
* visible pane by talking to it instead of typing keys: register the pane's
|
|
10
|
+
* server here, then `openPaneClient` sends a prompt into the session the TUI is
|
|
11
|
+
* already showing and confirms the user message landed.
|
|
12
|
+
*
|
|
13
|
+
* Routes and bodies are the server's own spec (opencode 1.18.31, saved to
|
|
14
|
+
* `.scratch/openapi.json`): `session.list`, `session.prompt_async`,
|
|
15
|
+
* `session.messages`, `session.abort`, `event.subscribe`, `permission.list`,
|
|
16
|
+
* `permission.reply`, `question.list`, `question.reply`, `question.reject`,
|
|
17
|
+
* `session.create` and `tui.selectSession`. A question reply takes
|
|
18
|
+
* `{ answers }`, each answer an array of selected labels. A session created
|
|
19
|
+
* over HTTP is not what the TUI shows until `tui.selectSession` moves it there.
|
|
20
|
+
*/
|
|
21
|
+
const MAX_PASSWORD = 200;
|
|
22
|
+
const REQUEST_TIMEOUT_MS = 10_000;
|
|
23
|
+
const PROMPT_POLL_MS = 200;
|
|
24
|
+
const DEFAULT_PROMPT_TIMEOUT_MS = 3_000;
|
|
25
|
+
/** Enough recent messages to find the one just sent without paging a long history. */
|
|
26
|
+
const RECENT_MESSAGES = 20;
|
|
27
|
+
/** The prompt never reached the server (refused, or nothing listening), so
|
|
28
|
+
* the caller may still send it another way without a duplicate. */
|
|
29
|
+
export class PromptNotSent extends Error {
|
|
30
|
+
}
|
|
31
|
+
/** A segment safe to embed in a filename: never `.`, `..`, or a path separator. */
|
|
32
|
+
function safeSegment(value) {
|
|
33
|
+
return typeof value === "string" && value.length > 0
|
|
34
|
+
&& value !== "." && value !== ".." && !/[/\\\u0000-\u001f\u007f]/.test(value);
|
|
35
|
+
}
|
|
36
|
+
function validEntry(value) {
|
|
37
|
+
if (!value || typeof value !== "object")
|
|
38
|
+
return false;
|
|
39
|
+
const entry = value;
|
|
40
|
+
return safeSegment(entry.server) && safeSegment(entry.pane)
|
|
41
|
+
&& Number.isInteger(entry.port) && entry.port >= 1 && entry.port <= 65_535
|
|
42
|
+
&& typeof entry.password === "string" && entry.password.length > 0 && entry.password.length <= MAX_PASSWORD
|
|
43
|
+
&& Number.isInteger(entry.pid) && entry.pid > 0
|
|
44
|
+
&& typeof entry.directory === "string" && entry.directory.length > 0
|
|
45
|
+
&& typeof entry.createdAt === "string";
|
|
46
|
+
}
|
|
47
|
+
/** Signal 0 only checks existence; EPERM still means the process is alive. */
|
|
48
|
+
function alive(pid) {
|
|
49
|
+
try {
|
|
50
|
+
process.kill(pid, 0);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return error.code === "EPERM";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** The `%2F`-joined name keeps a server/pane pair unique without a path separator. */
|
|
58
|
+
function paneServerFile(dir, server, pane) {
|
|
59
|
+
return path.join(dir, `${encodeURIComponent(`${server}/${pane}`)}.json`);
|
|
60
|
+
}
|
|
61
|
+
export function registerPaneServer(dir, entry) {
|
|
62
|
+
if (!validEntry(entry))
|
|
63
|
+
throw new Error("Invalid OpenCode pane server entry.");
|
|
64
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
65
|
+
const file = paneServerFile(dir, entry.server, entry.pane);
|
|
66
|
+
atomicWriteText(file, JSON.stringify(entry), { mode: 0o600 });
|
|
67
|
+
return file;
|
|
68
|
+
}
|
|
69
|
+
export function readPaneServer(dir, server, pane) {
|
|
70
|
+
if (!safeSegment(server) || !safeSegment(pane))
|
|
71
|
+
return undefined;
|
|
72
|
+
let raw;
|
|
73
|
+
try {
|
|
74
|
+
raw = fs.readFileSync(paneServerFile(dir, server, pane), "utf8");
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = JSON.parse(raw);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
if (!validEntry(parsed))
|
|
87
|
+
return undefined;
|
|
88
|
+
if (parsed.server !== server || parsed.pane !== pane)
|
|
89
|
+
return undefined;
|
|
90
|
+
if (!alive(parsed.pid))
|
|
91
|
+
return undefined;
|
|
92
|
+
return parsed;
|
|
93
|
+
}
|
|
94
|
+
/** Every registered pane whose OpenCode process is still running. An entry
|
|
95
|
+
* whose process is gone is removed as it is found. */
|
|
96
|
+
export function listPaneServers(dir) {
|
|
97
|
+
let names;
|
|
98
|
+
try {
|
|
99
|
+
names = fs.readdirSync(dir);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const entries = [];
|
|
105
|
+
for (const name of names.slice(0, 1024)) {
|
|
106
|
+
if (!name.endsWith(".json"))
|
|
107
|
+
continue;
|
|
108
|
+
const file = path.join(dir, name);
|
|
109
|
+
let parsed;
|
|
110
|
+
try {
|
|
111
|
+
const info = fs.lstatSync(file);
|
|
112
|
+
if (!info.isFile() || info.size > 16_384)
|
|
113
|
+
continue;
|
|
114
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (!validEntry(parsed) || paneServerFile(dir, parsed.server, parsed.pane) !== file)
|
|
120
|
+
continue;
|
|
121
|
+
if (!alive(parsed.pid)) {
|
|
122
|
+
try {
|
|
123
|
+
fs.rmSync(file, { force: true });
|
|
124
|
+
}
|
|
125
|
+
catch { /* already gone */ }
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
entries.push(parsed);
|
|
129
|
+
}
|
|
130
|
+
return entries;
|
|
131
|
+
}
|
|
132
|
+
export function removePaneServer(dir, server, pane) {
|
|
133
|
+
if (!safeSegment(server) || !safeSegment(pane))
|
|
134
|
+
return;
|
|
135
|
+
try {
|
|
136
|
+
fs.rmSync(paneServerFile(dir, server, pane), { force: true });
|
|
137
|
+
}
|
|
138
|
+
catch { /* already gone */ }
|
|
139
|
+
}
|
|
140
|
+
export function freePort() {
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
const server = net.createServer();
|
|
143
|
+
server.once("error", reject);
|
|
144
|
+
server.listen(0, "127.0.0.1", () => {
|
|
145
|
+
const address = server.address();
|
|
146
|
+
const port = typeof address === "object" && address ? address.port : 0;
|
|
147
|
+
server.close(() => resolve(port));
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
export function newPassword() {
|
|
152
|
+
return crypto.randomBytes(32).toString("base64url");
|
|
153
|
+
}
|
|
154
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
155
|
+
export function openPaneClient(entry, fetchImpl = fetch) {
|
|
156
|
+
const base = `http://127.0.0.1:${entry.port}`;
|
|
157
|
+
const auth = "Basic " + Buffer.from(`opencode:${entry.password}`).toString("base64");
|
|
158
|
+
const send = (method, route, body, signal, timeout = true) => {
|
|
159
|
+
const url = new URL(route, base);
|
|
160
|
+
url.searchParams.set("directory", entry.directory);
|
|
161
|
+
const requestSignal = signal ?? (timeout === false ? undefined : AbortSignal.timeout(timeout === true ? REQUEST_TIMEOUT_MS : timeout));
|
|
162
|
+
return fetchImpl(url.toString(), { method,
|
|
163
|
+
headers: { Authorization: auth, ...(body === undefined ? {} : { "Content-Type": "application/json" }) },
|
|
164
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
165
|
+
...(requestSignal ? { signal: requestSignal } : {}) });
|
|
166
|
+
};
|
|
167
|
+
const json = async (method, route, body) => {
|
|
168
|
+
const response = await send(method, route, body);
|
|
169
|
+
const text = await response.text();
|
|
170
|
+
if (!response.ok)
|
|
171
|
+
throw new Error(`opencode ${method} ${route} failed with ${response.status}: ${text.slice(0, 300)}`);
|
|
172
|
+
return (text ? JSON.parse(text) : undefined);
|
|
173
|
+
};
|
|
174
|
+
const messages = async (sessionId) => {
|
|
175
|
+
const rows = await json("GET", `/session/${encodeURIComponent(sessionId)}/message?limit=${RECENT_MESSAGES}`);
|
|
176
|
+
return Array.isArray(rows) ? rows : [];
|
|
177
|
+
};
|
|
178
|
+
const sessionList = async () => {
|
|
179
|
+
const rows = await json("GET", "/session");
|
|
180
|
+
return Array.isArray(rows) ? rows : [];
|
|
181
|
+
};
|
|
182
|
+
const textOf = (message) => (message.parts ?? []).filter(part => part.type === "text").map(part => part.text ?? "").join("").trim();
|
|
183
|
+
return {
|
|
184
|
+
async ready(timeoutMs = 1_500) {
|
|
185
|
+
try {
|
|
186
|
+
return (await send("GET", "/session?limit=1", undefined, undefined, timeoutMs)).ok;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
sessions: sessionList,
|
|
193
|
+
async session(id) {
|
|
194
|
+
const response = await send("GET", `/session/${encodeURIComponent(id)}`);
|
|
195
|
+
const text = await response.text();
|
|
196
|
+
if (response.status === 404)
|
|
197
|
+
return undefined;
|
|
198
|
+
if (!response.ok)
|
|
199
|
+
throw new Error(`opencode GET /session/{id} failed with ${response.status}.`);
|
|
200
|
+
const value = text ? JSON.parse(text) : undefined;
|
|
201
|
+
return value && typeof value.id === "string" ? value : undefined;
|
|
202
|
+
},
|
|
203
|
+
async createSession() {
|
|
204
|
+
const created = await json("POST", "/session", {});
|
|
205
|
+
if (!created || typeof created.id !== "string")
|
|
206
|
+
throw new Error("opencode POST /session returned no session.");
|
|
207
|
+
return created;
|
|
208
|
+
},
|
|
209
|
+
async selectSession(id) {
|
|
210
|
+
await json("POST", "/tui/select-session", { sessionID: id });
|
|
211
|
+
},
|
|
212
|
+
async setTitle(sessionId, title) {
|
|
213
|
+
const renamed = await json("PATCH", `/session/${encodeURIComponent(sessionId)}`, { title });
|
|
214
|
+
return typeof renamed?.title === "string" ? renamed.title : undefined;
|
|
215
|
+
},
|
|
216
|
+
async currentSession() {
|
|
217
|
+
const list = (await sessionList()).filter(session => typeof session.id === "string" && !session.parentID);
|
|
218
|
+
const matching = list.filter(session => !session.directory || session.directory === entry.directory);
|
|
219
|
+
const pool = matching.length > 0 ? matching : list;
|
|
220
|
+
return pool.sort((a, b) => (b.time?.updated ?? 0) - (a.time?.updated ?? 0))[0];
|
|
221
|
+
},
|
|
222
|
+
async prompt(sessionId, text, opts = {}) {
|
|
223
|
+
let before;
|
|
224
|
+
try {
|
|
225
|
+
before = await messages(sessionId);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw new PromptNotSent(error.message);
|
|
229
|
+
}
|
|
230
|
+
const beforeIds = new Set(before.map(message => message.info?.id).filter((id) => Boolean(id)));
|
|
231
|
+
const body = { parts: [{ type: "text", text }] };
|
|
232
|
+
const last = opts.inherit ? before.filter(message => message.info?.role === "user").at(-1)?.info : undefined;
|
|
233
|
+
if (!opts.model && !opts.agent && last) {
|
|
234
|
+
if (typeof last.agent === "string" && last.agent)
|
|
235
|
+
body.agent = last.agent;
|
|
236
|
+
if (typeof last.model?.providerID === "string" && typeof last.model.modelID === "string") {
|
|
237
|
+
body.model = { providerID: last.model.providerID, modelID: last.model.modelID };
|
|
238
|
+
if (typeof last.model.variant === "string" && last.model.variant)
|
|
239
|
+
body.variant = last.model.variant;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (opts.model) {
|
|
243
|
+
const slash = opts.model.indexOf("/");
|
|
244
|
+
body.model = { providerID: slash < 0 ? opts.model : opts.model.slice(0, slash), modelID: slash < 0 ? "" : opts.model.slice(slash + 1) };
|
|
245
|
+
}
|
|
246
|
+
if (opts.agent)
|
|
247
|
+
body.agent = opts.agent;
|
|
248
|
+
if (opts.variant)
|
|
249
|
+
body.variant = opts.variant;
|
|
250
|
+
let response;
|
|
251
|
+
try {
|
|
252
|
+
response = await send("POST", `/session/${encodeURIComponent(sessionId)}/prompt_async`, body);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
// Nothing listening: the prompt never left. Any other failure (a
|
|
256
|
+
// timeout, a reset) may have reached the server, so it is unconfirmed.
|
|
257
|
+
const code = (error.cause)?.code;
|
|
258
|
+
if (code === "ECONNREFUSED")
|
|
259
|
+
throw new PromptNotSent("opencode is not listening.");
|
|
260
|
+
return { delivered: false, reason: "timeout" };
|
|
261
|
+
}
|
|
262
|
+
const refused = await response.text().catch(() => "");
|
|
263
|
+
if (!response.ok)
|
|
264
|
+
throw new PromptNotSent(`opencode POST prompt_async failed with ${response.status}: ${refused.slice(0, 300)}`);
|
|
265
|
+
const deadline = Date.now() + (opts.timeoutMs ?? DEFAULT_PROMPT_TIMEOUT_MS);
|
|
266
|
+
for (;;) {
|
|
267
|
+
await sleep(PROMPT_POLL_MS);
|
|
268
|
+
const after = await messages(sessionId).catch(() => []);
|
|
269
|
+
for (const message of after) {
|
|
270
|
+
const id = message.info?.id;
|
|
271
|
+
if (message.info?.role !== "user" || !id || beforeIds.has(id))
|
|
272
|
+
continue;
|
|
273
|
+
if (textOf(message) === text.trim())
|
|
274
|
+
return { delivered: true, messageId: id };
|
|
275
|
+
}
|
|
276
|
+
if (Date.now() >= deadline)
|
|
277
|
+
return { delivered: false, reason: "timeout" };
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
async permissions() {
|
|
281
|
+
const rows = await json("GET", "/permission");
|
|
282
|
+
return Array.isArray(rows) ? rows : [];
|
|
283
|
+
},
|
|
284
|
+
async replyPermission(id, reply, message) {
|
|
285
|
+
await json("POST", `/permission/${encodeURIComponent(id)}/reply`, { reply, ...(message === undefined ? {} : { message }) });
|
|
286
|
+
},
|
|
287
|
+
async questions() {
|
|
288
|
+
const rows = await json("GET", "/question");
|
|
289
|
+
return Array.isArray(rows) ? rows : [];
|
|
290
|
+
},
|
|
291
|
+
async replyQuestion(id, answers) {
|
|
292
|
+
await json("POST", `/question/${encodeURIComponent(id)}/reply`, { answers });
|
|
293
|
+
},
|
|
294
|
+
async rejectQuestion(id) {
|
|
295
|
+
await json("POST", `/question/${encodeURIComponent(id)}/reject`);
|
|
296
|
+
},
|
|
297
|
+
async abort(sessionId) {
|
|
298
|
+
return json("POST", `/session/${encodeURIComponent(sessionId)}/abort`);
|
|
299
|
+
},
|
|
300
|
+
async *events(signal) {
|
|
301
|
+
const response = await send("GET", "/event", undefined, signal, false);
|
|
302
|
+
if (!response.ok || !response.body)
|
|
303
|
+
throw new Error(`opencode GET /event failed with ${response.status}.`);
|
|
304
|
+
const reader = response.body.getReader();
|
|
305
|
+
const decoder = new TextDecoder();
|
|
306
|
+
let pending = "";
|
|
307
|
+
try {
|
|
308
|
+
for (;;) {
|
|
309
|
+
const { value, done } = await reader.read();
|
|
310
|
+
if (done)
|
|
311
|
+
return;
|
|
312
|
+
pending += decoder.decode(value, { stream: true });
|
|
313
|
+
let boundary;
|
|
314
|
+
while ((boundary = pending.indexOf("\n\n")) >= 0) {
|
|
315
|
+
const block = pending.slice(0, boundary);
|
|
316
|
+
pending = pending.slice(boundary + 2);
|
|
317
|
+
const data = block.split("\n").filter(row => row.startsWith("data:")).map(row => row.slice(5).trimStart()).join("\n");
|
|
318
|
+
if (!data)
|
|
319
|
+
continue;
|
|
320
|
+
try {
|
|
321
|
+
yield JSON.parse(data);
|
|
322
|
+
}
|
|
323
|
+
catch { /* keep-alive or malformed frame */ }
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
await reader.cancel().catch(() => { });
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { type OpenCodePermission, type OpenCodeQuestion, type PaneClient, type PaneServerEntry, type PromptOptions } from "./opencode-pane-server.js";
|
|
2
|
+
/** Set in a served pane's environment: the port its TUI listens on. The
|
|
3
|
+
* OpenCode plugin leaves permission asks to the Hook's HTTP client when its
|
|
4
|
+
* own process was started with this port. */
|
|
5
|
+
export declare const PANE_PORT_ENV = "PHREN_OPENCODE_PORT";
|
|
6
|
+
export declare function paneServersDir(): string;
|
|
7
|
+
/** The live server entry for a pane, if the Hook started its OpenCode. */
|
|
8
|
+
export declare function servedPane(server: string, pane: string): PaneServerEntry | undefined;
|
|
9
|
+
export declare function servedPanes(): PaneServerEntry[];
|
|
10
|
+
export declare function forgetServedPane(server: string, pane: string): void;
|
|
11
|
+
export declare function paneClient(entry: PaneServerEntry): PaneClient;
|
|
12
|
+
/** For tests: build clients against a fake server; returns the restore. */
|
|
13
|
+
export declare function setPaneClientFactory(factory: (entry: PaneServerEntry) => PaneClient): () => void;
|
|
14
|
+
export interface ServedLaunch {
|
|
15
|
+
port: number;
|
|
16
|
+
password: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
env: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/** The port, password, extra arguments and pane variables for one launch. */
|
|
21
|
+
export declare function prepareServedLaunch(): Promise<ServedLaunch>;
|
|
22
|
+
/** `--port N` or `--port=N` in a command line. */
|
|
23
|
+
export declare function listensOn(command: string, port: number): boolean;
|
|
24
|
+
declare function processTable(): Promise<Array<{
|
|
25
|
+
pid: number;
|
|
26
|
+
command: string;
|
|
27
|
+
}>>;
|
|
28
|
+
/** The OpenCode process serving `port` in the pane: a foreground process of
|
|
29
|
+
* the pane whose command line carries that port, else any process that does
|
|
30
|
+
* (a launcher shim can hold the pane's foreground). The newest wins, which is
|
|
31
|
+
* the real binary under a shim. */
|
|
32
|
+
export declare function servingPid(server: string, pane: string, port: number, table?: typeof processTable): Promise<number | undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* Registers a pane whose OpenCode the Hook just started with `launch`, once
|
|
35
|
+
* its server answers. Undefined when it never did: the pane then keeps the
|
|
36
|
+
* typed path, exactly like one started by hand.
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerServedPane(server: string, pane: string, directory: string, launch: ServedLaunch, options?: {
|
|
39
|
+
readyMs?: number;
|
|
40
|
+
defaults?: PaneServerEntry["defaults"];
|
|
41
|
+
table?: () => Promise<Array<{
|
|
42
|
+
pid: number;
|
|
43
|
+
command: string;
|
|
44
|
+
}>>;
|
|
45
|
+
}): Promise<PaneServerEntry | undefined>;
|
|
46
|
+
export type ServedPrompt = {
|
|
47
|
+
sent: false;
|
|
48
|
+
reason: string;
|
|
49
|
+
} | {
|
|
50
|
+
sent: true;
|
|
51
|
+
delivered: boolean;
|
|
52
|
+
session: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Moves the TUI onto `session`, whose first turn is `text`. A TUI that has
|
|
56
|
+
* only just started answers HTTP before it listens for its own navigation
|
|
57
|
+
* events and drops the first request (seen live on 1.18.31), so the request
|
|
58
|
+
* is repeated until the pane draws that turn. False when it never did: the
|
|
59
|
+
* conversation is still real, only not on screen.
|
|
60
|
+
*/
|
|
61
|
+
export declare function showSession(entry: PaneServerEntry, client: PaneClient, session: string, text: string, options?: {
|
|
62
|
+
timeoutMs?: number;
|
|
63
|
+
intervalMs?: number;
|
|
64
|
+
shows?: (text: string) => Promise<boolean>;
|
|
65
|
+
}): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Sends `text` into the session a served TUI shows. `session` is the
|
|
68
|
+
* conversation the phone means and must be a root session of this server; with
|
|
69
|
+
* none (a TUI still on its home screen) a new session is created, and once the
|
|
70
|
+
* prompt is in, the TUI is moved onto it so the owner sees it there.
|
|
71
|
+
* `sent: false` means nothing reached OpenCode, so the caller may type it.
|
|
72
|
+
*/
|
|
73
|
+
export declare function sendServedPrompt(entry: PaneServerEntry, session: string | undefined, text: string, options?: PromptOptions): Promise<ServedPrompt>;
|
|
74
|
+
/** A launch brief sent over HTTP: into a new session the TUI shows. */
|
|
75
|
+
export declare function sendServedBrief(entry: PaneServerEntry, text: string, options?: PromptOptions): Promise<ServedPrompt>;
|
|
76
|
+
/** The root of a (possibly subagent) session: the conversation the pane shows. */
|
|
77
|
+
export declare function rootSession(client: PaneClient, session: string): Promise<string>;
|
|
78
|
+
export interface PaneAsks {
|
|
79
|
+
permissions: OpenCodePermission[];
|
|
80
|
+
questions: OpenCodeQuestion[];
|
|
81
|
+
}
|
|
82
|
+
/** Where the watcher reports what each served pane is asking. `asks` is the
|
|
83
|
+
* whole current set for that pane; `gone` means the pane's entry is gone. */
|
|
84
|
+
export interface PaneAskSink {
|
|
85
|
+
asks(entry: PaneServerEntry, client: PaneClient, asks: PaneAsks): Promise<void>;
|
|
86
|
+
gone(key: string): void;
|
|
87
|
+
}
|
|
88
|
+
export declare const paneKey: (entry: {
|
|
89
|
+
server: string;
|
|
90
|
+
pane: string;
|
|
91
|
+
}) => string;
|
|
92
|
+
/**
|
|
93
|
+
* One event subscription per served pane. On every (re)connect and on each
|
|
94
|
+
* permission or question event it lists the pane's pending asks and hands the
|
|
95
|
+
* whole set to the sink, so an ask answered in the TUI disappears too. A
|
|
96
|
+
* dropped stream reconnects with backoff; `tick` stops panes whose entry is
|
|
97
|
+
* gone (the process exited) and starts new ones.
|
|
98
|
+
*/
|
|
99
|
+
export declare class PaneServerWatcher {
|
|
100
|
+
private sink;
|
|
101
|
+
private list;
|
|
102
|
+
private minBackoffMs;
|
|
103
|
+
private live;
|
|
104
|
+
private closed;
|
|
105
|
+
constructor(sink: PaneAskSink, list?: () => PaneServerEntry[], minBackoffMs?: number);
|
|
106
|
+
tick(): void;
|
|
107
|
+
watching(): string[];
|
|
108
|
+
close(): void;
|
|
109
|
+
private follow;
|
|
110
|
+
}
|
|
111
|
+
export {};
|