Jelajahi Sumber

feat(trial): 提示词点击才展开 + 复制后跳会话 + 7 天回收作业

- 移除登录即自动拉提示词;改为点击「查看接入提示词」
- 复制成功跳转会话页,守卫对试用未到期放行
- 提示词补充自动重启网关、预期输出、下一步
- 新增 recycle-expired.mjs:7 天后停删容器 + 软删会话 + 记录吊销

Co-Authored-By: Claude Code <noreply@anthropic.com>
Huccct 11 jam lalu
induk
melakukan
1267a10d26

+ 13 - 1
cloud/functions/fmode-provisioning.js

@@ -112,7 +112,8 @@ function _buildSelfHostedInstruction(agentId, name, matrix, password, accessToke
     '安装器会备份被更新的文件、只批准本包指定 hooks;未配置模型、配置版本过旧或 AGENT_ID 冲突时会明确停止并说明原因——遇到停止就按提示处理或回报,不要绕过。',
     '若报「配置版本缺失或过旧」:先在本机执行 `hermes setup`(或 `hermes config` 的迁移流程)完成当前运行时配置,再重新执行 A2。',
     '',
-    'A3. 让网关加载新配置:先 `hermes gateway stop`,再在后台重新启动 `hermes gateway run`(Windows 下用新窗口或 `start` 均可),启动时加 `--accept-hooks`(接入包 hooks 在非交互启动时不会被自动批准,网关会静默掉线)。',
+    'A3. **配置完成后立即自动重启网关**(不要等用户确认,这一步必须由你完成):先 `hermes gateway stop`,再在后台重新启动 `hermes gateway run --accept-hooks`(Windows 下用新窗口或 `start` 均可)。',
+    '    `--accept-hooks` 必须加:接入包的 hooks 在非交互启动时不会被自动批准,不加网关会静默掉线。',
     '',
     'A2.5 原生环境必备适配(2026-12-03 实测,Windows 首次接入 3 个坑,macOS/Linux 一般用不到):',
     '- **Matrix 依赖**:原生安装不自动装 Matrix SDK。`MATRIX_E2EE_MODE=off`,装**不带 encryption** 的版本即可:',
@@ -188,6 +189,17 @@ function _buildSelfHostedInstruction(agentId, name, matrix, password, accessToke
     'FMODE_CHECK_PY', '```',
     '自检要求 matrix 为 connected、FMODE_ACCESS_TOKEN 为 true;原来启用的其他渠道(如 wecom)也必须仍为 connected。',
     '',
+    '## 预期输出(判断成功的标准)',
+    '重启后 30-60 秒内应当看到:',
+    '1. `gateway_state.json` 中 `platforms.matrix.state` = `connected`;',
+    '2. App 的容器列表在约 1 分钟内出现 ' + canonical + ',状态为在线;',
+    '3. 从 App 发一条消息,5 秒内收到回复,并且回复消息上出现 ✅。',
+    '任何一项没达到就如实回报卡在哪一项,不要宣布成功。',
+    '',
+    '## 下一步(写给用户)',
+    '接入完成后:① 回到 App,点左侧该容器 → 进入会话;② 发一句「你好」确认能收到回复和 ✅;',
+    '③ 如果 App 一直显示离线:先确认网关进程在跑,再看 `gateway.log` 里的 matrix 连接日志。',
+    '',
     '## 验收(两个分支共用)',
     '1. 逐项回报真实结果:网关进程正常、Matrix 连接成功、状态首报成功,App 将 ' + canonical + ' 显示为可用;再从 App 发起新会话,验证消息回复和 ✅ 结束回执,再验证附件读取、成果自动上云与 App 预览。原有渠道要各发一条消息确认仍能回复。',
     '2. Docker running(原生安装则为进程在跑)、已写变量、已复制文件或发出一条消息,都不能单独作为接入成功依据。失败时报告实际日志和未完成项,不伪造在线状态,不重复创建身份。',

+ 13 - 1
cloud/onboarding/prompt.js

@@ -68,7 +68,8 @@ function _buildSelfHostedInstruction(agentId, name, matrix, password, accessToke
     '安装器会备份被更新的文件、只批准本包指定 hooks;未配置模型、配置版本过旧或 AGENT_ID 冲突时会明确停止并说明原因——遇到停止就按提示处理或回报,不要绕过。',
     '若报「配置版本缺失或过旧」:先在本机执行 `hermes setup`(或 `hermes config` 的迁移流程)完成当前运行时配置,再重新执行 A2。',
     '',
-    'A3. 让网关加载新配置:先 `hermes gateway stop`,再在后台重新启动 `hermes gateway run`(Windows 下用新窗口或 `start` 均可),启动时加 `--accept-hooks`(接入包 hooks 在非交互启动时不会被自动批准,网关会静默掉线)。',
+    'A3. **配置完成后立即自动重启网关**(不要等用户确认,这一步必须由你完成):先 `hermes gateway stop`,再在后台重新启动 `hermes gateway run --accept-hooks`(Windows 下用新窗口或 `start` 均可)。',
+    '    `--accept-hooks` 必须加:接入包的 hooks 在非交互启动时不会被自动批准,不加网关会静默掉线。',
     '',
     'A2.5 原生环境必备适配(2026-12-03 实测,Windows 首次接入 3 个坑,macOS/Linux 一般用不到):',
     '- **Matrix 依赖**:原生安装不自动装 Matrix SDK。`MATRIX_E2EE_MODE=off`,装**不带 encryption** 的版本即可:',
@@ -144,6 +145,17 @@ function _buildSelfHostedInstruction(agentId, name, matrix, password, accessToke
     'FMODE_CHECK_PY', '```',
     '自检要求 matrix 为 connected、FMODE_ACCESS_TOKEN 为 true;原来启用的其他渠道(如 wecom)也必须仍为 connected。',
     '',
+    '## 预期输出(判断成功的标准)',
+    '重启后 30-60 秒内应当看到:',
+    '1. `gateway_state.json` 中 `platforms.matrix.state` = `connected`;',
+    '2. App 的容器列表在约 1 分钟内出现 ' + canonical + ',状态为在线;',
+    '3. 从 App 发一条消息,5 秒内收到回复,并且回复消息上出现 ✅。',
+    '任何一项没达到就如实回报卡在哪一项,不要宣布成功。',
+    '',
+    '## 下一步(写给用户)',
+    '接入完成后:① 回到 App,点左侧该容器 → 进入会话;② 发一句「你好」确认能收到回复和 ✅;',
+    '③ 如果 App 一直显示离线:先确认网关进程在跑,再看 `gateway.log` 里的 matrix 连接日志。',
+    '',
     '## 验收(两个分支共用)',
     '1. 逐项回报真实结果:网关进程正常、Matrix 连接成功、状态首报成功,App 将 ' + canonical + ' 显示为可用;再从 App 发起新会话,验证消息回复和 ✅ 结束回执,再验证附件读取、成果自动上云与 App 预览。原有渠道要各发一条消息确认仍能回复。',
     '2. Docker running(原生安装则为进程在跑)、已写变量、已复制文件或发出一条消息,都不能单独作为接入成功依据。失败时报告实际日志和未完成项,不伪造在线状态,不重复创建身份。',

+ 8 - 0
docs/00-tracking/操作追踪.md

@@ -10672,3 +10672,11 @@ Call log:
     - 前端:`FmodeApi.fetchProvisionInstruction` / `ProvisionService.loadInstruction`;两端套餐页在「已试用过且当前无提示词」时**自动拉回**,用户可一直复制。
   - 账号:18182795512 **已恢复**(手机号还原、`isDeleted=false`,用户名改为 `user_18182795512` 以避开唯一索引冲突);名下容器/工单仍为已删状态,相当于全新账号。
   - 验证:构建通过;`op:'instruction'` 接口就绪(测试账号无记录时正确返回 404 NO_RECORD)。
+
+- 2026-12-04 02:25:00+08:00:**试用体验修复 + 7 天回收作业落地**
+  - **提示词展示时机**(用户反馈「登录就直接显示提示词」):删除 `ngOnInit` 里的自动 `loadInstruction()`;已试用账号只显示「查看接入提示词」按钮,**点击才展开**,再点收起。
+  - **复制后跳转**:`provision-instruction` 新增 `copiedOut` 事件;`ProvisionService` 保存云函数返回的 `agentId`;两端复制成功后跳 `/desktop|mobile/chat/<agentId>/new`。
+  - **门禁**:`container.guard` 对「试用未到期」放行(即使还没接入),用户能进会话页看到引导;到期仍拦。
+  - **提示词增强**:A3 明确「配置完成后立即自动重启网关,不等确认」;新增「预期输出」段(matrix connected / App 1 分钟内出现 / 5 秒内回复+✅)与「下一步」段(回 App、发消息、离线怎么查)。
+  - **7 天回收作业**(新增 `scripts/recycle-expired.mjs`):到期满 7 天 → docker stop+rm → 会话数据软删(FmodeChatThread)→ 记录 revoked → 绑定 revoked;数据目录默认保留,`--purge-data` 才删。
+  - 实测:造「8 天前到期 + 2 条会话」的测试记录 → 干跑正确识别 → `--apply` 执行成功(容器已不在 → 跳过停删、会话软删 2 条、记录 revoked)→ 测试数据已清理。

+ 103 - 0
scripts/recycle-expired.mjs

@@ -0,0 +1,103 @@
+#!/usr/bin/env node
+/**
+ * 过期容器回收(2026-12-04)—— 默认只读,`--apply` 才执行。
+ *
+ * ## 规则(用户裁决)
+ *
+ *   到期 → 能力立刻失效(各接口读时判定,不靠本脚本)
+ *   到期满 7 天未续费 → 本脚本回收:
+ *     ① R730 上 docker stop + docker rm(容器消失)
+ *     ② 会话数据软删(FmodeChatThread 按 agentId)—— 用户再开通时不串旧数据
+ *     ③ 平台记录软删 + accessState=revoked;绑定 revoked
+ *     ④ 数据目录默认**保留**并打印路径,`--purge-data` 才删除
+ *
+ * 用法:
+ *   node scripts/recycle-expired.mjs                       # 干跑,列出清单
+ *   node scripts/recycle-expired.mjs --apply               # 执行
+ *   node scripts/recycle-expired.mjs --apply --days=7      # 自定义宽限天数
+ *   node scripts/recycle-expired.mjs --apply --purge-data  # 连数据目录一起删
+ */
+import fs from 'node:fs';
+import { execFileSync } from 'node:child_process';
+import { resolve } from 'node:path';
+
+const ROOT = process.cwd();
+const argv = process.argv.slice(2);
+const has = (f) => argv.includes(f);
+const arg = (f, d) => argv.find((a) => a.startsWith(`--${f}=`))?.split('=')[1] ?? d;
+const APPLY = has('--apply');
+const PURGE = has('--purge-data');
+const DAYS = Number(arg('days', '7'));
+const R730 = resolve(ROOT, '.local-backup/skill-lock-20261201/r730.py');
+
+const cfg = JSON.parse(fs.readFileSync(resolve(ROOT, '.claude/dev-login.json'), 'utf8'));
+const H = { 'Content-Type': 'application/json', 'X-Parse-Application-Id': 'ncloudmaster', 'X-Parse-Master-Key': cfg.masterKey };
+const B = 'https://server.fmode.cn/parse/classes';
+const now = Date.now();
+const GRACE_MS = DAYS * 86400_000;
+
+const list = async (cls, where, keys) =>
+  (await (await fetch(`${B}/${cls}?where=${encodeURIComponent(JSON.stringify(where))}&limit=500${keys ? '&keys=' + keys : ''}`, { headers: H })).json()).results ?? [];
+const put = async (cls, id, body) => (await fetch(`${B}/${cls}/${id}`, { method: 'PUT', headers: H, body: JSON.stringify(body) })).status;
+
+/* 1. 找候选:已过期且超过宽限期 */
+const agents = await list('FmodeAgent', { isDeleted: { $ne: true } }, 'objectId,name,agentId,planCode,user,accessExpiresAt,trialEndsAt,accessState');
+const due = [];
+for (const a of agents) {
+  const raw = a.accessExpiresAt?.iso || a.trialEndsAt?.iso;
+  const exp = raw ? Date.parse(raw) : 0;
+  if (!exp || now - exp <= GRACE_MS) continue;
+  due.push({ ...a, exp, overDays: Math.floor((now - exp) / 86400_000) });
+}
+
+console.log(`候选 ${due.length} 条(宽限 ${DAYS} 天,当前时间 ${new Date(now).toISOString()})\n`);
+if (!due.length) {
+  console.log('没有需要回收的容器。');
+  process.exit(0);
+}
+
+/* 2. 附带信息:会话数 */
+for (const a of due) {
+  const threads = await list('FmodeChatThread', { agentId: a.agentId, isDeleted: { $ne: true } }, 'objectId');
+  a.threadCount = threads.length;
+  const isPlatform = (a.planCode === 'advanced' || a.planCode === 'enterprise');
+  console.log(
+    `  ${a.name || a.objectId} | ${a.agentId} | ${a.planCode} | 超期 ${a.overDays} 天 | 会话 ${a.threadCount} 条 | ${isPlatform ? '平台容器' : '本地容器(无容器可停)'}`,
+  );
+}
+
+if (!APPLY) {
+  console.log('\n[干跑] 未加 --apply,未做任何修改。');
+  process.exit(0);
+}
+
+/* 3. 执行 */
+const platformAgents = due.filter((a) => a.planCode === 'advanced' || a.planCode === 'enterprise' || a.agentId);
+if (platformAgents.length) {
+  const lines = ['set -e'];
+  for (const a of platformAgents) {
+    lines.push(`echo "[RECYCLE] ${a.agentId}"`);
+    lines.push(`docker stop ${a.agentId} >/dev/null 2>&1 || true`);
+    lines.push(`docker rm ${a.agentId} >/dev/null 2>&1 || echo "  (容器已不在)"`);
+    if (PURGE) lines.push(`[ -d /opt/fmode-containers/${a.agentId} ] && rm -rf /opt/fmode-containers/${a.agentId} && echo "  [PURGE] 数据目录已删" || true`);
+    else lines.push(`[ -d /opt/fmode-containers/${a.agentId} ] && echo "  [KEEP] 数据目录保留: /opt/fmode-containers/${a.agentId}" || true`);
+  }
+  const f = resolve(ROOT, `.local-release/recycle-${Date.now()}.sh`);
+  fs.mkdirSync(resolve(ROOT, '.local-release'), { recursive: true });
+  fs.writeFileSync(f, lines.join('\n'));
+  const out = execFileSync('python', [R730, f, '180'], { encoding: 'utf8', cwd: ROOT });
+  console.log(out.split('\n').filter((l) => l.includes('[') || l.includes('已不在') || l.includes('KEEP') || l.includes('PURGE')).join('\n'));
+}
+
+for (const a of due) {
+  /* 会话数据软删:用户再开通时不串旧数据 */
+  const threads = await list('FmodeChatThread', { agentId: a.agentId, isDeleted: { $ne: true } }, 'objectId');
+  for (const t of threads) await put('FmodeChatThread', t.objectId, { isDeleted: true });
+  /* 平台记录与绑定 */
+  await put('FmodeAgent', a.objectId, { isDeleted: true, accessState: 'revoked' });
+  const binds = await list('FmodeMatrixBinding', { agentId: a.agentId }, 'objectId,status');
+  for (const b of binds) await put('FmodeMatrixBinding', b.objectId, { status: 'revoked' });
+  console.log(`[DONE] ${a.name || a.objectId}:会话软删 ${threads.length} 条,记录 revoked,绑定 ${binds.length} 条`);
+}
+
+console.log('\n回收完成。审计记录已打印在终端,按规范需补写操作追踪。');

+ 8 - 0
src/app/components/domain/provision-instruction/provision-instruction.ts

@@ -3,6 +3,7 @@ import {
   Component,
   ElementRef,
   input,
+  output,
   signal,
   viewChild,
 } from '@angular/core';
@@ -169,6 +170,12 @@ export class ProvisionInstructionComponent {
   /** 要展示/复制的提示词全文 */
   readonly text = input<string>('');
 
+  /**
+   * 复制成功(2026-12-04):宿主据此跳转到会话页并展示「下一步」引导。
+   * 只在**真正写入剪贴板成功**时触发;复制失败走全选兜底,不触发。
+   */
+  readonly copiedOut = output<void>();
+
   private readonly codeRef = viewChild<ElementRef<HTMLElement>>('code');
 
   protected readonly copying = signal(false);
@@ -184,6 +191,7 @@ export class ProvisionInstructionComponent {
     try {
       await navigator.clipboard.writeText(value);
       this.copied.set(true);
+      this.copiedOut.emit();
       // 2.4 秒后恢复,让用户看清「已复制」再变回去
       setTimeout(() => this.copied.set(false), 2400);
     } catch {

+ 5 - 0
src/app/core/api/models.ts

@@ -262,6 +262,11 @@ export interface Agent {
   trialEndsAt?: string;
   /** 试用是否已过期(云函数按当前时间派生)。过期后 App 端不再放行进入。 */
   trialExpired?: boolean;
+  /**
+   * 许可证状态(2026-12-04):`active` / `expired` / `revoked`。
+   * 与 `trialExpired` 的区别:后者是「时间到了」,前者还包含「被回收/停用」。
+   */
+  accessState?: 'active' | 'expired' | 'revoked';
   /** 会话未读数 */
   unread: number;
 }

+ 1 - 0
src/app/core/api/parse-api.ts

@@ -1753,6 +1753,7 @@ function mapAgent(raw: Record<string, unknown>): Agent {
     planCode: typeof raw['planCode'] === 'string' ? (raw['planCode'] as Agent['planCode']) : undefined,
     trialEndsAt: typeof raw['trialEndsAt'] === 'string' ? raw['trialEndsAt'] : undefined,
     trialExpired: raw['trialExpired'] === true,
+    accessState: typeof raw['accessState'] === 'string' ? (raw['accessState'] as Agent['accessState']) : undefined,
     // 未读数**不来自服务端**:云函数不返回该字段,真实计数由
     // `UnreadService` 依据 Matrix 事件流在客户端维护(见该服务注释)。
     // 此处恒为 0,UI 不得消费(消费点一律走 UnreadService.countOf)。

+ 6 - 0
src/app/core/container.guard.ts

@@ -85,5 +85,11 @@ export function hasAppAccess(agent: Agent): boolean {
    * 到期判断不能顺手把所有离线容器也拦住(离线 ≠ 到期)。
    */
   if (agent.trialExpired === true) return false;
+  /*
+   * 试用期内**未接入也放行**(2026-12-04 用户裁决):
+   * 用户刚复制提示词、Hermes 还没接上时也要能进会话页,那里才知道「下一步怎么做」。
+   * 到期后仍拦截(上面那行)。
+   */
+  if (agent.planCode === 'trial' && agent.accessState !== 'expired' && agent.accessState !== 'revoked') return true;
   return agent.provisioned ?? agent.matrixReady;
 }

+ 12 - 0
src/app/core/provision.service.ts

@@ -112,6 +112,16 @@ export class ProvisionService {
   readonly startingPlan = this._startingPlan.asReadonly();
   readonly error = this._error.asReadonly();
   readonly instruction = this._instruction.asReadonly();
+
+  /**
+   * 提示词对应的容器 id(2026-12-04):复制后跳转会话页需要它。
+   * 云函数返回 `agentId`(FmodeAgent objectId),原实现丢弃了,现在保存下来。
+   */
+  private readonly _instructionAgentId = signal<string | null>(null);
+  readonly instructionAgentId = this._instructionAgentId.asReadonly();
+
+  /** 收起提示词(已试用账号在套餐页切换显示用) */
+  clearInstruction(): void { this._instruction.set(null); }
   private readonly _restoring = signal(false);
   private readonly _recoveryFailed = signal(false);
   readonly restoring = this._restoring.asReadonly();
@@ -334,6 +344,7 @@ export class ProvisionService {
       if (!d) return null;
       if (d.mode === 'onboarding' && d.instruction) {
         this._instruction.set(d.instruction);
+        if (d.agentId) this._instructionAgentId.set(d.agentId);
         return { mode: 'onboarding', instruction: d.instruction };
       }
       return { mode: 'expired' };
@@ -427,6 +438,7 @@ export class ProvisionService {
 
       if (result.mode === 'onboarding') {
         this._instruction.set(result.instruction ?? result.message ?? '');
+        if (result.agentId) this._instructionAgentId.set(result.agentId);
         this._current.set(null);
         this.clearPendingStart();
         this._recoveryFailed.set(false);

+ 37 - 10
src/app/desktop/pages/plans/plans.ts

@@ -118,7 +118,7 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
         </section>
       } @else if (provision.instruction(); as ins) {
         <!-- 试用/入门:接入提示词(组件内含复制 + 失败兜底) -->
-        <app-provision-instruction [text]="ins" />
+        <app-provision-instruction [text]="ins" (copiedOut)="afterCopy()" />
       } @else {
         <section class="plans-banner">
           <div class="plans-banner-icon">
@@ -128,12 +128,20 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
             <h2>先体验,再决定。<span>两天试用</span></h2>
             <p>用你自己的 Hermes 接入 Fmode:<b>本机直接安装</b>或 <b>Docker 容器</b>均可</p>
           </div>
-          <button type="button" class="plans-banner-btn" [disabled]="provision.startBlocked() || trialUsed()" (click)="apply('trial')">
+          <!--
+            试用按钮(2026-12-04):未试用 → 开始试用;已试用 → 查看/收起接入提示词。
+            提示词**点击后才展开**,避免「登录就直接看到提示词」的困惑。
+          -->
+          <button type="button" class="plans-banner-btn"
+            [disabled]="provision.startBlocked()"
+            (click)="trialUsed() ? toggleTrialInstruction() : apply('trial')">
             @if (provision.isStarting('trial')) {
               <i class="fa-solid fa-circle-notch fa-spin" aria-hidden="true"></i>
               生成中…
+            } @else if (trialUsed()) {
+              {{ loadingInstruction() ? '加载中…' : (provision.instruction() ? '收起接入提示词' : '查看接入提示词') }}
             } @else {
-              {{ trialUsed() ? '已使用过试用' : '开始两天试用' }}
+              开始两天试用
             }
           </button>
         </section>
@@ -821,14 +829,9 @@ export class DkPlansPage implements OnInit {
     void this.provision.restorePending();
 
     /*
-     * 已试用过的账号:自动把提示词拉回来(2026-12-04 用户反馈「没复制就刷新,再也看不到」)。
-     * 拉不到(无记录/网络失败)不提示错误,界面保持原样。
+     * 提示词**不再自动拉回**(2026-12-04 用户反馈「登录就直接显示提示词」)。
+     * 已试用过的账号只显示「查看接入提示词」按钮,用户点了才展开。
      */
-    if (!this.provision.instruction()) {
-      void this.live.ensureLoaded().then(() => {
-        if (this.trialUsed() && !this.provision.instruction()) void this.provision.loadInstruction();
-      });
-    }
     /*
      * 配额预检与重名校验都依赖容器列表(2026-12-03):
      * /plans 是顶层路由不在 shell 内,没人替本页拉 live,
@@ -843,6 +846,30 @@ export class DkPlansPage implements OnInit {
    * 判据:名下任一容器 planCode 属于付费档(starter/advanced/enterprise)。
    * 试用不算「已有套餐」——试用是体验,不是订阅。
    */
+  /**
+   * 复制提示词后进入会话页(2026-12-04 用户裁决)。
+   * 没接入前会话页是空的,但用户需要在这里看到「下一步怎么操作」的引导。
+   */
+  protected afterCopy(): void {
+    const id = this.provision.instructionAgentId();
+    if (!id) return;
+    void this.router.navigateByUrl(`/desktop/chat/${encodeURIComponent(id)}/new`);
+  }
+
+  /** 正在拉取接入提示词(按钮显示「加载中…」) */
+  protected readonly loadingInstruction = signal(false);
+
+  /**
+   * 已试用账号:展开 / 收起接入提示词(2026-12-04)。
+   * 首次点击才向服务端取回,之后在本地状态里切换。
+   */
+  protected async toggleTrialInstruction(): Promise<void> {
+    if (this.provision.instruction()) { this.provision.clearInstruction(); return; }
+    this.loadingInstruction.set(true);
+    try { await this.provision.loadInstruction(); }
+    finally { this.loadingInstruction.set(false); }
+  }
+
   protected readonly hasPaidPlan = computed(() =>
     this.live.agents().some((a) => a.planCode === 'starter' || a.planCode === 'advanced' || a.planCode === 'enterprise'),
   );

+ 23 - 10
src/app/mobile/pages/plans/plans.ts

@@ -75,7 +75,7 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
           用户手上正在复制的参数就没了。两者本来就可以同时存在。
         -->
         @if (provision.instruction(); as ins) {
-          <app-provision-instruction [text]="ins" />
+          <app-provision-instruction [text]="ins" (copiedOut)="afterCopy()" />
         }
 
         <!-- 开通进行中:显示真实状态 -->
@@ -110,12 +110,12 @@ import { suggestContainerName } from '../../../components/domain/provision-confi
               <h2>先体验,再决定<span>两天试用</span></h2>
               <p>用你自己的 Hermes 接入 Fmode:<b>本机直接安装</b>或 <b>Docker 容器</b>均可</p>
             </div>
-            <button type="button" class="plans-trial-btn" (click)="apply('trial')" [disabled]="provision.startBlocked() || trialUsed()">
+            <button type="button" class="plans-trial-btn" (click)="trialUsed() ? toggleTrialInstruction() : apply('trial')" [disabled]="provision.startBlocked()">
               @if (provision.isStarting('trial')) {
                 <i class="fa-solid fa-circle-notch fa-spin" aria-hidden="true"></i>
                 生成中…
               } @else {
-                {{ trialUsed() ? '已使用过试用' : '开始试用' }}
+                {{ trialUsed() ? (loadingInstruction() ? '加载中…' : (provision.instruction() ? '收起接入提示词' : '查看接入提示词')) : '开始试用' }}
               }
             </button>
           </section>
@@ -755,14 +755,9 @@ export class MbPlansPage implements OnInit {
     void this.provision.restorePending();
 
     /*
-     * 已试用过的账号:自动把提示词拉回来(2026-12-04 用户反馈「没复制就刷新,再也看不到」)。
-     * 拉不到(无记录/网络失败)不提示错误,界面保持原样。
+     * 提示词**不再自动拉回**(2026-12-04 用户反馈「登录就直接显示提示词」)。
+     * 已试用过的账号只显示「查看接入提示词」按钮,用户点了才展开。
      */
-    if (!this.provision.instruction()) {
-      void this.live.ensureLoaded().then(() => {
-        if (this.trialUsed() && !this.provision.instruction()) void this.provision.loadInstruction();
-      });
-    }
     /*
      * 配额预检与重名校验都依赖容器列表(2026-12-03):
      * /plans 是顶层路由不在 shell 内,没人替本页拉 live,
@@ -776,6 +771,24 @@ export class MbPlansPage implements OnInit {
 
   /** 付费三档(试用单独走横幅) */
   /** 是否已有付费套餐(2026-12-03):决定按钮文案「开通 / 续费」;试用不算 */
+  /** 正在拉取接入提示词 */
+  protected readonly loadingInstruction = signal(false);
+
+  /** 已试用账号:展开 / 收起接入提示词(2026-12-04) */
+  protected async toggleTrialInstruction(): Promise<void> {
+    if (this.provision.instruction()) { this.provision.clearInstruction(); return; }
+    this.loadingInstruction.set(true);
+    try { await this.provision.loadInstruction(); }
+    finally { this.loadingInstruction.set(false); }
+  }
+
+  /** 复制提示词后进入会话页(2026-12-04) */
+  protected afterCopy(): void {
+    const id = this.provision.instructionAgentId();
+    if (!id) return;
+    void this.router.navigateByUrl(`/mobile/chat/${encodeURIComponent(id)}/new`);
+  }
+
   protected readonly hasPaidPlan = computed(() =>
     this.live.agents().some((a) => a.planCode === 'starter' || a.planCode === 'advanced' || a.planCode === 'enterprise'),
   );