@rozenite/network-activity-plugin 1.7.0 → 1.8.1

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 (43) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +24 -0
  3. package/dist/devtools/App.html +2 -2
  4. package/dist/devtools/assets/{App-pokLiGYV.js → App-B3xlUjs6.js} +163 -115
  5. package/dist/devtools/assets/{App-BrSkOkws.css → App-m6xge0az.css} +13 -0
  6. package/dist/react-native/chunks/boot-recording.cjs +307 -28
  7. package/dist/react-native/chunks/boot-recording.js +310 -31
  8. package/dist/react-native/chunks/useNetworkActivityDevTools.require.cjs +192 -141
  9. package/dist/react-native/chunks/useNetworkActivityDevTools.require.js +193 -142
  10. package/dist/react-native/index.d.ts +24 -7
  11. package/dist/rozenite.json +1 -1
  12. package/dist/sdk/index.cjs +127 -0
  13. package/dist/sdk/index.d.ts +1243 -0
  14. package/dist/sdk/index.js +127 -0
  15. package/package.json +17 -6
  16. package/sdk.ts +59 -0
  17. package/src/react-native/__tests__/events-listener.test.ts +35 -0
  18. package/src/react-native/agent/__tests__/network-activity-agent-state.test.ts +21 -9
  19. package/src/react-native/agent/state.ts +13 -13
  20. package/src/react-native/agent/tools.ts +20 -146
  21. package/src/react-native/agent/use-network-activity-agent-tools.ts +73 -64
  22. package/src/react-native/events-listener.ts +12 -3
  23. package/src/react-native/http/http-inspector.ts +19 -5
  24. package/src/react-native/network-inspector.ts +46 -8
  25. package/src/react-native/nitro-fetch/__tests__/nitro-network-inspector.test.ts +198 -0
  26. package/src/react-native/nitro-fetch/nitro-network-inspector.ts +403 -0
  27. package/src/react-native/useHttpInspector.ts +9 -19
  28. package/src/react-native/useNetworkActivityDevTools.ts +13 -1
  29. package/src/react-native/websocket/__tests__/websocket-inspector.test.ts +69 -0
  30. package/src/react-native/websocket/websocket-inspector.ts +32 -17
  31. package/src/shared/agent-tools.ts +230 -0
  32. package/src/shared/client.ts +3 -0
  33. package/src/shared/http-events.ts +6 -0
  34. package/src/shared/websocket-events.ts +16 -7
  35. package/src/ui/components/RequestList.tsx +21 -0
  36. package/src/ui/components/SidePanel.tsx +12 -9
  37. package/src/ui/state/derived.ts +4 -0
  38. package/src/ui/state/model.ts +6 -1
  39. package/src/ui/state/store.ts +52 -36
  40. package/src/ui/tabs/HeadersTab.tsx +18 -4
  41. package/src/ui/tabs/ResponseTab.tsx +5 -3
  42. package/tsconfig.json +4 -1
  43. package/vite.config.ts +7 -0
@@ -0,0 +1,127 @@
1
+ import { defineAgentToolContract, defineAgentToolDescriptors } from "@rozenite/agent-shared";
2
+ const NETWORK_ACTIVITY_AGENT_PLUGIN_ID = "@rozenite/network-activity-plugin";
3
+ const networkActivityToolDefinitions = {
4
+ startRecording: defineAgentToolContract({
5
+ name: "startRecording",
6
+ description: "Start recording network activity in the fallback network activity plugin.",
7
+ inputSchema: {
8
+ type: "object",
9
+ properties: {}
10
+ }
11
+ }),
12
+ stopRecording: defineAgentToolContract({
13
+ name: "stopRecording",
14
+ description: "Stop recording network activity without clearing the captured plugin buffer.",
15
+ inputSchema: {
16
+ type: "object",
17
+ properties: {}
18
+ }
19
+ }),
20
+ getRecordingStatus: defineAgentToolContract({
21
+ name: "getRecordingStatus",
22
+ description: "Return network activity plugin recording state and buffer metadata.",
23
+ inputSchema: {
24
+ type: "object",
25
+ properties: {}
26
+ }
27
+ }),
28
+ listRequests: defineAgentToolContract({
29
+ name: "listRequests",
30
+ description: "List captured HTTP request summaries with cursor pagination from the fallback plugin.",
31
+ inputSchema: {
32
+ type: "object",
33
+ properties: {
34
+ limit: {
35
+ type: "number",
36
+ description: "Maximum number of requests to return. Defaults to 20."
37
+ },
38
+ cursor: {
39
+ type: "string",
40
+ description: "Opaque pagination cursor from a previous listRequests call."
41
+ }
42
+ }
43
+ }
44
+ }),
45
+ getRequestDetails: defineAgentToolContract({
46
+ name: "getRequestDetails",
47
+ description: "Return detailed metadata for a captured HTTP request without fetching response body.",
48
+ inputSchema: {
49
+ type: "object",
50
+ properties: {
51
+ requestId: {
52
+ type: "string",
53
+ description: "Captured plugin request ID to inspect."
54
+ }
55
+ },
56
+ required: ["requestId"]
57
+ }
58
+ }),
59
+ getRequestBody: defineAgentToolContract({
60
+ name: "getRequestBody",
61
+ description: "Return the captured request body for a plugin-recorded HTTP request when available.",
62
+ inputSchema: {
63
+ type: "object",
64
+ properties: {
65
+ requestId: {
66
+ type: "string",
67
+ description: "Captured plugin request ID to inspect."
68
+ }
69
+ },
70
+ required: ["requestId"]
71
+ }
72
+ }),
73
+ getResponseBody: defineAgentToolContract({
74
+ name: "getResponseBody",
75
+ description: "Return the captured response body for a plugin-recorded HTTP request when available.",
76
+ inputSchema: {
77
+ type: "object",
78
+ properties: {
79
+ requestId: {
80
+ type: "string",
81
+ description: "Captured plugin request ID to inspect."
82
+ }
83
+ },
84
+ required: ["requestId"]
85
+ }
86
+ }),
87
+ listRealtimeConnections: defineAgentToolContract({
88
+ name: "listRealtimeConnections",
89
+ description: "List captured WebSocket and SSE connections with cursor pagination.",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {
93
+ limit: {
94
+ type: "number",
95
+ description: "Maximum number of realtime connections to return. Defaults to 20."
96
+ },
97
+ cursor: {
98
+ type: "string",
99
+ description: "Opaque pagination cursor from a previous listRealtimeConnections call."
100
+ }
101
+ }
102
+ }
103
+ }),
104
+ getRealtimeConnectionDetails: defineAgentToolContract({
105
+ name: "getRealtimeConnectionDetails",
106
+ description: "Return details for a captured WebSocket or SSE connection, including recent messages.",
107
+ inputSchema: {
108
+ type: "object",
109
+ properties: {
110
+ requestId: {
111
+ type: "string",
112
+ description: "Captured realtime request ID to inspect."
113
+ }
114
+ },
115
+ required: ["requestId"]
116
+ }
117
+ })
118
+ };
119
+ const networkActivityTools = defineAgentToolDescriptors(
120
+ NETWORK_ACTIVITY_AGENT_PLUGIN_ID,
121
+ networkActivityToolDefinitions
122
+ );
123
+ export {
124
+ NETWORK_ACTIVITY_AGENT_PLUGIN_ID,
125
+ networkActivityToolDefinitions,
126
+ networkActivityTools
127
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rozenite/network-activity-plugin",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "Network Activity for Rozenite.",
5
5
  "type": "module",
6
6
  "main": "./dist/react-native/index.cjs",
@@ -16,8 +16,9 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "nanoevents": "^9.1.0",
19
- "@rozenite/agent-bridge": "1.7.0",
20
- "@rozenite/plugin-bridge": "1.7.0"
19
+ "@rozenite/agent-shared": "1.8.1",
20
+ "@rozenite/agent-bridge": "1.8.1",
21
+ "@rozenite/plugin-bridge": "1.8.1"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@floating-ui/react": "^0.26.0",
@@ -48,13 +49,17 @@
48
49
  "typescript": "~5.9.3",
49
50
  "vite": "^7.3.1",
50
51
  "zustand": "^5.0.6",
51
- "@rozenite/vite-plugin": "1.7.0",
52
- "rozenite": "1.7.0"
52
+ "@rozenite/vite-plugin": "1.8.1",
53
+ "rozenite": "1.8.1"
53
54
  },
54
55
  "peerDependencies": {
56
+ "react-native-nitro-fetch": "*",
55
57
  "react-native-sse": "*"
56
58
  },
57
59
  "peerDependenciesMeta": {
60
+ "react-native-nitro-fetch": {
61
+ "optional": true
62
+ },
58
63
  "react-native-sse": {
59
64
  "optional": true
60
65
  }
@@ -66,7 +71,13 @@
66
71
  "import": "./dist/react-native/index.js",
67
72
  "require": "./dist/react-native/index.cjs"
68
73
  },
69
- "./package.json": "./package.json"
74
+ "./package.json": "./package.json",
75
+ "./sdk": {
76
+ "development": "./sdk.ts",
77
+ "types": "./dist/sdk/index.d.ts",
78
+ "import": "./dist/sdk/index.js",
79
+ "require": "./dist/sdk/index.cjs"
80
+ }
70
81
  },
71
82
  "publishConfig": {
72
83
  "access": "public"
package/sdk.ts ADDED
@@ -0,0 +1,59 @@
1
+ import { defineAgentToolDescriptors } from '@rozenite/agent-shared';
2
+ import {
3
+ NETWORK_ACTIVITY_AGENT_PLUGIN_ID,
4
+ networkActivityToolDefinitions,
5
+ } from './src/shared/agent-tools.js';
6
+
7
+ export {
8
+ NETWORK_ACTIVITY_AGENT_PLUGIN_ID,
9
+ networkActivityToolDefinitions,
10
+ };
11
+
12
+ export const networkActivityTools = defineAgentToolDescriptors(
13
+ NETWORK_ACTIVITY_AGENT_PLUGIN_ID,
14
+ networkActivityToolDefinitions,
15
+ );
16
+
17
+ export type {
18
+ NetworkActivityGetRealtimeConnectionDetailsArgs,
19
+ NetworkActivityGetRealtimeConnectionDetailsResult,
20
+ NetworkActivityGetRecordingStatusArgs,
21
+ NetworkActivityGetRecordingStatusResult,
22
+ NetworkActivityGetRequestBodyArgs,
23
+ NetworkActivityGetRequestBodyResult,
24
+ NetworkActivityGetRequestDetailsArgs,
25
+ NetworkActivityGetRequestDetailsResult,
26
+ NetworkActivityGetResponseBodyArgs,
27
+ NetworkActivityGetResponseBodyResult,
28
+ NetworkActivityListRealtimeConnectionsArgs,
29
+ NetworkActivityListRealtimeConnectionsResult,
30
+ NetworkActivityListRequestsArgs,
31
+ NetworkActivityListRequestsResult,
32
+ NetworkActivityPaginationArgs,
33
+ NetworkActivityRequestIdArgs,
34
+ NetworkActivityStartRecordingArgs,
35
+ NetworkActivityStartRecordingResult,
36
+ NetworkActivityStopRecordingArgs,
37
+ NetworkActivityStopRecordingResult,
38
+ } from './src/shared/agent-tools.js';
39
+
40
+ export type {
41
+ NetworkActivityAgentBodyResult,
42
+ NetworkActivityAgentState,
43
+ } from './src/react-native/agent/state.js';
44
+
45
+ export type {
46
+ Cookie,
47
+ HttpHeaders,
48
+ HttpMethod,
49
+ Initiator,
50
+ Request,
51
+ RequestBinaryPostData,
52
+ RequestFormDataPostData,
53
+ RequestId,
54
+ RequestOverride,
55
+ RequestPostData,
56
+ RequestTextPostData,
57
+ ResourceType,
58
+ Response,
59
+ } from './src/shared/http-events.js';
@@ -0,0 +1,35 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { createEventsListener } from '../events-listener';
3
+
4
+ type EventMap = {
5
+ 'request-sent': { id: string };
6
+ 'websocket-open': { id: string };
7
+ };
8
+
9
+ describe('events listener', () => {
10
+ it('filters queued messages when connecting', () => {
11
+ const listener = createEventsListener<EventMap>();
12
+ const send = vi.fn();
13
+
14
+ listener.enableQueuing();
15
+ listener.send('request-sent', { id: 'http-1' });
16
+ listener.send('websocket-open', { id: 'ws-1' });
17
+
18
+ listener.connect(send, (message) => message.type === 'websocket-open');
19
+
20
+ expect(send).toHaveBeenCalledTimes(1);
21
+ expect(send).toHaveBeenCalledWith('websocket-open', { id: 'ws-1' });
22
+ });
23
+
24
+ it('keeps applying the filter to live messages after connecting', () => {
25
+ const listener = createEventsListener<EventMap>();
26
+ const send = vi.fn();
27
+
28
+ listener.connect(send, (message) => message.type === 'websocket-open');
29
+ listener.send('request-sent', { id: 'http-1' });
30
+ listener.send('websocket-open', { id: 'ws-1' });
31
+
32
+ expect(send).toHaveBeenCalledTimes(1);
33
+ expect(send).toHaveBeenCalledWith('websocket-open', { id: 'ws-1' });
34
+ });
35
+ });
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { createNetworkActivityAgentState } from '../state';
3
- import { NETWORK_ACTIVITY_AGENT_TOOLS } from '../tools';
3
+ import { networkActivityToolDefinitions } from '../../../shared/agent-tools';
4
4
  import type { Request } from '../../../shared/client';
5
5
 
6
6
  const createRequest = (overrides?: Partial<Request>): Request => ({
@@ -18,7 +18,9 @@ const createRequest = (overrides?: Partial<Request>): Request => ({
18
18
 
19
19
  describe('network activity agent state', () => {
20
20
  it('exposes the expected fallback and realtime tool names', () => {
21
- expect(NETWORK_ACTIVITY_AGENT_TOOLS.map((tool) => tool.name)).toEqual([
21
+ expect(
22
+ Object.values(networkActivityToolDefinitions).map((tool) => tool.name),
23
+ ).toEqual([
22
24
  'startRecording',
23
25
  'stopRecording',
24
26
  'getRecordingStatus',
@@ -29,6 +31,9 @@ describe('network activity agent state', () => {
29
31
  'listRealtimeConnections',
30
32
  'getRealtimeConnectionDetails',
31
33
  ]);
34
+ expect(
35
+ networkActivityToolDefinitions.getRequestDetails.inputSchema.required,
36
+ ).toEqual(['requestId']);
32
37
  });
33
38
 
34
39
  it('tracks HTTP requests with parity-oriented list/detail/body results', () => {
@@ -40,7 +45,12 @@ describe('network activity agent state', () => {
40
45
  timestamp: 100,
41
46
  request: createRequest(),
42
47
  type: 'XHR',
43
- initiator: { type: 'script', url: 'App.tsx', lineNumber: 12, columnNumber: 4 },
48
+ initiator: {
49
+ type: 'script',
50
+ url: 'App.tsx',
51
+ lineNumber: 12,
52
+ columnNumber: 4,
53
+ },
44
54
  });
45
55
  state.onResponseReceived({
46
56
  requestId: 'req-1',
@@ -126,7 +136,7 @@ describe('network activity agent state', () => {
126
136
  state.onWebSocketConnect({
127
137
  type: 'websocket-connect',
128
138
  url: 'wss://example.com/socket',
129
- socketId: 7,
139
+ socketId: '7',
130
140
  timestamp: 100,
131
141
  protocols: ['chat'],
132
142
  options: [],
@@ -134,13 +144,13 @@ describe('network activity agent state', () => {
134
144
  state.onWebSocketOpen({
135
145
  type: 'websocket-open',
136
146
  url: 'wss://example.com/socket',
137
- socketId: 7,
147
+ socketId: '7',
138
148
  timestamp: 110,
139
149
  });
140
150
  state.onWebSocketMessageSent({
141
151
  type: 'websocket-message-sent',
142
152
  url: 'wss://example.com/socket',
143
- socketId: 7,
153
+ socketId: '7',
144
154
  timestamp: 120,
145
155
  data: 'ping',
146
156
  messageType: 'text',
@@ -148,7 +158,7 @@ describe('network activity agent state', () => {
148
158
  state.onWebSocketMessageReceived({
149
159
  type: 'websocket-message-received',
150
160
  url: 'wss://example.com/socket',
151
- socketId: 7,
161
+ socketId: '7',
152
162
  timestamp: 121,
153
163
  data: 'pong',
154
164
  messageType: 'text',
@@ -244,7 +254,9 @@ describe('network activity agent state', () => {
244
254
  state.startRecording();
245
255
 
246
256
  expect(() =>
247
- state.listRequests({ limit: 1, cursor: firstPage.page.nextCursor })
248
- ).toThrow('Cursor does not match the requested listing. Run the command again.');
257
+ state.listRequests({ limit: 1, cursor: firstPage.page.nextCursor }),
258
+ ).toThrow(
259
+ 'Cursor does not match the requested listing. Run the command again.',
260
+ );
249
261
  });
250
262
  });
@@ -47,7 +47,7 @@ type WebSocketAgentRecord = {
47
47
  requestId: string;
48
48
  kind: 'websocket';
49
49
  url: string;
50
- socketId: number;
50
+ socketId: string;
51
51
  status: 'connecting' | 'open' | 'closing' | 'closed' | 'error';
52
52
  startedAt: number;
53
53
  endedAt?: number;
@@ -174,7 +174,7 @@ const decodeCursor = (cursor: string, scope: string): number => {
174
174
  const [cursorScope, rawIndex] = cursor.split(':', 2);
175
175
  if (cursorScope !== scope || !rawIndex) {
176
176
  throw new Error(
177
- 'Cursor does not match the requested listing. Run the command again.'
177
+ 'Cursor does not match the requested listing. Run the command again.',
178
178
  );
179
179
  }
180
180
 
@@ -190,7 +190,7 @@ const paginate = <T>(
190
190
  rows: T[],
191
191
  scope: string,
192
192
  limit: number,
193
- cursor?: string
193
+ cursor?: string,
194
194
  ): Page<T> => {
195
195
  const startIndex = cursor ? decodeCursor(cursor, scope) : 0;
196
196
  const endIndex = Math.min(startIndex + limit, rows.length);
@@ -208,7 +208,7 @@ const paginate = <T>(
208
208
 
209
209
  const serializeRequestBody = (
210
210
  requestId: string,
211
- postData?: RequestPostData
211
+ postData?: RequestPostData,
212
212
  ): NetworkActivityAgentBodyResult => {
213
213
  if (!postData) {
214
214
  return {
@@ -287,7 +287,7 @@ const getRealtimeSummary = (record: RealtimeAgentRecord) => {
287
287
  const trimMap = <T>(
288
288
  order: string[],
289
289
  records: Map<string, T>,
290
- capacity: number
290
+ capacity: number,
291
291
  ): number => {
292
292
  let evicted = 0;
293
293
  while (order.length > capacity) {
@@ -330,7 +330,7 @@ export const createNetworkActivityAgentState = () => {
330
330
 
331
331
  const ensureHttpRecord = (
332
332
  requestId: string,
333
- fallback?: Partial<HttpAgentRecord>
333
+ fallback?: Partial<HttpAgentRecord>,
334
334
  ): HttpAgentRecord => {
335
335
  const existing = state.httpRecords.get(requestId);
336
336
  if (existing) {
@@ -357,7 +357,7 @@ export const createNetworkActivityAgentState = () => {
357
357
  const evicted = trimMap(
358
358
  state.httpOrder,
359
359
  state.httpRecords,
360
- HTTP_BUFFER_CAPACITY
360
+ HTTP_BUFFER_CAPACITY,
361
361
  );
362
362
  if (evicted > 0) {
363
363
  state.httpEvictedCount += evicted;
@@ -368,7 +368,7 @@ export const createNetworkActivityAgentState = () => {
368
368
 
369
369
  const ensureRealtimeRecord = (
370
370
  requestId: string,
371
- createRecord: () => RealtimeAgentRecord
371
+ createRecord: () => RealtimeAgentRecord,
372
372
  ): RealtimeAgentRecord => {
373
373
  const existing = state.realtimeRecords.get(requestId);
374
374
  if (existing) {
@@ -382,7 +382,7 @@ export const createNetworkActivityAgentState = () => {
382
382
  const evicted = trimMap(
383
383
  state.realtimeOrder,
384
384
  state.realtimeRecords,
385
- REALTIME_BUFFER_CAPACITY
385
+ REALTIME_BUFFER_CAPACITY,
386
386
  );
387
387
  if (evicted > 0) {
388
388
  state.realtimeEvictedCount += evicted;
@@ -706,12 +706,12 @@ export const createNetworkActivityAgentState = () => {
706
706
  timestamp: event.timestamp,
707
707
  };
708
708
  record.messages = [...record.messages, message].slice(
709
- -MAX_WEBSOCKET_MESSAGES_PER_CONNECTION
709
+ -MAX_WEBSOCKET_MESSAGES_PER_CONNECTION,
710
710
  );
711
711
  },
712
712
 
713
713
  onWebSocketMessageReceived(
714
- event: WebSocketEventMap['websocket-message-received']
714
+ event: WebSocketEventMap['websocket-message-received'],
715
715
  ) {
716
716
  if (!state.isRecording) {
717
717
  return;
@@ -734,7 +734,7 @@ export const createNetworkActivityAgentState = () => {
734
734
  timestamp: event.timestamp,
735
735
  };
736
736
  record.messages = [...record.messages, message].slice(
737
- -MAX_WEBSOCKET_MESSAGES_PER_CONNECTION
737
+ -MAX_WEBSOCKET_MESSAGES_PER_CONNECTION,
738
738
  );
739
739
  },
740
740
 
@@ -757,7 +757,7 @@ export const createNetworkActivityAgentState = () => {
757
757
  },
758
758
 
759
759
  onWebSocketConnectionStatusChanged(
760
- event: WebSocketEventMap['websocket-connection-status-changed']
760
+ event: WebSocketEventMap['websocket-connection-status-changed'],
761
761
  ) {
762
762
  if (!state.isRecording) {
763
763
  return;
@@ -1,146 +1,20 @@
1
- import type { AgentTool } from '@rozenite/agent-bridge';
2
-
3
- export const startRecordingTool: AgentTool = {
4
- name: 'startRecording',
5
- description:
6
- 'Start recording network activity in the fallback network activity plugin.',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {},
10
- },
11
- };
12
-
13
- export const stopRecordingTool: AgentTool = {
14
- name: 'stopRecording',
15
- description:
16
- 'Stop recording network activity without clearing the captured plugin buffer.',
17
- inputSchema: {
18
- type: 'object',
19
- properties: {},
20
- },
21
- };
22
-
23
- export const getRecordingStatusTool: AgentTool = {
24
- name: 'getRecordingStatus',
25
- description:
26
- 'Return network activity plugin recording state and buffer metadata.',
27
- inputSchema: {
28
- type: 'object',
29
- properties: {},
30
- },
31
- };
32
-
33
- export const listRequestsTool: AgentTool = {
34
- name: 'listRequests',
35
- description:
36
- 'List captured HTTP request summaries with cursor pagination from the fallback plugin.',
37
- inputSchema: {
38
- type: 'object',
39
- properties: {
40
- limit: {
41
- type: 'number',
42
- description: 'Maximum number of requests to return. Defaults to 20.',
43
- },
44
- cursor: {
45
- type: 'string',
46
- description: 'Opaque pagination cursor from a previous listRequests call.',
47
- },
48
- },
49
- },
50
- };
51
-
52
- export const getRequestDetailsTool: AgentTool = {
53
- name: 'getRequestDetails',
54
- description:
55
- 'Return detailed metadata for a captured HTTP request without fetching response body.',
56
- inputSchema: {
57
- type: 'object',
58
- properties: {
59
- requestId: {
60
- type: 'string',
61
- description: 'Captured plugin request ID to inspect.',
62
- },
63
- },
64
- required: ['requestId'],
65
- },
66
- };
67
-
68
- export const getRequestBodyTool: AgentTool = {
69
- name: 'getRequestBody',
70
- description:
71
- 'Return the captured request body for a plugin-recorded HTTP request when available.',
72
- inputSchema: {
73
- type: 'object',
74
- properties: {
75
- requestId: {
76
- type: 'string',
77
- description: 'Captured plugin request ID to inspect.',
78
- },
79
- },
80
- required: ['requestId'],
81
- },
82
- };
83
-
84
- export const getResponseBodyTool: AgentTool = {
85
- name: 'getResponseBody',
86
- description:
87
- 'Return the captured response body for a plugin-recorded HTTP request when available.',
88
- inputSchema: {
89
- type: 'object',
90
- properties: {
91
- requestId: {
92
- type: 'string',
93
- description: 'Captured plugin request ID to inspect.',
94
- },
95
- },
96
- required: ['requestId'],
97
- },
98
- };
99
-
100
- export const listRealtimeConnectionsTool: AgentTool = {
101
- name: 'listRealtimeConnections',
102
- description:
103
- 'List captured WebSocket and SSE connections with cursor pagination.',
104
- inputSchema: {
105
- type: 'object',
106
- properties: {
107
- limit: {
108
- type: 'number',
109
- description: 'Maximum number of realtime connections to return. Defaults to 20.',
110
- },
111
- cursor: {
112
- type: 'string',
113
- description:
114
- 'Opaque pagination cursor from a previous listRealtimeConnections call.',
115
- },
116
- },
117
- },
118
- };
119
-
120
- export const getRealtimeConnectionDetailsTool: AgentTool = {
121
- name: 'getRealtimeConnectionDetails',
122
- description:
123
- 'Return details for a captured WebSocket or SSE connection, including recent messages.',
124
- inputSchema: {
125
- type: 'object',
126
- properties: {
127
- requestId: {
128
- type: 'string',
129
- description: 'Captured realtime request ID to inspect.',
130
- },
131
- },
132
- required: ['requestId'],
133
- },
134
- };
135
-
136
- export const NETWORK_ACTIVITY_AGENT_TOOLS: AgentTool[] = [
137
- startRecordingTool,
138
- stopRecordingTool,
139
- getRecordingStatusTool,
140
- listRequestsTool,
141
- getRequestDetailsTool,
142
- getRequestBodyTool,
143
- getResponseBodyTool,
144
- listRealtimeConnectionsTool,
145
- getRealtimeConnectionDetailsTool,
146
- ];
1
+ import { networkActivityToolDefinitions } from '../../shared/agent-tools';
2
+
3
+ export const startRecordingTool = networkActivityToolDefinitions.startRecording;
4
+ export const stopRecordingTool = networkActivityToolDefinitions.stopRecording;
5
+ export const getRecordingStatusTool =
6
+ networkActivityToolDefinitions.getRecordingStatus;
7
+ export const listRequestsTool = networkActivityToolDefinitions.listRequests;
8
+ export const getRequestDetailsTool =
9
+ networkActivityToolDefinitions.getRequestDetails;
10
+ export const getRequestBodyTool = networkActivityToolDefinitions.getRequestBody;
11
+ export const getResponseBodyTool =
12
+ networkActivityToolDefinitions.getResponseBody;
13
+ export const listRealtimeConnectionsTool =
14
+ networkActivityToolDefinitions.listRealtimeConnections;
15
+ export const getRealtimeConnectionDetailsTool =
16
+ networkActivityToolDefinitions.getRealtimeConnectionDetails;
17
+
18
+ export const NETWORK_ACTIVITY_AGENT_TOOLS = Object.values(
19
+ networkActivityToolDefinitions,
20
+ );