@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,196 @@
1
+ import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+ import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
3
+ import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
4
+
5
+ import { GLOBAL_LOG_A_LOT } from "../../../constants.mjs";
6
+ import { APIFunctionInfo } from "../../api-types.mjs";
7
+ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
8
+ import { getCommandService } from "../command-service-v1.mjs";
9
+ import { CommandDataBase } from "../command-types.mjs";
10
+ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
11
+ import { GEMINI_SCHEMA_AGENT_ID, GEMINI_SCHEMA_AGENT_TYPE } from "../../../witness/agent/agent-constants.mjs";
12
+ import { getAgentsSvc } from "../../../witness/agent/agents-service-v1.mjs";
13
+ import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.web.mjs";
14
+
15
+ const logalot = GLOBAL_LOG_A_LOT;
16
+
17
+ // #region constants
18
+ const EXAMPLE_INPUT_GETCONTEXTINFO: Partial<GetContextInfoOpts> = {
19
+ agentId: 'someidprobablylookslikeahash',
20
+ agentType: 'sometypehere',
21
+ notesToSelf: 'Example of a getContextInfo function call. DO NOT USE THESE AS YOUR ACTUAL ARGS. THIS IS ONLY AN EXAMPLE TO SHOW THE SHAPE OF THE FUNCTION CALL!!',
22
+ repromptWithResult: true,
23
+ };
24
+
25
+ const EXAMPLES = [
26
+ // `\`\`\`typescript\n${FUNCTION_CALL_EXAMPLES_HEADER}\n${pretty(EXAMPLE_INPUT_GETCONTEXTINFO)}\n\`\`\``,
27
+ FUNCTION_CALL_EXAMPLES_HEADER,
28
+ pretty(EXAMPLE_INPUT_GETCONTEXTINFO),
29
+ ].join('\n');
30
+ // #endregion constants
31
+
32
+
33
+ /**
34
+ * @interface CommandResultBase - Base interface for command results.
35
+ *
36
+ * ## notes
37
+ *
38
+ * I'm adding this after already having created several existing commands in
39
+ * order to include an errorMsg. I want commands to return info about errors and
40
+ * not re-throw. I am not integrating this with all existing commands at this
41
+ * time though, so there will be some irregularity.
42
+ *
43
+ * I did go ahead and change the code in the command service to return
44
+ * `{errorMsg}` if an exception is thrown.
45
+ */
46
+ export interface CommandResultBase {
47
+ /**
48
+ * IIF the command errors out, this will be populated.
49
+ */
50
+ errorMsg?: string;
51
+ }
52
+
53
+ /**
54
+ * @interface GetContextInfoOpts - Options for the getContextInfo command.
55
+ * @extends CommandDataBase
56
+ */
57
+ export interface GetContextInfoOpts extends CommandDataBase<'agent', ['getContextInfo']> {
58
+ /**
59
+ * @property agentId - the agent's unique identifier.
60
+ */
61
+ agentId: string;
62
+ /**
63
+ * @property agentType - type of the agent that corresponds to the basic
64
+ * responsibilities of the agent
65
+ */
66
+ agentType: string;
67
+ }
68
+
69
+ export interface GetContextInfoResult extends CommandResultBase {
70
+ contextAddr: IbGibAddr;
71
+ contextIbGib: IbGib_V1;
72
+ latestContextAddr?: IbGibAddr;
73
+ latestContextIbGib?: IbGib_V1;
74
+ }
75
+
76
+ /**
77
+ * @interface GetContextInfoCommandData - Command data for the getContextInfo command.
78
+ * @extends CommandDataBase
79
+ */
80
+ export interface GetContextInfoCommandData extends CommandDataBase<'agent', ['getContextInfo']> {
81
+ /**
82
+ * @property agentId - the agent's unique identifier.
83
+ */
84
+ agentId: string;
85
+ /**
86
+ * @property agentType - type of the agent that corresponds to the basic
87
+ * responsibilities of the agent
88
+ */
89
+ agentType: string;
90
+ }
91
+
92
+ /**
93
+ * Wrapper function to enqueue the getContextInfo command.
94
+ * @param {GetContextInfoOpts} opts - Options for telling the user something.
95
+ * @returns {Promise<void>} A promise that resolves when the command is enqueued.
96
+ */
97
+ function getContextInfoViaCmd(opts: GetContextInfoOpts): Promise<GetContextInfoResult> {
98
+ const commandService = getCommandService();
99
+ const command: GetContextInfoCommandData = {
100
+ cmd: 'agent',
101
+ cmdModifiers: ['getContextInfo'],
102
+ agentId: opts.agentId,
103
+ agentType: opts.agentType,
104
+ repromptWithResult: opts?.repromptWithResult,
105
+ notesToSelf: opts?.notesToSelf,
106
+ };
107
+ return new Promise<GetContextInfoResult>((resolve, reject) => {
108
+ commandService.enqueueCommand({ command, resolve, reject });
109
+ });
110
+ }
111
+
112
+ /**
113
+ * Implementation function for the getContextInfo command (atow, does nothing other than resolve).
114
+ * @param {GetContextInfoOpts} opts - Options for telling the user something.
115
+ * @returns {Promise<void>} A promise that resolves when the command is executed (immediately).
116
+ */
117
+ async function getContextInfoImpl(opts: GetContextInfoOpts): Promise<GetContextInfoResult> {
118
+ const lc = `[${getContextInfoImpl.name}]`;
119
+ try {
120
+ if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
121
+
122
+ const { agentId, agentType, } = opts;
123
+
124
+ // In the actual implementation, this function might trigger some UI update
125
+ // or logging, but for now, it's just a placeholder.
126
+ // debugger; // walk through get-context-info command
127
+
128
+ // should get the agent
129
+ const agentsSvc = getAgentsSvc();
130
+ const agent = await agentsSvc.getAgentById({ agentId, agentType });
131
+ if (!agent) { throw new Error(`agent not found for opts: ${pretty(opts)} (E: b0da990f27c85c29e5bf148299507225)`); }
132
+ if (!agent.data) { throw new Error(`(UNEXPECTED) agent.data is falsy? opts: ${pretty(opts)} (E: a8b357b5c68e5485144e2358d1a60425)`); }
133
+
134
+ // get the context info here
135
+ const metaspace = await getGlobalMetaspace_waitIfNeeded();
136
+ const contextAddr = agent.data["@currentContextTjpAddr"];
137
+ const superSpaceId = agent.data.superSpaceId;
138
+ const superSpace = await metaspace.getLocalUserSpace({ localSpaceId: superSpaceId, lock: false });
139
+ const resGetContext = await metaspace.get({
140
+ addrs: [contextAddr],
141
+ space: superSpace,
142
+ });
143
+ if (resGetContext.errorMsg || (resGetContext.ibGibs ?? []).length !== 1) {
144
+ throw new Error(`couldn't get context ibgib (${contextAddr}) from super space (${superSpaceId}). errorMsg: ${resGetContext.errorMsg ?? '[unknown error]'} (E: 63514d4521e1dc26860354ccbcb02125)`);
145
+ }
146
+ const contextIbGib = resGetContext.ibGibs!.at(0)!
147
+ let latestContextIbGib: IbGib_V1 | undefined = undefined;
148
+ const latestContextAddr = await metaspace.getLatestAddr({ ibGib: contextIbGib, space: superSpace });
149
+ if (latestContextAddr) {
150
+ const resGetLatest = await metaspace.get({
151
+ addrs: [latestContextAddr], space: superSpace
152
+ });
153
+ if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
154
+ throw new Error(`couldn't get latest context ibgib (${latestContextAddr}) from super space (${superSpaceId}). errorMsg: ${resGetLatest.errorMsg ?? '[unknown error]'} (E: 450727cc12e226f8b741dd7b0efbfe25)`);
155
+ }
156
+ latestContextIbGib = resGetLatest.ibGibs!.at(0)!;
157
+ }
158
+
159
+ return {
160
+ contextAddr,
161
+ contextIbGib,
162
+ latestContextAddr,
163
+ latestContextIbGib,
164
+ }
165
+ } catch (error) {
166
+ const errorMsg = `${lc} ${extractErrorMsg(error)}`;
167
+ console.error(errorMsg);
168
+ throw new Error(errorMsg);
169
+ } finally {
170
+ if (logalot) { console.log(`${lc} complete.`); }
171
+ }
172
+ }
173
+
174
+ /**
175
+ * API function info for the getContextInfo command.
176
+ */
177
+ export const getContextInfoFunctionInfo: APIFunctionInfo<typeof getContextInfoViaCmd> = {
178
+ nameOrId: 'getContextInfo',
179
+ fnViaCmd: getContextInfoViaCmd,
180
+ functionImpl: getContextInfoImpl,
181
+ cmd: 'agent',
182
+ cmdModifiers: ['getContextInfo'],
183
+ schema: {
184
+ name: 'getContextInfo',
185
+ description: `Gets context info *about your current context ibgib in which you are conversing*. For example, agent's must always "be" in a single location ibgib which is their current primary context. When this ibgib's timeline changes (when a mut8/rel8 happens on it and a new ibgib frame is registered with the metaspace and published via the metaspace's pubsub mechanism), then the agent will be made aware of the new children ibgibs added to that timeline. The context address will probably be the TJP address as this defines the timeline's starting point and is used to refer to the entire timeline. Note that the context will always be in the agent's super space.\nNOTE: This function DOES NOT get any and all context info, e.g., it does not get the website's current css colors. It is specifically to get info regarding YOUR CURRENT default context ibgib info.\n\n${EXAMPLES}`,
186
+ parameters: {
187
+ type: 'object',
188
+ properties: {
189
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
190
+ agentId: GEMINI_SCHEMA_AGENT_ID,
191
+ agentType: GEMINI_SCHEMA_AGENT_TYPE,
192
+ },
193
+ required: ['agentId', 'agentType'],
194
+ },
195
+ },
196
+ };
@@ -0,0 +1,183 @@
1
+ import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+
3
+ import { GLOBAL_LOG_A_LOT } from "../../../constants.mjs";
4
+ import { APIFunctionInfo } from "../../api-types.mjs";
5
+ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
6
+ import { getCommandService } from "../command-service-v1.mjs";
7
+ import { CommandDataBase } from "../command-types.mjs";
8
+ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
9
+ import { AGENT_NAME_REGEXP, GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME } from "../../../witness/agent/agent-constants.mjs";
10
+ import { getAgentsSvc } from "../../../witness/agent/agents-service-v1.mjs";
11
+
12
+ const logalot = GLOBAL_LOG_A_LOT;
13
+
14
+ // #region constants
15
+
16
+ /**
17
+ * camelCased name of the command itself.
18
+ */
19
+ const FUNCTION_NAME = 'helloWorld';
20
+
21
+ /**
22
+ * chat category here as this is a chat-related command.
23
+ */
24
+ const CMD_CATEGORY = 'agent';
25
+ /**
26
+ * helloWorld here is the specific command modifier which narrows down to a command
27
+ * instance, similar to a fully curried function.
28
+ */
29
+ const CMD_MODIFIERS: string[] = [FUNCTION_NAME];
30
+
31
+ // #endregion constants
32
+
33
+ // #region constants
34
+ const EXAMPLE_INPUT_HELLOWORLD: Partial<HelloWorldOpts> = {
35
+ agentsSelfIdentifiedName: 'Coolguy',
36
+ agentId: 'someidprobablylookslikeahash',
37
+ agentType: 'sometypehere',
38
+ notesToSelf: 'Example of a helloWorld function call. DO NOT USE THESE AS YOUR ACTUAL NAME/ID/TYPE! THIS IS ONLY AN EXAMPLE TO SHOW THE SHAPE OF THE FUNCTION CALL!!',
39
+ repromptWithResult: false,
40
+ };
41
+
42
+ const EXAMPLES = [
43
+ // `\`\`\`typescript\n${FUNCTION_CALL_EXAMPLES_HEADER}\n${pretty(EXAMPLE_INPUT_HELLOWORLD)}\n\`\`\``,
44
+ FUNCTION_CALL_EXAMPLES_HEADER,
45
+ pretty(EXAMPLE_INPUT_HELLOWORLD),
46
+ ].join('\n');
47
+ // #endregion constants
48
+ const FUNCTION_DESCRIPTION = [
49
+ `Introductory function that does a couple things. First, it just makes sure that the basic function calling plumbing is working with the agent. Next, it also confirms the agent is aware of his/her/its id and type. Also, it empowers the agent to choose his/her/its own name with which to interact with user(s) and other agent(s) (only one user implemented atow 04/2025).NOTE: This does not say anything to the user proper. You have to call tellUser (or some other function in the future possibly) to converse with the user. This function only does init.`,
50
+ EXAMPLES,
51
+ ].join('\n');
52
+
53
+
54
+ const GEMINI_SCHEMA_AGENT_ID = {
55
+ type: 'string',
56
+ description: 'unique identifier for the agent. Should be provided to the agent in system instructions upon creation.',
57
+ };
58
+
59
+ const GEMINI_SCHEMA_AGENT_TYPE = {
60
+ type: 'string',
61
+ description: 'type of the agent that governs basic responsibilities. Should be provided to the agent in system instructions upon creation.',
62
+ };
63
+
64
+ /**
65
+ * @interface HelloWorldOpts - Options for the helloWorld command.
66
+ * @extends CommandDataBase
67
+ */
68
+ export interface HelloWorldOpts extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
69
+ /**
70
+ * @property agentsSelfIdentifiedName - the name which the agent chooses to
71
+ * use to represent him/her/itself.
72
+ */
73
+ agentsSelfIdentifiedName: string;
74
+ /**
75
+ * @property agentId - the agent's unique identifier.
76
+ */
77
+ agentId: string;
78
+ /**
79
+ * @property agentType - type of the agent that corresponds to the basic
80
+ * responsibilities of the agent
81
+ */
82
+ agentType: string;
83
+ }
84
+
85
+ /**
86
+ * @interface HelloWorldCommandData - Command data for the helloWorld command.
87
+ * @extends CommandDataBase
88
+ */
89
+ export interface HelloWorldCommandData extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
90
+ /**
91
+ * @see {@link HelloWorldOpts.agentsSelfIdentifiedName}
92
+ */
93
+ agentsSelfIdentifiedName: string;
94
+ /**
95
+ * @see {@link HelloWorldOpts.agentId}
96
+ */
97
+ agentId: string;
98
+ /**
99
+ * @see {@link HelloWorldOpts.agentType}
100
+ */
101
+ agentType: string;
102
+ }
103
+
104
+ /**
105
+ * Wrapper function to enqueue the helloWorld command.
106
+ * @param {HelloWorldOpts} opts - Options for telling the user something.
107
+ * @returns {Promise<void>} A promise that resolves when the command is enqueued.
108
+ */
109
+ function helloWorldViaCmd(opts: HelloWorldOpts): Promise<void | { errorMsg: string }> {
110
+ const commandService = getCommandService();
111
+ const command: HelloWorldCommandData = {
112
+ ...opts,
113
+ cmd: CMD_CATEGORY,
114
+ cmdModifiers: CMD_MODIFIERS,
115
+ // agentsSelfIdentifiedName: opts.agentsSelfIdentifiedName,
116
+ // agentId: opts.agentId,
117
+ // agentType: opts.agentType,
118
+ // repromptWithResult: opts?.repromptWithResult,
119
+ // notesToSelf: opts?.notesToSelf,
120
+ };
121
+ return new Promise<void>((resolve, reject) => {
122
+ commandService.enqueueCommand({ command, resolve, reject });
123
+ });
124
+ }
125
+
126
+ /**
127
+ * Implementation function for the helloWorld command (atow, does nothing other than resolve).
128
+ * @param {HelloWorldOpts} opts - Options for telling the user something.
129
+ * @returns {Promise<void>} A promise that resolves when the command is executed (immediately).
130
+ */
131
+ async function helloWorldImpl(opts: HelloWorldOpts): Promise<void | { errorMsg: string }> {
132
+ const lc = `[${helloWorldImpl.name}]`;
133
+ try {
134
+ if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
135
+
136
+ const { agentId, agentType, agentsSelfIdentifiedName } = opts;
137
+
138
+ // In the actual implementation, this function might trigger some UI update
139
+ // or logging, but for now, it's just a placeholder.
140
+ // debugger; // walk through hello-world command
141
+
142
+ // should get the agent
143
+ const agentsSvc = getAgentsSvc();
144
+ const agent = await agentsSvc.getAgentById({ agentId, agentType });
145
+ if (!agent) { throw new Error(`agent not found for opts: ${pretty(opts)} (E: b0da990f27c85c29e5bf148299507225)`); }
146
+
147
+ // this does the name validation, throws if invalid
148
+ await agent.updateName({ name: agentsSelfIdentifiedName });
149
+ // debugger; // does this get hit?
150
+ } catch (error) {
151
+ debugger; // error in helloworld
152
+ const errorMsg = `${lc} ${extractErrorMsg(error)}`;
153
+ console.error(errorMsg);
154
+ return { errorMsg };
155
+ } finally {
156
+ if (logalot) { console.log(`${lc} complete.`); }
157
+ }
158
+ }
159
+
160
+ /**
161
+ * API function info for the helloWorld command.
162
+ */
163
+ export const helloWorldFunctionInfo: APIFunctionInfo<typeof helloWorldViaCmd> = {
164
+ nameOrId: FUNCTION_NAME,
165
+ fnViaCmd: helloWorldViaCmd,
166
+ functionImpl: helloWorldImpl,
167
+ cmd: CMD_CATEGORY,
168
+ cmdModifiers: CMD_MODIFIERS,
169
+ schema: {
170
+ name: FUNCTION_NAME,
171
+ description: FUNCTION_DESCRIPTION,
172
+ parameters: {
173
+ type: 'object',
174
+ properties: {
175
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
176
+ agentsSelfIdentifiedName: GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME,
177
+ agentId: GEMINI_SCHEMA_AGENT_ID,
178
+ agentType: GEMINI_SCHEMA_AGENT_TYPE,
179
+ },
180
+ required: ['agentsSelfIdentifiedName', 'agentId', 'agentType'],
181
+ },
182
+ },
183
+ };
@@ -0,0 +1,241 @@
1
+ import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+ import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
3
+ import { validateIbGibAddr } from "@ibgib/ts-gib/dist/V1/validate-helper.mjs";
4
+ import { getIbAndGib, } from "@ibgib/ts-gib/dist/helper.mjs";
5
+ import { IbGibAddr, } from "@ibgib/ts-gib/dist/types.mjs";
6
+ import { isPrimitive } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
7
+ import { appendToTimeline } from "@ibgib/core-gib/dist/timeline/timeline-api.mjs";
8
+ import { createCommentIbGib } from "@ibgib/core-gib/dist/common/comment/comment-helper.mjs";
9
+
10
+ import { GLOBAL_LOG_A_LOT } from "../../../constants.mjs";
11
+ import { APIFunctionInfo } from "../../api-types.mjs";
12
+ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
13
+ import { getCommandService } from "../command-service-v1.mjs";
14
+ import { CommandDataBase } from "../command-types.mjs";
15
+ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
16
+ import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.web.mjs";
17
+ import {
18
+ getAddlMetadataTextForAgentText,
19
+ } from "../../../witness/agent/agent-one-file.mjs";
20
+ import { GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME, TextSource } from "../../../witness/agent/agent-constants.mjs";
21
+
22
+ const logalot = GLOBAL_LOG_A_LOT;
23
+
24
+ // #region constants
25
+ const FUNCTION_NAME = 'tellUser';
26
+
27
+ /**
28
+ * chat category here as this is a chat-related command.
29
+ */
30
+ const CMD_CATEGORY = 'agent';
31
+ /**
32
+ * helloWorld here is the specific command modifier which narrows down to a command
33
+ * instance, similar to a fully curried function.
34
+ */
35
+ const CMD_MODIFIERS: string[] = [FUNCTION_NAME];
36
+ const EXAMPLE_INPUT_TELLUSER: Partial<TellUserOpts> = {
37
+ text: 'Hello user, this is an example of how I can tell you something!',
38
+ agentName: 'Zarquon',
39
+ notesToSelf: 'Example of a tellUser function call. Note repromptWithResult is false b/c it is ignored with tellUser cmd.',
40
+ repromptWithResult: false,
41
+ };
42
+
43
+ const EXAMPLES = [
44
+ // `\`\`\`typescript\n${FUNCTION_CALL_EXAMPLES_HEADER}\n${pretty(EXAMPLE_INPUT_TELLUSER)}\n\`\`\``,
45
+ FUNCTION_CALL_EXAMPLES_HEADER,
46
+ pretty(EXAMPLE_INPUT_TELLUSER),
47
+ ].join('\n');
48
+ const FUNCTION_DESCRIPTION = `Use this to talk with the user. DON'T just add text on the canvas! Use this function as it adds a comment to the chat log which the user can see.\n\n${EXAMPLES}`;
49
+ // #endregion constants
50
+
51
+
52
+ /**
53
+ * @interface TellUserOpts - Options for the tellUser command.
54
+ * @extends CommandDataBase
55
+ */
56
+ export interface TellUserOpts extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
57
+ /**
58
+ * @property text - The text to tell the user.
59
+ */
60
+ text: string;
61
+
62
+ /**
63
+ * agent's id doing the telling
64
+ */
65
+ agentId: string;
66
+
67
+ /**
68
+ * address to the context in which the agent is communicating to a user.
69
+ */
70
+ contextIbGibAddr: IbGibAddr;
71
+
72
+ /**
73
+ * @property agentName - the name which the model chooses to
74
+ * use to represent him/her/itself.
75
+ */
76
+ agentName: string;
77
+ }
78
+
79
+ /**
80
+ * @interface TellUserCommandData - Command data for the tellUser command.
81
+ * @extends CommandDataBase
82
+ */
83
+ export interface TellUserCommandData extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
84
+ /**
85
+ * @property text - The text to tell the user.
86
+ */
87
+ text: string;
88
+ }
89
+
90
+ /**
91
+ * Wrapper function to enqueue the tellUser command.
92
+ * @param {TellUserOpts} opts - Options for telling the user something.
93
+ * @returns {Promise<void>} A promise that resolves when the command is enqueued.
94
+ */
95
+ function tellUserViaCmd(opts: TellUserOpts): Promise<void> {
96
+ const lc = `[${tellUserViaCmd.name}]`;
97
+ try {
98
+ if (logalot) { console.log(`${lc} starting... (I: 39ce6d58e154b8463170463f20d44925)`); }
99
+ if (logalot) { console.log(`${lc} tellUserViaCmd raw incoming opts: ${pretty(opts)} (I: 2ff6e7fc49b12e335affa1cb3af11125)`); }
100
+
101
+ const commandService = getCommandService();
102
+ const command: TellUserCommandData = {
103
+ ...opts,
104
+ cmd: 'agent',
105
+ cmdModifiers: ['tellUser'],
106
+ repromptWithResult: false, // override for tellUser
107
+ // text: opts.text,
108
+ // repromptWithResult: opts?.repromptWithResult,
109
+ // notesToSelf: opts?.notesToSelf,
110
+ };
111
+ if (logalot) { console.log(`${lc} tellUserViaCmd command: ${pretty(command)} (I: d7c86c41cf2578e1ccdd30f4dbc62625)`); }
112
+ return new Promise<void>((resolve, reject) => {
113
+ commandService.enqueueCommand({ command, resolve, reject });
114
+ });
115
+ } catch (error) {
116
+ console.error(`${lc} ${extractErrorMsg(error)}`);
117
+ throw error;
118
+ } finally {
119
+ if (logalot) { console.log(`${lc} complete.`); }
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Implementation function for the tellUser command.
125
+ *
126
+ * ## notes on context
127
+ *
128
+ * LLMs are designed to say/do something upon being prompted. In code, however,
129
+ * it is beneficial to sometimes just give information and let the agent decide
130
+ * whether or not to act upon it. Right now I have this doubling as an "ack"
131
+ * command that acts like a blackhole for when the agent decides no action is
132
+ * required. So if the context is a primitive, then this will "fail" silently.
133
+ *
134
+ *
135
+ * @param {TellUserOpts} opts - Options for telling the user something.
136
+ * @returns {Promise<void>} A promise that resolves when the command is executed (immediately).
137
+ */
138
+ async function tellUserImpl(opts: TellUserOpts): Promise<void> {
139
+ const lc = `[${tellUserImpl.name}]`;
140
+ try {
141
+ if (logalot) { console.log(`${lc} starting... (I: badce195ed1817dd686c7098511e1f25)`); }
142
+
143
+ console.log(`${lc} agent tell user opts: ${pretty(opts)}`);
144
+
145
+ const metaspace = await getGlobalMetaspace_waitIfNeeded();
146
+ const contextAddr = opts.contextIbGibAddr;
147
+ if (!contextAddr) { throw new Error(`contextIbGibAddr is falsy (was not provided by model if this was a function call request). This should be required in the gemini schema. (E: 2585778dc7f6fc74322f40745d7f4d25)`); }
148
+
149
+ const addrErrors = validateIbGibAddr({ addr: contextAddr }) ?? [];
150
+ if (addrErrors.length > 0) {
151
+ console.log(`${lc} returning early because agent has provided a non-ibgib addr for contextAddr: ${contextAddr}. addrErrors: ${addrErrors}. opts: ${pretty(opts)} (I: 66c39c5031723254de46c254b096dc25)`)
152
+ return; /* <<<< returns early */
153
+ }
154
+ if (isPrimitive({ gib: getIbAndGib({ ibGibAddr: contextAddr }).gib })) {
155
+ console.log(`${lc} agent has acked by calling this with a primitive context address. This will not propagate to the user's current context. opts: ${pretty(opts)} (I: a0687328201af74ed9d9e24ad4a5b825)`);
156
+ return; /* <<<< returns early */
157
+ }
158
+ const space = await metaspace.getLocalUserSpace({ lock: false });
159
+ if (!space) { throw new Error(`(UNEXPECTED) couldn't get default local user space? (E: 2fdac9f814d620ce6341cfc10942f525)`); }
160
+
161
+ // adding agent name elsewhere
162
+ // const agentNamePlusText = `${opts.agentName}: ${opts.text}`;
163
+
164
+ // create the comment
165
+ const { newIbGib: commentIbGib } = await createCommentIbGib({
166
+ text: opts.text,
167
+ addlMetadataText: getAddlMetadataTextForAgentText({
168
+ textSrc: TextSource.AI,
169
+ other: `${opts.agentName}_${opts.agentId}`,
170
+ }),
171
+ saveInSpace: true,
172
+ space,
173
+ });
174
+
175
+ // get the latest context ibgib
176
+ let latestContextIbGib: IbGib_V1 | undefined = undefined;
177
+ const latestContextAddr = await metaspace.getLatestAddr({
178
+ addr: contextAddr,
179
+ space,
180
+ });
181
+ if (latestContextAddr) {
182
+ const resGetLatest = await metaspace.get({
183
+ addrs: [latestContextAddr],
184
+ space,
185
+ });
186
+ if (resGetLatest.errorMsg || (resGetLatest.ibGibs ?? []).length !== 1) {
187
+ throw new Error(`couldn't get latest context ibgib (${latestContextAddr}) from super space (${space.ib}). errorMsg: ${resGetLatest.errorMsg ?? '[unknown error]'} (E: 450727cc12e226f8b741dd7b0efbfe25)`);
188
+ }
189
+ latestContextIbGib = resGetLatest.ibGibs!.at(0)!;
190
+ }
191
+ if (!latestContextIbGib) { throw new Error(`(UNEXPECTED) couldn't get latest context ibgib? (${latestContextAddr}) (E: cb50a6cb984a60c139a4f16a26290d25)`); }
192
+
193
+ await appendToTimeline({
194
+ timeline: latestContextIbGib,
195
+ metaspace,
196
+ rel8nInfos: [{ rel8nName: 'comment', ibGibs: [commentIbGib], }],
197
+ space,
198
+ });
199
+
200
+ } catch (error) {
201
+ console.error(`${lc} ${extractErrorMsg(error)}`);
202
+ throw error;
203
+ } finally {
204
+ if (logalot) { console.log(`${lc} complete.`); }
205
+ }
206
+ }
207
+
208
+ const GEMINI_SCHEMA_TELL_USER_TEXT = {
209
+ type: 'string',
210
+ description: 'The text content to display to the user in the chat log. This is how you, as the agent, communicate with the user.',
211
+ };
212
+
213
+ const GEMINI_SCHEMA_TELL_USER_CONTEXT_ADDR = {
214
+ type: 'string',
215
+ description: `This is the address of the ibgib in which you wish to communicate with the user (and/or other agents when implemented). If you don't know this, you should call the getContextInfo function (the actual name may vary slightly as we are in active development right now, but this should be included in your available functions).`,
216
+ };
217
+
218
+ /**
219
+ * API function info for the tellUser command.
220
+ */
221
+ export const tellUserFunctionInfo: APIFunctionInfo<typeof tellUserViaCmd> = {
222
+ nameOrId: FUNCTION_NAME,
223
+ fnViaCmd: tellUserViaCmd,
224
+ functionImpl: tellUserImpl,
225
+ cmd: CMD_CATEGORY,
226
+ cmdModifiers: CMD_MODIFIERS,
227
+ schema: {
228
+ name: FUNCTION_NAME,
229
+ description: FUNCTION_DESCRIPTION,
230
+ parameters: {
231
+ type: 'object',
232
+ properties: {
233
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
234
+ text: GEMINI_SCHEMA_TELL_USER_TEXT,
235
+ contextIbGibAddr: GEMINI_SCHEMA_TELL_USER_CONTEXT_ADDR,
236
+ agentName: GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME,
237
+ },
238
+ required: ['text', 'contextIbGibAddr', 'agentName'],
239
+ },
240
+ },
241
+ };
@@ -0,0 +1,17 @@
1
+ import { GEMINI_SCHEMA_AGENT_ID, GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME } from "../../witness/agent/agent-constants.mjs";
2
+
3
+ /**
4
+ * common properties for available functions passed to models.
5
+ */
6
+ export const COMMAND_BASE_SCHEMA_PROPERTIES = {
7
+ agentId: GEMINI_SCHEMA_AGENT_ID,
8
+ agentName: GEMINI_SCHEMA_AGENTS_SELF_IDENTIFIED_NAME,
9
+ repromptWithResult: {
10
+ type: 'boolean',
11
+ description: `Set this to true if you want to be reprompted with the function's result. Unless you really want a fire-and-forget style of function call, set this to true. NOTE: This is ignored with tellUser command, so you can't call tellUser and then repromptWithResult of true and then tellUser again.`,
12
+ },
13
+ notesToSelf: {
14
+ type: 'string',
15
+ description: 'Quick note scratchpad related to a requested function. For example, you could write your intent here.',
16
+ },
17
+ } as const;