dsh-plugin-t-expert 0.3.45 → 0.3.46

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/lib/client.js CHANGED
@@ -20018,7 +20018,7 @@ var scheduleWorkspaceSchema = external_exports.object({
20018
20018
 
20019
20019
  // src/client.jsx
20020
20020
  var NS = "t-team";
20021
- var CLIENT_BUILD_VERSION = "0.3.45";
20021
+ var CLIENT_BUILD_VERSION = "0.3.46";
20022
20022
  var uiPrefs = { showTaskBadge: true, showScheduleButton: true, showActivePulse: true };
20023
20023
  var UI_PREF_KEYS = Object.keys(uiPrefs);
20024
20024
  var uiPrefsListeners = /* @__PURE__ */ new Set();
package/lib/index.js CHANGED
@@ -160,6 +160,12 @@ export const UNKNOWN_SLUG_ERROR_CODE = "tTeam/unknown-slug";
160
160
 
161
161
  const settingsSchema = schema.object({
162
162
  enabled: schema.array(schema.string()).default([]),
163
+ /**
164
+ * 首次运行是否已把「默认全部启用」写进 enabled。见 seedDefaultEnabled:
165
+ * 只在「从未播种且名单为空」时把全部可用 slug 写一次,之后用户手动启用/禁用就不再动 ——
166
+ * 这样默认是「全启用」,但用户显式清空也绝不会被下次启动覆盖。
167
+ */
168
+ enabledSeeded: schema.boolean().default(false),
163
169
  /** 是否自动显示右上角的任务徽章(界面偏好,关掉后只在输入区浮层里手动查看)。 */
164
170
  showTaskBadge: schema.boolean().default(true),
165
171
  /**
@@ -404,7 +410,7 @@ export function apply(ctx, config) {
404
410
  return;
405
411
  }
406
412
  scope = settingsService.register(SETTINGS_NAMESPACE, settingsSchema, {
407
- base: { enabled: [], showTaskBadge: true, showScheduleButton: true, showActivePulse: true },
413
+ base: { enabled: [], enabledSeeded: false, showTaskBadge: true, showScheduleButton: true, showActivePulse: true },
408
414
  applies: "live",
409
415
  validate: (value) => {
410
416
  const list = value?.enabled;
@@ -533,6 +539,7 @@ export function apply(ctx, config) {
533
539
  }
534
540
  if (loadError !== null) throw loadError;
535
541
  await pruneStaleEnabled();
542
+ await seedDefaultEnabled();
536
543
  }
537
544
  /**
538
545
  * 清掉设置里**名册已不存在**的 slug(C-6)。
@@ -563,6 +570,33 @@ export function apply(ctx, config) {
563
570
  ctx.logger?.warn?.(`[t-team] 启用列表里的失效 slug 未能清理:${String(error)}`);
564
571
  }
565
572
  }
573
+ /**
574
+ * 首次运行把「默认全部启用」落到 enabled 名单上。
575
+ *
576
+ * enabled 是白名单,缺省 [] 本意是"一个都没启用",但这让新装用户得逐个开关 323 个专家。
577
+ * 改成"默认全启用"后,又不能简单地"enabled 为空就回填"——那样用户以后想清空(逐个关掉)
578
+ * 会被每次启动覆盖。所以用 sentinel 键 enabledSeeded 标记"已播种":
579
+ * 只在「从未播种 且 名单为空」时把全部可用 slug 写一次;名单非空说明用户已手动启用过,只补标记。
580
+ */
581
+ async function seedDefaultEnabled() {
582
+ if (settingsService === undefined) return;
583
+ const state = scope?.get?.();
584
+ if (state === undefined || state.enabledSeeded === true) return;
585
+ const current = (state.enabled ?? []).filter((value) => typeof value === "string");
586
+ // 名单非空 = 用户已经手动启用过:不再覆盖,只补 sentinel。
587
+ const nextEnabled = current.length > 0 ? current : usable().map((expert) => expert.slug);
588
+ if (nextEnabled.length === 0) return; // 名册残缺(既无名单也无专家),别乱写
589
+ try {
590
+ await settingsService.mutate(SETTINGS_NAMESPACE, [
591
+ { op: "set", path: ["enabled"], value: nextEnabled },
592
+ { op: "set", path: ["enabledSeeded"], value: true },
593
+ ], revision());
594
+ if (current.length === 0) ctx.logger?.info?.("[t-team] 首次运行:已默认启用全部专家");
595
+ } catch (error) {
596
+ // 写不进(并发 / 服务暂不可用)不致命:下次 ensureReady 还会再试。
597
+ ctx.logger?.warn?.(`[t-team] 默认启用全部专家写入失败:${String(error)}`);
598
+ }
599
+ }
566
600
  /** 可召唤/可展示的专家(排除重名冲突项)。 */
567
601
  const usable = () => entries.filter((expert) => expert.conflict !== true);
568
602
 
@@ -1922,7 +1956,7 @@ export function apply(ctx, config) {
1922
1956
  return [
1923
1957
  "## T专家 (T Expert) expert mode",
1924
1958
  scope,
1925
- "Experts are individually enabled/disabled in the T专家 settings tab; ALL are disabled by default and a disabled expert cannot be summoned.",
1959
+ "Experts are individually enabled/disabled in the T专家 settings tab; all experts are enabled by default and a disabled expert cannot be summoned.",
1926
1960
  "A composer selection inserts one enabled expert as a native reference chip; the remaining draft text is that expert's task.",
1927
1961
  `In the parent session, call \`list_t_experts()\` for enabled division names and counts, then \`list_t_experts(division)\` to pick a unique expert name, then \`summon_t_expert(expert, task)\` — or \`summon_t_experts\` for a small parallel team (at most ${config.maxSummonBatch}; partial results when some fail).`,
1928
1962
  "For a long multi-step goal that needs a durable team (members, tasks with dependencies, review gates), the user can run a T专家 squad with the `/t <squad> <goal>` slash command (squad names and aliases come from the plugin's squad definitions; plain `/t` lists them); it activates the built-in T专家 team engine with a squad whose members already carry the experts' personas. Do not invent squad names when `/t` is available.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-t-expert",
3
- "version": "0.3.45",
3
+ "version": "0.3.46",
4
4
  "type": "module",
5
5
  "description": "T Expert — a 323-expert, 22-division roster with full Chinese translations, as a standalone DeepSeek Harness plugin, with a built-in multi-agent team engine (T Team).",
6
6
  "license": "MIT",