yaver-feedback-react-native 0.8.11 → 0.8.13

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.
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ // VibeChatScreen — the converged chat UI for the standalone feedback
3
+ // SDK. Mirrors Yaver mobile's Tasks tab + the in-Yaver native pane:
4
+ //
5
+ // 1. User sees a live SSE transcript of agent stdout (PhaseStatusLine
6
+ // style "searching… / compiling…" while running, full markdown
7
+ // output once it lands).
8
+ // 2. User can keep vibing — type a follow-up after the first turn
9
+ // lands and POST a /tasks/{id}/resume to multi-turn the same
10
+ // coding session.
11
+ // 3. Reload button at the bottom hits client.reloadApp() so the user
12
+ // can see the change without leaving the chat.
13
+ //
14
+ // State machine:
15
+ // idle — empty, waiting for first prompt (handled by parent screen)
16
+ // running — task is live, transcript streams, follow-up disabled
17
+ // done — task finished, follow-up enabled, Reload prominent
18
+ // failed — same as done but error tinted
19
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ var desc = Object.getOwnPropertyDescriptor(m, k);
22
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
23
+ desc = { enumerable: true, get: function() { return m[k]; } };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }) : (function(o, m, k, k2) {
27
+ if (k2 === undefined) k2 = k;
28
+ o[k2] = m[k];
29
+ }));
30
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
31
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
32
+ }) : function(o, v) {
33
+ o["default"] = v;
34
+ });
35
+ var __importStar = (this && this.__importStar) || (function () {
36
+ var ownKeys = function(o) {
37
+ ownKeys = Object.getOwnPropertyNames || function (o) {
38
+ var ar = [];
39
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
+ return ar;
41
+ };
42
+ return ownKeys(o);
43
+ };
44
+ return function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ })();
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.VibeChatScreen = VibeChatScreen;
54
+ const react_1 = __importStar(require("react"));
55
+ const react_native_1 = require("react-native");
56
+ function VibeChatScreen({ client, initialTaskId, initialUserPrompt, onClose, onReload, }) {
57
+ const [taskId, setTaskId] = (0, react_1.useState)(initialTaskId);
58
+ const [turns, setTurns] = (0, react_1.useState)(() => [
59
+ {
60
+ id: `user-${Date.now()}`,
61
+ role: 'user',
62
+ text: initialUserPrompt,
63
+ timestamp: Date.now(),
64
+ },
65
+ {
66
+ id: `status-${Date.now()}`,
67
+ role: 'status',
68
+ text: 'starting…',
69
+ timestamp: Date.now(),
70
+ },
71
+ ]);
72
+ const [streamBuffer, setStreamBuffer] = (0, react_1.useState)('');
73
+ const [status, setStatus] = (0, react_1.useState)('running');
74
+ const [followUp, setFollowUp] = (0, react_1.useState)('');
75
+ const [isResuming, setIsResuming] = (0, react_1.useState)(false);
76
+ const [isReloading, setIsReloading] = (0, react_1.useState)(false);
77
+ const scrollRef = (0, react_1.useRef)(null);
78
+ const abortRef = (0, react_1.useRef)(null);
79
+ // Subscribe to the current task's SSE stream. Re-runs whenever the
80
+ // taskId changes (resumeTask reuses the same id, so this only fires
81
+ // once per task — which is fine).
82
+ (0, react_1.useEffect)(() => {
83
+ let live = true;
84
+ const acc = [];
85
+ const close = client.streamTaskOutput(taskId, (line) => {
86
+ if (!live)
87
+ return;
88
+ // Filter our internal error sentinel from the SSE helper.
89
+ if (line.startsWith('__error__:')) {
90
+ setStatus('failed');
91
+ setStreamBuffer((prev) => prev + (prev ? '\n' : '') + line.slice('__error__:'.length).trim());
92
+ return;
93
+ }
94
+ acc.push(line);
95
+ // Throttle re-renders: flush every ~100ms.
96
+ setStreamBuffer(acc.join('\n'));
97
+ }, (terminal) => {
98
+ if (!live)
99
+ return;
100
+ setStatus(terminal === 'completed' ? 'done' : 'failed');
101
+ // Move the buffered stream into a real assistant turn so the
102
+ // user sees a stable render and can scroll back, then clear
103
+ // the buffer for any follow-up.
104
+ setTurns((prev) => {
105
+ const collapsed = acc.join('\n').trim();
106
+ if (!collapsed)
107
+ return prev.filter((t) => t.role !== 'status');
108
+ const next = prev.filter((t) => t.role !== 'status');
109
+ next.push({
110
+ id: `assistant-${taskId}-${Date.now()}`,
111
+ role: 'assistant',
112
+ text: collapsed,
113
+ timestamp: Date.now(),
114
+ });
115
+ return next;
116
+ });
117
+ setStreamBuffer('');
118
+ });
119
+ abortRef.current = close;
120
+ return () => {
121
+ live = false;
122
+ try {
123
+ close();
124
+ }
125
+ catch { /* ignore */ }
126
+ };
127
+ }, [client, taskId]);
128
+ // Auto-scroll the transcript when new content lands.
129
+ (0, react_1.useEffect)(() => {
130
+ const t = setTimeout(() => {
131
+ scrollRef.current?.scrollToEnd({ animated: true });
132
+ }, 50);
133
+ return () => clearTimeout(t);
134
+ }, [streamBuffer, turns]);
135
+ const handleSendFollowUp = (0, react_1.useCallback)(async () => {
136
+ const text = followUp.trim();
137
+ if (!text || isResuming)
138
+ return;
139
+ setIsResuming(true);
140
+ // Add user turn immediately for snappy UX.
141
+ setTurns((prev) => [
142
+ ...prev,
143
+ { id: `user-${Date.now()}`, role: 'user', text, timestamp: Date.now() },
144
+ { id: `status-${Date.now()}`, role: 'status', text: 'thinking…', timestamp: Date.now() },
145
+ ]);
146
+ setFollowUp('');
147
+ setStatus('running');
148
+ setStreamBuffer('');
149
+ try {
150
+ await client.resumeTask({ taskId, userPrompt: text });
151
+ // resumeTask reuses the same taskId, so the SSE subscription
152
+ // above will pick up the new output stream automatically. To
153
+ // force a fresh subscription we momentarily flip taskId to a
154
+ // sentinel and back; cleaner than tearing down + re-attaching
155
+ // the SSE manually.
156
+ const same = taskId;
157
+ setTaskId(`${same}#`);
158
+ setTimeout(() => setTaskId(same), 0);
159
+ }
160
+ catch (e) {
161
+ setStatus('failed');
162
+ setTurns((prev) => [
163
+ ...prev.filter((t) => t.role !== 'status'),
164
+ {
165
+ id: `assistant-err-${Date.now()}`,
166
+ role: 'assistant',
167
+ text: `Failed to send follow-up: ${e instanceof Error ? e.message : String(e)}`,
168
+ timestamp: Date.now(),
169
+ },
170
+ ]);
171
+ }
172
+ finally {
173
+ setIsResuming(false);
174
+ }
175
+ }, [client, followUp, isResuming, taskId]);
176
+ const handleReload = (0, react_1.useCallback)(async () => {
177
+ if (isReloading || !onReload)
178
+ return;
179
+ setIsReloading(true);
180
+ try {
181
+ await onReload();
182
+ }
183
+ catch (e) {
184
+ setTurns((prev) => [
185
+ ...prev,
186
+ {
187
+ id: `assistant-reload-err-${Date.now()}`,
188
+ role: 'assistant',
189
+ text: `Reload failed: ${e instanceof Error ? e.message : String(e)}`,
190
+ timestamp: Date.now(),
191
+ },
192
+ ]);
193
+ }
194
+ finally {
195
+ setIsReloading(false);
196
+ }
197
+ }, [isReloading, onReload]);
198
+ return (<react_native_1.View style={styles.container}>
199
+ <react_native_1.View style={styles.header}>
200
+ <react_native_1.Text style={styles.title}>Vibe</react_native_1.Text>
201
+ {onClose && (<react_native_1.TouchableOpacity onPress={onClose} accessibilityLabel="Close vibe chat">
202
+ <react_native_1.Text style={styles.close}>✕</react_native_1.Text>
203
+ </react_native_1.TouchableOpacity>)}
204
+ </react_native_1.View>
205
+
206
+ <react_native_1.ScrollView ref={scrollRef} style={styles.transcript} contentContainerStyle={styles.transcriptContent} keyboardShouldPersistTaps="handled">
207
+ {turns.map((turn) => (<react_native_1.View key={turn.id} style={[
208
+ styles.turn,
209
+ turn.role === 'user' && styles.turnUser,
210
+ turn.role === 'assistant' && styles.turnAssistant,
211
+ turn.role === 'status' && styles.turnStatus,
212
+ ]}>
213
+ <react_native_1.Text style={styles.turnText}>{turn.text}</react_native_1.Text>
214
+ </react_native_1.View>))}
215
+ {/* Live streaming buffer rendered as a single trailing
216
+ assistant block while the task is running. Once the task
217
+ terminates the stream is moved into a real turn (above)
218
+ and this block clears. */}
219
+ {streamBuffer && status === 'running' && (<react_native_1.View style={[styles.turn, styles.turnAssistant]}>
220
+ <react_native_1.Text style={styles.turnText}>{streamBuffer}</react_native_1.Text>
221
+ </react_native_1.View>)}
222
+ {status === 'running' && (<react_native_1.View style={styles.spinnerRow}>
223
+ <react_native_1.ActivityIndicator size="small" color="#9ca3af"/>
224
+ <react_native_1.Text style={styles.spinnerText}>working…</react_native_1.Text>
225
+ </react_native_1.View>)}
226
+ </react_native_1.ScrollView>
227
+
228
+ <react_native_1.View style={styles.footer}>
229
+ <react_native_1.TextInput style={styles.input} value={followUp} onChangeText={setFollowUp} placeholder={status === 'running' ? 'wait for the agent…' : 'follow up…'} placeholderTextColor="#666" editable={status !== 'running' && !isResuming} multiline/>
230
+ <react_native_1.View style={styles.actions}>
231
+ {onReload && (<react_native_1.TouchableOpacity style={[
232
+ styles.actionBtn,
233
+ styles.reloadBtn,
234
+ (isReloading || status === 'running') && styles.actionBtnDisabled,
235
+ ]} onPress={handleReload} disabled={isReloading || status === 'running'}>
236
+ <react_native_1.Text style={styles.actionText}>
237
+ {isReloading ? 'reloading…' : '⟳ reload'}
238
+ </react_native_1.Text>
239
+ </react_native_1.TouchableOpacity>)}
240
+ <react_native_1.TouchableOpacity style={[
241
+ styles.actionBtn,
242
+ styles.sendBtn,
243
+ (isResuming || status === 'running' || !followUp.trim()) && styles.actionBtnDisabled,
244
+ ]} onPress={handleSendFollowUp} disabled={isResuming || status === 'running' || !followUp.trim()}>
245
+ <react_native_1.Text style={styles.actionText}>
246
+ {isResuming ? '…' : '↑ send'}
247
+ </react_native_1.Text>
248
+ </react_native_1.TouchableOpacity>
249
+ </react_native_1.View>
250
+ </react_native_1.View>
251
+ </react_native_1.View>);
252
+ }
253
+ const styles = react_native_1.StyleSheet.create({
254
+ container: { flex: 1, backgroundColor: '#0a0a0a' },
255
+ header: {
256
+ flexDirection: 'row',
257
+ alignItems: 'center',
258
+ justifyContent: 'space-between',
259
+ paddingHorizontal: 16,
260
+ paddingTop: 14,
261
+ paddingBottom: 8,
262
+ borderBottomWidth: 1,
263
+ borderBottomColor: 'rgba(255,255,255,0.08)',
264
+ },
265
+ title: { color: '#fff', fontSize: 17, fontWeight: '600' },
266
+ close: { color: '#9ca3af', fontSize: 18 },
267
+ transcript: { flex: 1 },
268
+ transcriptContent: { padding: 12, paddingBottom: 24 },
269
+ turn: {
270
+ marginVertical: 4,
271
+ padding: 10,
272
+ borderRadius: 12,
273
+ maxWidth: '92%',
274
+ },
275
+ turnUser: {
276
+ backgroundColor: '#7582f5',
277
+ alignSelf: 'flex-end',
278
+ },
279
+ turnAssistant: {
280
+ backgroundColor: 'rgba(255,255,255,0.06)',
281
+ borderColor: 'rgba(255,255,255,0.10)',
282
+ borderWidth: 1,
283
+ alignSelf: 'flex-start',
284
+ },
285
+ turnStatus: {
286
+ backgroundColor: 'transparent',
287
+ alignSelf: 'flex-start',
288
+ paddingHorizontal: 4,
289
+ },
290
+ turnText: { color: '#f1f5f9', fontSize: 14, lineHeight: 20 },
291
+ spinnerRow: {
292
+ flexDirection: 'row',
293
+ alignItems: 'center',
294
+ marginTop: 8,
295
+ paddingHorizontal: 4,
296
+ },
297
+ spinnerText: { color: '#9ca3af', fontSize: 12, marginLeft: 8 },
298
+ footer: {
299
+ borderTopWidth: 1,
300
+ borderTopColor: 'rgba(255,255,255,0.08)',
301
+ padding: 10,
302
+ },
303
+ input: {
304
+ minHeight: 40,
305
+ maxHeight: 120,
306
+ color: '#f1f5f9',
307
+ fontSize: 14,
308
+ backgroundColor: 'rgba(255,255,255,0.04)',
309
+ borderRadius: 10,
310
+ paddingHorizontal: 12,
311
+ paddingVertical: 8,
312
+ },
313
+ actions: {
314
+ flexDirection: 'row',
315
+ justifyContent: 'flex-end',
316
+ marginTop: 8,
317
+ },
318
+ actionBtn: {
319
+ paddingHorizontal: 14,
320
+ paddingVertical: 8,
321
+ borderRadius: 10,
322
+ marginLeft: 8,
323
+ },
324
+ actionBtnDisabled: { opacity: 0.5 },
325
+ reloadBtn: { backgroundColor: 'rgba(255,255,255,0.08)' },
326
+ sendBtn: { backgroundColor: '#7582f5' },
327
+ actionText: { color: '#fff', fontSize: 13, fontWeight: '600' },
328
+ });
@@ -116,6 +116,13 @@ export declare class YaverFeedback {
116
116
  static isEnabled(): boolean;
117
117
  /** Returns the current config, or null if not initialized. */
118
118
  static getConfig(): FeedbackConfig | null;
119
+ /** Returns the resolved relay password the SDK is currently using.
120
+ * Empty string when no relay routing is in play (direct LAN agent
121
+ * URLs need no password). Callers attaching it to relay-routed
122
+ * HTTP requests must check for empty before setting the header,
123
+ * since "X-Relay-Password: " is treated as invalid by the relay
124
+ * and would 401 the request. */
125
+ static getRelayPassword(): string;
119
126
  /**
120
127
  * Manually attach an error with optional metadata.
121
128
  * Use this in catch blocks to give the agent extra context.
@@ -781,6 +781,15 @@ class YaverFeedback {
781
781
  static getConfig() {
782
782
  return config;
783
783
  }
784
+ /** Returns the resolved relay password the SDK is currently using.
785
+ * Empty string when no relay routing is in play (direct LAN agent
786
+ * URLs need no password). Callers attaching it to relay-routed
787
+ * HTTP requests must check for empty before setting the header,
788
+ * since "X-Relay-Password: " is treated as invalid by the relay
789
+ * and would 401 the request. */
790
+ static getRelayPassword() {
791
+ return p2pRelayPassword;
792
+ }
784
793
  /**
785
794
  * Manually attach an error with optional metadata.
786
795
  * Use this in catch blocks to give the agent extra context.
@@ -988,7 +997,7 @@ class YaverFeedback {
988
997
  screenshots: screenshotPath ? [screenshotPath] : [],
989
998
  errors: errorBuffer.length > 0 ? [...errorBuffer] : undefined,
990
999
  };
991
- await uploadFeedback(config.agentUrl, config.authToken ?? '', bundle);
1000
+ await uploadFeedback(config.agentUrl, config.authToken ?? '', bundle, p2pRelayPassword);
992
1001
  console.log('[YaverFeedback] Auto-report sent');
993
1002
  }
994
1003
  catch (err) {
@@ -0,0 +1,13 @@
1
+ export interface BuildFeedbackPromptInput {
2
+ userPrompt: string;
3
+ /** Hot-Reload project name when running inside Yaver mobile, OR
4
+ * the host app's bundle/package name when running standalone. */
5
+ projectName?: string;
6
+ /** Absolute path on the host where the project lives (only known
7
+ * when running inside Yaver mobile via Hot Reload). */
8
+ projectPath?: string;
9
+ /** True when the caller has attached a screenshot of the current
10
+ * screen as the first image in the task's images array. */
11
+ hasScreenshot: boolean;
12
+ }
13
+ export declare function buildFeedbackPrompt(input: BuildFeedbackPromptInput): string;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ // buildFeedbackPrompt — shared prompt enrichment used by every Yaver
3
+ // feedback surface, in-Yaver native pane (mirrored in Swift + Kotlin)
4
+ // AND the standalone RN feedback SDK (this file). Keep all three
5
+ // implementations in lockstep — the wording is what the AI on the
6
+ // remote is conditioned to expect.
7
+ //
8
+ // The bare user text on its own loses crucial context: WHICH app the
9
+ // user is testing, WHICH screen they're looking at, and whether a
10
+ // screenshot is attached for visual reference. Without that the agent
11
+ // guesses, edits the wrong project, or asks clarifying questions
12
+ // instead of acting. The wrapper below tells the agent:
13
+ // - this feedback comes from the in-app drawer while the user is
14
+ // mid-test,
15
+ // - which project the user is in (when known),
16
+ // - that the FIRST attached image (when present) is a snapshot of
17
+ // the current screen — open it to see what the user is pointing
18
+ // at,
19
+ // - that changes should be applied to that project's source +
20
+ // saved so the user can trigger a Hermes reload to see them.
21
+ //
22
+ // Cross-reference: mobile/ios/Yaver/YaverFeedbackPane.swift's
23
+ // `buildFeedbackPrompt` and mobile/android/.../YaverFeedbackPane.kt's
24
+ // `buildFeedbackPrompt`. All three must match.
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.buildFeedbackPrompt = buildFeedbackPrompt;
27
+ function buildFeedbackPrompt(input) {
28
+ const userPrompt = input.userPrompt ?? "";
29
+ const projectName = (input.projectName ?? "").trim();
30
+ const projectPath = (input.projectPath ?? "").trim();
31
+ const hasScreenshot = !!input.hasScreenshot;
32
+ const lines = [];
33
+ lines.push("[Mobile feedback from inside Yaver]");
34
+ lines.push("The user is providing this feedback while running a mobile app inside the Yaver mobile container " +
35
+ "and is currently looking at a specific screen of that app.");
36
+ lines.push("");
37
+ if (projectName || projectPath) {
38
+ lines.push("App being tested:");
39
+ if (projectName)
40
+ lines.push(` name: ${projectName}`);
41
+ if (projectPath)
42
+ lines.push(` path: ${projectPath}`);
43
+ lines.push("");
44
+ }
45
+ if (hasScreenshot) {
46
+ lines.push("A screenshot of the current screen is attached as the first image. " +
47
+ "Open it before deciding what to change — the user is pointing at what they SEE, " +
48
+ "not necessarily what is named most prominently in the source.");
49
+ lines.push("");
50
+ }
51
+ else {
52
+ lines.push("(The user chose not to attach a screenshot for this round.)");
53
+ lines.push("");
54
+ }
55
+ lines.push("Operation contract:");
56
+ lines.push("1. Locate the file(s) responsible for what the user described and EDIT them in place. " +
57
+ "Save the changes — that is the deliverable.");
58
+ lines.push("2. Stream a CONCISE Claude-Code / Codex-style narration as you work: " +
59
+ "one short line per step (e.g. \"Reading app/index.tsx\", " +
60
+ "\"Editing safe.backgroundColor\", \"Saved app/index.tsx\"). Show small diffs only — " +
61
+ "never dump entire files, never paste node_modules contents, never echo build / install logs.");
62
+ lines.push("3. Do NOT run npm install / yarn / pnpm / git clone / cargo build / docker pull or any other " +
63
+ "long-running install / fetch command. The repo is already prepared on this machine. " +
64
+ "If a dependency is genuinely missing, say so in one line and stop — the user will install it.");
65
+ lines.push("4. Do NOT trigger a Hermes reload yourself. The user has a Reload button in the drawer " +
66
+ "and decides when to refresh.");
67
+ lines.push("5. Keep total output under a few hundred lines. Heavy ripgrep / find / cat with no filter " +
68
+ "are usually the wrong tool — use targeted reads.");
69
+ if (!projectName && !projectPath) {
70
+ lines.push("6. If you can identify the project from the prompt or the screenshot, work there. " +
71
+ "Otherwise ask the user briefly which project to target — one short line, no exhaustive list.");
72
+ }
73
+ lines.push("");
74
+ lines.push("User feedback:");
75
+ lines.push(userPrompt);
76
+ return lines.join("\n");
77
+ }
package/dist/capture.d.ts CHANGED
@@ -22,6 +22,20 @@
22
22
  * modal. See `FeedbackModal.handleScreenshotForFix`.
23
23
  */
24
24
  export declare function captureScreenshot(): Promise<string>;
25
+ /**
26
+ * Capture a screenshot AND return it as base64 + mime type, ready to
27
+ * embed in a `/tasks` payload's `images` array. Used by the converged
28
+ * vibe-feedback flow (FeedbackModal → P2PClient.createFeedbackTask).
29
+ *
30
+ * Returns null when capture isn't possible (peer dep missing / user
31
+ * permission denied / running in a context where view-shot can't
32
+ * grab the screen). Caller should treat null as "send without
33
+ * screenshot" rather than aborting the whole feedback.
34
+ */
35
+ export declare function captureScreenshotBase64(): Promise<{
36
+ base64: string;
37
+ mimeType: string;
38
+ } | null>;
25
39
  export interface PickedFeedbackFile {
26
40
  path: string;
27
41
  name: string;
package/dist/capture.js CHANGED
@@ -16,6 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.captureScreenshot = captureScreenshot;
19
+ exports.captureScreenshotBase64 = captureScreenshotBase64;
19
20
  exports.pickFeedbackFile = pickFeedbackFile;
20
21
  exports.startVideoRecording = startVideoRecording;
21
22
  exports.stopVideoRecording = stopVideoRecording;
@@ -46,6 +47,34 @@ async function captureScreenshot() {
46
47
  String(err));
47
48
  }
48
49
  }
50
+ /**
51
+ * Capture a screenshot AND return it as base64 + mime type, ready to
52
+ * embed in a `/tasks` payload's `images` array. Used by the converged
53
+ * vibe-feedback flow (FeedbackModal → P2PClient.createFeedbackTask).
54
+ *
55
+ * Returns null when capture isn't possible (peer dep missing / user
56
+ * permission denied / running in a context where view-shot can't
57
+ * grab the screen). Caller should treat null as "send without
58
+ * screenshot" rather than aborting the whole feedback.
59
+ */
60
+ async function captureScreenshotBase64() {
61
+ try {
62
+ const ViewShot = require('react-native-view-shot');
63
+ const result = await ViewShot.captureScreen({
64
+ format: 'jpg',
65
+ quality: 0.7,
66
+ result: 'base64',
67
+ });
68
+ if (typeof result === 'string' && result.length > 0) {
69
+ // ViewShot returns a bare base64 string (no `data:` prefix).
70
+ return { base64: result, mimeType: 'image/jpeg' };
71
+ }
72
+ return null;
73
+ }
74
+ catch {
75
+ return null;
76
+ }
77
+ }
49
78
  function classifyPickedFile(name, mimeType) {
50
79
  const lowerName = name.toLowerCase();
51
80
  const lowerMime = (mimeType ?? '').toLowerCase();
@@ -27,3 +27,7 @@ export declare function clearQuickIconDisabled(): Promise<void>;
27
27
  export declare function getQuickIconColorPreset(): Promise<QuickIconColorPreset | null>;
28
28
  export declare function setQuickIconColorPreset(preset: QuickIconColorPreset | null): Promise<void>;
29
29
  export declare function clearQuickIconColorPreset(): Promise<void>;
30
+ export declare function getPreferredRunner(): Promise<string | null>;
31
+ export declare function setPreferredRunner(runner: string | null): Promise<void>;
32
+ export declare function getPreferredModel(): Promise<string | null>;
33
+ export declare function setPreferredModel(model: string | null): Promise<void>;
@@ -21,6 +21,10 @@ exports.clearQuickIconDisabled = clearQuickIconDisabled;
21
21
  exports.getQuickIconColorPreset = getQuickIconColorPreset;
22
22
  exports.setQuickIconColorPreset = setQuickIconColorPreset;
23
23
  exports.clearQuickIconColorPreset = clearQuickIconColorPreset;
24
+ exports.getPreferredRunner = getPreferredRunner;
25
+ exports.setPreferredRunner = setPreferredRunner;
26
+ exports.getPreferredModel = getPreferredModel;
27
+ exports.setPreferredModel = setPreferredModel;
24
28
  let AsyncStorage = null;
25
29
  try {
26
30
  AsyncStorage = require('@react-native-async-storage/async-storage').default;
@@ -137,3 +141,61 @@ async function setQuickIconColorPreset(preset) {
137
141
  async function clearQuickIconColorPreset() {
138
142
  await setQuickIconColorPreset(null);
139
143
  }
144
+ // ── Preferred coding agent + model (used by the standalone feedback
145
+ // SDK's vibe chat to mirror what Yaver mobile's Tasks tab would send.
146
+ // The agent on the remote DOES read userSettings.primaryRunnerByDevice
147
+ // from Convex, but the standalone SDK has no DeviceContext to push the
148
+ // per-device pick. We persist the user's last choice locally; first
149
+ // run picks whatever's signed-in via getRunnerStatus().)
150
+ const PREFERRED_RUNNER_KEY = 'yaver_feedback_preferred_runner';
151
+ const PREFERRED_MODEL_KEY = 'yaver_feedback_preferred_model';
152
+ async function getPreferredRunner() {
153
+ if (!AsyncStorage)
154
+ return null;
155
+ try {
156
+ const v = await AsyncStorage.getItem(PREFERRED_RUNNER_KEY);
157
+ return v && v.trim() ? v.trim() : null;
158
+ }
159
+ catch {
160
+ return null;
161
+ }
162
+ }
163
+ async function setPreferredRunner(runner) {
164
+ if (!AsyncStorage)
165
+ return;
166
+ try {
167
+ if (!runner || !runner.trim()) {
168
+ await AsyncStorage.removeItem(PREFERRED_RUNNER_KEY);
169
+ return;
170
+ }
171
+ await AsyncStorage.setItem(PREFERRED_RUNNER_KEY, runner.trim());
172
+ }
173
+ catch {
174
+ /* best-effort */
175
+ }
176
+ }
177
+ async function getPreferredModel() {
178
+ if (!AsyncStorage)
179
+ return null;
180
+ try {
181
+ const v = await AsyncStorage.getItem(PREFERRED_MODEL_KEY);
182
+ return v && v.trim() ? v.trim() : null;
183
+ }
184
+ catch {
185
+ return null;
186
+ }
187
+ }
188
+ async function setPreferredModel(model) {
189
+ if (!AsyncStorage)
190
+ return;
191
+ try {
192
+ if (!model || !model.trim()) {
193
+ await AsyncStorage.removeItem(PREFERRED_MODEL_KEY);
194
+ return;
195
+ }
196
+ await AsyncStorage.setItem(PREFERRED_MODEL_KEY, model.trim());
197
+ }
198
+ catch {
199
+ /* best-effort */
200
+ }
201
+ }
package/dist/types.d.ts CHANGED
@@ -118,6 +118,15 @@ export interface FeedbackConfig {
118
118
  preferredDeviceId?: string;
119
119
  /** How feedback collection is triggered */
120
120
  trigger?: 'shake' | 'floating-button' | 'manual';
121
+ /**
122
+ * App slug used by the in-modal Deploy panel when calling the agent's
123
+ * `/fleet/deploy-options` and `/deploy/ship` endpoints. Should match an
124
+ * `apps[].name` entry in the agent's `yaver.workspace.yaml`. When omitted
125
+ * the panel falls back to the last dot-segment of `bundleId` (e.g.
126
+ * `io.yaver.sfmg` → `sfmg`). Set explicitly when the workspace name
127
+ * differs from the bundleId tail.
128
+ */
129
+ deployAppSlug?: string;
121
130
  /**
122
131
  * Non-default escape hatch for host apps that want the SDK without
123
132
  * shake gesture handling. When enabled:
package/dist/upload.d.ts CHANGED
@@ -12,7 +12,7 @@ import { FeedbackBundle } from './types';
12
12
  * Callers can inspect `.id` / `.reportId` to drive a follow-up
13
13
  * `/feedback/{id}/fix` kick.
14
14
  */
15
- export declare function uploadFeedback(agentUrl: string, authToken: string, bundle: FeedbackBundle): Promise<{
15
+ export declare function uploadFeedback(agentUrl: string, authToken: string, bundle: FeedbackBundle, relayPassword?: string): Promise<{
16
16
  id?: string;
17
17
  reportId?: string;
18
18
  [k: string]: unknown;
package/dist/upload.js CHANGED
@@ -15,7 +15,7 @@ const react_native_1 = require("react-native");
15
15
  * Callers can inspect `.id` / `.reportId` to drive a follow-up
16
16
  * `/feedback/{id}/fix` kick.
17
17
  */
18
- async function uploadFeedback(agentUrl, authToken, bundle) {
18
+ async function uploadFeedback(agentUrl, authToken, bundle, relayPassword = '') {
19
19
  const formData = new FormData();
20
20
  // Attach metadata as JSON
21
21
  formData.append('metadata', JSON.stringify(bundle.metadata));
@@ -44,11 +44,15 @@ async function uploadFeedback(agentUrl, authToken, bundle) {
44
44
  });
45
45
  }
46
46
  const url = agentUrl.replace(/\/$/, '') + '/feedback';
47
+ const headers = {
48
+ Authorization: `Bearer ${authToken}`,
49
+ };
50
+ if (relayPassword) {
51
+ headers['X-Relay-Password'] = relayPassword;
52
+ }
47
53
  const response = await fetch(url, {
48
54
  method: 'POST',
49
- headers: {
50
- Authorization: `Bearer ${authToken}`,
51
- },
55
+ headers,
52
56
  body: formData,
53
57
  });
54
58
  if (!response.ok) {