@daniel156161/prism 0.2.59 → 0.2.76

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 (1292) hide show
  1. package/README.md +26 -0
  2. package/dist/cli.js +0 -0
  3. package/dist/pi/pi-env.d.ts +1 -1
  4. package/dist/pi/pi-env.js +1 -1
  5. package/dist/pi/pi-extensions.js +2 -0
  6. package/dist/pi/pi-extensions.js.map +1 -1
  7. package/dist/pi/pi-patch-extension-loader.js +1 -0
  8. package/dist/pi/pi-patch-extension-loader.js.map +1 -1
  9. package/dist/pi/pi-patch-interactive.d.ts +1 -0
  10. package/dist/pi/pi-patch-interactive.js +11 -2
  11. package/dist/pi/pi-patch-interactive.js.map +1 -1
  12. package/dist/prism-extensions/integrations/ai-memory-system.d.ts +7 -0
  13. package/dist/prism-extensions/integrations/ai-memory-system.js +316 -0
  14. package/dist/prism-extensions/integrations/ai-memory-system.js.map +1 -0
  15. package/dist/prism-extensions/integrations/obsidian-formatting.d.ts +3 -0
  16. package/dist/prism-extensions/integrations/obsidian-formatting.js +53 -0
  17. package/dist/prism-extensions/integrations/obsidian-formatting.js.map +1 -0
  18. package/dist/prism-extensions/integrations/obsidian-memory.d.ts +3 -1
  19. package/dist/prism-extensions/integrations/obsidian-memory.js +102 -49
  20. package/dist/prism-extensions/integrations/obsidian-memory.js.map +1 -1
  21. package/dist/prism-extensions/providers/manifest-provider.d.ts +1 -0
  22. package/dist/prism-extensions/providers/manifest-provider.js +29 -2
  23. package/dist/prism-extensions/providers/manifest-provider.js.map +1 -1
  24. package/dist/prism-extensions/tools/builtin-tools.js +2 -157
  25. package/dist/prism-extensions/tools/builtin-tools.js.map +1 -1
  26. package/dist/prism-extensions/tools/prism-diagnostic-tools.d.ts +2 -0
  27. package/dist/prism-extensions/tools/prism-diagnostic-tools.js +155 -0
  28. package/dist/prism-extensions/tools/prism-diagnostic-tools.js.map +1 -0
  29. package/dist/prism-extensions/tools/toolbox.d.ts +1 -0
  30. package/dist/prism-extensions/tools/toolbox.js +81 -3
  31. package/dist/prism-extensions/tools/toolbox.js.map +1 -1
  32. package/dist/prism-extensions/ui/toolbar.js +33 -16
  33. package/dist/prism-extensions/ui/toolbar.js.map +1 -1
  34. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  35. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
  36. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  37. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/compile/validator.d.mts +3 -11
  38. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/compile/validator.mjs +6 -36
  39. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/error/errors.d.mts +1 -7
  40. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/_idna.mjs +36 -6
  41. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/_puny.mjs +4 -1
  42. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/uuid.d.mts +2 -2
  43. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/format/uuid.mjs +3 -3
  44. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/emit.d.mts +0 -4
  45. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/emit.mjs +0 -8
  46. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/guard.d.mts +5 -9
  47. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/guard.mjs +10 -15
  48. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/guard/string.mjs +16 -4
  49. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  50. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  51. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  52. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  53. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  54. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  55. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  56. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  57. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  58. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/index.mjs +0 -1
  59. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  60. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  61. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  62. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  63. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  64. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  65. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  66. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  67. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  68. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  69. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  70. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  71. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  72. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  73. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  74. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  75. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  76. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  77. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  78. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  79. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  80. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  81. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  82. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  83. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  84. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  85. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  86. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  87. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  88. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  89. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  90. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  91. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  92. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  93. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  94. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  95. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  96. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  97. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  98. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  99. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  100. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  101. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  102. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  103. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  104. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  105. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  106. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  107. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  108. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  109. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  110. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  111. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  112. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  113. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  114. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  115. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  116. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  117. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/index.d.mts +7 -4
  118. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/index.mjs +7 -4
  119. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  120. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  121. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/module.d.mts +8 -7
  122. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/module.mjs +7 -6
  123. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  124. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/with.d.mts +11 -0
  125. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/with.mjs +11 -0
  126. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  127. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  128. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  129. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  130. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  131. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  132. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  133. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  134. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  135. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  136. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  137. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  138. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  139. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  140. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  141. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  142. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  143. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  144. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  145. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  146. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  147. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  148. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  149. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  150. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  151. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  152. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  153. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  154. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  155. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  156. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  157. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  158. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  159. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  160. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  161. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/index.mjs +2 -2
  162. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  163. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  164. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  165. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  166. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  167. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  168. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  169. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  170. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  171. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  172. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  173. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  174. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  175. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  176. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  177. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  178. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  179. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  180. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  181. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  182. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  183. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  184. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  185. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  186. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  187. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  188. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  189. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  190. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  191. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  192. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  193. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  194. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  195. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  196. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  197. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  198. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  199. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  200. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  201. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  202. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  203. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  204. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  205. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  206. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  207. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  208. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  209. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  210. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  211. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  212. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  213. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  214. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  215. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  216. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  217. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  218. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  219. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  220. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  221. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  222. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  223. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  224. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  225. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  226. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  227. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  228. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  229. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  230. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  231. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  232. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  233. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  234. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  235. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  236. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  237. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  238. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  239. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  240. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  241. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  242. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  243. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  244. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  245. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  246. package/node_modules/@earendil-works/{pi-coding-agent/node_modules/typebox/build/type/engine/options → pi-agent-core/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  247. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  248. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  249. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  250. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  251. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  252. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  253. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  254. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  255. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  256. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  257. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/object.mjs +25 -3
  258. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  259. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  260. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/record.mjs +23 -0
  261. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  262. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  263. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  264. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  265. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/union.mjs +2 -2
  266. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  267. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  268. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  269. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/parser.mjs +23 -22
  270. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/script.d.mts +3 -4
  271. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/script.mjs +3 -2
  272. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  273. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  274. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  275. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  276. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  277. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  278. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  279. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  280. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  281. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  282. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  283. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  284. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  285. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  286. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/call.d.mts +3 -3
  287. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/call.mjs +3 -2
  288. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  289. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  290. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  291. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  292. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  293. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/enum.mjs +5 -0
  294. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/index.d.mts +1 -4
  295. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/index.mjs +1 -4
  296. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/number.d.mts +1 -1
  297. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/number.mjs +1 -1
  298. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/record.d.mts +13 -7
  299. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/record.mjs +15 -9
  300. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/static.d.mts +2 -5
  301. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/typebox.d.mts +3 -7
  302. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/typebox.mjs +3 -7
  303. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  304. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  305. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  306. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  307. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  308. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  309. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  310. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  311. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  312. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  313. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  314. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  315. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  316. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  317. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  318. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  319. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  320. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  321. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  322. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  323. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  324. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  325. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  326. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/index.d.mts +0 -1
  327. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/index.mjs +0 -1
  328. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  329. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  330. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  331. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  332. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/value.d.mts +0 -1
  333. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/value.mjs +0 -1
  334. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/package.json +33 -33
  335. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/readme.md +117 -103
  336. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  337. package/node_modules/@earendil-works/pi-ai/README.md +2 -1
  338. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  339. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +11 -4
  340. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  341. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  342. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +5 -1
  343. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  344. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  345. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +16 -4
  346. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  347. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  348. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +12 -2
  349. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  350. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  351. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
  352. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  353. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  354. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +19 -10
  355. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  356. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  357. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +12 -2
  358. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  359. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  360. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +21 -9
  361. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  362. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  363. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -1
  364. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  365. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  366. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -3
  367. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  368. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.d.ts.map +1 -1
  369. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +3 -2
  370. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
  371. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  372. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
  373. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  374. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
  375. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
  376. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +3 -1
  378. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +81 -26
  380. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -0
  382. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  383. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +16 -8
  384. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  385. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  386. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  387. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  388. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  389. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  390. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  391. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  392. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  393. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  394. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  395. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  396. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  397. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  398. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  399. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  400. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +4 -1
  401. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  402. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +11 -1
  403. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  404. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  405. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/compile/validator.d.mts +3 -11
  406. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/compile/validator.mjs +6 -36
  407. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/error/errors.d.mts +1 -7
  408. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/_idna.mjs +36 -6
  409. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/_puny.mjs +4 -1
  410. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/uuid.d.mts +2 -2
  411. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/format/uuid.mjs +3 -3
  412. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/emit.d.mts +0 -4
  413. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/emit.mjs +0 -8
  414. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/guard.d.mts +5 -9
  415. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/guard.mjs +10 -15
  416. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/guard/string.mjs +16 -4
  417. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  418. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  419. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  420. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  421. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  422. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  423. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  424. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  425. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  426. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/index.mjs +0 -1
  427. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  428. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  429. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  430. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  431. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  432. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  433. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  434. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  435. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  436. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  437. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  438. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  439. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  440. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  441. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  442. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  443. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  444. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  445. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  446. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  447. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  448. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  449. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  450. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  451. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  452. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  453. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  454. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  455. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  456. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  457. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  458. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  459. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  460. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  461. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  462. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  463. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  464. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  465. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  466. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  467. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  468. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  469. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  470. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  471. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  472. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  473. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  474. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  475. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  476. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  477. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  478. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  479. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  480. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  481. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  482. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  483. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  484. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  485. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/index.d.mts +7 -4
  486. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/index.mjs +7 -4
  487. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  488. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  489. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/module.d.mts +8 -7
  490. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/module.mjs +7 -6
  491. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  492. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/with.d.mts +11 -0
  493. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/with.mjs +11 -0
  494. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  495. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  496. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  497. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  498. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  499. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  500. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  501. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  502. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  503. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  504. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  505. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  506. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  507. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  508. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  509. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  510. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  511. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  512. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  513. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  514. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  515. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  516. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  517. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  518. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  519. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  520. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  521. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  522. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  523. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  524. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  525. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  526. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  527. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  528. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  529. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/index.mjs +2 -2
  530. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  531. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  532. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  533. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  534. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  535. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  536. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  537. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  538. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  539. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  540. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  541. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  542. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  543. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  544. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  545. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  546. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  547. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  548. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  549. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  550. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  551. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  552. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  553. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  554. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  555. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  556. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  557. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  558. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  559. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  560. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  561. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  562. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  563. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  564. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  565. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  566. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  567. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  568. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  569. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  570. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  571. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  572. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  573. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  574. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  575. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  576. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  577. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  578. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  579. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  580. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  581. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  582. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  583. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  584. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  585. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  586. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  587. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  588. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  589. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  590. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  591. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  592. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  593. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  594. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  595. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  596. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  597. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  598. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  599. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  600. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  601. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  602. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  603. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  604. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  605. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  606. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  607. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  608. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  609. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  610. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  611. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  612. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  613. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  614. package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  615. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  616. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  617. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  618. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  619. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  620. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  621. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  622. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  623. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  624. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  625. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/object.mjs +25 -3
  626. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  627. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  628. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/record.mjs +23 -0
  629. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  630. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  631. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  632. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  633. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/union.mjs +2 -2
  634. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  635. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  636. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  637. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/parser.mjs +23 -22
  638. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/script.d.mts +3 -4
  639. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/script.mjs +3 -2
  640. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  641. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  642. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  643. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  644. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  645. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  646. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  647. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  648. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  649. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  650. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  651. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  652. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  653. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  654. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/call.d.mts +3 -3
  655. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/call.mjs +3 -2
  656. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  657. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  658. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  659. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  660. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  661. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/enum.mjs +5 -0
  662. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/index.d.mts +1 -4
  663. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/index.mjs +1 -4
  664. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/number.d.mts +1 -1
  665. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/number.mjs +1 -1
  666. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/record.d.mts +13 -7
  667. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/record.mjs +15 -9
  668. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/static.d.mts +2 -5
  669. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/typebox.d.mts +3 -7
  670. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/typebox.mjs +3 -7
  671. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  672. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  673. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  674. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  675. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  676. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  677. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  678. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  679. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  680. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  681. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  682. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  683. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  684. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  685. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  686. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  687. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  688. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  689. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  690. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  691. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  692. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  693. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  694. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/index.d.mts +0 -1
  695. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/index.mjs +0 -1
  696. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  697. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  698. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  699. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  700. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/value.d.mts +0 -1
  701. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/value.mjs +0 -1
  702. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/package.json +33 -33
  703. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/readme.md +117 -103
  704. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  705. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +45 -0
  706. package/node_modules/@earendil-works/pi-coding-agent/README.md +1 -1
  707. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  708. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +8 -1
  709. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  710. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts +23 -0
  711. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts.map +1 -0
  712. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js +116 -0
  713. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js.map +1 -0
  714. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -1
  715. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +3 -0
  716. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js.map +1 -1
  717. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +1 -1
  718. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  719. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +13 -6
  720. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  721. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +1 -1
  722. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -0
  723. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  724. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +7 -0
  725. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  726. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +7 -0
  727. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  728. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  729. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts +10 -0
  730. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -1
  731. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js +1 -1
  732. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -1
  733. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +2 -0
  734. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  735. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  736. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  737. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +13 -6
  738. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  739. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +15 -0
  740. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  741. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +63 -9
  742. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  743. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +0 -267
  744. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.d.ts.map +1 -1
  745. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +1 -1
  746. package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js.map +1 -1
  747. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  748. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +43 -0
  749. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  750. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  751. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +4 -1
  752. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
  753. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  754. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +32 -17
  755. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  756. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  757. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +13 -0
  758. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  759. package/node_modules/@earendil-works/pi-coding-agent/docs/custom-provider.md +9 -3
  760. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +3 -1
  761. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +1 -0
  762. package/node_modules/@earendil-works/pi-coding-agent/docs/session-format.md +2 -0
  763. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/index.ts +8 -2
  764. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  765. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  766. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  767. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  768. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  769. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  770. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  771. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  772. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  773. package/node_modules/@earendil-works/pi-coding-agent/examples/sdk/12-full-control.ts +2 -0
  774. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/compile/validator.d.mts +3 -11
  775. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/compile/validator.mjs +6 -36
  776. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/error/errors.d.mts +1 -7
  777. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/_idna.mjs +36 -6
  778. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/_puny.mjs +4 -1
  779. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/uuid.d.mts +2 -2
  780. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/format/uuid.mjs +3 -3
  781. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/emit.d.mts +0 -4
  782. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/emit.mjs +0 -8
  783. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/guard.d.mts +5 -9
  784. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/guard.mjs +10 -15
  785. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/guard/string.mjs +16 -4
  786. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  787. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  788. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  789. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  790. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  791. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  792. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  793. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  794. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  795. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/index.mjs +0 -1
  796. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  797. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  798. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  799. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  800. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  801. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  802. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  803. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  804. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  805. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  806. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  807. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  808. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  809. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  810. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  811. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  812. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  813. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  814. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  815. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  816. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  817. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  818. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  819. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  820. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  821. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  822. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  823. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  824. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  825. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  826. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  827. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  828. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  829. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  830. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  831. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  832. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  833. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  834. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  835. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  836. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  837. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  838. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  839. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  840. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  841. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  842. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  843. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  844. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  845. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  846. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  847. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  848. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  849. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  850. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  851. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  852. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  853. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  854. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/index.d.mts +7 -4
  855. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/index.mjs +7 -4
  856. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  857. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  858. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/module.d.mts +8 -7
  859. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/module.mjs +7 -6
  860. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  861. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/with.d.mts +11 -0
  862. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/with.mjs +11 -0
  863. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  864. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  865. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  866. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  867. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  868. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  869. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  870. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  871. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  872. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  873. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  874. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  875. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  876. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  877. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  878. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  879. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  880. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  881. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  882. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  883. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  884. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  885. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  886. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  887. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  888. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  889. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  890. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  891. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  892. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  893. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  894. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  895. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  896. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  897. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  898. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/index.mjs +2 -2
  899. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  900. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  901. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  902. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  903. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  904. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  905. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  906. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  907. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  908. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  909. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  910. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  911. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  912. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  913. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  914. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  915. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  916. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  917. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  918. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  919. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  920. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  921. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  922. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  923. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  924. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  925. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  926. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  927. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  928. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  929. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  930. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  931. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  932. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  933. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  934. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  935. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  936. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  937. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  938. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  939. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  940. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  941. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  942. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  943. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  944. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  945. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  946. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  947. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  948. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  949. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  950. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  951. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  952. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  953. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  954. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  955. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  956. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  957. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  958. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  959. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  960. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  961. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  962. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  963. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  964. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  965. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  966. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  967. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  968. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  969. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  970. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  971. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  972. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  973. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  974. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  975. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  976. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  977. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  978. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  979. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  980. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  981. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  982. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  983. package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/options → pi-coding-agent/node_modules/typebox/build/type/engine/with}/instantiate.mjs +5 -5
  984. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  985. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  986. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  987. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  988. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  989. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  990. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  991. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  992. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  993. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  994. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/object.mjs +25 -3
  995. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  996. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  997. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/record.mjs +23 -0
  998. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  999. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  1000. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  1001. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  1002. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/union.mjs +2 -2
  1003. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  1004. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  1005. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  1006. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/parser.mjs +23 -22
  1007. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/script.d.mts +3 -4
  1008. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/script.mjs +3 -2
  1009. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  1010. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  1011. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  1012. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  1013. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  1014. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  1015. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  1016. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  1017. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  1018. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  1019. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  1020. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  1021. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  1022. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  1023. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/call.d.mts +3 -3
  1024. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/call.mjs +3 -2
  1025. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  1026. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  1027. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  1028. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  1029. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  1030. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/enum.mjs +5 -0
  1031. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/index.d.mts +1 -4
  1032. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/index.mjs +1 -4
  1033. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/number.d.mts +1 -1
  1034. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/number.mjs +1 -1
  1035. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/record.d.mts +13 -7
  1036. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/record.mjs +15 -9
  1037. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/static.d.mts +2 -5
  1038. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/typebox.d.mts +3 -7
  1039. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/typebox.mjs +3 -7
  1040. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  1041. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  1042. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  1043. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  1044. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  1045. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  1046. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  1047. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  1048. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  1049. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  1050. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  1051. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  1052. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  1053. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  1054. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  1055. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  1056. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  1057. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  1058. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  1059. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  1060. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  1061. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  1062. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  1063. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/index.d.mts +0 -1
  1064. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/index.mjs +0 -1
  1065. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  1066. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  1067. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  1068. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  1069. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/value.d.mts +0 -1
  1070. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/value.mjs +0 -1
  1071. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/package.json +33 -33
  1072. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/readme.md +117 -103
  1073. package/node_modules/@earendil-works/pi-coding-agent/package.json +5 -5
  1074. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  1075. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +3 -2
  1076. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  1077. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +5 -0
  1078. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1079. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +25 -2
  1080. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1081. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1082. package/node_modules/@types/node/README.md +1 -1
  1083. package/node_modules/@types/node/crypto.d.ts +1 -1
  1084. package/node_modules/@types/node/package.json +2 -2
  1085. package/package.json +5 -5
  1086. package/src/prism-extensions/README.md +1 -1
  1087. package/src/prism-extensions/integrations/ai-memory-system.ts +332 -0
  1088. package/src/prism-extensions/integrations/obsidian-formatting.ts +55 -0
  1089. package/src/prism-extensions/integrations/obsidian-memory.ts +90 -47
  1090. package/src/prism-extensions/providers/manifest-provider.ts +29 -2
  1091. package/src/prism-extensions/tools/builtin-tools.ts +2 -150
  1092. package/src/prism-extensions/tools/prism-diagnostic-tools.ts +160 -0
  1093. package/src/prism-extensions/tools/toolbox.ts +87 -3
  1094. package/src/prism-extensions/ui/toolbar.ts +31 -12
  1095. package/dist/prism-extensions/integrations/mcp-adapter.d.ts +0 -3
  1096. package/dist/prism-extensions/integrations/mcp-adapter.js +0 -21
  1097. package/dist/prism-extensions/integrations/mcp-adapter.js.map +0 -1
  1098. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1099. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1100. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1101. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1102. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1103. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1104. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1105. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1106. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1107. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1108. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1109. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/action/options.mjs +0 -11
  1110. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1111. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1112. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1113. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1114. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1115. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1116. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1117. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1118. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1119. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1120. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1121. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1122. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1123. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1124. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/base.mjs +0 -84
  1125. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1126. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1127. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1128. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1129. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1130. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1131. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1132. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1133. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1134. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1135. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1136. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1137. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1138. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1139. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1140. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1141. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1142. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1143. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1144. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1145. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1146. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1147. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1148. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1149. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1150. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1151. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1152. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1153. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1154. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1155. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1156. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1157. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1158. package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1159. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1160. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1161. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1162. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1163. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1164. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1165. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1166. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1167. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1168. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1169. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1170. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/action/options.mjs +0 -11
  1171. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1172. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1173. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1174. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1175. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1176. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1177. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1178. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1179. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1180. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1181. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1182. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1183. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1184. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1185. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1186. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1187. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/base.mjs +0 -84
  1188. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1189. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1190. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1191. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1192. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1193. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1194. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1195. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1196. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1197. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1198. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1199. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1200. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1201. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1202. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1203. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1204. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1205. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1206. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1207. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1208. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1209. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1210. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1211. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1212. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1213. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1214. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1215. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1216. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1217. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1218. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1219. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1220. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1221. package/node_modules/@earendil-works/pi-ai/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1222. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1223. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1224. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1225. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1226. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1227. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1228. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1229. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1230. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1231. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1232. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1233. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/action/options.mjs +0 -11
  1234. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/index.d.mts +0 -1
  1235. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/index.mjs +0 -1
  1236. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1237. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1238. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1239. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1240. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1241. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1242. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1243. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1244. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1245. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1246. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1247. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1248. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1249. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1250. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1251. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1252. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/base.mjs +0 -84
  1253. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1254. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1255. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1256. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1257. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1258. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1259. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1260. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1261. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1262. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1263. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1264. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1265. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1266. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1267. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1268. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1269. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1270. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1271. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1272. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1273. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1274. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1275. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1276. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1277. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1278. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1279. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1280. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1281. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1282. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1283. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1284. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1285. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1286. package/node_modules/@earendil-works/pi-coding-agent/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1287. /package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  1288. /package/node_modules/@earendil-works/pi-agent-core/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
  1289. /package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/index.d.mts +0 -0
  1290. /package/node_modules/@earendil-works/{pi-agent-core/node_modules/typebox/build/type/engine/options → pi-ai/node_modules/typebox/build/type/engine/with}/index.mjs +0 -0
  1291. /package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/awaited → pi-coding-agent/node_modules/typebox/build/type/engine/with}/index.d.mts +0 -0
  1292. /package/node_modules/@earendil-works/{pi-ai/node_modules/typebox/build/type/engine/awaited → pi-coding-agent/node_modules/typebox/build/type/engine/with}/index.mjs +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime.d.ts","source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O,EAChB,OAAO,CAAC,EAAE,sBAAsB,CAAC,IAAI,CAAC,GACpC,2BAA2B,CAY7B;IAED,QAAQ,CAAC,IAAI,SAAS,GAAG,EACxB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,sBAAsB,CAAC,IAAI,CAAC,GACpC,OAAO,CAAC,gBAAgB,CAAC,CAE3B;IAED,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,2BAA2B,CAKlH;IAED,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAElH;IAEK,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAIjG;IAEK,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK9C;IAEK,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqB9E;IAED,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAO/C;IAED,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAoCtE;IAED,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAM3C;CACD","sourcesContent":["import { dirname, join } from \"node:path\";\nimport {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tcreateModels,\n\tlazyStream,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\tModelsError,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelsStreamTransforms,\n\ttype MutableModels,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@earendil-works/pi-ai\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getAgentDir } from \"../config.ts\";\nimport { AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\n\ninterface ModelRuntimeSnapshot {\n\tall: readonly Model<Api>[];\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\tauthPath?: string;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n}\n\nexport interface ModelRuntimeAuthOverrides {\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: [],\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefresh: Promise<void> | undefined;\n\tprivate availabilityError: string | undefined;\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t) {\n\t\tthis.credentials = credentials;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst credentials = new RuntimeCredentials(options.credentials ?? DefaultAuthStorage.create(options.authPath));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) =>\n\t\t\t\tprovider.id === \"radius\"\n\t\t\t\t\t? provider\n\t\t\t\t\t: withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt),\n\t\t\t);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t);\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller = refreshFromNetwork ? new AbortController() : undefined;\n\t\tconst timeout = controller\n\t\t\t? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs ?? 15_000)\n\t\t\t: undefined;\n\t\ttry {\n\t\t\tawait runtime.refresh({ allowNetwork: refreshFromNetwork, signal: controller?.signal });\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t]);\n\t}\n\n\tprivate recomposeProvider(providerId: string): void {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\tif (!base && !this.config.getProvider(providerId) && !extension) {\n\t\t\tthis.models.deleteProvider(providerId);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\tif (base && !this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.models.setProvider(base);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.models.setProvider(composeModelProvider(providerId, base, this.config, extension));\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\tif (base) this.models.setProvider(base);\n\t\t\telse this.models.deleteProvider(providerId);\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = [...this.models.getModels()];\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.filter((model) => this.snapshot.configuredProviders.has(model.provider)),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list(),\n\t\t]);\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: [...this.models.getModels()],\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tthis.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(after: Promise<void> | undefined): Promise<void> {\n\t\tconst refresh = (after ?? Promise.resolve()).catch(() => {}).then(() => this.runAvailabilityRefresh());\n\t\tconst recorded = refresh.catch((error) => {\n\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\tthrow error;\n\t\t});\n\t\tconst tracked = recorded.finally(() => {\n\t\t\tif (this.availabilityRefresh === tracked) this.availabilityRefresh = undefined;\n\t\t});\n\t\tthis.availabilityRefresh = tracked;\n\t\treturn tracked;\n\t}\n\n\t/** Coalesce concurrent readers onto the pending refresh. */\n\tprivate refreshAvailability(): Promise<void> {\n\t\treturn this.availabilityRefresh ?? this.queueAvailabilityRefresh(undefined);\n\t}\n\n\t/** Mutations must not observe an in-flight refresh started before them. */\n\tprivate forceRefreshAvailability(): Promise<void> {\n\t\treturn this.queueAvailabilityRefresh(this.availabilityRefresh);\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId);\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tif (this.availabilityRefresh) {\n\t\t\t\tawait this.availabilityRefresh;\n\t\t\t\treturn this.snapshot.available.filter((model) => model.provider === providerId);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn await this.models.getAvailable(providerId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.refreshAvailability();\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tif (typeof providerOrModel === \"string\") return this.models.getAuth(providerOrModel, overrides);\n\t\tconst resolution = await this.models.getAuth(providerOrModel, overrides);\n\t\tif (!resolution) return undefined;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync setRuntimeApiKey(\n\t\tproviderId: string,\n\t\tapiKey: string,\n\t\trefreshOptions: ModelsRefreshOptions = {},\n\t): Promise<void> {\n\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"runtime API key\" });\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst storedProviders = new Set(this.snapshot.storedProviders).add(providerId);\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders,\n\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t};\n\t\tawait this.refresh(refreshOptions);\n\t}\n\n\tasync removeRuntimeApiKey(providerId: string): Promise<void> {\n\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tlistCredentials(): Promise<readonly CredentialInfo[]> {\n\t\treturn this.credentials.list();\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: (StreamOptions & ModelsStreamTransforms) | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst resolution = await this.getAuth(model, { apiKey: options?.apiKey, env: options?.env });\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst { transformHeaders, ...providerOptions } = options ?? {};\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsStreamTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(prepared.model, context, prepared.options as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst credential = await this.models.login(providerId, type, interaction);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\tawait this.models.logout(providerId);\n\t\t// Reset credential-dependent compatibility projections before the unconfigured provider is skipped by refresh.\n\t\tthis.recomposeProvider(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tthis.config = await ModelConfig.load(this.modelsPath);\n\t\tthis.configureRadiusProviders();\n\t\tthis.rebuildProviders();\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tthis.updateModelSnapshot();\n\t\ttry {\n\t\t\tawait this.forceRefreshAvailability();\n\t\t} catch {\n\t\t\t// Availability errors are recorded by forceRefreshAvailability; refreshed models remain usable.\n\t\t}\n\t\treturn result;\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tif (\n\t\t\tthis.snapshot.storedProviders.has(providerId) ||\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective)?.configured\n\t\t) {\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tconst auth = new Map(this.snapshot.auth);\n\t\t\t// Provisional entry until the async refresh lands; never clobber a real check result.\n\t\t\tif (!auth.get(providerId)) {\n\t\t\t\tauth.set(providerId, {\n\t\t\t\t\ttype: effective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t\t\t\tsource: \"configured provider\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.snapshot = {\n\t\t\t\t...this.snapshot,\n\t\t\t\tauth,\n\t\t\t\tconfiguredProviders,\n\t\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t\t};\n\t\t}\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n}\n"]}
1
+ {"version":3,"file":"model-runtime.d.ts","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,GAAG,EAER,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,EAChC,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EAGpB,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,WAAW,EAGhB,KAAK,QAAQ,EAIb,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EACN,KAAK,UAAU,EACf,KAAK,0BAA0B,EAG/B,KAAK,mBAAmB,EAIxB,MAAM,wBAAwB,CAAC;AAYhC,MAAM,WAAW,yBAAyB;IACzC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yDAAyD;IACzD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EA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CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAM3C;CACD","sourcesContent":["import { dirname, join } from \"node:path\";\nimport {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tcreateModels,\n\tlazyStream,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\tModelsError,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelsStreamTransforms,\n\ttype MutableModels,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@earendil-works/pi-ai\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getAgentDir } from \"../config.ts\";\nimport { AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\n\ninterface ModelRuntimeSnapshot {\n\tall: readonly Model<Api>[];\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\tauthPath?: string;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n}\n\nexport interface ModelRuntimeAuthOverrides {\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n\t/** Require this much remaining OAuth-token validity; defaults to five minutes. */\n\tminOAuthValidityMs?: number;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: [],\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefresh: Promise<void> | undefined;\n\tprivate availabilityError: string | undefined;\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t) {\n\t\tthis.credentials = credentials;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst credentials = new RuntimeCredentials(options.credentials ?? DefaultAuthStorage.create(options.authPath));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) =>\n\t\t\t\tprovider.id === \"radius\"\n\t\t\t\t\t? provider\n\t\t\t\t\t: withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt),\n\t\t\t);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t);\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller = refreshFromNetwork ? new AbortController() : undefined;\n\t\tconst timeout = controller\n\t\t\t? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs ?? 15_000)\n\t\t\t: undefined;\n\t\ttry {\n\t\t\tawait runtime.refresh({ allowNetwork: refreshFromNetwork, signal: controller?.signal });\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t]);\n\t}\n\n\tprivate recomposeProvider(providerId: string): void {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\tif (!base && !this.config.getProvider(providerId) && !extension) {\n\t\t\tthis.models.deleteProvider(providerId);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\tif (base && !this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.models.setProvider(base);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.models.setProvider(composeModelProvider(providerId, base, this.config, extension));\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\tif (base) this.models.setProvider(base);\n\t\t\telse this.models.deleteProvider(providerId);\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = [...this.models.getModels()];\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.filter((model) => this.snapshot.configuredProviders.has(model.provider)),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list(),\n\t\t]);\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: [...this.models.getModels()],\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tthis.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(after: Promise<void> | undefined): Promise<void> {\n\t\tconst refresh = (after ?? Promise.resolve()).catch(() => {}).then(() => this.runAvailabilityRefresh());\n\t\tconst recorded = refresh.catch((error) => {\n\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\tthrow error;\n\t\t});\n\t\tconst tracked = recorded.finally(() => {\n\t\t\tif (this.availabilityRefresh === tracked) this.availabilityRefresh = undefined;\n\t\t});\n\t\tthis.availabilityRefresh = tracked;\n\t\treturn tracked;\n\t}\n\n\t/** Coalesce concurrent readers onto the pending refresh. */\n\tprivate refreshAvailability(): Promise<void> {\n\t\treturn this.availabilityRefresh ?? this.queueAvailabilityRefresh(undefined);\n\t}\n\n\t/** Mutations must not observe an in-flight refresh started before them. */\n\tprivate forceRefreshAvailability(): Promise<void> {\n\t\treturn this.queueAvailabilityRefresh(this.availabilityRefresh);\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId);\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tif (this.availabilityRefresh) {\n\t\t\t\tawait this.availabilityRefresh;\n\t\t\t\treturn this.snapshot.available.filter((model) => model.provider === providerId);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn await this.models.getAvailable(providerId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.refreshAvailability();\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tif (typeof providerOrModel === \"string\") return this.models.getAuth(providerOrModel, overrides);\n\t\tconst resolution = await this.models.getAuth(providerOrModel, overrides);\n\t\tif (!resolution) return undefined;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync setRuntimeApiKey(\n\t\tproviderId: string,\n\t\tapiKey: string,\n\t\trefreshOptions: ModelsRefreshOptions = {},\n\t): Promise<void> {\n\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"runtime API key\" });\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst storedProviders = new Set(this.snapshot.storedProviders).add(providerId);\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders,\n\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t};\n\t\tawait this.refresh(refreshOptions);\n\t}\n\n\tasync removeRuntimeApiKey(providerId: string): Promise<void> {\n\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tlistCredentials(): Promise<readonly CredentialInfo[]> {\n\t\treturn this.credentials.list();\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: (StreamOptions & ModelsStreamTransforms) | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst resolution = await this.getAuth(model, { apiKey: options?.apiKey, env: options?.env });\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst { transformHeaders, ...providerOptions } = options ?? {};\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsStreamTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(prepared.model, context, prepared.options as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst credential = await this.models.login(providerId, type, interaction);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\tawait this.models.logout(providerId);\n\t\t// Reset credential-dependent compatibility projections before the unconfigured provider is skipped by refresh.\n\t\tthis.recomposeProvider(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tthis.config = await ModelConfig.load(this.modelsPath);\n\t\tthis.configureRadiusProviders();\n\t\tthis.rebuildProviders();\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tthis.updateModelSnapshot();\n\t\ttry {\n\t\t\tawait this.forceRefreshAvailability();\n\t\t} catch {\n\t\t\t// Availability errors are recorded by forceRefreshAvailability; refreshed models remain usable.\n\t\t}\n\t\treturn result;\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tif (\n\t\t\tthis.snapshot.storedProviders.has(providerId) ||\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective)?.configured\n\t\t) {\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tconst auth = new Map(this.snapshot.auth);\n\t\t\t// Provisional entry until the async refresh lands; never clobber a real check result.\n\t\t\tif (!auth.get(providerId)) {\n\t\t\t\tauth.set(providerId, {\n\t\t\t\t\ttype: effective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t\t\t\tsource: \"configured provider\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.snapshot = {\n\t\t\t\t...this.snapshot,\n\t\t\t\tauth,\n\t\t\t\tconfiguredProviders,\n\t\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t\t};\n\t\t}\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"model-runtime.js","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAaN,YAAY,EACZ,UAAU,EAIV,WAAW,GAWX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,sBAAsB,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAGN,oBAAoB,EACpB,2BAA2B,EAE3B,iCAAiC,EACjC,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA6B9D,SAAS,YAAY,CACpB,IAA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CAAC;QAC3C,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IAAA,CAC3C;CACD","sourcesContent":["import { dirname, join } from \"node:path\";\nimport {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tcreateModels,\n\tlazyStream,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\tModelsError,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelsStreamTransforms,\n\ttype MutableModels,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@earendil-works/pi-ai\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getAgentDir } from \"../config.ts\";\nimport { AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\n\ninterface ModelRuntimeSnapshot {\n\tall: readonly Model<Api>[];\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\tauthPath?: string;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n}\n\nexport interface ModelRuntimeAuthOverrides {\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: [],\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefresh: Promise<void> | undefined;\n\tprivate availabilityError: string | undefined;\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t) {\n\t\tthis.credentials = credentials;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst credentials = new RuntimeCredentials(options.credentials ?? DefaultAuthStorage.create(options.authPath));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) =>\n\t\t\t\tprovider.id === \"radius\"\n\t\t\t\t\t? provider\n\t\t\t\t\t: withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt),\n\t\t\t);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t);\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller = refreshFromNetwork ? new AbortController() : undefined;\n\t\tconst timeout = controller\n\t\t\t? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs ?? 15_000)\n\t\t\t: undefined;\n\t\ttry {\n\t\t\tawait runtime.refresh({ allowNetwork: refreshFromNetwork, signal: controller?.signal });\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t]);\n\t}\n\n\tprivate recomposeProvider(providerId: string): void {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\tif (!base && !this.config.getProvider(providerId) && !extension) {\n\t\t\tthis.models.deleteProvider(providerId);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\tif (base && !this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.models.setProvider(base);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.models.setProvider(composeModelProvider(providerId, base, this.config, extension));\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\tif (base) this.models.setProvider(base);\n\t\t\telse this.models.deleteProvider(providerId);\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = [...this.models.getModels()];\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.filter((model) => this.snapshot.configuredProviders.has(model.provider)),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list(),\n\t\t]);\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: [...this.models.getModels()],\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tthis.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(after: Promise<void> | undefined): Promise<void> {\n\t\tconst refresh = (after ?? Promise.resolve()).catch(() => {}).then(() => this.runAvailabilityRefresh());\n\t\tconst recorded = refresh.catch((error) => {\n\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\tthrow error;\n\t\t});\n\t\tconst tracked = recorded.finally(() => {\n\t\t\tif (this.availabilityRefresh === tracked) this.availabilityRefresh = undefined;\n\t\t});\n\t\tthis.availabilityRefresh = tracked;\n\t\treturn tracked;\n\t}\n\n\t/** Coalesce concurrent readers onto the pending refresh. */\n\tprivate refreshAvailability(): Promise<void> {\n\t\treturn this.availabilityRefresh ?? this.queueAvailabilityRefresh(undefined);\n\t}\n\n\t/** Mutations must not observe an in-flight refresh started before them. */\n\tprivate forceRefreshAvailability(): Promise<void> {\n\t\treturn this.queueAvailabilityRefresh(this.availabilityRefresh);\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId);\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tif (this.availabilityRefresh) {\n\t\t\t\tawait this.availabilityRefresh;\n\t\t\t\treturn this.snapshot.available.filter((model) => model.provider === providerId);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn await this.models.getAvailable(providerId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.refreshAvailability();\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tif (typeof providerOrModel === \"string\") return this.models.getAuth(providerOrModel, overrides);\n\t\tconst resolution = await this.models.getAuth(providerOrModel, overrides);\n\t\tif (!resolution) return undefined;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync setRuntimeApiKey(\n\t\tproviderId: string,\n\t\tapiKey: string,\n\t\trefreshOptions: ModelsRefreshOptions = {},\n\t): Promise<void> {\n\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"runtime API key\" });\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst storedProviders = new Set(this.snapshot.storedProviders).add(providerId);\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders,\n\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t};\n\t\tawait this.refresh(refreshOptions);\n\t}\n\n\tasync removeRuntimeApiKey(providerId: string): Promise<void> {\n\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tlistCredentials(): Promise<readonly CredentialInfo[]> {\n\t\treturn this.credentials.list();\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: (StreamOptions & ModelsStreamTransforms) | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst resolution = await this.getAuth(model, { apiKey: options?.apiKey, env: options?.env });\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst { transformHeaders, ...providerOptions } = options ?? {};\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsStreamTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(prepared.model, context, prepared.options as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst credential = await this.models.login(providerId, type, interaction);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\tawait this.models.logout(providerId);\n\t\t// Reset credential-dependent compatibility projections before the unconfigured provider is skipped by refresh.\n\t\tthis.recomposeProvider(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tthis.config = await ModelConfig.load(this.modelsPath);\n\t\tthis.configureRadiusProviders();\n\t\tthis.rebuildProviders();\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tthis.updateModelSnapshot();\n\t\ttry {\n\t\t\tawait this.forceRefreshAvailability();\n\t\t} catch {\n\t\t\t// Availability errors are recorded by forceRefreshAvailability; refreshed models remain usable.\n\t\t}\n\t\treturn result;\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tif (\n\t\t\tthis.snapshot.storedProviders.has(providerId) ||\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective)?.configured\n\t\t) {\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tconst auth = new Map(this.snapshot.auth);\n\t\t\t// Provisional entry until the async refresh lands; never clobber a real check result.\n\t\t\tif (!auth.get(providerId)) {\n\t\t\t\tauth.set(providerId, {\n\t\t\t\t\ttype: effective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t\t\t\tsource: \"configured provider\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.snapshot = {\n\t\t\t\t...this.snapshot,\n\t\t\t\tauth,\n\t\t\t\tconfiguredProviders,\n\t\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t\t};\n\t\t}\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n}\n"]}
1
+ {"version":3,"file":"model-runtime.js","sourceRoot":"","sources":["../../src/core/model-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAaN,YAAY,EACZ,UAAU,EAIV,WAAW,GAWX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,sBAAsB,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAGN,oBAAoB,EACpB,2BAA2B,EAE3B,iCAAiC,EACjC,6BAA6B,EAC7B,yBAAyB,GACzB,MAAM,wBAAwB,CAAC;A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EAAE,KAAK,EAAE,CAAC,CAAC;IAAA,CAC3C;IAED,kBAAkB,CAAC,UAAkB,EAAQ;QAC5C,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IAAA,CAC3C;CACD","sourcesContent":["import { dirname, join } from \"node:path\";\nimport {\n\ttype Api,\n\ttype ApiStreamOptions,\n\ttype AssistantMessage,\n\ttype AssistantMessageEventStream,\n\ttype AuthCheck,\n\ttype AuthInteraction,\n\ttype AuthResult,\n\ttype AuthType,\n\ttype Context,\n\ttype Credential,\n\ttype CredentialInfo,\n\ttype CredentialStore,\n\tcreateModels,\n\tlazyStream,\n\ttype Model,\n\ttype Models,\n\ttype ModelsApiStreamOptions,\n\tModelsError,\n\ttype ModelsRefreshOptions,\n\ttype ModelsRefreshResult,\n\ttype ModelsSimpleStreamOptions,\n\ttype ModelsStore,\n\ttype ModelsStreamTransforms,\n\ttype MutableModels,\n\ttype Provider,\n\ttype ProviderHeaders,\n\ttype SimpleStreamOptions,\n\ttype StreamOptions,\n} from \"@earendil-works/pi-ai\";\nimport * as builtinProviderCatalog from \"@earendil-works/pi-ai/providers/all\";\nimport { getAgentDir } from \"../config.ts\";\nimport { AuthStorage as DefaultAuthStorage } from \"./auth-storage.ts\";\nimport { ModelConfig } from \"./model-config.ts\";\nimport { FileModelsStore, InMemoryCodingAgentModelsStore } from \"./models-store.ts\";\nimport {\n\ttype AuthStatus,\n\ttype CompatibilityRequestConfig,\n\tcomposeModelProvider,\n\tconfiguredRequestAuthStatus,\n\ttype ProviderConfigInput,\n\tresolveCompatibilityRequestConfig,\n\tresolveConfiguredModelHeaders,\n\tvalidateExtensionProvider,\n} from \"./provider-composer.ts\";\nimport { withRemoteCatalog } from \"./remote-catalog-provider.ts\";\nimport { RuntimeCredentials } from \"./runtime-credentials.ts\";\n\ninterface ModelRuntimeSnapshot {\n\tall: readonly Model<Api>[];\n\tavailable: readonly Model<Api>[];\n\tconfiguredProviders: ReadonlySet<string>;\n\tstoredProviders: ReadonlySet<string>;\n\tauth: ReadonlyMap<string, AuthCheck | undefined>;\n}\n\nexport interface CreateModelRuntimeOptions {\n\t/** Credential storage. Defaults to the file at authPath. */\n\tcredentials?: CredentialStore;\n\tauthPath?: string;\n\tmodelsPath?: string | null;\n\tmodelsStore?: ModelsStore;\n\tmodelsStorePath?: string;\n\t/** Allow create() to refresh model catalogs over the network. Defaults to false. */\n\tallowModelNetwork?: boolean;\n\t/** Timeout for the create-time network model refresh. */\n\tmodelRefreshTimeoutMs?: number;\n\tcatalogBaseUrl?: string;\n}\n\nexport interface ModelRuntimeAuthOverrides {\n\tapiKey?: string;\n\tenv?: Record<string, string>;\n\t/** Require this much remaining OAuth-token validity; defaults to five minutes. */\n\tminOAuthValidityMs?: number;\n}\n\nfunction mergeHeaders(\n\tbase: ProviderHeaders | undefined,\n\toverride: ProviderHeaders | undefined,\n): ProviderHeaders | undefined {\n\tif (!base && !override) return undefined;\n\tconst merged = { ...base };\n\tfor (const [name, value] of Object.entries(override ?? {})) {\n\t\tconst lowerName = name.toLowerCase();\n\t\tfor (const existingName of Object.keys(merged)) {\n\t\t\tif (existingName.toLowerCase() === lowerName) delete merged[existingName];\n\t\t}\n\t\tmerged[name] = value;\n\t}\n\treturn merged;\n}\n\n/** Configured pi-ai Models collection used by coding-agent and SDK consumers. */\nexport class ModelRuntime implements Models {\n\tprivate readonly models: MutableModels;\n\tprivate readonly credentials: RuntimeCredentials;\n\tprivate readonly defaultBuiltins: ReadonlyMap<string, Provider>;\n\tprivate readonly builtins = new Map<string, Provider>();\n\tprivate readonly nativeExtensionProviders = new Map<string, Provider>();\n\tprivate readonly extensionProviders = new Map<string, ProviderConfigInput>();\n\tprivate readonly compositionErrors = new Map<string, string>();\n\tprivate readonly modelsPath: string | undefined;\n\tprivate readonly modelNetworkEnabled: boolean;\n\tprivate config: ModelConfig;\n\tprivate snapshot: ModelRuntimeSnapshot = {\n\t\tall: [],\n\t\tavailable: [],\n\t\tconfiguredProviders: new Set(),\n\t\tstoredProviders: new Set(),\n\t\tauth: new Map(),\n\t};\n\tprivate availabilityRefresh: Promise<void> | undefined;\n\tprivate availabilityError: string | undefined;\n\n\tprivate constructor(\n\t\tcredentials: RuntimeCredentials,\n\t\tconfig: ModelConfig,\n\t\tmodelsPath: string | undefined,\n\t\tmodelsStore: ModelsStore,\n\t\tproviders: readonly Provider[],\n\t\tmodelNetworkEnabled: boolean,\n\t) {\n\t\tthis.credentials = credentials;\n\t\tthis.config = config;\n\t\tthis.modelsPath = modelsPath;\n\t\tthis.modelNetworkEnabled = modelNetworkEnabled;\n\t\tthis.defaultBuiltins = new Map(providers.map((provider) => [provider.id, provider]));\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tthis.models = createModels({ credentials, modelsStore });\n\t\tthis.rebuildProviders();\n\t}\n\n\tstatic async create(options: CreateModelRuntimeOptions = {}): Promise<ModelRuntime> {\n\t\tconst credentials = new RuntimeCredentials(options.credentials ?? DefaultAuthStorage.create(options.authPath));\n\t\tconst modelsPath =\n\t\t\toptions.modelsPath === null ? undefined : (options.modelsPath ?? join(getAgentDir(), \"models.json\"));\n\t\tconst config = await ModelConfig.load(modelsPath);\n\t\tconst modelsStore =\n\t\t\toptions.modelsStore ??\n\t\t\t(modelsPath\n\t\t\t\t? new FileModelsStore(options.modelsStorePath ?? join(dirname(modelsPath), \"models-store.json\"))\n\t\t\t\t: new InMemoryCodingAgentModelsStore());\n\t\tconst builtinModelDataGeneratedAt = builtinProviderCatalog.getBuiltinModelDataGeneratedAt();\n\t\tconst providers = builtinProviderCatalog\n\t\t\t.builtinProviders()\n\t\t\t.map((provider) =>\n\t\t\t\tprovider.id === \"radius\"\n\t\t\t\t\t? provider\n\t\t\t\t\t: withRemoteCatalog(provider, options.catalogBaseUrl, builtinModelDataGeneratedAt),\n\t\t\t);\n\t\tconst runtime = new ModelRuntime(\n\t\t\tcredentials,\n\t\t\tconfig,\n\t\t\tmodelsPath,\n\t\t\tmodelsStore,\n\t\t\tproviders,\n\t\t\tprocess.env.PI_OFFLINE === undefined,\n\t\t);\n\t\truntime.configureRadiusProviders();\n\t\truntime.rebuildProviders();\n\t\tconst refreshFromNetwork = runtime.modelNetworkEnabled && options.allowModelNetwork === true;\n\t\tconst controller = refreshFromNetwork ? new AbortController() : undefined;\n\t\tconst timeout = controller\n\t\t\t? setTimeout(() => controller.abort(), options.modelRefreshTimeoutMs ?? 15_000)\n\t\t\t: undefined;\n\t\ttry {\n\t\t\tawait runtime.refresh({ allowNetwork: refreshFromNetwork, signal: controller?.signal });\n\t\t} finally {\n\t\t\tif (timeout) clearTimeout(timeout);\n\t\t}\n\t\treturn runtime;\n\t}\n\n\tprivate configureRadiusProviders(): void {\n\t\tthis.builtins.clear();\n\t\tfor (const [providerId, provider] of this.defaultBuiltins) this.builtins.set(providerId, provider);\n\t\tfor (const providerId of this.config.getProviderIds()) {\n\t\t\tconst config = this.config.getProvider(providerId);\n\t\t\tif (config?.oauth !== \"radius\" || !config.baseUrl) continue;\n\t\t\tthis.builtins.set(\n\t\t\t\tproviderId,\n\t\t\t\tbuiltinProviderCatalog.radiusProvider({\n\t\t\t\t\tid: providerId,\n\t\t\t\t\tname: config.name ?? providerId,\n\t\t\t\t\tgateway: config.baseUrl.replace(/\\/v1\\/?$/u, \"\"),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate providerIds(): Set<string> {\n\t\treturn new Set([\n\t\t\t...this.builtins.keys(),\n\t\t\t...this.nativeExtensionProviders.keys(),\n\t\t\t...this.config.getProviderIds(),\n\t\t\t...this.extensionProviders.keys(),\n\t\t]);\n\t}\n\n\tprivate recomposeProvider(providerId: string): void {\n\t\tconst base = this.nativeExtensionProviders.get(providerId) ?? this.builtins.get(providerId);\n\t\tconst extension = this.extensionProviders.get(providerId);\n\t\tif (!base && !this.config.getProvider(providerId) && !extension) {\n\t\t\tthis.models.deleteProvider(providerId);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\tif (base && !this.config.getProvider(providerId) && !extension) {\n\t\t\t// No overlays: use the builtin untouched so its auth/login/stream behavior is exact.\n\t\t\tthis.models.setProvider(base);\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tthis.models.setProvider(composeModelProvider(providerId, base, this.config, extension));\n\t\t\tthis.compositionErrors.delete(providerId);\n\t\t} catch (error) {\n\t\t\tthis.compositionErrors.set(providerId, error instanceof Error ? error.message : String(error));\n\t\t\tif (base) this.models.setProvider(base);\n\t\t\telse this.models.deleteProvider(providerId);\n\t\t}\n\t}\n\n\tprivate rebuildProviders(): void {\n\t\tthis.models.clearProviders();\n\t\tthis.compositionErrors.clear();\n\t\tfor (const providerId of this.providerIds()) this.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t}\n\n\tprivate updateModelSnapshot(): void {\n\t\tconst all = [...this.models.getModels()];\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tall,\n\t\t\tavailable: all.filter((model) => this.snapshot.configuredProviders.has(model.provider)),\n\t\t};\n\t}\n\n\tprivate async runAvailabilityRefresh(): Promise<void> {\n\t\tconst providers = this.models.getProviders();\n\t\tconst [available, checks, credentials] = await Promise.all([\n\t\t\tthis.models.getAvailable(),\n\t\t\tPromise.all(\n\t\t\t\tproviders.map(\n\t\t\t\t\tasync (provider): Promise<[string, AuthCheck | undefined]> => [\n\t\t\t\t\t\tprovider.id,\n\t\t\t\t\t\tawait this.models.checkAuth(provider.id),\n\t\t\t\t\t],\n\t\t\t\t),\n\t\t\t),\n\t\t\tthis.credentials.list(),\n\t\t]);\n\t\tconst auth = new Map(checks);\n\t\tconst configuredProviders = new Set(\n\t\t\tchecks\n\t\t\t\t.filter((entry): entry is [string, AuthCheck] => entry[1] !== undefined)\n\t\t\t\t.map(([providerId]) => providerId),\n\t\t);\n\t\tthis.snapshot = {\n\t\t\tall: [...this.models.getModels()],\n\t\t\tavailable: [...available],\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders: new Set(credentials.map((entry) => entry.providerId)),\n\t\t\tauth,\n\t\t};\n\t\tthis.availabilityError = undefined;\n\t}\n\n\tprivate queueAvailabilityRefresh(after: Promise<void> | undefined): Promise<void> {\n\t\tconst refresh = (after ?? Promise.resolve()).catch(() => {}).then(() => this.runAvailabilityRefresh());\n\t\tconst recorded = refresh.catch((error) => {\n\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\tthrow error;\n\t\t});\n\t\tconst tracked = recorded.finally(() => {\n\t\t\tif (this.availabilityRefresh === tracked) this.availabilityRefresh = undefined;\n\t\t});\n\t\tthis.availabilityRefresh = tracked;\n\t\treturn tracked;\n\t}\n\n\t/** Coalesce concurrent readers onto the pending refresh. */\n\tprivate refreshAvailability(): Promise<void> {\n\t\treturn this.availabilityRefresh ?? this.queueAvailabilityRefresh(undefined);\n\t}\n\n\t/** Mutations must not observe an in-flight refresh started before them. */\n\tprivate forceRefreshAvailability(): Promise<void> {\n\t\treturn this.queueAvailabilityRefresh(this.availabilityRefresh);\n\t}\n\n\tgetProviders(): readonly Provider[] {\n\t\treturn this.models.getProviders();\n\t}\n\n\tgetProvider(providerId: string): Provider | undefined {\n\t\treturn this.models.getProvider(providerId);\n\t}\n\n\tgetModels(providerId?: string): readonly Model<Api>[] {\n\t\treturn this.models.getModels(providerId);\n\t}\n\n\tgetModel(providerId: string, modelId: string): Model<Api> | undefined {\n\t\treturn this.models.getModel(providerId, modelId);\n\t}\n\n\tasync checkAuth(providerId: string): Promise<AuthCheck | undefined> {\n\t\treturn this.models.checkAuth(providerId);\n\t}\n\n\tasync getAvailable(providerId?: string): Promise<readonly Model<Api>[]> {\n\t\tif (providerId) {\n\t\t\tif (this.availabilityRefresh) {\n\t\t\t\tawait this.availabilityRefresh;\n\t\t\t\treturn this.snapshot.available.filter((model) => model.provider === providerId);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn await this.models.getAvailable(providerId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.availabilityError = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t\tawait this.refreshAvailability();\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetAvailableSnapshot(): readonly Model<Api>[] {\n\t\treturn this.snapshot.available;\n\t}\n\n\tgetError(): string | undefined {\n\t\tconst errors: string[] = [];\n\t\tconst configError = this.config.getError();\n\t\tif (configError) errors.push(configError);\n\t\tfor (const [providerId, error] of this.compositionErrors) {\n\t\t\terrors.push(`Provider \"${providerId}\": ${error}`);\n\t\t}\n\t\tif (this.availabilityError) errors.push(`Availability refresh: ${this.availabilityError}`);\n\t\treturn errors.length > 0 ? errors.join(\"\\n\\n\") : undefined;\n\t}\n\n\tgetRegisteredProviderConfig(providerId: string): ProviderConfigInput | undefined {\n\t\treturn this.extensionProviders.get(providerId);\n\t}\n\n\tgetRegisteredProviderIds(): readonly string[] {\n\t\treturn [...new Set([...this.extensionProviders.keys(), ...this.nativeExtensionProviders.keys()])];\n\t}\n\n\tgetRegisteredNativeProvider(providerId: string): Provider | undefined {\n\t\treturn this.nativeExtensionProviders.get(providerId);\n\t}\n\n\t/** @internal Compatibility fallback for ModelRegistry when provider auth is unconfigured. */\n\tgetCompatibilityRequestConfig(model: Model<Api>): CompatibilityRequestConfig {\n\t\treturn resolveCompatibilityRequestConfig(\n\t\t\tmodel,\n\t\t\tthis.config.getProvider(model.provider),\n\t\t\tthis.extensionProviders.get(model.provider),\n\t\t);\n\t}\n\n\tisUsingOAuth(providerId: string): boolean {\n\t\treturn this.snapshot.auth.get(providerId)?.type === \"oauth\";\n\t}\n\n\thasConfiguredAuth(providerId: string): boolean {\n\t\treturn this.snapshot.configuredProviders.has(providerId);\n\t}\n\n\tgetAuth(providerId: string, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tgetAuth(model: Model<Api>, overrides?: ModelRuntimeAuthOverrides): Promise<AuthResult | undefined>;\n\tasync getAuth(\n\t\tproviderOrModel: string | Model<Api>,\n\t\toverrides: ModelRuntimeAuthOverrides = {},\n\t): Promise<AuthResult | undefined> {\n\t\tif (typeof providerOrModel === \"string\") return this.models.getAuth(providerOrModel, overrides);\n\t\tconst resolution = await this.models.getAuth(providerOrModel, overrides);\n\t\tif (!resolution) return undefined;\n\t\tconst configuredHeaders = resolveConfiguredModelHeaders(\n\t\t\tproviderOrModel,\n\t\t\tthis.config.getProvider(providerOrModel.provider),\n\t\t\tthis.extensionProviders.get(providerOrModel.provider),\n\t\t\t{ ...(resolution.env ?? {}), ...(overrides.env ?? {}) },\n\t\t);\n\t\treturn {\n\t\t\t...resolution,\n\t\t\tauth: {\n\t\t\t\t...resolution.auth,\n\t\t\t\theaders: mergeHeaders(resolution.auth.headers, configuredHeaders),\n\t\t\t},\n\t\t};\n\t}\n\n\tasync setRuntimeApiKey(\n\t\tproviderId: string,\n\t\tapiKey: string,\n\t\trefreshOptions: ModelsRefreshOptions = {},\n\t): Promise<void> {\n\t\tthis.credentials.setRuntimeApiKey(providerId, apiKey);\n\t\tconst auth = new Map(this.snapshot.auth).set(providerId, { type: \"api_key\", source: \"runtime API key\" });\n\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\tconst storedProviders = new Set(this.snapshot.storedProviders).add(providerId);\n\t\tthis.snapshot = {\n\t\t\t...this.snapshot,\n\t\t\tauth,\n\t\t\tconfiguredProviders,\n\t\t\tstoredProviders,\n\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t};\n\t\tawait this.refresh(refreshOptions);\n\t}\n\n\tasync removeRuntimeApiKey(providerId: string): Promise<void> {\n\t\tthis.credentials.removeRuntimeApiKey(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tlistCredentials(): Promise<readonly CredentialInfo[]> {\n\t\treturn this.credentials.list();\n\t}\n\n\tgetProviderAuthStatus(providerId: string): AuthStatus {\n\t\tif (this.credentials.hasRuntimeApiKey(providerId)) return { configured: true, source: \"runtime\" };\n\t\tif (this.snapshot.storedProviders.has(providerId)) return { configured: true, source: \"stored\" };\n\t\tconst configured = configuredRequestAuthStatus(\n\t\t\tthis.config.getProvider(providerId),\n\t\t\tthis.extensionProviders.get(providerId),\n\t\t);\n\t\tif (configured) return configured;\n\t\tconst check = this.snapshot.auth.get(providerId);\n\t\treturn check ? { configured: true, source: \"environment\", label: check.source } : { configured: false };\n\t}\n\n\tprivate async prepareRequest(\n\t\tmodel: Model<Api>,\n\t\toptions: (StreamOptions & ModelsStreamTransforms) | undefined,\n\t): Promise<{ provider: Provider; model: Model<Api>; options: StreamOptions }> {\n\t\tconst provider = this.models.getProvider(model.provider);\n\t\tif (!provider) throw new ModelsError(\"provider\", `Unknown provider: ${model.provider}`);\n\t\tconst resolution = await this.getAuth(model, { apiKey: options?.apiKey, env: options?.env });\n\t\tif (!resolution) throw new ModelsError(\"auth\", `Provider is not configured: ${model.provider}`);\n\n\t\tconst { transformHeaders, ...providerOptions } = options ?? {};\n\t\tlet headers = mergeHeaders(resolution.auth.headers, providerOptions.headers);\n\t\tif (transformHeaders) headers = await transformHeaders(headers ?? {});\n\t\tconst env =\n\t\t\tresolution.env || providerOptions.env\n\t\t\t\t? { ...(resolution.env ?? {}), ...(providerOptions.env ?? {}) }\n\t\t\t\t: undefined;\n\t\treturn {\n\t\t\tprovider,\n\t\t\tmodel: resolution.auth.baseUrl ? { ...model, baseUrl: resolution.auth.baseUrl } : model,\n\t\t\toptions: {\n\t\t\t\t...providerOptions,\n\t\t\t\tapiKey: providerOptions.apiKey ?? resolution.auth.apiKey,\n\t\t\t\theaders,\n\t\t\t\tenv,\n\t\t\t},\n\t\t};\n\t}\n\n\tstream<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(\n\t\t\t\tmodel,\n\t\t\t\toptions as (StreamOptions & ModelsStreamTransforms) | undefined,\n\t\t\t);\n\t\t\treturn prepared.provider.stream(\n\t\t\t\tprepared.model as Model<TApi>,\n\t\t\t\tcontext,\n\t\t\t\tprepared.options as ApiStreamOptions<TApi>,\n\t\t\t);\n\t\t});\n\t}\n\n\tcomplete<TApi extends Api>(\n\t\tmodel: Model<TApi>,\n\t\tcontext: Context,\n\t\toptions?: ModelsApiStreamOptions<TApi>,\n\t): Promise<AssistantMessage> {\n\t\treturn this.stream(model, context, options).result();\n\t}\n\n\tstreamSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): AssistantMessageEventStream {\n\t\treturn lazyStream(model, async () => {\n\t\t\tconst prepared = await this.prepareRequest(model, options);\n\t\t\treturn prepared.provider.streamSimple(prepared.model, context, prepared.options as SimpleStreamOptions);\n\t\t});\n\t}\n\n\tcompleteSimple(model: Model<Api>, context: Context, options?: ModelsSimpleStreamOptions): Promise<AssistantMessage> {\n\t\treturn this.streamSimple(model, context, options).result();\n\t}\n\n\tasync login(providerId: string, type: AuthType, interaction: AuthInteraction): Promise<Credential> {\n\t\tconst credential = await this.models.login(providerId, type, interaction);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t\treturn credential;\n\t}\n\n\tasync logout(providerId: string): Promise<void> {\n\t\tawait this.models.logout(providerId);\n\t\t// Reset credential-dependent compatibility projections before the unconfigured provider is skipped by refresh.\n\t\tthis.recomposeProvider(providerId);\n\t\tawait this.refresh({ allowNetwork: this.modelNetworkEnabled });\n\t}\n\n\tasync refresh(options: ModelsRefreshOptions = {}): Promise<ModelsRefreshResult> {\n\t\tthis.config = await ModelConfig.load(this.modelsPath);\n\t\tthis.configureRadiusProviders();\n\t\tthis.rebuildProviders();\n\t\tconst refreshOptions = {\n\t\t\t...options,\n\t\t\tallowNetwork: options.allowNetwork ?? this.modelNetworkEnabled,\n\t\t};\n\t\t// Published pi-ai builds before ModelsStore returned void and accepted a provider ID.\n\t\t// The fallback keeps source-mode CLI tests working without rebuilding workspace dependencies.\n\t\tconst result = ((await this.models.refresh(refreshOptions)) as ModelsRefreshResult | undefined) ?? {\n\t\t\taborted: refreshOptions.signal?.aborted ?? false,\n\t\t\terrors: new Map(),\n\t\t};\n\t\tthis.updateModelSnapshot();\n\t\ttry {\n\t\t\tawait this.forceRefreshAvailability();\n\t\t} catch {\n\t\t\t// Availability errors are recorded by forceRefreshAvailability; refreshed models remain usable.\n\t\t}\n\t\treturn result;\n\t}\n\n\tregisterNativeProvider(provider: Provider): void {\n\t\tif (!provider.id.trim()) throw new Error(\"Provider id must not be empty.\");\n\t\tthis.extensionProviders.delete(provider.id);\n\t\tthis.nativeExtensionProviders.set(provider.id, provider);\n\t\tthis.recomposeProvider(provider.id);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tregisterProvider(providerId: string, config: ProviderConfigInput): void {\n\t\t// Validate the incoming registration on its own, like the legacy registry:\n\t\t// a broken re-registration must throw without touching the stored config.\n\t\tvalidateExtensionProvider(providerId, this.builtins.get(providerId), this.config.getProvider(providerId), config);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\t// Re-registration merges defined values over the previous registration and\n\t\t// preserves undefined ones, matching the legacy ModelRegistry contract.\n\t\tconst previous = this.extensionProviders.get(providerId);\n\t\tconst effective: ProviderConfigInput = { ...previous };\n\t\tfor (const [key, value] of Object.entries(config)) {\n\t\t\tif (value !== undefined) (effective as Record<string, unknown>)[key] = value;\n\t\t}\n\t\tthis.extensionProviders.set(providerId, effective);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tif (\n\t\t\tthis.snapshot.storedProviders.has(providerId) ||\n\t\t\tconfiguredRequestAuthStatus(this.config.getProvider(providerId), effective)?.configured\n\t\t) {\n\t\t\tconst configuredProviders = new Set(this.snapshot.configuredProviders).add(providerId);\n\t\t\tconst auth = new Map(this.snapshot.auth);\n\t\t\t// Provisional entry until the async refresh lands; never clobber a real check result.\n\t\t\tif (!auth.get(providerId)) {\n\t\t\t\tauth.set(providerId, {\n\t\t\t\t\ttype: effective.oauth && !effective.apiKey ? \"oauth\" : \"api_key\",\n\t\t\t\t\tsource: \"configured provider\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.snapshot = {\n\t\t\t\t...this.snapshot,\n\t\t\t\tauth,\n\t\t\t\tconfiguredProviders,\n\t\t\t\tavailable: this.snapshot.all.filter((model) => configuredProviders.has(model.provider)),\n\t\t\t};\n\t\t}\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n\n\tunregisterProvider(providerId: string): void {\n\t\tthis.extensionProviders.delete(providerId);\n\t\tthis.nativeExtensionProviders.delete(providerId);\n\t\tthis.recomposeProvider(providerId);\n\t\tthis.updateModelSnapshot();\n\t\tvoid this.refresh({ allowNetwork: false });\n\t}\n}\n"]}