dsh-archify-projects 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +204 -2
- package/cordis.patch.yml +99 -0
- package/dist/client.js +2261 -0
- package/dist/client.js.map +1 -0
- package/docs/CONTAINER.md +197 -0
- package/docs/DESIGN.md +905 -0
- package/docs/HANDOVER.md +391 -0
- package/docs/PUBLISH.md +107 -0
- package/icon.svg +12 -0
- package/lib/host/archify-skill.js +116 -0
- package/lib/host/archify-skill.js.map +1 -0
- package/lib/host/config.js +95 -0
- package/lib/host/config.js.map +1 -0
- package/lib/host/context.js +28 -0
- package/lib/host/context.js.map +1 -0
- package/lib/host/git.js +185 -0
- package/lib/host/git.js.map +1 -0
- package/lib/host/http.js +184 -0
- package/lib/host/http.js.map +1 -0
- package/lib/host/index.js +90 -0
- package/lib/host/index.js.map +1 -0
- package/lib/host/policy.js +124 -0
- package/lib/host/policy.js.map +1 -0
- package/lib/host/routes.js +667 -0
- package/lib/host/routes.js.map +1 -0
- package/lib/host/runner.js +913 -0
- package/lib/host/runner.js.map +1 -0
- package/lib/host/store.js +370 -0
- package/lib/host/store.js.map +1 -0
- package/lib/host/workspace.js +65 -0
- package/lib/host/workspace.js.map +1 -0
- package/lib/shared/format.js +138 -0
- package/lib/shared/format.js.map +1 -0
- package/lib/shared/prompt.js +257 -0
- package/lib/shared/prompt.js.map +1 -0
- package/lib/shared/protocol.js +31 -0
- package/lib/shared/protocol.js.map +1 -0
- package/lib/shared/types.js +173 -0
- package/lib/shared/types.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +98 -4
- package/skills/archify/LICENSE +22 -0
- package/skills/archify/SKILL.md +109 -0
- package/skills/archify/THIRD_PARTY_NOTICES.md +69 -0
- package/skills/archify/assets/JetBrainsMono-OFL.txt +93 -0
- package/skills/archify/assets/template.html +13709 -0
- package/skills/archify/bin/archify.mjs +6936 -0
- package/skills/archify/bin/delivery-update.mjs +91 -0
- package/skills/archify/bin/finalize.mjs +895 -0
- package/skills/archify/bin/open-artifact.mjs +146 -0
- package/skills/archify/bin/preview.mjs +969 -0
- package/skills/archify/bin/recover-output.mjs +41 -0
- package/skills/archify/bin/visual-check.mjs +2667 -0
- package/skills/archify/brand-marks/README.md +31 -0
- package/skills/archify/brand-marks/catalog.json +131 -0
- package/skills/archify/delta/architecture-delta.mjs +1313 -0
- package/skills/archify/examples/agent-run.lifecycle.json +55 -0
- package/skills/archify/examples/agent-tool-call.workflow.json +74 -0
- package/skills/archify/examples/async-job-roundtrip.sequence.json +56 -0
- package/skills/archify/examples/brand-aware-delivery.architecture.json +34 -0
- package/skills/archify/examples/cache-miss-request.sequence.json +77 -0
- package/skills/archify/examples/checkout-platform.base.architecture.json +32 -0
- package/skills/archify/examples/checkout-platform.head.architecture.json +32 -0
- package/skills/archify/examples/dataflow-product-analytics.html +13820 -0
- package/skills/archify/examples/deployment-release.lifecycle.json +48 -0
- package/skills/archify/examples/event-stream.dataflow.json +52 -0
- package/skills/archify/examples/holiday-planning.workflow.json +143 -0
- package/skills/archify/examples/incident-response.workflow.json +59 -0
- package/skills/archify/examples/lifecycle-agent-run.html +13765 -0
- package/skills/archify/examples/locales/de.json +425 -0
- package/skills/archify/examples/locales/es.json +440 -0
- package/skills/archify/examples/locales/fr.json +425 -0
- package/skills/archify/examples/locales/fr.partial.json +22 -0
- package/skills/archify/examples/locales/it.json +425 -0
- package/skills/archify/examples/locales/ja.json +425 -0
- package/skills/archify/examples/locales/ko.json +440 -0
- package/skills/archify/examples/locales/pt.json +425 -0
- package/skills/archify/examples/locales/ru.json +425 -0
- package/skills/archify/examples/product-analytics.dataflow.json +71 -0
- package/skills/archify/examples/production-deployment.architecture.json +51 -0
- package/skills/archify/examples/release-delivery.workflow.json +57 -0
- package/skills/archify/examples/sequence-cache-miss-request.html +13835 -0
- package/skills/archify/examples/web-app-rendered.html +13808 -0
- package/skills/archify/examples/web-app.architecture.json +41 -0
- package/skills/archify/examples/workflow-agent-tool-call-rendered.html +13826 -0
- package/skills/archify/migrations/workflow-v2.mjs +280 -0
- package/skills/archify/package.json +17 -0
- package/skills/archify/recipes/scenarios.mjs +430 -0
- package/skills/archify/references/architecture-layout-repair.md +18 -0
- package/skills/archify/references/authoring-contract.md +419 -0
- package/skills/archify/references/authoring-defaults.md +41 -0
- package/skills/archify/references/brand-marks.md +82 -0
- package/skills/archify/references/delivery-contract.md +588 -0
- package/skills/archify/references/repository-authoring.md +105 -0
- package/skills/archify/references/update-awareness.md +12 -0
- package/skills/archify/references/viewer-runtime.md +35 -0
- package/skills/archify/renderers/architecture/grid.mjs +62 -0
- package/skills/archify/renderers/architecture/labels.mjs +215 -0
- package/skills/archify/renderers/architecture/render-architecture.mjs +1001 -0
- package/skills/archify/renderers/architecture/routing.mjs +1157 -0
- package/skills/archify/renderers/dataflow/README.md +105 -0
- package/skills/archify/renderers/dataflow/render-dataflow.mjs +544 -0
- package/skills/archify/renderers/lifecycle/README.md +171 -0
- package/skills/archify/renderers/lifecycle/grid-routing.mjs +429 -0
- package/skills/archify/renderers/lifecycle/render-lifecycle.mjs +938 -0
- package/skills/archify/renderers/sequence/README.md +129 -0
- package/skills/archify/renderers/sequence/render-sequence.mjs +526 -0
- package/skills/archify/renderers/shared/atomic-output.mjs +1982 -0
- package/skills/archify/renderers/shared/brand-marks.mjs +670 -0
- package/skills/archify/renderers/shared/cli.mjs +451 -0
- package/skills/archify/renderers/shared/desktop-readability.mjs +132 -0
- package/skills/archify/renderers/shared/diagnostics.mjs +173 -0
- package/skills/archify/renderers/shared/engineering-profiles.mjs +157 -0
- package/skills/archify/renderers/shared/generated-brand-marks.mjs +2003 -0
- package/skills/archify/renderers/shared/generated-validators.mjs +134 -0
- package/skills/archify/renderers/shared/geometry.mjs +1941 -0
- package/skills/archify/renderers/shared/i18n.mjs +603 -0
- package/skills/archify/renderers/shared/layout-report.mjs +42 -0
- package/skills/archify/renderers/shared/legend.mjs +217 -0
- package/skills/archify/renderers/shared/output-path.mjs +440 -0
- package/skills/archify/renderers/shared/path-semantics.mjs +1017 -0
- package/skills/archify/renderers/shared/portable-path.mjs +408 -0
- package/skills/archify/renderers/shared/repository-evidence.mjs +352 -0
- package/skills/archify/renderers/shared/repository-location.mjs +59 -0
- package/skills/archify/renderers/shared/route-quality.mjs +614 -0
- package/skills/archify/renderers/shared/sidecar-path.mjs +38 -0
- package/skills/archify/renderers/shared/spatial-grid.mjs +66 -0
- package/skills/archify/renderers/shared/text-fit.mjs +105 -0
- package/skills/archify/renderers/shared/utils.mjs +254 -0
- package/skills/archify/renderers/shared/validator.mjs +86 -0
- package/skills/archify/renderers/workflow/README.md +301 -0
- package/skills/archify/renderers/workflow/render-workflow.mjs +37 -0
- package/skills/archify/renderers/workflow/workflow-compiler.mjs +4913 -0
- package/skills/archify/renderers/workflow/workflow-migration-geometry.mjs +144 -0
- package/skills/archify/schemas/README.md +256 -0
- package/skills/archify/schemas/architecture.schema.json +152 -0
- package/skills/archify/schemas/common.schema.json +181 -0
- package/skills/archify/schemas/dataflow.schema.json +254 -0
- package/skills/archify/schemas/lifecycle.schema.json +280 -0
- package/skills/archify/schemas/sequence.schema.json +234 -0
- package/skills/archify/schemas/workflow.schema.json +439 -0
- package/skills/archify/scripts/check-render-output.mjs +1388 -0
- package/skills/archify/scripts/check-update.mjs +1710 -0
- package/skills/archify/scripts/delivery-update-child.mjs +23 -0
- package/skills/archify/scripts/render-examples.mjs +26 -0
- package/skills/archify/scripts/update-contract.mjs +182 -0
- package/skills/archify/skill-release.json +10 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,2261 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-archify-projects",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
// src/shared/protocol.ts
|
|
13
|
+
/** 所有路由的前缀。 */
|
|
14
|
+
const ROUTE_PREFIX = "/dsh-archify-projects";
|
|
15
|
+
/** 路由表。host 注册与 client 请求都从这里取,避免字符串各写一份。 */
|
|
16
|
+
const ROUTES = {
|
|
17
|
+
health: `${ROUTE_PREFIX}/health`,
|
|
18
|
+
projects: `${ROUTE_PREFIX}/projects`,
|
|
19
|
+
project: (id) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}`,
|
|
20
|
+
check: (id) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/check`,
|
|
21
|
+
update: (id) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/update`,
|
|
22
|
+
/** 兼容旧接口:按 kind 重画默认图。 */
|
|
23
|
+
diagram: (id, kind) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/diagram/${kind}`,
|
|
24
|
+
diagrams: (id) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/diagrams`,
|
|
25
|
+
customDiagram: (id, diagramId) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/diagrams/${encodeURIComponent(diagramId)}`,
|
|
26
|
+
regenerate: (id, diagramId) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/diagrams/${encodeURIComponent(diagramId)}/regenerate`,
|
|
27
|
+
ask: (id, diagramId) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/diagrams/${encodeURIComponent(diagramId)}/ask`,
|
|
28
|
+
mergeQa: (id, qaId) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/qa/${encodeURIComponent(qaId)}/merge`,
|
|
29
|
+
childQa: (id, qaId) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/qa/${encodeURIComponent(qaId)}/child`,
|
|
30
|
+
runs: (id) => `${ROUTE_PREFIX}/projects/${encodeURIComponent(id)}/runs`,
|
|
31
|
+
artifact: (relativePath) => `${ROUTE_PREFIX}/artifact/${relativePath.split(/[\\/]+/).map((part) => encodeURIComponent(part)).join("/")}`
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/shared/types.ts
|
|
35
|
+
/** 两张默认图谱(自定义图统一用 `custom`)。 */
|
|
36
|
+
const DIAGRAM_KINDS = ["structure", "domain"];
|
|
37
|
+
/** Archify 的真实渲染器(见 skills/archify 的 Type router)。 */
|
|
38
|
+
const ARCHIFY_TYPES = [
|
|
39
|
+
"architecture",
|
|
40
|
+
"workflow",
|
|
41
|
+
"sequence",
|
|
42
|
+
"dataflow",
|
|
43
|
+
"lifecycle"
|
|
44
|
+
];
|
|
45
|
+
/** 一次运行/一次提问的 token 合计。 */
|
|
46
|
+
function usageTotalOf(usage) {
|
|
47
|
+
if (usage === null) return 0;
|
|
48
|
+
return usage.uncachedInput + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
49
|
+
}
|
|
50
|
+
/** 默认两张 + 自定义图,统一成一条列表(默认在前)。 */
|
|
51
|
+
function allDiagrams(project) {
|
|
52
|
+
return [...DIAGRAM_KINDS.map((kind) => project.diagrams[kind]), ...project.custom];
|
|
53
|
+
}
|
|
54
|
+
/** 按 id 找图;`structure` / `domain` 也能命中默认图。 */
|
|
55
|
+
function findDiagram(project, id) {
|
|
56
|
+
if (DIAGRAM_KINDS.includes(id)) return project.diagrams[id];
|
|
57
|
+
return project.custom.find((diagram) => diagram.id === id);
|
|
58
|
+
}
|
|
59
|
+
/** 工作区状态签名,用于判断图是否过期。 */
|
|
60
|
+
function treeSignature(tree) {
|
|
61
|
+
if (tree === null) return "none";
|
|
62
|
+
return `${tree.staged}:${tree.unstaged}:${tree.untracked}`;
|
|
63
|
+
}
|
|
64
|
+
/** 由 Git 快照派生「图谱是否落后于代码」——按分支 + 工作区,不看 commit。 */
|
|
65
|
+
function isStale(project) {
|
|
66
|
+
if (!project.git.isRepo) return false;
|
|
67
|
+
const ready = allDiagrams(project).filter((d) => d.status === "ready");
|
|
68
|
+
if (ready.length === 0) return false;
|
|
69
|
+
const currentTree = treeSignature(project.git.tree);
|
|
70
|
+
return ready.some((d) => d.branch !== project.git.branch || treeSignature(d.tree) !== currentTree);
|
|
71
|
+
}
|
|
72
|
+
/** 运行记录超过这个时长还没结束,就当它已经死了。
|
|
73
|
+
*
|
|
74
|
+
* 宿主被 kill / 断电 / 重启时,`running` 会被原样留在台账里。页面如果照字面
|
|
75
|
+
* 相信它,就会永远显示「生成中」并把按钮全部禁用——用户只能去手改 JSON。 */
|
|
76
|
+
const RUN_STALE_MS = 15e5;
|
|
77
|
+
/** 这条运行记录还算不算「活着」。 */
|
|
78
|
+
function isRunAlive(run, now = Date.now()) {
|
|
79
|
+
if (run.status !== "running") return false;
|
|
80
|
+
const started = Date.parse(run.startedAt);
|
|
81
|
+
if (Number.isNaN(started)) return false;
|
|
82
|
+
return now - started < RUN_STALE_MS;
|
|
83
|
+
}
|
|
84
|
+
/** 项目是否有正在进行的运行。 */
|
|
85
|
+
function isRunning(project, now = Date.now()) {
|
|
86
|
+
return project.runs.some((run) => isRunAlive(run, now)) || allDiagrams(project).some((d) => d.status === "queued" || d.status === "running");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/shared/format.ts
|
|
90
|
+
/**
|
|
91
|
+
* 相对时间(结构化)。
|
|
92
|
+
*
|
|
93
|
+
* 页面要中英双语,日文/德文同理,所以这里**不拼句子**,只回答
|
|
94
|
+
* 「多久以前、以什么粒度」—— 拼句子是渲染层的事。
|
|
95
|
+
*/
|
|
96
|
+
function relativeSpan(iso, now) {
|
|
97
|
+
if (iso === null || iso === void 0 || iso.length === 0) return null;
|
|
98
|
+
const then = new Date(iso).getTime();
|
|
99
|
+
if (Number.isNaN(then)) return null;
|
|
100
|
+
const deltaSec = Math.round((now.getTime() - then) / 1e3);
|
|
101
|
+
if (deltaSec < 60) return {
|
|
102
|
+
kind: "now",
|
|
103
|
+
value: 0
|
|
104
|
+
};
|
|
105
|
+
if (deltaSec < 3600) return {
|
|
106
|
+
kind: "minutes",
|
|
107
|
+
value: Math.floor(deltaSec / 60)
|
|
108
|
+
};
|
|
109
|
+
if (deltaSec < 86400) return {
|
|
110
|
+
kind: "hours",
|
|
111
|
+
value: Math.floor(deltaSec / 3600)
|
|
112
|
+
};
|
|
113
|
+
if (deltaSec < 2592e3) return {
|
|
114
|
+
kind: "days",
|
|
115
|
+
value: Math.floor(deltaSec / 86400)
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
kind: "date",
|
|
119
|
+
value: 0,
|
|
120
|
+
date: new Date(then).toISOString().slice(0, 10)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/** token 数的紧凑写法:1234 → 1.2k,12_345_678 → 12.3M。 */
|
|
124
|
+
function formatTokens(n) {
|
|
125
|
+
if (!Number.isFinite(n) || n <= 0) return "0";
|
|
126
|
+
if (n < 1e3) return String(Math.round(n));
|
|
127
|
+
if (n < 1e6) return `${(n / 1e3).toFixed(n < 1e4 ? 1 : 0)}k`;
|
|
128
|
+
return `${(n / 1e6).toFixed(1)}M`;
|
|
129
|
+
}
|
|
130
|
+
/** 估算费用(单位:货币,由配置决定是人民币还是美元)。 */
|
|
131
|
+
function estimateCost(usage, pricing) {
|
|
132
|
+
if (usage === null || pricing === null) return null;
|
|
133
|
+
const perM = 1e6;
|
|
134
|
+
return usage.uncachedInput / perM * pricing.inputPerMTok + usage.output / perM * pricing.outputPerMTok + usage.cacheRead / perM * pricing.cacheReadPerMTok;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/client/api.ts
|
|
138
|
+
/** 带错误码的失败。 */
|
|
139
|
+
var ApiError = class extends Error {
|
|
140
|
+
code;
|
|
141
|
+
constructor(code, message) {
|
|
142
|
+
super(message);
|
|
143
|
+
this.name = "ApiError";
|
|
144
|
+
this.code = code;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
/** 发一次请求并解包 `{ok, value}`。 */
|
|
148
|
+
async function api(path, init) {
|
|
149
|
+
const response = await fetch(path, {
|
|
150
|
+
credentials: "same-origin",
|
|
151
|
+
headers: init?.body === void 0 ? void 0 : { "Content-Type": "application/json" },
|
|
152
|
+
...init
|
|
153
|
+
});
|
|
154
|
+
let payload;
|
|
155
|
+
try {
|
|
156
|
+
payload = await response.json();
|
|
157
|
+
} catch {
|
|
158
|
+
throw new ApiError("bad-response", `服务返回了非 JSON 内容(HTTP ${response.status})`);
|
|
159
|
+
}
|
|
160
|
+
const result = payload;
|
|
161
|
+
if (result.ok === true) return result.value;
|
|
162
|
+
const code = result.error?.code ?? "unknown";
|
|
163
|
+
const message = result.error?.message ?? "未知错误";
|
|
164
|
+
throw new ApiError(code, message);
|
|
165
|
+
}
|
|
166
|
+
/** POST/PATCH 的便捷封装。 */
|
|
167
|
+
function send(path, method, body) {
|
|
168
|
+
return api(path, {
|
|
169
|
+
method,
|
|
170
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/client/components.tsx
|
|
175
|
+
/**
|
|
176
|
+
* 页面里可复用的小组件:标签、状态点、两个对话框。
|
|
177
|
+
*
|
|
178
|
+
* 只做展示与受控输入;请求与状态全部留在 page.tsx —— 组件不碰 fetch,
|
|
179
|
+
* 测试才能只渲染、不 mock 网络。
|
|
180
|
+
*/
|
|
181
|
+
/** 运行记录里的时钟:按本地时区显示 HH:mm:ss。 */
|
|
182
|
+
function clockText(iso) {
|
|
183
|
+
const at = new Date(iso);
|
|
184
|
+
if (Number.isNaN(at.getTime())) return iso.slice(11, 19);
|
|
185
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
186
|
+
return `${pad(at.getHours())}:${pad(at.getMinutes())}:${pad(at.getSeconds())}`;
|
|
187
|
+
}
|
|
188
|
+
/** 小标签。 */
|
|
189
|
+
function Chip({ tone = "default", dot = false, children }) {
|
|
190
|
+
const cls = tone === "default" ? "dap-chip" : `dap-chip dap-chip--${tone}`;
|
|
191
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
192
|
+
className: cls,
|
|
193
|
+
children: [dot ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
194
|
+
className: "dap-chip__dot",
|
|
195
|
+
"aria-hidden": "true"
|
|
196
|
+
}) : null, children]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/** 状态点。 */
|
|
200
|
+
function Dot({ tone = "ok" }) {
|
|
201
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
202
|
+
className: tone === "ok" ? "dap-dot" : `dap-dot dap-dot--${tone}`,
|
|
203
|
+
"aria-hidden": "true"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/** 新增项目对话框。 */
|
|
207
|
+
function NewProjectDialog({ t, busy, onClose, onSubmit }) {
|
|
208
|
+
const [name, setName] = (0, react.useState)("");
|
|
209
|
+
const [repoPath, setRepoPath] = (0, react.useState)("");
|
|
210
|
+
const [invalid, setInvalid] = (0, react.useState)(false);
|
|
211
|
+
const submit = () => {
|
|
212
|
+
if (repoPath.trim().length === 0) {
|
|
213
|
+
setInvalid(true);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
onSubmit(name.trim(), repoPath.trim());
|
|
217
|
+
};
|
|
218
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
219
|
+
className: "dap-mask",
|
|
220
|
+
role: "presentation",
|
|
221
|
+
onClick: (e) => e.target === e.currentTarget && onClose(),
|
|
222
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
223
|
+
className: "dap-dialog",
|
|
224
|
+
role: "dialog",
|
|
225
|
+
"aria-modal": "true",
|
|
226
|
+
"aria-label": t("dialog.addTitle"),
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
229
|
+
className: "dap-dialog__title",
|
|
230
|
+
children: t("dialog.addTitle")
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
233
|
+
className: "dap-dialog__sub",
|
|
234
|
+
children: t("empty.body")
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
237
|
+
className: "dap-field",
|
|
238
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
239
|
+
className: "dap-field__label",
|
|
240
|
+
children: t("field.name")
|
|
241
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
242
|
+
className: "dap-input",
|
|
243
|
+
value: name,
|
|
244
|
+
placeholder: t("field.namePlaceholder"),
|
|
245
|
+
onChange: (e) => setName(e.target.value)
|
|
246
|
+
})]
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
249
|
+
className: "dap-field",
|
|
250
|
+
style: { marginTop: 8 },
|
|
251
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
252
|
+
className: "dap-field__label",
|
|
253
|
+
children: t("field.path")
|
|
254
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
255
|
+
className: "dap-input",
|
|
256
|
+
value: repoPath,
|
|
257
|
+
placeholder: t("field.pathPlaceholder"),
|
|
258
|
+
"aria-invalid": invalid,
|
|
259
|
+
onChange: (e) => {
|
|
260
|
+
setRepoPath(e.target.value);
|
|
261
|
+
setInvalid(false);
|
|
262
|
+
}
|
|
263
|
+
})]
|
|
264
|
+
}),
|
|
265
|
+
invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
266
|
+
className: "dap-notice dap-notice--error",
|
|
267
|
+
children: t("field.pathRequired")
|
|
268
|
+
}) : null,
|
|
269
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
270
|
+
className: "dap-dialog__foot",
|
|
271
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
272
|
+
className: "dap-hint",
|
|
273
|
+
children: t("git.noRepoHint")
|
|
274
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
275
|
+
style: {
|
|
276
|
+
display: "flex",
|
|
277
|
+
gap: 6
|
|
278
|
+
},
|
|
279
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
280
|
+
className: "dap-btn dap-btn--sm",
|
|
281
|
+
onClick: onClose,
|
|
282
|
+
disabled: busy,
|
|
283
|
+
children: t("action.cancel")
|
|
284
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
285
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
286
|
+
onClick: submit,
|
|
287
|
+
disabled: busy,
|
|
288
|
+
children: t("action.submit")
|
|
289
|
+
})]
|
|
290
|
+
})]
|
|
291
|
+
})
|
|
292
|
+
]
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/** 从概念证据里推几个目录候选,够弹窗做「目录范围」。 */
|
|
297
|
+
function scopeOptions(project) {
|
|
298
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
299
|
+
for (const concept of project.concepts) for (const evidence of concept.evidence) {
|
|
300
|
+
const parts = evidence.split("/").filter((part) => part.length > 0);
|
|
301
|
+
if (parts.length === 0) continue;
|
|
302
|
+
const top = parts[0];
|
|
303
|
+
dirs.add(parts.length >= 2 && (top === "src" || top === "packages" || top === "apps") ? `${top}/${parts[1]}` : top);
|
|
304
|
+
}
|
|
305
|
+
const out = [...dirs].slice(0, 8);
|
|
306
|
+
return out.length > 0 ? out : ["src"];
|
|
307
|
+
}
|
|
308
|
+
/** 新建图对话框。 */
|
|
309
|
+
function NewDiagramDialog({ t, project, selectedId, busy, onClose, onSubmit }) {
|
|
310
|
+
const [prompt, setPrompt] = (0, react.useState)("");
|
|
311
|
+
const [persistence, setPersistence] = (0, react.useState)("permanent");
|
|
312
|
+
const [underCurrent, setUnderCurrent] = (0, react.useState)(selectedId !== null);
|
|
313
|
+
const [chosen, setChosen] = (0, react.useState)([]);
|
|
314
|
+
const [renderer, setRenderer] = (0, react.useState)(null);
|
|
315
|
+
const [pathScope, setPathScope] = (0, react.useState)([]);
|
|
316
|
+
const concepts = (0, react.useMemo)(() => project.concepts.slice(0, 24), [project.concepts]);
|
|
317
|
+
const scopes = (0, react.useMemo)(() => scopeOptions(project), [project]);
|
|
318
|
+
const toggleConcept = (id) => {
|
|
319
|
+
setChosen((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]);
|
|
320
|
+
};
|
|
321
|
+
const toggleScope = (dir) => {
|
|
322
|
+
setPathScope((prev) => prev.includes(dir) ? prev.filter((x) => x !== dir) : [...prev, dir]);
|
|
323
|
+
};
|
|
324
|
+
const submit = () => {
|
|
325
|
+
onSubmit({
|
|
326
|
+
title: prompt.trim().slice(0, 24),
|
|
327
|
+
prompt: prompt.trim(),
|
|
328
|
+
persistence,
|
|
329
|
+
parentId: underCurrent && selectedId !== null ? selectedId : null,
|
|
330
|
+
conceptIds: chosen,
|
|
331
|
+
renderer,
|
|
332
|
+
pathScope
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
336
|
+
className: "dap-mask",
|
|
337
|
+
role: "presentation",
|
|
338
|
+
onClick: (e) => e.target === e.currentTarget && onClose(),
|
|
339
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
340
|
+
className: "dap-dialog dap-dialog--wide",
|
|
341
|
+
role: "dialog",
|
|
342
|
+
"aria-modal": "true",
|
|
343
|
+
"aria-label": t("dialog.newDiagram"),
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
346
|
+
className: "dap-dialog__title",
|
|
347
|
+
children: t("dialog.newDiagram")
|
|
348
|
+
}),
|
|
349
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
350
|
+
className: "dap-dialog__sub",
|
|
351
|
+
children: t("dialog.newDiagramSub")
|
|
352
|
+
}),
|
|
353
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
354
|
+
className: "dap-dialog__row",
|
|
355
|
+
style: { marginBottom: 4 },
|
|
356
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
357
|
+
className: "dap-field__label",
|
|
358
|
+
children: t("field.renderer")
|
|
359
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
360
|
+
className: "dap-hint",
|
|
361
|
+
children: t("field.rendererHint")
|
|
362
|
+
})]
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
365
|
+
className: "dap-typebar",
|
|
366
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
367
|
+
className: renderer === null ? "dap-type-tag dap-type-tag--on" : "dap-type-tag",
|
|
368
|
+
onClick: () => setRenderer(null),
|
|
369
|
+
children: [
|
|
370
|
+
t("renderer.auto"),
|
|
371
|
+
" ",
|
|
372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
373
|
+
className: "dap-type-tag__k",
|
|
374
|
+
children: "agent"
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
}), ARCHIFY_TYPES.map((kind) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
378
|
+
className: renderer === kind ? "dap-type-tag dap-type-tag--on" : "dap-type-tag",
|
|
379
|
+
onClick: () => setRenderer(kind),
|
|
380
|
+
children: [
|
|
381
|
+
t(`renderer.${kind}`),
|
|
382
|
+
" ",
|
|
383
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
384
|
+
className: "dap-type-tag__k",
|
|
385
|
+
children: kind
|
|
386
|
+
})
|
|
387
|
+
]
|
|
388
|
+
}, kind))]
|
|
389
|
+
}),
|
|
390
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
391
|
+
className: "dap-type-detail",
|
|
392
|
+
children: renderer === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
393
|
+
className: "dap-type-detail__empty",
|
|
394
|
+
children: t("renderer.autoHint")
|
|
395
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
396
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
397
|
+
className: "dap-type-detail__head",
|
|
398
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: t(`renderer.${renderer}`) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: renderer })]
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
401
|
+
className: "dap-type-detail__row",
|
|
402
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("renderer.fit") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t(`renderer.${renderer}.fit`) })]
|
|
403
|
+
}),
|
|
404
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
405
|
+
className: "dap-type-detail__row",
|
|
406
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("renderer.show") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t(`renderer.${renderer}.show`) })]
|
|
407
|
+
}),
|
|
408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
409
|
+
className: "dap-type-detail__row",
|
|
410
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("renderer.grasp") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t(`renderer.${renderer}.grasp`) })]
|
|
411
|
+
})
|
|
412
|
+
] })
|
|
413
|
+
}),
|
|
414
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
415
|
+
className: "dap-field",
|
|
416
|
+
style: { marginTop: 10 },
|
|
417
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
418
|
+
className: "dap-field__label",
|
|
419
|
+
children: t("field.prompt")
|
|
420
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
421
|
+
className: "dap-textarea",
|
|
422
|
+
value: prompt,
|
|
423
|
+
placeholder: renderer === null ? t("field.promptPlaceholder") : `${t(`renderer.${renderer}`)}:${t("field.promptPlaceholder")}`,
|
|
424
|
+
onChange: (e) => setPrompt(e.target.value)
|
|
425
|
+
})]
|
|
426
|
+
}),
|
|
427
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
428
|
+
className: "dap-dialog__row",
|
|
429
|
+
style: { alignItems: "flex-start" },
|
|
430
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
431
|
+
className: "dap-field__label",
|
|
432
|
+
style: { flex: "none" },
|
|
433
|
+
children: t("field.concepts")
|
|
434
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
435
|
+
className: "dap-concepts",
|
|
436
|
+
children: concepts.map((concept) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
437
|
+
className: chosen.includes(concept.id) ? "dap-concept dap-concept--on" : "dap-concept",
|
|
438
|
+
onClick: () => toggleConcept(concept.id),
|
|
439
|
+
title: concept.summary,
|
|
440
|
+
children: concept.name
|
|
441
|
+
}, concept.id))
|
|
442
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
443
|
+
className: "dap-hint",
|
|
444
|
+
children: t("scope.conceptHint")
|
|
445
|
+
})] })]
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
448
|
+
className: "dap-dialog__row",
|
|
449
|
+
style: { alignItems: "flex-start" },
|
|
450
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
451
|
+
className: "dap-field__label",
|
|
452
|
+
style: { flex: "none" },
|
|
453
|
+
children: t("field.pathScope")
|
|
454
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
455
|
+
className: "dap-concepts",
|
|
456
|
+
children: scopes.map((dir) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
457
|
+
className: pathScope.includes(dir) ? "dap-concept dap-concept--on" : "dap-concept",
|
|
458
|
+
onClick: () => toggleScope(dir),
|
|
459
|
+
children: dir
|
|
460
|
+
}, dir))
|
|
461
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
462
|
+
className: "dap-hint",
|
|
463
|
+
children: t("scope.pathHint")
|
|
464
|
+
})] })]
|
|
465
|
+
}),
|
|
466
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
467
|
+
className: "dap-dialog__row",
|
|
468
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
469
|
+
className: "dap-field__label",
|
|
470
|
+
children: t("field.persistence")
|
|
471
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
472
|
+
className: "dap-seg",
|
|
473
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
474
|
+
className: persistence === "permanent" ? "dap-seg__btn dap-seg__btn--on" : "dap-seg__btn",
|
|
475
|
+
onClick: () => setPersistence("permanent"),
|
|
476
|
+
children: t("persistence.permanent")
|
|
477
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
478
|
+
className: persistence === "temporary" ? "dap-seg__btn dap-seg__btn--on" : "dap-seg__btn",
|
|
479
|
+
onClick: () => setPersistence("temporary"),
|
|
480
|
+
children: t("persistence.temporary")
|
|
481
|
+
})]
|
|
482
|
+
})]
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
485
|
+
className: "dap-hint",
|
|
486
|
+
children: persistence === "permanent" ? t("persistence.permanentHint") : t("persistence.temporaryHint")
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
489
|
+
className: "dap-dialog__row",
|
|
490
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
491
|
+
className: "dap-field__label",
|
|
492
|
+
children: t("field.parent")
|
|
493
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
494
|
+
className: "dap-seg",
|
|
495
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
496
|
+
className: !underCurrent ? "dap-seg__btn dap-seg__btn--on" : "dap-seg__btn",
|
|
497
|
+
onClick: () => setUnderCurrent(false),
|
|
498
|
+
children: t("parent.none")
|
|
499
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
500
|
+
className: underCurrent ? "dap-seg__btn dap-seg__btn--on" : "dap-seg__btn",
|
|
501
|
+
onClick: () => setUnderCurrent(true),
|
|
502
|
+
disabled: selectedId === null,
|
|
503
|
+
children: t("parent.current")
|
|
504
|
+
})]
|
|
505
|
+
})]
|
|
506
|
+
}),
|
|
507
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
508
|
+
className: "dap-dialog__foot",
|
|
509
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
510
|
+
className: "dap-hint",
|
|
511
|
+
children: t("qa.mergeHint")
|
|
512
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
513
|
+
style: {
|
|
514
|
+
display: "flex",
|
|
515
|
+
gap: 6
|
|
516
|
+
},
|
|
517
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
518
|
+
className: "dap-btn dap-btn--sm",
|
|
519
|
+
onClick: onClose,
|
|
520
|
+
disabled: busy,
|
|
521
|
+
children: t("action.cancel")
|
|
522
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
523
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
524
|
+
onClick: submit,
|
|
525
|
+
disabled: busy || prompt.trim().length === 0,
|
|
526
|
+
children: t("action.submit")
|
|
527
|
+
})]
|
|
528
|
+
})]
|
|
529
|
+
})
|
|
530
|
+
]
|
|
531
|
+
})
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/client/page.tsx
|
|
536
|
+
/**
|
|
537
|
+
* 插件主页面:图册(总览) + 工作台(三栏)。
|
|
538
|
+
*
|
|
539
|
+
* 数据全部走插件自己的 HTTP 路由;有任务在跑时 2.5s 轮询,跑完自动停 ——
|
|
540
|
+
* 不新增 WebSocket、不新增宿主契约。所有动作都有「进行中」状态与错误回执,
|
|
541
|
+
* 失败不吞。
|
|
542
|
+
*/
|
|
543
|
+
const INITIAL = {
|
|
544
|
+
loading: true,
|
|
545
|
+
error: null,
|
|
546
|
+
projects: [],
|
|
547
|
+
workspacePath: null,
|
|
548
|
+
pricing: null
|
|
549
|
+
};
|
|
550
|
+
/** 有任务在跑时的轮询间隔。 */
|
|
551
|
+
const POLL_MS = 2500;
|
|
552
|
+
/** 页面组件。 */
|
|
553
|
+
function StudioPage({ t }) {
|
|
554
|
+
const [state, setState] = (0, react.useState)(INITIAL);
|
|
555
|
+
const [screen, setScreen] = (0, react.useState)("atlas");
|
|
556
|
+
const [projectId, setProjectId] = (0, react.useState)(null);
|
|
557
|
+
const [diagramId, setDiagramId] = (0, react.useState)(null);
|
|
558
|
+
const [tab, setTab] = (0, react.useState)("info");
|
|
559
|
+
const [dialog, setDialog] = (0, react.useState)(null);
|
|
560
|
+
const [busy, setBusy] = (0, react.useState)(null);
|
|
561
|
+
const [notice, setNotice] = (0, react.useState)(null);
|
|
562
|
+
const [question, setQuestion] = (0, react.useState)("");
|
|
563
|
+
const mounted = (0, react.useRef)(true);
|
|
564
|
+
(0, react.useEffect)(() => {
|
|
565
|
+
mounted.current = true;
|
|
566
|
+
return () => {
|
|
567
|
+
mounted.current = false;
|
|
568
|
+
};
|
|
569
|
+
}, []);
|
|
570
|
+
const load = (0, react.useCallback)(async () => {
|
|
571
|
+
try {
|
|
572
|
+
const value = await api(ROUTES.projects);
|
|
573
|
+
if (!mounted.current) return;
|
|
574
|
+
setState({
|
|
575
|
+
loading: false,
|
|
576
|
+
error: null,
|
|
577
|
+
projects: value.projects,
|
|
578
|
+
workspacePath: value.workspacePath,
|
|
579
|
+
pricing: value.pricing ?? null
|
|
580
|
+
});
|
|
581
|
+
} catch (err) {
|
|
582
|
+
if (!mounted.current) return;
|
|
583
|
+
setState((prev) => ({
|
|
584
|
+
...prev,
|
|
585
|
+
loading: false,
|
|
586
|
+
error: messageOf(err)
|
|
587
|
+
}));
|
|
588
|
+
}
|
|
589
|
+
}, []);
|
|
590
|
+
(0, react.useEffect)(() => {
|
|
591
|
+
load();
|
|
592
|
+
}, [load]);
|
|
593
|
+
const running = state.projects.some((project) => isRunning(project));
|
|
594
|
+
(0, react.useEffect)(() => {
|
|
595
|
+
if (!running) return void 0;
|
|
596
|
+
const timer = setInterval(() => void load(), POLL_MS);
|
|
597
|
+
return () => clearInterval(timer);
|
|
598
|
+
}, [running, load]);
|
|
599
|
+
const project = (0, react.useMemo)(() => state.projects.find((item) => item.id === projectId) ?? null, [state.projects, projectId]);
|
|
600
|
+
const diagram = (0, react.useMemo)(() => project !== null && diagramId !== null ? findDiagram(project, diagramId) : void 0, [project, diagramId]);
|
|
601
|
+
(0, react.useEffect)(() => {
|
|
602
|
+
if (project === null) return;
|
|
603
|
+
if (diagramId !== null && findDiagram(project, diagramId) !== void 0) return;
|
|
604
|
+
setDiagramId(project.diagrams.structure.id);
|
|
605
|
+
}, [project, diagramId]);
|
|
606
|
+
const applyProject = (0, react.useCallback)((next) => {
|
|
607
|
+
if (!mounted.current) return;
|
|
608
|
+
setState((prev) => ({
|
|
609
|
+
...prev,
|
|
610
|
+
projects: prev.projects.map((item) => item.id === next.id ? next : item)
|
|
611
|
+
}));
|
|
612
|
+
}, []);
|
|
613
|
+
const fail = (0, react.useCallback)((err) => {
|
|
614
|
+
setNotice({
|
|
615
|
+
text: t("error.generic", { message: messageOf(err) }),
|
|
616
|
+
error: true
|
|
617
|
+
});
|
|
618
|
+
}, [t]);
|
|
619
|
+
const openProject = (0, react.useCallback)((id) => {
|
|
620
|
+
setProjectId(id);
|
|
621
|
+
setScreen("wb");
|
|
622
|
+
setTab("info");
|
|
623
|
+
setDiagramId("structure");
|
|
624
|
+
}, []);
|
|
625
|
+
const runUpdate = async (target) => {
|
|
626
|
+
setBusy(`update:${target.id}`);
|
|
627
|
+
setNotice(null);
|
|
628
|
+
try {
|
|
629
|
+
const value = await send(ROUTES.update(target.id), "POST");
|
|
630
|
+
applyProject(value.project);
|
|
631
|
+
} catch (err) {
|
|
632
|
+
fail(err);
|
|
633
|
+
} finally {
|
|
634
|
+
setBusy(null);
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
const updateAll = async () => {
|
|
638
|
+
for (const item of state.projects) {
|
|
639
|
+
if (isRunning(item)) continue;
|
|
640
|
+
await runUpdate(item);
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
const regenerate = async () => {
|
|
644
|
+
if (project === null || diagram === void 0) return;
|
|
645
|
+
setBusy(`regen:${diagram.id}`);
|
|
646
|
+
setNotice(null);
|
|
647
|
+
try {
|
|
648
|
+
const value = await send(ROUTES.regenerate(project.id, diagram.id), "POST");
|
|
649
|
+
applyProject(value.project);
|
|
650
|
+
} catch (err) {
|
|
651
|
+
fail(err);
|
|
652
|
+
} finally {
|
|
653
|
+
setBusy(null);
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
const createProject = async (name, repoPath) => {
|
|
657
|
+
setBusy("create:project");
|
|
658
|
+
setNotice(null);
|
|
659
|
+
try {
|
|
660
|
+
const value = await send(ROUTES.projects, "POST", {
|
|
661
|
+
name,
|
|
662
|
+
repoPath
|
|
663
|
+
});
|
|
664
|
+
setDialog(null);
|
|
665
|
+
if (!mounted.current) return;
|
|
666
|
+
setState((prev) => ({
|
|
667
|
+
...prev,
|
|
668
|
+
projects: [value.project, ...prev.projects.filter((p) => p.id !== value.project.id)]
|
|
669
|
+
}));
|
|
670
|
+
setProjectId(value.project.id);
|
|
671
|
+
setDiagramId("structure");
|
|
672
|
+
setScreen("wb");
|
|
673
|
+
} catch (err) {
|
|
674
|
+
fail(err);
|
|
675
|
+
} finally {
|
|
676
|
+
setBusy(null);
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
const createDiagram = async (draft) => {
|
|
680
|
+
if (project === null) return;
|
|
681
|
+
setBusy("create:diagram");
|
|
682
|
+
setNotice(null);
|
|
683
|
+
try {
|
|
684
|
+
const value = await send(ROUTES.diagrams(project.id), "POST", draft);
|
|
685
|
+
setDialog(null);
|
|
686
|
+
applyProject(value.project);
|
|
687
|
+
const newest = value.project.custom[value.project.custom.length - 1];
|
|
688
|
+
if (newest !== void 0) setDiagramId(newest.id);
|
|
689
|
+
setNotice({
|
|
690
|
+
text: t("notice.running"),
|
|
691
|
+
error: false
|
|
692
|
+
});
|
|
693
|
+
} catch (err) {
|
|
694
|
+
fail(err);
|
|
695
|
+
} finally {
|
|
696
|
+
setBusy(null);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
const ask = async () => {
|
|
700
|
+
if (project === null || diagram === void 0 || question.trim().length === 0) return;
|
|
701
|
+
setBusy("ask");
|
|
702
|
+
setNotice(null);
|
|
703
|
+
try {
|
|
704
|
+
const value = await send(ROUTES.ask(project.id, diagram.id), "POST", { question: question.trim() });
|
|
705
|
+
setQuestion("");
|
|
706
|
+
applyProject(value.project);
|
|
707
|
+
} catch (err) {
|
|
708
|
+
fail(err);
|
|
709
|
+
} finally {
|
|
710
|
+
setBusy(null);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
const applyQa = async (qaId, action) => {
|
|
714
|
+
if (project === null) return;
|
|
715
|
+
setBusy(`${action}:${qaId}`);
|
|
716
|
+
setNotice(null);
|
|
717
|
+
try {
|
|
718
|
+
const path = action === "merge" ? ROUTES.mergeQa(project.id, qaId) : ROUTES.childQa(project.id, qaId);
|
|
719
|
+
const value = await send(path, "POST");
|
|
720
|
+
applyProject(value.project);
|
|
721
|
+
setNotice({
|
|
722
|
+
text: t(action === "merge" ? "notice.merged" : "notice.child"),
|
|
723
|
+
error: false
|
|
724
|
+
});
|
|
725
|
+
if (action === "child" && value.diagramId !== null) setDiagramId(value.diagramId);
|
|
726
|
+
} catch (err) {
|
|
727
|
+
fail(err);
|
|
728
|
+
} finally {
|
|
729
|
+
setBusy(null);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
const setPersistence = async (persistence) => {
|
|
733
|
+
if (project === null || diagram === void 0) return;
|
|
734
|
+
setBusy("persistence");
|
|
735
|
+
try {
|
|
736
|
+
const value = await send(ROUTES.customDiagram(project.id, diagram.id), "PATCH", { persistence });
|
|
737
|
+
applyProject(value.project);
|
|
738
|
+
} catch (err) {
|
|
739
|
+
fail(err);
|
|
740
|
+
} finally {
|
|
741
|
+
setBusy(null);
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
const removeDiagram = async () => {
|
|
745
|
+
if (project === null || diagram === void 0) return;
|
|
746
|
+
setBusy("delete:diagram");
|
|
747
|
+
try {
|
|
748
|
+
const value = await send(ROUTES.customDiagram(project.id, diagram.id), "DELETE");
|
|
749
|
+
applyProject(value.project);
|
|
750
|
+
setDiagramId("structure");
|
|
751
|
+
} catch (err) {
|
|
752
|
+
fail(err);
|
|
753
|
+
} finally {
|
|
754
|
+
setBusy(null);
|
|
755
|
+
}
|
|
756
|
+
};
|
|
757
|
+
const ago = (iso) => {
|
|
758
|
+
const span = relativeSpan(iso, /* @__PURE__ */ new Date());
|
|
759
|
+
if (span === null) return t("status.none");
|
|
760
|
+
if (span.kind === "now") return t("time.now");
|
|
761
|
+
if (span.kind === "minutes") return t("time.minutes", { n: span.value });
|
|
762
|
+
if (span.kind === "hours") return t("time.hours", { n: span.value });
|
|
763
|
+
if (span.kind === "days") return t("time.days", { n: span.value });
|
|
764
|
+
return span.date ?? t("status.none");
|
|
765
|
+
};
|
|
766
|
+
if (screen === "wb" && project !== null) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
767
|
+
className: "dap-page",
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
770
|
+
className: "dap-head",
|
|
771
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
772
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
773
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
774
|
+
onClick: () => setScreen("atlas"),
|
|
775
|
+
children: ["← ", t("action.back")]
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
778
|
+
className: "dap-head__title",
|
|
779
|
+
style: { marginTop: 6 },
|
|
780
|
+
children: project.name
|
|
781
|
+
}),
|
|
782
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
783
|
+
className: "dap-head__sub",
|
|
784
|
+
children: project.repoPath
|
|
785
|
+
})
|
|
786
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
787
|
+
className: "dap-head__actions",
|
|
788
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
789
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
790
|
+
onClick: () => void runUpdate(project),
|
|
791
|
+
disabled: busy !== null || isRunning(project),
|
|
792
|
+
children: t("action.update")
|
|
793
|
+
})
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
797
|
+
className: "dap-scroll dap-scroll--wb",
|
|
798
|
+
children: [notice !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
799
|
+
className: notice.error ? "dap-notice dap-notice--error" : "dap-notice",
|
|
800
|
+
children: notice.text
|
|
801
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Workbench, {
|
|
802
|
+
t,
|
|
803
|
+
project,
|
|
804
|
+
diagram,
|
|
805
|
+
tab,
|
|
806
|
+
busy,
|
|
807
|
+
question,
|
|
808
|
+
pricing: state.pricing,
|
|
809
|
+
ago,
|
|
810
|
+
onTab: setTab,
|
|
811
|
+
onQuestion: setQuestion,
|
|
812
|
+
onAsk: () => void ask(),
|
|
813
|
+
onSelect: setDiagramId,
|
|
814
|
+
onRegenerate: () => void regenerate(),
|
|
815
|
+
onPersistence: (p) => void setPersistence(p),
|
|
816
|
+
onDelete: () => void removeDiagram(),
|
|
817
|
+
onQa: (id, action) => void applyQa(id, action),
|
|
818
|
+
onNewDiagram: () => setDialog("diagram")
|
|
819
|
+
})]
|
|
820
|
+
}),
|
|
821
|
+
dialog === "diagram" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewDiagramDialog, {
|
|
822
|
+
t,
|
|
823
|
+
project,
|
|
824
|
+
selectedId: diagram?.id ?? null,
|
|
825
|
+
busy: busy !== null,
|
|
826
|
+
onClose: () => setDialog(null),
|
|
827
|
+
onSubmit: (draft) => void createDiagram(draft)
|
|
828
|
+
}) : null
|
|
829
|
+
]
|
|
830
|
+
});
|
|
831
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
832
|
+
className: "dap-page",
|
|
833
|
+
children: [
|
|
834
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
835
|
+
className: "dap-head",
|
|
836
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
837
|
+
className: "dap-head__title",
|
|
838
|
+
children: t("page.title")
|
|
839
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
840
|
+
className: "dap-head__sub",
|
|
841
|
+
children: t("page.subtitle")
|
|
842
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
843
|
+
className: "dap-head__actions",
|
|
844
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
845
|
+
className: "dap-btn dap-btn--sm",
|
|
846
|
+
onClick: () => void updateAll(),
|
|
847
|
+
disabled: busy !== null || state.projects.length === 0,
|
|
848
|
+
children: t("action.updateAll")
|
|
849
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
850
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
851
|
+
onClick: () => setDialog("project"),
|
|
852
|
+
children: ["+ ", t("action.add")]
|
|
853
|
+
})]
|
|
854
|
+
})]
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
857
|
+
className: "dap-scroll",
|
|
858
|
+
children: [
|
|
859
|
+
notice !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
860
|
+
className: notice.error ? "dap-notice dap-notice--error" : "dap-notice",
|
|
861
|
+
children: notice.text
|
|
862
|
+
}) : null,
|
|
863
|
+
state.error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
864
|
+
className: "dap-notice dap-notice--error",
|
|
865
|
+
children: state.error
|
|
866
|
+
}) : null,
|
|
867
|
+
state.projects.length === 0 && !state.loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
868
|
+
className: "dap-empty",
|
|
869
|
+
children: [
|
|
870
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
871
|
+
className: "dap-empty__title",
|
|
872
|
+
children: t("empty.title")
|
|
873
|
+
}),
|
|
874
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
875
|
+
className: "dap-empty__body",
|
|
876
|
+
children: t("empty.body")
|
|
877
|
+
}),
|
|
878
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
879
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
880
|
+
onClick: () => setDialog("project"),
|
|
881
|
+
children: t("empty.action")
|
|
882
|
+
})
|
|
883
|
+
]
|
|
884
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
885
|
+
className: "dap-stats",
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
888
|
+
className: "dap-stat",
|
|
889
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
890
|
+
className: "dap-stat__k",
|
|
891
|
+
children: t("stat.repos")
|
|
892
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
893
|
+
className: "dap-stat__v",
|
|
894
|
+
children: state.projects.length
|
|
895
|
+
})]
|
|
896
|
+
}),
|
|
897
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
898
|
+
className: "dap-stat",
|
|
899
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
900
|
+
className: "dap-stat__k",
|
|
901
|
+
children: t("stat.concepts")
|
|
902
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
903
|
+
className: "dap-stat__v",
|
|
904
|
+
children: state.projects.reduce((sum, item) => sum + item.concepts.length, 0)
|
|
905
|
+
})]
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
908
|
+
className: "dap-stat",
|
|
909
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
910
|
+
className: "dap-stat__k",
|
|
911
|
+
children: t("stat.diagrams")
|
|
912
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
913
|
+
className: "dap-stat__v",
|
|
914
|
+
children: state.projects.reduce((sum, item) => sum + allDiagrams(item).length, 0)
|
|
915
|
+
})]
|
|
916
|
+
}),
|
|
917
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
918
|
+
className: "dap-stat",
|
|
919
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
920
|
+
className: "dap-stat__k",
|
|
921
|
+
children: t("stat.running")
|
|
922
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
923
|
+
className: "dap-stat__v",
|
|
924
|
+
children: state.projects.filter((item) => isRunning(item)).length
|
|
925
|
+
})]
|
|
926
|
+
})
|
|
927
|
+
]
|
|
928
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
929
|
+
className: "dap-atlas",
|
|
930
|
+
children: state.projects.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AtlasCard, {
|
|
931
|
+
t,
|
|
932
|
+
project: item,
|
|
933
|
+
busy,
|
|
934
|
+
ago,
|
|
935
|
+
onOpen: () => openProject(item.id),
|
|
936
|
+
onUpdate: () => void runUpdate(item)
|
|
937
|
+
}, item.id))
|
|
938
|
+
})] })
|
|
939
|
+
]
|
|
940
|
+
}),
|
|
941
|
+
dialog === "project" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NewProjectDialog, {
|
|
942
|
+
t,
|
|
943
|
+
busy: busy !== null,
|
|
944
|
+
onClose: () => setDialog(null),
|
|
945
|
+
onSubmit: (name, repoPath) => void createProject(name, repoPath)
|
|
946
|
+
}) : null
|
|
947
|
+
]
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
function AtlasCard({ t, project, busy, ago, onOpen, onUpdate }) {
|
|
951
|
+
const diagrams = allDiagrams(project);
|
|
952
|
+
const stale = isStale(project);
|
|
953
|
+
const running = isRunning(project);
|
|
954
|
+
const tree = project.git.tree;
|
|
955
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
956
|
+
className: "dap-card",
|
|
957
|
+
role: "button",
|
|
958
|
+
tabIndex: 0,
|
|
959
|
+
onClick: onOpen,
|
|
960
|
+
onKeyDown: (event) => {
|
|
961
|
+
if (event.key === "Enter" || event.key === " ") onOpen();
|
|
962
|
+
},
|
|
963
|
+
children: [
|
|
964
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
965
|
+
className: "dap-card__top",
|
|
966
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
967
|
+
className: "dap-repo",
|
|
968
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot, { tone: running ? "run" : stale ? "warn" : "ok" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
969
|
+
style: { minWidth: 0 },
|
|
970
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
971
|
+
className: "dap-repo__name",
|
|
972
|
+
children: project.name
|
|
973
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
974
|
+
className: "dap-repo__path",
|
|
975
|
+
children: project.repoPath
|
|
976
|
+
})]
|
|
977
|
+
})]
|
|
978
|
+
})
|
|
979
|
+
}),
|
|
980
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
981
|
+
className: "dap-chips",
|
|
982
|
+
children: [
|
|
983
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
984
|
+
dot: true,
|
|
985
|
+
children: project.git.isRepo ? project.git.branch ?? t("git.detached") : t("git.noRepo")
|
|
986
|
+
}),
|
|
987
|
+
tree !== null && tree.staged + tree.unstaged + tree.untracked > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
988
|
+
tone: "warn",
|
|
989
|
+
children: t("git.treeShort", {
|
|
990
|
+
staged: tree.staged,
|
|
991
|
+
unstaged: tree.unstaged
|
|
992
|
+
})
|
|
993
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
994
|
+
tone: "ok",
|
|
995
|
+
children: t("git.clean")
|
|
996
|
+
}),
|
|
997
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Chip, {
|
|
998
|
+
tone: "accent",
|
|
999
|
+
children: [
|
|
1000
|
+
project.concepts.length,
|
|
1001
|
+
" ",
|
|
1002
|
+
t("concept.title")
|
|
1003
|
+
]
|
|
1004
|
+
}),
|
|
1005
|
+
stale ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1006
|
+
tone: "warn",
|
|
1007
|
+
children: t("status.stale")
|
|
1008
|
+
}) : null
|
|
1009
|
+
]
|
|
1010
|
+
}),
|
|
1011
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1012
|
+
className: "dap-thumbs",
|
|
1013
|
+
children: diagrams.slice(0, 3).map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1014
|
+
className: item.kind === "structure" ? "dap-thumb dap-thumb--wide" : "dap-thumb",
|
|
1015
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1016
|
+
className: "dap-thumb__title",
|
|
1017
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: item.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1018
|
+
className: "dap-thumb__count",
|
|
1019
|
+
children: item.persistence === "temporary" ? t("persistence.temporary") : t("status.ready")
|
|
1020
|
+
})]
|
|
1021
|
+
})
|
|
1022
|
+
}, item.id))
|
|
1023
|
+
}),
|
|
1024
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1025
|
+
className: "dap-card__foot",
|
|
1026
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [running ? t("runbar.step", { step: activeStep(project) ?? t("runbar.unknown") }) : `${project.git.branch ?? t("git.noRepo")} · ${ago(diagrams.find((d) => d.generatedAt)?.generatedAt ?? null)}`, project.usageTotal > 0 ? ` · ${formatTokens(project.usageTotal)} tokens` : ""] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1027
|
+
className: "dap-btn dap-btn--sm",
|
|
1028
|
+
onClick: (event) => {
|
|
1029
|
+
event.stopPropagation();
|
|
1030
|
+
onUpdate();
|
|
1031
|
+
},
|
|
1032
|
+
children: t("action.update")
|
|
1033
|
+
})]
|
|
1034
|
+
}),
|
|
1035
|
+
busy === `update:${project.id}` ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1036
|
+
className: "dap-hint",
|
|
1037
|
+
children: t("notice.running")
|
|
1038
|
+
}) : null
|
|
1039
|
+
]
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function Workbench({ t, project, diagram, tab, busy, question, pricing, ago, onTab, onQuestion, onAsk, onSelect, onRegenerate, onPersistence, onDelete, onQa, onNewDiagram }) {
|
|
1043
|
+
const custom = project.custom;
|
|
1044
|
+
const children = diagram === void 0 ? [] : custom.filter((item) => item.parentId === diagram.id);
|
|
1045
|
+
const parent = diagram?.parentId != null ? findDiagram(project, diagram.parentId) : void 0;
|
|
1046
|
+
const thread = project.qa.filter((entry) => entry.diagramId === diagram?.id);
|
|
1047
|
+
const tree = project.git.tree;
|
|
1048
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1049
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1050
|
+
className: "dap-chips",
|
|
1051
|
+
style: { marginBottom: 10 },
|
|
1052
|
+
children: [
|
|
1053
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1054
|
+
dot: true,
|
|
1055
|
+
children: project.git.isRepo ? project.git.branch ?? t("git.detached") : t("git.noRepo")
|
|
1056
|
+
}),
|
|
1057
|
+
tree !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1058
|
+
tone: "warn",
|
|
1059
|
+
children: t("git.tree", {
|
|
1060
|
+
staged: tree.staged,
|
|
1061
|
+
unstaged: tree.unstaged,
|
|
1062
|
+
untracked: tree.untracked
|
|
1063
|
+
})
|
|
1064
|
+
}) : null,
|
|
1065
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1066
|
+
className: "dap-hint",
|
|
1067
|
+
children: t("meta.branchLevel", { branch: project.git.branch ?? "—" })
|
|
1068
|
+
})
|
|
1069
|
+
]
|
|
1070
|
+
}),
|
|
1071
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RunBar, {
|
|
1072
|
+
t,
|
|
1073
|
+
project
|
|
1074
|
+
}),
|
|
1075
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1076
|
+
className: "dap-wb",
|
|
1077
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1078
|
+
className: "dap-panel dap-viewer",
|
|
1079
|
+
children: [
|
|
1080
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThumbStrip, {
|
|
1081
|
+
t,
|
|
1082
|
+
project,
|
|
1083
|
+
selectedId: diagram?.id ?? null,
|
|
1084
|
+
onSelect,
|
|
1085
|
+
onNewDiagram
|
|
1086
|
+
}),
|
|
1087
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1088
|
+
className: "dap-viewer__head",
|
|
1089
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1090
|
+
className: "dap-viewer__title",
|
|
1091
|
+
children: [diagram?.title ?? t("status.none"), parent !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: ["/ ", parent.title] }) : null]
|
|
1092
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1093
|
+
className: "dap-viewer__tools",
|
|
1094
|
+
children: [diagram?.htmlPath != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1095
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
1096
|
+
href: ROUTES.artifact(diagram.htmlPath),
|
|
1097
|
+
target: "_blank",
|
|
1098
|
+
rel: "noreferrer",
|
|
1099
|
+
children: t("action.openTab")
|
|
1100
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1101
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
1102
|
+
href: ROUTES.artifact(diagram.htmlPath),
|
|
1103
|
+
target: "_blank",
|
|
1104
|
+
rel: "noreferrer",
|
|
1105
|
+
children: t("action.fullscreen")
|
|
1106
|
+
})] }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1107
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
1108
|
+
onClick: onRegenerate,
|
|
1109
|
+
disabled: busy !== null,
|
|
1110
|
+
children: t("action.regenerate")
|
|
1111
|
+
})]
|
|
1112
|
+
})]
|
|
1113
|
+
}),
|
|
1114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1115
|
+
className: "dap-stage",
|
|
1116
|
+
children: [diagram?.status === "ready" && diagram.htmlPath !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1117
|
+
className: "dap-frame",
|
|
1118
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1119
|
+
className: "dap-frame__cap",
|
|
1120
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
1121
|
+
project.git.branch ?? t("git.noRepo"),
|
|
1122
|
+
" · ",
|
|
1123
|
+
ago(diagram.generatedAt)
|
|
1124
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: diagram.title })]
|
|
1125
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
1126
|
+
className: "dap-iframe",
|
|
1127
|
+
title: diagram.title,
|
|
1128
|
+
src: ROUTES.artifact(diagram.htmlPath),
|
|
1129
|
+
sandbox: "allow-scripts allow-same-origin"
|
|
1130
|
+
})]
|
|
1131
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1132
|
+
className: "dap-frame",
|
|
1133
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1134
|
+
className: "dap-empty",
|
|
1135
|
+
children: [
|
|
1136
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1137
|
+
className: "dap-empty__title",
|
|
1138
|
+
children: diagram === void 0 ? t("status.none") : t(`status.${diagram.status}`)
|
|
1139
|
+
}),
|
|
1140
|
+
diagram?.error != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1141
|
+
className: "dap-empty__body",
|
|
1142
|
+
children: diagram.error
|
|
1143
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1144
|
+
className: "dap-empty__body",
|
|
1145
|
+
children: t("notice.running")
|
|
1146
|
+
}),
|
|
1147
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1148
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
1149
|
+
onClick: onRegenerate,
|
|
1150
|
+
disabled: busy !== null,
|
|
1151
|
+
children: t("action.regenerate")
|
|
1152
|
+
})
|
|
1153
|
+
]
|
|
1154
|
+
})
|
|
1155
|
+
}), children.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1156
|
+
className: "dap-insets",
|
|
1157
|
+
children: children.map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1158
|
+
className: child.id === diagram?.id ? "dap-inset dap-inset--on" : "dap-inset",
|
|
1159
|
+
onClick: () => onSelect(child.id),
|
|
1160
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot, { tone: child.status === "ready" ? "ok" : child.status === "failed" ? "err" : "run" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1161
|
+
className: "dap-inset__name",
|
|
1162
|
+
children: child.title
|
|
1163
|
+
})]
|
|
1164
|
+
}, child.id))
|
|
1165
|
+
}) : null]
|
|
1166
|
+
})
|
|
1167
|
+
]
|
|
1168
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1169
|
+
className: "dap-panel",
|
|
1170
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1171
|
+
className: "dap-tabs",
|
|
1172
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1173
|
+
className: tab === "info" ? "dap-tab dap-tab--on" : "dap-tab",
|
|
1174
|
+
onClick: () => onTab("info"),
|
|
1175
|
+
children: t("field.status")
|
|
1176
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1177
|
+
className: tab === "qa" ? "dap-tab dap-tab--on" : "dap-tab",
|
|
1178
|
+
onClick: () => onTab("qa"),
|
|
1179
|
+
children: [t("qa.title"), thread.length > 0 ? ` ${thread.length}` : ""]
|
|
1180
|
+
})]
|
|
1181
|
+
}), tab === "info" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1182
|
+
className: "dap-insp",
|
|
1183
|
+
children: diagram === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1184
|
+
className: "dap-hint",
|
|
1185
|
+
children: t("status.none")
|
|
1186
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1187
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1188
|
+
className: "dap-field",
|
|
1189
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1190
|
+
className: "dap-field__label",
|
|
1191
|
+
children: t("field.status")
|
|
1192
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1193
|
+
className: "dap-chips",
|
|
1194
|
+
children: [
|
|
1195
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1196
|
+
tone: diagram.status === "ready" ? "ok" : diagram.status === "failed" ? "warn" : "default",
|
|
1197
|
+
children: t(`status.${diagram.status}`)
|
|
1198
|
+
}),
|
|
1199
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1200
|
+
tone: diagram.persistence === "permanent" ? "accent" : "default",
|
|
1201
|
+
children: diagram.persistence === "permanent" ? t("persistence.permanent") : t("persistence.temporary")
|
|
1202
|
+
}),
|
|
1203
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, { children: ago(diagram.generatedAt) })
|
|
1204
|
+
]
|
|
1205
|
+
})]
|
|
1206
|
+
}),
|
|
1207
|
+
diagram.kind === "custom" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1208
|
+
className: "dap-field",
|
|
1209
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1210
|
+
className: "dap-field__label",
|
|
1211
|
+
children: t("field.prompt")
|
|
1212
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1213
|
+
className: "dap-box",
|
|
1214
|
+
children: [diagram.prompt ?? t("status.none"), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1215
|
+
className: "dap-box__meta",
|
|
1216
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1217
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
1218
|
+
onClick: () => onPersistence(diagram.persistence === "permanent" ? "temporary" : "permanent"),
|
|
1219
|
+
disabled: busy !== null,
|
|
1220
|
+
children: diagram.persistence === "permanent" ? t("persistence.temporary") : t("persistence.permanent")
|
|
1221
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1222
|
+
className: "dap-btn dap-btn--ghost dap-btn--sm",
|
|
1223
|
+
onClick: onDelete,
|
|
1224
|
+
disabled: busy !== null,
|
|
1225
|
+
children: t("action.delete")
|
|
1226
|
+
})]
|
|
1227
|
+
})]
|
|
1228
|
+
})]
|
|
1229
|
+
}) : null,
|
|
1230
|
+
diagram.error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1231
|
+
className: "dap-notice dap-notice--error",
|
|
1232
|
+
children: diagram.error
|
|
1233
|
+
}) : null,
|
|
1234
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1235
|
+
className: "dap-field",
|
|
1236
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1237
|
+
className: "dap-field__label",
|
|
1238
|
+
children: t("field.branch")
|
|
1239
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1240
|
+
className: "dap-chips",
|
|
1241
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1242
|
+
dot: true,
|
|
1243
|
+
children: diagram.branch ?? project.git.branch ?? t("git.noRepo")
|
|
1244
|
+
}), diagram.tree !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, { children: t("git.treeShort", {
|
|
1245
|
+
staged: diagram.tree.staged,
|
|
1246
|
+
unstaged: diagram.tree.unstaged
|
|
1247
|
+
}) }) : null]
|
|
1248
|
+
})]
|
|
1249
|
+
}),
|
|
1250
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1251
|
+
className: "dap-field",
|
|
1252
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1253
|
+
className: "dap-field__label",
|
|
1254
|
+
children: t("field.concepts")
|
|
1255
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1256
|
+
className: "dap-chips",
|
|
1257
|
+
children: diagram.conceptIds.length === 0 ? project.concepts.slice(0, 6).map((concept) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, { children: concept.name }, concept.id)) : diagram.conceptIds.map((id) => {
|
|
1258
|
+
const concept = project.concepts.find((item) => item.id === id);
|
|
1259
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, { children: concept?.name ?? id }, id);
|
|
1260
|
+
})
|
|
1261
|
+
})]
|
|
1262
|
+
}),
|
|
1263
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1264
|
+
className: "dap-field",
|
|
1265
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1266
|
+
className: "dap-field__label",
|
|
1267
|
+
children: t("progress.title")
|
|
1268
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TodoList, {
|
|
1269
|
+
t,
|
|
1270
|
+
todos: project.lastRun?.todos ?? []
|
|
1271
|
+
})]
|
|
1272
|
+
}),
|
|
1273
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1274
|
+
className: "dap-field",
|
|
1275
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1276
|
+
className: "dap-field__label",
|
|
1277
|
+
children: t("usage.title")
|
|
1278
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageBlock, {
|
|
1279
|
+
t,
|
|
1280
|
+
project,
|
|
1281
|
+
pricing
|
|
1282
|
+
})]
|
|
1283
|
+
}),
|
|
1284
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1285
|
+
className: "dap-field",
|
|
1286
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1287
|
+
className: "dap-field__label",
|
|
1288
|
+
children: t("run.history")
|
|
1289
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1290
|
+
className: "dap-hint",
|
|
1291
|
+
children: project.runs.slice(-3).reverse().map((run) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
1292
|
+
clockText(run.startedAt),
|
|
1293
|
+
" · ",
|
|
1294
|
+
t(`run.kind.${run.kind}`),
|
|
1295
|
+
" ·",
|
|
1296
|
+
" ",
|
|
1297
|
+
t(`run.status.${run.status}`)
|
|
1298
|
+
] }, run.id))
|
|
1299
|
+
})]
|
|
1300
|
+
})
|
|
1301
|
+
] })
|
|
1302
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1303
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1304
|
+
className: "dap-insp",
|
|
1305
|
+
children: [thread.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1306
|
+
className: "dap-hint",
|
|
1307
|
+
children: t("qa.empty")
|
|
1308
|
+
}) : null, thread.map((entry) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1309
|
+
className: "dap-qa",
|
|
1310
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1311
|
+
className: "dap-msg dap-msg--me",
|
|
1312
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1313
|
+
className: "dap-msg__who",
|
|
1314
|
+
children: t("qa.me")
|
|
1315
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1316
|
+
className: "dap-msg__bubble",
|
|
1317
|
+
children: entry.question
|
|
1318
|
+
})]
|
|
1319
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1320
|
+
className: "dap-msg",
|
|
1321
|
+
children: [
|
|
1322
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1323
|
+
className: "dap-msg__who",
|
|
1324
|
+
children: t("qa.answer")
|
|
1325
|
+
}),
|
|
1326
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1327
|
+
className: "dap-msg__bubble",
|
|
1328
|
+
children: entry.answer
|
|
1329
|
+
}),
|
|
1330
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1331
|
+
className: "dap-msg__acts",
|
|
1332
|
+
children: entry.applied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Chip, {
|
|
1333
|
+
tone: "ok",
|
|
1334
|
+
children: t("qa.applied")
|
|
1335
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1336
|
+
className: "dap-btn dap-btn--sm",
|
|
1337
|
+
onClick: () => onQa(entry.id, "merge"),
|
|
1338
|
+
disabled: busy !== null,
|
|
1339
|
+
children: t("action.merge")
|
|
1340
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1341
|
+
className: "dap-btn dap-btn--sm",
|
|
1342
|
+
onClick: () => onQa(entry.id, "child"),
|
|
1343
|
+
disabled: busy !== null,
|
|
1344
|
+
children: t("action.child")
|
|
1345
|
+
})] })
|
|
1346
|
+
})
|
|
1347
|
+
]
|
|
1348
|
+
})]
|
|
1349
|
+
}, entry.id))]
|
|
1350
|
+
}),
|
|
1351
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1352
|
+
className: "dap-ask",
|
|
1353
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1354
|
+
value: question,
|
|
1355
|
+
placeholder: t("qa.placeholder"),
|
|
1356
|
+
onChange: (event) => onQuestion(event.target.value),
|
|
1357
|
+
disabled: busy === "ask"
|
|
1358
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1359
|
+
className: "dap-btn dap-btn--sm dap-btn--primary",
|
|
1360
|
+
onClick: onAsk,
|
|
1361
|
+
disabled: busy !== null || question.trim().length === 0,
|
|
1362
|
+
children: busy === "ask" ? t("qa.working") : t("action.send")
|
|
1363
|
+
})]
|
|
1364
|
+
}),
|
|
1365
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1366
|
+
className: "dap-hint",
|
|
1367
|
+
style: { padding: "0 10px 10px" },
|
|
1368
|
+
children: t("qa.mergeHint")
|
|
1369
|
+
})
|
|
1370
|
+
] })]
|
|
1371
|
+
})]
|
|
1372
|
+
})
|
|
1373
|
+
] });
|
|
1374
|
+
}
|
|
1375
|
+
/** 图片上方的图名 tab 条:默认两张 + 自定义图(子图挂在父图后面)。 */
|
|
1376
|
+
function ThumbStrip({ t, project, selectedId, onSelect, onNewDiagram }) {
|
|
1377
|
+
const diagrams = allDiagrams(project);
|
|
1378
|
+
const defaults = diagrams.filter((item) => item.kind !== "custom");
|
|
1379
|
+
const custom = diagrams.filter((item) => item.kind === "custom");
|
|
1380
|
+
const roots = custom.filter((item) => item.parentId === null);
|
|
1381
|
+
const childrenOf = (id) => custom.filter((item) => item.parentId === id);
|
|
1382
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1383
|
+
className: "dap-strip",
|
|
1384
|
+
role: "tablist",
|
|
1385
|
+
"aria-label": t("page.title"),
|
|
1386
|
+
children: [
|
|
1387
|
+
defaults.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Thumb, {
|
|
1388
|
+
t,
|
|
1389
|
+
diagram: item,
|
|
1390
|
+
active: item.id === selectedId,
|
|
1391
|
+
onSelect
|
|
1392
|
+
}, item.id)),
|
|
1393
|
+
roots.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1394
|
+
className: "dap-strip__sep",
|
|
1395
|
+
"aria-hidden": "true"
|
|
1396
|
+
}) : null,
|
|
1397
|
+
roots.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Thumb, {
|
|
1398
|
+
t,
|
|
1399
|
+
diagram: item,
|
|
1400
|
+
active: item.id === selectedId,
|
|
1401
|
+
onSelect
|
|
1402
|
+
}), childrenOf(item.id).map((child) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Thumb, {
|
|
1403
|
+
t,
|
|
1404
|
+
diagram: child,
|
|
1405
|
+
active: child.id === selectedId,
|
|
1406
|
+
child: true,
|
|
1407
|
+
onSelect
|
|
1408
|
+
}, child.id))] }, item.id)),
|
|
1409
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1410
|
+
className: "dap-strip__new",
|
|
1411
|
+
onClick: onNewDiagram,
|
|
1412
|
+
title: t("action.newDiagram"),
|
|
1413
|
+
children: ["+ ", t("action.newDiagram")]
|
|
1414
|
+
})
|
|
1415
|
+
]
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* 一个图名 tab:只有文字,没有缩略图。
|
|
1420
|
+
*
|
|
1421
|
+
* 之前用 0.25 倍 iframe 做真预览,一条占 91px,把图片本身压下去;改成纯文字后
|
|
1422
|
+
* 整条 32px,状态用一个 5px 圆点表达,临时图挂一个小标签。
|
|
1423
|
+
*/
|
|
1424
|
+
function Thumb({ t, diagram, active, child = false, onSelect }) {
|
|
1425
|
+
const tone = diagram.status === "ready" ? "ok" : diagram.status === "failed" ? "err" : "warn";
|
|
1426
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1427
|
+
className: [
|
|
1428
|
+
"dap-tabitem",
|
|
1429
|
+
active ? "dap-tabitem--on" : "",
|
|
1430
|
+
child ? "dap-tabitem--child" : ""
|
|
1431
|
+
].filter((part) => part.length > 0).join(" "),
|
|
1432
|
+
role: "tab",
|
|
1433
|
+
"aria-selected": active,
|
|
1434
|
+
onClick: () => onSelect(diagram.id),
|
|
1435
|
+
title: `${diagram.title} · ${t(`status.${diagram.status}`)}`,
|
|
1436
|
+
children: [
|
|
1437
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dot, { tone }),
|
|
1438
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1439
|
+
className: "dap-tabitem__name",
|
|
1440
|
+
children: diagram.title
|
|
1441
|
+
}),
|
|
1442
|
+
diagram.persistence === "temporary" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1443
|
+
className: "dap-tabitem__tag",
|
|
1444
|
+
children: t("persistence.temporaryShort")
|
|
1445
|
+
}) : null
|
|
1446
|
+
]
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
function messageOf(err) {
|
|
1450
|
+
if (err instanceof ApiError) return err.message;
|
|
1451
|
+
return err instanceof Error ? err.message : String(err);
|
|
1452
|
+
}
|
|
1453
|
+
/** 运行中当前步骤;没有 todo 时返回 null。 */
|
|
1454
|
+
function activeStep(project) {
|
|
1455
|
+
return (project.lastRun?.todos.find((item) => item.status === "in_progress"))?.content ?? null;
|
|
1456
|
+
}
|
|
1457
|
+
/** 顶部运行进度条:只在有 agent 在跑时出现。 */
|
|
1458
|
+
function RunBar({ t, project }) {
|
|
1459
|
+
const run = project.lastRun;
|
|
1460
|
+
const running = isRunning(project);
|
|
1461
|
+
const qaRunning = project.qa.find((entry) => entry.status === "running");
|
|
1462
|
+
if (!running && qaRunning === void 0) return null;
|
|
1463
|
+
const todos = running ? run?.todos ?? [] : qaRunning?.todos ?? [];
|
|
1464
|
+
const current = todos.find((todo) => todo.status === "in_progress");
|
|
1465
|
+
const done = todos.filter((todo) => todo.status === "completed").length;
|
|
1466
|
+
const percent = todos.length === 0 ? 0 : Math.round(done / todos.length * 100);
|
|
1467
|
+
const usage = running ? run?.usage ?? null : qaRunning?.usage ?? null;
|
|
1468
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1469
|
+
className: "dap-runbar",
|
|
1470
|
+
children: [
|
|
1471
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1472
|
+
className: "dap-spinner",
|
|
1473
|
+
"aria-hidden": "true"
|
|
1474
|
+
}),
|
|
1475
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: t("runbar.running") }),
|
|
1476
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1477
|
+
className: "dap-runbar__step",
|
|
1478
|
+
children: [t("runbar.step", { step: current?.content ?? todos[0]?.content ?? t("runbar.unknown") }), todos.length > 0 ? `(${done}/${todos.length})` : ""]
|
|
1479
|
+
}),
|
|
1480
|
+
todos.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1481
|
+
className: "dap-runbar__bar",
|
|
1482
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", { style: { width: `${percent}%` } })
|
|
1483
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1484
|
+
className: "dap-runbar__pct",
|
|
1485
|
+
children: [percent, "%"]
|
|
1486
|
+
})] }) : null,
|
|
1487
|
+
usage !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1488
|
+
className: "dap-runbar__tok",
|
|
1489
|
+
children: t("runbar.tokens", { n: formatTokens(usageTotalOf(usage)) })
|
|
1490
|
+
}) : null
|
|
1491
|
+
]
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
/** todo 列表:✓ / spinner / ○。 */
|
|
1495
|
+
function TodoList({ t, todos }) {
|
|
1496
|
+
if (todos.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1497
|
+
className: "dap-hint",
|
|
1498
|
+
children: t("progress.none")
|
|
1499
|
+
});
|
|
1500
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1501
|
+
className: "dap-todos",
|
|
1502
|
+
children: todos.map((todo) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1503
|
+
className: todo.status === "completed" ? "dap-todo dap-todo--done" : todo.status === "in_progress" ? "dap-todo dap-todo--now" : "dap-todo",
|
|
1504
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1505
|
+
className: "dap-todo__mark",
|
|
1506
|
+
"aria-hidden": "true",
|
|
1507
|
+
children: todo.status === "completed" ? "✓" : todo.status === "in_progress" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "dap-spinner" }) : "○"
|
|
1508
|
+
}), todo.content]
|
|
1509
|
+
}, todo.content))
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
/** 用量块:本次 / 累计 tokens,配了单价才算钱。 */
|
|
1513
|
+
function UsageBlock({ t, project, pricing }) {
|
|
1514
|
+
const current = project.lastRun?.usage ?? null;
|
|
1515
|
+
const cost = estimateCost(current, pricing);
|
|
1516
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1517
|
+
className: "dap-usage",
|
|
1518
|
+
children: [
|
|
1519
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
1520
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usage.current") }),
|
|
1521
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: formatTokens(usageTotalOf(current)) }),
|
|
1522
|
+
cost !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("em", { children: t("usage.estimated", { cost: cost.toFixed(3) }) }) : null
|
|
1523
|
+
] }),
|
|
1524
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usage.total") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: formatTokens(project.usageTotal) })] }),
|
|
1525
|
+
current !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1526
|
+
className: "dap-usage__detail",
|
|
1527
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("usage.detail", {
|
|
1528
|
+
input: formatTokens(current.uncachedInput),
|
|
1529
|
+
cacheRead: formatTokens(current.cacheRead),
|
|
1530
|
+
output: formatTokens(current.output)
|
|
1531
|
+
}) })
|
|
1532
|
+
}) : null,
|
|
1533
|
+
pricing === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1534
|
+
className: "dap-hint",
|
|
1535
|
+
children: t("usage.estimateNote")
|
|
1536
|
+
}) : null
|
|
1537
|
+
]
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
// src/client/panel.tsx
|
|
1542
|
+
/** 三点连接的结构图小图标,用 currentColor 跟随侧栏配色。 */
|
|
1543
|
+
function PanelIcon({ size = 16 }) {
|
|
1544
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1545
|
+
width: size,
|
|
1546
|
+
height: size,
|
|
1547
|
+
viewBox: "0 0 24 24",
|
|
1548
|
+
fill: "none",
|
|
1549
|
+
stroke: "currentColor",
|
|
1550
|
+
strokeWidth: 1.6,
|
|
1551
|
+
strokeLinecap: "round",
|
|
1552
|
+
strokeLinejoin: "round",
|
|
1553
|
+
style: { display: "block" },
|
|
1554
|
+
"aria-hidden": "true",
|
|
1555
|
+
focusable: "false",
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1558
|
+
d: "M3.6 6.3V5.2c0-.9.7-1.6 1.6-1.6h3",
|
|
1559
|
+
opacity: "0.55"
|
|
1560
|
+
}),
|
|
1561
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1562
|
+
d: "M20.4 17.7v1.1c0 .9-.7 1.6-1.6 1.6h-3",
|
|
1563
|
+
opacity: "0.55"
|
|
1564
|
+
}),
|
|
1565
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1566
|
+
cx: "7.6",
|
|
1567
|
+
cy: "9.4",
|
|
1568
|
+
r: "2.1"
|
|
1569
|
+
}),
|
|
1570
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1571
|
+
cx: "16.4",
|
|
1572
|
+
cy: "7.1",
|
|
1573
|
+
r: "1.7"
|
|
1574
|
+
}),
|
|
1575
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
1576
|
+
cx: "12.6",
|
|
1577
|
+
cy: "16.6",
|
|
1578
|
+
r: "1.7"
|
|
1579
|
+
}),
|
|
1580
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.5 8.4l5.1-1" }),
|
|
1581
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8.6 11.2l2.9 3.6" }),
|
|
1582
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1583
|
+
d: "M15.9 8.8l-2.2 5.9",
|
|
1584
|
+
opacity: "0.7"
|
|
1585
|
+
})
|
|
1586
|
+
]
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// src/client/locale.ts
|
|
1591
|
+
/**
|
|
1592
|
+
* 页面文案。中英双语,键集合必须完全一致(`tests/contract/locale.test.ts` 守着)。
|
|
1593
|
+
*
|
|
1594
|
+
* 不放在 `locale/*.json` 里:那两个文件是**包级元数据**(宿主用来显示插件名与描述),
|
|
1595
|
+
* 页面内的即时文案走 `ctx.locale.register(ns, DICT)`。
|
|
1596
|
+
*/
|
|
1597
|
+
const LOCALE_NS = "dsh-archify-projects";
|
|
1598
|
+
/** 中文(默认)。 */
|
|
1599
|
+
const zh = {
|
|
1600
|
+
"panel.title": "架构建模",
|
|
1601
|
+
"panel.desc": "代码库概念与图册",
|
|
1602
|
+
"page.title": "架构建模",
|
|
1603
|
+
"page.subtitle": "代码库 → 概念 → 图册 · 按分支维护,工作区改动一起纳入",
|
|
1604
|
+
"stat.repos": "在册仓库",
|
|
1605
|
+
"stat.concepts": "已提取概念",
|
|
1606
|
+
"stat.diagrams": "图与套图",
|
|
1607
|
+
"stat.running": "正在生成",
|
|
1608
|
+
"tab.info": "图信息",
|
|
1609
|
+
"tab.qa": "提问",
|
|
1610
|
+
"action.add": "新增项目",
|
|
1611
|
+
"action.refresh": "刷新",
|
|
1612
|
+
"action.update": "更新图册",
|
|
1613
|
+
"action.updateAll": "全部更新",
|
|
1614
|
+
"action.check": "重探 Git",
|
|
1615
|
+
"action.openTab": "新窗口",
|
|
1616
|
+
"action.fullscreen": "全屏",
|
|
1617
|
+
"action.regenerate": "重画",
|
|
1618
|
+
"action.delete": "删除",
|
|
1619
|
+
"action.openSession": "查看会话",
|
|
1620
|
+
"action.cancel": "取消",
|
|
1621
|
+
"action.submit": "创建并分析",
|
|
1622
|
+
"action.close": "关闭",
|
|
1623
|
+
"action.back": "返回图册",
|
|
1624
|
+
"action.newDiagram": "新建图",
|
|
1625
|
+
"action.ask": "提问",
|
|
1626
|
+
"action.send": "发送",
|
|
1627
|
+
"action.merge": "补进图里",
|
|
1628
|
+
"action.child": "创建子图",
|
|
1629
|
+
"action.save": "保存",
|
|
1630
|
+
"empty.title": "还没有项目",
|
|
1631
|
+
"empty.body": "新增一个项目:填名称和本地代码库路径,插件会先提取概念,再生成默认两张图。",
|
|
1632
|
+
"empty.action": "新增第一个项目",
|
|
1633
|
+
"dialog.addTitle": "新增项目",
|
|
1634
|
+
"field.name": "项目名称",
|
|
1635
|
+
"field.namePlaceholder": "留空则用目录名",
|
|
1636
|
+
"field.path": "代码库路径",
|
|
1637
|
+
"field.pathPlaceholder": "/home/me/projects/your-repo",
|
|
1638
|
+
"field.pathRequired": "请填写代码库路径",
|
|
1639
|
+
"dialog.newDiagram": "新建图",
|
|
1640
|
+
"dialog.newDiagramSub": "用自然语言描述要什么图,agent 读代码后按这个 prompt 画。",
|
|
1641
|
+
"field.title": "标题",
|
|
1642
|
+
"field.titlePlaceholder": "例如:一次更新的调用链",
|
|
1643
|
+
"field.prompt": "出图要求",
|
|
1644
|
+
"field.promptPlaceholder": "例如:画出一次「更新」从按钮到产物回收的完整调用链,标出每一步失败会怎样。",
|
|
1645
|
+
"field.persistence": "时效",
|
|
1646
|
+
"field.parent": "归属",
|
|
1647
|
+
"field.concepts": "概念范围",
|
|
1648
|
+
"field.branch": "分支",
|
|
1649
|
+
"field.status": "状态",
|
|
1650
|
+
"field.generatedAt": "生成时间",
|
|
1651
|
+
"field.owner": "所属",
|
|
1652
|
+
"field.tree": "工作区",
|
|
1653
|
+
"field.renderer": "图型",
|
|
1654
|
+
"field.pathScope": "目录范围",
|
|
1655
|
+
"field.rendererHint": "点一下看它展示什么、能让你掌握什么",
|
|
1656
|
+
"renderer.auto": "不限",
|
|
1657
|
+
"renderer.autoHint": "不选也行:Archify 会按你的 prompt 自行判断图型;选了只是让 agent 少猜一步,图会更稳。",
|
|
1658
|
+
"renderer.fit": "适合看",
|
|
1659
|
+
"renderer.show": "会展示",
|
|
1660
|
+
"renderer.grasp": "能掌握",
|
|
1661
|
+
"renderer.architecture": "架构图",
|
|
1662
|
+
"renderer.architecture.fit": "系统由什么组成、谁依赖谁",
|
|
1663
|
+
"renderer.architecture.show": "组件与服务、进程/网络/信任边界、外部依赖",
|
|
1664
|
+
"renderer.architecture.grasp": "分层与职责、关键依赖、边界外的风险",
|
|
1665
|
+
"renderer.workflow": "流程图",
|
|
1666
|
+
"renderer.workflow.fit": "一个流程怎么走、有哪些判断与审批",
|
|
1667
|
+
"renderer.workflow.show": "步骤、分支条件、失败与回退",
|
|
1668
|
+
"renderer.workflow.grasp": "主流程与异常路径、谁在什么条件下做什么",
|
|
1669
|
+
"renderer.sequence": "时序图",
|
|
1670
|
+
"renderer.sequence.fit": "一次请求在模块之间怎么往返",
|
|
1671
|
+
"renderer.sequence.show": "参与者、消息顺序、返回与异步",
|
|
1672
|
+
"renderer.sequence.grasp": "调用链、时序依赖、失败重试点",
|
|
1673
|
+
"renderer.dataflow": "数据流",
|
|
1674
|
+
"renderer.dataflow.fit": "数据从哪来、经过谁、到哪去",
|
|
1675
|
+
"renderer.dataflow.show": "数据源、转换、存储、消费者",
|
|
1676
|
+
"renderer.dataflow.grasp": "数据血缘与口径、敏感数据流向",
|
|
1677
|
+
"renderer.lifecycle": "状态机",
|
|
1678
|
+
"renderer.lifecycle.fit": "一个对象有哪些状态、怎么流转",
|
|
1679
|
+
"renderer.lifecycle.show": "状态、转移条件、终态",
|
|
1680
|
+
"renderer.lifecycle.grasp": "状态机全貌、等待与重试、非法流转",
|
|
1681
|
+
"scope.conceptHint": "选中概念会限制取证范围:agent 只围绕这几个概念读代码,图更聚焦。不选则自行取舍。",
|
|
1682
|
+
"scope.pathHint": "只让 agent 在这些目录里取证;不选则扫全仓库。",
|
|
1683
|
+
"persistence.permanent": "永久 · 下次更新沿用",
|
|
1684
|
+
"persistence.temporary": "临时 · 仅这一次",
|
|
1685
|
+
"persistence.temporaryShort": "临时",
|
|
1686
|
+
"persistence.permanentHint": "存住 prompt,下次「更新图册」自动用同一 prompt 重画。",
|
|
1687
|
+
"persistence.temporaryHint": "只跑这一次,不占下次更新的时间;产物仍可查看。",
|
|
1688
|
+
"parent.none": "独立套图",
|
|
1689
|
+
"parent.current": "挂在当前图下",
|
|
1690
|
+
"git.noRepo": "非 Git 目录",
|
|
1691
|
+
"git.noRepoHint": "不做分支切换,直接基于当前目录分析",
|
|
1692
|
+
"git.branch": "分支",
|
|
1693
|
+
"git.dirty": "工作区有未提交改动",
|
|
1694
|
+
"git.clean": "工作区干净",
|
|
1695
|
+
"git.detached": "分离头指针",
|
|
1696
|
+
"git.checkedAt": "探测于 {time}",
|
|
1697
|
+
"git.behind": "落后 {n}",
|
|
1698
|
+
"git.ahead": "领先 {n}",
|
|
1699
|
+
"git.inSync": "与上游同步",
|
|
1700
|
+
"git.tree": "暂存 {staged} · 未暂存 {unstaged} · 未跟踪 {untracked}",
|
|
1701
|
+
"git.treeShort": "{staged} 暂存 · {unstaged} 未暂存",
|
|
1702
|
+
"status.idle": "未生成",
|
|
1703
|
+
"status.queued": "排队中",
|
|
1704
|
+
"status.running": "生成中",
|
|
1705
|
+
"status.ready": "已就绪",
|
|
1706
|
+
"status.failed": "失败",
|
|
1707
|
+
"status.stale": "工作区有变化",
|
|
1708
|
+
"status.none": "—",
|
|
1709
|
+
"runbar.running": "生成中",
|
|
1710
|
+
"runbar.step": "正在:{step}",
|
|
1711
|
+
"runbar.tokens": "本次 {n} tokens",
|
|
1712
|
+
"runbar.unknown": "正在准备…",
|
|
1713
|
+
"progress.title": "进度(agent 的 todo)",
|
|
1714
|
+
"progress.none": "agent 还没写 todo",
|
|
1715
|
+
"usage.title": "用量",
|
|
1716
|
+
"usage.current": "本次",
|
|
1717
|
+
"usage.total": "累计",
|
|
1718
|
+
"usage.detail": "输入 {input} · 缓存读 {cacheRead} · 输出 {output}",
|
|
1719
|
+
"usage.estimated": "≈ {cost}",
|
|
1720
|
+
"usage.estimateNote": "按配置单价估算,不是账单",
|
|
1721
|
+
"usage.tokens": "{n} tokens",
|
|
1722
|
+
"qa.running": "agent 正在读代码回答…",
|
|
1723
|
+
"qa.title": "提问",
|
|
1724
|
+
"qa.empty": "对这张图提问;agent 只读代码与这张图来回答。",
|
|
1725
|
+
"qa.placeholder": "例如:路由注册失败时插件会怎样?",
|
|
1726
|
+
"qa.answer": "agent",
|
|
1727
|
+
"qa.me": "我",
|
|
1728
|
+
"qa.applied": "已补进图里",
|
|
1729
|
+
"qa.working": "agent 正在读代码回答…",
|
|
1730
|
+
"qa.mergeHint": "「补进图里」会把这次回答并进这张图并重画;「创建子图」会挂一张新图。",
|
|
1731
|
+
"concept.title": "概念",
|
|
1732
|
+
"run.history": "运行记录",
|
|
1733
|
+
"run.none": "还没有运行记录",
|
|
1734
|
+
"run.kind.create": "首次生成",
|
|
1735
|
+
"run.kind.update": "更新",
|
|
1736
|
+
"run.kind.regenerate": "重生成",
|
|
1737
|
+
"run.status.running": "运行中",
|
|
1738
|
+
"run.status.succeeded": "成功",
|
|
1739
|
+
"run.status.failed": "失败",
|
|
1740
|
+
"meta.repoPath": "代码库",
|
|
1741
|
+
"meta.createdAt": "创建于 {time}",
|
|
1742
|
+
"meta.generatedAt": "生成于 {time}",
|
|
1743
|
+
"meta.branchLevel": "按分支维护 {branch}",
|
|
1744
|
+
"confirm.update": "更新会先快进到上游最新提交,然后用同一 prompt 重画所有永久图。继续?",
|
|
1745
|
+
"confirm.delete": "删除只移除台账和产物目录,不会动你的代码库。继续?",
|
|
1746
|
+
"confirm.updateOk": "更新",
|
|
1747
|
+
"error.generic": "出错了:{message}",
|
|
1748
|
+
"notice.dirty": "工作区有未提交改动,已跳过自动同步,本次基于当前内容分析。",
|
|
1749
|
+
"notice.noGit": "这个目录不是 Git 仓库,跳过分支切换。",
|
|
1750
|
+
"notice.running": "Agent 正在生成图谱,完成后会自动刷新。",
|
|
1751
|
+
"notice.merged": "已把回答并进图里,正在重画。",
|
|
1752
|
+
"notice.child": "已创建子图,正在生成。",
|
|
1753
|
+
"notice.temporary": "这是临时图:只跑这一次,下次更新不会重画。",
|
|
1754
|
+
"time.now": "刚刚",
|
|
1755
|
+
"time.minutes": "{n} 分钟前",
|
|
1756
|
+
"time.hours": "{n} 小时前",
|
|
1757
|
+
"time.days": "{n} 天前"
|
|
1758
|
+
};
|
|
1759
|
+
/** English. */
|
|
1760
|
+
const en = {
|
|
1761
|
+
"panel.title": "Archify",
|
|
1762
|
+
"panel.desc": "Concepts and diagram atlas",
|
|
1763
|
+
"page.title": "Architecture Studio",
|
|
1764
|
+
"page.subtitle": "Codebase → concepts → atlas · per branch, working tree included",
|
|
1765
|
+
"stat.repos": "Repositories",
|
|
1766
|
+
"stat.concepts": "Concepts",
|
|
1767
|
+
"stat.diagrams": "Diagrams & sets",
|
|
1768
|
+
"stat.running": "Generating",
|
|
1769
|
+
"tab.info": "Info",
|
|
1770
|
+
"tab.qa": "Ask",
|
|
1771
|
+
"action.add": "New project",
|
|
1772
|
+
"action.refresh": "Refresh",
|
|
1773
|
+
"action.update": "Update atlas",
|
|
1774
|
+
"action.updateAll": "Update all",
|
|
1775
|
+
"action.check": "Re-check Git",
|
|
1776
|
+
"action.openTab": "Open",
|
|
1777
|
+
"action.fullscreen": "Fullscreen",
|
|
1778
|
+
"action.regenerate": "Redraw",
|
|
1779
|
+
"action.delete": "Delete",
|
|
1780
|
+
"action.openSession": "Open session",
|
|
1781
|
+
"action.cancel": "Cancel",
|
|
1782
|
+
"action.submit": "Create and analyse",
|
|
1783
|
+
"action.close": "Close",
|
|
1784
|
+
"action.back": "Back to atlas",
|
|
1785
|
+
"action.newDiagram": "New diagram",
|
|
1786
|
+
"action.ask": "Ask",
|
|
1787
|
+
"action.send": "Send",
|
|
1788
|
+
"action.merge": "Merge into diagram",
|
|
1789
|
+
"action.child": "Create child diagram",
|
|
1790
|
+
"action.save": "Save",
|
|
1791
|
+
"empty.title": "No projects yet",
|
|
1792
|
+
"empty.body": "Add a project with a local repository path. Concepts are extracted first, then the two default diagrams are generated.",
|
|
1793
|
+
"empty.action": "Add your first project",
|
|
1794
|
+
"dialog.addTitle": "New project",
|
|
1795
|
+
"field.name": "Project name",
|
|
1796
|
+
"field.namePlaceholder": "Defaults to the folder name",
|
|
1797
|
+
"field.path": "Repository path",
|
|
1798
|
+
"field.pathPlaceholder": "/home/me/projects/your-repo",
|
|
1799
|
+
"field.pathRequired": "Repository path is required",
|
|
1800
|
+
"dialog.newDiagram": "New diagram",
|
|
1801
|
+
"dialog.newDiagramSub": "Describe the diagram you want. The agent reads the code and draws from this prompt.",
|
|
1802
|
+
"field.title": "Title",
|
|
1803
|
+
"field.titlePlaceholder": "e.g. Update call chain",
|
|
1804
|
+
"field.prompt": "Prompt",
|
|
1805
|
+
"field.promptPlaceholder": "e.g. Draw the full call chain of an update, from the button to artifact collection, including failure modes.",
|
|
1806
|
+
"field.persistence": "Lifetime",
|
|
1807
|
+
"field.parent": "Placement",
|
|
1808
|
+
"field.concepts": "Concept scope",
|
|
1809
|
+
"field.branch": "Branch",
|
|
1810
|
+
"field.status": "Status",
|
|
1811
|
+
"field.generatedAt": "Generated",
|
|
1812
|
+
"field.owner": "Owner",
|
|
1813
|
+
"field.tree": "Working tree",
|
|
1814
|
+
"field.renderer": "Diagram type",
|
|
1815
|
+
"field.pathScope": "Directories",
|
|
1816
|
+
"field.rendererHint": "Click one to see what it shows and what you get",
|
|
1817
|
+
"renderer.auto": "Any",
|
|
1818
|
+
"renderer.autoHint": "Optional: Archify picks a type from your prompt on its own. Choosing one just saves the agent a guess.",
|
|
1819
|
+
"renderer.fit": "Best for",
|
|
1820
|
+
"renderer.show": "Shows",
|
|
1821
|
+
"renderer.grasp": "You learn",
|
|
1822
|
+
"renderer.architecture": "Architecture",
|
|
1823
|
+
"renderer.architecture.fit": "What the system is made of and who depends on whom",
|
|
1824
|
+
"renderer.architecture.show": "Components and services, process/network/trust boundaries, external deps",
|
|
1825
|
+
"renderer.architecture.grasp": "Layers and responsibilities, key dependencies, outside-boundary risks",
|
|
1826
|
+
"renderer.workflow": "Workflow",
|
|
1827
|
+
"renderer.workflow.fit": "How a process runs, which branches and approvals exist",
|
|
1828
|
+
"renderer.workflow.show": "Steps, branch conditions, failures and fallbacks",
|
|
1829
|
+
"renderer.workflow.grasp": "Main and exception paths, who does what under which condition",
|
|
1830
|
+
"renderer.sequence": "Sequence",
|
|
1831
|
+
"renderer.sequence.fit": "How one request round-trips between modules",
|
|
1832
|
+
"renderer.sequence.show": "Participants, message order, returns and async",
|
|
1833
|
+
"renderer.sequence.grasp": "Call chains, ordering dependencies, retry points",
|
|
1834
|
+
"renderer.dataflow": "Dataflow",
|
|
1835
|
+
"renderer.dataflow.fit": "Where data comes from, passes through, and ends up",
|
|
1836
|
+
"renderer.dataflow.show": "Sources, transforms, storage, consumers",
|
|
1837
|
+
"renderer.dataflow.grasp": "Lineage and definitions, sensitive-data movement",
|
|
1838
|
+
"renderer.lifecycle": "Lifecycle",
|
|
1839
|
+
"renderer.lifecycle.fit": "Which states an object has and how it transitions",
|
|
1840
|
+
"renderer.lifecycle.show": "States, transition conditions, terminal states",
|
|
1841
|
+
"renderer.lifecycle.grasp": "The state machine, waits and retries, illegal transitions",
|
|
1842
|
+
"scope.conceptHint": "Selected concepts narrow the evidence: the agent reads only around them, so the diagram stays focused. Optional.",
|
|
1843
|
+
"scope.pathHint": "Only let the agent read these directories; leave empty to scan the whole repository.",
|
|
1844
|
+
"persistence.permanent": "Permanent · reuse next update",
|
|
1845
|
+
"persistence.temporary": "Temporary · this run only",
|
|
1846
|
+
"persistence.temporaryShort": "TEMP",
|
|
1847
|
+
"persistence.permanentHint": "The prompt is kept; the next atlas update redraws it with the same prompt.",
|
|
1848
|
+
"persistence.temporaryHint": "Runs once, skipped on future updates; artifacts stay available.",
|
|
1849
|
+
"parent.none": "Own set",
|
|
1850
|
+
"parent.current": "Under selected diagram",
|
|
1851
|
+
"git.noRepo": "Not a Git repository",
|
|
1852
|
+
"git.noRepoHint": "No branch switching; analysis runs on the current directory",
|
|
1853
|
+
"git.branch": "Branch",
|
|
1854
|
+
"git.dirty": "Uncommitted changes",
|
|
1855
|
+
"git.clean": "Clean",
|
|
1856
|
+
"git.detached": "Detached HEAD",
|
|
1857
|
+
"git.checkedAt": "Checked {time}",
|
|
1858
|
+
"git.behind": "{n} behind",
|
|
1859
|
+
"git.ahead": "{n} ahead",
|
|
1860
|
+
"git.inSync": "Up to date",
|
|
1861
|
+
"git.tree": "{staged} staged · {unstaged} unstaged · {untracked} untracked",
|
|
1862
|
+
"git.treeShort": "{staged} staged · {unstaged} unstaged",
|
|
1863
|
+
"status.idle": "Not generated",
|
|
1864
|
+
"status.queued": "Queued",
|
|
1865
|
+
"status.running": "Generating",
|
|
1866
|
+
"status.ready": "Ready",
|
|
1867
|
+
"status.failed": "Failed",
|
|
1868
|
+
"status.stale": "Working tree changed",
|
|
1869
|
+
"status.none": "—",
|
|
1870
|
+
"runbar.running": "Generating",
|
|
1871
|
+
"runbar.step": "Now: {step}",
|
|
1872
|
+
"runbar.tokens": "{n} tokens this run",
|
|
1873
|
+
"runbar.unknown": "Preparing…",
|
|
1874
|
+
"progress.title": "Progress (agent todos)",
|
|
1875
|
+
"progress.none": "The agent has not written todos yet",
|
|
1876
|
+
"usage.title": "Usage",
|
|
1877
|
+
"usage.current": "This run",
|
|
1878
|
+
"usage.total": "Total",
|
|
1879
|
+
"usage.detail": "{input} input · {cacheRead} cache read · {output} output",
|
|
1880
|
+
"usage.estimated": "≈ {cost}",
|
|
1881
|
+
"usage.estimateNote": "Estimated from configured unit prices, not a bill",
|
|
1882
|
+
"usage.tokens": "{n} tokens",
|
|
1883
|
+
"qa.running": "The agent is reading code…",
|
|
1884
|
+
"qa.title": "Ask",
|
|
1885
|
+
"qa.empty": "Ask about this diagram; the agent answers from the code and this diagram only.",
|
|
1886
|
+
"qa.placeholder": "e.g. What happens when route registration fails?",
|
|
1887
|
+
"qa.answer": "agent",
|
|
1888
|
+
"qa.me": "me",
|
|
1889
|
+
"qa.applied": "Merged into diagram",
|
|
1890
|
+
"qa.working": "The agent is reading code…",
|
|
1891
|
+
"qa.mergeHint": "Merge folds the answer into this diagram and redraws it; Create child attaches a new diagram.",
|
|
1892
|
+
"concept.title": "Concepts",
|
|
1893
|
+
"run.history": "Runs",
|
|
1894
|
+
"run.none": "No runs yet",
|
|
1895
|
+
"run.kind.create": "Initial",
|
|
1896
|
+
"run.kind.update": "Update",
|
|
1897
|
+
"run.kind.regenerate": "Regenerate",
|
|
1898
|
+
"run.status.running": "Running",
|
|
1899
|
+
"run.status.succeeded": "Succeeded",
|
|
1900
|
+
"run.status.failed": "Failed",
|
|
1901
|
+
"meta.repoPath": "Repository",
|
|
1902
|
+
"meta.createdAt": "Created {time}",
|
|
1903
|
+
"meta.generatedAt": "Generated {time}",
|
|
1904
|
+
"meta.branchLevel": "Maintained per branch {branch}",
|
|
1905
|
+
"confirm.update": "Update fast-forwards to the latest upstream commit, then redraws every permanent diagram with its own prompt. Continue?",
|
|
1906
|
+
"confirm.delete": "Deleting removes the ledger entry and artifact folder only; your repository is untouched. Continue?",
|
|
1907
|
+
"confirm.updateOk": "Update",
|
|
1908
|
+
"error.generic": "Error: {message}",
|
|
1909
|
+
"notice.dirty": "Working tree has uncommitted changes; automatic sync was skipped and this run uses the current content.",
|
|
1910
|
+
"notice.noGit": "This directory is not a Git repository; branch switching is skipped.",
|
|
1911
|
+
"notice.running": "The agent is generating diagrams. This refreshes automatically.",
|
|
1912
|
+
"notice.merged": "Answer merged into the diagram; redrawing.",
|
|
1913
|
+
"notice.child": "Child diagram created; generating.",
|
|
1914
|
+
"notice.temporary": "Temporary diagram: runs once and is skipped on future updates.",
|
|
1915
|
+
"time.now": "just now",
|
|
1916
|
+
"time.minutes": "{n} min ago",
|
|
1917
|
+
"time.hours": "{n} h ago",
|
|
1918
|
+
"time.days": "{n} d ago"
|
|
1919
|
+
};
|
|
1920
|
+
/** 注册给 `ctx.locale.register` 的字典。 */
|
|
1921
|
+
const DICT = {
|
|
1922
|
+
zh,
|
|
1923
|
+
en
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
// src/client/styles.ts
|
|
1927
|
+
/**
|
|
1928
|
+
* 页面样式。
|
|
1929
|
+
*
|
|
1930
|
+
* 两条硬规则:
|
|
1931
|
+
* 1. **只用 DSH alias 令牌**(`--dsw-alias-*` / `--dsw-radius-*`),不写死任何色值 ——
|
|
1932
|
+
* 宿主切深浅色时 alias 自动翻转,页面不需要第二条样式分支;
|
|
1933
|
+
* 2. 所有类名带 `dap-` 前缀,样式以 `<style data-plugin>` 注入并在卸载时摘掉,
|
|
1934
|
+
* 不污染宿主。
|
|
1935
|
+
*/
|
|
1936
|
+
const PAGE_CSS = `
|
|
1937
|
+
.dap-page {
|
|
1938
|
+
display: flex;
|
|
1939
|
+
flex-direction: column;
|
|
1940
|
+
height: 100%;
|
|
1941
|
+
min-height: 0;
|
|
1942
|
+
background: var(--dsw-alias-bg-base);
|
|
1943
|
+
color: var(--dsw-alias-label-primary);
|
|
1944
|
+
font-family: var(--dsw-font-family, inherit);
|
|
1945
|
+
font-size: 13px;
|
|
1946
|
+
line-height: 1.5;
|
|
1947
|
+
}
|
|
1948
|
+
.dap-scroll { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 26px; }
|
|
1949
|
+
/* 工作台整屏:三栏各自滚动,右栏再长也不撑高页面 */
|
|
1950
|
+
.dap-scroll--wb { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 12px; }
|
|
1951
|
+
|
|
1952
|
+
/* ---------------------------------------------------------------- 顶栏 */
|
|
1953
|
+
.dap-head {
|
|
1954
|
+
display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
|
|
1955
|
+
padding: 18px 22px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1); flex: none;
|
|
1956
|
+
}
|
|
1957
|
+
.dap-head__title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
|
|
1958
|
+
.dap-head__sub { margin: 3px 0 0; font-size: 12px; color: var(--dsw-alias-label-tertiary); }
|
|
1959
|
+
.dap-head__actions { display: flex; gap: 8px; flex: none; }
|
|
1960
|
+
|
|
1961
|
+
/* ---------------------------------------------------------------- 通用 */
|
|
1962
|
+
.dap-btn {
|
|
1963
|
+
display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px;
|
|
1964
|
+
border-radius: var(--dsw-radius-md); border: 1px solid var(--dsw-alias-border-l2);
|
|
1965
|
+
background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary);
|
|
1966
|
+
font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
1967
|
+
}
|
|
1968
|
+
.dap-btn:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
1969
|
+
.dap-btn:disabled { opacity: .45; cursor: not-allowed; }
|
|
1970
|
+
.dap-btn--primary { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-inverted); border-color: transparent; }
|
|
1971
|
+
.dap-btn--primary:hover { background: var(--dsw-alias-button-primary-hover); }
|
|
1972
|
+
.dap-btn--ghost { border-color: transparent; background: transparent; color: var(--dsw-alias-label-secondary); }
|
|
1973
|
+
.dap-btn--ghost:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
1974
|
+
.dap-btn--sm { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: var(--dsw-radius-md); }
|
|
1975
|
+
.dap-btn__icon { width: 13px; height: 13px; display: block; }
|
|
1976
|
+
|
|
1977
|
+
.dap-chip {
|
|
1978
|
+
display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
|
|
1979
|
+
border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1);
|
|
1980
|
+
background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-secondary);
|
|
1981
|
+
font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums;
|
|
1982
|
+
}
|
|
1983
|
+
.dap-chip--ok { color: var(--dsw-alias-state-success-primary); border-color: transparent; }
|
|
1984
|
+
.dap-chip--warn { color: var(--dsw-alias-state-warn-primary); border-color: transparent; }
|
|
1985
|
+
.dap-chip--accent { color: var(--dsw-alias-state-business-primary); border-color: transparent; }
|
|
1986
|
+
.dap-chip__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
|
|
1987
|
+
|
|
1988
|
+
.dap-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dsw-alias-state-success-primary); flex: none; }
|
|
1989
|
+
.dap-dot--warn { background: var(--dsw-alias-state-warn-primary); }
|
|
1990
|
+
.dap-dot--err { background: var(--dsw-alias-state-error-primary); }
|
|
1991
|
+
.dap-dot--run { background: var(--dsw-alias-state-warn-primary); animation: dap-pulse 1.4s ease-in-out infinite; }
|
|
1992
|
+
@keyframes dap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
|
|
1993
|
+
|
|
1994
|
+
/* ---------------------------------------------------------------- 总览 */
|
|
1995
|
+
.dap-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 14px; }
|
|
1996
|
+
.dap-stat { border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-1); padding: 11px 13px; }
|
|
1997
|
+
.dap-stat__k { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); }
|
|
1998
|
+
.dap-stat__v { margin-top: 3px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
|
|
1999
|
+
.dap-stat__v small { font-size: 11.5px; font-weight: 500; color: var(--dsw-alias-label-tertiary); margin-left: 6px; letter-spacing: 0; }
|
|
2000
|
+
|
|
2001
|
+
.dap-atlas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
|
|
2002
|
+
.dap-card {
|
|
2003
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-lg);
|
|
2004
|
+
background: var(--dsw-alias-bg-layer-1); padding: 14px; display: flex; flex-direction: column; gap: 10px;
|
|
2005
|
+
cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, box-shadow .15s;
|
|
2006
|
+
}
|
|
2007
|
+
.dap-card:hover { border-color: var(--dsw-alias-border-l3); box-shadow: var(--dsw-shadow-lv2); }
|
|
2008
|
+
.dap-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
|
|
2009
|
+
.dap-repo { display: flex; align-items: center; gap: 7px; min-width: 0; }
|
|
2010
|
+
.dap-repo__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2011
|
+
.dap-repo__path { font-size: 11px; color: var(--dsw-alias-label-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, monospace; }
|
|
2012
|
+
.dap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
|
|
2013
|
+
.dap-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
|
|
2014
|
+
.dap-thumb {
|
|
2015
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md);
|
|
2016
|
+
background: var(--dsw-alias-bg-layer-2); padding: 6px 8px; min-width: 0;
|
|
2017
|
+
}
|
|
2018
|
+
.dap-thumb--wide { grid-column: 1 / -1; }
|
|
2019
|
+
.dap-thumb__title { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
|
|
2020
|
+
.dap-thumb__title b { font-weight: 550; color: var(--dsw-alias-label-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2021
|
+
.dap-thumb__count { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); }
|
|
2022
|
+
.dap-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--dsw-alias-label-tertiary); }
|
|
2023
|
+
|
|
2024
|
+
/* ---------------------------------------------------------------- 工作台 */
|
|
2025
|
+
.dap-wb { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: stretch; flex: 1; min-height: 0; }
|
|
2026
|
+
.dap-panel { border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-lg); background: var(--dsw-alias-bg-layer-1); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
|
|
2027
|
+
.dap-panel__body { overflow: auto; flex: 1; min-height: 0; }
|
|
2028
|
+
.dap-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; border-bottom: 1px solid var(--dsw-alias-border-l1); font-size: 11.5px; color: var(--dsw-alias-label-tertiary); }
|
|
2029
|
+
.dap-panel__body { padding: 7px; }
|
|
2030
|
+
|
|
2031
|
+
.dap-strip {
|
|
2032
|
+
display: flex; gap: 2px; align-items: center; padding: 4px 8px;
|
|
2033
|
+
overflow-x: auto; border-bottom: 1px solid var(--dsw-alias-border-l1);
|
|
2034
|
+
background: var(--dsw-alias-bg-layer-1); flex: none;
|
|
2035
|
+
}
|
|
2036
|
+
.dap-strip__sep { flex: none; width: 1px; height: 16px; background: var(--dsw-alias-border-l1); margin: 0 4px; }
|
|
2037
|
+
.dap-tabitem {
|
|
2038
|
+
display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 220px;
|
|
2039
|
+
height: 26px; padding: 0 9px; border-radius: var(--dsw-radius-md);
|
|
2040
|
+
border: 1px solid transparent; background: transparent;
|
|
2041
|
+
color: var(--dsw-alias-label-secondary); font-size: 12px; cursor: pointer; white-space: nowrap;
|
|
2042
|
+
}
|
|
2043
|
+
.dap-tabitem:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
2044
|
+
.dap-tabitem--on {
|
|
2045
|
+
background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary);
|
|
2046
|
+
font-weight: 550; border-color: var(--dsw-alias-border-l1);
|
|
2047
|
+
}
|
|
2048
|
+
.dap-tabitem--child { margin-left: 10px; }
|
|
2049
|
+
.dap-tabitem--child::before { content: "└"; color: var(--dsw-alias-label-tertiary); font-size: 10px; }
|
|
2050
|
+
.dap-tabitem__name { overflow: hidden; text-overflow: ellipsis; }
|
|
2051
|
+
.dap-tabitem__tag {
|
|
2052
|
+
font-size: 9.5px; padding: 0 4px; border-radius: 4px;
|
|
2053
|
+
background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-tertiary); font-weight: 400;
|
|
2054
|
+
}
|
|
2055
|
+
.dap-strip__new {
|
|
2056
|
+
flex: none; margin-left: auto; height: 26px; padding: 0 9px; border-radius: var(--dsw-radius-md);
|
|
2057
|
+
border: 1px dashed var(--dsw-alias-border-l2); background: transparent;
|
|
2058
|
+
color: var(--dsw-alias-label-tertiary); font-size: 11.5px; cursor: pointer; white-space: nowrap;
|
|
2059
|
+
}
|
|
2060
|
+
.dap-strip__new:hover { color: var(--dsw-alias-label-primary); border-color: var(--dsw-alias-border-l3); }
|
|
2061
|
+
|
|
2062
|
+
.dap-viewer { display: flex; flex-direction: column; min-width: 0; }
|
|
2063
|
+
.dap-viewer__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 11px; border-bottom: 1px solid var(--dsw-alias-border-l1); }
|
|
2064
|
+
.dap-viewer__title { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; min-width: 0; }
|
|
2065
|
+
.dap-viewer__title span { color: var(--dsw-alias-label-tertiary); font-weight: 400; font-size: 11.5px; }
|
|
2066
|
+
.dap-viewer__tools { display: flex; gap: 2px; }
|
|
2067
|
+
.dap-stage { background: var(--dsw-alias-bg-layer-2); padding: 11px; flex: 1; min-height: 0; overflow: auto; }
|
|
2068
|
+
.dap-frame { background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md); overflow: hidden; }
|
|
2069
|
+
.dap-frame__cap { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; font-size: 11px; color: var(--dsw-alias-label-tertiary); border-bottom: 1px solid var(--dsw-alias-border-l1); }
|
|
2070
|
+
.dap-iframe { display: block; width: 100%; height: clamp(420px, 56vh, 720px); border: 0; background: var(--dsw-alias-bg-base); }
|
|
2071
|
+
.dap-insets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
|
|
2072
|
+
.dap-inset {
|
|
2073
|
+
display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--dsw-radius-md);
|
|
2074
|
+
border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); cursor: pointer;
|
|
2075
|
+
font-size: 11px; color: var(--dsw-alias-label-secondary); text-align: left; min-width: 0;
|
|
2076
|
+
}
|
|
2077
|
+
.dap-inset:hover { border-color: var(--dsw-alias-border-l3); }
|
|
2078
|
+
.dap-inset--on { border-color: var(--dsw-alias-border-l3); box-shadow: 0 0 0 1px var(--dsw-alias-border-l3) inset; color: var(--dsw-alias-label-primary); }
|
|
2079
|
+
.dap-inset__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2080
|
+
|
|
2081
|
+
.dap-tabs { display: flex; gap: 2px; padding: 5px; border-bottom: 1px solid var(--dsw-alias-border-l1); }
|
|
2082
|
+
.dap-tab { height: 26px; padding: 0 10px; border-radius: var(--dsw-radius-md); font-size: 12px; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
2083
|
+
.dap-tab--on { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); font-weight: 550; }
|
|
2084
|
+
.dap-insp { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow: auto; }
|
|
2085
|
+
.dap-field { display: flex; flex-direction: column; gap: 4px; }
|
|
2086
|
+
.dap-field__label { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); letter-spacing: .02em; }
|
|
2087
|
+
.dap-box {
|
|
2088
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md);
|
|
2089
|
+
background: var(--dsw-alias-bg-layer-2); padding: 7px 9px; font-size: 12px; line-height: 1.6;
|
|
2090
|
+
white-space: pre-wrap; word-break: break-word;
|
|
2091
|
+
}
|
|
2092
|
+
.dap-box__meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--dsw-alias-label-tertiary); }
|
|
2093
|
+
|
|
2094
|
+
.dap-qa { display: flex; flex-direction: column; gap: 8px; }
|
|
2095
|
+
.dap-msg { display: flex; flex-direction: column; gap: 3px; }
|
|
2096
|
+
.dap-msg__who { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); }
|
|
2097
|
+
.dap-msg__bubble {
|
|
2098
|
+
border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2);
|
|
2099
|
+
border-radius: var(--dsw-radius-md); padding: 7px 9px; font-size: 12px; line-height: 1.55;
|
|
2100
|
+
white-space: pre-wrap; word-break: break-word;
|
|
2101
|
+
}
|
|
2102
|
+
.dap-msg--me .dap-msg__bubble { background: var(--dsw-alias-bg-layer-1); }
|
|
2103
|
+
.dap-msg__acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
|
|
2104
|
+
.dap-ask { display: flex; gap: 6px; align-items: flex-end; padding: 9px 10px; border-top: 1px solid var(--dsw-alias-border-l1); position: sticky; bottom: 0; background: var(--dsw-alias-bg-layer-1); z-index: 2; }
|
|
2105
|
+
.dap-ask textarea {
|
|
2106
|
+
flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 7px 9px;
|
|
2107
|
+
border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md);
|
|
2108
|
+
background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary);
|
|
2109
|
+
font: inherit; font-size: 12px; outline: none;
|
|
2110
|
+
}
|
|
2111
|
+
.dap-ask textarea:focus { border-color: var(--dsw-alias-border-l3); }
|
|
2112
|
+
.dap-hint { font-size: 10.5px; color: var(--dsw-alias-label-tertiary); line-height: 1.5; }
|
|
2113
|
+
|
|
2114
|
+
.dap-runbar {
|
|
2115
|
+
display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 10px;
|
|
2116
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md);
|
|
2117
|
+
background: var(--dsw-alias-bg-layer-1); font-size: 11.5px; color: var(--dsw-alias-label-secondary);
|
|
2118
|
+
flex: none;
|
|
2119
|
+
}
|
|
2120
|
+
.dap-runbar b { color: var(--dsw-alias-label-primary); font-weight: 600; }
|
|
2121
|
+
.dap-runbar__step { color: var(--dsw-alias-label-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2122
|
+
.dap-runbar__bar { flex: 1; max-width: 240px; height: 4px; border-radius: 999px; background: var(--dsw-alias-bg-layer-2); overflow: hidden; }
|
|
2123
|
+
.dap-runbar__bar i { display: block; height: 100%; background: var(--dsw-alias-state-business-primary); border-radius: inherit; }
|
|
2124
|
+
.dap-runbar__pct { font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-tertiary); }
|
|
2125
|
+
.dap-runbar__tok { margin-left: auto; color: var(--dsw-alias-label-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
2126
|
+
.dap-spinner { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--dsw-alias-state-business-primary); border-right-color: transparent; animation: dap-spin 1s linear infinite; flex: none; display: inline-block; }
|
|
2127
|
+
@keyframes dap-spin { to { transform: rotate(360deg); } }
|
|
2128
|
+
|
|
2129
|
+
.dap-todos { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-2); padding: 6px 8px; }
|
|
2130
|
+
.dap-todo { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--dsw-alias-label-secondary); }
|
|
2131
|
+
.dap-todo__mark { width: 13px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--dsw-alias-state-success-primary); }
|
|
2132
|
+
.dap-todo--done { color: var(--dsw-alias-label-tertiary); }
|
|
2133
|
+
.dap-todo--now { color: var(--dsw-alias-label-primary); font-weight: 550; }
|
|
2134
|
+
.dap-todo--now .dap-todo__mark { color: var(--dsw-alias-state-business-primary); }
|
|
2135
|
+
|
|
2136
|
+
.dap-usage { border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-2); padding: 7px 9px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
|
|
2137
|
+
.dap-usage > div { display: flex; align-items: baseline; gap: 6px; }
|
|
2138
|
+
.dap-usage span { color: var(--dsw-alias-label-tertiary); }
|
|
2139
|
+
.dap-usage b { font-size: 13px; }
|
|
2140
|
+
.dap-usage em { font-style: normal; color: var(--dsw-alias-label-tertiary); font-size: 10.5px; }
|
|
2141
|
+
.dap-usage__detail { justify-content: space-between; font-size: 10.5px; }
|
|
2142
|
+
|
|
2143
|
+
/* ---------------------------------------------------------------- 对话框 */
|
|
2144
|
+
.dap-mask { position: fixed; inset: 0; background: var(--dsw-alias-bg-mask-1); display: grid; place-items: center; z-index: 40; }
|
|
2145
|
+
.dap-dialog {
|
|
2146
|
+
width: 540px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); overflow: auto;
|
|
2147
|
+
background: var(--dsw-alias-bg-layer-1); border: 1px solid var(--dsw-alias-border-l2);
|
|
2148
|
+
border-radius: var(--dsw-radius-lg); box-shadow: var(--dsw-shadow-lv2); padding: 16px;
|
|
2149
|
+
}
|
|
2150
|
+
.dap-dialog__title { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
|
|
2151
|
+
.dap-dialog__sub { font-size: 11.5px; color: var(--dsw-alias-label-tertiary); margin-bottom: 12px; }
|
|
2152
|
+
.dap-dialog__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; font-size: 12px; }
|
|
2153
|
+
.dap-dialog__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
|
|
2154
|
+
.dap-seg { display: inline-flex; background: var(--dsw-alias-bg-layer-2); border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md); padding: 2px; }
|
|
2155
|
+
.dap-seg__btn { height: 26px; padding: 0 9px; border-radius: var(--dsw-radius-md); font-size: 11.5px; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
2156
|
+
.dap-seg__btn--on { background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font-weight: 550; box-shadow: var(--dsw-shadow-lv2); }
|
|
2157
|
+
.dap-input, .dap-textarea {
|
|
2158
|
+
width: 100%; padding: 7px 9px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md);
|
|
2159
|
+
background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary);
|
|
2160
|
+
font: inherit; font-size: 12.5px; outline: none;
|
|
2161
|
+
}
|
|
2162
|
+
.dap-input:focus, .dap-textarea:focus { border-color: var(--dsw-alias-border-l3); }
|
|
2163
|
+
.dap-textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
|
|
2164
|
+
.dap-concepts { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
2165
|
+
.dap-concept {
|
|
2166
|
+
height: 20px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px;
|
|
2167
|
+
font-size: 11px; border: 1px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-secondary); cursor: pointer;
|
|
2168
|
+
}
|
|
2169
|
+
.dap-concept--on { border-color: transparent; background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-state-business-primary); }
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
.dap-dialog--wide { width: 680px; }
|
|
2173
|
+
.dap-typebar { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 8px; }
|
|
2174
|
+
.dap-type-tag {
|
|
2175
|
+
display: inline-flex; align-items: center; gap: 5px; height: 27px; padding: 0 9px;
|
|
2176
|
+
border-radius: 999px; border: 1px solid var(--dsw-alias-border-l2);
|
|
2177
|
+
background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary);
|
|
2178
|
+
font-size: 11.5px; cursor: pointer; white-space: nowrap;
|
|
2179
|
+
}
|
|
2180
|
+
.dap-type-tag:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
2181
|
+
.dap-type-tag--on { background: var(--dsw-alias-label-primary); color: var(--dsw-alias-bg-base); border-color: transparent; }
|
|
2182
|
+
.dap-type-tag__k { font-size: 9.5px; opacity: .65; font-family: ui-monospace, monospace; }
|
|
2183
|
+
.dap-type-detail {
|
|
2184
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-md);
|
|
2185
|
+
background: var(--dsw-alias-bg-layer-2); padding: 8px 10px; display: flex;
|
|
2186
|
+
flex-direction: column; gap: 5px; min-height: 82px;
|
|
2187
|
+
}
|
|
2188
|
+
.dap-type-detail__empty { font-size: 11.5px; color: var(--dsw-alias-label-secondary); line-height: 1.6; margin: auto 0; }
|
|
2189
|
+
.dap-type-detail__head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
|
|
2190
|
+
.dap-type-detail__head code { font: 10px/1 ui-monospace, monospace; color: var(--dsw-alias-label-tertiary); }
|
|
2191
|
+
.dap-type-detail__row { display: grid; grid-template-columns: 56px 1fr; gap: 8px; font-size: 11.5px; line-height: 1.55; }
|
|
2192
|
+
.dap-type-detail__row span { color: var(--dsw-alias-label-tertiary); }
|
|
2193
|
+
.dap-type-detail__row p { margin: 0; color: var(--dsw-alias-label-primary); }
|
|
2194
|
+
|
|
2195
|
+
/* ---------------------------------------------------------------- 空状态 / 提示 */
|
|
2196
|
+
.dap-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 44px 20px; text-align: center; color: var(--dsw-alias-label-secondary); }
|
|
2197
|
+
.dap-empty__title { font-size: 14px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
2198
|
+
.dap-empty__body { max-width: 460px; font-size: 12px; }
|
|
2199
|
+
.dap-notice { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 7px 10px; border-radius: var(--dsw-radius-md); font-size: 11.5px; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-secondary); }
|
|
2200
|
+
.dap-notice--error { border-color: var(--dsw-alias-state-error-primary); color: var(--dsw-alias-state-error-primary); }
|
|
2201
|
+
|
|
2202
|
+
@media (max-width: 1180px) {
|
|
2203
|
+
.dap-wb { grid-template-columns: minmax(0, 1fr); }
|
|
2204
|
+
.dap-wb > .dap-panel:last-child { grid-column: 1 / -1; max-height: 420px; }
|
|
2205
|
+
.dap-atlas { grid-template-columns: repeat(2, 1fr); }
|
|
2206
|
+
.dap-stats { grid-template-columns: repeat(2, 1fr); }
|
|
2207
|
+
}
|
|
2208
|
+
`;
|
|
2209
|
+
/** 把样式挂到 document;返回卸载函数(HMR / 插件停用时摘标签)。 */
|
|
2210
|
+
function installStyles() {
|
|
2211
|
+
const style = document.createElement("style");
|
|
2212
|
+
style.dataset.plugin = "dsh-archify-projects";
|
|
2213
|
+
style.textContent = PAGE_CSS;
|
|
2214
|
+
document.head.appendChild(style);
|
|
2215
|
+
return () => style.remove();
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
// src/client/entry.tsx
|
|
2219
|
+
/**
|
|
2220
|
+
* 客户端入口。
|
|
2221
|
+
*
|
|
2222
|
+
* 产物里的 `exports.apply` / `exports.inject` 就是 `window.__ModuleLoader__` 要的
|
|
2223
|
+
* Cordis 插件面;`load({ id, factory })` 的壳由 tsdown 的 banner/footer 生成
|
|
2224
|
+
* (见 tsdown.config.ts),这里只管导出。
|
|
2225
|
+
*
|
|
2226
|
+
* 两个槽:
|
|
2227
|
+
* ① `sidebar.panellist` —— 左侧顶栏的入口图标,`id` 就是面板 id;
|
|
2228
|
+
* ② `main` —— 点开后的整页,`key` 与 `id` 必须一模一样。
|
|
2229
|
+
*/
|
|
2230
|
+
/** 面板 id:侧栏入口与主面板共用的唯一标识。 */
|
|
2231
|
+
const PANEL_ID = "archify-projects";
|
|
2232
|
+
/** 需要客户端服务:插槽注册表 + 文案目录。 */
|
|
2233
|
+
const inject = ["slots", "locale"];
|
|
2234
|
+
/** 插件入口。 */
|
|
2235
|
+
function apply(ctx) {
|
|
2236
|
+
ctx.effect(() => ctx.locale.register(LOCALE_NS, DICT), "dsh-archify-projects: dictionaries");
|
|
2237
|
+
const t = ctx.locale.bind(LOCALE_NS);
|
|
2238
|
+
const Page = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StudioPage, { t });
|
|
2239
|
+
ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
|
|
2240
|
+
name: "sidebar.panellist",
|
|
2241
|
+
id: PANEL_ID,
|
|
2242
|
+
order: 16,
|
|
2243
|
+
locale: LOCALE_NS,
|
|
2244
|
+
label: () => t("panel.title")
|
|
2245
|
+
}, PanelIcon));
|
|
2246
|
+
ctx.slots.inject("main", () => ctx.slots.register({
|
|
2247
|
+
name: "main",
|
|
2248
|
+
key: PANEL_ID,
|
|
2249
|
+
locale: LOCALE_NS
|
|
2250
|
+
}, Page));
|
|
2251
|
+
ctx.effect(installStyles, "dsh-archify-projects: styles");
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
exports.PANEL_ID = PANEL_ID;
|
|
2255
|
+
exports.apply = apply;
|
|
2256
|
+
exports.inject = inject;
|
|
2257
|
+
return module.exports;
|
|
2258
|
+
}
|
|
2259
|
+
});
|
|
2260
|
+
|
|
2261
|
+
//# sourceMappingURL=client.js.map
|