codexmate 0.1.30 → 0.1.31
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 +95 -4
- package/README.vi.md +95 -4
- package/README.zh.md +96 -4
- package/cli/config-bootstrap.js +25 -11
- package/cli.js +360 -44
- package/lib/cli-config-engine.js +260 -0
- package/lib/cli-utils.js +2 -1
- package/lib/cli-webhook.js +1 -1
- package/lib/handoff-mcp.js +282 -0
- package/lib/http-access-control.js +335 -0
- package/lib/thread-handoff.js +130 -0
- package/lib/web-startup-auth.js +49 -0
- package/lib/workflow-engine.js +92 -21
- package/lib/workflow-runner.js +261 -0
- package/package.json +1 -1
- package/web-ui/app.js +23 -2
- package/web-ui/modules/access-token.mjs +33 -0
- package/web-ui/modules/api.mjs +2 -1
- package/web-ui/modules/app.methods.index.mjs +2 -0
- package/web-ui/modules/app.methods.navigation.mjs +17 -3
- package/web-ui/modules/app.methods.prompts-editor.mjs +7 -0
- package/web-ui/modules/app.methods.providers.mjs +2 -2
- package/web-ui/modules/app.methods.runtime.mjs +3 -2
- package/web-ui/modules/app.methods.session-actions.mjs +3 -0
- package/web-ui/modules/app.methods.session-browser.mjs +6 -2
- package/web-ui/modules/app.methods.workflows.mjs +41 -0
- package/web-ui/modules/i18n/locales/en.mjs +37 -2
- package/web-ui/modules/i18n/locales/ja.mjs +37 -2
- package/web-ui/modules/i18n/locales/vi.mjs +37 -2
- package/web-ui/modules/i18n/locales/zh-tw.mjs +37 -2
- package/web-ui/modules/i18n/locales/zh.mjs +37 -2
- package/web-ui/modules/sessions-filters-url.mjs +3 -0
- package/web-ui/modules/skills.methods.mjs +6 -5
- package/web-ui/modules/thread-handoff.mjs +142 -0
- package/web-ui/partials/index/panel-config-claude.html +2 -0
- package/web-ui/partials/index/panel-config-codex.html +2 -0
- package/web-ui/partials/index/panel-config-kilocode.html +3 -1
- package/web-ui/partials/index/panel-config-openclaw.html +2 -0
- package/web-ui/partials/index/panel-config-opencode.html +3 -1
- package/web-ui/partials/index/panel-config-pi.html +2 -0
- package/web-ui/partials/index/panel-dashboard.html +59 -0
- package/web-ui/partials/index/panel-prompts.html +28 -16
- package/web-ui/partials/index/panel-sessions.html +21 -33
- package/web-ui/partials/index/thread-handoff.html +59 -0
- package/web-ui/res/web-ui-render.precompiled.js +614 -152
- package/web-ui/styles/controls-forms.css +9 -0
- package/web-ui/styles/dashboard.css +51 -0
- package/web-ui/styles/modals-core.css +87 -0
- package/web-ui/styles/navigation-panels.css +1 -1
- package/web-ui/styles/plugins-panel.css +62 -0
- package/web-ui/styles/prompts-editor.css +11 -4
- package/web-ui/styles/responsive.css +19 -10
- package/web-ui/styles/sessions-preview.css +185 -111
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withAccessToken } from './access-token.mjs';
|
|
1
2
|
import {
|
|
2
3
|
buildSpeedTestIssue,
|
|
3
4
|
formatLatency
|
|
@@ -219,7 +220,7 @@ export function createRuntimeMethods(options = {}) {
|
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
222
|
this.claudeDownloadProgress = 100;
|
|
222
|
-
const downloadUrl = `/download/${encodeURIComponent(res.fileName)}
|
|
223
|
+
const downloadUrl = withAccessToken(`/download/${encodeURIComponent(res.fileName)}`);
|
|
223
224
|
const link = document.createElement('a');
|
|
224
225
|
link.href = downloadUrl;
|
|
225
226
|
link.download = res.fileName;
|
|
@@ -260,7 +261,7 @@ export function createRuntimeMethods(options = {}) {
|
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
this.codexDownloadProgress = 100;
|
|
263
|
-
const downloadUrl = `/download/${encodeURIComponent(res.fileName)}
|
|
264
|
+
const downloadUrl = withAccessToken(`/download/${encodeURIComponent(res.fileName)}`);
|
|
264
265
|
const link = document.createElement('a');
|
|
265
266
|
link.href = downloadUrl;
|
|
266
267
|
link.download = res.fileName;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAccessToken } from './access-token.mjs';
|
|
1
2
|
import {
|
|
2
3
|
normalizeConfigTemplateDiffConfirmEnabled
|
|
3
4
|
} from './config-template-confirm-pref.mjs';
|
|
@@ -124,6 +125,8 @@ export function createSessionActionMethods(options = {}) {
|
|
|
124
125
|
params.set('source', source);
|
|
125
126
|
if (sessionId) params.set('sessionId', sessionId);
|
|
126
127
|
if (filePath) params.set('filePath', filePath);
|
|
128
|
+
const accessToken = getAccessToken();
|
|
129
|
+
if (accessToken) params.set('token', accessToken);
|
|
127
130
|
return `${origin}/session?${params.toString()}`;
|
|
128
131
|
},
|
|
129
132
|
|
|
@@ -460,7 +460,9 @@ export function createSessionBrowserMethods(options = {}) {
|
|
|
460
460
|
const scrollEl = this.getSessionPreviewScrollContainer();
|
|
461
461
|
if (!scrollEl) return;
|
|
462
462
|
if (typeof scrollEl.scrollTo === 'function') {
|
|
463
|
-
|
|
463
|
+
const reduceMotion = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
464
|
+
const instant = (typeof document !== 'undefined' && document.hidden) || reduceMotion;
|
|
465
|
+
scrollEl.scrollTo({ top: 0, behavior: instant ? 'instant' : 'smooth' });
|
|
464
466
|
} else {
|
|
465
467
|
scrollEl.scrollTop = 0;
|
|
466
468
|
}
|
|
@@ -470,7 +472,9 @@ export function createSessionBrowserMethods(options = {}) {
|
|
|
470
472
|
const scrollEl = this.getSessionPreviewScrollContainer();
|
|
471
473
|
if (!scrollEl) return;
|
|
472
474
|
if (typeof scrollEl.scrollTo === 'function') {
|
|
473
|
-
|
|
475
|
+
const reduceMotion = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
476
|
+
const instant = (typeof document !== 'undefined' && document.hidden) || reduceMotion;
|
|
477
|
+
scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: instant ? 'instant' : 'smooth' });
|
|
474
478
|
} else {
|
|
475
479
|
scrollEl.scrollTop = scrollEl.scrollHeight;
|
|
476
480
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function createWorkflowMethods({ api }) {
|
|
2
|
+
return {
|
|
3
|
+
async refreshWorkflowRuns() {
|
|
4
|
+
try {
|
|
5
|
+
const [definitions, result] = await Promise.all([api('workflow-list'), api('workflow-active-runs')]);
|
|
6
|
+
if (result.error || definitions.error) throw new Error(result.error || definitions.error);
|
|
7
|
+
this.workflowDefinitions = definitions.workflows || [];
|
|
8
|
+
this.workflowRuns = (result.runs || []).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
9
|
+
this.workflowError = '';
|
|
10
|
+
} catch (error) { this.workflowError = error.message; }
|
|
11
|
+
},
|
|
12
|
+
async submitWorkflowRun() {
|
|
13
|
+
this.workflowBusy = true;
|
|
14
|
+
try {
|
|
15
|
+
const input = JSON.parse(this.workflowInput);
|
|
16
|
+
const result = await api('workflow-submit', { id: this.workflowId, input, allowWrite: this.workflowAllowWrite });
|
|
17
|
+
if (result.error || result.ok === false) throw new Error(result.error || this.t('workflow.submitFailed'));
|
|
18
|
+
await this.refreshWorkflowRuns();
|
|
19
|
+
} catch (error) { this.workflowError = error instanceof SyntaxError ? this.t('workflow.invalidJson') : error.message; }
|
|
20
|
+
finally { this.workflowBusy = false; }
|
|
21
|
+
},
|
|
22
|
+
async controlWorkflowRun(run, action) {
|
|
23
|
+
this.workflowBusy = true;
|
|
24
|
+
try {
|
|
25
|
+
const params = { runId: run.id };
|
|
26
|
+
if (action === 'resume') {
|
|
27
|
+
params.input = JSON.parse(this.workflowInput);
|
|
28
|
+
params.allowWrite = this.workflowAllowWrite;
|
|
29
|
+
}
|
|
30
|
+
const result = await api(`workflow-${action}`, params);
|
|
31
|
+
if (result.error && !result.id) throw new Error(result.error);
|
|
32
|
+
await this.refreshWorkflowRuns();
|
|
33
|
+
} catch (error) { this.workflowError = error instanceof SyntaxError ? this.t('workflow.invalidJson') : error.message; }
|
|
34
|
+
finally { this.workflowBusy = false; }
|
|
35
|
+
},
|
|
36
|
+
workflowStatusLabel(status) {
|
|
37
|
+
return ['queued', 'running', 'waiting', 'completed', 'failed', 'cancelling', 'cancelled'].includes(status)
|
|
38
|
+
? this.t(`workflow.status.${status}`) : status;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const en = Object.freeze({
|
|
2
|
+
'workflow.tagline': "Choose a task. Let it run in the background.",
|
|
3
|
+
'workflow.options': "Input parameters",
|
|
4
|
+
'workflow.title': "Automated workflows",
|
|
5
|
+
'workflow.description': "You can close this page after submitting. Safe steps resume after the service restarts; intervention is requested when a write outcome is unclear.",
|
|
6
|
+
'workflow.definition': "Task definition",
|
|
7
|
+
'workflow.noDefinitions': "No task definitions available",
|
|
8
|
+
'workflow.input': "Input (JSON)",
|
|
9
|
+
'workflow.inputHint': "Before continuing, load the original input and verify authorization.",
|
|
10
|
+
'workflow.allowWrite': "Authorize writes for this task",
|
|
11
|
+
'workflow.submit': "Submit task",
|
|
12
|
+
'workflow.submitting': "Submitting…",
|
|
13
|
+
'workflow.refresh': "Refresh results",
|
|
14
|
+
'workflow.refreshing': "Refreshing…",
|
|
15
|
+
'workflow.runs': "Run history",
|
|
16
|
+
'workflow.empty': "No runs yet",
|
|
17
|
+
'workflow.emptyHint': "After submitting a task, view its status and execution results here.",
|
|
18
|
+
'workflow.loadInput': "Load original input",
|
|
19
|
+
'workflow.resume': "Continue after confirming input and authorization",
|
|
20
|
+
'workflow.cancel': "Cancel further execution",
|
|
21
|
+
'workflow.summary': "Results and unfinished items",
|
|
22
|
+
'workflow.details': "Execution details and notification status",
|
|
23
|
+
'workflow.runId': "Run ID",
|
|
24
|
+
'workflow.submitFailed': "Submission failed",
|
|
25
|
+
'workflow.invalidJson': "Enter valid JSON.",
|
|
26
|
+
'workflow.status.queued': "Queued",
|
|
27
|
+
'workflow.status.running': "Running",
|
|
28
|
+
'workflow.status.waiting': "Action required",
|
|
29
|
+
'workflow.status.completed': "Completed",
|
|
30
|
+
'workflow.status.failed': "Failed",
|
|
31
|
+
'workflow.status.cancelling': "Cancelling, waiting for the tool to finish",
|
|
32
|
+
'workflow.status.cancelled': "Cancelled",
|
|
33
|
+
|
|
2
34
|
// Global
|
|
3
35
|
'lang.zh': '中文',
|
|
4
36
|
'lang.zh-tw': '繁體中文',
|
|
@@ -230,8 +262,11 @@ const en = Object.freeze({
|
|
|
230
262
|
'subtitle.prompts': 'Edit AGENTS.md and CLAUDE.md.',
|
|
231
263
|
'prompts.subTab.codex': 'AGENTS.md (Codex)',
|
|
232
264
|
'prompts.subTab.opencode': 'AGENTS.md (OpenCode)',
|
|
233
|
-
'prompts.subTab.project': 'CLAUDE.md',
|
|
234
|
-
'prompts.subTab.system': '
|
|
265
|
+
'prompts.subTab.project': 'CLAUDE.md (Claude)',
|
|
266
|
+
'prompts.subTab.system': 'SYSTEM.md (Pi)',
|
|
267
|
+
'prompts.path.fullPath': 'Full path',
|
|
268
|
+
'prompts.actions.edit': 'Edit',
|
|
269
|
+
'prompts.actions.view': 'View',
|
|
235
270
|
'prompts.pathReference.title': 'Insert rule reference',
|
|
236
271
|
'prompts.pathReference.placeholder': 'Insert rule reference…',
|
|
237
272
|
'prompts.pathReference.codex': 'AGENTS.md (Codex)',
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const ja = Object.freeze({
|
|
2
|
+
'workflow.tagline': "タスクを選んで、あとはバックグラウンドで。",
|
|
3
|
+
'workflow.options': "入力パラメーター",
|
|
4
|
+
'workflow.title': "自動ワークフロー",
|
|
5
|
+
'workflow.description': "送信後はこのページを閉じられます。サービスの再起動後、安全なステップから再開します。書き込み結果が不明な場合は対応を求めます。",
|
|
6
|
+
'workflow.definition': "タスク定義",
|
|
7
|
+
'workflow.noDefinitions': "利用可能なタスク定義はありません",
|
|
8
|
+
'workflow.input': "入力(JSON)",
|
|
9
|
+
'workflow.inputHint': "続行前に元の入力を読み込み、権限を確認してください。",
|
|
10
|
+
'workflow.allowWrite': "今回のタスクの書き込みを許可",
|
|
11
|
+
'workflow.submit': "タスクを送信",
|
|
12
|
+
'workflow.submitting': "送信中…",
|
|
13
|
+
'workflow.refresh': "結果を更新",
|
|
14
|
+
'workflow.refreshing': "更新中…",
|
|
15
|
+
'workflow.runs': "実行履歴",
|
|
16
|
+
'workflow.empty': "実行履歴はありません",
|
|
17
|
+
'workflow.emptyHint': "タスクを送信すると、ここで状態と実行結果を確認できます。",
|
|
18
|
+
'workflow.loadInput': "元の入力を読み込む",
|
|
19
|
+
'workflow.resume': "入力と権限を確認して続行",
|
|
20
|
+
'workflow.cancel': "以降の実行をキャンセル",
|
|
21
|
+
'workflow.summary': "結果と未完了項目",
|
|
22
|
+
'workflow.details': "実行の詳細と通知状態",
|
|
23
|
+
'workflow.runId': "実行ID",
|
|
24
|
+
'workflow.submitFailed': "送信に失敗しました",
|
|
25
|
+
'workflow.invalidJson': "有効なJSONを入力してください。",
|
|
26
|
+
'workflow.status.queued': "待機中",
|
|
27
|
+
'workflow.status.running': "実行中",
|
|
28
|
+
'workflow.status.waiting': "対応が必要",
|
|
29
|
+
'workflow.status.completed': "完了",
|
|
30
|
+
'workflow.status.failed': "失敗",
|
|
31
|
+
'workflow.status.cancelling': "キャンセル処理中、ツールの終了を待っています",
|
|
32
|
+
'workflow.status.cancelled': "キャンセル済み",
|
|
33
|
+
|
|
2
34
|
|
|
3
35
|
// Global
|
|
4
36
|
'lang.zh': '中国語',
|
|
@@ -231,8 +263,11 @@ const ja = Object.freeze({
|
|
|
231
263
|
'subtitle.prompts': 'AGENTS.md と CLAUDE.md を編集。',
|
|
232
264
|
'prompts.subTab.codex': 'AGENTS.md (Codex)',
|
|
233
265
|
'prompts.subTab.opencode': 'AGENTS.md (OpenCode)',
|
|
234
|
-
'prompts.subTab.project': 'CLAUDE.md',
|
|
235
|
-
'prompts.subTab.system': '
|
|
266
|
+
'prompts.subTab.project': 'CLAUDE.md (Claude)',
|
|
267
|
+
'prompts.subTab.system': 'SYSTEM.md (Pi)',
|
|
268
|
+
'prompts.path.fullPath': 'フルパス',
|
|
269
|
+
'prompts.actions.edit': '編集',
|
|
270
|
+
'prompts.actions.view': '表示',
|
|
236
271
|
'prompts.pathReference.title': 'ルール参照を挿入',
|
|
237
272
|
'prompts.pathReference.placeholder': 'ルール参照を挿入…',
|
|
238
273
|
'prompts.pathReference.codex': 'AGENTS.md (Codex)',
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const vi = Object.freeze({
|
|
2
|
+
'workflow.tagline': "Chọn tác vụ. Để hệ thống tiếp tục chạy nền.",
|
|
3
|
+
'workflow.options': "Tham số đầu vào",
|
|
4
|
+
'workflow.title': "Quy trình tự động",
|
|
5
|
+
'workflow.description': "Bạn có thể đóng trang sau khi gửi. Các bước an toàn tiếp tục sau khi dịch vụ khởi động lại; hệ thống yêu cầu can thiệp khi chưa rõ kết quả ghi.",
|
|
6
|
+
'workflow.definition': "Định nghĩa tác vụ",
|
|
7
|
+
'workflow.noDefinitions': "Chưa có định nghĩa tác vụ khả dụng",
|
|
8
|
+
'workflow.input': "Dữ liệu đầu vào (JSON)",
|
|
9
|
+
'workflow.inputHint': "Trước khi tiếp tục, hãy tải dữ liệu đầu vào ban đầu và kiểm tra quyền đã cấp.",
|
|
10
|
+
'workflow.allowWrite': "Cho phép ghi cho tác vụ này",
|
|
11
|
+
'workflow.submit': "Gửi tác vụ",
|
|
12
|
+
'workflow.submitting': "Đang gửi…",
|
|
13
|
+
'workflow.refresh': "Làm mới kết quả",
|
|
14
|
+
'workflow.refreshing': "Đang làm mới…",
|
|
15
|
+
'workflow.runs': "Lịch sử thực thi",
|
|
16
|
+
'workflow.empty': "Chưa có lần thực thi nào",
|
|
17
|
+
'workflow.emptyHint': "Sau khi gửi tác vụ, xem trạng thái và kết quả thực thi tại đây.",
|
|
18
|
+
'workflow.loadInput': "Tải dữ liệu đầu vào ban đầu",
|
|
19
|
+
'workflow.resume': "Tiếp tục sau khi xác nhận dữ liệu đầu vào và quyền đã cấp",
|
|
20
|
+
'workflow.cancel': "Hủy các bước thực thi tiếp theo",
|
|
21
|
+
'workflow.summary': "Kết quả và các mục chưa hoàn thành",
|
|
22
|
+
'workflow.details': "Chi tiết thực thi và trạng thái thông báo",
|
|
23
|
+
'workflow.runId': "Mã lần thực thi",
|
|
24
|
+
'workflow.submitFailed': "Gửi thất bại",
|
|
25
|
+
'workflow.invalidJson': "Vui lòng nhập JSON hợp lệ.",
|
|
26
|
+
'workflow.status.queued': "Đang chờ",
|
|
27
|
+
'workflow.status.running': "Đang thực thi",
|
|
28
|
+
'workflow.status.waiting': "Cần xử lý",
|
|
29
|
+
'workflow.status.completed': "Đã hoàn thành",
|
|
30
|
+
'workflow.status.failed': "Thất bại",
|
|
31
|
+
'workflow.status.cancelling': "Đang hủy, chờ công cụ kết thúc",
|
|
32
|
+
'workflow.status.cancelled': "Đã hủy",
|
|
33
|
+
|
|
2
34
|
'plugins.catalog.promptTemplates.title': 'Mẫu prompt',
|
|
3
35
|
'plugins.catalog.promptTemplates.description': 'Công cụ prompt theo mẫu, hỗ trợ biến, sao chép và xuất.',
|
|
4
36
|
'plugins.status.standard': 'tiêu chuẩn',
|
|
@@ -259,8 +291,11 @@ const vi = Object.freeze({
|
|
|
259
291
|
'subtitle.prompts': 'Chỉnh sửa AGENTS.md và CLAUDE.md.',
|
|
260
292
|
'prompts.subTab.codex': 'AGENTS.md (Codex)',
|
|
261
293
|
'prompts.subTab.opencode': 'AGENTS.md (OpenCode)',
|
|
262
|
-
'prompts.subTab.project': 'CLAUDE.md',
|
|
263
|
-
'prompts.subTab.system': '
|
|
294
|
+
'prompts.subTab.project': 'CLAUDE.md (Claude)',
|
|
295
|
+
'prompts.subTab.system': 'SYSTEM.md (Pi)',
|
|
296
|
+
'prompts.path.fullPath': 'Đường dẫn đầy đủ',
|
|
297
|
+
'prompts.actions.edit': 'Chỉnh sửa',
|
|
298
|
+
'prompts.actions.view': 'Chế độ xem',
|
|
264
299
|
'prompts.pathReference.title': 'Chèn tham chiếu quy tắc',
|
|
265
300
|
'prompts.pathReference.placeholder': 'Chèn tham chiếu quy tắc…',
|
|
266
301
|
'prompts.pathReference.codex': 'AGENTS.md (Codex)',
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const zhTw = Object.freeze({
|
|
2
|
+
'workflow.tagline': "選好任務,背景接著做。",
|
|
3
|
+
'workflow.options': "輸入參數",
|
|
4
|
+
'workflow.title': "自動工作流程",
|
|
5
|
+
'workflow.description': "提交後可關閉頁面。服務重新啟動後會恢復安全步驟;寫入結果不明時會請求介入。",
|
|
6
|
+
'workflow.definition': "任務定義",
|
|
7
|
+
'workflow.noDefinitions': "暫無可用任務定義",
|
|
8
|
+
'workflow.input': "輸入(JSON)",
|
|
9
|
+
'workflow.inputHint': "繼續任務前,請先載入原始輸入並核對授權。",
|
|
10
|
+
'workflow.allowWrite': "授權本次任務寫入",
|
|
11
|
+
'workflow.submit': "提交任務",
|
|
12
|
+
'workflow.submitting': "提交中…",
|
|
13
|
+
'workflow.refresh': "重新整理結果",
|
|
14
|
+
'workflow.refreshing': "重新整理中…",
|
|
15
|
+
'workflow.runs': "執行紀錄",
|
|
16
|
+
'workflow.empty': "暫無執行紀錄",
|
|
17
|
+
'workflow.emptyHint': "提交任務後,可在此查看狀態與執行結果。",
|
|
18
|
+
'workflow.loadInput': "載入原始輸入",
|
|
19
|
+
'workflow.resume': "確認輸入與授權後繼續",
|
|
20
|
+
'workflow.cancel': "取消後續執行",
|
|
21
|
+
'workflow.summary': "結果與未完成項目",
|
|
22
|
+
'workflow.details': "執行詳細資訊與通知狀態",
|
|
23
|
+
'workflow.runId': "執行識別碼",
|
|
24
|
+
'workflow.submitFailed': "提交失敗",
|
|
25
|
+
'workflow.invalidJson': "請輸入有效的 JSON。",
|
|
26
|
+
'workflow.status.queued': "排隊中",
|
|
27
|
+
'workflow.status.running': "執行中",
|
|
28
|
+
'workflow.status.waiting': "需要處理",
|
|
29
|
+
'workflow.status.completed': "已完成",
|
|
30
|
+
'workflow.status.failed': "失敗",
|
|
31
|
+
'workflow.status.cancelling': "正在取消,等待工具結束",
|
|
32
|
+
'workflow.status.cancelled': "已取消",
|
|
33
|
+
|
|
2
34
|
// Global
|
|
3
35
|
'lang.zh': '中文',
|
|
4
36
|
'lang.zh-tw': '繁體中文',
|
|
@@ -230,8 +262,11 @@ const zhTw = Object.freeze({
|
|
|
230
262
|
'subtitle.prompts': '編輯 AGENTS.md 與 CLAUDE.md。',
|
|
231
263
|
'prompts.subTab.codex': 'AGENTS.md (Codex)',
|
|
232
264
|
'prompts.subTab.opencode': 'AGENTS.md (OpenCode)',
|
|
233
|
-
'prompts.subTab.project': 'CLAUDE.md',
|
|
234
|
-
'prompts.subTab.system': '
|
|
265
|
+
'prompts.subTab.project': 'CLAUDE.md (Claude)',
|
|
266
|
+
'prompts.subTab.system': 'SYSTEM.md (Pi)',
|
|
267
|
+
'prompts.path.fullPath': '完整路徑',
|
|
268
|
+
'prompts.actions.edit': '編輯',
|
|
269
|
+
'prompts.actions.view': '檢視',
|
|
235
270
|
'prompts.pathReference.title': '插入規則引用',
|
|
236
271
|
'prompts.pathReference.placeholder': '插入規則引用…',
|
|
237
272
|
'prompts.pathReference.codex': 'AGENTS.md (Codex)',
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
const zh = Object.freeze({
|
|
2
|
+
'workflow.tagline': "选好任务,后台接着做。",
|
|
3
|
+
'workflow.options': "输入参数",
|
|
4
|
+
'workflow.title': "自动工作流",
|
|
5
|
+
'workflow.description': "提交后可关闭页面。服务重启后恢复安全步骤;写入结果不明时请求介入。",
|
|
6
|
+
'workflow.definition': "任务定义",
|
|
7
|
+
'workflow.noDefinitions': "暂无可用任务定义",
|
|
8
|
+
'workflow.input': "输入(JSON)",
|
|
9
|
+
'workflow.inputHint': "继续任务前,请先载入原输入并核对授权。",
|
|
10
|
+
'workflow.allowWrite': "授权本次任务写入",
|
|
11
|
+
'workflow.submit': "提交任务",
|
|
12
|
+
'workflow.submitting': "提交中…",
|
|
13
|
+
'workflow.refresh': "刷新结果",
|
|
14
|
+
'workflow.refreshing': "刷新中…",
|
|
15
|
+
'workflow.runs': "运行记录",
|
|
16
|
+
'workflow.empty': "暂无运行记录",
|
|
17
|
+
'workflow.emptyHint': "提交任务后,可在这里查看状态与执行结果。",
|
|
18
|
+
'workflow.loadInput': "载入原输入",
|
|
19
|
+
'workflow.resume': "确认输入与授权后继续",
|
|
20
|
+
'workflow.cancel': "取消后续执行",
|
|
21
|
+
'workflow.summary': "结果与未完成项",
|
|
22
|
+
'workflow.details': "执行详情与通知状态",
|
|
23
|
+
'workflow.runId': "运行标识",
|
|
24
|
+
'workflow.submitFailed': "提交失败",
|
|
25
|
+
'workflow.invalidJson': "请输入有效的 JSON。",
|
|
26
|
+
'workflow.status.queued': "排队中",
|
|
27
|
+
'workflow.status.running': "执行中",
|
|
28
|
+
'workflow.status.waiting': "需要处理",
|
|
29
|
+
'workflow.status.completed': "已完成",
|
|
30
|
+
'workflow.status.failed': "失败",
|
|
31
|
+
'workflow.status.cancelling': "正在取消,等待工具结束",
|
|
32
|
+
'workflow.status.cancelled': "已取消",
|
|
33
|
+
|
|
2
34
|
// Global
|
|
3
35
|
'lang.zh': '中文',
|
|
4
36
|
'lang.zh-tw': '繁體中文',
|
|
@@ -230,8 +262,11 @@ const zh = Object.freeze({
|
|
|
230
262
|
'subtitle.prompts': '编辑 AGENTS.md 与 CLAUDE.md。',
|
|
231
263
|
'prompts.subTab.codex': 'AGENTS.md (Codex)',
|
|
232
264
|
'prompts.subTab.opencode': 'AGENTS.md (OpenCode)',
|
|
233
|
-
'prompts.subTab.project': 'CLAUDE.md',
|
|
234
|
-
'prompts.subTab.system': '
|
|
265
|
+
'prompts.subTab.project': 'CLAUDE.md (Claude)',
|
|
266
|
+
'prompts.subTab.system': 'SYSTEM.md (Pi)',
|
|
267
|
+
'prompts.path.fullPath': '完整路径',
|
|
268
|
+
'prompts.actions.edit': '编辑',
|
|
269
|
+
'prompts.actions.view': '视图',
|
|
235
270
|
'prompts.pathReference.title': '插入规则引用',
|
|
236
271
|
'prompts.pathReference.placeholder': '插入规则引用…',
|
|
237
272
|
'prompts.pathReference.codex': 'AGENTS.md (Codex)',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getAccessToken } from './access-token.mjs';
|
|
1
2
|
import {
|
|
2
3
|
buildSessionFilterCacheState,
|
|
3
4
|
isSessionQueryEnabled
|
|
@@ -119,6 +120,8 @@ export function buildSessionsFilterShareUrl(vm) {
|
|
|
119
120
|
// 使用干净的根路径作为基础 URL,避免把 /web-ui/index.html 或 /session 带进分享链接。
|
|
120
121
|
const baseUrl = window.location.origin + '/';
|
|
121
122
|
const url = canonicalizeWebUiUrl(new URL(baseUrl));
|
|
123
|
+
const accessToken = getAccessToken();
|
|
124
|
+
if (accessToken) url.searchParams.set('token', accessToken);
|
|
122
125
|
url.searchParams.set('tab', 'sessions');
|
|
123
126
|
url.searchParams.set('s_source', String(vm.sessionFilterSource || 'all'));
|
|
124
127
|
if (vm.sessionPathFilter) url.searchParams.set('s_path', String(vm.sessionPathFilter || ''));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { authorizationHeaders, withAccessToken } from './access-token.mjs';
|
|
1
2
|
function createUnsupportedSkillsTargetAppError(app) {
|
|
2
3
|
return new Error(`Unsupported skills target app: ${String(app)}`);
|
|
3
4
|
}
|
|
@@ -326,9 +327,9 @@ export function createSkillsMethods({ api }) {
|
|
|
326
327
|
: `${this.skillsTargetApp}-skills.zip`;
|
|
327
328
|
const response = await fetch(`/api/import-skills-zip?targetApp=${encodeURIComponent(this.skillsTargetApp)}`, {
|
|
328
329
|
method: 'POST',
|
|
329
|
-
headers: {
|
|
330
|
+
headers: authorizationHeaders({
|
|
330
331
|
'x-codexmate-file-name': encodeURIComponent(fileName)
|
|
331
|
-
},
|
|
332
|
+
}),
|
|
332
333
|
body: file
|
|
333
334
|
});
|
|
334
335
|
let payload = {};
|
|
@@ -414,9 +415,9 @@ export function createSkillsMethods({ api }) {
|
|
|
414
415
|
}
|
|
415
416
|
const exportedCount = Array.isArray(res.exported) ? res.exported.length : 0;
|
|
416
417
|
const failedCount = Array.isArray(res.failed) ? res.failed.length : 0;
|
|
417
|
-
const downloadUrl = typeof res.downloadPath === 'string' && res.downloadPath.trim()
|
|
418
|
+
const downloadUrl = withAccessToken(typeof res.downloadPath === 'string' && res.downloadPath.trim()
|
|
418
419
|
? res.downloadPath.trim()
|
|
419
|
-
: `/download/${encodeURIComponent(res.fileName)}
|
|
420
|
+
: `/download/${encodeURIComponent(res.fileName)}`);
|
|
420
421
|
const link = document.createElement('a');
|
|
421
422
|
link.href = downloadUrl;
|
|
422
423
|
link.download = res.fileName;
|
|
@@ -449,7 +450,7 @@ export function createSkillsMethods({ api }) {
|
|
|
449
450
|
return;
|
|
450
451
|
}
|
|
451
452
|
const link = document.createElement('a');
|
|
452
|
-
link.href = res.downloadPath || `/download/${encodeURIComponent(res.fileName)}
|
|
453
|
+
link.href = withAccessToken(res.downloadPath || `/download/${encodeURIComponent(res.fileName)}`);
|
|
453
454
|
link.download = res.fileName;
|
|
454
455
|
document.body.appendChild(link);
|
|
455
456
|
link.click();
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { api } from './api.mjs';
|
|
2
|
+
|
|
3
|
+
const STATUS_LABELS = Object.freeze({
|
|
4
|
+
awaiting_read: '等待读取',
|
|
5
|
+
file_ready: '文件已就绪',
|
|
6
|
+
read_confirmed: '目标自报已读取(附证据)'
|
|
7
|
+
});
|
|
8
|
+
const CARD_FIELDS = Object.freeze([
|
|
9
|
+
{ key: 'completed', label: '已完成事项' },
|
|
10
|
+
{ key: 'blockers', label: '阻塞事项' },
|
|
11
|
+
{ key: 'nextSteps', label: '后续步骤' },
|
|
12
|
+
{ key: 'files', label: '相关文件' }
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
function emptyDraft() {
|
|
16
|
+
return { target: '', goal: '', completed: '', blockers: '', nextSteps: '', files: '' };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const threadHandoffMixin = {
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
handoffRecords: [],
|
|
23
|
+
handoffDraft: emptyDraft(),
|
|
24
|
+
handoffDrafts: new Map(),
|
|
25
|
+
handoffExpanded: false,
|
|
26
|
+
handoffFields: CARD_FIELDS,
|
|
27
|
+
handoffLoading: false,
|
|
28
|
+
handoffBusy: false,
|
|
29
|
+
handoffError: '',
|
|
30
|
+
handoffNotice: '',
|
|
31
|
+
handoffCopyText: '',
|
|
32
|
+
handoffRequestSeq: 0
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
handoffSessionKey() {
|
|
37
|
+
const session = this.activeSession;
|
|
38
|
+
return session && session.sessionId
|
|
39
|
+
? JSON.stringify([session.source || '', session.sessionId]) : '';
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
watch: {
|
|
43
|
+
handoffSessionKey: {
|
|
44
|
+
immediate: true,
|
|
45
|
+
handler(key, previousKey) {
|
|
46
|
+
if (previousKey) this.handoffDrafts.set(previousKey, this.handoffDraft);
|
|
47
|
+
this.handoffRequestSeq++;
|
|
48
|
+
this.handoffRecords = [];
|
|
49
|
+
this.handoffDraft = this.handoffDrafts.get(key) || emptyDraft();
|
|
50
|
+
this.handoffExpanded = false;
|
|
51
|
+
this.handoffError = '';
|
|
52
|
+
this.handoffNotice = '';
|
|
53
|
+
this.handoffCopyText = '';
|
|
54
|
+
this.handoffLoading = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
toggleThreadHandoff(event) {
|
|
60
|
+
// Nested optional-field details also emit toggle events.
|
|
61
|
+
if (event.target !== event.currentTarget) return;
|
|
62
|
+
const expanded = event.currentTarget.open;
|
|
63
|
+
if (expanded === this.handoffExpanded) return;
|
|
64
|
+
this.handoffExpanded = expanded;
|
|
65
|
+
if (expanded) void this.loadThreadHandoffs();
|
|
66
|
+
},
|
|
67
|
+
handoffStatusLabel(status) {
|
|
68
|
+
return STATUS_LABELS[status] || '未知状态';
|
|
69
|
+
},
|
|
70
|
+
async loadThreadHandoffs() {
|
|
71
|
+
const threadId = this.activeSession && this.activeSession.sessionId;
|
|
72
|
+
if (!threadId || !this.handoffExpanded) return;
|
|
73
|
+
const requestSeq = ++this.handoffRequestSeq;
|
|
74
|
+
this.handoffLoading = true;
|
|
75
|
+
this.handoffError = '';
|
|
76
|
+
try {
|
|
77
|
+
const result = await api('thread-handoff-list', { threadId });
|
|
78
|
+
if (requestSeq !== this.handoffRequestSeq) return;
|
|
79
|
+
if (result.error) throw new Error(result.error);
|
|
80
|
+
this.handoffRecords = result.records || [];
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (requestSeq === this.handoffRequestSeq) this.handoffError = '加载交接历史失败:' + error.message;
|
|
83
|
+
} finally {
|
|
84
|
+
if (requestSeq === this.handoffRequestSeq) this.handoffLoading = false;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
async createThreadHandoff() {
|
|
88
|
+
const threadId = this.activeSession && this.activeSession.sessionId;
|
|
89
|
+
if (!threadId || this.handoffBusy) return;
|
|
90
|
+
const draft = this.handoffDraft;
|
|
91
|
+
const requestSeq = this.handoffRequestSeq;
|
|
92
|
+
if (!draft.target.trim() || !draft.goal.trim()) {
|
|
93
|
+
this.handoffError = '请填写目标代理与交接目标';
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const card = { goal: draft.goal.trim() };
|
|
97
|
+
for (const { key } of CARD_FIELDS) {
|
|
98
|
+
card[key] = draft[key].split(/\r?\n/).map(line => line.trim()).filter(Boolean);
|
|
99
|
+
}
|
|
100
|
+
this.handoffBusy = true;
|
|
101
|
+
this.handoffError = '';
|
|
102
|
+
this.handoffNotice = '';
|
|
103
|
+
try {
|
|
104
|
+
const result = await api('thread-handoff-create', { threadId, target: draft.target.trim(), card, cwd: this.activeSession.cwd || undefined });
|
|
105
|
+
if (result.error) throw new Error(result.error);
|
|
106
|
+
if (requestSeq !== this.handoffRequestSeq) return;
|
|
107
|
+
this.handoffNotice = result.message || '已生成交接记录;读取状态以交接历史为准。';
|
|
108
|
+
await this.loadThreadHandoffs();
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if (requestSeq === this.handoffRequestSeq) this.handoffError = '生成交接失败:' + error.message;
|
|
111
|
+
} finally {
|
|
112
|
+
this.handoffBusy = false;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
async copyThreadHandoff(record) {
|
|
116
|
+
const threadId = this.activeSession && this.activeSession.sessionId;
|
|
117
|
+
if (!threadId || this.handoffBusy) return;
|
|
118
|
+
const requestSeq = this.handoffRequestSeq;
|
|
119
|
+
this.handoffBusy = true;
|
|
120
|
+
this.handoffError = '';
|
|
121
|
+
this.handoffNotice = '';
|
|
122
|
+
this.handoffCopyText = '';
|
|
123
|
+
try {
|
|
124
|
+
const result = await api('thread-handoff-fallback', { threadId, handoffId: record.id });
|
|
125
|
+
if (result.error) throw new Error(result.error);
|
|
126
|
+
if (requestSeq !== this.handoffRequestSeq) return;
|
|
127
|
+
if (result.record) {
|
|
128
|
+
this.handoffRecords = this.handoffRecords.map(item => item.id === record.id ? result.record : item);
|
|
129
|
+
}
|
|
130
|
+
if (typeof result.text !== 'string' || !result.text.trim()) throw new Error('未返回卡片文本');
|
|
131
|
+
this.handoffCopyText = result.text;
|
|
132
|
+
if (!navigator.clipboard || !navigator.clipboard.writeText) throw new Error('当前环境不支持剪贴板,请手动复制下方文本');
|
|
133
|
+
await navigator.clipboard.writeText(result.text);
|
|
134
|
+
if (requestSeq === this.handoffRequestSeq) this.handoffNotice = '已复制卡片文本;未发送给目标。请粘贴到目标会话。';
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (requestSeq === this.handoffRequestSeq) this.handoffError = '卡片复制未完成;未发送给目标:' + error.message;
|
|
137
|
+
} finally {
|
|
138
|
+
this.handoffBusy = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -171,11 +171,13 @@
|
|
|
171
171
|
</div>
|
|
172
172
|
|
|
173
173
|
<div v-if="!isToolConfigWriteAllowed('claude')" class="tool-config-write-overlay">
|
|
174
|
+
<teleport to="body" v-if="mainTab === 'config' && configMode === 'claude'">
|
|
174
175
|
<div class="tool-config-write-overlay-card">
|
|
175
176
|
<div class="tool-config-write-overlay-title">{{ t('toolConfig.claude.lockedTitle') }}</div>
|
|
176
177
|
<p>{{ t('toolConfig.claude.lockedDesc') }}</p>
|
|
177
178
|
<button type="button" class="btn-tool" @click="setToolConfigPermission('claude', true)" :disabled="toolConfigPermissionSaving.claude">{{ t('toolConfig.enableWrite') }}</button>
|
|
178
179
|
</div>
|
|
180
|
+
</teleport>
|
|
179
181
|
</div>
|
|
180
182
|
</div>
|
|
181
183
|
</div>
|
|
@@ -190,11 +190,13 @@
|
|
|
190
190
|
</div>
|
|
191
191
|
</div>
|
|
192
192
|
<div v-if="!isToolConfigWriteAllowed('codex')" class="tool-config-write-overlay">
|
|
193
|
+
<teleport to="body" v-if="mainTab === 'config' && configMode === 'codex'">
|
|
193
194
|
<div class="tool-config-write-overlay-card">
|
|
194
195
|
<div class="tool-config-write-overlay-title">{{ t('toolConfig.codex.lockedTitle') }}</div>
|
|
195
196
|
<p>{{ t('toolConfig.codex.lockedDesc') }}</p>
|
|
196
197
|
<button type="button" class="btn-tool" @click="setToolConfigPermission('codex', true)" :disabled="toolConfigPermissionSaving.codex">{{ t('toolConfig.enableWrite') }}</button>
|
|
197
198
|
</div>
|
|
199
|
+
</teleport>
|
|
198
200
|
</div>
|
|
199
201
|
</div>
|
|
200
202
|
</div>
|
|
@@ -90,11 +90,13 @@
|
|
|
90
90
|
</section>
|
|
91
91
|
|
|
92
92
|
<div v-if="!isToolConfigWriteAllowed('kilocode')" class="tool-config-write-overlay">
|
|
93
|
-
<
|
|
93
|
+
<teleport to="body" v-if="mainTab === 'config' && configMode === 'kilocode'">
|
|
94
|
+
<div class="tool-config-write-overlay-card">
|
|
94
95
|
<div class="tool-config-write-overlay-title">{{ t('toolConfig.kilocode.lockedTitle') }}</div>
|
|
95
96
|
<p>{{ t('toolConfig.kilocode.lockedDesc') }}</p>
|
|
96
97
|
<button type="button" class="btn-tool" @click="setToolConfigPermission('kilocode', true)" :disabled="toolConfigPermissionSaving.kilocode">{{ t('toolConfig.enableWrite') }}</button>
|
|
97
98
|
</div>
|
|
99
|
+
</teleport>
|
|
98
100
|
</div>
|
|
99
101
|
</div>
|
|
100
102
|
</div>
|
|
@@ -134,11 +134,13 @@
|
|
|
134
134
|
</div>
|
|
135
135
|
</section>
|
|
136
136
|
<div v-if="!isToolConfigWriteAllowed('openclaw')" class="tool-config-write-overlay">
|
|
137
|
+
<teleport to="body" v-if="mainTab === 'config' && configMode === 'openclaw'">
|
|
137
138
|
<div class="tool-config-write-overlay-card">
|
|
138
139
|
<div class="tool-config-write-overlay-title">{{ t('toolConfig.openclaw.lockedTitle') }}</div>
|
|
139
140
|
<p>{{ t('toolConfig.openclaw.lockedDesc') }}</p>
|
|
140
141
|
<button type="button" class="btn-tool" @click="setToolConfigPermission('openclaw', true)" :disabled="toolConfigPermissionSaving.openclaw">{{ t('toolConfig.enableWrite') }}</button>
|
|
141
142
|
</div>
|
|
143
|
+
</teleport>
|
|
142
144
|
</div>
|
|
143
145
|
</div>
|
|
144
146
|
</div>
|
|
@@ -156,11 +156,13 @@
|
|
|
156
156
|
</div>
|
|
157
157
|
</section>
|
|
158
158
|
<div v-if="!isToolConfigWriteAllowed('opencode')" class="tool-config-write-overlay">
|
|
159
|
-
<
|
|
159
|
+
<teleport to="body" v-if="mainTab === 'config' && configMode === 'opencode'">
|
|
160
|
+
<div class="tool-config-write-overlay-card">
|
|
160
161
|
<div class="tool-config-write-overlay-title">{{ t('toolConfig.opencode.lockedTitle') }}</div>
|
|
161
162
|
<p>{{ t('toolConfig.opencode.lockedDesc') }}</p>
|
|
162
163
|
<button type="button" class="btn-tool" @click="setToolConfigPermission('opencode', true)" :disabled="toolConfigPermissionSaving.opencode">{{ t('toolConfig.enableWrite') }}</button>
|
|
163
164
|
</div>
|
|
165
|
+
</teleport>
|
|
164
166
|
</div>
|
|
165
167
|
</div>
|
|
166
168
|
</div>
|