@rubytech/create-maxy 1.0.730 → 1.0.732
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/payload/server/server.js +33 -0
package/package.json
CHANGED
package/payload/server/server.js
CHANGED
|
@@ -7822,6 +7822,7 @@ var session_default2 = app10;
|
|
|
7822
7822
|
|
|
7823
7823
|
// server/routes/admin/chat.ts
|
|
7824
7824
|
import { resolve as resolve12 } from "path";
|
|
7825
|
+
import { appendFileSync as appendFileSync4 } from "fs";
|
|
7825
7826
|
|
|
7826
7827
|
// app/lib/script-stream-tailer.ts
|
|
7827
7828
|
import * as childProcess from "child_process";
|
|
@@ -8260,6 +8261,38 @@ app11.post("/", requireAdminSession, async (c) => {
|
|
|
8260
8261
|
const sk = sseConvId?.slice(0, 8) ?? session_key.slice(0, 8);
|
|
8261
8262
|
let tailer = null;
|
|
8262
8263
|
const readable = new ReadableStream({
|
|
8264
|
+
// Task 606 — fires when the consumer (Hono's response writer / Node
|
|
8265
|
+
// adapter) cancels the stream because the client disconnected. This is
|
|
8266
|
+
// the only signal that arrives WHILE start()'s for-await is blocked
|
|
8267
|
+
// awaiting the SDK's next message — c.req.raw.signal didn't propagate
|
|
8268
|
+
// under @hono/node-server, and controller.enqueue throwing only
|
|
8269
|
+
// surfaces on the next yielded event (which never comes if the model
|
|
8270
|
+
// is mid-response when Cancel is pressed). cancel() is the load-bearing
|
|
8271
|
+
// hook for operator abort.
|
|
8272
|
+
//
|
|
8273
|
+
// Synchronous trace writes go to BOTH the per-conv stream log (where
|
|
8274
|
+
// operators read) AND console.error (server.log backstop). This lets
|
|
8275
|
+
// us prove definitively whether this callback is even being invoked
|
|
8276
|
+
// by @hono/node-server on disconnect.
|
|
8277
|
+
cancel(reason) {
|
|
8278
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
|
|
8279
|
+
const reasonStr = typeof reason === "string" ? reason : reason instanceof Error ? reason.message : "consumer-cancelled";
|
|
8280
|
+
const cancelLine = `[${(/* @__PURE__ */ new Date()).toISOString()}] [stream-cancel-callback] sessionKey=${session_key.slice(0, 12)}\u2026 reason=${JSON.stringify(reasonStr)}
|
|
8281
|
+
`;
|
|
8282
|
+
try {
|
|
8283
|
+
const cancelLogKey = sseConvId ?? preflushStreamLogKey(session_key);
|
|
8284
|
+
const path2 = resolve12(account.accountDir, "logs", `claude-agent-stream-${cancelLogKey}.log`);
|
|
8285
|
+
appendFileSync4(path2, cancelLine);
|
|
8286
|
+
} catch {
|
|
8287
|
+
}
|
|
8288
|
+
console.error(cancelLine.trimEnd());
|
|
8289
|
+
sseLog.write(`[${ts}] [${sk}] admin: CANCEL [stream-cancel] reason=${reasonStr}
|
|
8290
|
+
`);
|
|
8291
|
+
interruptClient(session_key).catch((err) => {
|
|
8292
|
+
sseLog.write(`[${ts}] [${sk}] admin: ABORT [interrupt-failed] ${err instanceof Error ? err.message : String(err)}
|
|
8293
|
+
`);
|
|
8294
|
+
});
|
|
8295
|
+
},
|
|
8263
8296
|
async start(controller) {
|
|
8264
8297
|
let controllerOpen = true;
|
|
8265
8298
|
const sseEntry = { controller, conversationId: sseConvId ?? null, sessionKey: session_key };
|