react-native-ai-devtools 1.4.20 → 1.4.22
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 +109 -107
- package/build/core/feedback.d.ts +18 -0
- package/build/core/feedback.d.ts.map +1 -0
- package/build/core/feedback.js +73 -0
- package/build/core/feedback.js.map +1 -0
- package/build/core/guides.d.ts.map +1 -1
- package/build/core/guides.js +26 -0
- package/build/core/guides.js.map +1 -1
- package/build/core/index.d.ts +1 -0
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +2 -0
- package/build/core/index.js.map +1 -1
- package/build/index.js +76 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -47,7 +47,7 @@ initTelemetry, trackToolInvocation, getTargetPlatform,
|
|
|
47
47
|
// Format utilities (TONL)
|
|
48
48
|
formatLogsAsTonl, formatNetworkAsTonl,
|
|
49
49
|
// LogBox detection & control
|
|
50
|
-
detectLogBox, formatLogBoxWarning, dismissLogBox, formatDismissedEntries, pushLogBox, addLogBoxIgnorePatterns, verifyLogPipeline } from "./core/index.js";
|
|
50
|
+
detectLogBox, formatLogBoxWarning, dismissLogBox, formatDismissedEntries, pushLogBox, addLogBoxIgnorePatterns, verifyLogPipeline, formatIssueBody, buildGitHubUrl, shouldShowFeedbackHint, markFeedbackHintShown, } from "./core/index.js";
|
|
51
51
|
// Helper: resolve log buffer for a device (or create a merged buffer from all devices)
|
|
52
52
|
function resolveLogBuffer(device) {
|
|
53
53
|
if (device) {
|
|
@@ -155,6 +155,27 @@ function estimateImageTokens(base64Data) {
|
|
|
155
155
|
return Math.ceil(base64Data.length / 4); // fallback
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
// Tools that do NOT require an active Metro connection — excluded from feedback hint trigger
|
|
159
|
+
const NON_METRO_TOOLS = new Set([
|
|
160
|
+
"scan_metro",
|
|
161
|
+
"connect_metro",
|
|
162
|
+
"disconnect_metro",
|
|
163
|
+
"ensure_connection",
|
|
164
|
+
"get_connection_status",
|
|
165
|
+
"get_license_status",
|
|
166
|
+
"activate_license",
|
|
167
|
+
"delete_account",
|
|
168
|
+
"get_usage_guide",
|
|
169
|
+
"get_apps",
|
|
170
|
+
"list_ios_simulators",
|
|
171
|
+
"list_android_devices",
|
|
172
|
+
"ios_boot_simulator",
|
|
173
|
+
"ios_launch_app",
|
|
174
|
+
"android_launch_app",
|
|
175
|
+
"ios_install_app",
|
|
176
|
+
"android_install_app",
|
|
177
|
+
"send_feedback"
|
|
178
|
+
]);
|
|
158
179
|
// Registry for dev meta-tool — stores handlers and configs for dynamic dispatch
|
|
159
180
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
160
181
|
const toolRegistry = new Map();
|
|
@@ -242,6 +263,14 @@ function registerToolWithTelemetry(toolName, config, handler, emptyResultDetecto
|
|
|
242
263
|
responsePreview = textParts.join("\n").substring(0, 2000);
|
|
243
264
|
}
|
|
244
265
|
}
|
|
266
|
+
// First-install feedback hint — fires once on first successful Metro-connected tool
|
|
267
|
+
if (!NON_METRO_TOOLS.has(toolName) && shouldShowFeedbackHint()) {
|
|
268
|
+
markFeedbackHintShown();
|
|
269
|
+
// Fire-and-forget — don't block the tool response
|
|
270
|
+
pushLogBox("Congratulations on your first tool call! If you encounter any issues or have ideas for improvement, ask your AI assistant to call send_feedback. Your feedback helps me make this product better for everyone. Best regards, rn-ai-devtools developer.", "warning", true, "logbox").catch(() => {
|
|
271
|
+
// Non-fatal — hint delivery failure should not affect tool execution
|
|
272
|
+
});
|
|
273
|
+
}
|
|
245
274
|
return result;
|
|
246
275
|
}
|
|
247
276
|
catch (error) {
|
|
@@ -577,6 +606,52 @@ registerToolWithTelemetry("get_license_status", {
|
|
|
577
606
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
578
607
|
};
|
|
579
608
|
});
|
|
609
|
+
// Tool: Send feedback / bug report / feature request
|
|
610
|
+
registerToolWithTelemetry("send_feedback", {
|
|
611
|
+
description: "Create a feedback report (bug, feature request, or general feedback) for the react-native-ai-devtools team. " +
|
|
612
|
+
"Auto-collects environment info. Returns a pre-filled GitHub issue URL and formatted issue body. " +
|
|
613
|
+
"Ask the user to open the URL and paste the body to submit.",
|
|
614
|
+
inputSchema: {
|
|
615
|
+
type: z.enum(["feedback", "feature_request", "bug"]).describe('Type of feedback: "feedback", "feature_request", or "bug"'),
|
|
616
|
+
title: z.string().describe("Short summary (becomes the GitHub issue title)"),
|
|
617
|
+
description: z.string().describe("Detailed description of the feedback, feature request, or bug"),
|
|
618
|
+
workflow_context: z.string().optional().describe("What the user was trying to accomplish when they decided to give feedback")
|
|
619
|
+
}
|
|
620
|
+
}, async ({ type, title, description, workflow_context }) => {
|
|
621
|
+
// Collect environment info
|
|
622
|
+
const serverVersion = getServerVersion();
|
|
623
|
+
const platform = process.platform;
|
|
624
|
+
const deviceType = getTargetPlatform();
|
|
625
|
+
const licenseStatus = getLicenseStatus();
|
|
626
|
+
const env = {
|
|
627
|
+
serverVersion,
|
|
628
|
+
platform,
|
|
629
|
+
deviceType,
|
|
630
|
+
licenseTier: licenseStatus.tier
|
|
631
|
+
};
|
|
632
|
+
const input = { type, title, description, workflowContext: workflow_context };
|
|
633
|
+
const issueBody = formatIssueBody(input, env);
|
|
634
|
+
const githubUrl = buildGitHubUrl(title, type);
|
|
635
|
+
const output = [
|
|
636
|
+
"## Feedback Report Ready",
|
|
637
|
+
"",
|
|
638
|
+
`**GitHub Issue URL:** ${githubUrl}`,
|
|
639
|
+
"",
|
|
640
|
+
"**Issue body to paste:**",
|
|
641
|
+
"",
|
|
642
|
+
"```markdown",
|
|
643
|
+
issueBody,
|
|
644
|
+
"```",
|
|
645
|
+
"",
|
|
646
|
+
"Please ask the user to:",
|
|
647
|
+
"1. Open the GitHub URL above",
|
|
648
|
+
"2. Paste the issue body into the description field",
|
|
649
|
+
"3. Review and submit the issue"
|
|
650
|
+
].join("\n");
|
|
651
|
+
return {
|
|
652
|
+
content: [{ type: "text", text: output }]
|
|
653
|
+
};
|
|
654
|
+
});
|
|
580
655
|
// Tool: Ensure connection health
|
|
581
656
|
registerToolWithTelemetry("ensure_connection", {
|
|
582
657
|
description: "Verify or establish a healthy connection to a React Native app. Use before running commands if connection may be stale, or after navigation/reload. This tool runs a health check and will auto-reconnect if needed.",
|