Skip to content

Commit 46490ae

Browse files
committed
Remove debug logs
1 parent 9c76c24 commit 46490ae

File tree

5 files changed

+2
-233
lines changed

5 files changed

+2
-233
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -240,26 +240,6 @@ function TextEditor({
240240

241241
useEffect(() => {
242242
if (streamingContent !== undefined) {
243-
// #region agent log
244-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
245-
method: 'POST',
246-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
247-
body: JSON.stringify({
248-
sessionId: '6f10b0',
249-
location: 'file-viewer.tsx:streaming-merge',
250-
message: 'TextEditor streaming merge',
251-
data: {
252-
fileId: file.id,
253-
fileName: file.name,
254-
fetchedLen: fetchedContent?.length ?? 0,
255-
streamingLen: streamingContent.length,
256-
mode: fetchedContent !== undefined ? 'append_to_fetched' : 'stream_only',
257-
},
258-
timestamp: Date.now(),
259-
hypothesisId: 'H9',
260-
}),
261-
}).catch(() => {})
262-
// #endregion
263243
const nextContent =
264244
fetchedContent === undefined
265245
? streamingContent

apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/resource-content.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -102,30 +102,6 @@ export const ResourceContent = memo(function ResourceContent({
102102
}
103103
}, [workspaceId, streamFileName])
104104

105-
// #region agent log
106-
if (streamingFile) {
107-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
108-
method: 'POST',
109-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
110-
body: JSON.stringify({
111-
sessionId: '6f10b0',
112-
location: 'resource-content.tsx:render',
113-
message: 'ResourceContent render with streamingFile',
114-
data: {
115-
resourceId: resource.id,
116-
resourceType: resource.type,
117-
streamFileName: streamFileName,
118-
hasExtractedContent: streamingExtractedContent !== undefined,
119-
extractedLen: streamingExtractedContent?.length ?? 0,
120-
rawContentLen: streamingFile.content.length,
121-
},
122-
timestamp: Date.now(),
123-
hypothesisId: 'H3',
124-
}),
125-
}).catch(() => {})
126-
}
127-
// #endregion
128-
129105
if (streamingFile && resource.id === 'streaming-file') {
130106
return (
131107
<div className='flex h-full flex-col overflow-hidden'>

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 2 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -777,16 +777,6 @@ export function useChat(
777777
}
778778

779779
logger.debug('SSE event received', parsed)
780-
if (parsed.type === 'tool') {
781-
const _p = getPayloadData(parsed)
782-
if (_p.phase === 'args_delta' && _p.toolName === 'workspace_file') {
783-
console.warn('[FILE-STREAM-BROWSER] workspace_file args_delta arrived', {
784-
seq: parsed.seq,
785-
deltaLen:
786-
typeof _p.argumentsDelta === 'string' ? (_p.argumentsDelta as string).length : 0,
787-
})
788-
}
789-
}
790780
switch (parsed.type) {
791781
case MothershipStreamV1EventType.session: {
792782
const payload = getPayloadData(parsed)
@@ -891,26 +881,6 @@ export function useChat(
891881
: (blocks[toolMap.get(id) ?? -1]?.toolCall?.name ?? '')
892882
const streamWorkspaceFile = toolName === WorkspaceFile.id
893883

894-
// #region agent log
895-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
896-
method: 'POST',
897-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
898-
body: JSON.stringify({
899-
sessionId: '6f10b0',
900-
location: 'use-chat.ts:args_delta',
901-
message: 'args_delta entry',
902-
data: {
903-
toolName,
904-
streamWorkspaceFile,
905-
deltaLen: delta.length,
906-
seq: parsed.seq,
907-
},
908-
timestamp: Date.now(),
909-
hypothesisId: 'H1',
910-
}),
911-
}).catch(() => {})
912-
// #endregion
913-
914884
if (streamWorkspaceFile) {
915885
let prev = streamingFileRef.current
916886
if (!prev || (!prev.fileName && !prev.fileId)) {
@@ -943,32 +913,6 @@ export function useChat(
943913
(resource) => resource.type === 'file' && resource.id === matchedResourceId
944914
)
945915

946-
// #region agent log
947-
const hasContent = raw.indexOf('"content":') >= 0
948-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
949-
method: 'POST',
950-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
951-
body: JSON.stringify({
952-
sessionId: '6f10b0',
953-
location: 'use-chat.ts:resource-decision',
954-
message: 'resource routing',
955-
data: {
956-
fileName,
957-
matchedResourceId,
958-
existingFileMatch: !!existingFileMatch,
959-
hasContent,
960-
rawLen: raw.length,
961-
activeResourceId: activeResourceIdRef.current,
962-
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
963-
activeFileCtx: activeFileContextRef.current,
964-
seq: parsed.seq,
965-
},
966-
timestamp: Date.now(),
967-
hypothesisId: 'H4',
968-
}),
969-
}).catch(() => {})
970-
// #endregion
971-
972916
if (existingFileMatch) {
973917
setActiveResourceId(matchedResourceId)
974918
setResources((rs) => rs.filter((resource) => resource.id !== 'streaming-file'))
@@ -1132,26 +1076,6 @@ export function useChat(
11321076
if (fileId || fileName) {
11331077
activeFileContextRef.current = { fileId, fileName }
11341078
}
1135-
// #region agent log
1136-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
1137-
method: 'POST',
1138-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
1139-
body: JSON.stringify({
1140-
sessionId: '6f10b0',
1141-
location: 'use-chat.ts:create_file_result',
1142-
message: 'create_file result processed',
1143-
data: {
1144-
toolName: tc.name,
1145-
fileId,
1146-
fileName,
1147-
status: tc.status,
1148-
activeFileCtx: activeFileContextRef.current,
1149-
},
1150-
timestamp: Date.now(),
1151-
hypothesisId: 'H5',
1152-
}),
1153-
}).catch(() => {})
1154-
// #endregion
11551079
}
11561080

11571081
if (isWorkflowToolName(tc.name)) {
@@ -1160,27 +1084,6 @@ export function useChat(
11601084

11611085
if (tc.name === WorkspaceFile.id) {
11621086
const fileResource = extractedResources.find((r) => r.type === 'file')
1163-
// #region agent log
1164-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
1165-
method: 'POST',
1166-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
1167-
body: JSON.stringify({
1168-
sessionId: '6f10b0',
1169-
location: 'use-chat.ts:workspace_file_result_cleanup',
1170-
message: 'workspace_file result cleanup',
1171-
data: {
1172-
toolCallId: id,
1173-
activeResourceIdBefore: activeResourceIdRef.current,
1174-
streamingFileExists: !!streamingFileRef.current,
1175-
fileResourceId: fileResource?.id,
1176-
fileResourceTitle: fileResource?.title,
1177-
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
1178-
},
1179-
timestamp: Date.now(),
1180-
hypothesisId: 'H6',
1181-
}),
1182-
}).catch(() => {})
1183-
// #endregion
11841087
if (fileResource) {
11851088
setResources((rs) => {
11861089
const without = rs.filter((r) => r.id !== 'streaming-file')
@@ -1221,6 +1124,8 @@ export function useChat(
12211124
const chunkTitle = innerArgs?.title as string | undefined
12221125
if (chunkTitle) {
12231126
displayTitle = `Writing ${chunkTitle}`
1127+
} else if (activeFileContextRef.current?.fileName) {
1128+
displayTitle = `Writing ${activeFileContextRef.current.fileName}`
12241129
}
12251130
}
12261131

@@ -1385,26 +1290,6 @@ export function useChat(
13851290
blocks.push({ type: 'subagent', content: name })
13861291
}
13871292
if (name === FileWrite.id) {
1388-
// #region agent log
1389-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
1390-
method: 'POST',
1391-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
1392-
body: JSON.stringify({
1393-
sessionId: '6f10b0',
1394-
location: 'use-chat.ts:file_write_span_start',
1395-
message: 'file_write span start',
1396-
data: {
1397-
parentToolCallId,
1398-
activeResourceIdBefore: activeResourceIdRef.current,
1399-
existingStreamingFile: streamingFileRef.current,
1400-
activeFileCtx: activeFileContextRef.current,
1401-
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
1402-
},
1403-
timestamp: Date.now(),
1404-
hypothesisId: 'H7',
1405-
}),
1406-
}).catch(() => {})
1407-
// #endregion
14081293
const emptyFile = { fileName: '', content: '' }
14091294
streamingFileRef.current = emptyFile
14101295
setStreamingFile(emptyFile)
@@ -1415,28 +1300,6 @@ export function useChat(
14151300
break
14161301
}
14171302
if (streamingFileRef.current) {
1418-
// #region agent log
1419-
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
1420-
method: 'POST',
1421-
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
1422-
body: JSON.stringify({
1423-
sessionId: '6f10b0',
1424-
location: 'use-chat.ts:file_write_span_end',
1425-
message: 'file_write span end clear',
1426-
data: {
1427-
activeResourceIdBefore: activeResourceIdRef.current,
1428-
streamingFileBefore: streamingFileRef.current,
1429-
lastRealFileId: resourcesRef.current.find(
1430-
(r: { type: string; id: string }) =>
1431-
r.type === 'file' && r.id !== 'streaming-file'
1432-
)?.id,
1433-
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
1434-
},
1435-
timestamp: Date.now(),
1436-
hypothesisId: 'H8',
1437-
}),
1438-
}).catch(() => {})
1439-
// #endregion
14401303
setStreamingFile(null)
14411304
streamingFileRef.current = null
14421305
const lastFileResource = resourcesRef.current.find(

apps/sim/lib/copilot/request/go/stream.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -136,46 +136,6 @@ export async function runStreamLoop(
136136
return
137137
}
138138

139-
if (streamEvent.type === MothershipStreamV1EventType.tool) {
140-
const tp = streamEvent.payload as Record<string, unknown> | undefined
141-
if (tp?.phase === 'args_delta' && tp?.toolName === 'workspace_file') {
142-
logger.info('[file-stream] args_delta FROM GO', {
143-
toolCallId: tp.toolCallId,
144-
deltaLen:
145-
typeof tp.argumentsDelta === 'string' ? (tp.argumentsDelta as string).length : 0,
146-
scope: streamEvent.scope?.agentId,
147-
parentToolCallId: streamEvent.scope?.parentToolCallId,
148-
})
149-
}
150-
if (tp?.phase === 'call' && tp?.toolName === 'workspace_file') {
151-
logger.info('[file-stream] workspace_file CALL event', {
152-
toolCallId: tp.toolCallId,
153-
phase: tp.phase,
154-
status: tp.status,
155-
hasArgs: !!tp.arguments,
156-
})
157-
}
158-
if (tp?.phase === 'result' && tp?.toolName === 'workspace_file') {
159-
const resultData = tp.result as Record<string, unknown> | undefined
160-
const innerData = resultData?.data as Record<string, unknown> | undefined
161-
logger.info('[file-stream] workspace_file RESULT', {
162-
toolCallId: tp.toolCallId,
163-
success: tp.success,
164-
fileId: innerData?.id,
165-
fileName: innerData?.name,
166-
})
167-
}
168-
}
169-
if (streamEvent.type === MothershipStreamV1EventType.span) {
170-
const sp = streamEvent.payload as Record<string, unknown> | undefined
171-
if (sp?.agent === 'file_write') {
172-
logger.info('[file-stream] file_write SPAN', {
173-
event: sp.event,
174-
parentToolCallId: streamEvent.scope?.parentToolCallId,
175-
})
176-
}
177-
}
178-
179139
try {
180140
await options.onEvent?.(streamEvent)
181141
} catch (error) {

apps/sim/lib/copilot/request/session/writer.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ export class StreamWriter {
8383
}
8484

8585
publish(event: StreamEvent): void {
86-
const payload = event.payload as Record<string, unknown> | undefined
87-
if (event.type === MothershipStreamV1EventType.tool && payload?.toolName === 'workspace_file') {
88-
logger.info('[file-stream] PUBLISH to client', {
89-
seq: this.nextSeq + 1,
90-
phase: payload.phase,
91-
toolCallId: payload.toolCallId,
92-
disconnected: this._clientDisconnected,
93-
hasController: !!this.controller,
94-
})
95-
}
9686
const envelope = this.createEnvelope(event)
9787
this.enqueue(envelope)
9888
this.queuePersistence(envelope)

0 commit comments

Comments
 (0)