@oxmumu3/dsh-agent-twin 0.6.0 → 0.6.2

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.0)
1
+ # AI 分身工作台 · `@oxmumu3/dsh-agent-twin` (v0.6.2)
2
2
 
3
- 在 DeepSeek Harness (`0.2.2-rc.5` / `0.2.3-alpha.2`) 内把你的本地专业工作区发布为**满血隔离 AI 分身**:**1 个满血 DSH 只读内核 + 按人物理裁剪工作区(薄 Harness 边界)+ 0.2.3 官方飞书/企微连接器一键复用与真个人微信 iLink 扫码 + 对话流原位审批卡片 (`tool.call.toolview`)**。
3
+ 在 DeepSeek Harness (`0.2.2-rc.5` / `0.2.3-alpha.2`) 内把你的本地专业工作区发布为**满血隔离 AI 分身**:**1 个满血 DSH 只读内核 + 按人与目录物理裁剪工作区(薄 Harness 边界)+ `/try` 公开扫码真体验大厅 + 0.2.3 官方飞书/企微连接器与真个人微信 iLink + 对话流与手机远程拍板 + 内置 MTN 语义知识图谱**。
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,27 +15,33 @@ https://github.com/oxmumu3/ai-twin-starter
15
15
 
16
16
  ---
17
17
 
18
- ## v0.6.0 核心架构升级
18
+ ## v0.6.2 核心架构升级
19
19
 
20
- ### 1. 满血 DSH 原生内核 × 薄 Harness 边界隔离
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 秒创造模式安装指令。
24
+
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、口径文档与脚本后再回答。
22
- - **物理裁剪而非对话提示瞎挡**:每次会话通过 `materializeScopedWorkspace()` 为每位来访者生成 `0700` 专属符号链接沙箱,只挂载其获权能力包关联的文档与只读工具;`.env*`、私钥凭据、`DELETE/INSERT` 写库 SQL、`.git`、`.agent`/`.claude` 与遥测日志 JSON 从物理目录里彻底消失。
23
- - **语义红线 + 人工拍板**:工作台 `rules`(包含负责人自然语言临时加的规矩/红线)注入 `<twin_harness>` 边界层,命中红线或资料缺口时输出 `[[TWIN_DECISION:REDLINE|原因]]` / `[[TWIN_DECISION:GAP|原因]]`,自动挡回并生成待拍板草稿。
27
+ - **按人与按目录双层物理裁剪 (`scopePaths`)**:每次会话通过 `materializeScopedWorkspace()` 为每位来访者生成 `0700` 专属符号链接沙箱;除按能力包过滤外,支持在工作台为每项能力单独限定目录路径(如仅挂载 `docs/` 与 `README.md` 而不挂 `data/`),`.env*`、私钥凭据、`DELETE/INSERT` 写库 SQL、`.git` 与遥测日志 JSON 从物理目录里彻底消失。
28
+ - **实时流式步骤 + 3.5 秒慢响应安抚**:`/g/:token` 免装网页直连 `POST /api/guest/:token/ask-stream` SSE 事件流实时播报只读核查步骤;飞书/微信/企微/Slack 若深查超过 3.5 秒自动先回一句安抚回执。
29
+ - **语义红线 + 手机远程拍板闭环**:命中红线或资料缺口时生成带 `#编号` 的待拍板卡片,支持通过官方飞书机器人私信或本机 `dsh-wechat` 推送到负责人手机;直接在手机回复 `批准 #码` / `改 #码:最终回复` / `记规矩 #码:内容` 即可远程下发给来访对象。
24
30
 
25
31
  ### 2. 官方办公连接器一键复用 + 真个人微信 iLink
26
- - **飞书 (`@deepseek-ai/dsh-feishu`)**:一键检测并复用 DSH 0.2.3 官方插件 OAuth(零 App Secret 落盘),自动挂载 `lark-cli event consume im.message.receive_v1 --as bot` 实时事件流,识别本人在同一对话 15 分钟内发言并自动收声,批准草稿时通过 `im +messages-reply / +messages-send` 回传。
32
+ - **飞书 (`@deepseek-ai/dsh-feishu`)**:一键检测并复用 DSH 0.2.3 官方插件 OAuth(零 App Secret 落盘),自动挂载 `lark-cli event consume im.message.receive_v1 --as bot` 实时事件流,识别本人在群聊 15 分钟内发言自动收声,并在私聊支持远程拍板指令,批准草稿时通过 `im +messages-reply / +messages-send` 回传。
27
33
  - **企业微信 (`@deepseek-ai/dsh-wecom`)**:一键复用官方 `wecom-cli` 出站回传,同时保留智能机器人长连接实时接入。
28
34
  - **个人微信(真实 iLink 协议)**:接入 `weixin-ilink` 真实扫码二维码生成(SVG)、状态轮询、长轮询入站与 `-2` 异常自动重恢复,零公众号认证门槛。
29
35
  - **免装试用网页 & Slack Socket Mode**:按人签发独立沙箱网页链接,无须安装任何客户端即可试跑验证;所有已启用通道在插件重启后自动重连。
30
36
 
31
- ### 3. DSH 原生度拉满:四枚原子工具 + 对话流原位审批卡
37
+ ### 3. DSH 原生度拉满 + 内置 MTN / SKA 语义图谱
32
38
  - 收敛冗长单一工具为四枚职责清晰的原子工具:
33
39
  - `twin_status`:查看值班状态、切换 `shadow / live / off`、刷新官方连接器探测或本地只读自测;
34
40
  - `twin_publish_workspace`:从本地目录提炼能力包并可选一键挂载官方飞书;
35
41
  - `twin_grant_access`:为指定同事或合作方开通网页/微信/飞书/企微/Slack 隔离授权;
36
42
  - `twin_inbox`:查看待拍板草稿与红线拦截,并直接在主对话内批准或忽略。
37
43
  - 接入 **`tool.call.toolview` (`@deepseek-ai/dsh-client-ui-tool`)**:在主对话里直接编辑草稿文本、点击「批准发出」「发出并记为规矩」「忽略」或切换值班模式,无需来回跳转左侧面板。
38
- - 暴露 **`ctx.get('agentTwin')` 公共服务(含 `registerKnowledgeProvider`)**:方便 MTN / SKA 等上层知识图谱或企业索引插件零侵入挂接,并维持 **0.2.2-rc.5 + 0.2.3-alpha.2 单包双兼容**。
44
+ - 内置 **`mtn-provider` 语义图谱提供器 + `ctx.get('agentTwin')`**:开箱即自动读取项目内 `mtn/*.json` / `ska/*.json` / `*.mtn.json` 与工作台自定义节点(按 `allowedModes` 过滤并做 1 跳公式/异常/边界联想),同时保持 **0.2.2-rc.5 + 0.2.3-alpha.2 单包双兼容**。
39
45
 
40
46
  ---
41
47
 
@@ -45,6 +51,7 @@ https://github.com/oxmumu3/ai-twin-starter
45
51
  - `docs/attribution-and-roi-handbook.md`:D7 净回本 ROI 公式、自然量剔除规则与 Q1 未定稿返点边界;
46
52
  - `docs/anomaly-playbook.md`:退款率/苹果延迟入账排查步骤;
47
53
  - `data/channel_weekly_metrics.csv` + `scripts/calc_roi_summary.py`:4 渠道 3 周 12 行投放数据;
54
+ - `mtn/growth-ska-graph.json`:增长与 BI 语义图谱示范(串联指标公式、W03 延迟事件与 Q1 返点权限边界);
48
55
  - 刻意混入 `.env.production`(假数仓私钥哨兵)与 `scripts/export_raw_user_phones.sql`(假写库/导出手机号 SQL),供端到端验收分身隔离边界。
49
56
 
50
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;
@@ -7051,6 +7153,7 @@ function DeskScene({
7051
7153
  "div",
7052
7154
  { className: "brief-meta-left" },
7053
7155
  h3("span", { className: "brief-idx" }, idxLabel),
7156
+ item.shortCode && h3("span", { className: "status-pill status-pill--muted", style: { fontFamily: "var(--font-mono)" } }, `#${item.shortCode}`),
7054
7157
  canOpenPerson ? h3("button", { type: "button", className: "who-link", onClick: () => onOpenPersonDrawer(item.personId) }, item.personName) : h3("span", { className: "brief-who-static" }, item.personName),
7055
7158
  h3("span", null, `\xB7 ${item.channel}`)
7056
7159
  ),
@@ -7514,13 +7617,29 @@ function CapsScene({
7514
7617
  const [editingRuleId, setEditingRuleId] = (0, import_react3.useState)("");
7515
7618
  const [editRuleKind, setEditRuleKind] = (0, import_react3.useState)("\u89C4\u77E9");
7516
7619
  const [editRuleText, setEditRuleText] = (0, import_react3.useState)("");
7620
+ const [editingCapScopeId, setEditingCapScopeId] = (0, import_react3.useState)("");
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]);
7517
7633
  const imeNew = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7518
7634
  const imeEdit = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7635
+ const imeScope = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7636
+ const imePub = (0, import_react3.useMemo)(() => createImeHandlers(), []);
7519
7637
  const job = view?.extractionJob || null;
7520
7638
  const mounted = view?.mountedProjects || [];
7521
7639
  const capabilities = view?.capabilities || [];
7522
7640
  const rules = view?.rules || [];
7523
7641
  const channels = view?.channels || [];
7642
+ const selectedPubCapSet = new Set(Array.isArray(pub.capIds) ? pub.capIds : []);
7524
7643
  async function submitNewRule(ev) {
7525
7644
  ev.preventDefault();
7526
7645
  const val = newRuleText.trim();
@@ -7697,7 +7816,12 @@ function CapsScene({
7697
7816
  h3("span", { className: "section-index" }, "01"),
7698
7817
  h3("h2", { className: "section-title" }, "\u5206\u8EAB\u5177\u5907\u7684\u80FD\u529B")
7699
7818
  ),
7700
- h3("span", { className: "section-meta" }, "\u6BCF\u9879\u80FD\u529B\u4EC5\u6309\u53EA\u8BFB\u767D\u540D\u5355\u6838\u6570\uFF0C\u5199\u5E93\u4E0E\u6539\u4EE3\u7801\u5DF2\u7981\u6B62")
7819
+ h3(
7820
+ "div",
7821
+ { className: "action-row" },
7822
+ Number(view?.mtnNodeCount) > 0 && h3("span", { className: "status-pill status-pill--ok" }, `MTN \u8BED\u4E49\u56FE\u8C31 \xB7 ${view.mtnNodeCount} \u8282\u70B9`),
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")
7824
+ )
7701
7825
  ),
7702
7826
  h3(
7703
7827
  "div",
@@ -7707,8 +7831,10 @@ function CapsScene({
7707
7831
  { className: "card" },
7708
7832
  h3("div", { className: "cap-card-head" }, h3("h3", { className: "cap-card-title" }, "\u80FD\u529B\u6E05\u5355\u5F85\u63D0\u70BC")),
7709
7833
  h3("p", { className: "cap-desc" }, "\u5B8C\u6210\u300C\u9996\u6B21\u542F\u7528\u300D\u4E2D\u7684 4 \u6B65\u63D0\u53D6\u540E\uFF0C\u4ECE\u672C\u5730\u9879\u76EE\u62BD\u53D6\u51FA\u7684\u53EA\u8BFB\u67E5\u8BE2\u4E0E\u53E3\u5F84\u89E3\u7B54\u80FD\u529B\u4F1A\u9010\u9879\u5C55\u793A\u5728\u8FD9\u91CC\u3002")
7710
- ) : capabilities.map(
7711
- (cap) => h3(
7834
+ ) : capabilities.map((cap) => {
7835
+ const scopeList = Array.isArray(cap.scopePaths) ? cap.scopePaths : [];
7836
+ const isEditingScope = editingCapScopeId === cap.id;
7837
+ return h3(
7712
7838
  "div",
7713
7839
  { key: cap.id, className: "card" },
7714
7840
  h3("span", { className: "cap-source-tag" }, cap.projectName || "\u5DE5\u4F5C\u533A\u80FD\u529B\u6E90"),
@@ -7737,10 +7863,62 @@ function CapsScene({
7737
7863
  "div",
7738
7864
  { className: "cap-meta" },
7739
7865
  h3("span", null, `\u4F9D\u636E\uFF1A${cap.basis}`),
7740
- h3("span", null, `\u683C\u5F0F\uFF1A${cap.output}`)
7866
+ h3("span", null, `\u683C\u5F0F\uFF1A${cap.output}`),
7867
+ h3("span", null, `\u76EE\u5F55\u8FB9\u754C\uFF1A${scopeList.length > 0 ? scopeList.join(", ") : "\u5168\u90E8\u53EA\u8BFB\u5B89\u5168\u6587\u4EF6"}`)
7868
+ ),
7869
+ isEditingScope ? h3(
7870
+ "div",
7871
+ { style: { marginTop: "0.625rem", display: "flex", flexDirection: "column", gap: "0.4375rem" } },
7872
+ h3("input", {
7873
+ className: "tw-input",
7874
+ type: "text",
7875
+ value: capScopeInput,
7876
+ onChange: (e) => setCapScopeInput(e.target.value),
7877
+ onCompositionEnd: imeScope.onCompositionEnd,
7878
+ onKeyDown: imeScope.onKeyDown,
7879
+ placeholder: "\u5982 docs/, README.md\uFF08\u7559\u7A7A\u8868\u793A\u5168\u90E8\u5B89\u5168\u6587\u4EF6\uFF09",
7880
+ "aria-label": `${cap.name} \u5F00\u653E\u76EE\u5F55\u8303\u56F4`,
7881
+ autoComplete: "off"
7882
+ }),
7883
+ h3(
7884
+ "div",
7885
+ { className: "action-row" },
7886
+ h3("button", {
7887
+ type: "button",
7888
+ className: "tw-btn tw-btn--primary tw-btn--sm",
7889
+ disabled: busy,
7890
+ onClick: async () => {
7891
+ await onAction("update_capability_scope", { capId: cap.id, scopePaths: capScopeInput });
7892
+ setEditingCapScopeId("");
7893
+ onToast?.(capScopeInput.trim() ? "\u5DF2\u6536\u655B\u8BE5\u80FD\u529B\u4EC5\u6302\u8F7D\u6307\u5B9A\u76EE\u5F55\u8DEF\u5F84" : "\u5DF2\u6062\u590D\u8BE5\u80FD\u529B\u4E3A\u5168\u90E8\u53EA\u8BFB\u5B89\u5168\u6587\u4EF6");
7894
+ }
7895
+ }, "\u4FDD\u5B58\u8303\u56F4"),
7896
+ h3("button", {
7897
+ type: "button",
7898
+ className: "tw-btn tw-btn--ghost tw-btn--sm",
7899
+ onClick: () => setEditingCapScopeId("")
7900
+ }, "\u53D6\u6D88")
7901
+ )
7902
+ ) : h3(
7903
+ "div",
7904
+ { className: "cap-foot-actions" },
7905
+ h3(
7906
+ "span",
7907
+ { className: scopeList.length > 0 ? "status-pill status-pill--ok" : "status-pill status-pill--muted" },
7908
+ scopeList.length > 0 ? `\u5DF2\u7F29\u7A84 ${scopeList.length} \u6761\u8DEF\u5F84` : "\u5168\u9879\u76EE\u53EA\u8BFB"
7909
+ ),
7910
+ h3("button", {
7911
+ type: "button",
7912
+ className: "tw-btn tw-btn--ghost tw-btn--sm",
7913
+ disabled: busy,
7914
+ onClick: () => {
7915
+ setEditingCapScopeId(cap.id);
7916
+ setCapScopeInput(scopeList.join(", "));
7917
+ }
7918
+ }, "\u9650\u5B9A\u8DEF\u5F84")
7741
7919
  )
7742
- )
7743
- )
7920
+ );
7921
+ })
7744
7922
  )
7745
7923
  ),
7746
7924
  // 02 Rules & Redlines
@@ -7791,6 +7969,96 @@ function CapsScene({
7791
7969
  h3("span", { className: "switch-track" })
7792
7970
  )
7793
7971
  ),
7972
+ h3(
7973
+ "div",
7974
+ { className: "rule-row", style: { alignItems: "center", justifyContent: "space-between" } },
7975
+ h3(
7976
+ "div",
7977
+ null,
7978
+ h3("div", { style: { fontWeight: 600, color: "var(--text)" } }, "\u98DE\u4E66\u79C1\u4FE1\u63A8\u6211\u624B\u673A\u62CD\u677F"),
7979
+ h3(
7980
+ "div",
7981
+ { style: { fontSize: "0.78125rem", color: "var(--text-secondary)", marginTop: "0.125rem" } },
7982
+ "\u6709\u4EBA\u89E6\u53D1\u7EA2\u7EBF\u6216\u5F85\u5BA1\u6838\u8349\u7A3F\u65F6\u63A8 #\u7F16\u53F7 \u7ED9\u4F60\uFF0C\u79C1\u4FE1\u56DE\u300C\u6279\u51C6 #\u7801\u300D\u6216\u300C\u6539 #\u7801\uFF1A\u5185\u5BB9\u300D\u8FDC\u7A0B\u79D2\u6279"
7983
+ )
7984
+ ),
7985
+ h3(
7986
+ "label",
7987
+ { className: "switch", "aria-label": "\u5207\u6362\u98DE\u4E66\u79C1\u4FE1\u63A8\u9001\u5F85\u62CD\u677F\u63D0\u9192" },
7988
+ h3("input", {
7989
+ type: "checkbox",
7990
+ id: "toggleOwnerNotifyFeishu",
7991
+ checked: view?.ownerNotify?.feishu !== false,
7992
+ disabled: busy,
7993
+ onChange: async (e) => {
7994
+ const checked = e.target.checked;
7995
+ await onAction("set_owner_notify", { feishu: checked });
7996
+ onToast?.(checked ? "\u5DF2\u5F00\u542F\u98DE\u4E66\u79C1\u4FE1\u624B\u673A\u8FDC\u7A0B\u62CD\u677F\u63D0\u9192" : "\u5DF2\u5173\u95ED\u98DE\u4E66\u79C1\u4FE1\u62CD\u677F\u63D0\u9192");
7997
+ }
7998
+ }),
7999
+ h3("span", { className: "switch-track" })
8000
+ )
8001
+ ),
8002
+ h3(
8003
+ "div",
8004
+ { className: "rule-row", style: { alignItems: "center", justifyContent: "space-between" } },
8005
+ h3(
8006
+ "div",
8007
+ null,
8008
+ h3("div", { style: { fontWeight: 600, color: "var(--text)" } }, "\u5FAE\u4FE1\u6865\uFF08dsh-wechat\uFF09\u540C\u6B65\u63A8\u6211\u624B\u673A"),
8009
+ h3(
8010
+ "div",
8011
+ { style: { fontSize: "0.78125rem", color: "var(--text-secondary)", marginTop: "0.125rem" } },
8012
+ "\u8C03\u7528\u672C\u673A dsh-wechat \u901A\u9053\u628A\u5F85\u62CD\u677F #\u7F16\u53F7 \u6458\u8981\u63A8\u5230\u4F60\u7684\u5FAE\u4FE1\uFF0C\u51FA\u95E8\u4E5F\u80FD\u968F\u65F6\u638C\u63E1\u8FB9\u754C\u62E6\u622A"
8013
+ )
8014
+ ),
8015
+ h3(
8016
+ "label",
8017
+ { className: "switch", "aria-label": "\u5207\u6362 dsh-wechat \u5FAE\u4FE1\u5F85\u62CD\u677F\u63A8\u9001" },
8018
+ h3("input", {
8019
+ type: "checkbox",
8020
+ id: "toggleOwnerNotifyWechat",
8021
+ checked: Boolean(view?.ownerNotify?.wechat),
8022
+ disabled: busy,
8023
+ onChange: async (e) => {
8024
+ const checked = e.target.checked;
8025
+ await onAction("set_owner_notify", { wechat: checked });
8026
+ onToast?.(checked ? "\u5DF2\u5F00\u542F dsh-wechat \u5FAE\u4FE1\u540C\u6B65\u63A8\u9001" : "\u5DF2\u5173\u95ED dsh-wechat \u5FAE\u4FE1\u63A8\u9001");
8027
+ }
8028
+ }),
8029
+ h3("span", { className: "switch-track" })
8030
+ )
8031
+ ),
8032
+ h3(
8033
+ "div",
8034
+ { className: "rule-row", style: { alignItems: "center", justifyContent: "space-between" } },
8035
+ h3(
8036
+ "div",
8037
+ null,
8038
+ h3("div", { style: { fontWeight: 600, color: "var(--text)" } }, "\u6162\u54CD\u5E94\u5148\u7ED9\u5BF9\u65B9\u4E00\u53E5\u56DE\u6267"),
8039
+ h3(
8040
+ "div",
8041
+ { style: { fontSize: "0.78125rem", color: "var(--text-secondary)", marginTop: "0.125rem" } },
8042
+ "\u5916\u90E8\u5206\u8EAB\u6DF1\u5EA6\u53EA\u8BFB\u6838\u7B97\u8D85\u8FC7 3.5 \u79D2\u65F6\u81EA\u52A8\u5B89\u629A\u4E00\u6B21\uFF0C\u907F\u514D\u540C\u4E8B\u4EE5\u4E3A\u6D88\u606F\u6CA1\u6536\u5230"
8043
+ )
8044
+ ),
8045
+ h3(
8046
+ "label",
8047
+ { className: "switch", "aria-label": "\u5207\u6362\u6162\u54CD\u5E94\u81EA\u52A8\u56DE\u6267" },
8048
+ h3("input", {
8049
+ type: "checkbox",
8050
+ id: "toggleAckSlowTurns",
8051
+ checked: view?.ackSlowTurns !== false,
8052
+ disabled: busy,
8053
+ onChange: async (e) => {
8054
+ const checked = e.target.checked;
8055
+ await onAction("set_ack_slow_turns", { enabled: checked });
8056
+ onToast?.(checked ? "\u5DF2\u5F00\u542F 3.5 \u79D2\u6162\u54CD\u5E94\u81EA\u52A8\u56DE\u6267" : "\u5DF2\u5173\u95ED\u6162\u54CD\u5E94\u81EA\u52A8\u56DE\u6267");
8057
+ }
8058
+ }),
8059
+ h3("span", { className: "switch-track" })
8060
+ )
8061
+ ),
7794
8062
  h3(
7795
8063
  "div",
7796
8064
  { id: "rulesList" },
@@ -7974,6 +8242,235 @@ function CapsScene({
7974
8242
  );
7975
8243
  })
7976
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
+ )
7977
8474
  )
7978
8475
  );
7979
8476
  }
@@ -1,6 +1,6 @@
1
1
  # 星云笔记 · 增长与 BI 协同工作区(脱敏示例)
2
2
 
3
- 本工作区用于演示 `@oxmumu3/dsh-agent-twin@0.6.0` 的真实端到端「AI 分身」闭环:
3
+ 本工作区用于演示 `@oxmumu3/dsh-agent-twin@0.6.1` 的真实端到端「AI 分身」闭环:
4
4
  - 所有数字、渠道花费、订单营收均已彻底脱敏重构,不含任何真实公司或个人数据。
5
5
  - 工作区内**故意混入**了两类危险哨兵文件:
6
6
  1. `.env.production`(模拟数仓管理员密钥)
@@ -12,4 +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
16
  - `scripts/calc_roi_summary.py`:只读口径汇总脚本,按渠道精确核算净回本 ROI。