@herbertgao/pi-extensions 2026.11.10 → 2026.11.11

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 (60) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +6 -6
  3. package/THIRD_PARTY_NOTICES.md +2 -2
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +6 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -2
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -2
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +13 -8
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +58 -15
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +0 -5
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +18 -4
  11. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  12. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
  13. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  14. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  15. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +3 -1
  16. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
  17. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.md +12 -1
  18. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/audit.native.md +4 -0
  19. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +5 -5
  20. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +1 -1
  21. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +1 -1
  22. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/distill.md +1 -1
  23. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/document.md +3 -1
  24. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/foundations.md +44 -0
  25. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live-setup.md +1 -1
  26. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +26 -12
  27. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +10 -9
  28. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/onboard.md +7 -6
  29. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/overdrive.md +2 -2
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/quieter.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/visualize.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +69 -16
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +55 -7
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +34 -4
  37. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  38. package/node_modules/@herbertgao/pi-subagents/README.md +27 -9
  39. package/node_modules/@herbertgao/pi-subagents/docs/workflows.md +11 -11
  40. package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
  41. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +13 -0
  42. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +51 -32
  43. package/node_modules/@herbertgao/pi-subagents/src/default-agents.ts +7 -0
  44. package/node_modules/@herbertgao/pi-subagents/src/index.ts +334 -893
  45. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +4 -1
  46. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +13 -0
  47. package/node_modules/@herbertgao/pi-subagents/src/schedule-store.ts +18 -13
  48. package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +25 -5
  49. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +215 -69
  50. package/node_modules/@herbertgao/pi-subagents/src/types.ts +17 -0
  51. package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +9 -0
  52. package/node_modules/@herbertgao/pi-subagents/src/ui/agents-menu.ts +705 -0
  53. package/node_modules/@herbertgao/pi-subagents/src/ui/settings-menu.ts +361 -0
  54. package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +1 -1
  55. package/node_modules/pi-commandcode-provider/CHANGELOG.md +11 -1
  56. package/node_modules/pi-commandcode-provider/index.ts +2 -1
  57. package/node_modules/pi-commandcode-provider/package.json +5 -4
  58. package/node_modules/pi-commandcode-provider/src/pricing.ts +8 -1
  59. package/node_modules/pi-commandcode-provider/src/responses-compat.ts +137 -0
  60. package/package.json +5 -5
@@ -1005,6 +1005,57 @@ export async function runAgent(
1005
1005
  }
1006
1006
  }
1007
1007
 
1008
+ const disallowedSet = agentConfig?.disallowedTools
1009
+ ? new Set(agentConfig.disallowedTools)
1010
+ : undefined
1011
+
1012
+ // Nested delegation tools (opt-in, ownership-scoped). Empty unless the agent
1013
+ // set `allowed_subagents` and a nestedRuntime was provided — and never when
1014
+ // isolated. Their names collide with EXCLUDED_TOOL_NAMES by design, so the
1015
+ // scoping below re-admits them explicitly (registry deny + active-set narrow).
1016
+ // Decided before the prompt is built, which says so when the agent delegates.
1017
+ const effectiveMaxDepth =
1018
+ options.nestedRuntime?.maxSubagentDepth ?? getMaxSubagentDepth()
1019
+ // At (or past) the cap this agent can never spawn, so it can never own a child
1020
+ // to fetch from or steer either — inject nothing rather than three tools whose
1021
+ // every call is an error. This is also what makes `maxSubagentDepth` 0/1 mean
1022
+ // "nesting off" instead of "nesting always fails".
1023
+ const nestedRuntime =
1024
+ options.nestedRuntime && options.nestedRuntime.depth < effectiveMaxDepth
1025
+ ? options.nestedRuntime
1026
+ : undefined
1027
+ // A workflow agent running the built-in general-purpose (what an untyped
1028
+ // agent() gets) does not delegate: Claude Code's `workflow-subagent` drops the
1029
+ // Agent tool, and the workflow script is what fans out. A custom agent's own
1030
+ // `allowed_subagents` still applies.
1031
+ const builtinInWorkflow =
1032
+ options.workflow === true && agentConfig?.isDefault === true
1033
+ const nestedTools =
1034
+ agentConfig?.allowedSubagents &&
1035
+ nestedRuntime &&
1036
+ !isolated &&
1037
+ !builtinInWorkflow
1038
+ ? createNestedSubagentTools({
1039
+ manager: nestedRuntime.manager,
1040
+ pi: options.pi,
1041
+ parentAgentId: nestedRuntime.parentAgentId,
1042
+ depth: nestedRuntime.depth,
1043
+ maxSubagentDepth: effectiveMaxDepth,
1044
+ allowedSubagents: agentConfig.allowedSubagents,
1045
+ configCwd,
1046
+ })
1047
+ : []
1048
+ const nestedToolNames = new Set(nestedTools.map((tool) => tool.name))
1049
+ // Only where the built-in general-purpose can actually spawn — not in a
1050
+ // workflow, at the depth cap, isolated, or with `Agent` disallowed.
1051
+ if (
1052
+ agentConfig?.isDefault &&
1053
+ nestedToolNames.has("Agent") &&
1054
+ !disallowedSet?.has("Agent")
1055
+ ) {
1056
+ extras.delegationGuideline = true
1057
+ }
1058
+
1008
1059
  // Build system prompt from agent config
1009
1060
  let systemPrompt: string
1010
1061
  if (agentConfig) {
@@ -1267,38 +1318,6 @@ export async function runAgent(
1267
1318
  const thinkingLevel =
1268
1319
  options.thinkingLevel ?? agentConfig?.thinking ?? ctx.thinkingLevel
1269
1320
 
1270
- const disallowedSet = agentConfig?.disallowedTools
1271
- ? new Set(agentConfig.disallowedTools)
1272
- : undefined
1273
-
1274
- // Nested delegation tools (opt-in, ownership-scoped). Empty unless the agent
1275
- // set `allowed_subagents` and a nestedRuntime was provided — and never when
1276
- // isolated. Their names collide with EXCLUDED_TOOL_NAMES by design, so the
1277
- // scoping below re-admits them explicitly (registry deny + active-set narrow).
1278
- const effectiveMaxDepth =
1279
- options.nestedRuntime?.maxSubagentDepth ?? getMaxSubagentDepth()
1280
- // At (or past) the cap this agent can never spawn, so it can never own a child
1281
- // to fetch from or steer either — inject nothing rather than three tools whose
1282
- // every call is an error. This is also what makes `maxSubagentDepth` 0/1 mean
1283
- // "nesting off" instead of "nesting always fails".
1284
- const nestedRuntime =
1285
- options.nestedRuntime && options.nestedRuntime.depth < effectiveMaxDepth
1286
- ? options.nestedRuntime
1287
- : undefined
1288
- const nestedTools =
1289
- agentConfig?.allowedSubagents && nestedRuntime && !isolated
1290
- ? createNestedSubagentTools({
1291
- manager: nestedRuntime.manager,
1292
- pi: options.pi,
1293
- parentAgentId: nestedRuntime.parentAgentId,
1294
- depth: nestedRuntime.depth,
1295
- maxSubagentDepth: effectiveMaxDepth,
1296
- allowedSubagents: agentConfig.allowedSubagents,
1297
- configCwd,
1298
- })
1299
- : []
1300
- const nestedToolNames = new Set(nestedTools.map((tool) => tool.name))
1301
-
1302
1321
  // The `agent({ schema })` contract: this child reports its answer by calling
1303
1322
  // StructuredOutput, and `structuredJson` below is what the caller reads. The
1304
1323
  // schema was already compiled by whoever asked for it, so a bad one failed
@@ -21,6 +21,13 @@ export const DEFAULT_AGENTS: Map<string, AgentConfig> = new Map([
21
21
  // Setting them to false would lock callsite intent (see resolveAgentInvocationConfig in invocation-config.ts).
22
22
  extensions: true,
23
23
  skills: true,
24
+ // Claude Code's general-purpose (`tools: ["*"]`) keeps its Agent tool;
25
+ // Explore and Plan disallow it. Delegation grants this agent nothing it
26
+ // lacks — it already has every tool — so the privilege-boundary reason
27
+ // nesting is opt-in for custom agents does not apply here.
28
+ allowedSubagents: "all",
29
+ // Claude Code's closing "do not re-delegate" line is added by the runner
30
+ // (`PromptExtras.delegationGuideline`), only when this agent can spawn.
24
31
  systemPrompt: "",
25
32
  promptMode: "append",
26
33
  isDefault: true,