osborn 0.9.271 → 0.9.274

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.
Files changed (55) hide show
  1. package/.claude/skills/browser-apply/SKILL.md +82 -30
  2. package/.claude/skills/browser-apply/candidate.example.env +16 -0
  3. package/.claude/skills/browser-apply/fill.mjs +294 -0
  4. package/Dockerfile +1 -1
  5. package/dist/claude-llm.d.ts +3 -0
  6. package/dist/claude-llm.js +100 -17
  7. package/dist/compaction-log.d.ts +67 -0
  8. package/dist/compaction-log.js +195 -0
  9. package/dist/config.d.ts +18 -0
  10. package/dist/config.js +122 -65
  11. package/dist/content/transcript-sanitizer.d.ts +20 -6
  12. package/dist/content/transcript-sanitizer.js +66 -11
  13. package/dist/data-sender-auth.d.ts +90 -0
  14. package/dist/data-sender-auth.js +157 -0
  15. package/dist/env-keys.js +11 -0
  16. package/dist/index.js +411 -92
  17. package/dist/meeting-addressing.d.ts +176 -0
  18. package/dist/meeting-addressing.js +288 -0
  19. package/dist/pipeline-direct-llm.d.ts +27 -0
  20. package/dist/pipeline-direct-llm.js +117 -37
  21. package/dist/prompts/direct-mode-fallback.md +1 -1
  22. package/dist/prompts/direct-mode-research.md +2 -2
  23. package/dist/prompts.d.ts +1 -1
  24. package/dist/prompts.js +3 -3
  25. package/dist/pushover.d.ts +77 -0
  26. package/dist/pushover.js +276 -0
  27. package/dist/recall-client.js +21 -2
  28. package/dist/session-store.d.ts +15 -5
  29. package/dist/session-store.js +37 -10
  30. package/dist/transcript-wiring.d.ts +121 -0
  31. package/dist/transcript-wiring.js +252 -0
  32. package/dist/voice-io.d.ts +0 -9
  33. package/dist/voice-io.js +5 -19
  34. package/dist/watch-gateway.d.ts +38 -0
  35. package/dist/watch-gateway.js +205 -0
  36. package/package.json +1 -1
  37. package/scripts/review.ts +1 -1
  38. package/dist/bridge-llm.d.ts +0 -22
  39. package/dist/bridge-llm.js +0 -39
  40. package/dist/codex-handler.d.ts +0 -38
  41. package/dist/codex-handler.js +0 -83
  42. package/dist/codex-llm.d.ts +0 -40
  43. package/dist/codex-llm.js +0 -144
  44. package/dist/fast-brain.d.ts +0 -176
  45. package/dist/fast-brain.js +0 -1887
  46. package/dist/index-3-2-26-legacy.d.ts +0 -1
  47. package/dist/index-3-2-26-legacy.js +0 -2233
  48. package/dist/leagcyprompts2.d.ts +0 -0
  49. package/dist/leagcyprompts2.js +0 -573
  50. package/dist/prompts-2-25-26.d.ts +0 -0
  51. package/dist/prompts-2-25-26.js +0 -518
  52. package/dist/prompts-3-2-26.d.ts +0 -78
  53. package/dist/prompts-3-2-26.js +0 -1319
  54. package/dist/summary-index.d.ts +0 -90
  55. package/dist/summary-index.js +0 -585
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Meeting multi-participant addressing + mute — scaffolding (OFF by default).
3
+ *
4
+ * WHY THIS EXISTS
5
+ * The comm-layer design (docs: Tier-1 router / Tier-2 workers) and the meeting
6
+ * copilot both want a way, in a multi-speaker room, to (a) address a SPECIFIC
7
+ * named agent ("@researcher, dig into X") rather than just "the bot", and
8
+ * (b) mute a noisy participant so their utterances never reach the LLM. The
9
+ * live meeting path today only does fuzzy single-name matching for "Osborn" and
10
+ * a global interactive/observer latch (see index.ts recall.on('transcript')).
11
+ * There is no per-agent routing and no per-participant mute. This module is the
12
+ * smallest, fully-additive first step toward that runtime.
13
+ *
14
+ * SAFETY CONTRACT
15
+ * - OFF BY DEFAULT. The singleton's `enabled` getter reads
16
+ * OSBORN_MEETING_ADDRESSING lazily; unless it is exactly 'on'/'1'/'true',
17
+ * processUtterance() is a pure pass-through: it never drops, never rewrites,
18
+ * never routes. With the flag unset there is ZERO behavior change.
19
+ * - PURE CORE. parseAddressing / parseMuteCommand / resolveAgent / buildRoster
20
+ * are pure functions with no I/O, so the regression suite can pin them without
21
+ * a network or a live meeting.
22
+ * - NO SIDE EFFECTS ON IMPORT. Only a class, some functions, and one singleton
23
+ * with no timers and no env reads at module load.
24
+ *
25
+ * WHAT IS REAL vs SCAFFOLD
26
+ * - REAL: the addressing parser, the mute command parser, the MuteRegistry, the
27
+ * flag gate, and the combined processUtterance() verdict object.
28
+ * - SCAFFOLD / NOT WIRED: the verdict's `target` does not yet route the turn to
29
+ * that Tier-2 worker (that needs the SDK-queue feed described in
30
+ * docs/multiagent-runtime-plan.md). Today the meeting handler only logs the
31
+ * verdict behind the flag and honours `drop` for muted speakers.
32
+ */
33
+ /** A target that can be addressed in a meeting: the orchestrator or a worker. */
34
+ export interface MeetingAgentDef {
35
+ /** Canonical id used for routing, e.g. 'researcher' or 'osborn'. */
36
+ id: string;
37
+ /** Human label for logs/UI, e.g. 'Researcher'. */
38
+ label: string;
39
+ /** Lowercase tokens (without '@') that resolve to this id. */
40
+ aliases: string[];
41
+ }
42
+ export type MeetingRoster = MeetingAgentDef[];
43
+ /**
44
+ * Default addressable names. 'osborn' is the orchestrator (the main agent /
45
+ * the bot itself); the rest mirror the built-in NAMED_AGENTS worker roster in
46
+ * claude-llm.ts. Kept as a plain list (not an import of NAMED_AGENTS) to avoid
47
+ * coupling this leaf module to the LLM module — the runtime can override at
48
+ * startup via setRoster(Object.keys(NAMED_AGENTS)).
49
+ */
50
+ export declare const DEFAULT_AGENT_NAMES: readonly ["osborn", "researcher", "reasoner", "writer", "planner", "reviewer", "tester"];
51
+ /** The orchestrator's canonical id — the main agent / "the bot" itself. An
52
+ * utterance addressed to it is NOT routed to a Tier-2 worker (the orchestrator
53
+ * already IS the turn's handler); only a NON-orchestrator target is routable. */
54
+ export declare const ORCHESTRATOR_ID = "osborn";
55
+ /**
56
+ * Whether an addressing target should be routed to a specific Tier-2 worker.
57
+ * True only for a concrete, non-orchestrator target. Pure — the single source
58
+ * of the Phase-C routing decision, shared by the meeting handler and the tests
59
+ * so the "@researcher routes, @osborn does not" rule is pinned without a live
60
+ * meeting. Fail-safe: null / undefined / the orchestrator id all return false.
61
+ */
62
+ export declare function isRoutableTarget(target: string | null | undefined): boolean;
63
+ /** Build a roster from a list of agent ids. Aliases default to the id plus a
64
+ * couple of forgiving variants (hyphen/space collapsed). Extra aliases let the
65
+ * caller add room-specific nicknames. Pure. */
66
+ export declare function buildRoster(names?: readonly string[], extraAliases?: Record<string, string[]>): MeetingRoster;
67
+ /** Resolve a single token (with or without a leading '@') to a canonical agent
68
+ * id, or null if nothing in the roster matches. Case-insensitive. Pure. */
69
+ export declare function resolveAgent(token: string, roster: MeetingRoster): string | null;
70
+ export interface AddressingResult {
71
+ /** Canonical agent id addressed, or null if the turn addresses no one specific. */
72
+ target: string | null;
73
+ /** The utterance with the matched addressing token removed (whitespace tidied).
74
+ * Equals the input when there was no match. NEVER a paraphrase — only the
75
+ * single addressing token is stripped. */
76
+ cleanedText: string;
77
+ /** The raw token that matched (for logging), e.g. '@researcher'. */
78
+ token?: string;
79
+ }
80
+ /**
81
+ * Parse @-addressing out of an utterance. Resolution order:
82
+ * 1. The first '@mention' whose token resolves in the roster.
83
+ * 2. Otherwise a leading "<alias>," / "<alias>:" address, only if the alias
84
+ * resolves in the roster (so plain sentences like "So, let's..." are NOT
85
+ * treated as addressing).
86
+ * Returns the resolved target (or null) and the utterance with just that one
87
+ * addressing token removed. Pure — no state, no I/O.
88
+ */
89
+ export declare function parseAddressing(text: string, roster: MeetingRoster): AddressingResult;
90
+ export interface MuteCommand {
91
+ action: 'mute' | 'unmute' | null;
92
+ /** Lowercased participant name, '*' for everyone, or null when none parsed. */
93
+ who: string | null;
94
+ }
95
+ /**
96
+ * Parse an explicit mute/unmute command from an utterance. Conservative: the
97
+ * command must LEAD the utterance (after an optional "please"/"can you" lead)
98
+ * and name a target, so ordinary sentences that merely contain the word "mute"
99
+ * mid-speech don't trigger it. Pure. Returns { action: null, who: null } when
100
+ * nothing matches.
101
+ */
102
+ export declare function parseMuteCommand(text: string): MuteCommand;
103
+ /** Case-insensitive set of muted participant names, plus a global mute-all flag. */
104
+ export declare class MuteRegistry {
105
+ #private;
106
+ mute(who: string): void;
107
+ unmute(who: string): void;
108
+ isMuted(name: string): boolean;
109
+ list(): string[];
110
+ clear(): void;
111
+ }
112
+ export interface UtteranceVerdict {
113
+ /** Whether the addressing/mute layer was active (flag on) for this utterance. */
114
+ gated: boolean;
115
+ /** True when the speaker is muted and the utterance should NOT reach the LLM. */
116
+ drop: boolean;
117
+ /** Canonical agent id the utterance addresses, or null. */
118
+ target: string | null;
119
+ /** Utterance with any addressing token stripped (verbatim otherwise). */
120
+ cleanedText: string;
121
+ /** Set when this utterance was itself a mute/unmute command that was applied. */
122
+ muteChanged?: {
123
+ action: 'mute' | 'unmute';
124
+ who: string;
125
+ };
126
+ }
127
+ /**
128
+ * Singleton meeting-addressing layer. One per agent process (one meeting at a
129
+ * time per machine), mirroring the noiseGate singleton pattern. Stateful only
130
+ * in the MuteRegistry and the (overridable) roster.
131
+ */
132
+ declare class MeetingAddressing {
133
+ #private;
134
+ readonly mutes: MuteRegistry;
135
+ /** OFF unless OSBORN_MEETING_ADDRESSING is on/1/true. Read lazily so ops can
136
+ * flip it at runtime without a republish (same discipline as noiseGate). */
137
+ get enabled(): boolean;
138
+ get roster(): MeetingRoster;
139
+ /** Canonical ids of the addressable roster (for emitting to the frontend). */
140
+ get rosterIds(): string[];
141
+ /**
142
+ * Apply an out-of-band mute/unmute control (e.g. a `mute_participant` message
143
+ * from the frontend) to the registry. Normalizes the name the same way voice
144
+ * commands do (lowercase/trim; everyone|everybody|all → '*') and returns the
145
+ * applied change for emission, or null when nothing valid was given. Pure of
146
+ * I/O — only mutates the registry — so the control path is testable without a
147
+ * live room or the data channel.
148
+ */
149
+ applyMuteControl(action: 'mute' | 'unmute', who: string): {
150
+ action: 'mute' | 'unmute';
151
+ who: string;
152
+ } | null;
153
+ /** Snapshot of the addressing/mute layer for the frontend meeting_state msg. */
154
+ state(): {
155
+ enabled: boolean;
156
+ roster: string[];
157
+ muted: string[];
158
+ };
159
+ /** Override the addressable roster, e.g. from Object.keys(NAMED_AGENTS) at
160
+ * startup, or from per-user named agents. */
161
+ setRoster(names: readonly string[], extraAliases?: Record<string, string[]>): void;
162
+ /** Reset per-meeting state (call on leave_meeting / session switch). */
163
+ reset(): void;
164
+ /**
165
+ * The combined per-utterance verdict. PURE PASS-THROUGH when disabled:
166
+ * returns the input verbatim with drop=false, target=null. When enabled it
167
+ * (1) applies any mute/unmute command FIRST (so a muted speaker can still
168
+ * unmute themselves), (2) decides drop from the mute registry, and
169
+ * (3) parses @-addressing. It NEVER paraphrases — cleanedText only ever has a
170
+ * single addressing token removed.
171
+ */
172
+ processUtterance(speaker: string, text: string): UtteranceVerdict;
173
+ }
174
+ /** Process-wide singleton (no side effects on import). */
175
+ export declare const meetingAddressing: MeetingAddressing;
176
+ export {};
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Meeting multi-participant addressing + mute — scaffolding (OFF by default).
3
+ *
4
+ * WHY THIS EXISTS
5
+ * The comm-layer design (docs: Tier-1 router / Tier-2 workers) and the meeting
6
+ * copilot both want a way, in a multi-speaker room, to (a) address a SPECIFIC
7
+ * named agent ("@researcher, dig into X") rather than just "the bot", and
8
+ * (b) mute a noisy participant so their utterances never reach the LLM. The
9
+ * live meeting path today only does fuzzy single-name matching for "Osborn" and
10
+ * a global interactive/observer latch (see index.ts recall.on('transcript')).
11
+ * There is no per-agent routing and no per-participant mute. This module is the
12
+ * smallest, fully-additive first step toward that runtime.
13
+ *
14
+ * SAFETY CONTRACT
15
+ * - OFF BY DEFAULT. The singleton's `enabled` getter reads
16
+ * OSBORN_MEETING_ADDRESSING lazily; unless it is exactly 'on'/'1'/'true',
17
+ * processUtterance() is a pure pass-through: it never drops, never rewrites,
18
+ * never routes. With the flag unset there is ZERO behavior change.
19
+ * - PURE CORE. parseAddressing / parseMuteCommand / resolveAgent / buildRoster
20
+ * are pure functions with no I/O, so the regression suite can pin them without
21
+ * a network or a live meeting.
22
+ * - NO SIDE EFFECTS ON IMPORT. Only a class, some functions, and one singleton
23
+ * with no timers and no env reads at module load.
24
+ *
25
+ * WHAT IS REAL vs SCAFFOLD
26
+ * - REAL: the addressing parser, the mute command parser, the MuteRegistry, the
27
+ * flag gate, and the combined processUtterance() verdict object.
28
+ * - SCAFFOLD / NOT WIRED: the verdict's `target` does not yet route the turn to
29
+ * that Tier-2 worker (that needs the SDK-queue feed described in
30
+ * docs/multiagent-runtime-plan.md). Today the meeting handler only logs the
31
+ * verdict behind the flag and honours `drop` for muted speakers.
32
+ */
33
+ /**
34
+ * Default addressable names. 'osborn' is the orchestrator (the main agent /
35
+ * the bot itself); the rest mirror the built-in NAMED_AGENTS worker roster in
36
+ * claude-llm.ts. Kept as a plain list (not an import of NAMED_AGENTS) to avoid
37
+ * coupling this leaf module to the LLM module — the runtime can override at
38
+ * startup via setRoster(Object.keys(NAMED_AGENTS)).
39
+ */
40
+ export const DEFAULT_AGENT_NAMES = [
41
+ 'osborn',
42
+ 'researcher',
43
+ 'reasoner',
44
+ 'writer',
45
+ 'planner',
46
+ 'reviewer',
47
+ 'tester',
48
+ ];
49
+ /** The orchestrator's canonical id — the main agent / "the bot" itself. An
50
+ * utterance addressed to it is NOT routed to a Tier-2 worker (the orchestrator
51
+ * already IS the turn's handler); only a NON-orchestrator target is routable. */
52
+ export const ORCHESTRATOR_ID = 'osborn';
53
+ /**
54
+ * Whether an addressing target should be routed to a specific Tier-2 worker.
55
+ * True only for a concrete, non-orchestrator target. Pure — the single source
56
+ * of the Phase-C routing decision, shared by the meeting handler and the tests
57
+ * so the "@researcher routes, @osborn does not" rule is pinned without a live
58
+ * meeting. Fail-safe: null / undefined / the orchestrator id all return false.
59
+ */
60
+ export function isRoutableTarget(target) {
61
+ const t = String(target || '').trim().toLowerCase();
62
+ return !!t && t !== ORCHESTRATOR_ID;
63
+ }
64
+ /** Build a roster from a list of agent ids. Aliases default to the id plus a
65
+ * couple of forgiving variants (hyphen/space collapsed). Extra aliases let the
66
+ * caller add room-specific nicknames. Pure. */
67
+ export function buildRoster(names = DEFAULT_AGENT_NAMES, extraAliases = {}) {
68
+ const seen = new Set();
69
+ const roster = [];
70
+ for (const raw of names) {
71
+ const id = String(raw || '').trim().toLowerCase();
72
+ if (!id || seen.has(id))
73
+ continue;
74
+ seen.add(id);
75
+ const aliases = new Set([id, id.replace(/[-_\s]+/g, '')]);
76
+ for (const a of extraAliases[id] || []) {
77
+ const t = String(a || '').trim().toLowerCase();
78
+ if (t)
79
+ aliases.add(t);
80
+ }
81
+ roster.push({ id, label: id.charAt(0).toUpperCase() + id.slice(1), aliases: [...aliases] });
82
+ }
83
+ return roster;
84
+ }
85
+ /** Resolve a single token (with or without a leading '@') to a canonical agent
86
+ * id, or null if nothing in the roster matches. Case-insensitive. Pure. */
87
+ export function resolveAgent(token, roster) {
88
+ const t = String(token || '').trim().toLowerCase().replace(/^@+/, '').replace(/[^a-z0-9_-]/g, '');
89
+ if (!t)
90
+ return null;
91
+ for (const a of roster)
92
+ if (a.id === t || a.aliases.includes(t))
93
+ return a.id;
94
+ return null;
95
+ }
96
+ // '@name' mention anywhere in the utterance. The capture excludes the '@'.
97
+ const MENTION_RE = /@([a-z0-9][a-z0-9_-]*)/i;
98
+ // Leading direct address: "researcher, ..." or "researcher: ..." at the start.
99
+ const LEADING_RE = /^\s*([a-z][a-z0-9_-]*)\s*[,:]\s+/i;
100
+ /**
101
+ * Parse @-addressing out of an utterance. Resolution order:
102
+ * 1. The first '@mention' whose token resolves in the roster.
103
+ * 2. Otherwise a leading "<alias>," / "<alias>:" address, only if the alias
104
+ * resolves in the roster (so plain sentences like "So, let's..." are NOT
105
+ * treated as addressing).
106
+ * Returns the resolved target (or null) and the utterance with just that one
107
+ * addressing token removed. Pure — no state, no I/O.
108
+ */
109
+ export function parseAddressing(text, roster) {
110
+ const input = String(text ?? '');
111
+ if (!input.trim())
112
+ return { target: null, cleanedText: input };
113
+ const m = input.match(MENTION_RE);
114
+ if (m) {
115
+ const target = resolveAgent(m[1], roster);
116
+ if (target) {
117
+ const token = m[0];
118
+ const cleanedText = input.replace(token, ' ').replace(/\s{2,}/g, ' ').trim();
119
+ return { target, cleanedText, token };
120
+ }
121
+ // An '@token' that is NOT a known agent is left untouched (could be a handle,
122
+ // an email fragment, etc.) — fall through to the leading-address check.
123
+ }
124
+ const lead = input.match(LEADING_RE);
125
+ if (lead) {
126
+ const target = resolveAgent(lead[1], roster);
127
+ if (target) {
128
+ const token = lead[0];
129
+ const cleanedText = input.slice(token.length).trim();
130
+ return { target, cleanedText, token: lead[1] };
131
+ }
132
+ }
133
+ return { target: null, cleanedText: input };
134
+ }
135
+ // "mute <name>" / "unmute <name>" / "mute everyone|all|me", optionally with a
136
+ // short polite lead ("please mute Daniel"). The <name> is 1-2 words.
137
+ const MUTE_RE = /^(?:(?:can|could|would) you\s+|please\s+)?(mute|unmute)\s+(everyone|everybody|all|me|[a-z][a-z0-9'._-]*(?:\s+[a-z][a-z0-9'._-]*)?)\s*$/i;
138
+ /**
139
+ * Parse an explicit mute/unmute command from an utterance. Conservative: the
140
+ * command must LEAD the utterance (after an optional "please"/"can you" lead)
141
+ * and name a target, so ordinary sentences that merely contain the word "mute"
142
+ * mid-speech don't trigger it. Pure. Returns { action: null, who: null } when
143
+ * nothing matches.
144
+ */
145
+ export function parseMuteCommand(text) {
146
+ const t = String(text ?? '').trim().replace(/\s+(please|now|thanks)\.?\s*$/i, '');
147
+ const m = t.match(MUTE_RE);
148
+ if (!m)
149
+ return { action: null, who: null };
150
+ const action = m[1].toLowerCase();
151
+ const rawWho = m[2].trim().toLowerCase();
152
+ const who = /^(everyone|everybody|all)$/.test(rawWho) ? '*' : rawWho.replace(/[.,!?]+$/, '');
153
+ return { action, who: who || null };
154
+ }
155
+ /** Case-insensitive set of muted participant names, plus a global mute-all flag. */
156
+ export class MuteRegistry {
157
+ #muted = new Set();
158
+ #all = false;
159
+ mute(who) {
160
+ const w = String(who || '').trim().toLowerCase();
161
+ if (!w)
162
+ return;
163
+ if (w === '*') {
164
+ this.#all = true;
165
+ return;
166
+ }
167
+ this.#muted.add(w);
168
+ }
169
+ unmute(who) {
170
+ const w = String(who || '').trim().toLowerCase();
171
+ if (!w)
172
+ return;
173
+ if (w === '*') {
174
+ this.#all = false;
175
+ this.#muted.clear();
176
+ return;
177
+ }
178
+ this.#muted.delete(w);
179
+ }
180
+ isMuted(name) {
181
+ const n = String(name || '').trim().toLowerCase();
182
+ if (!n)
183
+ return false;
184
+ if (this.#muted.has(n))
185
+ return true;
186
+ // mute-all applies to everyone EXCEPT names explicitly carved out is not a
187
+ // feature yet; '*' simply mutes all participants.
188
+ return this.#all;
189
+ }
190
+ list() {
191
+ return this.#all ? ['*', ...[...this.#muted].sort()] : [...this.#muted].sort();
192
+ }
193
+ clear() {
194
+ this.#muted.clear();
195
+ this.#all = false;
196
+ }
197
+ }
198
+ /**
199
+ * Singleton meeting-addressing layer. One per agent process (one meeting at a
200
+ * time per machine), mirroring the noiseGate singleton pattern. Stateful only
201
+ * in the MuteRegistry and the (overridable) roster.
202
+ */
203
+ class MeetingAddressing {
204
+ #roster = buildRoster();
205
+ mutes = new MuteRegistry();
206
+ /** OFF unless OSBORN_MEETING_ADDRESSING is on/1/true. Read lazily so ops can
207
+ * flip it at runtime without a republish (same discipline as noiseGate). */
208
+ get enabled() {
209
+ const v = String(process.env.OSBORN_MEETING_ADDRESSING || '').trim().toLowerCase();
210
+ return v === 'on' || v === '1' || v === 'true';
211
+ }
212
+ get roster() {
213
+ return this.#roster;
214
+ }
215
+ /** Canonical ids of the addressable roster (for emitting to the frontend). */
216
+ get rosterIds() {
217
+ return this.#roster.map((a) => a.id);
218
+ }
219
+ /**
220
+ * Apply an out-of-band mute/unmute control (e.g. a `mute_participant` message
221
+ * from the frontend) to the registry. Normalizes the name the same way voice
222
+ * commands do (lowercase/trim; everyone|everybody|all → '*') and returns the
223
+ * applied change for emission, or null when nothing valid was given. Pure of
224
+ * I/O — only mutates the registry — so the control path is testable without a
225
+ * live room or the data channel.
226
+ */
227
+ applyMuteControl(action, who) {
228
+ const raw = String(who || '').trim().toLowerCase();
229
+ if (!raw)
230
+ return null;
231
+ const target = /^(everyone|everybody|all)$/.test(raw) ? '*' : raw;
232
+ if (action === 'mute')
233
+ this.mutes.mute(target);
234
+ else
235
+ this.mutes.unmute(target);
236
+ return { action, who: target };
237
+ }
238
+ /** Snapshot of the addressing/mute layer for the frontend meeting_state msg. */
239
+ state() {
240
+ return { enabled: this.enabled, roster: this.rosterIds, muted: this.mutes.list() };
241
+ }
242
+ /** Override the addressable roster, e.g. from Object.keys(NAMED_AGENTS) at
243
+ * startup, or from per-user named agents. */
244
+ setRoster(names, extraAliases) {
245
+ this.#roster = buildRoster(names, extraAliases);
246
+ }
247
+ /** Reset per-meeting state (call on leave_meeting / session switch). */
248
+ reset() {
249
+ this.mutes.clear();
250
+ }
251
+ /**
252
+ * The combined per-utterance verdict. PURE PASS-THROUGH when disabled:
253
+ * returns the input verbatim with drop=false, target=null. When enabled it
254
+ * (1) applies any mute/unmute command FIRST (so a muted speaker can still
255
+ * unmute themselves), (2) decides drop from the mute registry, and
256
+ * (3) parses @-addressing. It NEVER paraphrases — cleanedText only ever has a
257
+ * single addressing token removed.
258
+ */
259
+ processUtterance(speaker, text) {
260
+ if (!this.enabled) {
261
+ return { gated: false, drop: false, target: null, cleanedText: String(text ?? '') };
262
+ }
263
+ let muteChanged;
264
+ const cmd = parseMuteCommand(text);
265
+ if (cmd.action && cmd.who) {
266
+ // "mute me" / "unmute me" resolve to the current speaker.
267
+ const who = cmd.who === 'me' ? String(speaker || '').trim().toLowerCase() : cmd.who;
268
+ if (who) {
269
+ if (cmd.action === 'mute')
270
+ this.mutes.mute(who);
271
+ else
272
+ this.mutes.unmute(who);
273
+ muteChanged = { action: cmd.action, who };
274
+ }
275
+ }
276
+ const drop = this.mutes.isMuted(speaker);
277
+ const addr = parseAddressing(text, this.#roster);
278
+ return {
279
+ gated: true,
280
+ drop,
281
+ target: addr.target,
282
+ cleanedText: addr.cleanedText,
283
+ ...(muteChanged ? { muteChanged } : {}),
284
+ };
285
+ }
286
+ }
287
+ /** Process-wide singleton (no side effects on import). */
288
+ export const meetingAddressing = new MeetingAddressing();
@@ -11,6 +11,31 @@
11
11
  import { llm, type APIConnectOptions } from '@livekit/agents';
12
12
  import { type ClaudeLLMOptions } from './claude-llm.js';
13
13
  import { EventEmitter } from 'events';
14
+ export declare const SESSION_TAIL_DEFAULT_ROWS = 200;
15
+ export declare const SESSION_TAIL_DEFAULT_MAX_CHARS = 16000;
16
+ export declare function buildSessionTail(sessionId: string | null, workingDir: string, opts?: {
17
+ maxRows?: number;
18
+ maxChars?: number;
19
+ }): string;
20
+ /**
21
+ * Return a SHALLOW COPY of `chatCtx` whose last user message is a clone carrying
22
+ * `text`. The original context, its items array and every item object stay
23
+ * untouched — the LiveKit session echoes the ORIGINAL user item to the frontend
24
+ * (conversation_item_added → user_transcript), so mutating it leaked the
25
+ * [INTERRUPTED]/[CONTEXT]/<session_tail> enrichment into chat (UI#16). Earlier
26
+ * items are shared by reference; the clone keeps the item's id/role/prototype.
27
+ * Synchronous by design (chat() must stay sync). Returns the original when there
28
+ * is no user message.
29
+ */
30
+ export declare function withLastUserContent(chatCtx: llm.ChatContext, text: string): llm.ChatContext;
31
+ /**
32
+ * Return a SHALLOW COPY of `chatCtx` whose last user message is a clone with
33
+ * `note` prepended to its FIRST text part; every other part (images, etc.) is
34
+ * kept in place. With no text part the note becomes a new leading part. Same
35
+ * no-mutation guarantee as withLastUserContent. Returns the original when there
36
+ * is no user message.
37
+ */
38
+ export declare function withNotePrepended(chatCtx: llm.ChatContext, note: string): llm.ChatContext;
14
39
  export interface InterruptionContext {
15
40
  spokenText: string;
16
41
  recentMessages: string;
@@ -33,6 +58,8 @@ export interface PipelineDirectOptions extends ClaudeLLMOptions {
33
58
  getResearchContext?: () => string | undefined;
34
59
  /** Returns pending interruption context and clears it (consumed once). null = no pending interruption. */
35
60
  getAndConsumeInterruptionContext?: () => InterruptionContext | null;
61
+ /** Returns pending client notices as a hidden-context block and clears them ('' = none). */
62
+ getAndConsumeClientNotes?: () => string;
36
63
  }
37
64
  export interface FastBrainPanelResult {
38
65
  question: string;