yaver-feedback-react-native 0.5.2 → 0.5.4
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/README.md +8 -0
- package/dist/AuthOverlay.d.ts +16 -0
- package/dist/AuthOverlay.js +104 -0
- package/dist/BlackBox.d.ts +154 -0
- package/dist/BlackBox.js +395 -0
- package/dist/ConnectionScreen.d.ts +13 -0
- package/dist/ConnectionScreen.js +373 -0
- package/dist/Discovery.d.ts +59 -0
- package/dist/Discovery.js +293 -0
- package/dist/FeedbackModal.d.ts +11 -0
- package/dist/FeedbackModal.js +623 -0
- package/dist/FixReport.d.ts +23 -0
- package/dist/FixReport.js +282 -0
- package/dist/FloatingButton.d.ts +71 -0
- package/dist/FloatingButton.js +778 -0
- package/dist/LoginScreen.d.ts +14 -0
- package/dist/LoginScreen.js +317 -0
- package/dist/MachinePickerScreen.d.ts +19 -0
- package/dist/MachinePickerScreen.js +175 -0
- package/dist/P2PClient.d.ts +136 -0
- package/dist/P2PClient.js +357 -0
- package/dist/ShakeDetector.d.ts +39 -0
- package/dist/ShakeDetector.js +111 -0
- package/dist/YaverFeedback.d.ts +198 -0
- package/dist/YaverFeedback.js +679 -0
- package/dist/YaverUpdates.d.ts +78 -0
- package/dist/YaverUpdates.js +272 -0
- package/dist/__tests__/Discovery.test.d.ts +1 -0
- package/dist/__tests__/Discovery.test.js +164 -0
- package/dist/__tests__/P2PClient.test.d.ts +1 -0
- package/dist/__tests__/P2PClient.test.js +169 -0
- package/dist/__tests__/SDKToken.test.d.ts +1 -0
- package/dist/__tests__/SDKToken.test.js +215 -0
- package/dist/__tests__/YaverFeedback.test.d.ts +1 -0
- package/dist/__tests__/YaverFeedback.test.js +161 -0
- package/dist/__tests__/types.test.d.ts +1 -0
- package/dist/__tests__/types.test.js +219 -0
- package/dist/auth.d.ts +105 -0
- package/dist/auth.js +282 -0
- package/dist/capture.d.ts +27 -0
- package/dist/capture.js +74 -0
- package/dist/expo.d.ts +15 -0
- package/dist/expo.js +62 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +80 -0
- package/dist/types.d.ts +282 -0
- package/dist/types.js +2 -0
- package/dist/upload.d.ts +13 -0
- package/dist/upload.js +59 -0
- package/package.json +10 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Full-screen connection UI for discovering and connecting to a Yaver agent.
|
|
4
|
+
*
|
|
5
|
+
* Shows connection status, auto-discovery, manual URL entry, and a
|
|
6
|
+
* Start/Stop testing toggle with recording timer.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* {__DEV__ && <YaverConnectionScreen />}
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare const YaverConnectionScreen: React.FC;
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.YaverConnectionScreen = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const Discovery_1 = require("./Discovery");
|
|
40
|
+
const YaverFeedback_1 = require("./YaverFeedback");
|
|
41
|
+
/**
|
|
42
|
+
* Full-screen connection UI for discovering and connecting to a Yaver agent.
|
|
43
|
+
*
|
|
44
|
+
* Shows connection status, auto-discovery, manual URL entry, and a
|
|
45
|
+
* Start/Stop testing toggle with recording timer.
|
|
46
|
+
*
|
|
47
|
+
* Usage:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* {__DEV__ && <YaverConnectionScreen />}
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
const YaverConnectionScreen = () => {
|
|
53
|
+
const [url, setUrl] = (0, react_1.useState)('');
|
|
54
|
+
const [token, setToken] = (0, react_1.useState)('');
|
|
55
|
+
const [connected, setConnected] = (0, react_1.useState)(false);
|
|
56
|
+
const [hostname, setHostname] = (0, react_1.useState)('');
|
|
57
|
+
const [version, setVersion] = (0, react_1.useState)('');
|
|
58
|
+
const [latency, setLatency] = (0, react_1.useState)(null);
|
|
59
|
+
const [discovering, setDiscovering] = (0, react_1.useState)(false);
|
|
60
|
+
const [connecting, setConnecting] = (0, react_1.useState)(false);
|
|
61
|
+
const [recording, setRecording] = (0, react_1.useState)(false);
|
|
62
|
+
const [recordingTime, setRecordingTime] = (0, react_1.useState)(0);
|
|
63
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
64
|
+
const timerRef = (0, react_1.useRef)(null);
|
|
65
|
+
// Auto-discover on mount
|
|
66
|
+
(0, react_1.useEffect)(() => {
|
|
67
|
+
handleDiscover();
|
|
68
|
+
return () => {
|
|
69
|
+
if (timerRef.current) {
|
|
70
|
+
clearInterval(timerRef.current);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}, []);
|
|
74
|
+
// Recording timer
|
|
75
|
+
(0, react_1.useEffect)(() => {
|
|
76
|
+
if (recording) {
|
|
77
|
+
setRecordingTime(0);
|
|
78
|
+
timerRef.current = setInterval(() => {
|
|
79
|
+
setRecordingTime((prev) => prev + 1);
|
|
80
|
+
}, 1000);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (timerRef.current) {
|
|
84
|
+
clearInterval(timerRef.current);
|
|
85
|
+
timerRef.current = null;
|
|
86
|
+
}
|
|
87
|
+
setRecordingTime(0);
|
|
88
|
+
}
|
|
89
|
+
}, [recording]);
|
|
90
|
+
const applyResult = (result) => {
|
|
91
|
+
setUrl(result.url);
|
|
92
|
+
setHostname(result.hostname);
|
|
93
|
+
setVersion(result.version);
|
|
94
|
+
setLatency(result.latency);
|
|
95
|
+
setConnected(true);
|
|
96
|
+
setError(null);
|
|
97
|
+
// Update YaverFeedback config if initialized
|
|
98
|
+
const config = YaverFeedback_1.YaverFeedback.getConfig();
|
|
99
|
+
if (config) {
|
|
100
|
+
YaverFeedback_1.YaverFeedback.init({ ...config, agentUrl: result.url });
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const handleDiscover = async () => {
|
|
104
|
+
setDiscovering(true);
|
|
105
|
+
setError(null);
|
|
106
|
+
try {
|
|
107
|
+
const result = await Discovery_1.YaverDiscovery.discover();
|
|
108
|
+
if (result) {
|
|
109
|
+
applyResult(result);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
setConnected(false);
|
|
113
|
+
setError('No agent found on the local network.');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
setConnected(false);
|
|
118
|
+
setError(`Discovery failed: ${String(err)}`);
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
setDiscovering(false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const handleConnect = async () => {
|
|
125
|
+
if (!url.trim()) {
|
|
126
|
+
setError('Enter an agent URL.');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
setConnecting(true);
|
|
130
|
+
setError(null);
|
|
131
|
+
try {
|
|
132
|
+
const result = await Discovery_1.YaverDiscovery.connect(url.trim());
|
|
133
|
+
if (result) {
|
|
134
|
+
applyResult(result);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
setConnected(false);
|
|
138
|
+
setError('Could not connect to agent at that URL.');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
setConnected(false);
|
|
143
|
+
setError(`Connection failed: ${String(err)}`);
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
setConnecting(false);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const handleToggleRecording = () => {
|
|
150
|
+
if (!connected) {
|
|
151
|
+
setError('Connect to an agent first.');
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (recording) {
|
|
155
|
+
// Stop & send
|
|
156
|
+
setRecording(false);
|
|
157
|
+
YaverFeedback_1.YaverFeedback.startReport();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Start testing
|
|
161
|
+
setRecording(true);
|
|
162
|
+
// Initialize SDK with current URL/token if not already done
|
|
163
|
+
if (!YaverFeedback_1.YaverFeedback.isInitialized()) {
|
|
164
|
+
YaverFeedback_1.YaverFeedback.init({
|
|
165
|
+
agentUrl: url,
|
|
166
|
+
authToken: token,
|
|
167
|
+
trigger: 'manual',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const formatTime = (seconds) => {
|
|
173
|
+
const mins = Math.floor(seconds / 60);
|
|
174
|
+
const secs = seconds % 60;
|
|
175
|
+
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
|
|
176
|
+
};
|
|
177
|
+
return (<react_native_1.SafeAreaView style={styles.container}>
|
|
178
|
+
<react_native_1.ScrollView contentContainerStyle={styles.content} keyboardShouldPersistTaps="handled">
|
|
179
|
+
{/* Header */}
|
|
180
|
+
<react_native_1.Text style={styles.title}>Yaver Agent</react_native_1.Text>
|
|
181
|
+
|
|
182
|
+
{/* Connection status */}
|
|
183
|
+
<react_native_1.View style={styles.statusRow}>
|
|
184
|
+
<react_native_1.View style={[styles.statusDot, connected ? styles.statusConnected : styles.statusDisconnected]}/>
|
|
185
|
+
<react_native_1.Text style={styles.statusText}>
|
|
186
|
+
{connected
|
|
187
|
+
? `Connected to ${hostname}`
|
|
188
|
+
: 'Not connected'}
|
|
189
|
+
</react_native_1.Text>
|
|
190
|
+
</react_native_1.View>
|
|
191
|
+
|
|
192
|
+
{connected && (<react_native_1.View style={styles.infoRow}>
|
|
193
|
+
<react_native_1.Text style={styles.infoText}>v{version}</react_native_1.Text>
|
|
194
|
+
{latency !== null && (<react_native_1.Text style={styles.infoText}>{latency}ms</react_native_1.Text>)}
|
|
195
|
+
</react_native_1.View>)}
|
|
196
|
+
|
|
197
|
+
{/* URL input */}
|
|
198
|
+
<react_native_1.Text style={styles.label}>Agent URL</react_native_1.Text>
|
|
199
|
+
<react_native_1.TextInput style={styles.input} value={url} onChangeText={setUrl} placeholder="http://192.168.1.10:18080" placeholderTextColor="#666" autoCapitalize="none" autoCorrect={false} keyboardType="url"/>
|
|
200
|
+
|
|
201
|
+
{/* Token input */}
|
|
202
|
+
<react_native_1.Text style={styles.label}>Auth Token</react_native_1.Text>
|
|
203
|
+
<react_native_1.TextInput style={styles.input} value={token} onChangeText={setToken} placeholder="your-auth-token" placeholderTextColor="#666" autoCapitalize="none" autoCorrect={false} secureTextEntry/>
|
|
204
|
+
|
|
205
|
+
{/* Action buttons */}
|
|
206
|
+
<react_native_1.View style={styles.buttonRow}>
|
|
207
|
+
<react_native_1.TouchableOpacity style={[styles.button, styles.discoverButton]} onPress={handleDiscover} disabled={discovering}>
|
|
208
|
+
{discovering ? (<react_native_1.ActivityIndicator color="#e0e0e0" size="small"/>) : (<react_native_1.Text style={styles.buttonText}>Auto-discover</react_native_1.Text>)}
|
|
209
|
+
</react_native_1.TouchableOpacity>
|
|
210
|
+
|
|
211
|
+
<react_native_1.TouchableOpacity style={[styles.button, styles.connectButton]} onPress={handleConnect} disabled={connecting}>
|
|
212
|
+
{connecting ? (<react_native_1.ActivityIndicator color="#fff" size="small"/>) : (<react_native_1.Text style={styles.buttonText}>Connect</react_native_1.Text>)}
|
|
213
|
+
</react_native_1.TouchableOpacity>
|
|
214
|
+
</react_native_1.View>
|
|
215
|
+
|
|
216
|
+
{/* Error */}
|
|
217
|
+
{error && <react_native_1.Text style={styles.error}>{error}</react_native_1.Text>}
|
|
218
|
+
|
|
219
|
+
{/* Recording indicator */}
|
|
220
|
+
{recording && (<react_native_1.View style={styles.recordingIndicator}>
|
|
221
|
+
<react_native_1.View style={styles.recordingDot}/>
|
|
222
|
+
<react_native_1.Text style={styles.recordingText}>
|
|
223
|
+
Recording {formatTime(recordingTime)}
|
|
224
|
+
</react_native_1.Text>
|
|
225
|
+
</react_native_1.View>)}
|
|
226
|
+
|
|
227
|
+
{/* Start/Stop toggle */}
|
|
228
|
+
<react_native_1.TouchableOpacity style={[
|
|
229
|
+
styles.toggleButton,
|
|
230
|
+
recording ? styles.toggleStop : styles.toggleStart,
|
|
231
|
+
!connected && styles.toggleDisabled,
|
|
232
|
+
]} onPress={handleToggleRecording} disabled={!connected}>
|
|
233
|
+
<react_native_1.Text style={styles.toggleText}>
|
|
234
|
+
{recording ? 'Stop & Send' : 'Start Testing'}
|
|
235
|
+
</react_native_1.Text>
|
|
236
|
+
</react_native_1.TouchableOpacity>
|
|
237
|
+
</react_native_1.ScrollView>
|
|
238
|
+
</react_native_1.SafeAreaView>);
|
|
239
|
+
};
|
|
240
|
+
exports.YaverConnectionScreen = YaverConnectionScreen;
|
|
241
|
+
const styles = react_native_1.StyleSheet.create({
|
|
242
|
+
container: {
|
|
243
|
+
flex: 1,
|
|
244
|
+
backgroundColor: '#1a1a2e',
|
|
245
|
+
},
|
|
246
|
+
content: {
|
|
247
|
+
padding: 24,
|
|
248
|
+
paddingTop: 16,
|
|
249
|
+
},
|
|
250
|
+
title: {
|
|
251
|
+
fontSize: 24,
|
|
252
|
+
fontWeight: '700',
|
|
253
|
+
color: '#e0e0e0',
|
|
254
|
+
marginBottom: 20,
|
|
255
|
+
},
|
|
256
|
+
statusRow: {
|
|
257
|
+
flexDirection: 'row',
|
|
258
|
+
alignItems: 'center',
|
|
259
|
+
marginBottom: 8,
|
|
260
|
+
},
|
|
261
|
+
statusDot: {
|
|
262
|
+
width: 10,
|
|
263
|
+
height: 10,
|
|
264
|
+
borderRadius: 5,
|
|
265
|
+
marginRight: 10,
|
|
266
|
+
},
|
|
267
|
+
statusConnected: {
|
|
268
|
+
backgroundColor: '#22c55e',
|
|
269
|
+
},
|
|
270
|
+
statusDisconnected: {
|
|
271
|
+
backgroundColor: '#ef4444',
|
|
272
|
+
},
|
|
273
|
+
statusText: {
|
|
274
|
+
color: '#e0e0e0',
|
|
275
|
+
fontSize: 15,
|
|
276
|
+
},
|
|
277
|
+
infoRow: {
|
|
278
|
+
flexDirection: 'row',
|
|
279
|
+
gap: 16,
|
|
280
|
+
marginBottom: 20,
|
|
281
|
+
paddingLeft: 20,
|
|
282
|
+
},
|
|
283
|
+
infoText: {
|
|
284
|
+
color: '#888',
|
|
285
|
+
fontSize: 13,
|
|
286
|
+
},
|
|
287
|
+
label: {
|
|
288
|
+
color: '#999',
|
|
289
|
+
fontSize: 13,
|
|
290
|
+
marginBottom: 6,
|
|
291
|
+
marginTop: 12,
|
|
292
|
+
},
|
|
293
|
+
input: {
|
|
294
|
+
backgroundColor: 'rgba(255,255,255,0.08)',
|
|
295
|
+
borderWidth: 1,
|
|
296
|
+
borderColor: 'rgba(255,255,255,0.15)',
|
|
297
|
+
borderRadius: 10,
|
|
298
|
+
paddingHorizontal: 14,
|
|
299
|
+
paddingVertical: 12,
|
|
300
|
+
color: '#e0e0e0',
|
|
301
|
+
fontSize: 15,
|
|
302
|
+
},
|
|
303
|
+
buttonRow: {
|
|
304
|
+
flexDirection: 'row',
|
|
305
|
+
gap: 12,
|
|
306
|
+
marginTop: 20,
|
|
307
|
+
},
|
|
308
|
+
button: {
|
|
309
|
+
flex: 1,
|
|
310
|
+
paddingVertical: 14,
|
|
311
|
+
borderRadius: 10,
|
|
312
|
+
alignItems: 'center',
|
|
313
|
+
justifyContent: 'center',
|
|
314
|
+
minHeight: 48,
|
|
315
|
+
},
|
|
316
|
+
discoverButton: {
|
|
317
|
+
backgroundColor: 'rgba(99,102,241,0.2)',
|
|
318
|
+
borderWidth: 1,
|
|
319
|
+
borderColor: 'rgba(99,102,241,0.4)',
|
|
320
|
+
},
|
|
321
|
+
connectButton: {
|
|
322
|
+
backgroundColor: '#6366f1',
|
|
323
|
+
},
|
|
324
|
+
buttonText: {
|
|
325
|
+
color: '#e0e0e0',
|
|
326
|
+
fontSize: 15,
|
|
327
|
+
fontWeight: '600',
|
|
328
|
+
},
|
|
329
|
+
error: {
|
|
330
|
+
color: '#ef4444',
|
|
331
|
+
fontSize: 13,
|
|
332
|
+
marginTop: 12,
|
|
333
|
+
},
|
|
334
|
+
recordingIndicator: {
|
|
335
|
+
flexDirection: 'row',
|
|
336
|
+
alignItems: 'center',
|
|
337
|
+
justifyContent: 'center',
|
|
338
|
+
marginTop: 24,
|
|
339
|
+
},
|
|
340
|
+
recordingDot: {
|
|
341
|
+
width: 10,
|
|
342
|
+
height: 10,
|
|
343
|
+
borderRadius: 5,
|
|
344
|
+
backgroundColor: '#ef4444',
|
|
345
|
+
marginRight: 8,
|
|
346
|
+
},
|
|
347
|
+
recordingText: {
|
|
348
|
+
color: '#ef4444',
|
|
349
|
+
fontSize: 16,
|
|
350
|
+
fontWeight: '600',
|
|
351
|
+
fontVariant: ['tabular-nums'],
|
|
352
|
+
},
|
|
353
|
+
toggleButton: {
|
|
354
|
+
marginTop: 24,
|
|
355
|
+
paddingVertical: 18,
|
|
356
|
+
borderRadius: 14,
|
|
357
|
+
alignItems: 'center',
|
|
358
|
+
},
|
|
359
|
+
toggleStart: {
|
|
360
|
+
backgroundColor: '#22c55e',
|
|
361
|
+
},
|
|
362
|
+
toggleStop: {
|
|
363
|
+
backgroundColor: '#ef4444',
|
|
364
|
+
},
|
|
365
|
+
toggleDisabled: {
|
|
366
|
+
opacity: 0.4,
|
|
367
|
+
},
|
|
368
|
+
toggleText: {
|
|
369
|
+
color: '#fff',
|
|
370
|
+
fontSize: 18,
|
|
371
|
+
fontWeight: '700',
|
|
372
|
+
},
|
|
373
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface DiscoveryResult {
|
|
2
|
+
url: string;
|
|
3
|
+
hostname: string;
|
|
4
|
+
version: string;
|
|
5
|
+
latency: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Device discovery for finding Yaver agents on the local network or via Convex.
|
|
9
|
+
*
|
|
10
|
+
* Three discovery strategies (tried in order):
|
|
11
|
+
* 1. **Convex cloud** — fetch agent IP from Convex `/devices/list` (for cloud machines)
|
|
12
|
+
* 2. **Stored connection** — try cached URL from last successful connection
|
|
13
|
+
* 3. **LAN scan** — probe common LAN IPs via `/health` endpoint
|
|
14
|
+
*/
|
|
15
|
+
export declare class YaverDiscovery {
|
|
16
|
+
/**
|
|
17
|
+
* Discover an agent. Tries Convex cloud first (if configured),
|
|
18
|
+
* then stored connection, then LAN scan.
|
|
19
|
+
*/
|
|
20
|
+
static discover(options?: {
|
|
21
|
+
convexUrl?: string;
|
|
22
|
+
authToken?: string;
|
|
23
|
+
preferredDeviceId?: string;
|
|
24
|
+
}): Promise<DiscoveryResult | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch the agent URL from Convex device list or cloud machines.
|
|
27
|
+
* No hardcoded IPs needed — Convex knows where the agent is.
|
|
28
|
+
*/
|
|
29
|
+
static discoverFromConvex(convexUrl: string, authToken: string, preferredDeviceId?: string): Promise<DiscoveryResult | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Discover agent via relay HTTP proxy.
|
|
32
|
+
* Fetches relay server list from Convex platformConfig, then probes
|
|
33
|
+
* `{relayHttpUrl}/d/{deviceId}/health` to reach the agent over the internet.
|
|
34
|
+
*/
|
|
35
|
+
static discoverViaRelay(convexUrl: string, authToken: string, deviceId: string): Promise<DiscoveryResult | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Probe with extra headers (e.g. relay password).
|
|
38
|
+
*/
|
|
39
|
+
static probeWithHeaders(url: string, headers: Record<string, string>): Promise<DiscoveryResult | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Probe a specific URL for a running Yaver agent.
|
|
42
|
+
* Hits the `/health` endpoint with a 2s timeout.
|
|
43
|
+
*/
|
|
44
|
+
static probe(url: string): Promise<DiscoveryResult | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Manually connect to a specific agent URL.
|
|
47
|
+
* Probes the URL and stores the connection if successful.
|
|
48
|
+
*/
|
|
49
|
+
static connect(url: string): Promise<DiscoveryResult | null>;
|
|
50
|
+
/** Get the cached agent connection from storage. */
|
|
51
|
+
static getStored(): Promise<{
|
|
52
|
+
url: string;
|
|
53
|
+
hostname: string;
|
|
54
|
+
} | null>;
|
|
55
|
+
/** Store a successful discovery result. */
|
|
56
|
+
static store(result: DiscoveryResult): Promise<void>;
|
|
57
|
+
/** Clear the stored agent connection. */
|
|
58
|
+
static clear(): Promise<void>;
|
|
59
|
+
}
|