@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.
- package/.ibgibignore +30 -0
- package/.vscode/ibgib-snippets.code-snippets +309 -0
- package/.vscode/launch.json +25 -0
- package/.vscode/settings.json +68 -0
- package/.vscode/tasks.json +38 -0
- package/CHANGELOG.md +427 -0
- package/README.md +66 -0
- package/dist/agent-texts/common-agent-texts.d.mts +14 -0
- package/dist/agent-texts/common-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/common-agent-texts.mjs +51 -0
- package/dist/agent-texts/common-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/primary-agent-texts.d.mts +16 -0
- package/dist/agent-texts/primary-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/primary-agent-texts.mjs +27 -0
- package/dist/agent-texts/primary-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/project-agent-texts.d.mts +8 -0
- package/dist/agent-texts/project-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/project-agent-texts.mjs +29 -0
- package/dist/agent-texts/project-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/project-child-text-agent-texts.d.mts +5 -0
- package/dist/agent-texts/project-child-text-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/project-child-text-agent-texts.mjs +26 -0
- package/dist/agent-texts/project-child-text-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/projects-agent-texts.d.mts +4 -0
- package/dist/agent-texts/projects-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/projects-agent-texts.mjs +15 -0
- package/dist/agent-texts/projects-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/raw-agent-texts.d.mts +4 -0
- package/dist/agent-texts/raw-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/raw-agent-texts.mjs +17 -0
- package/dist/agent-texts/raw-agent-texts.mjs.map +1 -0
- package/dist/agent-texts/text-editor-agent-texts.d.mts +6 -0
- package/dist/agent-texts/text-editor-agent-texts.d.mts.map +1 -0
- package/dist/agent-texts/text-editor-agent-texts.mjs +19 -0
- package/dist/agent-texts/text-editor-agent-texts.mjs.map +1 -0
- package/dist/api/api-constants.d.mts +9 -0
- package/dist/api/api-constants.d.mts.map +1 -0
- package/dist/api/api-constants.mjs +9 -0
- package/dist/api/api-constants.mjs.map +1 -0
- package/dist/api/api-index.d.mts +10 -0
- package/dist/api/api-index.d.mts.map +1 -0
- package/dist/api/api-index.mjs +121 -0
- package/dist/api/api-index.mjs.map +1 -0
- package/dist/api/api-types.d.mts +36 -0
- package/dist/api/api-types.d.mts.map +1 -0
- package/dist/api/api-types.mjs +2 -0
- package/dist/api/api-types.mjs.map +1 -0
- package/dist/api/commands/chat/chat-index.d.mts +3 -0
- package/dist/api/commands/chat/chat-index.d.mts.map +1 -0
- package/dist/api/commands/chat/chat-index.mjs +9 -0
- package/dist/api/commands/chat/chat-index.mjs.map +1 -0
- package/dist/api/commands/chat/get-context-info.d.mts +71 -0
- package/dist/api/commands/chat/get-context-info.d.mts.map +1 -0
- package/dist/api/commands/chat/get-context-info.mjs +130 -0
- package/dist/api/commands/chat/get-context-info.mjs.map +1 -0
- package/dist/api/commands/chat/hello-world.d.mts +63 -0
- package/dist/api/commands/chat/hello-world.d.mts.map +1 -0
- package/dist/api/commands/chat/hello-world.mjs +132 -0
- package/dist/api/commands/chat/hello-world.mjs.map +1 -0
- package/dist/api/commands/chat/tell-user.d.mts +57 -0
- package/dist/api/commands/chat/tell-user.d.mts.map +1 -0
- package/dist/api/commands/chat/tell-user.mjs +199 -0
- package/dist/api/commands/chat/tell-user.mjs.map +1 -0
- package/dist/api/commands/command-constants.d.mts +22 -0
- package/dist/api/commands/command-constants.d.mts.map +1 -0
- package/dist/api/commands/command-constants.mjs +17 -0
- package/dist/api/commands/command-constants.mjs.map +1 -0
- package/dist/api/commands/command-helpers.d.mts +47 -0
- package/dist/api/commands/command-helpers.d.mts.map +1 -0
- package/dist/api/commands/command-helpers.mjs +76 -0
- package/dist/api/commands/command-helpers.mjs.map +1 -0
- package/dist/api/commands/command-service-v1.d.mts +28 -0
- package/dist/api/commands/command-service-v1.d.mts.map +1 -0
- package/dist/api/commands/command-service-v1.mjs +122 -0
- package/dist/api/commands/command-service-v1.mjs.map +1 -0
- package/dist/api/commands/command-service.respec.d.mts +7 -0
- package/dist/api/commands/command-service.respec.d.mts.map +1 -0
- package/dist/api/commands/command-service.respec.mjs +66 -0
- package/dist/api/commands/command-service.respec.mjs.map +1 -0
- package/dist/api/commands/command-types.d.mts +48 -0
- package/dist/api/commands/command-types.d.mts.map +1 -0
- package/dist/api/commands/command-types.mjs +12 -0
- package/dist/api/commands/command-types.mjs.map +1 -0
- package/dist/api/commands/ibgib/get-ibgibs.d.mts +94 -0
- package/dist/api/commands/ibgib/get-ibgibs.d.mts.map +1 -0
- package/dist/api/commands/ibgib/get-ibgibs.mjs +219 -0
- package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -0
- package/dist/api/commands/ibgib/ibgib-index.d.mts +3 -0
- package/dist/api/commands/ibgib/ibgib-index.d.mts.map +1 -0
- package/dist/api/commands/ibgib/ibgib-index.mjs +7 -0
- package/dist/api/commands/ibgib/ibgib-index.mjs.map +1 -0
- package/dist/api/commands/ibgib/mut8-ibgib.d.mts +135 -0
- package/dist/api/commands/ibgib/mut8-ibgib.d.mts.map +1 -0
- package/dist/api/commands/ibgib/mut8-ibgib.mjs +318 -0
- package/dist/api/commands/ibgib/mut8-ibgib.mjs.map +1 -0
- package/dist/api/commands/templates/api-function-info.template.d.mts +73 -0
- package/dist/api/commands/templates/api-function-info.template.d.mts.map +1 -0
- package/dist/api/commands/templates/api-function-info.template.mjs +161 -0
- package/dist/api/commands/templates/api-function-info.template.mjs.map +1 -0
- package/dist/api/commands/text/text-edit.d.mts +54 -0
- package/dist/api/commands/text/text-edit.d.mts.map +1 -0
- package/dist/api/commands/text/text-edit.mjs +170 -0
- package/dist/api/commands/text/text-edit.mjs.map +1 -0
- package/dist/api/commands/text/text-index.d.mts +3 -0
- package/dist/api/commands/text/text-index.d.mts.map +1 -0
- package/dist/api/commands/text/text-index.mjs +5 -0
- package/dist/api/commands/text/text-index.mjs.map +1 -0
- package/dist/api/commands/ui/ui-index.d.mts +3 -0
- package/dist/api/commands/ui/ui-index.d.mts.map +1 -0
- package/dist/api/commands/ui/ui-index.mjs +5 -0
- package/dist/api/commands/ui/ui-index.mjs.map +1 -0
- package/dist/api/commands/ui/update-css-variables.d.mts +48 -0
- package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -0
- package/dist/api/commands/ui/update-css-variables.mjs +145 -0
- package/dist/api/commands/ui/update-css-variables.mjs.map +1 -0
- package/dist/api/function-infos.web.d.mts +15 -0
- package/dist/api/function-infos.web.d.mts.map +1 -0
- package/dist/api/function-infos.web.mjs +63 -0
- package/dist/api/function-infos.web.mjs.map +1 -0
- package/dist/assumptions.respec.d.mts +2 -0
- package/dist/assumptions.respec.d.mts.map +1 -0
- package/dist/assumptions.respec.mjs +41 -0
- package/dist/assumptions.respec.mjs.map +1 -0
- package/dist/common/project/project-constants.d.mts +38 -0
- package/dist/common/project/project-constants.d.mts.map +1 -0
- package/dist/common/project/project-constants.mjs +71 -0
- package/dist/common/project/project-constants.mjs.map +1 -0
- package/dist/common/project/project-helper.d.mts +127 -0
- package/dist/common/project/project-helper.d.mts.map +1 -0
- package/dist/common/project/project-helper.mjs +683 -0
- package/dist/common/project/project-helper.mjs.map +1 -0
- package/dist/common/project/project-types.d.mts +91 -0
- package/dist/common/project/project-types.d.mts.map +1 -0
- package/dist/common/project/project-types.mjs +31 -0
- package/dist/common/project/project-types.mjs.map +1 -0
- package/dist/common/prompt-functions.web.d.mts +90 -0
- package/dist/common/prompt-functions.web.d.mts.map +1 -0
- package/dist/common/prompt-functions.web.mjs +426 -0
- package/dist/common/prompt-functions.web.mjs.map +1 -0
- package/dist/common/settings/settings-constants.d.mts +33 -0
- package/dist/common/settings/settings-constants.d.mts.map +1 -0
- package/dist/common/settings/settings-constants.mjs +54 -0
- package/dist/common/settings/settings-constants.mjs.map +1 -0
- package/dist/common/settings/settings-helpers.d.mts +59 -0
- package/dist/common/settings/settings-helpers.d.mts.map +1 -0
- package/dist/common/settings/settings-helpers.mjs +253 -0
- package/dist/common/settings/settings-helpers.mjs.map +1 -0
- package/dist/common/settings/settings-types.d.mts +118 -0
- package/dist/common/settings/settings-types.d.mts.map +1 -0
- package/dist/common/settings/settings-types.mjs +13 -0
- package/dist/common/settings/settings-types.mjs.map +1 -0
- package/dist/constants.d.mts +34 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +35 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/foo.d.mts +2 -0
- package/dist/foo.d.mts.map +1 -0
- package/dist/foo.mjs +19 -0
- package/dist/foo.mjs.map +1 -0
- package/dist/helpers.d.mts +137 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +514 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/helpers.web.d.mts +324 -0
- package/dist/helpers.web.d.mts.map +1 -0
- package/dist/helpers.web.mjs +1133 -0
- package/dist/helpers.web.mjs.map +1 -0
- package/dist/helpers.web.respec.d.mts +2 -0
- package/dist/helpers.web.respec.d.mts.map +1 -0
- package/dist/helpers.web.respec.mjs +12 -0
- package/dist/helpers.web.respec.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/respec-gib.node.d.mts +2 -0
- package/dist/respec-gib.node.d.mts.map +1 -0
- package/dist/respec-gib.node.mjs +211 -0
- package/dist/respec-gib.node.mjs.map +1 -0
- package/dist/spec-helper.node.respec.d.mts +13 -0
- package/dist/spec-helper.node.respec.d.mts.map +1 -0
- package/dist/spec-helper.node.respec.mjs +50 -0
- package/dist/spec-helper.node.respec.mjs.map +1 -0
- package/dist/storage/storage-helpers.web.d.mts +108 -0
- package/dist/storage/storage-helpers.web.d.mts.map +1 -0
- package/dist/storage/storage-helpers.web.mjs +757 -0
- package/dist/storage/storage-helpers.web.mjs.map +1 -0
- package/dist/storage/storage-types.web.d.mts +30 -0
- package/dist/storage/storage-types.web.d.mts.map +1 -0
- package/dist/storage/storage-types.web.mjs +2 -0
- package/dist/storage/storage-types.web.mjs.map +1 -0
- package/dist/types.web.d.mts +42 -0
- package/dist/types.web.d.mts.map +1 -0
- package/dist/types.web.mjs +2 -0
- package/dist/types.web.mjs.map +1 -0
- package/dist/ui/component/component-types.d.mts +225 -0
- package/dist/ui/component/component-types.d.mts.map +1 -0
- package/dist/ui/component/component-types.mjs +2 -0
- package/dist/ui/component/component-types.mjs.map +1 -0
- package/dist/ui/component/ibgib-component-service.d.mts +70 -0
- package/dist/ui/component/ibgib-component-service.d.mts.map +1 -0
- package/dist/ui/component/ibgib-component-service.mjs +201 -0
- package/dist/ui/component/ibgib-component-service.mjs.map +1 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.d.mts +338 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.d.mts.map +1 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.mjs +1304 -0
- package/dist/ui/component/ibgib-dynamic-component-bases.mjs.map +1 -0
- package/dist/ui/ui-constants.d.mts +12 -0
- package/dist/ui/ui-constants.d.mts.map +1 -0
- package/dist/ui/ui-constants.mjs +93 -0
- package/dist/ui/ui-constants.mjs.map +1 -0
- package/dist/ui/ui-helpers.d.mts +42 -0
- package/dist/ui/ui-helpers.d.mts.map +1 -0
- package/dist/ui/ui-helpers.mjs +198 -0
- package/dist/ui/ui-helpers.mjs.map +1 -0
- package/dist/ui/ui-types.d.mts +13 -0
- package/dist/ui/ui-types.d.mts.map +1 -0
- package/dist/ui/ui-types.mjs +2 -0
- package/dist/ui/ui-types.mjs.map +1 -0
- package/dist/witness/agent/agent-constants.d.mts +97 -0
- package/dist/witness/agent/agent-constants.d.mts.map +1 -0
- package/dist/witness/agent/agent-constants.mjs +98 -0
- package/dist/witness/agent/agent-constants.mjs.map +1 -0
- package/dist/witness/agent/agent-helpers.d.mts +106 -0
- package/dist/witness/agent/agent-helpers.d.mts.map +1 -0
- package/dist/witness/agent/agent-helpers.mjs +601 -0
- package/dist/witness/agent/agent-helpers.mjs.map +1 -0
- package/dist/witness/agent/agent-one-file.app.d.mts +2 -0
- package/dist/witness/agent/agent-one-file.app.d.mts.map +1 -0
- package/dist/witness/agent/agent-one-file.app.mjs +8 -0
- package/dist/witness/agent/agent-one-file.app.mjs.map +1 -0
- package/dist/witness/agent/agent-one-file.d.mts +478 -0
- package/dist/witness/agent/agent-one-file.d.mts.map +1 -0
- package/dist/witness/agent/agent-one-file.mjs +1462 -0
- package/dist/witness/agent/agent-one-file.mjs.map +1 -0
- package/dist/witness/agent/agent-types.d.mts +83 -0
- package/dist/witness/agent/agent-types.d.mts.map +1 -0
- package/dist/witness/agent/agent-types.mjs +2 -0
- package/dist/witness/agent/agent-types.mjs.map +1 -0
- package/dist/witness/agent/agents-service-v1.d.mts +99 -0
- package/dist/witness/agent/agents-service-v1.d.mts.map +1 -0
- package/dist/witness/agent/agents-service-v1.mjs +453 -0
- package/dist/witness/agent/agents-service-v1.mjs.map +1 -0
- package/dist/witness/agent/function-info/function-info-one-file.d.mts +192 -0
- package/dist/witness/agent/function-info/function-info-one-file.d.mts.map +1 -0
- package/dist/witness/agent/function-info/function-info-one-file.mjs +192 -0
- package/dist/witness/agent/function-info/function-info-one-file.mjs.map +1 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts +51 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts.map +1 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs +928 -0
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.d.mts +27 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.mjs +144 -0
- package/dist/witness/agent/gemini/gemini-agent-factory.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-constants.d.mts +36 -0
- package/dist/witness/agent/gemini/gemini-constants.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-constants.mjs +47 -0
- package/dist/witness/agent/gemini/gemini-constants.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-helpers.d.mts +58 -0
- package/dist/witness/agent/gemini/gemini-helpers.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-helpers.mjs +210 -0
- package/dist/witness/agent/gemini/gemini-helpers.mjs.map +1 -0
- package/dist/witness/agent/gemini/gemini-types.d.mts +82 -0
- package/dist/witness/agent/gemini/gemini-types.d.mts.map +1 -0
- package/dist/witness/agent/gemini/gemini-types.mjs +3 -0
- package/dist/witness/agent/gemini/gemini-types.mjs.map +1 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts +136 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs +334 -0
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts +35 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs +267 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts +134 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts.map +1 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs +389 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts +2 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs +2 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-constants.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts +104 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs +457 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-helper.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts +93 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs +98 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.mjs.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts +73 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts.map +1 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs +650 -0
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.mjs.map +1 -0
- package/generate-version-file.js +29 -0
- package/package.json +60 -0
- package/src/agent-texts/common-agent-texts.mts +61 -0
- package/src/agent-texts/primary-agent-texts.mts +32 -0
- package/src/agent-texts/project-agent-texts.mts +29 -0
- package/src/agent-texts/project-child-text-agent-texts.mts +30 -0
- package/src/agent-texts/projects-agent-texts.mts +17 -0
- package/src/agent-texts/raw-agent-texts.mts +18 -0
- package/src/agent-texts/text-editor-agent-texts.mts +20 -0
- package/src/api/api-constants.mts +8 -0
- package/src/api/api-index.mts +110 -0
- package/src/api/api-types.mts +36 -0
- package/src/api/commands/chat/chat-index.mts +10 -0
- package/src/api/commands/chat/get-context-info.mts +196 -0
- package/src/api/commands/chat/hello-world.mts +183 -0
- package/src/api/commands/chat/tell-user.mts +241 -0
- package/src/api/commands/command-constants.mts +17 -0
- package/src/api/commands/command-helpers.mts +105 -0
- package/src/api/commands/command-service-v1.mts +136 -0
- package/src/api/commands/command-service.respec.mts +72 -0
- package/src/api/commands/command-types.mts +71 -0
- package/src/api/commands/ibgib/get-ibgibs.mts +269 -0
- package/src/api/commands/ibgib/ibgib-index.mts +8 -0
- package/src/api/commands/ibgib/mut8-ibgib.mts +418 -0
- package/src/api/commands/templates/api-function-info.template.mts +212 -0
- package/src/api/commands/text/text-edit.mts +217 -0
- package/src/api/commands/text/text-index.mts +6 -0
- package/src/api/commands/ui/ui-index.mts +6 -0
- package/src/api/commands/ui/update-css-variables.mts +187 -0
- package/src/api/function-infos.web.mts +66 -0
- package/src/assets/fullscreen-dialog.html +18 -0
- package/src/assumptions.respec.mts +51 -0
- package/src/common/project/project-constants.mts +83 -0
- package/src/common/project/project-helper.mts +730 -0
- package/src/common/project/project-types.mts +121 -0
- package/src/common/prompt-functions.web.mts +447 -0
- package/src/common/settings/settings-constants.mts +72 -0
- package/src/common/settings/settings-helpers.mts +280 -0
- package/src/common/settings/settings-types.mts +137 -0
- package/src/constants.mts +39 -0
- package/src/foo.mts +13 -0
- package/src/helpers.mts +574 -0
- package/src/helpers.web.mts +1277 -0
- package/src/helpers.web.respec.mts +16 -0
- package/src/index.mts +3 -0
- package/src/respec-gib.node.mts +199 -0
- package/src/spec-helper.node.respec.mts +50 -0
- package/src/storage/storage-helpers.web.mts +728 -0
- package/src/storage/storage-types.web.mts +29 -0
- package/src/types.web.mts +42 -0
- package/src/ui/component/component-types.mts +241 -0
- package/src/ui/component/ibgib-component-service.mts +201 -0
- package/src/ui/component/ibgib-dynamic-component-bases.mts +1369 -0
- package/src/ui/ui-constants.mts +101 -0
- package/src/ui/ui-helpers.mts +222 -0
- package/src/ui/ui-types.mts +11 -0
- package/src/witness/agent/agent-constants.mts +122 -0
- package/src/witness/agent/agent-helpers.mts +681 -0
- package/src/witness/agent/agent-one-file.app.mts +8 -0
- package/src/witness/agent/agent-one-file.mts +1665 -0
- package/src/witness/agent/agent-types.mts +92 -0
- package/src/witness/agent/agents-service-v1.mts +482 -0
- package/src/witness/agent/function-info/function-info-one-file.mts +362 -0
- package/src/witness/agent/gemini/agent-witness-gemini-v1.mts +910 -0
- package/src/witness/agent/gemini/gemini-agent-factory.mts +135 -0
- package/src/witness/agent/gemini/gemini-constants.mts +79 -0
- package/src/witness/agent/gemini/gemini-helpers.mts +216 -0
- package/src/witness/agent/gemini/gemini-types.mts +88 -0
- package/src/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mts +321 -0
- package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mts +290 -0
- package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mts +407 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-constants.mts +1 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-helper.mts +491 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-types.mts +172 -0
- package/src/witness/space/web-filesystem-space/web-filesystem-space-v1.mts +670 -0
- package/tsconfig.json +17 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { clone, extractErrorMsg, pickRandom_Letters } 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 { getCommandService } from "./command-service-v1.mjs";
|
|
6
|
+
import { CommandDataBase } from "./command-types.mjs";
|
|
7
|
+
|
|
8
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* customizing function to create the schema specific to some concrete schema
|
|
12
|
+
* description/instructions.
|
|
13
|
+
*/
|
|
14
|
+
export function tweakGeminiSchema({
|
|
15
|
+
baseSchema,
|
|
16
|
+
addlDescription,
|
|
17
|
+
}: {
|
|
18
|
+
/**
|
|
19
|
+
* starting schema which we will customize.
|
|
20
|
+
*/
|
|
21
|
+
baseSchema: any,
|
|
22
|
+
/**
|
|
23
|
+
* additional description, to be used for concrete schema descriptions.
|
|
24
|
+
* If there is no description to begin with, this will simply set the
|
|
25
|
+
* description.
|
|
26
|
+
*
|
|
27
|
+
* For example, with destroy renderable, describe that this will recursively
|
|
28
|
+
* destroy children. With update renderable, this will apply the changes
|
|
29
|
+
* recursively to all children (like setting color).
|
|
30
|
+
*/
|
|
31
|
+
addlDescription?: string,
|
|
32
|
+
}): { type: 'boolean', description: string } {
|
|
33
|
+
if (!baseSchema) { throw new Error(`(UNEXPECTED) baseSchema falsy? (E: 338a083d88ab9ae5286edc7d0c20c825)`); }
|
|
34
|
+
const resSchema = clone(baseSchema);
|
|
35
|
+
resSchema.description = `${resSchema.description ?? ''}\n${addlDescription}`;
|
|
36
|
+
return resSchema;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* wraps the given {@link fn} inside of a {@link APIFunctionInfo} that can be
|
|
41
|
+
* executed on the api command service.
|
|
42
|
+
*
|
|
43
|
+
* ## intent
|
|
44
|
+
*
|
|
45
|
+
* I want to be able to execute certain functions serially similar to a barrier
|
|
46
|
+
* or critical section. This was the "easiest" way for me to do it, since each
|
|
47
|
+
* command is executed serially on the commanding service. And I didn't want to
|
|
48
|
+
* have to create APIFunctionInfo objects for things that will not be exposed to
|
|
49
|
+
* agents proper.
|
|
50
|
+
*
|
|
51
|
+
* ## NOT for agents' use
|
|
52
|
+
*
|
|
53
|
+
* because this is anon function, there is NO schema generated. So this can't be
|
|
54
|
+
* used with agents directly.
|
|
55
|
+
*/
|
|
56
|
+
export function commandifyAnonFn<TFunc extends (...args: any[]) => Promise<any> = (...args: any[]) => Promise<void>>({
|
|
57
|
+
fn,
|
|
58
|
+
nameOrId,
|
|
59
|
+
cmdCategory,
|
|
60
|
+
}: {
|
|
61
|
+
fn: TFunc,
|
|
62
|
+
nameOrId?: string,
|
|
63
|
+
cmdCategory?: string,
|
|
64
|
+
}): APIFunctionInfo<TFunc> {
|
|
65
|
+
const lc = `[${commandifyAnonFn.name}]`;
|
|
66
|
+
try {
|
|
67
|
+
if (logalot) { console.log(`${lc} starting... (I: e302e6a0f13584968379c9149406f225)`); }
|
|
68
|
+
|
|
69
|
+
const cmdName =
|
|
70
|
+
(nameOrId ?? fn.name) + `_${pickRandom_Letters({ count: 8 })}`;
|
|
71
|
+
cmdCategory ??= 'anon';
|
|
72
|
+
const cmdModifiers = [cmdName];
|
|
73
|
+
|
|
74
|
+
const fnViaCmd: any = async (opts: any) => {
|
|
75
|
+
cmdCategory ??= 'anon';
|
|
76
|
+
const commandService = getCommandService();
|
|
77
|
+
const command: CommandDataBase<typeof cmdCategory, typeof cmdModifiers> = {
|
|
78
|
+
cmd: cmdCategory,
|
|
79
|
+
cmdModifiers,
|
|
80
|
+
...opts,
|
|
81
|
+
};
|
|
82
|
+
return new Promise<any>((resolve, reject) => {
|
|
83
|
+
commandService.enqueueCommand({ command, resolve, reject, anonApiFn });
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const anonApiFn: APIFunctionInfo<TFunc> = {
|
|
88
|
+
nameOrId: cmdName,
|
|
89
|
+
cmd: cmdCategory,
|
|
90
|
+
cmdModifiers: [cmdName],
|
|
91
|
+
fnViaCmd,
|
|
92
|
+
functionImpl: fn,
|
|
93
|
+
schema: undefined,
|
|
94
|
+
isAnon: true,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return anonApiFn;
|
|
98
|
+
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
101
|
+
throw error;
|
|
102
|
+
} finally {
|
|
103
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
|
+
|
|
3
|
+
import { APIFunctionInfo } from "../api-types.mjs";
|
|
4
|
+
import { CommandDataBase, CommandService, EnqueuedCommand } from "./command-types.mjs";
|
|
5
|
+
import { getAllFunctionInfos } from "../api-index.mjs";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @class CommandService_V1 - Implementation of the command service.
|
|
9
|
+
* Implements the {@link CommandService} interface.
|
|
10
|
+
*/
|
|
11
|
+
export class CommandService_V1 implements CommandService {
|
|
12
|
+
protected lc: string = `[${CommandService_V1.name}]`;
|
|
13
|
+
private commandQueue: EnqueuedCommand<CommandDataBase<string, string[]>>[] = [];
|
|
14
|
+
private isProcessing = false;
|
|
15
|
+
|
|
16
|
+
// private anonFns: Map<string, APIFunctionInfo<any>> = new Map();
|
|
17
|
+
|
|
18
|
+
constructor() { }
|
|
19
|
+
|
|
20
|
+
// registerAnonFn({ apiFnInfo }: { apiFnInfo: APIFunctionInfo<any> }): void {
|
|
21
|
+
// const lc = `${this.lc}[${this.registerAnonFn.name}]`;
|
|
22
|
+
// if (this.anonFns.has(apiFnInfo.nameOrId)) {
|
|
23
|
+
// console.warn(`${lc} anonFn already registered? (W: c6721a63affe97f5514d54bbe780f625)`)
|
|
24
|
+
// }
|
|
25
|
+
// this.anonFns.set(apiFnInfo.nameOrId, apiFnInfo);
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
enqueueCommand<TCommand extends CommandDataBase<string, string[]>>(enqueuedCommand: EnqueuedCommand<TCommand>): void {
|
|
29
|
+
this.commandQueue.push(enqueuedCommand);
|
|
30
|
+
if (!this.isProcessing) {
|
|
31
|
+
this.startProcessing();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private startProcessing(): void {
|
|
36
|
+
this.isProcessing = true;
|
|
37
|
+
this.processQueue().finally(() => {
|
|
38
|
+
this.isProcessing = false;
|
|
39
|
+
if (this.commandQueue.length > 0) {
|
|
40
|
+
this.startProcessing(); // If more commands were added, process them
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async processQueue(): Promise<void> {
|
|
46
|
+
const lc = `${this.lc}[${this.processQueue.name}]`;
|
|
47
|
+
while (this.commandQueue.length > 0) {
|
|
48
|
+
const enqueuedCommand = this.commandQueue.shift();
|
|
49
|
+
if (enqueuedCommand) {
|
|
50
|
+
try {
|
|
51
|
+
const result =
|
|
52
|
+
await this.executeCommand(enqueuedCommand.command, enqueuedCommand.anonApiFn);
|
|
53
|
+
enqueuedCommand.resolve(result);
|
|
54
|
+
} catch (error: any) {
|
|
55
|
+
console.error(`Error executing command ${enqueuedCommand.command.cmd} ${enqueuedCommand.command.cmdModifiers?.join(',') ?? ''}:`, error);
|
|
56
|
+
enqueuedCommand.reject(error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private async executeCommand(cmdData: CommandDataBase<string, string[]>, anonApiFn?: APIFunctionInfo<any>): Promise<any | void> {
|
|
63
|
+
const lc = `[${CommandService_V1.name}.${this.executeCommand.name}]`;
|
|
64
|
+
try {
|
|
65
|
+
const functionInfo =
|
|
66
|
+
anonApiFn ??
|
|
67
|
+
Array.from(getAllFunctionInfos().entries())
|
|
68
|
+
.map(x => x[1] as APIFunctionInfo<any>)
|
|
69
|
+
.find((info) => {
|
|
70
|
+
return info.cmd === cmdData.cmd &&
|
|
71
|
+
info.cmdModifiers.every(modifier => !!cmdData.cmdModifiers?.includes(modifier));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (functionInfo) {
|
|
75
|
+
console.log(`${lc} command executing. cmdData: ${pretty(cmdData)}`)
|
|
76
|
+
// Type checking and argument passing will need refinement based on schema
|
|
77
|
+
if (cmdData.notesToSelf) {
|
|
78
|
+
console.log(`${lc} Notes to self: ${cmdData.notesToSelf}. (I: ebcc5471b2b309ba186281c134f77e25)`);
|
|
79
|
+
}
|
|
80
|
+
const args = this.getCommandArgs(cmdData, functionInfo);
|
|
81
|
+
const result = await functionInfo.functionImpl(args);
|
|
82
|
+
return result;
|
|
83
|
+
} else {
|
|
84
|
+
throw new Error(`${lc} Unknown command: ${cmdData.cmd} with modifiers ${cmdData.cmdModifiers?.join(', ')} (E: cc9cb829f118de05b762020213ef2825)`);
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
debugger; // error in command svc exec
|
|
88
|
+
const errorMsg = `${lc} ${extractErrorMsg(error)}`;
|
|
89
|
+
console.error(errorMsg);
|
|
90
|
+
return { errorMsg };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* todo: change the structure so these explicit calls aren't necessary.
|
|
96
|
+
* @param cmdData about the cmd to invoke
|
|
97
|
+
* @param functionInfo full function info corresponding to cmd
|
|
98
|
+
* @returns args that the cmd expects depending on incoming {@link cmdData}
|
|
99
|
+
*/
|
|
100
|
+
private getCommandArgs(cmdData: CommandDataBase<string, string[]>, functionInfo: APIFunctionInfo): any {
|
|
101
|
+
return cmdData as any;
|
|
102
|
+
// // This will need to be refined based on the actual function signature and schema
|
|
103
|
+
// if (functionInfo.nameOrId === 'renderableCreate') {
|
|
104
|
+
// // return { initialStates: (cmdData as RenderableCreateCommandData).initialStates, };
|
|
105
|
+
// return cmdData as RenderableCreateCommandData;
|
|
106
|
+
// } else if (functionInfo.nameOrId === 'renderableUpdate') {
|
|
107
|
+
// // return { handle: (cmdData as RenderableUpdateCommandData).handle,
|
|
108
|
+
// // updatedState: (cmdData as RenderableUpdateCommandData).updatedState
|
|
109
|
+
// // };
|
|
110
|
+
// return cmdData as RenderableUpdateCommandData;
|
|
111
|
+
// } else if (functionInfo.nameOrId === 'renderableDestroy') {
|
|
112
|
+
// return cmdData as RenderableDestroyCommandData;
|
|
113
|
+
// } else if (functionInfo.nameOrId === 'tellUser') {
|
|
114
|
+
// return { text: (cmdData as TellUserCommandData).text };
|
|
115
|
+
// } else {
|
|
116
|
+
// throw new Error(`(UNEXPECTED) unknown command? functionInfo.nameOrId: ${functionInfo.nameOrId}, cmdData: ${pretty(cmdData)} (E: 376725f2024d48c5056a9f8989616125)`);
|
|
117
|
+
// }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
let globalCommandService: CommandService | undefined;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Gets the singleton instance of the CommandService.
|
|
129
|
+
* @returns {CommandService} The CommandService instance.
|
|
130
|
+
*/
|
|
131
|
+
export function getCommandService(): CommandService {
|
|
132
|
+
if (!globalCommandService) {
|
|
133
|
+
globalCommandService = new CommandService_V1();
|
|
134
|
+
}
|
|
135
|
+
return globalCommandService;
|
|
136
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module command-service respec, not quite a real respec atow (01/2025).
|
|
3
|
+
* convert later when doing better testing. for now, just import the test function
|
|
4
|
+
* and run it to test.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// import { RenderableHandle } from '../../render/render-one-file.mjs';
|
|
8
|
+
// import { renderableCreateFunctionInfo } from './renderable/create-renderables.mjs';
|
|
9
|
+
// import { renderableDestroyFunctionInfo } from './renderable/destroy-renderable.mts';
|
|
10
|
+
// import { renderableUpdateFunctionInfo } from './renderable/update-renderable.mts';
|
|
11
|
+
|
|
12
|
+
// /**
|
|
13
|
+
// * @function testCommandService - A test function to demonstrate using the command service.
|
|
14
|
+
// * @returns {Promise<void>}
|
|
15
|
+
// */
|
|
16
|
+
// export async function testCommandService(): Promise<void> {
|
|
17
|
+
// console.log('>>> Starting testCommandService...');
|
|
18
|
+
|
|
19
|
+
// // 1. Create a renderable
|
|
20
|
+
// let createHandle: RenderableHandle | undefined;
|
|
21
|
+
// try {
|
|
22
|
+
// const renderableCreateViaCmd = renderableCreateFunctionInfo.fnViaCmd;
|
|
23
|
+
// // createHandle = (await renderableCreateViaCmd({
|
|
24
|
+
// const resCreate = await renderableCreateViaCmd(
|
|
25
|
+
// {
|
|
26
|
+
// cmd: 'Renderable',
|
|
27
|
+
// initialStates: [{
|
|
28
|
+
// isVisible: true,
|
|
29
|
+
// color: { r: 1, g: 0, b: 0, a: 1 }, // Red
|
|
30
|
+
// position: { x: 10, y: 10, z: 0 },
|
|
31
|
+
// scale: { x: 1, y: 1 },
|
|
32
|
+
// geometry: { type: 'rect', parameters: { type: 'rect', width: 50, height: 50 } },
|
|
33
|
+
// }],
|
|
34
|
+
// });
|
|
35
|
+
|
|
36
|
+
// createHandle = resCreate.at(0);
|
|
37
|
+
// console.log(`testCommandService: Created renderable with handle ${createHandle.uuid}`);
|
|
38
|
+
// } catch (error) {
|
|
39
|
+
// console.error('testCommandService: Error creating renderable:', error);
|
|
40
|
+
// return;
|
|
41
|
+
// }
|
|
42
|
+
|
|
43
|
+
// if (!createHandle) {
|
|
44
|
+
// console.error('testCommandService: Error creating renderable - handle is undefined. (E: 6548f5560b07137bd683cb713a4fcc24)');
|
|
45
|
+
// return;
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// // 2. Update the renderable after a short delay
|
|
49
|
+
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
50
|
+
// try {
|
|
51
|
+
// const renderableUpdateViaCmd = renderableUpdateFunctionInfo.fnViaCmd;
|
|
52
|
+
// await renderableUpdateViaCmd({
|
|
53
|
+
// handle: createHandle,
|
|
54
|
+
// updatedState: { color: { r: 0, g: 1, b: 0, a: 1 }, position: { x: 100, y: 100, z: 0 } }, // Green, moved
|
|
55
|
+
// });
|
|
56
|
+
// console.log(`testCommandService: Updated renderable with handle ${createHandle.uuid}`);
|
|
57
|
+
// } catch (error) {
|
|
58
|
+
// console.error('testCommandService: Error updating renderable:', error);
|
|
59
|
+
// }
|
|
60
|
+
|
|
61
|
+
// // 3. Destroy the renderable after another short delay
|
|
62
|
+
// await new Promise(resolve => setTimeout(resolve, 2000));
|
|
63
|
+
// try {
|
|
64
|
+
// const renderableDestroyViaCmd = renderableDestroyFunctionInfo.fnViaCmd;
|
|
65
|
+
// await renderableDestroyViaCmd({ handle: createHandle });
|
|
66
|
+
// console.log(`testCommandService: Destroyed renderable with handle ${createHandle.uuid}`);
|
|
67
|
+
// } catch (error) {
|
|
68
|
+
// console.error('testCommandService: Error destroying renderable:', error);
|
|
69
|
+
// }
|
|
70
|
+
|
|
71
|
+
// console.log('>>> Finished testCommandService.');
|
|
72
|
+
// }
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { WitnessCmdData } from "@ibgib/core-gib/dist/witness/witness-cmd/witness-cmd-types.mjs";
|
|
2
|
+
import { APIFunctionInfo } from "../api-types.mjs";
|
|
3
|
+
import type { getAllFunctionInfos } from "../api-index.mjs";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @interface CommandBase - Base interface for all commands.
|
|
7
|
+
* Extends the structure for witness commands.
|
|
8
|
+
*/
|
|
9
|
+
export interface CommandDataBase<TCmds extends string, TCmdModifiers extends string[]> extends WitnessCmdData<TCmds, TCmdModifiers> {
|
|
10
|
+
/**
|
|
11
|
+
* notes to self for use by the LLM to describe their use of the command.
|
|
12
|
+
*/
|
|
13
|
+
notesToSelf?: string;
|
|
14
|
+
/**
|
|
15
|
+
* set to true if the model desires notification as soon as the command is completed.
|
|
16
|
+
* Note that this is not part of the intrinsic command, rather it is
|
|
17
|
+
* metadata regarding agent (internal LLM model) workflow.
|
|
18
|
+
*/
|
|
19
|
+
repromptWithResult?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @interface EnqueuedCommand - Represents a command enqueued with its resolve
|
|
24
|
+
* and reject functions.
|
|
25
|
+
*/
|
|
26
|
+
export interface EnqueuedCommand<TCommand extends CommandDataBase<string, string[]>> {
|
|
27
|
+
command: TCommand;
|
|
28
|
+
resolve: (result: any) => void;
|
|
29
|
+
reject: (error: Error) => void;
|
|
30
|
+
/**
|
|
31
|
+
* If the command is anonymous, then this will be set. Otherwise, the APIFunctionInfo
|
|
32
|
+
* that will be used will be whitelisted from {@link getAllFunctionInfos}.
|
|
33
|
+
*/
|
|
34
|
+
anonApiFn?: APIFunctionInfo<any>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @interface CommandService - Interface for the command service.
|
|
39
|
+
*/
|
|
40
|
+
export interface CommandService {
|
|
41
|
+
// /**
|
|
42
|
+
// * I'm adding this to enable anonymous functions. You must call this first
|
|
43
|
+
// * and then you can call {@link enqueueCommand}. If you don't register, then
|
|
44
|
+
// * you'll get an error.
|
|
45
|
+
// *
|
|
46
|
+
// * @see {@link commandifyAnonFn}
|
|
47
|
+
// */
|
|
48
|
+
// registerAnonFn({ apiFnInfo }: { apiFnInfo: APIFunctionInfo<any> }): void;
|
|
49
|
+
/**
|
|
50
|
+
* Enqueues a command to be executed.
|
|
51
|
+
* @param {EnqueuedCommand<TCommand>} enqueuedCommand - The command to enqueue with its resolve and reject functions.
|
|
52
|
+
*/
|
|
53
|
+
enqueueCommand<TCommand extends CommandDataBase<string, string[]>>(enqueuedCommand: EnqueuedCommand<TCommand>): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Starts processing the command queue.
|
|
57
|
+
* @returns {Promise<void>} A promise that resolves when the queue is empty.
|
|
58
|
+
*/
|
|
59
|
+
processQueue(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// export const commandBaseSchemaProperties = {
|
|
63
|
+
// repromptWithResult: {
|
|
64
|
+
// type: 'boolean',
|
|
65
|
+
// description: `Set this to true if you want to be reprompted with the function's result.`,
|
|
66
|
+
// },
|
|
67
|
+
// notesToSelf: {
|
|
68
|
+
// type: 'string',
|
|
69
|
+
// description: `Use this as a note to yourself when looking at this function call and/or its result.`,
|
|
70
|
+
// },
|
|
71
|
+
// } as const;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module get-ibgibs.mts
|
|
3
|
+
* Provides the API Function Info for the `getIbGibs` command, which allows
|
|
4
|
+
* editing an existing ibGib using the `mut8` transform.
|
|
5
|
+
*
|
|
6
|
+
* ## notes
|
|
7
|
+
*
|
|
8
|
+
* ### ordering imports
|
|
9
|
+
*
|
|
10
|
+
* import sections always go:
|
|
11
|
+
* 1. non-ibgib deps first
|
|
12
|
+
* 2. @ibgib/helper-gib, @ibgib/encrypt-gib, @ibgib/ts-gib, @ibgib/core-gib packages (in that order)
|
|
13
|
+
* 3. import GLOBAL_LOG_A_LOT then remaining project imports
|
|
14
|
+
* 4. code proper starts with the definition of `const logalot` (if applicable)
|
|
15
|
+
*
|
|
16
|
+
* Each section is separated by a blank line.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
import { extractErrorMsg, pretty } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
21
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
22
|
+
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
23
|
+
import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs';
|
|
24
|
+
import { SpaceId } from '@ibgib/core-gib/dist/witness/space/space-types.mjs';
|
|
25
|
+
|
|
26
|
+
import { GLOBAL_LOG_A_LOT } from '../../../constants.mjs';
|
|
27
|
+
import { APIFunctionInfo } from "../../api-types.mjs";
|
|
28
|
+
import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
29
|
+
import { getCommandService } from "../command-service-v1.mjs";
|
|
30
|
+
import { CommandDataBase } from "../command-types.mjs";
|
|
31
|
+
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.web.mjs';
|
|
32
|
+
import { FUNCTION_CALL_EXAMPLES_HEADER } from '../../api-constants.mjs';
|
|
33
|
+
import { getLatestAddrs } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
34
|
+
|
|
35
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
36
|
+
|
|
37
|
+
type IbGibMap = Record<IbGibAddr, IbGib_V1 | undefined>;
|
|
38
|
+
|
|
39
|
+
// #region constants
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* camelCased name of the command itself.
|
|
43
|
+
*/
|
|
44
|
+
const FUNCTION_NAME = 'getIbGibs';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* agent is the broad command which basically acts like a category of commands at this point.
|
|
48
|
+
*/
|
|
49
|
+
const CMD_CATEGORY = 'ibgib';
|
|
50
|
+
/**
|
|
51
|
+
* getIbGibs here is the specific command modifier which narrows down to a command
|
|
52
|
+
* instance, similar to a fully curried function.
|
|
53
|
+
*
|
|
54
|
+
* This should be camelCased actual name of the function.
|
|
55
|
+
*/
|
|
56
|
+
const CMD_MODIFIERS: string[] = [FUNCTION_NAME];
|
|
57
|
+
|
|
58
|
+
const EXAMPLE_INPUT_GETIBGIBS_SINGLE: Partial<GetIbGibsOpts> = {
|
|
59
|
+
ibGibAddrs: ['project SomeProject 1748386170000^A2D75E05B14E264619D24ABA4F1A1B2328E183B4524CC26029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994'],
|
|
60
|
+
notesToSelf: `Example of getting a single ibgib. Note that even though it's only getting a single ibgib, it still passes in an array. Usually reprompt is set because you're calling this to see the full ibgib record(s).`,
|
|
61
|
+
repromptWithResult: true,
|
|
62
|
+
};
|
|
63
|
+
const EXAMPLE_INPUT_GETIBGIBS_MULTIPLE: Partial<GetIbGibsOpts> = {
|
|
64
|
+
ibGibAddrs: [
|
|
65
|
+
'project SomeProject 1748386170000^A2D75E05B14E264619D24ABA4F1A1B2328E183B4524CC26029E54B84BF7BFD73.02544DDD1E042D481EAF62E36229EEC54F20C1899250D6F664ABB48A2013C994',
|
|
66
|
+
'comment HelloWorld^98289357698348694683943689487958972634583644598269186EA90A3F4A73.298986986BC82792837498759817F9827395872AC87519CDAFFE8175786E5098',
|
|
67
|
+
],
|
|
68
|
+
notesToSelf: `Example of getting multiple ibgibs. Usually reprompt is set because you're calling this to see the full ibgib record(s).`,
|
|
69
|
+
repromptWithResult: true,
|
|
70
|
+
};
|
|
71
|
+
const EXAMPLES = [
|
|
72
|
+
FUNCTION_CALL_EXAMPLES_HEADER,
|
|
73
|
+
pretty(EXAMPLE_INPUT_GETIBGIBS_SINGLE),
|
|
74
|
+
pretty(EXAMPLE_INPUT_GETIBGIBS_MULTIPLE),
|
|
75
|
+
].join('\n');
|
|
76
|
+
const FUNCTION_DESCRIPTION = [
|
|
77
|
+
`Gets one or more full ibgib records via their addrs.`,
|
|
78
|
+
`Note that all of these must be in a single space, determined by the spaceId arg. IF not provided, then the default local user space will be used.`,
|
|
79
|
+
EXAMPLES,
|
|
80
|
+
].join('\n');
|
|
81
|
+
|
|
82
|
+
// #region gemini schemas
|
|
83
|
+
export const GEMINI_SCHEMA_IBGIB_ADDRS = {
|
|
84
|
+
type: 'array',
|
|
85
|
+
description: 'The ibGib addresses (ib^gib) of the ibGibs to load.',
|
|
86
|
+
items: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'caret-delimited ib^gib address, e.g., "comment HelloWorld^98289357698348694683943689487958972634583644598269186EA90A3F4A73.298986986BC82792837498759817F9827395872AC87519CDAFFE8175786E5098"',
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const GET_IBGIBS_SCHEMA = {
|
|
92
|
+
name: FUNCTION_NAME,
|
|
93
|
+
description: FUNCTION_DESCRIPTION,
|
|
94
|
+
parameters: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
...COMMAND_BASE_SCHEMA_PROPERTIES,
|
|
98
|
+
spaceId: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
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.)`,
|
|
101
|
+
},
|
|
102
|
+
ibGibAddrs: GEMINI_SCHEMA_IBGIB_ADDRS,
|
|
103
|
+
getLatest: {
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
description: 'Set to true if you want to get the latest ibgib in a timeline for the given incoming ibGibAddr. This is usually going to be true, unless you are specifically looking for ibGibs in the past or some other use case where you want the specific ibGib in time, so agents should explicitly decide this before calling this function (but no need to tell the user or anything, just make this decision).'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
required: [
|
|
109
|
+
'ibGibAddrs',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
// #endregion gemini schemas
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @interface GetIbGibsOpts - Options for the getIbGibs command.
|
|
117
|
+
*
|
|
118
|
+
* @extends CommandDataBase
|
|
119
|
+
*/
|
|
120
|
+
export interface GetIbGibsOpts extends CommandDataBase<typeof CMD_CATEGORY, typeof CMD_MODIFIERS> {
|
|
121
|
+
spaceId?: SpaceId;
|
|
122
|
+
/**
|
|
123
|
+
* @property ibGibAddr - The address (or tjp address) of the project ibGib to edit.
|
|
124
|
+
*/
|
|
125
|
+
ibGibAddrs: IbGibAddr[];
|
|
126
|
+
/**
|
|
127
|
+
* @property getLatest - flag that if true will get the latest version of
|
|
128
|
+
* the ibGib registered with the space.
|
|
129
|
+
*/
|
|
130
|
+
getLatest?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @interface GetIbGibsCommandData - Command data for the getIbGibs command.
|
|
135
|
+
* @extends CommandDataBase
|
|
136
|
+
*/
|
|
137
|
+
export interface GetIbGibsCommandData extends CommandDataBase<typeof CMD_CATEGORY, [typeof FUNCTION_NAME]> {
|
|
138
|
+
/**
|
|
139
|
+
* @see {@link GetIbGibsOpts.spaceId}
|
|
140
|
+
*/
|
|
141
|
+
spaceId?: string;
|
|
142
|
+
/**
|
|
143
|
+
* @see {@link GetIbGibsOpts.ibGibAddrs}
|
|
144
|
+
*/
|
|
145
|
+
ibGibAddrs: IbGibAddr[];
|
|
146
|
+
/**
|
|
147
|
+
* @see {@link GetIbGibsOpts.getLatest}
|
|
148
|
+
*/
|
|
149
|
+
getLatest?: boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type GetIbGibsResult = IbGibMap;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Wrapper function to enqueue the getIbGibs command.
|
|
156
|
+
* @param {GetIbGibsOpts} opts - @see {@link GetIbGibsOpts}
|
|
157
|
+
* @returns {Promise<void>} A promise that resolves when the command finishes execution.
|
|
158
|
+
*/
|
|
159
|
+
function getIbGibsViaCmd(opts: GetIbGibsOpts): Promise<GetIbGibsResult> {
|
|
160
|
+
const commandService = getCommandService();
|
|
161
|
+
const command: GetIbGibsCommandData = {
|
|
162
|
+
...opts,
|
|
163
|
+
cmd: CMD_CATEGORY,
|
|
164
|
+
cmdModifiers: CMD_MODIFIERS,
|
|
165
|
+
};
|
|
166
|
+
return new Promise<GetIbGibsResult>((resolve, reject) => {
|
|
167
|
+
commandService.enqueueCommand({ command, resolve, reject });
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Implementation function for the getIbGibs command.
|
|
173
|
+
*
|
|
174
|
+
* @param {GetIbGibsOpts} opts - @see {@link GetIbGibsOpts}
|
|
175
|
+
* @returns {Promise<IbGib_V1>} the new timeline ibgib
|
|
176
|
+
*/
|
|
177
|
+
async function getIbGibsImpl(opts: GetIbGibsOpts): Promise<GetIbGibsResult> {
|
|
178
|
+
const lc = `[${getIbGibsImpl.name}]`;
|
|
179
|
+
try {
|
|
180
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
181
|
+
|
|
182
|
+
console.log(`${lc} ${CMD_CATEGORY} ${CMD_MODIFIERS} opts: ${pretty(opts)}`);
|
|
183
|
+
|
|
184
|
+
let { spaceId, ibGibAddrs, getLatest } = opts;
|
|
185
|
+
|
|
186
|
+
if (!ibGibAddrs) { throw new Error(`(UNEXPECTED) ibGibAddrs falsy? (E: e9beaad8ab3cf56608dd5fc79c4c1825)`); }
|
|
187
|
+
if (ibGibAddrs.length === 0) { throw new Error(`ibGibAddrs is empty (E: f0b1462f482872acba0612c8eb461925)`); }
|
|
188
|
+
|
|
189
|
+
const metaspace = await getGlobalMetaspace_waitIfNeeded();
|
|
190
|
+
if (!metaspace) { throw new Error(`${lc} metaspace falsy ($1: 85aa77c76e583edda3549ff59fadf825)`); }
|
|
191
|
+
const space = await metaspace.getLocalUserSpace({ localSpaceId: spaceId });
|
|
192
|
+
if (!space) {
|
|
193
|
+
if (!spaceId) {
|
|
194
|
+
throw new Error(`(UNEXPECTED) couldn't get default local user space? ($1: 9b1528024148052dd871b4f323881825)`);
|
|
195
|
+
} else {
|
|
196
|
+
throw new Error(`could not get local user space for spaceId (${spaceId}) ($1: genuuid)`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let addrToLatestAddrMap: { [addr: string]: IbGibAddr } = {};
|
|
201
|
+
if (getLatest) {
|
|
202
|
+
const resLatestAddrs = await getLatestAddrs({ addrs: ibGibAddrs, space });
|
|
203
|
+
if (!resLatestAddrs.data) { throw new Error(`(UNEXPECTED) resLatestAddrs.data falsy? we tried calling getLatestAddrs and this means there is a problem lower in the lib. (E: 0baaf8072abd4feed8330ab503925b25)`); }
|
|
204
|
+
if (resLatestAddrs.data.latestAddrsMap) {
|
|
205
|
+
// addrToLatestAddrMap = resLatestAddrs.data.latestAddrsMap;
|
|
206
|
+
Object.entries(resLatestAddrs.data.latestAddrsMap)
|
|
207
|
+
.forEach(([addr, latestAddr]) => {
|
|
208
|
+
if (latestAddr) {
|
|
209
|
+
addrToLatestAddrMap[addr] = latestAddr;
|
|
210
|
+
} else {
|
|
211
|
+
debugger; // warn - we're getting latest addrs and I don't know what it means downstream when we get a null for latest addr.
|
|
212
|
+
console.warn(`${lc} we're getting latest addrs and I don't know what it means downstream when we get a null for latest addr. (W: bb1db99ccf189afff83a1b5807263a25)`);
|
|
213
|
+
addrToLatestAddrMap[addr] = addr;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
} else {
|
|
217
|
+
throw new Error(`(UNEXPECTED) resLatestAddrs.data.latestAddrsMap falsy? we tried calling getLatestAddrs and this was supposed to be the resulting map. This means there is a problem lower in the lib. (E: 9dcca8343a284dfb1a43cf282b82f825)`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const addrsToGet = getLatest ?
|
|
222
|
+
Object.values(addrToLatestAddrMap) :
|
|
223
|
+
ibGibAddrs;
|
|
224
|
+
|
|
225
|
+
if (addrsToGet.length !== ibGibAddrs.length) {
|
|
226
|
+
throw new Error(`(UNEXPECTED) addrsToGet.length !== ibGibAddrs.length? at this point it's assumed that these are the same length (E: 745698a1ba78a14077d648e8d0150825)`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let resGet = await metaspace.get({
|
|
230
|
+
addrs: addrsToGet,
|
|
231
|
+
space,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if (resGet.errorMsg || (resGet.ibGibs ?? []).length !== addrsToGet.length) {
|
|
235
|
+
throw new Error(`getIbGibs failed. error: ${extractErrorMsg(resGet.errorMsg ?? `[unknown error. resGet.ibGib length (${(resGet.ibGibs ?? []).length}). addrsToGet.length (${addrsToGet.length})]`)} (E: 09aca916068c6254580f5e29fb63e825)`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const resMap: IbGibMap = {};
|
|
239
|
+
|
|
240
|
+
resGet.ibGibs!.forEach(ibGib => {
|
|
241
|
+
const ibGibAddr = getIbGibAddr({ ibGib });
|
|
242
|
+
const addr = addrsToGet.find(x => x === ibGibAddr);
|
|
243
|
+
if (!addr) { throw new Error(`ibGibAddr (${ibGibAddr}) in result ibGibs not found in addrsToGet (${addrsToGet})? Here are the original ibGibAddrs: ${ibGibAddrs}. Here is the resGet.ibGibs: ${pretty(resGet.ibGibs)} (E: 07535883a3a89fcb686f2409bf799825)`); }
|
|
244
|
+
resMap[ibGibAddr] = ibGib;
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
if (logalot) { console.log(`${lc} resMap: ${pretty(resMap)} (I: 70d79d873dd271949b48d837c286d825)`); }
|
|
248
|
+
|
|
249
|
+
return resMap;
|
|
250
|
+
} catch (error) {
|
|
251
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
252
|
+
throw error; // Re-throw the error to be caught by the command service
|
|
253
|
+
} finally {
|
|
254
|
+
// This finally block will execute regardless of whether the try block succeeds or fails.
|
|
255
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* API function info for the getIbGibs command.
|
|
261
|
+
*/
|
|
262
|
+
export const getIbGibsFunctionInfo: APIFunctionInfo<typeof getIbGibsViaCmd> = {
|
|
263
|
+
nameOrId: FUNCTION_NAME,
|
|
264
|
+
fnViaCmd: getIbGibsViaCmd,
|
|
265
|
+
functionImpl: getIbGibsImpl,
|
|
266
|
+
cmd: CMD_CATEGORY,
|
|
267
|
+
cmdModifiers: CMD_MODIFIERS,
|
|
268
|
+
schema: GET_IBGIBS_SCHEMA,
|
|
269
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { APIFunctionInfo } from "../../api-types.mjs";
|
|
2
|
+
import { getIbGibsFunctionInfo } from "./get-ibgibs.mjs";
|
|
3
|
+
import { mut8IbGibFunctionInfo } from "./mut8-ibgib.mjs";
|
|
4
|
+
|
|
5
|
+
export const IbGibAPIFunctionInfos: APIFunctionInfo<any>[] = [
|
|
6
|
+
getIbGibsFunctionInfo,
|
|
7
|
+
mut8IbGibFunctionInfo,
|
|
8
|
+
];
|