@voxagent/bridge 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +27 -0
  2. package/dist/cli.js +22 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.d.ts +26 -2
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +46 -1
  7. package/dist/config.js.map +1 -1
  8. package/dist/drivers/claude.d.ts.map +1 -1
  9. package/dist/drivers/claude.js +6 -1
  10. package/dist/drivers/claude.js.map +1 -1
  11. package/dist/drivers/codex.d.ts.map +1 -1
  12. package/dist/drivers/codex.js +5 -1
  13. package/dist/drivers/codex.js.map +1 -1
  14. package/dist/drivers/types.d.ts +9 -0
  15. package/dist/drivers/types.d.ts.map +1 -1
  16. package/dist/protocol.d.ts +103 -2
  17. package/dist/protocol.d.ts.map +1 -1
  18. package/dist/protocol.js.map +1 -1
  19. package/dist/room.d.ts +20 -0
  20. package/dist/room.d.ts.map +1 -1
  21. package/dist/room.js +220 -8
  22. package/dist/room.js.map +1 -1
  23. package/dist/trigger/addressing.d.ts +40 -0
  24. package/dist/trigger/addressing.d.ts.map +1 -0
  25. package/dist/trigger/addressing.js +90 -0
  26. package/dist/trigger/addressing.js.map +1 -0
  27. package/dist/trigger/decide.d.ts +33 -0
  28. package/dist/trigger/decide.d.ts.map +1 -0
  29. package/dist/trigger/decide.js +133 -0
  30. package/dist/trigger/decide.js.map +1 -0
  31. package/dist/trigger/effort.d.ts +26 -0
  32. package/dist/trigger/effort.d.ts.map +1 -0
  33. package/dist/trigger/effort.js +66 -0
  34. package/dist/trigger/effort.js.map +1 -0
  35. package/dist/trigger/engine.d.ts +120 -0
  36. package/dist/trigger/engine.d.ts.map +1 -0
  37. package/dist/trigger/engine.js +515 -0
  38. package/dist/trigger/engine.js.map +1 -0
  39. package/dist/trigger/jev.d.ts +52 -0
  40. package/dist/trigger/jev.d.ts.map +1 -0
  41. package/dist/trigger/jev.js +204 -0
  42. package/dist/trigger/jev.js.map +1 -0
  43. package/dist/trigger/questions.d.ts +43 -0
  44. package/dist/trigger/questions.d.ts.map +1 -0
  45. package/dist/trigger/questions.js +243 -0
  46. package/dist/trigger/questions.js.map +1 -0
  47. package/dist/trigger/types.d.ts +175 -0
  48. package/dist/trigger/types.d.ts.map +1 -0
  49. package/dist/trigger/types.js +29 -0
  50. package/dist/trigger/types.js.map +1 -0
  51. package/package.json +11 -10
@@ -0,0 +1,175 @@
1
+ /**
2
+ * @file Shared types for the trigger layer — the bridge-side "should the
3
+ * agent act on this utterance?" decision.
4
+ *
5
+ * Everything under `trigger/` is transport-agnostic (no LiveKit imports) so
6
+ * it ports unchanged to the Meet bot's bridge-side ear. `room.ts` is the only
7
+ * place that wires it to a transport.
8
+ */
9
+ import type { AgentBackend } from '../protocol.js';
10
+ /** One finalized line of speech, from a human or from the agent itself. */
11
+ export interface TranscriptLine {
12
+ entryId: string;
13
+ speaker: string;
14
+ speakerIdentity: string;
15
+ text: string;
16
+ timestampMs: number;
17
+ /** STT confidence 0-1 when the transport provides one. */
18
+ confidence?: number;
19
+ /** True for lines the agent spoke. */
20
+ fromAgent?: boolean;
21
+ }
22
+ export interface RoomInfo {
23
+ id: string;
24
+ name: string;
25
+ /** Human participant display names (agent excluded). */
26
+ participants: string[];
27
+ }
28
+ export type AgentRunStatus = 'idle' | 'thinking' | 'speaking' | 'acting';
29
+ /** What the agent is doing right now, as the runtime sees it. */
30
+ export interface RunSnapshot {
31
+ status: AgentRunStatus;
32
+ /** Prompt text the active run is working on. */
33
+ activePromptText: string | null;
34
+ /** Tail of what the agent has said so far in the active run. */
35
+ spokenSoFar: string;
36
+ activeToolName: string | null;
37
+ }
38
+ export interface ChoiceAnswer {
39
+ choice: string;
40
+ confidence: number;
41
+ probabilities: Record<string, number>;
42
+ }
43
+ export interface ScoreAnswer {
44
+ /** Probability-weighted level, fractional. */
45
+ score: number;
46
+ confidence: number;
47
+ /** Probability per level, index = level. */
48
+ probabilities: number[];
49
+ }
50
+ export type AddresseeOption = 'agent' | 'specific_person' | 'group' | 'nobody';
51
+ export type RelationOption = 'adds_detail' | 'redirects' | 'unrelated' | 'stop_talking' | 'abort_work' | 'backchannel';
52
+ /** Parsed jev answers for one utterance. Nouls are probabilities of "yes". */
53
+ export interface TriggerAnswers {
54
+ addressee: ChoiceAnswer;
55
+ thoughtComplete: number;
56
+ isRequest: number;
57
+ agentCapable: number;
58
+ hypotheticalOrQuoted: number;
59
+ /** Only asked while a run is active. */
60
+ relation: ChoiceAnswer | null;
61
+ effort: ScoreAnswer;
62
+ risk: ScoreAnswer;
63
+ humansDisagree: number;
64
+ }
65
+ export interface ClassifyInput {
66
+ /** The utterance to judge — a merged burst when finals were held. */
67
+ utterance: TranscriptLine;
68
+ /** Recent lines, oldest first, NOT including `utterance`. */
69
+ window: TranscriptLine[];
70
+ room: RoomInfo;
71
+ run: RunSnapshot;
72
+ agent: AgentDescriptor;
73
+ /** Set when the agent has an unanswered "was that for me?" on screen. */
74
+ pendingNudgeText: string | null;
75
+ lastAgentText: string | null;
76
+ lastAgentSpokeAtMs: number | null;
77
+ nowMs: number;
78
+ }
79
+ export interface ClassifyResult {
80
+ answers: TriggerAnswers;
81
+ latencyMs: number;
82
+ model: string;
83
+ inputTokens: number;
84
+ }
85
+ /** The seam tests fake. Must reject (not hang) on timeout. */
86
+ export interface Classifier {
87
+ classify(input: ClassifyInput): Promise<ClassifyResult>;
88
+ }
89
+ export interface AgentDescriptor {
90
+ names: string[];
91
+ backend: AgentBackend;
92
+ /** Basename of the workspace, never the full path. */
93
+ workspace: string;
94
+ tools: string[];
95
+ hostName: string;
96
+ }
97
+ export type TriggerAction = {
98
+ kind: 'ignore';
99
+ reason: string;
100
+ } | {
101
+ kind: 'hold';
102
+ reason: string;
103
+ waitMs: number;
104
+ } | {
105
+ kind: 'run';
106
+ reason: string;
107
+ } | {
108
+ kind: 'nudge';
109
+ reason: string;
110
+ nudgeKind: 'unsure' | 'offer';
111
+ } | {
112
+ kind: 'append';
113
+ reason: string;
114
+ } | {
115
+ kind: 'supersede';
116
+ reason: string;
117
+ } | {
118
+ kind: 'queue';
119
+ reason: string;
120
+ } | {
121
+ kind: 'stop_talking';
122
+ reason: string;
123
+ } | {
124
+ kind: 'abort';
125
+ reason: string;
126
+ };
127
+ export interface TriggerSettings {
128
+ /** `probabilities.agent` needed to act with no name and several humans. */
129
+ wakeThreshold: number;
130
+ /** ...when the utterance contains the agent's name. */
131
+ wakeThresholdWithName: number;
132
+ /** ...when only one human is in the room. */
133
+ wakeThresholdSolo: number;
134
+ /** Added to the wake threshold per risk level above 0. */
135
+ riskBump: number;
136
+ /** Below the wake threshold but at/above this → "was that for me?" nudge. */
137
+ nudgeFloor: number;
138
+ /** `thought_complete` below this holds the utterance for more speech. */
139
+ holdBelow: number;
140
+ /** Longest a held utterance waits before running anyway. */
141
+ maxHoldMs: number;
142
+ /** `hypothetical_or_quoted` at/above this vetoes a nameless wake. */
143
+ hypotheticalVeto: number;
144
+ /** stop_talking + abort_work mass needed to silence a speaking agent. */
145
+ stopTalkingThreshold: number;
146
+ /** abort_work probability needed to cancel the work itself. */
147
+ abortThreshold: number;
148
+ /** `probabilities.agent` floor for stop/abort — lower than wake on purpose. */
149
+ stopAddressFloor: number;
150
+ /** Offer help on group requests nobody addressed to the agent. */
151
+ proactive: 'off' | 'nudge';
152
+ proactiveThreshold: number;
153
+ /** `humans_disagree` at/above this adds the both-options instruction. */
154
+ disagreeThreshold: number;
155
+ nudgeTtlMs: number;
156
+ /** Minimum gap between nudges so the pill doesn't nag. */
157
+ nudgeCooldownMs: number;
158
+ }
159
+ export declare const DEFAULT_TRIGGER_SETTINGS: TriggerSettings;
160
+ /** Per-run routing the engine hands to the runtime alongside a prompt. */
161
+ export interface RunPlan {
162
+ /** 0-3, from the `effort` score. */
163
+ effortLevel: number;
164
+ /** Set only in `--llm-model auto`. */
165
+ model?: string;
166
+ /** Claude only. */
167
+ maxThinkingTokens?: number;
168
+ /** Codex only. */
169
+ reasoningEffort?: 'low' | 'medium' | 'high';
170
+ /** Canned line spoken before the first LLM token. */
171
+ ack?: string;
172
+ /** Extra system-prompt lines for this run (e.g. the disagreement note). */
173
+ addendum?: string[];
174
+ }
175
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/trigger/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAEtE,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzE,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,C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C7C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,SAAS,EAAE,KAAK,GAAG,OAAO,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,wBAAwB,EAAE,eAiBtC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,WAAW,OAAO;IACtB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB;IAClB,eAAe,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @file Shared types for the trigger layer — the bridge-side "should the
3
+ * agent act on this utterance?" decision.
4
+ *
5
+ * Everything under `trigger/` is transport-agnostic (no LiveKit imports) so
6
+ * it ports unchanged to the Meet bot's bridge-side ear. `room.ts` is the only
7
+ * place that wires it to a transport.
8
+ */
9
+ const _actionKindsMatchWire = true;
10
+ void _actionKindsMatchWire;
11
+ export const DEFAULT_TRIGGER_SETTINGS = {
12
+ wakeThreshold: 0.8,
13
+ wakeThresholdWithName: 0.45,
14
+ wakeThresholdSolo: 0.55,
15
+ riskBump: 0.1,
16
+ nudgeFloor: 0.45,
17
+ holdBelow: 0.45,
18
+ maxHoldMs: 2500,
19
+ hypotheticalVeto: 0.6,
20
+ stopTalkingThreshold: 0.5,
21
+ abortThreshold: 0.7,
22
+ stopAddressFloor: 0.4,
23
+ proactive: 'nudge',
24
+ proactiveThreshold: 0.75,
25
+ disagreeThreshold: 0.7,
26
+ nudgeTtlMs: 10_000,
27
+ nudgeCooldownMs: 20_000,
28
+ };
29
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/trigger/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2HH,MAAM,qBAAqB,GAA0B,IAAI,CAAC;AAC1D,KAAK,qBAAqB,CAAC;AAmC3B,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,aAAa,EAAE,GAAG;IAClB,qBAAqB,EAAE,IAAI;IAC3B,iBAAiB,EAAE,IAAI;IACvB,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,GAAG;IACrB,oBAAoB,EAAE,GAAG;IACzB,cAAc,EAAE,GAAG;IACnB,gBAAgB,EAAE,GAAG;IACrB,SAAS,EAAE,OAAO;IAClB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,GAAG;IACtB,UAAU,EAAE,MAAM;IAClB,eAAe,EAAE,MAAM;CACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxagent/bridge",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "Local bridge process that pairs the host's Claude Code or Codex agent with a VoxAgent meeting.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,15 @@
40
40
  "dist",
41
41
  "README.md"
42
42
  ],
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json",
45
+ "dev": "tsx watch src/cli.ts",
46
+ "start": "node dist/cli.js",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "trigger:eval": "tsx src/trigger/jev.smoke.ts",
50
+ "type-check": "tsc -p tsconfig.json --noEmit"
51
+ },
43
52
  "dependencies": {
44
53
  "@anthropic-ai/claude-agent-sdk": "^0.1.13",
45
54
  "@livekit/rtc-node": "^0.13.24",
@@ -56,13 +65,5 @@
56
65
  },
57
66
  "engines": {
58
67
  "node": ">=20"
59
- },
60
- "scripts": {
61
- "build": "tsc -p tsconfig.json",
62
- "dev": "tsx watch src/cli.ts",
63
- "start": "node dist/cli.js",
64
- "test": "vitest run",
65
- "test:watch": "vitest",
66
- "type-check": "tsc -p tsconfig.json --noEmit"
67
68
  }
68
- }
69
+ }