mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
Remove debug logs
This commit is contained in:
@@ -240,26 +240,6 @@ function TextEditor({
|
||||
|
||||
useEffect(() => {
|
||||
if (streamingContent !== undefined) {
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'file-viewer.tsx:streaming-merge',
|
||||
message: 'TextEditor streaming merge',
|
||||
data: {
|
||||
fileId: file.id,
|
||||
fileName: file.name,
|
||||
fetchedLen: fetchedContent?.length ?? 0,
|
||||
streamingLen: streamingContent.length,
|
||||
mode: fetchedContent !== undefined ? 'append_to_fetched' : 'stream_only',
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H9',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
const nextContent =
|
||||
fetchedContent === undefined
|
||||
? streamingContent
|
||||
|
||||
@@ -110,30 +110,6 @@ export const ResourceContent = memo(function ResourceContent({
|
||||
}
|
||||
}, [workspaceId, streamFileName])
|
||||
|
||||
// #region agent log
|
||||
if (streamingFile) {
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'resource-content.tsx:render',
|
||||
message: 'ResourceContent render with streamingFile',
|
||||
data: {
|
||||
resourceId: resource.id,
|
||||
resourceType: resource.type,
|
||||
streamFileName: streamFileName,
|
||||
hasExtractedContent: streamingExtractedContent !== undefined,
|
||||
extractedLen: streamingExtractedContent?.length ?? 0,
|
||||
rawContentLen: streamingFile.content.length,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H3',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
}
|
||||
// #endregion
|
||||
|
||||
if (streamingFile && resource.id === 'streaming-file') {
|
||||
return (
|
||||
<div className='flex h-full flex-col overflow-hidden'>
|
||||
|
||||
@@ -777,16 +777,6 @@ export function useChat(
|
||||
}
|
||||
|
||||
logger.debug('SSE event received', parsed)
|
||||
if (parsed.type === 'tool') {
|
||||
const _p = getPayloadData(parsed)
|
||||
if (_p.phase === 'args_delta' && _p.toolName === 'workspace_file') {
|
||||
console.warn('[FILE-STREAM-BROWSER] workspace_file args_delta arrived', {
|
||||
seq: parsed.seq,
|
||||
deltaLen:
|
||||
typeof _p.argumentsDelta === 'string' ? (_p.argumentsDelta as string).length : 0,
|
||||
})
|
||||
}
|
||||
}
|
||||
switch (parsed.type) {
|
||||
case MothershipStreamV1EventType.session: {
|
||||
const payload = getPayloadData(parsed)
|
||||
@@ -891,26 +881,6 @@ export function useChat(
|
||||
: (blocks[toolMap.get(id) ?? -1]?.toolCall?.name ?? '')
|
||||
const streamWorkspaceFile = toolName === WorkspaceFile.id
|
||||
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:args_delta',
|
||||
message: 'args_delta entry',
|
||||
data: {
|
||||
toolName,
|
||||
streamWorkspaceFile,
|
||||
deltaLen: delta.length,
|
||||
seq: parsed.seq,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H1',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
|
||||
if (streamWorkspaceFile) {
|
||||
let prev = streamingFileRef.current
|
||||
if (!prev || (!prev.fileName && !prev.fileId)) {
|
||||
@@ -943,32 +913,6 @@ export function useChat(
|
||||
(resource) => resource.type === 'file' && resource.id === matchedResourceId
|
||||
)
|
||||
|
||||
// #region agent log
|
||||
const hasContent = raw.indexOf('"content":') >= 0
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:resource-decision',
|
||||
message: 'resource routing',
|
||||
data: {
|
||||
fileName,
|
||||
matchedResourceId,
|
||||
existingFileMatch: !!existingFileMatch,
|
||||
hasContent,
|
||||
rawLen: raw.length,
|
||||
activeResourceId: activeResourceIdRef.current,
|
||||
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
|
||||
activeFileCtx: activeFileContextRef.current,
|
||||
seq: parsed.seq,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H4',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
|
||||
if (existingFileMatch) {
|
||||
setActiveResourceId(matchedResourceId)
|
||||
setResources((rs) => rs.filter((resource) => resource.id !== 'streaming-file'))
|
||||
@@ -1132,26 +1076,6 @@ export function useChat(
|
||||
if (fileId || fileName) {
|
||||
activeFileContextRef.current = { fileId, fileName }
|
||||
}
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:create_file_result',
|
||||
message: 'create_file result processed',
|
||||
data: {
|
||||
toolName: tc.name,
|
||||
fileId,
|
||||
fileName,
|
||||
status: tc.status,
|
||||
activeFileCtx: activeFileContextRef.current,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H5',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
}
|
||||
|
||||
if (isWorkflowToolName(tc.name)) {
|
||||
@@ -1160,27 +1084,6 @@ export function useChat(
|
||||
|
||||
if (tc.name === WorkspaceFile.id) {
|
||||
const fileResource = extractedResources.find((r) => r.type === 'file')
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:workspace_file_result_cleanup',
|
||||
message: 'workspace_file result cleanup',
|
||||
data: {
|
||||
toolCallId: id,
|
||||
activeResourceIdBefore: activeResourceIdRef.current,
|
||||
streamingFileExists: !!streamingFileRef.current,
|
||||
fileResourceId: fileResource?.id,
|
||||
fileResourceTitle: fileResource?.title,
|
||||
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H6',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
if (fileResource) {
|
||||
setResources((rs) => {
|
||||
const without = rs.filter((r) => r.id !== 'streaming-file')
|
||||
@@ -1221,6 +1124,8 @@ export function useChat(
|
||||
const chunkTitle = innerArgs?.title as string | undefined
|
||||
if (chunkTitle) {
|
||||
displayTitle = `Writing ${chunkTitle}`
|
||||
} else if (activeFileContextRef.current?.fileName) {
|
||||
displayTitle = `Writing ${activeFileContextRef.current.fileName}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1385,26 +1290,6 @@ export function useChat(
|
||||
blocks.push({ type: 'subagent', content: name })
|
||||
}
|
||||
if (name === FileWrite.id) {
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:file_write_span_start',
|
||||
message: 'file_write span start',
|
||||
data: {
|
||||
parentToolCallId,
|
||||
activeResourceIdBefore: activeResourceIdRef.current,
|
||||
existingStreamingFile: streamingFileRef.current,
|
||||
activeFileCtx: activeFileContextRef.current,
|
||||
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H7',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
const emptyFile = { fileName: '', content: '' }
|
||||
streamingFileRef.current = emptyFile
|
||||
setStreamingFile(emptyFile)
|
||||
@@ -1415,28 +1300,6 @@ export function useChat(
|
||||
break
|
||||
}
|
||||
if (streamingFileRef.current) {
|
||||
// #region agent log
|
||||
fetch('http://127.0.0.1:7774/ingest/b056eec6-a1ee-457f-8556-85f94314ca06', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '6f10b0' },
|
||||
body: JSON.stringify({
|
||||
sessionId: '6f10b0',
|
||||
location: 'use-chat.ts:file_write_span_end',
|
||||
message: 'file_write span end clear',
|
||||
data: {
|
||||
activeResourceIdBefore: activeResourceIdRef.current,
|
||||
streamingFileBefore: streamingFileRef.current,
|
||||
lastRealFileId: resourcesRef.current.find(
|
||||
(r: { type: string; id: string }) =>
|
||||
r.type === 'file' && r.id !== 'streaming-file'
|
||||
)?.id,
|
||||
resourceIds: resourcesRef.current.map((r: { id: string }) => r.id),
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
hypothesisId: 'H8',
|
||||
}),
|
||||
}).catch(() => {})
|
||||
// #endregion
|
||||
setStreamingFile(null)
|
||||
streamingFileRef.current = null
|
||||
const lastFileResource = resourcesRef.current.find(
|
||||
|
||||
@@ -136,46 +136,6 @@ export async function runStreamLoop(
|
||||
return
|
||||
}
|
||||
|
||||
if (streamEvent.type === MothershipStreamV1EventType.tool) {
|
||||
const tp = streamEvent.payload as Record<string, unknown> | undefined
|
||||
if (tp?.phase === 'args_delta' && tp?.toolName === 'workspace_file') {
|
||||
logger.info('[file-stream] args_delta FROM GO', {
|
||||
toolCallId: tp.toolCallId,
|
||||
deltaLen:
|
||||
typeof tp.argumentsDelta === 'string' ? (tp.argumentsDelta as string).length : 0,
|
||||
scope: streamEvent.scope?.agentId,
|
||||
parentToolCallId: streamEvent.scope?.parentToolCallId,
|
||||
})
|
||||
}
|
||||
if (tp?.phase === 'call' && tp?.toolName === 'workspace_file') {
|
||||
logger.info('[file-stream] workspace_file CALL event', {
|
||||
toolCallId: tp.toolCallId,
|
||||
phase: tp.phase,
|
||||
status: tp.status,
|
||||
hasArgs: !!tp.arguments,
|
||||
})
|
||||
}
|
||||
if (tp?.phase === 'result' && tp?.toolName === 'workspace_file') {
|
||||
const resultData = tp.result as Record<string, unknown> | undefined
|
||||
const innerData = resultData?.data as Record<string, unknown> | undefined
|
||||
logger.info('[file-stream] workspace_file RESULT', {
|
||||
toolCallId: tp.toolCallId,
|
||||
success: tp.success,
|
||||
fileId: innerData?.id,
|
||||
fileName: innerData?.name,
|
||||
})
|
||||
}
|
||||
}
|
||||
if (streamEvent.type === MothershipStreamV1EventType.span) {
|
||||
const sp = streamEvent.payload as Record<string, unknown> | undefined
|
||||
if (sp?.agent === 'file_write') {
|
||||
logger.info('[file-stream] file_write SPAN', {
|
||||
event: sp.event,
|
||||
parentToolCallId: streamEvent.scope?.parentToolCallId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await options.onEvent?.(streamEvent)
|
||||
} catch (error) {
|
||||
|
||||
@@ -83,16 +83,6 @@ export class StreamWriter {
|
||||
}
|
||||
|
||||
publish(event: StreamEvent): void {
|
||||
const payload = event.payload as Record<string, unknown> | undefined
|
||||
if (event.type === MothershipStreamV1EventType.tool && payload?.toolName === 'workspace_file') {
|
||||
logger.info('[file-stream] PUBLISH to client', {
|
||||
seq: this.nextSeq + 1,
|
||||
phase: payload.phase,
|
||||
toolCallId: payload.toolCallId,
|
||||
disconnected: this._clientDisconnected,
|
||||
hasController: !!this.controller,
|
||||
})
|
||||
}
|
||||
const envelope = this.createEnvelope(event)
|
||||
this.enqueue(envelope)
|
||||
this.queuePersistence(envelope)
|
||||
|
||||
Reference in New Issue
Block a user