@opengeni/react-native 1.4.5-canary.37615713321001
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/LICENSE +190 -0
- package/README.md +74 -0
- package/dist/adapters.d.ts +53 -0
- package/dist/adapters.js +3 -0
- package/dist/adapters.js.map +1 -0
- package/dist/attachments.d.ts +75 -0
- package/dist/chunk-3VSZAQ7G.js +391 -0
- package/dist/chunk-3VSZAQ7G.js.map +1 -0
- package/dist/chunk-5ZVK7WKA.js +88 -0
- package/dist/chunk-5ZVK7WKA.js.map +1 -0
- package/dist/chunk-EEDIMY3L.js +240 -0
- package/dist/chunk-EEDIMY3L.js.map +1 -0
- package/dist/chunk-M23SDI4R.js +83 -0
- package/dist/chunk-M23SDI4R.js.map +1 -0
- package/dist/chunk-PHJBSAR3.js +2006 -0
- package/dist/chunk-PHJBSAR3.js.map +1 -0
- package/dist/environment.d.ts +19 -0
- package/dist/expo.d.ts +25 -0
- package/dist/expo.js +267 -0
- package/dist/expo.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +3345 -0
- package/dist/index.js.map +1 -0
- package/dist/presentation.d.ts +262 -0
- package/dist/read-acknowledgement.d.ts +39 -0
- package/dist/realtime/call-events.d.ts +11 -0
- package/dist/realtime/call-view.d.ts +26 -0
- package/dist/realtime/expo-call.d.ts +11 -0
- package/dist/realtime/native-call.d.ts +104 -0
- package/dist/realtime/native-realtime.d.ts +35 -0
- package/dist/realtime/use-native-session-realtime.d.ts +25 -0
- package/dist/session-view.d.ts +87 -0
- package/dist/timeline/activity.d.ts +34 -0
- package/dist/timeline/composer.d.ts +86 -0
- package/dist/timeline/controls.d.ts +27 -0
- package/dist/timeline/decisions.d.ts +29 -0
- package/dist/timeline/feedback.d.ts +26 -0
- package/dist/timeline/icon-nodes.generated.d.ts +738 -0
- package/dist/timeline/icon.d.ts +11 -0
- package/dist/timeline/index.d.ts +32 -0
- package/dist/timeline/index.js +5419 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/markdown.d.ts +11 -0
- package/dist/timeline/markdown.js +415 -0
- package/dist/timeline/markdown.js.map +1 -0
- package/dist/timeline/message-attachments.d.ts +13 -0
- package/dist/timeline/message-timeline.d.ts +36 -0
- package/dist/timeline/model-picker.d.ts +17 -0
- package/dist/timeline/primitives.d.ts +85 -0
- package/dist/timeline/queue-dock.d.ts +19 -0
- package/dist/timeline/session-actions.d.ts +34 -0
- package/dist/timeline/session-list.d.ts +50 -0
- package/dist/timeline/session-screen.d.ts +35 -0
- package/dist/timeline/session-signals.d.ts +37 -0
- package/dist/timeline/sheet.d.ts +14 -0
- package/dist/timeline/theme.d.ts +58 -0
- package/dist/timeline/thinking-orb.d.ts +13 -0
- package/dist/timeline/turn.d.ts +80 -0
- package/dist/ui/attention.d.ts +14 -0
- package/dist/ui/cards.d.ts +21 -0
- package/dist/ui/composer.d.ts +21 -0
- package/dist/ui/format.d.ts +13 -0
- package/dist/ui/icons.d.ts +9 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.js +1757 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/steps-sheet.d.ts +10 -0
- package/dist/ui/theme.d.ts +63 -0
- package/dist/ui/timeline.d.ts +48 -0
- package/dist/ui/web-tokens.gen.d.ts +90 -0
- package/dist/use-native-session.d.ts +40 -0
- package/dist/view-model.d.ts +52 -0
- package/dist/voice-input.d.ts +102 -0
- package/dist/webrtc.d.ts +9 -0
- package/dist/webrtc.js +19 -0
- package/dist/webrtc.js.map +1 -0
- package/expo-module.config.json +7 -0
- package/ios/OpenGeniCall.podspec +22 -0
- package/ios/OpenGeniCallAppDelegateSubscriber.swift +29 -0
- package/ios/OpenGeniCallCenter.swift +189 -0
- package/ios/OpenGeniCallModule.swift +64 -0
- package/package.json +93 -0
- package/src/adapters.ts +150 -0
- package/src/attachments.ts +396 -0
- package/src/environment.tsx +214 -0
- package/src/expo.ts +295 -0
- package/src/index.ts +98 -0
- package/src/presentation.ts +285 -0
- package/src/read-acknowledgement.ts +72 -0
- package/src/realtime/call-events.ts +41 -0
- package/src/realtime/call-view.tsx +220 -0
- package/src/realtime/expo-call.ts +49 -0
- package/src/realtime/native-call.ts +266 -0
- package/src/realtime/native-realtime.ts +115 -0
- package/src/realtime/use-native-session-realtime.ts +29 -0
- package/src/session-view.tsx +2251 -0
- package/src/timeline/activity.tsx +736 -0
- package/src/timeline/composer.tsx +686 -0
- package/src/timeline/controls.tsx +151 -0
- package/src/timeline/decisions.tsx +651 -0
- package/src/timeline/feedback.tsx +251 -0
- package/src/timeline/icon-nodes.generated.ts +1830 -0
- package/src/timeline/icon.tsx +44 -0
- package/src/timeline/index.ts +67 -0
- package/src/timeline/markdown.tsx +510 -0
- package/src/timeline/message-attachments.tsx +155 -0
- package/src/timeline/message-timeline.tsx +1042 -0
- package/src/timeline/model-picker.tsx +450 -0
- package/src/timeline/primitives.tsx +561 -0
- package/src/timeline/queue-dock.tsx +331 -0
- package/src/timeline/session-actions.tsx +379 -0
- package/src/timeline/session-list.tsx +338 -0
- package/src/timeline/session-screen.tsx +488 -0
- package/src/timeline/session-signals.tsx +312 -0
- package/src/timeline/sheet.tsx +153 -0
- package/src/timeline/theme.tsx +128 -0
- package/src/timeline/thinking-orb.tsx +93 -0
- package/src/timeline/turn.tsx +569 -0
- package/src/ui/attention.tsx +220 -0
- package/src/ui/cards.tsx +267 -0
- package/src/ui/composer.tsx +296 -0
- package/src/ui/format.ts +86 -0
- package/src/ui/icons.tsx +131 -0
- package/src/ui/index.ts +18 -0
- package/src/ui/steps-sheet.tsx +71 -0
- package/src/ui/theme.ts +261 -0
- package/src/ui/timeline.tsx +837 -0
- package/src/ui/web-tokens.gen.ts +94 -0
- package/src/use-native-session.ts +219 -0
- package/src/view-model.ts +485 -0
- package/src/voice-input.ts +382 -0
- package/src/webrtc.ts +30 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
export interface OpenGeniNativeTheme {
|
|
2
|
+
dark: boolean;
|
|
3
|
+
colors: {
|
|
4
|
+
background: string;
|
|
5
|
+
surface: string;
|
|
6
|
+
elevated: string;
|
|
7
|
+
border: string;
|
|
8
|
+
text: string;
|
|
9
|
+
secondaryText: string;
|
|
10
|
+
mutedText: string;
|
|
11
|
+
accent: string;
|
|
12
|
+
accentForeground: string;
|
|
13
|
+
userBubble: string;
|
|
14
|
+
userBubbleText: string;
|
|
15
|
+
danger: string;
|
|
16
|
+
dangerSurface: string;
|
|
17
|
+
warning: string;
|
|
18
|
+
warningSurface: string;
|
|
19
|
+
success: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface OpenGeniNativeLabels {
|
|
23
|
+
knowledgeOutcome?: Record<"published" | "pending" | "rejected" | "archived" | "failed", string>;
|
|
24
|
+
emptyTitle: string;
|
|
25
|
+
emptyDescription: string;
|
|
26
|
+
loadEarlier: string;
|
|
27
|
+
loadingEarlier: string;
|
|
28
|
+
reconnecting: string;
|
|
29
|
+
connecting: string;
|
|
30
|
+
offlinePaused: string;
|
|
31
|
+
error: string;
|
|
32
|
+
retry: string;
|
|
33
|
+
dismiss: string;
|
|
34
|
+
queueTitle: string;
|
|
35
|
+
queueEmpty: string;
|
|
36
|
+
edit: string;
|
|
37
|
+
runNext: string;
|
|
38
|
+
remove: string;
|
|
39
|
+
moveEarlier: string;
|
|
40
|
+
moveLater: string;
|
|
41
|
+
approvalsTitle: string;
|
|
42
|
+
approve: string;
|
|
43
|
+
deny: string;
|
|
44
|
+
questionsTitle: string;
|
|
45
|
+
humanInputAsked: string;
|
|
46
|
+
humanInputOutcome: {
|
|
47
|
+
answered: string;
|
|
48
|
+
skipped: string;
|
|
49
|
+
expired: string;
|
|
50
|
+
cancelled: string;
|
|
51
|
+
};
|
|
52
|
+
submitAnswers: string;
|
|
53
|
+
skip: string;
|
|
54
|
+
other: string;
|
|
55
|
+
required: string;
|
|
56
|
+
attachDocument: string;
|
|
57
|
+
attachImage: string;
|
|
58
|
+
preparingAttachment: string;
|
|
59
|
+
uploading: string;
|
|
60
|
+
uploadFailed: string;
|
|
61
|
+
attachmentError: string;
|
|
62
|
+
removeAttachment: string;
|
|
63
|
+
retryUpload: string;
|
|
64
|
+
restoredAttachment: string;
|
|
65
|
+
composerPlaceholder: string;
|
|
66
|
+
send: string;
|
|
67
|
+
steer: string;
|
|
68
|
+
pause: string;
|
|
69
|
+
resume: string;
|
|
70
|
+
savingDraft: string;
|
|
71
|
+
draftConflict: string;
|
|
72
|
+
keepMine: string;
|
|
73
|
+
useRemote: string;
|
|
74
|
+
thinking: string;
|
|
75
|
+
thought: string;
|
|
76
|
+
reasoning: string;
|
|
77
|
+
tool: string;
|
|
78
|
+
worker: string;
|
|
79
|
+
user: string;
|
|
80
|
+
assistant: string;
|
|
81
|
+
sandbox: string;
|
|
82
|
+
goal: string;
|
|
83
|
+
goalAction: {
|
|
84
|
+
set: string;
|
|
85
|
+
updated: string;
|
|
86
|
+
completed: string;
|
|
87
|
+
paused: string;
|
|
88
|
+
resumed: string;
|
|
89
|
+
cleared: string;
|
|
90
|
+
held: string;
|
|
91
|
+
continuation: string;
|
|
92
|
+
};
|
|
93
|
+
contextUpdated: string;
|
|
94
|
+
contextCompactionPhase: {
|
|
95
|
+
started: string;
|
|
96
|
+
compacted: string;
|
|
97
|
+
skipped: string;
|
|
98
|
+
};
|
|
99
|
+
machineUpdates: string;
|
|
100
|
+
connectionRequired: string;
|
|
101
|
+
memory: string;
|
|
102
|
+
memoryAction: {
|
|
103
|
+
saved: string;
|
|
104
|
+
corrected: string;
|
|
105
|
+
updated: string;
|
|
106
|
+
archived: string;
|
|
107
|
+
};
|
|
108
|
+
fleetDecision: string;
|
|
109
|
+
fleetOutcome: {
|
|
110
|
+
selected: string;
|
|
111
|
+
waiting: string;
|
|
112
|
+
none: string;
|
|
113
|
+
};
|
|
114
|
+
fleetReason: {
|
|
115
|
+
leaseReused: string;
|
|
116
|
+
pin: string;
|
|
117
|
+
rotation: string;
|
|
118
|
+
active: string;
|
|
119
|
+
allCapped: string;
|
|
120
|
+
none: string;
|
|
121
|
+
};
|
|
122
|
+
turn: string;
|
|
123
|
+
activity: string;
|
|
124
|
+
statusQueued: string;
|
|
125
|
+
statusRunning: string;
|
|
126
|
+
statusComplete: string;
|
|
127
|
+
statusRecovering: string;
|
|
128
|
+
statusWaitingCapacity: string;
|
|
129
|
+
statusIdle: string;
|
|
130
|
+
statusRequiresAction: string;
|
|
131
|
+
statusFailed: string;
|
|
132
|
+
statusCancelled: string;
|
|
133
|
+
relativeNow: string;
|
|
134
|
+
relativeSeconds: string;
|
|
135
|
+
relativeMinutes: string;
|
|
136
|
+
relativeHours: string;
|
|
137
|
+
relativeDays: string;
|
|
138
|
+
}
|
|
139
|
+
export declare const DEFAULT_OPENGENI_NATIVE_LABELS: {
|
|
140
|
+
knowledgeOutcome: {
|
|
141
|
+
published: string;
|
|
142
|
+
pending: string;
|
|
143
|
+
rejected: string;
|
|
144
|
+
archived: string;
|
|
145
|
+
failed: string;
|
|
146
|
+
};
|
|
147
|
+
emptyTitle: string;
|
|
148
|
+
emptyDescription: string;
|
|
149
|
+
loadEarlier: string;
|
|
150
|
+
loadingEarlier: string;
|
|
151
|
+
reconnecting: string;
|
|
152
|
+
connecting: string;
|
|
153
|
+
offlinePaused: string;
|
|
154
|
+
error: string;
|
|
155
|
+
retry: string;
|
|
156
|
+
dismiss: string;
|
|
157
|
+
queueTitle: string;
|
|
158
|
+
queueEmpty: string;
|
|
159
|
+
edit: string;
|
|
160
|
+
runNext: string;
|
|
161
|
+
remove: string;
|
|
162
|
+
moveEarlier: string;
|
|
163
|
+
moveLater: string;
|
|
164
|
+
approvalsTitle: string;
|
|
165
|
+
approve: string;
|
|
166
|
+
deny: string;
|
|
167
|
+
questionsTitle: string;
|
|
168
|
+
humanInputAsked: string;
|
|
169
|
+
humanInputOutcome: {
|
|
170
|
+
answered: string;
|
|
171
|
+
skipped: string;
|
|
172
|
+
expired: string;
|
|
173
|
+
cancelled: string;
|
|
174
|
+
};
|
|
175
|
+
submitAnswers: string;
|
|
176
|
+
skip: string;
|
|
177
|
+
other: string;
|
|
178
|
+
required: string;
|
|
179
|
+
attachDocument: string;
|
|
180
|
+
attachImage: string;
|
|
181
|
+
preparingAttachment: string;
|
|
182
|
+
uploading: string;
|
|
183
|
+
uploadFailed: string;
|
|
184
|
+
attachmentError: string;
|
|
185
|
+
removeAttachment: string;
|
|
186
|
+
retryUpload: string;
|
|
187
|
+
restoredAttachment: string;
|
|
188
|
+
composerPlaceholder: string;
|
|
189
|
+
send: string;
|
|
190
|
+
steer: string;
|
|
191
|
+
pause: string;
|
|
192
|
+
resume: string;
|
|
193
|
+
savingDraft: string;
|
|
194
|
+
draftConflict: string;
|
|
195
|
+
keepMine: string;
|
|
196
|
+
useRemote: string;
|
|
197
|
+
thinking: string;
|
|
198
|
+
thought: string;
|
|
199
|
+
reasoning: string;
|
|
200
|
+
tool: string;
|
|
201
|
+
worker: string;
|
|
202
|
+
user: string;
|
|
203
|
+
assistant: string;
|
|
204
|
+
sandbox: string;
|
|
205
|
+
goal: string;
|
|
206
|
+
goalAction: {
|
|
207
|
+
set: string;
|
|
208
|
+
updated: string;
|
|
209
|
+
completed: string;
|
|
210
|
+
paused: string;
|
|
211
|
+
resumed: string;
|
|
212
|
+
cleared: string;
|
|
213
|
+
held: string;
|
|
214
|
+
continuation: string;
|
|
215
|
+
};
|
|
216
|
+
contextUpdated: string;
|
|
217
|
+
contextCompactionPhase: {
|
|
218
|
+
started: string;
|
|
219
|
+
compacted: string;
|
|
220
|
+
skipped: string;
|
|
221
|
+
};
|
|
222
|
+
machineUpdates: string;
|
|
223
|
+
connectionRequired: string;
|
|
224
|
+
memory: string;
|
|
225
|
+
memoryAction: {
|
|
226
|
+
saved: string;
|
|
227
|
+
corrected: string;
|
|
228
|
+
updated: string;
|
|
229
|
+
archived: string;
|
|
230
|
+
};
|
|
231
|
+
fleetDecision: string;
|
|
232
|
+
fleetOutcome: {
|
|
233
|
+
selected: string;
|
|
234
|
+
waiting: string;
|
|
235
|
+
none: string;
|
|
236
|
+
};
|
|
237
|
+
fleetReason: {
|
|
238
|
+
leaseReused: string;
|
|
239
|
+
pin: string;
|
|
240
|
+
rotation: string;
|
|
241
|
+
active: string;
|
|
242
|
+
allCapped: string;
|
|
243
|
+
none: string;
|
|
244
|
+
};
|
|
245
|
+
turn: string;
|
|
246
|
+
activity: string;
|
|
247
|
+
statusQueued: string;
|
|
248
|
+
statusRunning: string;
|
|
249
|
+
statusComplete: string;
|
|
250
|
+
statusRecovering: string;
|
|
251
|
+
statusWaitingCapacity: string;
|
|
252
|
+
statusIdle: string;
|
|
253
|
+
statusRequiresAction: string;
|
|
254
|
+
statusFailed: string;
|
|
255
|
+
statusCancelled: string;
|
|
256
|
+
relativeNow: string;
|
|
257
|
+
relativeSeconds: string;
|
|
258
|
+
relativeMinutes: string;
|
|
259
|
+
relativeHours: string;
|
|
260
|
+
relativeDays: string;
|
|
261
|
+
};
|
|
262
|
+
export declare const DEFAULT_OPENGENI_NATIVE_THEME: OpenGeniNativeTheme;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SessionEvent } from "@opengeni/sdk";
|
|
2
|
+
/** The optional attention mutation a host client may expose (the SDK client does). */
|
|
3
|
+
export type SessionAttentionClientLike = {
|
|
4
|
+
updateSessionAttention?(workspaceId: string, sessionId: string, body: {
|
|
5
|
+
unread?: boolean;
|
|
6
|
+
acknowledgedThroughSequence?: number;
|
|
7
|
+
}): Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Where an open conversation should be acknowledged through, and whether it
|
|
11
|
+
* needs it: the server says unread, or newer attention events have arrived
|
|
12
|
+
* since the session row was read.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readAcknowledgementFrontier(session: {
|
|
15
|
+
unread?: boolean;
|
|
16
|
+
lastSequence?: number;
|
|
17
|
+
} | null, attentionThrough: number): {
|
|
18
|
+
readThrough: number;
|
|
19
|
+
unread: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Mark the open conversation read, as the web session page does: while it is on
|
|
23
|
+
* screen and the app is in the foreground, acknowledge through the latest
|
|
24
|
+
* delivered attention boundary (completed reply, question, failure), never per
|
|
25
|
+
* streaming flush. Reading a session does not acknowledge it on the server;
|
|
26
|
+
* without this, every reply stays unread and attention notifications (pushes,
|
|
27
|
+
* webhooks a host turns into alerts) fire even while the person watches it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useNativeReadAcknowledgement(input: {
|
|
30
|
+
client: SessionAttentionClientLike;
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
sessionId: string;
|
|
33
|
+
session: {
|
|
34
|
+
unread?: boolean;
|
|
35
|
+
lastSequence?: number;
|
|
36
|
+
} | null;
|
|
37
|
+
events: readonly SessionEvent[];
|
|
38
|
+
active: boolean;
|
|
39
|
+
}): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NativeCallEvent } from "./native-call.js";
|
|
2
|
+
/** A call event as the native module sends it. */
|
|
3
|
+
export type RawNativeCallEvent = {
|
|
4
|
+
type: string;
|
|
5
|
+
callId?: string;
|
|
6
|
+
muted?: boolean;
|
|
7
|
+
route?: string;
|
|
8
|
+
target?: string | null;
|
|
9
|
+
};
|
|
10
|
+
/** Map a raw native event onto the typed call event, dropping anything unknown. */
|
|
11
|
+
export declare function parseNativeCallEvent(raw: RawNativeCallEvent): NativeCallEvent | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NativeRealtimeCall } from "./native-call.js";
|
|
2
|
+
export type OpenGeniNativeCallLabels = {
|
|
3
|
+
connecting: string;
|
|
4
|
+
live: string;
|
|
5
|
+
reconnecting: string;
|
|
6
|
+
ending: string;
|
|
7
|
+
muted: string;
|
|
8
|
+
mute: string;
|
|
9
|
+
unmute: string;
|
|
10
|
+
speaker: string;
|
|
11
|
+
end: string;
|
|
12
|
+
minimize: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const DEFAULT_OPENGENI_NATIVE_CALL_LABELS: OpenGeniNativeCallLabels;
|
|
15
|
+
/**
|
|
16
|
+
* The full-screen call with an agent: the web's thinking orb, the call state,
|
|
17
|
+
* and mute, speaker and end controls. The host owns navigation (`onMinimize`
|
|
18
|
+
* returns to the conversation while the call continues) and safe areas.
|
|
19
|
+
*/
|
|
20
|
+
export declare function OpenGeniNativeCallView({ call, title, subtitle, onMinimize, labels: labelOverrides, }: {
|
|
21
|
+
call: NativeRealtimeCall;
|
|
22
|
+
title: string;
|
|
23
|
+
subtitle?: string | null | undefined;
|
|
24
|
+
onMinimize?: (() => void) | undefined;
|
|
25
|
+
labels?: Partial<OpenGeniNativeCallLabels> | undefined;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { parseNativeCallEvent } from "./call-events.js";
|
|
2
|
+
import type { NativeCallAdapter } from "./native-call.js";
|
|
3
|
+
export { parseNativeCallEvent };
|
|
4
|
+
/**
|
|
5
|
+
* CallKit for Expo hosts, from the native module this package ships (linked by
|
|
6
|
+
* Expo autolinking). Returns null where it is unavailable (Android, web, or a
|
|
7
|
+
* build without the module), so voice still works without a system call.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createExpoCallAdapter(options?: {
|
|
10
|
+
includeInRecents?: boolean;
|
|
11
|
+
}): NativeCallAdapter | null;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { SessionRealtimeControllerSnapshot } from "@opengeni/sdk/realtime";
|
|
2
|
+
import type { SessionRealtimeModel } from "@opengeni/sdk";
|
|
3
|
+
/** System events from the platform call service (CallKit on iOS). */
|
|
4
|
+
export type NativeCallEvent =
|
|
5
|
+
/** The person ended the call from the system UI, lock screen or headset. */
|
|
6
|
+
{
|
|
7
|
+
type: "ended";
|
|
8
|
+
callId: string;
|
|
9
|
+
}
|
|
10
|
+
/** The person muted or unmuted from the system UI. */
|
|
11
|
+
| {
|
|
12
|
+
type: "muteChanged";
|
|
13
|
+
callId: string;
|
|
14
|
+
muted: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** The audio route changed (speaker, receiver, AirPods, CarPlay). */
|
|
17
|
+
| {
|
|
18
|
+
type: "routeChanged";
|
|
19
|
+
route: NativeCallAudioRoute;
|
|
20
|
+
}
|
|
21
|
+
/** The system activated or released the call audio session (forwarded to WebRTC). */
|
|
22
|
+
| {
|
|
23
|
+
type: "audioSessionActivated";
|
|
24
|
+
} | {
|
|
25
|
+
type: "audioSessionDeactivated";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The system asked the app to start a call from outside it (Siri, the Phone
|
|
29
|
+
* app's recents, an App Intent or a shortcut). `target` is the host's own
|
|
30
|
+
* call target, for example a session id, or absent for the default.
|
|
31
|
+
*/
|
|
32
|
+
| {
|
|
33
|
+
type: "startRequested";
|
|
34
|
+
target: string | null;
|
|
35
|
+
};
|
|
36
|
+
export type NativeCallAudioRoute = "receiver" | "speaker" | "bluetooth" | "headphones" | "other";
|
|
37
|
+
/**
|
|
38
|
+
* The platform call service seam. The OpenGeni Expo module implements it with
|
|
39
|
+
* CallKit; hosts on other platforms can implement it or omit it, in which case
|
|
40
|
+
* the realtime session runs without a system call.
|
|
41
|
+
*/
|
|
42
|
+
export interface NativeCallAdapter {
|
|
43
|
+
/** Report an outgoing call to the system and activate the call audio session. */
|
|
44
|
+
startCall(call: {
|
|
45
|
+
callId: string;
|
|
46
|
+
title: string;
|
|
47
|
+
target: string | null;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/** The voice connection is live: the system call shows as connected. */
|
|
50
|
+
reportConnected(callId: string): void;
|
|
51
|
+
/** End the system call. `failed` reports a failure rather than a normal hang-up. */
|
|
52
|
+
endCall(callId: string, reason?: "ended" | "failed"): Promise<void>;
|
|
53
|
+
setMuted(callId: string, muted: boolean): Promise<void>;
|
|
54
|
+
/** Route call audio to the loudspeaker, or back to the default route. */
|
|
55
|
+
setSpeaker(on: boolean): Promise<void>;
|
|
56
|
+
subscribe(listener: (event: NativeCallEvent) => void): () => void;
|
|
57
|
+
/** A start request that launched the app before JavaScript subscribed. */
|
|
58
|
+
takePendingStartRequest(): Promise<{
|
|
59
|
+
target: string | null;
|
|
60
|
+
} | null>;
|
|
61
|
+
}
|
|
62
|
+
/** Native hosts can stream voice over WebRTC; WebSocket audio transports need a browser. */
|
|
63
|
+
export declare function nativeRealtimeModelSupported(model: SessionRealtimeModel): boolean;
|
|
64
|
+
/** The slice of `useSessionRealtime` a call drives. */
|
|
65
|
+
export type NativeCallRealtime = {
|
|
66
|
+
snapshot: SessionRealtimeControllerSnapshot;
|
|
67
|
+
canStart: boolean;
|
|
68
|
+
admissionBlocker: string | null;
|
|
69
|
+
start(): Promise<void>;
|
|
70
|
+
stop(): Promise<void>;
|
|
71
|
+
setInputMuted(muted: boolean): void;
|
|
72
|
+
};
|
|
73
|
+
export type NativeCallPhase = "idle" | "connecting" | "active" | "reconnecting" | "ending";
|
|
74
|
+
export type NativeRealtimeCall = {
|
|
75
|
+
phase: NativeCallPhase;
|
|
76
|
+
muted: boolean;
|
|
77
|
+
speaker: boolean;
|
|
78
|
+
route: NativeCallAudioRoute | null;
|
|
79
|
+
error: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the system shows this call (CallKit). False when the platform has
|
|
82
|
+
* no call service or refused the call; voice then runs as an in-app call.
|
|
83
|
+
*/
|
|
84
|
+
systemCall: boolean;
|
|
85
|
+
canStart: boolean;
|
|
86
|
+
start(): Promise<void>;
|
|
87
|
+
end(): Promise<void>;
|
|
88
|
+
setMuted(muted: boolean): void;
|
|
89
|
+
setSpeaker(on: boolean): void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Keep one system call and one shared realtime session in lockstep: starting
|
|
93
|
+
* reports an outgoing call and starts voice; the call shows connected once
|
|
94
|
+
* voice is live; hanging up anywhere (app, lock screen, headset) stops voice,
|
|
95
|
+
* and voice ending or failing ends the call. Mute is mirrored both ways.
|
|
96
|
+
* If the system refuses the call (no call service, a region without CallKit,
|
|
97
|
+
* the simulator), voice still starts as an in-app call.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useNativeRealtimeCall(options: {
|
|
100
|
+
realtime: NativeCallRealtime;
|
|
101
|
+
call?: NativeCallAdapter | null | undefined;
|
|
102
|
+
title: string;
|
|
103
|
+
target?: string | null | undefined;
|
|
104
|
+
}): NativeRealtimeCall;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type SessionRealtimeOwnerStorage } from "@opengeni/sdk/realtime";
|
|
2
|
+
import type { SessionRealtimeControllerFactory } from "@opengeni/react/session-realtime";
|
|
3
|
+
/**
|
|
4
|
+
* The WebRTC entry points a native host supplies, in the shape of
|
|
5
|
+
* `react-native-webrtc`. Everything else (negotiation, the realtime ledger,
|
|
6
|
+
* delegation, recovery and lifecycle) stays in the shared SDK controller that
|
|
7
|
+
* the web uses.
|
|
8
|
+
*/
|
|
9
|
+
export interface NativeWebRtcAdapter {
|
|
10
|
+
createPeerConnection(): RTCPeerConnection;
|
|
11
|
+
getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
|
|
12
|
+
}
|
|
13
|
+
export type NativeRealtimeControllerFactoryOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Owner-proof storage. Defaults to process memory, which matches the web's
|
|
16
|
+
* tab-scoped session storage: a relaunched app recovers through the server
|
|
17
|
+
* lifecycle rather than a stale local proof.
|
|
18
|
+
*/
|
|
19
|
+
storage?: SessionRealtimeOwnerStorage | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** Process-lifetime owner storage, the native counterpart of `sessionStorage`. */
|
|
22
|
+
export declare function createMemoryRealtimeOwnerStorage(): SessionRealtimeOwnerStorage;
|
|
23
|
+
/**
|
|
24
|
+
* Native WebRTC plays remote audio itself, through the call audio session. The
|
|
25
|
+
* SDK still drives an audio element (attach, mute, play, detach), so this
|
|
26
|
+
* stand-in maps those calls onto the remote audio tracks: muting disables the
|
|
27
|
+
* tracks, and play resolves because playback is already live.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createNativeRemoteAudio(): HTMLAudioElement;
|
|
30
|
+
/**
|
|
31
|
+
* Controller factory for `useSessionRealtime({ controllerFactory })`: the
|
|
32
|
+
* shared SDK controller with native WebRTC, a native remote-audio stand-in and
|
|
33
|
+
* owner storage injected. No realtime logic is forked.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createNativeRealtimeControllerFactory(webrtc: NativeWebRtcAdapter, options?: NativeRealtimeControllerFactoryOptions): SessionRealtimeControllerFactory;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useSessionRealtime } from "@opengeni/react/session-realtime";
|
|
2
|
+
import { type NativeRealtimeControllerFactoryOptions, type NativeWebRtcAdapter } from "./native-realtime.js";
|
|
3
|
+
export type UseNativeSessionRealtimeOptions = Omit<Parameters<typeof useSessionRealtime>[0], "controllerFactory"> & {
|
|
4
|
+
/** Native WebRTC, for example `createReactNativeWebRtcAdapter()` from `./webrtc`. */
|
|
5
|
+
webrtc: NativeWebRtcAdapter;
|
|
6
|
+
storage?: NativeRealtimeControllerFactoryOptions["storage"];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The web's `useSessionRealtime`, driven by native WebRTC. Same controller,
|
|
10
|
+
* same admission rules, same lifecycle recovery; only media is injected.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useNativeSessionRealtime(options: UseNativeSessionRealtimeOptions): {
|
|
13
|
+
snapshot: import("@opengeni/sdk").CodexRealtimeControllerSnapshot;
|
|
14
|
+
lifecycleActive: boolean;
|
|
15
|
+
canStart: boolean;
|
|
16
|
+
admissionBlocker: string | null;
|
|
17
|
+
codexConnected: boolean;
|
|
18
|
+
audioRef: import("react").RefObject<HTMLAudioElement | null>;
|
|
19
|
+
start: () => Promise<void>;
|
|
20
|
+
stop: () => Promise<void>;
|
|
21
|
+
retry: () => Promise<void>;
|
|
22
|
+
retryAudibleOutput: () => Promise<void>;
|
|
23
|
+
setInputMuted: (muted: boolean) => void;
|
|
24
|
+
setOutputMuted: (muted: boolean) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import type { ActivityItem, TimelineGroup, ToolCallItem } from "@opengeni/react/session";
|
|
4
|
+
import type { OpenGeniNativeSessionController } from "./use-native-session.js";
|
|
5
|
+
import type { NativeFileAttachmentsResult } from "./attachments.js";
|
|
6
|
+
import { type OpenGeniNativeLabels, type OpenGeniNativeTheme } from "./presentation.js";
|
|
7
|
+
export type NativeToolRenderer = (item: ToolCallItem, context: {
|
|
8
|
+
theme: OpenGeniNativeTheme;
|
|
9
|
+
labels: OpenGeniNativeLabels;
|
|
10
|
+
compact: boolean;
|
|
11
|
+
}) => ReactNode;
|
|
12
|
+
export type NativeMessageRenderer = (text: string, role: "user" | "assistant" | "reasoning", context: {
|
|
13
|
+
theme: OpenGeniNativeTheme;
|
|
14
|
+
}) => ReactNode;
|
|
15
|
+
export interface NativeTurnSummaryContext {
|
|
16
|
+
items: readonly ActivityItem[];
|
|
17
|
+
toolCalls: readonly ToolCallItem[];
|
|
18
|
+
outcome: Extract<TimelineGroup, {
|
|
19
|
+
kind: "turn";
|
|
20
|
+
}>["outcome"];
|
|
21
|
+
failureText: string | undefined;
|
|
22
|
+
durationMs: number | undefined;
|
|
23
|
+
settled: boolean;
|
|
24
|
+
contextCompactionCount: number;
|
|
25
|
+
}
|
|
26
|
+
export interface NativeTurnSummaryResult {
|
|
27
|
+
content: string;
|
|
28
|
+
accessibilityLabel?: string | undefined;
|
|
29
|
+
duration?: string | null;
|
|
30
|
+
}
|
|
31
|
+
export type NativeTurnSummaryRenderer = (context: NativeTurnSummaryContext) => NativeTurnSummaryResult | null;
|
|
32
|
+
export interface NativeComposerActionContext {
|
|
33
|
+
accessory?: ReactNode | undefined;
|
|
34
|
+
labels: OpenGeniNativeLabels;
|
|
35
|
+
theme: OpenGeniNativeTheme;
|
|
36
|
+
busy: boolean;
|
|
37
|
+
paused: boolean;
|
|
38
|
+
runActive: boolean;
|
|
39
|
+
canSubmit: boolean;
|
|
40
|
+
draftSaving: boolean;
|
|
41
|
+
submitLabel: string;
|
|
42
|
+
onAttachDocument(): void;
|
|
43
|
+
onAttachImage(): void;
|
|
44
|
+
onTogglePause(): void;
|
|
45
|
+
onSubmit(): void;
|
|
46
|
+
}
|
|
47
|
+
export type NativeComposerActionRenderer = (context: NativeComposerActionContext) => ReactNode;
|
|
48
|
+
export interface NativeComposerRenderContext extends NativeComposerActionContext {
|
|
49
|
+
value: string;
|
|
50
|
+
onChangeText: (text: string) => void;
|
|
51
|
+
placeholder: string;
|
|
52
|
+
}
|
|
53
|
+
export type NativeComposerRenderer = (context: NativeComposerRenderContext) => ReactNode;
|
|
54
|
+
export interface NativeComposerSurfaceContext {
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
style: StyleProp<ViewStyle>;
|
|
57
|
+
}
|
|
58
|
+
export type NativeComposerSurfaceRenderer = (context: NativeComposerSurfaceContext) => ReactNode;
|
|
59
|
+
export interface OpenGeniNativeSessionViewProps {
|
|
60
|
+
controller: OpenGeniNativeSessionController;
|
|
61
|
+
theme?: OpenGeniNativeTheme | undefined;
|
|
62
|
+
labels?: Partial<OpenGeniNativeLabels> | undefined;
|
|
63
|
+
header?: ReactNode | undefined;
|
|
64
|
+
composerAccessory?: ReactNode | undefined;
|
|
65
|
+
composerSafeAreaInsets?: {
|
|
66
|
+
bottom: number;
|
|
67
|
+
left: number;
|
|
68
|
+
right: number;
|
|
69
|
+
};
|
|
70
|
+
renderComposer?: NativeComposerRenderer | undefined;
|
|
71
|
+
renderComposerActions?: NativeComposerActionRenderer | undefined;
|
|
72
|
+
renderComposerSurface?: NativeComposerSurfaceRenderer | undefined;
|
|
73
|
+
renderTool?: NativeToolRenderer | undefined;
|
|
74
|
+
renderMessage?: NativeMessageRenderer | undefined;
|
|
75
|
+
summarizeTurn?: NativeTurnSummaryRenderer | undefined;
|
|
76
|
+
formatError?: ((error: Error) => string) | undefined;
|
|
77
|
+
keyboardVerticalOffset?: number | undefined;
|
|
78
|
+
testID?: string | undefined;
|
|
79
|
+
}
|
|
80
|
+
export declare function OpenGeniNativeSessionView({ controller, theme, labels: labelOverrides, header, composerAccessory, composerSafeAreaInsets, renderComposer, renderComposerActions, renderComposerSurface, renderTool, renderMessage, summarizeTurn, formatError, keyboardVerticalOffset, testID, }: OpenGeniNativeSessionViewProps): import("react").JSX.Element;
|
|
81
|
+
export declare function OpenGeniNativeAttachmentStrip({ attachments, labels, onRemoveRestoredResource, restoredResources, theme, }: {
|
|
82
|
+
attachments: NativeFileAttachmentsResult;
|
|
83
|
+
labels: OpenGeniNativeLabels;
|
|
84
|
+
onRemoveRestoredResource?: ((index: number) => void) | undefined;
|
|
85
|
+
restoredResources?: readonly unknown[] | undefined;
|
|
86
|
+
theme: OpenGeniNativeTheme;
|
|
87
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ActivityItem, ToolCallItem } from "@opengeni/react/session";
|
|
2
|
+
import { type ToolRowPresentation } from "@opengeni/react/timeline-model";
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
export type NativeToolRendererProps = {
|
|
5
|
+
item: ToolCallItem;
|
|
6
|
+
presentation: ToolRowPresentation;
|
|
7
|
+
compact: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Return null to fall back to the shared row. */
|
|
10
|
+
export type NativeToolRenderer = (props: NativeToolRendererProps) => ReactNode | null;
|
|
11
|
+
export interface NativeActivityOptions {
|
|
12
|
+
/** Per-tool overrides keyed by exact tool name or MCP leaf. */
|
|
13
|
+
toolRenderers?: Record<string, NativeToolRenderer> | undefined;
|
|
14
|
+
/** Host renderer consulted for every tool call (return null for the shared row). */
|
|
15
|
+
renderTool?: NativeToolRenderer | undefined;
|
|
16
|
+
/** Active compute label for exec previews ("on <label> · …"). */
|
|
17
|
+
computeLabel?: string | null | undefined;
|
|
18
|
+
renderMarkdown?: ((text: string, options: {
|
|
19
|
+
tone: "body" | "muted";
|
|
20
|
+
streaming?: boolean;
|
|
21
|
+
}) => ReactNode) | undefined;
|
|
22
|
+
onOpenSession?: ((sessionId: string) => void) | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare const NativeActivityOptionsProvider: import("react").Provider<NativeActivityOptions>;
|
|
25
|
+
export declare function useNativeActivityOptions(): NativeActivityOptions;
|
|
26
|
+
export declare function PresentedToolRow({ presentation: p, compact, }: {
|
|
27
|
+
presentation: ToolRowPresentation;
|
|
28
|
+
compact?: boolean;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
/** Renders one activity item — the native `renderActivity`. */
|
|
31
|
+
export declare function ActivityRow({ item, compact }: {
|
|
32
|
+
item: ActivityItem;
|
|
33
|
+
compact?: boolean;
|
|
34
|
+
}): import("react").JSX.Element | null;
|