@tonyclaw/agent-inspector 3.0.44 → 3.0.45

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 (80) hide show
  1. package/.output/cli.js +20743 -16945
  2. package/.output/nitro.json +1 -1
  3. package/.output/public/assets/{CompareDrawer-DQHjxFO6.js → CompareDrawer-B3_TLTJh.js} +1 -1
  4. package/.output/public/assets/{InspectorPet-D1A4505B.js → InspectorPet-Cpn6hv4P.js} +1 -1
  5. package/.output/public/assets/{ProxyViewerContainer-BhpIgfBi.js → ProxyViewerContainer-BEAhuGOJ.js} +27 -27
  6. package/.output/public/assets/{ReplayDialog-C5vmbecv.js → ReplayDialog-B3EKVdJk.js} +1 -1
  7. package/.output/public/assets/{RequestAnatomy-CPGNB8lk.js → RequestAnatomy-COOQjyUC.js} +1 -1
  8. package/.output/public/assets/{ResponseView-DUfrajCm.js → ResponseView-DBCjkwye.js} +1 -1
  9. package/.output/public/assets/{StreamingChunkSequence-nbeCQqOz.js → StreamingChunkSequence-CuXhDgMo.js} +1 -1
  10. package/.output/public/assets/{_sessionId-mw3aA8Bp.js → _sessionId-BJlM3nmt.js} +1 -1
  11. package/.output/public/assets/{_sessionId-CDhRgzf6.js → _sessionId-zbgYl7ZJ.js} +1 -1
  12. package/.output/public/assets/{index-B2eoeT-Z.js → index-BIK4bPTv.js} +1 -1
  13. package/.output/public/assets/{index-C6qZwYlR.js → index-BZo_8koU.js} +15 -15
  14. package/.output/public/assets/{index-CX7_rf7o.js → index-D2Qw6Ri2.js} +1 -1
  15. package/.output/public/assets/{index-BWjeqxbk.css → index-ZWschkCh.css} +1 -1
  16. package/.output/public/assets/{index-BfRhTvOd.js → index-xF_NY8Yb.js} +5 -5
  17. package/.output/public/assets/{json-viewer-BLmF1sOZ.js → json-viewer-B-Ao6pwW.js} +1 -1
  18. package/.output/public/assets/{jszip.min-C9rCFoU3.js → jszip.min-B_rfAUCe.js} +1 -1
  19. package/.output/server/_libs/modelcontextprotocol__core.mjs +25 -25
  20. package/.output/server/_libs/modelcontextprotocol__server.mjs +2 -2
  21. package/.output/server/_libs/zod.mjs +6 -6
  22. package/.output/server/{_sessionId-U54BAqdp.mjs → _sessionId-CJ99gZFV.mjs} +3 -1
  23. package/.output/server/{_sessionId-E_Dmopc-.mjs → _sessionId-DEjScBpK.mjs} +5 -3
  24. package/.output/server/_ssr/{CompareDrawer-CksatPed.mjs → CompareDrawer-DtOIMeQB.mjs} +4 -2
  25. package/.output/server/_ssr/{InspectorPet-DNc4GQ7z.mjs → InspectorPet-CXc4oCBQ.mjs} +3 -1
  26. package/.output/server/_ssr/{ProxyViewerContainer-B02Ey0p_.mjs → ProxyViewerContainer-DVPlwfkt.mjs} +52 -27
  27. package/.output/server/_ssr/{ReplayDialog-DdMvHJF1.mjs → ReplayDialog-BQEA95qC.mjs} +6 -4
  28. package/.output/server/_ssr/{RequestAnatomy--vh2Z8__.mjs → RequestAnatomy-BMyd8B7Q.mjs} +4 -2
  29. package/.output/server/_ssr/{ResponseView-Dhxc-cKC.mjs → ResponseView-qrTaEIM8.mjs} +4 -2
  30. package/.output/server/_ssr/{StreamingChunkSequence-BG0EQmaD.mjs → StreamingChunkSequence-BFTL8mIy.mjs} +5 -3
  31. package/.output/server/_ssr/{index-lcfulIXa.mjs → index-Bcj1Hcy4.mjs} +4 -2
  32. package/.output/server/_ssr/{index-D0At9nfd.mjs → index-DW-M7XUG.mjs} +3 -1
  33. package/.output/server/_ssr/index.mjs +4 -3
  34. package/.output/server/_ssr/{json-viewer-My1J1_5R.mjs → json-viewer-DiI0Yjsn.mjs} +4 -2
  35. package/.output/server/_ssr/publicBasePathContext-5264L3rX.mjs +148 -0
  36. package/.output/server/_ssr/{router-DWcUFPR3.mjs → router-BJ_ltLim.mjs} +2432 -475
  37. package/.output/server/_ssr/start-C6MjPjxp.mjs +57 -0
  38. package/.output/server/_tanstack-start-manifest_v-C6pXXX9R.mjs +4 -0
  39. package/.output/server/index.mjs +92 -92
  40. package/.output/workers/logFinalizer.worker.js +4 -0
  41. package/.output/workers/sessionWorkerEntry.js +4 -0
  42. package/README.md +221 -25
  43. package/docs/instance-control.openapi.yaml +306 -0
  44. package/package.json +4 -1
  45. package/src/cli/alias.ts +440 -0
  46. package/src/cli/instance.ts +1037 -0
  47. package/src/cli/instanceArgs.ts +266 -0
  48. package/src/cli/instanceControl.ts +183 -0
  49. package/src/cli/instanceModel.ts +275 -0
  50. package/src/cli/instanceRegistry.ts +740 -0
  51. package/src/cli/onboard.ts +123 -35
  52. package/src/cli/onboardTarget.ts +179 -0
  53. package/src/cli/templates/codex-skill-onboard.ts +76 -28
  54. package/src/cli/templates/skill-onboard.ts +93 -59
  55. package/src/cli.ts +154 -16
  56. package/src/components/ProxyViewer.tsx +13 -5
  57. package/src/components/providers/SettingsDialog.tsx +13 -8
  58. package/src/lib/basePath.ts +8 -2
  59. package/src/lib/codingAgentEndpoints.ts +16 -0
  60. package/src/lib/instanceContract.ts +220 -0
  61. package/src/lib/managedInstance.ts +104 -0
  62. package/src/lib/publicBasePathContext.ts +107 -0
  63. package/src/mcp/instanceHandlers.ts +149 -0
  64. package/src/mcp/loopback.ts +16 -5
  65. package/src/mcp/mode.ts +25 -0
  66. package/src/mcp/server.ts +258 -18
  67. package/src/mcp/toolHandlers.ts +2 -2
  68. package/src/proxy/identityProxy.ts +655 -36
  69. package/src/proxy/runtimeShutdown.ts +73 -1
  70. package/src/proxy/sessionInfo.ts +5 -4
  71. package/src/routes/api/-instances.ts +109 -0
  72. package/src/routes/api/instances.$name.connection.ts +12 -0
  73. package/src/routes/api/instances.$name.restart.ts +23 -0
  74. package/src/routes/api/instances.$name.start.ts +18 -0
  75. package/src/routes/api/instances.$name.stop.ts +23 -0
  76. package/src/routes/api/instances.$name.ts +12 -0
  77. package/src/routes/api/instances.ts +16 -0
  78. package/src/start.ts +10 -0
  79. package/.output/server/_ssr/start-HYkvq4Ni.mjs +0 -4
  80. package/.output/server/_tanstack-start-manifest_v-B2chR8ef.mjs +0 -4
package/src/mcp/server.ts CHANGED
@@ -33,9 +33,14 @@ import {
33
33
  UpdateInspectorGroupInputSchema,
34
34
  } from "../lib/groupContract";
35
35
  import { InspectorRunStatusSchema, UpdateInspectorRunInputSchema } from "../lib/runContract";
36
- import { getCurrentPort, setCurrentPort } from "../lib/serverPort";
37
- import { getConfiguredBasePath, withBasePath } from "../lib/basePath";
36
+ import { withBasePath } from "../lib/basePath";
37
+ import {
38
+ getPublicBasePath,
39
+ getPublicPort,
40
+ runWithRequestPublicBasePath,
41
+ } from "../lib/publicBasePathContext";
38
42
  import { JsonValueSchema } from "../contracts";
43
+ import { InstanceListOutputSchema } from "../lib/instanceContract";
39
44
  import {
40
45
  MAX_PROVIDER_MODEL_NAME_CHARS,
41
46
  MAX_PROVIDER_MODELS,
@@ -43,7 +48,22 @@ import {
43
48
  MAX_SEARCH_QUERY_CHARS,
44
49
  } from "../lib/resourceLimits";
45
50
  import { getCurrentContext } from "./currentContext";
46
- import { getMcpModeInfo, isMcpWriteEnabled } from "./mode";
51
+ import {
52
+ getMcpInstanceModeInfo,
53
+ getMcpModeInfo,
54
+ isMcpInstanceWriteEnabled,
55
+ isMcpWriteEnabled,
56
+ } from "./mode";
57
+ import {
58
+ getInstanceConnectionImpl,
59
+ getInstanceImpl,
60
+ InstanceLifecycleToolInputSchema,
61
+ InstanceNameToolInputSchema,
62
+ listInstancesImpl,
63
+ restartInstanceImpl,
64
+ startInstanceImpl,
65
+ stopInstanceImpl,
66
+ } from "./instanceHandlers";
47
67
  import {
48
68
  getInspectorGroup,
49
69
  listInspectorGroups,
@@ -178,17 +198,10 @@ export async function _resetForTests(): Promise<void> {
178
198
  * handler — accepts a Web `Request`, returns a `Promise<Response>`.
179
199
  */
180
200
  export async function handleMcpRequest(request: Request): Promise<Response> {
181
- // Extract port from the incoming request URL so loopback calls work even
182
- // when PORT env var is unset (e.g. MCP client connected before server init).
183
- try {
184
- const url = new URL(request.url);
185
- const port = Number(url.port);
186
- if (port > 0) setCurrentPort(port);
187
- } catch {
188
- // URL parse failure → fall through to PORT env var in getCurrentPort()
189
- }
190
- const { transport } = await getServer();
191
- return transport.handleRequest(request);
201
+ return runWithRequestPublicBasePath(request, async () => {
202
+ const { transport } = await getServer();
203
+ return transport.handleRequest(request);
204
+ });
192
205
  }
193
206
 
194
207
  // ---------------------------------------------------------------------------
@@ -219,6 +232,27 @@ Either preview field is null when the body is unknown format, unparseable, or th
219
232
  const PROVIDER_WRITE_WARNING =
220
233
  "⚠ This tool mutates provider configuration. Confirm with the user before invoking.";
221
234
 
235
+ const INSTANCE_LIFECYCLE_WRITE_WARNING =
236
+ "This tool changes a local Agent Inspector process. Obtain explicit user approval before invoking it.";
237
+
238
+ const INSTANCE_READ_TOOL_NAMES = [
239
+ "inspector_list_instances",
240
+ "inspector_get_instance",
241
+ "inspector_get_instance_connection",
242
+ ] as const;
243
+
244
+ const INSTANCE_WRITE_TOOL_NAMES = [
245
+ "inspector_start_instance",
246
+ "inspector_stop_instance",
247
+ "inspector_restart_instance",
248
+ ] as const;
249
+
250
+ const INSTANCE_RESOURCE_URIS = [
251
+ "inspector://instances",
252
+ "inspector://instances/{name}",
253
+ "inspector://instances/{name}/connection",
254
+ ] as const;
255
+
222
256
  const AddProviderInputSchema = z
223
257
  .object({
224
258
  name: z.string().min(1).describe("Provider display name."),
@@ -327,9 +361,9 @@ function jsonResource(uri: URL, data: unknown): ReadResourceResult {
327
361
  }
328
362
 
329
363
  function mcpEndpointUrl(): string {
330
- return `http://localhost:${String(getCurrentPort())}${withBasePath(
364
+ return `http://localhost:${String(getPublicPort())}${withBasePath(
331
365
  "/api/mcp",
332
- getConfiguredBasePath(process.env),
366
+ getPublicBasePath(),
333
367
  )}`;
334
368
  }
335
369
 
@@ -342,7 +376,7 @@ function mcpHealth(): Record<string, unknown> {
342
376
  },
343
377
  transport: {
344
378
  primary: "streamable-http",
345
- endpoint: withBasePath("/api/mcp", getConfiguredBasePath(process.env)),
379
+ endpoint: mcpEndpointUrl(),
346
380
  stateless: true,
347
381
  },
348
382
  mode: getMcpModeInfo(),
@@ -355,6 +389,7 @@ function mcpHealth(): Record<string, unknown> {
355
389
  }
356
390
 
357
391
  const WRITE_TOOL_NAMES = new Set<string>([
392
+ ...INSTANCE_WRITE_TOOL_NAMES,
358
393
  "inspector_create_run",
359
394
  "inspector_update_run",
360
395
  "inspector_export_evidence",
@@ -379,18 +414,36 @@ const WRITE_TOOL_NAMES = new Set<string>([
379
414
  function mcpCapabilities(): Record<string, unknown> {
380
415
  const readTools = TOOL_NAMES.filter((name) => !WRITE_TOOL_NAMES.has(name));
381
416
  const writeTools = TOOL_NAMES.filter((name) => WRITE_TOOL_NAMES.has(name));
417
+ const generalWriteMode = getMcpModeInfo();
418
+ const instanceWriteMode = getMcpInstanceModeInfo();
382
419
  return {
383
420
  serverInfo: {
384
421
  name: "agent-inspector",
385
422
  version: MCP_SERVER_VERSION,
386
423
  },
387
- mode: getMcpModeInfo(),
424
+ mode: generalWriteMode,
388
425
  tools: {
389
426
  read: readTools,
390
427
  writeOrAction: writeTools,
391
428
  },
392
429
  resources: RESOURCE_NAMES,
393
430
  prompts: PROMPT_NAMES,
431
+ instanceControl: {
432
+ tools: {
433
+ read: INSTANCE_READ_TOOL_NAMES,
434
+ writeOrAction: INSTANCE_WRITE_TOOL_NAMES,
435
+ },
436
+ resources: INSTANCE_RESOURCE_URIS,
437
+ writeGates: {
438
+ general: generalWriteMode,
439
+ instance: instanceWriteMode,
440
+ lifecycleWritesEnabled: generalWriteMode.writesEnabled && instanceWriteMode.writesEnabled,
441
+ },
442
+ limitations: {
443
+ selfStopOrRestart:
444
+ "The serving managed instance cannot stop or restart itself over REST or MCP. Use the CLI or a sibling controller instance.",
445
+ },
446
+ },
394
447
  };
395
448
  }
396
449
 
@@ -473,6 +526,36 @@ function safeWriteCall(
473
526
  });
474
527
  }
475
528
 
529
+ function disabledInstanceWriteTool(toolName: string): ToolResult {
530
+ return {
531
+ content: [
532
+ {
533
+ type: "text",
534
+ text: JSON.stringify(
535
+ {
536
+ error: "mcp-instance-write-disabled",
537
+ tool: toolName,
538
+ generalMode: getMcpModeInfo(),
539
+ instanceMode: getMcpInstanceModeInfo(),
540
+ },
541
+ null,
542
+ 2,
543
+ ),
544
+ },
545
+ ],
546
+ isError: true,
547
+ };
548
+ }
549
+
550
+ function safeInstanceWriteCall(
551
+ toolName: string,
552
+ fn: () => ToolResult | Promise<ToolResult>,
553
+ ): Promise<ToolResult> {
554
+ return safeWriteCall(toolName, () =>
555
+ isMcpInstanceWriteEnabled() ? fn() : disabledInstanceWriteTool(toolName),
556
+ );
557
+ }
558
+
476
559
  function variableString(variables: Variables, name: string): string | null {
477
560
  const value = variables[name];
478
561
  if (Array.isArray(value)) return value[0] ?? null;
@@ -504,6 +587,41 @@ function readServiceJsonResource<T>(
504
587
  return jsonResource(uri, result.value);
505
588
  }
506
589
 
590
+ async function readInstanceToolResource(
591
+ uri: URL,
592
+ resultPromise: Promise<ToolResult>,
593
+ ): Promise<ReadResourceResult> {
594
+ const result = await resultPromise;
595
+ const text = result.content[0]?.text ?? "";
596
+ return textResource(uri, result.isError === true ? "text/plain" : "application/json", text);
597
+ }
598
+
599
+ async function listInstanceTemplateResources(connection: boolean): Promise<ListResourcesResult> {
600
+ try {
601
+ const response = await callApi("/api/instances", {
602
+ headers: { accept: "application/json" },
603
+ });
604
+ if (!response.ok) return listResult([]);
605
+ const parsed = InstanceListOutputSchema.safeParse(await response.json());
606
+ if (!parsed.success) return listResult([]);
607
+ return listResult(
608
+ parsed.data.instances.map((instance) => ({
609
+ uri: connection
610
+ ? `inspector://instances/${encodeURIComponent(instance.name)}/connection`
611
+ : `inspector://instances/${encodeURIComponent(instance.name)}`,
612
+ name: connection ? `instance-connection:${instance.name}` : `instance:${instance.name}`,
613
+ title: connection
614
+ ? `Agent Inspector connection for ${instance.name}`
615
+ : `Agent Inspector instance ${instance.name}`,
616
+ mimeType: "application/json",
617
+ description: `${instance.state} at ${instance.urls.ui}`,
618
+ })),
619
+ );
620
+ } catch {
621
+ return listResult([]);
622
+ }
623
+ }
624
+
507
625
  async function listSessionResources(): Promise<ListResourcesResult> {
508
626
  try {
509
627
  const response = await callApi("/api/sessions");
@@ -707,6 +825,74 @@ function userPrompt(text: string): GetPromptResult {
707
825
  // ---------------------------------------------------------------------------
708
826
 
709
827
  function registerTools(server: McpServer): void {
828
+ // ----- Named instance discovery and lifecycle -----
829
+
830
+ server.registerTool(
831
+ "inspector_list_instances",
832
+ {
833
+ title: "List named Agent Inspector instances",
834
+ description:
835
+ "Returns the versioned, token-free REST instance list with live state, saved configuration, and public URLs. Available in readonly mode.",
836
+ inputSchema: z.object({}).strict(),
837
+ },
838
+ () => safeCall(() => listInstancesImpl(callApi)),
839
+ );
840
+
841
+ server.registerTool(
842
+ "inspector_get_instance",
843
+ {
844
+ title: "Get a named Agent Inspector instance",
845
+ description:
846
+ "Returns one versioned, token-free named-instance status document from the REST control plane. Available in readonly mode.",
847
+ inputSchema: InstanceNameToolInputSchema,
848
+ },
849
+ ({ name }) => safeCall(() => getInstanceImpl(callApi, name)),
850
+ );
851
+
852
+ server.registerTool(
853
+ "inspector_get_instance_connection",
854
+ {
855
+ title: "Get coding-agent connection settings for an instance",
856
+ description:
857
+ "Returns the REST connection descriptor for one named instance, including protocol-correct proxy, OpenAI /v1, MCP, health, environment, and Codex values. It never includes credentials.",
858
+ inputSchema: InstanceNameToolInputSchema,
859
+ },
860
+ ({ name }) => safeCall(() => getInstanceConnectionImpl(callApi, name)),
861
+ );
862
+
863
+ server.registerTool(
864
+ "inspector_start_instance",
865
+ {
866
+ title: "Start or create a named Agent Inspector instance",
867
+ description: `${INSTANCE_LIFECYCLE_WRITE_WARNING} Starts, creates, or idempotently reuses a named sibling instance through the REST lifecycle API. Requires both AGENT_INSPECTOR_MCP_WRITES=1 and AGENT_INSPECTOR_MCP_INSTANCE_WRITES=1.`,
868
+ inputSchema: InstanceLifecycleToolInputSchema,
869
+ },
870
+ (args) =>
871
+ safeInstanceWriteCall("inspector_start_instance", () => startInstanceImpl(callApi, args)),
872
+ );
873
+
874
+ server.registerTool(
875
+ "inspector_stop_instance",
876
+ {
877
+ title: "Stop a named Agent Inspector instance",
878
+ description: `${INSTANCE_LIFECYCLE_WRITE_WARNING} Gracefully stops a sibling instance after authenticated ownership checks. The instance serving this MCP connection cannot stop itself. Requires both MCP write gates.`,
879
+ inputSchema: InstanceNameToolInputSchema,
880
+ },
881
+ ({ name }) =>
882
+ safeInstanceWriteCall("inspector_stop_instance", () => stopInstanceImpl(callApi, name)),
883
+ );
884
+
885
+ server.registerTool(
886
+ "inspector_restart_instance",
887
+ {
888
+ title: "Restart a named Agent Inspector instance",
889
+ description: `${INSTANCE_LIFECYCLE_WRITE_WARNING} Validates and restarts a sibling instance through the bounded REST lifecycle path. The instance serving this MCP connection cannot restart itself. Requires both MCP write gates.`,
890
+ inputSchema: InstanceLifecycleToolInputSchema,
891
+ },
892
+ (args) =>
893
+ safeInstanceWriteCall("inspector_restart_instance", () => restartInstanceImpl(callApi, args)),
894
+ );
895
+
710
896
  // ----- Read tools -----
711
897
 
712
898
  server.registerTool(
@@ -1460,6 +1646,55 @@ PATCH-style update: only the fields you supply are changed. Use models to update
1460
1646
  }
1461
1647
 
1462
1648
  function registerResources(server: McpServer): void {
1649
+ server.registerResource(
1650
+ "inspector_instances",
1651
+ "inspector://instances",
1652
+ {
1653
+ title: "Named Agent Inspector instances",
1654
+ description: "Versioned, token-free named-instance list backed by GET /api/instances.",
1655
+ mimeType: "application/json",
1656
+ },
1657
+ (uri) => readInstanceToolResource(uri, listInstancesImpl(callApi)),
1658
+ );
1659
+
1660
+ server.registerResource(
1661
+ "inspector_instance",
1662
+ new ResourceTemplate("inspector://instances/{name}", {
1663
+ list: async () => await listInstanceTemplateResources(false),
1664
+ }),
1665
+ {
1666
+ title: "Named Agent Inspector instance",
1667
+ description:
1668
+ "Versioned, token-free status for one named instance backed by GET /api/instances/{name}.",
1669
+ mimeType: "application/json",
1670
+ },
1671
+ (uri, variables) => {
1672
+ const name = variableString(variables, "name");
1673
+ return name === null
1674
+ ? textResource(uri, "text/plain", "Missing instance name")
1675
+ : readInstanceToolResource(uri, getInstanceImpl(callApi, name));
1676
+ },
1677
+ );
1678
+
1679
+ server.registerResource(
1680
+ "inspector_instance_connection",
1681
+ new ResourceTemplate("inspector://instances/{name}/connection", {
1682
+ list: async () => await listInstanceTemplateResources(true),
1683
+ }),
1684
+ {
1685
+ title: "Named instance coding-agent connection",
1686
+ description:
1687
+ "Token-free connection descriptor backed by GET /api/instances/{name}/connection.",
1688
+ mimeType: "application/json",
1689
+ },
1690
+ (uri, variables) => {
1691
+ const name = variableString(variables, "name");
1692
+ return name === null
1693
+ ? textResource(uri, "text/plain", "Missing instance name")
1694
+ : readInstanceToolResource(uri, getInstanceConnectionImpl(callApi, name));
1695
+ },
1696
+ );
1697
+
1463
1698
  server.registerResource(
1464
1699
  "inspector_mcp_health",
1465
1700
  "inspector://mcp/health",
@@ -1958,6 +2193,8 @@ Return:
1958
2193
 
1959
2194
  // Surface the tool catalog for tests that assert on the tool name set.
1960
2195
  export const TOOL_NAMES = [
2196
+ ...INSTANCE_READ_TOOL_NAMES,
2197
+ ...INSTANCE_WRITE_TOOL_NAMES,
1961
2198
  "inspector_list_logs",
1962
2199
  "inspector_search_logs",
1963
2200
  "inspector_get_log",
@@ -2006,6 +2243,9 @@ export const TOOL_NAMES = [
2006
2243
  ] as const;
2007
2244
 
2008
2245
  export const RESOURCE_NAMES = [
2246
+ "inspector_instances",
2247
+ "inspector_instance",
2248
+ "inspector_instance_connection",
2009
2249
  "inspector_mcp_health",
2010
2250
  "inspector_mcp_capabilities",
2011
2251
  "inspector_mcp_config",
@@ -20,7 +20,7 @@ import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
20
20
  import { dirname, join } from "node:path";
21
21
  import JSZip from "jszip";
22
22
  import { z } from "zod";
23
- import { getCurrentPort } from "../lib/serverPort";
23
+ import { getPublicPort } from "../lib/publicBasePathContext";
24
24
  import { LoopbackTimeoutError, type CallApiOptions } from "./loopback";
25
25
  import { extractLastUserMessagePreview, extractResponsePreview } from "./previewExtractor";
26
26
  import {
@@ -138,7 +138,7 @@ function redactedProvidersResult(value: unknown): ToolResult {
138
138
  }
139
139
 
140
140
  function inspectorBaseUrl(): string {
141
- return `http://127.0.0.1:${String(getCurrentPort())}`;
141
+ return `http://127.0.0.1:${String(getPublicPort())}`;
142
142
  }
143
143
 
144
144
  function hasBodyText(value: string | null, byteLength: number | null | undefined): boolean {