pi-web-ui 0.110.0 → 0.112.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 -2
- package/bin/frp-manager.mjs +92 -7
- package/dist/server/agent-formatters.js +10 -6
- package/dist/server/agent-service-daemon.js +27 -9
- package/dist/server/agent-service.js +1442 -489
- package/dist/server/approval-audit.js +119 -0
- package/dist/server/approval-default-rules.js +4 -4
- package/dist/server/approval-rules.js +42 -17
- package/dist/server/attachment-store.js +8 -8
- package/dist/server/attachments.js +114 -31
- package/dist/server/canvas/canvas-agent-tool.js +593 -0
- package/dist/server/canvas/canvas-cards.js +144 -0
- package/dist/server/canvas/canvas-dispatch.js +155 -0
- package/dist/server/canvas/canvas-orchestrator.js +1094 -0
- package/dist/server/canvas/canvas-store.js +260 -0
- package/dist/server/client-id-utils.js +2 -2
- package/dist/server/client-state.js +52 -0
- package/dist/server/context-budget.js +6 -3
- package/dist/server/delegate-mode.js +6 -3
- package/dist/server/delegate-task.js +18 -3
- package/dist/server/dispatch-domain-handlers.js +3 -0
- package/dist/server/dsh/dsh-agent-service.js +357 -20
- package/dist/server/dsh/dsh-client.js +10 -1
- package/dist/server/dsh/dsh-serialize.js +1 -1
- package/dist/server/dsh/runtime/goal-rpc.mjs +128 -3
- package/dist/server/dsh/runtime/launcher.mjs +59 -5
- package/dist/server/dsh/runtime/runtime-root.mjs +353 -40
- package/dist/server/durable/durable-agent-service.js +3 -0
- package/dist/server/durable/durable-driver.js +75 -9
- package/dist/server/durable/durable-loader.js +1 -14
- package/dist/server/durable/durable-models.js +107 -0
- package/dist/server/durable/index.js +0 -4
- package/dist/server/engine-probe.js +76 -37
- package/dist/server/eval-tool.js +28 -3
- package/dist/server/file-transfer-routes.js +8 -2
- package/dist/server/files-service.js +10 -2
- package/dist/server/goal-service.js +7 -0
- package/dist/server/index.js +480 -59
- package/dist/server/json-utils.js +57 -0
- package/dist/server/marker-service.js +11 -1
- package/dist/server/markers/marker.js +45 -4
- package/dist/server/markers/registry.js +31 -0
- package/dist/server/message-window.js +44 -8
- package/dist/server/model-admin.js +68 -106
- package/dist/server/model-resolver.js +66 -44
- package/dist/server/office-parse.js +394 -7
- package/dist/server/plan-manager.js +3 -6
- package/dist/server/plugin-api-catalog.js +7 -0
- package/dist/server/plugin-assets.js +238 -0
- package/dist/server/plugin-facilities.js +22 -0
- package/dist/server/plugin-ui-slots.js +1 -0
- package/dist/server/plugins.js +296 -25
- package/dist/server/preset-fields.js +60 -2
- package/dist/server/preset-share.js +8 -2
- package/dist/server/prompt-assembler.js +9 -2
- package/dist/server/prompt-composer.js +84 -44
- package/dist/server/protocol-version.js +1 -1
- package/dist/server/queue-utils.js +156 -0
- package/dist/server/remote-ssh-service.js +16 -4
- package/dist/server/sdk-builtin-extensions.js +85 -0
- package/dist/server/server-config.js +66 -0
- package/dist/server/session-parser.js +49 -13
- package/dist/server/session-search.js +4 -3
- package/dist/server/settings-service.js +56 -7
- package/dist/server/soft-cap.js +8 -6
- package/dist/server/subagent-helpers.js +22 -1
- package/dist/server/subagent-notify.js +93 -0
- package/dist/server/subagent-security-gate.js +282 -0
- package/dist/server/subagent-templates.js +8 -0
- package/dist/server/subagents.js +144 -17
- package/dist/server/terminals.js +196 -8
- package/dist/server/text-quote.js +61 -0
- package/dist/server/tool-approval.js +63 -4
- package/dist/server/tool-guards.js +208 -0
- package/dist/server/tool-host-factories.js +46 -10
- package/dist/server/tool-manager.js +30 -0
- package/dist/server/tool-overrides.js +21 -11
- package/dist/server/univer-service.js +448 -0
- package/dist/server/universal/driver-base.js +8 -0
- package/dist/server/universal/drivers/claude-code.js +39 -5
- package/dist/server/universal/drivers/dsh-driver.js +3 -0
- package/dist/server/universal/index.js +0 -1
- package/dist/server/universal/universal-attachments.js +5 -0
- package/dist/server/universal/universal-service.js +5 -0
- package/dist/server/universal/universal-session.js +114 -21
- package/dist/server/update-check.js +90 -5
- package/dist/server/workspace-snapshot.js +33 -2
- package/dist/server/worktree-service.js +189 -1
- package/docs/dsh-engine.md +493 -0
- package/package.json +5 -4
- package/plugin-sdk/client-utils.mjs +192 -5
- package/plugin-sdk/index.d.ts +80 -1
- package/plugin-sdk/index.mjs +99 -0
- package/plugin-sdk/package.json +5 -1
- package/plugins/catalog.json +33 -0
- package/themes/aetheris.css +114 -0
- package/themes/bases/obsidian-base.css +216 -0
- package/themes/md-preview.css +113 -0
- package/themes/wallpaper-flow.css +182 -0
- package/web/dist/assets/{TerminalPanel-BHjM6pzY.js → TerminalPanel-Dqr1dK28.js} +2 -2
- package/web/dist/assets/index-Dh8BX-lP.js +720 -0
- package/web/dist/assets/index-DqrC1I_a.css +1 -0
- package/web/dist/assets/{markdown-DXwnfD9T.js → markdown-BJZlfvdP.js} +24 -24
- package/web/dist/assets/markdown-DSNUiDzp.css +1 -0
- package/web/dist/index.html +13 -4
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/es-DIDZppIF.js +0 -2
- package/web/dist/assets/index-DwInT7-a.css +0 -1
- package/web/dist/assets/index-GfVFIgIL.js +0 -693
- package/web/dist/assets/markdown-CCeVCbci.css +0 -1
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
* (reloadSession 里还会刷新斜杠命令目录)。
|
|
8
8
|
*/
|
|
9
9
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
10
|
+
import { homedir } from "node:os";
|
|
10
11
|
import { basename, dirname, join } from "node:path";
|
|
11
12
|
import { fileURLToPath } from "node:url";
|
|
12
|
-
import { extensionKey, isInternalExtension, normalizeBgCleanupMinutes, normalizeDisabledPluginTools, normalizeRetryMaxAttempts, normalizeKeepRecentMessages, normalizeSkillList, normalizeToolWatchdogTimeoutMs, normalizeUiLayout, settingsPresetToUi, } from "./client-state.js";
|
|
13
|
+
import { extensionKey, isInternalExtension, normalizeBgCleanupMinutes, normalizeDisabledPluginTools, normalizeRetryMaxAttempts, normalizeKeepRecentMessages, normalizeSkillList, normalizeSkillsCatalogBudget, normalizeSkillsCatalogMaxDesc, normalizeToolWatchdogTimeoutMs, normalizeUiLayout, defaultSubagentAutoWakeMaxTurns, normalizeSubagentAutoWakeMaxTurns, settingsPresetToUi, } from "./client-state.js";
|
|
13
14
|
import { normalizeSoftCapByModel, normalizeSoftCapTokens } from "./soft-cap.js";
|
|
14
15
|
import { findVisionModels, SYSTEM_PROMPT } from "./vision-bridge.js";
|
|
15
16
|
import { COMMITMSG_SYSTEM_PROMPT } from "./scm-commitmsg.js";
|
|
@@ -61,13 +62,16 @@ export class SettingsService {
|
|
|
61
62
|
hasPendingReload() {
|
|
62
63
|
return this.pendingReload;
|
|
63
64
|
}
|
|
65
|
+
setPendingReload(v) {
|
|
66
|
+
this.pendingReload = v;
|
|
67
|
+
}
|
|
64
68
|
consumePendingReload() {
|
|
65
69
|
const v = this.pendingReload;
|
|
66
70
|
this.pendingReload = false;
|
|
67
71
|
return v;
|
|
68
72
|
}
|
|
69
|
-
/** 判断某个 skill 名是否仍存在于磁盘任何来源(agent 区 /
|
|
70
|
-
* .agents/skills / npm 包内 skills)。被禁用且文件已删除的名字不应再
|
|
73
|
+
/** 判断某个 skill 名是否仍存在于磁盘任何来源(agent 区 / 用户级或祖先
|
|
74
|
+
* .agents/skills / 项目 .pi / npm 包内 skills)。被禁用且文件已删除的名字不应再
|
|
71
75
|
* 出现在设置面板,也不应留在持久化记录里。 */
|
|
72
76
|
skillStillOnDisk(name) {
|
|
73
77
|
const cwd = this.host.cwd();
|
|
@@ -76,6 +80,9 @@ export class SettingsService {
|
|
|
76
80
|
// ① 用户区 <agentDir>/skills ② 项目 .pi/skills
|
|
77
81
|
if (check(join(agentDir, "skills")))
|
|
78
82
|
return true;
|
|
83
|
+
// SDK 始终扫描用户级 ~/.agents/skills,不依赖 cwd 的祖先链(issue #669)。
|
|
84
|
+
if (check(join(process.env.HOME || homedir(), ".agents", "skills")))
|
|
85
|
+
return true;
|
|
79
86
|
if (check(join(cwd, ".pi", "skills")))
|
|
80
87
|
return true;
|
|
81
88
|
// ③ 祖先链 .agents/skills(SDK collectAncestorAgentsSkillDirs 语义,最多上溯 6 层)
|
|
@@ -297,6 +304,7 @@ export class SettingsService {
|
|
|
297
304
|
customSystemPrompt: this.settings.customSystemPrompt,
|
|
298
305
|
promptTemplate: this.settings.promptTemplate ?? "",
|
|
299
306
|
promptOverrides: { ...this.settings.promptOverrides },
|
|
307
|
+
promptDisabled: [...(this.settings.promptDisabled ?? [])],
|
|
300
308
|
toolPromptOverrides: { ...this.settings.toolPromptOverrides },
|
|
301
309
|
disabledAgentTools: [...normalizeDisabledAgentTools(this.settings.disabledAgentTools)],
|
|
302
310
|
disabledPluginTools: [...normalizeDisabledPluginTools(this.settings.disabledPluginTools)],
|
|
@@ -340,6 +348,9 @@ export class SettingsService {
|
|
|
340
348
|
disabledPlugins: [...(this.settings.disabledPlugins ?? [])],
|
|
341
349
|
uiLayout: normalizeUiLayout(this.settings.uiLayout),
|
|
342
350
|
skillsFullText: [...normalizeSkillList(this.settings.skillsFullText)],
|
|
351
|
+
skillsCatalogMaxDesc: this.settings.skillsCatalogMaxDesc,
|
|
352
|
+
skillsCatalogShowLocation: this.settings.skillsCatalogShowLocation,
|
|
353
|
+
skillsCatalogBudget: this.settings.skillsCatalogBudget,
|
|
343
354
|
// The composed system prompt actually in effect (read-only view).
|
|
344
355
|
effectiveSystemPrompt: promptSnap.full,
|
|
345
356
|
// 每个来源未覆盖时的默认(自动)内容(「各来源」行预览用)。
|
|
@@ -366,6 +377,8 @@ export class SettingsService {
|
|
|
366
377
|
subagentTemplates: this.templates.list().map((t) => localizeTemplate(t, this.host.getLocale?.())),
|
|
367
378
|
subagentDefaultTemplates: DEFAULT_TEMPLATES.map((t) => t.name),
|
|
368
379
|
subagentDefaultModel: this.settings.subagentDefaultModel ?? null,
|
|
380
|
+
subagentMaxDepth: this.settings.subagentMaxDepth ?? 0,
|
|
381
|
+
subagentAutoWakeMaxTurns: this.settings.subagentAutoWakeMaxTurns ?? defaultSubagentAutoWakeMaxTurns(),
|
|
369
382
|
retryMaxAttempts: this.settings.retryMaxAttempts,
|
|
370
383
|
softCapTokens: this.settings.softCapTokens,
|
|
371
384
|
softCapByModel: { ...this.settings.softCapByModel },
|
|
@@ -426,6 +439,7 @@ export class SettingsService {
|
|
|
426
439
|
partial.customSystemPrompt !== undefined ||
|
|
427
440
|
partial.promptTemplate !== undefined ||
|
|
428
441
|
partial.promptOverrides !== undefined ||
|
|
442
|
+
partial.promptDisabled !== undefined ||
|
|
429
443
|
partial.disabledSkills !== undefined ||
|
|
430
444
|
partial.disabledExtensions !== undefined;
|
|
431
445
|
// 统一工具开关 live 生效(ActiveSet 加减,无需 reload),见末尾 applyToolGating。
|
|
@@ -456,6 +470,8 @@ export class SettingsService {
|
|
|
456
470
|
}
|
|
457
471
|
this.settings.promptOverrides = next;
|
|
458
472
|
}
|
|
473
|
+
if (partial.promptDisabled !== undefined)
|
|
474
|
+
this.settings.promptDisabled = [...partial.promptDisabled];
|
|
459
475
|
if (partial.toolPromptOverrides !== undefined) {
|
|
460
476
|
// 逐工具合并:给出的键整体替换(归一化后为空 = 清除该工具覆盖)。
|
|
461
477
|
const next = { ...this.settings.toolPromptOverrides };
|
|
@@ -601,6 +617,15 @@ export class SettingsService {
|
|
|
601
617
|
if (partial.skillsFullText !== undefined) {
|
|
602
618
|
this.settings.skillsFullText = normalizeSkillList(partial.skillsFullText);
|
|
603
619
|
}
|
|
620
|
+
if (partial.skillsCatalogMaxDesc !== undefined) {
|
|
621
|
+
this.settings.skillsCatalogMaxDesc = normalizeSkillsCatalogMaxDesc(partial.skillsCatalogMaxDesc);
|
|
622
|
+
}
|
|
623
|
+
if (partial.skillsCatalogShowLocation !== undefined) {
|
|
624
|
+
this.settings.skillsCatalogShowLocation = Boolean(partial.skillsCatalogShowLocation);
|
|
625
|
+
}
|
|
626
|
+
if (partial.skillsCatalogBudget !== undefined) {
|
|
627
|
+
this.settings.skillsCatalogBudget = normalizeSkillsCatalogBudget(partial.skillsCatalogBudget);
|
|
628
|
+
}
|
|
604
629
|
if (partial.visionBridgeEnabled !== undefined) {
|
|
605
630
|
this.settings.visionBridgeEnabled = partial.visionBridgeEnabled;
|
|
606
631
|
}
|
|
@@ -636,6 +661,13 @@ export class SettingsService {
|
|
|
636
661
|
const m = partial.subagentDefaultModel?.trim() ?? "";
|
|
637
662
|
this.settings.subagentDefaultModel = m ? m : null;
|
|
638
663
|
}
|
|
664
|
+
if (partial.subagentMaxDepth !== undefined) {
|
|
665
|
+
const n = Math.floor(Number(partial.subagentMaxDepth));
|
|
666
|
+
this.settings.subagentMaxDepth = Number.isFinite(n) && n > 0 ? n : 0;
|
|
667
|
+
}
|
|
668
|
+
if (partial.subagentAutoWakeMaxTurns !== undefined) {
|
|
669
|
+
this.settings.subagentAutoWakeMaxTurns = normalizeSubagentAutoWakeMaxTurns(partial.subagentAutoWakeMaxTurns);
|
|
670
|
+
}
|
|
639
671
|
if (partial.retryMaxAttempts !== undefined) {
|
|
640
672
|
// 出错重试次数:持久化 + 即时注入各会话(SDK 在每次退避前都重读
|
|
641
673
|
// getRetrySettings,无需 reload runtime;见宿主 applyRetryOverrides)。
|
|
@@ -747,14 +779,19 @@ export class SettingsService {
|
|
|
747
779
|
editSoftEnabled: presetLegacy.editSoftEnabled,
|
|
748
780
|
};
|
|
749
781
|
this.host.stateStore.saveSettings(this.host.clientId, this.settings);
|
|
750
|
-
//
|
|
751
|
-
this.host.
|
|
782
|
+
// 统一收口重放配置覆盖与工具门控(包含 retry/compaction/codemode 与 toolGating)
|
|
783
|
+
if (this.host.applySessionOverrides) {
|
|
784
|
+
this.host.applySessionOverrides();
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
this.host.applyRetryOverrides();
|
|
788
|
+
this.host.applyCodemodeOverrides?.();
|
|
789
|
+
this.host.applyToolGating();
|
|
790
|
+
}
|
|
752
791
|
this.push();
|
|
753
792
|
if ((this.settings.showForkedParentSessions ?? false) !== prevShowForked) {
|
|
754
793
|
this.host.onSessionsFilterChanged?.();
|
|
755
794
|
}
|
|
756
|
-
// 预设带了工具开关:live 应用(reload 路径会重放,流式中延迟到 agent_end)。
|
|
757
|
-
this.host.applyToolGating();
|
|
758
795
|
await this.applyRuntime();
|
|
759
796
|
}
|
|
760
797
|
/** Remove a named preset. */
|
|
@@ -956,6 +993,18 @@ export class SettingsService {
|
|
|
956
993
|
}
|
|
957
994
|
/** session.reload() + refresh the slash-command catalog + push state. */
|
|
958
995
|
async applyReload() {
|
|
996
|
+
if (this.host.isDisposed())
|
|
997
|
+
return;
|
|
998
|
+
if (this.host.isStreaming()) {
|
|
999
|
+
this.pendingReload = true;
|
|
1000
|
+
this.host.emit({
|
|
1001
|
+
type: "notice",
|
|
1002
|
+
level: "info",
|
|
1003
|
+
text: "当前回复进行中,设置将在回复结束后自动应用",
|
|
1004
|
+
textEn: "A reply is in progress; settings will apply when it finishes",
|
|
1005
|
+
});
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
959
1008
|
try {
|
|
960
1009
|
await this.host.reloadSession();
|
|
961
1010
|
this.push();
|
package/dist/server/soft-cap.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 自定义上下文压缩阈值(Soft Cap,issue #229)。
|
|
2
|
+
* 自定义上下文压缩阈值(Soft Cap,issue #229,issue #716)。
|
|
3
3
|
*
|
|
4
4
|
* 背景:SDK 的自动压缩只看物理上限(shouldCompact:tokens > window - reserveTokens,
|
|
5
5
|
* reserveTokens 默认 16384)。对 1M 上下文的模型会堆到 ~900K 才压;对 Grok 这类
|
|
6
6
|
* 200K 起阶梯翻倍计费的模型,会在高价区跑很久,还伴随长上下文降智。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* 实现机制(控制权反转与主动压缩):
|
|
9
|
+
* 1. SDK 的 compaction.reserveTokens 始终保持默认值 16384,只负责物理防爆兜底;
|
|
10
|
+
* 2. 软上限(Soft Cap)不由 SDK reserve 反推注入,从数学上根除切模型时的公式混乱;
|
|
11
|
+
* 3. 当有效上下文 token 达到用户设置的软上限时,由 pi-web-ui 在空闲态(回合结算后
|
|
12
|
+
* 或新一轮提问前)主动调用 session.compact() 执行压缩。
|
|
13
|
+
*
|
|
14
|
+
* softCapToReserve 作为分层上下文预算裁剪(context-budget-runner)的工具函数保留。
|
|
13
15
|
*/
|
|
14
16
|
import { DEFAULT_COMPACTION_SETTINGS } from "@earendil-works/pi-coding-agent";
|
|
15
17
|
/** SDK 默认保留 token(软上限关闭时的回填值)。 */
|
|
@@ -80,9 +80,18 @@ export function toSubagentSnapshot(conv) {
|
|
|
80
80
|
catch {
|
|
81
81
|
// session being replaced — report defaults
|
|
82
82
|
}
|
|
83
|
+
let thinkingLevel;
|
|
84
|
+
try {
|
|
85
|
+
thinkingLevel = conv.session.thinkingLevel ?? conv.subagentThinking;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
thinkingLevel = conv.subagentThinking;
|
|
89
|
+
}
|
|
83
90
|
const fullPrompt = conv.subagentPrompt ?? "";
|
|
84
91
|
const sm = conv.session.sessionManager;
|
|
85
92
|
const isPersisted = !conv.isSubagent || (typeof sm?.isPersisted === "function" && sm.isPersisted());
|
|
93
|
+
const m = conv.session.model;
|
|
94
|
+
const modelKey = m ? `${m.provider}/${m.id}` : (conv.subagentTemplate?.model ?? undefined);
|
|
86
95
|
return {
|
|
87
96
|
convId: conv.id,
|
|
88
97
|
type: conv.subagentType ?? "general",
|
|
@@ -95,12 +104,24 @@ export function toSubagentSnapshot(conv) {
|
|
|
95
104
|
error,
|
|
96
105
|
canceled,
|
|
97
106
|
messageCount,
|
|
98
|
-
model:
|
|
107
|
+
model: modelKey,
|
|
108
|
+
thinkingLevel,
|
|
99
109
|
output: conv.session.getLastAssistantText() ?? "",
|
|
100
110
|
parentId: conv.parentId,
|
|
101
111
|
persisted: isPersisted,
|
|
102
112
|
handoffTo: conv.peerHandoffTo ? [...conv.peerHandoffTo] : undefined,
|
|
103
113
|
handoffFrom: conv.peerHandoffFrom ? [...conv.peerHandoffFrom] : undefined,
|
|
114
|
+
worktree: conv.subagentWorktree
|
|
115
|
+
? {
|
|
116
|
+
path: conv.subagentWorktree.worktreePath,
|
|
117
|
+
branch: conv.subagentWorktree.branch,
|
|
118
|
+
cleanedUp: Boolean(conv.subagentWorktree.cleanedUp),
|
|
119
|
+
isDirty: conv.subagentWorktree.isDirty,
|
|
120
|
+
uncommittedCount: conv.subagentWorktree.uncommittedCount,
|
|
121
|
+
aheadCount: conv.subagentWorktree.aheadCount,
|
|
122
|
+
error: conv.subagentWorktree.error,
|
|
123
|
+
}
|
|
124
|
+
: undefined,
|
|
104
125
|
};
|
|
105
126
|
}
|
|
106
127
|
/** 列举并排序子代理快照集合 */
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// subagent-notify.ts — 子代理终态自动通知与结构化交付契约(issue #713)
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// 负责:
|
|
5
|
+
// 1. extractSubagentConclusion: 提炼子代理输出的核心结论(保留首尾重点,折叠冗余日志)
|
|
6
|
+
// 2. formatSubagentsCompletionNotice: 将批处理/防抖收敛的一组终态子代理格式化为
|
|
7
|
+
// 高信噪比、低 Token 占用的父对话唤醒汇报
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
import { pick } from "./i18n.js";
|
|
10
|
+
import { subagentRunOutcome } from "./subagent-helpers.js";
|
|
11
|
+
/**
|
|
12
|
+
* 从子代理的长文本输出中提取核心结论:
|
|
13
|
+
* - 输出较短(<= 20 行)时原样返回;
|
|
14
|
+
* - 输出较长时保留前 3 行任务概况与后 15 行最终总结/结论,中间过程性输出自适应折叠;
|
|
15
|
+
* - 空输出给出可读占位符。
|
|
16
|
+
*/
|
|
17
|
+
export function extractSubagentConclusion(output, lang = "en") {
|
|
18
|
+
const trimmed = (output ?? "").trim();
|
|
19
|
+
if (!trimmed) {
|
|
20
|
+
return lang === "zh" ? "(无输出结果)" : "(no output produced)";
|
|
21
|
+
}
|
|
22
|
+
const lines = trimmed.split("\n");
|
|
23
|
+
if (lines.length <= 20) {
|
|
24
|
+
return trimmed;
|
|
25
|
+
}
|
|
26
|
+
const head = lines.slice(0, 3).join("\n");
|
|
27
|
+
const tail = lines.slice(-15).join("\n");
|
|
28
|
+
const omitted = lines.length - 18;
|
|
29
|
+
const omitMarker = lang === "zh"
|
|
30
|
+
? `… [中间省略 ${omitted} 行过程日志,完整转录可通过 get_result 查看] …`
|
|
31
|
+
: `… [${omitted} lines omitted, full transcript available via get_result] …`;
|
|
32
|
+
return `${head}\n${omitMarker}\n${tail}`;
|
|
33
|
+
}
|
|
34
|
+
/** 短 id(前 8 字符) */
|
|
35
|
+
function shortId(id) {
|
|
36
|
+
return id.slice(0, 8);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 格式化聚合的一组终态子代理为父对话的入站通知。
|
|
40
|
+
* 多个子代理同时完成时合成一条结构化汇报,避免碎片化打断父对话。
|
|
41
|
+
*/
|
|
42
|
+
export function formatSubagentsCompletionNotice(subagents, lang = "en", fallbackOriginalParentId) {
|
|
43
|
+
if (subagents.length === 0)
|
|
44
|
+
return "";
|
|
45
|
+
const count = subagents.length;
|
|
46
|
+
const fallbackNote = fallbackOriginalParentId
|
|
47
|
+
? pick(lang, `(原父对话 ${shortId(fallbackOriginalParentId)} 已不在,转至当前活跃对话继续)\n`, `(Original parent chat ${shortId(fallbackOriginalParentId)} is gone; redirected here)\n`, "subagents.notify.fallback", { parentId: shortId(fallbackOriginalParentId) })
|
|
48
|
+
: "";
|
|
49
|
+
const titleHeader = pick(lang, `[子代理执行完成通知] 共有 ${count} 个子代理已完成:`, `[Subagent Completion Notice] ${count} subagent(s) completed:`, "subagents.notify.header", { count });
|
|
50
|
+
const items = subagents.map((conv) => {
|
|
51
|
+
const sId = shortId(conv.id);
|
|
52
|
+
const type = conv.subagentType ?? "general";
|
|
53
|
+
const roleModel = conv.session.model
|
|
54
|
+
? `${conv.session.model.provider}/${conv.session.model.id}`
|
|
55
|
+
: conv.subagentTemplate?.model || "default";
|
|
56
|
+
const thinking = conv.session.thinkingLevel ?? conv.subagentThinking ?? "default";
|
|
57
|
+
const metaTag = `${type} · ${roleModel}:${thinking}`;
|
|
58
|
+
const outcome = subagentRunOutcome(conv);
|
|
59
|
+
let statusLabel;
|
|
60
|
+
if (outcome.error) {
|
|
61
|
+
statusLabel = pick(lang, `❌ 运行失败(${outcome.error})`, `❌ Failed (${outcome.error})`, "subagents.notify.status.failed", { error: outcome.error });
|
|
62
|
+
}
|
|
63
|
+
else if (outcome.canceled) {
|
|
64
|
+
statusLabel = pick(lang, "⚠️ 已中止", "⚠️ Canceled", "subagents.notify.status.canceled");
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
statusLabel = pick(lang, "✅ 正常完成", "✅ Done", "subagents.notify.status.done");
|
|
68
|
+
}
|
|
69
|
+
const rawOutput = conv.session.getLastAssistantText() ?? "";
|
|
70
|
+
const conclusion = extractSubagentConclusion(rawOutput, lang);
|
|
71
|
+
const indentedConclusion = conclusion
|
|
72
|
+
.split("\n")
|
|
73
|
+
.map((l) => ` > ${l}`)
|
|
74
|
+
.join("\n");
|
|
75
|
+
const taskLine = conv.title ? ` - ${pick(lang, "目标", "Goal", "subagents.notify.goal")}: ${conv.title}\n` : "";
|
|
76
|
+
let wtLine = "";
|
|
77
|
+
if (conv.subagentWorktree) {
|
|
78
|
+
const wt = conv.subagentWorktree;
|
|
79
|
+
if (wt.cleanedUp) {
|
|
80
|
+
wtLine = ` - ${pick(lang, "工作树隔离", "Worktree isolation", "subagents.notify.worktree")}: ${pick(lang, "无文件修改,临时工作树已自动清理", "No changes made; temporary worktree cleaned up", "subagents.notify.worktree.cleaned")}\n`;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
wtLine =
|
|
84
|
+
` - ${pick(lang, "工作树隔离", "Worktree isolation", "subagents.notify.worktree")}: ` +
|
|
85
|
+
pick(lang, `已保留分支 ${wt.branch}(${wt.uncommittedCount ?? 0} 处未提交修改,${wt.aheadCount ?? 0} 个新提交)`, `Preserved branch ${wt.branch} (${wt.uncommittedCount ?? 0} uncommitted, ${wt.aheadCount ?? 0} commits ahead)`, "subagents.notify.worktree.preserved", { branch: wt.branch, uncommitted: wt.uncommittedCount ?? 0, ahead: wt.aheadCount ?? 0 }) +
|
|
86
|
+
`\n - ${pick(lang, "工作树路径", "Worktree path", "subagents.notify.worktree.path")}: ${wt.worktreePath}\n`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return `- **${sId}**(${metaTag})— ${statusLabel}\n${taskLine}${wtLine} - ${pick(lang, "产出摘要", "Summary", "subagents.notify.summary")}:\n${indentedConclusion}`;
|
|
90
|
+
});
|
|
91
|
+
const footer = pick(lang, '\n如需调取子代理完整对话转录与工具执行详情,可调用 subagent(action="get_result", runId="<id>")。', '\nFor full transcripts or detailed tool logs, call subagent(action="get_result", runId="<id>").', "subagents.notify.footer");
|
|
92
|
+
return `${fallbackNote}${titleHeader}\n\n${items.join("\n\n")}${footer}`;
|
|
93
|
+
}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { pick } from "./i18n.js";
|
|
2
|
+
import { bashCommandIsReadOnly } from "./plan-mode.js";
|
|
3
|
+
import { goalReviewBashAllowed } from "./goal-review-gate.js";
|
|
4
|
+
/** 常见只读角色关键词(转小写后包含即判定为 readonly)。 */
|
|
5
|
+
const READONLY_ROLE_KEYWORDS = ["explore", "scout", "research", "oracle", "librarian", "reader"];
|
|
6
|
+
/** 常见审查验证角色关键词(转小写后包含即判定为 verify)。 */
|
|
7
|
+
const VERIFY_ROLE_KEYWORDS = ["review", "audit", "verify", "inspector"];
|
|
8
|
+
/**
|
|
9
|
+
* 解析并推导子代理的安全模式:
|
|
10
|
+
* 1. 优先使用模板显式声明的 securityMode;
|
|
11
|
+
* 2. 其次根据模板名或 type 关键词兜底(保障老用户无 securityMode 字段的模板或直接传 type 时自然生效);
|
|
12
|
+
* 3. 缺省返回 "normal"。
|
|
13
|
+
*/
|
|
14
|
+
export function resolveSecurityMode(nameOrType, template) {
|
|
15
|
+
if (template?.securityMode && template.securityMode !== "normal") {
|
|
16
|
+
return template.securityMode;
|
|
17
|
+
}
|
|
18
|
+
const candidate = `${template?.name ?? ""} ${nameOrType ?? ""}`.trim().toLowerCase();
|
|
19
|
+
if (!candidate)
|
|
20
|
+
return "normal";
|
|
21
|
+
for (const kw of VERIFY_ROLE_KEYWORDS) {
|
|
22
|
+
if (candidate.includes(kw))
|
|
23
|
+
return "verify";
|
|
24
|
+
}
|
|
25
|
+
for (const kw of READONLY_ROLE_KEYWORDS) {
|
|
26
|
+
if (candidate.includes(kw))
|
|
27
|
+
return "readonly";
|
|
28
|
+
}
|
|
29
|
+
return "normal";
|
|
30
|
+
}
|
|
31
|
+
/** 别名映射:将调用方可能传入的泛称归一化为实际注册的工具名。 */
|
|
32
|
+
const TOOL_NAME_ALIASES = {
|
|
33
|
+
terminal: "bash",
|
|
34
|
+
shell: "bash",
|
|
35
|
+
sh: "bash",
|
|
36
|
+
cmd: "bash",
|
|
37
|
+
exec: "bash",
|
|
38
|
+
cli: "bash",
|
|
39
|
+
grep: "grep",
|
|
40
|
+
find: "find",
|
|
41
|
+
read: "read",
|
|
42
|
+
view: "read",
|
|
43
|
+
cat: "read",
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 宽容解析 delegate_task 的 required_tools 文本。
|
|
47
|
+
* 支持:
|
|
48
|
+
* - 逗号/分号/空白分隔:"read, grep, find"
|
|
49
|
+
* - 换行列表:"- read\n- grep"
|
|
50
|
+
* - 预设代称识别:"read-only" / "readonly" -> 返回空 allowedTools 但可标明预设意图
|
|
51
|
+
*
|
|
52
|
+
* @param raw 模型传入的原始输入
|
|
53
|
+
* @param availableTools 当前环境可用工具名集合(可选,若提供则校验合法性)
|
|
54
|
+
*/
|
|
55
|
+
export function parseRequiredTools(raw, availableTools) {
|
|
56
|
+
if (typeof raw !== "string" || !raw.trim()) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
const text = raw.trim();
|
|
60
|
+
// 特殊标记识别
|
|
61
|
+
const lower = text.toLowerCase();
|
|
62
|
+
const requestedReadOnly = lower.includes("read-only") || lower.includes("readonly") || lower.includes("reader");
|
|
63
|
+
// 匹配单词 token(支持连字符与下划线,如 edit_soft)
|
|
64
|
+
const matches = text.match(/[A-Za-z0-9_-]+/g) || [];
|
|
65
|
+
const availableSet = availableTools instanceof Set ? availableTools : availableTools ? new Set(availableTools) : null;
|
|
66
|
+
const seen = new Set();
|
|
67
|
+
const allowedTools = [];
|
|
68
|
+
const unrecognized = [];
|
|
69
|
+
for (const item of matches) {
|
|
70
|
+
const token = item.trim().toLowerCase();
|
|
71
|
+
// 跳过常见的介词、连接词与预设代称关键词
|
|
72
|
+
if ([
|
|
73
|
+
"and",
|
|
74
|
+
"or",
|
|
75
|
+
"with",
|
|
76
|
+
"only",
|
|
77
|
+
"tools",
|
|
78
|
+
"tool",
|
|
79
|
+
"the",
|
|
80
|
+
"for",
|
|
81
|
+
"read-only",
|
|
82
|
+
"readonly",
|
|
83
|
+
"reader",
|
|
84
|
+
"none",
|
|
85
|
+
"all",
|
|
86
|
+
].includes(token)) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const mapped = TOOL_NAME_ALIASES[token] ?? token;
|
|
90
|
+
if (seen.has(mapped))
|
|
91
|
+
continue;
|
|
92
|
+
seen.add(mapped);
|
|
93
|
+
if (availableSet) {
|
|
94
|
+
if (availableSet.has(mapped)) {
|
|
95
|
+
allowedTools.push(mapped);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
unrecognized.push(token);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
allowedTools.push(mapped);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
allowedTools: allowedTools.length > 0 ? allowedTools : undefined,
|
|
107
|
+
unrecognized: unrecognized.length > 0 ? unrecognized : undefined,
|
|
108
|
+
requestedReadOnly,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** 目标模式与只读模式下公认的硬写类工具名。 */
|
|
112
|
+
export const SUBAGENT_WRITE_TOOL_NAMES = new Set([
|
|
113
|
+
"write",
|
|
114
|
+
"create",
|
|
115
|
+
"create_file",
|
|
116
|
+
"write_file",
|
|
117
|
+
"edit",
|
|
118
|
+
"edit_file",
|
|
119
|
+
"edit_soft",
|
|
120
|
+
"apply_patch",
|
|
121
|
+
"patch",
|
|
122
|
+
"patch_tool",
|
|
123
|
+
"str_replace",
|
|
124
|
+
"str_replace_editor",
|
|
125
|
+
"multi_edit",
|
|
126
|
+
"notebook_edit",
|
|
127
|
+
"mv",
|
|
128
|
+
"move",
|
|
129
|
+
"cp",
|
|
130
|
+
"copy",
|
|
131
|
+
"mkdir",
|
|
132
|
+
"rm",
|
|
133
|
+
"rmdir",
|
|
134
|
+
"delete",
|
|
135
|
+
"delete_file",
|
|
136
|
+
"touch",
|
|
137
|
+
"chmod",
|
|
138
|
+
"chown",
|
|
139
|
+
"codemode",
|
|
140
|
+
"powershell",
|
|
141
|
+
]);
|
|
142
|
+
/** 交互式终端输入工具:受限模式下必须禁用,防止通过交互输入写命令绕过检测。 */
|
|
143
|
+
export const SUBAGENT_TERMINAL_INPUT_TOOLS = new Set([
|
|
144
|
+
"terminal_input",
|
|
145
|
+
"terminal_key",
|
|
146
|
+
"terminal_create",
|
|
147
|
+
"terminal_close",
|
|
148
|
+
]);
|
|
149
|
+
/** 越权派发工具:受限子代理禁止再派生/操控其他子代理。 */
|
|
150
|
+
export const SUBAGENT_DISPATCH_TOOLS = new Set(["delegate_task"]);
|
|
151
|
+
/** bash 类工具名。 */
|
|
152
|
+
const BASH_TOOL_NAMES = new Set(["bash", "bash_execute", "run_command", "shell", "terminal", "terminal_exec"]);
|
|
153
|
+
/** 取工具参数中的命令字段。 */
|
|
154
|
+
function commandOf(params) {
|
|
155
|
+
if (!params || typeof params !== "object")
|
|
156
|
+
return "";
|
|
157
|
+
const p = params;
|
|
158
|
+
for (const key of ["command", "cmd", "script", "input"]) {
|
|
159
|
+
const v = p[key];
|
|
160
|
+
if (typeof v === "string" && v.trim() !== "")
|
|
161
|
+
return v;
|
|
162
|
+
}
|
|
163
|
+
return "";
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 校验子代理对指定工具的调用是否违规(纯函数)。
|
|
167
|
+
*
|
|
168
|
+
* @param mode 子代理的安全模式
|
|
169
|
+
* @param toolName 被调用的工具名
|
|
170
|
+
* @param params 调用参数
|
|
171
|
+
* @param allowedTools 显式工具白名单集合(若设置)
|
|
172
|
+
*/
|
|
173
|
+
export function subagentSecurityDenial(mode, toolName, params, allowedTools) {
|
|
174
|
+
const name = (toolName ?? "").trim();
|
|
175
|
+
if (!name)
|
|
176
|
+
return undefined;
|
|
177
|
+
// 1. 显式白名单门控(若配置了 allowedTools)
|
|
178
|
+
if (allowedTools && allowedTools.size > 0 && !allowedTools.has(name)) {
|
|
179
|
+
return {
|
|
180
|
+
kind: "not-allowed-tool",
|
|
181
|
+
reason: `受限子代理:工具 "${name}" 不在本次任务允许的工具白名单内(仅限:${[...allowedTools].join(", ")})。`,
|
|
182
|
+
reasonEn: `Restricted subagent: tool "${name}" is not in the allowed tool whitelist for this task (only: ${[...allowedTools].join(", ")}).`,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// normal 模式下不追加写拦截与 bash 只读限制
|
|
186
|
+
if (mode === "normal") {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
// 2. 派发工具拦截(只读/审查子代理禁止派发或操纵同伴,防止安全穿透)
|
|
190
|
+
if (SUBAGENT_DISPATCH_TOOLS.has(name)) {
|
|
191
|
+
return {
|
|
192
|
+
kind: "dispatch-tool",
|
|
193
|
+
reason: `受限子代理(${mode}):禁止调用派发工具 "${name}"。请在当前会话内独立完成分析与核实并返回结论。`,
|
|
194
|
+
reasonEn: `Restricted subagent (${mode}): dispatch tool "${name}" is blocked. Complete inspection and return findings within this session.`,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (name === "subagent") {
|
|
198
|
+
const action = typeof params === "object" && params !== null ? params.action : undefined;
|
|
199
|
+
const act = typeof action === "string" ? action.trim().toLowerCase() : "";
|
|
200
|
+
// 只放行只读查询类 action,拦截 spawn/steer/stop/handoff/wait_all
|
|
201
|
+
if (act !== "get_result" && act !== "list" && act !== "templates") {
|
|
202
|
+
return {
|
|
203
|
+
kind: "dispatch-tool",
|
|
204
|
+
reason: `受限子代理(${mode}):禁止调用 subagent(action="${act || "spawn"}") 派生或操控其他子代理。`,
|
|
205
|
+
reasonEn: `Restricted subagent (${mode}): subagent(action="${act || "spawn"}") is blocked in restricted mode.`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// 3. 硬写类工具拦截
|
|
210
|
+
if (SUBAGENT_WRITE_TOOL_NAMES.has(name)) {
|
|
211
|
+
return {
|
|
212
|
+
kind: "write-tool",
|
|
213
|
+
reason: `受限子代理(${mode}):当前属于只读/审查模式,禁止调用写工具 "${name}"。请使用 read/grep/只读命令进行核实。`,
|
|
214
|
+
reasonEn: `Restricted subagent (${mode}): write tool "${name}" is blocked in read/verify mode. Use read/grep/read-only commands to inspect.`,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
// 4. 交互式终端输入拦截(防绕过)
|
|
218
|
+
if (SUBAGENT_TERMINAL_INPUT_TOOLS.has(name)) {
|
|
219
|
+
return {
|
|
220
|
+
kind: "terminal-input",
|
|
221
|
+
reason: `受限子代理(${mode}):禁止使用交互式终端输入工具 "${name}"。请使用一次性 bash 只读命令。`,
|
|
222
|
+
reasonEn: `Restricted subagent (${mode}): interactive terminal tool "${name}" is blocked. Use one-shot read-only bash commands instead.`,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// 5. Bash 命令动态审查拦截
|
|
226
|
+
if (BASH_TOOL_NAMES.has(name)) {
|
|
227
|
+
const cmd = commandOf(params);
|
|
228
|
+
if (!cmd.trim()) {
|
|
229
|
+
return {
|
|
230
|
+
kind: "bash-write",
|
|
231
|
+
reason: `受限子代理(${mode}):不接受无命令的 bash 调用。`,
|
|
232
|
+
reasonEn: `Restricted subagent (${mode}): empty bash calls are rejected.`,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
if (mode === "readonly") {
|
|
236
|
+
// 严格只读模式:必须过 bashCommandIsReadOnly
|
|
237
|
+
if (!bashCommandIsReadOnly(cmd)) {
|
|
238
|
+
return {
|
|
239
|
+
kind: "bash-write",
|
|
240
|
+
reason: `只读侦察子代理(readonly):命令被阻断(仅允许纯只读命令,如 ls/cat/grep/git diff/git log 等):\`${cmd.slice(0, 160)}\`。`,
|
|
241
|
+
reasonEn: `Read-only subagent (readonly): command blocked (only pure read-only commands allowed, e.g. ls/cat/grep/git diff/git log): \`${cmd.slice(0, 160)}\`.`,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else if (mode === "verify") {
|
|
246
|
+
// 审查验证模式:允许只读命令 + 测试套件(goalReviewBashAllowed)
|
|
247
|
+
if (!goalReviewBashAllowed(cmd)) {
|
|
248
|
+
return {
|
|
249
|
+
kind: "bash-write",
|
|
250
|
+
reason: `审查验证子代理(verify):命令被阻断(仅允许只读命令与测试套件,禁止重定向写或破坏性操作):\`${cmd.slice(0, 160)}\`。`,
|
|
251
|
+
reasonEn: `Verification subagent (verify): command blocked (only read-only and test runner commands allowed, no redirect writes or destructive ops): \`${cmd.slice(0, 160)}\`.`,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 将工具包裹上子代理安全门禁(withSubagentSecurityGate)。
|
|
260
|
+
*/
|
|
261
|
+
export function withSubagentSecurityGate(def, getSecurityInfo, getLang) {
|
|
262
|
+
return {
|
|
263
|
+
...def,
|
|
264
|
+
execute: (async (...args) => {
|
|
265
|
+
const info = getSecurityInfo();
|
|
266
|
+
const mode = info.mode ?? "normal";
|
|
267
|
+
const allowedTools = info.allowedTools;
|
|
268
|
+
if (mode !== "normal" || (allowedTools && allowedTools.size > 0)) {
|
|
269
|
+
const params = args[1];
|
|
270
|
+
const denied = subagentSecurityDenial(mode, def.name, params, allowedTools);
|
|
271
|
+
if (denied) {
|
|
272
|
+
return {
|
|
273
|
+
content: [{ type: "text", text: pick(getLang(), denied.reason, denied.reasonEn) }],
|
|
274
|
+
details: { guardDenied: true, subagentSecurityDenied: true, kind: denied.kind },
|
|
275
|
+
isError: true,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return def.execute(...args);
|
|
280
|
+
}),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
@@ -154,6 +154,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
154
154
|
model: "",
|
|
155
155
|
thinkingLevel: "",
|
|
156
156
|
enabled: true,
|
|
157
|
+
securityMode: "verify",
|
|
157
158
|
},
|
|
158
159
|
{
|
|
159
160
|
name: "implement",
|
|
@@ -199,6 +200,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
199
200
|
model: "",
|
|
200
201
|
thinkingLevel: "",
|
|
201
202
|
enabled: true,
|
|
203
|
+
securityMode: "normal",
|
|
202
204
|
},
|
|
203
205
|
{
|
|
204
206
|
name: "research",
|
|
@@ -240,6 +242,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
240
242
|
model: "",
|
|
241
243
|
thinkingLevel: "",
|
|
242
244
|
enabled: true,
|
|
245
|
+
securityMode: "readonly",
|
|
243
246
|
},
|
|
244
247
|
{
|
|
245
248
|
name: "scout",
|
|
@@ -285,6 +288,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
285
288
|
model: "",
|
|
286
289
|
thinkingLevel: "",
|
|
287
290
|
enabled: true,
|
|
291
|
+
securityMode: "readonly",
|
|
288
292
|
},
|
|
289
293
|
{
|
|
290
294
|
name: "audit",
|
|
@@ -312,6 +316,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
312
316
|
model: "",
|
|
313
317
|
thinkingLevel: "",
|
|
314
318
|
enabled: true,
|
|
319
|
+
securityMode: "verify",
|
|
315
320
|
},
|
|
316
321
|
{
|
|
317
322
|
name: "delegate",
|
|
@@ -366,6 +371,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
366
371
|
model: "",
|
|
367
372
|
thinkingLevel: "",
|
|
368
373
|
enabled: true,
|
|
374
|
+
securityMode: "readonly",
|
|
369
375
|
},
|
|
370
376
|
{
|
|
371
377
|
name: "librarian",
|
|
@@ -391,6 +397,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
391
397
|
model: "",
|
|
392
398
|
thinkingLevel: "",
|
|
393
399
|
enabled: true,
|
|
400
|
+
securityMode: "readonly",
|
|
394
401
|
},
|
|
395
402
|
{
|
|
396
403
|
name: "explore",
|
|
@@ -424,6 +431,7 @@ export const DEFAULT_TEMPLATES = [
|
|
|
424
431
|
model: "",
|
|
425
432
|
thinkingLevel: "",
|
|
426
433
|
enabled: true,
|
|
434
|
+
securityMode: "readonly",
|
|
427
435
|
},
|
|
428
436
|
{
|
|
429
437
|
name: "metis",
|