osborn 0.9.290 → 0.9.291
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/claude-llm.d.ts +3 -0
- package/dist/claude-llm.js +19 -1
- package/dist/content/lens-library-index.js +1 -1
- package/dist/data-sender-auth.d.ts +74 -2
- package/dist/data-sender-auth.js +113 -3
- package/dist/index.js +133 -19
- package/dist/pipeline-direct-llm.d.ts +1 -0
- package/dist/pipeline-direct-llm.js +1 -0
- package/dist/prompts.d.ts +4 -0
- package/dist/prompts.js +4 -0
- package/package.json +1 -1
package/dist/claude-llm.d.ts
CHANGED
|
@@ -211,6 +211,9 @@ export declare class ClaudeLLM extends llm.LLM {
|
|
|
211
211
|
setTurbo(on: boolean): void;
|
|
212
212
|
/** Read-only accessor used by ClaudeLLMStream (private fields are class-scoped). */
|
|
213
213
|
get turbo(): boolean;
|
|
214
|
+
/** A phone caller holds this session (index.ts sets it per voice session): tools are denied. */
|
|
215
|
+
setPhoneCall(on: boolean): void;
|
|
216
|
+
get phoneCall(): boolean;
|
|
214
217
|
permissionPending: boolean;
|
|
215
218
|
compacting: boolean;
|
|
216
219
|
/**
|
package/dist/claude-llm.js
CHANGED
|
@@ -11,7 +11,8 @@ import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
12
|
import { saveSessionMetadata, getSessionWorkspace } from './config.js';
|
|
13
13
|
import { statusManager } from './status-manager.js';
|
|
14
|
-
import { getResearchSystemPrompt, getDirectModeResearchPrompt, getStewardPrompt, getChainReminder, getGroundingBlock, getRecalledContextBlock } from './prompts.js';
|
|
14
|
+
import { getResearchSystemPrompt, getDirectModeResearchPrompt, getStewardPrompt, getChainReminder, getGroundingBlock, getRecalledContextBlock, PHONE_TOOLS_DENIED } from './prompts.js';
|
|
15
|
+
import { phoneToolPolicy } from './data-sender-auth.js';
|
|
15
16
|
import { openStore, recall, storeExists, updateSessionStore, getStorePath } from './session-store.js';
|
|
16
17
|
import { appendCompactionRecord, countTranscriptRows } from './compaction-log.js';
|
|
17
18
|
import { getEmbedder } from './embedder.js';
|
|
@@ -1244,6 +1245,9 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1244
1245
|
// Turbo mode — when true, every spawned agent (main + sub-agents) runs on
|
|
1245
1246
|
// FAST_MODEL regardless of individual model config. Default off = no-op.
|
|
1246
1247
|
#turbo = false;
|
|
1248
|
+
// Phone call — when true, the PreToolUse hook denies every tool (talk-only
|
|
1249
|
+
// call, see PHONE_TOOLS_ENABLED). Read at each tool call, so it applies mid-session.
|
|
1250
|
+
#phoneCall = false;
|
|
1247
1251
|
constructor(opts = {}) {
|
|
1248
1252
|
super();
|
|
1249
1253
|
// Session resume/continue options
|
|
@@ -1445,6 +1449,13 @@ export class ClaudeLLM extends llm.LLM {
|
|
|
1445
1449
|
}
|
|
1446
1450
|
/** Read-only accessor used by ClaudeLLMStream (private fields are class-scoped). */
|
|
1447
1451
|
get turbo() { return this.#turbo; }
|
|
1452
|
+
/** A phone caller holds this session (index.ts sets it per voice session): tools are denied. */
|
|
1453
|
+
setPhoneCall(on) {
|
|
1454
|
+
if (this.#phoneCall !== on)
|
|
1455
|
+
console.log(`📞 Phone call ${on ? 'ON: tools denied' : 'OFF'}`);
|
|
1456
|
+
this.#phoneCall = on;
|
|
1457
|
+
}
|
|
1458
|
+
get phoneCall() { return this.#phoneCall; }
|
|
1448
1459
|
// Steer-priority suppression state (adversarial findings #1/#8): a 'now'
|
|
1449
1460
|
// message aborts the running turn, so never stamp it while that turn is
|
|
1450
1461
|
// parked on a permission dialog (the user's spoken "yes, allow it" would
|
|
@@ -2515,6 +2526,13 @@ class ClaudeLLMStream extends llm.LLMStream {
|
|
|
2515
2526
|
const toolInput = input?.tool_input || {};
|
|
2516
2527
|
const agentType = input?.agent_type || null;
|
|
2517
2528
|
console.log(`🔍 PreToolUse: toolName=${toolName} agent_type=${agentType} agent_id=${input?.agent_id || 'none'} all_keys=[${Object.keys(input || {}).join(', ')}]`);
|
|
2529
|
+
// Phone call: talk-only. Runs before allowedTools, so it also stops the
|
|
2530
|
+
// auto-approved tools, sub-agent dispatch and MCP tools.
|
|
2531
|
+
if (phoneToolPolicy(this.#llmRef.phoneCall) === 'deny') {
|
|
2532
|
+
console.log(`📞 Phone call: denied ${toolName} (phone tools are off)`);
|
|
2533
|
+
this.#eventEmitter.emit('tool_blocked', { name: toolName, reason: 'Tools are off on a phone call.', agent: agentType ?? 'main' });
|
|
2534
|
+
return { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny' }, reason: PHONE_TOOLS_DENIED };
|
|
2535
|
+
}
|
|
2518
2536
|
// Spoken-progress cadence + runaway backstop (main orchestrator only).
|
|
2519
2537
|
// Only the MAIN agent's direct tool calls count (agent_type === null).
|
|
2520
2538
|
// Task/Agent delegations and sub-agent calls are exempt.
|
|
@@ -45,7 +45,7 @@ export function renderIndex(sessionLabel, pages) {
|
|
|
45
45
|
const ps = [...pages].sort((a, b) => a.index - b.index || a.file.localeCompare(b.file));
|
|
46
46
|
const L = [`# Content library — session ${sessionLabel}`, ''];
|
|
47
47
|
L.push('Period pages from the period map (review mode). New pages are written automatically by the content-lens worker on each ' +
|
|
48
|
-
'compaction, one per period, keyed on the period\'s opening boundary row. content-profile.md and the HWM are not touched.', '');
|
|
48
|
+
'compaction and when a session ends, one per period spanning at least an hour, keyed on the period\'s opening boundary row. content-profile.md and the HWM are not touched.', '');
|
|
49
49
|
L.push('## Periods (chronological)', '', '| # | Date range (UTC) | Rows | Period goal | Top high-leverage item | File |', '|---|---|---|---|---|---|');
|
|
50
50
|
for (const p of ps) {
|
|
51
51
|
L.push(`| ${String(p.index).padStart(2, '0')} | ${when(p.from)} → ${when(p.to)} | ${p.rows} | ${cell(p.goal)} | ${cell(p.topItem ?? '(none verified)')} | [${p.file}](${p.file}) |`);
|
|
@@ -61,6 +61,73 @@ export declare function checkControlSender(type: string, senderIdentity: string
|
|
|
61
61
|
* - No owner configured (single-tenant / local): yes (newest joiner wins).
|
|
62
62
|
*/
|
|
63
63
|
export declare function canBecomeController(participantUserId: string | undefined | null, ownerUserId: string | undefined | null): boolean;
|
|
64
|
+
/** A room name POST /connect-room may join for a phone call. */
|
|
65
|
+
export declare function isPhoneRoomName(name: unknown): name is string;
|
|
66
|
+
/** Keypad answer to a pending approval on a phone call: 1 allows, 2 denies, anything else is ignored. */
|
|
67
|
+
export declare function keypadAnswer(digit: string | undefined | null): boolean | null;
|
|
68
|
+
/**
|
|
69
|
+
* Keypad approvals on a phone call. Off: caller ID alone is not proof enough
|
|
70
|
+
* to approve a tool, so every permission raised while a phone caller holds the
|
|
71
|
+
* session is denied and keypad 1 approves nothing. Turned on once a second
|
|
72
|
+
* factor confirms the caller.
|
|
73
|
+
*/
|
|
74
|
+
export declare const PHONE_KEYPAD_APPROVALS_ENABLED = false;
|
|
75
|
+
/**
|
|
76
|
+
* Tools on a phone call. Off: a call is talk-only, so the PreToolUse hook
|
|
77
|
+
* (claude-llm.ts) denies every tool while a phone caller holds the session,
|
|
78
|
+
* including the ones allowedTools auto-approves (Bash, Read, WebFetch …),
|
|
79
|
+
* sub-agent dispatch and MCP tools. Turned on once a second factor confirms
|
|
80
|
+
* the caller.
|
|
81
|
+
*/
|
|
82
|
+
export declare const PHONE_TOOLS_ENABLED = false;
|
|
83
|
+
/** What happens to a permission raised during a phone call: denied unless keypad approvals are on. */
|
|
84
|
+
export declare function phonePermissionPolicy(inPhoneCall: boolean, approvalsEnabled?: boolean): 'deny' | 'ask';
|
|
85
|
+
/** What happens to any tool call during a phone call: denied unless phone tools are on. */
|
|
86
|
+
export declare function phoneToolPolicy(inPhoneCall: boolean, toolsEnabled?: boolean): 'deny' | 'allow';
|
|
87
|
+
/**
|
|
88
|
+
* A phone call is live: the agent is in the room an authorised phone connect
|
|
89
|
+
* asked for AND a SIP participant is in it. False as soon as the caller leaves.
|
|
90
|
+
*/
|
|
91
|
+
export declare function isPhoneCallLive(activeRoomName: string | null, phoneRoomName: string | null, sipPresent: boolean): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* What POST /connect-room does with the room the agent is in.
|
|
94
|
+
* - 'fresh': no room, or an empty one: (tear it down and) make a new room
|
|
95
|
+
* (the requested phone room, else a new name).
|
|
96
|
+
* - 'reuse': return the occupied room: a browser connect while no phone call is
|
|
97
|
+
* live, or a phone connect for the room the agent is already in.
|
|
98
|
+
* - 'busy' (409): the room is someone else's: a phone connect while a user is in
|
|
99
|
+
* another room, or a browser connect during a live phone call (the caller's
|
|
100
|
+
* room is never handed to a browser).
|
|
101
|
+
*/
|
|
102
|
+
export declare function planConnectRoom(s: {
|
|
103
|
+
activeRoomName: string | null;
|
|
104
|
+
occupied: boolean;
|
|
105
|
+
phoneCallLive: boolean;
|
|
106
|
+
phoneRoom?: string;
|
|
107
|
+
}): 'fresh' | 'reuse' | 'busy';
|
|
108
|
+
/**
|
|
109
|
+
* Handles one keypad press (index.ts DtmfReceived). Only the SIP caller in an
|
|
110
|
+
* authorised phone room counts; with approvals off a 1 settles nothing (a 2
|
|
111
|
+
* still denies). Returns what was done.
|
|
112
|
+
*/
|
|
113
|
+
export declare function handlePhoneKeypad(press: {
|
|
114
|
+
sip: boolean;
|
|
115
|
+
inPhoneRoom: boolean;
|
|
116
|
+
digit: string | undefined | null;
|
|
117
|
+
}, settle: (allow: boolean) => boolean, approvalsEnabled?: boolean): 'ignored' | 'approved' | 'denied' | 'no pending permission';
|
|
118
|
+
/** Most bytes POST /connect-room reads; its body is only `{ roomName }`. */
|
|
119
|
+
export declare const CONNECT_ROOM_MAX_BODY = 4096;
|
|
120
|
+
/**
|
|
121
|
+
* Reads a request body up to `max` bytes. Returns null as soon as it is
|
|
122
|
+
* longer (the caller answers 413) and stops reading.
|
|
123
|
+
*/
|
|
124
|
+
export declare function readBodyCapped(body: AsyncIterable<Buffer | string>, max: number): Promise<string | null>;
|
|
125
|
+
export interface JoinOptions {
|
|
126
|
+
/** The joiner is a SIP (phone) participant. */
|
|
127
|
+
sip?: boolean;
|
|
128
|
+
/** The agent joined this room through an authorised phone connect (POST /connect-room with a roomName). */
|
|
129
|
+
phoneRoom?: boolean;
|
|
130
|
+
}
|
|
64
131
|
export interface JoinDecision {
|
|
65
132
|
/** Build the voice session for this joiner (index.ts participantConnectedHandler). */
|
|
66
133
|
adoptSession: boolean;
|
|
@@ -79,11 +146,16 @@ export interface JoinDecision {
|
|
|
79
146
|
* when it joins with no controller (the opt-in watch voice path that hears
|
|
80
147
|
* the watch mic). When a controller already exists it is NOT adopted: the
|
|
81
148
|
* full session rebuild would tear down the owner's live session and reset
|
|
82
|
-
* currentUserId to '' (the gateway's token has no metadata).
|
|
149
|
+
* currentUserId to '' (the gateway's token has no metadata). Nor in a
|
|
150
|
+
* phone room, where the rebuild would take the caller's session.
|
|
151
|
+
* - A SIP (phone) joiner: never the controller, whatever its identity. It
|
|
152
|
+
* gets the voice session only in a room the agent joined through an
|
|
153
|
+
* authorised phone connect, and only while no controller holds the session.
|
|
154
|
+
* Anywhere else it is ignored, in single-tenant mode too.
|
|
83
155
|
* - Any other identity: never the controller; gets a session only in
|
|
84
156
|
* single-tenant mode (no owner), matching the old behavior there.
|
|
85
157
|
*/
|
|
86
|
-
export declare function resolveJoin(joinerIdentity: string, joinerUserId: string | undefined | null, ownerUserId: string | undefined | null, currentController: string | null): JoinDecision;
|
|
158
|
+
export declare function resolveJoin(joinerIdentity: string, joinerUserId: string | undefined | null, ownerUserId: string | undefined | null, currentController: string | null, opts?: JoinOptions): JoinDecision;
|
|
87
159
|
/**
|
|
88
160
|
* userId from a participant's token metadata (JSON set by /api/token and signed
|
|
89
161
|
* into the JWT). Participants cannot change their own metadata unless the token
|
package/dist/data-sender-auth.js
CHANGED
|
@@ -123,6 +123,107 @@ export function canBecomeController(participantUserId, ownerUserId) {
|
|
|
123
123
|
return true;
|
|
124
124
|
return !!participantUserId && participantUserId === ownerUserId;
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Room-name prefix of the inbound phone dispatch rule (LiveKit `individual`
|
|
128
|
+
* rule, roomPrefix "call-"). POST /connect-room only joins a caller-supplied
|
|
129
|
+
* room with this prefix, and only behind the sync-token check.
|
|
130
|
+
*/
|
|
131
|
+
const PHONE_ROOM_PREFIX = 'call-';
|
|
132
|
+
/** A room name POST /connect-room may join for a phone call. */
|
|
133
|
+
export function isPhoneRoomName(name) {
|
|
134
|
+
return typeof name === 'string'
|
|
135
|
+
&& name.length <= 128
|
|
136
|
+
&& name.startsWith(PHONE_ROOM_PREFIX)
|
|
137
|
+
&& /^[A-Za-z0-9_+\-]+$/.test(name);
|
|
138
|
+
}
|
|
139
|
+
/** Keypad answer to a pending approval on a phone call: 1 allows, 2 denies, anything else is ignored. */
|
|
140
|
+
export function keypadAnswer(digit) {
|
|
141
|
+
if (digit === '1')
|
|
142
|
+
return true;
|
|
143
|
+
if (digit === '2')
|
|
144
|
+
return false;
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Keypad approvals on a phone call. Off: caller ID alone is not proof enough
|
|
149
|
+
* to approve a tool, so every permission raised while a phone caller holds the
|
|
150
|
+
* session is denied and keypad 1 approves nothing. Turned on once a second
|
|
151
|
+
* factor confirms the caller.
|
|
152
|
+
*/
|
|
153
|
+
export const PHONE_KEYPAD_APPROVALS_ENABLED = false;
|
|
154
|
+
/**
|
|
155
|
+
* Tools on a phone call. Off: a call is talk-only, so the PreToolUse hook
|
|
156
|
+
* (claude-llm.ts) denies every tool while a phone caller holds the session,
|
|
157
|
+
* including the ones allowedTools auto-approves (Bash, Read, WebFetch …),
|
|
158
|
+
* sub-agent dispatch and MCP tools. Turned on once a second factor confirms
|
|
159
|
+
* the caller.
|
|
160
|
+
*/
|
|
161
|
+
export const PHONE_TOOLS_ENABLED = false;
|
|
162
|
+
/** What happens to a permission raised during a phone call: denied unless keypad approvals are on. */
|
|
163
|
+
export function phonePermissionPolicy(inPhoneCall, approvalsEnabled = PHONE_KEYPAD_APPROVALS_ENABLED) {
|
|
164
|
+
return inPhoneCall && !approvalsEnabled ? 'deny' : 'ask';
|
|
165
|
+
}
|
|
166
|
+
/** What happens to any tool call during a phone call: denied unless phone tools are on. */
|
|
167
|
+
export function phoneToolPolicy(inPhoneCall, toolsEnabled = PHONE_TOOLS_ENABLED) {
|
|
168
|
+
return inPhoneCall && !toolsEnabled ? 'deny' : 'allow';
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A phone call is live: the agent is in the room an authorised phone connect
|
|
172
|
+
* asked for AND a SIP participant is in it. False as soon as the caller leaves.
|
|
173
|
+
*/
|
|
174
|
+
export function isPhoneCallLive(activeRoomName, phoneRoomName, sipPresent) {
|
|
175
|
+
return !!activeRoomName && activeRoomName === phoneRoomName && sipPresent;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* What POST /connect-room does with the room the agent is in.
|
|
179
|
+
* - 'fresh': no room, or an empty one: (tear it down and) make a new room
|
|
180
|
+
* (the requested phone room, else a new name).
|
|
181
|
+
* - 'reuse': return the occupied room: a browser connect while no phone call is
|
|
182
|
+
* live, or a phone connect for the room the agent is already in.
|
|
183
|
+
* - 'busy' (409): the room is someone else's: a phone connect while a user is in
|
|
184
|
+
* another room, or a browser connect during a live phone call (the caller's
|
|
185
|
+
* room is never handed to a browser).
|
|
186
|
+
*/
|
|
187
|
+
export function planConnectRoom(s) {
|
|
188
|
+
if (!s.activeRoomName || !s.occupied)
|
|
189
|
+
return 'fresh';
|
|
190
|
+
if (s.phoneRoom)
|
|
191
|
+
return s.activeRoomName === s.phoneRoom ? 'reuse' : 'busy';
|
|
192
|
+
return s.phoneCallLive ? 'busy' : 'reuse';
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Handles one keypad press (index.ts DtmfReceived). Only the SIP caller in an
|
|
196
|
+
* authorised phone room counts; with approvals off a 1 settles nothing (a 2
|
|
197
|
+
* still denies). Returns what was done.
|
|
198
|
+
*/
|
|
199
|
+
export function handlePhoneKeypad(press, settle, approvalsEnabled = PHONE_KEYPAD_APPROVALS_ENABLED) {
|
|
200
|
+
if (!press.sip || !press.inPhoneRoom)
|
|
201
|
+
return 'ignored';
|
|
202
|
+
const allow = keypadAnswer(press.digit);
|
|
203
|
+
if (allow === null || (allow && !approvalsEnabled))
|
|
204
|
+
return 'ignored';
|
|
205
|
+
if (!settle(allow))
|
|
206
|
+
return 'no pending permission';
|
|
207
|
+
return allow ? 'approved' : 'denied';
|
|
208
|
+
}
|
|
209
|
+
/** Most bytes POST /connect-room reads; its body is only `{ roomName }`. */
|
|
210
|
+
export const CONNECT_ROOM_MAX_BODY = 4096;
|
|
211
|
+
/**
|
|
212
|
+
* Reads a request body up to `max` bytes. Returns null as soon as it is
|
|
213
|
+
* longer (the caller answers 413) and stops reading.
|
|
214
|
+
*/
|
|
215
|
+
export async function readBodyCapped(body, max) {
|
|
216
|
+
const parts = [];
|
|
217
|
+
let size = 0;
|
|
218
|
+
for await (const chunk of body) {
|
|
219
|
+
const b = typeof chunk === 'string' ? Buffer.from(chunk) : chunk;
|
|
220
|
+
size += b.length;
|
|
221
|
+
if (size > max)
|
|
222
|
+
return null;
|
|
223
|
+
parts.push(b);
|
|
224
|
+
}
|
|
225
|
+
return Buffer.concat(parts).toString('utf8');
|
|
226
|
+
}
|
|
126
227
|
/**
|
|
127
228
|
* What a non-canvas participant joining the room changes. Pure, so the
|
|
128
229
|
* controller rules are testable without LiveKit.
|
|
@@ -135,13 +236,22 @@ export function canBecomeController(participantUserId, ownerUserId) {
|
|
|
135
236
|
* when it joins with no controller (the opt-in watch voice path that hears
|
|
136
237
|
* the watch mic). When a controller already exists it is NOT adopted: the
|
|
137
238
|
* full session rebuild would tear down the owner's live session and reset
|
|
138
|
-
* currentUserId to '' (the gateway's token has no metadata).
|
|
239
|
+
* currentUserId to '' (the gateway's token has no metadata). Nor in a
|
|
240
|
+
* phone room, where the rebuild would take the caller's session.
|
|
241
|
+
* - A SIP (phone) joiner: never the controller, whatever its identity. It
|
|
242
|
+
* gets the voice session only in a room the agent joined through an
|
|
243
|
+
* authorised phone connect, and only while no controller holds the session.
|
|
244
|
+
* Anywhere else it is ignored, in single-tenant mode too.
|
|
139
245
|
* - Any other identity: never the controller; gets a session only in
|
|
140
246
|
* single-tenant mode (no owner), matching the old behavior there.
|
|
141
247
|
*/
|
|
142
|
-
export function resolveJoin(joinerIdentity, joinerUserId, ownerUserId, currentController) {
|
|
248
|
+
export function resolveJoin(joinerIdentity, joinerUserId, ownerUserId, currentController, opts = {}) {
|
|
249
|
+
if (opts.sip) {
|
|
250
|
+
return { adoptSession: !!opts.phoneRoom && !currentController, controller: currentController };
|
|
251
|
+
}
|
|
143
252
|
if (joinerIdentity === AGENT_SELF_IDENTITY) {
|
|
144
|
-
|
|
253
|
+
// In a phone room the caller holds the session without being the controller.
|
|
254
|
+
return { adoptSession: !currentController && !opts.phoneRoom, controller: currentController };
|
|
145
255
|
}
|
|
146
256
|
if (joinerIdentity.startsWith(USER_IDENTITY_PREFIX)) {
|
|
147
257
|
return canBecomeController(joinerUserId, ownerUserId)
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import 'dotenv/config';
|
|
|
6
6
|
import './boot-secrets.js';
|
|
7
7
|
import { voice, initializeLogger } from '@livekit/agents';
|
|
8
8
|
import { CloudTurnDetector } from './turn-detector-shim.js';
|
|
9
|
-
import { Room, RoomEvent, DisconnectReason, } from '@livekit/rtc-node';
|
|
9
|
+
import { Room, RoomEvent, DisconnectReason, ParticipantKind, } from '@livekit/rtc-node';
|
|
10
10
|
import { AccessToken } from 'livekit-server-sdk';
|
|
11
11
|
// Initialize logger before anything else
|
|
12
12
|
initializeLogger({ pretty: true, level: 'info' });
|
|
@@ -46,7 +46,7 @@ import { ensureClaudeAuth, applyAuthFallback, replayInFlightAuth, startClaudeAut
|
|
|
46
46
|
import { statusManager } from './status-manager.js';
|
|
47
47
|
import { decideNextSession, planSwitch, resolveSessionCwd, keepNonConversationItems, recoverySessionId as pickRecoverySessionId, warmParkKey, sessionMessagesDir, createSwitchGuard, scanSlugCwd } from './session-switch.js';
|
|
48
48
|
import { createSmitheryProxy, destroySmitheryProxy, parseSmitheryUrl, isSmitheryUrl, SmitheryAuthorizationError } from './smithery-proxy.js';
|
|
49
|
-
import { DIRECT_MODE_PROMPT } from './prompts.js';
|
|
49
|
+
import { DIRECT_MODE_PROMPT, PHONE_PERMISSION_DENIED } from './prompts.js';
|
|
50
50
|
import { MCP_CATALOG } from './config.js';
|
|
51
51
|
import { launchLibraryOnSessionEnd, lastLibraryRun, isContentLensEnabled } from './content/lens-launch.js';
|
|
52
52
|
import { resolveIngestConfig } from './content/lens-ingest.js';
|
|
@@ -64,7 +64,7 @@ import { noiseGate } from './noise-gate.js';
|
|
|
64
64
|
import { installDuck, DUCK_LEVEL } from './duck.js';
|
|
65
65
|
import { meetingAddressing, isRoutableTarget } from './meeting-addressing.js';
|
|
66
66
|
import { listSecretStatus, setSecrets, deleteSecret } from './secrets-store.js';
|
|
67
|
-
import { AGENT_SELF_IDENTITY, checkControlSender, resolveJoin, userIdFromMetadata } from './data-sender-auth.js';
|
|
67
|
+
import { AGENT_SELF_IDENTITY, CONNECT_ROOM_MAX_BODY, checkControlSender, handlePhoneKeypad, isPhoneCallLive, isPhoneRoomName, phonePermissionPolicy, planConnectRoom, readBodyCapped, resolveJoin, userIdFromMetadata } from './data-sender-auth.js';
|
|
68
68
|
import { llm } from '@livekit/agents';
|
|
69
69
|
// ============================================================
|
|
70
70
|
// PIPELINE MODE: STT (Deepgram) → Claude Agent SDK → TTS
|
|
@@ -295,6 +295,7 @@ let intentionalLeave = false;
|
|
|
295
295
|
// Native barge-in duck on the live session's audio output (see duck.ts)
|
|
296
296
|
let currentDuck = null;
|
|
297
297
|
let duckRestoreTimer = null;
|
|
298
|
+
// phoneRoom: join this caller's room (a phone call) instead of a fresh one.
|
|
298
299
|
let connectRoomHook = null;
|
|
299
300
|
// Mints a LISTEN-ONLY LiveKit token for the meeting canvas so it can join the
|
|
300
301
|
// agent's room and play the agent's REAL TTS audio track — bit-identical to
|
|
@@ -986,18 +987,52 @@ function startApiServer(workingDir, port) {
|
|
|
986
987
|
// directly (mint its LiveKit token for it) rather than fetching /room-code.
|
|
987
988
|
// The agent is in the room by the time this responds, so the user's join
|
|
988
989
|
// fires ParticipantConnected (or is caught by the adopt-sweep either way).
|
|
990
|
+
// Phone calls (#361): an optional JSON body { roomName } joins that caller's
|
|
991
|
+
// room instead of a fresh one. Only with the sync token, only a "call-" room;
|
|
992
|
+
// 409 { error: 'busy' } while a user is in another room. No body = as before,
|
|
993
|
+
// except during a live phone call: 409 busy (never the caller's room).
|
|
989
994
|
if (req.method === 'POST' && url.pathname === '/connect-room') {
|
|
995
|
+
// Stop reading past the cap without destroying the socket, so the 413 still goes out.
|
|
996
|
+
const raw = await readBodyCapped(req.iterator({ destroyOnReturn: false }), CONNECT_ROOM_MAX_BODY);
|
|
997
|
+
if (raw === null) {
|
|
998
|
+
res.writeHead(413, { 'Content-Type': 'application/json', Connection: 'close' });
|
|
999
|
+
res.end(JSON.stringify({ ok: false, error: 'body too large' }));
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
let phoneRoom;
|
|
1003
|
+
if (raw.trim()) {
|
|
1004
|
+
let parsed = {};
|
|
1005
|
+
try {
|
|
1006
|
+
parsed = JSON.parse(raw);
|
|
1007
|
+
}
|
|
1008
|
+
catch { }
|
|
1009
|
+
if (parsed.roomName !== undefined) {
|
|
1010
|
+
if (unauthorized())
|
|
1011
|
+
return;
|
|
1012
|
+
if (!isPhoneRoomName(parsed.roomName)) {
|
|
1013
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
1014
|
+
res.end(JSON.stringify({ ok: false, error: 'invalid roomName' }));
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
phoneRoom = parsed.roomName;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
990
1020
|
if (!connectRoomHook) {
|
|
991
1021
|
res.writeHead(503, { 'Content-Type': 'application/json' });
|
|
992
1022
|
res.end(JSON.stringify({ ok: false, error: 'agent not ready' }));
|
|
993
1023
|
return;
|
|
994
1024
|
}
|
|
995
|
-
connectRoomHook()
|
|
1025
|
+
connectRoomHook(phoneRoom)
|
|
996
1026
|
.then((roomName) => {
|
|
997
1027
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
998
1028
|
res.end(JSON.stringify({ ok: true, roomName, status: livekitState.status }));
|
|
999
1029
|
})
|
|
1000
1030
|
.catch((e) => {
|
|
1031
|
+
if (e?.code === 'busy') {
|
|
1032
|
+
res.writeHead(409, { 'Content-Type': 'application/json' });
|
|
1033
|
+
res.end(JSON.stringify({ ok: false, error: 'busy', status: livekitState.status }));
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1001
1036
|
console.error('❌ /connect-room hook failed:', e);
|
|
1002
1037
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
1003
1038
|
res.end(JSON.stringify({ ok: false, error: e instanceof Error ? e.message : String(e), status: livekitState.status }));
|
|
@@ -2338,6 +2373,11 @@ async function main() {
|
|
|
2338
2373
|
// null while the agent is idle (between sessions).
|
|
2339
2374
|
let activeRoom = null;
|
|
2340
2375
|
let activeRoomName = null; // the temporary room name currently joined
|
|
2376
|
+
// The caller's room the last authorised phone connect asked for. A phone call
|
|
2377
|
+
// is live only while the agent is in that room AND a SIP participant is in it
|
|
2378
|
+
// (cleared when the caller leaves or the room session ends).
|
|
2379
|
+
let phoneRoomName = null;
|
|
2380
|
+
const inPhoneRoom = () => isPhoneCallLive(activeRoomName, phoneRoomName, !!activeRoom && [...activeRoom.remoteParticipants.values()].some((p) => p.kind === ParticipantKind.SIP));
|
|
2341
2381
|
// Watch gateway (mobile Track 2): bridges the native watchOS app's WS audio
|
|
2342
2382
|
// + JSON into the user's LiveKit room via rtc-node. Opt-in — dormant unless
|
|
2343
2383
|
// WATCH_GATEWAY=1 (port WATCH_GATEWAY_PORT, default 8742).
|
|
@@ -4474,14 +4514,15 @@ async function main() {
|
|
|
4474
4514
|
// Apply turbo to the freshly created LLM so the main model also picks it up.
|
|
4475
4515
|
// PipelineDirectLLM (llmOverride path) wraps its own ClaudeLLM and may not expose setTurbo.
|
|
4476
4516
|
directLLM?.setTurbo?.(turboMode);
|
|
4517
|
+
// Phone call: talk-only, every tool denied (PHONE_TOOLS_ENABLED). Recomputed on
|
|
4518
|
+
// each session, so a re-attached brain follows whoever holds it now.
|
|
4519
|
+
directLLM?.setPhoneCall?.(inPhoneRoom());
|
|
4477
4520
|
currentLLM = directLLM;
|
|
4478
4521
|
// Watch bridge (mobile Track 1): a wrist ack/expiry settles whatever
|
|
4479
4522
|
// permission is currently pending. Re-registered per session — harmless,
|
|
4480
4523
|
// the latest closure wins and they all resolve through currentLLM.
|
|
4481
4524
|
setWatchResultHandler((allow, toolName) => {
|
|
4482
|
-
|
|
4483
|
-
if (target) {
|
|
4484
|
-
target.respondToPermission(allow);
|
|
4525
|
+
if (settlePendingPermission(allow)) {
|
|
4485
4526
|
console.log(`⌚️ Watch bridge settled ${toolName}: ${allow ? 'approve' : 'deny'}`);
|
|
4486
4527
|
}
|
|
4487
4528
|
else {
|
|
@@ -4616,6 +4657,12 @@ async function main() {
|
|
|
4616
4657
|
console.log(`⚠️ Permission needed: ${data.toolName}`);
|
|
4617
4658
|
const toolName = data.toolName;
|
|
4618
4659
|
const input = data.input || {};
|
|
4660
|
+
// A phone caller cannot approve tools until PHONE_KEYPAD_APPROVALS_ENABLED is on: deny straight away.
|
|
4661
|
+
if (phonePermissionPolicy(inPhoneRoom()) === 'deny') {
|
|
4662
|
+
console.log(`📞 Phone call: denied ${toolName} (keypad approvals are off)`);
|
|
4663
|
+
directLLM.respondToPermission(false, PHONE_PERMISSION_DENIED);
|
|
4664
|
+
return;
|
|
4665
|
+
}
|
|
4619
4666
|
// Check session always-allow list before showing dialog
|
|
4620
4667
|
if (toolName === 'Write' || toolName === 'Edit' || toolName === 'MultiEdit') {
|
|
4621
4668
|
const filePath = String(input?.file_path || '');
|
|
@@ -5198,6 +5245,16 @@ async function main() {
|
|
|
5198
5245
|
livekitState.error = err instanceof Error ? err.message : String(err);
|
|
5199
5246
|
});
|
|
5200
5247
|
};
|
|
5248
|
+
// Settles whatever permission is pending (live session first, then a parked
|
|
5249
|
+
// warm brain). Shared by the watch bridge and the phone keypad. False when
|
|
5250
|
+
// nothing is pending (already answered elsewhere).
|
|
5251
|
+
function settlePendingPermission(allow) {
|
|
5252
|
+
const target = currentLLM?.hasPendingPermission?.() ? currentLLM : warmLLM?.hasPendingPermission?.() ? warmLLM : null;
|
|
5253
|
+
if (!target)
|
|
5254
|
+
return false;
|
|
5255
|
+
target.respondToPermission(allow);
|
|
5256
|
+
return true;
|
|
5257
|
+
}
|
|
5201
5258
|
// wireRoomHandlers(room): register EVERY room.on(...) listener onto a fresh
|
|
5202
5259
|
// Room instance. Called once per session from createRoomSession(). The bodies
|
|
5203
5260
|
// close over main()-scope state; `room` is the fresh instance passed in.
|
|
@@ -5260,6 +5317,13 @@ async function main() {
|
|
|
5260
5317
|
room.on(RoomEvent.ParticipantConnected, (p) => { participantConnectedHandler?.(p); });
|
|
5261
5318
|
room.on(RoomEvent.ParticipantDisconnected, handleParticipantDisconnected);
|
|
5262
5319
|
room.on(RoomEvent.DataReceived, handleDataReceived);
|
|
5320
|
+
// Phone calls: keypad 2 denies the pending approval; 1 allows only once
|
|
5321
|
+
// PHONE_KEYPAD_APPROVALS_ENABLED is on. Only from the caller in an authorised phone room.
|
|
5322
|
+
room.on(RoomEvent.DtmfReceived, (_code, digit, participant) => {
|
|
5323
|
+
const outcome = handlePhoneKeypad({ sip: participant?.kind === ParticipantKind.SIP, inPhoneRoom: inPhoneRoom(), digit }, settlePendingPermission);
|
|
5324
|
+
if (outcome !== 'ignored')
|
|
5325
|
+
console.log(`📞 Keypad ${digit}: ${outcome}`);
|
|
5326
|
+
});
|
|
5263
5327
|
};
|
|
5264
5328
|
// 0.9.83: handler kept as a named reference so createRoomSession's adopt-sweep
|
|
5265
5329
|
// can CALL it directly for participants already in the room at join time
|
|
@@ -5287,10 +5351,16 @@ async function main() {
|
|
|
5287
5351
|
// no controller exists (watch voice alone); joining after the owner it is
|
|
5288
5352
|
// not adopted, so the owner's session and currentUserId stay intact.
|
|
5289
5353
|
const joinerUserId = userIdFromMetadata(participant.metadata);
|
|
5290
|
-
|
|
5354
|
+
// A phone caller (SIP) is adopted only in a room an authorised phone connect
|
|
5355
|
+
// asked for, and never becomes the controller (it has no data channel).
|
|
5356
|
+
const isPhoneCaller = participant.kind === ParticipantKind.SIP;
|
|
5357
|
+
const join = resolveJoin(participant.identity, joinerUserId, OWNER_USER_ID, controllingUserIdentity, { sip: isPhoneCaller, phoneRoom: inPhoneRoom() });
|
|
5291
5358
|
controllingUserIdentity = join.controller;
|
|
5292
5359
|
if (!join.adoptSession) {
|
|
5293
|
-
if (
|
|
5360
|
+
if (isPhoneCaller) {
|
|
5361
|
+
console.warn(`🚫 phone caller ${participant.identity} is not in an authorised phone room; not adopting it`);
|
|
5362
|
+
}
|
|
5363
|
+
else if (participant.identity === AGENT_SELF_IDENTITY) {
|
|
5294
5364
|
console.log(`⌚ ${participant.identity} joined while ${controllingUserIdentity} controls the session; keeping the owner's voice session`);
|
|
5295
5365
|
}
|
|
5296
5366
|
else {
|
|
@@ -5411,6 +5481,23 @@ async function main() {
|
|
|
5411
5481
|
catch (err) {
|
|
5412
5482
|
console.log('⚠️ Could not parse participant metadata, using config voiceMode:', voiceMode);
|
|
5413
5483
|
}
|
|
5484
|
+
// A phone call carries no token metadata and has no session picker: it runs
|
|
5485
|
+
// as the machine owner and resumes the most recent session (none = a new one).
|
|
5486
|
+
if (isPhoneCaller) {
|
|
5487
|
+
currentUserId = OWNER_USER_ID;
|
|
5488
|
+
try {
|
|
5489
|
+
const [latest] = await listAllClaudeSessions(1);
|
|
5490
|
+
const cwd = latest ? await resolveCwdForSession(latest.sessionId, latest.cwd) : null;
|
|
5491
|
+
if (latest && cwd) {
|
|
5492
|
+
preSelectedSessionId = latest.sessionId;
|
|
5493
|
+
workingDir = cwd;
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
catch (e) {
|
|
5497
|
+
console.warn('⚠️ phone call: latest session lookup failed:', e instanceof Error ? e.message : e);
|
|
5498
|
+
}
|
|
5499
|
+
console.log(`📞 Phone call: ${preSelectedSessionId ? `resuming ${preSelectedSessionId}` : 'new session'} in ${workingDir}`);
|
|
5500
|
+
}
|
|
5414
5501
|
ctMark('participant joined + metadata parsed');
|
|
5415
5502
|
// Sync to outer scope so DataReceived handler can use it
|
|
5416
5503
|
currentVoiceMode = sessionVoiceMode;
|
|
@@ -6247,8 +6334,8 @@ async function main() {
|
|
|
6247
6334
|
})();
|
|
6248
6335
|
}
|
|
6249
6336
|
}
|
|
6250
|
-
else if (!preSelectedSessionId && hasRecentSession) {
|
|
6251
|
-
// No pre-selected session but sessions exist — defer greeting for session gate
|
|
6337
|
+
else if (!preSelectedSessionId && hasRecentSession && !isPhoneCaller) {
|
|
6338
|
+
// No pre-selected session but sessions exist — defer greeting for session gate (a phone call has none)
|
|
6252
6339
|
console.log('⏳ Deferring greeting until session gate is completed');
|
|
6253
6340
|
}
|
|
6254
6341
|
else {
|
|
@@ -6271,6 +6358,12 @@ async function main() {
|
|
|
6271
6358
|
// participantConnectedHandler above).
|
|
6272
6359
|
const handleParticipantDisconnected = (participant) => {
|
|
6273
6360
|
console.log(`👋 User left: ${participant.identity}`);
|
|
6361
|
+
// The caller hung up: the call is over (inPhoneRoom() is false from here, so the
|
|
6362
|
+
// next session gets tools back). Its brain is killed below, not parked, so nothing
|
|
6363
|
+
// it was asked on the call runs after hang-up with tools on.
|
|
6364
|
+
const phoneCallerLeft = participant.kind === ParticipantKind.SIP;
|
|
6365
|
+
if (phoneCallerLeft)
|
|
6366
|
+
phoneRoomName = null;
|
|
6274
6367
|
if (participant.identity === controllingUserIdentity)
|
|
6275
6368
|
controllingUserIdentity = null;
|
|
6276
6369
|
cancelPendingSwitch('participant_disconnected', false);
|
|
@@ -6334,7 +6427,7 @@ async function main() {
|
|
|
6334
6427
|
clearPipelineFastBrainSession();
|
|
6335
6428
|
clearPipelineFastBrainSession();
|
|
6336
6429
|
}
|
|
6337
|
-
else if (KEEP_WARM && currentLLM && currentLLM.sessionId) {
|
|
6430
|
+
else if (KEEP_WARM && currentLLM && currentLLM.sessionId && !phoneCallerLeft) {
|
|
6338
6431
|
// KEEP-WARM network/tab-close drop: park the subprocess instead of killing
|
|
6339
6432
|
// it so a reconnect within the grace re-attaches with ZERO replay. We
|
|
6340
6433
|
// STILL run the normal room teardown below — the parked brain is
|
|
@@ -7630,6 +7723,7 @@ async function main() {
|
|
|
7630
7723
|
// Drop the reference immediately so nothing (handlers, sweeps) touches it.
|
|
7631
7724
|
activeRoom = null;
|
|
7632
7725
|
activeRoomName = null;
|
|
7726
|
+
phoneRoomName = null;
|
|
7633
7727
|
if (aloneTimer) {
|
|
7634
7728
|
clearTimeout(aloneTimer);
|
|
7635
7729
|
aloneTimer = null;
|
|
@@ -7677,7 +7771,8 @@ async function main() {
|
|
|
7677
7771
|
t.addGrant({ roomJoin: true, room: activeRoomName, canPublish: false, canSubscribe: true, canPublishData: false });
|
|
7678
7772
|
return { token: await t.toJwt(), url: process.env.LIVEKIT_URL || '', room: activeRoomName };
|
|
7679
7773
|
};
|
|
7680
|
-
connectRoomHook = async () => {
|
|
7774
|
+
connectRoomHook = async (phoneRoom) => {
|
|
7775
|
+
const busy = () => Object.assign(new Error('busy: the agent is in another session'), { code: 'busy' });
|
|
7681
7776
|
intentionalLeave = false;
|
|
7682
7777
|
cancelIdleExitTimer();
|
|
7683
7778
|
// CONNECT TIMING: stamp the server's request-incoming moment (the user asked
|
|
@@ -7687,17 +7782,36 @@ async function main() {
|
|
|
7687
7782
|
// Idempotency: an active session with a user present is reused (return its
|
|
7688
7783
|
// room name). An active-but-empty session (agent joined, user never showed,
|
|
7689
7784
|
// or a stale race) is torn down and replaced with a fresh one.
|
|
7785
|
+
const plan = planConnectRoom({
|
|
7786
|
+
activeRoomName: activeRoom ? activeRoomName : null,
|
|
7787
|
+
occupied: !!activeRoom && activeRoom.remoteParticipants.size > 0,
|
|
7788
|
+
// A caller's room is never handed to a browser, even once the caller has left.
|
|
7789
|
+
phoneCallLive: inPhoneRoom() || isPhoneRoomName(activeRoomName),
|
|
7790
|
+
phoneRoom,
|
|
7791
|
+
});
|
|
7792
|
+
if (plan === 'busy') {
|
|
7793
|
+
console.log(`🔌 /connect-room — busy: ${phoneRoom ? 'a user is in another room' : 'a phone call is live'} (${activeRoomName})`);
|
|
7794
|
+
throw busy();
|
|
7795
|
+
}
|
|
7796
|
+
if (plan === 'reuse') {
|
|
7797
|
+
console.log(`🔌 /connect-room — already connected with a user present, reusing ${activeRoomName}`);
|
|
7798
|
+
return activeRoomName;
|
|
7799
|
+
}
|
|
7690
7800
|
if (activeRoom && activeRoomName) {
|
|
7691
|
-
if (activeRoom.remoteParticipants.size > 0) {
|
|
7692
|
-
console.log(`🔌 /connect-room — already connected with a user present, reusing ${activeRoomName}`);
|
|
7693
|
-
return activeRoomName;
|
|
7694
|
-
}
|
|
7695
7801
|
console.log('🔌 /connect-room — active room is empty; tearing down + creating fresh');
|
|
7696
7802
|
await destroyRoomSession('connect-room replacing empty session');
|
|
7697
7803
|
}
|
|
7698
|
-
const targetRoomName = buildRoomName();
|
|
7699
|
-
|
|
7804
|
+
const targetRoomName = phoneRoom || buildRoomName();
|
|
7805
|
+
if (phoneRoom)
|
|
7806
|
+
phoneRoomName = phoneRoom;
|
|
7807
|
+
console.log(`🔌 /connect-room — creating fresh room session: ${targetRoomName}${phoneRoom ? ' (phone call)' : ''}`);
|
|
7700
7808
|
await createRoomSession(targetRoomName);
|
|
7809
|
+
// A concurrent browser connect won the in-flight join: that room is not the caller's.
|
|
7810
|
+
if (phoneRoom && activeRoomName !== phoneRoom)
|
|
7811
|
+
throw busy();
|
|
7812
|
+
// A browser connect that awaited an in-flight phone join: never hand it the caller's room.
|
|
7813
|
+
if (!phoneRoom && isPhoneRoomName(activeRoomName))
|
|
7814
|
+
throw busy();
|
|
7701
7815
|
// Return the room the agent actually joined. When a concurrent /connect-room
|
|
7702
7816
|
// call awaited an in-flight session, activeRoomName is the first call's room
|
|
7703
7817
|
// name — which differs from targetRoomName generated here. Always use the
|
|
@@ -110,6 +110,7 @@ export declare class PipelineDirectLLM extends llm.LLM {
|
|
|
110
110
|
setMcpServers(s: any): void;
|
|
111
111
|
setAgents(a: any, roles?: any): void;
|
|
112
112
|
setTurbo(on: boolean): void;
|
|
113
|
+
setPhoneCall(on: boolean): void;
|
|
113
114
|
prewarmResume(): void;
|
|
114
115
|
getMemDebug(): Record<string, string | number>;
|
|
115
116
|
interruptAgent(): Promise<boolean>;
|
|
@@ -241,6 +241,7 @@ export class PipelineDirectLLM extends llm.LLM {
|
|
|
241
241
|
setMcpServers(s) { this.#claudeLLM.setMcpServers(s); }
|
|
242
242
|
setAgents(a, roles) { this.#claudeLLM.setAgents(a, roles); }
|
|
243
243
|
setTurbo(on) { this.#claudeLLM.setTurbo(on); }
|
|
244
|
+
setPhoneCall(on) { this.#claudeLLM.setPhoneCall(on); }
|
|
244
245
|
// CLICK-TIME OVERLAP (0.9.258): start the resume replay early so it overlaps
|
|
245
246
|
// the connect handshake. Proxied to the inner ClaudeLLM.
|
|
246
247
|
prewarmResume() { this.#claudeLLM.prewarmResume(); }
|
package/dist/prompts.d.ts
CHANGED
|
@@ -98,3 +98,7 @@ export declare function buildFastBrainSdkPrompt(workingDir: string, sessionId: s
|
|
|
98
98
|
* tool calls (search → refine → search deeper → answer).
|
|
99
99
|
*/
|
|
100
100
|
export declare function buildGeminiContextPrompt(sessionId: string, workingDir: string, sessionBaseDir: string): string;
|
|
101
|
+
/** Deny reason the model reads when a tool needs approval during a phone call (keypad approvals off). */
|
|
102
|
+
export declare const PHONE_PERMISSION_DENIED = "Tools that need approval cannot be approved on a phone call. Tell the caller to approve it from the app.";
|
|
103
|
+
/** Deny reason the model reads for any tool during a phone call (phone tools off): a call is talk-only. */
|
|
104
|
+
export declare const PHONE_TOOLS_DENIED = "Tools are off on a phone call: no reading files, running commands, searching the web or starting agents. Answer from what you already know, and tell the caller you cannot do that on a call and to use the app for it.";
|
package/dist/prompts.js
CHANGED
|
@@ -1863,3 +1863,7 @@ Your final text response is the teleprompter script — spoken aloud verbatim.
|
|
|
1863
1863
|
export function buildGeminiContextPrompt(sessionId, workingDir, sessionBaseDir) {
|
|
1864
1864
|
return FAST_BRAIN_SYSTEM_PROMPT;
|
|
1865
1865
|
}
|
|
1866
|
+
/** Deny reason the model reads when a tool needs approval during a phone call (keypad approvals off). */
|
|
1867
|
+
export const PHONE_PERMISSION_DENIED = 'Tools that need approval cannot be approved on a phone call. Tell the caller to approve it from the app.';
|
|
1868
|
+
/** Deny reason the model reads for any tool during a phone call (phone tools off): a call is talk-only. */
|
|
1869
|
+
export const PHONE_TOOLS_DENIED = 'Tools are off on a phone call: no reading files, running commands, searching the web or starting agents. Answer from what you already know, and tell the caller you cannot do that on a call and to use the app for it.';
|