@ibgib/web-gib 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +4 -0
  2. package/dist/AUTO-GENERATED-version.d.mts +1 -1
  3. package/dist/AUTO-GENERATED-version.mjs +1 -1
  4. package/dist/helpers.web.respec.mjs +37 -10
  5. package/dist/helpers.web.respec.mjs.map +1 -1
  6. package/dist/index.d.mts +3 -0
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +4 -0
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.d.mts +7 -0
  11. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.d.mts.map +1 -0
  12. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mjs +7 -0
  13. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mjs.map +1 -0
  14. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.d.mts +24 -0
  15. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.d.mts.map +1 -0
  16. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mjs +23 -0
  17. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mjs.map +1 -0
  18. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.d.mts +85 -0
  19. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.d.mts.map +1 -0
  20. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs +343 -0
  21. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs.map +1 -0
  22. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.d.mts +8 -0
  23. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.d.mts.map +1 -0
  24. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mjs +249 -0
  25. package/dist/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mjs.map +1 -0
  26. package/package.json +2 -2
  27. package/src/AUTO-GENERATED-version.mts +1 -1
  28. package/src/helpers.mts +1 -1
  29. package/src/helpers.web.respec.mts +41 -10
  30. package/src/index.mts +5 -0
  31. package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mts +8 -0
  32. package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mts +53 -0
  33. package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mts +424 -0
  34. package/src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.respec.mts +304 -0
  35. package/tools/auto-generated-agent-skills/skills/ibgib-create-app/SKILL.md +65 -39
  36. package/tools/auto-generated-agent-skills/skills/ibgib-create-client-app/SKILL.md +51 -0
  37. package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/SKILL.md +26 -22
  38. package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/SKILL.md +11 -7
  39. package/tools/auto-generated-agent-skills/skills/ibgib-create-client-identity/SKILL.md +78 -0
  40. package/tools/auto-generated-agent-skills/skills/ibgib-create-client-shell/SKILL.md +42 -0
  41. package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-server → ibgib-create-server-app}/SKILL.md +6 -6
  42. package/tools/auto-generated-agent-skills/skills/ibgib-create-server-app/templates/Dockerfile.template +14 -0
  43. package/tools/auto-generated-agent-skills/skills/ibgib-create-server-app/templates/docker-compose.yml.template +33 -0
  44. package/tools/auto-generated-agent-skills/skills/ibgib-create-server-app/templates/server.mts.template +97 -0
  45. package/tools/auto-generated-agent-skills/skills/ibgib-create-server-app/templates/tsconfig.server.json.template +29 -0
  46. package/tools/auto-generated-agent-skills/skills/ibgib-implementation-plan/SKILL.md +4 -1
  47. package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/SKILL.md +0 -40
  48. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/generate-id.js +0 -0
  49. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/generate-version-file.js +0 -0
  50. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/bootstrap.mts.template +0 -0
  51. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/constants.mts.template +0 -0
  52. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/declarations.d.ts.template +0 -0
  53. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/helpers.web.mts.template +0 -0
  54. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/index.html.template +0 -0
  55. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/index.mts.template +0 -0
  56. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/script.mts.template +0 -0
  57. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-core → ibgib-create-client-app-core}/templates/types.mts.template +0 -0
  58. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/templates/api/function-infos.web.mts.template +0 -0
  59. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/templates/witness/app/app-v1.mts.template +0 -0
  60. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/templates/witness/app/constants.mts.template +0 -0
  61. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/templates/witness/app/helper.mts.template +0 -0
  62. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-app-witness → ibgib-create-client-app-witness}/templates/witness/app/types.mts.template +0 -0
  63. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-shell → ibgib-create-client-shell}/templates/ui/shell/shell-constants.mts.template +0 -0
  64. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-shell → ibgib-create-client-shell}/templates/ui/shell/shell-service.mts.template +0 -0
  65. /package/tools/auto-generated-agent-skills/skills/{ibgib-create-shell → ibgib-create-client-shell}/templates/ui/shell/shell-types.mts.template +0 -0
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # web-gib - agent-driven ibGib web apps
2
2
 
3
+ > [!TIP]
4
+ > **🚀 Building Applications with ibgib**:
5
+ > Looking to build a downstream web app, browser extension, or UI component on ibgib? Start with the **[Creating IbGib Applications Guide](../../docs/CREATING_IBGIB_APPS_GUIDE.md)** and the **[IbGib Client Applications Developer Guide](../../docs/IBGIB_CLIENT_APPS_GUIDE.md)** for detailed coverage of client bootstrap, Web Components, and remote Hub sync.
6
+
3
7
  :under_construction: _I'm currently in the process of pulling this out as a framework from @ibgib/blank-gib._
4
8
 
5
9
  This library enables ibgib apps with...
@@ -10,5 +10,5 @@
10
10
  /**
11
11
  * this is the version of this package, auto-updated in the build process
12
12
  */
13
- export declare const AUTO_GENERATED_VERSION = "0.0.63";
13
+ export declare const AUTO_GENERATED_VERSION = "0.0.64";
14
14
  //# sourceMappingURL=AUTO-GENERATED-version.d.mts.map
@@ -10,5 +10,5 @@
10
10
  /**
11
11
  * this is the version of this package, auto-updated in the build process
12
12
  */
13
- export const AUTO_GENERATED_VERSION = '0.0.63';
13
+ export const AUTO_GENERATED_VERSION = '0.0.64';
14
14
  //# sourceMappingURL=AUTO-GENERATED-version.mjs.map
@@ -1,12 +1,39 @@
1
+ import { firstOfAll, ifWe, iReckon, respecfully } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
2
+ import { PathUtilsHelper } from './helpers.web.mjs';
1
3
  const maam = `[${import.meta.url}]`, sir = maam;
2
- export {};
3
- // import { storageDBExists } from './helpers.web.mjs';
4
- //todo: do these tests once we get web testing going (this won't work in node)
5
- // await respecfully(sir, `indexeddb storage`, async () => {
6
- // await ifWe(sir, `storageDBExists`, async () => {
7
- // const randomName = pickRandom_Letters({ count: 7 });
8
- // const dbExists = await storageDBExists({ name: randomName });
9
- // iReckon(sir, dbExists).isGonnaBeFalse();
10
- // });
11
- // });
4
+ await respecfully(sir, `PathUtilsHelper`, async () => {
5
+ let pathUtils;
6
+ firstOfAll(sir, async () => {
7
+ pathUtils = new PathUtilsHelper();
8
+ });
9
+ await ifWe(sir, `check isAbsolute and isRelative`, async () => {
10
+ iReckon(sir, pathUtils.isAbsolute('/a/b/c')).isGonnaBeTrue();
11
+ iReckon(sir, pathUtils.isAbsolute('/file.txt')).isGonnaBeTrue();
12
+ iReckon(sir, pathUtils.isAbsolute('a/b/c')).isGonnaBeFalse();
13
+ iReckon(sir, pathUtils.isAbsolute('file.txt')).isGonnaBeFalse();
14
+ iReckon(sir, pathUtils.isRelative('a/b/c')).isGonnaBeTrue();
15
+ iReckon(sir, pathUtils.isRelative('file.txt')).isGonnaBeTrue();
16
+ iReckon(sir, pathUtils.isRelative('/a/b/c')).isGonnaBeFalse();
17
+ });
18
+ await ifWe(sir, `join empty paths or single ..`, async () => {
19
+ iReckon(sir, pathUtils.join()).isGonnaBe('.');
20
+ iReckon(sir, pathUtils.join('..')).isGonnaBe('..');
21
+ });
22
+ await ifWe(sir, `join path segments`, async () => {
23
+ iReckon(sir, pathUtils.join('a', 'b', 'c')).isGonnaBe('a/b/c');
24
+ iReckon(sir, pathUtils.join('/a/', '/b/', 'c.txt')).isGonnaBe('a/b/c.txt');
25
+ iReckon(sir, pathUtils.join('foo', 'bar', '..')).isGonnaBe('foo');
26
+ iReckon(sir, pathUtils.join('foo', 'bar', '..', 'baz')).isGonnaBe('foo/baz');
27
+ });
28
+ await ifWe(sir, `extract dirname`, async () => {
29
+ iReckon(sir, pathUtils.dirname('a/b/c.txt')).isGonnaBe('a/b');
30
+ iReckon(sir, pathUtils.dirname('/root/sub/file.json')).isGonnaBe('/root/sub');
31
+ iReckon(sir, pathUtils.dirname('singlefile.txt')).isGonnaBe('');
32
+ });
33
+ await ifWe(sir, `extract basename`, async () => {
34
+ iReckon(sir, pathUtils.basename('a/b/c.txt')).isGonnaBe('c.txt');
35
+ iReckon(sir, pathUtils.basename('/root/sub/file.json')).isGonnaBe('file.json');
36
+ iReckon(sir, pathUtils.basename('standalone')).isGonnaBe('standalone');
37
+ });
38
+ });
12
39
  //# sourceMappingURL=helpers.web.respec.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.web.respec.mjs","sourceRoot":"","sources":["../src/helpers.web.respec.mts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAG,IAAI,OAAO,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;;AAEhD,uDAAuD;AAEvD,8EAA8E;AAE9E,4DAA4D;AAE5D,uDAAuD;AACvD,+DAA+D;AAC/D,wEAAwE;AACxE,mDAAmD;AACnD,UAAU;AACV,MAAM"}
1
+ {"version":3,"file":"helpers.web.respec.mjs","sourceRoot":"","sources":["../src/helpers.web.respec.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAa,OAAO,EAAa,WAAW,EAAmB,MAAM,kDAAkD,CAAC;AACjJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,IAAI,GAAG,IAAI,OAAO,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;AAEhD,MAAM,WAAW,CAAC,GAAG,EAAE,iB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CAAC,OAAO,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC/E,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/dist/index.d.mts CHANGED
@@ -18,4 +18,7 @@ export * from "./identity/passkey-helper.mjs";
18
18
  export * from "./ui/component/identity/index.mjs";
19
19
  export * from "./ui/ui-constants.mjs";
20
20
  export * from "./ui/ui-types.mjs";
21
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs";
22
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mjs";
23
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mjs";
21
24
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AAEvD,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,cAAc,4BAA4B,CAAC;AAG3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,mCAAmC,CAAC;AAGlD,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AAEvD,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,cAAc,4BAA4B,CAAC;AAG3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,mCAAmC,CAAC;AAGlD,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,0GAA0G,CAAC;AACzH,cAAc,6GAA6G,CAAC;AAC5H,cAAc,iHAAiH,CAAC"}
package/dist/index.mjs CHANGED
@@ -22,4 +22,8 @@ export * from "./ui/component/identity/index.mjs";
22
22
  // UI constants & types
23
23
  export * from "./ui/ui-constants.mjs";
24
24
  export * from "./ui/ui-types.mjs";
25
+ // Workspace Projection Spaces
26
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mjs";
27
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mjs";
28
+ export * from "./witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mjs";
25
29
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AAEvD,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,kBAAkB;AAClB,cAAc,4BAA4B,CAAC;AAE3C,2BAA2B;AAC3B,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,yBAAyB;AACzB,cAAc,mCAAmC,CAAC;AAElD,uBAAuB;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AAEvD,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,kBAAkB;AAClB,cAAc,4BAA4B,CAAC;AAE3C,2BAA2B;AAC3B,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,yBAAyB;AACzB,cAAc,mCAAmC,CAAC;AAElD,uBAAuB;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAElC,8BAA8B;AAC9B,cAAc,0GAA0G,CAAC;AACzH,cAAc,6GAA6G,CAAC;AAC5H,cAAc,iHAAiH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-constants
3
+ *
4
+ * Constants for in-memory web workspace projection spaces.
5
+ */
6
+ export declare const DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DESCRIPTION = "Web in-memory space witness for projecting and observing virtual workspace hierarchies in browser environments.";
7
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-constants.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-in-memory-workspace-projection-space-constants.d.mts","sourceRoot":"","sources":["../../../../src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,4DAA4D,oHAC4C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-constants
3
+ *
4
+ * Constants for in-memory web workspace projection spaces.
5
+ */
6
+ export const DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DESCRIPTION = 'Web in-memory space witness for projecting and observing virtual workspace hierarchies in browser environments.';
7
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-in-memory-workspace-projection-space-constants.mjs","sourceRoot":"","sources":["../../../../src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-constants.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4DAA4D,GACrE,iHAAiH,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-types
3
+ *
4
+ * Types for in-memory web workspace projection spaces.
5
+ */
6
+ import { WorkspaceProjectionSpaceData_V1, WorkspaceProjectionSpaceRel8ns_V1 } from '@ibgib/core-gib/dist/witness/space/workspace-projection-space/workspace-projection-space-types.mjs';
7
+ /**
8
+ * In-memory virtual file entry.
9
+ */
10
+ export interface VirtualFileEntry {
11
+ relPath: string;
12
+ content: Uint8Array;
13
+ isDirectory: boolean;
14
+ modifiedAt?: number;
15
+ }
16
+ /**
17
+ * Data payload for WebInMemoryWorkspaceProjectionSpace_V1.
18
+ */
19
+ export interface WebInMemoryWorkspaceProjectionSpaceData_V1 extends WorkspaceProjectionSpaceData_V1 {
20
+ }
21
+ export declare const DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DATA_V1: WebInMemoryWorkspaceProjectionSpaceData_V1;
22
+ export interface WebInMemoryWorkspaceProjectionSpaceRel8ns_V1 extends WorkspaceProjectionSpaceRel8ns_V1 {
23
+ }
24
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-in-memory-workspace-projection-space-types.d.mts","sourceRoot":"","sources":["../../../../src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,+BAA+B,EAC/B,iCAAiC,EACpC,MAAM,oGAAoG,CAAC;AAU5G;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,0CAA2C,SAAQ,+BAA+B;CAClG;AAED,eAAO,MAAM,wDAAwD,EAAE,0CActE,CAAC;AAEF,MAAM,WAAW,4CAA6C,SAAQ,iCAAiC;CACtG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-types
3
+ *
4
+ * Types for in-memory web workspace projection spaces.
5
+ */
6
+ import { DEFAULT_LOCAL_SPACE_POLLING_INTERVAL_MS, IBGIB_SPACE_NAME_DEFAULT, ZERO_SPACE_ID } from '@ibgib/core-gib/dist/witness/space/space-constants.mjs';
7
+ import { DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DESCRIPTION } from './web-in-memory-workspace-projection-space-constants.mjs';
8
+ export const DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DATA_V1 = {
9
+ version: '1',
10
+ uuid: ZERO_SPACE_ID,
11
+ name: IBGIB_SPACE_NAME_DEFAULT,
12
+ classname: 'WebInMemoryWorkspaceProjectionSpace_V1',
13
+ workspaceRoot: '/',
14
+ vcsFolderName: '.vcsgib',
15
+ persistOptsAndResultIbGibs: false,
16
+ validateIbGibAddrsMatchIbGibs: false,
17
+ longPollingIntervalMs: DEFAULT_LOCAL_SPACE_POLLING_INTERVAL_MS,
18
+ allowPrimitiveArgs: false,
19
+ catchAllErrors: true,
20
+ description: DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DESCRIPTION,
21
+ trace: false,
22
+ };
23
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-in-memory-workspace-projection-space-types.mjs","sourceRoot":"","sources":["../../../../src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-types.mts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACH,uCAAuC,EACvC,wBAAwB,EACxB,aAAa,EAChB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EACH,4DAA4D,EAC/D,MAAM,0DAA0D,CAAC;AAkBlE,MAAM,CAAC,MAAM,wDAAwD,GAA+C;IAChH,OAAO,EAAE,GAAG;IACZ,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,wBAAwB;IAC9B,SAAS,EAAE,wCAAwC;IACnD,aAAa,EAAE,GAAG;IAClB,aAAa,EAAE,SAAS;IACxB,0BAA0B,EAAE,KAAK;IACjC,6BAA6B,EAAE,KAAK;IACpC,qBAAqB,EAAE,uCAAuC;IAC9D,kBAAkB,EAAE,KAAK;IACzB,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,4DAA4D;IACzE,KAAK,EAAE,KAAK;CACf,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-v1
3
+ *
4
+ * Concrete in-memory Web workspace projection space implementation.
5
+ * Projects B2tFS item DAGs into an in-memory virtual file tree and scans/observes
6
+ * virtual files for status and diff operations in browser environments.
7
+ */
8
+ import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
9
+ import { IbGibSpaceAny } from '@ibgib/core-gib/dist/witness/space/space-base-v1.mjs';
10
+ import { WorkspaceProjectionSpaceBase_V1 } from '@ibgib/core-gib/dist/witness/space/workspace-projection-space/workspace-projection-space-base-v1.mjs';
11
+ import { WorkspaceScanResultData } from '@ibgib/core-gib/dist/witness/space/workspace-projection-space/workspace-projection-space-types.mjs';
12
+ import { B2tFSItemIbGib_V1 } from '@ibgib/core-gib/dist/vcs/item/item-types.mjs';
13
+ import { WebInMemoryWorkspaceProjectionSpaceData_V1, WebInMemoryWorkspaceProjectionSpaceRel8ns_V1 } from './web-in-memory-workspace-projection-space-types.mjs';
14
+ export interface WebInMemoryWorkspaceProjectionSpaceOpts {
15
+ initialData?: WebInMemoryWorkspaceProjectionSpaceData_V1;
16
+ initialRel8ns?: WebInMemoryWorkspaceProjectionSpaceRel8ns_V1;
17
+ backingSpace?: IbGibSpaceAny;
18
+ }
19
+ /**
20
+ * In-Memory Web Workspace Projection Space that projects B2tFS item DAGs into
21
+ * an in-memory virtual file tree for browser code browsing, editing, and staging.
22
+ */
23
+ export declare class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBase_V1<WebInMemoryWorkspaceProjectionSpaceData_V1, WebInMemoryWorkspaceProjectionSpaceRel8ns_V1> {
24
+ protected lc: string;
25
+ /** Backing CAS space where source BinIbGibs and child items reside */
26
+ backingSpace?: IbGibSpaceAny;
27
+ /** Map of normalized relative paths -> virtual file entries */
28
+ private _virtualFiles;
29
+ constructor(initialDataOrOpts?: WebInMemoryWorkspaceProjectionSpaceData_V1 | WebInMemoryWorkspaceProjectionSpaceOpts, initialRel8ns?: WebInMemoryWorkspaceProjectionSpaceRel8ns_V1);
30
+ /**
31
+ * Projects an item (and its recursive child hierarchy or binary payload) onto the in-memory virtual tree.
32
+ */
33
+ protected putItemToWorkspaceImpl({ item, subPath, }: {
34
+ item: B2tFSItemIbGib_V1;
35
+ subPath?: string;
36
+ }): Promise<void>;
37
+ /**
38
+ * Scans the in-memory virtual workspace and returns file observations and pending companion notes.
39
+ */
40
+ protected scanWorkspaceImpl({ subPath, filterPatterns, }: {
41
+ subPath?: string;
42
+ filterPatterns?: string[];
43
+ }): Promise<WorkspaceScanResultData>;
44
+ /**
45
+ * Deletes a virtual file, folder, or comment entry from the in-memory tree.
46
+ */
47
+ protected deleteFromWorkspaceImpl({ relPath, ibGib, }: {
48
+ relPath?: string;
49
+ ibGib?: IbGib_V1;
50
+ }): Promise<void>;
51
+ /**
52
+ * Reads raw bytes of a virtual file from in-memory map.
53
+ */
54
+ protected getFileBytesImpl({ relPath, }: {
55
+ relPath: string;
56
+ }): Promise<Uint8Array | undefined>;
57
+ /**
58
+ * Gets raw byte content for a virtual file.
59
+ */
60
+ getVirtualFile(relPath: string): Uint8Array | undefined;
61
+ /**
62
+ * Gets UTF-8 text content for a virtual file.
63
+ */
64
+ getVirtualText(relPath: string): string | undefined;
65
+ /**
66
+ * Sets or updates a virtual file's content directly in memory.
67
+ */
68
+ setVirtualFile(relPath: string, content: Uint8Array | string): void;
69
+ /**
70
+ * Lists all virtual file and folder paths currently stored in memory.
71
+ */
72
+ listVirtualPaths(): string[];
73
+ /**
74
+ * Clears all virtual files from memory.
75
+ */
76
+ clearVirtualFiles(): void;
77
+ private normalizePath;
78
+ private isCommentMetadataFilename;
79
+ private extractCommentTopicName;
80
+ /**
81
+ * Helper to fetch an IbGib strictly from backingSpace with fail-fast validation.
82
+ */
83
+ private fetchIbGib;
84
+ }
85
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-v1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-in-memory-workspace-projection-space-v1.d.mts","sourceRoot":"","sources":["../../../../src/witness/space/web-in-memory-workspace-projection-space/web-in-memory-workspace-projection-space-v1.mts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AAErF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sGAAsG,CAAC;AACvJ,OAAO,EACH,uBAAuB,EAG1B,MAAM,oGAA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EAAE;QACC,OAAO,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAElC;IAMD;;OAEG;IACI,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAK7D;IAED;;OAEG;IACI,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIzD;IAED;;OAEG;IACI,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAwBzE;IAED;;OAEG;IACI,gBAAgB,IAAI,MAAM,EAAE,CAElC;IAED;;OAEG;IACI,iBAAiB,IAAI,IAAI,CAE/B;IAMD,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,uBAAuB;IAK/B;;OAEG;YACW,UAAU;CAsB3B"}
@@ -0,0 +1,343 @@
1
+ /**
2
+ * @module web-in-memory-workspace-projection-space-v1
3
+ *
4
+ * Concrete in-memory Web workspace projection space implementation.
5
+ * Projects B2tFS item DAGs into an in-memory virtual file tree and scans/observes
6
+ * virtual files for status and diff operations in browser environments.
7
+ */
8
+ import { clone, extractErrorMsg } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
9
+ import { GLOBAL_LOG_A_LOT } from '@ibgib/core-gib/dist/core-constants.mjs';
10
+ import { getFromSpace } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
11
+ import { WorkspaceProjectionSpaceBase_V1 } from '@ibgib/core-gib/dist/witness/space/workspace-projection-space/workspace-projection-space-base-v1.mjs';
12
+ import { isPathFiltered, parseFilterFileContent } from '@ibgib/core-gib/dist/vcs/filter/glob-helper.mjs';
13
+ import { DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DATA_V1, } from './web-in-memory-workspace-projection-space-types.mjs';
14
+ const logalot = GLOBAL_LOG_A_LOT;
15
+ /**
16
+ * In-Memory Web Workspace Projection Space that projects B2tFS item DAGs into
17
+ * an in-memory virtual file tree for browser code browsing, editing, and staging.
18
+ */
19
+ export class WebInMemoryWorkspaceProjectionSpace_V1 extends WorkspaceProjectionSpaceBase_V1 {
20
+ lc = `[${WebInMemoryWorkspaceProjectionSpace_V1.name}]`;
21
+ /** Backing CAS space where source BinIbGibs and child items reside */
22
+ backingSpace;
23
+ /** Map of normalized relative paths -> virtual file entries */
24
+ _virtualFiles = new Map();
25
+ constructor(initialDataOrOpts, initialRel8ns) {
26
+ let data;
27
+ let rel8ns = initialRel8ns;
28
+ let backingSpace;
29
+ if (initialDataOrOpts && ('workspaceRoot' in initialDataOrOpts || 'name' in initialDataOrOpts)) {
30
+ data = initialDataOrOpts;
31
+ }
32
+ else if (initialDataOrOpts && typeof initialDataOrOpts === 'object') {
33
+ const opts = initialDataOrOpts;
34
+ data = opts.initialData;
35
+ rel8ns = opts.initialRel8ns ?? initialRel8ns;
36
+ backingSpace = opts.backingSpace;
37
+ }
38
+ super(data ?? clone(DEFAULT_WEB_IN_MEMORY_WORKSPACE_PROJECTION_SPACE_DATA_V1), rel8ns);
39
+ this.backingSpace = backingSpace;
40
+ }
41
+ // #region Implementation of Abstract Extension Hooks
42
+ /**
43
+ * Projects an item (and its recursive child hierarchy or binary payload) onto the in-memory virtual tree.
44
+ */
45
+ async putItemToWorkspaceImpl({ item, subPath, }) {
46
+ const lc = `${this.lc}[${this.putItemToWorkspaceImpl.name}]`;
47
+ try {
48
+ if (logalot) {
49
+ console.log(`${lc} projecting item to virtual workspace...`);
50
+ }
51
+ if (!item || !item.data) {
52
+ throw new Error(`${lc} item and item.data are required (E: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6)`);
53
+ }
54
+ const { fsType, name } = item.data;
55
+ let itemRelPath;
56
+ if (subPath === undefined) {
57
+ itemRelPath = fsType === 'folder' ? '' : (name || '');
58
+ }
59
+ else {
60
+ itemRelPath = name ? (subPath ? `${subPath}/${name}` : name) : subPath;
61
+ }
62
+ itemRelPath = this.normalizePath(itemRelPath);
63
+ if (fsType === 'folder') {
64
+ if (itemRelPath) {
65
+ this._virtualFiles.set(itemRelPath, {
66
+ relPath: itemRelPath,
67
+ content: new Uint8Array(0),
68
+ isDirectory: true,
69
+ modifiedAt: Date.now(),
70
+ });
71
+ }
72
+ const childAddrs = item.rel8ns?.b2tFS_child || item.rel8ns?.b2tfs_child || [];
73
+ for (const childAddr of childAddrs) {
74
+ const childItem = (await this.fetchIbGib(childAddr));
75
+ await this.putItemToWorkspaceImpl({
76
+ item: childItem,
77
+ subPath: itemRelPath,
78
+ });
79
+ }
80
+ }
81
+ else if (fsType === 'file') {
82
+ if (!item.rel8ns) {
83
+ throw new Error(`${lc} item.rel8ns required for file item (E: b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7)`);
84
+ }
85
+ const binAddrs = item.rel8ns.bin;
86
+ if (!binAddrs || binAddrs.length === 0) {
87
+ throw new Error(`${lc} item.rel8ns.bin required for file item ${name} (E: c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8)`);
88
+ }
89
+ const latestBinAddr = binAddrs.at(-1);
90
+ const binIbGib = await this.fetchIbGib(latestBinAddr);
91
+ if (binIbGib.data === undefined) {
92
+ throw new Error(`${lc} BinIbGib at addr ${latestBinAddr} has undefined data (E: d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9)`);
93
+ }
94
+ let fileData;
95
+ if (binIbGib.data instanceof Uint8Array) {
96
+ fileData = binIbGib.data;
97
+ }
98
+ else if (typeof binIbGib.data === 'string') {
99
+ fileData = new TextEncoder().encode(binIbGib.data);
100
+ }
101
+ else if (typeof binIbGib.data === 'object') {
102
+ const vals = Object.values(binIbGib.data);
103
+ fileData = new Uint8Array(vals);
104
+ }
105
+ else {
106
+ fileData = new Uint8Array(0);
107
+ }
108
+ this._virtualFiles.set(itemRelPath, {
109
+ relPath: itemRelPath,
110
+ content: fileData,
111
+ isDirectory: false,
112
+ modifiedAt: Date.now(),
113
+ });
114
+ }
115
+ }
116
+ catch (error) {
117
+ console.error(`${lc} ${extractErrorMsg(error)} (E: e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0)`);
118
+ throw error;
119
+ }
120
+ }
121
+ /**
122
+ * Scans the in-memory virtual workspace and returns file observations and pending companion notes.
123
+ */
124
+ async scanWorkspaceImpl({ subPath, filterPatterns, }) {
125
+ const lc = `${this.lc}[${this.scanWorkspaceImpl.name}]`;
126
+ try {
127
+ if (logalot) {
128
+ console.log(`${lc} starting in-memory virtual scan...`);
129
+ }
130
+ const vcsFolderName = this.data?.vcsFolderName || '.vcsgib';
131
+ let patterns = filterPatterns ?? this.data?.filterPatterns;
132
+ if (!patterns || patterns.length === 0) {
133
+ const ignoreEntry = this._virtualFiles.get('.ibgibignore');
134
+ if (ignoreEntry && !ignoreEntry.isDirectory) {
135
+ const ignoreContent = new TextDecoder('utf8').decode(ignoreEntry.content);
136
+ patterns = parseFilterFileContent(ignoreContent);
137
+ }
138
+ else {
139
+ patterns = [];
140
+ }
141
+ }
142
+ const normalizedSubPath = subPath ? this.normalizePath(subPath) : '';
143
+ const files = new Map();
144
+ const pendingComments = [];
145
+ for (const [relPath, entry] of this._virtualFiles.entries()) {
146
+ if (normalizedSubPath && !relPath.startsWith(normalizedSubPath)) {
147
+ continue;
148
+ }
149
+ // Exclude VCS metadata folders, .git, and worktrees folder 'b'
150
+ if (relPath === vcsFolderName || relPath.startsWith(vcsFolderName + '/') ||
151
+ relPath === '.git' || relPath.startsWith('.git/') ||
152
+ relPath === 'b' || relPath.startsWith('b/')) {
153
+ continue;
154
+ }
155
+ if (isPathFiltered({ relativePath: relPath, isDirectory: entry.isDirectory, filterPatterns: patterns })) {
156
+ continue;
157
+ }
158
+ const filename = relPath.split('/').pop() || relPath;
159
+ if (entry.isDirectory) {
160
+ files.set(relPath, {
161
+ relPath,
162
+ fullPath: relPath,
163
+ isDirectory: true,
164
+ });
165
+ }
166
+ else {
167
+ if (this.isCommentMetadataFilename(filename)) {
168
+ const pathParts = relPath.split('/');
169
+ pathParts.pop();
170
+ const parentRelPath = pathParts.join('/');
171
+ const content = new TextDecoder('utf8').decode(entry.content);
172
+ const topicName = this.extractCommentTopicName(filename);
173
+ const targetRelPath = parentRelPath ? `${parentRelPath}/${topicName}` : topicName;
174
+ pendingComments.push({
175
+ commentRelPath: relPath,
176
+ commentFullPath: relPath,
177
+ targetRelPath,
178
+ targetType: filename.startsWith('.ib.') ? 'file' : 'folder',
179
+ topicName,
180
+ content,
181
+ });
182
+ }
183
+ else {
184
+ const digestBuf = await crypto.subtle.digest('SHA-256', entry.content);
185
+ const digestBytes = new Uint8Array(digestBuf);
186
+ let fileHash = '';
187
+ for (let i = 0; i < digestBytes.length; i++) {
188
+ fileHash += digestBytes[i].toString(16).padStart(2, '0');
189
+ }
190
+ files.set(relPath, {
191
+ relPath,
192
+ fullPath: relPath,
193
+ isDirectory: false,
194
+ fileHash,
195
+ size: entry.content.length,
196
+ });
197
+ }
198
+ }
199
+ }
200
+ return {
201
+ files,
202
+ pendingComments,
203
+ };
204
+ }
205
+ catch (error) {
206
+ console.error(`${lc} ${extractErrorMsg(error)} (E: f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1)`);
207
+ throw error;
208
+ }
209
+ }
210
+ /**
211
+ * Deletes a virtual file, folder, or comment entry from the in-memory tree.
212
+ */
213
+ async deleteFromWorkspaceImpl({ relPath, ibGib, }) {
214
+ const lc = `${this.lc}[${this.deleteFromWorkspaceImpl.name}]`;
215
+ try {
216
+ if (logalot) {
217
+ console.log(`${lc} deleting from virtual workspace...`);
218
+ }
219
+ const targetRelPath = this.normalizePath(relPath || ibGib?.data?.name);
220
+ if (!targetRelPath) {
221
+ throw new Error(`${lc} relPath or item name required for deletion (E: a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2)`);
222
+ }
223
+ // Remove target path and any nested children
224
+ const keysToDelete = [];
225
+ for (const key of this._virtualFiles.keys()) {
226
+ if (key === targetRelPath || key.startsWith(`${targetRelPath}/`)) {
227
+ keysToDelete.push(key);
228
+ }
229
+ }
230
+ for (const key of keysToDelete) {
231
+ this._virtualFiles.delete(key);
232
+ }
233
+ }
234
+ catch (error) {
235
+ console.error(`${lc} ${extractErrorMsg(error)} (E: b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3)`);
236
+ throw error;
237
+ }
238
+ }
239
+ /**
240
+ * Reads raw bytes of a virtual file from in-memory map.
241
+ */
242
+ async getFileBytesImpl({ relPath, }) {
243
+ return this.getVirtualFile(relPath);
244
+ }
245
+ // #endregion
246
+ // #region In-Memory Virtual File Accessors
247
+ /**
248
+ * Gets raw byte content for a virtual file.
249
+ */
250
+ getVirtualFile(relPath) {
251
+ const normalized = this.normalizePath(relPath);
252
+ const entry = this._virtualFiles.get(normalized);
253
+ if (!entry || entry.isDirectory) {
254
+ return undefined;
255
+ }
256
+ return entry.content;
257
+ }
258
+ /**
259
+ * Gets UTF-8 text content for a virtual file.
260
+ */
261
+ getVirtualText(relPath) {
262
+ const bytes = this.getVirtualFile(relPath);
263
+ if (bytes === undefined) {
264
+ return undefined;
265
+ }
266
+ return new TextDecoder('utf8').decode(bytes);
267
+ }
268
+ /**
269
+ * Sets or updates a virtual file's content directly in memory.
270
+ */
271
+ setVirtualFile(relPath, content) {
272
+ const normalized = this.normalizePath(relPath);
273
+ const data = typeof content === 'string' ? new TextEncoder().encode(content) : content;
274
+ // Ensure parent directories exist
275
+ const parts = normalized.split('/');
276
+ for (let i = 1; i < parts.length; i++) {
277
+ const parentPath = parts.slice(0, i).join('/');
278
+ if (!this._virtualFiles.has(parentPath)) {
279
+ this._virtualFiles.set(parentPath, {
280
+ relPath: parentPath,
281
+ content: new Uint8Array(0),
282
+ isDirectory: true,
283
+ modifiedAt: Date.now(),
284
+ });
285
+ }
286
+ }
287
+ this._virtualFiles.set(normalized, {
288
+ relPath: normalized,
289
+ content: data,
290
+ isDirectory: false,
291
+ modifiedAt: Date.now(),
292
+ });
293
+ }
294
+ /**
295
+ * Lists all virtual file and folder paths currently stored in memory.
296
+ */
297
+ listVirtualPaths() {
298
+ return Array.from(this._virtualFiles.keys()).sort();
299
+ }
300
+ /**
301
+ * Clears all virtual files from memory.
302
+ */
303
+ clearVirtualFiles() {
304
+ this._virtualFiles.clear();
305
+ }
306
+ // #endregion
307
+ // #region Private Helpers
308
+ normalizePath(p) {
309
+ return p.replace(/\\/g, '/').replace(/^\/+/, '').replace(/\/+$/, '');
310
+ }
311
+ isCommentMetadataFilename(filename) {
312
+ return filename.startsWith('.ib.') && filename.endsWith('.md') && filename.length > '.ib..md'.length;
313
+ }
314
+ extractCommentTopicName(filename) {
315
+ if (!this.isCommentMetadataFilename(filename)) {
316
+ return '';
317
+ }
318
+ return filename.slice(4, -3);
319
+ }
320
+ /**
321
+ * Helper to fetch an IbGib strictly from backingSpace with fail-fast validation.
322
+ */
323
+ async fetchIbGib(addr) {
324
+ const lc = `${this.lc}[${this.fetchIbGib.name}]`;
325
+ try {
326
+ if (!this.backingSpace) {
327
+ throw new Error(`${lc} backingSpace required to fetch IbGib at ${addr} (E: c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4)`);
328
+ }
329
+ const resGet = await getFromSpace({ space: this.backingSpace, addrs: [addr] });
330
+ if (!resGet.success || !resGet.ibGibs || resGet.ibGibs.length === 0) {
331
+ const resIbGib = resGet.rawResultIbGib;
332
+ const addrsNotFound = resIbGib?.data?.addrsNotFound ?? 'unknown';
333
+ throw new Error(`${lc} couldn't find addr ${addr} in backingSpace. addrsNotFound: ${addrsNotFound} (E: d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5)`);
334
+ }
335
+ return resGet.ibGibs[0];
336
+ }
337
+ catch (error) {
338
+ console.error(`${lc} ${extractErrorMsg(error)} (E: e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6)`);
339
+ throw error;
340
+ }
341
+ }
342
+ }
343
+ //# sourceMappingURL=web-in-memory-workspace-projection-space-v1.mjs.map