@lesliechan721/aw 0.1.0-beta.3

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 (429) hide show
  1. package/dist/authoring/assets/aw-config.d.mts +2 -0
  2. package/dist/authoring/assets/aw-config.mjs +556 -0
  3. package/dist/authoring/assets/aw-config.mjs.map +1 -0
  4. package/dist/authoring/scripts/add-skill.d.mts +2 -0
  5. package/dist/authoring/scripts/add-skill.mjs +355 -0
  6. package/dist/authoring/scripts/add-skill.mjs.map +1 -0
  7. package/dist/authoring/scripts/check-plugin-versions.d.mts +2 -0
  8. package/dist/authoring/scripts/check-plugin-versions.mjs +5 -0
  9. package/dist/authoring/scripts/check-plugin-versions.mjs.map +1 -0
  10. package/dist/authoring/scripts/init-plugin.d.mts +2 -0
  11. package/dist/authoring/scripts/init-plugin.mjs +512 -0
  12. package/dist/authoring/scripts/init-plugin.mjs.map +1 -0
  13. package/dist/authoring/scripts/lib/javascript-import-scanner.d.mts +4 -0
  14. package/dist/authoring/scripts/lib/javascript-import-scanner.mjs +261 -0
  15. package/dist/authoring/scripts/lib/javascript-import-scanner.mjs.map +1 -0
  16. package/dist/authoring/scripts/lib/plugin-root.d.mts +26 -0
  17. package/dist/authoring/scripts/lib/plugin-root.mjs +125 -0
  18. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -0
  19. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +55 -0
  20. package/dist/authoring/scripts/lib/plugin-version-check.mjs +777 -0
  21. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -0
  22. package/dist/authoring/scripts/lib/semver.d.mts +9 -0
  23. package/dist/authoring/scripts/lib/semver.mjs +63 -0
  24. package/dist/authoring/scripts/lib/semver.mjs.map +1 -0
  25. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +124 -0
  26. package/dist/authoring/scripts/lib/skill-scaffold.mjs +374 -0
  27. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -0
  28. package/dist/authoring/scripts/plugin-status.d.mts +2 -0
  29. package/dist/authoring/scripts/plugin-status.mjs +96 -0
  30. package/dist/authoring/scripts/plugin-status.mjs.map +1 -0
  31. package/dist/authoring/scripts/validate-plugin.d.mts +2 -0
  32. package/dist/authoring/scripts/validate-plugin.mjs +4442 -0
  33. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -0
  34. package/dist/authoring/scripts/validate-skill.d.mts +2 -0
  35. package/dist/authoring/scripts/validate-skill.mjs +126 -0
  36. package/dist/authoring/scripts/validate-skill.mjs.map +1 -0
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.js +8 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/scripts/aw-skill-eval-engine.d.ts +13 -0
  41. package/dist/scripts/aw-skill-eval-engine.js +31 -0
  42. package/dist/scripts/aw-skill-eval-engine.js.map +1 -0
  43. package/dist/scripts/bundle-plugins.d.ts +18 -0
  44. package/dist/scripts/bundle-plugins.js +123 -0
  45. package/dist/scripts/bundle-plugins.js.map +1 -0
  46. package/dist/scripts/codex-eval-app-server.d.ts +89 -0
  47. package/dist/scripts/codex-eval-app-server.js +1228 -0
  48. package/dist/scripts/codex-eval-app-server.js.map +1 -0
  49. package/dist/scripts/codex-eval-isolation.d.ts +61 -0
  50. package/dist/scripts/codex-eval-isolation.js +318 -0
  51. package/dist/scripts/codex-eval-isolation.js.map +1 -0
  52. package/dist/scripts/codex-eval-process-management.d.ts +8 -0
  53. package/dist/scripts/codex-eval-process-management.js +69 -0
  54. package/dist/scripts/codex-eval-process-management.js.map +1 -0
  55. package/dist/scripts/codex-eval-process-tree.d.ts +38 -0
  56. package/dist/scripts/codex-eval-process-tree.js +803 -0
  57. package/dist/scripts/codex-eval-process-tree.js.map +1 -0
  58. package/dist/scripts/codex-eval-runtime-config.d.ts +62 -0
  59. package/dist/scripts/codex-eval-runtime-config.js +843 -0
  60. package/dist/scripts/codex-eval-runtime-config.js.map +1 -0
  61. package/dist/scripts/codex-trigger-eval.d.ts +84 -0
  62. package/dist/scripts/codex-trigger-eval.js +968 -0
  63. package/dist/scripts/codex-trigger-eval.js.map +1 -0
  64. package/dist/scripts/eval-plugin-skills-audited.d.ts +6 -0
  65. package/dist/scripts/eval-plugin-skills-audited.js +261 -0
  66. package/dist/scripts/eval-plugin-skills-audited.js.map +1 -0
  67. package/dist/scripts/eval-plugin-skills.d.ts +45 -0
  68. package/dist/scripts/eval-plugin-skills.js +1586 -0
  69. package/dist/scripts/eval-plugin-skills.js.map +1 -0
  70. package/dist/scripts/eval-run-layout.d.ts +17 -0
  71. package/dist/scripts/eval-run-layout.js +26 -0
  72. package/dist/scripts/eval-run-layout.js.map +1 -0
  73. package/dist/scripts/plugin-eval-contract.d.ts +185 -0
  74. package/dist/scripts/plugin-eval-contract.js +695 -0
  75. package/dist/scripts/plugin-eval-contract.js.map +1 -0
  76. package/dist/scripts/plugin-eval-materializer.d.ts +13 -0
  77. package/dist/scripts/plugin-eval-materializer.js +421 -0
  78. package/dist/scripts/plugin-eval-materializer.js.map +1 -0
  79. package/dist/scripts/plugin-staging.d.ts +43 -0
  80. package/dist/scripts/plugin-staging.js +196 -0
  81. package/dist/scripts/plugin-staging.js.map +1 -0
  82. package/dist/scripts/skill-reporting.d.ts +212 -0
  83. package/dist/scripts/skill-reporting.js +922 -0
  84. package/dist/scripts/skill-reporting.js.map +1 -0
  85. package/dist/scripts/test-plugin-scripts.d.ts +7 -0
  86. package/dist/scripts/test-plugin-scripts.js +674 -0
  87. package/dist/scripts/test-plugin-scripts.js.map +1 -0
  88. package/dist/src/adapters/helpers.d.ts +44 -0
  89. package/dist/src/adapters/helpers.js +95 -0
  90. package/dist/src/adapters/helpers.js.map +1 -0
  91. package/dist/src/authoring/workspace-commands.d.ts +46 -0
  92. package/dist/src/authoring/workspace-commands.js +133 -0
  93. package/dist/src/authoring/workspace-commands.js.map +1 -0
  94. package/dist/src/commands/catalog-publish.d.ts +33 -0
  95. package/dist/src/commands/catalog-publish.js +374 -0
  96. package/dist/src/commands/catalog-publish.js.map +1 -0
  97. package/dist/src/commands/catalog-source.d.ts +111 -0
  98. package/dist/src/commands/catalog-source.js +266 -0
  99. package/dist/src/commands/catalog-source.js.map +1 -0
  100. package/dist/src/commands/console.d.ts +3 -0
  101. package/dist/src/commands/console.js +44 -0
  102. package/dist/src/commands/console.js.map +1 -0
  103. package/dist/src/commands/dependency-operation-plan.d.ts +28 -0
  104. package/dist/src/commands/dependency-operation-plan.js +15 -0
  105. package/dist/src/commands/dependency-operation-plan.js.map +1 -0
  106. package/dist/src/commands/init.d.ts +31 -0
  107. package/dist/src/commands/init.js +63 -0
  108. package/dist/src/commands/init.js.map +1 -0
  109. package/dist/src/commands/options.d.ts +68 -0
  110. package/dist/src/commands/options.js +146 -0
  111. package/dist/src/commands/options.js.map +1 -0
  112. package/dist/src/commands/rebuild-command.d.ts +77 -0
  113. package/dist/src/commands/rebuild-command.js +1681 -0
  114. package/dist/src/commands/rebuild-command.js.map +1 -0
  115. package/dist/src/commands/rebuild-integration.d.ts +94 -0
  116. package/dist/src/commands/rebuild-integration.js +3289 -0
  117. package/dist/src/commands/rebuild-integration.js.map +1 -0
  118. package/dist/src/commands/rebuild-operations.d.ts +110 -0
  119. package/dist/src/commands/rebuild-operations.js +791 -0
  120. package/dist/src/commands/rebuild-operations.js.map +1 -0
  121. package/dist/src/commands/review-publication.d.ts +99 -0
  122. package/dist/src/commands/review-publication.js +904 -0
  123. package/dist/src/commands/review-publication.js.map +1 -0
  124. package/dist/src/commands/runtime.d.ts +176 -0
  125. package/dist/src/commands/runtime.js +746 -0
  126. package/dist/src/commands/runtime.js.map +1 -0
  127. package/dist/src/commands/status-v4.d.ts +102 -0
  128. package/dist/src/commands/status-v4.js +844 -0
  129. package/dist/src/commands/status-v4.js.map +1 -0
  130. package/dist/src/commands/status.d.ts +93 -0
  131. package/dist/src/commands/status.js +442 -0
  132. package/dist/src/commands/status.js.map +1 -0
  133. package/dist/src/commands/wizard.d.ts +57 -0
  134. package/dist/src/commands/wizard.js +58 -0
  135. package/dist/src/commands/wizard.js.map +1 -0
  136. package/dist/src/commands/write-commands.d.ts +7 -0
  137. package/dist/src/commands/write-commands.js +167 -0
  138. package/dist/src/commands/write-commands.js.map +1 -0
  139. package/dist/src/constants.d.ts +25 -0
  140. package/dist/src/constants.js +26 -0
  141. package/dist/src/constants.js.map +1 -0
  142. package/dist/src/generators/agents.d.ts +3 -0
  143. package/dist/src/generators/agents.js +46 -0
  144. package/dist/src/generators/agents.js.map +1 -0
  145. package/dist/src/generators/hooks.d.ts +15 -0
  146. package/dist/src/generators/hooks.js +76 -0
  147. package/dist/src/generators/hooks.js.map +1 -0
  148. package/dist/src/generators/instructions.d.ts +13 -0
  149. package/dist/src/generators/instructions.js +66 -0
  150. package/dist/src/generators/instructions.js.map +1 -0
  151. package/dist/src/generators/local-plugin.d.ts +53 -0
  152. package/dist/src/generators/local-plugin.js +1268 -0
  153. package/dist/src/generators/local-plugin.js.map +1 -0
  154. package/dist/src/generators/permissions.d.ts +10 -0
  155. package/dist/src/generators/permissions.js +37 -0
  156. package/dist/src/generators/permissions.js.map +1 -0
  157. package/dist/src/generators/shared.d.ts +2 -0
  158. package/dist/src/generators/shared.js +15 -0
  159. package/dist/src/generators/shared.js.map +1 -0
  160. package/dist/src/index.d.ts +35 -0
  161. package/dist/src/index.js +2344 -0
  162. package/dist/src/index.js.map +1 -0
  163. package/dist/src/output/command-receipt.d.ts +90 -0
  164. package/dist/src/output/command-receipt.js +129 -0
  165. package/dist/src/output/command-receipt.js.map +1 -0
  166. package/dist/src/output/debug-log.d.ts +4 -0
  167. package/dist/src/output/debug-log.js +97 -0
  168. package/dist/src/output/debug-log.js.map +1 -0
  169. package/dist/src/output/equivalent-command.d.ts +9 -0
  170. package/dist/src/output/equivalent-command.js +39 -0
  171. package/dist/src/output/equivalent-command.js.map +1 -0
  172. package/dist/src/output/model.d.ts +117 -0
  173. package/dist/src/output/model.js +145 -0
  174. package/dist/src/output/model.js.map +1 -0
  175. package/dist/src/output/rebuild-progress.d.ts +21 -0
  176. package/dist/src/output/rebuild-progress.js +138 -0
  177. package/dist/src/output/rebuild-progress.js.map +1 -0
  178. package/dist/src/output/redact.d.ts +3 -0
  179. package/dist/src/output/redact.js +39 -0
  180. package/dist/src/output/redact.js.map +1 -0
  181. package/dist/src/output/reporter.d.ts +9 -0
  182. package/dist/src/output/reporter.js +133 -0
  183. package/dist/src/output/reporter.js.map +1 -0
  184. package/dist/src/portable/commands.d.ts +120 -0
  185. package/dist/src/portable/commands.js +506 -0
  186. package/dist/src/portable/commands.js.map +1 -0
  187. package/dist/src/portable/materializer.d.ts +50 -0
  188. package/dist/src/portable/materializer.js +408 -0
  189. package/dist/src/portable/materializer.js.map +1 -0
  190. package/dist/src/portable/skills-cli.d.ts +43 -0
  191. package/dist/src/portable/skills-cli.js +148 -0
  192. package/dist/src/portable/skills-cli.js.map +1 -0
  193. package/dist/src/tui/components.d.ts +32 -0
  194. package/dist/src/tui/components.js +42 -0
  195. package/dist/src/tui/components.js.map +1 -0
  196. package/dist/src/tui/console-app-v4.d.ts +20 -0
  197. package/dist/src/tui/console-app-v4.js +2613 -0
  198. package/dist/src/tui/console-app-v4.js.map +1 -0
  199. package/dist/src/tui/controller-runtime.d.ts +11 -0
  200. package/dist/src/tui/controller-runtime.js +902 -0
  201. package/dist/src/tui/controller-runtime.js.map +1 -0
  202. package/dist/src/tui/controller.d.ts +367 -0
  203. package/dist/src/tui/controller.js +1724 -0
  204. package/dist/src/tui/controller.js.map +1 -0
  205. package/dist/src/tui/index.d.ts +13 -0
  206. package/dist/src/tui/index.js +14 -0
  207. package/dist/src/tui/index.js.map +1 -0
  208. package/dist/src/tui/keys.d.ts +12 -0
  209. package/dist/src/tui/keys.js +22 -0
  210. package/dist/src/tui/keys.js.map +1 -0
  211. package/dist/src/tui/layout.d.ts +12 -0
  212. package/dist/src/tui/layout.js +19 -0
  213. package/dist/src/tui/layout.js.map +1 -0
  214. package/dist/src/tui/model.d.ts +279 -0
  215. package/dist/src/tui/model.js +652 -0
  216. package/dist/src/tui/model.js.map +1 -0
  217. package/dist/src/tui/prompt.d.ts +8 -0
  218. package/dist/src/tui/prompt.js +242 -0
  219. package/dist/src/tui/prompt.js.map +1 -0
  220. package/dist/src/tui/router.d.ts +153 -0
  221. package/dist/src/tui/router.js +102 -0
  222. package/dist/src/tui/router.js.map +1 -0
  223. package/dist/src/tui/runner.d.ts +11 -0
  224. package/dist/src/tui/runner.js +71 -0
  225. package/dist/src/tui/runner.js.map +1 -0
  226. package/dist/src/tui/theme.d.ts +18 -0
  227. package/dist/src/tui/theme.js +20 -0
  228. package/dist/src/tui/theme.js.map +1 -0
  229. package/dist/src/tui/views.d.ts +57 -0
  230. package/dist/src/tui/views.js +173 -0
  231. package/dist/src/tui/views.js.map +1 -0
  232. package/dist/src/tui/wizard.d.ts +11 -0
  233. package/dist/src/tui/wizard.js +321 -0
  234. package/dist/src/tui/wizard.js.map +1 -0
  235. package/dist/src/types.d.ts +313 -0
  236. package/dist/src/types.js +33 -0
  237. package/dist/src/types.js.map +1 -0
  238. package/dist/src/utils/active-marketplace-runtime-lock.d.ts +12 -0
  239. package/dist/src/utils/active-marketplace-runtime-lock.js +133 -0
  240. package/dist/src/utils/active-marketplace-runtime-lock.js.map +1 -0
  241. package/dist/src/utils/agent-version.d.ts +13 -0
  242. package/dist/src/utils/agent-version.js +172 -0
  243. package/dist/src/utils/agent-version.js.map +1 -0
  244. package/dist/src/utils/artifact-plan.d.ts +26 -0
  245. package/dist/src/utils/artifact-plan.js +444 -0
  246. package/dist/src/utils/artifact-plan.js.map +1 -0
  247. package/dist/src/utils/artifact-renderer.d.ts +124 -0
  248. package/dist/src/utils/artifact-renderer.js +442 -0
  249. package/dist/src/utils/artifact-renderer.js.map +1 -0
  250. package/dist/src/utils/artifact-sources.d.ts +8 -0
  251. package/dist/src/utils/artifact-sources.js +10 -0
  252. package/dist/src/utils/artifact-sources.js.map +1 -0
  253. package/dist/src/utils/aw-home-mutation-lock.d.ts +10 -0
  254. package/dist/src/utils/aw-home-mutation-lock.js +55 -0
  255. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -0
  256. package/dist/src/utils/bundle-integrity.d.ts +3 -0
  257. package/dist/src/utils/bundle-integrity.js +88 -0
  258. package/dist/src/utils/bundle-integrity.js.map +1 -0
  259. package/dist/src/utils/bundle-layout.d.ts +4 -0
  260. package/dist/src/utils/bundle-layout.js +546 -0
  261. package/dist/src/utils/bundle-layout.js.map +1 -0
  262. package/dist/src/utils/catalog-digests.d.ts +8 -0
  263. package/dist/src/utils/catalog-digests.js +108 -0
  264. package/dist/src/utils/catalog-digests.js.map +1 -0
  265. package/dist/src/utils/catalog-manifest-v3.d.ts +2 -0
  266. package/dist/src/utils/catalog-manifest-v3.js +3 -0
  267. package/dist/src/utils/catalog-manifest-v3.js.map +1 -0
  268. package/dist/src/utils/catalog-manifest-v4.d.ts +5 -0
  269. package/dist/src/utils/catalog-manifest-v4.js +106 -0
  270. package/dist/src/utils/catalog-manifest-v4.js.map +1 -0
  271. package/dist/src/utils/catalog-public-error.d.ts +15 -0
  272. package/dist/src/utils/catalog-public-error.js +84 -0
  273. package/dist/src/utils/catalog-public-error.js.map +1 -0
  274. package/dist/src/utils/catalog-runtime-projection.d.ts +36 -0
  275. package/dist/src/utils/catalog-runtime-projection.js +172 -0
  276. package/dist/src/utils/catalog-runtime-projection.js.map +1 -0
  277. package/dist/src/utils/catalog-snapshot.d.ts +8 -0
  278. package/dist/src/utils/catalog-snapshot.js +12 -0
  279. package/dist/src/utils/catalog-snapshot.js.map +1 -0
  280. package/dist/src/utils/catalog-source-cache.d.ts +61 -0
  281. package/dist/src/utils/catalog-source-cache.js +276 -0
  282. package/dist/src/utils/catalog-source-cache.js.map +1 -0
  283. package/dist/src/utils/catalog-source-identity.d.ts +4 -0
  284. package/dist/src/utils/catalog-source-identity.js +118 -0
  285. package/dist/src/utils/catalog-source-identity.js.map +1 -0
  286. package/dist/src/utils/catalog-source-presentation.d.ts +1 -0
  287. package/dist/src/utils/catalog-source-presentation.js +32 -0
  288. package/dist/src/utils/catalog-source-presentation.js.map +1 -0
  289. package/dist/src/utils/catalog-source-references.d.ts +65 -0
  290. package/dist/src/utils/catalog-source-references.js +1418 -0
  291. package/dist/src/utils/catalog-source-references.js.map +1 -0
  292. package/dist/src/utils/catalog-sources.d.ts +39 -0
  293. package/dist/src/utils/catalog-sources.js +293 -0
  294. package/dist/src/utils/catalog-sources.js.map +1 -0
  295. package/dist/src/utils/codex-config.d.ts +124 -0
  296. package/dist/src/utils/codex-config.js +1011 -0
  297. package/dist/src/utils/codex-config.js.map +1 -0
  298. package/dist/src/utils/codex-project-surface.d.ts +3 -0
  299. package/dist/src/utils/codex-project-surface.js +49 -0
  300. package/dist/src/utils/codex-project-surface.js.map +1 -0
  301. package/dist/src/utils/codex-roles.d.ts +71 -0
  302. package/dist/src/utils/codex-roles.js +257 -0
  303. package/dist/src/utils/codex-roles.js.map +1 -0
  304. package/dist/src/utils/codex-skill-staging.d.ts +9 -0
  305. package/dist/src/utils/codex-skill-staging.js +8 -0
  306. package/dist/src/utils/codex-skill-staging.js.map +1 -0
  307. package/dist/src/utils/config-value.d.ts +3 -0
  308. package/dist/src/utils/config-value.js +23 -0
  309. package/dist/src/utils/config-value.js.map +1 -0
  310. package/dist/src/utils/dynamic-skill-tree.d.ts +32 -0
  311. package/dist/src/utils/dynamic-skill-tree.js +436 -0
  312. package/dist/src/utils/dynamic-skill-tree.js.map +1 -0
  313. package/dist/src/utils/file-rules.d.ts +1 -0
  314. package/dist/src/utils/file-rules.js +2 -0
  315. package/dist/src/utils/file-rules.js.map +1 -0
  316. package/dist/src/utils/git-catalog-provider.d.ts +7 -0
  317. package/dist/src/utils/git-catalog-provider.js +510 -0
  318. package/dist/src/utils/git-catalog-provider.js.map +1 -0
  319. package/dist/src/utils/hooks-contract.d.ts +1 -0
  320. package/dist/src/utils/hooks-contract.js +2 -0
  321. package/dist/src/utils/hooks-contract.js.map +1 -0
  322. package/dist/src/utils/json.d.ts +4 -0
  323. package/dist/src/utils/json.js +29 -0
  324. package/dist/src/utils/json.js.map +1 -0
  325. package/dist/src/utils/lifecycle-active-store.d.ts +175 -0
  326. package/dist/src/utils/lifecycle-active-store.js +1276 -0
  327. package/dist/src/utils/lifecycle-active-store.js.map +1 -0
  328. package/dist/src/utils/local-marketplace.d.ts +41 -0
  329. package/dist/src/utils/local-marketplace.js +317 -0
  330. package/dist/src/utils/local-marketplace.js.map +1 -0
  331. package/dist/src/utils/manifest.d.ts +14 -0
  332. package/dist/src/utils/manifest.js +36 -0
  333. package/dist/src/utils/manifest.js.map +1 -0
  334. package/dist/src/utils/marketplace.d.ts +3 -0
  335. package/dist/src/utils/marketplace.js +76 -0
  336. package/dist/src/utils/marketplace.js.map +1 -0
  337. package/dist/src/utils/multi-source-catalog.d.ts +72 -0
  338. package/dist/src/utils/multi-source-catalog.js +402 -0
  339. package/dist/src/utils/multi-source-catalog.js.map +1 -0
  340. package/dist/src/utils/native-cli.d.ts +75 -0
  341. package/dist/src/utils/native-cli.js +435 -0
  342. package/dist/src/utils/native-cli.js.map +1 -0
  343. package/dist/src/utils/orphan-marketplace-cleanup.d.ts +18 -0
  344. package/dist/src/utils/orphan-marketplace-cleanup.js +202 -0
  345. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -0
  346. package/dist/src/utils/ownership.d.ts +130 -0
  347. package/dist/src/utils/ownership.js +766 -0
  348. package/dist/src/utils/ownership.js.map +1 -0
  349. package/dist/src/utils/path-catalog-provider.d.ts +7 -0
  350. package/dist/src/utils/path-catalog-provider.js +87 -0
  351. package/dist/src/utils/path-catalog-provider.js.map +1 -0
  352. package/dist/src/utils/paths.d.ts +41 -0
  353. package/dist/src/utils/paths.js +138 -0
  354. package/dist/src/utils/paths.js.map +1 -0
  355. package/dist/src/utils/platform-entries.d.ts +1 -0
  356. package/dist/src/utils/platform-entries.js +2 -0
  357. package/dist/src/utils/platform-entries.js.map +1 -0
  358. package/dist/src/utils/platform-support.d.ts +1 -0
  359. package/dist/src/utils/platform-support.js +2 -0
  360. package/dist/src/utils/platform-support.js.map +1 -0
  361. package/dist/src/utils/plugin-authoring-capabilities.d.ts +23 -0
  362. package/dist/src/utils/plugin-authoring-capabilities.js +37 -0
  363. package/dist/src/utils/plugin-authoring-capabilities.js.map +1 -0
  364. package/dist/src/utils/plugin-authoring-capabilities.json +92 -0
  365. package/dist/src/utils/plugin-config-write.d.ts +107 -0
  366. package/dist/src/utils/plugin-config-write.js +565 -0
  367. package/dist/src/utils/plugin-config-write.js.map +1 -0
  368. package/dist/src/utils/plugin-config.d.ts +396 -0
  369. package/dist/src/utils/plugin-config.js +1898 -0
  370. package/dist/src/utils/plugin-config.js.map +1 -0
  371. package/dist/src/utils/plugin-dependencies.d.ts +12 -0
  372. package/dist/src/utils/plugin-dependencies.js +162 -0
  373. package/dist/src/utils/plugin-dependencies.js.map +1 -0
  374. package/dist/src/utils/plugin-release.d.ts +2 -0
  375. package/dist/src/utils/plugin-release.js +2 -0
  376. package/dist/src/utils/plugin-release.js.map +1 -0
  377. package/dist/src/utils/plugin-script-contract.d.ts +1 -0
  378. package/dist/src/utils/plugin-script-contract.js +2 -0
  379. package/dist/src/utils/plugin-script-contract.js.map +1 -0
  380. package/dist/src/utils/plugin-scripts.d.ts +172 -0
  381. package/dist/src/utils/plugin-scripts.js +585 -0
  382. package/dist/src/utils/plugin-scripts.js.map +1 -0
  383. package/dist/src/utils/process-lock.d.ts +47 -0
  384. package/dist/src/utils/process-lock.js +532 -0
  385. package/dist/src/utils/process-lock.js.map +1 -0
  386. package/dist/src/utils/process-tree.d.ts +2 -0
  387. package/dist/src/utils/process-tree.js +2 -0
  388. package/dist/src/utils/process-tree.js.map +1 -0
  389. package/dist/src/utils/project-boundary.d.ts +21 -0
  390. package/dist/src/utils/project-boundary.js +95 -0
  391. package/dist/src/utils/project-boundary.js.map +1 -0
  392. package/dist/src/utils/rendered-contract.d.ts +8 -0
  393. package/dist/src/utils/rendered-contract.js +134 -0
  394. package/dist/src/utils/rendered-contract.js.map +1 -0
  395. package/dist/src/utils/runtime-skill-closure.d.ts +13 -0
  396. package/dist/src/utils/runtime-skill-closure.js +863 -0
  397. package/dist/src/utils/runtime-skill-closure.js.map +1 -0
  398. package/dist/src/utils/skill-authoring.d.ts +1 -0
  399. package/dist/src/utils/skill-authoring.js +2 -0
  400. package/dist/src/utils/skill-authoring.js.map +1 -0
  401. package/dist/src/utils/skill-frontmatter-capabilities.d.ts +201 -0
  402. package/dist/src/utils/skill-frontmatter-capabilities.js +5 -0
  403. package/dist/src/utils/skill-frontmatter-capabilities.js.map +1 -0
  404. package/dist/src/utils/skill-frontmatter-capabilities.json +200 -0
  405. package/dist/src/utils/skill-validation.d.ts +37 -0
  406. package/dist/src/utils/skill-validation.js +326 -0
  407. package/dist/src/utils/skill-validation.js.map +1 -0
  408. package/dist/src/utils/slash-commands.d.ts +1 -0
  409. package/dist/src/utils/slash-commands.js +2 -0
  410. package/dist/src/utils/slash-commands.js.map +1 -0
  411. package/dist/src/utils/state-paths.d.ts +13 -0
  412. package/dist/src/utils/state-paths.js +129 -0
  413. package/dist/src/utils/state-paths.js.map +1 -0
  414. package/dist/src/utils/target-eligibility.d.ts +7 -0
  415. package/dist/src/utils/target-eligibility.js +26 -0
  416. package/dist/src/utils/target-eligibility.js.map +1 -0
  417. package/dist/src/utils/target-order.d.ts +7 -0
  418. package/dist/src/utils/target-order.js +10 -0
  419. package/dist/src/utils/target-order.js.map +1 -0
  420. package/dist/src/utils/template-engine.d.ts +1 -0
  421. package/dist/src/utils/template-engine.js +2 -0
  422. package/dist/src/utils/template-engine.js.map +1 -0
  423. package/dist/src/utils/test-path-fence.d.ts +12 -0
  424. package/dist/src/utils/test-path-fence.js +31 -0
  425. package/dist/src/utils/test-path-fence.js.map +1 -0
  426. package/dist/vitest.config.d.ts +2 -0
  427. package/dist/vitest.config.js +16 -0
  428. package/dist/vitest.config.js.map +1 -0
  429. package/package.json +61 -0
@@ -0,0 +1,107 @@
1
+ import type { RebuildCommandRuntime } from '../commands/rebuild-command.js';
2
+ import { reinstallWriteCommand } from '../commands/write-commands.js';
3
+ import type { ConfigReceiptFieldEntry, ConfigSchemaEvidence, PluginMeta, ReceiptOverallState, ReceiptTargetIdentity, ReceiptTargetResult, Scope } from '../types.js';
4
+ import { type NativeCliRunner } from './native-cli.js';
5
+ import { summarizeEffectivePluginConfig } from './plugin-config.js';
6
+ import { type ProjectBoundaryWarning } from './project-boundary.js';
7
+ import { type AwHomeMutationToken } from './aw-home-mutation-lock.js';
8
+ export interface PluginConfigWriteRequest {
9
+ updates?: Record<string, unknown>;
10
+ removeKeys?: string[];
11
+ }
12
+ export type ConfigApplySkippedReason = 'noVisibleTarget' | 'noConfigChange';
13
+ export interface PluginConfigWriteReceipt {
14
+ plugin: string;
15
+ scope: Scope;
16
+ projectLayer: 'shared' | 'local';
17
+ schema?: ConfigSchemaEvidence;
18
+ updatedKeys: string[];
19
+ removedKeys: string[];
20
+ effective: ReturnType<typeof summarizeEffectivePluginConfig>;
21
+ configWrite: 'succeeded';
22
+ overallState: ReceiptOverallState;
23
+ targetResults: ReceiptTargetResult[];
24
+ applySkippedReason?: ConfigApplySkippedReason;
25
+ otherProjectsRequireReinstall: boolean;
26
+ warnings: Array<ProjectBoundaryWarning | string>;
27
+ }
28
+ export interface ResetPluginConfigWriteReceipt {
29
+ plugin: string;
30
+ scope: Scope;
31
+ projectLayer: 'shared' | 'local';
32
+ schema?: ConfigSchemaEvidence;
33
+ existed: boolean;
34
+ deleted: boolean;
35
+ removedKeys: string[];
36
+ effective?: ReturnType<typeof summarizeEffectivePluginConfig>;
37
+ configWrite: 'succeeded';
38
+ overallState: ReceiptOverallState;
39
+ targetResults: ReceiptTargetResult[];
40
+ applySkippedReason?: ConfigApplySkippedReason;
41
+ otherProjectsRequireReinstall: boolean;
42
+ warnings: Array<ProjectBoundaryWarning | string>;
43
+ }
44
+ type ReinstallCommand = typeof reinstallWriteCommand;
45
+ interface ConfigRuntimeReplayReceipt {
46
+ configWrite: 'succeeded';
47
+ overallState: ReceiptOverallState;
48
+ targetResults: ReceiptTargetResult[];
49
+ applySkippedReason?: ConfigApplySkippedReason;
50
+ otherProjectsRequireReinstall: boolean;
51
+ }
52
+ export declare function replayConfigRuntimeWrites(options: {
53
+ plugin: PluginMeta;
54
+ scope: Scope;
55
+ cwd: string;
56
+ env?: NodeJS.ProcessEnv;
57
+ applyTargets?: ReceiptTargetIdentity[];
58
+ includeDynamicArtifacts?: boolean;
59
+ nativeCliRunner?: NativeCliRunner;
60
+ reinstallCommandImpl?: ReinstallCommand;
61
+ rebuildRuntime?: RebuildCommandRuntime;
62
+ awHomeMutationToken?: AwHomeMutationToken;
63
+ }): Promise<ConfigRuntimeReplayReceipt>;
64
+ type ApplyPluginConfigWriteOptions = {
65
+ plugin?: PluginMeta | null;
66
+ pluginError?: Error | null;
67
+ pluginName?: string;
68
+ scope: Scope;
69
+ projectLayer?: 'shared' | 'local';
70
+ cwd: string;
71
+ env?: NodeJS.ProcessEnv;
72
+ applyTargets?: ReceiptTargetIdentity[];
73
+ nativeCliRunner?: NativeCliRunner;
74
+ reinstallCommandImpl?: ReinstallCommand;
75
+ rebuildRuntime?: RebuildCommandRuntime;
76
+ awHomeMutationToken?: AwHomeMutationToken;
77
+ request: PluginConfigWriteRequest;
78
+ reviewPreflight?: () => Promise<void> | void;
79
+ };
80
+ export declare function applyPluginConfigWrite(options: ApplyPluginConfigWriteOptions): Promise<PluginConfigWriteReceipt>;
81
+ type ResetPluginConfigWriteOptions = {
82
+ pluginName: string;
83
+ scope: Scope;
84
+ projectLayer?: 'shared' | 'local';
85
+ cwd: string;
86
+ env?: NodeJS.ProcessEnv;
87
+ plugin: PluginMeta;
88
+ applyTargets?: ReceiptTargetIdentity[];
89
+ nativeCliRunner?: NativeCliRunner;
90
+ reinstallCommandImpl?: ReinstallCommand;
91
+ rebuildRuntime?: RebuildCommandRuntime;
92
+ awHomeMutationToken?: AwHomeMutationToken;
93
+ reviewPreflight?: () => Promise<void> | void;
94
+ };
95
+ export declare function resetPluginConfigWithHelper(options: ResetPluginConfigWriteOptions): Promise<ResetPluginConfigWriteReceipt>;
96
+ export declare function describeResetAffectedFields(options: {
97
+ sourceId?: string;
98
+ sourceIdentity?: string;
99
+ pluginName: string;
100
+ plugin?: PluginMeta | null;
101
+ pluginError?: Error | null;
102
+ scope: Scope;
103
+ projectLayer?: 'shared' | 'local';
104
+ cwd: string;
105
+ env?: NodeJS.ProcessEnv;
106
+ }): Promise<ConfigReceiptFieldEntry[]>;
107
+ export {};
@@ -0,0 +1,565 @@
1
+ import path from 'node:path';
2
+ import { discoverRebuildTargetNames, inspectRebuildTarget, } from '../commands/rebuild-integration.js';
3
+ import { reinstallWriteCommand } from '../commands/write-commands.js';
4
+ import { createNoopDebugLogger } from '../output/debug-log.js';
5
+ import { createNoopReporter } from '../output/reporter.js';
6
+ import { getDefaultNativeCliRunner } from './native-cli.js';
7
+ import { resolveAwHome } from './paths.js';
8
+ import { hasCodexProjectManagedArtifacts } from './codex-project-surface.js';
9
+ import { assertSafePluginConfigSegment, coercePluginConfigUpdates, collectProjectArtifactConfigBoundaryIssues, patchPluginConfigStore, readPluginConfigStore, resetPluginConfigStore, resolveConfigRead, resolveEffectivePluginConfig, resolvePluginConfigSchemaAccess, summarizeEffectivePluginConfig, withPluginConfigTransactionLease, } from './plugin-config.js';
10
+ import { assertProjectSharedConfigPathVisible, ensureProjectPrivateStateIgnore, } from './project-boundary.js';
11
+ import { resolveClaudeProjectKey, resolveCodexProjectKey } from './paths.js';
12
+ import { supportsPlatform } from './platform-support.js';
13
+ import { withAwHomeMutationLock, } from './aw-home-mutation-lock.js';
14
+ function uniqueInOrder(values) {
15
+ return [...new Set(values)];
16
+ }
17
+ function collectRemovedConfigKeys(values) {
18
+ return uniqueInOrder(Object.keys(values));
19
+ }
20
+ function targetKey(target) {
21
+ return `${target.platform}:${target.scope}:${target.projectKey ?? '-'}`;
22
+ }
23
+ function dedupeTargets(targets) {
24
+ const deduped = new Map();
25
+ for (const target of targets)
26
+ deduped.set(targetKey(target), target);
27
+ return [...deduped.values()];
28
+ }
29
+ async function resolveProjectKey(platform, cwd) {
30
+ return platform === 'codex'
31
+ ? resolveCodexProjectKey(cwd)
32
+ : resolveClaudeProjectKey(cwd);
33
+ }
34
+ async function createCandidateTarget(options) {
35
+ return {
36
+ pluginName: options.pluginName,
37
+ platform: options.platform,
38
+ scope: options.scope,
39
+ ...(options.scope === 'project'
40
+ ? { projectKey: await resolveProjectKey(options.platform, options.cwd) }
41
+ : {}),
42
+ };
43
+ }
44
+ async function discoverVisibleTargets(options) {
45
+ const targets = [];
46
+ const failures = [];
47
+ const namedTargets = [];
48
+ const scopes = options.scope === 'user' ? ['user', 'project'] : ['project'];
49
+ for (const platform of ['codex', 'claude']) {
50
+ for (const scope of scopes) {
51
+ if (!supportsPlatform(options.plugin.manifest, platform))
52
+ continue;
53
+ if (platform === 'codex'
54
+ && scope === 'project'
55
+ && !hasCodexProjectManagedArtifacts(options.plugin))
56
+ continue;
57
+ const target = await createCandidateTarget({
58
+ pluginName: options.pluginName,
59
+ platform,
60
+ scope,
61
+ cwd: options.cwd,
62
+ });
63
+ try {
64
+ const names = await discoverRebuildTargetNames({
65
+ cwd: options.cwd,
66
+ env: options.env,
67
+ platform,
68
+ scope,
69
+ nativeCliRunner: options.nativeCliRunner,
70
+ nativeFailureMode: 'ignore',
71
+ marketplaceName: options.plugin.marketplaceName,
72
+ marketplaceRoot: options.plugin.sourceId
73
+ ? path.join(resolveAwHome(options.env), 'marketplaces', options.plugin.sourceId)
74
+ : undefined,
75
+ });
76
+ if (!names.includes(options.pluginName))
77
+ continue;
78
+ namedTargets.push(target);
79
+ }
80
+ catch (error) {
81
+ failures.push({
82
+ target,
83
+ action: 'reinstall',
84
+ state: 'failed',
85
+ message: error instanceof Error ? error.message : String(error),
86
+ });
87
+ }
88
+ }
89
+ }
90
+ if (namedTargets.length === 0)
91
+ return { targets, failures };
92
+ const catalog = options.rebuildRuntime?.catalogResolution ?? {
93
+ rootDir: options.plugin.sourceId
94
+ ? path.resolve(options.plugin.rootDir, '..', '..')
95
+ : options.plugin.rootDir,
96
+ source: 'local',
97
+ };
98
+ for (const target of namedTargets) {
99
+ try {
100
+ const inspected = await inspectRebuildTarget({
101
+ sourceId: options.plugin.sourceId,
102
+ sourceIdentity: options.plugin.sourceIdentity,
103
+ pluginId: options.plugin.pluginId,
104
+ marketplaceName: options.plugin.marketplaceName,
105
+ marketplaceRoot: options.plugin.sourceId
106
+ ? path.join(resolveAwHome(options.env), 'marketplaces', options.plugin.sourceId)
107
+ : undefined,
108
+ plugin: options.plugin,
109
+ platform: target.platform,
110
+ scope: target.scope,
111
+ cwd: options.cwd,
112
+ catalog,
113
+ context: {
114
+ env: options.env,
115
+ nativeCliRunner: options.nativeCliRunner,
116
+ reporter: options.rebuildRuntime?.reporter ?? createNoopReporter(),
117
+ debugLogger: options.rebuildRuntime?.debugLogger ?? createNoopDebugLogger(),
118
+ },
119
+ });
120
+ if (inspected.inspection.state === 'present' || inspected.inspection.state === 'partial') {
121
+ targets.push(target);
122
+ }
123
+ }
124
+ catch (error) {
125
+ failures.push({
126
+ target,
127
+ action: 'reinstall',
128
+ state: 'failed',
129
+ message: error instanceof Error ? error.message : String(error),
130
+ });
131
+ }
132
+ }
133
+ return { targets: dedupeTargets(targets), failures };
134
+ }
135
+ async function reinstallVisibleTargets(options) {
136
+ const nativeCliRunner = options.nativeCliRunner ?? getDefaultNativeCliRunner();
137
+ const discovered = options.applyTargets === undefined
138
+ ? await discoverVisibleTargets({
139
+ pluginName: options.plugin.manifest.name,
140
+ plugin: options.plugin,
141
+ scope: options.scope,
142
+ cwd: options.cwd,
143
+ env: options.env,
144
+ nativeCliRunner,
145
+ rebuildRuntime: options.rebuildRuntime,
146
+ })
147
+ : { targets: dedupeTargets(options.applyTargets), failures: [] };
148
+ const targetResults = [...discovered.failures];
149
+ let runtimeFailed = discovered.failures.length > 0;
150
+ const reinstall = options.reinstallCommandImpl ?? reinstallWriteCommand;
151
+ if (options.plugin.sourceId && !options.plugin.pluginId) {
152
+ throw new Error(`Plugin "${options.plugin.manifest.name}" is missing its namespaced plugin ID.`);
153
+ }
154
+ const selector = options.plugin.sourceId
155
+ ? options.plugin.pluginId
156
+ : options.plugin.manifest.name;
157
+ for (const target of discovered.targets) {
158
+ try {
159
+ const result = await reinstall([selector], {
160
+ cwd: options.cwd,
161
+ platform: target.platform,
162
+ scope: target.scope,
163
+ }, {
164
+ ...options.rebuildRuntime,
165
+ env: options.env,
166
+ nativeCliRunner,
167
+ });
168
+ if (result.overallState === 'failed')
169
+ runtimeFailed = true;
170
+ targetResults.push(...result.targetResults);
171
+ }
172
+ catch (error) {
173
+ runtimeFailed = true;
174
+ targetResults.push({
175
+ target,
176
+ action: 'reinstall',
177
+ state: 'failed',
178
+ message: error instanceof Error ? error.message : String(error),
179
+ });
180
+ }
181
+ }
182
+ const overallState = runtimeFailed || targetResults.some((entry) => entry.state === 'failed')
183
+ ? 'failed' : 'succeeded';
184
+ return {
185
+ overallState,
186
+ targetResults,
187
+ ...(discovered.targets.length === 0 && discovered.failures.length === 0
188
+ ? { applySkippedReason: 'noVisibleTarget' }
189
+ : {}),
190
+ };
191
+ }
192
+ function otherProjectsWarning(scope) {
193
+ return scope === 'user'
194
+ ? ['其它项目不会由本次命令扫描或更新。请在每个项目目录中运行对应的 aw reinstall 命令。']
195
+ : [];
196
+ }
197
+ function buildReceiptFieldEntry(options) {
198
+ return {
199
+ key: options.key,
200
+ title: options.title,
201
+ kind: options.kind,
202
+ reserved: options.reserved,
203
+ action: options.action,
204
+ scope: options.scope,
205
+ ...(options.scope === 'project' ? { projectLayer: options.projectLayer } : {}),
206
+ ...(options.valueState ? { valueState: options.valueState } : {}),
207
+ };
208
+ }
209
+ export async function replayConfigRuntimeWrites(options) {
210
+ return withAwHomeMutationLock({
211
+ env: options.env,
212
+ token: options.awHomeMutationToken,
213
+ action: async (awHomeMutationToken) => {
214
+ const applied = await reinstallVisibleTargets({
215
+ plugin: options.plugin,
216
+ scope: options.scope,
217
+ cwd: options.cwd,
218
+ env: options.env ?? process.env,
219
+ applyTargets: options.applyTargets,
220
+ nativeCliRunner: options.nativeCliRunner,
221
+ reinstallCommandImpl: options.reinstallCommandImpl,
222
+ rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
223
+ });
224
+ return {
225
+ configWrite: 'succeeded',
226
+ overallState: applied.overallState,
227
+ targetResults: applied.targetResults,
228
+ ...(applied.applySkippedReason ? { applySkippedReason: applied.applySkippedReason } : {}),
229
+ otherProjectsRequireReinstall: options.scope === 'user',
230
+ };
231
+ },
232
+ });
233
+ }
234
+ async function applyPluginConfigWriteUnlocked(options) {
235
+ const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
236
+ if (!requestedPluginName)
237
+ throw new Error('Plugin name is required for config write.');
238
+ const pluginName = assertSafePluginConfigSegment(requestedPluginName);
239
+ const configIdentity = options.plugin?.sourceId ? {
240
+ sourceId: options.plugin.sourceId,
241
+ sourceIdentity: options.plugin.sourceIdentity,
242
+ } : {};
243
+ const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
244
+ const requestedUpdates = options.request.updates ?? {};
245
+ const requestedRemoveKeys = uniqueInOrder(options.request.removeKeys ?? []);
246
+ const duplicateKeys = requestedRemoveKeys.filter((key) => Object.hasOwn(requestedUpdates, key));
247
+ if (duplicateKeys.length > 0) {
248
+ throw new Error(`Config write cannot update and remove the same key: ${duplicateKeys.join(', ')}.`);
249
+ }
250
+ const schemaAccess = await resolvePluginConfigSchemaAccess({
251
+ pluginName,
252
+ currentPlugin: options.plugin,
253
+ currentPluginError: options.pluginError,
254
+ scope: options.scope,
255
+ projectLayer,
256
+ cwd: options.cwd,
257
+ env: options.env,
258
+ });
259
+ const schemaPlugin = schemaAccess.plugin;
260
+ const schema = schemaPlugin?.manifest.config?.schema;
261
+ if (!schema || !schemaPlugin) {
262
+ throw new Error(`configSchemaUnavailable: Plugin "${pluginName}" does not declare an AW config schema.`);
263
+ }
264
+ for (const key of requestedRemoveKeys) {
265
+ if (!schema[key])
266
+ throw new Error(`Unknown config key "${key}".`);
267
+ }
268
+ const updates = await coercePluginConfigUpdates({ schema, updates: requestedUpdates, cwd: options.cwd });
269
+ if (options.scope === 'project' && projectLayer === 'shared') {
270
+ for (const key of Object.keys(updates)) {
271
+ const field = schema[key];
272
+ if (field.type === 'file' || field.type === 'directory') {
273
+ throw new Error(`Config "${key}" is a ${field.type} value and cannot be written into project shared config. `
274
+ + 'Use `--scope project --local` or user config instead.');
275
+ }
276
+ }
277
+ }
278
+ const store = await readPluginConfigStore({
279
+ ...configIdentity,
280
+ pluginName,
281
+ scope: options.scope,
282
+ projectLayer,
283
+ cwd: options.cwd,
284
+ env: options.env,
285
+ });
286
+ const warnings = [];
287
+ if (options.scope === 'project' && projectLayer === 'shared') {
288
+ await assertProjectSharedConfigPathVisible({ cwd: options.cwd, targetPath: store.path });
289
+ }
290
+ if (options.scope === 'project' && projectLayer === 'local') {
291
+ const ignore = await ensureProjectPrivateStateIgnore({ cwd: options.cwd, targetPath: store.path });
292
+ if (ignore.warning)
293
+ warnings.push(ignore.warning);
294
+ }
295
+ const removedKeys = requestedRemoveKeys.filter((key) => Object.hasOwn(store.values, key));
296
+ const updatedKeys = Object.keys(updates);
297
+ const changedKeys = [...updatedKeys, ...removedKeys];
298
+ if (options.scope === 'project' && projectLayer === 'shared' && changedKeys.length > 0) {
299
+ const nextValues = { ...store.values, ...updates };
300
+ for (const key of requestedRemoveKeys)
301
+ delete nextValues[key];
302
+ const boundaryIssues = collectProjectArtifactConfigBoundaryIssues({
303
+ schema,
304
+ sharedEntries: nextValues,
305
+ });
306
+ if (boundaryIssues.length > 0) {
307
+ throw new Error([...new Set(boundaryIssues.map((issue) => issue.message))].join(' '));
308
+ }
309
+ }
310
+ if (changedKeys.length > 0) {
311
+ await patchPluginConfigStore({
312
+ ...configIdentity,
313
+ pluginName,
314
+ scope: options.scope,
315
+ projectLayer,
316
+ cwd: options.cwd,
317
+ env: options.env,
318
+ updates,
319
+ removeKeys: requestedRemoveKeys,
320
+ });
321
+ }
322
+ const effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
323
+ ...configIdentity,
324
+ pluginName,
325
+ manifest: schemaPlugin.manifest,
326
+ cwd: options.cwd,
327
+ env: options.env,
328
+ }));
329
+ const applied = changedKeys.length === 0
330
+ ? {
331
+ overallState: 'succeeded',
332
+ targetResults: [],
333
+ applySkippedReason: 'noConfigChange',
334
+ }
335
+ : await reinstallVisibleTargets({
336
+ plugin: schemaPlugin,
337
+ scope: options.scope,
338
+ cwd: options.cwd,
339
+ env: options.env ?? process.env,
340
+ applyTargets: options.applyTargets,
341
+ nativeCliRunner: options.nativeCliRunner,
342
+ reinstallCommandImpl: options.reinstallCommandImpl,
343
+ rebuildRuntime: options.rebuildRuntime,
344
+ });
345
+ const otherProjectsRequireReinstall = options.scope === 'user'
346
+ && changedKeys.length > 0;
347
+ if (otherProjectsRequireReinstall)
348
+ warnings.push(...otherProjectsWarning(options.scope));
349
+ return {
350
+ plugin: pluginName,
351
+ scope: options.scope,
352
+ projectLayer,
353
+ ...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
354
+ updatedKeys,
355
+ removedKeys,
356
+ effective,
357
+ configWrite: 'succeeded',
358
+ overallState: applied.overallState,
359
+ targetResults: applied.targetResults,
360
+ ...(applied.applySkippedReason ? { applySkippedReason: applied.applySkippedReason } : {}),
361
+ otherProjectsRequireReinstall,
362
+ warnings,
363
+ };
364
+ }
365
+ export async function applyPluginConfigWrite(options) {
366
+ const requestedPluginName = options.pluginName ?? options.plugin?.manifest.name;
367
+ if (!requestedPluginName)
368
+ throw new Error('Plugin name is required for config write.');
369
+ const pluginName = assertSafePluginConfigSegment(requestedPluginName);
370
+ return withAwHomeMutationLock({
371
+ env: options.env,
372
+ token: options.awHomeMutationToken,
373
+ action: (awHomeMutationToken) => withPluginConfigTransactionLease({
374
+ ...(options.plugin?.sourceId ? { sourceId: options.plugin.sourceId } : {}),
375
+ pluginName,
376
+ scope: options.scope,
377
+ projectLayer: options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared',
378
+ cwd: options.cwd,
379
+ env: options.env,
380
+ action: async () => {
381
+ await options.reviewPreflight?.();
382
+ return applyPluginConfigWriteUnlocked({
383
+ ...options,
384
+ awHomeMutationToken,
385
+ rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
386
+ });
387
+ },
388
+ }),
389
+ });
390
+ }
391
+ async function resetPluginConfigWithHelperUnlocked(options) {
392
+ const pluginName = assertSafePluginConfigSegment(options.pluginName);
393
+ const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
394
+ if (!options.plugin) {
395
+ throw new Error(`sourceMissing: Plugin "${pluginName}" is unavailable; config reset was not applied.`);
396
+ }
397
+ const schemaAccess = await resolvePluginConfigSchemaAccess({
398
+ pluginName,
399
+ currentPlugin: options.plugin,
400
+ scope: options.scope,
401
+ projectLayer,
402
+ cwd: options.cwd,
403
+ env: options.env,
404
+ });
405
+ if (!schemaAccess.plugin?.manifest.config?.schema) {
406
+ throw new Error(`configSchemaUnavailable: Plugin "${pluginName}" does not declare an AW config schema.`);
407
+ }
408
+ const configIdentity = options.plugin.sourceId ? {
409
+ sourceId: options.plugin.sourceId,
410
+ sourceIdentity: options.plugin.sourceIdentity,
411
+ } : {};
412
+ const store = await readPluginConfigStore({
413
+ ...configIdentity,
414
+ pluginName,
415
+ scope: options.scope,
416
+ projectLayer,
417
+ cwd: options.cwd,
418
+ env: options.env,
419
+ });
420
+ const removedKeys = collectRemovedConfigKeys(store.values);
421
+ const warnings = [];
422
+ if (options.scope === 'project' && projectLayer === 'shared' && store.exists) {
423
+ await assertProjectSharedConfigPathVisible({ cwd: options.cwd, targetPath: store.path });
424
+ }
425
+ if (options.scope === 'project' && projectLayer === 'local') {
426
+ const ignore = await ensureProjectPrivateStateIgnore({ cwd: options.cwd, targetPath: store.path });
427
+ if (ignore.warning)
428
+ warnings.push(ignore.warning);
429
+ }
430
+ const reset = await resetPluginConfigStore({
431
+ ...configIdentity,
432
+ pluginName,
433
+ scope: options.scope,
434
+ projectLayer,
435
+ cwd: options.cwd,
436
+ env: options.env,
437
+ });
438
+ let applied = {
439
+ overallState: 'succeeded',
440
+ targetResults: [],
441
+ applySkippedReason: 'noConfigChange',
442
+ };
443
+ let effective;
444
+ if (schemaAccess.plugin) {
445
+ if (schemaAccess.plugin.manifest.config?.schema) {
446
+ effective = summarizeEffectivePluginConfig(await resolveEffectivePluginConfig({
447
+ ...configIdentity,
448
+ pluginName,
449
+ manifest: schemaAccess.plugin.manifest,
450
+ cwd: options.cwd,
451
+ env: options.env,
452
+ }));
453
+ }
454
+ if (reset.deleted) {
455
+ applied = await reinstallVisibleTargets({
456
+ plugin: schemaAccess.plugin,
457
+ scope: options.scope,
458
+ cwd: options.cwd,
459
+ env: options.env ?? process.env,
460
+ applyTargets: options.applyTargets,
461
+ nativeCliRunner: options.nativeCliRunner,
462
+ reinstallCommandImpl: options.reinstallCommandImpl,
463
+ rebuildRuntime: options.rebuildRuntime,
464
+ });
465
+ }
466
+ }
467
+ const otherProjectsRequireReinstall = Boolean(schemaAccess.plugin)
468
+ && options.scope === 'user'
469
+ && reset.deleted;
470
+ if (otherProjectsRequireReinstall)
471
+ warnings.push(...otherProjectsWarning(options.scope));
472
+ return {
473
+ plugin: pluginName,
474
+ scope: options.scope,
475
+ projectLayer,
476
+ ...(schemaAccess.schema ? { schema: schemaAccess.schema } : {}),
477
+ existed: reset.existed,
478
+ deleted: reset.deleted,
479
+ removedKeys,
480
+ ...(effective ? { effective } : {}),
481
+ configWrite: 'succeeded',
482
+ overallState: applied.overallState,
483
+ targetResults: applied.targetResults,
484
+ ...(applied.applySkippedReason ? { applySkippedReason: applied.applySkippedReason } : {}),
485
+ otherProjectsRequireReinstall,
486
+ warnings,
487
+ };
488
+ }
489
+ export async function resetPluginConfigWithHelper(options) {
490
+ const pluginName = assertSafePluginConfigSegment(options.pluginName);
491
+ if (!options.plugin) {
492
+ throw new Error(`sourceMissing: Plugin "${pluginName}" is unavailable; config reset was not applied.`);
493
+ }
494
+ const sourceId = options.plugin.sourceId;
495
+ return withAwHomeMutationLock({
496
+ env: options.env,
497
+ token: options.awHomeMutationToken,
498
+ action: (awHomeMutationToken) => withPluginConfigTransactionLease({
499
+ ...(sourceId ? { sourceId } : {}),
500
+ pluginName,
501
+ scope: options.scope,
502
+ projectLayer: options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared',
503
+ cwd: options.cwd,
504
+ env: options.env,
505
+ action: async () => {
506
+ await options.reviewPreflight?.();
507
+ return resetPluginConfigWithHelperUnlocked({
508
+ ...options,
509
+ awHomeMutationToken,
510
+ rebuildRuntime: { ...options.rebuildRuntime, awHomeMutationToken },
511
+ });
512
+ },
513
+ }),
514
+ });
515
+ }
516
+ export async function describeResetAffectedFields(options) {
517
+ const projectLayer = options.scope === 'project' ? (options.projectLayer ?? 'shared') : 'shared';
518
+ try {
519
+ const resolved = await resolveConfigRead({
520
+ pluginName: options.pluginName,
521
+ plugin: options.plugin,
522
+ ...(options.pluginError ? { pluginError: options.pluginError } : {}),
523
+ scope: options.scope,
524
+ projectLayer,
525
+ cwd: options.cwd,
526
+ env: options.env,
527
+ });
528
+ return resolved.fields.map((field) => buildReceiptFieldEntry({
529
+ key: field.key,
530
+ title: field.title,
531
+ kind: field.kind,
532
+ reserved: field.reserved,
533
+ action: 'reset',
534
+ scope: options.scope,
535
+ projectLayer,
536
+ valueState: field.valueState,
537
+ }));
538
+ }
539
+ catch {
540
+ const store = await readPluginConfigStore({
541
+ ...(options.plugin?.sourceId ? {
542
+ sourceId: options.plugin.sourceId,
543
+ sourceIdentity: options.plugin.sourceIdentity,
544
+ } : options.sourceId ? {
545
+ sourceId: options.sourceId,
546
+ sourceIdentity: options.sourceIdentity,
547
+ } : {}),
548
+ pluginName: options.pluginName,
549
+ scope: options.scope,
550
+ projectLayer,
551
+ cwd: options.cwd,
552
+ env: options.env,
553
+ });
554
+ return collectRemovedConfigKeys(store.values).map((key) => buildReceiptFieldEntry({
555
+ key,
556
+ title: key,
557
+ kind: 'manifest',
558
+ reserved: false,
559
+ action: 'reset',
560
+ scope: options.scope,
561
+ projectLayer,
562
+ }));
563
+ }
564
+ }
565
+ //# sourceMappingURL=plugin-config-write.js.map