@tom2012/cc-web 2026.5.18-i → 2026.5.18-j
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 +1 -1
- package/backend/dist/track-flow/__tests__/prompt-translator.test.js +14 -2
- package/backend/dist/track-flow/__tests__/prompt-translator.test.js.map +1 -1
- package/backend/dist/track-flow/__tests__/run-state-file.test.d.ts +2 -0
- package/backend/dist/track-flow/__tests__/run-state-file.test.d.ts.map +1 -0
- package/backend/dist/track-flow/__tests__/run-state-file.test.js +125 -0
- package/backend/dist/track-flow/__tests__/run-state-file.test.js.map +1 -0
- package/backend/dist/track-flow/llm-dispatcher.d.ts +16 -7
- package/backend/dist/track-flow/llm-dispatcher.d.ts.map +1 -1
- package/backend/dist/track-flow/llm-dispatcher.js +55 -46
- package/backend/dist/track-flow/llm-dispatcher.js.map +1 -1
- package/backend/dist/track-flow/prompt-translator.d.ts +12 -7
- package/backend/dist/track-flow/prompt-translator.d.ts.map +1 -1
- package/backend/dist/track-flow/prompt-translator.js +33 -19
- package/backend/dist/track-flow/prompt-translator.js.map +1 -1
- package/backend/dist/track-flow/run-state-file.d.ts +43 -0
- package/backend/dist/track-flow/run-state-file.d.ts.map +1 -0
- package/backend/dist/track-flow/run-state-file.js +134 -0
- package/backend/dist/track-flow/run-state-file.js.map +1 -0
- package/backend/dist/track-flow/runtime.d.ts +1 -0
- package/backend/dist/track-flow/runtime.d.ts.map +1 -1
- package/backend/dist/track-flow/runtime.js +88 -1
- package/backend/dist/track-flow/runtime.js.map +1 -1
- package/frontend/dist/assets/{ChatOverlay-9d5dpS5b.js → ChatOverlay-BhRFsbbR.js} +1 -1
- package/frontend/dist/assets/{GraphPreview-C6qEXitD.js → GraphPreview-D6ZEeVED.js} +1 -1
- package/frontend/dist/assets/{MobilePage-CFU9G20m.js → MobilePage-WRYXRAc8.js} +3 -3
- package/frontend/dist/assets/{OfficePreview-_l7j8IV8.js → OfficePreview-DyaPvJlf.js} +2 -2
- package/frontend/dist/assets/{PdfPreview-DTUBbS18.js → PdfPreview-B52kU16y.js} +1 -1
- package/frontend/dist/assets/{ProjectPage-DlHo3QQu.js → ProjectPage-DQ2F8xZb.js} +3 -3
- package/frontend/dist/assets/{SettingsPage-C3gzKiEP.js → SettingsPage-CgLJryAs.js} +1 -1
- package/frontend/dist/assets/{SkillHubPage-YwjsOoUC.js → SkillHubPage-D8kn7S1o.js} +1 -1
- package/frontend/dist/assets/{chevron-down-DodPtCYb.js → chevron-down-DWfB7z-t.js} +1 -1
- package/frontend/dist/assets/{index-CRR0fz5Z.js → index-BhJADLPx.js} +2 -2
- package/frontend/dist/assets/{index-L7gDJlsf.js → index-CGrwyTes.js} +1 -1
- package/frontend/dist/assets/{index-CryLBIY6.js → index-DSFa9HJl.js} +1 -1
- package/frontend/dist/assets/{jszip.min-6qCZ4RHI.js → jszip.min-BS4NYaGC.js} +1 -1
- package/frontend/dist/assets/{search-CMAXJLdz.js → search-C5-inwaf.js} +1 -1
- package/frontend/dist/assets/{select-5_sxYgAx.js → select-C6vHKLtQ.js} +1 -1
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.writeRunState = writeRunState;
|
|
37
|
+
exports.readRunState = readRunState;
|
|
38
|
+
exports.getRunStateMtime = getRunStateMtime;
|
|
39
|
+
exports.runStateRelativePath = runStateRelativePath;
|
|
40
|
+
exports.initialRunState = initialRunState;
|
|
41
|
+
exports.patchRunState = patchRunState;
|
|
42
|
+
/**
|
|
43
|
+
* Run state sidecar: `<projectFolder>/.ccweb/tracks/<basename>.run-state.json`
|
|
44
|
+
*
|
|
45
|
+
* v-j 起作为 LLM 节点完成判定的唯一信号源,并兼任运行进度的对外可视表达:
|
|
46
|
+
* - runtime 在节点 active/completed/failed 时同步写入文件
|
|
47
|
+
* - LLM 节点的 prompt 系统指令要求 LLM 完成时把 nodes[<id>].done=true,
|
|
48
|
+
* 或不能完成时 nodes[<id>].failed=true + reason='...';
|
|
49
|
+
* - llm-dispatcher polling 本文件 mtime,读 nodes[currentNodeId] 决定 success/failed
|
|
50
|
+
*
|
|
51
|
+
* 文件保留覆盖写(不在 run 结束时删,方便用户回看上一次结果)。
|
|
52
|
+
*/
|
|
53
|
+
const fs = __importStar(require("fs"));
|
|
54
|
+
const path = __importStar(require("path"));
|
|
55
|
+
function runStatePath(projectFolder, basename) {
|
|
56
|
+
return path.join(projectFolder, '.ccweb', 'tracks', `${basename}.run-state.json`);
|
|
57
|
+
}
|
|
58
|
+
function atomicWriteJson(target, value) {
|
|
59
|
+
try {
|
|
60
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
61
|
+
const tmp = `${target}.tmp.${process.pid}.${Date.now()}`;
|
|
62
|
+
fs.writeFileSync(tmp, JSON.stringify(value, null, 2), 'utf8');
|
|
63
|
+
fs.renameSync(tmp, target);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function writeRunState(projectFolder, basename, state) {
|
|
71
|
+
return atomicWriteJson(runStatePath(projectFolder, basename), state);
|
|
72
|
+
}
|
|
73
|
+
/** 读取 run-state.json。文件不存在 / parse 失败返 null。 */
|
|
74
|
+
function readRunState(projectFolder, basename) {
|
|
75
|
+
const p = runStatePath(projectFolder, basename);
|
|
76
|
+
try {
|
|
77
|
+
if (!fs.existsSync(p))
|
|
78
|
+
return null;
|
|
79
|
+
const raw = fs.readFileSync(p, 'utf8');
|
|
80
|
+
const parsed = JSON.parse(raw);
|
|
81
|
+
if (parsed.version !== 1)
|
|
82
|
+
return null;
|
|
83
|
+
return parsed;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** statSync mtime — dispatcher polling 用。 */
|
|
90
|
+
function getRunStateMtime(projectFolder, basename) {
|
|
91
|
+
try {
|
|
92
|
+
return fs.statSync(runStatePath(projectFolder, basename)).mtimeMs;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** 返回 sidecar 文件**相对项目根**的路径,用于 prompt 系统指令告知 LLM。 */
|
|
99
|
+
function runStateRelativePath(basename) {
|
|
100
|
+
return `.ccweb/tracks/${basename}.run-state.json`;
|
|
101
|
+
}
|
|
102
|
+
function initialRunState(runId, basename, nodes) {
|
|
103
|
+
const nodeMap = {};
|
|
104
|
+
for (const n of nodes) {
|
|
105
|
+
nodeMap[n.id] = {
|
|
106
|
+
label: n.label,
|
|
107
|
+
type: n.type,
|
|
108
|
+
status: 'idle',
|
|
109
|
+
iter: 0,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
version: 1,
|
|
114
|
+
runId,
|
|
115
|
+
basename,
|
|
116
|
+
startedAt: Date.now(),
|
|
117
|
+
finishedAt: null,
|
|
118
|
+
status: 'pending',
|
|
119
|
+
currentNodeId: null,
|
|
120
|
+
nodes: nodeMap,
|
|
121
|
+
error: null,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/** Mutate-and-write helper:runtime 在每个状态切换点调一次,承担 read-modify-write 与
|
|
125
|
+
* 原子写。文件可能并发被 LLM 改写(done flag),所以必须 read 最新值再 merge。 */
|
|
126
|
+
function patchRunState(projectFolder, basename, patcher) {
|
|
127
|
+
const cur = readRunState(projectFolder, basename);
|
|
128
|
+
if (!cur)
|
|
129
|
+
return null;
|
|
130
|
+
const next = patcher(cur);
|
|
131
|
+
writeRunState(projectFolder, basename, next);
|
|
132
|
+
return next;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=run-state-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-state-file.js","sourceRoot":"","sources":["../../src/track-flow/run-state-file.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,sCAMC;AAGD,oCAcC;AAGD,4CAMC;AAGD,oDAEC;AAED,0CAyBC;AAID,sCAUC;AA5ID;;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;IAE5C,MAAM,GAAG,GAAG,YAAY,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IACzB,aAAa,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;IAC5C,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/track-flow/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/track-flow/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGnE,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AASjE,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,CAAC,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACpD,SAAS,EAAE,OAAO,EAAE,CAAA;IACpB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErD,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,a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M,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAM7F;AA8BD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,IAAI,CAAC,CAuKf"}
|
|
@@ -8,6 +8,7 @@ const if_expr_evaluator_1 = require("./if-expr-evaluator");
|
|
|
8
8
|
const llm_dispatcher_1 = require("./llm-dispatcher");
|
|
9
9
|
const audit_log_1 = require("./audit-log");
|
|
10
10
|
const run_registry_1 = require("./run-registry");
|
|
11
|
+
const run_state_file_1 = require("./run-state-file");
|
|
11
12
|
const pendingUserInput = new Map(); // runId → promise
|
|
12
13
|
/**
|
|
13
14
|
* Submit user input from frontend. Resolves the runtime's await.
|
|
@@ -56,6 +57,15 @@ async function runFlow(flow, initialSnapshot, deps) {
|
|
|
56
57
|
run_registry_1.flowRunRegistry.updateStatus(deps.runId, 'running');
|
|
57
58
|
run_registry_1.flowRunRegistry.setSnapshot(deps.runId, snapshot);
|
|
58
59
|
run_registry_1.flowRunRegistry.setCurrentNode(deps.runId, currentNodeId);
|
|
60
|
+
// v-j: 初始化 .ccweb/tracks/<basename>.run-state.json(覆盖上一次 run),
|
|
61
|
+
// 后续每步状态切换 patch 此文件。LLM 节点 prompt 通过这个文件路径告诉 LLM
|
|
62
|
+
// 自报 done/failed flag。
|
|
63
|
+
(0, run_state_file_1.writeRunState)(deps.projectFolder, deps.basename, {
|
|
64
|
+
...(0, run_state_file_1.initialRunState)(deps.runId, deps.basename, flow.nodes.map((n) => ({
|
|
65
|
+
id: n.id, type: n.type, label: n.label,
|
|
66
|
+
}))),
|
|
67
|
+
status: 'running',
|
|
68
|
+
});
|
|
59
69
|
emit('flow_started', deps, { initialVars: snapshot });
|
|
60
70
|
while (currentNodeId !== null && info.status !== 'cancelled') {
|
|
61
71
|
const node = flow.nodes.find((n) => n.id === currentNodeId);
|
|
@@ -72,6 +82,24 @@ async function runFlow(flow, initialSnapshot, deps) {
|
|
|
72
82
|
const iter = (info.iterCounts.get(node.id) ?? 1);
|
|
73
83
|
run_registry_1.flowRunRegistry.setCurrentNode(deps.runId, node.id);
|
|
74
84
|
run_registry_1.flowRunRegistry.setNodeState(deps.runId, node.id, 'active');
|
|
85
|
+
(0, run_state_file_1.patchRunState)(deps.projectFolder, deps.basename, (cur) => ({
|
|
86
|
+
...cur,
|
|
87
|
+
currentNodeId: node.id,
|
|
88
|
+
status: 'running',
|
|
89
|
+
nodes: {
|
|
90
|
+
...cur.nodes,
|
|
91
|
+
[node.id]: {
|
|
92
|
+
...(cur.nodes[node.id] ?? { type: node.type, status: 'idle', iter: 0 }),
|
|
93
|
+
type: node.type,
|
|
94
|
+
label: node.label,
|
|
95
|
+
status: 'active',
|
|
96
|
+
iter,
|
|
97
|
+
lastActiveAt: Date.now(),
|
|
98
|
+
// LLM 节点 active 时清 done/failed/reason —— 这是新一轮 iter,等 LLM 重新自报
|
|
99
|
+
...(node.type === 'llm' ? { done: false, failed: false, reason: null } : {}),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
75
103
|
emit('flow_node_active', deps, { nodeId: node.id, iter, quota: run_registry_1.flowRunRegistry.remainingQuota(deps.runId, node.id) });
|
|
76
104
|
(0, audit_log_1.appendAudit)(deps.projectFolder, deps.basename, deps.runId, {
|
|
77
105
|
ts: Date.now(), type: 'node_active', nodeId: node.id, iter,
|
|
@@ -96,9 +124,15 @@ async function runFlow(flow, initialSnapshot, deps) {
|
|
|
96
124
|
finish('failed', deps, info, llmQuotaErr, node.id);
|
|
97
125
|
return;
|
|
98
126
|
}
|
|
99
|
-
const translated = (0, prompt_translator_1.translatePrompt)(node.promptTemplate, flow.variables, snapshot, node.outputs
|
|
127
|
+
const translated = (0, prompt_translator_1.translatePrompt)(node.promptTemplate, flow.variables, snapshot, node.outputs, {
|
|
128
|
+
basename: deps.basename,
|
|
129
|
+
nodeId: node.id,
|
|
130
|
+
});
|
|
100
131
|
const r = await (0, llm_dispatcher_1.dispatchLlmCall)({
|
|
101
132
|
projectFolder: deps.projectFolder,
|
|
133
|
+
basename: deps.basename,
|
|
134
|
+
nodeId: node.id,
|
|
135
|
+
expectedIter: iter,
|
|
102
136
|
injector: deps.injector,
|
|
103
137
|
prompt: translated,
|
|
104
138
|
beforeSnapshot: snapshot,
|
|
@@ -120,6 +154,22 @@ async function runFlow(flow, initialSnapshot, deps) {
|
|
|
120
154
|
for (const d of r.varsDiff) {
|
|
121
155
|
emit('flow_var_changed', deps, { key: d.key, value: d.new });
|
|
122
156
|
}
|
|
157
|
+
// v-j: outputs 检查降级为 warning(LLM done=true 但漏改某些 outputs)。
|
|
158
|
+
// codex P1 #4:除 audit log 外还 broadcast WS 让前端 minimap 能显示。
|
|
159
|
+
if (r.missingOutputs && r.missingOutputs.length > 0) {
|
|
160
|
+
(0, audit_log_1.appendAudit)(deps.projectFolder, deps.basename, deps.runId, {
|
|
161
|
+
ts: Date.now(),
|
|
162
|
+
type: 'outputs_warning',
|
|
163
|
+
nodeId: node.id,
|
|
164
|
+
message: `LLM 自报完成但未修改字段:${r.missingOutputs.join(', ')}`,
|
|
165
|
+
});
|
|
166
|
+
emit('flow_warning', deps, {
|
|
167
|
+
nodeId: node.id,
|
|
168
|
+
kind: 'missing_outputs',
|
|
169
|
+
missingOutputs: r.missingOutputs,
|
|
170
|
+
message: `LLM 自报完成但未修改字段:${r.missingOutputs.join(', ')}`,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
123
173
|
}
|
|
124
174
|
}
|
|
125
175
|
else if (node.type === 'if') {
|
|
@@ -137,6 +187,17 @@ async function runFlow(flow, initialSnapshot, deps) {
|
|
|
137
187
|
return;
|
|
138
188
|
}
|
|
139
189
|
run_registry_1.flowRunRegistry.setNodeState(deps.runId, node.id, 'completed');
|
|
190
|
+
(0, run_state_file_1.patchRunState)(deps.projectFolder, deps.basename, (cur) => ({
|
|
191
|
+
...cur,
|
|
192
|
+
nodes: {
|
|
193
|
+
...cur.nodes,
|
|
194
|
+
[node.id]: {
|
|
195
|
+
...(cur.nodes[node.id] ?? { type: node.type, status: 'idle', iter: 0 }),
|
|
196
|
+
status: 'completed',
|
|
197
|
+
lastCompletedAt: Date.now(),
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}));
|
|
140
201
|
emit('flow_node_completed', deps, { nodeId: node.id, iter });
|
|
141
202
|
(0, audit_log_1.appendAudit)(deps.projectFolder, deps.basename, deps.runId, {
|
|
142
203
|
ts: Date.now(), type: 'node_completed', nodeId: node.id, iter,
|
|
@@ -158,6 +219,17 @@ async function executeUserInputNode(node, _snapshot, deps) {
|
|
|
158
219
|
}));
|
|
159
220
|
run_registry_1.flowRunRegistry.setPendingUserInput(deps.runId, { nodeId: node.id, fields });
|
|
160
221
|
run_registry_1.flowRunRegistry.updateStatus(deps.runId, 'waiting_user_input');
|
|
222
|
+
(0, run_state_file_1.patchRunState)(deps.projectFolder, deps.basename, (cur) => ({
|
|
223
|
+
...cur,
|
|
224
|
+
status: 'waiting_user_input',
|
|
225
|
+
nodes: {
|
|
226
|
+
...cur.nodes,
|
|
227
|
+
[node.id]: {
|
|
228
|
+
...(cur.nodes[node.id] ?? { type: 'user_input', status: 'idle', iter: 0 }),
|
|
229
|
+
status: 'waiting_user_input',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
}));
|
|
161
233
|
emit('flow_user_input_required', deps, { nodeId: node.id, fields });
|
|
162
234
|
const info = run_registry_1.flowRunRegistry.get(deps.runId);
|
|
163
235
|
return new Promise((resolve) => {
|
|
@@ -190,6 +262,21 @@ function finish(status, deps, info, errorMessage, nodeId) {
|
|
|
190
262
|
// 节点等待中时 registry 仍残留 pending,hydrateFromBackend 会让前端弹一个
|
|
191
263
|
// status=cancelled 但仍要求用户输入的对话框。
|
|
192
264
|
run_registry_1.flowRunRegistry.clearPendingUserInput(deps.runId);
|
|
265
|
+
// v-j: 终态同步写 run-state.json(用户能从此文件看到最终结果)
|
|
266
|
+
(0, run_state_file_1.patchRunState)(deps.projectFolder, deps.basename, (cur) => ({
|
|
267
|
+
...cur,
|
|
268
|
+
status,
|
|
269
|
+
finishedAt: Date.now(),
|
|
270
|
+
currentNodeId: null,
|
|
271
|
+
error: status === 'failed' ? { nodeId, message: errorMessage ?? 'unknown' } : null,
|
|
272
|
+
nodes: nodeId ? {
|
|
273
|
+
...cur.nodes,
|
|
274
|
+
[nodeId]: {
|
|
275
|
+
...(cur.nodes[nodeId] ?? { type: 'llm', status: 'idle', iter: 0 }),
|
|
276
|
+
status: status === 'failed' ? 'failed' : cur.nodes[nodeId]?.status ?? 'idle',
|
|
277
|
+
},
|
|
278
|
+
} : cur.nodes,
|
|
279
|
+
}));
|
|
193
280
|
if (status === 'failed') {
|
|
194
281
|
run_registry_1.flowRunRegistry.updateStatus(deps.runId, 'failed', {
|
|
195
282
|
nodeId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/track-flow/runtime.ts"],"names":[],"mappings":";;AAwEA,sDAMC;AA8BD,0BA6GC;AAzND,2DAAmE;AACnE,qDAA8C;AAC9C,2DAAoD;AACpD,qDAAiE;AACjE,2CAAyC;AACzC,iDAA8D;AA8D9D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA4B,CAAA,CAAE,kBAAkB;AAEhF;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAa,EAAE,MAA+B;IAClF,MAAM,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACrC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACpB,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACjB,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,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,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA,CAAE,QAAQ;IAClE,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bI as e,bJ as t,r as n,bK as r,c as a,h as i,bL as o,aF as s,j as l,R as c,d as u,aN as d,bM as p,t as m,A as g,q as h,b5 as f,bN as b,a as y,a0 as E,a2 as v,Z as S,Y as w,a1 as k,W as x,bn as T,aP as A,bC as _,bD as I,i as N,bO as R,bP as C,s as O,bQ as L,bR as D,bE as M,bS as P,bG as F,S as B,l as U,p as z}from"./index-
|
|
1
|
+
import{bI as e,bJ as t,r as n,bK as r,c as a,h as i,bL as o,aF as s,j as l,R as c,d as u,aN as d,bM as p,t as m,A as g,q as h,b5 as f,bN as b,a as y,a0 as E,a2 as v,Z as S,Y as w,a1 as k,W as x,bn as T,aP as A,bC as _,bD as I,i as N,bO as R,bP as C,s as O,bQ as L,bR as D,bE as M,bS as P,bG as F,S as B,l as U,p as z}from"./index-BhJADLPx.js";import{C as $}from"./chevron-down-DWfB7z-t.js";import{a as G,C as j,u as H,c as q}from"./index-CGrwyTes.js";function V(){!e.current&&t();const[a]=n.useState(r.current);return a}
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.309.0 - ISC
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,r as t,b as n,j as i,aN as r,B as o,m as a}from"./index-
|
|
1
|
+
import{c as e,r as t,b as n,j as i,aN as r,B as o,m as a}from"./index-BhJADLPx.js";import{Z as l,a as s}from"./ProjectPage-DQ2F8xZb.js";import"./purify.es-CgRAQgUo.js";import"./ChatOverlay-BhRFsbbR.js";import"./chevron-down-DWfB7z-t.js";import"./index-CGrwyTes.js";import"./select-C6vHKLtQ.js";import"./search-C5-inwaf.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license lucide-react v0.309.0 - ISC
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-
|
|
2
|
-
import{c as e,aQ as t,bu as s,aS as a,r as n,bv as r,bw as l,j as o,bx as c,m as i,d,by as u,bz as x,bA as m,bB as h,bC as p,bD as f,ac as g,ab as b,bE as j,bF as v,t as y,aa as N,aT as w,aN as k,bG as C,a as S,b as I,g as P,D as z,h as M,R as T,_ as U,l as $,X as D,p as R,b2 as A,bH as E,C as L,A as H,q as F}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-DyaPvJlf.js","assets/index-BhJADLPx.js","assets/index-Bvo6b2D8.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as e,aQ as t,bu as s,aS as a,r as n,bv as r,bw as l,j as o,bx as c,m as i,d,by as u,bz as x,bA as m,bB as h,bC as p,bD as f,ac as g,ab as b,bE as j,bF as v,t as y,aa as N,aT as w,aN as k,bG as C,a as S,b as I,g as P,D as z,h as M,R as T,_ as U,l as $,X as D,p as R,b2 as A,bH as E,C as L,A as H,q as F}from"./index-BhJADLPx.js";import{A as O,g as _,T as q,i as W,j as B,G as V,M as K,r as G,a as J,b as Q,c as X,e as Y,h as Z,o as ee,d as te,I as se,F as ae}from"./ChatOverlay-BhRFsbbR.js";import{a as ne}from"./index-CGrwyTes.js";import{C as re}from"./chevron-down-DWfB7z-t.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license lucide-react v0.309.0 - ISC
|
|
5
5
|
*
|
|
@@ -11,4 +11,4 @@ import{c as e,aQ as t,bu as s,aS as a,r as n,bv as r,bw as l,j as o,bx as c,m as
|
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the ISC license.
|
|
13
13
|
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
-
*/function ue({onSelectProject:e}){const h=t(),p=s(e=>e.clearToken),{projects:f,fetchProjects:g,hasFetched:b,loading:j}=a(),v=n.useCallback(()=>{a.getState().setProjects([]),p(),h("/login")},[p,h]),[y,N]=n.useState(new Map),[w,k]=n.useState(new Set),[C,S]=n.useState(!1);n.useEffect(()=>{g()},[g]);const I=n.useCallback(e=>{e.status&&N(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&k(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);r({onActivityUpdate:I});const{applyOrder:P}=l(),z=P(f.filter(e=>!e.archived));return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[o.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),o.jsx(c,{}),o.jsx("button",{onClick:()=>{(async()=>{S(!0);try{await g()}finally{S(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:C,"aria-label":"Refresh",children:o.jsx(i,{className:d("h-4 w-4",C&&"animate-spin")})}),o.jsx("button",{onClick:()=>h("/settings"),className:"text-muted-foreground active:text-foreground","aria-label":"Settings",children:o.jsx(u,{className:"h-4 w-4"})}),o.jsx("button",{onClick:v,className:"text-muted-foreground active:text-foreground","aria-label":"Logout",children:o.jsx(x,{className:"h-4 w-4"})}),!de&&o.jsx("button",{onClick:()=>h("/"),className:"text-muted-foreground active:text-foreground","aria-label":"Desktop mode",children:o.jsx(m,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[j&&!b&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),b&&0===z.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:z.map(t=>{var s;const a="running"===(s=t,y.get(s.id)??s.status??"stopped"),n=w.has(t.id),r=o.jsxs("button",{onClick:()=>e(t.id),className:d("w-full text-left rounded-xl border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),o.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return o.jsx("div",{className:n?"card-active-glow rounded-xl":void 0,children:r},t.id)})})]})]})}function xe(e){if(!e.phase)return null;if("thinking"===e.phase)return"思考中";if("tool_result"===e.phase)return"处理结果";if("tool_use"===e.phase){const t=(e.detail||"").toLowerCase();return"bash"===t?"执行命令":"read"===t?"读取文件":"edit"===t||"multiedit"===t?"编辑文件":"write"===t?"写入文件":"grep"===t?"搜索内容":"glob"===t?"匹配文件":"webfetch"===t||"websearch"===t?"访问网络":"task"===t?"调度子任务":"todowrite"===t?"更新任务列表":"notebookedit"===t?"编辑 Notebook":e.detail?`调用 ${e.detail}`:"调用工具"}return null}function me({project:e,onBack:t,onOpenPanel:s,onContextUpdate:a}){const[r,l]=n.useState(""),c=n.useRef(null),i=n.useRef(null),[u,x]=n.useState([]),m=n.useCallback(e=>{x(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),S=n.useRef(null),I=n.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),[P,z]=n.useState([]),M=n.useRef(new Set),T=n.useCallback(e=>{M.current.has(e.toolUseId)||z(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),U=n.useCallback(e=>{M.current.add(e.toolUseId),z(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),$=n.useCallback(e=>{M.current.add(e),z(t=>t.filter(t=>t.toolUseId!==e))},[]),[D,R]=n.useState(null),A=n.useRef(0),E=n.useCallback(e=>{var t,s,a;if(!e.active)return void R(null);if("text"===(null==(t=e.semantic)?void 0:t.phase))return void R(null);const n=null==(s=e.semantic)?void 0:s.phase,r=null==(a=e.semantic)?void 0:a.detail;R(e=>e?e.phase===n&&e.detail===r?e:{...e,phase:n,detail:r}:{id:"mab"+ ++A.current,phase:n,detail:r})},[]),{sendInput:L,connected:H}=h({projectId:e.id,enabled:!0,onChatMessage:m,onStatusChange:I,onContextUpdate:a,onApprovalRequest:T,onApprovalResolved:U,onSemanticUpdate:E});n.useEffect(()=>{if(!H)return;if("claude"!==e.cliTool)return;let t=!1;return p(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!M.current.has(e.toolUseId));z(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||M.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,H]);const{state:F,setState:K,messages:G,hasMoreHistory:J,loadMoreHistory:Q,sendMessage:X,isWaking:Y}=f({project:e,liveMessages:u,ws:{send:L,connected:H},historyLimit:20});S.current=K;const Z=n.useRef(H);n.useEffect(()=>{!Z.current&&H&&x([]),Z.current=H},[H]);const ee=(()=>{for(let e=G.length-1;e>=0;e--)if("assistant"===G[e].role)return e;return-1})(),[te,se]=n.useState([]),[ae,oe]=n.useState([]),[ce,de]=n.useState(null),[ue,me]=n.useState(null),he=n.useRef(!1);n.useEffect(()=>{g().then(se).catch(()=>{}),b(e.id).then(oe).catch(()=>{})},[e.id]);const pe=n.useCallback(e=>{const t=i.current;if(!t)return void l(t=>t+e);const s=t.selectionStart??r.length,a=t.selectionEnd??r.length,n=r.slice(0,s)+e+r.slice(a);l(n),requestAnimationFrame(()=>{t.focus();const a=s+e.length;t.setSelectionRange(a,a),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"})},[r]),fe=n.useCallback(e=>{de(null),pe(e+" ")},[pe]),ge=n.useCallback(t=>{const s=e.folderPath;let a=t;s&&(t===s||t.startsWith(s+"/")||t.startsWith(s+"\\"))&&(a=t.slice(s.length).replace(/^[/\\]+/,"")),de(null),pe(`@${a} `)},[e.folderPath,pe]),be=n.useCallback(async()=>{if("skills"!==ce){if(!he.current){he.current=!0;try{const t=await j(e.cliTool??"claude",e.id);me(t)}catch{me({builtin:[],custom:[],plugins:[],mcp:[]})}finally{he.current=!1}}de("skills")}else de(null)},[ce,e.cliTool,e.id]),je=n.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await Q(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[Q]),ve=n.useRef(0);n.useEffect(()=>{const e=c.current;if(!e)return;const t=G.length>ve.current,s=0===ve.current&&G.length>0;ve.current=G.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[G,P.length]);const[ye,Ne]=n.useState(!1),we=n.useCallback(async()=>{const e=r.trim();if(!e||ye)return;Ne(!0);const t=await X(e);Ne(!1),"delivered"===t&&(l(""),i.current&&(i.current.style.height="auto"))},[r,ye,X]),ke=v(we,"shift"),Ce=n.useCallback(async(t,s)=>{de(null);try{"failed"===await X(t.command)?y.error("快捷命令未送达,请重试或检查会话"):"project"===s&&N(e.id,t.id,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})}catch(a){console.error("Shortcut send error:",a),y.error("快捷命令发送失败")}},[X,e.id]),Se="live"===F;return o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",Se?"bg-green-500":Y?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),o.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(ie,{className:"h-5 w-5"})})]}),o.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[J&&o.jsx("div",{className:"flex justify-center pb-1",children:o.jsxs("button",{onClick:()=>{je()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[o.jsx(ne,{className:"h-3 w-3"}),"加载更早消息"]})}),G.map((e,t)=>{const s="user"===e.role;return o.jsx("div",{className:d("flex",s?"justify-end":"justify-start"),children:o.jsx("div",{className:d("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:o.jsx(O,{content:e.content,blocks:e.blocks,isLatest:t===ee})})},e.id)}),P.map(e=>o.jsx(_,{approval:e,onResolved:$},e.toolUseId)),D&&0===P.length&&o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"rounded-2xl rounded-bl-md px-3 py-1.5 bg-black/5 dark:bg-white/10 border border-black/10 dark:border-white/15 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(q,{}),xe(D)&&o.jsx("span",{children:xe(D)})]})},D.id),0===G.length&&0===P.length&&!D&&"stopped"===F&&o.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),Y&&o.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),"global"===ce||"project"===ce?o.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:o.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===ce?te:ae).map(e=>o.jsxs("button",{onClick:()=>Ce(e,ce),disabled:Y,className:d("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",Y&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"font-medium text-xs",children:e.label}),o.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===ce?te:ae).length&&o.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}):"skills"===ce&&ue?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(W,{data:ue,onCommand:fe})}):"files"===ce&&e.folderPath?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(B,{projectPath:e.folderPath,onSelect:ge})}):null,o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[o.jsx("button",{onClick:()=>{be()},title:"斜杠命令",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","skills"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:"/"}),o.jsx("button",{onClick:()=>de(e=>"files"===e?null:"files"),disabled:!e.folderPath,title:"引用文件",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","files"===ce?"bg-accent text-foreground font-medium":e.folderPath?"text-muted-foreground active:bg-accent":"text-muted-foreground/30 cursor-not-allowed"),children:"@"}),te.length>0&&o.jsxs("button",{onClick:()=>de(e=>"global"===e?null:"global"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(V,{className:"h-3 w-3"}),"全局","global"===ce&&o.jsx(re,{className:"h-3 w-3"})]}),ae.length>0&&o.jsxs("button",{onClick:()=>de(e=>"project"===e?null:"project"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(le,{className:"h-3 w-3"}),"项目","project"===ce&&o.jsx(re,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("textarea",{ref:i,value:r,onChange:e=>l(e.target.value),onKeyDown:ke,disabled:Y||ye,placeholder:Y?"启动中...":ye?"发送中…":"stopped"===F?"输入消息(自动启动)...":"输入消息...",rows:1,className:d("flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",(Y||ye)&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),o.jsx("button",{onClick:we,disabled:Y||ye||!r.trim(),className:d("shrink-0 p-2 rounded-md transition-colors",r.trim()&&!ye?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:ye?o.jsx(k,{className:"h-5 w-5 animate-spin"}):o.jsx(C,{className:"h-5 w-5"})})]})})]})}const he=T.lazy(()=>U(()=>import("./OfficePreview-_l7j8IV8.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),pe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),fe=new Set(["docx","xlsx","xls","pptx"]),ge={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function be(e){return e.split("/").pop()??e}function je({filePath:e,onBack:t}){const[s,a]=n.useState(null),[r,l]=n.useState(!0),[c,i]=n.useState(null),{resolved:d}=S(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),x=pe.has(u),m=fe.has(u),h=ge[u],p="dark"===d;n.useEffect(()=>{x||m?l(!1):(l(!0),i(null),I(e).then(a).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>l(!1)))},[e,x,m]);const f=M(e),g=n.useMemo(()=>{const e=P();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),b=n.useMemo(()=>x?`${g}&t=${Date.now()}`:"",[g,x]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:be(e)}),o.jsx("a",{href:g,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:o.jsx(z,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&o.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),x&&o.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:o.jsx("img",{src:b,alt:be(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&o.jsx(n.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:o.jsx(he,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&o.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[o.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${j=s.size,j<1024?`${j} B`:j<1048576?`${(j/1024).toFixed(1)} KB`:`${(j/1048576).toFixed(1)} MB`})`]}),o.jsxs("a",{href:g,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[o.jsx(z,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&o.jsxs(o.Fragment,{children:["md"===u&&o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:o.jsx(K,{remarkPlugins:[J,Q],rehypePlugins:[G],urlTransform:(e,t,s)=>"src"===t&&"img"===s.tagName?e:Y(e),components:{img:({src:t,alt:s,...a})=>o.jsx("img",{...a,src:X(e,t,P()),alt:s??"",loading:"lazy",style:{maxWidth:"100%",height:"auto"}})},children:s.content})}),"md"!==u&&h&&o.jsx(Z,{language:h,style:p?ee:te,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&o.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var j}const ve=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ye=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),Ne=new Set(["json","yaml","yml","toml","csv","tsv"]);function we({entry:e}){if("dir"===e.type)return o.jsx(R,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ve.has(t)?o.jsx(se,{className:"h-8 w-8 text-emerald-400"}):ye.has(t)?o.jsx(oe,{className:"h-8 w-8 text-orange-400"}):Ne.has(t)?o.jsx(ce,{className:"h-8 w-8 text-yellow-400"}):"md"===t?o.jsx(ae,{className:"h-8 w-8 text-sky-400"}):o.jsx(A,{className:"h-8 w-8 text-muted-foreground"})}function ke({rootPath:e,onClose:t}){const[s,a]=n.useState(e),[r,l]=n.useState([]),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await $(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));l(t),a(e)}catch{l([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?o.jsx(je,{filePath:d,onBack:()=>u(null)}):o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(D,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&o.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:o.jsx(w,{className:"h-4 w-4"})}),o.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&o.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>o.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-md active:bg-accent transition-colors",children:[o.jsx(we,{entry:e}),o.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function Ce(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function Se(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function Ie({projectName:e,cliTool:t,folderPath:s,contextData:a,onClose:r}){const[l,c]=n.useState(new Set(["context","usage","files"])),[u,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{c(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),E(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=a?Math.round(a.usedPercentage):null;return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(D,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("context")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&o.jsxs("span",{className:d("text-xs font-mono ml-auto",Ce(f)),children:[f,"%"]})]}),l.has("context")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&a?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full transition-all",Se(f)),style:{width:`${Math.min(f,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-10 text-right",Ce(f)),children:[f,"%"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[o.jsx("span",{children:"窗口大小"}),o.jsx("span",{className:"text-right font-mono",children:a.contextWindowSize>=1e6?`${(a.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(a.contextWindowSize/1e3)}K`}),o.jsx("span",{children:"输入 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.inputTokens.toLocaleString()}),o.jsx("span",{children:"输出 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.outputTokens.toLocaleString()})]})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),o.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[l.has("usage")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"用量"}),o.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await U(async()=>{const{refreshUsage:e}=await import("./index-CRR0fz5Z.js").then(e=>e.bV);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:o.jsx(i,{className:d("h-3 w-3",m&&"animate-spin")})})]}),l.has("usage")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:u?o.jsxs("div",{className:"space-y-2",children:[u.planName&&o.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",o.jsx("span",{className:"font-medium text-foreground",children:u.planName})]}),o.jsx(Pe,{label:"5h",bucket:u.fiveHour}),o.jsx(Pe,{label:"7d",bucket:u.sevenDay}),u.sevenDaySonnet&&o.jsx(Pe,{label:"7d Sonnet",bucket:u.sevenDaySonnet}),u.sevenDayOpus&&o.jsx(Pe,{label:"7d Opus",bucket:u.sevenDayOpus}),!u.fiveHour&&!u.sevenDay&&o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),o.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("files")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),l.has("files")&&o.jsx("div",{className:"h-[60vh]",children:o.jsx(ke,{rootPath:s,onClose:()=>p("files")})})]})]})}function Pe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),o.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full",Se(s)),style:{width:`${Math.min(s,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-8 text-right",Ce(s)),children:[s,"%"]}),a&&o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function ze(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[s,r]=n.useState(null),l=a(e=>e.projects),c=n.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?l.find(t=>t.id===e.projectId):void 0;return o.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[o.jsxs(H,{mode:"wait",children:["list"===e.screen&&o.jsx(F.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(ue,{onSelectProject:c})},"list"),"chat"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(me,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),o.jsx(H,{children:"panel"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(Ie,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:s,onClose:d})},"panel")})]})}export{ze as MobilePage};
|
|
14
|
+
*/function ue({onSelectProject:e}){const h=t(),p=s(e=>e.clearToken),{projects:f,fetchProjects:g,hasFetched:b,loading:j}=a(),v=n.useCallback(()=>{a.getState().setProjects([]),p(),h("/login")},[p,h]),[y,N]=n.useState(new Map),[w,k]=n.useState(new Set),[C,S]=n.useState(!1);n.useEffect(()=>{g()},[g]);const I=n.useCallback(e=>{e.status&&N(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&k(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);r({onActivityUpdate:I});const{applyOrder:P}=l(),z=P(f.filter(e=>!e.archived));return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[o.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),o.jsx(c,{}),o.jsx("button",{onClick:()=>{(async()=>{S(!0);try{await g()}finally{S(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:C,"aria-label":"Refresh",children:o.jsx(i,{className:d("h-4 w-4",C&&"animate-spin")})}),o.jsx("button",{onClick:()=>h("/settings"),className:"text-muted-foreground active:text-foreground","aria-label":"Settings",children:o.jsx(u,{className:"h-4 w-4"})}),o.jsx("button",{onClick:v,className:"text-muted-foreground active:text-foreground","aria-label":"Logout",children:o.jsx(x,{className:"h-4 w-4"})}),!de&&o.jsx("button",{onClick:()=>h("/"),className:"text-muted-foreground active:text-foreground","aria-label":"Desktop mode",children:o.jsx(m,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[j&&!b&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),b&&0===z.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:z.map(t=>{var s;const a="running"===(s=t,y.get(s.id)??s.status??"stopped"),n=w.has(t.id),r=o.jsxs("button",{onClick:()=>e(t.id),className:d("w-full text-left rounded-xl border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),o.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return o.jsx("div",{className:n?"card-active-glow rounded-xl":void 0,children:r},t.id)})})]})]})}function xe(e){if(!e.phase)return null;if("thinking"===e.phase)return"思考中";if("tool_result"===e.phase)return"处理结果";if("tool_use"===e.phase){const t=(e.detail||"").toLowerCase();return"bash"===t?"执行命令":"read"===t?"读取文件":"edit"===t||"multiedit"===t?"编辑文件":"write"===t?"写入文件":"grep"===t?"搜索内容":"glob"===t?"匹配文件":"webfetch"===t||"websearch"===t?"访问网络":"task"===t?"调度子任务":"todowrite"===t?"更新任务列表":"notebookedit"===t?"编辑 Notebook":e.detail?`调用 ${e.detail}`:"调用工具"}return null}function me({project:e,onBack:t,onOpenPanel:s,onContextUpdate:a}){const[r,l]=n.useState(""),c=n.useRef(null),i=n.useRef(null),[u,x]=n.useState([]),m=n.useCallback(e=>{x(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),S=n.useRef(null),I=n.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),[P,z]=n.useState([]),M=n.useRef(new Set),T=n.useCallback(e=>{M.current.has(e.toolUseId)||z(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),U=n.useCallback(e=>{M.current.add(e.toolUseId),z(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),$=n.useCallback(e=>{M.current.add(e),z(t=>t.filter(t=>t.toolUseId!==e))},[]),[D,R]=n.useState(null),A=n.useRef(0),E=n.useCallback(e=>{var t,s,a;if(!e.active)return void R(null);if("text"===(null==(t=e.semantic)?void 0:t.phase))return void R(null);const n=null==(s=e.semantic)?void 0:s.phase,r=null==(a=e.semantic)?void 0:a.detail;R(e=>e?e.phase===n&&e.detail===r?e:{...e,phase:n,detail:r}:{id:"mab"+ ++A.current,phase:n,detail:r})},[]),{sendInput:L,connected:H}=h({projectId:e.id,enabled:!0,onChatMessage:m,onStatusChange:I,onContextUpdate:a,onApprovalRequest:T,onApprovalResolved:U,onSemanticUpdate:E});n.useEffect(()=>{if(!H)return;if("claude"!==e.cliTool)return;let t=!1;return p(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!M.current.has(e.toolUseId));z(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||M.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,H]);const{state:F,setState:K,messages:G,hasMoreHistory:J,loadMoreHistory:Q,sendMessage:X,isWaking:Y}=f({project:e,liveMessages:u,ws:{send:L,connected:H},historyLimit:20});S.current=K;const Z=n.useRef(H);n.useEffect(()=>{!Z.current&&H&&x([]),Z.current=H},[H]);const ee=(()=>{for(let e=G.length-1;e>=0;e--)if("assistant"===G[e].role)return e;return-1})(),[te,se]=n.useState([]),[ae,oe]=n.useState([]),[ce,de]=n.useState(null),[ue,me]=n.useState(null),he=n.useRef(!1);n.useEffect(()=>{g().then(se).catch(()=>{}),b(e.id).then(oe).catch(()=>{})},[e.id]);const pe=n.useCallback(e=>{const t=i.current;if(!t)return void l(t=>t+e);const s=t.selectionStart??r.length,a=t.selectionEnd??r.length,n=r.slice(0,s)+e+r.slice(a);l(n),requestAnimationFrame(()=>{t.focus();const a=s+e.length;t.setSelectionRange(a,a),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"})},[r]),fe=n.useCallback(e=>{de(null),pe(e+" ")},[pe]),ge=n.useCallback(t=>{const s=e.folderPath;let a=t;s&&(t===s||t.startsWith(s+"/")||t.startsWith(s+"\\"))&&(a=t.slice(s.length).replace(/^[/\\]+/,"")),de(null),pe(`@${a} `)},[e.folderPath,pe]),be=n.useCallback(async()=>{if("skills"!==ce){if(!he.current){he.current=!0;try{const t=await j(e.cliTool??"claude",e.id);me(t)}catch{me({builtin:[],custom:[],plugins:[],mcp:[]})}finally{he.current=!1}}de("skills")}else de(null)},[ce,e.cliTool,e.id]),je=n.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await Q(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[Q]),ve=n.useRef(0);n.useEffect(()=>{const e=c.current;if(!e)return;const t=G.length>ve.current,s=0===ve.current&&G.length>0;ve.current=G.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[G,P.length]);const[ye,Ne]=n.useState(!1),we=n.useCallback(async()=>{const e=r.trim();if(!e||ye)return;Ne(!0);const t=await X(e);Ne(!1),"delivered"===t&&(l(""),i.current&&(i.current.style.height="auto"))},[r,ye,X]),ke=v(we,"shift"),Ce=n.useCallback(async(t,s)=>{de(null);try{"failed"===await X(t.command)?y.error("快捷命令未送达,请重试或检查会话"):"project"===s&&N(e.id,t.id,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})}catch(a){console.error("Shortcut send error:",a),y.error("快捷命令发送失败")}},[X,e.id]),Se="live"===F;return o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",Se?"bg-green-500":Y?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),o.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(ie,{className:"h-5 w-5"})})]}),o.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[J&&o.jsx("div",{className:"flex justify-center pb-1",children:o.jsxs("button",{onClick:()=>{je()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[o.jsx(ne,{className:"h-3 w-3"}),"加载更早消息"]})}),G.map((e,t)=>{const s="user"===e.role;return o.jsx("div",{className:d("flex",s?"justify-end":"justify-start"),children:o.jsx("div",{className:d("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:o.jsx(O,{content:e.content,blocks:e.blocks,isLatest:t===ee})})},e.id)}),P.map(e=>o.jsx(_,{approval:e,onResolved:$},e.toolUseId)),D&&0===P.length&&o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"rounded-2xl rounded-bl-md px-3 py-1.5 bg-black/5 dark:bg-white/10 border border-black/10 dark:border-white/15 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(q,{}),xe(D)&&o.jsx("span",{children:xe(D)})]})},D.id),0===G.length&&0===P.length&&!D&&"stopped"===F&&o.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),Y&&o.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),"global"===ce||"project"===ce?o.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:o.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===ce?te:ae).map(e=>o.jsxs("button",{onClick:()=>Ce(e,ce),disabled:Y,className:d("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",Y&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"font-medium text-xs",children:e.label}),o.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===ce?te:ae).length&&o.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}):"skills"===ce&&ue?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(W,{data:ue,onCommand:fe})}):"files"===ce&&e.folderPath?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(B,{projectPath:e.folderPath,onSelect:ge})}):null,o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[o.jsx("button",{onClick:()=>{be()},title:"斜杠命令",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","skills"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:"/"}),o.jsx("button",{onClick:()=>de(e=>"files"===e?null:"files"),disabled:!e.folderPath,title:"引用文件",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","files"===ce?"bg-accent text-foreground font-medium":e.folderPath?"text-muted-foreground active:bg-accent":"text-muted-foreground/30 cursor-not-allowed"),children:"@"}),te.length>0&&o.jsxs("button",{onClick:()=>de(e=>"global"===e?null:"global"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(V,{className:"h-3 w-3"}),"全局","global"===ce&&o.jsx(re,{className:"h-3 w-3"})]}),ae.length>0&&o.jsxs("button",{onClick:()=>de(e=>"project"===e?null:"project"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(le,{className:"h-3 w-3"}),"项目","project"===ce&&o.jsx(re,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("textarea",{ref:i,value:r,onChange:e=>l(e.target.value),onKeyDown:ke,disabled:Y||ye,placeholder:Y?"启动中...":ye?"发送中…":"stopped"===F?"输入消息(自动启动)...":"输入消息...",rows:1,className:d("flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",(Y||ye)&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),o.jsx("button",{onClick:we,disabled:Y||ye||!r.trim(),className:d("shrink-0 p-2 rounded-md transition-colors",r.trim()&&!ye?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:ye?o.jsx(k,{className:"h-5 w-5 animate-spin"}):o.jsx(C,{className:"h-5 w-5"})})]})})]})}const he=T.lazy(()=>U(()=>import("./OfficePreview-DyaPvJlf.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),pe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),fe=new Set(["docx","xlsx","xls","pptx"]),ge={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function be(e){return e.split("/").pop()??e}function je({filePath:e,onBack:t}){const[s,a]=n.useState(null),[r,l]=n.useState(!0),[c,i]=n.useState(null),{resolved:d}=S(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),x=pe.has(u),m=fe.has(u),h=ge[u],p="dark"===d;n.useEffect(()=>{x||m?l(!1):(l(!0),i(null),I(e).then(a).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>l(!1)))},[e,x,m]);const f=M(e),g=n.useMemo(()=>{const e=P();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),b=n.useMemo(()=>x?`${g}&t=${Date.now()}`:"",[g,x]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:be(e)}),o.jsx("a",{href:g,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:o.jsx(z,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&o.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),x&&o.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:o.jsx("img",{src:b,alt:be(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&o.jsx(n.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:o.jsx(he,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&o.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[o.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${j=s.size,j<1024?`${j} B`:j<1048576?`${(j/1024).toFixed(1)} KB`:`${(j/1048576).toFixed(1)} MB`})`]}),o.jsxs("a",{href:g,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[o.jsx(z,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&o.jsxs(o.Fragment,{children:["md"===u&&o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:o.jsx(K,{remarkPlugins:[J,Q],rehypePlugins:[G],urlTransform:(e,t,s)=>"src"===t&&"img"===s.tagName?e:Y(e),components:{img:({src:t,alt:s,...a})=>o.jsx("img",{...a,src:X(e,t,P()),alt:s??"",loading:"lazy",style:{maxWidth:"100%",height:"auto"}})},children:s.content})}),"md"!==u&&h&&o.jsx(Z,{language:h,style:p?ee:te,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&o.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var j}const ve=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ye=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),Ne=new Set(["json","yaml","yml","toml","csv","tsv"]);function we({entry:e}){if("dir"===e.type)return o.jsx(R,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ve.has(t)?o.jsx(se,{className:"h-8 w-8 text-emerald-400"}):ye.has(t)?o.jsx(oe,{className:"h-8 w-8 text-orange-400"}):Ne.has(t)?o.jsx(ce,{className:"h-8 w-8 text-yellow-400"}):"md"===t?o.jsx(ae,{className:"h-8 w-8 text-sky-400"}):o.jsx(A,{className:"h-8 w-8 text-muted-foreground"})}function ke({rootPath:e,onClose:t}){const[s,a]=n.useState(e),[r,l]=n.useState([]),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await $(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));l(t),a(e)}catch{l([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?o.jsx(je,{filePath:d,onBack:()=>u(null)}):o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(D,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&o.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:o.jsx(w,{className:"h-4 w-4"})}),o.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&o.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>o.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-md active:bg-accent transition-colors",children:[o.jsx(we,{entry:e}),o.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function Ce(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function Se(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function Ie({projectName:e,cliTool:t,folderPath:s,contextData:a,onClose:r}){const[l,c]=n.useState(new Set(["context","usage","files"])),[u,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{c(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),E(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=a?Math.round(a.usedPercentage):null;return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(D,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("context")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&o.jsxs("span",{className:d("text-xs font-mono ml-auto",Ce(f)),children:[f,"%"]})]}),l.has("context")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&a?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full transition-all",Se(f)),style:{width:`${Math.min(f,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-10 text-right",Ce(f)),children:[f,"%"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[o.jsx("span",{children:"窗口大小"}),o.jsx("span",{className:"text-right font-mono",children:a.contextWindowSize>=1e6?`${(a.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(a.contextWindowSize/1e3)}K`}),o.jsx("span",{children:"输入 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.inputTokens.toLocaleString()}),o.jsx("span",{children:"输出 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.outputTokens.toLocaleString()})]})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),o.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[l.has("usage")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"用量"}),o.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await U(async()=>{const{refreshUsage:e}=await import("./index-BhJADLPx.js").then(e=>e.bV);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:o.jsx(i,{className:d("h-3 w-3",m&&"animate-spin")})})]}),l.has("usage")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:u?o.jsxs("div",{className:"space-y-2",children:[u.planName&&o.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",o.jsx("span",{className:"font-medium text-foreground",children:u.planName})]}),o.jsx(Pe,{label:"5h",bucket:u.fiveHour}),o.jsx(Pe,{label:"7d",bucket:u.sevenDay}),u.sevenDaySonnet&&o.jsx(Pe,{label:"7d Sonnet",bucket:u.sevenDaySonnet}),u.sevenDayOpus&&o.jsx(Pe,{label:"7d Opus",bucket:u.sevenDayOpus}),!u.fiveHour&&!u.sevenDay&&o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),o.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("files")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),l.has("files")&&o.jsx("div",{className:"h-[60vh]",children:o.jsx(ke,{rootPath:s,onClose:()=>p("files")})})]})]})}function Pe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),o.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full",Se(s)),style:{width:`${Math.min(s,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-8 text-right",Ce(s)),children:[s,"%"]}),a&&o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function ze(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[s,r]=n.useState(null),l=a(e=>e.projects),c=n.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?l.find(t=>t.id===e.projectId):void 0;return o.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[o.jsxs(H,{mode:"wait",children:["list"===e.screen&&o.jsx(F.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(ue,{onSelectProject:c})},"list"),"chat"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(me,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),o.jsx(H,{children:"panel"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(Ie,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:s,onClose:d})},"panel")})]})}export{ze as MobilePage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as e,r as t,_ as s,g as r,h as a}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DSFa9HJl.js","assets/index-BhJADLPx.js","assets/index-Bvo6b2D8.css","assets/jszip.min-BS4NYaGC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as t,_ as s,g as r,h as a}from"./index-BhJADLPx.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-DSFa9HJl.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-BS4NYaGC.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-xl p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
|