@nextclaw/server 0.15.17 → 0.15.18
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/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { compress } from "hono/compress";
|
|
3
3
|
import { serve } from "@hono/node-server";
|
|
4
|
-
import { AccessManager, PanelAppError, isPanelAppError, isPreferenceError, isProjectError, isServiceAppError, isSessionContextCompactionError, isSessionMessageCursorError, isSessionSettingsError } from "@nextclaw/kernel";
|
|
4
|
+
import { AccessManager, PanelAppError, injectUiContentParamsBootstrap, isPanelAppError, isPreferenceError, isProjectError, isServiceAppError, isSessionContextCompactionError, isSessionMessageCursorError, isSessionSettingsError } from "@nextclaw/kernel";
|
|
5
5
|
import { WebSocket, WebSocketServer } from "ws";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { mkdir, open, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
@@ -461,6 +461,15 @@ const ingressKeys = {
|
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
463
|
//#endregion
|
|
464
|
+
//#region ../nextclaw-shared/src/utils/ui-content-params.utils.ts
|
|
465
|
+
const UI_CONTENT_PARAMS_HOST_CONTRACT = {
|
|
466
|
+
bootstrapQueryParam: "nextclawContentParams",
|
|
467
|
+
bootstrapQueryValue: "1",
|
|
468
|
+
maxDepth: 32,
|
|
469
|
+
maxSerializedBytes: 64 * 1024,
|
|
470
|
+
windowNamePrefix: "nextclaw:content-params:v1:"
|
|
471
|
+
};
|
|
472
|
+
//#endregion
|
|
464
473
|
//#region src/features/agents/stores/agents.store.ts
|
|
465
474
|
function listAgents(configPath) {
|
|
466
475
|
const config = loadConfig(configPath);
|
|
@@ -5480,7 +5489,8 @@ var ServerPathRoutesController = class {
|
|
|
5480
5489
|
sendContent = async (c, options) => {
|
|
5481
5490
|
try {
|
|
5482
5491
|
const payload = await readServerPathContent(options);
|
|
5483
|
-
|
|
5492
|
+
const content = payload.contentType.startsWith("text/html") && c.req.query(UI_CONTENT_PARAMS_HOST_CONTRACT.bootstrapQueryParam) === UI_CONTENT_PARAMS_HOST_CONTRACT.bootstrapQueryValue ? injectUiContentParamsBootstrap(payload.content.toString("utf8")) : payload.content;
|
|
5493
|
+
return new Response(content, { headers: {
|
|
5484
5494
|
"content-type": payload.contentType,
|
|
5485
5495
|
"cache-control": "no-store",
|
|
5486
5496
|
"content-disposition": `inline; filename*=UTF-8''${encodeContentDispositionFileName(payload.fileName)}`
|