pi-scenes 0.2.2 → 0.3.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 CHANGED
@@ -91,6 +91,18 @@ Edit it to fit your setup (each scene also gets a skill dir scaffold at `~/.pi/a
91
91
 
92
92
  Drop `SKILL.md` folders (or `.md` files) into a scene's skill directory; the whole directory toggles with the scene. `/scene init` scaffolds `~/.pi/agent/scenes/{common,coding,office,pm,research,writing,data}/skills/`.
93
93
 
94
+ ### Status-bar scene badge
95
+
96
+ A successful switch sets a persistent footer badge (`◆ coding`), restored automatically at every session start and cleared by `/scene off`. The status bar should answer *"which scene am I in"* — not display tool internals.
97
+
98
+ Scenes often bundle tool-heavy extensions whose own footer output crowds the bar. If you use the preset `coding` scene, pi-lens's diagnostics widget and `LSP Inactive` status can be silenced **without losing any AI-side value** (turn-end error injection, `lens_diagnostics`, symbol navigation) via `~/.pi-lens/config.json`:
99
+
100
+ ```json
101
+ { "ui": { "hideLspStatus": true }, "widget": { "visible": false } }
102
+ ```
103
+
104
+ pi-scenes never edits a third-party package's global config — the badge stays the only thing pi-scenes itself puts on your status bar.
105
+
94
106
  ## Self-evolution (usage-driven)
95
107
 
96
108
  Scenes are not static. pi-scenes observes what you actually use and proposes updates:
@@ -273,6 +285,18 @@ pi install git:github.com/Feng-H/pi-scenes
273
285
  场景 skill 目录里放 `SKILL.md` 文件夹(或 `.md` 文件)即可,切换场景时整目录启停。
274
286
  `/scene init` 会创建 `~/.pi/agent/scenes/{common,coding,office,pm,research,writing,data}/skills/` 骨架。
275
287
 
288
+ ### 状态栏场景徽标
289
+
290
+ 切换成功后状态栏常驻徽标(`◆ coding`),每次会话启动自动恢复,`/scene off` 清除。状态栏应该回答「我现在在哪个场景」——而不是展示工具的内部状态。
291
+
292
+ 场景常打包工具型扩展,它们自己的 footer 输出会把状态栏拼得很吵。若使用预设 `coding` 场景,pi-lens 的诊断 widget 与 `LSP Inactive` 状态可在**不损失任何 AI 侧价值**(turn-end 错误注入、`lens_diagnostics`、符号导航)的前提下静音,写入 `~/.pi-lens/config.json`:
293
+
294
+ ```json
295
+ { "ui": { "hideLspStatus": true }, "widget": { "visible": false } }
296
+ ```
297
+
298
+ pi-scenes 绝不改第三方包的全局配置——徽标是它放到状态栏上的唯一东西。
299
+
276
300
  ## 自进化(用量驱动)
277
301
 
278
302
  场景不是静态的。pi-scenes 观察你的实际使用并提议更新:
@@ -870,6 +870,27 @@ export default function (pi: ExtensionAPI) {
870
870
  const baseDir = process.env.PI_SCENES_DIR || path.join(os.homedir(), ".pi", "agent");
871
871
  const core = makeCore(baseDir);
872
872
 
873
+ /**
874
+ * 状态栏常驻场景徽标(◆ <场景名>):切换后用户始终知道自己在哪个场景。
875
+ * 设计动机:场景切换器在界面上只弹一次 notify 就消失了,用户无从得知当前场景;
876
+ * 而场景附带的工具型扩展(如 pi-lens)的状态栏内脏反而在抢占视觉 ——
877
+ * 状态栏应该回答“我在哪”,而不是“工具的内部状态”。
878
+ * off(仅通用层)时清除;session_start 时幂等重放(重启 pi 后恢复)。
879
+ */
880
+ function updateSceneBadge(ctx: any): void {
881
+ try {
882
+ const ui = ctx?.ui;
883
+ if (!ui || typeof ui.setStatus !== "function") return;
884
+ const active = core.loadState().active;
885
+ if (active) {
886
+ const text = `◆ ${active}`;
887
+ ui.setStatus("pi-scene", ui.theme?.fg ? ui.theme.fg("accent", text) : text);
888
+ } else {
889
+ ui.setStatus("pi-scene", undefined);
890
+ }
891
+ } catch {}
892
+ }
893
+
873
894
  /** 执行切换(name=null 表示仅通用层) */
874
895
  async function doSwitch(ctx: any, name: string | null): Promise<void> {
875
896
  const cfg = core.loadScenes();
@@ -938,6 +959,7 @@ export default function (pi: ExtensionAPI) {
938
959
  }
939
960
 
940
961
  const r = core.applyToSettings(target, name, preInstallPackages);
962
+ updateSceneBadge(ctx);
941
963
  ctx.ui.notify(
942
964
  `已切换到 ${label}\n +${r.addedPackages.length} 包 +${r.addedSkills.length} skill · -${r.removedPackages.length} 包 -${r.removedSkills.length} skill\n 正在热重载…`,
943
965
  "info",
@@ -1215,6 +1237,7 @@ export default function (pi: ExtensionAPI) {
1215
1237
  const pkgs = readJson<Record<string, unknown>>(core.paths.settingsFile, {}).packages;
1216
1238
  core.beginSession(ctx.sessionManager?.getSessionFile?.() ?? null, Array.isArray(pkgs) ? (pkgs as PackageEntry[]) : []);
1217
1239
  } catch {}
1240
+ updateSceneBadge(ctx);
1218
1241
  });
1219
1242
 
1220
1243
  pi.on("tool_call", async (event) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-scenes",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "pi 扩展:场景切换器 + 资源自进化。通用层+分场景层打包 extension/skill,/scene 热切换;按实际用量(工具调用归因 + 会话结束 LLM 反思)生成吸收/淘汰提案,让场景定义随使用习惯进化。",
5
5
  "keywords": [
6
6
  "pi-package"