pi-web-ui 0.114.2 → 0.115.0
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 +55 -1
- package/bin/pi-web-ui.mjs +69 -7
- package/dist/server/agent-service-daemon.js +440 -32
- package/dist/server/agent-service.js +878 -383
- package/dist/server/canvas/canvas-dispatch.js +13 -1
- package/dist/server/client-state.js +25 -0
- package/dist/server/communicate-tool.js +2 -0
- package/dist/server/context-usage.js +105 -0
- package/dist/server/conversation-communication.js +14 -0
- package/dist/server/conversation-identity.js +27 -0
- package/dist/server/device-center/approval-summary.js +31 -0
- package/dist/server/device-center/bot-catalog.js +21 -7
- package/dist/server/device-center/bot-execution.js +72 -9
- package/dist/server/device-center/bot-presets.js +46 -0
- package/dist/server/device-center/collab-service.js +328 -10
- package/dist/server/device-center/collab-tool.js +738 -12
- package/dist/server/device-center/connector.js +359 -23
- package/dist/server/device-center/desktop-page.js +22 -16
- package/dist/server/device-center/device-integration.js +595 -0
- package/dist/server/device-center/execution-guides.js +32 -0
- package/dist/server/device-center/execution-instructions.js +19 -0
- package/dist/server/device-center/execution-settings.js +100 -0
- package/dist/server/device-center/execution-system-prompt.js +38 -0
- package/dist/server/device-center/execution-workspace.js +20 -0
- package/dist/server/device-center/executor.js +389 -40
- package/dist/server/device-center/file-sync-paths.js +171 -0
- package/dist/server/device-center/file-sync.js +180 -91
- package/dist/server/device-center/group-context-delta.js +37 -0
- package/dist/server/device-center/group-context-message.js +208 -0
- package/dist/server/device-center/group-context.js +109 -0
- package/dist/server/device-center/group-events.js +136 -0
- package/dist/server/device-center/group-plan-guard.js +138 -0
- package/dist/server/device-center/hub-conversations.js +178 -0
- package/dist/server/device-center/hub-deliveries.js +277 -0
- package/dist/server/device-center/hub-integration.js +451 -0
- package/dist/server/device-center/hub.js +1544 -80
- package/dist/server/device-center/human-interaction.js +232 -0
- package/dist/server/device-center/integration-errors.js +25 -0
- package/dist/server/device-center/local-hub.js +18 -0
- package/dist/server/device-center/local.js +356 -40
- package/dist/server/device-center/main.js +11 -1
- package/dist/server/device-center/path-portal.js +11 -3
- package/dist/server/device-center/relay.js +364 -35
- package/dist/server/device-center/report-metadata.js +66 -0
- package/dist/server/device-center/report-upload.js +63 -0
- package/dist/server/device-center/runtime.js +549 -41
- package/dist/server/device-center/store.js +66 -3
- package/dist/server/device-center/task-context-budget.js +161 -0
- package/dist/server/device-center/task-journal.js +385 -0
- package/dist/server/device-center/task-plan.js +33 -0
- package/dist/server/device-center/task-progress.js +141 -0
- package/dist/server/device-center/task-recovery.js +452 -0
- package/dist/server/device-center/task-report-outbox.js +216 -0
- package/dist/server/device-center/task-report.js +384 -0
- package/dist/server/device-center/task-scheduler.js +400 -0
- package/dist/server/device-center/task-state.js +333 -0
- package/dist/server/device-center/transfer-stream.js +1006 -0
- package/dist/server/device-center/transfers.js +815 -8
- package/dist/server/dispatch-domain-handlers.js +21 -3
- package/dist/server/dsh/dsh-agent-service.js +6 -0
- package/dist/server/goal-service.js +10 -5
- package/dist/server/index.js +89 -13
- package/dist/server/message-deletion.js +40 -0
- package/dist/server/message-window.js +9 -0
- package/dist/server/patch-executable-lookup.js +396 -0
- package/dist/server/payload-limits.js +2 -0
- package/dist/server/plugin-llm.js +100 -9
- package/dist/server/plugins.js +1 -0
- package/dist/server/preset-fields.js +24 -0
- package/dist/server/preset-share.js +2 -0
- package/dist/server/prompt-base-store.js +85 -0
- package/dist/server/prompt-composer.js +5 -2
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/protocol.js +2 -2
- package/dist/server/remote-ssh-service.js +22 -9
- package/dist/server/resolve-global-sdk.js +2 -0
- package/dist/server/session-search.js +1 -1
- package/dist/server/settings-service.js +90 -39
- package/dist/server/skill-content-filler.js +29 -8
- package/dist/server/skill-tool.js +12 -3
- package/dist/server/subagent-helpers.js +4 -1
- package/dist/server/subagents.js +50 -36
- package/dist/server/tool-host-factories.js +1 -0
- package/dist/server/universal/universal-session.js +5 -0
- package/dist/server/webui-context.js +25 -5
- package/docs/README.md +94 -0
- package/docs/device-center.md +100 -12
- package/docs/dsh-engine.md +10 -10
- package/extensions/webui.ts +43 -1
- package/package.json +1 -1
- package/themes/aetheris.css +5 -0
- package/themes/ayu-light.css +6 -0
- package/themes/bases/flow-base.css +68 -68
- package/themes/catppuccin-latte.css +6 -0
- package/themes/catppuccin.css +6 -0
- package/themes/claude-code-dark.css +5 -0
- package/themes/codex.css +6 -0
- package/themes/cyberpunk.css +6 -0
- package/themes/dark-teal.css +6 -1
- package/themes/dazzle.css +6 -0
- package/themes/everforest-light.css +6 -0
- package/themes/flow-light.css +8 -1
- package/themes/flow.css +6 -1
- package/themes/geist.css +6 -0
- package/themes/gruvbox-light.css +6 -0
- package/themes/kanagawa-lotus.css +6 -0
- package/themes/md-preview.css +6 -0
- package/themes/mist.css +6 -0
- package/themes/nord.css +6 -0
- package/themes/one-dark.css +6 -0
- package/themes/paper.css +6 -0
- package/themes/rose-pine-dawn.css +6 -0
- package/themes/sakura.css +6 -0
- package/themes/solarized-light.css +6 -0
- package/themes/tokyo-night.css +6 -0
- package/themes/translucent.css +6 -0
- package/themes/transparent.css +6 -0
- package/themes/vs-code-dark.css +5 -0
- package/themes/wallpaper-flow.css +5 -1
- package/themes/wallpaper-obsidian.css +6 -0
- package/themes/white.css +6 -0
- package/themes/zhujian-dark.css +6 -1
- package/themes/zhujian.css +6 -1
- package/themes/zhupi-dark.css +6 -1
- package/themes/zhupi.css +6 -1
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/BgTasksModal-BYzPgmoq.js +1 -0
- package/web/dist/assets/BgTasksModal-ni0VTmAQ.js +1 -0
- package/web/dist/assets/{CanvasStudio-B3W6b_rA.js → CanvasStudio-BCUeEf25.js} +3 -3
- package/web/dist/assets/{CanvasStudio-Csv1Sj1-.js → CanvasStudio-DNmDNBod.js} +3 -3
- package/web/dist/assets/DeviceCenter-BcBhRgL6.js +3 -0
- package/web/dist/assets/DeviceCenter-CmL5FZmt.js +3 -0
- package/web/dist/assets/DeviceGroups-CLdpdnI7.js +1 -0
- package/web/dist/assets/DeviceGroups-CgBaDPrD.js +1 -0
- package/web/dist/assets/Dropdown-CGXD0DfT.js +1 -0
- package/web/dist/assets/FilePreview-B8iqnBjy.js +2 -0
- package/web/dist/assets/FilePreview-BqviZKCN.js +2 -0
- package/web/dist/assets/GlobalSearchModal-mevF-ySi.js +1 -0
- package/web/dist/assets/GlobalSearchModal-qL99FN_F.js +1 -0
- package/web/dist/assets/GroupConversation-B88Yy-lt.js +3 -0
- package/web/dist/assets/GroupConversation-BwP5NVOE.js +3 -0
- package/web/dist/assets/HintTip-LHwkS2jV.js +1 -0
- package/web/dist/assets/ModelConfigModal-Do3Fe3jH.js +2 -0
- package/web/dist/assets/PiSetupModal-DE5-gEtI.js +1 -0
- package/web/dist/assets/ProviderOAuthControls-6UMARucA.js +1 -0
- package/web/dist/assets/SCMPanel-Hi6QqC1Q.js +2 -0
- package/web/dist/assets/SCMPanel-ezY_ZtCu.js +2 -0
- package/web/dist/assets/SettingsModal-6HgeEsJ8.js +20 -0
- package/web/dist/assets/SettingsModal-CF-7MwqS.js +20 -0
- package/web/dist/assets/TerminalPanel-CTp_BZ4S.js +3 -0
- package/web/dist/assets/TerminalPanel-CkYxC-Gh.js +3 -0
- package/web/dist/assets/TuiOverlayModal-1cRLP8IF.js +1 -0
- package/web/dist/assets/TuiOverlayModal-2xlptqWX.js +1 -0
- package/web/dist/assets/app-globals-DZNa9v8u.js +325 -0
- package/web/dist/assets/canvas-client-Bye9nSFO.js +1 -0
- package/web/dist/assets/{desktop-YguLbrX1.js → desktop-kjBoE3Nu.js} +1 -1
- package/web/dist/assets/group-view-state-CGCzYF8k.js +1 -0
- package/web/dist/assets/index-CsFs_HMb.css +1 -0
- package/web/dist/assets/index-DHeeHS_l.js +85 -0
- package/web/dist/assets/index-DTZch8uz.js +85 -0
- package/web/dist/assets/plugin-host-C8mNgghx.js +1 -0
- package/web/dist/assets/remote-ssh-client-CeP3CLUW.js +1 -0
- package/web/dist/assets/theme-BXGpyTMh.js +1 -0
- package/web/dist/index.html +10 -9
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/BgTasksModal-BIlQ89vr.js +0 -1
- package/web/dist/assets/BgTasksModal-Ck2sjlPM.js +0 -1
- package/web/dist/assets/DeviceCenter-BQdDcO8A.js +0 -3
- package/web/dist/assets/DeviceCenter-CHRKL0Vy.js +0 -3
- package/web/dist/assets/DeviceGroups-D2rogxEN.js +0 -1
- package/web/dist/assets/Dropdown-ZLS04O8p.js +0 -1
- package/web/dist/assets/FilePreview-B9xoU6ON.js +0 -2
- package/web/dist/assets/FilePreview-DUQpVZkH.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BXEGvUZq.js +0 -1
- package/web/dist/assets/GlobalSearchModal-CnVPmfOI.js +0 -1
- package/web/dist/assets/GroupConversation-CyIpQzDd.js +0 -1
- package/web/dist/assets/GroupConversation-DgYV3uYS.js +0 -1
- package/web/dist/assets/ModelConfigModal-DDZccDYt.js +0 -2
- package/web/dist/assets/PiSetupModal-DHbqfx8T.js +0 -1
- package/web/dist/assets/ProviderOAuthControls-C-MK36Dk.js +0 -1
- package/web/dist/assets/SCMPanel-imYI2Ecw.js +0 -2
- package/web/dist/assets/SCMPanel-sVZcV7dR.js +0 -2
- package/web/dist/assets/SettingsModal-Xw1Yoi3_.js +0 -20
- package/web/dist/assets/SettingsModal-mb4e34-0.js +0 -20
- package/web/dist/assets/TerminalPanel-CLkJJvxg.js +0 -3
- package/web/dist/assets/TerminalPanel-DpcIellm.js +0 -3
- package/web/dist/assets/TuiOverlayModal-4-fFAZe7.js +0 -1
- package/web/dist/assets/TuiOverlayModal-DCu01lks.js +0 -1
- package/web/dist/assets/app-globals-DcyO0UPi.js +0 -1
- package/web/dist/assets/fi-DaSO0Q-m.js +0 -325
- package/web/dist/assets/index-Cdh3sibd.js +0 -85
- package/web/dist/assets/index-DDZMv6LO.css +0 -1
- package/web/dist/assets/index-DWw_SxRq.js +0 -85
- package/web/dist/assets/plugin-host-BRBg6zmQ.js +0 -1
- package/web/dist/assets/theme-DDl-Oy1b.js +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { writeJsonAtomicSync } from "../atomic-file.js";
|
|
4
|
+
export const DEFAULT_EXECUTION_SETTINGS = {
|
|
5
|
+
maxActiveTasks: 4,
|
|
6
|
+
maxWaitingTasks: 32,
|
|
7
|
+
};
|
|
8
|
+
export const EXECUTION_SETTINGS_LIMITS = {
|
|
9
|
+
minActiveTasks: 1,
|
|
10
|
+
maxActiveTasks: 16,
|
|
11
|
+
minWaitingTasks: 0,
|
|
12
|
+
maxWaitingTasks: 128,
|
|
13
|
+
};
|
|
14
|
+
export class DeviceExecutionSettingsError extends Error {
|
|
15
|
+
code = "INVALID_EXECUTION_SETTINGS";
|
|
16
|
+
constructor(message, cause) {
|
|
17
|
+
super(message, { cause });
|
|
18
|
+
this.name = "DeviceExecutionSettingsError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function validateExecutionSettings(input) {
|
|
22
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
23
|
+
return { valid: false, error: "Settings must be an object" };
|
|
24
|
+
}
|
|
25
|
+
const candidate = input;
|
|
26
|
+
// Strict rejection of unknown/extra keys to prevent spelling mistakes
|
|
27
|
+
const allowedKeys = new Set(["maxActiveTasks", "maxWaitingTasks"]);
|
|
28
|
+
for (const key of Object.keys(candidate)) {
|
|
29
|
+
if (!allowedKeys.has(key)) {
|
|
30
|
+
return { valid: false, error: `Unknown configuration key: ${key}` };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const rawActive = candidate.maxActiveTasks;
|
|
34
|
+
if (typeof rawActive !== "number" || !Number.isInteger(rawActive)) {
|
|
35
|
+
return { valid: false, error: "maxActiveTasks must be an integer" };
|
|
36
|
+
}
|
|
37
|
+
if (rawActive < EXECUTION_SETTINGS_LIMITS.minActiveTasks || rawActive > EXECUTION_SETTINGS_LIMITS.maxActiveTasks) {
|
|
38
|
+
return {
|
|
39
|
+
valid: false,
|
|
40
|
+
error: `maxActiveTasks must be between ${EXECUTION_SETTINGS_LIMITS.minActiveTasks} and ${EXECUTION_SETTINGS_LIMITS.maxActiveTasks}`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const rawWaiting = candidate.maxWaitingTasks;
|
|
44
|
+
if (typeof rawWaiting !== "number" || !Number.isInteger(rawWaiting)) {
|
|
45
|
+
return { valid: false, error: "maxWaitingTasks must be an integer" };
|
|
46
|
+
}
|
|
47
|
+
if (rawWaiting < EXECUTION_SETTINGS_LIMITS.minWaitingTasks ||
|
|
48
|
+
rawWaiting > EXECUTION_SETTINGS_LIMITS.maxWaitingTasks) {
|
|
49
|
+
return {
|
|
50
|
+
valid: false,
|
|
51
|
+
error: `maxWaitingTasks must be between ${EXECUTION_SETTINGS_LIMITS.minWaitingTasks} and ${EXECUTION_SETTINGS_LIMITS.maxWaitingTasks}`,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
valid: true,
|
|
56
|
+
value: {
|
|
57
|
+
maxActiveTasks: rawActive,
|
|
58
|
+
maxWaitingTasks: rawWaiting,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function executionSettingsFilePath(dataDir) {
|
|
63
|
+
return join(dataDir, "execution-settings.json");
|
|
64
|
+
}
|
|
65
|
+
export function loadExecutionSettings(dataDir) {
|
|
66
|
+
if (!dataDir)
|
|
67
|
+
return { ...DEFAULT_EXECUTION_SETTINGS };
|
|
68
|
+
const file = executionSettingsFilePath(dataDir);
|
|
69
|
+
let raw;
|
|
70
|
+
try {
|
|
71
|
+
raw = readFileSync(file, "utf8");
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code === "ENOENT") {
|
|
75
|
+
return { ...DEFAULT_EXECUTION_SETTINGS };
|
|
76
|
+
}
|
|
77
|
+
throw new DeviceExecutionSettingsError("Failed to read execution settings file", error);
|
|
78
|
+
}
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = JSON.parse(raw);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new DeviceExecutionSettingsError("Execution settings file contains corrupted JSON", error);
|
|
85
|
+
}
|
|
86
|
+
const validated = validateExecutionSettings(parsed);
|
|
87
|
+
if (!validated.valid) {
|
|
88
|
+
throw new DeviceExecutionSettingsError(`Invalid execution settings: ${validated.error}`);
|
|
89
|
+
}
|
|
90
|
+
return validated.value;
|
|
91
|
+
}
|
|
92
|
+
export function saveExecutionSettings(dataDir, settings) {
|
|
93
|
+
const validated = validateExecutionSettings(settings);
|
|
94
|
+
if (!validated.valid) {
|
|
95
|
+
throw new DeviceExecutionSettingsError(validated.error);
|
|
96
|
+
}
|
|
97
|
+
const file = executionSettingsFilePath(dataDir);
|
|
98
|
+
writeJsonAtomicSync(file, validated.value);
|
|
99
|
+
return validated.value;
|
|
100
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { splitAgentStartPrompt } from "../persona-chain.js";
|
|
2
|
+
const ownedSections = ["device_bot", "device_execution"];
|
|
3
|
+
/** Keep execution authority in SDK sections, including when a renderer forces opaque text. */
|
|
4
|
+
export function prepareBotExecutionSystemPrompt(event, execution) {
|
|
5
|
+
// Split before adding sections: earlier extensions wrapped the previous SDK baseline.
|
|
6
|
+
const { pre, core, post } = splitAgentStartPrompt(event);
|
|
7
|
+
if (!execution)
|
|
8
|
+
return { core, rewrap: (next) => pre + next + post };
|
|
9
|
+
const sections = {};
|
|
10
|
+
if (execution.bot.systemPrompt?.trim())
|
|
11
|
+
sections.device_bot = execution.bot.systemPrompt.trim();
|
|
12
|
+
if (execution.instructions.trim())
|
|
13
|
+
sections.device_execution = execution.instructions.trim();
|
|
14
|
+
if (event.systemPromptOptions) {
|
|
15
|
+
const target = (event.systemPromptOptions.sections ??= {});
|
|
16
|
+
for (const name of ownedSections)
|
|
17
|
+
delete target[name];
|
|
18
|
+
Object.assign(target, sections);
|
|
19
|
+
}
|
|
20
|
+
const stripOwnedSections = (text) => {
|
|
21
|
+
for (const name of ownedSections) {
|
|
22
|
+
text = text.replace(new RegExp(`<${name}>\\n[\\s\\S]*?\\n</${name}>`, "g"), "");
|
|
23
|
+
}
|
|
24
|
+
return text;
|
|
25
|
+
};
|
|
26
|
+
const rendered = Object.entries(sections)
|
|
27
|
+
.map(([name, content]) => `<${name}>\n${content}\n</${name}>`)
|
|
28
|
+
.join("\n\n");
|
|
29
|
+
const rewrap = (next) => {
|
|
30
|
+
const wrapped = stripOwnedSections(pre + next + post);
|
|
31
|
+
return rendered ? `${wrapped.trimEnd()}\n\n${rendered}` : wrapped;
|
|
32
|
+
};
|
|
33
|
+
// SDK ignores sections when an earlier extension has already forced the prompt.
|
|
34
|
+
if (typeof event.systemPromptOptions?.forceSystemPrompt === "string") {
|
|
35
|
+
event.systemPromptOptions.forceSystemPrompt = rewrap(core);
|
|
36
|
+
}
|
|
37
|
+
return { core: stripOwnedSections(core), rewrap };
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
3
|
+
/** Canonical roots prevent symlink aliases from bypassing execution isolation. */
|
|
4
|
+
export function executionRoot(path) {
|
|
5
|
+
let root = resolve(path);
|
|
6
|
+
try {
|
|
7
|
+
root = realpathSync.native(root);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
/* Admission validates missing roots separately. */
|
|
11
|
+
}
|
|
12
|
+
return process.platform === "win32" ? root.toLowerCase() : root;
|
|
13
|
+
}
|
|
14
|
+
export function executionRootsOverlap(left, right) {
|
|
15
|
+
const contains = (a, b) => {
|
|
16
|
+
const path = relative(a, b);
|
|
17
|
+
return !path || (!isAbsolute(path) && path !== ".." && !path.startsWith("../") && !path.startsWith("..\\"));
|
|
18
|
+
};
|
|
19
|
+
return contains(left, right) || contains(right, left);
|
|
20
|
+
}
|