@herbertgao/pi-extensions 2026.11.16 → 2026.11.18

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.
Files changed (23) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/node_modules/@herbertgao/pi-agency/CHANGELOG.md +6 -0
  3. package/node_modules/@herbertgao/pi-agency/README.md +3 -1
  4. package/node_modules/@herbertgao/pi-agency/package.json +1 -1
  5. package/node_modules/@herbertgao/pi-agency/src/index.ts +151 -9
  6. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +12 -0
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +7 -0
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/agent-badge.ts +244 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +1 -1
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -3
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +25 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/package.json +1 -1
  13. package/node_modules/@herbertgao/pi-inline-skill-commands/README.md +18 -0
  14. package/node_modules/@herbertgao/pi-inline-skill-commands/package.json +1 -1
  15. package/node_modules/@herbertgao/pi-inline-skill-commands/src/index.ts +80 -0
  16. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +12 -0
  17. package/node_modules/@herbertgao/pi-subagents/docs/rpc.md +13 -1
  18. package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
  19. package/node_modules/@herbertgao/pi-subagents/src/agent-color.ts +6 -2
  20. package/node_modules/@herbertgao/pi-subagents/src/agent-types.ts +87 -1
  21. package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +142 -2
  22. package/node_modules/@herbertgao/pi-subagents/src/index.ts +33 -3
  23. package/package.json +8 -8
@@ -54,6 +54,7 @@ import {
54
54
  steerAgent,
55
55
  } from "./agent-runner.js"
56
56
  import {
57
+ clearEphemeralAgents,
57
58
  formatAgentTypeList,
58
59
  getAgentConfig,
59
60
  getAvailableTypes,
@@ -616,9 +617,31 @@ export default function (pi: ExtensionAPI) {
616
617
  seedProjectTrust(process.cwd())
617
618
 
618
619
  /** Reload agents from package/global/project agent dirs and merge with defaults (called on init and each Agent invocation). */
620
+ /** Current session context; undefined outside a session (also gates the
621
+ * agents-changed emit above to active sessions). */
622
+ let currentCtx: ExtensionContext | undefined
623
+
619
624
  const reloadCustomAgents = (strict = false) => {
625
+ // The before/after comparison feeds subagents:agents-changed, so badge
626
+ // holders re-pull exactly when the spawnable set actually changed. Gated
627
+ // on an active session: the factory-time first load always "changes" the
628
+ // set (defaults → defaults+files) and would fire a pull nobody can answer
629
+ // yet; session_start's own reload runs after currentCtx is set and still
630
+ // announces anything that changed since.
631
+ // Signature covers name, displayName and color: a color-only edit to a
632
+ // file-backed agent is a real change for badge holders, not just a rename.
633
+ const signature = () =>
634
+ getAvailableTypes()
635
+ .map((type) => {
636
+ const config = getConfig(type)
637
+ return `${type}|${config.displayName}|${config.color ?? ""}`
638
+ })
639
+ .join(",")
640
+ const before = signature()
620
641
  const userAgents = loadCustomAgents(process.cwd(), strict)
621
642
  registerAgents(userAgents)
643
+ if (currentCtx !== undefined && signature() !== before)
644
+ pi.events.emit("subagents:agents-changed", {})
622
645
  }
623
646
 
624
647
  // Initial load — the only strict one. A bad edit mid-session must not kill the
@@ -1102,7 +1125,6 @@ export default function (pi: ExtensionAPI) {
1102
1125
  }
1103
1126
 
1104
1127
  // --- Cross-extension RPC via pi.events ---
1105
- let currentCtx: ExtensionContext | undefined
1106
1128
  // RPC handlers + the `subagents:ready` broadcast are wired on `session_start`
1107
1129
  // (a bound lifecycle event), not at factory time. pi runs every extension
1108
1130
  // factory before the `extensions:` filter and only fires lifecycle events for
@@ -1151,6 +1173,10 @@ export default function (pi: ExtensionAPI) {
1151
1173
  // resumed session all land here, and any of them may follow a `pi install`
1152
1174
  // that added a package the cached root list predates.
1153
1175
  invalidatePackageCache()
1176
+ // Ephemeral types live for the current session only: a new or resumed
1177
+ // session starts clean, so a persona's registration never outlives the
1178
+ // run that seated it.
1179
+ clearEphemeralAgents()
1154
1180
  reloadCustomAgents()
1155
1181
  if (ctx.hasUI) {
1156
1182
  widget.setUICtx(ctx.ui)
@@ -1164,6 +1190,7 @@ export default function (pi: ExtensionAPI) {
1164
1190
  rpcHandle = registerRpcHandlers({
1165
1191
  events: pi.events,
1166
1192
  pi,
1193
+ refreshAgents: () => reloadCustomAgents(),
1167
1194
  getCtx: () => currentCtx,
1168
1195
  manager: {
1169
1196
  spawn: spawnTopLevel,
@@ -1501,6 +1528,9 @@ export default function (pi: ExtensionAPI) {
1501
1528
  rpcHandle?.unsubPing()
1502
1529
  rpcHandle?.unsubConsume()
1503
1530
  rpcHandle?.unsubSteer()
1531
+ rpcHandle?.unsubRegisterAgents()
1532
+ rpcHandle?.unsubUnregisterAgents()
1533
+ rpcHandle?.unsubListAgents()
1504
1534
  rpcHandle = undefined
1505
1535
  currentCtx = undefined
1506
1536
  // Only release the global slot if this activation claimed it — a child
@@ -2197,11 +2227,11 @@ Terse command-style prompts produce shallow, generic work.
2197
2227
  name: Type.Optional(
2198
2228
  Type.String({
2199
2229
  description:
2200
- 'Optional memorable name for this agent, e.g. "auth-audit", so it can be addressed as `@name` at the prompt and by steer_subagent / get_subagent_result. Letters, digits, `_` and `-`. Worth setting when several agents of the same type run at once; omit for one-off work. The agent stays reachable by its type either way.',
2230
+ 'Optional memorable name for this agent, e.g. "auth-audit", so it can be addressed as `@name` at the prompt and by steer_subagent / get_subagent_result. Any characters are accepted; the `@handle` is slugged from it (lowercase letters, digits, `_`, `-`) while UI labels show it as given, spaces included. Worth setting when several agents of the same type run at once; omit for one-off work. The agent stays reachable by its type either way.',
2201
2231
  }),
2202
2232
  ),
2203
2233
  subagent_type: Type.String({
2204
- description: `The type of specialized agent to use. Available types: ${getAvailableTypes().join(", ")}. Custom agents from .pi/agents/*.md (project) or ${getAgentDir()}/agents/*.md (global) are also available.`,
2234
+ description: `The type of specialized agent to use. Available types: ${getAvailableTypes().join(", ")}. Custom agents from .pi/agents/*.md (project) or ${getAgentDir()}/agents/*.md (global) are also available, as are types another tool registered for this session — a list outside this description is usable, not invalid.`,
2205
2235
  }),
2206
2236
  model: Type.Optional(
2207
2237
  Type.String({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-extensions",
3
- "version": "2026.11.16",
3
+ "version": "2026.11.18",
4
4
  "description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
5
5
  "keywords": [
6
6
  "extensions",
@@ -39,12 +39,12 @@
39
39
  "@ast-grep/cli": "0.51.1",
40
40
  "@ast-grep/napi": "^0.51.0",
41
41
  "@dietrichgebert/ponytail": "5.3.3",
42
- "@herbertgao/pi-agency": "0.1.3",
42
+ "@herbertgao/pi-agency": "0.1.4",
43
43
  "@herbertgao/pi-bark": "0.2.2",
44
- "@herbertgao/pi-cc-extensions": "1.0.21-local.1",
44
+ "@herbertgao/pi-cc-extensions": "1.0.21-local.3",
45
45
  "@herbertgao/pi-impeccable": "0.6.0",
46
- "@herbertgao/pi-inline-skill-commands": "0.1.1",
47
- "@herbertgao/pi-subagents": "0.26.1-local.1",
46
+ "@herbertgao/pi-inline-skill-commands": "0.2.0",
47
+ "@herbertgao/pi-subagents": "0.26.1-local.3",
48
48
  "@herbertgao/sol-pi": "0.4.3",
49
49
  "@juicesharp/rpiv-ask-user-question": "2.15.0",
50
50
  "@juicesharp/rpiv-config": "^2.15.0",
@@ -73,7 +73,7 @@
73
73
  "js-yaml": "^5.2.2",
74
74
  "linkedom": "^0.16.0",
75
75
  "minimatch": "^11.0.4",
76
- "nanoid": "^5.0.0",
76
+ "nanoid": "^5.1.16",
77
77
  "p-limit": "^6.1.0",
78
78
  "pi-antigravity": "0.14.0",
79
79
  "pi-commandcode-provider": "0.8.6",
@@ -84,10 +84,10 @@
84
84
  "pi-web-access": "0.48.0",
85
85
  "pidusage": "^4.0.1",
86
86
  "promise.try": "^2.0.1",
87
- "turndown": "^7.2.0",
87
+ "turndown": "^7.2.4",
88
88
  "turndown-plugin-gfm": "^1.0.2",
89
89
  "unbash": "4.0.10",
90
- "undici": "^8.11.2",
90
+ "undici": "^8.12.3",
91
91
  "unpdf": "^1.6.2",
92
92
  "vscode-jsonrpc": "^10.0.0",
93
93
  "ws": "^8.21.0",