pi-scenes 0.10.0 → 0.11.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 +10 -0
- package/extensions/scenes.ts +34 -14
- package/package.json +36 -36
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ active resources = common layer ∪ current scene
|
|
|
21
21
|
- **Scene layers** — per-scenario bundles (coding / office / writing…), loaded only while active
|
|
22
22
|
- **Project-scoped by default (v0.7)** — `/scene office` writes activation entries to `<cwd>/.pi/settings.json`, so a scene belongs to *this* directory only; opening a fresh directory starts clean. `--global` keeps the ≤0.6 all-projects behavior
|
|
23
23
|
- **Asset/activation split (v0.7)** — packages are installed once globally and shared across projects; git skill bundles are pinned as zero-exposure *anchors* (`{source, autoload:false, skills:[]}`) in user settings, while the project layer writes a *delta* (`{source, autoload:false, skills:[...]}`) that enables just the scene's whitelist — one clone, per-project curation, via pi's native delta mechanism
|
|
24
|
+
- **Full spatial isolation for scene packages (v0.11)** — *every* scene package (plain `npm:` specs included, not just filtered git bundles) now lands in the project layer as a universal delta (`{source, autoload:false, skills:["**"], extensions:["**"], ...}`) with a zero-exposure global anchor — one shared install, zero disk duplication, and a fresh directory loads **only the common layer**. Fixes the v0.7-v0.10 behavior where plain npm scene packages leaked into global settings and loaded in every project while the scene was active. Re-activating an existing scene migrates the leaked entries automatically (borrow semantics for user-configured globals is preserved)
|
|
24
25
|
- **Scene-scoped prompt templates (v0.8)** — each scene can also bundle workflow templates (`prompts` field): fixed checklists that pin down step-by-step procedures so the model can't take shortcuts. Scene = **tools + skills + workflow templates** as one unit
|
|
25
26
|
- Switching rewrites `packages`/`skills` in `settings.json`, then `ctx.reload()` hot-reloads — **no pi restart, session untouched**; prompt templates take a different path: injected via pi's `resources_discover` event with **zero settings writes**
|
|
26
27
|
- Every switch stamps a persistent **status-bar badge** (`◆ coding`, or a per-scene `icon` like `💻 coding`) so the bar always answers *"which scene am I in"* — restored at session start, cleared by `/scene off`
|
|
@@ -265,6 +266,10 @@ Before uninstalling, `/scene off` and prune entries you don't want to keep from
|
|
|
265
266
|
|
|
266
267
|
## Changelog
|
|
267
268
|
|
|
269
|
+
### v0.11.0 (2026-09-24)
|
|
270
|
+
|
|
271
|
+
- **Full spatial isolation for scene packages** — plain `npm:` scene packages now land in the *project* layer as a universal delta (`{source, autoload:false, skills:["**"], extensions:["**"], prompts:["**"], themes:["**"]}`) with a zero-exposure global anchor, exactly like filtered git bundles since v0.7. One shared install (no per-project node_modules), and a fresh directory now loads **only the common layer**. Fixes the v0.7–v0.10 leak where scene npm packages sat in global settings and loaded in *every* project while the scene was active somewhere. Re-activating an existing scene migrates leaked entries automatically; user-configured global packages keep borrowed semantics
|
|
272
|
+
|
|
268
273
|
### v0.10.0 (2026-09-23)
|
|
269
274
|
|
|
270
275
|
- **Vendored asset fingerprints + safe updates** — preset templates/skills copied to `~/.pi/agent/scenes/` now record a content-hash baseline (`.assets-manifest.json`). New `/scene update-assets` command syncs package assets to your disk: **untouched files follow new package versions; files you edited are kept yours** (listed as conflicts); presets removed from the package are reported but never auto-deleted. Closes the "npm updates don't update vendored assets" gap — ownership transfer no longer means losing updates
|
|
@@ -319,6 +324,7 @@ pi 的 `packages` / `skills` 是全局平铺的:所有已安装扩展、所有
|
|
|
319
324
|
- **场景层**:每个场景自己的一组 extension + skill,激活才加载
|
|
320
325
|
- **默认项目级(v0.7)**——`/scene office` 把激活条目写进 `<cwd>/.pi/settings.json`,场景只属于当前目录;新建目录零残留、干净启动。`--global` 保留 ≤0.6 的全目录生效语义
|
|
321
326
|
- **资产/激活分离(v0.7)**——包只全局装一份、所有项目共享;git 技能包在全局层钉为零暴露**锚点**(`{source, autoload:false, skills:[]}`),项目层写 **delta**(`{source, autoload:false, skills:[白名单]}`)按场景启用——借 pi 原生 delta 机制做到「一份克隆、每项目各自的精选」
|
|
327
|
+
- **场景包全面空间隔离(v0.11)**——所有场景包(含裸 `npm:` 串,不再限于带白名单的 git 包)统一落项目层通用 delta(`{source, autoload:false, skills:["**"], extensions:["**"], ...}`)+ 全局零暴露锚点——共享一份安装、零磁盘复制,新目录只加载通用层。修复 v0.7~v0.10 裸 npm 场景包泄漏到全局 settings、场景激活期间所有项目都加载的问题;存量泄漏在重新激活场景时自动迁移修复(用户手配的全局同包仍保持借用语义)
|
|
322
328
|
- **场景化 prompt 模板(v0.8)**——每个场景可携带流程模板(`prompts` 字段):把固定流程的步骤清单固化成 `/命令`,模型无法挑最快路径跳步。场景成为**工具 + 技能 + 流程模板**三位一体
|
|
323
329
|
- 切换 = 改写 `settings.json` 的 `packages`/`skills` → `ctx.reload()` 热重载,**无需重启 pi**;prompt 模板走另一条路:经 pi 的 `resources_discover` 事件动态注入,**零 settings 写入**
|
|
324
330
|
- 每次切换成功后状态栏常驻**场景徽标**(`◆ coding`,或每场景自定义 `icon` 如 `💻 coding`),状态栏随时回答「我现在在哪个场景」——会话启动自动恢复,`/scene off` 清除
|
|
@@ -556,6 +562,10 @@ managed 注入的条目在卸载前建议先 `/scene off` + 手工清理 `packag
|
|
|
556
562
|
|
|
557
563
|
## 版本历史
|
|
558
564
|
|
|
565
|
+
### v0.11.0(2026-09-24)
|
|
566
|
+
|
|
567
|
+
- **场景包全面空间隔离**——裸 `npm:` 场景包与 v0.7 起的 git 白名单包同等待遇:统一落项目层通用 delta(`{source, autoload:false, skills:["**"], extensions:["**"], prompts:["**"], themes:["**"]}`)+ 全局零暴露锚点。共享一份全局安装(零磁盘复制),新目录只加载**通用层**。修复 v0.7~v0.10 期间裸 npm 场景包写入全局 settings、场景激活期间所有项目都加载的泄漏;重新激活场景即自动迁移修复,用户手配的全局同包保持借用语义
|
|
568
|
+
|
|
559
569
|
### v0.10.0(2026-09-23)
|
|
560
570
|
|
|
561
571
|
- **vendored 资产指纹 + 安全更新**——预置模板/skill 复制到 `~/.pi/agent/scenes/` 时记录内容指纹基线(`.assets-manifest.json`)。新增 `/scene update-assets` 命令同步包内资产到落盘:**你未修改的跟随包新版,你改过的保留你的版本**(列为冲突清单),包内已删除的预设仅提示不自动删。补上「npm 更新不更新 vendored 资产」的缺口——所有权移交不再等于更新断绝
|
package/extensions/scenes.ts
CHANGED
|
@@ -546,16 +546,20 @@ export function makeCore(baseDir: string, projectDir?: string) {
|
|
|
546
546
|
function computeTarget(
|
|
547
547
|
active: string | null,
|
|
548
548
|
cfg: ScenesFile,
|
|
549
|
-
): { packages: PackageEntry[]; skills: string[]; commonSkills: string[]; sceneSkills: string[]; prompts: string[] } {
|
|
549
|
+
): { packages: PackageEntry[]; commonPackages: PackageEntry[]; scenePackages: PackageEntry[]; skills: string[]; commonSkills: string[]; sceneSkills: string[]; prompts: string[] } {
|
|
550
550
|
const common = cfg.common ?? {};
|
|
551
551
|
let scene: SceneDef = {};
|
|
552
552
|
if (active) scene = resolveScene(active, cfg);
|
|
553
|
-
|
|
553
|
+
// v0.9 空间隔离:拆分归属——与通用层同身份的场景包归通用层(常驻语义优先,防双层重复)
|
|
554
|
+
const commonPackages = dedupeEntries([...(common.packages ?? [])]);
|
|
555
|
+
const scenePackagesAll = dedupeEntries([...(scene.packages ?? [])]);
|
|
556
|
+
const scenePackages = scenePackagesAll.filter((e) => !commonPackages.some((c) => sameResource(c, e)));
|
|
557
|
+
const packages = dedupeByIdentity(dedupeEntries([...commonPackages, ...scenePackagesAll]));
|
|
554
558
|
const commonSkills = [...new Set([...(common.skills ?? [])].map(expandHome))];
|
|
555
559
|
const sceneSkills = [...new Set([...(scene.skills ?? [])].map(expandHome))];
|
|
556
560
|
const skills = [...new Set([...commonSkills, ...sceneSkills])];
|
|
557
561
|
const prompts = [...new Set([...(common.prompts ?? []), ...(scene.prompts ?? [])].map(expandHome))];
|
|
558
|
-
return { packages, skills, commonSkills, sceneSkills, prompts };
|
|
562
|
+
return { packages, commonPackages, scenePackages, skills, commonSkills, sceneSkills, prompts };
|
|
559
563
|
}
|
|
560
564
|
|
|
561
565
|
/** 包是否已安装(探测 npm 目录 / git clone 目录 / 本地路径) */
|
|
@@ -680,8 +684,33 @@ export function makeCore(baseDir: string, projectDir?: string) {
|
|
|
680
684
|
const newProjManagedPkgs: PackageEntry[] = [];
|
|
681
685
|
for (const raw of target.packages) {
|
|
682
686
|
// 项目模式下 filtered 条目 → delta 形态(autoload:false 复用全局克隆 + 白名单启用)
|
|
683
|
-
|
|
684
|
-
|
|
687
|
+
// v0.9 空间隔离:项目模式下场景包(含裸 npm 串)一律落项目层 delta,全局层只留零暴露锚点。
|
|
688
|
+
// 裸 spec → 通用 delta(** 通配全启用):复用 delta+锚点机制共享全局安装(零磁盘复制、零重复加载),
|
|
689
|
+
// 加载仅在本项目生效 —— 新目录只见通用层,场景包不再串场。
|
|
690
|
+
const isCommon = (target.commonPackages ?? []).some((c) => sameResource(c, raw));
|
|
691
|
+
const landed = useProject && !isCommon;
|
|
692
|
+
const e: PackageEntry = landed
|
|
693
|
+
? isFilteredEntry(raw)
|
|
694
|
+
? { ...(raw as Record<string, unknown>), autoload: false }
|
|
695
|
+
: { source: specOf(raw), autoload: false, skills: ["**"], extensions: ["**"], prompts: ["**"], themes: ["**"] }
|
|
696
|
+
: raw;
|
|
697
|
+
if (landed) {
|
|
698
|
+
// 用户先前手配的同包全局条目(摘旧后仍在 = 非本次 pi install 写入、非旧版 managed 遗留)
|
|
699
|
+
// → 借用语义:全局已覆盖所有项目,不落项目 delta、不加锚点
|
|
700
|
+
const preUserList = preInstallPackages ?? oldUserPkgs;
|
|
701
|
+
const inCurrentUser = userPkgs.some((x) => sameResource(x, raw));
|
|
702
|
+
const userOwn = inCurrentUser && preUserList.some((x) => sameResource(x, raw));
|
|
703
|
+
if (userOwn) {
|
|
704
|
+
result.borrowedPackages.push(raw);
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (inCurrentUser) userPkgs = userPkgs.filter((x) => !sameResource(x, raw)); // 摘 pi install 刚写入的裸串
|
|
708
|
+
const anchor: PackageEntry = { source: specOf(raw), autoload: false, skills: [] };
|
|
709
|
+
if (!anchors.some((a) => sameResource(a, anchor))) {
|
|
710
|
+
userPkgs.push(anchor);
|
|
711
|
+
anchors.push(anchor);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
685
714
|
let pkgsRef = landed ? projPkgs : userPkgs;
|
|
686
715
|
const sink = landed ? newProjManagedPkgs : newUserManagedPkgs;
|
|
687
716
|
const preList = preInstallPackages ?? (landed ? oldProjPkgs : oldUserPkgs);
|
|
@@ -718,15 +747,6 @@ export function makeCore(baseDir: string, projectDir?: string) {
|
|
|
718
747
|
sink.push(e);
|
|
719
748
|
result.addedPackages.push(e);
|
|
720
749
|
}
|
|
721
|
-
// 项目层 delta 落地 → 全局层确保资产锚点(零暴露 + 共享全局克隆的 delta base)
|
|
722
|
-
if (landed) {
|
|
723
|
-
const anchor: PackageEntry = { source: specOf(raw), autoload: false, skills: [] };
|
|
724
|
-
const anchored = userPkgs.some((x) => sameResource(x, raw)) || anchors.some((a) => sameResource(a, anchor));
|
|
725
|
-
if (!anchored) {
|
|
726
|
-
userPkgs.push(anchor);
|
|
727
|
-
anchors.push(anchor);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
750
|
}
|
|
731
751
|
|
|
732
752
|
// skills 按层落点:场景 scaffold 目录(项目模式)映射为项目相对路径 + 幂等复制 vendor
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
2
|
+
"name": "pi-scenes",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "Scene switcher for pi: bundle extensions, skills, and prompt templates into a common layer + per-scene layers. /scene hot-switches with live reload (project-scoped, zero settings residue); scene-scoped workflow templates arrive via resources_discover with no config writes; scene definitions self-evolve from real usage (tool-call attribution + session-end LLM reflection).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Feng-H",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/Feng-H/pi-scenes.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Feng-H/pi-scenes/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/Feng-H/pi-scenes#readme",
|
|
19
|
+
"files": [
|
|
20
|
+
"extensions",
|
|
21
|
+
"assets",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "node --test test/"
|
|
27
|
+
},
|
|
28
|
+
"pi": {
|
|
29
|
+
"extensions": [
|
|
30
|
+
"./extensions"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
35
|
+
"@earendil-works/pi-ai": "*"
|
|
36
|
+
}
|
|
37
|
+
}
|