@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,321 @@
|
|
|
1
|
+
import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
|
+
import { Ib, IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
3
|
+
import { IbGib_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
4
|
+
import { GIB, IB, ROOT } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
5
|
+
import { WitnessWithContextBase_V1 } from "@ibgib/core-gib/dist/witness/witness-with-context/witness-with-context-base-v1.mjs";
|
|
6
|
+
import { IbGibTimelineUpdateInfo } from "@ibgib/core-gib/dist/common/other/other-types.mjs";
|
|
7
|
+
import { ObservableWitness, } from "@ibgib/core-gib/dist/common/pubsub/observable/observable-types.mjs";
|
|
8
|
+
import { newupSubject } from "@ibgib/core-gib/dist/common/pubsub/subject/subject-helper.mjs";
|
|
9
|
+
import { SubjectWitness } from "@ibgib/core-gib/dist/common/pubsub/subject/subject-types.mjs";
|
|
10
|
+
|
|
11
|
+
import { GLOBAL_LOG_A_LOT } from "../../constants.mjs";
|
|
12
|
+
import { WitnessWithContextData_V1, WitnessWithContextRel8ns_V1 } from "@ibgib/core-gib/dist/witness/witness-with-context/witness-with-context-types.mjs";
|
|
13
|
+
import { IbGibSpaceAny } from "@ibgib/core-gib/dist/witness/space/space-base-v1.mjs";
|
|
14
|
+
import { getGlobalMetaspace_waitIfNeeded } from "../../helpers.web.mjs";
|
|
15
|
+
import { isSpaceIb } from "@ibgib/core-gib/dist/witness/space/space-helper.mjs";
|
|
16
|
+
import { SpaceId } from "@ibgib/core-gib/dist/witness/space/space-types.mjs";
|
|
17
|
+
import { Factory_V1 } from "@ibgib/ts-gib/dist/V1/factory.mjs";
|
|
18
|
+
|
|
19
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Helper ibgib witness for backing ibgib component instances.
|
|
23
|
+
*
|
|
24
|
+
* This witness's job is not intrinsically do much of anything, rather, its
|
|
25
|
+
* focus is to keep up-to-date with changes to a context.
|
|
26
|
+
*
|
|
27
|
+
* So this particular witness does not need to care about its own state (its gib
|
|
28
|
+
* is actually just primitive "gib"). So no calls to loadNewerSelfIfAvailable
|
|
29
|
+
* should be necessary.
|
|
30
|
+
*
|
|
31
|
+
* ## how to use
|
|
32
|
+
*
|
|
33
|
+
* ATOW (04/2025) the idea is to have an ibgib component that you want to keep
|
|
34
|
+
* up-to-date. So you include a backing model proxy ibgib and subscribe to its
|
|
35
|
+
* events, e.g., {@link LiveProxyIbGib.contextUpdated$}, and then the component
|
|
36
|
+
* will update its visual elements.
|
|
37
|
+
*
|
|
38
|
+
* ## notes on driving intent of this class
|
|
39
|
+
*
|
|
40
|
+
* There is quite a bit of plumbing involved with updating ibgibs
|
|
41
|
+
* when updates are published to the metaspace. This involves subscribing
|
|
42
|
+
* to the ibgib timeline's latestObs observable on the metaspace, checking if
|
|
43
|
+
* there are actual new updates, as well as other things.
|
|
44
|
+
*
|
|
45
|
+
* Our components, however, since they are web components must descend from
|
|
46
|
+
* HTMLElement, so we can't descend from WitnessWithContextBase_V1 directly.
|
|
47
|
+
*
|
|
48
|
+
* So my hope is that this will be performant enough, and maintainable enough,
|
|
49
|
+
* to have this backing model for ibgib components.
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
export class LiveProxyIbGib<TIbGib extends IbGib_V1 = IbGib_V1> extends WitnessWithContextBase_V1 {
|
|
53
|
+
protected lc: string = ``;
|
|
54
|
+
|
|
55
|
+
ib = this._currentWorkingContextIbGib ? this._currentWorkingContextIbGib.ib : IB;
|
|
56
|
+
gib = this._currentWorkingContextIbGib ? this._currentWorkingContextIbGib.gib : GIB;
|
|
57
|
+
data = this._currentWorkingContextIbGib ? this._currentWorkingContextIbGib.data : undefined;
|
|
58
|
+
rel8ns = this._currentWorkingContextIbGib ? this._currentWorkingContextIbGib.rel8ns : undefined;
|
|
59
|
+
|
|
60
|
+
protected override async loadNewerSelfIfAvailable(): Promise<void> {
|
|
61
|
+
const lc = `${this.lc}[${this.loadNewerSelfIfAvailable.name}]`;
|
|
62
|
+
try {
|
|
63
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
64
|
+
// doesn't look like this gets hit right now
|
|
65
|
+
console.warn(`${lc} does nothing in this class. I just have this warning here because I want to see if this gets executed. (W: genuuid)`)
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
68
|
+
throw error;
|
|
69
|
+
} finally {
|
|
70
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
override async loadIbGibDto(dto: IbGib_V1<WitnessWithContextData_V1, WitnessWithContextRel8ns_V1>): Promise<void> {
|
|
74
|
+
const lc = `${this.lc}[${this.loadIbGibDto.name}]`;
|
|
75
|
+
try {
|
|
76
|
+
if (logalot) { console.log(`${lc} starting... (I: genuuid)`); }
|
|
77
|
+
debugger; // does live proxy ibgib hit here?
|
|
78
|
+
console.warn(`${lc} does nothing in this class. I just have this warning here because I want to see if this gets executed. (W: genuuid)`)
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
81
|
+
throw error;
|
|
82
|
+
} finally {
|
|
83
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* not a "true" witness as I'm thinking right now so I'm not validating this
|
|
89
|
+
* proxy class. I am keeping the validateArg function though, as that seems
|
|
90
|
+
* good to me.
|
|
91
|
+
*/
|
|
92
|
+
protected override async validateThis(): Promise<string[]> {
|
|
93
|
+
const lc = `${this.lc}[${this.validateThis.name}]`;
|
|
94
|
+
if (logalot) { console.log(`${lc} elided in this proxy class because this isn't a true witness atow (04/2025) (I: fd223814f169798d9f499d6e9cdc0325)`); }
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get ibGib(): TIbGib | undefined {
|
|
99
|
+
return this._currentWorkingContextIbGib as TIbGib | undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* determines the local space in which this proxy ibgib resides.
|
|
104
|
+
*
|
|
105
|
+
* set this via passing in a space ibgib for the proxy to witness.
|
|
106
|
+
*/
|
|
107
|
+
spaceId: SpaceId | undefined;
|
|
108
|
+
|
|
109
|
+
constructor(initialData?: any, initialRel8ns?: IbGibRel8ns_V1) {
|
|
110
|
+
super(initialData, initialRel8ns);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
protected override async initialize(): Promise<void> {
|
|
114
|
+
const lc = `${this.lc}[${this.initialize.name}]`;
|
|
115
|
+
try {
|
|
116
|
+
if (logalot) { console.log(`${lc} starting... (I: 1bd72217a5f334effc63f8d51e7b2225)`); }
|
|
117
|
+
await super.initialize();
|
|
118
|
+
|
|
119
|
+
// init observables event streams
|
|
120
|
+
this._contextUpdated$ = await newupSubject();
|
|
121
|
+
this.contextUpdated$ = this._contextUpdated$.asObservable();
|
|
122
|
+
|
|
123
|
+
this._newContextChild$ = await newupSubject();
|
|
124
|
+
this.newContextChild$ = this._newContextChild$.asObservable();
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
127
|
+
throw error;
|
|
128
|
+
} finally {
|
|
129
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
protected parseAddlMetadataString({ ib }: { ib: Ib; }): any {
|
|
135
|
+
const lc = `${this.lc}[${this.parseAddlMetadataString.name}]`;
|
|
136
|
+
console.warn(`${lc} not really implemented in this class atow (04/2025). (W: genuuid)`);
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*
|
|
143
|
+
* The first context ibgib frame that this proxy is initialized with,
|
|
144
|
+
* namely, before any updates happen that produce newer ibgibs in the
|
|
145
|
+
* timelines. Those will update the {@link _currentWorkingContextIbGib}.
|
|
146
|
+
*/
|
|
147
|
+
protected _initialContext: TIbGib | undefined;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* implementation for witnessing. Basically, the first ibgib this proxy
|
|
151
|
+
* witnesses is its context, i.e., its ibgib.
|
|
152
|
+
*
|
|
153
|
+
* ## notes
|
|
154
|
+
*
|
|
155
|
+
* ### on "Context" with this Proxy
|
|
156
|
+
*
|
|
157
|
+
* "Context" is kinda funny in this way, but it's how I'm reusing existing
|
|
158
|
+
* plumbing for updating contexts.
|
|
159
|
+
*
|
|
160
|
+
* Said another way, usually a "context" is peripheral/ambient compared to
|
|
161
|
+
* the primary behavior of a witness with context. But in this use case as a
|
|
162
|
+
* proxy ibgib, "context" is just the actual ibgib.
|
|
163
|
+
*/
|
|
164
|
+
protected async witnessImpl(arg: IbGib_V1<any, IbGibRel8ns_V1>): Promise<IbGib_V1<any, IbGibRel8ns_V1> | undefined> {
|
|
165
|
+
const lc = `${this.lc}[${this.witnessImpl.name}]`;
|
|
166
|
+
try {
|
|
167
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
168
|
+
|
|
169
|
+
if (isSpaceIb({ ib: arg.ib })) {
|
|
170
|
+
// we're setting the local space
|
|
171
|
+
if (!arg.data) { throw new Error(`arg has space ib but arg.data is falsy (E: b2af9226c067d5e72f117fa36e239525)`); }
|
|
172
|
+
const spaceId: SpaceId = arg.data.uuid as string;
|
|
173
|
+
this.spaceId = spaceId;
|
|
174
|
+
if (logalot) { console.log(`${lc} spaceId set to the ${spaceId} (I: 018724a5431ba421b71fad36924c5a25)`); }
|
|
175
|
+
// return a primitive string
|
|
176
|
+
return Factory_V1.primitive({ ib: `spaceId set to ${spaceId}` });
|
|
177
|
+
} else {
|
|
178
|
+
// we're wrapping an ibgib
|
|
179
|
+
if (!this._initialContext) {
|
|
180
|
+
const space = await this.metaspace?.getLocalUserSpace({ localSpaceId: this.spaceId });
|
|
181
|
+
await this.setWrappedIbGib({
|
|
182
|
+
ibGib: arg,
|
|
183
|
+
space,
|
|
184
|
+
});
|
|
185
|
+
// return ROOT => default action taken
|
|
186
|
+
return ROOT;
|
|
187
|
+
} else {
|
|
188
|
+
debugger; // error
|
|
189
|
+
console.error(`${lc} (UNEXPECTED) context already initialized. returning early without doing anything. NOTE: This error was not thrown, only logged. (E: genuuid)`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error(`${lc} ${error.message}`);
|
|
194
|
+
throw error;
|
|
195
|
+
} finally {
|
|
196
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
_contextUpdated$: SubjectWitness<TIbGib> | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* similar to {@link newContextChild$}, but this is triggered when a NEW
|
|
203
|
+
* context ibgib is published via the metaspace (not its children).
|
|
204
|
+
*
|
|
205
|
+
* I believe this happens before the {@link newContextChild$} but don't
|
|
206
|
+
* quote me.
|
|
207
|
+
*
|
|
208
|
+
* ## notes
|
|
209
|
+
*
|
|
210
|
+
* * sometimes an ibgib is published on the timeline by the metaspace but it
|
|
211
|
+
* is not actually new. So this swallows those old updates to essentially
|
|
212
|
+
* be idempotent
|
|
213
|
+
*
|
|
214
|
+
* @see {@link _contextUpdated$}
|
|
215
|
+
* @see {@link newContextChild$}
|
|
216
|
+
*/
|
|
217
|
+
contextUpdated$: ObservableWitness<TIbGib> | undefined;
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
*/
|
|
221
|
+
_newContextChild$: SubjectWitness<IbGib_V1> | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* similar to {@link contextUpdated$}, but this happens when new _children_
|
|
224
|
+
* are added to the context ibgib, not just when the context ibgib itself is
|
|
225
|
+
* changed.
|
|
226
|
+
*
|
|
227
|
+
* This wraps {@link WitnessWithContextBase_V1.handleNewContextChild}
|
|
228
|
+
*
|
|
229
|
+
* @see {@link _newContextChild$}
|
|
230
|
+
* @see {@link contextUpdated$}
|
|
231
|
+
*/
|
|
232
|
+
newContextChild$: ObservableWitness<IbGib_V1> | undefined;
|
|
233
|
+
|
|
234
|
+
protected async handleContextUpdate({ update }: { update: IbGibTimelineUpdateInfo; }): Promise<void> {
|
|
235
|
+
const lc = `${this.lc}[${this.handleContextUpdate.name}]`;
|
|
236
|
+
try {
|
|
237
|
+
if (logalot) { console.log(`${lc} starting... (I: c262bcda065c086ffe9e3ac5899abe25)`); }
|
|
238
|
+
|
|
239
|
+
await super.handleContextUpdate({ update });
|
|
240
|
+
if (!this._contextUpdated$) { throw new Error(`(UNEXPECTED) this._contextUpdated$ falsy? (E: a184df090502bed9649f8df88bd4c125)`); }
|
|
241
|
+
await this._contextUpdated$.next(this._currentWorkingContextIbGib as TIbGib);
|
|
242
|
+
|
|
243
|
+
} catch (error) {
|
|
244
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
245
|
+
throw error;
|
|
246
|
+
} finally {
|
|
247
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
async setWrappedIbGib({
|
|
252
|
+
ibGib,
|
|
253
|
+
ibGibAddr,
|
|
254
|
+
space,
|
|
255
|
+
}: {
|
|
256
|
+
ibGib?: IbGib_V1,
|
|
257
|
+
ibGibAddr?: IbGibAddr,
|
|
258
|
+
space?: IbGibSpaceAny,
|
|
259
|
+
}): Promise<void> {
|
|
260
|
+
const lc = `${this.lc}[${this.setWrappedIbGib.name}]`;
|
|
261
|
+
try {
|
|
262
|
+
if (logalot) { console.log(`${lc} starting... (I: a4b0acda259c121801aa701534320125)`); }
|
|
263
|
+
if (!this.metaspace) {
|
|
264
|
+
this.metaspace = await getGlobalMetaspace_waitIfNeeded();
|
|
265
|
+
// throw new Error(`(UNEXPECTED) this.metaspace falsy? (E: 60dc3b1eb082dfc266a33cd4cc96a525)`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// get the ibgib by addr if necessary
|
|
269
|
+
// initialize the context with the ibgib
|
|
270
|
+
// NOTE: this.initializeContext says it has the ability to load from
|
|
271
|
+
// addr, but it doesn't and I'm too "lazy" right now to change that
|
|
272
|
+
// lib.
|
|
273
|
+
|
|
274
|
+
if (!ibGib) {
|
|
275
|
+
if (!ibGibAddr) { throw new Error(`(UNEXPECTED) both ibGib AND ibGibAddr falsy? (E: 6fac98ba2d4cfdec2b7ee974dec74625)`); }
|
|
276
|
+
|
|
277
|
+
space ??= await this.metaspace.getLocalUserSpace({ lock: false });
|
|
278
|
+
if (!space) { throw new Error(`(UNEXPECTED) space falsy? no space provided and couldn't get default local user space? (E: e14d1b7a6586f99453fc571396d4df25)`); }
|
|
279
|
+
const resGet = await this.metaspace.get({
|
|
280
|
+
addrs: [ibGibAddr],
|
|
281
|
+
space,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
if (!resGet.success || resGet.ibGibs?.length !== 1) {
|
|
285
|
+
throw new Error(`${lc} failed to get ibGib(?) (${ibGibAddr}). space.ib: ${space.ib} (E: b38f0a25d92e44c0aa5cc3b038a43c6c)`);
|
|
286
|
+
}
|
|
287
|
+
ibGib = resGet.ibGibs.at(0)!;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
await this.initializeContext({
|
|
291
|
+
// arg: ibGib as TIbGib,
|
|
292
|
+
contextIbGib: ibGib as TIbGib,
|
|
293
|
+
// empty string for rel8nName avoids attempting to rel8 this
|
|
294
|
+
// witness to the context...sniff sniff
|
|
295
|
+
rel8nName: '',
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
} catch (error) {
|
|
299
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
300
|
+
throw error;
|
|
301
|
+
} finally {
|
|
302
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
protected override async handleNewContextChild({ newChild }: { newChild: IbGib_V1; }): Promise<void> {
|
|
307
|
+
const lc = `[${this.handleNewContextChild.name}]`;
|
|
308
|
+
try {
|
|
309
|
+
if (logalot) { console.log(`${lc} starting... (I: 7e9b6b7a4bb2726e9c717f230dfe1925)`); }
|
|
310
|
+
// console.error(`${lc} not really an error. newChild: ${pretty(newChild)}`);
|
|
311
|
+
|
|
312
|
+
if (!this._newContextChild$) { throw new Error(`(UNEXPECTED) this._contextUpdated$ falsy? (E: a184df090502bed9649f8df88bd4c125)`); }
|
|
313
|
+
await this._newContextChild$.next(newChild);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
316
|
+
throw error;
|
|
317
|
+
} finally {
|
|
318
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { extractErrorMsg, getTimestamp, getUUID, pretty } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
|
+
import { getGib, isPrimitive } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
3
|
+
import { GIB } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
4
|
+
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
5
|
+
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
6
|
+
import { getIbAndGib } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
7
|
+
import { SyncSagaInfo, SyncStatusIbGib } from "@ibgib/core-gib/dist/witness/space/outer-space/outer-space-types.mjs";
|
|
8
|
+
import { SubscriptionWitness } from "@ibgib/core-gib/dist/common/pubsub/subscription/subscription-types.mjs";
|
|
9
|
+
import { fnObs } from "@ibgib/core-gib/dist/common/pubsub/observer/observer-helper.mjs";
|
|
10
|
+
import { ErrorIbGib_V1 } from "@ibgib/core-gib/dist/common/error/error-types.mjs";
|
|
11
|
+
import { IbGibSpaceAny } from "@ibgib/core-gib/dist/witness/space/space-base-v1.mjs";
|
|
12
|
+
import {
|
|
13
|
+
DtoToSpaceFunction, LocalSpaceFactoryFunction, MetaspaceService,
|
|
14
|
+
} from "@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs";
|
|
15
|
+
import { isSpaceIb, spaceNameIsValid } from "@ibgib/core-gib/dist/witness/space/space-helper.mjs";
|
|
16
|
+
import {
|
|
17
|
+
IBGIB_BASE_DIR, IBGIB_BASE_SUBPATH, IBGIB_BIN_SUBPATH,
|
|
18
|
+
IBGIB_DNA_SUBPATH, IBGIB_ENCODING, IBGIB_IBGIBS_SUBPATH, IBGIB_META_SUBPATH
|
|
19
|
+
} from "@ibgib/core-gib/dist/witness/space/filesystem-space/filesystem-constants.mjs";
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_LOCAL_SPACE_DESCRIPTION, DEFAULT_LOCAL_SPACE_POLLING_INTERVAL_MS,
|
|
22
|
+
PERSIST_OPTS_AND_RESULTS_IBGIBS_DEFAULT
|
|
23
|
+
} from "@ibgib/core-gib/dist/witness/space/space-constants.mjs";
|
|
24
|
+
import { toDto } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
|
|
25
|
+
|
|
26
|
+
import { GLOBAL_LOG_A_LOT } from "../../../../constants.mjs";
|
|
27
|
+
import { getFnPrompt } from "../../../../common/prompt-functions.web.mjs";
|
|
28
|
+
import { WebFilesystemSpace_V1 } from "../../web-filesystem-space/web-filesystem-space-v1.mjs";
|
|
29
|
+
import { WebFilesystemSpaceData_V1, WebFilesystemSpaceRel8ns_V1 } from "../../web-filesystem-space/web-filesystem-space-types.mjs";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* used in verbose logging (across all ibgib libs atow)
|
|
33
|
+
*/
|
|
34
|
+
const logalot = GLOBAL_LOG_A_LOT;
|
|
35
|
+
|
|
36
|
+
export const fnCreateNewLocalSpace: LocalSpaceFactoryFunction = async ({
|
|
37
|
+
allowCancel,
|
|
38
|
+
spaceName,
|
|
39
|
+
logalot,
|
|
40
|
+
}) => {
|
|
41
|
+
const lc = `[fnCreateNewLocalSpace]`;
|
|
42
|
+
try {
|
|
43
|
+
if (logalot) { console.log(`${lc} starting... (I: b05e12810c1d32269b0fa7e965ccfd24)`); }
|
|
44
|
+
|
|
45
|
+
if (spaceName && !spaceNameIsValid(spaceName)) {
|
|
46
|
+
throw new Error(`spaceName (${spaceName}) is invalid. (E: c54aa952ee34102befe5f47681cdf624)`);
|
|
47
|
+
// throw because this is used in RCLI and automated testing...
|
|
48
|
+
}
|
|
49
|
+
if (!spaceName) {
|
|
50
|
+
|
|
51
|
+
const promptName: () => Promise<void> = async () => {
|
|
52
|
+
const fnPrompt = getFnPrompt();
|
|
53
|
+
const resName = await fnPrompt({
|
|
54
|
+
title: 'greetings program', msg: `this website does not use cookies. it's driven by ibgib's innovative protocol, and all of YOUR data is stored in a "local space" on YOUR device. in browsers, this means in IndexedDB.
|
|
55
|
+
|
|
56
|
+
so give your local space a name like 'phone_alice' or 'web_bob_foo', or leave blank to get a random name. then click ok.
|
|
57
|
+
`
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (resName === '' && !allowCancel) {
|
|
61
|
+
spaceName = 'space_' + (await getUUID()).slice(0, 10);
|
|
62
|
+
} else {
|
|
63
|
+
if (resName && spaceNameIsValid(resName)) {
|
|
64
|
+
spaceName = resName;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// ...prompt for name
|
|
70
|
+
await promptName();
|
|
71
|
+
|
|
72
|
+
if (!spaceName) { return undefined; /* <<<< returns early */ }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ...create in memory with defaults
|
|
76
|
+
const now = new Date();
|
|
77
|
+
const timestamp = getTimestamp(now);
|
|
78
|
+
const timestampMs = now.getMilliseconds();
|
|
79
|
+
const newLocalSpace = new WebFilesystemSpace_V1(/*initialData*/ {
|
|
80
|
+
version: '1',
|
|
81
|
+
uuid: await getUUID(),
|
|
82
|
+
isTjp: true,
|
|
83
|
+
timestamp,
|
|
84
|
+
timestampMs,
|
|
85
|
+
name: spaceName,
|
|
86
|
+
baseDir: IBGIB_BASE_DIR,
|
|
87
|
+
spaceSubPath: spaceName,
|
|
88
|
+
baseSubPath: IBGIB_BASE_SUBPATH,
|
|
89
|
+
binSubPath: IBGIB_BIN_SUBPATH,
|
|
90
|
+
dnaSubPath: IBGIB_DNA_SUBPATH,
|
|
91
|
+
ibgibsSubPath: IBGIB_IBGIBS_SUBPATH,
|
|
92
|
+
metaSubPath: IBGIB_META_SUBPATH,
|
|
93
|
+
encoding: IBGIB_ENCODING,
|
|
94
|
+
persistOptsAndResultIbGibs: PERSIST_OPTS_AND_RESULTS_IBGIBS_DEFAULT,
|
|
95
|
+
validateIbGibAddrsMatchIbGibs: true,
|
|
96
|
+
trace: false,
|
|
97
|
+
description: DEFAULT_LOCAL_SPACE_DESCRIPTION,
|
|
98
|
+
allowPrimitiveArgs: false,
|
|
99
|
+
catchAllErrors: true,
|
|
100
|
+
longPollingIntervalMs: DEFAULT_LOCAL_SPACE_POLLING_INTERVAL_MS,
|
|
101
|
+
} as WebFilesystemSpaceData_V1, /*initialRel8ns*/ undefined);
|
|
102
|
+
if (logalot) { console.log(`${lc} localSpace.ib: ${newLocalSpace.ib} (I: f57802654c5be84eb96d36d477425924)`); }
|
|
103
|
+
if (logalot) { console.log(`${lc} localSpace.gib: ${newLocalSpace.gib} (before sha256v1) (I: 4171271b7c1484e90205824a31067924)`); }
|
|
104
|
+
if (logalot) { console.log(`${lc} localSpace.data: ${pretty(newLocalSpace.data || 'falsy')} (I: 01221a1d7f6f19accf05b17534e3e624)`); }
|
|
105
|
+
if (logalot) { console.log(`${lc} localSpace.rel8ns: ${pretty(newLocalSpace.rel8ns || 'falsy')} (I: 750a7ec2b25b5d344dea900cf14ca524)`); }
|
|
106
|
+
|
|
107
|
+
// trying out with tjp, can't remember why didn't have it except for
|
|
108
|
+
// backwards compatability which i'm no longer shooting for (will be
|
|
109
|
+
// able to project old spaces to new ones i believe)
|
|
110
|
+
// newLocalSpace.gib = await getGib({ ibGib: newLocalSpace, hasTjp: false });
|
|
111
|
+
newLocalSpace.gib = await getGib({ ibGib: toDto({ ibGib: newLocalSpace }), hasTjp: true });
|
|
112
|
+
|
|
113
|
+
if (newLocalSpace.gib === GIB) { throw new Error(`localSpace.gib not updated correctly. (E: 277f8305ec3fd8dd4b023616c1fa0624)`); }
|
|
114
|
+
if (logalot) { console.log(`${lc} localSpace.gib: ${newLocalSpace.gib} (after sha256v1) (I: d3ab464fdb4500d95a50bf1e7c036524)`); }
|
|
115
|
+
|
|
116
|
+
return newLocalSpace as IbGibSpaceAny;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
119
|
+
throw error;
|
|
120
|
+
} finally {
|
|
121
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const fnDtoToSpace_webFilesystem: DtoToSpaceFunction = (spaceDto) => {
|
|
126
|
+
return Promise.resolve(
|
|
127
|
+
WebFilesystemSpace_V1.createFromDto(spaceDto as IbGib_V1<WebFilesystemSpaceData_V1, WebFilesystemSpaceRel8ns_V1>)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* wrapper around metaspace.syncIbGibs
|
|
133
|
+
* @param param0
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
export async function doSync_awaitAllSagas({
|
|
137
|
+
addr,
|
|
138
|
+
metaspace,
|
|
139
|
+
localSpace,
|
|
140
|
+
syncSpaces,
|
|
141
|
+
sagaReporter,
|
|
142
|
+
verbose,
|
|
143
|
+
}: {
|
|
144
|
+
/**
|
|
145
|
+
* the addr whose live dependency graph is going to be built and synced.
|
|
146
|
+
*/
|
|
147
|
+
addr: IbGibAddr,
|
|
148
|
+
/**
|
|
149
|
+
* it's meta yo
|
|
150
|
+
*/
|
|
151
|
+
metaspace: MetaspaceService,
|
|
152
|
+
/**
|
|
153
|
+
* the space which contains the syncSpace (proxy outer space).
|
|
154
|
+
*/
|
|
155
|
+
localSpace: IbGibSpaceAny,
|
|
156
|
+
/**
|
|
157
|
+
* sync space witnesses (not just ibgib dtos)
|
|
158
|
+
*/
|
|
159
|
+
syncSpaces: IbGibSpaceAny[],
|
|
160
|
+
sagaReporter: (msg: string, saga: SyncSagaInfo | null) => Promise<void>,
|
|
161
|
+
/**
|
|
162
|
+
* If true, will report more in {@link sagaReporter}
|
|
163
|
+
*/
|
|
164
|
+
verbose?: boolean,
|
|
165
|
+
}): Promise<SyncSagaInfo[] | undefined> {
|
|
166
|
+
const lc = `[${doSync_awaitAllSagas.name}]`;
|
|
167
|
+
try {
|
|
168
|
+
if (logalot || verbose) { console.log(`${lc} starting... (I: 78bf9e5bea88d9b3827bb991eeedc524)`); }
|
|
169
|
+
const { ib, gib } = getIbAndGib({ ibGibAddr: addr });
|
|
170
|
+
|
|
171
|
+
if (isPrimitive({ gib })) { throw new Error(`can't sync primitive ibgib (${addr}) (E: 915b331b00118b5f69e630ef5d2b8d24)`); }
|
|
172
|
+
if (isSpaceIb({ ib })) { throw new Error(`can't sync entire space ibgib (${addr}) (E: bd1b991e35a683df5a79c379c21d3924)`); }
|
|
173
|
+
if (syncSpaces.length === 0) { throw new Error(`syncSpaces required (E: 671b4f4adc6e009ed304419d662b2d24)`); }
|
|
174
|
+
if (syncSpaces.some(x => !x.witness)) { throw new Error(`(UNEXPECTED) syncSpaces.some(x => !x.witness)? sync spaces should all be witnesses (and have a witness function). these are not supposed to be just dtos (with ib, gib, data, rel8ns props). (E: 879c32b69856218f7eeafb89db491524)`); }
|
|
175
|
+
|
|
176
|
+
if (verbose) { await sagaReporter('getDependencyGraph starting... (I: 35cb6f89e87d7300b3be4088b4176a24)', null); }
|
|
177
|
+
|
|
178
|
+
const dependencyGraph = await metaspace.getDependencyGraph({
|
|
179
|
+
space: localSpace,
|
|
180
|
+
ibGibAddr: addr,
|
|
181
|
+
live: true,
|
|
182
|
+
msBetweenRetries: 1_000,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
if (verbose) {
|
|
186
|
+
await sagaReporter('getDependencyGraph complete. (I: ec9aadd538ac3a61da3873c53852d324)', null);
|
|
187
|
+
await sagaReporter('syncIbGibs spinning off... (I: a15ddf897f8797848b350ad6a2067b24)', null);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const sagas = await metaspace.syncIbGibs({
|
|
191
|
+
dependencyGraphIbGibs: Object.values(dependencyGraph),
|
|
192
|
+
syncSpaceIbGibs: syncSpaces,
|
|
193
|
+
localSpace,
|
|
194
|
+
}) ?? [];
|
|
195
|
+
if (sagas.length === 0) { throw new Error(`(UNEXPECTED) metaspace.syncIbGibs returned undefined (no sagas)? (E: 4d7faeb9ed95fe4b162f2a1377928b24)`); }
|
|
196
|
+
if (verbose) {
|
|
197
|
+
await sagaReporter('syncIbGibs spin off complete. these are not yet done, it/they are just spun off and going. (I: a958a6b706c9b66933cb82ea7bbfcc24)', sagas.at(0) ?? null);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let sagaCount = sagas.length;
|
|
201
|
+
let sagaErrorCounter = 0;
|
|
202
|
+
/**
|
|
203
|
+
* using this during debugging...
|
|
204
|
+
*/
|
|
205
|
+
const sagaErrorMsgs: string[] = [];
|
|
206
|
+
let sagaCompleteOrErrorCounter = 0;
|
|
207
|
+
let allSagasCompletePromise = new Promise<void>((resolve, reject) => {
|
|
208
|
+
const interval = setInterval(async () => {
|
|
209
|
+
if (sagaCompleteOrErrorCounter === sagaCount) {
|
|
210
|
+
if (sagaErrorCounter > 0) {
|
|
211
|
+
reject(`saga had errors: ${sagaErrorMsgs.join('|')} (E: c039232a158cd69669e233a84f9be924)`);
|
|
212
|
+
}
|
|
213
|
+
clearInterval(interval);
|
|
214
|
+
resolve();
|
|
215
|
+
}
|
|
216
|
+
}, 500);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const fnIncCompleteOrError = async (saga: SyncSagaInfo) => {
|
|
220
|
+
const lcInner = `${lc}[fnIncCompleteOrError]`;
|
|
221
|
+
if (logalot || verbose) { console.log(`${lcInner} starting... (I: 1c41e7aaab13ecdf4f3608533f38b324)`); }
|
|
222
|
+
try {
|
|
223
|
+
sagaCompleteOrErrorCounter++;
|
|
224
|
+
let updateText: string;
|
|
225
|
+
if (sagaCompleteOrErrorCounter < sagaCount) {
|
|
226
|
+
updateText = `saga (${saga.sagaId}) complete or errored. ONLY SOME (${sagaCompleteOrErrorCounter}/${sagaCount}) have completed or errored. still more to go...`;
|
|
227
|
+
} else if (sagaCompleteOrErrorCounter === sagaCount) {
|
|
228
|
+
updateText = `saga (${saga.sagaId}) complete or errored. ALL ${sagaCount} sync sagas COMPLETE OR ERRORED.`;
|
|
229
|
+
} else {
|
|
230
|
+
debugger; // unexpected error state. sagaCompleteOrErrorCounter > sagaCount
|
|
231
|
+
updateText = `uhh, there is an error here. we have incremented sagaCompleteOrErrorCounter (${sagaCompleteOrErrorCounter}) to be greater than sagaCount (${sagaCount}) (E: b8e934cfce188f40a93cb90a462c7c24)`;
|
|
232
|
+
}
|
|
233
|
+
if (logalot || verbose) {
|
|
234
|
+
console.log(`${lc} ${updateText} (I: 519a895d1a7ddc44cf8b4532cf3b6524)`);
|
|
235
|
+
await sagaReporter(`${lcInner} ${updateText}`, saga);
|
|
236
|
+
}
|
|
237
|
+
} catch (error) {
|
|
238
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
239
|
+
throw error;
|
|
240
|
+
} finally {
|
|
241
|
+
if (logalot || verbose) { console.log(`${lc}[fnIncCompleteOrError] complete. (I: f2be67aa53e59ab2e5a7f89b26b4df24)`); }
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
for (let i = 0; i < sagas.length; i++) {
|
|
246
|
+
const saga = sagas[i];
|
|
247
|
+
let subscription: SubscriptionWitness = await saga.syncStatus$.subscribe(fnObs({
|
|
248
|
+
next: async (status: SyncStatusIbGib) => {
|
|
249
|
+
if (logalot || verbose) {
|
|
250
|
+
console.log(`${lc} console.dir(status)... (I: e786c4449ebf14be5b2d63a61d22c824)`);
|
|
251
|
+
console.dir(status);
|
|
252
|
+
} else {
|
|
253
|
+
let statusCode = status.data?.statusCode;
|
|
254
|
+
if (statusCode === "already_synced") {
|
|
255
|
+
process.stdout.write('.');
|
|
256
|
+
} else {
|
|
257
|
+
console.log(statusCode);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
complete: async () => {
|
|
262
|
+
if (logalot || verbose) {
|
|
263
|
+
console.log(`${lc}[saga complete] triggered for saga (${saga.spaceId}, ${saga.multiSpaceOpId}). (I: 999536aeb555ac9eaac88c98aee71224)`);
|
|
264
|
+
}
|
|
265
|
+
await fnIncCompleteOrError(saga);
|
|
266
|
+
await subscription.unsubscribe();
|
|
267
|
+
},
|
|
268
|
+
error: async (err: string | Error | ErrorIbGib_V1) => {
|
|
269
|
+
const errorMsg = extractErrorMsg(err);
|
|
270
|
+
sagaErrorMsgs.push(errorMsg);
|
|
271
|
+
if (errorMsg.includes('EAI_AGAIN')) {
|
|
272
|
+
console.error(`this error may be because of no internet connection. ${errorMsg}`)
|
|
273
|
+
}
|
|
274
|
+
console.error(`${lc}[error] err: ${errorMsg} (E: 90b11d262194884ae8320ccbf7252124)`);
|
|
275
|
+
sagaErrorCounter++;
|
|
276
|
+
await fnIncCompleteOrError(saga);
|
|
277
|
+
await subscription.unsubscribe();
|
|
278
|
+
// sagaCompleteOrErrorCounter++;
|
|
279
|
+
}
|
|
280
|
+
}));
|
|
281
|
+
}
|
|
282
|
+
await allSagasCompletePromise;
|
|
283
|
+
return sagas;
|
|
284
|
+
} catch (error) {
|
|
285
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
286
|
+
throw error;
|
|
287
|
+
} finally {
|
|
288
|
+
if (logalot || verbose) { console.log(`${lc} complete.`); }
|
|
289
|
+
}
|
|
290
|
+
}
|