@zihanw/pi-forge 0.4.0-beta.1 → 0.4.1

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 (227) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/PUBLIC_API.md +3 -26
  3. package/README.md +90 -601
  4. package/README.zh-CN.md +86 -585
  5. package/SUBAGENT_ADAPTER_CONTRACT.md +3 -197
  6. package/dist/agent-profile.d.ts +24 -1
  7. package/dist/agent-profile.d.ts.map +1 -1
  8. package/dist/agent-profile.js +146 -36
  9. package/dist/agent-profile.js.map +1 -1
  10. package/dist/catalog.d.ts +27 -0
  11. package/dist/catalog.d.ts.map +1 -0
  12. package/dist/catalog.js +59 -0
  13. package/dist/catalog.js.map +1 -0
  14. package/dist/forge-config.d.ts +106 -0
  15. package/dist/forge-config.d.ts.map +1 -1
  16. package/dist/forge-config.js +305 -18
  17. package/dist/forge-config.js.map +1 -1
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +55 -8
  21. package/dist/index.js.map +1 -1
  22. package/dist/lifecycle.d.ts +2 -1
  23. package/dist/lifecycle.d.ts.map +1 -1
  24. package/dist/lifecycle.js +7 -4
  25. package/dist/lifecycle.js.map +1 -1
  26. package/dist/loader.d.ts +17 -1
  27. package/dist/loader.d.ts.map +1 -1
  28. package/dist/loader.js +84 -25
  29. package/dist/loader.js.map +1 -1
  30. package/dist/preset-command.d.ts +1 -1
  31. package/dist/preset-command.d.ts.map +1 -1
  32. package/dist/preset-command.js +38 -10
  33. package/dist/preset-command.js.map +1 -1
  34. package/dist/profile-command.d.ts.map +1 -1
  35. package/dist/profile-command.js +46 -21
  36. package/dist/profile-command.js.map +1 -1
  37. package/dist/profile-service.d.ts +6 -3
  38. package/dist/profile-service.d.ts.map +1 -1
  39. package/dist/profile-service.js +55 -13
  40. package/dist/profile-service.js.map +1 -1
  41. package/dist/resource-identity.d.ts +33 -0
  42. package/dist/resource-identity.d.ts.map +1 -0
  43. package/dist/resource-identity.js +56 -0
  44. package/dist/resource-identity.js.map +1 -0
  45. package/dist/runtime/profile-runtime.d.ts.map +1 -1
  46. package/dist/runtime/profile-runtime.js +7 -2
  47. package/dist/runtime/profile-runtime.js.map +1 -1
  48. package/dist/runtime/prompt-stack-runtime.d.ts +1 -1
  49. package/dist/runtime/prompt-stack-runtime.d.ts.map +1 -1
  50. package/dist/runtime/prompt-stack-runtime.js +22 -12
  51. package/dist/runtime/prompt-stack-runtime.js.map +1 -1
  52. package/dist/runtime/subagent-runtime.d.ts +23 -8
  53. package/dist/runtime/subagent-runtime.d.ts.map +1 -1
  54. package/dist/runtime/subagent-runtime.js +296 -67
  55. package/dist/runtime/subagent-runtime.js.map +1 -1
  56. package/dist/storage.d.ts +11 -0
  57. package/dist/storage.d.ts.map +1 -1
  58. package/dist/storage.js +51 -2
  59. package/dist/storage.js.map +1 -1
  60. package/dist/subagent/canonical.d.ts +19 -7
  61. package/dist/subagent/canonical.d.ts.map +1 -1
  62. package/dist/subagent/canonical.js +19 -47
  63. package/dist/subagent/canonical.js.map +1 -1
  64. package/dist/subagent/contract.d.ts +1 -2
  65. package/dist/subagent/contract.d.ts.map +1 -1
  66. package/dist/subagent/contract.js +1 -2
  67. package/dist/subagent/contract.js.map +1 -1
  68. package/dist/subagent/index.d.ts +4 -3
  69. package/dist/subagent/index.d.ts.map +1 -1
  70. package/dist/subagent/index.js +4 -3
  71. package/dist/subagent/index.js.map +1 -1
  72. package/dist/subagent/plan.d.ts +5 -1
  73. package/dist/subagent/plan.d.ts.map +1 -1
  74. package/dist/subagent/plan.js +29 -32
  75. package/dist/subagent/plan.js.map +1 -1
  76. package/dist/subagent/request.d.ts.map +1 -1
  77. package/dist/subagent/request.js +36 -4
  78. package/dist/subagent/request.js.map +1 -1
  79. package/dist/subagent/types.d.ts +66 -178
  80. package/dist/subagent/types.d.ts.map +1 -1
  81. package/dist/subagent/types.js +1 -1
  82. package/dist/subagent/types.js.map +1 -1
  83. package/dist/subagent/validation.d.ts +14 -14
  84. package/dist/subagent/validation.d.ts.map +1 -1
  85. package/dist/subagent/validation.js +52 -238
  86. package/dist/subagent/validation.js.map +1 -1
  87. package/dist/subagent-command.d.ts +2 -1
  88. package/dist/subagent-command.d.ts.map +1 -1
  89. package/dist/subagent-command.js +115 -19
  90. package/dist/subagent-command.js.map +1 -1
  91. package/dist/subagent-host.d.ts.map +1 -1
  92. package/dist/subagent-host.js +43 -16
  93. package/dist/subagent-host.js.map +1 -1
  94. package/dist/subagent-profile-tool.d.ts +25 -2
  95. package/dist/subagent-profile-tool.d.ts.map +1 -1
  96. package/dist/subagent-profile-tool.js +41 -9
  97. package/dist/subagent-profile-tool.js.map +1 -1
  98. package/dist/subagent-tool.d.ts +31 -4
  99. package/dist/subagent-tool.d.ts.map +1 -1
  100. package/dist/subagent-tool.js +311 -137
  101. package/dist/subagent-tool.js.map +1 -1
  102. package/dist/types.d.ts +3 -0
  103. package/dist/types.d.ts.map +1 -1
  104. package/dist/types.js.map +1 -1
  105. package/dist/web-editor/client-script.generated.d.ts +1 -1
  106. package/dist/web-editor/client-script.generated.d.ts.map +1 -1
  107. package/dist/web-editor/client-script.generated.js +1 -1
  108. package/dist/web-editor/client-script.generated.js.map +1 -1
  109. package/dist/web-editor/client-styles.d.ts +2 -0
  110. package/dist/web-editor/client-styles.d.ts.map +1 -0
  111. package/dist/web-editor/client-styles.generated.d.ts +2 -0
  112. package/dist/web-editor/client-styles.generated.d.ts.map +1 -0
  113. package/dist/web-editor/client-styles.generated.js +3 -0
  114. package/dist/web-editor/client-styles.generated.js.map +1 -0
  115. package/dist/web-editor/client-styles.js +2 -0
  116. package/dist/web-editor/client-styles.js.map +1 -0
  117. package/dist/web-editor/page.d.ts +2 -0
  118. package/dist/web-editor/page.d.ts.map +1 -1
  119. package/dist/web-editor/page.js +11 -73
  120. package/dist/web-editor/page.js.map +1 -1
  121. package/dist/web-editor/server.d.ts.map +1 -1
  122. package/dist/web-editor/server.js +176 -1
  123. package/dist/web-editor/server.js.map +1 -1
  124. package/dist/web-editor/styles.d.ts.map +1 -1
  125. package/dist/web-editor/styles.js +60 -3
  126. package/dist/web-editor/styles.js.map +1 -1
  127. package/dist/web-editor/types.d.ts +87 -0
  128. package/dist/web-editor/types.d.ts.map +1 -1
  129. package/dist/web-host.d.ts +13 -2
  130. package/dist/web-host.d.ts.map +1 -1
  131. package/dist/web-host.js +371 -27
  132. package/dist/web-host.js.map +1 -1
  133. package/docs/README.md +41 -0
  134. package/docs/concepts/agent-profiles.md +60 -0
  135. package/docs/concepts/prompt-stacks.md +95 -0
  136. package/docs/design/README.md +17 -0
  137. package/docs/design/roadmap-0.4-archive.md +216 -0
  138. package/docs/design/subagents/design-review.md +220 -0
  139. package/docs/design/subagents/interface-design.md +274 -0
  140. package/docs/design/subagents/sdk-spike-findings.md +117 -0
  141. package/docs/development/complexity-review.md +86 -0
  142. package/docs/development/release.md +31 -0
  143. package/docs/development/roadmap.md +36 -0
  144. package/docs/development/scoped-global-profiles-stacks.md +325 -0
  145. package/docs/development/setup.md +75 -0
  146. package/docs/getting-started.md +95 -0
  147. package/docs/guides/custom-macros-and-slots.md +68 -0
  148. package/docs/guides/debugging.md +39 -0
  149. package/docs/guides/delegation.md +107 -0
  150. package/docs/guides/sillytavern-import.md +47 -0
  151. package/docs/guides/use-cases.md +65 -0
  152. package/docs/guides/web-editor.md +75 -0
  153. package/docs/reference/commands.md +60 -0
  154. package/docs/reference/configuration.md +66 -0
  155. package/docs/reference/features.md +280 -0
  156. package/docs/reference/macros-and-slots.md +82 -0
  157. package/docs/reference/public-api.md +28 -0
  158. package/docs/reference/stack-schema.md +167 -0
  159. package/docs/reference/subagent-adapter.md +204 -0
  160. package/docs/zh-CN/README.md +37 -0
  161. package/docs/zh-CN/concepts/agent-profiles.md +46 -0
  162. package/docs/zh-CN/concepts/prompt-stacks.md +42 -0
  163. package/docs/zh-CN/getting-started.md +81 -0
  164. package/docs/zh-CN/guides/delegation.md +66 -0
  165. package/docs/zh-CN/guides/web-editor.md +45 -0
  166. package/docs/zh-CN/reference/commands.md +60 -0
  167. package/package.json +29 -15
  168. package/dist/subagent/backend-registry.d.ts +0 -75
  169. package/dist/subagent/backend-registry.d.ts.map +0 -1
  170. package/dist/subagent/backend-registry.js +0 -463
  171. package/dist/subagent/backend-registry.js.map +0 -1
  172. package/dist/subagent/diagnostics.d.ts +0 -3
  173. package/dist/subagent/diagnostics.d.ts.map +0 -1
  174. package/dist/subagent/diagnostics.js +0 -5
  175. package/dist/subagent/diagnostics.js.map +0 -1
  176. package/dist/subagent/pi-model-runtime.d.ts +0 -8
  177. package/dist/subagent/pi-model-runtime.d.ts.map +0 -1
  178. package/dist/subagent/pi-model-runtime.js +0 -22
  179. package/dist/subagent/pi-model-runtime.js.map +0 -1
  180. package/dist/subagent/pi-sdk-backend.d.ts +0 -23
  181. package/dist/subagent/pi-sdk-backend.d.ts.map +0 -1
  182. package/dist/subagent/pi-sdk-backend.js +0 -383
  183. package/dist/subagent/pi-sdk-backend.js.map +0 -1
  184. package/dist/subagent/pi-subprocess-backend.d.ts +0 -72
  185. package/dist/subagent/pi-subprocess-backend.d.ts.map +0 -1
  186. package/dist/subagent/pi-subprocess-backend.js +0 -756
  187. package/dist/subagent/pi-subprocess-backend.js.map +0 -1
  188. package/dist/subagent/subprocess-bridge.d.ts +0 -21
  189. package/dist/subagent/subprocess-bridge.d.ts.map +0 -1
  190. package/dist/subagent/subprocess-bridge.js +0 -87
  191. package/dist/subagent/subprocess-bridge.js.map +0 -1
  192. package/dist/subagent/subprocess-report.d.ts +0 -4
  193. package/dist/subagent/subprocess-report.d.ts.map +0 -1
  194. package/dist/subagent/subprocess-report.js +0 -55
  195. package/dist/subagent/subprocess-report.js.map +0 -1
  196. package/dist/subagent-contract.d.ts +0 -8
  197. package/dist/subagent-contract.d.ts.map +0 -1
  198. package/dist/subagent-contract.js +0 -8
  199. package/dist/subagent-contract.js.map +0 -1
  200. package/dist/web-editor/client/api.d.ts +0 -9
  201. package/dist/web-editor/client/api.d.ts.map +0 -1
  202. package/dist/web-editor/client/api.js +0 -26
  203. package/dist/web-editor/client/api.js.map +0 -1
  204. package/dist/web-editor/client/dom.d.ts +0 -13
  205. package/dist/web-editor/client/dom.d.ts.map +0 -1
  206. package/dist/web-editor/client/dom.js +0 -30
  207. package/dist/web-editor/client/dom.js.map +0 -1
  208. package/dist/web-editor/client/inspector.d.ts +0 -22
  209. package/dist/web-editor/client/inspector.d.ts.map +0 -1
  210. package/dist/web-editor/client/inspector.js +0 -226
  211. package/dist/web-editor/client/inspector.js.map +0 -1
  212. package/dist/web-editor/client/main.d.ts +0 -2
  213. package/dist/web-editor/client/main.d.ts.map +0 -1
  214. package/dist/web-editor/client/main.js +0 -1468
  215. package/dist/web-editor/client/main.js.map +0 -1
  216. package/dist/web-editor/client/policy-editor.d.ts +0 -16
  217. package/dist/web-editor/client/policy-editor.d.ts.map +0 -1
  218. package/dist/web-editor/client/policy-editor.js +0 -330
  219. package/dist/web-editor/client/policy-editor.js.map +0 -1
  220. package/dist/web-editor/client/regex-editor.d.ts +0 -19
  221. package/dist/web-editor/client/regex-editor.d.ts.map +0 -1
  222. package/dist/web-editor/client/regex-editor.js +0 -281
  223. package/dist/web-editor/client/regex-editor.js.map +0 -1
  224. package/dist/web-editor/client/types.d.ts +0 -60
  225. package/dist/web-editor/client/types.d.ts.map +0 -1
  226. package/dist/web-editor/client/types.js +0 -2
  227. package/dist/web-editor/client/types.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ import type { ResourceKey, ResourceScope, ResourceSelector } from "./resource-identity.ts";
2
+ export interface ScopedResource {
3
+ key: ResourceKey;
4
+ }
5
+ export interface ResourceCatalog<T extends ScopedResource> {
6
+ /** Every loaded scoped definition, including shadowed resources. */
7
+ all: T[];
8
+ /** One resource per unqualified ID after project-over-global shadowing. */
9
+ effective: T[];
10
+ resolveExact(key: ResourceKey): T | undefined;
11
+ resolveExact(scope: ResourceScope, id: string): T | undefined;
12
+ resolveEffective(id: string): T | undefined;
13
+ resolveSelector(selector: ResourceSelector): T | undefined;
14
+ }
15
+ export declare function createResourceCatalog<T extends ScopedResource>(all: T[]): ResourceCatalog<T>;
16
+ export declare function computeEffectiveView<T extends ScopedResource>(all: T[]): T[];
17
+ /**
18
+ * Project-over-global effective resolution. A project definition shadows a
19
+ * same-ID global definition even when the project definition is invalid; an
20
+ * ambiguous project scope (duplicate IDs) fails closed instead of falling
21
+ * back to the global resource.
22
+ */
23
+ export declare function resolveEffectiveResource<T extends ScopedResource>(all: readonly T[], id: string): T | undefined;
24
+ export declare function resolveExactResource<T extends ScopedResource>(all: readonly T[], key: ResourceKey): T | undefined;
25
+ export declare function resolveResourceSelector<T extends ScopedResource>(all: readonly T[], selector: ResourceSelector): T | undefined;
26
+ export declare function scopedResourceId(key: ResourceKey): string;
27
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,WAAW,CAAC;CACjB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,cAAc;IACxD,oEAAoE;IACpE,GAAG,EAAE,CAAC,EAAE,CAAC;IACT,2EAA2E;IAC3E,SAAS,EAAE,CAAC,EAAE,CAAC;IACf,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9C,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9D,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAC5C,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAAC;CAC3D;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAsB5F;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAW5E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAM/G;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,GAAG,CAAC,GAAG,SAAS,CAGjH;AAED,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,cAAc,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,CAAC,GAAG,SAAS,CAG9H;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,59 @@
1
+ export function createResourceCatalog(all) {
2
+ const effective = computeEffectiveView(all);
3
+ function resolveExact(scopeOrKey, maybeId) {
4
+ const scope = typeof scopeOrKey === "string" ? scopeOrKey : scopeOrKey.scope;
5
+ const id = typeof scopeOrKey === "string" ? maybeId : scopeOrKey.id;
6
+ const matches = all.filter((item) => item.key.scope === scope && item.key.id === id);
7
+ return matches.length === 1 ? matches[0] : undefined;
8
+ }
9
+ function resolveEffective(id) {
10
+ return resolveEffectiveResource(all, id);
11
+ }
12
+ function resolveSelector(selector) {
13
+ if (selector.scope)
14
+ return resolveExact(selector.scope, selector.id);
15
+ return resolveEffective(selector.id);
16
+ }
17
+ return { all, effective, resolveExact, resolveEffective, resolveSelector };
18
+ }
19
+ export function computeEffectiveView(all) {
20
+ const ids = [];
21
+ const seen = new Set();
22
+ for (const item of all) {
23
+ if (seen.has(item.key.id))
24
+ continue;
25
+ seen.add(item.key.id);
26
+ ids.push(item.key.id);
27
+ }
28
+ return ids
29
+ .map((id) => resolveEffectiveResource(all, id))
30
+ .filter((item) => item !== undefined);
31
+ }
32
+ /**
33
+ * Project-over-global effective resolution. A project definition shadows a
34
+ * same-ID global definition even when the project definition is invalid; an
35
+ * ambiguous project scope (duplicate IDs) fails closed instead of falling
36
+ * back to the global resource.
37
+ */
38
+ export function resolveEffectiveResource(all, id) {
39
+ const projectMatches = all.filter((item) => item.key.id === id && item.key.scope === "project");
40
+ if (projectMatches.length === 1)
41
+ return projectMatches[0];
42
+ if (projectMatches.length > 1)
43
+ return undefined;
44
+ const globalMatches = all.filter((item) => item.key.id === id && item.key.scope === "global");
45
+ return globalMatches.length === 1 ? globalMatches[0] : undefined;
46
+ }
47
+ export function resolveExactResource(all, key) {
48
+ const matches = all.filter((item) => item.key.scope === key.scope && item.key.id === key.id);
49
+ return matches.length === 1 ? matches[0] : undefined;
50
+ }
51
+ export function resolveResourceSelector(all, selector) {
52
+ if (selector.scope)
53
+ return resolveExactResource(all, { scope: selector.scope, id: selector.id });
54
+ return resolveEffectiveResource(all, selector.id);
55
+ }
56
+ export function scopedResourceId(key) {
57
+ return `${key.scope}:${key.id}`;
58
+ }
59
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,qBAAqB,CAA2B,GAAQ;IACvE,MAAM,SAAS,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAI5C,SAAS,YAAY,CAAC,UAAuC,EAAE,OAAgB;QAC9E,MAAM,KAAK,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QAC7E,MAAM,EAAE,GAAG,OAAO,U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CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAA2B,GAAiB,EAAE,QAA0B;IAC9G,IAAI,QAAQ,CAAC,KAAK;QAAE,OAAO,oBAAoB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;IACjG,OAAO,wBAAwB,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAgB;IAChD,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;AACjC,CAAC"}
@@ -1,8 +1,114 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { type ResourceScope } from "./resource-identity.ts";
3
+ /** Backend used when neither a per-run override nor a configured default applies. */
4
+ export declare const DEFAULT_SUBAGENT_BACKEND_ID = "pi-subprocess-readonly";
5
+ /** Preserve the original foreground-run timeout unless the user configures one. */
6
+ export declare const DEFAULT_SUBAGENT_TIMEOUT_MS = 60000;
7
+ export declare const MIN_SUBAGENT_TIMEOUT_MS = 1000;
8
+ export declare const MAX_SUBAGENT_TIMEOUT_MS = 3600000;
9
+ /**
10
+ * Development/test override for the global config location. Keeps automated
11
+ * tests hermetic regardless of the developer's real ~/.pi/forge/config.json.
12
+ * Not part of the supported user-facing configuration surface.
13
+ */
14
+ export declare const GLOBAL_FORGE_CONFIG_PATH_ENV = "PI_FORGE_GLOBAL_CONFIG_PATH";
15
+ export type ForgeSubagentBackendSource = "explicit" | "project-profile" | "global-profile" | "project" | "global" | "built-in";
16
+ export type ForgeSubagentConfigSource = "project" | "global";
17
+ export type ForgeSubagentProfileSource = "project-profile" | "global-profile";
18
+ export interface ForgeSubagentProfileSettings {
19
+ enabled?: boolean;
20
+ enabledSource?: ForgeSubagentProfileSource;
21
+ backend?: string;
22
+ backendSource?: ForgeSubagentProfileSource;
23
+ timeoutMs?: number;
24
+ timeoutSource?: ForgeSubagentProfileSource;
25
+ }
2
26
  export interface ForgeSubagentSettings {
3
27
  allowAgentInvocationWithoutApproval: boolean;
28
+ /** Configured default backend ID; a trusted project config wins over the global config. */
29
+ backend?: string;
30
+ backendSource?: ForgeSubagentConfigSource;
31
+ /** Best-effort foreground timeout; a trusted project config wins over the global config. */
32
+ timeoutMs: number;
33
+ timeoutSource: ForgeSubagentConfigSource | "built-in";
34
+ /**
35
+ * Embed a compact summary of enabled subagent profiles directly in the
36
+ * forge_subagent tool description so the parent model does not need a
37
+ * discovery call for a small set of frequently used profiles. Opt-in
38
+ * because the summary rides in every request; the discovery tool remains
39
+ * the authoritative surface.
40
+ */
41
+ summaryInToolDescription: boolean;
42
+ summaryInToolDescriptionSource?: ForgeSubagentConfigSource;
43
+ /**
44
+ * Per-profile delegation allowlist and execution overrides, keyed by
45
+ * canonical scoped selector (`global:<id>` or `project:<id>`). Unlisted
46
+ * profiles are not delegatable.
47
+ */
48
+ profiles: Record<string, ForgeSubagentProfileSettings>;
4
49
  configPath: string;
50
+ globalConfigPath: string;
5
51
  warnings: string[];
6
52
  }
53
+ export interface ResolvedSubagentBackend {
54
+ id: string;
55
+ source: ForgeSubagentBackendSource;
56
+ }
57
+ export interface ResolvedSubagentTimeout {
58
+ milliseconds: number;
59
+ source: Exclude<ForgeSubagentBackendSource, "explicit">;
60
+ }
61
+ export interface ResolvedSubagentProfilePolicy {
62
+ /** The selector used to resolve this policy, e.g. `reviewer` or `global:reviewer`. */
63
+ profileId: string;
64
+ enabled: boolean;
65
+ enabledSource: ForgeSubagentProfileSource | "built-in";
66
+ backend: ResolvedSubagentBackend;
67
+ timeout: ResolvedSubagentTimeout;
68
+ }
69
+ /**
70
+ * Resolve the effective backend for one run: explicit per-run override, then
71
+ * a matching-scope per-profile override, then trusted-project/global defaults,
72
+ * then the built-in subprocess backend. There is deliberately no fallback when
73
+ * the resolved backend is missing or rejects the intent.
74
+ */
75
+ export declare function resolveSubagentBackend(settings: ForgeSubagentSettings, explicitBackend?: string, profileId?: string): ResolvedSubagentBackend;
76
+ export declare function resolveSubagentTimeout(settings: ForgeSubagentSettings, profileId?: string): ResolvedSubagentTimeout;
77
+ export declare function resolveSubagentProfilePolicy(settings: ForgeSubagentSettings, profileId: string, explicitBackend?: string): ResolvedSubagentProfilePolicy;
7
78
  export declare function loadForgeSubagentSettings(ctx: ExtensionContext): ForgeSubagentSettings;
79
+ export declare function isValidSubagentTimeoutMs(value: unknown): value is number;
80
+ /**
81
+ * One scoped per-profile delegation update. `enabled: false`,
82
+ * `backend: null`, and `timeoutMs: null` remove the explicit value; entries
83
+ * that become empty are removed so the file only records real overrides.
84
+ */
85
+ export interface ForgeSubagentProfileConfigUpdate {
86
+ enabled?: boolean;
87
+ backend?: string | null;
88
+ timeoutMs?: number | null;
89
+ }
90
+ export type ForgeSubagentProfileConfigResult = {
91
+ ok: true;
92
+ configPath: string;
93
+ } | {
94
+ ok: false;
95
+ error: string;
96
+ };
97
+ export declare function globalForgeConfigPath(): string;
98
+ export declare function projectForgeConfigPath(cwd: string): string;
99
+ /**
100
+ * Update `subagents.profiles.<id>` in the selected scope's config file,
101
+ * preserving unknown top-level, `subagents`, and per-entry fields. Project
102
+ * config updates must be gated on project trust by the caller; global config
103
+ * is user-owned and always writable.
104
+ */
105
+ export declare function updateForgeSubagentProfileConfig(cwd: string, profileId: string, update: ForgeSubagentProfileConfigUpdate, options?: {
106
+ scope?: ResourceScope;
107
+ }): ForgeSubagentProfileConfigResult;
108
+ /**
109
+ * Resolve the configured per-profile settings for a profile selector. Bare
110
+ * selectors use project-first effective lookup; qualified selectors address
111
+ * the exact scope. Returns undefined for unknown or malformed selectors.
112
+ */
113
+ export declare function configuredProfileForSelector(settings: ForgeSubagentSettings, profileId: string): ForgeSubagentProfileSettings | undefined;
8
114
  //# sourceMappingURL=forge-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forge-config.d.ts","sourceRoot":"","sources":["../src/forge-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,qBAAqB;IACrC,mCAAmC,EAAE,OAAO,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,gBAAgB,GAAG,qBAAqB,CA8BtF"}
1
+ {"version":3,"file":"forge-config.d.ts","sourceRoot":"","sources":["../src/forge-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGtG,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,uBAAuB,UAAY,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,gCAAgC,CAAC;AAE1E,MAAM,MAAM,0BAA0B,GACnC,UAAU,GACV,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,GACT,QAAQ,GACR,UAAU,CAAC;AACd,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC7D,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE9E,MAAM,WAAW,4BAA4B;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,0BAA0B,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EA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AgB,4BAA4B,CAC3C,QAAQ,EAAE,qBAAqB,EAC/B,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,MAAM,GACtB,6BAA6B,CAS/B;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,gBAAgB,GAAG,qBAAqB,CA+BtF;AAmJD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAIxE;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,gCAAgC,GACzC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhC,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,gCAAgC,EACxC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAO,GACrC,gCAAgC,CAwElC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC3C,QAAQ,EAAE,qBAAqB,EAC/B,SAAS,EAAE,MAAM,GACf,4BAA4B,GAAG,SAAS,CAU1C"}
@@ -1,38 +1,325 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { join } from "node:path";
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { isValidAgentProfileId } from "./agent-profile.js";
4
+ import { formatResourceKey, parseResourceSelector } from "./resource-identity.js";
5
+ import { globalForgeDir } from "./storage.js";
6
+ /** Backend used when neither a per-run override nor a configured default applies. */
7
+ export const DEFAULT_SUBAGENT_BACKEND_ID = "pi-subprocess-readonly";
8
+ /** Preserve the original foreground-run timeout unless the user configures one. */
9
+ export const DEFAULT_SUBAGENT_TIMEOUT_MS = 60_000;
10
+ export const MIN_SUBAGENT_TIMEOUT_MS = 1_000;
11
+ export const MAX_SUBAGENT_TIMEOUT_MS = 3_600_000;
12
+ /**
13
+ * Development/test override for the global config location. Keeps automated
14
+ * tests hermetic regardless of the developer's real ~/.pi/forge/config.json.
15
+ * Not part of the supported user-facing configuration surface.
16
+ */
17
+ export const GLOBAL_FORGE_CONFIG_PATH_ENV = "PI_FORGE_GLOBAL_CONFIG_PATH";
18
+ /**
19
+ * Resolve the effective backend for one run: explicit per-run override, then
20
+ * a matching-scope per-profile override, then trusted-project/global defaults,
21
+ * then the built-in subprocess backend. There is deliberately no fallback when
22
+ * the resolved backend is missing or rejects the intent.
23
+ */
24
+ export function resolveSubagentBackend(settings, explicitBackend, profileId) {
25
+ if (explicitBackend)
26
+ return { id: explicitBackend, source: "explicit" };
27
+ const profile = profileId ? configuredProfileForSelector(settings, profileId) : undefined;
28
+ if (profile?.backend)
29
+ return { id: profile.backend, source: profile.backendSource ?? "project-profile" };
30
+ if (settings.backend)
31
+ return { id: settings.backend, source: settings.backendSource ?? "global" };
32
+ return { id: DEFAULT_SUBAGENT_BACKEND_ID, source: "built-in" };
33
+ }
34
+ export function resolveSubagentTimeout(settings, profileId) {
35
+ const profile = profileId ? configuredProfileForSelector(settings, profileId) : undefined;
36
+ if (profile?.timeoutMs !== undefined) {
37
+ return { milliseconds: profile.timeoutMs, source: profile.timeoutSource ?? "project-profile" };
38
+ }
39
+ return { milliseconds: settings.timeoutMs, source: settings.timeoutSource };
40
+ }
41
+ export function resolveSubagentProfilePolicy(settings, profileId, explicitBackend) {
42
+ const profile = configuredProfileForSelector(settings, profileId);
43
+ return {
44
+ profileId,
45
+ enabled: profile?.enabled === true,
46
+ enabledSource: profile?.enabledSource ?? "built-in",
47
+ backend: resolveSubagentBackend(settings, explicitBackend, profileId),
48
+ timeout: resolveSubagentTimeout(settings, profileId),
49
+ };
50
+ }
3
51
  export function loadForgeSubagentSettings(ctx) {
4
52
  const configPath = join(ctx.cwd, ".pi", "forge", "config.json");
5
- const defaults = { allowAgentInvocationWithoutApproval: false, configPath, warnings: [] };
6
- if (!ctx.isProjectTrusted() || !existsSync(configPath))
7
- return defaults;
53
+ const globalConfigPath = process.env[GLOBAL_FORGE_CONFIG_PATH_ENV] ?? join(globalForgeDir(), "config.json");
54
+ const settings = {
55
+ allowAgentInvocationWithoutApproval: false,
56
+ timeoutMs: DEFAULT_SUBAGENT_TIMEOUT_MS,
57
+ timeoutSource: "built-in",
58
+ summaryInToolDescription: false,
59
+ profiles: Object.create(null),
60
+ configPath,
61
+ globalConfigPath,
62
+ warnings: [],
63
+ };
64
+ // The global config is user-owned and always applies. Its `profiles` map
65
+ // authorizes `global:<id>` profiles only. The project config is honored
66
+ // only for trusted projects; its `profiles` map authorizes `project:<id>`
67
+ // profiles only. Same-ID profiles never inherit policy from each other.
68
+ const globalSection = readSubagentsSection(globalConfigPath, settings.warnings);
69
+ applyBackend(globalSection, globalConfigPath, "global", settings);
70
+ applyTimeout(globalSection, globalConfigPath, "global", settings);
71
+ applyEmbedProfileSummary(globalSection, globalConfigPath, "global", settings);
72
+ applyProfiles(globalSection, globalConfigPath, "global-profile", "global", settings);
73
+ if (!ctx.isProjectTrusted())
74
+ return settings;
75
+ const projectSection = readSubagentsSection(configPath, settings.warnings);
76
+ applyBackend(projectSection, configPath, "project", settings);
77
+ applyTimeout(projectSection, configPath, "project", settings);
78
+ applyEmbedProfileSummary(projectSection, configPath, "project", settings);
79
+ applyProfiles(projectSection, configPath, "project-profile", "project", settings);
80
+ applyUnattended(projectSection, configPath, settings);
81
+ return settings;
82
+ }
83
+ function readSubagentsSection(configPath, warnings) {
84
+ if (!existsSync(configPath))
85
+ return undefined;
8
86
  let raw;
9
87
  try {
10
88
  raw = JSON.parse(readFileSync(configPath, "utf8"));
11
89
  }
12
90
  catch (error) {
13
- return {
14
- ...defaults,
15
- warnings: [`pi-forge: failed to read ${configPath}; per-run subagent approval remains required. ${error instanceof Error ? error.message : String(error)}`],
16
- };
91
+ warnings.push(`pi-forge: failed to read ${configPath}; its subagent settings are ignored. ${error instanceof Error ? error.message : String(error)}`);
92
+ return undefined;
17
93
  }
18
94
  if (!isPlainObject(raw)) {
19
- return { ...defaults, warnings: [`pi-forge: ${configPath} must be a JSON object; per-run subagent approval remains required.`] };
95
+ warnings.push(`pi-forge: ${configPath} must be a JSON object; its subagent settings are ignored.`);
96
+ return undefined;
20
97
  }
21
98
  if (raw.subagents === undefined)
22
- return defaults;
99
+ return undefined;
23
100
  if (!isPlainObject(raw.subagents)) {
24
- return { ...defaults, warnings: [`pi-forge: ${configPath} subagents must be a JSON object; per-run subagent approval remains required.`] };
101
+ warnings.push(`pi-forge: ${configPath} subagents must be a JSON object; its subagent settings are ignored.`);
102
+ return undefined;
103
+ }
104
+ return raw.subagents;
105
+ }
106
+ function applyBackend(section, configPath, source, settings) {
107
+ if (!section || section.backend === undefined)
108
+ return;
109
+ const value = section.backend;
110
+ if (typeof value !== "string" || !value.trim()) {
111
+ settings.warnings.push(`pi-forge: ${configPath} subagents.backend must be a non-empty string; the configured value is ignored.`);
112
+ return;
113
+ }
114
+ settings.backend = value;
115
+ settings.backendSource = source;
116
+ }
117
+ function applyTimeout(section, configPath, source, settings) {
118
+ if (!section || section.timeoutMs === undefined)
119
+ return;
120
+ const value = section.timeoutMs;
121
+ if (!isValidSubagentTimeoutMs(value)) {
122
+ settings.warnings.push(`pi-forge: ${configPath} subagents.timeoutMs must be an integer from ${MIN_SUBAGENT_TIMEOUT_MS} to ${MAX_SUBAGENT_TIMEOUT_MS}; the configured value is ignored.`);
123
+ return;
124
+ }
125
+ settings.timeoutMs = value;
126
+ settings.timeoutSource = source;
127
+ }
128
+ function applyEmbedProfileSummary(section, configPath, source, settings) {
129
+ if (!section || section.summaryInToolDescription === undefined)
130
+ return;
131
+ const value = section.summaryInToolDescription;
132
+ if (typeof value !== "boolean") {
133
+ settings.warnings.push(`pi-forge: ${configPath} subagents.summaryInToolDescription must be boolean; the configured value is ignored.`);
134
+ return;
135
+ }
136
+ settings.summaryInToolDescription = value;
137
+ settings.summaryInToolDescriptionSource = source;
138
+ }
139
+ function applyProfiles(section, configPath, source, scope, settings) {
140
+ if (!section || section.profiles === undefined)
141
+ return;
142
+ if (!isPlainObject(section.profiles)) {
143
+ settings.warnings.push(`pi-forge: ${configPath} subagents.profiles must be a JSON object; its per-profile settings are ignored.`);
144
+ return;
145
+ }
146
+ for (const [profileId, rawProfile] of Object.entries(section.profiles)) {
147
+ const path = `subagents.profiles.${profileId}`;
148
+ if (!isValidAgentProfileId(profileId)) {
149
+ settings.warnings.push(`pi-forge: ${configPath} ${path} has an invalid profile id; the entry is ignored.`);
150
+ continue;
151
+ }
152
+ if (!isPlainObject(rawProfile)) {
153
+ settings.warnings.push(`pi-forge: ${configPath} ${path} must be a JSON object; the entry is ignored.`);
154
+ continue;
155
+ }
156
+ for (const field of Object.keys(rawProfile)) {
157
+ if (field === "enabled" || field === "backend" || field === "timeoutMs")
158
+ continue;
159
+ settings.warnings.push(`pi-forge: ${configPath} ${path}.${field} is unsupported and ignored.`);
160
+ }
161
+ const key = formatResourceKey({ scope, id: profileId });
162
+ const target = configuredProfile(settings, key) ?? {};
163
+ if (rawProfile.enabled !== undefined) {
164
+ if (typeof rawProfile.enabled !== "boolean") {
165
+ settings.warnings.push(`pi-forge: ${configPath} ${path}.enabled must be boolean; the configured value is ignored.`);
166
+ }
167
+ else {
168
+ target.enabled = rawProfile.enabled;
169
+ target.enabledSource = source;
170
+ }
171
+ }
172
+ if (rawProfile.backend !== undefined) {
173
+ if (typeof rawProfile.backend !== "string" || !rawProfile.backend.trim()) {
174
+ settings.warnings.push(`pi-forge: ${configPath} ${path}.backend must be a non-empty string; the configured value is ignored.`);
175
+ }
176
+ else {
177
+ target.backend = rawProfile.backend;
178
+ target.backendSource = source;
179
+ }
180
+ }
181
+ if (rawProfile.timeoutMs !== undefined) {
182
+ if (!isValidSubagentTimeoutMs(rawProfile.timeoutMs)) {
183
+ settings.warnings.push(`pi-forge: ${configPath} ${path}.timeoutMs must be an integer from ${MIN_SUBAGENT_TIMEOUT_MS} to ${MAX_SUBAGENT_TIMEOUT_MS}; the configured value is ignored.`);
184
+ }
185
+ else {
186
+ target.timeoutMs = rawProfile.timeoutMs;
187
+ target.timeoutSource = source;
188
+ }
189
+ }
190
+ if (Object.keys(target).length > 0)
191
+ settings.profiles[key] = target;
25
192
  }
26
- const value = raw.subagents.allowAgentInvocationWithoutApproval;
27
- if (value === undefined)
28
- return defaults;
193
+ }
194
+ function applyUnattended(section, configPath, settings) {
195
+ if (!section || section.allowAgentInvocationWithoutApproval === undefined)
196
+ return;
197
+ const value = section.allowAgentInvocationWithoutApproval;
29
198
  if (typeof value !== "boolean") {
199
+ settings.warnings.push(`pi-forge: ${configPath} subagents.allowAgentInvocationWithoutApproval must be boolean; per-run subagent approval remains required.`);
200
+ return;
201
+ }
202
+ settings.allowAgentInvocationWithoutApproval = value;
203
+ }
204
+ export function isValidSubagentTimeoutMs(value) {
205
+ return Number.isSafeInteger(value)
206
+ && value >= MIN_SUBAGENT_TIMEOUT_MS
207
+ && value <= MAX_SUBAGENT_TIMEOUT_MS;
208
+ }
209
+ export function globalForgeConfigPath() {
210
+ return process.env[GLOBAL_FORGE_CONFIG_PATH_ENV] ?? join(globalForgeDir(), "config.json");
211
+ }
212
+ export function projectForgeConfigPath(cwd) {
213
+ return join(cwd, ".pi", "forge", "config.json");
214
+ }
215
+ /**
216
+ * Update `subagents.profiles.<id>` in the selected scope's config file,
217
+ * preserving unknown top-level, `subagents`, and per-entry fields. Project
218
+ * config updates must be gated on project trust by the caller; global config
219
+ * is user-owned and always writable.
220
+ */
221
+ export function updateForgeSubagentProfileConfig(cwd, profileId, update, options = {}) {
222
+ const scope = options.scope ?? "project";
223
+ if (!isValidAgentProfileId(profileId)) {
224
+ return { ok: false, error: `Invalid agent profile id: ${profileId}` };
225
+ }
226
+ if (update.backend !== undefined && update.backend !== null && (typeof update.backend !== "string" || !update.backend.trim())) {
227
+ return { ok: false, error: "subagent backend must be a non-empty string or null to clear the override." };
228
+ }
229
+ if (update.timeoutMs !== undefined && update.timeoutMs !== null && !isValidSubagentTimeoutMs(update.timeoutMs)) {
30
230
  return {
31
- ...defaults,
32
- warnings: [`pi-forge: ${configPath} subagents.allowAgentInvocationWithoutApproval must be boolean; per-run subagent approval remains required.`],
231
+ ok: false,
232
+ error: `subagent timeoutMs must be an integer from ${MIN_SUBAGENT_TIMEOUT_MS} to ${MAX_SUBAGENT_TIMEOUT_MS} or null to clear the override.`,
33
233
  };
34
234
  }
35
- return { ...defaults, allowAgentInvocationWithoutApproval: value };
235
+ const configPath = scope === "project" ? projectForgeConfigPath(cwd) : globalForgeConfigPath();
236
+ let root = {};
237
+ if (existsSync(configPath)) {
238
+ let raw;
239
+ try {
240
+ raw = JSON.parse(readFileSync(configPath, "utf8"));
241
+ }
242
+ catch (error) {
243
+ return {
244
+ ok: false,
245
+ error: `Refusing to update unreadable ${configPath}: ${error instanceof Error ? error.message : String(error)}`,
246
+ };
247
+ }
248
+ if (!isPlainObject(raw)) {
249
+ return { ok: false, error: `Refusing to update ${configPath}: the config root must be a JSON object.` };
250
+ }
251
+ root = raw;
252
+ }
253
+ if (root.subagents !== undefined && !isPlainObject(root.subagents)) {
254
+ return { ok: false, error: `Refusing to update ${configPath}: subagents must be a JSON object.` };
255
+ }
256
+ const subagents = isPlainObject(root.subagents) ? root.subagents : {};
257
+ if (subagents.profiles !== undefined && !isPlainObject(subagents.profiles)) {
258
+ return { ok: false, error: `Refusing to update ${configPath}: subagents.profiles must be a JSON object.` };
259
+ }
260
+ const profiles = isPlainObject(subagents.profiles) ? subagents.profiles : {};
261
+ if (profiles[profileId] !== undefined && !isPlainObject(profiles[profileId])) {
262
+ return { ok: false, error: `Refusing to update ${configPath}: subagents.profiles.${profileId} must be a JSON object.` };
263
+ }
264
+ const entry = isPlainObject(profiles[profileId]) ? { ...profiles[profileId] } : {};
265
+ if (update.enabled !== undefined) {
266
+ if (update.enabled)
267
+ entry.enabled = true;
268
+ else
269
+ delete entry.enabled;
270
+ }
271
+ if (update.backend !== undefined) {
272
+ if (typeof update.backend === "string" && update.backend.trim())
273
+ entry.backend = update.backend.trim();
274
+ else
275
+ delete entry.backend;
276
+ }
277
+ if (update.timeoutMs !== undefined) {
278
+ if (update.timeoutMs === null)
279
+ delete entry.timeoutMs;
280
+ else
281
+ entry.timeoutMs = update.timeoutMs;
282
+ }
283
+ if (Object.keys(entry).length > 0)
284
+ profiles[profileId] = entry;
285
+ else
286
+ delete profiles[profileId];
287
+ if (Object.keys(profiles).length > 0)
288
+ subagents.profiles = profiles;
289
+ else
290
+ delete subagents.profiles;
291
+ if (Object.keys(subagents).length > 0)
292
+ root.subagents = subagents;
293
+ else
294
+ delete root.subagents;
295
+ try {
296
+ mkdirSync(dirname(configPath), { recursive: true });
297
+ writeFileSync(configPath, `${JSON.stringify(root, null, 2)}\n`, "utf8");
298
+ return { ok: true, configPath };
299
+ }
300
+ catch (error) {
301
+ return { ok: false, error: `Failed to write ${configPath}: ${error instanceof Error ? error.message : String(error)}` };
302
+ }
303
+ }
304
+ /**
305
+ * Resolve the configured per-profile settings for a profile selector. Bare
306
+ * selectors use project-first effective lookup; qualified selectors address
307
+ * the exact scope. Returns undefined for unknown or malformed selectors.
308
+ */
309
+ export function configuredProfileForSelector(settings, profileId) {
310
+ const parsed = parseResourceSelector(profileId);
311
+ if (!parsed.ok)
312
+ return undefined;
313
+ if (parsed.selector.scope) {
314
+ return configuredProfile(settings, formatResourceKey({ scope: parsed.selector.scope, id: parsed.selector.id }));
315
+ }
316
+ // A bare selector is intentionally project-only here. Callers that resolve
317
+ // a bare ID to a loaded global profile must pass the exact `global:<id>`
318
+ // selector; never infer global delegation authority from a bare ID.
319
+ return configuredProfile(settings, formatResourceKey({ scope: "project", id: parsed.selector.id }));
320
+ }
321
+ function configuredProfile(settings, key) {
322
+ return Object.hasOwn(settings.profiles, key) ? settings.profiles[key] : undefined;
36
323
  }
37
324
  function isPlainObject(value) {
38
325
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -1 +1 @@
1
- {"version":3,"file":"forge-config.js","sourceRoot":"","sources":["../src/forge-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASjC,MAAM,UAAU,yBAAyB,CAAC,GAAqB;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,EAAE,mCAAmC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAc,EAAE,CAAC;IACtG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,QAAQ,CAAC;IAExE,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACJ,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO;YACN,GAAG,QAAQ;YACX,QAAQ,EAAE,CAAC,4BAA4B,UAAU,iDAAiD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;SAC3J,CAAC;IACH,CAAC;IACD,IAAI,CAAC,aAAa,CAAC,GAAG,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BAA4B,CAC3C,QAA+B,EAC/B,SAAiB;IAEjB,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IACjC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC3B,OAAO,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjH,CAAC;IACD,2EAA2E;IAC3E,yEAAyE;IACzE,oEAAoE;IACpE,OAAO,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,SAAS,iBAAiB,CAAC,QAA+B,EAAE,GAAW;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACpC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ export { formatResourceKey, formatResourceSelector, isResourceScope, isValidResourceId, parseResourceSelector, resourceKey, RESOURCE_ID_PATTERN, type ResourceKey, type ResourceScope, type ResourceSelector, type ResourceSelectorParseResult, } from "./resource-identity.ts";
3
+ export { computeEffectiveView, createResourceCatalog, resolveEffectiveResource, resolveExactResource, resolveResourceSelector, type ResourceCatalog, type ScopedResource, } from "./catalog.ts";
2
4
  export { getRegisteredMacros, registerMacro, type PromptMacroDefinition, type PromptMacroRenderContext, type PromptMacroRenderer, } from "./macro-engine.ts";
3
5
  export { getRegisteredSlots, registerSlot, type PromptSlotDefinition, type PromptSlotRenderContext, type PromptSlotRenderer, } from "./slot-renderers.ts";
4
6
  export { type PromptExtensionArgumentDefinition, type PromptExtensionOptionDefinition, type PromptExtensionOptionsSchema, type PromptExtensionOptionType, type PromptRegistryEntry, } from "./extension-registry.ts";
5
7
  export { type ForgeExtensionApi, type ForgeExtensionRegister, } from "./forge-extensions.ts";
6
- export { AGENT_PROFILE_THINKING_LEVELS, AGENT_PROFILE_TYPE, agentProfileFingerprint, agentProfilePath, agentProfilesDir, chooseAutoActivateAgentProfile, hasAutoActivateAgentProfile, hasAgentProfileErrors, isResolvedAgentProfileUsable, isUsableAgentProfile, isValidAgentProfileId, loadAgentProfileFile, loadAgentProfiles, renderAgentProfileDiagnostics, resolveAgentProfile, validateAgentProfile, type AgentProfile, type AgentProfileDiagnostic, type AgentProfileDiagnosticLevel, type AgentProfileModelReference, type AgentProfileResolutionResources, type AgentProfileProvenance, type AgentProfileRuntimeSnapshot, type LoadedAgentProfile, type ResolvedAgentProfile, isAgentProfileProvenance, } from "./agent-profile.ts";
8
+ export { chooseAutoActivateStack, chooseDefaultStack, isDisabledPromptStackId, isUsablePromptStack, isValidPromptStackId, loadPromptStacks, loadPromptStacksScoped, validatePromptStack, } from "./loader.ts";
9
+ export { AGENT_PROFILE_THINKING_LEVELS, AGENT_PROFILE_TYPE, agentProfileFingerprint, agentProfilePath, agentProfilesDir, chooseAutoActivateAgentProfile, hasAutoActivateAgentProfile, hasAgentProfileErrors, isResolvedAgentProfileUsable, isUsableAgentProfile, isValidAgentProfileId, loadAgentProfileFile, loadAgentProfiles, loadAgentProfilesScoped, renderAgentProfileDiagnostics, resolveAgentProfile, validateAgentProfile, validateAgentProfilePromptStackScope, type AgentProfile, type AgentProfileDiagnostic, type AgentProfileDiagnosticLevel, type AgentProfileModelReference, type AgentProfileResolutionResources, type AgentProfileProvenance, type AgentProfileRuntimeSnapshot, type LoadedAgentProfile, type ResolvedAgentProfile, isAgentProfileProvenance, } from "./agent-profile.ts";
7
10
  export { applyResolvedAgentProfile, captureAgentProfile, createAgentProfilePreview, deleteAgentProfile, forgetAgentProfileProvenance, getAgentProfileRuntimeStatus, writeAgentProfile, type AgentProfileApplicationDeps, type AgentProfileApplicationResult, type AgentProfileApplicationState, type AgentProfileCaptureInput, type AgentProfileCaptureResult, type AgentProfileCurrentRuntime, type AgentProfileDeleteResult, type AgentProfileDriftField, type AgentProfilePreview, type AgentProfileRuntimeStatus, type AgentProfileWriteResult, } from "./profile-service.ts";
8
11
  export { createVariableAccess, promptRenderHelpers, type PromptRenderHelpers, type PromptVariableAccess, type PromptVariableScope, type PromptWritableVariableScope, } from "./render-helpers.ts";
9
- export * from "./subagent-contract.ts";
12
+ export * from "./subagent/contract.ts";
10
13
  export { appendProtectedAgentTask, collectMacroCommandNames, collectSubagentPromptDependencies, compileProtectedAgentTaskMessages, currentSubagentPromptRegistrationCatalog, isProtectedAgentTaskPreserved, prepareSubagentHostPlan, resolveSubagentHostProfile, type SubagentHostResolution, type SubagentPromptRegistration, type SubagentPromptRegistrationCatalog, } from "./subagent-host.ts";
11
- export { SubagentBackendRegistry, SubagentBackendRegistryError, type SubagentBackend, type SubagentBackendCancelInput, type SubagentBackendExecutionContext, type SubagentBackendExecutionResult, type SubagentBackendExecutionUpdate, type SubagentBackendPreparationContext, type SubagentBackendPreflightInput, type SubagentBackendRegistryOptions, type SubagentBackendTraceInput, type SubagentBackendTraceResult, type SubagentExecutionOptions, } from "./subagent/backend-registry.ts";
12
- export { PI_SDK_ISOLATED_BACKEND_DESCRIPTOR, PI_SDK_ISOLATED_BACKEND_ID, PiSdkIsolatedBackend, type PiSdkIsolatedBackendOptions, } from "./subagent/pi-sdk-backend.ts";
13
- export { PI_FORGE_SUBPROCESS_INPUT_ENV, PI_SUBPROCESS_READONLY_BACKEND_DESCRIPTOR, PI_SUBPROCESS_READONLY_BACKEND_ID, PiSubprocessBackend, type PiSubprocessBackendOptions, type PiSubprocessRunReport, type PiSubprocessUsage, } from "./subagent/pi-subprocess-backend.ts";
14
14
  export default function piForge(pi: ExtensionAPI): void;
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AAgBhH,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,6BAA6B,EAC7B,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,K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