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,157 @@
1
+ /**
2
+ * data-sender-auth.ts — who may send data-channel commands, and who may become
3
+ * the controller.
4
+ *
5
+ * Every message on topic 'user-input' is handled by handleDataReceived in
6
+ * index.ts. All of them EXCEPT the read-only queries in READ_ONLY_MESSAGE_TYPES
7
+ * must come from the controlling user participant: the `user-*` identity
8
+ * minted by the frontend /api/token (auth-gated, checks room ownership) that
9
+ * the agent adopted as its voice user. Canvas, bots and other identities are
10
+ * dropped. The gate FAILS CLOSED: a type that is not on the read-only list
11
+ * (including any new type added to index.ts later) requires the controller.
12
+ *
13
+ * Full set of types handleDataReceived handles (2026-11-07):
14
+ * Gated (state-changing or leaks session/process ids):
15
+ * user_text, claude_auth_code, permission_response, list_sessions,
16
+ * resume_session, continue_session, switch_session, session_selected,
17
+ * mcp_toggle, set_agents, skill_add, skill_remove, noise_cancel,
18
+ * gate_send_anyway, stop_dispatch, join_meeting, leave_meeting,
19
+ * mute_participant, start_ide, stop_ide, spawn_background_session,
20
+ * dispatch_background, stop_background_session, list_slots, list_processes,
21
+ * favorite_changed
22
+ * Open (read-only, listed in READ_ONLY_MESSAGE_TYPES):
23
+ * get_current_session, get_session_artifacts, get_plan_file,
24
+ * get_research_artifact, get_mcp_status, get_skills, get_agents, skill_get
25
+ * list_sessions / list_slots / list_processes are read-only but return session
26
+ * and process ids that the gated commands (dispatch_background etc.) take as
27
+ * targets, so they are gated too.
28
+ *
29
+ * Controller binding (canBecomeController): when the machine has an owner
30
+ * (OSBORN_OWNER_USER_ID, baked into machine env by the frontend provisioning),
31
+ * only a participant whose SIGNED token metadata userId equals the owner can
32
+ * become the controller. With no owner configured (single-tenant / local
33
+ * mode) the newest joiner becomes the controller, as before.
34
+ */
35
+ /**
36
+ * Known gated types. Informational and for tests: the gate itself is "not
37
+ * read-only", so types missing from this list are still gated.
38
+ */
39
+ export const CONTROL_MESSAGE_TYPES = new Set([
40
+ 'user_text',
41
+ 'claude_auth_code',
42
+ 'permission_response',
43
+ 'list_sessions',
44
+ 'resume_session',
45
+ 'continue_session',
46
+ 'switch_session',
47
+ 'session_selected',
48
+ 'mcp_toggle',
49
+ 'set_agents',
50
+ 'skill_add',
51
+ 'skill_remove',
52
+ 'noise_cancel',
53
+ 'gate_send_anyway',
54
+ 'stop_dispatch',
55
+ 'join_meeting',
56
+ 'leave_meeting',
57
+ 'mute_participant',
58
+ 'start_ide',
59
+ 'stop_ide',
60
+ 'spawn_background_session',
61
+ 'dispatch_background',
62
+ 'stop_background_session',
63
+ 'list_slots',
64
+ 'list_processes',
65
+ // Feeds hidden context into the next turn (UI#21), so controller-only.
66
+ 'favorite_changed',
67
+ ]);
68
+ /** Read-only queries any participant may send. Everything else is gated. */
69
+ export const READ_ONLY_MESSAGE_TYPES = new Set([
70
+ 'get_current_session',
71
+ 'get_session_artifacts',
72
+ 'get_plan_file',
73
+ 'get_research_artifact',
74
+ 'get_mcp_status',
75
+ 'get_skills',
76
+ 'get_agents',
77
+ 'skill_get',
78
+ ]);
79
+ /** Identity prefix /api/token gives every user participant. */
80
+ export const USER_IDENTITY_PREFIX = 'user-';
81
+ /**
82
+ * Identity the agent itself mints (mintAgentToken). The watch gateway joins
83
+ * with it and relays watch Approve/Deny as `permission_response`. Only the
84
+ * agent's own API secret can mint it, so it is trusted for approvals but not
85
+ * for anything else.
86
+ */
87
+ export const AGENT_SELF_IDENTITY = 'osborn-agent';
88
+ export function checkControlSender(type, senderIdentity, controllingIdentity) {
89
+ if (READ_ONLY_MESSAGE_TYPES.has(type))
90
+ return { ok: true };
91
+ if (!senderIdentity)
92
+ return { ok: false, reason: 'no sender participant' };
93
+ if (type === 'permission_response' && senderIdentity === AGENT_SELF_IDENTITY)
94
+ return { ok: true };
95
+ if (!senderIdentity.startsWith(USER_IDENTITY_PREFIX)) {
96
+ return { ok: false, reason: `sender ${senderIdentity} is not a user participant` };
97
+ }
98
+ if (!controllingIdentity)
99
+ return { ok: false, reason: 'no controlling participant' };
100
+ if (senderIdentity !== controllingIdentity) {
101
+ return { ok: false, reason: `sender ${senderIdentity} is not the controlling participant (${controllingIdentity})` };
102
+ }
103
+ return { ok: true };
104
+ }
105
+ /**
106
+ * May a joining participant become the controller?
107
+ * - Owner configured: only when the participant's token userId matches it.
108
+ * - No owner configured (single-tenant / local): yes (newest joiner wins).
109
+ */
110
+ export function canBecomeController(participantUserId, ownerUserId) {
111
+ if (!ownerUserId)
112
+ return true;
113
+ return !!participantUserId && participantUserId === ownerUserId;
114
+ }
115
+ /**
116
+ * What a non-canvas participant joining the room changes. Pure, so the
117
+ * controller rules are testable without LiveKit.
118
+ * - `user-*` joiner allowed by canBecomeController: gets the session and
119
+ * becomes the controller (newest eligible joiner wins).
120
+ * - `user-*` joiner that is not the owner: ignored entirely.
121
+ * - The agent's own identity (watch gateway): NEVER becomes the controller,
122
+ * so the owner's commands keep working; it can still send
123
+ * permission_response (checkControlSender). It gets the voice session only
124
+ * when it joins with no controller (the opt-in watch voice path that hears
125
+ * the watch mic). When a controller already exists it is NOT adopted: the
126
+ * full session rebuild would tear down the owner's live session and reset
127
+ * currentUserId to '' (the gateway's token has no metadata).
128
+ * - Any other identity: never the controller; gets a session only in
129
+ * single-tenant mode (no owner), matching the old behavior there.
130
+ */
131
+ export function resolveJoin(joinerIdentity, joinerUserId, ownerUserId, currentController) {
132
+ if (joinerIdentity === AGENT_SELF_IDENTITY) {
133
+ return { adoptSession: !currentController, controller: currentController };
134
+ }
135
+ if (joinerIdentity.startsWith(USER_IDENTITY_PREFIX)) {
136
+ return canBecomeController(joinerUserId, ownerUserId)
137
+ ? { adoptSession: true, controller: joinerIdentity }
138
+ : { adoptSession: false, controller: currentController };
139
+ }
140
+ return { adoptSession: !ownerUserId, controller: currentController };
141
+ }
142
+ /**
143
+ * userId from a participant's token metadata (JSON set by /api/token and signed
144
+ * into the JWT). Participants cannot change their own metadata unless the token
145
+ * grants canUpdateOwnMetadata, which /api/token sets to false.
146
+ */
147
+ export function userIdFromMetadata(metadata) {
148
+ if (!metadata)
149
+ return undefined;
150
+ try {
151
+ const parsed = JSON.parse(metadata);
152
+ return typeof parsed?.userId === 'string' && parsed.userId ? parsed.userId : undefined;
153
+ }
154
+ catch {
155
+ return undefined;
156
+ }
157
+ }
package/dist/env-keys.js CHANGED
@@ -31,10 +31,21 @@ export const AGENT_ENV_KEYS = [
31
31
  { key: 'RECALL_API_KEY', required: false, explicit: true, description: 'Recall.ai meeting bot.' },
32
32
  { key: 'RECALL_REGION', required: false, explicit: true, description: 'Recall.ai region.' },
33
33
  { key: 'SMITHERY_API_KEY', required: false, explicit: true, description: 'Smithery hosted-MCP catalog.' },
34
+ // Watch bridge (Track 1 — Pushover wrist yes/no)
35
+ { key: 'PUSHOVER_TOKEN', required: false, explicit: true, description: 'Pushover app token — emergency permission pushes to the wrist (pushover.ts).' },
36
+ { key: 'PUSHOVER_USER_KEY', required: false, explicit: true, description: 'Pushover user/group key receiving permission pushes.' },
37
+ { key: 'NTFY_URL', required: false, explicit: true, description: 'ntfy server base (https://ntfy.sh or self-hosted) — second Track 1 provider with Approve/Deny buttons.' },
38
+ { key: 'NTFY_TOPIC', required: false, explicit: true, description: 'ntfy topic permission asks are published to.' },
39
+ { key: 'NTFY_TOKEN', required: false, explicit: true, description: 'Optional ntfy access token for protected topics.' },
40
+ { key: 'WATCH_ACK_SECRET', required: false, explicit: true, description: 'HMAC secret signing watch-ack links; shared with the frontend /api/watch/ack route.' },
41
+ { key: 'OSBORN_PUBLIC_URL', required: false, explicit: true, description: 'This machine\'s public base URL, embedded in signed watch-ack links so the callback knows where to forward.' },
42
+ { key: 'WATCH_GATEWAY', required: false, explicit: true, description: 'Set "1" to start the Track 2 watchOS WS gateway (watch-gateway.ts) bridging the native watch app into the LiveKit room.' },
43
+ { key: 'WATCH_GATEWAY_PORT', required: false, explicit: true, description: 'Port for the Track 2 watch gateway WS server (default 8742).' },
34
44
  // Platform / infra
35
45
  { key: 'OSBORN_API_PORT', required: true, explicit: true, description: 'Agent HTTP server port.' },
36
46
  { key: 'OSBORN_CWD', required: false, explicit: true, description: 'Agent working directory.' },
37
47
  { key: 'OSBORN_SYNC_TOKEN', required: false, explicit: true, description: 'Session export/import auth token.' },
48
+ { key: 'OSBORN_OWNER_USER_ID', required: false, explicit: true, description: 'Machine owner user id; only a participant whose token metadata userId matches may control the agent. Unset = single-tenant newest-joiner mode.' },
38
49
  { key: 'OSBORN_FRONTEND_URL', required: false, explicit: true, description: 'Frontend base URL for artifact upload.' },
39
50
  { key: 'OSBORN_HOUSEKEEPING_DRYRUN', required: false, explicit: true, description: 'Set "0" to enable live housekeeping deletion; any other value / unset = dry-run (log only).' },
40
51
  { key: 'DEV_DOMAIN', required: false, explicit: true, description: 'Wildcard dev-routing domain.' },