pi-web-ui 0.114.0 → 0.114.1
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/CHANGELOG.md +28 -0
- package/README.md +187 -187
- package/README.zh-CN.md +227 -227
- package/README.zh-TW.md +227 -227
- package/bin/device-hub-cli.mjs +577 -577
- package/bin/frp-manager.mjs +1573 -1573
- package/bin/pi-device-hub.mjs +9 -9
- package/bin/pi-web-ui.mjs +4081 -4073
- package/deploy/nginx-subpath.conf +100 -100
- package/deploy/pi-web-ui.service +36 -36
- package/dist/server/agent-service.js +131 -55
- package/dist/server/attachments.js +51 -5
- package/dist/server/canvas/canvas-agent-tool.js +3 -3
- package/dist/server/canvas/canvas-cards.js +1 -1
- package/dist/server/canvas/canvas-orchestrator.js +3 -3
- package/dist/server/canvas/canvas-scheduled-task.js +45 -0
- package/dist/server/canvas/canvas-validation.js +1 -1
- package/dist/server/client-state.js +6 -2
- package/dist/server/compaction-instructions.js +8 -8
- package/dist/server/device-center/connector.js +33 -14
- package/dist/server/device-center/desktop-page.js +228 -228
- package/dist/server/device-center/hub-page.js +64 -64
- package/dist/server/device-center/hub.js +2 -1
- package/dist/server/device-center/local-hub.js +92 -0
- package/dist/server/device-center/local.js +60 -7
- package/dist/server/device-center/native-desktop/macos.js +190 -190
- package/dist/server/device-center/native-desktop/windows.js +116 -116
- package/dist/server/device-center/path-portal.js +1 -1
- package/dist/server/device-center/relay.js +45 -8
- package/dist/server/dispatch-domain-handlers.js +1 -0
- package/dist/server/dsh/dsh-agent-service.js +5 -1
- package/dist/server/dsh/runtime/cordis.yml +1 -1
- package/dist/server/dsh/runtime/custom-prompt.mjs +33 -33
- package/dist/server/dsh/runtime/goal-rpc.mjs +1309 -1309
- package/dist/server/dsh/runtime/launcher.mjs +235 -235
- package/dist/server/dsh/runtime/override.patch.yml +89 -89
- package/dist/server/dsh/runtime/runtime-root.mjs +405 -405
- package/dist/server/engine-probe.js +36 -6
- package/dist/server/eval-tool.js +135 -135
- package/dist/server/global-loader.js +40 -2
- package/dist/server/index.js +56 -32
- package/dist/server/patch-bash-process.js +125 -0
- package/dist/server/patch-tool.js +9 -9
- package/dist/server/patch-turn-end-boundary.js +3 -3
- package/dist/server/persona-chain.js +8 -8
- package/dist/server/plugins.js +26 -2
- package/dist/server/preset-fields.js +7 -0
- package/dist/server/preset-share.js +1 -0
- package/dist/server/prompt-templates.js +106 -0
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/remote-ssh-service.js +39 -39
- package/dist/server/resolve-global-sdk.js +2 -0
- package/dist/server/schedule-agent-tool.js +39 -21
- package/dist/server/scheduler-tasks.js +45 -9
- package/dist/server/scm-commitmsg.js +10 -10
- package/dist/server/settings-service.js +6 -0
- package/dist/server/setup-page.js +620 -620
- package/dist/server/text-quote.js +9 -0
- package/dist/server/tool-manager.js +2 -1
- package/dist/server/universal/drivers/claude-code.js +5 -0
- package/dist/server/universal/drivers/codex.js +336 -0
- package/dist/server/universal/index.js +1 -0
- package/dist/server/universal/universal-attachments.js +24 -1
- package/dist/server/universal/universal-session.js +23 -0
- package/dist/server/vision-bridge.js +18 -18
- package/docs/device-center.md +148 -142
- package/docs/device-desktop.md +48 -48
- package/docs/dsh-engine.md +493 -493
- package/extensions/webui.ts +335 -335
- package/package.json +2 -2
- package/plugin-sdk/README.md +174 -174
- package/plugin-sdk/client-utils.mjs +279 -279
- package/plugin-sdk/import-check.mjs +210 -210
- package/plugin-sdk/index.d.ts +698 -698
- package/plugin-sdk/index.mjs +696 -696
- package/plugin-sdk/package.json +13 -13
- package/plugin-sdk/ssh-host-trust.mjs +225 -225
- package/plugins/catalog.json +10 -0
- package/themes/aetheris.css +501 -501
- package/themes/ayu-light.css +116 -116
- package/themes/bases/flow-base.css +1357 -1357
- package/themes/bases/obsidian-base.css +895 -895
- package/themes/bases/statusbar-flat-base.css +112 -112
- package/themes/bases/zhujian-base.css +688 -688
- package/themes/bases/zhupi-base.css +660 -660
- package/themes/catppuccin-latte.css +119 -119
- package/themes/catppuccin.css +116 -116
- package/themes/claude-code-dark.css +147 -147
- package/themes/codex.css +114 -114
- package/themes/cyberpunk.css +50 -50
- package/themes/dark-teal.css +264 -264
- package/themes/dazzle.css +38 -38
- package/themes/everforest-light.css +115 -115
- package/themes/flow-light.css +164 -164
- package/themes/flow.css +161 -161
- package/themes/geist.css +114 -114
- package/themes/gruvbox-light.css +115 -115
- package/themes/kanagawa-lotus.css +115 -115
- package/themes/md-preview.css +24 -24
- package/themes/mist.css +166 -166
- package/themes/nord.css +107 -107
- package/themes/one-dark.css +106 -106
- package/themes/paper.css +174 -174
- package/themes/rose-pine-dawn.css +114 -114
- package/themes/sakura.css +166 -166
- package/themes/solarized-light.css +114 -114
- package/themes/tokyo-night.css +115 -115
- package/themes/translucent.css +85 -85
- package/themes/transparent.css +116 -116
- package/themes/vs-code-dark.css +147 -147
- package/themes/wallpaper-flow.css +382 -382
- package/themes/wallpaper-obsidian.css +74 -74
- package/themes/white.css +164 -164
- package/themes/zhujian-dark.css +115 -115
- package/themes/zhujian.css +114 -114
- package/themes/zhupi-dark.css +115 -115
- package/themes/zhupi.css +114 -114
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BcXJ20RO.js +1 -0
- package/web/dist/assets/BgTasksModal-DjQmiKnE.js +1 -0
- package/web/dist/assets/{CanvasStudio-BEJZE5BI.js → CanvasStudio-PI9pid0Y.js} +3 -3
- package/web/dist/assets/{CanvasStudio-CgUNHqos.js → CanvasStudio-nf5-HxLM.js} +3 -3
- package/web/dist/assets/DeviceCenter-CYttJw2a.js +3 -0
- package/web/dist/assets/DeviceCenter-DPe4sz74.js +3 -0
- package/web/dist/assets/DeviceGroups-D2rogxEN.js +1 -0
- package/web/dist/assets/Dropdown-ZLS04O8p.js +1 -0
- package/web/dist/assets/FilePreview-C9Ut4Lq6.js +2 -0
- package/web/dist/assets/FilePreview-CvK3ZzX5.js +2 -0
- package/web/dist/assets/GlobalSearchModal-C5e-OCw2.js +1 -0
- package/web/dist/assets/GlobalSearchModal-H7pFK2UC.js +1 -0
- package/web/dist/assets/GroupConversation-C2wNM0dQ.js +1 -0
- package/web/dist/assets/GroupConversation-ChN3TWQK.js +1 -0
- package/web/dist/assets/ModelConfigModal-DDZccDYt.js +2 -0
- package/web/dist/assets/PiSetupModal-DHbqfx8T.js +1 -0
- package/web/dist/assets/ProviderOAuthControls-C-MK36Dk.js +1 -0
- package/web/dist/assets/SCMPanel-buTGziDB.js +2 -0
- package/web/dist/assets/SCMPanel-kx-SCL2s.js +2 -0
- package/web/dist/assets/SettingsModal-BsUF8jqr.js +20 -0
- package/web/dist/assets/SettingsModal-D357Ky7P.js +20 -0
- package/web/dist/assets/{TerminalPanel-DL20uKgU.js → TerminalPanel-BBuM_Sez.js} +2 -2
- package/web/dist/assets/{TerminalPanel-D6cPRFei.js → TerminalPanel-D6x6xz8Q.js} +2 -2
- package/web/dist/assets/TuiOverlayModal-CdbGV3Za.js +1 -0
- package/web/dist/assets/TuiOverlayModal-d6x9u25n.js +1 -0
- package/web/dist/assets/app-globals-DcyO0UPi.js +1 -0
- package/web/dist/assets/{desktop-DPyTy4M3.js → desktop-YguLbrX1.js} +1 -1
- package/web/dist/assets/fi-DaSO0Q-m.js +325 -0
- package/web/dist/assets/index-BPvpea8t.js +85 -0
- package/web/dist/assets/index-D6u8xH0o.js +85 -0
- package/web/dist/assets/index-DDZMv6LO.css +1 -0
- package/web/dist/assets/{plugin-host-CqA4yW6w.js → plugin-host-BRBg6zmQ.js} +1 -1
- package/web/dist/assets/theme-DDl-Oy1b.js +1 -0
- package/web/dist/index.html +37 -36
- package/web/dist/sw.js +179 -179
- package/web/public/sw.js +179 -179
- package/dist/gh-comment-781.md +0 -5
- package/dist/server/device-center/local-page.js +0 -17
- package/dist/server/device-center/smoke-preview.js +0 -3
- package/dist/server/durable/durable-capabilities.js +0 -11
- package/dist/server/markers/builtins/services.js +0 -123
- package/dist/server/markers/builtins/todo.js +0 -189
- package/dist/server/markers-list-tool.js +0 -34
- package/dist/server/orchestrator.js +0 -109
- package/dist/server/system-prompt-soul.js +0 -41
- package/dist/server/univer-service.js +0 -448
- package/dist/server/universal/drivers/dsh-driver.js +0 -379
- package/dist/test-artifact.md +0 -9
- package/dist/test-preview-modal.md +0 -11
- package/dist/test-report.html +0 -20
- package/web/dist/assets/BgTasksModal-CS7UNzcw.js +0 -1
- package/web/dist/assets/BgTasksModal-Dk-tp78W.js +0 -1
- package/web/dist/assets/DeviceCenter-C8_CbxQ3.js +0 -3
- package/web/dist/assets/DeviceCenter-CVblvhNX.js +0 -3
- package/web/dist/assets/Dropdown-Oug0DDte.js +0 -1
- package/web/dist/assets/FilePreview-CvdX6nr6.js +0 -2
- package/web/dist/assets/FilePreview-kCZhfBAF.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BLH63yYP.js +0 -1
- package/web/dist/assets/GlobalSearchModal-DAkvlvp6.js +0 -1
- package/web/dist/assets/GroupConversation-Cgo4xbpa.js +0 -1
- package/web/dist/assets/GroupConversation-DZ71jEi8.js +0 -1
- package/web/dist/assets/ModelConfigModal-BpWdFdQC.js +0 -2
- package/web/dist/assets/PiSetupModal-mkWPSxMj.js +0 -1
- package/web/dist/assets/ProviderOAuthControls-VK_jqXYS.js +0 -1
- package/web/dist/assets/SCMPanel-BP1TUT-V.js +0 -2
- package/web/dist/assets/SCMPanel-BscPm9kf.js +0 -2
- package/web/dist/assets/SettingsModal-C8UgMjVM.js +0 -20
- package/web/dist/assets/SettingsModal-VynB7jNb.js +0 -20
- package/web/dist/assets/TuiOverlayModal-Dst3BmT8.js +0 -1
- package/web/dist/assets/TuiOverlayModal-NCkpNtTp.js +0 -1
- package/web/dist/assets/UniversalPathPicker-CfQFc_c3.js +0 -1
- package/web/dist/assets/UniversalPathPicker-DwxwNcFw.js +0 -1
- package/web/dist/assets/app-globals-CnO6KlEM.js +0 -325
- package/web/dist/assets/index-CPgAH5q7.js +0 -83
- package/web/dist/assets/index-Cje8iugL.js +0 -83
- package/web/dist/assets/index-DnKeiDbj.css +0 -1
- package/web/dist/assets/theme-BqdAjEjF.js +0 -1
|
@@ -45,7 +45,7 @@ export function transformPortalHtml(html, base) {
|
|
|
45
45
|
const content = html
|
|
46
46
|
.replace(/<base\b[^>]*>/gi, "")
|
|
47
47
|
.replace(/\b(src|href|action|poster)\s*=\s*(["'])\/(?!\/)([^"']*)\2/gi, (_all, name, quote, path) => `${name}=${quote}${base}${path}${quote}`);
|
|
48
|
-
const ready = `<script>const
|
|
48
|
+
const ready = `<script>(()=>{let ready=false,banner;const update=()=>{const root=document.getElementById('root'),status=document.querySelector('.status-conn');if(!ready&&((root&&root.childElementCount)||(!root&&document.readyState==='complete'))){ready=true;parent.postMessage({type:'device-portal-ready'},'*')}if(!ready||!status)return;if(!banner){banner=document.createElement('div');banner.setAttribute('role','status');banner.style.cssText='position:fixed;top:8px;left:50%;transform:translateX(-50%);z-index:2147483647;max-width:90vw;padding:8px 12px;border-radius:8px;background:#303137;color:#eee;font:13px system-ui;box-shadow:0 2px 12px #0006';banner.textContent='连接已断开,正在自动重试,请稍候… / Disconnected. Retrying automatically, please wait…';document.body.append(banner)}banner.hidden=status.classList.contains('ok')};setInterval(update,200);update()})();</script>`;
|
|
49
49
|
return `<!doctype html><base href="${base}">` + content.replace(/<!doctype[^>]*>/i, "") + ready;
|
|
50
50
|
}
|
|
51
51
|
/** Only the entry HTML is collected; every other body retains relay streaming. */
|
|
@@ -98,7 +98,7 @@ export function safePath(path, method = "GET") {
|
|
|
98
98
|
if (normalized === "/api/device-center" || normalized.startsWith("/api/device-center/")) {
|
|
99
99
|
// Only account-scoped chat routes may cross a device portal.
|
|
100
100
|
if (method === "GET") {
|
|
101
|
-
return /^\/api\/device-center\/(devices|bots|rooms(?:\/[^/]+)?)$/.test(normalized);
|
|
101
|
+
return /^\/api\/device-center\/(chat-status|devices|bots|rooms(?:\/[^/]+)?)$/.test(normalized);
|
|
102
102
|
}
|
|
103
103
|
if (method === "POST")
|
|
104
104
|
return /^\/api\/device-center\/rooms(?:\/[^/]+\/(messages|rename|members|delete))?$/.test(normalized);
|
|
@@ -401,6 +401,26 @@ export function createDeviceRelay(options) {
|
|
|
401
401
|
if (!["http:", "https:"].includes(hub.protocol) || hub.pathname !== "/" || hub.search)
|
|
402
402
|
throw new Error("publicUrl must be an HTTP(S) root origin");
|
|
403
403
|
const devices = new Map();
|
|
404
|
+
// Slow browser responses apply transport backpressure instead of losing resource bodies.
|
|
405
|
+
const stalledResponses = new WeakMap();
|
|
406
|
+
function pauseForResponse(ws, res) {
|
|
407
|
+
let stalled = stalledResponses.get(ws);
|
|
408
|
+
if (!stalled)
|
|
409
|
+
stalledResponses.set(ws, (stalled = new Set()));
|
|
410
|
+
if (stalled.has(res))
|
|
411
|
+
return;
|
|
412
|
+
stalled.add(res);
|
|
413
|
+
ws.pause();
|
|
414
|
+
const resume = () => {
|
|
415
|
+
res.off("drain", resume);
|
|
416
|
+
res.off("close", resume);
|
|
417
|
+
stalled.delete(res);
|
|
418
|
+
if (!stalled.size && ws.readyState === WebSocket.OPEN)
|
|
419
|
+
ws.resume();
|
|
420
|
+
};
|
|
421
|
+
res.once("drain", resume);
|
|
422
|
+
res.once("close", resume);
|
|
423
|
+
}
|
|
404
424
|
const tickets = new Map();
|
|
405
425
|
const sessions = new Map();
|
|
406
426
|
const capabilities = new Map();
|
|
@@ -412,7 +432,7 @@ export function createDeviceRelay(options) {
|
|
|
412
432
|
session.deviceId === id &&
|
|
413
433
|
session.expiresAt > Date.now() &&
|
|
414
434
|
path?.path &&
|
|
415
|
-
safePath(path.path,
|
|
435
|
+
(!websocket || safePath(path.path, "WS")) &&
|
|
416
436
|
(!req.headers.origin || req.headers.origin === "null") &&
|
|
417
437
|
(!websocket || req.headers.origin === "null"));
|
|
418
438
|
}
|
|
@@ -642,22 +662,38 @@ export function createDeviceRelay(options) {
|
|
|
642
662
|
res.writeHead(204, portalHeaders(hub, capabilityBase(id, path.token))).end();
|
|
643
663
|
return true;
|
|
644
664
|
}
|
|
665
|
+
// Only authenticated capability requests receive opaque-origin response headers.
|
|
666
|
+
if (path) {
|
|
667
|
+
for (const [key, value] of Object.entries(portalHeaders(hub, capabilityBase(id, path.token))))
|
|
668
|
+
res.setHeader(key, value);
|
|
669
|
+
}
|
|
670
|
+
const forwardPath = path ? path.path : req.url;
|
|
671
|
+
// Serve account binding at the Hub, including compatibility for older device UIs.
|
|
672
|
+
// Never forward the local management status endpoint or expose its settings.
|
|
673
|
+
if (path &&
|
|
674
|
+
req.method === "GET" &&
|
|
675
|
+
["/api/device-center/chat-status", "/api/device-center/status"].includes(forwardPath?.split("?")[0] ?? "")) {
|
|
676
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
677
|
+
res.end(JSON.stringify({ hubUrl: hub.origin, deviceId: id }));
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
645
680
|
const entry = devices.get(id);
|
|
646
681
|
if (!entry || entry.streams.size >= RELAY_LIMITS.streams) {
|
|
647
682
|
res.writeHead(503).end();
|
|
648
683
|
return true;
|
|
649
684
|
}
|
|
650
|
-
const forwardPath = path ? path.path : req.url;
|
|
651
685
|
if (!safePath(forwardPath, req.method)) {
|
|
652
686
|
res.writeHead(400).end();
|
|
653
687
|
return true;
|
|
654
688
|
}
|
|
689
|
+
// Only entry documents are rewritten; preserve negotiated compression for assets.
|
|
690
|
+
const rewriteHtml = !!path && ["/", "/desktop"].includes(path.path.split("?")[0]);
|
|
655
691
|
const streamId = randomBytes(12).toString("hex");
|
|
656
692
|
addStream(entry, streamId, {
|
|
657
693
|
res,
|
|
658
694
|
...(path
|
|
659
695
|
? {
|
|
660
|
-
portal: createPortalResponse(res, hub, capabilityBase(id, path.token),
|
|
696
|
+
portal: createPortalResponse(res, hub, capabilityBase(id, path.token), rewriteHtml),
|
|
661
697
|
}
|
|
662
698
|
: {}),
|
|
663
699
|
});
|
|
@@ -667,7 +703,7 @@ export function createDeviceRelay(options) {
|
|
|
667
703
|
id: streamId,
|
|
668
704
|
method: req.method,
|
|
669
705
|
path: forwardPath,
|
|
670
|
-
headers: { ...cleanHeaders(req.headers), ...(
|
|
706
|
+
headers: { ...cleanHeaders(req.headers), ...(rewriteHtml ? { "accept-encoding": "identity" } : {}) },
|
|
671
707
|
});
|
|
672
708
|
req.on("data", (chunk) => {
|
|
673
709
|
bytes += chunk.length;
|
|
@@ -828,12 +864,13 @@ export function createDeviceRelay(options) {
|
|
|
828
864
|
else if (item.res?.headersSent)
|
|
829
865
|
item.res.write(data);
|
|
830
866
|
}
|
|
831
|
-
if (item.bytes > RELAY_LIMITS.body ||
|
|
832
|
-
(!item.portal && !item.res?.headersSent) ||
|
|
833
|
-
item.res.writableLength > RELAY_LIMITS.queue) {
|
|
867
|
+
if (item.bytes > RELAY_LIMITS.body || (!item.portal && !item.res?.headersSent)) {
|
|
834
868
|
item.res?.destroy();
|
|
835
869
|
sendFrame(ws, { type: "cancel", id: frame.id });
|
|
836
870
|
}
|
|
871
|
+
else if (item.res && item.res.writableLength > RELAY_LIMITS.queue / 2) {
|
|
872
|
+
pauseForResponse(ws, item.res);
|
|
873
|
+
}
|
|
837
874
|
}
|
|
838
875
|
else if (frame.type === "response_end" || frame.type === "error") {
|
|
839
876
|
if (frame.type === "error")
|
|
@@ -650,6 +650,7 @@ export function handleSettingsMessage(msg, cs, send) {
|
|
|
650
650
|
editSoftEnabled: msg.editSoftEnabled,
|
|
651
651
|
questionnaireEnabled: msg.questionnaireEnabled,
|
|
652
652
|
questionPresentation: msg.questionPresentation,
|
|
653
|
+
toolApprovalPresentation: msg.toolApprovalPresentation,
|
|
653
654
|
questionTimeoutSeconds: msg.questionTimeoutSeconds,
|
|
654
655
|
parallelReminderEnabled: msg.parallelReminderEnabled,
|
|
655
656
|
goalModeEnabled: msg.goalModeEnabled,
|
|
@@ -41,7 +41,7 @@ import { assertEngineWorkspaceSupported } from "../sandbox-engines.js";
|
|
|
41
41
|
import { QuiesceRejectedError } from "../agent-service.js";
|
|
42
42
|
import { NATIVE_COMMANDS, parseSlash } from "../slash-commands.js";
|
|
43
43
|
import { discoverDiskSkills, readSkillInstruction } from "../skill-discovery.js";
|
|
44
|
-
import { scanAtMentions, formatPromptWithSkills } from "../universal/universal-attachments.js";
|
|
44
|
+
import { scanAtMentions, formatPromptWithSkills, formatUnavailableCanvasReference, } from "../universal/universal-attachments.js";
|
|
45
45
|
import { bilingual, pick, resolveServerLang } from "../i18n.js";
|
|
46
46
|
import { ModelAdminService } from "../model-admin.js";
|
|
47
47
|
import { normalizeToolInfo, unsupportedToolInfo } from "../tool-info.js";
|
|
@@ -2184,6 +2184,10 @@ export class DshClientSession {
|
|
|
2184
2184
|
});
|
|
2185
2185
|
continue;
|
|
2186
2186
|
}
|
|
2187
|
+
if (a.mode === "canvas") {
|
|
2188
|
+
blocks.push({ type: "text", text: formatUnavailableCanvasReference(a) });
|
|
2189
|
+
continue;
|
|
2190
|
+
}
|
|
2187
2191
|
const resolved = a.path ? workspacePath(this.cwd, a.path) : null;
|
|
2188
2192
|
if (a.imageData) {
|
|
2189
2193
|
// 视觉桥:base64 图片 → attachment store → 真 image 块(模型可看图)。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[]
|
|
1
|
+
[]
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pi-web-ui custom prompt section (host plane).
|
|
3
|
-
*
|
|
4
|
-
* pi-web-ui 的自定义系统提示词在预设时代的载体:官方 preset 的 persona 行会
|
|
5
|
-
* shadow 掉部署人设(standard/ptc/cordis),minimal(complete:true)更压住一切,
|
|
6
|
-
* 所以沿用 system-prompt 行(DSH_PERSONA)已无法让用户的自定义提示词生效。
|
|
7
|
-
* 本行在 host plane 注册一个独立 section(deployment:persona-suffix 之后),
|
|
8
|
-
* standard/ptc/cordis 下随系统提示词下发,minimal 下被 complete 压住(官方语义)。
|
|
9
|
-
*
|
|
10
|
-
* 文本来自环境变量 PI_WEB_DSH_CUSTOM_PROMPT(Node 侧 dsh-agent-service 维护,
|
|
11
|
-
* 变化即重启运行时);为空时不注册任何 section。无 Config export(loader 允许,
|
|
12
|
-
* 与 dsh-tool-ask-user 同形)。
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const name = "pi-webui-custom-prompt";
|
|
16
|
-
const inject = ["systemPrompt"];
|
|
17
|
-
|
|
18
|
-
function apply(ctx) {
|
|
19
|
-
const text = (process.env.PI_WEB_DSH_CUSTOM_PROMPT ?? "").trim();
|
|
20
|
-
if (!text) return;
|
|
21
|
-
const order = ctx.systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_SUFFIX") + 50;
|
|
22
|
-
ctx.effect(
|
|
23
|
-
() =>
|
|
24
|
-
ctx.systemPrompt.section({
|
|
25
|
-
name: "pi-webui:custom-prompt",
|
|
26
|
-
order,
|
|
27
|
-
text,
|
|
28
|
-
}),
|
|
29
|
-
"pi-webui-custom-prompt.section()",
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { apply, inject, name };
|
|
1
|
+
/**
|
|
2
|
+
* pi-web-ui custom prompt section (host plane).
|
|
3
|
+
*
|
|
4
|
+
* pi-web-ui 的自定义系统提示词在预设时代的载体:官方 preset 的 persona 行会
|
|
5
|
+
* shadow 掉部署人设(standard/ptc/cordis),minimal(complete:true)更压住一切,
|
|
6
|
+
* 所以沿用 system-prompt 行(DSH_PERSONA)已无法让用户的自定义提示词生效。
|
|
7
|
+
* 本行在 host plane 注册一个独立 section(deployment:persona-suffix 之后),
|
|
8
|
+
* standard/ptc/cordis 下随系统提示词下发,minimal 下被 complete 压住(官方语义)。
|
|
9
|
+
*
|
|
10
|
+
* 文本来自环境变量 PI_WEB_DSH_CUSTOM_PROMPT(Node 侧 dsh-agent-service 维护,
|
|
11
|
+
* 变化即重启运行时);为空时不注册任何 section。无 Config export(loader 允许,
|
|
12
|
+
* 与 dsh-tool-ask-user 同形)。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const name = "pi-webui-custom-prompt";
|
|
16
|
+
const inject = ["systemPrompt"];
|
|
17
|
+
|
|
18
|
+
function apply(ctx) {
|
|
19
|
+
const text = (process.env.PI_WEB_DSH_CUSTOM_PROMPT ?? "").trim();
|
|
20
|
+
if (!text) return;
|
|
21
|
+
const order = ctx.systemPrompt.getSectionOrder("DEPLOYMENT_PERSONA_SUFFIX") + 50;
|
|
22
|
+
ctx.effect(
|
|
23
|
+
() =>
|
|
24
|
+
ctx.systemPrompt.section({
|
|
25
|
+
name: "pi-webui:custom-prompt",
|
|
26
|
+
order,
|
|
27
|
+
text,
|
|
28
|
+
}),
|
|
29
|
+
"pi-webui-custom-prompt.section()",
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { apply, inject, name };
|