codexmate 0.1.31 → 0.1.32
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/README.md +3 -3
- package/README.vi.md +3 -3
- package/README.zh.md +3 -3
- package/cli/agents-files.js +18 -4
- package/cli/plugin-config.js +64 -0
- package/cli/prompt-history.js +17 -4
- package/cli/system-prompt-files.js +7 -2
- package/cli.js +36 -2
- package/lib/cli-config-engine.js +9 -3
- package/lib/session-context-health.js +82 -0
- package/lib/session-context-records.js +153 -0
- package/lib/web-startup-auth.js +5 -1
- package/package.json +1 -1
- package/plugins/prompt-templates/computed.mjs +3 -3
- package/plugins/prompt-templates/invocation.mjs +73 -0
- package/plugins/prompt-templates/methods.mjs +48 -3
- package/plugins/prompt-templates/overview.mjs +2 -0
- package/web-ui/app.js +25 -0
- package/web-ui/index.html +1 -0
- package/web-ui/logic.context-health.mjs +144 -0
- package/web-ui/modules/app.computed.prompts.mjs +11 -0
- package/web-ui/modules/app.methods.agents.mjs +20 -3
- package/web-ui/modules/app.methods.index.mjs +4 -0
- package/web-ui/modules/app.methods.system-prompt.mjs +17 -2
- package/web-ui/modules/context-health.methods.mjs +70 -0
- package/web-ui/modules/i18n/locales/en.mjs +33 -0
- package/web-ui/modules/i18n/locales/ja.mjs +33 -0
- package/web-ui/modules/i18n/locales/vi.mjs +33 -0
- package/web-ui/modules/i18n/locales/zh-tw.mjs +33 -0
- package/web-ui/modules/i18n/locales/zh.mjs +33 -0
- package/web-ui/modules/plugins.methods.mjs +2 -0
- package/web-ui/modules/prompt-ecosystem.methods.mjs +136 -0
- package/web-ui/partials/index/context-health.html +45 -0
- package/web-ui/partials/index/modal-prompt-invocation.html +17 -0
- package/web-ui/partials/index/panel-plugins.html +37 -9
- package/web-ui/partials/index/panel-prompts.html +18 -2
- package/web-ui/partials/index/panel-sessions.html +14 -11
- package/web-ui/res/web-ui-render.precompiled.js +682 -32
- package/web-ui/styles/context-health.css +107 -0
- package/web-ui/styles/prompts-editor.css +23 -0
- package/web-ui/styles/sessions-preview.css +21 -0
- package/web-ui/styles/sub-tabs.css +181 -0
- package/web-ui/styles.css +2 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export function createContextHealthMethods({ api }) {
|
|
2
|
+
return {
|
|
3
|
+
async loadSessionContextHealth(force = false) {
|
|
4
|
+
if (!this.activeSession || (this.mainTab !== 'sessions' && !this.sessionStandalone)) return;
|
|
5
|
+
const session = this.activeSession;
|
|
6
|
+
const stamp = `${this.getSessionExportKey(session)}:${this.sessionDetailRequestSeq}`;
|
|
7
|
+
if (force !== true && this.sessionContextHealthStamp === stamp) return;
|
|
8
|
+
this.sessionContextHealthStamp = stamp;
|
|
9
|
+
this.sessionContextHealth = null;
|
|
10
|
+
this.sessionContextHealthError = '';
|
|
11
|
+
this.sessionContextHealthFocusedNode = null;
|
|
12
|
+
this.sessionContextHealthLoading = true;
|
|
13
|
+
try {
|
|
14
|
+
const result = await api('session-context-health', { source: session.source,
|
|
15
|
+
sessionId: session.sessionId, filePath: session.filePath, cwd: session.cwd });
|
|
16
|
+
if (this.activeSession !== session || this.sessionContextHealthStamp !== stamp) return;
|
|
17
|
+
if (result.error) throw new Error(result.error);
|
|
18
|
+
this.sessionContextHealth = Object.freeze(result);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (this.activeSession === session && this.sessionContextHealthStamp === stamp) {
|
|
21
|
+
this.sessionContextHealthError = error.message || this.t('toast.load.fail');
|
|
22
|
+
}
|
|
23
|
+
} finally {
|
|
24
|
+
if (this.sessionContextHealthStamp === stamp) this.sessionContextHealthLoading = false;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
toggleContextHealthDetails() {
|
|
28
|
+
this.sessionContextHealthPinned = !this.sessionContextHealthPinned;
|
|
29
|
+
this.sessionContextHealthExpanded = this.sessionContextHealthPinned;
|
|
30
|
+
},
|
|
31
|
+
leaveContextHealthDetails() {
|
|
32
|
+
if (!this.sessionContextHealthPinned) this.sessionContextHealthExpanded = false;
|
|
33
|
+
},
|
|
34
|
+
contextHealthReasonLabel(reason) {
|
|
35
|
+
return this.t(`contextHealth.reason.${reason}`);
|
|
36
|
+
},
|
|
37
|
+
async jumpToContextHealthNode(node) {
|
|
38
|
+
if (!this.activeSession || this.sessionContextHealthNodeLoading) return;
|
|
39
|
+
const session = this.activeSession;
|
|
40
|
+
const stamp = this.sessionContextHealthStamp;
|
|
41
|
+
this.sessionContextHealthNodeLoading = true;
|
|
42
|
+
this.sessionContextHealthError = '';
|
|
43
|
+
try {
|
|
44
|
+
const result = await api('session-context-node', { source: session.source,
|
|
45
|
+
sessionId: session.sessionId, filePath: session.filePath, cwd: session.cwd, nodeId: node.id });
|
|
46
|
+
if (this.activeSession !== session || this.sessionContextHealthStamp !== stamp) return;
|
|
47
|
+
if (result.error) throw new Error(result.error);
|
|
48
|
+
this.sessionContextHealthFocusedNode = Object.freeze({ ...result.node,
|
|
49
|
+
estimatedTokens: node.estimatedTokens, percentage: node.percentage });
|
|
50
|
+
const matching = node.id.includes('.') ? -1
|
|
51
|
+
: this.activeSessionMessages.findIndex((message) => message.recordLineIndex === result.node.recordLineIndex
|
|
52
|
+
&& typeof message.text === 'string' && message.text.trim() === result.node.text.trim());
|
|
53
|
+
if (matching >= 0 && this.sessionPreviewRenderEnabled) {
|
|
54
|
+
this.sessionPreviewVisibleCount = Math.max(this.sessionPreviewVisibleCount, matching + 1);
|
|
55
|
+
}
|
|
56
|
+
await this.$nextTick();
|
|
57
|
+
const message = matching >= 0 ? this.activeSessionMessages[matching] : null;
|
|
58
|
+
const key = message ? this.getRecordRenderKey(message, matching) : '';
|
|
59
|
+
const original = key && this.sessionMessageRefMap[key];
|
|
60
|
+
const target = original || this.$refs.contextHealthFocusedMessage;
|
|
61
|
+
if (target) {
|
|
62
|
+
target.scrollIntoView({ block: 'start', behavior: 'auto' });
|
|
63
|
+
if (target === this.$refs.contextHealthFocusedMessage) target.focus();
|
|
64
|
+
}
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (this.activeSession === session) this.sessionContextHealthError = error.message || this.t('toast.load.fail');
|
|
67
|
+
} finally { this.sessionContextHealthNodeLoading = false; }
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
const en = Object.freeze({
|
|
2
|
+
'contextHealth.title': "Context health",
|
|
3
|
+
'contextHealth.loading': "Scanning the complete session…",
|
|
4
|
+
'contextHealth.composition': "Context composition",
|
|
5
|
+
'contextHealth.estimateHint': "Estimated from stored readable text; not actual request usage",
|
|
6
|
+
'contextHealth.nodes': "message nodes",
|
|
7
|
+
'contextHealth.topFive': "Top 5 largest nodes",
|
|
8
|
+
'contextHealth.jump': "Jump to this message",
|
|
9
|
+
'contextHealth.empty': "No readable messages to analyze",
|
|
10
|
+
'contextHealth.hotspots': "Bloat hotspots",
|
|
11
|
+
'contextHealth.message': "Located message node",
|
|
12
|
+
'contextHealth.category.system': "System & Rules",
|
|
13
|
+
'contextHealth.category.user': "User Prompts",
|
|
14
|
+
'contextHealth.category.assistant': "Assistant Reasoning & Text",
|
|
15
|
+
'contextHealth.category.tools': "Tool Outputs / Logs",
|
|
16
|
+
'contextHealth.category.code': "Code Blocks",
|
|
17
|
+
'contextHealth.level.healthy': "Healthy < 32k",
|
|
18
|
+
'contextHealth.level.heavy': "Heavy 32k–64k",
|
|
19
|
+
'contextHealth.level.bloated': "Bloated > 64k",
|
|
20
|
+
'contextHealth.reason.dominant_message': "Single node exceeds 15%",
|
|
21
|
+
'contextHealth.reason.repeated_file_read': "Repeated file read",
|
|
22
|
+
'contextHealth.reason.long_error_log': "Long error log",
|
|
23
|
+
'ecosystem.rollbackConfirm': "Rollback replaces the current configuration and unsaved edits. The current version is backed up before writing.",
|
|
24
|
+
'ecosystem.variablesTitle': "Fill template variables",
|
|
25
|
+
'ecosystem.variablesHint': "Values are used only for this invocation. Paste git_diff text; no commands are executed.",
|
|
26
|
+
'ecosystem.variablesRequired': "Fill every variable.",
|
|
27
|
+
'ecosystem.useTemplate': "Use template",
|
|
28
|
+
'ecosystem.share': "Share template",
|
|
29
|
+
'ecosystem.rollback': "Roll back to this version",
|
|
30
|
+
'ecosystem.historyCompare': "Historical version → current content",
|
|
31
|
+
'ecosystem.before': "Historical version",
|
|
32
|
+
'ecosystem.current': "Current content",
|
|
33
|
+
'ecosystem.storageFail': "Failed to save plugin configuration.",
|
|
34
|
+
'ecosystem.cacheFail': "Template configuration saved; browser cache update failed.",
|
|
2
35
|
'workflow.tagline': "Choose a task. Let it run in the background.",
|
|
3
36
|
'workflow.options': "Input parameters",
|
|
4
37
|
'workflow.title': "Automated workflows",
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
const ja = Object.freeze({
|
|
2
|
+
'contextHealth.title': "コンテキスト診断",
|
|
3
|
+
'contextHealth.loading': "会話全体を走査中…",
|
|
4
|
+
'contextHealth.composition': "コンテキストの構成比率",
|
|
5
|
+
'contextHealth.estimateHint': "保存された読めるテキストからの推定値。実際のリクエスト使用量とは異なります",
|
|
6
|
+
'contextHealth.nodes': "メッセージノード",
|
|
7
|
+
'contextHealth.topFive': "使用量の多い Top 5",
|
|
8
|
+
'contextHealth.jump': "このメッセージへ移動",
|
|
9
|
+
'contextHealth.empty': "集計できるテキストがありません",
|
|
10
|
+
'contextHealth.hotspots': "肥大化ホットスポット",
|
|
11
|
+
'contextHealth.message': "移動先のメッセージ",
|
|
12
|
+
'contextHealth.category.system': "システムとルール",
|
|
13
|
+
'contextHealth.category.user': "ユーザー指示",
|
|
14
|
+
'contextHealth.category.assistant': "モデルの応答と思考",
|
|
15
|
+
'contextHealth.category.tools': "ツール出力とログ",
|
|
16
|
+
'contextHealth.category.code': "コードと Diff",
|
|
17
|
+
'contextHealth.level.healthy': "正常 < 32k",
|
|
18
|
+
'contextHealth.level.heavy': "重い 32k–64k",
|
|
19
|
+
'contextHealth.level.bloated': "肥大 > 64k",
|
|
20
|
+
'contextHealth.reason.dominant_message': "単一ノードが 15% 超",
|
|
21
|
+
'contextHealth.reason.repeated_file_read': "ファイルの重複読み込み",
|
|
22
|
+
'contextHealth.reason.long_error_log': "長いエラーログ",
|
|
23
|
+
'ecosystem.rollbackConfirm': "ロールバックは現在の設定と未保存の編集を置き換えます。書き込み前に現在のバージョンをバックアップします。",
|
|
24
|
+
'ecosystem.variablesTitle': "テンプレート変数を入力",
|
|
25
|
+
'ecosystem.variablesHint': "入力値は今回の呼び出しだけで使用します。git_diff は差分テキストを貼り付けてください。コマンドは実行しません。",
|
|
26
|
+
'ecosystem.variablesRequired': "すべての変数を入力してください。",
|
|
27
|
+
'ecosystem.useTemplate': "テンプレートを使用",
|
|
28
|
+
'ecosystem.share': "テンプレートを共有",
|
|
29
|
+
'ecosystem.rollback': "このバージョンに戻す",
|
|
30
|
+
'ecosystem.historyCompare': "履歴バージョン → 現在の内容",
|
|
31
|
+
'ecosystem.before': "履歴バージョン",
|
|
32
|
+
'ecosystem.current': "現在の内容",
|
|
33
|
+
'ecosystem.storageFail': "プラグイン設定の保存に失敗しました。",
|
|
34
|
+
'ecosystem.cacheFail': "テンプレート設定を保存しました。ブラウザーのキャッシュ更新に失敗しました。",
|
|
2
35
|
'workflow.tagline': "タスクを選んで、あとはバックグラウンドで。",
|
|
3
36
|
'workflow.options': "入力パラメーター",
|
|
4
37
|
'workflow.title': "自動ワークフロー",
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
const vi = Object.freeze({
|
|
2
|
+
'contextHealth.title': "Sức khỏe ngữ cảnh",
|
|
3
|
+
'contextHealth.loading': "Đang quét toàn bộ phiên…",
|
|
4
|
+
'contextHealth.composition': "Tỷ lệ thành phần ngữ cảnh",
|
|
5
|
+
'contextHealth.estimateHint': "Ước tính từ văn bản đọc được đã lưu; không phải mức dùng thực tế",
|
|
6
|
+
'contextHealth.nodes': "nút tin nhắn",
|
|
7
|
+
'contextHealth.topFive': "Top 5 nút lớn nhất",
|
|
8
|
+
'contextHealth.jump': "Đi đến tin nhắn này",
|
|
9
|
+
'contextHealth.empty': "Không có văn bản để phân tích",
|
|
10
|
+
'contextHealth.hotspots': "Điểm phình ngữ cảnh",
|
|
11
|
+
'contextHealth.message': "Nút tin nhắn được định vị",
|
|
12
|
+
'contextHealth.category.system': "Hệ thống và quy tắc",
|
|
13
|
+
'contextHealth.category.user': "Chỉ dẫn người dùng",
|
|
14
|
+
'contextHealth.category.assistant': "Văn bản và suy luận của mô hình",
|
|
15
|
+
'contextHealth.category.tools': "Đầu ra công cụ và nhật ký",
|
|
16
|
+
'contextHealth.category.code': "Mã và Diff",
|
|
17
|
+
'contextHealth.level.healthy': "Khỏe < 32k",
|
|
18
|
+
'contextHealth.level.heavy': "Nặng 32k–64k",
|
|
19
|
+
'contextHealth.level.bloated': "Phình > 64k",
|
|
20
|
+
'contextHealth.reason.dominant_message': "Một nút vượt 15%",
|
|
21
|
+
'contextHealth.reason.repeated_file_read': "Đọc lại cùng tệp",
|
|
22
|
+
'contextHealth.reason.long_error_log': "Nhật ký lỗi dài",
|
|
23
|
+
'ecosystem.rollbackConfirm': "Khôi phục sẽ thay thế cấu hình hiện tại và nội dung chưa lưu. Phiên bản hiện tại được sao lưu trước khi ghi.",
|
|
24
|
+
'ecosystem.variablesTitle': "Điền biến mẫu",
|
|
25
|
+
'ecosystem.variablesHint': "Giá trị chỉ dùng cho lần gọi này. Dán văn bản git_diff; không thực thi lệnh.",
|
|
26
|
+
'ecosystem.variablesRequired': "Điền tất cả các biến.",
|
|
27
|
+
'ecosystem.useTemplate': "Dùng mẫu",
|
|
28
|
+
'ecosystem.share': "Chia sẻ mẫu",
|
|
29
|
+
'ecosystem.rollback': "Khôi phục phiên bản này",
|
|
30
|
+
'ecosystem.historyCompare': "Phiên bản lịch sử → nội dung hiện tại",
|
|
31
|
+
'ecosystem.before': "Phiên bản lịch sử",
|
|
32
|
+
'ecosystem.current': "Nội dung hiện tại",
|
|
33
|
+
'ecosystem.storageFail': "Không thể lưu cấu hình plugin.",
|
|
34
|
+
'ecosystem.cacheFail': "Đã lưu cấu hình mẫu; không thể cập nhật bộ nhớ đệm trình duyệt.",
|
|
2
35
|
'workflow.tagline': "Chọn tác vụ. Để hệ thống tiếp tục chạy nền.",
|
|
3
36
|
'workflow.options': "Tham số đầu vào",
|
|
4
37
|
'workflow.title': "Quy trình tự động",
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
const zhTw = Object.freeze({
|
|
2
|
+
'contextHealth.title': "上下文健檢",
|
|
3
|
+
'contextHealth.loading': "掃描完整會話…",
|
|
4
|
+
'contextHealth.composition': "上下文組成比例",
|
|
5
|
+
'contextHealth.estimateHint': "依保存的可讀文字估算;不等於實際請求用量",
|
|
6
|
+
'contextHealth.nodes': "訊息節點",
|
|
7
|
+
'contextHealth.topFive': "佔用最多的 Top 5",
|
|
8
|
+
'contextHealth.jump': "定位此訊息",
|
|
9
|
+
'contextHealth.empty': "沒有可統計的文字訊息",
|
|
10
|
+
'contextHealth.hotspots': "膨脹熱點",
|
|
11
|
+
'contextHealth.message': "定位訊息節點",
|
|
12
|
+
'contextHealth.category.system': "系統與規則",
|
|
13
|
+
'contextHealth.category.user': "使用者指令",
|
|
14
|
+
'contextHealth.category.assistant': "模型文字與思考",
|
|
15
|
+
'contextHealth.category.tools': "工具輸出與日誌",
|
|
16
|
+
'contextHealth.category.code': "程式碼與 Diff",
|
|
17
|
+
'contextHealth.level.healthy': "健康 < 32k",
|
|
18
|
+
'contextHealth.level.heavy': "偏重 32k–64k",
|
|
19
|
+
'contextHealth.level.bloated': "膨脹 > 64k",
|
|
20
|
+
'contextHealth.reason.dominant_message': "單條超過 15%",
|
|
21
|
+
'contextHealth.reason.repeated_file_read': "重複讀取檔案",
|
|
22
|
+
'contextHealth.reason.long_error_log': "過長錯誤日誌",
|
|
23
|
+
'ecosystem.rollbackConfirm': "回復將取代目前設定與未儲存內容;寫入前保留目前版本備份。",
|
|
24
|
+
'ecosystem.variablesTitle': "填寫範本變數",
|
|
25
|
+
'ecosystem.variablesHint': "填寫後僅用於本次呼叫;git_diff 請貼上差異文字,不執行命令。",
|
|
26
|
+
'ecosystem.variablesRequired': "請填寫全部變數。",
|
|
27
|
+
'ecosystem.useTemplate': "使用範本",
|
|
28
|
+
'ecosystem.share': "分享範本",
|
|
29
|
+
'ecosystem.rollback': "回復至此版本",
|
|
30
|
+
'ecosystem.historyCompare': "歷史版本 → 目前內容",
|
|
31
|
+
'ecosystem.before': "歷史版本",
|
|
32
|
+
'ecosystem.current': "目前內容",
|
|
33
|
+
'ecosystem.storageFail': "外掛設定儲存失敗。",
|
|
34
|
+
'ecosystem.cacheFail': "範本設定已儲存;瀏覽器快取更新失敗。",
|
|
2
35
|
'workflow.tagline': "選好任務,背景接著做。",
|
|
3
36
|
'workflow.options': "輸入參數",
|
|
4
37
|
'workflow.title': "自動工作流程",
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
const zh = Object.freeze({
|
|
2
|
+
'contextHealth.title': "上下文体检",
|
|
3
|
+
'contextHealth.loading': "扫描完整会话…",
|
|
4
|
+
'contextHealth.composition': "上下文构成比例",
|
|
5
|
+
'contextHealth.estimateHint': "按保存的可读文本估算;不等同实际请求用量",
|
|
6
|
+
'contextHealth.nodes': "消息节点",
|
|
7
|
+
'contextHealth.topFive': "占用最多的 Top 5",
|
|
8
|
+
'contextHealth.jump': "定位此消息",
|
|
9
|
+
'contextHealth.empty': "没有可统计的文本消息",
|
|
10
|
+
'contextHealth.hotspots': "膨胀热点",
|
|
11
|
+
'contextHealth.message': "定位消息节点",
|
|
12
|
+
'contextHealth.category.system': "系统与规则",
|
|
13
|
+
'contextHealth.category.user': "用户指令",
|
|
14
|
+
'contextHealth.category.assistant': "模型文本与思考",
|
|
15
|
+
'contextHealth.category.tools': "工具输出与日志",
|
|
16
|
+
'contextHealth.category.code': "代码片段与 Diff",
|
|
17
|
+
'contextHealth.level.healthy': "健康 < 32k",
|
|
18
|
+
'contextHealth.level.heavy': "偏重 32k–64k",
|
|
19
|
+
'contextHealth.level.bloated': "膨胀 > 64k",
|
|
20
|
+
'contextHealth.reason.dominant_message': "单条超过 15%",
|
|
21
|
+
'contextHealth.reason.repeated_file_read': "重复读取文件",
|
|
22
|
+
'contextHealth.reason.long_error_log': "超长错误日志",
|
|
23
|
+
'ecosystem.rollbackConfirm': "回滚将替换当前配置与未保存内容;写入前保留当前版本备份。",
|
|
24
|
+
'ecosystem.variablesTitle': "填写模板变量",
|
|
25
|
+
'ecosystem.variablesHint': "填写后仅用于本次调用;git_diff 请粘贴差异文本,不执行命令。",
|
|
26
|
+
'ecosystem.variablesRequired': "请填写全部变量。",
|
|
27
|
+
'ecosystem.useTemplate': "使用模板",
|
|
28
|
+
'ecosystem.share': "分享模板",
|
|
29
|
+
'ecosystem.rollback': "回滚到此版本",
|
|
30
|
+
'ecosystem.historyCompare': "历史版本 → 当前内容",
|
|
31
|
+
'ecosystem.before': "历史版本",
|
|
32
|
+
'ecosystem.current': "当前内容",
|
|
33
|
+
'ecosystem.storageFail': "插件配置保存失败。",
|
|
34
|
+
'ecosystem.cacheFail': "模板配置已保存;浏览器缓存更新失败。",
|
|
2
35
|
'workflow.tagline': "选好任务,后台接着做。",
|
|
3
36
|
'workflow.options': "输入参数",
|
|
4
37
|
'workflow.title': "自动工作流",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createPromptTemplatesMethods } from '../../plugins/prompt-templates/methods.mjs';
|
|
2
2
|
import { createTextToolsMethods } from '../../plugins/text-tools/methods.mjs';
|
|
3
|
+
import { createPromptInvocationMethods } from '../../plugins/prompt-templates/invocation.mjs';
|
|
3
4
|
|
|
4
5
|
export function createPluginsMethods() {
|
|
5
6
|
return {
|
|
6
7
|
...createPromptTemplatesMethods(),
|
|
8
|
+
...createPromptInvocationMethods(),
|
|
7
9
|
...createTextToolsMethods()
|
|
8
10
|
};
|
|
9
11
|
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { normalizePromptTemplateDraft } from '../../plugins/prompt-templates/methods.mjs';
|
|
2
|
+
import { persistPromptTemplatesToStorage } from '../../plugins/prompt-templates/storage.mjs';
|
|
3
|
+
|
|
4
|
+
export function createPromptEcosystemMethods({ api }) {
|
|
5
|
+
return {
|
|
6
|
+
promptHistoryTarget(kind) {
|
|
7
|
+
if (kind === 'sys') return {
|
|
8
|
+
key: `${this.sysPromptScope}:${this.sysPromptMode}:${this.sysHistoryPreviewId}`,
|
|
9
|
+
busy: this.sysPromptLoading || this.sysPromptSaving || this.sysPromptDiffVisible,
|
|
10
|
+
id: this.sysHistoryPreviewId, content: this.sysHistoryPreviewContent,
|
|
11
|
+
action: 'apply-system-prompt', saving: 'sysPromptSaving',
|
|
12
|
+
params: { scope: this.sysPromptScope, mode: this.sysPromptMode, baseHash: this.sysPromptHash },
|
|
13
|
+
load: 'loadSystemPrompt', history: 'loadSysHistory', bucket: this.sysHistoryBucket
|
|
14
|
+
};
|
|
15
|
+
const context = this.agentsContext || 'codex';
|
|
16
|
+
const action = { codex: 'apply-agents-file', opencode: 'apply-opencode-agents-file', 'claude-project': 'apply-claude-md-file' }[context];
|
|
17
|
+
if (!action) return null;
|
|
18
|
+
return {
|
|
19
|
+
key: `${context}:${this.projectClaudeMdPath || ''}:${this.promptHistoryPreviewId}`,
|
|
20
|
+
busy: this.agentsLoading || this.agentsSaving || this.agentsDiffVisible,
|
|
21
|
+
id: this.promptHistoryPreviewId, content: this.promptHistoryPreviewContent,
|
|
22
|
+
action, saving: 'agentsSaving',
|
|
23
|
+
params: { baseContent: this.agentsOriginalContent, lineEnding: this.agentsLineEnding,
|
|
24
|
+
...(context === 'claude-project' ? { baseDir: this.projectClaudeMdPath } : {}) },
|
|
25
|
+
load: 'loadPromptsContent', history: 'loadPromptHistory', bucket: this.promptHistoryBucket
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
async rollbackPromptHistory(kind = 'agents') {
|
|
29
|
+
const target = this.promptHistoryTarget(kind);
|
|
30
|
+
if (!target || target.busy || !target.id) return false;
|
|
31
|
+
const confirmed = await this.requestConfirmDialog({ title: this.t('ecosystem.rollback'),
|
|
32
|
+
message: this.t('ecosystem.rollbackConfirm'), confirmText: this.t('ecosystem.rollback'),
|
|
33
|
+
cancelText: this.t('common.cancel'), danger: true });
|
|
34
|
+
const latest = this.promptHistoryTarget(kind);
|
|
35
|
+
if (!confirmed || !latest || latest.busy || latest.key !== target.key
|
|
36
|
+
|| latest.params.baseContent !== target.params.baseContent || latest.params.baseHash !== target.params.baseHash) return false;
|
|
37
|
+
this[target.saving] = true;
|
|
38
|
+
try {
|
|
39
|
+
const result = await api(target.action, { ...target.params, content: target.content });
|
|
40
|
+
if (result.error) throw new Error(result.error);
|
|
41
|
+
await this[target.load]();
|
|
42
|
+
await this[target.history](target.bucket);
|
|
43
|
+
this.showMessage(this.t('toast.history.restored'), 'success');
|
|
44
|
+
return true;
|
|
45
|
+
} catch (error) { this.showMessage(error.message || this.t('toast.save.fail'), 'error'); return false; }
|
|
46
|
+
finally { this[target.saving] = false; }
|
|
47
|
+
},
|
|
48
|
+
async loadPluginConfig() {
|
|
49
|
+
try {
|
|
50
|
+
const result = await api('get-plugin-config', {});
|
|
51
|
+
if (result.error) throw new Error(result.error);
|
|
52
|
+
this.pluginConfigHash = result.hash;
|
|
53
|
+
this.pluginHistoryBucket = result.historyBucket;
|
|
54
|
+
this.pluginConfigLoaded = true;
|
|
55
|
+
if (result.exists) {
|
|
56
|
+
const builtins = this.promptTemplatesListRaw.filter((item) => item.isBuiltin === true);
|
|
57
|
+
this.promptTemplatesListRaw = [...builtins, ...result.templates];
|
|
58
|
+
if (!persistPromptTemplatesToStorage(this.promptTemplatesListRaw, localStorage)) {
|
|
59
|
+
this.showMessage(this.t('ecosystem.cacheFail'), 'error');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
} catch (error) { this.showMessage(error.message || this.t('toast.load.fail'), 'error'); return false; }
|
|
64
|
+
},
|
|
65
|
+
async persistPluginTemplates(list) {
|
|
66
|
+
if (this.pluginConfigSaving) return false;
|
|
67
|
+
if (!this.pluginConfigLoaded && !await this.loadPluginConfig()) return false;
|
|
68
|
+
this.pluginConfigSaving = true;
|
|
69
|
+
try {
|
|
70
|
+
const result = await api('apply-plugin-config', { baseHash: this.pluginConfigHash,
|
|
71
|
+
templates: list.map(normalizePromptTemplateDraft),
|
|
72
|
+
legacyTemplates: this.promptTemplatesListRaw.map(normalizePromptTemplateDraft) });
|
|
73
|
+
if (result.error) throw new Error(result.error);
|
|
74
|
+
this.pluginConfigHash = result.hash;
|
|
75
|
+
this.pluginHistoryBucket = result.historyBucket;
|
|
76
|
+
return true;
|
|
77
|
+
} catch (error) { this.showMessage(error.message || this.t('ecosystem.storageFail'), 'error'); return false; }
|
|
78
|
+
finally { this.pluginConfigSaving = false; }
|
|
79
|
+
},
|
|
80
|
+
async openPluginHistory() {
|
|
81
|
+
if (this.pluginHistoryLoading || this.pluginConfigSaving) return;
|
|
82
|
+
if (!this.pluginConfigLoaded && !await this.loadPluginConfig()) return;
|
|
83
|
+
this.pluginHistoryVisible = true;
|
|
84
|
+
this.pluginHistorySelectedId = '';
|
|
85
|
+
this.pluginHistoryError = '';
|
|
86
|
+
this.pluginHistoryLoading = true;
|
|
87
|
+
try {
|
|
88
|
+
const result = await api('list-prompt-history', { bucket: this.pluginHistoryBucket });
|
|
89
|
+
if (result.error) throw new Error(result.error);
|
|
90
|
+
this.pluginHistoryItems = Array.isArray(result) ? result : [];
|
|
91
|
+
} catch (error) { this.pluginHistoryError = error.message; }
|
|
92
|
+
finally { this.pluginHistoryLoading = false; }
|
|
93
|
+
},
|
|
94
|
+
async viewPluginHistory(item) {
|
|
95
|
+
if (this.pluginHistoryLoading || this.pluginConfigSaving) return;
|
|
96
|
+
this.pluginHistoryLoading = true;
|
|
97
|
+
this.pluginHistorySelectedId = '';
|
|
98
|
+
this.pluginHistoryError = '';
|
|
99
|
+
try {
|
|
100
|
+
const result = await api('get-prompt-history', { bucket: this.pluginHistoryBucket, id: item.id });
|
|
101
|
+
if (result.error) throw new Error(result.error);
|
|
102
|
+
if (!this.pluginHistoryVisible) return;
|
|
103
|
+
this.pluginHistoryContent = result.content;
|
|
104
|
+
this.pluginHistorySelectedId = item.id;
|
|
105
|
+
} catch (error) { this.pluginHistoryError = error.message; }
|
|
106
|
+
finally { this.pluginHistoryLoading = false; }
|
|
107
|
+
},
|
|
108
|
+
async rollbackPluginConfig() {
|
|
109
|
+
if (!this.pluginHistorySelectedId || this.pluginHistoryLoading || this.pluginConfigSaving) return false;
|
|
110
|
+
const id = this.pluginHistorySelectedId;
|
|
111
|
+
const content = this.pluginHistoryContent;
|
|
112
|
+
const hash = this.pluginConfigHash;
|
|
113
|
+
const confirmed = await this.requestConfirmDialog({ title: this.t('ecosystem.rollback'),
|
|
114
|
+
message: this.t('ecosystem.rollbackConfirm'), confirmText: this.t('ecosystem.rollback'),
|
|
115
|
+
cancelText: this.t('common.cancel'), danger: true });
|
|
116
|
+
if (!confirmed || id !== this.pluginHistorySelectedId || hash !== this.pluginConfigHash || this.pluginConfigSaving) return false;
|
|
117
|
+
try {
|
|
118
|
+
const parsed = JSON.parse(content);
|
|
119
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.templates)) throw new Error(this.t('toast.import.invalidJson'));
|
|
120
|
+
if (!await this.persistPluginTemplates(parsed.templates)) return false;
|
|
121
|
+
const builtins = this.promptTemplatesListRaw.filter((item) => item.isBuiltin === true);
|
|
122
|
+
this.promptTemplatesListRaw = [...builtins, ...parsed.templates];
|
|
123
|
+
if (!persistPromptTemplatesToStorage(this.promptTemplatesListRaw, localStorage)) {
|
|
124
|
+
this.showMessage(this.t('ecosystem.cacheFail'), 'error');
|
|
125
|
+
}
|
|
126
|
+
this.promptTemplateDraftRaw = null;
|
|
127
|
+
this.promptTemplateSelectedId = '';
|
|
128
|
+
const first = this.promptTemplatesList[0];
|
|
129
|
+
if (first) this.selectPromptTemplate(first.id);
|
|
130
|
+
this.promptComposerSelectedTemplateId = first?.id || '';
|
|
131
|
+
await this.openPluginHistory();
|
|
132
|
+
return true;
|
|
133
|
+
} catch (error) { this.pluginHistoryError = error.message; return false; }
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<section v-if="activeSession" class="context-health" aria-labelledby="context-health-heading" :aria-busy="sessionContextHealthLoading" @vue:mounted="loadSessionContextHealth()" @vue:updated="loadSessionContextHealth()">
|
|
2
|
+
<div class="context-health-header">
|
|
3
|
+
<div class="context-health-heading">
|
|
4
|
+
<h3 id="context-health-heading" class="context-health-title">{{ t('contextHealth.title') }}</h3>
|
|
5
|
+
<span v-if="sessionContextHealth" :class="['context-health-rating', sessionContextHealth.health]" role="img" :aria-label="t('contextHealth.level.' + sessionContextHealth.health)"></span>
|
|
6
|
+
<p class="context-health-meta" v-if="sessionContextHealth">{{ sessionContextHealth.messageCount.toLocaleString() }} {{ t('contextHealth.nodes') }}</p>
|
|
7
|
+
<p class="context-health-meta" v-else-if="sessionContextHealthLoading" role="status">{{ t('contextHealth.loading') }}</p>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-if="sessionContextHealth" class="context-health-summary">
|
|
10
|
+
<span class="context-health-total mono">≈ {{ sessionContextHealth.totalEstimatedTokens.toLocaleString() }} <small>Token</small></span>
|
|
11
|
+
</div>
|
|
12
|
+
<div v-else-if="sessionContextHealthLoading" class="context-health-summary context-health-summary-skeleton" aria-hidden="true"><span></span></div>
|
|
13
|
+
<button type="button" class="btn-mini context-health-refresh" @click="loadSessionContextHealth(true)" :disabled="sessionContextHealthLoading" :aria-label="t('common.refresh')" :title="t('common.refresh')">
|
|
14
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 7v5h-5M4 17v-5h5"/><path d="M6.1 7a7 7 0 0 1 11.5-1.3L20 8M4 16l2.4 2.3A7 7 0 0 0 17.9 17"/></svg>
|
|
15
|
+
</button>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="context-health-bar" role="img" :aria-label="t('contextHealth.composition')">
|
|
18
|
+
<template v-if="sessionContextHealth">
|
|
19
|
+
<span v-for="part in sessionContextHealth.categories" :key="part.id" :class="['context-health-segment', part.id]" :style="{ flexGrow: part.estimatedTokens }" :title="t('contextHealth.category.' + part.id) + ': ≈ ' + part.estimatedTokens + ' Token (' + part.percentage.toFixed(2) + '%)'" :aria-label="t('contextHealth.category.' + part.id) + ': ' + part.percentage.toFixed(2) + '%'" v-show="part.estimatedTokens > 0"></span>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
<p v-if="sessionContextHealthError" class="form-error context-health-error" role="alert">{{ sessionContextHealthError }}</p>
|
|
23
|
+
<div v-if="sessionContextHealth" id="context-health-details" class="context-health-details">
|
|
24
|
+
<dl class="context-health-legend">
|
|
25
|
+
<div v-for="part in sessionContextHealth.categories" :key="part.id">
|
|
26
|
+
<dt><span :class="['context-health-dot', part.id]" aria-hidden="true"></span>{{ t('contextHealth.category.' + part.id) }}</dt>
|
|
27
|
+
<dd><span class="context-health-category-tokens mono">≈ {{ part.estimatedTokens.toLocaleString() }}</span><span class="context-health-category-share mono">{{ part.percentage.toFixed(2) }}%</span></dd>
|
|
28
|
+
</div>
|
|
29
|
+
</dl>
|
|
30
|
+
<p v-if="!sessionContextHealth.messageCount" class="context-health-note">{{ t('contextHealth.empty') }}</p>
|
|
31
|
+
</div>
|
|
32
|
+
<dl v-else-if="sessionContextHealthLoading" class="context-health-legend context-health-loading" aria-hidden="true">
|
|
33
|
+
<div v-for="part in ['system', 'user', 'assistant', 'tools', 'code']" :key="part" class="context-health-loading-row">
|
|
34
|
+
<dt><span :class="['context-health-dot', part]" aria-hidden="true"></span>{{ t('contextHealth.category.' + part) }}</dt>
|
|
35
|
+
<dd><span class="context-health-value-skeleton"></span><span class="context-health-share-skeleton"></span></dd>
|
|
36
|
+
</div>
|
|
37
|
+
</dl>
|
|
38
|
+
</section>
|
|
39
|
+
<article v-if="sessionContextHealthFocusedNode" ref="contextHealthFocusedMessage" class="context-health-focused-message" tabindex="-1" :data-context-node-id="sessionContextHealthFocusedNode.id" :aria-label="t('contextHealth.message')">
|
|
40
|
+
<header>
|
|
41
|
+
<div><strong>{{ t('contextHealth.message') }}</strong><span class="context-health-meta mono">{{ sessionContextHealthFocusedNode.id }}</span></div>
|
|
42
|
+
<button type="button" class="btn-mini context-health-refresh" @click="sessionContextHealthFocusedNode = null" :aria-label="t('common.close')"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18"/></svg></button>
|
|
43
|
+
</header>
|
|
44
|
+
<pre>{{ sessionContextHealthFocusedNode.text }}</pre>
|
|
45
|
+
</article>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div v-if="promptInvocationVisible" class="modal-overlay" @click.self="closePromptTemplateInvocation">
|
|
2
|
+
<form ref="promptInvocationDialog" class="modal prompt-invocation-dialog" role="dialog" aria-modal="true" aria-labelledby="prompt-invocation-title" aria-describedby="prompt-invocation-hint" @submit.prevent="finishPromptTemplateInvocation" @keydown="onPromptInvocationKeydown">
|
|
3
|
+
<h2 id="prompt-invocation-title" class="modal-title">{{ t('ecosystem.variablesTitle') }}</h2>
|
|
4
|
+
<p id="prompt-invocation-hint" class="form-hint">{{ t('ecosystem.variablesHint') }}</p>
|
|
5
|
+
<div class="prompt-invocation-fields">
|
|
6
|
+
<label v-for="(name, index) in promptInvocationNames" :key="name" class="form-group" :for="'prompt-invocation-var-' + index">
|
|
7
|
+
<span class="form-label mono">{{ '{' + '{' + name + '}' + '}' }}</span>
|
|
8
|
+
<textarea :id="'prompt-invocation-var-' + index" v-model="promptInvocationValues[name]" class="form-input" :rows="name === 'git_diff' ? 6 : 2" autocomplete="off" spellcheck="false" aria-required="true" :aria-invalid="!!promptInvocationError && !promptInvocationValues[name].trim()"></textarea>
|
|
9
|
+
</label>
|
|
10
|
+
</div>
|
|
11
|
+
<p v-if="promptInvocationError" class="form-error" role="alert">{{ promptInvocationError }}</p>
|
|
12
|
+
<div class="modal-actions">
|
|
13
|
+
<button type="button" class="btn btn-secondary" @click="closePromptTemplateInvocation">{{ t('common.cancel') }}</button>
|
|
14
|
+
<button type="submit" class="btn btn-primary">{{ t('ecosystem.useTemplate') }}</button>
|
|
15
|
+
</div>
|
|
16
|
+
</form>
|
|
17
|
+
</div>
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
<div v-if="promptComposerMissingVars.length" class="plugins-panel-note">{{ t('plugins.promptTemplates.compose.missingCount', { count: promptComposerMissingVars.length }) }}</div>
|
|
100
100
|
</div>
|
|
101
101
|
<div class="prompt-editor-actions">
|
|
102
|
-
<button v-if="promptComposerMissingVars.length" type="button" class="btn-mini" @click="focusPromptComposerFirstMissingVar" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.compose.jumpToMissing') }}</button>
|
|
103
|
-
<button type="button" class="btn-mini" @click="resetPromptComposerVarValues" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.vars.reset') }}</button>
|
|
102
|
+
<button v-if="promptComposerMissingVars.length" type="button" class="btn-mini" @click="focusPromptComposerFirstMissingVar" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.compose.jumpToMissing') }}</button>
|
|
103
|
+
<button type="button" class="btn-mini" @click="resetPromptComposerVarValues" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.vars.reset') }}</button>
|
|
104
104
|
</div>
|
|
105
105
|
</div>
|
|
106
106
|
<div class="prompt-vars-grid">
|
|
@@ -139,9 +139,9 @@
|
|
|
139
139
|
v-model.trim="promptTemplatesKeyword"
|
|
140
140
|
:aria-label="t('plugins.promptTemplates.manage.searchAria')"
|
|
141
141
|
:placeholder="t('plugins.promptTemplates.manage.searchPlaceholder')">
|
|
142
|
-
<button type="button" class="btn-mini" @click="createPromptTemplate" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.manage.create') }}</button>
|
|
142
|
+
<button type="button" class="btn-mini" @click="createPromptTemplate" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.manage.create') }}</button>
|
|
143
143
|
<button type="button" class="btn-mini" @click="exportPromptTemplates" :disabled="pluginsLoading || !promptTemplatesList.length">{{ t('plugins.promptTemplates.manage.export') }}</button>
|
|
144
|
-
<button type="button" class="btn-mini" @click="triggerPromptTemplatesImport" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.manage.import') }}</button>
|
|
144
|
+
<button type="button" class="btn-mini" @click="triggerPromptTemplatesImport" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.manage.import') }}</button>
|
|
145
145
|
</div>
|
|
146
146
|
|
|
147
147
|
<div v-if="pluginsLoading && !promptTemplatesLoadedOnce" class="skills-empty-state">{{ t('plugins.promptTemplates.manage.loading') }}</div>
|
|
@@ -168,15 +168,43 @@
|
|
|
168
168
|
</div>
|
|
169
169
|
|
|
170
170
|
<div class="prompt-templates-pane prompt-templates-pane-editor">
|
|
171
|
+
<div class="prompt-editor-actions">
|
|
172
|
+
<button type="button" class="btn-mini" @click="openPluginHistory" :disabled="pluginsLoading || pluginConfigSaving || pluginHistoryLoading">{{ t('common.history') }}</button>
|
|
173
|
+
<button type="button" class="btn-mini" @click="sharePromptTemplate" :disabled="pluginsLoading || pluginConfigSaving || !promptTemplateDraft">{{ t('ecosystem.share') }}</button>
|
|
174
|
+
</div>
|
|
175
|
+
<details v-if="pluginHistoryVisible" class="prompt-history-panel" open>
|
|
176
|
+
<summary class="prompt-history-summary">
|
|
177
|
+
<span>{{ t('common.history') }}</span>
|
|
178
|
+
<button type="button" class="btn-mini" @click="pluginHistoryVisible = false; pluginHistorySelectedId = ''" :aria-label="t('common.close')">×</button>
|
|
179
|
+
</summary>
|
|
180
|
+
<div class="prompt-history-body">
|
|
181
|
+
<div class="prompt-history-list" role="group" :aria-label="t('common.history')">
|
|
182
|
+
<button v-for="item in pluginHistoryItems" :key="item.id" type="button" :class="['btn-mini', { active: pluginHistorySelectedId === item.id }]" :aria-pressed="pluginHistorySelectedId === item.id" :disabled="pluginHistoryLoading || pluginConfigSaving" @click="viewPluginHistory(item)">{{ item.id }}</button>
|
|
183
|
+
</div>
|
|
184
|
+
<p v-if="pluginHistoryLoading" class="state-message">{{ t('diff.generating') }}</p>
|
|
185
|
+
<p v-else-if="pluginHistoryError" class="state-message error" role="alert">{{ pluginHistoryError }}</p>
|
|
186
|
+
<p v-else-if="!pluginHistoryItems.length" class="state-message">{{ t('toast.history.empty') }}</p>
|
|
187
|
+
<template v-if="pluginHistorySelectedId && !pluginHistoryLoading && !pluginHistoryError">
|
|
188
|
+
<div class="form-hint">{{ t('ecosystem.historyCompare') }} · +{{ pluginHistoryComparison.stats.added }} / −{{ pluginHistoryComparison.stats.removed }}</div>
|
|
189
|
+
<div class="agents-diff-view prompt-history-diff" role="region" :aria-label="t('ecosystem.historyCompare')" tabindex="0">
|
|
190
|
+
<div v-for="(line, index) in pluginHistoryComparison.lines" :key="index" :class="['agents-diff-line', line.type]">
|
|
191
|
+
<span class="agents-diff-line-sign">{{ line.type === 'add' ? '+' : (line.type === 'del' ? '−' : ' ') }}</span>
|
|
192
|
+
<span class="agents-diff-line-text">{{ line.value }}</span>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
<button type="button" class="btn-mini btn-confirm-mini" @click="rollbackPluginConfig" :disabled="pluginConfigSaving || pluginHistoryLoading">{{ t('ecosystem.rollback') }}</button>
|
|
196
|
+
</template>
|
|
197
|
+
</div>
|
|
198
|
+
</details>
|
|
171
199
|
<div v-if="!promptTemplateDraft" class="skills-empty-state">{{ t('plugins.promptTemplates.editor.selectHint') }}</div>
|
|
172
200
|
<template v-else>
|
|
173
201
|
<div class="prompt-editor-head">
|
|
174
202
|
<div class="prompt-editor-title-row">
|
|
175
203
|
<input class="form-input prompt-editor-name" type="text" v-model.trim="promptTemplateDraftRaw.name" :disabled="promptTemplateDraft.isBuiltin" :placeholder="t('plugins.promptTemplates.editor.namePlaceholder')" :aria-label="t('plugins.promptTemplates.editor.nameAria')">
|
|
176
204
|
<div v-if="!promptTemplateDraft.isBuiltin" class="prompt-editor-actions">
|
|
177
|
-
<button type="button" class="btn-mini" @click="duplicatePromptTemplate" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.editor.duplicate') }}</button>
|
|
178
|
-
<button type="button" class="btn-mini delete" @click="deletePromptTemplate" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.editor.delete') }}</button>
|
|
179
|
-
<button type="button" class="btn-mini" @click="savePromptTemplate" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.editor.save') }}</button>
|
|
205
|
+
<button type="button" class="btn-mini" @click="duplicatePromptTemplate" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.editor.duplicate') }}</button>
|
|
206
|
+
<button type="button" class="btn-mini delete" @click="deletePromptTemplate" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.editor.delete') }}</button>
|
|
207
|
+
<button type="button" class="btn-mini" @click="savePromptTemplate" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.editor.save') }}</button>
|
|
180
208
|
</div>
|
|
181
209
|
</div>
|
|
182
210
|
<div v-if="promptTemplateDraft.isBuiltin" class="plugins-panel-note">
|
|
@@ -206,7 +234,7 @@
|
|
|
206
234
|
<div class="plugins-panel-note">{{ t('plugins.promptTemplates.vars.hint') }}</div>
|
|
207
235
|
</div>
|
|
208
236
|
<div v-if="!promptTemplateDraft.isBuiltin" class="prompt-editor-actions">
|
|
209
|
-
<button type="button" class="btn-mini" @click="resetPromptVariableValues" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.vars.reset') }}</button>
|
|
237
|
+
<button type="button" class="btn-mini" @click="resetPromptVariableValues" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.vars.reset') }}</button>
|
|
210
238
|
</div>
|
|
211
239
|
</div>
|
|
212
240
|
|
|
@@ -225,7 +253,7 @@
|
|
|
225
253
|
<div class="prompt-vars-title">{{ t('plugins.promptTemplates.preview.title') }}</div>
|
|
226
254
|
<div class="plugins-panel-note">{{ t('plugins.promptTemplates.preview.hint') }}</div>
|
|
227
255
|
</div>
|
|
228
|
-
<button type="button" class="btn-mini" @click="copyRenderedPrompt" :disabled="pluginsLoading">{{ t('plugins.promptTemplates.preview.copy') }}</button>
|
|
256
|
+
<button type="button" class="btn-mini" @click="copyRenderedPrompt" :disabled="pluginsLoading || pluginConfigSaving">{{ t('plugins.promptTemplates.preview.copy') }}</button>
|
|
229
257
|
</div>
|
|
230
258
|
<textarea class="form-input prompt-preview-textarea" :value="renderedPrompt" rows="10" readonly spellcheck="false" :aria-label="t('plugins.promptTemplates.preview.outputAria')"></textarea>
|
|
231
259
|
</div>
|