@oxmumu3/dsh-agent-twin 0.6.1 → 0.6.3

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 CHANGED
@@ -1,6 +1,6 @@
1
- # AI 分身工作台 · `@oxmumu3/dsh-agent-twin` (v0.6.1)
1
+ # AI 分身工作台 · `@oxmumu3/dsh-agent-twin` (v0.6.3)
2
2
 
3
- 在 DeepSeek Harness (`0.2.2-rc.5` / `0.2.3-alpha.2`) 内把你的本地专业工作区发布为**满血隔离 AI 分身**:**1 个满血 DSH 只读内核 + 按人与目录物理裁剪工作区(薄 Harness 边界)+ 0.2.3 官方飞书/企微连接器与真个人微信 iLink + 对话流原位与手机远程拍板 + 内置 MTN 语义知识图谱**。
3
+ 在 DeepSeek Harness (`0.2.2-rc.5` / `0.2.3-alpha.2`) 内把你的本地专业工作区发布为**满血隔离 AI 分身**:**1 个满血 DSH 只读内核 + 按人与目录物理裁剪工作区(薄 Harness 边界)+ `/try` 公开扫码真体验大厅 + 0.2.3 官方飞书/企微连接器与真个人微信 iLink + 对话流与手机远程拍板 + 内置语义知识图谱**。
4
4
 
5
5
  > 兼容 DeepSeek Harness Desktop / Web **0.2.2-rc.2 ~ 0.2.3-alpha.2**(Node.js 22+),不内置任何付费墙或商业化限制,所有通道凭据仅加密保存在本机 `0600` 凭据库 `$DSH_HOME/agent-twin/secrets.json`。
6
6
 
@@ -15,7 +15,12 @@ https://github.com/oxmumu3/ai-twin-starter
15
15
 
16
16
  ---
17
17
 
18
- ## v0.6.1 核心架构升级
18
+ ## v0.6.3 核心架构升级
19
+
20
+ ### 0. `/try` 公开扫码真体验大厅(Fail-Closed 隔离 + 匿名会话分流)
21
+ - **同一张永久二维码,每人独立隔离会话**:开启 `04 公开扫码真体验大厅(/try)` 并配合公网隧道域名(如 Cloudflare Named Tunnel `https://twin.finvo.ai/try`)后,每位扫码访客通过 `HttpOnly; SameSite=Lax` Cookie (`dsh_twin_vid`) 分配独立对话目录与独立 DSH `--session-id`,多人同时体验互不串台。
22
+ - **Fail-Closed 安全默认 + 三层防刷护栏**:未显式勾选 `capIds` 时默认不挂载任何目录、绝不继承私人项目名称或未定边界全局图谱;同时内置单访客每日轮次上限(默认 5 轮)、大厅全局每日总上限(默认 200 轮)与按 IP 滑动窗口防刷限流。
23
+ - **即点即问 + 一键部署引流**:大厅页自带 3 个可点击试问按钮、SSE 实时核查步骤流与 `#编号` 红线拦截演示,并在访客达到体验上限或想自建时给出完整 30 秒创造模式安装指令。
19
24
 
20
25
  ### 1. 满血 DSH 原生内核 × 目录级物理裁剪隔离 × 流式实时进度
21
26
  - **不再用伪关键词切片糊弄同事**:当运行环境具备 DSH 凭据时,来访者提问直接在 `$DSH_HOME/agent-twin/dsh-runner-home` 隔离实例下唤醒真实只读 DSH Agent(`--profile headless --permission-mode read-only --approval-policy never`),保留每名访客独立的 `--session-id` 连续记忆,实打实使用 `read` / `grep` / `glob` / 只读计算核对 CSV、口径文档与脚本后再回答。
@@ -29,14 +34,14 @@ https://github.com/oxmumu3/ai-twin-starter
29
34
  - **个人微信(真实 iLink 协议)**:接入 `weixin-ilink` 真实扫码二维码生成(SVG)、状态轮询、长轮询入站与 `-2` 异常自动重恢复,零公众号认证门槛。
30
35
  - **免装试用网页 & Slack Socket Mode**:按人签发独立沙箱网页链接,无须安装任何客户端即可试跑验证;所有已启用通道在插件重启后自动重连。
31
36
 
32
- ### 3. DSH 原生度拉满 + 内置 MTN / SKA 语义图谱
37
+ ### 3. DSH 原生度拉满 + 内置语义知识图谱
33
38
  - 收敛冗长单一工具为四枚职责清晰的原子工具:
34
39
  - `twin_status`:查看值班状态、切换 `shadow / live / off`、刷新官方连接器探测或本地只读自测;
35
40
  - `twin_publish_workspace`:从本地目录提炼能力包并可选一键挂载官方飞书;
36
41
  - `twin_grant_access`:为指定同事或合作方开通网页/微信/飞书/企微/Slack 隔离授权;
37
42
  - `twin_inbox`:查看待拍板草稿与红线拦截,并直接在主对话内批准或忽略。
38
43
  - 接入 **`tool.call.toolview` (`@deepseek-ai/dsh-client-ui-tool`)**:在主对话里直接编辑草稿文本、点击「批准发出」「发出并记为规矩」「忽略」或切换值班模式,无需来回跳转左侧面板。
39
- - 内置 **`mtn-provider` 语义图谱提供器 + `ctx.get('agentTwin')`**:开箱即自动读取项目内 `mtn/*.json` / `ska/*.json` / `*.mtn.json` 与工作台自定义节点(按 `allowedModes` 过滤并做 1 跳公式/异常/边界联想),同时保持 **0.2.2-rc.5 + 0.2.3-alpha.2 单包双兼容**。
44
+ - 内置 **`graph-provider` 语义图谱提供器 + `ctx.get('agentTwin')`**:开箱即自动读取项目内 `graph/*.json` / `knowledge/*.json` / `*.graph.json` 与工作台自定义节点(按 `allowedModes` 过滤并做 1 跳公式/异常/边界联想),同时保持 **0.2.2-rc.5 + 0.2.3-alpha.2 单包双兼容**。
40
45
 
41
46
  ---
42
47
 
@@ -46,7 +51,7 @@ https://github.com/oxmumu3/ai-twin-starter
46
51
  - `docs/attribution-and-roi-handbook.md`:D7 净回本 ROI 公式、自然量剔除规则与 Q1 未定稿返点边界;
47
52
  - `docs/anomaly-playbook.md`:退款率/苹果延迟入账排查步骤;
48
53
  - `data/channel_weekly_metrics.csv` + `scripts/calc_roi_summary.py`:4 渠道 3 周 12 行投放数据;
49
- - `mtn/growth-ska-graph.json`:增长与 BI 语义图谱示范(串联指标公式、W03 延迟事件与 Q1 返点权限边界);
54
+ - `graph/growth-semantic-graph.json`:增长与 BI 语义知识图谱示范(串联指标公式、W03 延迟事件与 Q1 返点权限边界);
50
55
  - 刻意混入 `.env.production`(假数仓私钥哨兵)与 `scripts/export_raw_user_phones.sql`(假写库/导出手机号 SQL),供端到端验收分身隔离边界。
51
56
 
52
57
  ---
package/client.js CHANGED
@@ -3586,6 +3586,108 @@ dialog.tw-dlg .official-conn-status {
3586
3586
  color: var(--accent);
3587
3587
  font-weight: 500;
3588
3588
  }
3589
+
3590
+ .tw-root .public-lobby-grid {
3591
+ display: grid;
3592
+ grid-template-columns: minmax(0, 1fr) 12rem;
3593
+ gap: 1.125rem;
3594
+ align-items: start;
3595
+ }
3596
+
3597
+ .tw-root .public-lobby-form {
3598
+ display: flex;
3599
+ flex-direction: column;
3600
+ gap: 0.75rem;
3601
+ min-width: 0;
3602
+ }
3603
+
3604
+ .tw-root .public-lobby-row {
3605
+ display: grid;
3606
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
3607
+ gap: 0.75rem;
3608
+ }
3609
+
3610
+ .tw-root .public-lobby-field {
3611
+ display: flex;
3612
+ flex-direction: column;
3613
+ gap: 0.3125rem;
3614
+ min-width: 0;
3615
+ }
3616
+
3617
+ .tw-root .public-lobby-label {
3618
+ font-size: 0.78125rem;
3619
+ font-weight: 600;
3620
+ color: var(--text-secondary);
3621
+ }
3622
+
3623
+ .tw-root .public-lobby-caps {
3624
+ display: flex;
3625
+ flex-wrap: wrap;
3626
+ gap: 0.4375rem;
3627
+ }
3628
+
3629
+ .tw-root .public-cap-check {
3630
+ display: inline-flex;
3631
+ align-items: center;
3632
+ gap: 0.4375rem;
3633
+ padding: 0.375rem 0.625rem;
3634
+ border-radius: var(--radius-sm);
3635
+ border: 1px solid var(--line-strong);
3636
+ background: var(--surface-subtle);
3637
+ font-size: 0.8125rem;
3638
+ color: var(--text);
3639
+ cursor: pointer;
3640
+ }
3641
+
3642
+ .tw-root .public-cap-check.is-selected {
3643
+ background: var(--accent-soft);
3644
+ border-color: var(--accent-line);
3645
+ color: var(--accent);
3646
+ font-weight: 600;
3647
+ }
3648
+
3649
+ .tw-root .public-cap-proj {
3650
+ font-size: 0.75rem;
3651
+ color: var(--text-muted);
3652
+ font-weight: 400;
3653
+ }
3654
+
3655
+ .tw-root .public-lobby-qr-col {
3656
+ display: flex;
3657
+ flex-direction: column;
3658
+ align-items: center;
3659
+ gap: 0.5625rem;
3660
+ padding: 0.875rem;
3661
+ border-radius: var(--radius-md);
3662
+ background: var(--surface-subtle);
3663
+ border: 1px solid var(--line);
3664
+ }
3665
+
3666
+ .tw-root .public-lobby-qr-box {
3667
+ width: 9.5rem;
3668
+ height: 9.5rem;
3669
+ padding: 0.4375rem;
3670
+ border-radius: var(--radius-sm);
3671
+ background: #ffffff;
3672
+ border: 1px solid var(--line);
3673
+ display: flex;
3674
+ align-items: center;
3675
+ justify-content: center;
3676
+ }
3677
+
3678
+ .tw-root .public-lobby-qr-box img,
3679
+ .tw-root .public-lobby-qr-box svg {
3680
+ width: 100%;
3681
+ height: 100%;
3682
+ display: block;
3683
+ }
3684
+
3685
+ @container tw (max-width: 44rem) {
3686
+ .tw-root .public-lobby-grid,
3687
+ .tw-root .public-lobby-row {
3688
+ grid-template-columns: minmax(0, 1fr);
3689
+ }
3690
+ }
3589
3691
  `;
3590
3692
  function ensureTwinStyles() {
3591
3693
  if (typeof document === "undefined") return;
@@ -7517,14 +7619,27 @@ function CapsScene({
7517
7619
  const [editRuleText, setEditRuleText] = (0, import_react3.useState)("");
7518
7620
  const [editingCapScopeId, setEditingCapScopeId] = (0, import_react3.useState)("");
7519
7621
  const [capScopeInput, setCapScopeInput] = (0, import_react3.useState)("");
7622
+ const pub = view?.publicLobby || {};
7623
+ const [pubBaseUrl, setPubBaseUrl] = (0, import_react3.useState)(pub.publicBaseUrl || "");
7624
+ const [pubTitle, setPubTitle] = (0, import_react3.useState)(pub.title || "");
7625
+ const [pubIntro, setPubIntro] = (0, import_react3.useState)(pub.intro || "");
7626
+ const [pubVisitorLimit, setPubVisitorLimit] = (0, import_react3.useState)(String(pub.visitorDailyLimit || 5));
7627
+ (0, import_react3.useEffect)(() => {
7628
+ setPubBaseUrl(pub.publicBaseUrl || "");
7629
+ setPubTitle(pub.title || "");
7630
+ setPubIntro(pub.intro || "");
7631
+ setPubVisitorLimit(String(pub.visitorDailyLimit || 5));
7632
+ }, [pub.publicBaseUrl, pub.title, pub.intro, pub.visitorDailyLimit]);
7520
7633
  const imeNew = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7521
7634
  const imeEdit = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7522
7635
  const imeScope = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7636
+ const imePub = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7523
7637
  const job = view?.extractionJob || null;
7524
7638
  const mounted = view?.mountedProjects || [];
7525
7639
  const capabilities = view?.capabilities || [];
7526
7640
  const rules = view?.rules || [];
7527
7641
  const channels = view?.channels || [];
7642
+ const selectedPubCapSet = new Set(Array.isArray(pub.capIds) ? pub.capIds : []);
7528
7643
  async function submitNewRule(ev) {
7529
7644
  ev.preventDefault();
7530
7645
  const val = newRuleText.trim();
@@ -7704,7 +7819,7 @@ function CapsScene({
7704
7819
  h3(
7705
7820
  "div",
7706
7821
  { className: "action-row" },
7707
- Number(view?.mtnNodeCount) > 0 && h3("span", { className: "status-pill status-pill--ok" }, `MTN \u8BED\u4E49\u56FE\u8C31 \xB7 ${view.mtnNodeCount} \u8282\u70B9`),
7822
+ Number(view?.graphNodeCount) > 0 && h3("span", { className: "status-pill status-pill--ok" }, `\u8BED\u4E49\u77E5\u8BC6\u56FE\u8C31 \xB7 ${view.graphNodeCount} \u8282\u70B9`),
7708
7823
  h3("span", { className: "section-meta" }, "\u6BCF\u9879\u80FD\u529B\u53EF\u5355\u72EC\u9650\u5B9A\u53EA\u8BFB\u76EE\u5F55\u8303\u56F4\uFF0C\u5199\u5E93\u4E0E\u6539\u4EE3\u7801\u5DF2\u7981\u6B62")
7709
7824
  )
7710
7825
  ),
@@ -8127,6 +8242,235 @@ function CapsScene({
8127
8242
  );
8128
8243
  })
8129
8244
  )
8245
+ ),
8246
+ // 04 Public Scan-to-Try Lobby (/try)
8247
+ h3(
8248
+ "div",
8249
+ { id: "publicLobbySection", className: "section-block" },
8250
+ h3(
8251
+ "div",
8252
+ { className: "section-head" },
8253
+ h3(
8254
+ "div",
8255
+ { className: "section-title-wrap" },
8256
+ h3("span", { className: "section-index" }, "04"),
8257
+ h3("h2", { className: "section-title" }, "\u516C\u5F00\u626B\u7801\u771F\u4F53\u9A8C\u5927\u5385\uFF08/try\uFF09")
8258
+ ),
8259
+ h3(
8260
+ "div",
8261
+ { className: "action-row" },
8262
+ h3("span", {
8263
+ className: pub.enabled && selectedPubCapSet.size > 0 ? "status-pill status-pill--ok" : "status-pill status-pill--muted"
8264
+ }, pub.enabled ? selectedPubCapSet.size > 0 ? `\u516C\u5F00\u63A5\u5F85\u4E2D \xB7 \u5DF2\u5F00\u653E ${selectedPubCapSet.size} \u9879` : "\u5DF2\u5F00\u542F\u4F46\u672A\u52FE\u9009\u516C\u5F00\u80FD\u529B" : "\u5DF2\u5173\u95ED"),
8265
+ h3("span", { className: "section-meta" }, `\u4ECA\u65E5\u5DF2\u63A5\u5F85 ${pub.todayGlobalUsed || 0} / ${pub.globalDailyLimit || 200} \u8F6E`)
8266
+ )
8267
+ ),
8268
+ h3(
8269
+ "div",
8270
+ { className: "card" },
8271
+ h3(
8272
+ "div",
8273
+ { className: "rule-row", style: { paddingTop: 0, alignItems: "center", justifyContent: "space-between" } },
8274
+ h3(
8275
+ "div",
8276
+ null,
8277
+ h3("div", { style: { fontWeight: 600, color: "var(--text)" } }, "\u542F\u7528\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u5927\u5385\uFF08\u533F\u540D Cookie \u4F1A\u8BDD\u9694\u79BB\uFF09"),
8278
+ h3(
8279
+ "div",
8280
+ { style: { fontSize: "0.78125rem", color: "var(--text-secondary)", marginTop: "0.125rem" } },
8281
+ "\u6BCF\u4F4D\u626B\u7801\u8BBF\u5BA2\u83B7\u72EC\u7ACB\u9694\u79BB\u4F1A\u8BDD\u4E0E\u6BCF\u65E5\u9650\u989D\uFF1BFail-Closed \u9ED8\u8BA4\u5168\u4E0D\u66B4\u9732\uFF0C\u672A\u52FE\u9009\u7684\u79C1\u6709\u9879\u76EE\u7269\u7406\u4E0D\u53EF\u89C1\u3002"
8282
+ )
8283
+ ),
8284
+ h3(
8285
+ "label",
8286
+ { className: "switch", "aria-label": "\u5207\u6362\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u5927\u5385" },
8287
+ h3("input", {
8288
+ type: "checkbox",
8289
+ id: "togglePublicLobby",
8290
+ checked: Boolean(pub.enabled),
8291
+ disabled: busy,
8292
+ onChange: async (e) => {
8293
+ const checked = e.target.checked;
8294
+ await onAction("configure_public_lobby", { enabled: checked });
8295
+ onToast?.(checked ? "\u5DF2\u5F00\u542F\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u5927\u5385\uFF08\u8BF7\u786E\u8BA4\u4E0B\u65B9\u5DF2\u52FE\u9009\u516C\u5F00\u53EA\u8BFB\u80FD\u529B\uFF09" : "\u5DF2\u5173\u95ED\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u5927\u5385");
8296
+ }
8297
+ }),
8298
+ h3("span", { className: "switch-track" })
8299
+ )
8300
+ ),
8301
+ h3(
8302
+ "div",
8303
+ { className: "public-lobby-grid", style: { marginTop: "0.875rem" } },
8304
+ h3(
8305
+ "div",
8306
+ { className: "public-lobby-form" },
8307
+ h3(
8308
+ "div",
8309
+ { className: "public-lobby-row" },
8310
+ h3(
8311
+ "div",
8312
+ { className: "public-lobby-field" },
8313
+ h3("label", { className: "public-lobby-label", htmlFor: "publicLobbyBaseUrl" }, "\u516C\u7F51\u96A7\u9053\u57DF\u540D\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u751F\u6210\u6C38\u4E45\u4E8C\u7EF4\u7801\uFF09"),
8314
+ h3("input", {
8315
+ id: "publicLobbyBaseUrl",
8316
+ className: "tw-input",
8317
+ type: "url",
8318
+ value: pubBaseUrl,
8319
+ onChange: (e) => setPubBaseUrl(e.target.value),
8320
+ onCompositionEnd: imePub.onCompositionEnd,
8321
+ onKeyDown: imePub.onKeyDown,
8322
+ placeholder: "\u4F8B\u5982\uFF1Ahttps://twin.finvo.ai",
8323
+ autoComplete: "off"
8324
+ })
8325
+ ),
8326
+ h3(
8327
+ "div",
8328
+ { className: "public-lobby-field" },
8329
+ h3("label", { className: "public-lobby-label", htmlFor: "publicLobbyVisitorLimit" }, "\u6BCF\u4EBA\u6BCF\u65E5\u4F53\u9A8C\u8F6E\u6B21\u4E0A\u9650"),
8330
+ h3("input", {
8331
+ id: "publicLobbyVisitorLimit",
8332
+ className: "tw-input",
8333
+ type: "number",
8334
+ min: 1,
8335
+ max: 100,
8336
+ value: pubVisitorLimit,
8337
+ onChange: (e) => setPubVisitorLimit(e.target.value)
8338
+ })
8339
+ )
8340
+ ),
8341
+ h3(
8342
+ "div",
8343
+ { className: "public-lobby-row" },
8344
+ h3(
8345
+ "div",
8346
+ { className: "public-lobby-field" },
8347
+ h3("label", { className: "public-lobby-label", htmlFor: "publicLobbyTitle" }, "\u516C\u5F00\u5927\u5385\u5BF9\u5916\u5206\u8EAB\u540D\uFF08\u72EC\u7ACB\u9694\u79BB\u540D\u7247\uFF09"),
8348
+ h3("input", {
8349
+ id: "publicLobbyTitle",
8350
+ className: "tw-input",
8351
+ type: "text",
8352
+ value: pubTitle,
8353
+ onChange: (e) => setPubTitle(e.target.value),
8354
+ onCompositionEnd: imePub.onCompositionEnd,
8355
+ onKeyDown: imePub.onKeyDown,
8356
+ placeholder: "\u4F8B\u5982\uFF1A\u725B\u6751\u6728\u6728\u5C71 \xB7 DSH \u5B9E\u6218\u4F53\u9A8C\u5206\u8EAB",
8357
+ autoComplete: "off"
8358
+ })
8359
+ ),
8360
+ h3(
8361
+ "div",
8362
+ { className: "public-lobby-field" },
8363
+ h3("label", { className: "public-lobby-label", htmlFor: "publicLobbyIntro" }, "\u516C\u5F00\u5927\u5385\u4E00\u53E5\u8BDD\u4ECB\u7ECD"),
8364
+ h3("input", {
8365
+ id: "publicLobbyIntro",
8366
+ className: "tw-input",
8367
+ type: "text",
8368
+ value: pubIntro,
8369
+ onChange: (e) => setPubIntro(e.target.value),
8370
+ onCompositionEnd: imePub.onCompositionEnd,
8371
+ onKeyDown: imePub.onKeyDown,
8372
+ placeholder: "\u4F8B\u5982\uFF1A\u672C\u673A DeepSeek Harness \u53EA\u8BFB\u9A71\u52A8",
8373
+ autoComplete: "off"
8374
+ })
8375
+ )
8376
+ ),
8377
+ h3(
8378
+ "div",
8379
+ { className: "public-lobby-field" },
8380
+ h3("span", { className: "public-lobby-label" }, "\u52FE\u9009\u5F00\u653E\u7ED9\u516C\u5F00\u626B\u7801\u8BBF\u5BA2\u7684\u53EA\u8BFB\u80FD\u529B\uFF08\u9ED8\u8BA4\u5168\u4E0D\u52FE\u9009 \xB7 \u7269\u7406\u9694\u79BB\u79C1\u5BC6\u9879\u76EE\uFF09"),
8381
+ capabilities.length === 0 ? h3("div", { style: { fontSize: "0.8125rem", color: "var(--text-muted)" } }, "\u8BF7\u5148\u63D0\u70BC\u81F3\u5C11\u4E00\u4E2A\u516C\u5F00\u793A\u4F8B\u6216\u8131\u654F\u5DE5\u4F5C\u533A\u80FD\u529B\u5305") : h3(
8382
+ "div",
8383
+ { id: "publicLobbyCapList", className: "public-lobby-caps" },
8384
+ capabilities.map((cap) => {
8385
+ const isSelected = Boolean(cap.enabled) && selectedPubCapSet.has(cap.id);
8386
+ return h3(
8387
+ "label",
8388
+ {
8389
+ key: cap.id,
8390
+ className: isSelected ? "public-cap-check is-selected" : "public-cap-check"
8391
+ },
8392
+ h3("input", {
8393
+ type: "checkbox",
8394
+ checked: isSelected,
8395
+ disabled: busy || !cap.enabled,
8396
+ onChange: async (e) => {
8397
+ const nextSet = new Set(selectedPubCapSet);
8398
+ if (e.target.checked) nextSet.add(cap.id);
8399
+ else nextSet.delete(cap.id);
8400
+ await onAction("configure_public_lobby", { capIds: [...nextSet] });
8401
+ onToast?.(e.target.checked ? `\u5DF2\u5411\u516C\u5F00\u5927\u5385\u5F00\u653E\u300C${cap.name}\u300D` : `\u5DF2\u4ECE\u516C\u5F00\u5927\u5385\u64A4\u56DE\u300C${cap.name}\u300D`);
8402
+ }
8403
+ }),
8404
+ h3("span", null, cap.name),
8405
+ h3("span", { className: "public-cap-proj" }, `[${cap.projectName || "\u9879\u76EE"}]`)
8406
+ );
8407
+ })
8408
+ )
8409
+ ),
8410
+ h3(
8411
+ "div",
8412
+ { className: "action-row", style: { justifyContent: "space-between", flexWrap: "wrap", marginTop: "0.25rem" } },
8413
+ h3(
8414
+ "label",
8415
+ { style: { display: "inline-flex", alignItems: "center", gap: "0.4375rem", fontSize: "0.8125rem", color: "var(--text-secondary)", cursor: "pointer" } },
8416
+ h3("input", {
8417
+ type: "checkbox",
8418
+ id: "togglePublicPushOwner",
8419
+ checked: Boolean(pub.pushOwner),
8420
+ disabled: busy,
8421
+ onChange: async (e) => {
8422
+ await onAction("configure_public_lobby", { pushOwner: e.target.checked });
8423
+ onToast?.(e.target.checked ? "\u5DF2\u5F00\u542F\u516C\u5F00\u7EA2\u7EBF\u89E6\u53D1\u624B\u673A\u63A8\u9001\uFF08\u6BCF 10 \u5206\u949F\u81F3\u591A 1 \u6B21\uFF09" : "\u5DF2\u5173\u95ED\u516C\u5F00\u4F53\u9A8C\u624B\u673A\u63A8\u9001\u9632\u6253\u6270");
8424
+ }
8425
+ }),
8426
+ h3("span", null, "\u516C\u5F00\u8BBF\u5BA2\u89E6\u53D1\u7EA2\u7EBF\u65F6\u63A8\u6211\u624B\u673A\uFF0810 \u5206\u949F\u51B7\u5374\u9632\u5237\u5C4F\uFF09")
8427
+ ),
8428
+ h3("button", {
8429
+ type: "button",
8430
+ id: "btnSavePublicLobby",
8431
+ className: "tw-btn tw-btn--primary tw-btn--sm",
8432
+ disabled: busy,
8433
+ onClick: async () => {
8434
+ await onAction("configure_public_lobby", {
8435
+ publicBaseUrl: pubBaseUrl.trim(),
8436
+ title: pubTitle.trim(),
8437
+ intro: pubIntro.trim(),
8438
+ visitorDailyLimit: Number(pubVisitorLimit) || 5
8439
+ });
8440
+ onToast?.("\u5DF2\u4FDD\u5B58\u516C\u5F00\u626B\u7801\u5927\u5385\u8BBE\u7F6E\u5E76\u66F4\u65B0\u4E8C\u7EF4\u7801");
8441
+ }
8442
+ }, "\u4FDD\u5B58\u5927\u5385\u8BBE\u7F6E")
8443
+ )
8444
+ ),
8445
+ h3(
8446
+ "div",
8447
+ { className: "public-lobby-qr-col" },
8448
+ h3(
8449
+ "div",
8450
+ { id: "publicLobbyQrWrap", className: "public-lobby-qr-box", "aria-label": "\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u6C38\u4E45\u4E8C\u7EF4\u7801" },
8451
+ pub.qrSvg ? h3("img", {
8452
+ src: `data:image/svg+xml;utf8,${encodeURIComponent(pub.qrSvg)}`,
8453
+ alt: "\u516C\u5F00\u626B\u7801\u4F53\u9A8C\u4E8C\u7EF4\u7801"
8454
+ }) : h3(QrCodeMatrixSvg, { seed: pub.tryUrl || "twin-try-lobby" })
8455
+ ),
8456
+ h3("input", {
8457
+ id: "publicLobbyTryUrl",
8458
+ className: "tw-input",
8459
+ type: "text",
8460
+ readOnly: true,
8461
+ value: pub.tryUrl || "\u542F\u52A8\u672C\u5730\u7F51\u9875\u5165\u53E3\u540E\u751F\u6210",
8462
+ style: { fontSize: "0.75rem", textAlign: "center" }
8463
+ }),
8464
+ h3("button", {
8465
+ type: "button",
8466
+ id: "btnCopyPublicTryUrl",
8467
+ className: "tw-btn tw-btn--subtle tw-btn--sm",
8468
+ disabled: !pub.tryUrl,
8469
+ onClick: () => copyToClipboard(pub.tryUrl || "", (msg) => onToast?.(msg))
8470
+ }, "\u590D\u5236\u4F53\u9A8C\u94FE\u63A5")
8471
+ )
8472
+ )
8473
+ )
8130
8474
  )
8131
8475
  );
8132
8476
  }
@@ -1,6 +1,6 @@
1
1
  # 星云笔记 · 增长与 BI 协同工作区(脱敏示例)
2
2
 
3
- 本工作区用于演示 `@oxmumu3/dsh-agent-twin@0.6.1` 的真实端到端「AI 分身」闭环:
3
+ 本工作区用于演示 `@oxmumu3/dsh-agent-twin@0.6.3` 的真实端到端「AI 分身」闭环:
4
4
  - 所有数字、渠道花费、订单营收均已彻底脱敏重构,不含任何真实公司或个人数据。
5
5
  - 工作区内**故意混入**了两类危险哨兵文件:
6
6
  1. `.env.production`(模拟数仓管理员密钥)
@@ -12,5 +12,5 @@
12
12
  - `docs/attribution-and-roi-handbook.md`:增长归因口径手册(D7 净回本 ROI 公式、自然量剔除规则、渠道定义)。
13
13
  - `docs/anomaly-playbook.md`:周报异常归因排查清单(苹果内购延迟入账、测试号剔除、返点未定稿边界)。
14
14
  - `data/channel_weekly_metrics.csv`:连续 3 周分渠道投放花费、新付费用户数、D7 累计营收与退款汇总(12 行脱敏数据)。
15
- - `mtn/growth-ska-graph.json`:MTN / SKA 语义图谱示范,串联 `D7 净回本 ROI` 公式、`W03 延迟脉冲`与 `Q1 返点`分级保护。
15
+ - `graph/growth-semantic-graph.json`:语义知识图谱示范,串联 `D7 净回本 ROI` 公式、`W03 延迟脉冲`与 `Q1 返点`分级保护。
16
16
  - `scripts/calc_roi_summary.py`:只读口径汇总脚本,按渠道精确核算净回本 ROI。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "project": "星云笔记 · 增长与 BI 协同图谱 (MTN / SKA 脱敏示范)",
3
+ "project": "星云笔记 · 增长与 BI 协同图谱(脱敏示范)",
4
4
  "nodes": [
5
5
  {
6
6
  "id": "metric.d7_net_roi",
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Built-in MTN / SKA Semantic Knowledge Graph Provider (`lib/mtn-provider.js`):
3
- * - Discovers `mtn/*.json`, `ska/*.json`, `*.mtn.json` inside mounted read-only projects
4
- * and owner-curated nodes at `$DSH_HOME/agent-twin/mtn-graph.json`.
2
+ * Built-in Semantic Knowledge Graph Provider (`lib/graph-provider.js`):
3
+ * - Discovers `graph/*.json`, `knowledge/*.json`, `*.graph.json` inside mounted read-only projects
4
+ * and owner-curated nodes at `$DSH_HOME/agent-twin/knowledge-graph.json`.
5
5
  * - Enforces caller capability authorization and `allowedModes` filtering before expanding
6
6
  * 1-hop semantic relations (`公式` / `口径注意` / `受保护关联边界提示`) into caller turns.
7
7
  */
@@ -32,7 +32,7 @@ function normalizeNode(raw, defaultProjectId = '') {
32
32
  const summary = sanitizeSurfaceText(String(raw.summary || raw.definition || raw.description || '').trim());
33
33
  if (!title && !summary) return null;
34
34
 
35
- const id = String(raw.id || '').trim() || `mtn-${createHash('sha1').update(`${defaultProjectId}:${title}`).digest('hex').slice(0, 8)}`;
35
+ const id = String(raw.id || '').trim() || `kg-${createHash('sha1').update(`${defaultProjectId}:${title}`).digest('hex').slice(0, 8)}`;
36
36
  const allowedModesRaw = Array.isArray(raw.allowedModes) ? raw.allowedModes : [];
37
37
  const allowedModes = allowedModesRaw.filter(m => PERSON_MODES.includes(m));
38
38
  const relations = Array.isArray(raw.relations)
@@ -80,8 +80,8 @@ async function safeAtomicWrite(filePath, payload) {
80
80
  }
81
81
  }
82
82
 
83
- export function createMtnKnowledgeProvider({ store, logger = console }) {
84
- const customGraphPath = join(store.paths.rootDir, 'mtn-graph.json');
83
+ export function createKnowledgeGraphProvider({ store, logger = console }) {
84
+ const customGraphPath = join(store.paths.rootDir, 'knowledge-graph.json');
85
85
  const fileCache = new Map();
86
86
 
87
87
  async function readGraphFileNodes(filePath, defaultProjectId = '') {
@@ -141,8 +141,8 @@ export function createMtnKnowledgeProvider({ store, logger = console }) {
141
141
  if (!st.isFile()) continue;
142
142
  const lower = rel.toLowerCase();
143
143
  if (
144
- lower.endsWith('.mtn.json') ||
145
- ((lower.startsWith('mtn/') || lower.startsWith('ska/')) && lower.endsWith('.json'))
144
+ lower.endsWith('.graph.json') ||
145
+ ((lower.startsWith('graph/') || lower.startsWith('knowledge/')) && lower.endsWith('.json'))
146
146
  ) {
147
147
  found.push(full);
148
148
  }
@@ -184,7 +184,7 @@ export function createMtnKnowledgeProvider({ store, logger = console }) {
184
184
  .map(n => normalizeNode(n, n?.projectId || ''))
185
185
  .filter(Boolean);
186
186
  if (incoming.length === 0) {
187
- throw new Error('缺少有效的 MTN 知识节点内容');
187
+ throw new Error('缺少有效的语义知识节点内容');
188
188
  }
189
189
  const existing = await readGraphFileNodes(customGraphPath, '');
190
190
  const merged = new Map(existing.map(n => [n.id, n]));
@@ -214,6 +214,7 @@ export function createMtnKnowledgeProvider({ store, logger = console }) {
214
214
 
215
215
  const authorizedNodes = allNodes.filter(node => {
216
216
  if (node.projectId && !authorizedProjectIds.has(node.projectId)) return false;
217
+ if (!node.projectId && person?.isPublicVisitor) return false;
217
218
  if (!node.projectId && activeSet && activeSet.size === 0) return false;
218
219
  if (node.capIds.length > 0 && activeSet && !node.capIds.some(cid => activeSet.has(cid))) return false;
219
220
  return true;
@@ -267,7 +268,7 @@ export function createMtnKnowledgeProvider({ store, logger = console }) {
267
268
  nodeId: node.id,
268
269
  type: node.type,
269
270
  score,
270
- source: 'MTN 语义图谱',
271
+ source: '语义知识图谱',
271
272
  title: node.title,
272
273
  summary: sanitizeSurfaceText(parts.filter(Boolean).join(' | '))
273
274
  };
@@ -275,7 +276,7 @@ export function createMtnKnowledgeProvider({ store, logger = console }) {
275
276
  }
276
277
 
277
278
  return {
278
- name: 'MTN 语义图谱',
279
+ name: '语义知识图谱',
279
280
  query,
280
281
  listNodes,
281
282
  upsertNodes