osborn 0.9.295 → 0.9.296
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/Dockerfile +1 -1
- package/Dockerfile.sandbox +71 -7
- package/dist/claude-auth.d.ts +2 -2
- package/dist/claude-auth.js +5 -13
- package/dist/claude-llm.d.ts +1 -0
- package/dist/claude-llm.js +2 -1
- package/dist/content/compaction-lens.js +5 -5
- package/dist/content/content-checks.d.ts +7 -0
- package/dist/content/content-checks.js +4 -3
- package/dist/content/content-ingest.js +2 -3
- package/dist/content/content-llm.d.ts +69 -3
- package/dist/content/content-llm.js +127 -18
- package/dist/content/content-run.js +3 -4
- package/dist/content/lens-ingest.d.ts +2 -0
- package/dist/content/lens-ingest.js +2 -0
- package/dist/content/lens-launch.js +4 -3
- package/dist/content/lens-library-digest.js +8 -10
- package/dist/content/lens-library-sweep.js +2 -2
- package/dist/content/lens-library.js +2 -1
- package/dist/content/lens-model.d.ts +15 -6
- package/dist/content/lens-model.js +44 -32
- package/dist/content/period-run.d.ts +1 -1
- package/dist/content/period-run.js +7 -7
- package/dist/data-sender-auth.d.ts +14 -0
- package/dist/data-sender-auth.js +25 -0
- package/dist/env-key.d.ts +15 -0
- package/dist/env-key.js +25 -0
- package/dist/index.js +86 -42
- package/dist/meeting-tts.d.ts +2 -0
- package/dist/meeting-tts.js +3 -1
- package/dist/pipeline-direct-llm.d.ts +1 -0
- package/dist/pipeline-fastbrain.js +4 -6
- package/dist/prompts/chain-after-writer.md +1 -1
- package/dist/prompts/steward.md +3 -0
- package/dist/steward-verdict.js +2 -2
- package/dist/volume-sync-status.d.ts +15 -0
- package/dist/volume-sync-status.js +35 -0
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -49,6 +49,7 @@ import { createSmitheryProxy, destroySmitheryProxy, parseSmitheryUrl, isSmithery
|
|
|
49
49
|
import { DIRECT_MODE_PROMPT, PHONE_PERMISSION_DENIED } from './prompts.js';
|
|
50
50
|
import { MCP_CATALOG, readApprovalMode, writeApprovalMode } from './config.js';
|
|
51
51
|
import { launchLibraryOnSessionEnd, launchLibrarySweep, librarySweepHealth, setLibraryLiveSessions, isContentLensEnabled } from './content/lens-launch.js';
|
|
52
|
+
import { hasContentModelKey } from './content/content-llm.js';
|
|
52
53
|
import { resolveIngestConfig } from './content/lens-ingest.js';
|
|
53
54
|
import { storeExists, openStore, recentRows } from './session-store.js';
|
|
54
55
|
import { readCompactionMarkers } from './compaction-log.js';
|
|
@@ -64,10 +65,11 @@ import { noiseGate } from './noise-gate.js';
|
|
|
64
65
|
import { installDuck, DUCK_LEVEL } from './duck.js';
|
|
65
66
|
import { meetingAddressing, isRoutableTarget } from './meeting-addressing.js';
|
|
66
67
|
import { listSecretStatus, setSecrets, deleteSecret } from './secrets-store.js';
|
|
67
|
-
import { AGENT_SELF_IDENTITY, CONNECT_ROOM_MAX_BODY, PHONE_ACTION_TYPES, PHONE_KEYPAD_APPROVALS_ENABLED, PHONE_TOOLS_ENABLED, checkControlSender, handlePhoneKeypad, isPhoneCallLive, isPhoneRoomName, phoneAnswerAllowed, phoneRequestRoute, planConnectRoom, readBodyCapped, resolveJoin, userIdFromMetadata } from './data-sender-auth.js';
|
|
68
|
+
import { AGENT_SELF_IDENTITY, CONNECT_ROOM_MAX_BODY, PHONE_ACTION_TYPES, PHONE_KEYPAD_APPROVALS_ENABLED, PHONE_TOOLS_ENABLED, checkControlSender, handlePhoneKeypad, isPhoneCallLive, isViewerIdentity, roomOccupants, VIEWER_IDENTITY_PREFIX, isPhoneRoomName, phoneAnswerAllowed, phoneRequestRoute, planConnectRoom, readBodyCapped, resolveJoin, userIdFromMetadata } from './data-sender-auth.js';
|
|
68
69
|
import { PHONE_CODE_HANGUP_GRACE_MS, PHONE_CODE_TIMEOUT_MS, addCodeDigit, checkPhoneCode, heldCode, isPhoneLinePlayer as isLinePlayer, offerPhoneCode, phoneCallerAdmission, phoneCodeAction, removePhoneCaller } from './phone-code.js';
|
|
69
70
|
import { alwaysScope, answerPending, answerPendingWithoutId, approvalModeAnnouncement, approvalModeLabel, autoApproval, describePermission, isAlwaysAllowed, isApprovalMode, newSessionAllows, phoneApprovalPrompt, speakablePermission } from './approval-policy.js';
|
|
70
71
|
import { matchVoiceAction, phoneMayChangeMode, promptHeard, sayBlocked, sayModeChanged, sayOutputs, saySessions, sayStatus, saySwitchOutcome } from './phone-voice-actions.js';
|
|
72
|
+
import { readVolumeSyncStatus } from './volume-sync-status.js';
|
|
71
73
|
import { llm } from '@livekit/agents';
|
|
72
74
|
// ============================================================
|
|
73
75
|
// PIPELINE MODE: STT (Deepgram) → Claude Agent SDK → TTS
|
|
@@ -137,9 +139,10 @@ const STORE_REPLY_TYPES = {
|
|
|
137
139
|
skill_remove: 'skill_remove_result', get_agent_prompt: 'agent_prompt',
|
|
138
140
|
};
|
|
139
141
|
// Store routes, guarded by storeRefused: writes change the machine's skills; reads carry the
|
|
140
|
-
// core prompts, the user's skills and the catalog. Neither answers every site's CORS.
|
|
142
|
+
// core prompts, the user's skills and the catalog. Neither answers every site's CORS. The
|
|
143
|
+
// room view's token route (#383) is guarded the same way: its token hears every broadcast.
|
|
141
144
|
const STORE_WRITE_PATHS = new Set(['/skills/fork', '/skills/remove', '/store/install']);
|
|
142
|
-
const STORE_PATHS = new Set([...STORE_WRITE_PATHS, '/skills', '/skills/content', '/store/catalog', '/store/entry', '/agents']);
|
|
145
|
+
const STORE_PATHS = new Set([...STORE_WRITE_PATHS, '/skills', '/skills/content', '/store/catalog', '/store/entry', '/agents', '/view-token']);
|
|
143
146
|
// Skills shipped with the package (core: maintained by Voice Native).
|
|
144
147
|
const PKG_SKILLS_DIR = join(__dirname, '..', '.claude', 'skills');
|
|
145
148
|
const homeSkillsDir = () => join(homedir(), '.claude', 'skills');
|
|
@@ -306,6 +309,10 @@ let connectRoomHook = null;
|
|
|
306
309
|
// the browser voice experience (2026-08-01 quality architecture; replaces the
|
|
307
310
|
// synth-file chain when connected). Set from main() where the room name lives.
|
|
308
311
|
let canvasTokenHook = null;
|
|
312
|
+
// Read-only room view (#383): what the live session is doing, and with
|
|
313
|
+
// `withToken` a hidden, subscribe-only LiveKit token (`viewer-*`) to watch its
|
|
314
|
+
// broadcast stream. Null when no room is live. Set from main().
|
|
315
|
+
let viewTokenHook = null;
|
|
309
316
|
let leaveRoomHook = null;
|
|
310
317
|
// Hook for the bug-reporter skill. The /report-bug HTTP endpoint validates the
|
|
311
318
|
// payload + generates the reportId in the module-level handler, then delegates
|
|
@@ -391,7 +398,7 @@ function parseDevSubdomainPort(req) {
|
|
|
391
398
|
// Route prefixes that belong to the agent itself. The proxy fall-through checks
|
|
392
399
|
// this list FIRST so it never intercepts an agent API path.
|
|
393
400
|
const AGENT_ROUTE_PREFIXES = [
|
|
394
|
-
'/health', '/sessions', '/skills', '/agents', '/store', '/canvas', '/canvas-token',
|
|
401
|
+
'/health', '/sessions', '/skills', '/agents', '/store', '/canvas', '/canvas-token', '/view-token',
|
|
395
402
|
'/canvas-stream', '/events', '/room-code', '/connect-room', '/leave-room',
|
|
396
403
|
'/report-bug', '/restart', '/tts', '/noise-cancel', '/webhook', '/sessions/export',
|
|
397
404
|
'/sessions/import', '/sessions/manifest',
|
|
@@ -768,6 +775,16 @@ function startApiServer(workingDir, port) {
|
|
|
768
775
|
reply(refusal.status, { error: refusal.error });
|
|
769
776
|
return !!refusal;
|
|
770
777
|
};
|
|
778
|
+
if (req.method === 'GET' && url.pathname === '/view-token') {
|
|
779
|
+
// Owner-only: the token gate, and with no token (local) the store's who-may-ask rules,
|
|
780
|
+
// since a hidden listener hears every broadcast. `?status=1` reads the snapshot without a token.
|
|
781
|
+
if (unauthorized() || storeRefused(true))
|
|
782
|
+
return;
|
|
783
|
+
const out = viewTokenHook ? await viewTokenHook(url.searchParams.get('status') !== '1') : null;
|
|
784
|
+
res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
|
|
785
|
+
res.end(JSON.stringify(out ?? { live: false }));
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
771
788
|
if (req.method === 'GET' && url.pathname === '/skills') {
|
|
772
789
|
if (unauthorized() || storeRefused(true))
|
|
773
790
|
return;
|
|
@@ -919,7 +936,7 @@ function startApiServer(workingDir, port) {
|
|
|
919
936
|
// Library: is it on, can it call the model, does it reach /library. Public: counts, times and codes only.
|
|
920
937
|
library: {
|
|
921
938
|
enabled: isContentLensEnabled(),
|
|
922
|
-
modelKey:
|
|
939
|
+
modelKey: hasContentModelKey(),
|
|
923
940
|
ingest: (() => { const c = resolveIngestConfig(); return 'reason' in c ? (c.reason === 'no-key' ? 'no-anon-key' : c.reason) : 'on'; })(),
|
|
924
941
|
// Last launches, the worker's step outcome, the sweep's backlog and result, the last worker failure.
|
|
925
942
|
...librarySweepHealth(),
|
|
@@ -941,6 +958,9 @@ function startApiServer(workingDir, port) {
|
|
|
941
958
|
},
|
|
942
959
|
// Whole-machine memory — what the OOM killer watches. All values in MB.
|
|
943
960
|
memory: { totalMb, usedMb, availableMb, usedPct, processRssMb },
|
|
961
|
+
// The entrypoint's boot-time volume sync to the image's osborn (null off a sandbox):
|
|
962
|
+
// a failed update reads why here (disk_full / npm_failed, free vs needed MB).
|
|
963
|
+
volumeSync: readVolumeSyncStatus(),
|
|
944
964
|
// #87: the tier actually answering + its key self-test. `provider` is the
|
|
945
965
|
// LIVE reading — agent_ready fires once, so it goes stale the moment a
|
|
946
966
|
// mid-session sign-in swaps the tier.
|
|
@@ -2110,8 +2130,8 @@ function startApiServer(workingDir, port) {
|
|
|
2110
2130
|
{
|
|
2111
2131
|
const c = resolveIngestConfig();
|
|
2112
2132
|
const why = 'reason' in c ? c.reason : null;
|
|
2113
|
-
if (!(
|
|
2114
|
-
console.warn('⚠️ library: OPENROUTER_API_KEY is
|
|
2133
|
+
if (!hasContentModelKey())
|
|
2134
|
+
console.warn('⚠️ library: neither OPENROUTER_API_KEY nor a z.ai key (Z_AI_PERSONAL_API_KEY / ZAI_API_KEY) is set: no Library pages will be written');
|
|
2115
2135
|
else if (why && why !== 'disabled')
|
|
2116
2136
|
console.warn(`⚠️ library: pages stay on this machine, nothing reaches /library (${why})`);
|
|
2117
2137
|
}
|
|
@@ -2347,21 +2367,13 @@ async function main() {
|
|
|
2347
2367
|
// session now joins a UNIQUE temporary room (buildRoomName), the token must
|
|
2348
2368
|
// be minted per room, not once at boot. mintAgentToken(roomName) returns a
|
|
2349
2369
|
// fresh JWT grant for the given room.
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
});
|
|
2356
|
-
token.addGrant({
|
|
2357
|
-
roomJoin: true,
|
|
2358
|
-
room: targetRoom,
|
|
2359
|
-
canPublish: true,
|
|
2360
|
-
canSubscribe: true,
|
|
2361
|
-
canPublishData: true,
|
|
2362
|
-
});
|
|
2363
|
-
return token.toJwt();
|
|
2370
|
+
// One minting path for every token the agent issues: itself, the meeting canvas and the read-only view (#383).
|
|
2371
|
+
const mintRoomToken = (room, who, grant) => {
|
|
2372
|
+
const t = new AccessToken(apiKey, apiSecret, { identity: who.identity, name: who.name, metadata: JSON.stringify(who.metadata), ...(who.ttl ? { ttl: who.ttl } : {}) });
|
|
2373
|
+
t.addGrant({ roomJoin: true, room, ...grant });
|
|
2374
|
+
return t.toJwt();
|
|
2364
2375
|
};
|
|
2376
|
+
const mintAgentToken = (targetRoom) => mintRoomToken(targetRoom, { identity: 'osborn-agent', name: 'Osborn AI', metadata: { type: 'agent', version: '0.3.0' } }, { canPublish: true, canSubscribe: true, canPublishData: true });
|
|
2365
2377
|
// ============================================================
|
|
2366
2378
|
// Room session (0.9.83): FRESH Room instance per user session
|
|
2367
2379
|
// ============================================================
|
|
@@ -2378,6 +2390,10 @@ async function main() {
|
|
|
2378
2390
|
// is live only while the agent is in that room AND a SIP participant is in it
|
|
2379
2391
|
// (cleared when the caller leaves or the room session ends).
|
|
2380
2392
|
let phoneRoomName = null;
|
|
2393
|
+
// People in the room for the leave/idle timers and connect reuse: read-only viewers (#383) do not count.
|
|
2394
|
+
const peopleIn = (room) => room ? roomOccupants([...room.remoteParticipants.values()].map((p) => p.identity)) : 0;
|
|
2395
|
+
// When the agent joined the current room (the room view shows how long the session has run).
|
|
2396
|
+
let roomJoinedAt = null;
|
|
2381
2397
|
const inPhoneRoom = () => isPhoneCallLive(activeRoomName, phoneRoomName, !!activeRoom && [...activeRoom.remoteParticipants.values()].some((p) => p.kind === ParticipantKind.SIP));
|
|
2382
2398
|
// Emailed code (#362, PHONE_EMAIL_CODE_ENABLED): the caller waiting to type it
|
|
2383
2399
|
// (not adopted: no voice session, no voice actions, no tools), the digits so
|
|
@@ -2560,11 +2576,11 @@ async function main() {
|
|
|
2560
2576
|
if (aloneTimer)
|
|
2561
2577
|
clearTimeout(aloneTimer);
|
|
2562
2578
|
aloneTimer = null;
|
|
2563
|
-
if (!activeRoom || activeRoom
|
|
2579
|
+
if (!activeRoom || peopleIn(activeRoom) > 0)
|
|
2564
2580
|
return;
|
|
2565
2581
|
aloneTimer = setTimeout(() => {
|
|
2566
2582
|
aloneTimer = null;
|
|
2567
|
-
if (activeRoom && activeRoom
|
|
2583
|
+
if (activeRoom && peopleIn(activeRoom) === 0 && livekitState.status === 'connected') {
|
|
2568
2584
|
console.log(`🕊️ Alone in room ${ALONE_GRACE_MS / 1000}s — destroying room session to stop connection-minute burn`);
|
|
2569
2585
|
intentionalLeave = true;
|
|
2570
2586
|
// Fresh-Room-per-session (0.9.83): tear down + discard the instance
|
|
@@ -2587,11 +2603,11 @@ async function main() {
|
|
|
2587
2603
|
if (fastLeaveTimer)
|
|
2588
2604
|
clearTimeout(fastLeaveTimer);
|
|
2589
2605
|
fastLeaveTimer = null;
|
|
2590
|
-
if (!activeRoom || activeRoom
|
|
2606
|
+
if (!activeRoom || peopleIn(activeRoom) > 0)
|
|
2591
2607
|
return;
|
|
2592
2608
|
fastLeaveTimer = setTimeout(() => {
|
|
2593
2609
|
fastLeaveTimer = null;
|
|
2594
|
-
if (activeRoom && activeRoom
|
|
2610
|
+
if (activeRoom && peopleIn(activeRoom) === 0 && livekitState.status === 'connected') {
|
|
2595
2611
|
console.log(`🚪 Room empty ${POST_LEAVE_GRACE_MS / 1000}s after session end (tab close / leave) — destroying room session`);
|
|
2596
2612
|
intentionalLeave = true;
|
|
2597
2613
|
destroyRoomSession('fast-leave').catch((e) => console.error('fast-leave destroyRoomSession failed:', e));
|
|
@@ -2628,14 +2644,14 @@ async function main() {
|
|
|
2628
2644
|
idleExitTimer = setTimeout(() => {
|
|
2629
2645
|
idleExitTimer = null;
|
|
2630
2646
|
const stillIdle = livekitState.status === 'idle' || livekitState.status === 'failed';
|
|
2631
|
-
const empty = !activeRoom || activeRoom
|
|
2647
|
+
const empty = !activeRoom || peopleIn(activeRoom) === 0;
|
|
2632
2648
|
if (stillIdle && empty && !agentsActive()) {
|
|
2633
2649
|
console.log(`⏻ [IDLE-EXIT] still idle after grace — exiting 0 so Fly stops the machine (billing stops; next Resume boots it)`);
|
|
2634
2650
|
// Give the log tee a beat to flush, then stop the machine.
|
|
2635
2651
|
setTimeout(() => process.exit(0), 2000);
|
|
2636
2652
|
}
|
|
2637
2653
|
else {
|
|
2638
|
-
console.log(`⏻ [IDLE-EXIT] aborted — status=${livekitState.status} participants=${activeRoom
|
|
2654
|
+
console.log(`⏻ [IDLE-EXIT] aborted — status=${livekitState.status} participants=${peopleIn(activeRoom)}`);
|
|
2639
2655
|
}
|
|
2640
2656
|
}, IDLE_EXIT_GRACE_MS);
|
|
2641
2657
|
};
|
|
@@ -2937,7 +2953,7 @@ async function main() {
|
|
|
2937
2953
|
// Safe to recycle = nothing a restart would interrupt: no user in the room,
|
|
2938
2954
|
// voice pipeline quiet, no host/background agents running.
|
|
2939
2955
|
const safeToRecycle = () => {
|
|
2940
|
-
const noUser = !activeRoom || activeRoom
|
|
2956
|
+
const noUser = !activeRoom || peopleIn(activeRoom) === 0;
|
|
2941
2957
|
const voiceQuiet = !currentSpeechHandle && voiceQueue.length === 0 && userState !== 'speaking';
|
|
2942
2958
|
return noUser && voiceQuiet && !agentsActive();
|
|
2943
2959
|
};
|
|
@@ -3408,7 +3424,7 @@ async function main() {
|
|
|
3408
3424
|
// Orphan cleanup: if no user is connected, the LLM subprocess was kept alive
|
|
3409
3425
|
// solely to serve the meeting — release it now and let idle-exit stop the
|
|
3410
3426
|
// machine (same billing discipline as 0.9.73, deferred until meeting end).
|
|
3411
|
-
const userPresent = activeRoom && activeRoom
|
|
3427
|
+
const userPresent = activeRoom && peopleIn(activeRoom) > 0;
|
|
3412
3428
|
if (!userPresent && currentLLM) {
|
|
3413
3429
|
console.log('🏁 Meeting over with no user connected — releasing LLM + arming idle-exit');
|
|
3414
3430
|
killCurrentLLM(`meeting_ended(${reason})_no_user`);
|
|
@@ -3432,7 +3448,7 @@ async function main() {
|
|
|
3432
3448
|
console.log(`🏁 Meeting leave-grace armed (${MEETING_LEAVE_GRACE_MS / 1000}s) — bot stays unless the user is really gone`);
|
|
3433
3449
|
meetingLeaveGraceTimer = setTimeout(() => {
|
|
3434
3450
|
meetingLeaveGraceTimer = null;
|
|
3435
|
-
const userPresent = activeRoom && activeRoom
|
|
3451
|
+
const userPresent = activeRoom && peopleIn(activeRoom) > 0;
|
|
3436
3452
|
if (activeMeetingBotId && !userPresent)
|
|
3437
3453
|
void endMeeting('user_disconnected_grace_expired');
|
|
3438
3454
|
}, MEETING_LEAVE_GRACE_MS);
|
|
@@ -5470,7 +5486,9 @@ async function main() {
|
|
|
5470
5486
|
});
|
|
5471
5487
|
room.on(RoomEvent.Disconnected, handleRoomDisconnected);
|
|
5472
5488
|
room.on(RoomEvent.ParticipantConnected, (p) => { participantConnectedHandler?.(p); });
|
|
5473
|
-
|
|
5489
|
+
// A read-only viewer (#383) leaving ends nothing.
|
|
5490
|
+
room.on(RoomEvent.ParticipantDisconnected, (p) => { if (!isViewerIdentity(p.identity))
|
|
5491
|
+
handleParticipantDisconnected(p); });
|
|
5474
5492
|
room.on(RoomEvent.DataReceived, handleDataReceived);
|
|
5475
5493
|
// Phone calls: keypad 2 denies the pending approval; 1 allows only once
|
|
5476
5494
|
// PHONE_KEYPAD_APPROVALS_ENABLED is on. Only from the caller in an authorised phone room.
|
|
@@ -5491,6 +5509,11 @@ async function main() {
|
|
|
5491
5509
|
// (they fire no ParticipantConnected event — rtc-node populates them from the
|
|
5492
5510
|
// connect callback, not via events).
|
|
5493
5511
|
participantConnectedHandler = async (participant) => {
|
|
5512
|
+
// A read-only viewer (#383) only watches: nothing is built, adopted or cancelled for it.
|
|
5513
|
+
if (isViewerIdentity(participant.identity)) {
|
|
5514
|
+
console.log(`👀 Viewer joined: ${participant.identity}`);
|
|
5515
|
+
return;
|
|
5516
|
+
}
|
|
5494
5517
|
console.log(`\n👤 User joined: ${participant.identity}`);
|
|
5495
5518
|
keepWorkingRequested = false; // a request belongs to the hang-up it preceded
|
|
5496
5519
|
// The meeting canvas joining as a listener = browser-parity audio path is
|
|
@@ -6229,7 +6252,7 @@ async function main() {
|
|
|
6229
6252
|
console.log(`⚠️ Recovery too frequent — scheduling retry in ${MIN_RECOVERY_INTERVAL}ms`);
|
|
6230
6253
|
setTimeout(async () => {
|
|
6231
6254
|
// Re-check: if session was already recovered or user left, skip
|
|
6232
|
-
if (currentSession || !activeRoom || !activeRoom
|
|
6255
|
+
if (currentSession || !activeRoom || !peopleIn(activeRoom))
|
|
6233
6256
|
return;
|
|
6234
6257
|
console.log('🔄 Retrying direct mode recovery after guard interval...');
|
|
6235
6258
|
// Trigger recovery by emitting a synthetic close
|
|
@@ -8034,6 +8057,7 @@ async function main() {
|
|
|
8034
8057
|
// Success — adopt this instance as the active room.
|
|
8035
8058
|
activeRoom = room;
|
|
8036
8059
|
activeRoomName = targetRoomName;
|
|
8060
|
+
roomJoinedAt = Date.now();
|
|
8037
8061
|
currentRoomCode = targetRoomName; // legacy /room-code returns last-created NAME
|
|
8038
8062
|
localParticipant = room.localParticipant;
|
|
8039
8063
|
livekitState.status = 'connected';
|
|
@@ -8156,13 +8180,33 @@ async function main() {
|
|
|
8156
8180
|
canvasTokenHook = async () => {
|
|
8157
8181
|
if (!activeRoomName)
|
|
8158
8182
|
return null;
|
|
8159
|
-
const
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8183
|
+
const token = await mintRoomToken(activeRoomName, { identity: 'meeting-canvas', name: 'Meeting Canvas', metadata: { type: 'canvas' } }, { canPublish: false, canSubscribe: true, canPublishData: false });
|
|
8184
|
+
return { token, url: process.env.LIVEKIT_URL || '', room: activeRoomName };
|
|
8185
|
+
};
|
|
8186
|
+
viewTokenHook = async (withToken) => {
|
|
8187
|
+
if (!activeRoom || !activeRoomName)
|
|
8188
|
+
return null;
|
|
8189
|
+
const llm = currentLLM;
|
|
8190
|
+
const busy = llm?.busyState?.() ?? {};
|
|
8191
|
+
const view = {
|
|
8192
|
+
live: true,
|
|
8193
|
+
room: activeRoomName,
|
|
8194
|
+
sessionId: llm?.sessionId ?? currentResumeSessionId ?? null,
|
|
8195
|
+
since: roomJoinedAt,
|
|
8196
|
+
phoneCall: inPhoneRoom(),
|
|
8197
|
+
busy: { turnInFlight: !!busy.turnInFlight, compacting: !!busy.compacting, permissionPending: !!busy.permissionPending },
|
|
8198
|
+
tasks: (() => { try {
|
|
8199
|
+
return llm?.getRunningTasks?.() ?? [];
|
|
8200
|
+
}
|
|
8201
|
+
catch {
|
|
8202
|
+
return [];
|
|
8203
|
+
} })(),
|
|
8204
|
+
};
|
|
8205
|
+
if (!withToken)
|
|
8206
|
+
return view;
|
|
8207
|
+
// Hidden + subscribe-only: no tracks, no data, invisible to the other participants (and the agent).
|
|
8208
|
+
const token = await mintRoomToken(activeRoomName, { identity: `${VIEWER_IDENTITY_PREFIX}${randomUUID().slice(0, 8)}`, name: 'Viewer', metadata: { type: 'viewer' }, ttl: '2h' }, { canPublish: false, canPublishData: false, canSubscribe: true, canUpdateOwnMetadata: false, hidden: true });
|
|
8209
|
+
return { ...view, token, url: process.env.LIVEKIT_URL || '' };
|
|
8166
8210
|
};
|
|
8167
8211
|
connectRoomHook = async (phoneRoom) => {
|
|
8168
8212
|
const busy = () => Object.assign(new Error('busy: the agent is in another session'), { code: 'busy' });
|
|
@@ -8177,7 +8221,7 @@ async function main() {
|
|
|
8177
8221
|
// or a stale race) is torn down and replaced with a fresh one.
|
|
8178
8222
|
const plan = planConnectRoom({
|
|
8179
8223
|
activeRoomName: activeRoom ? activeRoomName : null,
|
|
8180
|
-
occupied: !!activeRoom && activeRoom
|
|
8224
|
+
occupied: !!activeRoom && peopleIn(activeRoom) > 0,
|
|
8181
8225
|
// A caller's room is never handed to a browser, even once the caller has left.
|
|
8182
8226
|
phoneCallLive: inPhoneRoom() || isPhoneRoomName(activeRoomName),
|
|
8183
8227
|
phoneRoom,
|
|
@@ -8223,8 +8267,8 @@ async function main() {
|
|
|
8223
8267
|
// client joined) were kicking the agent out mid-adopt, stranding the new
|
|
8224
8268
|
// user on "Connecting..." (observed 2026-07-28). The alone-timer handles
|
|
8225
8269
|
// the real departure when they actually leave.
|
|
8226
|
-
if (activeRoom
|
|
8227
|
-
console.log(`🛑 /leave-room ignored (${reason}) — ${activeRoom
|
|
8270
|
+
if (peopleIn(activeRoom) > 0) {
|
|
8271
|
+
console.log(`🛑 /leave-room ignored (${reason}) — ${peopleIn(activeRoom)} participant(s) still in room`);
|
|
8228
8272
|
return;
|
|
8229
8273
|
}
|
|
8230
8274
|
console.log(`🚪 /leave-room (${reason}) — destroying room session`);
|
package/dist/meeting-tts.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export declare const SONIOX_TTS_URL = "https://tts-rt.soniox.com/tts";
|
|
|
20
20
|
export declare const OPENAI_TTS_URL = "https://api.openai.com/v1/audio/speech";
|
|
21
21
|
export declare const SONIOX_TIMEOUT_MS = 8000;
|
|
22
22
|
export declare const TOTAL_DEADLINE_MS = 11000;
|
|
23
|
+
/** Below this much time left, the next provider is not tried: a few ms cannot synthesize anything. */
|
|
24
|
+
export declare const MIN_ATTEMPT_MS = 50;
|
|
23
25
|
/** Identify audio by magic bytes: ID3 tag or an MPEG frame sync → mp3, RIFF → wav. */
|
|
24
26
|
export declare function sniffAudioFormat(buf: Buffer): SniffedAudioFormat;
|
|
25
27
|
/** Ordered list of providers to try, given the env. Empty → no voice. */
|
package/dist/meeting-tts.js
CHANGED
|
@@ -20,6 +20,8 @@ export const SONIOX_TTS_URL = 'https://tts-rt.soniox.com/tts';
|
|
|
20
20
|
export const OPENAI_TTS_URL = 'https://api.openai.com/v1/audio/speech';
|
|
21
21
|
export const SONIOX_TIMEOUT_MS = 8000;
|
|
22
22
|
export const TOTAL_DEADLINE_MS = 11000;
|
|
23
|
+
/** Below this much time left, the next provider is not tried: a few ms cannot synthesize anything. */
|
|
24
|
+
export const MIN_ATTEMPT_MS = 50;
|
|
23
25
|
// Fallbacks when the pipeline TTS is not Soniox (mirrors config.ts defaults).
|
|
24
26
|
const SONIOX_DEFAULT_MODEL = 'tts-rt-v1';
|
|
25
27
|
const SONIOX_DEFAULT_VOICE = 'Victoria';
|
|
@@ -147,7 +149,7 @@ export async function synthMeetingAudio(text, opts = {}) {
|
|
|
147
149
|
const deadline = Date.now() + (opts.deadlineMs ?? TOTAL_DEADLINE_MS);
|
|
148
150
|
for (const provider of order) {
|
|
149
151
|
const remaining = deadline - Date.now();
|
|
150
|
-
if (remaining
|
|
152
|
+
if (remaining < MIN_ATTEMPT_MS) {
|
|
151
153
|
console.warn(`⚠️ meeting tts: deadline reached before ${provider}`);
|
|
152
154
|
break;
|
|
153
155
|
}
|
|
@@ -129,6 +129,7 @@ export declare class PipelineDirectLLM extends llm.LLM {
|
|
|
129
129
|
subagentType?: string;
|
|
130
130
|
description?: string;
|
|
131
131
|
status: string;
|
|
132
|
+
startedAt: number;
|
|
132
133
|
}[];
|
|
133
134
|
/** Send a new prompt to Claude via direct chat() — event listeners stay attached */
|
|
134
135
|
sendPrompt(prompt: string): void;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* emergency_stop — interrupt the main agent's turn and redirect it (background tasks survive)
|
|
14
14
|
*/
|
|
15
15
|
import { getPipelineFastBrainPrompt } from './prompts.js';
|
|
16
|
+
import { ZAI_CODING_BASE, zaiApiKey } from './env-key.js';
|
|
16
17
|
// ============================================================
|
|
17
18
|
// CONSTANTS
|
|
18
19
|
// ============================================================
|
|
@@ -45,13 +46,10 @@ const MAX_TOOL_ROUNDS = 4;
|
|
|
45
46
|
export function resolveFastBrainProvider() {
|
|
46
47
|
if (process.env.OSBORN_DEMO_PASS !== 'zai')
|
|
47
48
|
return null;
|
|
48
|
-
|
|
49
|
-
if (!zaiKey)
|
|
49
|
+
if (!zaiApiKey())
|
|
50
50
|
return null;
|
|
51
51
|
return {
|
|
52
|
-
|
|
53
|
-
// wallet instead of the GLM Coding Plan quota.
|
|
54
|
-
url: 'https://api.z.ai/api/coding/paas/v4/chat/completions',
|
|
52
|
+
url: `${ZAI_CODING_BASE}/chat/completions`,
|
|
55
53
|
model: process.env.OSBORN_DEMO_FAST_MODEL || 'glm-5.3-flash', // fast/cheap tier of the pass
|
|
56
54
|
name: 'z.ai (demo pass)',
|
|
57
55
|
};
|
|
@@ -402,7 +400,7 @@ export async function askPipelineFastBrain(workingDir, sessionId, question, opts
|
|
|
402
400
|
// Demo pass (house z.ai key) takes precedence when active; else the user's own
|
|
403
401
|
// pay-per-use providers (Fireworks preferred, OpenRouter fallback).
|
|
404
402
|
const apiKey = resolveFastBrainProvider()
|
|
405
|
-
? (
|
|
403
|
+
? zaiApiKey()
|
|
406
404
|
: (process.env.FIREWORKS_API_KEY || process.env.OPENROUTER_API_KEY);
|
|
407
405
|
if (!apiKey) {
|
|
408
406
|
return { script: 'Search system not available right now.', type: 'acknowledgment', toolsUsed: [] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
The `{{agent}}` sub-agent (writer role) just finished. Before you finalize, you MUST now use the Task tool to: (1) RUN the tester's tests against the new implementation and report PASS/FAIL; (2) dispatch the `steward` on the diff (diff mode), passing the task and, for a fix, its root cause and evidence — it refactors toward reuse and returns CLEAN, REFACTORED or BLOCK; (3) if it REFACTORED, RUN the tests again; (4) dispatch the `reviewer` on the final diff for a VERDICT. If the steward returns BLOCK, stop and ask the user the decision it names. If tests FAIL or the reviewer REJECTs, dispatch the `{{agent}}` to fix and then re-verify (steward included) — at most 2 fix rounds, after which surface the outcome to the user rather than looping. Re-dispatching the steward, paste its previous SETTLED lines into the task so a refuted item is not raised again. In any PR description, put the steward's ROOT CAUSE under Why,
|
|
1
|
+
The `{{agent}}` sub-agent (writer role) just finished. Before you finalize, you MUST now use the Task tool to: (1) RUN the tester's tests against the new implementation and report PASS/FAIL; (2) dispatch the `steward` on the diff (diff mode), passing the task and, for a fix, its root cause and evidence — it refactors toward reuse and returns CLEAN, REFACTORED or BLOCK; (3) if it REFACTORED, RUN the tests again; (4) dispatch the `reviewer` on the final diff for a VERDICT. If the steward returns BLOCK, stop and ask the user the decision it names. If tests FAIL or the reviewer REJECTs, dispatch the `{{agent}}` to fix and then re-verify (steward included) — at most 2 fix rounds, after which surface the outcome to the user rather than looping. Re-dispatching the steward, paste its previous SETTLED lines into the task so a refuted item is not raised again. In any PR description, put the steward's ROOT CAUSE under Why, its NET-NEW and REMOVED lists under those headings, and its USER TIME line under User time.
|
package/dist/prompts/steward.md
CHANGED
|
@@ -18,6 +18,8 @@ causes more misses and more duplicates. You debloat new code and protect existin
|
|
|
18
18
|
- Prompts live in prompt files. Any text written for a model (an instruction, a reminder, an injected
|
|
19
19
|
message, an agent prompt) goes in `agent/src/prompts/*.md` or `prompts.ts`, never inline in other code, so
|
|
20
20
|
every prompt can be read and edited in one place. A diff that adds or moves prompt text elsewhere is REFACTORED.
|
|
21
|
+
- User time: every change must save the user time or say why it costs it. Flag a change that adds waiting,
|
|
22
|
+
clicks or questions without a reason, and say in your USER TIME line what the change saves or costs.
|
|
21
23
|
- Scope: act only on the diff (or plan) and on the code it duplicates. Never rewrite untouched code.
|
|
22
24
|
|
|
23
25
|
## Plan mode (the task gives you a plan, no diff yet)
|
|
@@ -145,6 +147,7 @@ LINES: +<added> -<removed> before → after, excluding test files (*.test.*, *.s
|
|
|
145
147
|
HISTORY: churn, re-touched lines (hunks checked / found), fix chains followed, missing coupled files, related issues/PRs, and any check that could not run
|
|
146
148
|
CHALLENGED: <claim> → <command run to break it> → held / broke (fixed) / could not run (why)
|
|
147
149
|
SETTLED: <item dropped> → <file:line that refuted it> (or none)
|
|
150
|
+
USER TIME: saves / costs the user time because … (flag added waiting, clicks or questions with no reason)
|
|
148
151
|
STEPS: <what you read or ran → how long>, in order, then the total
|
|
149
152
|
ROOT CAUSE: for a fix, the cause, its evidence and the chain it ends; for a feature, "new feature, no earlier fault"
|
|
150
153
|
For BLOCK, name the decision a human has to make.
|
package/dist/steward-verdict.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getStorePath } from './session-store.js';
|
|
|
7
7
|
const LABELS = {
|
|
8
8
|
'VERDICT': 'verdict', 'REUSE MAP': 'reuse', 'INVENTORY': 'reuse', 'DUPLICATES': 'reuse', 'BEHAVIOUR': 'regressions', 'NET-NEW': 'netNew', 'REMOVED': 'removed',
|
|
9
9
|
'REGRESSION MAP': 'regressions', 'IMPACT': 'impact', 'CHALLENGED': 'regressions', 'TESTS': 'regressions',
|
|
10
|
-
'SETTLED': 'regressions', 'STEPS': 'regressions', 'LINES': 'lines', 'HISTORY': 'history', 'ROOT CAUSE': 'rootCause',
|
|
10
|
+
'SETTLED': 'regressions', 'USER TIME': 'regressions', 'STEPS': 'regressions', 'LINES': 'lines', 'HISTORY': 'history', 'ROOT CAUSE': 'rootCause',
|
|
11
11
|
'DECISION': 'decision', 'HUMAN DECISION': 'decision', 'DECISION NEEDED': 'decision',
|
|
12
12
|
};
|
|
13
13
|
// A label line, tolerant of markdown: "- **VERDICT:** ...", "## HISTORY", "ROOT CAUSE — ...".
|
|
@@ -16,7 +16,7 @@ const strip = (s) => s.replace(/^[\s>*_\-•]+|[\s*_]+$/g, '').replace(/\*\*/g,
|
|
|
16
16
|
const isNone = (s) => /^(none|n\/a|nothing)\b\.?$/i.test(s);
|
|
17
17
|
// Labels the template puts after HISTORY: only these may end it from a bullet line, so a
|
|
18
18
|
// "- IMPACT: …" or "- coupled: …" bullet inside HISTORY stays history (#259).
|
|
19
|
-
const AFTER_HISTORY = new Set(['CHALLENGED', 'SETTLED', 'STEPS', 'ROOT CAUSE', 'DECISION', 'HUMAN DECISION', 'DECISION NEEDED']);
|
|
19
|
+
const AFTER_HISTORY = new Set(['CHALLENGED', 'SETTLED', 'USER TIME', 'STEPS', 'ROOT CAUSE', 'DECISION', 'HUMAN DECISION', 'DECISION NEEDED']);
|
|
20
20
|
const BULLET_RE = /^\s*(?:[-•*]\s|>)/;
|
|
21
21
|
// Bounds, so a long return cannot overflow the data-channel packet on reload.
|
|
22
22
|
const MAX_ENTRIES = 20, MAX_ENTRY = 300, MAX_TEXT = 1000, MAX_RAW = 6000;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface VolumeSyncStatus {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
/** synced | up_to_date | disk_full | npm_failed */
|
|
4
|
+
reason: string;
|
|
5
|
+
image: string | null;
|
|
6
|
+
volume: string | null;
|
|
7
|
+
freeMb: number | null;
|
|
8
|
+
needMb: number | null;
|
|
9
|
+
detail: string | null;
|
|
10
|
+
at: string | null;
|
|
11
|
+
}
|
|
12
|
+
/** /tmp is written only when the volume could not take the file on this boot, so it wins. */
|
|
13
|
+
export declare const VOLUME_SYNC_STATUS_FILES: string[];
|
|
14
|
+
/** The newest sync outcome, or null off a sandbox (no file) or when the file is unreadable. */
|
|
15
|
+
export declare function readVolumeSyncStatus(files?: string[]): VolumeSyncStatus | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// The sandbox entrypoint (Dockerfile.sandbox) syncs the volume's osborn copy to
|
|
2
|
+
// the image's version on boot and writes the outcome as JSON. /health serves it
|
|
3
|
+
// as `volumeSync` so the dashboard can say why an update did not take
|
|
4
|
+
// (disk full, npm failed) instead of timing out.
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
/** /tmp is written only when the volume could not take the file on this boot, so it wins. */
|
|
7
|
+
export const VOLUME_SYNC_STATUS_FILES = ['/tmp/osborn-sync-status', '/workspace/.osborn-sync-status'];
|
|
8
|
+
const str = (v, max) => (typeof v === 'string' && v ? v.slice(0, max) : null);
|
|
9
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
|
|
10
|
+
/** The newest sync outcome, or null off a sandbox (no file) or when the file is unreadable. */
|
|
11
|
+
export function readVolumeSyncStatus(files = VOLUME_SYNC_STATUS_FILES) {
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
let raw;
|
|
14
|
+
try {
|
|
15
|
+
raw = JSON.parse(readFileSync(file, 'utf8'));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (!raw || typeof raw !== 'object' || typeof raw.ok !== 'boolean')
|
|
21
|
+
continue;
|
|
22
|
+
const r = raw;
|
|
23
|
+
return {
|
|
24
|
+
ok: r.ok,
|
|
25
|
+
reason: str(r.reason, 40) ?? 'unknown',
|
|
26
|
+
image: str(r.image, 64),
|
|
27
|
+
volume: str(r.volume, 64),
|
|
28
|
+
freeMb: num(r.freeMb),
|
|
29
|
+
needMb: num(r.needMb),
|
|
30
|
+
detail: str(r.detail, 600),
|
|
31
|
+
at: str(r.at, 40),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osborn",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.296",
|
|
4
4
|
"description": "Voice AI coding assistant - local agent that connects to Osborn frontend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"@livekit/rtc-node": "0.13.35",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
46
46
|
"@smithery/api": "^0.48.0",
|
|
47
|
-
"@types/diff": "^8.0.0",
|
|
48
47
|
"@vscode/ripgrep": "^1.17.1",
|
|
49
48
|
"better-sqlite3": "^13.0.3",
|
|
50
49
|
"diff": "^8.0.4",
|
|
@@ -62,11 +61,11 @@
|
|
|
62
61
|
"devDependencies": {
|
|
63
62
|
"@types/http-proxy": "^1.17.17",
|
|
64
63
|
"@types/node": "^20.0.0",
|
|
65
|
-
"@vitest/coverage-v8": "^4.
|
|
64
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
66
65
|
"typescript": "^5.0.0",
|
|
67
|
-
"vitest": "^4.
|
|
66
|
+
"vitest": "^4.1.12"
|
|
68
67
|
},
|
|
69
68
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
69
|
+
"node": ">=22.0.0"
|
|
71
70
|
}
|
|
72
71
|
}
|