GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode-codex-computer-use/src/debug.ts at main · malhashemi/opencode-codex-computer-use

Expand file tree

/

debug.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
33 lines (31 loc) · 1.31 KB
/

debug.ts

Copy path

File metadata and controls

33 lines (31 loc) · 1.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { appendFileSync, mkdirSync } from "node:fs"
import { dirname } from "node:path"
/**
* Appends every app-server message to a JSONL file. Screenshot data is replaced by its size; everything else
* (accessibility trees, page text, code) is written as is, so the log can contain sensitive data.
*/
export function trafficLogger(path: string, log: (message: string) => void) {
let failed = false
mkdirSync(dirname(path), { recursive: true })
return (direction: "send" | "receive", message: unknown) => {
if (failed) return
try {
appendFileSync(
path,
JSON.stringify({ time: new Date().toISOString(), direction, message: stripImages(message) }) + "\n",
)
} catch (error) {
failed = true
log(`debug log disabled, could not write ${path}: ${error instanceof Error ? error.message : String(error)}`)
}
}
}
export function stripImages(value: unknown): unknown {
if (Array.isArray(value)) return value.map(stripImages)
if (value === null || typeof value !== "object") return value
const record = value as Record<string, unknown>
if (record.type === "image" && typeof record.data === "string") {
return { ...record, data: `<${record.data.length} base64 chars>` }
}
return Object.fromEntries(Object.entries(record).map(([key, item]) => [key, stripImages(item)]))
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.