@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,730 @@
|
|
|
1
|
+
import { extractErrorMsg, getSaferSubstring, getTimestamp, getTimestampInTicks, pretty, unique } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
2
|
+
import { Ib, TransformResult } from '@ibgib/ts-gib/dist/types.mjs';
|
|
3
|
+
import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs';
|
|
4
|
+
import { validateIbGibIntrinsically } from '@ibgib/ts-gib/dist/V1/validate-helper.mjs';
|
|
5
|
+
import { IbGib_V1, } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
6
|
+
import { mut8 } from '@ibgib/ts-gib/dist/V1/transforms/mut8.mjs';
|
|
7
|
+
import { fork } from '@ibgib/ts-gib/dist/V1/transforms/fork.mjs';
|
|
8
|
+
import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
9
|
+
import { createCommentIbGib } from '@ibgib/core-gib/dist/common/comment/comment-helper.mjs';
|
|
10
|
+
import { CommentIbGib_V1 } from '@ibgib/core-gib/dist/common/comment/comment-types.mjs';
|
|
11
|
+
import { getLatestAddrs, parseSpaceIb, persistTransformResult } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
12
|
+
import { IbGibSpaceAny } from '@ibgib/core-gib/dist/witness/space/space-base-v1.mjs';
|
|
13
|
+
import { getTimestampInfo } from '@ibgib/core-gib/dist/common/other/ibgib-helper.mjs';
|
|
14
|
+
import { MetaspaceService } from '@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs';
|
|
15
|
+
import { appendToTimeline, mut8Timeline } from '@ibgib/core-gib/dist/timeline/timeline-api.mjs';
|
|
16
|
+
|
|
17
|
+
import { GLOBAL_LOG_A_LOT } from '../../constants.mjs';
|
|
18
|
+
import {
|
|
19
|
+
PROJECT_ATOM, PROJECT_DESC_REGEXP, PROJECT_NAME_REGEXP,
|
|
20
|
+
DEFAULT_PROJECT_SAFE_NAME_LENGTH, DEFAULT_PROJECT_ADDL_METADATA_LENGTH,
|
|
21
|
+
PROJECT_CHILD_DEFAULT_REL8N_NAME,
|
|
22
|
+
} from './project-constants.mjs'; // Constants file to be created
|
|
23
|
+
import {
|
|
24
|
+
ProjectData_V1, ProjectIbGib_V1, ProjectIbInfo, ProjectAddlMetadataInfo,
|
|
25
|
+
} from './project-types.mjs';
|
|
26
|
+
import { getAgentsSvc } from '../../witness/agent/agents-service-v1.mjs';
|
|
27
|
+
import { AGENT_SPECIAL_IBGIB_TYPE_PROJECTAGENT } from '../../agent-texts/project-agent-texts.mjs';
|
|
28
|
+
|
|
29
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
30
|
+
|
|
31
|
+
export function getProjectSafeName({ name }: { name: string }): string {
|
|
32
|
+
const lc = `[${getProjectSafeName.name}]`;
|
|
33
|
+
try {
|
|
34
|
+
if (logalot) { console.log(`${lc} starting... (I: ec0c81cb0e8ec820f882ecafc2fbc825)`); }
|
|
35
|
+
const safeName = getSaferSubstring({
|
|
36
|
+
text: name,
|
|
37
|
+
length: DEFAULT_PROJECT_SAFE_NAME_LENGTH,
|
|
38
|
+
});
|
|
39
|
+
if (!safeName) { throw new Error(`${lc} Could not generate safeName from name: ${name}. (E: genuuid)`); }
|
|
40
|
+
return safeName;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
43
|
+
throw error;
|
|
44
|
+
} finally {
|
|
45
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Generates the `ib` string for a ProjectIbGib based on its data.
|
|
51
|
+
* The structure is: `${PROJECT_ATOM} ${safeName} ${addlMetadataText}`
|
|
52
|
+
* where addlMetadataText contains underscore-delimited fields like timestampInTicks.
|
|
53
|
+
*
|
|
54
|
+
* ## notes
|
|
55
|
+
*
|
|
56
|
+
* atow (04/2025), we are "descending" (forking) from a source comment ibgib to
|
|
57
|
+
* create the project. As such, we are positioning the project ibgib itself to
|
|
58
|
+
* have a similar structure to a comment ibgib. So the schema for the `ib`
|
|
59
|
+
* purposefully has the safeName in the second position just like a comment
|
|
60
|
+
* ibgib has a saferized version of the comment.data.text in its ib schema.
|
|
61
|
+
*
|
|
62
|
+
* WARNING
|
|
63
|
+
* WARNING
|
|
64
|
+
* ATOW (05/2025) THIS FUNCTION'S DETAILS ARE USED IN MUT8-IBGIB
|
|
65
|
+
* APIFUNCTIONINFO. IF THIS CHANGES, THEN THAT FUNCTION MUST BE CHANGED TOO.
|
|
66
|
+
* WARNING
|
|
67
|
+
* WARNING
|
|
68
|
+
*
|
|
69
|
+
* @see {@link ProjectIbInfo}
|
|
70
|
+
* @see {@link ProjectAddlMetadataInfo}
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
export function getProjectIb({
|
|
74
|
+
data,
|
|
75
|
+
}: {
|
|
76
|
+
data: ProjectData_V1;
|
|
77
|
+
}): string {
|
|
78
|
+
const lc = `[${getProjectIb.name}]`;
|
|
79
|
+
try {
|
|
80
|
+
const validationErrors = validateProjectData_V1({ data }) ?? [];
|
|
81
|
+
if (validationErrors.length > 0) {
|
|
82
|
+
throw new Error(`invalid Project data. errors: ${validationErrors} (E: d93d821fcc256b4bcb4d785b08c2f425)`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Get saferized name segment
|
|
86
|
+
const safeName = getProjectSafeName({ name: data.name });
|
|
87
|
+
|
|
88
|
+
// Prepare additional metadata text (add more fields with underscores here later)
|
|
89
|
+
|
|
90
|
+
// timestampInTicks
|
|
91
|
+
const timestampInfo = getTimestampInfo({ timestamp: data.timestamp });
|
|
92
|
+
if (!timestampInfo.valid) { throw new Error(`(UNEXPECTED) validated data but invalid data.timestamp? (E: 679cbf1c92e8b9473becf8310e6b8225)`); }
|
|
93
|
+
const timestampInTicks = Number.parseInt(timestampInfo.ticks);
|
|
94
|
+
|
|
95
|
+
// compose addlMetadataText
|
|
96
|
+
const addlMetadataFields: string[] = [
|
|
97
|
+
timestampInTicks.toString(),
|
|
98
|
+
// add more fields here as needed in the future
|
|
99
|
+
];
|
|
100
|
+
addlMetadataFields.push();
|
|
101
|
+
const addlMetadataText = addlMetadataFields.join('_');
|
|
102
|
+
if (addlMetadataText.length > DEFAULT_PROJECT_ADDL_METADATA_LENGTH) {
|
|
103
|
+
throw new Error(`(UNEXPECTED) addlMetadataText.length > DEFAULT_PROJECT_ADDL_METADATA_LENGTH (${DEFAULT_PROJECT_ADDL_METADATA_LENGTH})? (E: 8fed8709283f6be2d8deda13b67b3925)`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Construct the final ib string
|
|
107
|
+
return `${PROJECT_ATOM} ${safeName} ${addlMetadataText}`;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
console.error(`${lc} ${error.message}`);
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function validateProjectIb({
|
|
115
|
+
ib,
|
|
116
|
+
}: {
|
|
117
|
+
ib: Ib;
|
|
118
|
+
}): string[] | undefined {
|
|
119
|
+
const lc = `[${validateProjectIb.name}]`;
|
|
120
|
+
try {
|
|
121
|
+
if (logalot) { console.log(`${lc} starting... (I: 111f6b5630badb921accdc6c224c0425)`); }
|
|
122
|
+
|
|
123
|
+
// major hack here...I'm tired of doing this plumbing shit.
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
const _info = parseProjectIb({ ib });
|
|
127
|
+
} catch (error) {
|
|
128
|
+
return [extractErrorMsg(error)];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return undefined;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
134
|
+
throw error;
|
|
135
|
+
} finally {
|
|
136
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Parses a project `ib` string into its components.
|
|
142
|
+
*
|
|
143
|
+
* @see {@link getProjectIb} for expected ib schema
|
|
144
|
+
*/
|
|
145
|
+
export function parseProjectIb({
|
|
146
|
+
ib,
|
|
147
|
+
}: {
|
|
148
|
+
ib: Ib;
|
|
149
|
+
}): ProjectIbInfo {
|
|
150
|
+
const lc = `[${parseProjectIb.name}]`;
|
|
151
|
+
try {
|
|
152
|
+
if (logalot) { console.log(`${lc} starting... parsing ib: ${ib}`); }
|
|
153
|
+
if (!ib) { throw new Error(`${lc} ib required (E: genuuid)`); }
|
|
154
|
+
|
|
155
|
+
const pieces = ib.split(' ');
|
|
156
|
+
if (pieces.length !== 3) { throw new Error(`${lc} Invalid project ib format. Expected 3 space-delimited pieces. Got: ${pieces.length}. ib: ${ib} (E: genuuid)`); }
|
|
157
|
+
|
|
158
|
+
const [atom, safeName, addlMetadataText] = pieces;
|
|
159
|
+
|
|
160
|
+
if (atom !== PROJECT_ATOM) { throw new Error(`${lc} Invalid atom. Expected '${PROJECT_ATOM}', got '${atom}'. ib: ${ib} (E: genuuid)`); }
|
|
161
|
+
|
|
162
|
+
if (!safeName) { throw new Error(`${lc} safeName segment is empty. ib: ${ib} (E: genuuid)`); }
|
|
163
|
+
|
|
164
|
+
if (!addlMetadataText) { throw new Error(`${lc} addlMetadataText segment is empty. ib: ${ib} (E: genuuid)`); }
|
|
165
|
+
|
|
166
|
+
// Parse the underscore-delimited addlMetadataText
|
|
167
|
+
const metadataPieces = addlMetadataText.split('_');
|
|
168
|
+
if (metadataPieces.length !== 1) { throw new Error(`${lc} Could not parse addlMetadataText. Expected 1 underscore-delimited piece. Got: ${metadataPieces.length}. addlMetadataText: ${addlMetadataText} (E: genuuid)`); }
|
|
169
|
+
|
|
170
|
+
const timestampInTicksStr = metadataPieces[0];
|
|
171
|
+
const timestampInTicks = parseInt(timestampInTicksStr, 10);
|
|
172
|
+
if (isNaN(timestampInTicks)) { throw new Error(`${lc} Could not parse timestampInTicks from addlMetadataText. isNan. Expected a decimal number. timestampInTicksStr: ${timestampInTicksStr}. addlMetadataText: ${addlMetadataText} (E: genuuid)`); }
|
|
173
|
+
|
|
174
|
+
const addlMetadata: ProjectAddlMetadataInfo = {
|
|
175
|
+
timestampInTicks,
|
|
176
|
+
// otherField, // if added
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const result: ProjectIbInfo = {
|
|
180
|
+
atom: PROJECT_ATOM,
|
|
181
|
+
safeName,
|
|
182
|
+
addlMetadataText,
|
|
183
|
+
addlMetadata,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
if (logalot) { console.log(`${lc} parsed info: ${pretty(result)}`); }
|
|
187
|
+
return result;
|
|
188
|
+
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error(`${lc} ${error.message}`);
|
|
191
|
+
throw error;
|
|
192
|
+
} finally {
|
|
193
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Validates the ProjectData_V1 structure.
|
|
199
|
+
* Returns array of error messages if invalid, otherwise undefined.
|
|
200
|
+
*/
|
|
201
|
+
export function validateProjectData_V1({
|
|
202
|
+
data,
|
|
203
|
+
}: {
|
|
204
|
+
data: ProjectData_V1 | any;
|
|
205
|
+
}): string[] | undefined {
|
|
206
|
+
const lc = `[${validateProjectData_V1.name}]`;
|
|
207
|
+
const errors: string[] = [];
|
|
208
|
+
try {
|
|
209
|
+
if (logalot) { console.log(`${lc} starting... (I: ac9c21893f38a2500fcb49ee26f0b325)`); }
|
|
210
|
+
|
|
211
|
+
if (!data) {
|
|
212
|
+
errors.push("Data is required.");
|
|
213
|
+
return errors; /* <<<< returns early */
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (data.name) {
|
|
217
|
+
if (typeof data.name === 'string') {
|
|
218
|
+
if (!PROJECT_NAME_REGEXP.test(data.name)) {
|
|
219
|
+
errors.push(`data.name must match regexp: ${PROJECT_NAME_REGEXP.source}`);
|
|
220
|
+
}
|
|
221
|
+
} else {
|
|
222
|
+
errors.push("Name must be a string.");
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
errors.push("name required")
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (data.description) {
|
|
229
|
+
if (typeof data.description === 'string') {
|
|
230
|
+
if (!PROJECT_DESC_REGEXP.test(data.description)) {
|
|
231
|
+
errors.push(`data.description must match regexp: ${PROJECT_DESC_REGEXP.source}`);
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
errors.push("Description must be a string.");
|
|
235
|
+
}
|
|
236
|
+
} else {
|
|
237
|
+
// not required
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// export interface CommentData_V1 extends IbGibData_V1 {
|
|
241
|
+
// text: string;
|
|
242
|
+
// textTimestamp?: string;
|
|
243
|
+
// timestamp?: string;
|
|
244
|
+
// }
|
|
245
|
+
|
|
246
|
+
if (data.text) {
|
|
247
|
+
if (typeof data.text === 'string') {
|
|
248
|
+
// any more checks on text?
|
|
249
|
+
} else {
|
|
250
|
+
errors.push("data.text must be a non-empty string. project's text is meant to be the primary reason/focus for the project.");
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
errors.push(`data.text required`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (data.textTimestamp) {
|
|
257
|
+
if (typeof data.textTimestamp === 'string') {
|
|
258
|
+
const resValid = getTimestampInfo({ timestamp: data.textTimestamp });
|
|
259
|
+
if (!resValid.valid) {
|
|
260
|
+
errors.push(`data.textTimestamp (${data.textTimestamp}) is not a valid timestamp: ${resValid.emsg}`);
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
errors.push("data.textTimestamp must be a string.");
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
// why would this be falsy?
|
|
267
|
+
console.warn(`${lc} data.textTimestamp not provided. (W: genuuid)`);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (data.timestamp) {
|
|
271
|
+
if (typeof data.timestamp === 'string') {
|
|
272
|
+
const resValid = getTimestampInfo({ timestamp: data.timestamp });
|
|
273
|
+
if (!resValid.valid) {
|
|
274
|
+
errors.push(`data.timestamp (${data.timestamp}) is not a valid timestamp: ${resValid.emsg}`);
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
errors.push("data.timestamp must be a string.");
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
// why would this be falsy?
|
|
281
|
+
console.warn(`${lc} data.timestamp not provided. (W: genuuid)`);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return errors.length > 0 ? errors : undefined;
|
|
285
|
+
} catch (error) {
|
|
286
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
287
|
+
return [`Unexpected error during validation: ${extractErrorMsg(error)} (E: genuuid)`];
|
|
288
|
+
} finally {
|
|
289
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Validates a ProjectIbGib_V1 intrinsically, its data, and the consistency
|
|
296
|
+
* between the ib string and the data content.
|
|
297
|
+
* Returns an array of error messages if invalid, otherwise undefined.
|
|
298
|
+
*/
|
|
299
|
+
export async function validateProjectIbGib_V1({
|
|
300
|
+
ibGib,
|
|
301
|
+
}: {
|
|
302
|
+
ibGib: IbGib_V1;
|
|
303
|
+
}): Promise<string[] | undefined> {
|
|
304
|
+
const lc = `[${validateProjectIbGib_V1.name}]`;
|
|
305
|
+
const allErrors: string[] = [];
|
|
306
|
+
try {
|
|
307
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
308
|
+
if (!ibGib) {
|
|
309
|
+
allErrors.push('ibGib is required.');
|
|
310
|
+
return allErrors;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 1. Basic intrinsic validation (ib, gib, data, rel8ns presence, gib calc)
|
|
314
|
+
const intrinsicErrors = await validateIbGibIntrinsically({ ibGib }) ?? [];
|
|
315
|
+
if (intrinsicErrors.length > 0) {
|
|
316
|
+
return intrinsicErrors; /* <<<< returns early */
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const dataErrors = validateProjectData_V1({ data: ibGib.data as ProjectData_V1 }) ?? [];
|
|
320
|
+
dataErrors.forEach(x => allErrors.push(x));
|
|
321
|
+
|
|
322
|
+
const ibErrors = validateProjectIb({ ib: ibGib.ib }) ?? [];
|
|
323
|
+
ibErrors.forEach(x => allErrors.push(x));
|
|
324
|
+
|
|
325
|
+
// not doing this for now
|
|
326
|
+
const rel8nsErrors = [];
|
|
327
|
+
rel8nsErrors.forEach(x => allErrors.push(x));
|
|
328
|
+
|
|
329
|
+
return allErrors.length > 0 ? allErrors : undefined;
|
|
330
|
+
} catch (error) {
|
|
331
|
+
console.error(`${lc} ${extractErrorMsg(error)} (E: genuuid)`);
|
|
332
|
+
// Return validation data indicating an unexpected error occurred
|
|
333
|
+
return [`Unexpected error during validation: ${extractErrorMsg(error)} (E: genuuid)`];
|
|
334
|
+
} finally {
|
|
335
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Type guard to check if an object conforms to ProjectData_V1 structure.
|
|
341
|
+
*/
|
|
342
|
+
export function isProjectData_V1(data: any): data is ProjectData_V1 {
|
|
343
|
+
const lc = `[${isProjectData_V1.name}]`;
|
|
344
|
+
try {
|
|
345
|
+
if (logalot) { console.log(`${lc} starting... (I: 959a0308e86d328cb1e68aab8385df25)`); }
|
|
346
|
+
|
|
347
|
+
const errors = validateProjectData_V1({ data }) ?? [];
|
|
348
|
+
return errors.length === 0;
|
|
349
|
+
} catch (error) {
|
|
350
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
351
|
+
return false;
|
|
352
|
+
} finally {
|
|
353
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Type guard to check if an IbGib_V1 is structurally a ProjectIbGib_V1.
|
|
359
|
+
* Verifies the atom in the ib and checks data structure using isProjectData_V1.
|
|
360
|
+
*/
|
|
361
|
+
export function isProjectIbGib_V1(ibGib: IbGib_V1): ibGib is ProjectIbGib_V1 {
|
|
362
|
+
if (!ibGib || !ibGib.ib || !ibGib.data) { return false; }
|
|
363
|
+
// Check if atom is 'project'
|
|
364
|
+
if (!ibGib.ib.startsWith(`${PROJECT_ATOM} `)) { return false; }
|
|
365
|
+
// Check data structure
|
|
366
|
+
return isProjectData_V1(ibGib.data);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Creates a new Project ibGib.
|
|
371
|
+
*/
|
|
372
|
+
export async function createProjectIbGib({
|
|
373
|
+
name,
|
|
374
|
+
srcCommentIbGib,
|
|
375
|
+
description,
|
|
376
|
+
saveInSpace,
|
|
377
|
+
space,
|
|
378
|
+
}: {
|
|
379
|
+
name: string;
|
|
380
|
+
/**
|
|
381
|
+
* NOT implemented yet
|
|
382
|
+
*/
|
|
383
|
+
srcCommentIbGib?: CommentIbGib_V1,
|
|
384
|
+
description?: string;
|
|
385
|
+
/**
|
|
386
|
+
* If true, saves the newly created project ibgib and all intermediate
|
|
387
|
+
* dependency ibgibs (dna and others) in the given {@link space}, or default
|
|
388
|
+
* local space if that is falsy.
|
|
389
|
+
*/
|
|
390
|
+
saveInSpace?: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* If set and {@link saveInSpace} is true, then this will be where all
|
|
393
|
+
* ibgibs are saved.
|
|
394
|
+
*/
|
|
395
|
+
space?: IbGibSpaceAny;
|
|
396
|
+
}): Promise<TransformResult<ProjectIbGib_V1>> {
|
|
397
|
+
const lc = `[${createProjectIbGib.name}]`;
|
|
398
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
399
|
+
try {
|
|
400
|
+
if (!name) { throw new Error(`${lc} required. (E: genuuid)`); }
|
|
401
|
+
|
|
402
|
+
// start with a comment ibgib as the genesis of the project.
|
|
403
|
+
let resSrcCommentIbGib: TransformResult<CommentIbGib_V1> | undefined = undefined;
|
|
404
|
+
if (!srcCommentIbGib) {
|
|
405
|
+
resSrcCommentIbGib = await createCommentIbGib({
|
|
406
|
+
text: [
|
|
407
|
+
`# ${name}`,
|
|
408
|
+
``,
|
|
409
|
+
description ?? `initial comment`, // a little programming humor
|
|
410
|
+
].join('\n'),
|
|
411
|
+
saveInSpace,
|
|
412
|
+
space,
|
|
413
|
+
});
|
|
414
|
+
srcCommentIbGib = resSrcCommentIbGib.newIbGib;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const safeName = getSaferSubstring({
|
|
418
|
+
text: name,
|
|
419
|
+
length: DEFAULT_PROJECT_SAFE_NAME_LENGTH,
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
const resNewProjectFork = await fork({
|
|
423
|
+
src: srcCommentIbGib,
|
|
424
|
+
destIb: `${PROJECT_ATOM} ${safeName}`, // will do the full destIb in the next mut8 step
|
|
425
|
+
cloneData: true,
|
|
426
|
+
cloneRel8ns: true,
|
|
427
|
+
tjp: { uuid: true, timestamp: true },
|
|
428
|
+
dna: true,
|
|
429
|
+
nCounter: true,
|
|
430
|
+
}) as TransformResult<CommentIbGib_V1>;
|
|
431
|
+
|
|
432
|
+
// we now have an intermediate ibgib that is essentially a clone of the
|
|
433
|
+
// src comment but with new tjp/timestamp metadata. We need to convert
|
|
434
|
+
// this to a project ibgib.
|
|
435
|
+
|
|
436
|
+
const now = new Date();
|
|
437
|
+
const timestamp = getTimestamp(now);
|
|
438
|
+
const timestampMs = now.getMilliseconds();
|
|
439
|
+
/**
|
|
440
|
+
* This drives the project.ib, but may not be 100% the final data. But
|
|
441
|
+
* the pieces that drive the ib should be accurate.
|
|
442
|
+
*/
|
|
443
|
+
const fullNewDataSortOf: ProjectData_V1 = {
|
|
444
|
+
...resNewProjectFork.newIbGib.data!,
|
|
445
|
+
timestamp, timestampMs,
|
|
446
|
+
name,
|
|
447
|
+
description,
|
|
448
|
+
}
|
|
449
|
+
const newIb = getProjectIb({ data: fullNewDataSortOf });
|
|
450
|
+
if (logalot) { console.log(`${lc} newIb: ${newIb}. (I: 60804a0c0e575d525855926a9712d825)`); }
|
|
451
|
+
|
|
452
|
+
const dataToAddOrPatch: Partial<ProjectData_V1> = {
|
|
453
|
+
...resNewProjectFork.newIbGib.data,
|
|
454
|
+
timestamp, timestampMs,
|
|
455
|
+
name,
|
|
456
|
+
description,
|
|
457
|
+
};
|
|
458
|
+
if (logalot) { console.log(`${lc} dataToAddOrPatch: ${pretty(dataToAddOrPatch)} (I: 70129a2aeaa4e9df5d42137c479f4f25)`); }
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* finalizes the new project (not forever, but in terms of this fn)
|
|
462
|
+
*/
|
|
463
|
+
const resNewProjectMut8 = await mut8({
|
|
464
|
+
src: resNewProjectFork.newIbGib,
|
|
465
|
+
mut8Ib: newIb,
|
|
466
|
+
dataToAddOrPatch,
|
|
467
|
+
noTimestamp: true,
|
|
468
|
+
dna: true,
|
|
469
|
+
nCounter: true,
|
|
470
|
+
}) as TransformResult<ProjectIbGib_V1>;
|
|
471
|
+
if (logalot) { console.log(`${lc} resNewProjectMut8.newIbGib: ${pretty(resNewProjectMut8.newIbGib)} (I: c0bca72cced2edbe69956774c09ad925)`); }
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* depending on if we created our own new srcCommentIbGib, contains all the
|
|
475
|
+
* newly created ibgibs required for the new project.
|
|
476
|
+
*/
|
|
477
|
+
let resNewProject: TransformResult<ProjectIbGib_V1>;
|
|
478
|
+
if (resSrcCommentIbGib) {
|
|
479
|
+
// had to do a comment ibgib, so merge the transform results
|
|
480
|
+
resNewProject = {
|
|
481
|
+
newIbGib: resNewProjectMut8.newIbGib,
|
|
482
|
+
intermediateIbGibs: [
|
|
483
|
+
...resSrcCommentIbGib.intermediateIbGibs ?? [],
|
|
484
|
+
resSrcCommentIbGib.newIbGib,
|
|
485
|
+
...resNewProjectFork.intermediateIbGibs ?? [],
|
|
486
|
+
resNewProjectFork.newIbGib,
|
|
487
|
+
...resNewProjectMut8.intermediateIbGibs ?? [],
|
|
488
|
+
],
|
|
489
|
+
dnas: [
|
|
490
|
+
...resSrcCommentIbGib.dnas ?? [],
|
|
491
|
+
...resNewProjectFork.dnas ?? [],
|
|
492
|
+
...resNewProjectMut8.dnas ?? [],
|
|
493
|
+
],
|
|
494
|
+
};
|
|
495
|
+
} else {
|
|
496
|
+
// had to do a comment ibgib, so merge the transform results
|
|
497
|
+
resNewProject = {
|
|
498
|
+
newIbGib: resNewProjectMut8.newIbGib,
|
|
499
|
+
intermediateIbGibs: [
|
|
500
|
+
...resNewProjectFork.intermediateIbGibs ?? [],
|
|
501
|
+
resNewProjectFork.newIbGib,
|
|
502
|
+
...resNewProjectMut8.intermediateIbGibs ?? [],
|
|
503
|
+
],
|
|
504
|
+
dnas: [
|
|
505
|
+
...resNewProjectFork.dnas ?? [],
|
|
506
|
+
...resNewProjectMut8.dnas ?? [],
|
|
507
|
+
],
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (saveInSpace) {
|
|
512
|
+
if (!space) {
|
|
513
|
+
throw new Error(`(UNEXPECTED) saveInSpace true but space falsy? (E: 492e86a326fd099f4d28a5286809d625)`);
|
|
514
|
+
}
|
|
515
|
+
await persistTransformResult({ resTransform: resNewProject, space });
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return resNewProject;
|
|
519
|
+
} catch (error) {
|
|
520
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
521
|
+
throw error;
|
|
522
|
+
} finally {
|
|
523
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
interface AddChildOptsDetails_Text {
|
|
528
|
+
type: 'text';
|
|
529
|
+
title?: string;
|
|
530
|
+
text?: string;
|
|
531
|
+
}
|
|
532
|
+
interface AddChildOptsDetails_Canvas {
|
|
533
|
+
wakka: string
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* discriminate union other options here
|
|
538
|
+
*/
|
|
539
|
+
type AddChildOptsDetails = AddChildOptsDetails_Text | AddChildOptsDetails_Canvas;
|
|
540
|
+
|
|
541
|
+
interface AddChildOpts<TDetails extends AddChildOptsDetails = any> {
|
|
542
|
+
type: 'text';
|
|
543
|
+
ibGib: IbGib_V1;
|
|
544
|
+
details: TDetails;
|
|
545
|
+
/**
|
|
546
|
+
* rel8nName to use to rel8 the child to the ibgib.
|
|
547
|
+
*/
|
|
548
|
+
rel8nName?: string;
|
|
549
|
+
metaspace: MetaspaceService;
|
|
550
|
+
space: IbGibSpaceAny;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
export function addChildIbGib(arg: AddChildOpts): Promise<IbGib_V1> {
|
|
555
|
+
const lc = `[${addChildIbGib.name}]`;
|
|
556
|
+
try {
|
|
557
|
+
if (logalot) { console.log(`${lc} starting... (I: 1d5cb8453e5a9e49bffd923da9c90825)`); }
|
|
558
|
+
|
|
559
|
+
switch (arg.type) {
|
|
560
|
+
case 'text':
|
|
561
|
+
return addChildIbGib_text(arg);
|
|
562
|
+
default:
|
|
563
|
+
throw new Error(`(UNEXPECTED) invalid add child type (${arg.type})? (E: bde41e94cb88a66aee56e2cfd4c88825)`);
|
|
564
|
+
}
|
|
565
|
+
} catch (error) {
|
|
566
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
567
|
+
throw error;
|
|
568
|
+
} finally {
|
|
569
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
async function addChildIbGib_text({
|
|
574
|
+
ibGib,
|
|
575
|
+
rel8nName,
|
|
576
|
+
details,
|
|
577
|
+
metaspace,
|
|
578
|
+
space,
|
|
579
|
+
}: AddChildOpts<AddChildOptsDetails_Text>): Promise<IbGib_V1> {
|
|
580
|
+
const lc = `[${addChildIbGib_text.name}]`;
|
|
581
|
+
try {
|
|
582
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
583
|
+
|
|
584
|
+
let { title, text } = details;
|
|
585
|
+
|
|
586
|
+
text ??= '';
|
|
587
|
+
|
|
588
|
+
title ||= 'SomeText';
|
|
589
|
+
rel8nName ||= PROJECT_CHILD_DEFAULT_REL8N_NAME;
|
|
590
|
+
|
|
591
|
+
// create the comment ibgib
|
|
592
|
+
const resCommentIbGib = await createCommentIbGib({
|
|
593
|
+
text,
|
|
594
|
+
addlMetadataText: `${getTimestampInTicks()}_${getSaferSubstring({ text: title, length: 16 })}`,
|
|
595
|
+
saveInSpace: true,
|
|
596
|
+
space,
|
|
597
|
+
});
|
|
598
|
+
let commentIbGib = resCommentIbGib.newIbGib;
|
|
599
|
+
commentIbGib = await mut8Timeline({
|
|
600
|
+
timeline: commentIbGib,
|
|
601
|
+
mut8Opts: {
|
|
602
|
+
dataToAddOrPatch: { title, description: title, },
|
|
603
|
+
},
|
|
604
|
+
metaspace,
|
|
605
|
+
space,
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
if (!ibGib) { throw new Error(`(UNEXPECTED) ibGib falsy? should be a project ibgib (E: genuuid)`); }
|
|
609
|
+
if (!isProjectIbGib_V1(ibGib)) { throw new Error(`(UNEXPECTED) ibGib is not a project ibgib? (E: genuuid)`); }
|
|
610
|
+
|
|
611
|
+
// append the comment to the project's timeline
|
|
612
|
+
const newTimeline = await appendToTimeline({
|
|
613
|
+
timeline: ibGib,
|
|
614
|
+
rel8nInfos: [{ ibGibs: [commentIbGib], rel8nName }],
|
|
615
|
+
metaspace,
|
|
616
|
+
space,
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
return newTimeline;
|
|
620
|
+
} catch (error) {
|
|
621
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
622
|
+
throw error;
|
|
623
|
+
} finally {
|
|
624
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Retrieves all the latest project ibGibs from a given space (or the default
|
|
631
|
+
* local user space).
|
|
632
|
+
*/
|
|
633
|
+
export async function getProjects({
|
|
634
|
+
metaspace,
|
|
635
|
+
space,
|
|
636
|
+
}: {
|
|
637
|
+
metaspace: MetaspaceService;
|
|
638
|
+
space?: IbGibSpaceAny;
|
|
639
|
+
}): Promise<ProjectIbGib_V1[]> {
|
|
640
|
+
const lc = `[${getProjects.name}]`;
|
|
641
|
+
try {
|
|
642
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
643
|
+
|
|
644
|
+
// prepare space info
|
|
645
|
+
space ??= await metaspace.getLocalUserSpace({ lock: false });
|
|
646
|
+
if (!space) { throw new Error(`(UNEXPECTED) space falsy and couldn't even get default local user space? (E: ca5d383873a8ff9068709c7a39e67625)`); }
|
|
647
|
+
const { spaceId } = parseSpaceIb({ spaceIb: space.ib });
|
|
648
|
+
|
|
649
|
+
// get all project agents
|
|
650
|
+
const agentsSvc = getAgentsSvc();
|
|
651
|
+
const projectAgents = await agentsSvc.getAgents({
|
|
652
|
+
metaspace,
|
|
653
|
+
type: AGENT_SPECIAL_IBGIB_TYPE_PROJECTAGENT,
|
|
654
|
+
spaceId,
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// build up the list of projectTjpAddrs from the agents
|
|
658
|
+
const projectTjpAddrs: IbGibAddr[] = [];
|
|
659
|
+
for (const projectAgent of projectAgents) {
|
|
660
|
+
if (!projectAgent.data) { throw new Error(`(UNEXPECTED) projectAgent.data falsy? (E: 53256c9d2168fdf37b0cf5688b11b625)`); }
|
|
661
|
+
const projectTjpAddr = projectAgent.data['@currentContextTjpAddr'];
|
|
662
|
+
if (projectTjpAddr) {
|
|
663
|
+
projectTjpAddrs.push(projectTjpAddr);
|
|
664
|
+
} else {
|
|
665
|
+
console.warn(`${lc} projectAgent (${getIbGibAddr({ ibGib: projectAgent })}) has no @currentContextTjpAddr (W: 29c4d8d251945597086f4de8001bc825)`);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const uniqueTjpAddrs = unique(projectTjpAddrs);
|
|
669
|
+
if (uniqueTjpAddrs.length === 0) {
|
|
670
|
+
if (logalot) { console.log(`${lc} No project agents found with space (${space.ib}). Returning empty array. (I: cbc626e97598562d12b483d468082825)`); }
|
|
671
|
+
return []; /* <<<< returns early */
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// get the latest addrs corresponding to those tjp addrs.
|
|
675
|
+
const resLatestIbGib = await getLatestAddrs({
|
|
676
|
+
addrs: uniqueTjpAddrs,
|
|
677
|
+
space,
|
|
678
|
+
});
|
|
679
|
+
if (!resLatestIbGib.data) { throw new Error(`(UNEXPECTED) resLatestIbGib.data falsy? (E: 0dc6f8692c02cef4112642184de79225)`); }
|
|
680
|
+
if (resLatestIbGib.data.errors && resLatestIbGib.data.errors.length > 0) {
|
|
681
|
+
console.error(`${lc} Error getting latest tjp addrs for projects: ${resLatestIbGib.data.errors}. addrsErrored: ${resLatestIbGib.data.addrsErrored ?? '[addrsErrored falsy?]'} (E: 9ee4e8a3329b464d280e3fb8318a6825)`);
|
|
682
|
+
if (resLatestIbGib.data.addrsErrored && resLatestIbGib.data.addrsErrored.length === uniqueTjpAddrs.length) {
|
|
683
|
+
// all of them errored, so return an empty array
|
|
684
|
+
throw new Error(`all project addrs errors. (E: 942bc8f6920865be18f09c98e06f9825)`);
|
|
685
|
+
} else {
|
|
686
|
+
console.warn(`${lc} not all project addrs errored, so we're returning the ones we *were* able to get. addrsErrored: ${resLatestIbGib.data.addrsErrored ?? '[addrsErrored falsy?]'}(W: 20bc481170085fc3b8011f2ce50f9825)`)
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const latestAddrsMap = resLatestIbGib.data.latestAddrsMap;
|
|
690
|
+
if (!latestAddrsMap) {
|
|
691
|
+
throw new Error(`(UNEXPECTED) resLatestIbGib.data.latestAddrsMap falsy? this should have contained the latest project addrs. returning empty array. (E: d89fe88d7488d1aaf8618b38db1aa825)`);
|
|
692
|
+
}
|
|
693
|
+
const latestAddrs: IbGibAddr[] = [];
|
|
694
|
+
for (let [addr, latestAddr] of Object.entries(latestAddrsMap)) {
|
|
695
|
+
latestAddrs.push(latestAddr ?? addr);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// get the actual ibgibs corresponding to the latest addrs
|
|
699
|
+
const resGet = await metaspace.get({
|
|
700
|
+
addrs: latestAddrs,
|
|
701
|
+
space,
|
|
702
|
+
});
|
|
703
|
+
if (resGet.errorMsg || (resGet.ibGibs ?? []).length !== latestAddrs.length) {
|
|
704
|
+
if ((resGet.ibGibs ?? []).length === 0) {
|
|
705
|
+
throw new Error(`error in getting latest project ibgibs. (E: 3b2878e08db8b296e11463669d523825)`);
|
|
706
|
+
} else {
|
|
707
|
+
console.error(`${lc} get project ibgibs had errors, but we did get some of the project ibgibs. resGet.errorMsg: ${resGet.errorMsg ?? '[unknown error (E: 733358e3894819cbd8364db8c5ac2725)]'}. (E: 24fcf830893ffadd78eaabd839103825)`);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const latestProjectIbGibs: ProjectIbGib_V1[] = [];
|
|
711
|
+
const ibGibsUnknownType = resGet.ibGibs!;
|
|
712
|
+
for (const ibGibUnknownType of ibGibsUnknownType) {
|
|
713
|
+
if (isProjectIbGib_V1(ibGibUnknownType)) {
|
|
714
|
+
latestProjectIbGibs.push(ibGibUnknownType);
|
|
715
|
+
} else {
|
|
716
|
+
console.error(`${lc} ibgib gotten (${getIbGibAddr({ ibGib: ibGibUnknownType })}) is NOT a ProjectIbGib_V1. (E: 656f18145928cca6481c4ee8547c0825)`);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// return them!
|
|
721
|
+
return latestProjectIbGibs;
|
|
722
|
+
} catch (error) {
|
|
723
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
724
|
+
// We probably don't want to throw here, as it could break a UI component.
|
|
725
|
+
// Returning an empty array is safer for rendering.
|
|
726
|
+
return [];
|
|
727
|
+
} finally {
|
|
728
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
729
|
+
}
|
|
730
|
+
}
|