@lesliechan721/aw 0.1.0-beta.10 → 0.1.0-beta.101

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 (864) hide show
  1. package/dist/authoring/assets/aw-config.d.mts +1 -50
  2. package/dist/authoring/assets/aw-config.mjs +58 -928
  3. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  4. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  6. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  7. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  8. package/dist/authoring/assets/command-runtime-config.mjs +134 -0
  9. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  10. package/dist/authoring/scripts/add-skill.mjs +16 -39
  11. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  12. package/dist/authoring/scripts/init-plugin.mjs +43 -71
  13. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  14. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  15. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  16. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  17. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  18. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  19. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +3 -3
  20. package/dist/authoring/scripts/lib/skill-scaffold.mjs +5 -8
  21. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  22. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  23. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  24. package/dist/authoring/scripts/validate-plugin.mjs +408 -1748
  25. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  26. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  27. package/dist/index.js +2 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/native-runtime/reader-runtime.mjs +34 -0
  30. package/dist/native-runtime/reader.d.mts +6 -0
  31. package/dist/native-runtime/reader.mjs +11 -0
  32. package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
  33. package/dist/scripts/aw-skill-eval-materializer.js +119 -114
  34. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  35. package/dist/scripts/bundle-plugins.js +32 -7
  36. package/dist/scripts/bundle-plugins.js.map +1 -1
  37. package/dist/scripts/plugin-staging.d.ts +1 -1
  38. package/dist/scripts/plugin-staging.js +5 -2
  39. package/dist/scripts/plugin-staging.js.map +1 -1
  40. package/dist/scripts/plugin-test-context-guard.d.mts +1 -0
  41. package/dist/scripts/plugin-test-context-guard.mjs +59 -0
  42. package/dist/scripts/plugin-test-context-guard.mjs.map +1 -0
  43. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  44. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  45. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  46. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  47. package/dist/scripts/test-plugin-scripts.js +343 -58
  48. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  49. package/dist/scripts/test-workers.d.mts +24 -0
  50. package/dist/scripts/test-workers.mjs +59 -0
  51. package/dist/scripts/test-workers.mjs.map +1 -0
  52. package/dist/src/adapters/helpers.d.ts +7 -0
  53. package/dist/src/adapters/helpers.js.map +1 -1
  54. package/dist/src/authoring/workspace-commands.d.ts +3 -0
  55. package/dist/src/authoring/workspace-commands.js +7 -2
  56. package/dist/src/authoring/workspace-commands.js.map +1 -1
  57. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  58. package/dist/src/commands/aw-capabilities.js +48 -19
  59. package/dist/src/commands/aw-capabilities.js.map +1 -1
  60. package/dist/src/commands/catalog-dev-source.d.ts +40 -3
  61. package/dist/src/commands/catalog-dev-source.js +333 -42
  62. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  63. package/dist/src/commands/catalog-generation.d.ts +5 -0
  64. package/dist/src/commands/catalog-generation.js.map +1 -1
  65. package/dist/src/commands/catalog-publication-inspection.d.ts +11 -3
  66. package/dist/src/commands/catalog-publication-inspection.js +211 -59
  67. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  68. package/dist/src/commands/catalog-publication-journal.d.ts +12 -0
  69. package/dist/src/commands/catalog-publication-journal.js +78 -1
  70. package/dist/src/commands/catalog-publication-journal.js.map +1 -1
  71. package/dist/src/commands/catalog-publish.d.ts +21 -1
  72. package/dist/src/commands/catalog-publish.js +133 -92
  73. package/dist/src/commands/catalog-publish.js.map +1 -1
  74. package/dist/src/commands/catalog-source.d.ts +26 -5
  75. package/dist/src/commands/catalog-source.js +154 -27
  76. package/dist/src/commands/catalog-source.js.map +1 -1
  77. package/dist/src/commands/catalog-status.js +2 -2
  78. package/dist/src/commands/catalog-status.js.map +1 -1
  79. package/dist/src/commands/catalog-store.d.ts +35 -7
  80. package/dist/src/commands/catalog-store.js +469 -79
  81. package/dist/src/commands/catalog-store.js.map +1 -1
  82. package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
  83. package/dist/src/commands/catalog-workspace-resolution.js +18 -3
  84. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
  85. package/dist/src/commands/console.js +33 -20
  86. package/dist/src/commands/console.js.map +1 -1
  87. package/dist/src/commands/dependency-operation-plan.d.ts +7 -0
  88. package/dist/src/commands/dependency-operation-plan.js +66 -30
  89. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  90. package/dist/src/commands/deployment-confirmation.d.ts +11 -0
  91. package/dist/src/commands/deployment-confirmation.js +101 -0
  92. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  93. package/dist/src/commands/init.js +1 -1
  94. package/dist/src/commands/init.js.map +1 -1
  95. package/dist/src/commands/intent-command.d.ts +35 -0
  96. package/dist/src/commands/intent-command.js +174 -0
  97. package/dist/src/commands/intent-command.js.map +1 -0
  98. package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
  99. package/dist/src/commands/lifecycle-command-package.js +199 -0
  100. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  101. package/dist/src/commands/managed-commands.d.ts +41 -0
  102. package/dist/src/commands/managed-commands.js +408 -0
  103. package/dist/src/commands/managed-commands.js.map +1 -0
  104. package/dist/src/commands/offline-cleanup-evidence.d.ts +12 -2
  105. package/dist/src/commands/offline-cleanup-evidence.js +57 -35
  106. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  107. package/dist/src/commands/operation-plan.d.ts +72 -2
  108. package/dist/src/commands/operation-plan.js +54 -3
  109. package/dist/src/commands/operation-plan.js.map +1 -1
  110. package/dist/src/commands/operation-planner.d.ts +6 -5
  111. package/dist/src/commands/operation-planner.js +23 -20
  112. package/dist/src/commands/operation-planner.js.map +1 -1
  113. package/dist/src/commands/options.d.ts +11 -16
  114. package/dist/src/commands/options.js +31 -25
  115. package/dist/src/commands/options.js.map +1 -1
  116. package/dist/src/commands/permission-batch.d.ts +5 -0
  117. package/dist/src/commands/permission-batch.js +83 -0
  118. package/dist/src/commands/permission-batch.js.map +1 -0
  119. package/dist/src/commands/plugin-capabilities.js +128 -58
  120. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  121. package/dist/src/commands/public-config-confirmation.d.ts +14 -0
  122. package/dist/src/commands/public-config-confirmation.js +73 -0
  123. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  124. package/dist/src/commands/public-interruption.d.ts +9 -0
  125. package/dist/src/commands/public-interruption.js +23 -0
  126. package/dist/src/commands/public-interruption.js.map +1 -0
  127. package/dist/src/commands/public-lifecycle-result.d.ts +107 -0
  128. package/dist/src/commands/public-lifecycle-result.js +536 -0
  129. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  130. package/dist/src/commands/public-lifecycle.d.ts +28 -0
  131. package/dist/src/commands/public-lifecycle.js +633 -0
  132. package/dist/src/commands/public-lifecycle.js.map +1 -0
  133. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  134. package/dist/src/commands/public-plugin-query.js +235 -0
  135. package/dist/src/commands/public-plugin-query.js.map +1 -0
  136. package/dist/src/commands/rebuild-command.d.ts +177 -16
  137. package/dist/src/commands/rebuild-command.js +3374 -1558
  138. package/dist/src/commands/rebuild-command.js.map +1 -1
  139. package/dist/src/commands/rebuild-integration.d.ts +100 -55
  140. package/dist/src/commands/rebuild-integration.js +866 -3275
  141. package/dist/src/commands/rebuild-integration.js.map +1 -1
  142. package/dist/src/commands/rebuild-operations.d.ts +68 -13
  143. package/dist/src/commands/rebuild-operations.js +309 -120
  144. package/dist/src/commands/rebuild-operations.js.map +1 -1
  145. package/dist/src/commands/rebuild-platform-integration.d.ts +99 -0
  146. package/dist/src/commands/rebuild-platform-integration.js +2329 -0
  147. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  148. package/dist/src/commands/reconcile-operation-plan.d.ts +14 -9
  149. package/dist/src/commands/reconcile-operation-plan.js +26 -6
  150. package/dist/src/commands/reconcile-operation-plan.js.map +1 -1
  151. package/dist/src/commands/review-inspection.d.ts +60 -0
  152. package/dist/src/commands/review-inspection.js +437 -0
  153. package/dist/src/commands/review-inspection.js.map +1 -0
  154. package/dist/src/commands/review-preparation.d.ts +51 -0
  155. package/dist/src/commands/review-preparation.js +400 -0
  156. package/dist/src/commands/review-preparation.js.map +1 -0
  157. package/dist/src/commands/runtime.d.ts +7 -1
  158. package/dist/src/commands/runtime.js +41 -8
  159. package/dist/src/commands/runtime.js.map +1 -1
  160. package/dist/src/commands/skill-eval.d.ts +8 -0
  161. package/dist/src/commands/skill-eval.js +126 -73
  162. package/dist/src/commands/skill-eval.js.map +1 -1
  163. package/dist/src/commands/status-v6.d.ts +148 -35
  164. package/dist/src/commands/status-v6.js +1166 -307
  165. package/dist/src/commands/status-v6.js.map +1 -1
  166. package/dist/src/commands/targets-command.d.ts +38 -0
  167. package/dist/src/commands/targets-command.js +210 -0
  168. package/dist/src/commands/targets-command.js.map +1 -0
  169. package/dist/src/commands/wizard.d.ts +7 -3
  170. package/dist/src/commands/wizard.js +7 -4
  171. package/dist/src/commands/wizard.js.map +1 -1
  172. package/dist/src/commands/write-commands.d.ts +7 -1
  173. package/dist/src/commands/write-commands.js +129 -38
  174. package/dist/src/commands/write-commands.js.map +1 -1
  175. package/dist/src/constants.d.ts +2 -3
  176. package/dist/src/constants.js +2 -3
  177. package/dist/src/constants.js.map +1 -1
  178. package/dist/src/eval/manifest-v1.d.ts +6 -3
  179. package/dist/src/eval/manifest-v1.js +44 -33
  180. package/dist/src/eval/manifest-v1.js.map +1 -1
  181. package/dist/src/generators/local-plugin.d.ts +4 -2
  182. package/dist/src/generators/local-plugin.js +319 -353
  183. package/dist/src/generators/local-plugin.js.map +1 -1
  184. package/dist/src/generators/permissions.d.ts +20 -2
  185. package/dist/src/generators/permissions.js +82 -15
  186. package/dist/src/generators/permissions.js.map +1 -1
  187. package/dist/src/index.d.ts +3 -34
  188. package/dist/src/index.js +1711 -1935
  189. package/dist/src/index.js.map +1 -1
  190. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  191. package/dist/src/intent/deployment-preferences.js +170 -0
  192. package/dist/src/intent/deployment-preferences.js.map +1 -0
  193. package/dist/src/intent/diagnostics.d.ts +11 -0
  194. package/dist/src/intent/diagnostics.js +14 -0
  195. package/dist/src/intent/diagnostics.js.map +1 -0
  196. package/dist/src/intent/intent-codec.d.ts +19 -0
  197. package/dist/src/intent/intent-codec.js +117 -0
  198. package/dist/src/intent/intent-codec.js.map +1 -0
  199. package/dist/src/intent/intent-store.d.ts +43 -0
  200. package/dist/src/intent/intent-store.js +118 -0
  201. package/dist/src/intent/intent-store.js.map +1 -0
  202. package/dist/src/intent/scope-context.d.ts +35 -0
  203. package/dist/src/intent/scope-context.js +179 -0
  204. package/dist/src/intent/scope-context.js.map +1 -0
  205. package/dist/src/intent/work-context.d.ts +13 -0
  206. package/dist/src/intent/work-context.js +22 -0
  207. package/dist/src/intent/work-context.js.map +1 -0
  208. package/dist/src/output/cli-progress.d.ts +30 -0
  209. package/dist/src/output/cli-progress.js +424 -0
  210. package/dist/src/output/cli-progress.js.map +1 -0
  211. package/dist/src/output/command-receipt.d.ts +6 -2
  212. package/dist/src/output/command-receipt.js +67 -32
  213. package/dist/src/output/command-receipt.js.map +1 -1
  214. package/dist/src/output/component-delivery.d.ts +28 -0
  215. package/dist/src/output/component-delivery.js +141 -0
  216. package/dist/src/output/component-delivery.js.map +1 -0
  217. package/dist/src/output/model.d.ts +123 -1
  218. package/dist/src/output/model.js +45 -1
  219. package/dist/src/output/model.js.map +1 -1
  220. package/dist/src/output/public-command-ids.d.ts +8 -0
  221. package/dist/src/output/public-command-ids.js +38 -0
  222. package/dist/src/output/public-command-ids.js.map +1 -0
  223. package/dist/src/output/public-result.d.ts +71 -0
  224. package/dist/src/output/public-result.js +40 -0
  225. package/dist/src/output/public-result.js.map +1 -0
  226. package/dist/src/output/rebuild-progress.d.ts +3 -0
  227. package/dist/src/output/rebuild-progress.js +34 -9
  228. package/dist/src/output/rebuild-progress.js.map +1 -1
  229. package/dist/src/output/receipt-projection.d.ts +7 -0
  230. package/dist/src/output/receipt-projection.js +670 -0
  231. package/dist/src/output/receipt-projection.js.map +1 -0
  232. package/dist/src/output/render/document.d.ts +55 -0
  233. package/dist/src/output/render/document.js +176 -0
  234. package/dist/src/output/render/document.js.map +1 -0
  235. package/dist/src/output/render/shared.d.ts +18 -0
  236. package/dist/src/output/render/shared.js +245 -0
  237. package/dist/src/output/render/shared.js.map +1 -0
  238. package/dist/src/output/render/style.d.ts +45 -0
  239. package/dist/src/output/render/style.js +155 -0
  240. package/dist/src/output/render/style.js.map +1 -0
  241. package/dist/src/output/render/views/commands-self.d.ts +6 -0
  242. package/dist/src/output/render/views/commands-self.js +210 -0
  243. package/dist/src/output/render/views/commands-self.js.map +1 -0
  244. package/dist/src/output/render/views/config.d.ts +2 -0
  245. package/dist/src/output/render/views/config.js +203 -0
  246. package/dist/src/output/render/views/config.js.map +1 -0
  247. package/dist/src/output/render/views/dev.d.ts +2 -0
  248. package/dist/src/output/render/views/dev.js +278 -0
  249. package/dist/src/output/render/views/dev.js.map +1 -0
  250. package/dist/src/output/render/views/fallback.d.ts +2 -0
  251. package/dist/src/output/render/views/fallback.js +6 -0
  252. package/dist/src/output/render/views/fallback.js.map +1 -0
  253. package/dist/src/output/render/views/index.d.ts +3 -0
  254. package/dist/src/output/render/views/index.js +79 -0
  255. package/dist/src/output/render/views/index.js.map +1 -0
  256. package/dist/src/output/render/views/lifecycle.d.ts +5 -0
  257. package/dist/src/output/render/views/lifecycle.js +170 -0
  258. package/dist/src/output/render/views/lifecycle.js.map +1 -0
  259. package/dist/src/output/render/views/sources-cache.d.ts +3 -0
  260. package/dist/src/output/render/views/sources-cache.js +322 -0
  261. package/dist/src/output/render/views/sources-cache.js.map +1 -0
  262. package/dist/src/output/render/views/targets.d.ts +2 -0
  263. package/dist/src/output/render/views/targets.js +82 -0
  264. package/dist/src/output/render/views/targets.js.map +1 -0
  265. package/dist/src/output/skill-invocation-notices.d.ts +18 -0
  266. package/dist/src/output/skill-invocation-notices.js +84 -0
  267. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  268. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  269. package/dist/src/platforms/antigravity-permissions.js +388 -0
  270. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  271. package/dist/src/platforms/capabilities.d.ts +9 -0
  272. package/dist/src/platforms/capabilities.js +125 -0
  273. package/dist/src/platforms/capabilities.js.map +1 -0
  274. package/dist/src/platforms/contracts.d.ts +394 -0
  275. package/dist/src/platforms/contracts.js +2 -0
  276. package/dist/src/platforms/contracts.js.map +1 -0
  277. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  278. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  279. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  280. package/dist/src/platforms/discovery.d.ts +100 -0
  281. package/dist/src/platforms/discovery.js +796 -0
  282. package/dist/src/platforms/discovery.js.map +1 -0
  283. package/dist/src/platforms/grok-permission-config.d.ts +23 -0
  284. package/dist/src/platforms/grok-permission-config.js +184 -0
  285. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  286. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  287. package/dist/src/platforms/grok-permission-document.js +145 -0
  288. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  289. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  290. package/dist/src/platforms/grok-permissions.js +311 -0
  291. package/dist/src/platforms/grok-permissions.js.map +1 -0
  292. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  293. package/dist/src/platforms/host-permission-policy.js +86 -0
  294. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  295. package/dist/src/platforms/identity.d.ts +4 -0
  296. package/dist/src/platforms/identity.js +22 -0
  297. package/dist/src/platforms/identity.js.map +1 -0
  298. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  299. package/dist/src/platforms/inspection-grok.js +380 -0
  300. package/dist/src/platforms/inspection-grok.js.map +1 -0
  301. package/dist/src/platforms/inspection-native.d.ts +8 -0
  302. package/dist/src/platforms/inspection-native.js +584 -0
  303. package/dist/src/platforms/inspection-native.js.map +1 -0
  304. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  305. package/dist/src/platforms/inspection-opencode.js +98 -0
  306. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  307. package/dist/src/platforms/inspection-pi.d.ts +9 -0
  308. package/dist/src/platforms/inspection-pi.js +490 -0
  309. package/dist/src/platforms/inspection-pi.js.map +1 -0
  310. package/dist/src/platforms/inspection-query.d.ts +26 -0
  311. package/dist/src/platforms/inspection-query.js +118 -0
  312. package/dist/src/platforms/inspection-query.js.map +1 -0
  313. package/dist/src/platforms/inspection.d.ts +20 -0
  314. package/dist/src/platforms/inspection.js +259 -0
  315. package/dist/src/platforms/inspection.js.map +1 -0
  316. package/dist/src/platforms/layout.d.ts +35 -0
  317. package/dist/src/platforms/layout.js +332 -0
  318. package/dist/src/platforms/layout.js.map +1 -0
  319. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  320. package/dist/src/platforms/lifecycle-native-services.js +213 -0
  321. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  322. package/dist/src/platforms/lifecycle-native.d.ts +14 -0
  323. package/dist/src/platforms/lifecycle-native.js +234 -0
  324. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  325. package/dist/src/platforms/lifecycle.d.ts +29 -0
  326. package/dist/src/platforms/lifecycle.js +688 -0
  327. package/dist/src/platforms/lifecycle.js.map +1 -0
  328. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  329. package/dist/src/platforms/opencode-permission-config.js +253 -0
  330. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  331. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  332. package/dist/src/platforms/opencode-permissions.js +212 -0
  333. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  334. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  335. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  336. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  337. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  338. package/dist/src/platforms/permission-ownership.js +543 -0
  339. package/dist/src/platforms/permission-ownership.js.map +1 -0
  340. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  341. package/dist/src/platforms/permission-sidecar.js +215 -0
  342. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  343. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  344. package/dist/src/platforms/projection-code-extension.js +126 -0
  345. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  346. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  347. package/dist/src/platforms/projection-command-resources.js +74 -0
  348. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  349. package/dist/src/platforms/projection-files.d.ts +28 -0
  350. package/dist/src/platforms/projection-files.js +113 -0
  351. package/dist/src/platforms/projection-files.js.map +1 -0
  352. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  353. package/dist/src/platforms/projection-marketplace.js +42 -0
  354. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  355. package/dist/src/platforms/projection.d.ts +13 -0
  356. package/dist/src/platforms/projection.js +578 -0
  357. package/dist/src/platforms/projection.js.map +1 -0
  358. package/dist/src/platforms/read-only-retry-policy.d.ts +34 -0
  359. package/dist/src/platforms/read-only-retry-policy.js +70 -0
  360. package/dist/src/platforms/read-only-retry-policy.js.map +1 -0
  361. package/dist/src/platforms/registry.d.ts +4 -0
  362. package/dist/src/platforms/registry.js +30 -0
  363. package/dist/src/platforms/registry.js.map +1 -0
  364. package/dist/src/platforms/retirement-native.d.ts +6 -0
  365. package/dist/src/platforms/retirement-native.js +95 -0
  366. package/dist/src/platforms/retirement-native.js.map +1 -0
  367. package/dist/src/platforms/supplement-layout.d.ts +20 -0
  368. package/dist/src/platforms/supplement-layout.js +54 -0
  369. package/dist/src/platforms/supplement-layout.js.map +1 -0
  370. package/dist/src/platforms/supplement-state.d.ts +13 -0
  371. package/dist/src/platforms/supplement-state.js +93 -0
  372. package/dist/src/platforms/supplement-state.js.map +1 -0
  373. package/dist/src/portable/commands.d.ts +60 -11
  374. package/dist/src/portable/commands.js +88 -346
  375. package/dist/src/portable/commands.js.map +1 -1
  376. package/dist/src/portable/historical-materialization.d.ts +25 -0
  377. package/dist/src/portable/historical-materialization.js +148 -0
  378. package/dist/src/portable/historical-materialization.js.map +1 -0
  379. package/dist/src/portable/materializer.d.ts +46 -2
  380. package/dist/src/portable/materializer.js +262 -259
  381. package/dist/src/portable/materializer.js.map +1 -1
  382. package/dist/src/portable/recovery-layout.d.ts +17 -0
  383. package/dist/src/portable/recovery-layout.js +42 -0
  384. package/dist/src/portable/recovery-layout.js.map +1 -0
  385. package/dist/src/portable/recovery.d.ts +177 -0
  386. package/dist/src/portable/recovery.js +597 -0
  387. package/dist/src/portable/recovery.js.map +1 -0
  388. package/dist/src/portable/writer.d.ts +67 -0
  389. package/dist/src/portable/writer.js +321 -0
  390. package/dist/src/portable/writer.js.map +1 -0
  391. package/dist/src/recovery/coordinator.d.ts +175 -0
  392. package/dist/src/recovery/coordinator.js +1629 -0
  393. package/dist/src/recovery/coordinator.js.map +1 -0
  394. package/dist/src/recovery/demand.d.ts +53 -0
  395. package/dist/src/recovery/demand.js +189 -0
  396. package/dist/src/recovery/demand.js.map +1 -0
  397. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  398. package/dist/src/recovery/install-concurrency.js +196 -0
  399. package/dist/src/recovery/install-concurrency.js.map +1 -0
  400. package/dist/src/recovery/interruption.d.ts +19 -0
  401. package/dist/src/recovery/interruption.js +43 -0
  402. package/dist/src/recovery/interruption.js.map +1 -0
  403. package/dist/src/recovery/joint-coordinator.d.ts +46 -0
  404. package/dist/src/recovery/joint-coordinator.js +1728 -0
  405. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  406. package/dist/src/recovery/joint-demand.d.ts +72 -0
  407. package/dist/src/recovery/joint-demand.js +332 -0
  408. package/dist/src/recovery/joint-demand.js.map +1 -0
  409. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  410. package/dist/src/recovery/joint-install-execution.js +312 -0
  411. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  412. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  413. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  414. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  415. package/dist/src/recovery/performance.d.ts +4 -0
  416. package/dist/src/recovery/performance.js +26 -0
  417. package/dist/src/recovery/performance.js.map +1 -0
  418. package/dist/src/recovery/receipt.d.ts +131 -0
  419. package/dist/src/recovery/receipt.js +91 -0
  420. package/dist/src/recovery/receipt.js.map +1 -0
  421. package/dist/src/recovery/retirement.d.ts +47 -0
  422. package/dist/src/recovery/retirement.js +504 -0
  423. package/dist/src/recovery/retirement.js.map +1 -0
  424. package/dist/src/recovery/status.d.ts +143 -0
  425. package/dist/src/recovery/status.js +1528 -0
  426. package/dist/src/recovery/status.js.map +1 -0
  427. package/dist/src/recovery/types.d.ts +85 -0
  428. package/dist/src/recovery/types.js +2 -0
  429. package/dist/src/recovery/types.js.map +1 -0
  430. package/dist/src/review/eval-source-input.d.ts +44 -0
  431. package/dist/src/review/eval-source-input.js +213 -0
  432. package/dist/src/review/eval-source-input.js.map +1 -0
  433. package/dist/src/review/platform-profile.d.ts +5 -0
  434. package/dist/src/review/platform-profile.js +13 -0
  435. package/dist/src/review/platform-profile.js.map +1 -0
  436. package/dist/src/review/review-profile.d.ts +20 -0
  437. package/dist/src/review/review-profile.js +286 -0
  438. package/dist/src/review/review-profile.js.map +1 -0
  439. package/dist/src/review/review-selection.d.ts +20 -0
  440. package/dist/src/review/review-selection.js +502 -0
  441. package/dist/src/review/review-selection.js.map +1 -0
  442. package/dist/src/review/review-types.d.ts +71 -0
  443. package/dist/src/review/review-types.js +16 -0
  444. package/dist/src/review/review-types.js.map +1 -0
  445. package/dist/src/review/skill-materialization.d.ts +67 -0
  446. package/dist/src/review/skill-materialization.js +235 -0
  447. package/dist/src/review/skill-materialization.js.map +1 -0
  448. package/dist/src/review/source-binding.d.ts +203 -0
  449. package/dist/src/review/source-binding.js +791 -0
  450. package/dist/src/review/source-binding.js.map +1 -0
  451. package/dist/src/tui/agent-management.d.ts +23 -0
  452. package/dist/src/tui/agent-management.js +319 -0
  453. package/dist/src/tui/agent-management.js.map +1 -0
  454. package/dist/src/tui/agent-settings.d.ts +47 -0
  455. package/dist/src/tui/agent-settings.js +97 -0
  456. package/dist/src/tui/agent-settings.js.map +1 -0
  457. package/dist/src/tui/catalog-generation.d.ts +9 -0
  458. package/dist/src/tui/catalog-generation.js +96 -6
  459. package/dist/src/tui/catalog-generation.js.map +1 -1
  460. package/dist/src/tui/catalog-sources/projection.d.ts +2 -2
  461. package/dist/src/tui/catalog-sources/screens.js +19 -12
  462. package/dist/src/tui/catalog-sources/screens.js.map +1 -1
  463. package/dist/src/tui/catalog-sources/session.d.ts +11 -1
  464. package/dist/src/tui/catalog-sources/session.js +80 -5
  465. package/dist/src/tui/catalog-sources/session.js.map +1 -1
  466. package/dist/src/tui/catalog-sources/types.d.ts +15 -2
  467. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  468. package/dist/src/tui/catalog-store-task.js +19 -0
  469. package/dist/src/tui/catalog-store-task.js.map +1 -0
  470. package/dist/src/tui/clipboard.d.ts +13 -0
  471. package/dist/src/tui/clipboard.js +95 -0
  472. package/dist/src/tui/clipboard.js.map +1 -0
  473. package/dist/src/tui/components.d.ts +113 -3
  474. package/dist/src/tui/components.js +201 -34
  475. package/dist/src/tui/components.js.map +1 -1
  476. package/dist/src/tui/config-array-draft.d.ts +30 -0
  477. package/dist/src/tui/config-array-draft.js +51 -0
  478. package/dist/src/tui/config-array-draft.js.map +1 -0
  479. package/dist/src/tui/config-leaf-editor.d.ts +44 -0
  480. package/dist/src/tui/config-leaf-editor.js +227 -0
  481. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  482. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  483. package/dist/src/tui/config-object-suggestions.js +71 -0
  484. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  485. package/dist/src/tui/config-references.d.ts +38 -0
  486. package/dist/src/tui/config-references.js +82 -0
  487. package/dist/src/tui/config-references.js.map +1 -0
  488. package/dist/src/tui/config-suggestions.d.ts +27 -0
  489. package/dist/src/tui/config-suggestions.js +62 -0
  490. package/dist/src/tui/config-suggestions.js.map +1 -0
  491. package/dist/src/tui/config-value-presentation.d.ts +23 -0
  492. package/dist/src/tui/config-value-presentation.js +151 -0
  493. package/dist/src/tui/config-value-presentation.js.map +1 -0
  494. package/dist/src/tui/console-app-v4.d.ts +14 -5
  495. package/dist/src/tui/console-app-v4.js +9779 -2488
  496. package/dist/src/tui/console-app-v4.js.map +1 -1
  497. package/dist/src/tui/content-item-card.d.ts +13 -0
  498. package/dist/src/tui/content-item-card.js +51 -0
  499. package/dist/src/tui/content-item-card.js.map +1 -0
  500. package/dist/src/tui/controller-runtime.d.ts +4 -3
  501. package/dist/src/tui/controller-runtime.js +1610 -590
  502. package/dist/src/tui/controller-runtime.js.map +1 -1
  503. package/dist/src/tui/controller.d.ts +583 -80
  504. package/dist/src/tui/controller.js +3362 -263
  505. package/dist/src/tui/controller.js.map +1 -1
  506. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  507. package/dist/src/tui/dependency-graph-view.js +121 -0
  508. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  509. package/dist/src/tui/dependency-graph.d.ts +81 -0
  510. package/dist/src/tui/dependency-graph.js +452 -0
  511. package/dist/src/tui/dependency-graph.js.map +1 -0
  512. package/dist/src/tui/deployment-view.d.ts +14 -0
  513. package/dist/src/tui/deployment-view.js +175 -0
  514. package/dist/src/tui/deployment-view.js.map +1 -0
  515. package/dist/src/tui/diagnostic-projection.d.ts +31 -0
  516. package/dist/src/tui/diagnostic-projection.js +681 -0
  517. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  518. package/dist/src/tui/diagnostics.d.ts +6 -2
  519. package/dist/src/tui/diagnostics.js +14 -2
  520. package/dist/src/tui/diagnostics.js.map +1 -1
  521. package/dist/src/tui/entity-cards.d.ts +56 -0
  522. package/dist/src/tui/entity-cards.js +327 -0
  523. package/dist/src/tui/entity-cards.js.map +1 -0
  524. package/dist/src/tui/glossary.d.ts +25 -0
  525. package/dist/src/tui/glossary.js +78 -0
  526. package/dist/src/tui/glossary.js.map +1 -0
  527. package/dist/src/tui/guided-setup.d.ts +25 -0
  528. package/dist/src/tui/guided-setup.js +101 -0
  529. package/dist/src/tui/guided-setup.js.map +1 -0
  530. package/dist/src/tui/index.d.ts +4 -1
  531. package/dist/src/tui/index.js +4 -1
  532. package/dist/src/tui/index.js.map +1 -1
  533. package/dist/src/tui/input-display.d.ts +1 -0
  534. package/dist/src/tui/input-display.js +23 -1
  535. package/dist/src/tui/input-display.js.map +1 -1
  536. package/dist/src/tui/keys.d.ts +44 -0
  537. package/dist/src/tui/keys.js +43 -15
  538. package/dist/src/tui/keys.js.map +1 -1
  539. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  540. package/dist/src/tui/lifecycle-action-view.js +36 -0
  541. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  542. package/dist/src/tui/model.d.ts +141 -28
  543. package/dist/src/tui/model.js +968 -285
  544. package/dist/src/tui/model.js.map +1 -1
  545. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  546. package/dist/src/tui/operation-diagnostic-screens.js +76 -0
  547. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  548. package/dist/src/tui/operation-history.d.ts +91 -0
  549. package/dist/src/tui/operation-history.js +167 -0
  550. package/dist/src/tui/operation-history.js.map +1 -0
  551. package/dist/src/tui/operation-review-planner.d.ts +7 -0
  552. package/dist/src/tui/operation-review-planner.js +980 -146
  553. package/dist/src/tui/operation-review-planner.js.map +1 -1
  554. package/dist/src/tui/plugin-content.d.ts +33 -0
  555. package/dist/src/tui/plugin-content.js +245 -0
  556. package/dist/src/tui/plugin-content.js.map +1 -0
  557. package/dist/src/tui/plugin-detail.d.ts +75 -0
  558. package/dist/src/tui/plugin-detail.js +267 -0
  559. package/dist/src/tui/plugin-detail.js.map +1 -0
  560. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  561. package/dist/src/tui/plugin-write-task.js +286 -0
  562. package/dist/src/tui/plugin-write-task.js.map +1 -0
  563. package/dist/src/tui/query-header.d.ts +30 -0
  564. package/dist/src/tui/query-header.js +40 -0
  565. package/dist/src/tui/query-header.js.map +1 -0
  566. package/dist/src/tui/reader.d.ts +38 -0
  567. package/dist/src/tui/reader.js +49 -0
  568. package/dist/src/tui/reader.js.map +1 -0
  569. package/dist/src/tui/router.d.ts +170 -39
  570. package/dist/src/tui/router.js +338 -50
  571. package/dist/src/tui/router.js.map +1 -1
  572. package/dist/src/tui/scoped-flow.d.ts +49 -0
  573. package/dist/src/tui/scoped-flow.js +212 -0
  574. package/dist/src/tui/scoped-flow.js.map +1 -0
  575. package/dist/src/tui/scoped-inventory.d.ts +139 -0
  576. package/dist/src/tui/scoped-inventory.js +295 -0
  577. package/dist/src/tui/scoped-inventory.js.map +1 -0
  578. package/dist/src/tui/screen-registry.d.ts +696 -0
  579. package/dist/src/tui/screen-registry.js +226 -0
  580. package/dist/src/tui/screen-registry.js.map +1 -0
  581. package/dist/src/tui/session-console-app.d.ts +8 -0
  582. package/dist/src/tui/session-console-app.js +24 -0
  583. package/dist/src/tui/session-console-app.js.map +1 -0
  584. package/dist/src/tui/session-host.d.ts +45 -0
  585. package/dist/src/tui/session-host.js +219 -0
  586. package/dist/src/tui/session-host.js.map +1 -0
  587. package/dist/src/tui/source-detail-card.d.ts +29 -0
  588. package/dist/src/tui/source-detail-card.js +45 -0
  589. package/dist/src/tui/source-detail-card.js.map +1 -0
  590. package/dist/src/tui/theme.d.ts +12 -0
  591. package/dist/src/tui/theme.js +12 -0
  592. package/dist/src/tui/theme.js.map +1 -1
  593. package/dist/src/tui/viewport.d.ts +1 -0
  594. package/dist/src/tui/viewport.js +23 -0
  595. package/dist/src/tui/viewport.js.map +1 -1
  596. package/dist/src/tui/wizard.js +26 -4
  597. package/dist/src/tui/wizard.js.map +1 -1
  598. package/dist/src/types.d.ts +105 -83
  599. package/dist/src/types.js +1 -1
  600. package/dist/src/types.js.map +1 -1
  601. package/dist/src/utils/agent-version.d.ts +10 -4
  602. package/dist/src/utils/agent-version.js +6 -8
  603. package/dist/src/utils/agent-version.js.map +1 -1
  604. package/dist/src/utils/artifact-plan.d.ts +18 -25
  605. package/dist/src/utils/artifact-plan.js +59 -445
  606. package/dist/src/utils/artifact-plan.js.map +1 -1
  607. package/dist/src/utils/artifact-renderer.d.ts +64 -90
  608. package/dist/src/utils/artifact-renderer.js +202 -303
  609. package/dist/src/utils/artifact-renderer.js.map +1 -1
  610. package/dist/src/utils/artifact-request.d.ts +19 -14
  611. package/dist/src/utils/artifact-request.js +51 -36
  612. package/dist/src/utils/artifact-request.js.map +1 -1
  613. package/dist/src/utils/artifact-sources.d.ts +4 -8
  614. package/dist/src/utils/artifact-sources.js +15 -6
  615. package/dist/src/utils/artifact-sources.js.map +1 -1
  616. package/dist/src/utils/aw-home-mutation-lock.d.ts +1 -0
  617. package/dist/src/utils/aw-home-mutation-lock.js +28 -6
  618. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  619. package/dist/src/utils/bundle-layout.d.ts +2 -0
  620. package/dist/src/utils/bundle-layout.js +88 -158
  621. package/dist/src/utils/bundle-layout.js.map +1 -1
  622. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  623. package/dist/src/utils/catalog-capability-projection.js +14 -0
  624. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  625. package/dist/src/utils/catalog-digests.d.ts +2 -12
  626. package/dist/src/utils/catalog-digests.js +7 -55
  627. package/dist/src/utils/catalog-digests.js.map +1 -1
  628. package/dist/src/utils/catalog-generation-resolver.d.ts +28 -4
  629. package/dist/src/utils/catalog-generation-resolver.js +146 -40
  630. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  631. package/dist/src/utils/catalog-generation-service.d.ts +25 -2
  632. package/dist/src/utils/catalog-generation-service.js +99 -48
  633. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  634. package/dist/src/utils/catalog-generation-state.js +1 -1
  635. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  636. package/dist/src/utils/catalog-generation-store.d.ts +5 -0
  637. package/dist/src/utils/catalog-generation-store.js +69 -10
  638. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  639. package/dist/src/utils/catalog-operation-context.d.ts +61 -4
  640. package/dist/src/utils/catalog-operation-context.js +225 -4
  641. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  642. package/dist/src/utils/catalog-public-error.js +4 -0
  643. package/dist/src/utils/catalog-public-error.js.map +1 -1
  644. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
  645. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  646. package/dist/src/utils/catalog-snapshot.d.ts +3 -0
  647. package/dist/src/utils/catalog-snapshot.js +4 -1
  648. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  649. package/dist/src/utils/catalog-source-impact.d.ts +3 -2
  650. package/dist/src/utils/catalog-source-impact.js +142 -20
  651. package/dist/src/utils/catalog-source-impact.js.map +1 -1
  652. package/dist/src/utils/catalog-source-references.d.ts +57 -1
  653. package/dist/src/utils/catalog-source-references.js +755 -162
  654. package/dist/src/utils/catalog-source-references.js.map +1 -1
  655. package/dist/src/utils/catalog-sources.d.ts +1 -1
  656. package/dist/src/utils/catalog-sources.js +21 -5
  657. package/dist/src/utils/catalog-sources.js.map +1 -1
  658. package/dist/src/utils/codex-config.d.ts +3 -0
  659. package/dist/src/utils/codex-config.js +7 -0
  660. package/dist/src/utils/codex-config.js.map +1 -1
  661. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  662. package/dist/src/utils/codex-executable-discovery.js +431 -0
  663. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  664. package/dist/src/utils/codex-manager.d.ts +23 -42
  665. package/dist/src/utils/codex-manager.js +79 -767
  666. package/dist/src/utils/codex-manager.js.map +1 -1
  667. package/dist/src/utils/codex-native-observation.d.ts +40 -1
  668. package/dist/src/utils/codex-native-observation.js +172 -0
  669. package/dist/src/utils/codex-native-observation.js.map +1 -1
  670. package/dist/src/utils/codex-reconciler.d.ts +2 -7
  671. package/dist/src/utils/codex-reconciler.js +33 -5
  672. package/dist/src/utils/codex-reconciler.js.map +1 -1
  673. package/dist/src/utils/codex-shared-native.d.ts +8 -26
  674. package/dist/src/utils/codex-shared-native.js +63 -83
  675. package/dist/src/utils/codex-shared-native.js.map +1 -1
  676. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  677. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  678. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  679. package/dist/src/utils/codex-skills-root.js +29 -0
  680. package/dist/src/utils/codex-skills-root.js.map +1 -0
  681. package/dist/src/utils/codex-surface-analysis.d.ts +6 -2
  682. package/dist/src/utils/codex-surface-analysis.js +31 -56
  683. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  684. package/dist/src/utils/component-agent-binding.d.ts +17 -0
  685. package/dist/src/utils/component-agent-binding.js +119 -0
  686. package/dist/src/utils/component-agent-binding.js.map +1 -0
  687. package/dist/src/utils/component-command-preparation.d.ts +33 -0
  688. package/dist/src/utils/component-command-preparation.js +129 -0
  689. package/dist/src/utils/component-command-preparation.js.map +1 -0
  690. package/dist/src/utils/component-gap.d.ts +4 -0
  691. package/dist/src/utils/component-gap.js +16 -0
  692. package/dist/src/utils/component-gap.js.map +1 -0
  693. package/dist/src/utils/component-resources.d.ts +53 -0
  694. package/dist/src/utils/component-resources.js +340 -0
  695. package/dist/src/utils/component-resources.js.map +1 -0
  696. package/dist/src/utils/config-platforms.d.ts +21 -0
  697. package/dist/src/utils/config-platforms.js +51 -0
  698. package/dist/src/utils/config-platforms.js.map +1 -0
  699. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  700. package/dist/src/utils/dynamic-skill-tree.js +33 -40
  701. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  702. package/dist/src/utils/git-catalog-provider.d.ts +3 -0
  703. package/dist/src/utils/git-catalog-provider.js +49 -3
  704. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  705. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  706. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  707. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  708. package/dist/src/utils/local-marketplace.d.ts +19 -12
  709. package/dist/src/utils/local-marketplace.js +97 -194
  710. package/dist/src/utils/local-marketplace.js.map +1 -1
  711. package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
  712. package/dist/src/utils/managed-command-cli-review.js +431 -0
  713. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  714. package/dist/src/utils/managed-command-closure.d.ts +14 -0
  715. package/dist/src/utils/managed-command-closure.js +156 -0
  716. package/dist/src/utils/managed-command-closure.js.map +1 -0
  717. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  718. package/dist/src/utils/managed-command-errors.js +10 -0
  719. package/dist/src/utils/managed-command-errors.js.map +1 -0
  720. package/dist/src/utils/managed-command-materialization.d.ts +90 -0
  721. package/dist/src/utils/managed-command-materialization.js +375 -0
  722. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  723. package/dist/src/utils/managed-command-preparation.d.ts +30 -0
  724. package/dist/src/utils/managed-command-preparation.js +39 -0
  725. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  726. package/dist/src/utils/managed-command-review.d.ts +33 -0
  727. package/dist/src/utils/managed-command-review.js +80 -0
  728. package/dist/src/utils/managed-command-review.js.map +1 -0
  729. package/dist/src/utils/managed-command-runtime.d.ts +36 -0
  730. package/dist/src/utils/managed-command-runtime.js +126 -0
  731. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  732. package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
  733. package/dist/src/utils/managed-command-snapshots.js +89 -0
  734. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  735. package/dist/src/utils/managed-command-store.d.ts +141 -0
  736. package/dist/src/utils/managed-command-store.js +839 -0
  737. package/dist/src/utils/managed-command-store.js.map +1 -0
  738. package/dist/src/utils/multi-source-catalog.d.ts +6 -1
  739. package/dist/src/utils/multi-source-catalog.js +9 -4
  740. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  741. package/dist/src/utils/native-cli-interruption.d.ts +11 -0
  742. package/dist/src/utils/native-cli-interruption.js +106 -0
  743. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  744. package/dist/src/utils/native-cli.d.ts +37 -6
  745. package/dist/src/utils/native-cli.js +523 -60
  746. package/dist/src/utils/native-cli.js.map +1 -1
  747. package/dist/src/utils/native-demand.d.ts +29 -0
  748. package/dist/src/utils/native-demand.js +4 -0
  749. package/dist/src/utils/native-demand.js.map +1 -0
  750. package/dist/src/utils/native-tool-context.d.ts +17 -0
  751. package/dist/src/utils/native-tool-context.js +40 -0
  752. package/dist/src/utils/native-tool-context.js.map +1 -0
  753. package/dist/src/utils/native-tool-review.d.ts +8 -0
  754. package/dist/src/utils/native-tool-review.js +14 -0
  755. package/dist/src/utils/native-tool-review.js.map +1 -0
  756. package/dist/src/utils/ownership.d.ts +38 -3
  757. package/dist/src/utils/ownership.js +118 -11
  758. package/dist/src/utils/ownership.js.map +1 -1
  759. package/dist/src/utils/package-content.d.ts +7 -0
  760. package/dist/src/utils/package-content.js +70 -0
  761. package/dist/src/utils/package-content.js.map +1 -0
  762. package/dist/src/utils/path-catalog-provider.js +2 -0
  763. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  764. package/dist/src/utils/paths.d.ts +1 -1
  765. package/dist/src/utils/paths.js +5 -2
  766. package/dist/src/utils/paths.js.map +1 -1
  767. package/dist/src/utils/platform-empty-state.d.ts +69 -0
  768. package/dist/src/utils/platform-empty-state.js +249 -0
  769. package/dist/src/utils/platform-empty-state.js.map +1 -0
  770. package/dist/src/utils/platform-support.d.ts +1 -1
  771. package/dist/src/utils/platform-support.js +1 -1
  772. package/dist/src/utils/platform-support.js.map +1 -1
  773. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  774. package/dist/src/utils/plugin-config-command-apply.js +142 -0
  775. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  776. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  777. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  778. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  779. package/dist/src/utils/plugin-config-impact.d.ts +76 -0
  780. package/dist/src/utils/plugin-config-impact.js +359 -0
  781. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  782. package/dist/src/utils/plugin-config-references.d.ts +116 -0
  783. package/dist/src/utils/plugin-config-references.js +379 -0
  784. package/dist/src/utils/plugin-config-references.js.map +1 -0
  785. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
  786. package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
  787. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
  788. package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
  789. package/dist/src/utils/plugin-config-suggestions.js +322 -0
  790. package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
  791. package/dist/src/utils/plugin-config-write.d.ts +108 -19
  792. package/dist/src/utils/plugin-config-write.js +781 -568
  793. package/dist/src/utils/plugin-config-write.js.map +1 -1
  794. package/dist/src/utils/plugin-config.d.ts +122 -43
  795. package/dist/src/utils/plugin-config.js +574 -610
  796. package/dist/src/utils/plugin-config.js.map +1 -1
  797. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  798. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  799. package/dist/src/utils/plugin-scripts.d.ts +41 -17
  800. package/dist/src/utils/plugin-scripts.js +586 -123
  801. package/dist/src/utils/plugin-scripts.js.map +1 -1
  802. package/dist/src/utils/process-lock.d.ts +1 -0
  803. package/dist/src/utils/process-lock.js +22 -5
  804. package/dist/src/utils/process-lock.js.map +1 -1
  805. package/dist/src/utils/process-tree.d.ts +2 -2
  806. package/dist/src/utils/process-tree.js +1 -1
  807. package/dist/src/utils/process-tree.js.map +1 -1
  808. package/dist/src/utils/project-boundary.d.ts +11 -1
  809. package/dist/src/utils/project-boundary.js +33 -11
  810. package/dist/src/utils/project-boundary.js.map +1 -1
  811. package/dist/src/utils/rendered-contract.js +24 -1
  812. package/dist/src/utils/rendered-contract.js.map +1 -1
  813. package/dist/src/utils/runtime-config.d.ts +18 -0
  814. package/dist/src/utils/runtime-config.js +64 -0
  815. package/dist/src/utils/runtime-config.js.map +1 -0
  816. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  817. package/dist/src/utils/runtime-skill-closure.js +50 -7
  818. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  819. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  820. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  821. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  822. package/dist/src/utils/sensitive-content.d.ts +4 -0
  823. package/dist/src/utils/sensitive-content.js +36 -0
  824. package/dist/src/utils/sensitive-content.js.map +1 -0
  825. package/dist/src/utils/skill-invocation-warning.d.ts +19 -0
  826. package/dist/src/utils/skill-invocation-warning.js +43 -0
  827. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  828. package/dist/src/utils/skill-validation.js +0 -5
  829. package/dist/src/utils/skill-validation.js.map +1 -1
  830. package/dist/src/utils/state-paths.d.ts +8 -3
  831. package/dist/src/utils/state-paths.js +53 -16
  832. package/dist/src/utils/state-paths.js.map +1 -1
  833. package/dist/src/utils/target-eligibility.d.ts +2 -2
  834. package/dist/src/utils/target-eligibility.js.map +1 -1
  835. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  836. package/dist/src/utils/windows-claude-shim.js +10 -0
  837. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  838. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  839. package/dist/src/utils/windows-npm-shim.js +155 -0
  840. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  841. package/dist/vitest.config.js +109 -9
  842. package/dist/vitest.config.js.map +1 -1
  843. package/package.json +20 -12
  844. package/dist/authoring/templates/aw-config-runtime.d.mts +0 -2
  845. package/dist/authoring/templates/aw-config-runtime.mjs +0 -407
  846. package/dist/authoring/templates/aw-config-runtime.mjs.map +0 -1
  847. package/dist/src/commands/review-publication.d.ts +0 -99
  848. package/dist/src/commands/review-publication.js +0 -904
  849. package/dist/src/commands/review-publication.js.map +0 -1
  850. package/dist/src/commands/sync-command.d.ts +0 -23
  851. package/dist/src/commands/sync-command.js +0 -242
  852. package/dist/src/commands/sync-command.js.map +0 -1
  853. package/dist/src/portable/skills-cli.d.ts +0 -43
  854. package/dist/src/portable/skills-cli.js +0 -148
  855. package/dist/src/portable/skills-cli.js.map +0 -1
  856. package/dist/src/utils/codex-native-render-receipt.d.ts +0 -40
  857. package/dist/src/utils/codex-native-render-receipt.js +0 -205
  858. package/dist/src/utils/codex-native-render-receipt.js.map +0 -1
  859. package/dist/src/utils/plugin-intent-state.d.ts +0 -34
  860. package/dist/src/utils/plugin-intent-state.js +0 -289
  861. package/dist/src/utils/plugin-intent-state.js.map +0 -1
  862. package/dist/src/utils/slash-commands.d.ts +0 -1
  863. package/dist/src/utils/slash-commands.js +0 -2
  864. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -1,17 +1,33 @@
1
1
  import crypto from 'node:crypto';
2
+ import { resolveWorkContext } from '../intent/work-context.js';
3
+ import { observePreferences } from '../intent/deployment-preferences.js';
2
4
  import * as nodeFs from 'node:fs/promises';
3
5
  import path from 'node:path';
4
6
  import fs from 'fs-extra';
5
- import { canonicalizePluginConfigValues, formatPluginConfigIssue, matchPluginConfigPreset, redactPluginConfigValue, stablePluginConfigStringify, validatePluginConfigDocument, validatePluginConfigValue as validateCorePluginConfigValue, } from '@lesliechan721/aw-plugin-core/manifest';
6
- import { assertTestReadablePath, assertTestWritablePath, } from './test-path-fence.js';
7
+ import { canonicalizePluginConfigValues, selectPluginConfigProfile, PLATFORM_TARGETS, formatPluginConfigIssue, getPluginConfigDependencyKeys, getPluginConfigDependencyFields, getStrippedPlatformOnlyProperties, matchPluginConfigPreset, redactPluginConfigValue, resolvePluginConfigObjectProperties, stablePluginConfigStringify, validatePluginConfigCandidate, validatePluginConfigDocument, validatePluginConfigValue as validateCorePluginConfigValue, } from '@lesliechan721/aw-plugin-core/manifest';
7
8
  import { canonicalizePathThroughExistingAncestor, resolveAwHome, resolveRepoRootSync, } from './paths.js';
8
9
  import { assertRealFileParentWithinRoot, assertSafeFileMutationPath, atomicReplaceSafeFile, } from './safe-fs.js';
9
- export function codexNativeRefreshKeys(manifest) {
10
- return new Set((manifest.artifacts?.targets ?? []).flatMap((target) => target.platform === 'codex'
11
- && target.target === 'codex.skill'
12
- && target.delivery?.mode === 'codex-native'
13
- ? target.refreshKeys
14
- : []));
10
+ import { pluginConfigHasExternalReferences, resolvePluginConfigReferenceContext, } from './plugin-config-references.js';
11
+ import { assertConfigLayerWritable, resolveConfigurableLayers } from './config-platforms.js';
12
+ export { resolvePluginConfigReferenceContext } from './plugin-config-references.js';
13
+ function readPluginConfigBinding(value) {
14
+ return isRecord(value) && value.kind === 'source'
15
+ && typeof value.sourceIdentity === 'string'
16
+ && /^sha256:[0-9a-f]{64}$/u.test(value.sourceIdentity)
17
+ && Object.keys(value).every((key) => ['kind', 'sourceIdentity'].includes(key))
18
+ ? { kind: 'source', sourceIdentity: value.sourceIdentity } : null;
19
+ }
20
+ function readPluginConfigEnvelopeV6(value, _scope) {
21
+ if (!isRecord(value) || value.schemaVersion !== 6
22
+ || typeof value.sourceId !== 'string' || typeof value.pluginName !== 'string'
23
+ || !isRecord(value.common) || !isRecord(value.platforms)
24
+ || Object.keys(value).some((key) => !['schemaVersion', 'sourceId', 'pluginName', 'binding', 'common', 'platforms'].includes(key))
25
+ || Object.keys(value.platforms).some((key) => !PLATFORM_TARGETS.includes(key)))
26
+ return null;
27
+ const binding = readPluginConfigBinding(value.binding);
28
+ return binding ? { schemaVersion: 6, sourceId: value.sourceId, pluginName: value.pluginName,
29
+ binding, common: value.common,
30
+ platforms: value.platforms } : null;
15
31
  }
16
32
  export class PluginConfigResetError extends Error {
17
33
  code;
@@ -186,7 +202,7 @@ function formatValue(value) {
186
202
  if (typeof value === 'number' || typeof value === 'boolean') {
187
203
  return stablePluginConfigStringify(value);
188
204
  }
189
- if (isRecord(value)) {
205
+ if (isRecord(value) || Array.isArray(value)) {
190
206
  return stablePluginConfigStringify(value);
191
207
  }
192
208
  return JSON.stringify(value);
@@ -204,10 +220,11 @@ async function calculateConfigSchemaManifestDigestForPlugin(plugin) {
204
220
  hash.update(JSON.stringify(plugin.manifest));
205
221
  return `sha256:${hash.digest('hex')}`;
206
222
  }
207
- function createConfigSchemaEvidenceFromCurrentCatalog(plugin, manifestDigest) {
223
+ function createConfigSchemaEvidenceFromCurrentCatalog(plugin, manifestDigest, platform) {
208
224
  return {
209
225
  source: 'currentCatalog',
210
- identity: createPluginConfigSchemaIdentity(plugin.manifest),
226
+ identity: createPluginConfigSchemaIdentity(plugin.manifest, platform),
227
+ platform,
211
228
  pluginVersion: plugin.manifest.version,
212
229
  manifestDigest,
213
230
  };
@@ -235,52 +252,45 @@ export function resolveAwProjectRoot(cwd) {
235
252
  return path.resolve(resolveRepoRootSync(cwd));
236
253
  }
237
254
  function resolvePluginConfigAllowedRoot(options) {
238
- return options.scope === 'user'
239
- ? resolveAwHome(options.env)
240
- : path.join(resolveAwProjectRoot(options.cwd), '.agent-workflows');
255
+ return resolveAwHome(options.env);
241
256
  }
257
+ /** Scope selects source context. All config values belong to the user document. */
242
258
  export function resolvePluginConfigStorePath(options) {
243
259
  const pluginName = assertSafePluginConfigSegment(options.pluginName);
244
- const sourceId = options.sourceId === undefined
245
- ? undefined
246
- : assertSafePluginConfigSegment(options.sourceId);
247
- const root = options.scope === 'user'
248
- ? resolveAwHome(options.env)
249
- : path.join(resolveAwProjectRoot(options.cwd), '.agent-workflows');
250
- const filePath = path.join(root, CONFIG_DIR, ...(sourceId ? [sourceId] : []), pluginName, CONFIG_FILE);
251
- if (options.scope !== 'project') {
252
- return filePath;
253
- }
254
- if (options.access === 'read') {
255
- return assertTestReadablePath(filePath, 'project plugin config store (.agent-workflows/plugin-config)', '用 registerReadonlyFixtureRoot() 或 runWithRepositoryCwdAsReadOnly() 登记只读 project fixture 根;需要写入时改用 withSafeTestCwd() 或 registerWritableStateRoot()。');
256
- }
257
- if (options.access === 'write') {
258
- return assertTestWritablePath(filePath, 'project plugin config store (.agent-workflows/plugin-config)', '用 withSafeTestCwd() 切到测试可写 cwd,或通过 registerWritableStateRoot() 登记 project fixture 根。');
259
- }
260
- return filePath;
260
+ const sourceId = options.sourceId === undefined ? undefined : assertSafePluginConfigSegment(options.sourceId);
261
+ return path.join(resolveAwHome(options.env), CONFIG_DIR, ...(sourceId ? [sourceId] : []), pluginName, CONFIG_FILE);
261
262
  }
262
263
  export function resolvePluginConfigStoreTargets(options) {
263
- if (options.scope === 'user') {
264
- return [{
265
- storeKind: 'user',
266
- path: resolvePluginConfigStorePath(options),
267
- }];
268
- }
269
- return [{
270
- storeKind: 'project',
271
- path: resolvePluginConfigStorePath(options),
272
- }];
264
+ return [{ storeKind: 'user', path: resolvePluginConfigStorePath(options) }];
273
265
  }
274
- function isPluginConfigValue(value) {
266
+ function isPluginConfigScalar(value) {
275
267
  if (typeof value === 'string' || typeof value === 'boolean')
276
268
  return true;
277
- if (typeof value === 'number')
278
- return Number.isFinite(value);
269
+ return typeof value === 'number' && Number.isFinite(value);
270
+ }
271
+ function isPluginConfigObject(value, objectArrayLevels) {
279
272
  if (!isRecord(value))
280
273
  return false;
281
- return Object.values(value).every((child) => typeof child === 'string'
282
- || typeof child === 'boolean'
283
- || (typeof child === 'number' && Number.isFinite(child)));
274
+ return Object.values(value).every((property) => {
275
+ if (isPluginConfigScalar(property))
276
+ return true;
277
+ if (Array.isArray(property))
278
+ return isPluginConfigArray(property, objectArrayLevels);
279
+ return isRecord(property) && Object.values(property).every(isPluginConfigScalar);
280
+ });
281
+ }
282
+ function isPluginConfigArray(value, objectArrayLevels) {
283
+ if (Object.keys(value).length !== value.length)
284
+ return false;
285
+ const elementType = typeof value[0];
286
+ return value.every((item, index) => Object.hasOwn(value, index)
287
+ && typeof item === elementType
288
+ && (isPluginConfigScalar(item) || (objectArrayLevels > 0 && isPluginConfigObject(item, objectArrayLevels - 1))));
289
+ }
290
+ function isPluginConfigValue(value) {
291
+ return isPluginConfigScalar(value) || (Array.isArray(value)
292
+ ? isPluginConfigArray(value, 2)
293
+ : isPluginConfigObject(value, 1));
284
294
  }
285
295
  function invalidStore(filePath, code, message, rawDigest) {
286
296
  return {
@@ -345,60 +355,75 @@ function validateStoreValues(options) {
345
355
  ? invalidStore(options.filePath, 'invalidValues', issues.join(' '), options.rawDigest)
346
356
  : readyStore(options.filePath, values, options.rawDigest);
347
357
  }
348
- async function readStoreFile(filePath) {
358
+ function documentStore(options) {
359
+ const common = validateStoreValues({ filePath: options.filePath, values: options.common, rawDigest: options.rawDigest });
360
+ if (common.state === 'invalid')
361
+ return common;
362
+ if (!isRecord(options.platforms) || Object.keys(options.platforms).some((key) => !PLATFORM_TARGETS.includes(key))) {
363
+ return invalidStore(options.filePath, 'invalidValues', 'The platforms field must contain known platform objects.', options.rawDigest);
364
+ }
365
+ const platforms = {};
366
+ for (const [platform, values] of Object.entries(options.platforms)) {
367
+ const store = validateStoreValues({ filePath: options.filePath, values, rawDigest: options.rawDigest });
368
+ if (store.state === 'invalid')
369
+ return store;
370
+ platforms[platform] = store.values;
371
+ }
372
+ return { ...common, common: common.values, platforms, ...(options.platform ? { platform: options.platform } : {}),
373
+ values: options.platform ? platforms[options.platform] ?? {} : common.values };
374
+ }
375
+ export function pluginConfigStoreForProfile(store, platform) {
376
+ return { ...store, platform, values: platform ? store.platforms?.[platform] ?? {} : store.common ?? store.values };
377
+ }
378
+ /** Replace one layer in memory without changing any other profile. */
379
+ export function replacePluginConfigStoreLayer(store, values, platform) {
380
+ const common = platform ? store.common ?? store.values : canonicalizePluginConfigValues(values);
381
+ const platforms = { ...store.platforms };
382
+ if (platform) {
383
+ if (Object.keys(values).length)
384
+ platforms[platform] = canonicalizePluginConfigValues(values);
385
+ else
386
+ delete platforms[platform];
387
+ }
388
+ const exists = Object.keys(common).length > 0 || Object.keys(platforms).length > 0;
389
+ return { ...store, common, platforms, platform, values: platform ? platforms[platform] ?? {} : common,
390
+ exists, state: exists ? 'ready' : 'missing', issues: [], rawDigest: undefined };
391
+ }
392
+ async function readStoreFile(filePath, platform) {
349
393
  const parsed = await parseStoreJson(filePath);
350
394
  if (parsed.state === 'invalidJson')
351
395
  return parsed.store;
352
- return validateStoreValues({ filePath, values: parsed.value, rawDigest: parsed.rawDigest });
396
+ const raw = parsed.value;
397
+ if (!isRecord(raw) || raw.schemaVersion !== 6
398
+ || Object.keys(raw).some((key) => !['schemaVersion', 'common', 'platforms'].includes(key))) {
399
+ return invalidStore(filePath, 'schemaVersionUnsupported', 'Only plugin config store schemaVersion 6 is supported. Reset the old document, then save the required values.', parsed.rawDigest);
400
+ }
401
+ return documentStore({ filePath, common: raw.common, platforms: raw.platforms, rawDigest: parsed.rawDigest, platform });
353
402
  }
354
403
  async function readNamespacedStoreFile(options) {
355
404
  const parsed = await parseStoreJson(options.filePath);
356
405
  if (parsed.state === 'invalidJson')
357
406
  return parsed.store;
358
- const raw = parsed.value;
359
- if (!isRecord(raw) || raw.schemaVersion !== 3) {
360
- return invalidStore(options.filePath, 'schemaVersionUnsupported', 'Only plugin config store schemaVersion 3 is supported.', parsed.rawDigest);
361
- }
362
- if (raw.sourceId !== options.sourceId
363
- || raw.pluginName !== options.pluginName
364
- || raw.sourceIdentity !== options.sourceIdentity) {
365
- return invalidStore(options.filePath, 'identityMismatch', 'The store identity does not match its source and namespaced path.', parsed.rawDigest);
407
+ const envelope = readPluginConfigEnvelopeV6(parsed.value);
408
+ if (!envelope)
409
+ return invalidStore(options.filePath, 'schemaVersionUnsupported', 'Only a valid plugin config store schemaVersion 6 is supported. Reset the old document, then save the required values.', parsed.rawDigest);
410
+ if (envelope.sourceId !== options.sourceId || envelope.pluginName !== options.pluginName
411
+ || !options.sourceIdentity || envelope.binding.sourceIdentity !== options.sourceIdentity) {
412
+ return invalidStore(options.filePath, 'identityMismatch', 'The user store is not bound to the requested source and plugin identity.', parsed.rawDigest);
366
413
  }
367
- return validateStoreValues({
368
- filePath: options.filePath,
369
- values: raw.values,
370
- rawDigest: parsed.rawDigest,
371
- });
414
+ return documentStore({ filePath: options.filePath, common: envelope.common, platforms: envelope.platforms,
415
+ rawDigest: parsed.rawDigest, platform: options.platform });
372
416
  }
373
417
  function namespacedConfigContent(options) {
374
- const values = canonicalizePluginConfigValues(options.values);
418
+ const document = { schemaVersion: 6, common: canonicalizePluginConfigValues(options.common),
419
+ platforms: Object.fromEntries(Object.entries(options.platforms).sort(([a], [b]) => a.localeCompare(b, 'en'))
420
+ .map(([platform, values]) => [platform, canonicalizePluginConfigValues(values)])) };
375
421
  if (!options.sourceId)
376
- return `${JSON.stringify(values, null, 2)}\n`;
377
- if (!options.sourceIdentity) {
378
- throw new Error('sourceChanged: namespaced plugin config requires a source identity.');
379
- }
380
- const envelope = {
381
- schemaVersion: 3,
382
- sourceId: options.sourceId,
383
- sourceIdentity: options.sourceIdentity,
384
- pluginName: options.pluginName,
385
- values,
386
- };
387
- return `${JSON.stringify(envelope, null, 2)}\n`;
388
- }
389
- async function assertNoLegacyConfigCoexistence(options) {
390
- if (!options.sourceId)
391
- return;
392
- const legacyPath = resolvePluginConfigStorePath({
393
- pluginName: options.pluginName,
394
- scope: options.scope,
395
- cwd: options.cwd,
396
- env: options.env,
397
- ...(options.scope === 'project' ? { access: 'read' } : {}),
398
- });
399
- if (await lstatIfExists(legacyPath)) {
400
- throw new Error('legacyStateUnsupported: legacy and namespaced plugin config stores cannot coexist.');
401
- }
422
+ return `${JSON.stringify(document, null, 2)}\n`;
423
+ if (!options.sourceIdentity)
424
+ throw new Error('sourceChanged: user plugin config requires a source identity.');
425
+ return `${JSON.stringify({ ...document, sourceId: options.sourceId, pluginName: options.pluginName,
426
+ binding: { kind: 'source', sourceIdentity: options.sourceIdentity } }, null, 2)}\n`;
402
427
  }
403
428
  export async function readPluginConfigStore(options) {
404
429
  const filePath = resolvePluginConfigStorePath({
@@ -431,10 +456,13 @@ export async function readPluginConfigStore(options) {
431
456
  ? readNamespacedStoreFile({
432
457
  filePath,
433
458
  sourceId: options.sourceId,
459
+ scope: options.scope,
434
460
  sourceIdentity: options.sourceIdentity,
461
+ logicalIdentity: options.logicalIdentity,
435
462
  pluginName: options.pluginName,
463
+ platform: options.platform,
436
464
  })
437
- : readStoreFile(filePath);
465
+ : readStoreFile(filePath, options.platform);
438
466
  }
439
467
  export async function readNamespacedPluginConfigStoreIdentity(options) {
440
468
  const filePath = resolvePluginConfigStorePath({
@@ -447,16 +475,16 @@ export async function readNamespacedPluginConfigStoreIdentity(options) {
447
475
  if (parsed.state === 'invalidJson') {
448
476
  throw new Error(`${parsed.store.invalidCode}: invalid namespaced plugin config store.`);
449
477
  }
450
- const raw = parsed.value;
451
- if (!isRecord(raw) || raw.schemaVersion !== 3 || !isRecord(raw.values)
452
- || raw.sourceId !== options.sourceId || raw.pluginName !== options.pluginName
453
- || typeof raw.sourceIdentity !== 'string') {
478
+ const envelope = readPluginConfigEnvelopeV6(parsed.value, options.scope);
479
+ if (!envelope
480
+ || envelope.sourceId !== options.sourceId
481
+ || envelope.pluginName !== options.pluginName) {
454
482
  throw new Error('schemaVersionUnsupported: invalid namespaced plugin config store.');
455
483
  }
456
- const store = validateStoreValues({ filePath, values: raw.values });
484
+ const store = documentStore({ filePath, common: envelope.common, platforms: envelope.platforms, platform: options.platform });
457
485
  assertReadyPluginConfigStore(store);
458
486
  return {
459
- sourceIdentity: raw.sourceIdentity,
487
+ binding: envelope.binding,
460
488
  store,
461
489
  };
462
490
  }
@@ -484,29 +512,75 @@ async function listConfigStoreDirectoryPluginNames(storeRoot) {
484
512
  return pluginNames;
485
513
  }
486
514
  export async function listPluginConfigStorePluginNames(options) {
487
- const projectRoot = resolveAwProjectRoot(options.cwd);
488
- const storeRoots = options.scope === 'user'
489
- ? [path.join(resolveAwHome(options.env), CONFIG_DIR)]
490
- : options.scope === 'project'
491
- ? [path.join(projectRoot, '.agent-workflows', CONFIG_DIR)]
492
- : [
493
- path.join(resolveAwHome(options.env), CONFIG_DIR),
494
- path.join(projectRoot, '.agent-workflows', CONFIG_DIR),
495
- ];
515
+ const storeRoots = [path.join(resolveAwHome(options.env), CONFIG_DIR)];
496
516
  const pluginNames = (await Promise.all(storeRoots.map((storeRoot) => listConfigStoreDirectoryPluginNames(storeRoot)))).flat();
497
517
  return [...new Set(pluginNames)].sort((left, right) => left.localeCompare(right));
498
518
  }
519
+ export async function listNamespacedPluginConfigStoreIdentities(options) {
520
+ const boundaryRoot = resolveAwHome(options.env);
521
+ if (options.scope === 'user') {
522
+ await canonicalizePathThroughExistingAncestor(boundaryRoot);
523
+ }
524
+ else {
525
+ await fs.realpath(boundaryRoot);
526
+ }
527
+ const storeRoot = path.join(boundaryRoot, CONFIG_DIR);
528
+ if (!await inspectConfigInventoryStoreRoot(boundaryRoot, storeRoot))
529
+ return [];
530
+ const output = [];
531
+ for (const sourceEntry of await fs.readdir(storeRoot, { withFileTypes: true })) {
532
+ if (!sourceEntry.isDirectory() || sourceEntry.isSymbolicLink())
533
+ continue;
534
+ let sourceId;
535
+ try {
536
+ sourceId = assertSafePluginConfigSegment(sourceEntry.name);
537
+ }
538
+ catch {
539
+ continue;
540
+ }
541
+ const sourceRoot = path.join(storeRoot, sourceId);
542
+ let pluginEntries;
543
+ try {
544
+ await assertNoConfigSymlink(boundaryRoot, sourceRoot);
545
+ pluginEntries = await fs.readdir(sourceRoot, { withFileTypes: true });
546
+ }
547
+ catch {
548
+ continue;
549
+ }
550
+ for (const pluginEntry of pluginEntries) {
551
+ if (!pluginEntry.isDirectory() || pluginEntry.isSymbolicLink())
552
+ continue;
553
+ let pluginName;
554
+ try {
555
+ pluginName = assertSafePluginConfigSegment(pluginEntry.name);
556
+ await assertNoConfigSymlink(boundaryRoot, path.join(sourceRoot, pluginName));
557
+ }
558
+ catch {
559
+ continue;
560
+ }
561
+ let target;
562
+ try {
563
+ target = await lstatIfExists(path.join(sourceRoot, pluginName, CONFIG_FILE));
564
+ }
565
+ catch {
566
+ continue;
567
+ }
568
+ if (!target)
569
+ continue;
570
+ output.push({ sourceId, pluginName, pluginId: `${sourceId}/${pluginName}` });
571
+ }
572
+ }
573
+ return output.sort((left, right) => left.pluginId.localeCompare(right.pluginId));
574
+ }
499
575
  export async function listNamespacedPluginConfigStores(options) {
500
- const boundaryRoot = options.scope === 'user'
501
- ? resolveAwHome(options.env)
502
- : resolveAwProjectRoot(options.cwd);
576
+ const boundaryRoot = resolveAwHome(options.env);
503
577
  if (options.scope === 'user') {
504
578
  await canonicalizePathThroughExistingAncestor(boundaryRoot);
505
579
  }
506
580
  else {
507
581
  await fs.realpath(boundaryRoot);
508
582
  }
509
- const storeRoot = path.join(boundaryRoot, ...(options.scope === 'project' ? ['.agent-workflows'] : []), CONFIG_DIR);
583
+ const storeRoot = path.join(boundaryRoot, CONFIG_DIR);
510
584
  const output = [];
511
585
  if (!await inspectConfigInventoryStoreRoot(boundaryRoot, storeRoot))
512
586
  return output;
@@ -532,17 +606,17 @@ export async function listNamespacedPluginConfigStores(options) {
532
606
  if (parsed.state === 'invalidJson') {
533
607
  throw new Error(`${parsed.store.invalidCode}: invalid namespaced plugin config store "${filePath}".`);
534
608
  }
535
- const raw = parsed.value;
536
- if (!isRecord(raw) || raw.schemaVersion !== 3 || !isRecord(raw.values)
537
- || raw.sourceId !== sourceId || raw.pluginName !== pluginName
538
- || typeof raw.sourceIdentity !== 'string') {
609
+ const envelope = readPluginConfigEnvelopeV6(parsed.value, options.scope);
610
+ if (!envelope
611
+ || envelope.sourceId !== sourceId
612
+ || envelope.pluginName !== pluginName) {
539
613
  throw new Error(`schemaVersionUnsupported: invalid namespaced plugin config store "${filePath}".`);
540
614
  }
541
- const store = validateStoreValues({ filePath, values: raw.values });
615
+ const store = documentStore({ filePath, common: envelope.common, platforms: envelope.platforms });
542
616
  assertReadyPluginConfigStore(store);
543
617
  output.push({
544
618
  sourceId,
545
- sourceIdentity: raw.sourceIdentity,
619
+ binding: envelope.binding,
546
620
  pluginName,
547
621
  pluginId: `${sourceId}/${pluginName}`,
548
622
  values: store.values,
@@ -552,90 +626,51 @@ export async function listNamespacedPluginConfigStores(options) {
552
626
  return output.sort((left, right) => left.pluginId.localeCompare(right.pluginId));
553
627
  }
554
628
  export async function writePluginConfigStore(options) {
555
- await assertNoLegacyConfigCoexistence(options);
556
- const filePath = resolvePluginConfigStorePath({
557
- ...options,
558
- ...(options.scope === 'project' ? { access: 'write' } : {}),
559
- });
560
- const allowedRoot = resolvePluginConfigAllowedRoot(options);
561
- const validated = validateStoreValues({ filePath, values: options.values });
629
+ const current = await readPluginConfigStore(options);
630
+ assertReadyPluginConfigStore(current);
631
+ const validated = validateStoreValues({ filePath: current.path, values: options.values });
562
632
  assertReadyPluginConfigStore(validated);
563
- await withConfigFileMutation({
564
- filePath,
565
- allowedRoot,
566
- action: async () => Object.keys(validated.values).length === 0
567
- ? atomicRemoveConfigFile({ filePath, allowedRoot })
568
- : atomicReplaceConfigFile({
569
- filePath,
570
- allowedRoot,
571
- content: namespacedConfigContent({ ...options, values: validated.values }),
572
- mode: 0o600,
573
- }),
574
- });
575
- return {
576
- pluginName: options.pluginName,
577
- scope: options.scope,
578
- path: filePath,
579
- };
633
+ return commitPluginConfigLayer(options, current, validated.values);
580
634
  }
581
- export async function patchPluginConfigStore(options) {
582
- await assertNoLegacyConfigCoexistence(options);
583
- const filePath = resolvePluginConfigStorePath({
584
- ...options,
585
- ...(options.scope === 'project' ? { access: 'write' } : {}),
586
- });
635
+ async function commitPluginConfigLayer(options, current, values) {
636
+ const next = replacePluginConfigStoreLayer(current, values, options.platform);
587
637
  const allowedRoot = resolvePluginConfigAllowedRoot(options);
638
+ await withConfigFileMutation({ filePath: current.path, allowedRoot, action: async () => {
639
+ if (!next.exists)
640
+ await atomicRemoveConfigFile({ filePath: current.path, allowedRoot });
641
+ else
642
+ await atomicReplaceConfigFile({ filePath: current.path, allowedRoot,
643
+ content: namespacedConfigContent({ ...options, common: next.common, platforms: next.platforms }), mode: 0o600 });
644
+ } });
645
+ return { pluginName: options.pluginName, scope: 'user', platform: options.platform, path: current.path, warnings: [] };
646
+ }
647
+ export async function patchPluginConfigStore(options) {
648
+ await options.reviewPreflight?.();
649
+ const current = await readPluginConfigStore(options);
650
+ assertReadyPluginConfigStore(current);
588
651
  const removedKeys = options.removeKeys ?? [];
589
- await withConfigFileMutation({
590
- filePath,
591
- allowedRoot,
592
- action: async () => {
593
- await options.reviewPreflight?.();
594
- const current = (await lstatIfExists(filePath))
595
- ? options.sourceId
596
- ? await readNamespacedStoreFile({
597
- filePath,
598
- sourceId: options.sourceId,
599
- sourceIdentity: options.sourceIdentity,
600
- pluginName: options.pluginName,
601
- })
602
- : await readStoreFile(filePath)
603
- : readyStore(filePath, {});
604
- assertReadyPluginConfigStore(current);
605
- if (options.requireExistingRemoveKeys) {
606
- const missingKey = removedKeys.find((key) => !Object.hasOwn(current.values, key));
607
- if (missingKey)
608
- throw new Error(`Unknown config key "${missingKey}".`);
609
- }
610
- const next = { ...current.values };
611
- for (const key of removedKeys) {
612
- delete next[key];
613
- }
614
- for (const [key, value] of Object.entries(options.updates)) {
615
- next[key] = value;
616
- }
617
- if (Object.keys(next).length === 0) {
618
- await atomicRemoveConfigFile({ filePath, allowedRoot });
619
- }
620
- else {
621
- await atomicReplaceConfigFile({
622
- filePath,
623
- allowedRoot,
624
- content: namespacedConfigContent({ ...options, values: next }),
625
- mode: 0o600,
626
- });
627
- }
628
- },
629
- });
630
- return {
631
- pluginName: options.pluginName,
632
- scope: options.scope,
633
- path: filePath,
634
- updatedKeys: Object.keys(options.updates),
635
- removedKeys,
636
- };
652
+ if (options.requireExistingRemoveKeys) {
653
+ const missing = removedKeys.find((key) => !Object.hasOwn(current.values, key));
654
+ if (missing)
655
+ throw new Error(`Unknown config key "${missing}".`);
656
+ }
657
+ const next = Object.assign(Object.create(null), current.values);
658
+ for (const key of removedKeys)
659
+ delete next[key];
660
+ for (const [key, value] of Object.entries(options.updates))
661
+ next[key] = value;
662
+ const validated = validateStoreValues({ filePath: current.path, values: next });
663
+ assertReadyPluginConfigStore(validated);
664
+ return { ...await commitPluginConfigLayer(options, current, validated.values), updatedKeys: Object.keys(options.updates), removedKeys };
637
665
  }
638
666
  export async function resetPluginConfigStore(options) {
667
+ return resetPluginConfigStoreTarget(options, false);
668
+ }
669
+ /** Delete the plugin's complete user document, including every platform profile. */
670
+ export async function deletePluginConfigStore(options) {
671
+ return resetPluginConfigStoreTarget(options, true);
672
+ }
673
+ async function resetPluginConfigStoreTarget(options, wholeDocument) {
639
674
  const filePath = resolvePluginConfigStorePath({
640
675
  ...options,
641
676
  ...(options.scope === 'project' ? { access: 'write' } : {}),
@@ -654,8 +689,8 @@ export async function resetPluginConfigStore(options) {
654
689
  if (!stats) {
655
690
  return {
656
691
  pluginName: options.pluginName,
657
- scope: options.scope,
658
- storeKind: options.scope,
692
+ scope: 'user',
693
+ storeKind: 'user',
659
694
  path: filePath,
660
695
  existed: false,
661
696
  deleted: false,
@@ -671,8 +706,8 @@ export async function resetPluginConfigStore(options) {
671
706
  if (!parentStats) {
672
707
  return {
673
708
  pluginName: options.pluginName,
674
- scope: options.scope,
675
- storeKind: options.scope,
709
+ scope: 'user',
710
+ storeKind: 'user',
676
711
  path: filePath,
677
712
  existed: false,
678
713
  deleted: false,
@@ -687,21 +722,35 @@ export async function resetPluginConfigStore(options) {
687
722
  if (!target) {
688
723
  return {
689
724
  pluginName: options.pluginName,
690
- scope: options.scope,
691
- storeKind: options.scope,
725
+ scope: 'user',
726
+ storeKind: 'user',
692
727
  path: filePath,
693
728
  existed: false,
694
729
  deleted: false,
695
730
  resetDisposition: 'absent',
696
731
  };
697
732
  }
733
+ let store;
734
+ if (target.isFile()) {
735
+ try {
736
+ store = await readPluginConfigStore(options);
737
+ }
738
+ catch {
739
+ // A broken document still has the schema-independent reset recovery below.
740
+ }
741
+ }
742
+ if (!wholeDocument && store && store.state !== 'invalid' && replacePluginConfigStoreLayer(store, {}, options.platform).exists) {
743
+ await commitPluginConfigLayer(options, store, {});
744
+ return { pluginName: options.pluginName, scope: 'user', platform: options.platform, storeKind: 'user',
745
+ path: filePath, existed: true, deleted: false, resetDisposition: 'clearedLayer' };
746
+ }
698
747
  if (target.isFile() || target.isSymbolicLink()) {
699
748
  await assertNoConfigSymlink(allowedRoot, path.dirname(filePath));
700
749
  await nodeFs.unlink(filePath);
701
750
  return {
702
751
  pluginName: options.pluginName,
703
- scope: options.scope,
704
- storeKind: options.scope,
752
+ scope: 'user',
753
+ storeKind: 'user',
705
754
  path: filePath,
706
755
  existed: true,
707
756
  deleted: true,
@@ -715,8 +764,8 @@ export async function resetPluginConfigStore(options) {
715
764
  await nodeFs.rename(filePath, path.join(path.dirname(filePath), quarantineBasename));
716
765
  return {
717
766
  pluginName: options.pluginName,
718
- scope: options.scope,
719
- storeKind: options.scope,
767
+ scope: 'user',
768
+ storeKind: 'user',
720
769
  path: filePath,
721
770
  existed: true,
722
771
  deleted: true,
@@ -790,41 +839,43 @@ function resetTargetInspection(kind, stats) {
790
839
  };
791
840
  }
792
841
  export async function resetPluginConfigStores(options) {
793
- await assertNoLegacyConfigCoexistence(options);
794
- const targets = resolvePluginConfigStoreTargets({
795
- ...options,
796
- ...(options.scope === 'project' ? { access: 'write' } : {}),
797
- });
798
- const allowedRoot = resolvePluginConfigAllowedRoot(options);
799
- const receipts = [];
800
- const existing = [];
801
- for (const target of targets) {
802
- await prepareConfigFileParent(target.path, allowedRoot);
803
- await assertNoConfigSymlink(allowedRoot, target.path);
804
- const stats = await lstatIfExists(target.path);
805
- existing.push(stats !== null);
806
- if (!stats)
807
- continue;
808
- if (!stats.isFile() || stats.isSymbolicLink()) {
809
- throw new Error(`Config target must be a regular file: ${target.path}`);
810
- }
842
+ return [await resetPluginConfigStore(options)];
843
+ }
844
+ export class PluginConfigValueValidationError extends Error {
845
+ publicMessage;
846
+ constructor(issue, publicMessage) {
847
+ super(formatPluginConfigIssue(issue));
848
+ this.publicMessage = publicMessage;
811
849
  }
812
- for (const [index, target] of targets.entries()) {
813
- const deleted = await atomicRemoveConfigFile({
814
- filePath: target.path,
815
- allowedRoot,
816
- });
817
- receipts.push({
818
- pluginName: options.pluginName,
819
- scope: options.scope,
820
- storeKind: target.storeKind,
821
- path: target.path,
822
- existed: existing[index],
823
- deleted,
824
- resetDisposition: deleted ? 'deletedFile' : 'absent',
825
- });
850
+ }
851
+ function configValueIssuePublicMessage(initialField, input, issue) {
852
+ const segments = issue.path.segments;
853
+ if (segments === undefined || segments.length < 2 || initialField.sensitive === true)
854
+ return undefined;
855
+ let field = initialField;
856
+ let value = input;
857
+ // User-supplied object keys may contain private text. Only report declared properties and row positions.
858
+ for (const [index, segment] of segments.slice(1).entries()) {
859
+ if (typeof segment === 'number' && field.type === 'array' && Array.isArray(value)) {
860
+ field = field.items;
861
+ value = value[segment];
862
+ }
863
+ else if (typeof segment === 'string' && field.type === 'object' && isRecord(value)) {
864
+ if (!/^[A-Za-z0-9_-]+$/u.test(segment))
865
+ return undefined;
866
+ if (issue.code === 'platformOnlyProperty' && index === segments.length - 2) {
867
+ return getStrippedPlatformOnlyProperties(field, value).has(segment) ? formatPluginConfigIssue(issue) : undefined;
868
+ }
869
+ const { properties } = resolvePluginConfigObjectProperties(field, value);
870
+ if (!Object.hasOwn(properties, segment))
871
+ return undefined;
872
+ field = properties[segment];
873
+ value = Object.hasOwn(value, segment) ? value[segment] : undefined;
874
+ }
875
+ else
876
+ return undefined;
826
877
  }
827
- return receipts;
878
+ return formatPluginConfigIssue(issue);
828
879
  }
829
880
  function coerceConfigValue(key, field, value) {
830
881
  let coerced = value;
@@ -840,7 +891,8 @@ function coerceConfigValue(key, field, value) {
840
891
  }
841
892
  const issues = validateCorePluginConfigValue(field, coerced, key);
842
893
  if (issues.length > 0) {
843
- throw new Error(formatPluginConfigIssue(issues[0]));
894
+ const issue = issues[0];
895
+ throw new PluginConfigValueValidationError(issue, configValueIssuePublicMessage(field, coerced, issue));
844
896
  }
845
897
  return coerced;
846
898
  }
@@ -850,16 +902,16 @@ export async function coercePluginConfigValue(options) {
850
902
  function redactValue(field, value) {
851
903
  return redactPluginConfigValue(field, value);
852
904
  }
853
- function sourceForStoreLayer(scope) {
854
- return scope === 'user' ? 'user' : 'project';
855
- }
856
905
  async function applyConfigLayer(options) {
857
906
  for (const [key, field] of Object.entries(options.schema)) {
858
907
  if (!Object.hasOwn(options.entries, key)) {
859
908
  continue;
860
909
  }
861
910
  const value = options.entries[key];
862
- const validationIssues = validateCorePluginConfigValue(field, value, key);
911
+ // Inherited values must be legal in their originating common profile as well as this platform.
912
+ const commonField = options.commonSchema?.[key];
913
+ const commonIssues = commonField ? validateCorePluginConfigValue(commonField, value, key) : [];
914
+ const validationIssues = commonIssues.length > 0 ? commonIssues : validateCorePluginConfigValue(field, value, key);
863
915
  if (validationIssues.length === 0) {
864
916
  const redactedValue = redactValue(field, value);
865
917
  options.values[key] = value;
@@ -888,38 +940,31 @@ async function applyConfigLayer(options) {
888
940
  }
889
941
  }
890
942
  export async function resolveEffectivePluginConfig(options) {
943
+ const workContext = options.context ? await resolveWorkContext({ cwd: options.cwd, context: options.context }) : undefined;
891
944
  const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
892
- const schema = options.manifest.config?.fields;
945
+ const user = await readPluginConfigStore({ ...options, pluginName, scope: 'user' });
946
+ assertReadyPluginConfigStore(user);
947
+ const references = !options.referenceContext && pluginConfigHasExternalReferences(options.manifest)
948
+ ? await resolvePluginConfigReferenceContext({ ...options, scope: options.context ?? options.targetScope ?? 'user', plugins: options.referencePlugins }) : undefined;
949
+ return resolveEffectivePluginConfigFromStores({ ...options, pluginName, projectRoot: workContext?.projectRoot ?? ((options.context ?? options.targetScope) === 'project' ? resolveAwProjectRoot(options.cwd) : ''),
950
+ referenceContext: options.referenceContext ?? references?.context, referenceEvidence: references?.evidence,
951
+ stores: { user } });
952
+ }
953
+ export async function resolveEffectivePluginConfigFromStores(options) {
954
+ const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
955
+ const definition = options.manifest.config ? selectPluginConfigProfile(options.manifest.config, options.platform) : undefined;
956
+ const schema = definition?.fields;
893
957
  if (!schema) {
894
- throw new Error(`Plugin "${pluginName}" does not declare an AW config schema.`);
958
+ throw new PluginConfigSchemaResolutionError('configSchemaUnavailable', `Plugin "${pluginName}" does not declare an AW config schema.`);
895
959
  }
896
- const projectRoot = resolveAwProjectRoot(options.cwd);
897
- const userStore = await readPluginConfigStore({
898
- sourceId: options.sourceId,
899
- sourceIdentity: options.sourceIdentity,
900
- pluginName,
901
- scope: 'user',
902
- cwd: options.cwd,
903
- env: options.env,
904
- });
905
- const projectStore = options.targetScope === 'user'
906
- ? undefined
907
- : await readPluginConfigStore({
908
- sourceId: options.sourceId,
909
- sourceIdentity: options.sourceIdentity,
910
- pluginName,
911
- scope: 'project',
912
- cwd: options.cwd,
913
- env: options.env,
914
- });
960
+ const userStore = options.stores.user;
915
961
  assertReadyPluginConfigStore(userStore);
916
- if (projectStore)
917
- assertReadyPluginConfigStore(projectStore);
918
962
  const values = {};
919
963
  const redactedValues = {};
920
964
  const sources = {};
921
965
  const fieldStates = {};
922
966
  const ignoredUnknownKeys = [];
967
+ const unsupportedLayerOverrides = [];
923
968
  const dangerousKeyIssues = [];
924
969
  const schemaKeys = new Set(Object.keys(schema));
925
970
  for (const key of schemaKeys) {
@@ -939,33 +984,34 @@ export async function resolveEffectivePluginConfig(options) {
939
984
  source: 'default',
940
985
  });
941
986
  }
942
- const layers = options.targetScope === 'user'
943
- ? [['user', userStore]]
944
- : [
945
- ['user', userStore],
946
- ['project', projectStore],
947
- ];
948
- for (const [scope, store] of layers) {
949
- const plainEntries = getStoreEntries(store.values);
950
- const source = sourceForStoreLayer(scope);
951
- const dangerousIssues = new Map(validatePluginConfigDocument({ fields: schema }, plainEntries).filter((issue) => issue.code === 'dangerousKey')
952
- .map((issue) => [issue.path.field, issue]));
987
+ const commonFields = selectPluginConfigProfile(options.manifest.config, undefined).fields;
988
+ const layers = [
989
+ { entries: options.platform
990
+ ? Object.fromEntries(Object.entries(userStore.common ?? (userStore.platform ? {} : userStore.values))
991
+ .filter(([key]) => {
992
+ // Unknown keys remain available to the existing dangerous-key check and
993
+ // unknown-key reporting; only declared, platform-specific values are isolated.
994
+ if (!Object.hasOwn(schema, key))
995
+ return true;
996
+ const field = schema[key];
997
+ return Object.hasOwn(commonFields, key) && !('platformOnly' in field && field.platformOnly);
998
+ }))
999
+ : userStore.common ?? userStore.values, source: 'common' },
1000
+ ...(options.platform ? [{ entries: userStore.platforms?.[options.platform] ?? {}, source: 'platform' }] : []),
1001
+ ];
1002
+ for (const { entries, source } of layers) {
1003
+ const plainEntries = getStoreEntries(entries);
1004
+ const dangerousIssues = new Map(validatePluginConfigDocument(definition, plainEntries)
1005
+ .filter((issue) => issue.code === 'dangerousKey').map((issue) => [issue.path.field, issue]));
953
1006
  for (const key of Object.keys(plainEntries)) {
954
- if (!schemaKeys.has(key)) {
955
- const dangerousIssue = dangerousIssues.get(key);
956
- if (dangerousIssue) {
957
- dangerousKeyIssues.push({
958
- type: 'invalid-config',
959
- code: dangerousIssue.code,
960
- key,
961
- source,
962
- message: formatPluginConfigIssue(dangerousIssue),
963
- });
964
- }
965
- else {
966
- ignoredUnknownKeys.push({ scope, source, key });
967
- }
968
- }
1007
+ if (schemaKeys.has(key))
1008
+ continue;
1009
+ const dangerousIssue = dangerousIssues.get(key);
1010
+ if (dangerousIssue)
1011
+ dangerousKeyIssues.push({ type: 'invalid-config', code: dangerousIssue.code,
1012
+ key, source, message: formatPluginConfigIssue(dangerousIssue) });
1013
+ else
1014
+ ignoredUnknownKeys.push({ scope: 'user', source, key });
969
1015
  }
970
1016
  await applyConfigLayer({
971
1017
  values,
@@ -973,13 +1019,108 @@ export async function resolveEffectivePluginConfig(options) {
973
1019
  sources,
974
1020
  fieldStates,
975
1021
  schema,
1022
+ ...(options.platform !== undefined && source === 'common' ? { commonSchema: commonFields } : {}),
976
1023
  entries: plainEntries,
977
1024
  source,
978
1025
  });
979
1026
  }
1027
+ const candidateValues = {};
1028
+ for (const [key, field] of Object.entries(schema)) {
1029
+ const source = sources[key];
1030
+ if (source === 'default')
1031
+ candidateValues[key] = field.default;
1032
+ if (source === 'common')
1033
+ candidateValues[key] = ownStoreValue(userStore.common ?? userStore.values, key);
1034
+ if (source === 'platform' && options.platform)
1035
+ candidateValues[key] = ownStoreValue(userStore.platforms?.[options.platform] ?? {}, key);
1036
+ }
1037
+ const candidateIssues = validatePluginConfigCandidate(definition, candidateValues, undefined, options.referenceContext);
1038
+ const referenceIssues = candidateIssues.filter((issue) => issue.code.startsWith('valueRef')
1039
+ && (!issue.path.plugin || issue.path.plugin === pluginName));
1040
+ const missingReferenceIssues = [];
1041
+ for (const issue of referenceIssues) {
1042
+ const key = issue.path.field;
1043
+ const source = sources[key];
1044
+ const state = fieldStates[key];
1045
+ const configIssue = {
1046
+ type: 'invalid-config', code: issue.code, key, source,
1047
+ message: formatPluginConfigIssue(issue),
1048
+ };
1049
+ if (source === 'missing') {
1050
+ missingReferenceIssues.push(configIssue);
1051
+ continue;
1052
+ }
1053
+ delete values[key];
1054
+ delete redactedValues[key];
1055
+ fieldStates[key] = {
1056
+ invalidOverride: { source, issues: [...(state?.invalidOverride?.issues ?? []), configIssue] },
1057
+ ...(state?.fallback ? { fallback: state.fallback } : {}),
1058
+ };
1059
+ }
1060
+ // Provider errors stay private, while each field that reads them remains unusable.
1061
+ if (options.referenceContext) {
1062
+ for (const foreign of candidateIssues.filter((issue) => issue.code.startsWith('valueRef')
1063
+ && issue.path.plugin && issue.path.plugin !== pluginName)) {
1064
+ for (const key of schemaKeys) {
1065
+ let dependencies;
1066
+ try {
1067
+ dependencies = getPluginConfigDependencyFields(definition, [key], options.referenceContext);
1068
+ }
1069
+ catch {
1070
+ continue; // The local association issue already reports the invalid schema.
1071
+ }
1072
+ if (!dependencies.some((entry) => entry.plugin === foreign.path.plugin && entry.field === foreign.path.field))
1073
+ continue;
1074
+ const source = sources[key];
1075
+ const state = fieldStates[key];
1076
+ const configIssue = { type: 'invalid-config', code: 'valueRefSource', key, source,
1077
+ message: `Config "${key}" depends on invalid config "${foreign.path.plugin}/${foreign.path.field}". Fix the dependency before using this field.` };
1078
+ if (state?.invalidOverride?.issues.some((issue) => issue.code === configIssue.code && issue.message === configIssue.message))
1079
+ continue;
1080
+ delete values[key];
1081
+ delete redactedValues[key];
1082
+ if (source === 'missing')
1083
+ missingReferenceIssues.push(configIssue);
1084
+ else
1085
+ fieldStates[key] = { invalidOverride: { source, issues: [...(state?.invalidOverride?.issues ?? []), configIssue] },
1086
+ ...(state?.fallback ? { fallback: state.fallback } : {}) };
1087
+ }
1088
+ }
1089
+ }
1090
+ // Consumers must retain dependency failures after invalid source values are omitted.
1091
+ const invalidKeys = new Set([
1092
+ ...Object.entries(fieldStates).filter(([, state]) => state.invalidOverride !== undefined).map(([key]) => key),
1093
+ ...missingReferenceIssues.map((issue) => issue.key),
1094
+ ]);
1095
+ for (const key of schemaKeys) {
1096
+ if (invalidKeys.has(key))
1097
+ continue;
1098
+ const dependency = getPluginConfigDependencyKeys(definition, [key])
1099
+ .find((dependencyKey) => dependencyKey !== key && invalidKeys.has(dependencyKey));
1100
+ if (dependency === undefined)
1101
+ continue;
1102
+ const source = sources[key];
1103
+ const configIssue = {
1104
+ type: 'invalid-config', code: 'valueRefSource', key, source,
1105
+ message: `Config "${key}" depends on invalid config "${dependency}". Fix the dependency before using this field.`,
1106
+ };
1107
+ delete values[key];
1108
+ delete redactedValues[key];
1109
+ if (source === 'missing') {
1110
+ missingReferenceIssues.push(configIssue);
1111
+ }
1112
+ else {
1113
+ const state = fieldStates[key];
1114
+ fieldStates[key] = {
1115
+ invalidOverride: { source, issues: [configIssue] },
1116
+ ...(state?.fallback ? { fallback: state.fallback } : {}),
1117
+ };
1118
+ }
1119
+ }
980
1120
  const issues = [
981
1121
  ...Object.values(fieldStates).flatMap((state) => state.invalidOverride?.issues ?? []),
982
1122
  ...dangerousKeyIssues,
1123
+ ...missingReferenceIssues,
983
1124
  ];
984
1125
  for (const [key, field] of Object.entries(schema)) {
985
1126
  if (field.required && values[key] === undefined && !fieldStates[key]?.invalidOverride) {
@@ -993,20 +1134,65 @@ export async function resolveEffectivePluginConfig(options) {
993
1134
  }
994
1135
  return {
995
1136
  pluginName,
996
- projectRoot,
1137
+ platform: options.platform,
1138
+ context: options.context ?? options.targetScope ?? 'user',
1139
+ definition: definition,
1140
+ projectRoot: options.projectRoot,
997
1141
  values,
998
1142
  redactedValues,
999
1143
  sources,
1000
1144
  fieldStates,
1001
1145
  issues,
1146
+ unsupportedLayerOverrides,
1002
1147
  ignoredUnknownKeys,
1003
1148
  schema,
1004
1149
  stores: {
1005
1150
  user: userStore,
1006
- ...(projectStore ? { project: projectStore } : {}),
1007
1151
  },
1152
+ ...(options.referenceContext ? { referenceContext: options.referenceContext } : {}),
1153
+ ...(options.referenceEvidence ? { referenceEvidence: options.referenceEvidence } : {}),
1008
1154
  };
1009
1155
  }
1156
+ function ownStoreValue(values, key) {
1157
+ return Object.hasOwn(values, key) ? values[key] : undefined;
1158
+ }
1159
+ /** Check cross-field relations before saving one complete layer candidate. */
1160
+ export async function assertPluginConfigMutationCandidate(options) {
1161
+ const pluginId = options.sourceId ? `${options.sourceId}/${options.pluginName}` : options.pluginName;
1162
+ const preferences = await observePreferences(options);
1163
+ if (Object.keys(options.updates).length) {
1164
+ assertConfigLayerWritable(pluginId, options.manifest, preferences, options.platform);
1165
+ }
1166
+ const user = await readPluginConfigStore({ ...options, scope: 'user' });
1167
+ assertReadyPluginConfigStore(user);
1168
+ // Unsetting an unknown (stale) key has no effective profile to validate.
1169
+ const selectedFields = options.manifest.config ? selectPluginConfigProfile(options.manifest.config, options.platform).fields : {};
1170
+ if (!Object.keys(options.updates).length && options.removeKeys.every((key) => !Object.hasOwn(selectedFields, key)))
1171
+ return;
1172
+ const layers = resolveConfigurableLayers(pluginId, options.manifest, preferences);
1173
+ if (!layers.includes(options.platform ?? 'common'))
1174
+ return;
1175
+ const values = { ...user.values };
1176
+ for (const key of options.removeKeys)
1177
+ delete values[key];
1178
+ for (const [key, value] of Object.entries(options.updates))
1179
+ values[key] = value;
1180
+ const candidate = replacePluginConfigStoreLayer(user, values, options.platform);
1181
+ const profiles = options.platform ? [options.platform] : layers.map((layer) => layer === 'common' ? undefined : layer);
1182
+ for (const platform of profiles) {
1183
+ const references = pluginConfigHasExternalReferences(options.manifest)
1184
+ ? await resolvePluginConfigReferenceContext({ ...options, platform, plugins: options.referencePlugins }) : undefined;
1185
+ const resolve = (store) => resolveEffectivePluginConfigFromStores({ ...options, platform,
1186
+ targetScope: options.scope, projectRoot: options.scope === 'project' ? resolveAwProjectRoot(options.cwd) : '', stores: { user: store }, referenceContext: references?.context });
1187
+ const [before, after] = await Promise.all([resolve(user), resolve(candidate)]);
1188
+ const existing = new Set(before.issues.map((issue) => `${issue.key}\0${issue.code}\0${issue.message}`));
1189
+ const selectedSource = options.platform ? 'platform' : 'common';
1190
+ const issues = after.issues.filter((issue) => (Object.hasOwn(options.updates, issue.key) && after.sources[issue.key] === selectedSource)
1191
+ || !existing.has(`${issue.key}\0${issue.code}\0${issue.message}`));
1192
+ if (issues.length)
1193
+ throw Object.assign(new Error(`configReferenceInvalid: ${platform ?? 'common'}: ${issues.map((issue) => issue.message).join(' ')}`), { code: 'configReferenceInvalid' });
1194
+ }
1195
+ }
1010
1196
  export async function coercePluginConfigUpdates(options) {
1011
1197
  const output = {};
1012
1198
  for (const [key, value] of Object.entries(options.updates)) {
@@ -1026,35 +1212,28 @@ export async function coercePluginConfigUpdates(options) {
1026
1212
  export async function resolveProjectArtifactRenderConfig(options) {
1027
1213
  if (!options.manifest.config?.fields) {
1028
1214
  const pluginName = assertSafePluginConfigSegment(options.pluginName ?? options.manifest.name);
1029
- const [userStore, projectStore] = await Promise.all([
1215
+ const [userStore] = await Promise.all([
1030
1216
  readPluginConfigStore({
1031
1217
  sourceId: options.sourceId,
1032
1218
  sourceIdentity: options.sourceIdentity,
1219
+ logicalIdentity: options.logicalIdentity,
1033
1220
  pluginName,
1034
1221
  scope: 'user',
1035
1222
  cwd: options.cwd,
1036
1223
  env: options.env,
1037
1224
  }),
1038
- readPluginConfigStore({
1039
- sourceId: options.sourceId,
1040
- sourceIdentity: options.sourceIdentity,
1041
- pluginName,
1042
- scope: 'project',
1043
- cwd: options.cwd,
1044
- env: options.env,
1045
- }),
1046
1225
  ]);
1047
1226
  assertReadyPluginConfigStore(userStore);
1048
- assertReadyPluginConfigStore(projectStore);
1049
1227
  return {
1050
1228
  pluginName,
1051
1229
  projectRoot: resolveAwProjectRoot(options.cwd),
1052
1230
  values: {},
1053
1231
  sources: {},
1054
1232
  issues: [],
1233
+ unsupportedLayerOverrides: [],
1055
1234
  ignoredUnknownKeys: [],
1056
1235
  schema: {},
1057
- stores: { user: userStore, project: projectStore },
1236
+ stores: { user: userStore },
1058
1237
  };
1059
1238
  }
1060
1239
  const effective = await resolveEffectivePluginConfig({
@@ -1067,108 +1246,16 @@ export async function resolveProjectArtifactRenderConfig(options) {
1067
1246
  values: effective.values,
1068
1247
  sources: effective.sources,
1069
1248
  issues: effective.issues,
1249
+ unsupportedLayerOverrides: effective.unsupportedLayerOverrides,
1070
1250
  ignoredUnknownKeys: effective.ignoredUnknownKeys,
1071
1251
  schema: effective.schema,
1072
1252
  stores: {
1073
1253
  user: effective.stores.user,
1074
- project: effective.stores.project,
1075
1254
  },
1076
1255
  };
1077
1256
  }
1078
- async function resolveRedactedLayerValue(options) {
1079
- try {
1080
- const coerced = await coercePluginConfigValue({
1081
- key: options.key,
1082
- field: options.field,
1083
- value: options.value,
1084
- });
1085
- return {
1086
- value: redactValue(options.field, coerced),
1087
- };
1088
- }
1089
- catch (error) {
1090
- return {
1091
- issue: {
1092
- type: 'invalid-config',
1093
- key: options.key,
1094
- source: options.source,
1095
- message: error instanceof Error ? error.message : String(error),
1096
- },
1097
- };
1098
- }
1099
- }
1100
- export async function resolveProjectScopedPluginConfigView(options) {
1101
- const effective = await resolveEffectivePluginConfig(options);
1102
- const entries = {};
1103
- for (const [key, field] of Object.entries(effective.schema)) {
1104
- const entry = {
1105
- key,
1106
- effectiveValue: effective.redactedValues[key],
1107
- effectiveSource: effective.sources[key] ?? 'missing',
1108
- };
1109
- if (field.default !== undefined) {
1110
- const resolvedDefault = await resolveRedactedLayerValue({
1111
- key,
1112
- field,
1113
- source: 'default',
1114
- value: field.default,
1115
- });
1116
- if (resolvedDefault.value !== undefined) {
1117
- entry.defaultValue = resolvedDefault.value;
1118
- }
1119
- }
1120
- const userPlainEntries = getStoreEntries(effective.stores.user.values);
1121
- if (Object.hasOwn(userPlainEntries, key)) {
1122
- const resolvedUser = await resolveRedactedLayerValue({
1123
- key,
1124
- field,
1125
- source: 'user',
1126
- value: userPlainEntries[key],
1127
- });
1128
- if (resolvedUser.value !== undefined) {
1129
- entry.userValue = resolvedUser.value;
1130
- }
1131
- }
1132
- const projectPlainEntries = getStoreEntries(effective.stores.project.values);
1133
- if (Object.hasOwn(projectPlainEntries, key)) {
1134
- const resolvedProject = await resolveRedactedLayerValue({
1135
- key,
1136
- field,
1137
- source: 'project',
1138
- value: projectPlainEntries[key],
1139
- });
1140
- if (resolvedProject.value !== undefined) {
1141
- entry.projectValue = resolvedProject.value;
1142
- }
1143
- }
1144
- entries[key] = entry;
1145
- }
1146
- return {
1147
- pluginName: effective.pluginName,
1148
- projectRoot: effective.projectRoot,
1149
- schema: effective.schema,
1150
- stores: {
1151
- user: effective.stores.user,
1152
- project: effective.stores.project,
1153
- },
1154
- redactedValues: effective.redactedValues,
1155
- sources: effective.sources,
1156
- entries,
1157
- issues: effective.issues,
1158
- ignoredUnknownKeys: effective.ignoredUnknownKeys,
1159
- };
1160
- }
1161
1257
  function toConfigSourceLayer(source) {
1162
- if (source === 'default') {
1163
- return 'default';
1164
- }
1165
- if (source === 'user') {
1166
- return 'user';
1167
- }
1168
- if (source === 'project') {
1169
- return 'project';
1170
- }
1171
- return null;
1258
+ return source === undefined || source === 'missing' ? null : source;
1172
1259
  }
1173
1260
  function configFieldProjection(options) {
1174
1261
  const source = options.source ?? 'missing';
@@ -1189,216 +1276,74 @@ function configFieldProjection(options) {
1189
1276
  };
1190
1277
  }
1191
1278
  async function buildManifestFieldEntries(options) {
1192
- const schema = options.plugin.manifest.config?.fields;
1193
- if (!schema) {
1194
- return [];
1195
- }
1196
- const userStore = await readPluginConfigStore({
1197
- sourceId: options.plugin.sourceId,
1198
- sourceIdentity: options.plugin.sourceIdentity,
1199
- pluginName: options.plugin.manifest.name,
1200
- scope: 'user',
1201
- cwd: options.cwd,
1202
- env: options.env,
1203
- schema,
1204
- });
1205
- const projectStore = options.scope === 'user'
1206
- ? undefined
1207
- : await readPluginConfigStore({
1208
- sourceId: options.plugin.sourceId,
1209
- sourceIdentity: options.plugin.sourceIdentity,
1210
- pluginName: options.plugin.manifest.name,
1211
- scope: 'project',
1212
- cwd: options.cwd,
1213
- env: options.env,
1214
- schema,
1215
- });
1216
- assertReadyPluginConfigStore(userStore);
1217
- if (projectStore)
1218
- assertReadyPluginConfigStore(projectStore);
1219
- const userPlainEntries = getStoreEntries(userStore.values);
1220
- const projectPlainEntries = projectStore ? getStoreEntries(projectStore.values) : {};
1221
1279
  const effective = await resolveEffectivePluginConfig({
1222
1280
  sourceId: options.plugin.sourceId,
1223
1281
  sourceIdentity: options.plugin.sourceIdentity,
1224
- pluginName: options.plugin.manifest.name,
1282
+ logicalIdentity: options.plugin.catalogLogicalIdentity,
1225
1283
  manifest: options.plugin.manifest,
1226
- targetScope: options.scope === 'user' ? 'user' : 'project',
1284
+ platform: options.platform,
1285
+ targetScope: options.context ?? (options.scope === 'project' ? 'project' : 'user'),
1227
1286
  cwd: options.cwd,
1228
1287
  env: options.env,
1229
1288
  });
1230
- const userOnlyKeys = codexNativeRefreshKeys(options.plugin.manifest);
1231
- const effectiveFieldState = (key) => {
1232
- const source = effective.sources[key];
1233
- const sourceLayer = toConfigSourceLayer(source);
1234
- const field = schema[key];
1235
- const fieldIssues = effective.issues.filter((entry) => entry.key === key);
1236
- const fieldState = effective.fieldStates[key];
1237
- if (source === undefined || source === 'missing') {
1238
- return {
1239
- valueState: fieldIssues.length > 0 ? 'invalid' : 'default',
1240
- effectiveValue: null,
1241
- sourceLayer: null,
1242
- ...configFieldProjection({ field, source: 'missing', issues: fieldIssues }),
1243
- };
1289
+ const stored = pluginConfigStoreForProfile(effective.stores.user, options.platform).values;
1290
+ const fields = await Promise.all(Object.entries(effective.schema).map(async ([key, field]) => {
1291
+ const state = effective.fieldStates[key];
1292
+ const source = effective.sources[key] ?? 'missing';
1293
+ const issues = effective.issues.filter((issue) => issue.key === key);
1294
+ const hasStored = Object.hasOwn(stored, key);
1295
+ const storedSourceLayer = options.platform ? 'platform' : 'common';
1296
+ let fallback;
1297
+ if (hasStored) {
1298
+ const inherited = { ...stored };
1299
+ delete inherited[key];
1300
+ const withoutOverride = await resolveEffectivePluginConfigFromStores({
1301
+ manifest: options.plugin.manifest,
1302
+ platform: options.platform,
1303
+ projectRoot: effective.projectRoot,
1304
+ stores: { user: replacePluginConfigStoreLayer(effective.stores.user, inherited, options.platform) },
1305
+ referenceContext: effective.referenceContext,
1306
+ });
1307
+ const fallbackIssues = withoutOverride.issues.filter((issue) => issue.key === key);
1308
+ const fallbackSource = withoutOverride.sources[key];
1309
+ fallback = fallbackSource === 'missing' || fallbackSource === undefined
1310
+ ? { state: 'missing' }
1311
+ : fallbackIssues.length
1312
+ ? { state: 'invalid', sourceLayer: fallbackSource, issues: fallbackIssues }
1313
+ : { state: 'valid', sourceLayer: fallbackSource, effectiveValue: withoutOverride.redactedValues[key] };
1244
1314
  }
1245
- const issue = fieldIssues.find((entry) => entry.source === source);
1246
1315
  return {
1247
- valueState: issue ? 'invalid' : source === 'default' ? 'default' : 'configured',
1248
- effectiveValue: issue ? null : effective.redactedValues[key] ?? null,
1249
- sourceLayer,
1250
- ...(fieldState?.invalidOverride ? {
1251
- invalidOverride: {
1252
- sourceLayer: fieldState.invalidOverride.source,
1253
- issues: fieldState.invalidOverride.issues,
1254
- },
1255
- } : {}),
1256
- ...(fieldState?.fallback ? {
1257
- fallback: {
1258
- effectiveValue: fieldState.fallback.redactedValue,
1259
- sourceLayer: fieldState.fallback.source,
1260
- },
1261
- } : {}),
1262
- ...configFieldProjection({
1263
- field,
1264
- value: issue ? undefined : effective.values[key],
1265
- source,
1266
- issues: fieldIssues,
1267
- }),
1268
- };
1269
- };
1270
- const fields = [];
1271
- for (const [key, field] of Object.entries(schema)) {
1272
- const base = {
1273
1316
  key,
1274
1317
  title: field.title ?? key,
1275
1318
  kind: 'manifest',
1276
1319
  reserved: false,
1277
- writable: options.scope !== 'project' || !userOnlyKeys.has(key),
1278
- valueState: 'default',
1279
- effectiveValue: null,
1280
- sourceLayer: null,
1281
- ...configFieldProjection({ field }),
1320
+ writable: true,
1321
+ canSet: true,
1322
+ canUnset: hasStored,
1323
+ valueState: issues.length ? 'invalid' : source === 'default' || source === 'missing' ? 'default' : 'configured',
1324
+ effectiveValue: effective.redactedValues[key] ?? null,
1325
+ sourceLayer: toConfigSourceLayer(source),
1326
+ ...(hasStored ? { storedSourceLayer, ...(validateCorePluginConfigValue(field, stored[key], key).length
1327
+ ? {} : { storedValue: redactValue(field, stored[key]) }) } : {}),
1328
+ ...(state?.invalidOverride ? { invalidOverride: { sourceLayer: state.invalidOverride.source, issues: state.invalidOverride.issues } } : {}),
1329
+ ...(fallback ? { fallback } : {}),
1330
+ ...configFieldProjection({ field, value: effective.values[key], source, issues }),
1282
1331
  };
1283
- if (options.scope === 'user') {
1284
- if (Object.hasOwn(userPlainEntries, key)) {
1285
- try {
1286
- const value = await coercePluginConfigValue({
1287
- key,
1288
- field,
1289
- value: userPlainEntries[key],
1290
- });
1291
- fields.push({
1292
- ...base,
1293
- valueState: 'configured',
1294
- effectiveValue: redactValue(field, value),
1295
- sourceLayer: 'user',
1296
- storedValue: redactValue(field, value),
1297
- storedSourceLayer: 'user',
1298
- ...configFieldProjection({ field, value, source: 'user' }),
1299
- });
1300
- }
1301
- catch {
1302
- fields.push({
1303
- ...base,
1304
- valueState: 'invalid',
1305
- sourceLayer: 'user',
1306
- storedSourceLayer: 'user',
1307
- valid: false,
1308
- issues: [{ type: 'invalid-config', key, source: 'user' }],
1309
- });
1310
- }
1311
- continue;
1312
- }
1313
- if (field.default !== undefined) {
1314
- try {
1315
- const value = await coercePluginConfigValue({
1316
- key,
1317
- field,
1318
- value: field.default,
1319
- });
1320
- fields.push({
1321
- ...base,
1322
- effectiveValue: redactValue(field, value),
1323
- sourceLayer: 'default',
1324
- ...configFieldProjection({ field, value, source: 'default' }),
1325
- });
1326
- }
1327
- catch {
1328
- fields.push({
1329
- ...base,
1330
- valueState: 'invalid',
1331
- sourceLayer: 'default',
1332
- source: 'default',
1333
- valid: false,
1334
- issues: [{ type: 'invalid-config', key, source: 'default' }],
1335
- });
1336
- }
1337
- continue;
1338
- }
1339
- fields.push(base);
1340
- continue;
1341
- }
1342
- let storedProjectValue;
1343
- if (options.scope === 'project' && Object.hasOwn(projectPlainEntries, key)) {
1344
- try {
1345
- const value = await coercePluginConfigValue({
1346
- key,
1347
- field,
1348
- value: projectPlainEntries[key],
1349
- });
1350
- storedProjectValue = {
1351
- storedValue: redactValue(field, value),
1352
- storedSourceLayer: 'project',
1353
- };
1354
- }
1355
- catch {
1356
- storedProjectValue = { storedSourceLayer: 'project' };
1357
- }
1358
- }
1359
- fields.push({ ...base, ...effectiveFieldState(key), ...storedProjectValue });
1332
+ }));
1333
+ for (const key of Object.keys(stored).filter((key) => !Object.hasOwn(effective.schema, key)).sort()) {
1334
+ const source = options.platform ? 'platform' : 'common';
1335
+ fields.push({ key, title: key, kind: 'manifest', reserved: false, writable: false, canSet: false, canUnset: true,
1336
+ valueState: 'configured', effectiveValue: '[redacted]', sourceLayer: source, storedSourceLayer: source,
1337
+ value: '[redacted]', source, matchedPreset: null, valid: false, issues: [] });
1360
1338
  }
1361
1339
  return fields;
1362
1340
  }
1363
1341
  async function buildLegacyStoreFieldEntries(options) {
1364
- const locations = options.scope === 'effective'
1365
- ? [
1366
- { scope: 'user', sourceLayer: 'user' },
1367
- { scope: 'project', sourceLayer: 'project' },
1368
- ]
1369
- : [{
1370
- scope: options.scope,
1371
- sourceLayer: options.scope === 'user' ? 'user' : 'project',
1372
- }];
1373
- const fields = new Map();
1374
- for (const location of locations) {
1375
- const store = await readPluginConfigStore({
1376
- sourceId: options.sourceId,
1377
- sourceIdentity: options.sourceIdentity,
1378
- pluginName: options.pluginName,
1379
- scope: location.scope,
1380
- cwd: options.cwd,
1381
- env: options.env,
1382
- });
1383
- for (const key of Object.keys(store.values)) {
1384
- fields.set(key, {
1385
- key,
1386
- title: key,
1387
- kind: 'manifest',
1388
- reserved: false,
1389
- writable: false,
1390
- valueState: 'configured',
1391
- effectiveValue: '[redacted]',
1392
- sourceLayer: location.sourceLayer,
1393
- value: '[redacted]',
1394
- source: location.sourceLayer,
1395
- matchedPreset: null,
1396
- valid: true,
1397
- issues: [],
1398
- });
1399
- }
1400
- }
1401
- return [...fields.values()].sort((left, right) => left.key.localeCompare(right.key));
1342
+ const store = await readPluginConfigStore({ ...options, scope: 'user' });
1343
+ const source = options.platform ? 'platform' : 'common';
1344
+ return Object.keys(store.values).sort().map((key) => ({ key, title: key, kind: 'manifest', reserved: false,
1345
+ writable: false, canSet: false, canUnset: true, valueState: 'configured', effectiveValue: '[redacted]',
1346
+ sourceLayer: source, value: '[redacted]', source, matchedPreset: null, valid: true, issues: [] }));
1402
1347
  }
1403
1348
  export async function resolvePluginConfigSchemaAccess(options) {
1404
1349
  const pluginName = assertSafePluginConfigSegment(options.pluginName);
@@ -1414,38 +1359,50 @@ export async function resolvePluginConfigSchemaAccess(options) {
1414
1359
  return {
1415
1360
  pluginName,
1416
1361
  plugin: options.currentPlugin,
1417
- schema: createConfigSchemaEvidenceFromCurrentCatalog(options.currentPlugin, await calculateConfigSchemaManifestDigestForPlugin(options.currentPlugin)),
1362
+ schema: createConfigSchemaEvidenceFromCurrentCatalog(options.currentPlugin, await calculateConfigSchemaManifestDigestForPlugin(options.currentPlugin), options.platform),
1418
1363
  };
1419
1364
  }
1420
1365
  export async function resolveConfigRead(options) {
1366
+ if (options.context)
1367
+ await resolveWorkContext({ cwd: options.cwd, context: options.context });
1421
1368
  const pluginName = assertSafePluginConfigSegment(options.pluginName);
1422
1369
  const schemaAccess = await resolvePluginConfigSchemaAccess({
1423
1370
  pluginName,
1424
1371
  currentPlugin: options.plugin,
1425
1372
  currentPluginError: options.pluginError,
1373
+ platform: options.platform,
1426
1374
  scope: options.scope,
1427
1375
  cwd: options.cwd,
1428
1376
  env: options.env,
1429
1377
  });
1430
- const manifestFields = schemaAccess.plugin
1378
+ const manifestFields = options.schemaOnly ? [] : schemaAccess.plugin?.manifest.config
1431
1379
  ? await buildManifestFieldEntries({
1432
1380
  plugin: schemaAccess.plugin,
1381
+ context: options.context,
1382
+ platform: options.platform,
1433
1383
  scope: options.scope,
1434
1384
  cwd: options.cwd,
1435
1385
  env: options.env,
1436
1386
  })
1437
1387
  : await buildLegacyStoreFieldEntries({
1438
- sourceId: options.sourceId,
1439
- sourceIdentity: options.sourceIdentity,
1388
+ sourceId: schemaAccess.plugin?.sourceId ?? options.sourceId,
1389
+ sourceIdentity: schemaAccess.plugin?.sourceIdentity ?? options.sourceIdentity,
1390
+ logicalIdentity: schemaAccess.plugin?.catalogLogicalIdentity ?? options.logicalIdentity,
1440
1391
  pluginName,
1441
1392
  scope: options.scope,
1393
+ platform: options.platform,
1442
1394
  cwd: options.cwd,
1443
1395
  env: options.env,
1444
1396
  });
1445
1397
  return {
1446
1398
  pluginName,
1399
+ platform: options.platform,
1400
+ context: options.context ?? 'user',
1447
1401
  scope: options.scope,
1448
1402
  ...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
1403
+ ...(schemaAccess.plugin?.manifest.config?.fields
1404
+ ? { fieldDefinitions: selectPluginConfigProfile(schemaAccess.plugin.manifest.config, options.platform).fields }
1405
+ : {}),
1449
1406
  fields: manifestFields,
1450
1407
  };
1451
1408
  }
@@ -1472,13 +1429,14 @@ export function summarizeEffectivePluginConfig(config) {
1472
1429
  ignoredUnknownKeys: config.ignoredUnknownKeys,
1473
1430
  };
1474
1431
  }
1475
- export function createPluginConfigSchemaIdentity(manifest) {
1432
+ export function createPluginConfigSchemaIdentity(manifest, platform) {
1476
1433
  const hash = crypto
1477
1434
  .createHash('sha256')
1478
1435
  .update(JSON.stringify({
1479
1436
  name: manifest.name,
1480
1437
  version: manifest.version,
1481
- config: manifest.config ?? null,
1438
+ platform: platform ?? null,
1439
+ config: manifest.config ? selectPluginConfigProfile(manifest.config, platform) : null,
1482
1440
  }))
1483
1441
  .digest('hex');
1484
1442
  return `${manifest.name}:${hash}`;
@@ -1502,7 +1460,7 @@ function cliConfigPromptEnumValues(field) {
1502
1460
  export function toCliConfigPromptSchema(schema) {
1503
1461
  const promptSchema = {};
1504
1462
  for (const [key, field] of Object.entries(schema)) {
1505
- if (field.type === 'object')
1463
+ if (field.type === 'object' || field.type === 'array')
1506
1464
  continue;
1507
1465
  promptSchema[key] = {
1508
1466
  type: field.type,
@@ -1519,15 +1477,15 @@ export function toCliConfigPromptSchema(schema) {
1519
1477
  return promptSchema;
1520
1478
  }
1521
1479
  export function createPluginConfigFormModel(options) {
1522
- const schema = options.manifest.config?.fields;
1480
+ const schema = options.effective.schema;
1523
1481
  if (!schema) {
1524
- throw new Error(`Plugin "${options.pluginName ?? options.manifest.name}" does not declare an AW config schema.`);
1482
+ throw new PluginConfigSchemaResolutionError('configSchemaUnavailable', `Plugin "${options.pluginName ?? options.manifest.name}" does not declare an AW config schema.`);
1525
1483
  }
1526
1484
  const requiredKeys = [...new Set(options.effective.issues
1527
1485
  .filter((issue) => issue.type === 'missing-required' || issue.type === 'invalid-config')
1528
1486
  .map((issue) => issue.key))];
1529
1487
  const fields = Object.entries(schema).flatMap(([key, field]) => {
1530
- if (field.type === 'object')
1488
+ if (field.type === 'object' || field.type === 'array')
1531
1489
  return [];
1532
1490
  return [{
1533
1491
  key,
@@ -1548,8 +1506,8 @@ export function createPluginConfigFormModel(options) {
1548
1506
  });
1549
1507
  return {
1550
1508
  pluginName: options.pluginName ?? options.manifest.name,
1551
- allowedScopes: options.allowedScopes ?? ['user', 'project'],
1552
- initialScope: options.initialScope,
1509
+ allowedScopes: ['user'],
1510
+ initialScope: 'user',
1553
1511
  requiredKeys,
1554
1512
  fields,
1555
1513
  };
@@ -1588,13 +1546,17 @@ export function toCliConfigPromptOptions(model) {
1588
1546
  requiredKeys: [...model.requiredKeys],
1589
1547
  };
1590
1548
  }
1591
- function formatRequiredConfigSetCommands(pluginName, issues, defaultScope) {
1549
+ export function formatPluginConfigSetRecoveryCommand(pluginName, key, field, context, platform) {
1550
+ const command = `aw plugin config set ${pluginName} ${key} --context ${context}`
1551
+ + (platform ? ` --platform ${platform}` : '');
1552
+ return field.sensitive === true ? `${command} --value-stdin` : `${command} --value-json '<json>'`;
1553
+ }
1554
+ function formatRequiredConfigSetCommands(pluginName, issues, context, schema, platform) {
1592
1555
  const commands = new Set();
1593
1556
  for (const issue of issues) {
1594
- const scope = issue.source === 'user' || issue.source === 'project'
1595
- ? issue.source
1596
- : defaultScope;
1597
- commands.add(`aw config set ${pluginName} ${issue.key} --scope ${scope} --value-json '<json>'`);
1557
+ const field = schema[issue.key];
1558
+ if (field)
1559
+ commands.add(formatPluginConfigSetRecoveryCommand(pluginName, issue.key, field, context, platform));
1598
1560
  }
1599
1561
  return [...commands].map((command) => `\`${command}\``).join(' 或 ');
1600
1562
  }
@@ -1607,8 +1569,8 @@ export async function preflightRequiredPluginConfigs(options) {
1607
1569
  };
1608
1570
  for (const target of options.targets) {
1609
1571
  const pluginName = target.pluginName ?? target.manifest.name;
1610
- const identity = target.schemaSourceIdentity ?? createPluginConfigSchemaIdentity(target.manifest);
1611
- const dedupeKey = `${pluginName}\0${identity}`;
1572
+ const identity = target.schemaSourceIdentity ?? createPluginConfigSchemaIdentity(target.manifest, target.platform);
1573
+ const dedupeKey = `${pluginName}\0${target.platform ?? 'common'}\0${identity}`;
1612
1574
  if (visited.has(dedupeKey)) {
1613
1575
  continue;
1614
1576
  }
@@ -1617,11 +1579,13 @@ export async function preflightRequiredPluginConfigs(options) {
1617
1579
  if (!target.manifest.config?.fields) {
1618
1580
  continue;
1619
1581
  }
1620
- let effective = await resolveEffectivePluginConfig({
1582
+ const effective = await resolveEffectivePluginConfig({
1621
1583
  sourceId: target.sourceId,
1622
1584
  sourceIdentity: target.sourceIdentity,
1585
+ logicalIdentity: target.logicalIdentity,
1623
1586
  pluginName,
1624
1587
  manifest: target.manifest,
1588
+ platform: target.platform,
1625
1589
  cwd: options.cwd,
1626
1590
  env: options.context.env,
1627
1591
  });
@@ -1630,7 +1594,7 @@ export async function preflightRequiredPluginConfigs(options) {
1630
1594
  continue;
1631
1595
  }
1632
1596
  const details = blockingIssues.map((issue) => issue.key).join(', ');
1633
- const setCommands = formatRequiredConfigSetCommands(pluginName, blockingIssues, options.defaultScope);
1597
+ const setCommands = formatRequiredConfigSetCommands(target.sourceId ? `${target.sourceId}/${pluginName}` : pluginName, blockingIssues, options.defaultScope, effective.schema, target.platform);
1634
1598
  throw new Error(`${pluginName} requires valid AW config before install/upgrade: ${details}. ` +
1635
1599
  `Run ${setCommands}, or open \`aw\` to complete setup.`);
1636
1600
  }