@ibgib/web-gib 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/.ibgibignore +30 -0
  2. package/.vscode/ibgib-snippets.code-snippets +309 -0
  3. package/.vscode/launch.json +25 -0
  4. package/.vscode/settings.json +68 -0
  5. package/.vscode/tasks.json +38 -0
  6. package/CHANGELOG.md +427 -0
  7. package/README.md +66 -0
  8. package/dist/agent-texts/common-agent-texts.d.mts +14 -0
  9. package/dist/agent-texts/common-agent-texts.d.mts.map +1 -0
  10. package/dist/agent-texts/common-agent-texts.mjs +51 -0
  11. package/dist/agent-texts/common-agent-texts.mjs.map +1 -0
  12. package/dist/agent-texts/primary-agent-texts.d.mts +16 -0
  13. package/dist/agent-texts/primary-agent-texts.d.mts.map +1 -0
  14. package/dist/agent-texts/primary-agent-texts.mjs +27 -0
  15. package/dist/agent-texts/primary-agent-texts.mjs.map +1 -0
  16. package/dist/agent-texts/project-agent-texts.d.mts +8 -0
  17. package/dist/agent-texts/project-agent-texts.d.mts.map +1 -0
  18. package/dist/agent-texts/project-agent-texts.mjs +29 -0
  19. package/dist/agent-texts/project-agent-texts.mjs.map +1 -0
  20. package/dist/agent-texts/project-child-text-agent-texts.d.mts +5 -0
  21. package/dist/agent-texts/project-child-text-agent-texts.d.mts.map +1 -0
  22. package/dist/agent-texts/project-child-text-agent-texts.mjs +26 -0
  23. package/dist/agent-texts/project-child-text-agent-texts.mjs.map +1 -0
  24. package/dist/agent-texts/projects-agent-texts.d.mts +4 -0
  25. package/dist/agent-texts/projects-agent-texts.d.mts.map +1 -0
  26. package/dist/agent-texts/projects-agent-texts.mjs +15 -0
  27. package/dist/agent-texts/projects-agent-texts.mjs.map +1 -0
  28. package/dist/agent-texts/raw-agent-texts.d.mts +4 -0
  29. package/dist/agent-texts/raw-agent-texts.d.mts.map +1 -0
  30. package/dist/agent-texts/raw-agent-texts.mjs +17 -0
  31. package/dist/agent-texts/raw-agent-texts.mjs.map +1 -0
  32. package/dist/agent-texts/text-editor-agent-texts.d.mts +6 -0
  33. package/dist/agent-texts/text-editor-agent-texts.d.mts.map +1 -0
  34. package/dist/agent-texts/text-editor-agent-texts.mjs +19 -0
  35. package/dist/agent-texts/text-editor-agent-texts.mjs.map +1 -0
  36. package/dist/api/api-constants.d.mts +9 -0
  37. package/dist/api/api-constants.d.mts.map +1 -0
  38. package/dist/api/api-constants.mjs +9 -0
  39. package/dist/api/api-constants.mjs.map +1 -0
  40. package/dist/api/api-index.d.mts +10 -0
  41. package/dist/api/api-index.d.mts.map +1 -0
  42. package/dist/api/api-index.mjs +121 -0
  43. package/dist/api/api-index.mjs.map +1 -0
  44. package/dist/api/api-types.d.mts +36 -0
  45. package/dist/api/api-types.d.mts.map +1 -0
  46. package/dist/api/api-types.mjs +2 -0
  47. package/dist/api/api-types.mjs.map +1 -0
  48. package/dist/api/commands/chat/chat-index.d.mts +3 -0
  49. package/dist/api/commands/chat/chat-index.d.mts.map +1 -0
  50. package/dist/api/commands/chat/chat-index.mjs +9 -0
  51. package/dist/api/commands/chat/chat-index.mjs.map +1 -0
  52. package/dist/api/commands/chat/get-context-info.d.mts +71 -0
  53. package/dist/api/commands/chat/get-context-info.d.mts.map +1 -0
  54. package/dist/api/commands/chat/get-context-info.mjs +130 -0
  55. package/dist/api/commands/chat/get-context-info.mjs.map +1 -0
  56. package/dist/api/commands/chat/hello-world.d.mts +63 -0
  57. package/dist/api/commands/chat/hello-world.d.mts.map +1 -0
  58. package/dist/api/commands/chat/hello-world.mjs +132 -0
  59. package/dist/api/commands/chat/hello-world.mjs.map +1 -0
  60. package/dist/api/commands/chat/tell-user.d.mts +57 -0
  61. package/dist/api/commands/chat/tell-user.d.mts.map +1 -0
  62. package/dist/api/commands/chat/tell-user.mjs +199 -0
  63. package/dist/api/commands/chat/tell-user.mjs.map +1 -0
  64. package/dist/api/commands/command-constants.d.mts +22 -0
  65. package/dist/api/commands/command-constants.d.mts.map +1 -0
  66. package/dist/api/commands/command-constants.mjs +17 -0
  67. package/dist/api/commands/command-constants.mjs.map +1 -0
  68. package/dist/api/commands/command-helpers.d.mts +47 -0
  69. package/dist/api/commands/command-helpers.d.mts.map +1 -0
  70. package/dist/api/commands/command-helpers.mjs +76 -0
  71. package/dist/api/commands/command-helpers.mjs.map +1 -0
  72. package/dist/api/commands/command-service-v1.d.mts +28 -0
  73. package/dist/api/commands/command-service-v1.d.mts.map +1 -0
  74. package/dist/api/commands/command-service-v1.mjs +122 -0
  75. package/dist/api/commands/command-service-v1.mjs.map +1 -0
  76. package/dist/api/commands/command-service.respec.d.mts +7 -0
  77. package/dist/api/commands/command-service.respec.d.mts.map +1 -0
  78. package/dist/api/commands/command-service.respec.mjs +66 -0
  79. package/dist/api/commands/command-service.respec.mjs.map +1 -0
  80. package/dist/api/commands/command-types.d.mts +48 -0
  81. package/dist/api/commands/command-types.d.mts.map +1 -0
  82. package/dist/api/commands/command-types.mjs +12 -0
  83. package/dist/api/commands/command-types.mjs.map +1 -0
  84. package/dist/api/commands/ibgib/get-ibgibs.d.mts +94 -0
  85. package/dist/api/commands/ibgib/get-ibgibs.d.mts.map +1 -0
  86. package/dist/api/commands/ibgib/get-ibgibs.mjs +219 -0
  87. package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -0
  88. package/dist/api/commands/ibgib/ibgib-index.d.mts +3 -0
  89. package/dist/api/commands/ibgib/ibgib-index.d.mts.map +1 -0
  90. package/dist/api/commands/ibgib/ibgib-index.mjs +7 -0
  91. package/dist/api/commands/ibgib/ibgib-index.mjs.map +1 -0
  92. package/dist/api/commands/ibgib/mut8-ibgib.d.mts +135 -0
  93. package/dist/api/commands/ibgib/mut8-ibgib.d.mts.map +1 -0
  94. package/dist/api/commands/ibgib/mut8-ibgib.mjs +318 -0
  95. package/dist/api/commands/ibgib/mut8-ibgib.mjs.map +1 -0
  96. package/dist/api/commands/templates/api-function-info.template.d.mts +73 -0
  97. package/dist/api/commands/templates/api-function-info.template.d.mts.map +1 -0
  98. package/dist/api/commands/templates/api-function-info.template.mjs +161 -0
  99. package/dist/api/commands/templates/api-function-info.template.mjs.map +1 -0
  100. package/dist/api/commands/text/text-edit.d.mts +54 -0
  101. package/dist/api/commands/text/text-edit.d.mts.map +1 -0
  102. package/dist/api/commands/text/text-edit.mjs +170 -0
  103. package/dist/api/commands/text/text-edit.mjs.map +1 -0
  104. package/dist/api/commands/text/text-index.d.mts +3 -0
  105. package/dist/api/commands/text/text-index.d.mts.map +1 -0
  106. package/dist/api/commands/text/text-index.mjs +5 -0
  107. package/dist/api/commands/text/text-index.mjs.map +1 -0
  108. package/dist/api/commands/ui/ui-index.d.mts +3 -0
  109. package/dist/api/commands/ui/ui-index.d.mts.map +1 -0
  110. package/dist/api/commands/ui/ui-index.mjs +5 -0
  111. package/dist/api/commands/ui/ui-index.mjs.map +1 -0
  112. package/dist/api/commands/ui/update-css-variables.d.mts +48 -0
  113. package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -0
  114. package/dist/api/commands/ui/update-css-variables.mjs +145 -0
  115. package/dist/api/commands/ui/update-css-variables.mjs.map +1 -0
  116. package/dist/api/function-infos.web.d.mts +15 -0
  117. package/dist/api/function-infos.web.d.mts.map +1 -0
  118. package/dist/api/function-infos.web.mjs +63 -0
  119. package/dist/api/function-infos.web.mjs.map +1 -0
  120. package/dist/assumptions.respec.d.mts +2 -0
  121. package/dist/assumptions.respec.d.mts.map +1 -0
  122. package/dist/assumptions.respec.mjs +41 -0
  123. package/dist/assumptions.respec.mjs.map +1 -0
  124. package/dist/common/project/project-constants.d.mts +38 -0
  125. package/dist/common/project/project-constants.d.mts.map +1 -0
  126. package/dist/common/project/project-constants.mjs +71 -0
  127. package/dist/common/project/project-constants.mjs.map +1 -0
  128. package/dist/common/project/project-helper.d.mts +127 -0
  129. package/dist/common/project/project-helper.d.mts.map +1 -0
  130. package/dist/common/project/project-helper.mjs +683 -0
  131. package/dist/common/project/project-helper.mjs.map +1 -0
  132. package/dist/common/project/project-types.d.mts +91 -0
  133. package/dist/common/project/project-types.d.mts.map +1 -0
  134. package/dist/common/project/project-types.mjs +31 -0
  135. package/dist/common/project/project-types.mjs.map +1 -0
  136. package/dist/common/prompt-functions.web.d.mts +90 -0
  137. package/dist/common/prompt-functions.web.d.mts.map +1 -0
  138. package/dist/common/prompt-functions.web.mjs +426 -0
  139. package/dist/common/prompt-functions.web.mjs.map +1 -0
  140. package/dist/common/settings/settings-constants.d.mts +33 -0
  141. package/dist/common/settings/settings-constants.d.mts.map +1 -0
  142. package/dist/common/settings/settings-constants.mjs +54 -0
  143. package/dist/common/settings/settings-constants.mjs.map +1 -0
  144. package/dist/common/settings/settings-helpers.d.mts +59 -0
  145. package/dist/common/settings/settings-helpers.d.mts.map +1 -0
  146. package/dist/common/settings/settings-helpers.mjs +253 -0
  147. package/dist/common/settings/settings-helpers.mjs.map +1 -0
  148. package/dist/common/settings/settings-types.d.mts +118 -0
  149. package/dist/common/settings/settings-types.d.mts.map +1 -0
  150. package/dist/common/settings/settings-types.mjs +13 -0
  151. package/dist/common/settings/settings-types.mjs.map +1 -0
  152. package/dist/constants.d.mts +34 -0
  153. package/dist/constants.d.mts.map +1 -0
  154. package/dist/constants.mjs +35 -0
  155. package/dist/constants.mjs.map +1 -0
  156. package/dist/foo.d.mts +2 -0
  157. package/dist/foo.d.mts.map +1 -0
  158. package/dist/foo.mjs +19 -0
  159. package/dist/foo.mjs.map +1 -0
  160. package/dist/helpers.d.mts +137 -0
  161. package/dist/helpers.d.mts.map +1 -0
  162. package/dist/helpers.mjs +514 -0
  163. package/dist/helpers.mjs.map +1 -0
  164. package/dist/helpers.web.d.mts +324 -0
  165. package/dist/helpers.web.d.mts.map +1 -0
  166. package/dist/helpers.web.mjs +1133 -0
  167. package/dist/helpers.web.mjs.map +1 -0
  168. package/dist/helpers.web.respec.d.mts +2 -0
  169. package/dist/helpers.web.respec.d.mts.map +1 -0
  170. package/dist/helpers.web.respec.mjs +12 -0
  171. package/dist/helpers.web.respec.mjs.map +1 -0
  172. package/dist/index.d.mts +2 -0
  173. package/dist/index.d.mts.map +1 -0
  174. package/dist/index.mjs +3 -0
  175. package/dist/index.mjs.map +1 -0
  176. package/dist/respec-gib.node.d.mts +2 -0
  177. package/dist/respec-gib.node.d.mts.map +1 -0
  178. package/dist/respec-gib.node.mjs +211 -0
  179. package/dist/respec-gib.node.mjs.map +1 -0
  180. package/dist/spec-helper.node.respec.d.mts +13 -0
  181. package/dist/spec-helper.node.respec.d.mts.map +1 -0
  182. package/dist/spec-helper.node.respec.mjs +50 -0
  183. package/dist/spec-helper.node.respec.mjs.map +1 -0
  184. package/dist/storage/storage-helpers.web.d.mts +108 -0
  185. package/dist/storage/storage-helpers.web.d.mts.map +1 -0
  186. package/dist/storage/storage-helpers.web.mjs +757 -0
  187. package/dist/storage/storage-helpers.web.mjs.map +1 -0
  188. package/dist/storage/storage-types.web.d.mts +30 -0
  189. package/dist/storage/storage-types.web.d.mts.map +1 -0
  190. package/dist/storage/storage-types.web.mjs +2 -0
  191. package/dist/storage/storage-types.web.mjs.map +1 -0
  192. package/dist/types.web.d.mts +42 -0
  193. package/dist/types.web.d.mts.map +1 -0
  194. package/dist/types.web.mjs +2 -0
  195. package/dist/types.web.mjs.map +1 -0
  196. package/dist/ui/component/component-types.d.mts +225 -0
  197. package/dist/ui/component/component-types.d.mts.map +1 -0
  198. package/dist/ui/component/component-types.mjs +2 -0
  199. package/dist/ui/component/component-types.mjs.map +1 -0
  200. package/dist/ui/component/ibgib-component-service.d.mts +70 -0
  201. package/dist/ui/component/ibgib-component-service.d.mts.map +1 -0
  202. package/dist/ui/component/ibgib-component-service.mjs +201 -0
  203. package/dist/ui/component/ibgib-component-service.mjs.map +1 -0
  204. package/dist/ui/component/ibgib-dynamic-component-bases.d.mts +338 -0
  205. package/dist/ui/component/ibgib-dynamic-component-bases.d.mts.map +1 -0
  206. package/dist/ui/component/ibgib-dynamic-component-bases.mjs +1304 -0
  207. package/dist/ui/component/ibgib-dynamic-component-bases.mjs.map +1 -0
  208. package/dist/ui/ui-constants.d.mts +12 -0
  209. package/dist/ui/ui-constants.d.mts.map +1 -0
  210. package/dist/ui/ui-constants.mjs +93 -0
  211. package/dist/ui/ui-constants.mjs.map +1 -0
  212. package/dist/ui/ui-helpers.d.mts +42 -0
  213. package/dist/ui/ui-helpers.d.mts.map +1 -0
  214. package/dist/ui/ui-helpers.mjs +198 -0
  215. package/dist/ui/ui-helpers.mjs.map +1 -0
  216. package/dist/ui/ui-types.d.mts +13 -0
  217. package/dist/ui/ui-types.d.mts.map +1 -0
  218. package/dist/ui/ui-types.mjs +2 -0
  219. package/dist/ui/ui-types.mjs.map +1 -0
  220. package/dist/witness/agent/agent-constants.d.mts +97 -0
  221. package/dist/witness/agent/agent-constants.d.mts.map +1 -0
  222. package/dist/witness/agent/agent-constants.mjs +98 -0
  223. package/dist/witness/agent/agent-constants.mjs.map +1 -0
  224. package/dist/witness/agent/agent-helpers.d.mts +106 -0
  225. package/dist/witness/agent/agent-helpers.d.mts.map +1 -0
  226. package/dist/witness/agent/agent-helpers.mjs +601 -0
  227. package/dist/witness/agent/agent-helpers.mjs.map +1 -0
  228. package/dist/witness/agent/agent-one-file.app.d.mts +2 -0
  229. package/dist/witness/agent/agent-one-file.app.d.mts.map +1 -0
  230. package/dist/witness/agent/agent-one-file.app.mjs +8 -0
  231. package/dist/witness/agent/agent-one-file.app.mjs.map +1 -0
  232. package/dist/witness/agent/agent-one-file.d.mts +478 -0
  233. package/dist/witness/agent/agent-one-file.d.mts.map +1 -0
  234. package/dist/witness/agent/agent-one-file.mjs +1462 -0
  235. package/dist/witness/agent/agent-one-file.mjs.map +1 -0
  236. package/dist/witness/agent/agent-types.d.mts +83 -0
  237. package/dist/witness/agent/agent-types.d.mts.map +1 -0
  238. package/dist/witness/agent/agent-types.mjs +2 -0
  239. package/dist/witness/agent/agent-types.mjs.map +1 -0
  240. package/dist/witness/agent/agents-service-v1.d.mts +99 -0
  241. package/dist/witness/agent/agents-service-v1.d.mts.map +1 -0
  242. package/dist/witness/agent/agents-service-v1.mjs +453 -0
  243. package/dist/witness/agent/agents-service-v1.mjs.map +1 -0
  244. package/dist/witness/agent/function-info/function-info-one-file.d.mts +192 -0
  245. package/dist/witness/agent/function-info/function-info-one-file.d.mts.map +1 -0
  246. package/dist/witness/agent/function-info/function-info-one-file.mjs +192 -0
  247. package/dist/witness/agent/function-info/function-info-one-file.mjs.map +1 -0
  248. package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts +51 -0
  249. package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts.map +1 -0
  250. package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs +928 -0
  251. package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs.map +1 -0
  252. package/dist/witness/agent/gemini/gemini-agent-factory.d.mts +27 -0
  253. package/dist/witness/agent/gemini/gemini-agent-factory.d.mts.map +1 -0
  254. package/dist/witness/agent/gemini/gemini-agent-factory.mjs +144 -0
  255. package/dist/witness/agent/gemini/gemini-agent-factory.mjs.map +1 -0
  256. package/dist/witness/agent/gemini/gemini-constants.d.mts +36 -0
  257. package/dist/witness/agent/gemini/gemini-constants.d.mts.map +1 -0
  258. package/dist/witness/agent/gemini/gemini-constants.mjs +47 -0
  259. package/dist/witness/agent/gemini/gemini-constants.mjs.map +1 -0
  260. package/dist/witness/agent/gemini/gemini-helpers.d.mts +58 -0
  261. package/dist/witness/agent/gemini/gemini-helpers.d.mts.map +1 -0
  262. package/dist/witness/agent/gemini/gemini-helpers.mjs +210 -0
  263. package/dist/witness/agent/gemini/gemini-helpers.mjs.map +1 -0
  264. package/dist/witness/agent/gemini/gemini-types.d.mts +82 -0
  265. package/dist/witness/agent/gemini/gemini-types.d.mts.map +1 -0
  266. package/dist/witness/agent/gemini/gemini-types.mjs +3 -0
  267. package/dist/witness/agent/gemini/gemini-types.mjs.map +1 -0
  268. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts +136 -0
  269. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -0
  270. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs +334 -0
  271. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -0
  272. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts +35 -0
  273. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts.map +1 -0
  274. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs +267 -0
  275. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs.map +1 -0
  276. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts +134 -0
  277. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts.map +1 -0
  278. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs +389 -0
  279. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs.map +1 -0
  280. package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts +2 -0
  281. package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts.map +1 -0
  282. package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs +2 -0
  283. package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs.map +1 -0
  284. package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts +104 -0
  285. package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts.map +1 -0
  286. package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs +457 -0
  287. package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs.map +1 -0
  288. package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts +93 -0
  289. package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts.map +1 -0
  290. package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs +98 -0
  291. package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs.map +1 -0
  292. package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts +73 -0
  293. package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts.map +1 -0
  294. package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs +650 -0
  295. package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs.map +1 -0
  296. package/generate-version-file.js +29 -0
  297. package/package.json +60 -0
  298. package/src/agent-texts/common-agent-texts.mts +61 -0
  299. package/src/agent-texts/primary-agent-texts.mts +32 -0
  300. package/src/agent-texts/project-agent-texts.mts +29 -0
  301. package/src/agent-texts/project-child-text-agent-texts.mts +30 -0
  302. package/src/agent-texts/projects-agent-texts.mts +17 -0
  303. package/src/agent-texts/raw-agent-texts.mts +18 -0
  304. package/src/agent-texts/text-editor-agent-texts.mts +20 -0
  305. package/src/api/api-constants.mts +8 -0
  306. package/src/api/api-index.mts +110 -0
  307. package/src/api/api-types.mts +36 -0
  308. package/src/api/commands/chat/chat-index.mts +10 -0
  309. package/src/api/commands/chat/get-context-info.mts +196 -0
  310. package/src/api/commands/chat/hello-world.mts +183 -0
  311. package/src/api/commands/chat/tell-user.mts +241 -0
  312. package/src/api/commands/command-constants.mts +17 -0
  313. package/src/api/commands/command-helpers.mts +105 -0
  314. package/src/api/commands/command-service-v1.mts +136 -0
  315. package/src/api/commands/command-service.respec.mts +72 -0
  316. package/src/api/commands/command-types.mts +71 -0
  317. package/src/api/commands/ibgib/get-ibgibs.mts +269 -0
  318. package/src/api/commands/ibgib/ibgib-index.mts +8 -0
  319. package/src/api/commands/ibgib/mut8-ibgib.mts +418 -0
  320. package/src/api/commands/templates/api-function-info.template.mts +212 -0
  321. package/src/api/commands/text/text-edit.mts +217 -0
  322. package/src/api/commands/text/text-index.mts +6 -0
  323. package/src/api/commands/ui/ui-index.mts +6 -0
  324. package/src/api/commands/ui/update-css-variables.mts +187 -0
  325. package/src/api/function-infos.web.mts +66 -0
  326. package/src/assets/fullscreen-dialog.html +18 -0
  327. package/src/assumptions.respec.mts +51 -0
  328. package/src/common/project/project-constants.mts +83 -0
  329. package/src/common/project/project-helper.mts +730 -0
  330. package/src/common/project/project-types.mts +121 -0
  331. package/src/common/prompt-functions.web.mts +447 -0
  332. package/src/common/settings/settings-constants.mts +72 -0
  333. package/src/common/settings/settings-helpers.mts +280 -0
  334. package/src/common/settings/settings-types.mts +137 -0
  335. package/src/constants.mts +39 -0
  336. package/src/foo.mts +13 -0
  337. package/src/helpers.mts +574 -0
  338. package/src/helpers.web.mts +1277 -0
  339. package/src/helpers.web.respec.mts +16 -0
  340. package/src/index.mts +3 -0
  341. package/src/respec-gib.node.mts +199 -0
  342. package/src/spec-helper.node.respec.mts +50 -0
  343. package/src/storage/storage-helpers.web.mts +728 -0
  344. package/src/storage/storage-types.web.mts +29 -0
  345. package/src/types.web.mts +42 -0
  346. package/src/ui/component/component-types.mts +241 -0
  347. package/src/ui/component/ibgib-component-service.mts +201 -0
  348. package/src/ui/component/ibgib-dynamic-component-bases.mts +1369 -0
  349. package/src/ui/ui-constants.mts +101 -0
  350. package/src/ui/ui-helpers.mts +222 -0
  351. package/src/ui/ui-types.mts +11 -0
  352. package/src/witness/agent/agent-constants.mts +122 -0
  353. package/src/witness/agent/agent-helpers.mts +681 -0
  354. package/src/witness/agent/agent-one-file.app.mts +8 -0
  355. package/src/witness/agent/agent-one-file.mts +1665 -0
  356. package/src/witness/agent/agent-types.mts +92 -0
  357. package/src/witness/agent/agents-service-v1.mts +482 -0
  358. package/src/witness/agent/function-info/function-info-one-file.mts +362 -0
  359. package/src/witness/agent/gemini/agent-witness-gemini-v1.mts +910 -0
  360. package/src/witness/agent/gemini/gemini-agent-factory.mts +135 -0
  361. package/src/witness/agent/gemini/gemini-constants.mts +79 -0
  362. package/src/witness/agent/gemini/gemini-helpers.mts +216 -0
  363. package/src/witness/agent/gemini/gemini-types.mts +88 -0
  364. package/src/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mts +321 -0
  365. package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mts +290 -0
  366. package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mts +407 -0
  367. package/src/witness/space/web-filesystem-space/web-filesystem-space-constants.mts +1 -0
  368. package/src/witness/space/web-filesystem-space/web-filesystem-space-helper.mts +491 -0
  369. package/src/witness/space/web-filesystem-space/web-filesystem-space-types.mts +172 -0
  370. package/src/witness/space/web-filesystem-space/web-filesystem-space-v1.mts +670 -0
  371. package/tsconfig.json +17 -0
  372. package/tsconfig.test.json +10 -0
@@ -0,0 +1,418 @@
1
+ /**
2
+ * @module mut8IbGib.api-function-info Provides the API Function Info for the `mut8IbGib` command,
3
+ * which allows editing an existing ibGib using the `mut8` transform.
4
+ *
5
+ * ## notes
6
+ *
7
+ * ### ordering imports
8
+ *
9
+ * import sections always go:
10
+ * 1. non-ibgib deps first
11
+ * 2. @ibgib/helper-gib, @ibgib/encrypt-gib, @ibgib/ts-gib, @ibgib/core-gib packages (in that order)
12
+ * 3. import GLOBAL_LOG_A_LOT then remaining project imports
13
+ * 4. code proper starts with the definition of `const logalot` (if applicable)
14
+ *
15
+ * Each section is separated by a blank line.
16
+ */
17
+
18
+
19
+ import { extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
20
+ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
21
+ import { getIbAndGib } from '@ibgib/ts-gib/dist/helper.mjs';
22
+
23
+ import { GLOBAL_LOG_A_LOT } from '../../../constants.mjs';
24
+ import { APIFunctionInfo } from "../../api-types.mjs";
25
+ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
26
+ import { getCommandService } from "../command-service-v1.mjs";
27
+ import { CommandDataBase } from "../command-types.mjs";
28
+ import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.web.mjs';
29
+ import { FUNCTION_CALL_EXAMPLES_HEADER } from '../../api-constants.mjs';
30
+ import { getProjectSafeName, parseProjectIb } from '../../../common/project/project-helper.mjs';
31
+ import { mut8Timeline } from '@ibgib/core-gib/dist/timeline/timeline-api.mjs';
32
+
33
+ const logalot = GLOBAL_LOG_A_LOT;
34
+
35
+ // #region constants
36
+
37
+ /**
38
+ * camelCased name of the command itself.
39
+ */
40
+ export const FUNCTION_NAME = 'mut8IbGib';
41
+
42
+ /**
43
+ * agent is the broad command which basically acts like a category of commands at this point.
44
+ */
45
+ const CMD_CATEGORY = 'ibgib';
46
+ /**
47
+ * mut8IbGib here is the specific command modifier which narrows down to a command
48
+ * instance, similar to a fully curried function.
49
+ *
50
+ * This should be camelCased actual name of the function.
51
+ */
52
+ const CMD_MODIFIERS: string[] = [FUNCTION_NAME];
53
+
54
+ /**
55
+ * The ibgib.data map has certain keys that are not allowed to be edited, renamed, or removed.
56
+ */
57
+ const DISALLOWED_DATA_KEYS = ['uuid', 'timestamp', 'timestampMs', 'n', 'textTimestamp',];
58
+
59
+ const EXAMPLE_INPUT_MUT8IBGIB_MUT8PROJECTNAME: Partial<Mut8IbGibOpts> = {
60
+ ibGibAddr: 'project SomeProject 1748386170000^A2D75E05B14E264619D24ABA4F1A1B2328E183B4524CC26029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
61
+ dataToAddOrPatchJSONString: JSON.stringify({ name: 'New Title' }),
62
+ mut8Ib: 'project NewTitle 1748386170000',
63
+ notesToSelf: `Example of editing/adding a project ibgib's "title". In project ibgibs, this is in the "data.name" field, and the 2nd spot in the ib is a alphanumerics-only version of the name.`,
64
+ repromptWithResult: false,
65
+ };
66
+ const EXAMPLE_INPUT_MUT8IBGIB_MUT8DESCRIPTION: Partial<Mut8IbGibOpts> = {
67
+ ibGibAddr: 'project SomeProject^A2D75E05B14E264619D24ABA4F1A1B2328E183B4524CC26029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
68
+ dataToAddOrPatchJSONString: JSON.stringify({ description: 'Updated description for the project. You do not have to include all the properties, only the ones you want to change/patch.' }),
69
+ notesToSelf: `Example of editing/adding an ibGib's description. This will change the description in the ibGib's data map.`,
70
+ repromptWithResult: false,
71
+ };
72
+ const EXAMPLE_INPUT_MUT8IBGIB_REMOVEKEY: Partial<Mut8IbGibOpts> = {
73
+ ibGibAddr: 'project SomeProject^AAAA2827879982375961098098B239047928374987987F6029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
74
+ dataToRemoveJSONString: JSON.stringify({ identity: { middleInitial: '' } }),
75
+ notesToSelf: `Example of removing a nested key. This will delete the "middleInitial" property from the "identity" object in an ibgib's data map.`,
76
+ repromptWithResult: true,
77
+ };
78
+ const EXAMPLE_INPUT_MUT8IBGIB_RENAMEKEY: Partial<Mut8IbGibOpts> = {
79
+ ibGibAddr: 'project SomeProject^AAAA2827879982375961098098B239047928374987987F6029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
80
+ dataToRenameJSONString: JSON.stringify({ identity: { oldKeyName: 'newKeyName' } }),
81
+ notesToSelf: `Example of renaming a key. This will rename the "oldKeyName" key to "newKeyName" in an ibgib's data map.`,
82
+ repromptWithResult: false,
83
+ };
84
+ const EXAMPLE_INPUT_MUT8IBGIB_MUT8IB: Partial<Mut8IbGibOpts> = {
85
+ ibGibAddr: 'project SomeProject^AAAA2827879982375961098098B239047928374987987F6029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
86
+ mut8Ib: 'project SomeNewIb',
87
+ notesToSelf: `Example of renaming a key. This will rename the "ib" value, in this case "project SomeProject" to the new value. Empty values will throw.`,
88
+ repromptWithResult: true,
89
+ };
90
+ const EXAMPLES = [
91
+ FUNCTION_CALL_EXAMPLES_HEADER,
92
+ pretty(EXAMPLE_INPUT_MUT8IBGIB_MUT8PROJECTNAME),
93
+ pretty(EXAMPLE_INPUT_MUT8IBGIB_MUT8DESCRIPTION),
94
+ pretty(EXAMPLE_INPUT_MUT8IBGIB_REMOVEKEY),
95
+ pretty(EXAMPLE_INPUT_MUT8IBGIB_RENAMEKEY),
96
+ pretty(EXAMPLE_INPUT_MUT8IBGIB_MUT8IB),
97
+ ].join('\n');
98
+ const FUNCTION_DESCRIPTION = [
99
+ `Edits an ibGib's intrinsic data map via the mut8 transform.`,
100
+ `This can include setting/updating an ibgib's data, renaming keys or removing data properties entirely, or changing the ib.`,
101
+ `It operates on a specific ibGib identified by its address.`,
102
+ `**Note**: Certain intrinsic data properties are disallowed from being edited, renamed, or removed, including: \`${DISALLOWED_DATA_KEYS.join('`, `')}\`. Any attempts to modify these paths will be ignored.`,
103
+ `In the business domain, this can include multiple things, like editing a name, description, or other internal property. The following are only a couple of examples, but really it's any internal data for an ibgib.`,
104
+ ``,
105
+ EXAMPLES,
106
+ `**Note**: Even though each one individually is optional, at least one of dataToRenameJSONString, dataToRemoveJSONString, dataToAddOrPatchJSONString, or mut8Ib is required.`,
107
+ ].join('\n');
108
+
109
+ const JSON_CAVEAT = `Ibgib data can have any structure, so there is no way to know the keys beforehand. OpenAPI schema only allows for known props. So this arg should be a valid JSON string, i.e., the output of JSON.stringify(actualArg).`;
110
+ const DISALLOWED_CAVEAT = `Disallowed paths like "uuid" or "timestamp" cannot be added or patched. See function description for all disallowed keys.`;
111
+
112
+ const MUT8_IBGIB_SCHEMA = {
113
+ name: FUNCTION_NAME,
114
+ description: FUNCTION_DESCRIPTION,
115
+ parameters: {
116
+ type: 'object',
117
+ properties: {
118
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
119
+ spaceId: {
120
+ type: 'string',
121
+ description: `The id of the local user space. If not provided, will use the default local space. Only provide this if you don't want to use the default space. Agents should either leave this unset, or if they are trying to mut8 an ibGib that is inside *their* subspace, then they should provide this. Otherwise, it will look in the default space which will be incorrect. In the future, agents will have a different API for interacting with their subspaces, but for now this may be used (if the agent even has access to their subspace id. it's so early in dev, I'm not sure if this is true.)`,
122
+ },
123
+ ibGibAddr: {
124
+ type: 'string',
125
+ description: 'The content address of the ibGib to edit.',
126
+ },
127
+ dataToRenameJSONString: {
128
+ type: 'object',
129
+ description: [
130
+ `Specifies data properties to rename the key.`,
131
+ DISALLOWED_CAVEAT,
132
+ JSON_CAVEAT,
133
+ ].join('\n'),
134
+ },
135
+ dataToRemoveJSONString: {
136
+ type: 'string',
137
+ description: [
138
+ `Specifies data properties to remove entirely.`,
139
+ DISALLOWED_CAVEAT,
140
+ JSON_CAVEAT,
141
+ ].join('\n'),
142
+ },
143
+ dataToAddOrPatchJSONString: {
144
+ type: 'string',
145
+ description: [
146
+ `Subset of ibgib.data to be added or patched (or upserted if you like). So if you want to change the "name" property, then you specify that as the stringified version of { "name": "Some Name" }.`,
147
+ DISALLOWED_CAVEAT,
148
+ JSON_CAVEAT,
149
+ ].join('\n'),
150
+ },
151
+ mut8Ib: {
152
+ type: 'string',
153
+ description: 'Optional. If provided, will mutate the ib of the ibGib.',
154
+ },
155
+ },
156
+ required: [
157
+ 'ibGibAddr',
158
+ ],
159
+ },
160
+ };
161
+
162
+ /**
163
+ * @interface Mut8IbGibOpts - Options for the mut8IbGib command.
164
+ *
165
+ * @extends CommandDataBase
166
+ */
167
+ export interface Mut8IbGibOpts extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
168
+ spaceId?: string;
169
+ /**
170
+ * @property ibGibAddr - The address (or tjp address) of the project ibGib to edit.
171
+ */
172
+ ibGibAddr: string;
173
+ /**
174
+ * @property dataToRenameJSONString - Info to rename keys. Should be an object where each value should either be
175
+ * a string or an object. If it's a string, then the corresponding key will
176
+ * be renamed to that value. If it's an object, then it will recurse at that
177
+ * key. Disallowed paths include: \`${DISALLOWED_DATA_PATHS.join('`, `')}\`.
178
+ */
179
+ dataToRenameJSONString?: string;
180
+ /**
181
+ * @property dataToRemoveJSONString - Info to remove keys. Should be an object where each value should either be
182
+ * a string or an object. If it's a string, then the corresponding key (and its value)
183
+ * will be removed (the string value in the dataToRemove object is ignored). If it's an object,
184
+ * then it will recurse at that key. Disallowed paths include: \`${DISALLOWED_DATA_PATHS.join('`, `')}\`.
185
+ */
186
+ dataToRemoveJSONString?: string;
187
+ /**
188
+ * @property dataToAddOrPatchJSONString - Data object that contains only additive information for ibGib's intrinsic data.
189
+ * Disallowed paths include: \`${DISALLOWED_DATA_PATHS.join('`, `')}\`.
190
+ *
191
+ * JSON.stringified version of the dataToAddOrPatchJSONString. This is to overcome the
192
+ * poor OpenAPI schema limitations, because we do not know the exact allowed
193
+ * properties ahead of time.
194
+ */
195
+ dataToAddOrPatchJSONString?: string;
196
+ /**
197
+ * @property mut8Ib - If given, will mut8 the ib (without forking the entire ibGib).
198
+ */
199
+ mut8Ib?: string;
200
+ /**
201
+ * used in simplified functions
202
+ */
203
+ newName?: string;
204
+ /**
205
+ * used in simplified functions
206
+ */
207
+ newDescription?: string;
208
+ }
209
+
210
+ /**
211
+ * @interface Mut8IbGibCommandData - Command data for the mut8IbGib command.
212
+ * @extends CommandDataBase
213
+ */
214
+ export interface Mut8IbGibCommandData extends CommandDataBase<typeof CMD_CATEGORY, [typeof FUNCTION_NAME]> {
215
+ spaceId?: string;
216
+ /**
217
+ * @see {@link Mut8IbGibOpts.ibGibAddr}
218
+ */
219
+ ibGibAddr: string;
220
+ /**
221
+ * @see {@link Mut8IbGibOpts.dataToRenameJSONString}
222
+ */
223
+ dataToRenameJSONString?: string;
224
+ /**
225
+ * @see {@link Mut8IbGibOpts.dataToRemoveJSONString}
226
+ */
227
+ dataToRemoveJSONString?: string;
228
+ /**
229
+ * @see {@link Mut8IbGibOpts.dataToAddOrPatchJSONString}
230
+ */
231
+ dataToAddOrPatchJSONString?: string;
232
+ /**
233
+ * @see {@link Mut8IbGibOpts.mut8Ib} If given, will mut8 the ib (without forking the entire ibGib).
234
+ */
235
+ mut8Ib?: string;
236
+ /**
237
+ * used in simplified functions
238
+ */
239
+ newName?: string;
240
+ /**
241
+ * used in simplified functions
242
+ */
243
+ newDescription?: string;
244
+ }
245
+
246
+ /**
247
+ * Wrapper function to enqueue the mut8IbGib command.
248
+ * @param {Mut8IbGibOpts} opts - @see {@link Mut8IbGibOpts}
249
+ * @returns {Promise<void>} A promise that resolves when the command finishes execution.
250
+ */
251
+ export function mut8IbGibViaCmd(opts: Mut8IbGibOpts): Promise<IbGib_V1> {
252
+ const commandService = getCommandService();
253
+ const command: Mut8IbGibCommandData = {
254
+ ...opts,
255
+ cmd: CMD_CATEGORY,
256
+ cmdModifiers: CMD_MODIFIERS,
257
+ mut8Ib: opts.mut8Ib?.trim() || undefined, // Ensure mut8Ib is not an empty string
258
+ };
259
+ return new Promise<IbGib_V1>((resolve, reject) => {
260
+ commandService.enqueueCommand({ command, resolve, reject });
261
+ });
262
+ }
263
+
264
+ /**
265
+ * Implementation function for the mut8IbGib command.
266
+ *
267
+ * @param {Mut8IbGibOpts} opts - @see {@link Mut8IbGibOpts}
268
+ * @returns {Promise<IbGib_V1>} the new timeline ibgib
269
+ */
270
+ export async function mut8IbGibImpl(opts: Mut8IbGibOpts): Promise<IbGib_V1> {
271
+ const lc = `[${mut8IbGibImpl.name}]`;
272
+ try {
273
+ if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
274
+
275
+ console.log(`${lc} ${CMD_CATEGORY} ${CMD_MODIFIERS} opts: ${pretty(opts)}`);
276
+
277
+ let {
278
+ spaceId,
279
+ ibGibAddr, dataToRenameJSONString, dataToRemoveJSONString,
280
+ dataToAddOrPatchJSONString, mut8Ib, newName, newDescription,
281
+ } = opts;
282
+
283
+ const metaspace = await getGlobalMetaspace_waitIfNeeded();
284
+ if (!metaspace) { throw new Error(`${lc} metaspace falsy (E: 1a3f5e6c8d9a7b01f2e3d4c5b6a708d9)`); }
285
+ const space = await metaspace.getLocalUserSpace({ localSpaceId: spaceId });
286
+ if (!space) {
287
+ if (!spaceId) {
288
+ throw new Error(`(UNEXPECTED) couldn't get default local user space? (E: 593028fc4038c1cb713a8b1d757da825)`);
289
+ } else {
290
+ throw new Error(`could not get local user space for spaceId (${spaceId}) (E: 61fc28fbdf3fd69ae7c9214fe74c2825)`);
291
+ }
292
+ }
293
+
294
+ if (newName || newDescription !== undefined) {
295
+ if (newName) {
296
+ if (dataToAddOrPatchJSONString) { throw new Error(`cannot have newName and dataToAddOrPatchJSONString in the same function call. (E: 72bf6c3c8d8e18a9284f5b0e16d63525)`); }
297
+ dataToAddOrPatchJSONString = JSON.stringify({ name: newName });
298
+ const newSafeName = getProjectSafeName({ name: newName });
299
+ const latestIbGibAddr = await metaspace.getLatestAddr({ addr: ibGibAddr, space });
300
+ const { ib: projectIb } = getIbAndGib({ ibGibAddr: latestIbGibAddr });
301
+ const { addlMetadataText, atom, } = parseProjectIb({ ib: projectIb });
302
+ mut8Ib = `${atom} ${newSafeName} ${addlMetadataText}`;
303
+ if (newDescription) {
304
+ dataToAddOrPatchJSONString = JSON.stringify({ description: newDescription });
305
+ }
306
+ } else {
307
+ dataToAddOrPatchJSONString = JSON.stringify({ description: newDescription });
308
+ }
309
+ }
310
+ const dataToRename = dataToRenameJSONString ?
311
+ JSON.parse(dataToRenameJSONString) :
312
+ undefined;
313
+ const dataToRemove = dataToRemoveJSONString ?
314
+ JSON.parse(dataToRemoveJSONString) :
315
+ undefined;
316
+ const dataToAddOrPatch = dataToAddOrPatchJSONString ?
317
+ JSON.parse(dataToAddOrPatchJSONString) :
318
+ undefined;
319
+
320
+ if (!ibGibAddr) { throw new Error(`${lc} ibGibAddr is required. (E: genuuid)`); }
321
+
322
+ // 1. Load the project ibGib
323
+
324
+ // 2. Filter out disallowed paths from the mut8 options.
325
+ // Note: filterDisallowedPaths handles nested paths as well.
326
+ const fnValidateMap = (map: any, paramName: string) => {
327
+ if (!map) { return; /* <<<< returns early */ }
328
+ const mapKeys = Object.keys(map);
329
+ mapKeys.forEach(key => {
330
+ if (DISALLOWED_DATA_KEYS.includes(key)) {
331
+ throw new Error(`invalid map. includes disallowed path/key: ${key}. cannot contain any of the following keys: ${DISALLOWED_DATA_KEYS} (E: 855afe854d78e4bf68e7ad88798d0825) (E: fc9c2c9549783685c859c3c4fbb84825)`);
332
+ }
333
+ })
334
+ }
335
+
336
+ if (dataToRename) { fnValidateMap(dataToRename, 'dataToRename'); }
337
+ if (dataToRemove) { fnValidateMap(dataToRemove, 'dataToRemove'); }
338
+ if (dataToAddOrPatch) { fnValidateMap(dataToAddOrPatch, 'dataToAddOrPatch'); }
339
+ if (mut8Ib) {
340
+ const invalidChars = ['^'];
341
+ invalidChars.forEach(x => {
342
+ if (mut8Ib!.includes(x)) {
343
+ throw new Error(`invalid mut8Ib property. includes character: ${x}. Cannot include any of the following characters: ${invalidChars} (E: 855afe854d78e4bf68e7ad88798d0825)`);
344
+ }
345
+ });
346
+ if (typeof mut8Ib !== 'string' || mut8Ib.length === 0) {
347
+ throw new Error(`${lc} mut8Ib must be a non-empty string. (E: 392678cef0a5458e0e4bca6869dc6825)`);
348
+ }
349
+ }
350
+
351
+ // 3. Perform the mut8 transform
352
+ if (logalot) { console.log(`${lc} Mutating timeline ibGib... (I: genuuid)`); }
353
+ const newTimelineIbGib = await mut8Timeline({
354
+ timelineAddr: ibGibAddr,
355
+ mut8Opts: {
356
+ dataToRename,
357
+ dataToRemove,
358
+ dataToAddOrPatch,
359
+ mut8Ib,
360
+ },
361
+ metaspace,
362
+ space,
363
+ });
364
+
365
+ if (!newTimelineIbGib) {
366
+ throw new Error(`${lc} Mutate timeline transform failed: No new timeline ibGib returned. (E: genuuid)`);
367
+ }
368
+
369
+ console.log(`${lc} Mutated timeline ibGib processed.`);
370
+
371
+ return newTimelineIbGib;
372
+ } catch (error) {
373
+ console.error(`${lc} ${extractErrorMsg(error)}`);
374
+ throw error; // Re-throw the error to be caught by the command service
375
+ } finally {
376
+ // This finally block will execute regardless of whether the try block succeeds or fails.
377
+ if (logalot) { console.log(`${lc} complete.`); }
378
+ }
379
+ }
380
+
381
+ /**
382
+ * OpenAPI schema for the ibGibAddr parameter.
383
+ */
384
+ const GEMINI_SCHEMA_PROJECT_ADDR = {
385
+ type: 'string',
386
+ description: 'The address (or tjp address) of the project ibGib to edit.',
387
+ };
388
+
389
+ /**
390
+ * Helper to create OpenAPI schema for data objects with disallowed paths.
391
+ */
392
+ function getDataSchema({
393
+ description,
394
+ disallowedPaths,
395
+ }: {
396
+ description: string,
397
+ disallowedPaths: string[],
398
+ }): any {
399
+ return {
400
+ type: 'object',
401
+ description: `${description} Disallowed paths include: ${disallowedPaths.join(', ')}.`,
402
+ // We can't define specific properties here because the structure is dynamic,
403
+ // but we emphasize the disallowed paths in the description.
404
+ additionalProperties: true, // Allow any other properties
405
+ };
406
+ }
407
+
408
+ /**
409
+ * API function info for the mut8IbGib command.
410
+ */
411
+ export const mut8IbGibFunctionInfo: APIFunctionInfo<typeof mut8IbGibViaCmd> = {
412
+ nameOrId: FUNCTION_NAME,
413
+ fnViaCmd: mut8IbGibViaCmd,
414
+ functionImpl: mut8IbGibImpl,
415
+ cmd: CMD_CATEGORY,
416
+ cmdModifiers: CMD_MODIFIERS,
417
+ schema: MUT8_IBGIB_SCHEMA,
418
+ };
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @module api-function-info.template is a template for implementing api function infos (obviously).
3
+ *
4
+ * ## notes
5
+ *
6
+ * ### ordering imports
7
+ *
8
+ * import sections always go:
9
+ * 1. non-ibgib deps first (rare)
10
+ * 2. @ibgib/helper-gib, @ibgib/encrypt-gib, @ibgib/ts-gib, @ibgib/core-gib packages (in that order)
11
+ * 3. import GLOBAL_LOG_A_LOT then remaining project imports
12
+ * 4. code proper starts with the definition of `const logalot` (if applicable)
13
+ *
14
+ * There is a blank line between these sections.
15
+ *
16
+ */
17
+
18
+
19
+ import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
20
+ // import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
21
+ // import { rel8 } from "@ibgib/ts-gib/dist/V1/transforms/rel8.mjs";
22
+ // import { getIbAndGib, getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
23
+ // import { IbGibAddr, TransformResult } from "@ibgib/ts-gib/dist/types.mjs";
24
+ // import { isPrimitive } from "@ibgib/ts-gib/dist/V1/index.mjs";
25
+ // import { toDto } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
26
+
27
+ import { GLOBAL_LOG_A_LOT } from "../../../constants.mjs";
28
+ import { APIFunctionInfo } from "../../api-types.mjs";
29
+ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
30
+ import { getCommandService } from "../command-service-v1.mjs";
31
+ import { CommandDataBase } from "../command-types.mjs";
32
+ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
33
+ // import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.web.mjs";
34
+
35
+ const logalot = GLOBAL_LOG_A_LOT;
36
+
37
+ // #region constants
38
+
39
+ /**
40
+ * camelCased name of the command itself.
41
+ */
42
+ const FUNCTION_NAME = 'fooBar';
43
+
44
+ /**
45
+ * fooCategory could be 'agent', 'renderable', etc. It's the broad command which
46
+ * basically acts like a category of commands at this point.
47
+ *
48
+ * If an agent is generating this, ask me what this should be before going forward.
49
+ */
50
+ const CMD_CATEGORY = 'fooCategory';
51
+ /**
52
+ * fooBar here is the specific command modifier which narrows down to a command
53
+ * instance, similar to a fully curried function.
54
+ *
55
+ * This should be camelCased actual name of the function.
56
+ */
57
+ const CMD_MODIFIERS: string[] = [FUNCTION_NAME];
58
+
59
+ const EXAMPLE_INPUT_FOOBAR: Partial<FooBarOpts> = {
60
+ fooArgString: 'This is an example string',
61
+ fooArgArray: 'This is an example string',
62
+ notesToSelf: `Example of a ${FUNCTION_NAME} function call.`,
63
+ repromptWithResult: false,
64
+ };
65
+ const EXAMPLES = [
66
+ // `\`\`\`typescript\n${FUNCTION_CALL_EXAMPLES_HEADER}\n${pretty(EXAMPLE_INPUT_FOOBAR)}\n\`\`\``,
67
+ FUNCTION_CALL_EXAMPLES_HEADER,
68
+ pretty(EXAMPLE_INPUT_FOOBAR),
69
+ ].join('\n');
70
+ const FUNCTION_DESCRIPTION = [
71
+ `Enter the description here.`,
72
+ '',
73
+ EXAMPLES,
74
+ ].join('\n');
75
+ // #endregion constants
76
+
77
+ /**
78
+ * @interface FooBarOpts - Options for the fooBar command.
79
+ *
80
+ * @extends CommandDataBase
81
+ */
82
+ export interface FooBarOpts extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
83
+ /**
84
+ * @property fooArgString - always include the docs here in the opts interface
85
+ */
86
+ fooArgString: string;
87
+ /**
88
+ * @property fooArgArray - always include the docs here in the opts interface
89
+ */
90
+ fooArgArray: string;
91
+ }
92
+
93
+ /**
94
+ * @interface FooBarCommandData - Command data for the fooBar command.
95
+ * @extends CommandDataBase
96
+ */
97
+ export interface FooBarCommandData extends CommandDataBase<'agent', ['fooBar']> {
98
+ /**
99
+ * @see {@link FooBarOpts.fooArgString}
100
+ */
101
+ fooArgString: string;
102
+ /**
103
+ * @see {@link FooBarOpts.fooArgArray}
104
+ */
105
+ fooArgArray: string;
106
+ }
107
+
108
+ /**
109
+ * Wrapper function to enqueue the fooBar command.
110
+ * @param {FooBarOpts} opts - @see {@link FooBarOpts}
111
+ * @returns {Promise<void>} A promise that resolves when the command finishes execution.
112
+ */
113
+ function fooBarViaCmd(opts: FooBarOpts): Promise<void> {
114
+ const commandService = getCommandService();
115
+ const command: FooBarCommandData = {
116
+ cmd: CMD_CATEGORY,
117
+ cmdModifiers: CMD_MODIFIERS,
118
+ fooArgString: opts.fooArgString,
119
+ fooArgArray: opts.fooArgArray,
120
+ repromptWithResult: opts.repromptWithResult,
121
+ notesToSelf: opts.notesToSelf,
122
+ };
123
+ return new Promise<void>((resolve, reject) => {
124
+ commandService.enqueueCommand({ command, resolve, reject });
125
+ });
126
+ }
127
+
128
+ /**
129
+ * Implementation function for the fooBar command.
130
+ *
131
+ * @param {FooBarOpts} opts - @see {@link FooBarOpts}
132
+ * @returns {Promise<void>} A promise that resolves when the command is executed.
133
+ */
134
+ async function fooBarImpl(opts: FooBarOpts): Promise<void> {
135
+ const lc = `[${fooBarImpl.name}]`;
136
+ try {
137
+ if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
138
+
139
+ console.log(`${lc} ${CMD_CATEGORY} ${CMD_MODIFIERS} opts: ${pretty(opts)}`);
140
+
141
+ // actual implementation goes here
142
+
143
+ } catch (error) {
144
+ console.error(`${lc} ${extractErrorMsg(error)}`);
145
+ throw error;
146
+ } finally {
147
+ if (logalot) { console.log(`${lc} complete.`); }
148
+ }
149
+ }
150
+
151
+ /**
152
+ * example of OpenAPI shape of a string declaration
153
+ */
154
+ const GEMINI_SCHEMA_FOO_ARG_STRING = {
155
+ type: 'string',
156
+ description: 'fooArgString is a prop that...',
157
+ }
158
+
159
+ function getGeminiArraySchemaOfItem({
160
+ itemSchema,
161
+ description,
162
+ }: {
163
+ itemSchema: any,
164
+ description: string,
165
+ }): any {
166
+ return {
167
+ type: 'array',
168
+ description,
169
+ items: itemSchema,
170
+ };
171
+ }
172
+
173
+ const GEMINI_SCHEMA_FOO_ARG_ARRAY_ITEM = {
174
+ type: 'object',
175
+ description: 'fooArgArray item is an item that...',
176
+ properties: {
177
+ someString: GEMINI_SCHEMA_FOO_ARG_STRING,
178
+ },
179
+ required: ['someString'],
180
+ }
181
+
182
+ const GEMINI_SCHEMA_FOO_ARG_ARRAY = getGeminiArraySchemaOfItem({
183
+ itemSchema: GEMINI_SCHEMA_FOO_ARG_ARRAY_ITEM,
184
+ description: 'fooArgArray is a prop that...',
185
+ });
186
+
187
+ /**
188
+ * API function info for the fooBar command.
189
+ */
190
+ export const fooBarFunctionInfo: APIFunctionInfo<typeof fooBarViaCmd> = {
191
+ nameOrId: FUNCTION_NAME,
192
+ fnViaCmd: fooBarViaCmd,
193
+ functionImpl: fooBarImpl,
194
+ cmd: CMD_CATEGORY,
195
+ cmdModifiers: CMD_MODIFIERS,
196
+ schema: {
197
+ name: FUNCTION_NAME,
198
+ description: FUNCTION_DESCRIPTION,
199
+ parameters: {
200
+ type: 'object',
201
+ properties: {
202
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
203
+ fooArgString: GEMINI_SCHEMA_FOO_ARG_STRING,
204
+ fooArgArray: GEMINI_SCHEMA_FOO_ARG_ARRAY,
205
+ },
206
+ required: [
207
+ 'fooArgString', // comment out/remove if optional
208
+ 'fooArgArray', // comment out/remove if optional
209
+ ],
210
+ },
211
+ },
212
+ };