agent-yes 1.303.1 → 1.304.0
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/README.md +54 -0
- package/default.config.yaml +5 -5
- package/dist/{JsonlStore-BpYZZTap.js → JsonlStore-CB_0sfdT.js} +5 -4
- package/dist/{SUPPORTED_CLIS-Dq9Lq9WJ.js → SUPPORTED_CLIS-C_1IiOj3.js} +2 -2
- package/dist/SUPPORTED_CLIS-Do3GHAY1.js +12 -0
- package/dist/{agentShare-suB6yPgO.js → agentShare-BvpEm-Fr.js} +10 -9
- package/dist/{askCli-BU3CNCLU.js → askCli-KmMf-3wA.js} +6 -6
- package/dist/{browser-BmxN1Ur9.js → browser-BAFPmEvN.js} +2 -2
- package/dist/{callback-Ctj3_Wxp.js → callback-BiSUhjw7.js} +6 -6
- package/dist/callback-SqLD2mMX.js +17 -0
- package/dist/{callbackCore-DSJWhqAe.js → callbackCore-BZ_10zyc.js} +1 -1
- package/dist/{callbackCore-BesbQ6-Z.js → callbackCore-Deve5pv3.js} +1 -1
- package/dist/{channels-j5nWuzlQ.js → channels-Y36S0ccW.js} +2 -2
- package/dist/cli.js +118 -13
- package/dist/{cmdDsh-2LP0grim.js → cmdDsh-DZ8bLsH7.js} +1 -1
- package/dist/cmdKill-CzSBfWmx.js +116 -0
- package/dist/{cmdPs-wc1j85fi.js → cmdPs-DBt23Qz0.js} +11 -10
- package/dist/{cwdConflictWarn-skQSMwEh.js → cwdConflictWarn-y-epQyOj.js} +21 -5
- package/dist/{cwdPassthroughHint-BUbWMoz0.js → cwdPassthroughHint-CzWh0hrw.js} +1 -1
- package/dist/{expose-Dawq1LxC.js → expose-Bhsn5yUz.js} +2 -2
- package/dist/forceKill-BDqxx4uQ.js +44 -0
- package/dist/{forkNested-CavHyWzA.js → forkNested-3heLs5XC.js} +45 -5
- package/dist/{globalPidIndex-CRB5KtyL.js → globalPidIndex-BsjlId-h.js} +6 -5
- package/dist/{globalPidIndex-BftWlg2V.js → globalPidIndex-uoz8Esqz.js} +2 -2
- package/dist/{hist-Cs0KFSUW.js → hist-DY16wm7g.js} +1 -1
- package/dist/{identity-DA7YI9km.js → identity-C0MxfwI2.js} +1 -1
- package/dist/{identity-Bk-aG_xl.js → identity-Ckav3-Up.js} +1 -1
- package/dist/index.js +7 -7
- package/dist/{initMsg-CcTqFtsp.js → initMsg-BEVDWYnv.js} +1 -1
- package/dist/{initMsg-D9KJnfgC.js → initMsg-GPU52N-j.js} +1 -1
- package/dist/liagent/box-BSIrRRc_.js +2320 -0
- package/dist/liagent/box-DloywR57.d.ts +409 -0
- package/dist/liagent/box.d.ts +3 -0
- package/dist/liagent/box.js +3 -0
- package/dist/liagent/cli.d.ts +1 -0
- package/dist/liagent/cli.js +908 -0
- package/dist/liagent/client.d.ts +28 -0
- package/dist/liagent/client.js +240 -0
- package/dist/liagent/echo-BvzPSI0x.js +86 -0
- package/dist/liagent/echo-W2RcMEny.d.ts +38 -0
- package/dist/liagent/hub.d.ts +405 -0
- package/dist/liagent/hub.js +1831 -0
- package/dist/liagent/index.d.ts +14 -0
- package/dist/liagent/index.js +10 -0
- package/dist/liagent/liagent.js +339 -0
- package/dist/liagent/mic-audio-C3Shud_F.js +754 -0
- package/dist/liagent/mic-audio-DMCWtEI-.d.ts +317 -0
- package/dist/liagent/mic-button-CtZHFBSG.js +651 -0
- package/dist/liagent/mic-button-Y0ioPetQ.d.ts +248 -0
- package/dist/liagent/mic.d.ts +3 -0
- package/dist/liagent/mic.js +4 -0
- package/dist/liagent/progress-CJs08bXb.js +473 -0
- package/dist/liagent/progress-CfE-meHr.d.ts +205 -0
- package/dist/liagent/progress.d.ts +2 -0
- package/dist/liagent/progress.js +3 -0
- package/dist/liagent/protocol.d.ts +324 -0
- package/dist/liagent/protocol.js +504 -0
- package/dist/liagent/speech-rate-DXeJjRTc.js +42 -0
- package/dist/liagent/state-tree-BZCmAknI.js +353 -0
- package/dist/liagent/tree-BrR7NwMf.js +710 -0
- package/dist/liagent/tree-HB9RhX_H.d.ts +295 -0
- package/dist/liagent/tree.d.ts +2 -0
- package/dist/liagent/tree.js +4 -0
- package/dist/liagent/ui-strings-B03le3fh.d.ts +27 -0
- package/dist/liagent/ui-strings-CJIwW5Gf.js +794 -0
- package/dist/liagent/ui.d.ts +394 -0
- package/dist/liagent/ui.js +5 -0
- package/dist/liagent/voice-D7yeS9VM.js +802 -0
- package/dist/liagent/voice-Qo7SCgi8.d.ts +308 -0
- package/dist/liagent/voice.d.ts +3 -0
- package/dist/liagent/voice.js +4 -0
- package/dist/{notifyDaemon-C7GlfJ1E.js → notifyDaemon-DkUB7GV2.js} +10 -9
- package/dist/{openBrowser-1cIo4dJL.js → openBrowser-CQAOIrD6.js} +1 -1
- package/dist/oxmgrService-DlYHmqyI.js +37 -0
- package/dist/oxmgrService-o9L3I6FX.js +3 -0
- package/dist/{parentLink-DoEWVGld.js → parentLink-BcAYcO9L.js} +2 -2
- package/dist/{parentLink-B58V1RVd.js → parentLink-MBUD3oY2.js} +2 -2
- package/dist/{parentPingLoop-C73bbmCE.js → parentPingLoop-DDO592Wh.js} +5 -5
- package/dist/{pidStore-433kvh9D.js → pidStore-C50VPk3E.js} +3 -3
- package/dist/pidStore-COkPjpW8.js +6 -0
- package/dist/{procStats-BvmrBrOs.js → procStats-DwTxj3rs.js} +1 -1
- package/dist/{remotes-MfdV9M8u.js → remotes-BqLoB5GR.js} +2 -2
- package/dist/{remotes-DevcBeLl.js → remotes-BsMGvAay.js} +3 -3
- package/dist/{roomReplyAlias-DFqg_6IU.js → roomReplyAlias-B-v76TA8.js} +3 -3
- package/dist/roomReplyAlias-BzWUBkQy.js +6 -0
- package/dist/{rustBinary-7VK7oLlW.js → rustBinary-BrJ2p8wy.js} +2 -2
- package/dist/{rustBinary-BV4LxMMn.js → rustBinary-vpfpWj1q.js} +2 -2
- package/dist/{schedule-Dp0qkNO1.js → schedule-Bzjhl6-h.js} +15 -44
- package/dist/schedulesCli-CLqieyQZ.js +784 -0
- package/dist/senderAncestry-CVHeKk1Y.js +173 -0
- package/dist/senderAncestry-KhAUPCQs.js +3 -0
- package/dist/{serve-BpOIIOVc.js → serve-XwFYE0cE.js} +67 -69
- package/dist/{serveRust-CbBrcUrg.js → serveRust-BfWkeL6T.js} +31 -4
- package/dist/{setup-DdIBk6Iv.js → setup-D4-s2VZw.js} +5 -5
- package/dist/{share-w5oRbvlj.js → share-CbFetL5H.js} +1 -1
- package/dist/{share-DrS3LYqf.js → share-_TPYAGWC.js} +1 -1
- package/dist/{shareCmd-DDENkBW2.js → shareCmd-DUBsVI3e.js} +10 -10
- package/dist/spawnGate-Dfj9V76w.js +5 -0
- package/dist/{spawnGate-lr3tvA6U.js → spawnGate-Dj_WaS29.js} +3 -3
- package/dist/{subcommands-DxgvDmZX.js → subcommands-B7YZJL8n.js} +471 -307
- package/dist/subcommands-BZPxFgkT.js +15 -0
- package/dist/{systemPathLink-SjUzgSiq.js → systemPathLink-Y3iC7bYV.js} +1 -1
- package/dist/{terminal-C2h7tpe0.js → terminal-13cGj3h6.js} +2 -2
- package/dist/terminal.js +1 -1
- package/dist/{todoAutomation-TTp_Qz9G.js → todoAutomation-CKlrxuZv.js} +2 -2
- package/dist/{todoCli-BWm5nZE0.js → todoCli-CU9vSJSJ.js} +6 -6
- package/dist/{todoIdentity-BvXZKWJI.js → todoIdentity-CzS1e7VL.js} +2 -2
- package/dist/{todoStore-C9RTz0Vs.js → todoStore-msRCEUi1.js} +2 -2
- package/dist/{tray-BeRSozJz.js → tray-CLktEN3G.js} +1 -1
- package/dist/{trayApp-QQjqhDv1.js → trayApp-5_OlvQcz.js} +2 -2
- package/dist/trayApp-DkAPo0m6.js +5 -0
- package/dist/{ts-6LF7f4fx.js → ts-njuddXQz.js} +126 -57
- package/dist/{versionChecker-Bc62HNf6.js → versionChecker-BJycAanp.js} +2 -2
- package/dist/{webrtcLink-va_gAR77.js → webrtcLink-DcvacEci.js} +1 -1
- package/dist/{webrtcLink-SsInrVHU.js → webrtcLink-WxS1nTIs.js} +1 -1
- package/dist/{webrtcRemote-BlGyNZDC.js → webrtcRemote-C3xQyf3u.js} +2 -2
- package/dist/{widget-Crb5zeHL.js → widget-DmRwOlco.js} +3 -3
- package/dist/widgets.js +1 -1
- package/dist/{workspaceConfig-BLWB5Wu9.js → workspaceConfig-DBgsu81B.js} +1 -1
- package/dist/{ws-DIbwNz8Z.js → ws-ByO6JO6m.js} +3 -3
- package/dist/{ws-BRhPG1Vy.js → ws-D0-Jg88z.js} +9 -8
- package/lab/ui/index.html +1 -1
- package/lab/ui/lab/posts/2026-08-11-slack-term-safe-writes.md +1 -1
- package/package.json +73 -8
- package/ts/JsonlStore.ts +10 -3
- package/ts/cli-idle.bun.spec.ts +1 -1
- package/ts/cli-idle.spec.ts +1 -1
- package/ts/cli.ts +35 -0
- package/ts/cmdKill.bun.spec.ts +155 -0
- package/ts/cmdKill.spec.ts +155 -0
- package/ts/cmdKill.ts +183 -0
- package/ts/composerGuard.edges.spec.ts +91 -0
- package/ts/composerGuard.spec.ts +53 -6
- package/ts/composerGuard.ts +42 -13
- package/ts/conptyModeFilter.spec.ts +30 -0
- package/ts/conptyModeFilter.ts +53 -0
- package/ts/copyLiagent.ts +42 -0
- package/ts/cwdConflictWarn.io.spec.ts +50 -0
- package/ts/cwdConflictWarn.spec.ts +34 -1
- package/ts/cwdConflictWarn.ts +43 -5
- package/ts/cwdGuard.spec.ts +110 -0
- package/ts/cwdGuard.ts +118 -0
- package/ts/forceKill.ts +52 -0
- package/ts/forkNested.bun.spec.ts +41 -0
- package/ts/forkNested.spec.ts +41 -0
- package/ts/forkNested.ts +48 -1
- package/ts/globalPidIndex.edges.spec.ts +125 -0
- package/ts/globalPidIndex.ts +6 -2
- package/ts/index.ts +13 -1
- package/ts/interruptSend.bun.spec.ts +99 -0
- package/ts/interruptSend.spec.ts +99 -0
- package/ts/interruptSend.ts +51 -0
- package/ts/lockRegistry.spec.ts +49 -0
- package/ts/lsRenderCache.spec.ts +58 -0
- package/ts/needsInput.edges.spec.ts +23 -0
- package/ts/parseCliArgs.ts +7 -0
- package/ts/pushGatePlan.spec.ts +147 -0
- package/ts/roomReplyAlias.io.spec.ts +81 -0
- package/ts/schedule.ts +5 -1
- package/ts/schedules.bun.spec.ts +397 -0
- package/ts/schedules.spec.ts +397 -0
- package/ts/schedules.ts +517 -0
- package/ts/schedulesCli.ts +386 -0
- package/ts/sendControl.bun.spec.ts +12 -0
- package/ts/senderAncestry.ts +1 -3
- package/ts/serve.ts +22 -33
- package/ts/serveRust.spec.ts +29 -2
- package/ts/serveRust.ts +27 -2
- package/ts/sizeNego.bun.spec.ts +9 -2
- package/ts/sizeNego.spec.ts +9 -2
- package/ts/sizeNego.ts +10 -5
- package/ts/subcommands.spec.ts +348 -9
- package/ts/subcommands.ts +513 -93
- package/ts/suggestAgents.spec.ts +33 -0
- package/ts/terminal/browser.ts +1 -1
- package/ts/todoParse.spec.ts +22 -1
- package/ts/todoParse.ts +19 -0
- package/dist/SUPPORTED_CLIS-ByO5twge.js +0 -12
- package/dist/callback-D7qfh_7p.js +0 -16
- package/dist/pidStore-BRlKRHXY.js +0 -6
- package/dist/roomReplyAlias-DuEkSSDI.js +0 -6
- package/dist/spawnGate-DeQBTX-o.js +0 -5
- package/dist/subcommands-DmiswRy4.js +0 -14
- package/dist/trayApp-C4TAvRvU.js +0 -5
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
//#region src/protocol.d.ts
|
|
2
|
+
/** Largest `code` accepted, in characters. */
|
|
3
|
+
declare const MAX_CODE: number;
|
|
4
|
+
/** Largest result summary a page sends back, in characters. */
|
|
5
|
+
declare const MAX_RESULT = 4000;
|
|
6
|
+
/** Largest page or controller label, in characters. */
|
|
7
|
+
declare const MAX_LABEL = 300;
|
|
8
|
+
/** How long the owner has to answer a pairing prompt. */
|
|
9
|
+
declare const PENDING_MS: number;
|
|
10
|
+
/** How long a friend's preview approval (eval on their pages, one socket) lasts. */
|
|
11
|
+
declare const APPROVAL_MS: number;
|
|
12
|
+
/**
|
|
13
|
+
* How long the user's eval approval lasts — and its resumable grant token: the
|
|
14
|
+
* agent reconnects with it (x-liagent-token) without a new prompt until then,
|
|
15
|
+
* or until End revokes it.
|
|
16
|
+
*/
|
|
17
|
+
declare const EVAL_GRANT_MS: number;
|
|
18
|
+
/** How long "Allow chat" lasts — and its resumable grant token. */
|
|
19
|
+
declare const CHAT_MS: number;
|
|
20
|
+
/** Largest chat message (owner's or agent's), in characters. */
|
|
21
|
+
declare const MAX_CHAT = 4000;
|
|
22
|
+
/** Chat messages the hub keeps (and sends a page on connect). */
|
|
23
|
+
declare const CHAT_HISTORY = 200;
|
|
24
|
+
/** A page shows the spinner while the agent's last busy beat is younger than this. */
|
|
25
|
+
declare const BUSY_MS = 12000;
|
|
26
|
+
/** A beat this soon after a reply is the tail of the work just answered: ignored. */
|
|
27
|
+
declare const BUSY_AFTER_REPLY_MS = 1500;
|
|
28
|
+
/**
|
|
29
|
+
* How long an eval grant outlives its pages: if every page it covers stays
|
|
30
|
+
* closed this long, the agent is told to pair again (4409). Shorter gaps —
|
|
31
|
+
* a phone app switch, a reload — keep the grant, since a tab keeps its page id.
|
|
32
|
+
*/
|
|
33
|
+
declare const PAGES_GONE_MS: number;
|
|
34
|
+
/** A page id: the tab's own, kept in sessionStorage and sent on reconnect (?page=). */
|
|
35
|
+
declare const isPageId: (v: unknown) => v is string;
|
|
36
|
+
/** How long a page waits after client-side navigation before reporting it. */
|
|
37
|
+
declare const PAGE_DEBOUNCE_MS = 300;
|
|
38
|
+
/**
|
|
39
|
+
* What an approval lets an agent do: "eval" (8 hours, resumable) runs code on
|
|
40
|
+
* the owner's pages and chats; "chat" (Allow chat for 30 days) only chats.
|
|
41
|
+
*/
|
|
42
|
+
type Scope = "eval" | "chat";
|
|
43
|
+
/** Picture URLs in fallback order: each that fails to load falls through to the next. */
|
|
44
|
+
type AvatarSrc = string | readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* Who sent a line, for the box's avatar. Optional everywhere: the bundled
|
|
47
|
+
* hub does not set it, a host's hub may. `id` seeds the fallback colour:
|
|
48
|
+
* a stable id or a hash of one, never an email.
|
|
49
|
+
*/
|
|
50
|
+
type Sender = {
|
|
51
|
+
id?: string;
|
|
52
|
+
name?: string; /** In fallback order: the app's own avatar, then the sign-in provider's image. */
|
|
53
|
+
avatar?: AvatarSrc;
|
|
54
|
+
};
|
|
55
|
+
/** One line of the chat, as the hub stores and sends it. */
|
|
56
|
+
type ChatMessage = {
|
|
57
|
+
id: string;
|
|
58
|
+
from: "owner" | "agent" | "friend";
|
|
59
|
+
label: string;
|
|
60
|
+
text: string;
|
|
61
|
+
at: number;
|
|
62
|
+
thread?: string; /** Who sent it, for the avatar (absent: the box falls back, see src/avatar.ts). */
|
|
63
|
+
sender?: Sender; /** The state-tree node an agent line comes from ("/words/prefetch"; absent = the main thread). */
|
|
64
|
+
taskPath?: string; /** The node's assignee that wrote an agent line (≤ MAX_AGENT_ID). */
|
|
65
|
+
agentId?: string; /** The node the line is addressed to (absent or "/" = the main thread). */
|
|
66
|
+
to?: string;
|
|
67
|
+
/**
|
|
68
|
+
* "stt": the owner's line came from the box's own mic — an STT final sent
|
|
69
|
+
* as heard, or sent unchanged. Absent = typed (or dictation edited before
|
|
70
|
+
* sending). Only such a line may be polished by the agent (`edit`).
|
|
71
|
+
*/
|
|
72
|
+
source?: MessageSource; /** The STT text as first heard, kept once the agent has polished the line. */
|
|
73
|
+
raw?: string; /** Set when the agent polished the line: when, by which agent, and how many times. */
|
|
74
|
+
edited?: EditMark;
|
|
75
|
+
};
|
|
76
|
+
/** Where an owner line came from: "stt" (the box's mic). Absent = typed. */
|
|
77
|
+
type MessageSource = "stt";
|
|
78
|
+
/** An agent's polish of a voice line (ChatMessage.edited). */
|
|
79
|
+
type EditMark = {
|
|
80
|
+
at: number;
|
|
81
|
+
by: string;
|
|
82
|
+
count: number;
|
|
83
|
+
};
|
|
84
|
+
/** How many times the agent may polish one voice line. */
|
|
85
|
+
declare const MAX_EDITS = 3;
|
|
86
|
+
/**
|
|
87
|
+
* The hub's broadcast after an agent polished a voice line: the pages and
|
|
88
|
+
* listeners update that line in place (never read aloud again).
|
|
89
|
+
*/
|
|
90
|
+
type EditedEvent = {
|
|
91
|
+
type: "edited";
|
|
92
|
+
id: string;
|
|
93
|
+
thread: string;
|
|
94
|
+
text: string;
|
|
95
|
+
raw: string;
|
|
96
|
+
edited: EditMark;
|
|
97
|
+
};
|
|
98
|
+
/** A message updated by an EditedEvent; any other message is returned as is. */
|
|
99
|
+
declare function applyEdit<M extends ChatMessage>(m: M, e: Omit<EditedEvent, "type">): M;
|
|
100
|
+
/**
|
|
101
|
+
* The draft after a transcript landed in it, if the whole draft is still
|
|
102
|
+
* dictation (the draft was empty, or is exactly what dictation left there);
|
|
103
|
+
* null once anything typed is in it.
|
|
104
|
+
*/
|
|
105
|
+
declare function dictatedDraft(prev: string, pure: string | null, next: string): string | null;
|
|
106
|
+
/**
|
|
107
|
+
* A line's source as it is sent: "stt" when the draft is exactly what the
|
|
108
|
+
* mic left there (sent as heard, or unchanged); undefined when anything was
|
|
109
|
+
* typed or edited in it.
|
|
110
|
+
*/
|
|
111
|
+
declare function draftSource(draft: string, pure: string | null): MessageSource | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* A pairing: waiting for the owner's answer (no `until`), or approved.
|
|
114
|
+
* `scope` is what the agent asked for (absent from an agent that did not
|
|
115
|
+
* say: then the owner's answer decides). `pages`: the page ids it was
|
|
116
|
+
* approved on, or "all" (every page of that audience, now and later).
|
|
117
|
+
*/
|
|
118
|
+
type PairInfo = {
|
|
119
|
+
pair: string;
|
|
120
|
+
code: string;
|
|
121
|
+
label: string;
|
|
122
|
+
at: number;
|
|
123
|
+
until?: number;
|
|
124
|
+
scope?: Scope;
|
|
125
|
+
pages?: string[] | "all";
|
|
126
|
+
};
|
|
127
|
+
/** One connected page of the viewer's own audience (the owner's pages, or a friend's own). */
|
|
128
|
+
type PageInfo = {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
at: number;
|
|
132
|
+
};
|
|
133
|
+
type HubState = {
|
|
134
|
+
type: "state";
|
|
135
|
+
pending: PairInfo | null;
|
|
136
|
+
sessions: PairInfo[]; /** Chat-capable agents connected now. */
|
|
137
|
+
listeners: number; /** This audience's connected pages, and which of them the receiving page is. */
|
|
138
|
+
pages: PageInfo[];
|
|
139
|
+
self: string; /** The state-tree nodes agents listen at (never "/"), for the box's "@/…" completions. */
|
|
140
|
+
nodes?: string[];
|
|
141
|
+
};
|
|
142
|
+
type ControllerMessage = {
|
|
143
|
+
type: "eval";
|
|
144
|
+
code: string;
|
|
145
|
+
target?: string;
|
|
146
|
+
} /** `to`: a friend's thread; `node`: a state-tree node (a `to` starting with "/"). */ | {
|
|
147
|
+
type: "say";
|
|
148
|
+
text: string;
|
|
149
|
+
to?: string;
|
|
150
|
+
node?: string;
|
|
151
|
+
taskPath?: string;
|
|
152
|
+
agentId?: string;
|
|
153
|
+
} | {
|
|
154
|
+
type: "busy";
|
|
155
|
+
to?: string;
|
|
156
|
+
on?: boolean;
|
|
157
|
+
} /** Polish the owner's latest line, when it came from the box's mic (`source: "stt"`). */ | {
|
|
158
|
+
type: "edit";
|
|
159
|
+
id: string;
|
|
160
|
+
text: string;
|
|
161
|
+
} /** Let senders within node `from` address nodes within `to` (only a listener holding both). */ | {
|
|
162
|
+
type: "grant";
|
|
163
|
+
from: string;
|
|
164
|
+
to: string;
|
|
165
|
+
ms?: number;
|
|
166
|
+
} | {
|
|
167
|
+
type: "ungrant";
|
|
168
|
+
from: string;
|
|
169
|
+
to: string;
|
|
170
|
+
};
|
|
171
|
+
type PageMessage = {
|
|
172
|
+
type: "allow";
|
|
173
|
+
pair: string;
|
|
174
|
+
pages?: string[] | "all";
|
|
175
|
+
scope?: "chat";
|
|
176
|
+
} | {
|
|
177
|
+
type: "deny" | "revoke";
|
|
178
|
+
pair: string;
|
|
179
|
+
} | {
|
|
180
|
+
type: "page";
|
|
181
|
+
label: string;
|
|
182
|
+
} | {
|
|
183
|
+
type: "end-page";
|
|
184
|
+
id: string;
|
|
185
|
+
} /** `source: "stt"`: sent from the box's mic, unchanged (absent = typed). */ | {
|
|
186
|
+
type: "chat";
|
|
187
|
+
id: string;
|
|
188
|
+
text: string;
|
|
189
|
+
to?: string;
|
|
190
|
+
source?: MessageSource;
|
|
191
|
+
} | {
|
|
192
|
+
type: "result";
|
|
193
|
+
id: string;
|
|
194
|
+
to: string;
|
|
195
|
+
ok: boolean;
|
|
196
|
+
value?: string;
|
|
197
|
+
error?: string;
|
|
198
|
+
stack?: string;
|
|
199
|
+
ms?: number;
|
|
200
|
+
};
|
|
201
|
+
/** A chat message's text: trimmed, non-empty, at most MAX_CHAT characters; else undefined. */
|
|
202
|
+
declare function chatText(raw: unknown): string | undefined;
|
|
203
|
+
/** Validate an agent's message; anything else is an error sent back to it. */
|
|
204
|
+
declare function parseControllerMessage(raw: unknown): {
|
|
205
|
+
ok: true;
|
|
206
|
+
value: ControllerMessage;
|
|
207
|
+
} | {
|
|
208
|
+
ok: false;
|
|
209
|
+
error: string;
|
|
210
|
+
};
|
|
211
|
+
/** Validate a page's message; anything else is dropped. */
|
|
212
|
+
declare function parsePageMessage(raw: unknown): PageMessage | null;
|
|
213
|
+
/** The newest `max` messages, oldest first. */
|
|
214
|
+
declare function trimHistory(list: ChatMessage[], max?: number): ChatMessage[];
|
|
215
|
+
/**
|
|
216
|
+
* The language to read a reply in, from its script alone: any kana is
|
|
217
|
+
* Japanese, Hangul Korean, other Han Chinese (zh-CN), and everything else
|
|
218
|
+
* English.
|
|
219
|
+
*/
|
|
220
|
+
declare function pickLang(text: string): "ja-JP" | "ko-KR" | "zh-CN" | "en-US";
|
|
221
|
+
/** An installed voice for `lang`: the exact locale first, then the same language. */
|
|
222
|
+
declare function pickVoice<V extends {
|
|
223
|
+
lang: string;
|
|
224
|
+
default?: boolean;
|
|
225
|
+
}>(voices: readonly V[], lang: string): V | undefined;
|
|
226
|
+
/** A label shown to the user: one line, printable, bounded. */
|
|
227
|
+
declare function cleanLabel(raw: string | null | undefined, max?: number): string;
|
|
228
|
+
/** The short code the CLI prints and the prompt shows, so the owner can match them. */
|
|
229
|
+
declare function shortCode(bytes: Uint8Array): string;
|
|
230
|
+
/** A page's label matches when there is no target, or it contains the target (any case). */
|
|
231
|
+
declare function matchesTarget(label: string, target: string | undefined): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* A JSON-serialisable summary of whatever the code returned, at most `max`
|
|
234
|
+
* characters: cycles, functions, DOM nodes, errors, Maps, Sets and BigInts
|
|
235
|
+
* become readable strings instead of throwing.
|
|
236
|
+
*/
|
|
237
|
+
declare function summarize(value: unknown, max?: number): string;
|
|
238
|
+
/**
|
|
239
|
+
* Compile `code` as an async function. An expression (`document.title`) is
|
|
240
|
+
* returned as is; anything else is a function body, so `return x` works and
|
|
241
|
+
* `await` is allowed in both.
|
|
242
|
+
*/
|
|
243
|
+
declare function compile(code: string): () => Promise<unknown>;
|
|
244
|
+
/** Longest node path kept, in characters ("/words/prefetch"). */
|
|
245
|
+
declare const MAX_NODE_PATH = 80;
|
|
246
|
+
/** Longest assignee id kept (`agentId`), in characters. */
|
|
247
|
+
declare const MAX_AGENT_ID = 40;
|
|
248
|
+
/** The main thread's node: the root of the tree. */
|
|
249
|
+
declare const ROOT_NODE = "/";
|
|
250
|
+
/**
|
|
251
|
+
* A node path, normalised: trimmed, a leading "/", segments split on "/" or
|
|
252
|
+
* "›" (so "/words › prefetch" and "words/prefetch" are "/words/prefetch"),
|
|
253
|
+
* no empty, "." or ".." segment, at most MAX_NODE_PATH characters, path
|
|
254
|
+
* characters only. Anything else is undefined (never truncated: a cut path
|
|
255
|
+
* would name another node).
|
|
256
|
+
*/
|
|
257
|
+
declare function nodePath(raw: unknown): string | undefined;
|
|
258
|
+
/** An assignee id: trimmed, cut to MAX_AGENT_ID, letters, digits and ._@:+- or spaces only. */
|
|
259
|
+
declare function agentIdOf(raw: unknown): string | undefined;
|
|
260
|
+
/** `p` is `root` or below it. Both are normalised node paths. */
|
|
261
|
+
declare function isWithin(p: string, root: string): boolean;
|
|
262
|
+
/** The deepest node both paths are within. */
|
|
263
|
+
declare function commonAncestor(a: string, b: string): string;
|
|
264
|
+
/** How a node path reads in the chat: "/words › prefetch" ("/" stays "/"). */
|
|
265
|
+
declare function pathLabel(p: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* Whether a listener at node `listener` gets a message addressed to `to`
|
|
268
|
+
* (both absent = the root, the main thread, as before node paths):
|
|
269
|
+
* "direct" when it is that node, "observed" when it is an ancestor (the
|
|
270
|
+
* root observes everything), null otherwise (a sibling or a descendant).
|
|
271
|
+
*/
|
|
272
|
+
declare function routeTo(listener: string | undefined, to: string | undefined): "direct" | "observed" | null;
|
|
273
|
+
/** An approval that lets senders within `from` address nodes within `to`. */
|
|
274
|
+
type NodeGrant = {
|
|
275
|
+
from: string;
|
|
276
|
+
to: string;
|
|
277
|
+
until: number;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* May a sender at node `from` address node `to`? Always into its own
|
|
281
|
+
* subtree, always upward (its parent, any ancestor, the root), else only
|
|
282
|
+
* under a live grant covering both. The error names the common ancestor,
|
|
283
|
+
* whose listener (or the root's) may grant it.
|
|
284
|
+
*/
|
|
285
|
+
declare function mayAddress(from: string, to: string, grants?: readonly NodeGrant[], now?: number): {
|
|
286
|
+
ok: true;
|
|
287
|
+
via: "subtree" | "upward" | "grant";
|
|
288
|
+
} | {
|
|
289
|
+
ok: false;
|
|
290
|
+
error: string;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* A draft that starts with "@/words › prefetch " (or "@/words/prefetch ")
|
|
294
|
+
* addresses that node: `to` and the rest of the text. `complete` is false
|
|
295
|
+
* while the address is still being typed (no space after it yet). Null when
|
|
296
|
+
* the draft is not an address.
|
|
297
|
+
*/
|
|
298
|
+
declare function parseAddress(draft: string): {
|
|
299
|
+
to: string;
|
|
300
|
+
text: string;
|
|
301
|
+
complete: boolean;
|
|
302
|
+
} | null;
|
|
303
|
+
/** The node paths offered while typing "@/…": those starting with what is typed, shortest first. */
|
|
304
|
+
declare function completeNode(partial: string, nodes: readonly string[]): string[];
|
|
305
|
+
/** A node's hue (0–359), from its path: the log line's left border. */
|
|
306
|
+
declare function nodeHue(p: string): number;
|
|
307
|
+
/**
|
|
308
|
+
* What a log line shows about nodes: the node it belongs to (an agent's
|
|
309
|
+
* `taskPath`, else the owner's target `to`), the muted subtitle ("/words ›
|
|
310
|
+
* prefetch", "→ /words › prefetch", or "/a › b → /c" for agent→agent), and
|
|
311
|
+
* its left-border colour. Nothing for a main-thread line without a node.
|
|
312
|
+
*/
|
|
313
|
+
declare function lineNode(m: {
|
|
314
|
+
from: string;
|
|
315
|
+
taskPath?: string;
|
|
316
|
+
to?: string;
|
|
317
|
+
}): {
|
|
318
|
+
node: string;
|
|
319
|
+
subtitle: string;
|
|
320
|
+
border: string;
|
|
321
|
+
} | null;
|
|
322
|
+
//#endregion
|
|
323
|
+
export { APPROVAL_MS, AvatarSrc, BUSY_AFTER_REPLY_MS, BUSY_MS, CHAT_HISTORY, CHAT_MS, ChatMessage, ControllerMessage, EVAL_GRANT_MS, EditMark, EditedEvent, HubState, MAX_AGENT_ID, MAX_CHAT, MAX_CODE, MAX_EDITS, MAX_LABEL, MAX_NODE_PATH, MAX_RESULT, MessageSource, NodeGrant, PAGES_GONE_MS, PAGE_DEBOUNCE_MS, PENDING_MS, PageInfo, PageMessage, PairInfo, ROOT_NODE, Scope, Sender, agentIdOf, applyEdit, chatText, cleanLabel, commonAncestor, compile, completeNode, dictatedDraft, draftSource, isPageId, isWithin, lineNode, matchesTarget, mayAddress, nodeHue, nodePath, parseAddress, parseControllerMessage, parsePageMessage, pathLabel, pickLang, pickVoice, routeTo, shortCode, summarize, trimHistory };
|
|
324
|
+
//# sourceMappingURL=protocol.d.ts.map
|