create-principles-disciple 1.145.36 → 1.145.37
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.
|
@@ -208,6 +208,10 @@ function asyncHandler(fn, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
|
208
208
|
return (innerReq, innerRes) => {
|
|
209
209
|
const timeoutId = setTimeout(() => {
|
|
210
210
|
if (!innerRes.headersSent) {
|
|
211
|
+
// The route keeps running after this point; record the real cause
|
|
212
|
+
// before any dropped late write, so the log never leads with a
|
|
213
|
+
// transport error (ERR_HTTP_HEADERS_SENT) instead of the timeout.
|
|
214
|
+
console.warn(`[pd-console] Request timed out after ${timeoutMs}ms: ${innerReq.method ?? 'GET'} ${innerReq.url ?? ''}`);
|
|
211
215
|
sendJson(innerRes, 504, { success: false, error: 'Request timeout' });
|
|
212
216
|
innerRes.end();
|
|
213
217
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export function sendJson(res, statusCode, payload) {
|
|
2
|
+
// A response can already be committed by an earlier writer — most often the
|
|
3
|
+
// request-timeout path in server/index.ts, which answers 504 while the route
|
|
4
|
+
// is still running. Writing again throws ERR_HTTP_HEADERS_SENT, which hides
|
|
5
|
+
// the first (real) failure behind a transport error. Drop the late write.
|
|
6
|
+
if (res.headersSent || res.writableEnded) {
|
|
7
|
+
console.warn(`[pd-console] Dropped late response write (status ${statusCode}): headers already sent`);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
2
10
|
const body = JSON.stringify(payload);
|
|
3
11
|
res.writeHead(statusCode, {
|
|
4
12
|
'Content-Type': 'application/json; charset=utf-8',
|
package/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/core",
|
|
3
|
-
"version": "1.297.
|
|
3
|
+
"version": "1.297.8",
|
|
4
4
|
"description": "Pure-logic core of Principles Disciple, an AI Agent Governance System - pain signal capture and principle proposal (no I/O)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/package.json
CHANGED