opencode-self-improvement 0.3.5 → 0.3.6
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.
- package/package.json +1 -1
- package/src/viewer/server.ts +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-self-improvement",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Durable memory for opencode: remember facts, decisions, and commands across sessions, plus a one-command per-repo setup (/repo-init).",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"exports": {
|
package/src/viewer/server.ts
CHANGED
|
@@ -125,11 +125,20 @@ export async function startViewer(port: number = PORT): Promise<ViewerServer> {
|
|
|
125
125
|
const server = serve({
|
|
126
126
|
hostname: HOST,
|
|
127
127
|
port,
|
|
128
|
+
// Without this, an uncaught throw gets Bun's development error page, which
|
|
129
|
+
// includes the stack trace and local file paths. The stack still goes to
|
|
130
|
+
// the terminal.
|
|
131
|
+
error: (e) => {
|
|
132
|
+
console.error(e);
|
|
133
|
+
return error("internal error", 500);
|
|
134
|
+
},
|
|
128
135
|
fetch(req, srv) {
|
|
129
136
|
// Bun builds req.url from the request's Host header. A malformed Host
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
137
|
+
// (`127.0.0.1.8787`, an out-of-range port, `exa mple`) makes it
|
|
138
|
+
// unparseable, and the URL parse THROWs — before rejectRequest could
|
|
139
|
+
// answer. Letting that escape hands the caller Bun's dev error page
|
|
140
|
+
// (stack + absolute paths), so the parse itself is the first guarded
|
|
141
|
+
// step (issue #12).
|
|
133
142
|
let url: URL;
|
|
134
143
|
try {
|
|
135
144
|
url = new URL(req.url);
|