@ibgib/web-gib 0.0.52 โ†’ 0.0.55

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 (150) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/AUTO-GENERATED-version.d.mts +1 -1
  3. package/dist/AUTO-GENERATED-version.mjs +1 -1
  4. package/dist/api/commands/chat/hello-world.mjs.map +1 -1
  5. package/dist/api/commands/command-constants.d.mts +4 -4
  6. package/dist/api/commands/command-constants.d.mts.map +1 -1
  7. package/dist/api/commands/command-service-v1.d.mts.map +1 -1
  8. package/dist/api/commands/command-service-v1.mjs.map +1 -1
  9. package/dist/api/commands/ibgib/get-ibgibs.d.mts.map +1 -1
  10. package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -1
  11. package/dist/api/ibgib-api-bridge.d.mts +81 -0
  12. package/dist/api/ibgib-api-bridge.d.mts.map +1 -0
  13. package/dist/api/ibgib-api-bridge.mjs +259 -0
  14. package/dist/api/ibgib-api-bridge.mjs.map +1 -0
  15. package/dist/app-bootstrap/init-orchestration.d.mts +1 -1
  16. package/dist/app-bootstrap/init-orchestration.d.mts.map +1 -1
  17. package/dist/app-bootstrap/init-orchestration.mjs +17 -3
  18. package/dist/app-bootstrap/init-orchestration.mjs.map +1 -1
  19. package/dist/assets/fullscreen-dialog.html +18 -0
  20. package/dist/assumptions.respec.mjs.map +1 -1
  21. package/dist/common/settings/settings-constants.d.mts.map +1 -1
  22. package/dist/helpers.d.mts.map +1 -1
  23. package/dist/helpers.mjs.map +1 -1
  24. package/dist/helpers.web.d.mts.map +1 -1
  25. package/dist/helpers.web.mjs.map +1 -1
  26. package/dist/helpers.web.respec.mjs.map +1 -1
  27. package/dist/identity/keystone-sync-service.d.mts +37 -0
  28. package/dist/identity/keystone-sync-service.d.mts.map +1 -0
  29. package/dist/identity/keystone-sync-service.mjs +211 -0
  30. package/dist/identity/keystone-sync-service.mjs.map +1 -0
  31. package/dist/identity/sso/sso-custodian-service.d.mts.map +1 -1
  32. package/dist/identity/sso/sso-custodian-service.mjs.map +1 -1
  33. package/dist/identity/sso/sso-custodian-service.respec.mjs.map +1 -1
  34. package/dist/index.d.mts +17 -1
  35. package/dist/index.d.mts.map +1 -1
  36. package/dist/index.mjs +21 -26
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/storage/storage-helpers.web.mjs.map +1 -1
  39. package/dist/ui/component/common-component-styles.css +270 -0
  40. package/dist/ui/component/ibgib-component-service.d.mts.map +1 -1
  41. package/dist/ui/component/ibgib-dynamic-component-bases.d.mts.map +1 -1
  42. package/dist/ui/component/ibgib-dynamic-component-bases.mjs.map +1 -1
  43. package/dist/ui/component/identity/add-device/add-device.css +133 -0
  44. package/dist/ui/component/identity/add-device/add-device.d.mts +49 -0
  45. package/dist/ui/component/identity/add-device/add-device.d.mts.map +1 -0
  46. package/dist/ui/component/identity/add-device/add-device.html +52 -0
  47. package/dist/ui/component/identity/add-device/add-device.mjs +321 -0
  48. package/dist/ui/component/identity/add-device/add-device.mjs.map +1 -0
  49. package/dist/ui/component/identity/identity-header/identity-header.css +317 -0
  50. package/dist/ui/component/identity/identity-header/identity-header.d.mts +85 -0
  51. package/dist/ui/component/identity/identity-header/identity-header.d.mts.map +1 -0
  52. package/dist/ui/component/identity/identity-header/identity-header.html +72 -0
  53. package/dist/ui/component/identity/identity-header/identity-header.mjs +546 -0
  54. package/dist/ui/component/identity/identity-header/identity-header.mjs.map +1 -0
  55. package/dist/ui/component/identity/identity-manager/identity-manager.css +178 -0
  56. package/dist/ui/component/identity/identity-manager/identity-manager.d.mts +76 -0
  57. package/dist/ui/component/identity/identity-manager/identity-manager.d.mts.map +1 -0
  58. package/dist/ui/component/identity/identity-manager/identity-manager.html +19 -0
  59. package/dist/ui/component/identity/identity-manager/identity-manager.mjs +591 -0
  60. package/dist/ui/component/identity/identity-manager/identity-manager.mjs.map +1 -0
  61. package/dist/ui/component/identity/index.d.mts +17 -0
  62. package/dist/ui/component/identity/index.d.mts.map +1 -0
  63. package/dist/ui/component/identity/index.mjs +34 -0
  64. package/dist/ui/component/identity/index.mjs.map +1 -0
  65. package/dist/ui/component/identity/keystone-creator/keystone-creator.css +97 -0
  66. package/dist/ui/component/identity/keystone-creator/keystone-creator.d.mts +58 -0
  67. package/dist/ui/component/identity/keystone-creator/keystone-creator.d.mts.map +1 -0
  68. package/dist/ui/component/identity/keystone-creator/keystone-creator.html +51 -0
  69. package/dist/ui/component/identity/keystone-creator/keystone-creator.mjs +410 -0
  70. package/dist/ui/component/identity/keystone-creator/keystone-creator.mjs.map +1 -0
  71. package/dist/ui/component/identity/keystone-details/keystone-details.css +621 -0
  72. package/dist/ui/component/identity/keystone-details/keystone-details.d.mts +98 -0
  73. package/dist/ui/component/identity/keystone-details/keystone-details.d.mts.map +1 -0
  74. package/dist/ui/component/identity/keystone-details/keystone-details.html +154 -0
  75. package/dist/ui/component/identity/keystone-details/keystone-details.mjs +1377 -0
  76. package/dist/ui/component/identity/keystone-details/keystone-details.mjs.map +1 -0
  77. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.css +46 -0
  78. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.d.mts +64 -0
  79. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.d.mts.map +1 -0
  80. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.html +15 -0
  81. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.mjs +300 -0
  82. package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.mjs.map +1 -0
  83. package/dist/ui/component/identity/remove-device/remove-device.css +118 -0
  84. package/dist/ui/component/identity/remove-device/remove-device.d.mts +50 -0
  85. package/dist/ui/component/identity/remove-device/remove-device.d.mts.map +1 -0
  86. package/dist/ui/component/identity/remove-device/remove-device.html +31 -0
  87. package/dist/ui/component/identity/remove-device/remove-device.mjs +188 -0
  88. package/dist/ui/component/identity/remove-device/remove-device.mjs.map +1 -0
  89. package/dist/ui/ui-constants.d.mts +1 -0
  90. package/dist/ui/ui-constants.d.mts.map +1 -1
  91. package/dist/ui/ui-constants.mjs +1 -0
  92. package/dist/ui/ui-constants.mjs.map +1 -1
  93. package/dist/ui/ui-types.d.mts +7 -0
  94. package/dist/ui/ui-types.d.mts.map +1 -1
  95. package/dist/witness/agent/agent-constants.d.mts.map +1 -1
  96. package/dist/witness/agent/agent-helpers.mjs.map +1 -1
  97. package/dist/witness/agent/agent-one-file.d.mts.map +1 -1
  98. package/dist/witness/agent/agent-one-file.mjs.map +1 -1
  99. package/dist/witness/agent/agents-service-v1.d.mts.map +1 -1
  100. package/dist/witness/agent/agents-service-v1.mjs.map +1 -1
  101. package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts.map +1 -1
  102. package/dist/witness/agent/gemini/gemini-agent-factory.d.mts.map +1 -1
  103. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -1
  104. package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -1
  105. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs.map +1 -1
  106. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts +4 -0
  107. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts.map +1 -1
  108. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs +40 -1
  109. package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs.map +1 -1
  110. package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts.map +1 -1
  111. package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts.map +1 -1
  112. package/package.json +2 -2
  113. package/src/AUTO-GENERATED-version.mts +1 -1
  114. package/src/api/ibgib-api-bridge.mts +292 -0
  115. package/src/app-bootstrap/init-orchestration.mts +17 -6
  116. package/src/custom.d.ts +11 -0
  117. package/src/identity/keystone-sync-service.mts +257 -0
  118. package/src/index.mts +24 -25
  119. package/src/ui/component/README.md +82 -5
  120. package/src/ui/component/common-component-styles.css +270 -0
  121. package/src/ui/component/identity/add-device/add-device.css +133 -0
  122. package/src/ui/component/identity/add-device/add-device.html +52 -0
  123. package/src/ui/component/identity/add-device/add-device.mts +397 -0
  124. package/src/ui/component/identity/identity-header/IMPLEMENTATION.md +45 -0
  125. package/src/ui/component/identity/identity-header/identity-header.css +317 -0
  126. package/src/ui/component/identity/identity-header/identity-header.html +72 -0
  127. package/src/ui/component/identity/identity-header/identity-header.mts +651 -0
  128. package/src/ui/component/identity/identity-manager/IMPLEMENTATION.md +100 -0
  129. package/src/ui/component/identity/identity-manager/identity-manager.css +178 -0
  130. package/src/ui/component/identity/identity-manager/identity-manager.html +19 -0
  131. package/src/ui/component/identity/identity-manager/identity-manager.mts +675 -0
  132. package/src/ui/component/identity/index.mts +36 -0
  133. package/src/ui/component/identity/keystone-creator/keystone-creator.css +97 -0
  134. package/src/ui/component/identity/keystone-creator/keystone-creator.html +51 -0
  135. package/src/ui/component/identity/keystone-creator/keystone-creator.mts +497 -0
  136. package/src/ui/component/identity/keystone-details/keystone-details.css +621 -0
  137. package/src/ui/component/identity/keystone-details/keystone-details.html +154 -0
  138. package/src/ui/component/identity/keystone-details/keystone-details.mts +1506 -0
  139. package/src/ui/component/identity/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +33 -0
  140. package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.css +46 -0
  141. package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.html +15 -0
  142. package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.mts +355 -0
  143. package/src/ui/component/identity/remove-device/remove-device.css +118 -0
  144. package/src/ui/component/identity/remove-device/remove-device.html +31 -0
  145. package/src/ui/component/identity/remove-device/remove-device.mts +247 -0
  146. package/src/ui/ui-constants.mts +1 -0
  147. package/src/ui/ui-types.mts +8 -0
  148. package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mts +42 -1
  149. package/tools/auto-generated-agent-skills/skills/ibgib-dependency-graph/SKILL.md +209 -0
  150. package/tools/auto-generated-agent-skills/skills/ibgib-implementation-plan/SKILL.md +102 -0
@@ -0,0 +1,247 @@
1
+ import thisCss from "./remove-device.css";
2
+ import thisHtml from "./remove-device.html";
3
+ import commonComponentStylesCss from "../../common-component-styles.css";
4
+
5
+ import { delay, extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
6
+ import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
7
+ import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
8
+ import { KeystoneService_V1 } from "@ibgib/core-gib/dist/keystone/keystone-service-v1.mjs";
9
+ import { KeystoneIbGib_V1 } from "@ibgib/core-gib/dist/keystone/keystone-types.mjs";
10
+
11
+ import { getGlobalMetaspace_waitIfNeeded } from "../../../../helpers.mjs";
12
+ import {
13
+ IbGibDynamicComponentMetaBase, IbGibFormInstanceBase,
14
+ } from "../../ibgib-dynamic-component-bases.mjs";
15
+ import {
16
+ ElementsBase, IbGibDynamicComponentInstance,
17
+ IbGibDynamicComponentInstanceInitOpts,
18
+ } from "../../component-types.mjs";
19
+ import { getComponentCtorArg } from "../../../../app-bootstrap/init-orchestration.mjs";
20
+
21
+ export const REMOVE_DEVICE_COMPONENT_NAME = 'ibgib-remove-device';
22
+
23
+ /**
24
+ * Metadata for the Remove Device / Revocation component.
25
+ */
26
+ export class RemoveDeviceComponentMeta extends IbGibDynamicComponentMetaBase {
27
+ protected lc: string = `[RemoveDeviceComponentMeta]`;
28
+
29
+ routeRegExp?: RegExp = new RegExp(`^${REMOVE_DEVICE_COMPONENT_NAME}$`);
30
+ componentName = REMOVE_DEVICE_COMPONENT_NAME;
31
+
32
+ constructor() {
33
+ super(getComponentCtorArg());
34
+ if (!customElements.get(this.componentName)) {
35
+ customElements.define(this.componentName, RemoveDeviceComponentInstance);
36
+ }
37
+ }
38
+
39
+ async createInstance({
40
+ path,
41
+ ibGibAddr
42
+ }: {
43
+ path: string;
44
+ ibGibAddr: IbGibAddr;
45
+ }): Promise<IbGibDynamicComponentInstance> {
46
+ const component = document.createElement(this.componentName) as RemoveDeviceComponentInstance;
47
+ await component.initialize({
48
+ ibGibAddr,
49
+ meta: this,
50
+ html: thisHtml,
51
+ css: [commonComponentStylesCss, thisCss],
52
+ });
53
+ return component;
54
+ }
55
+ }
56
+
57
+ interface RemoveDeviceElements extends ElementsBase {
58
+ containerEl: HTMLDivElement;
59
+ titleEl: HTMLHeadingElement;
60
+ selectDelegateEl: HTMLSelectElement;
61
+ inputPassphrase: HTMLInputElement;
62
+ btnRemoveDeviceEl: HTMLButtonElement;
63
+ statusArea: HTMLDivElement;
64
+ statusText: HTMLParagraphElement;
65
+ resultAreaEl: HTMLDivElement;
66
+ }
67
+
68
+ /**
69
+ * Concrete implementation of the Remove Device / Revocation component.
70
+ */
71
+ export class RemoveDeviceComponentInstance
72
+ extends IbGibFormInstanceBase<IbGib_V1, RemoveDeviceElements>
73
+ implements IbGibDynamicComponentInstance<IbGib_V1, RemoveDeviceElements> {
74
+
75
+ protected lc: string = `[RemoveDeviceComponentInstance]`;
76
+ private activePrimaryKeystone: KeystoneIbGib_V1 | undefined;
77
+
78
+ constructor() {
79
+ super();
80
+ }
81
+
82
+ override async initialize(opts: IbGibDynamicComponentInstanceInitOpts): Promise<void> {
83
+ await super.initialize(opts);
84
+ }
85
+
86
+ override async created(): Promise<void> {
87
+ this.elements = {} as RemoveDeviceElements;
88
+
89
+ this.elements.containerEl = this.shadowRoot!.getElementById('container') as HTMLDivElement;
90
+ this.elements.titleEl = this.shadowRoot!.getElementById('title') as HTMLHeadingElement;
91
+ this.elements.selectDelegateEl = this.shadowRoot!.getElementById('select-delegate') as HTMLSelectElement;
92
+ this.elements.inputPassphrase = this.shadowRoot!.getElementById('input-passphrase') as HTMLInputElement;
93
+ this.elements.btnRemoveDeviceEl = this.shadowRoot!.getElementById('btn-remove-device') as HTMLButtonElement;
94
+ this.elements.statusArea = this.shadowRoot!.getElementById('status-area') as HTMLDivElement;
95
+ this.elements.statusText = this.shadowRoot!.getElementById('status-text') as HTMLParagraphElement;
96
+ this.elements.resultAreaEl = this.shadowRoot!.getElementById('result-area') as HTMLDivElement;
97
+
98
+ this.elements.contentEl = this.elements.containerEl;
99
+
100
+ this.initHandlers();
101
+ await this.loadRegisteredDelegates();
102
+ await this.renderUI();
103
+ }
104
+
105
+ override async disconnected(): Promise<void> {
106
+ // cleanup if needed
107
+ }
108
+
109
+ private initHandlers() {
110
+ this.elements!.btnRemoveDeviceEl.addEventListener('click', () => this.handleRemoveDevice());
111
+ this.elements!.inputPassphrase.addEventListener('input', () => {
112
+ this.elements!.inputPassphrase.classList.remove('invalid');
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Loads registered delegate devices from the active primary identity keystone into the dropdown select.
118
+ */
119
+ protected async loadRegisteredDelegates() {
120
+ const lc = `${this.lc}[${this.loadRegisteredDelegates.name}]`;
121
+ try {
122
+ const metaspace = await getGlobalMetaspace_waitIfNeeded();
123
+ const space = await metaspace.getLocalUserSpace({});
124
+ if (!space) { return; }
125
+
126
+ const keystonesIndex = await metaspace.getSpecialIbGib({
127
+ type: "keystones",
128
+ space,
129
+ initialize: true,
130
+ });
131
+ const registeredAddrs: string[] = keystonesIndex?.rel8ns?.keystone ?? [];
132
+
133
+ // Find primary identity (n === 0 and has delegates map or is primary domain keystone)
134
+ for (const addr of registeredAddrs) {
135
+ const res = await metaspace.get({ addrs: [addr], space });
136
+ const keystone = res?.ibGibs?.[0] as KeystoneIbGib_V1 | undefined;
137
+ if (keystone && keystone.data && !keystone.data.isDelegate) {
138
+ this.activePrimaryKeystone = keystone;
139
+ break;
140
+ }
141
+ }
142
+
143
+ const selectEl = this.elements!.selectDelegateEl;
144
+ selectEl.innerHTML = '';
145
+
146
+ const delegatesMap = this.activePrimaryKeystone?.data?.delegates ?? {};
147
+ const delegateTjpAddrs = Object.keys(delegatesMap);
148
+
149
+ if (delegateTjpAddrs.length === 0) {
150
+ const opt = document.createElement('option');
151
+ opt.value = '';
152
+ opt.text = 'No registered delegate devices found';
153
+ selectEl.appendChild(opt);
154
+ this.elements!.btnRemoveDeviceEl.disabled = true;
155
+ return;
156
+ }
157
+
158
+ const defaultOpt = document.createElement('option');
159
+ defaultOpt.value = '';
160
+ defaultOpt.text = '-- Select a device to unlink --';
161
+ selectEl.appendChild(defaultOpt);
162
+
163
+ for (const tjpAddr of delegateTjpAddrs) {
164
+ const info = delegatesMap[tjpAddr];
165
+ const opt = document.createElement('option');
166
+ opt.value = tjpAddr;
167
+ opt.text = `${info.delegateAddr.split('^')[0]} (TJP: ${tjpAddr.substring(0, 20)}...)`;
168
+ selectEl.appendChild(opt);
169
+ }
170
+ this.elements!.btnRemoveDeviceEl.disabled = false;
171
+
172
+ } catch (error) {
173
+ console.error(`${lc} ${extractErrorMsg(error)}`);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Executes the Phase 1 Remove-Device revocation orchestration flow.
179
+ */
180
+ protected async handleRemoveDevice() {
181
+ const lc = `${this.lc}[${this.handleRemoveDevice.name}]`;
182
+ try {
183
+ const humanEyeDelay = 500;
184
+ const delegateTjpAddr = this.elements!.selectDelegateEl.value;
185
+ if (!delegateTjpAddr) {
186
+ this.setStatus("Please select a device delegate to unlink.", "error");
187
+ return;
188
+ }
189
+
190
+ const masterSecret = this.elements!.inputPassphrase.value.trim();
191
+ this.elements!.inputPassphrase.value = masterSecret;
192
+ if (!masterSecret) {
193
+ this.elements!.inputPassphrase.classList.add('invalid');
194
+ this.setStatus("Please enter your master passphrase.", "error");
195
+ return;
196
+ }
197
+
198
+ if (!this.activePrimaryKeystone) {
199
+ this.setStatus("No active primary identity keystone found.", "error");
200
+ return;
201
+ }
202
+
203
+ this.showBusy({
204
+ isBusy: true,
205
+ title: 'Revoking Device...',
206
+ msg: 'Evolving primary identity to revoke delegate device...',
207
+ animationEmoji: '๐Ÿ”’',
208
+ submitBtnSelector: '#btn-remove-device',
209
+ loadingText: 'Unlinking...'
210
+ });
211
+
212
+ const metaspace = await getGlobalMetaspace_waitIfNeeded();
213
+ const space = await metaspace.getLocalUserSpace({});
214
+ if (!space) { throw new Error("No default space found in metaspace."); }
215
+
216
+ const keystoneService = new KeystoneService_V1();
217
+
218
+ // Evolve primary identity keystone unregistering delegate
219
+ const evolvedParent = await keystoneService.unregisterDelegate({
220
+ parentKeystone: this.activePrimaryKeystone,
221
+ delegateTjpAddr,
222
+ masterSecret,
223
+ metaspace,
224
+ space
225
+ });
226
+
227
+ // Persist evolved parent to space
228
+ await metaspace.put({ ibGibs: [evolvedParent], space });
229
+ await metaspace.registerNewIbGib({ ibGib: evolvedParent, space });
230
+
231
+ this.activePrimaryKeystone = evolvedParent;
232
+ await delay(humanEyeDelay);
233
+
234
+ this.showBusy({ isBusy: false });
235
+ this.elements!.resultAreaEl.classList.remove('collapsed');
236
+ this.setStatus("Device successfully unlinked and revoked!", "success");
237
+
238
+ // Refresh list
239
+ await this.loadRegisteredDelegates();
240
+
241
+ } catch (error) {
242
+ console.error(`${lc} ${extractErrorMsg(error)}`);
243
+ this.setStatus(`Revocation failed: ${extractErrorMsg(error)}`, "error");
244
+ this.showBusy({ isBusy: false });
245
+ }
246
+ }
247
+ }
@@ -106,6 +106,7 @@ export const EVENT_IBGIB_UI_BUSY = 'ibgib-ui-busy';
106
106
  export const EVENT_IBGIB_UI_MESSAGE = 'ibgib-ui-message';
107
107
  export const EVENT_IBGIB_IDENTITY_REQUEST_CHANGE = 'ibgib-identity-request-change';
108
108
  export const EVENT_IBGIB_IDENTITY_CHANGED = 'ibgib-identity-changed';
109
+ export const EVENT_IBGIB_IDENTITY_UPDATE_AVAILABLE = 'ibgib-identity-update-available';
109
110
  // #endregion Custom Events
110
111
 
111
112
 
@@ -9,3 +9,11 @@ export interface UIThemeInfo {
9
9
  */
10
10
  cssVariableOverrides: { [key: string]: string; }
11
11
  }
12
+
13
+ export interface EventIbGibIdentityUpdateAvailableDetail {
14
+ activePrimaryAddr: string;
15
+ hasUpdate: boolean;
16
+ serverN: number;
17
+ localN: number;
18
+ serverLatestAddr: string;
19
+ }
@@ -18,7 +18,7 @@ import { fnCreateNewLocalSpace, fnDtoToSpace_webFilesystem } from './metaspace-w
18
18
  import { WebFilesystemSpace_V1 } from '../../web-filesystem-space/web-filesystem-space-v1.mjs';
19
19
  // import { storageCreateStoreIfNotExist, initializeStorage, storageDBExists, } from '../../../../helpers.web.mjs';
20
20
  import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
21
- import { storageCreateStoreIfNotExist } from '../../../../storage/storage-helpers.web.mjs';
21
+ import { storageCreateStoreIfNotExist, storageRmRF } from '../../../../storage/storage-helpers.web.mjs';
22
22
  import { SpaceId } from '@ibgib/core-gib/dist/witness/space/space-types.mjs';
23
23
  import { validateIbGibIntrinsically } from '@ibgib/ts-gib/dist/V1/validate-helper.mjs';
24
24
  import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
@@ -404,4 +404,45 @@ export class Metaspace_Webspace extends MetaspaceBase {
404
404
  }
405
405
  }
406
406
 
407
+ override async deleteLocalUserSpace({
408
+ spaceId,
409
+ deletePhysicalStorage = true,
410
+ }: {
411
+ spaceId: SpaceId;
412
+ deletePhysicalStorage?: boolean;
413
+ }): Promise<void> {
414
+ const lc = `${this.lc}[${this.deleteLocalUserSpace.name}]`;
415
+ try {
416
+ if (logalot) { console.log(`${lc} starting... spaceId: ${spaceId} (I: c81a5120a14941a590b512a8e0915623)`); }
417
+ if (!spaceId) { throw new Error(`spaceId required. (E: f3a210410a124b819e917f9db0972b23)`); }
418
+
419
+ // 1. Get space instance to evict from cache
420
+ const space = await this.getLocalUserSpace({ localSpaceId: spaceId });
421
+ if (space) {
422
+ const spaceAddr = getIbGibAddr({ ibGib: space });
423
+ NAIVE_SPACE_CACHE.delete(spaceAddr);
424
+ }
425
+ STORES_CONFIRMED.delete(spaceId);
426
+
427
+ // 2. Deregister space from bootstrap^gib and delete space record from zeroSpace via super
428
+ await super.deleteLocalUserSpace({ spaceId, deletePhysicalStorage });
429
+
430
+ // 3. Delete physical IndexedDB storage if requested
431
+ if (deletePhysicalStorage) {
432
+ const dbName = getGlobalDbName();
433
+ if (logalot) { console.log(`${lc} purging IndexedDB store/subpath for spaceId (${spaceId}) in db (${dbName})... (I: d9410a5170d14b4fb2478d102e3b2e23)`); }
434
+ await storageRmRF({
435
+ dbName,
436
+ storeName: spaceId,
437
+ pathToRm: '/',
438
+ });
439
+ }
440
+
441
+ if (logalot) { console.log(`${lc} complete.`); }
442
+ } catch (error) {
443
+ console.error(`${lc} ${extractErrorMsg(error)}`);
444
+ throw error;
445
+ }
446
+ }
447
+
407
448
  }
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: ibgib-dependency-graph
3
+ description: Detailed guide and patterns for using getDependencyGraph from core-gib to extract dependency graphs, live timelines, and graph nodes across spaces
4
+ ---
5
+
6
+ # IbGib Dependency Graph Skill Guide
7
+
8
+ This skill provides patterns, architecture guidelines, and multi-file operational code samples for extracting and traversing dependency graphs in the `ibgib` codebase using `getDependencyGraph` and related functions in `@ibgib/core-gib`.
9
+
10
+ ---
11
+
12
+ ## 1. Overview & Core Architecture
13
+
14
+ In the `ibgib` content-addressable DAG system, an `ibgib` references other `ibgibs` through relationship links (`rel8ns`), timelines (`tjp` / time-jump-point), and past history (`past`/`ancestor`).
15
+
16
+ The authoritative implementation of graph extraction resides in:
17
+ ๐Ÿ“ `libs/core-gib/src/common/other/graph-helper.mts`
18
+
19
+ Primary exports:
20
+ ```typescript
21
+ import {
22
+ getDependencyGraph,
23
+ getDeltaDependencyGraph,
24
+ toFlatGraph,
25
+ graphsAreEquivalent,
26
+ GetDependencyGraphOptions,
27
+ GetGraphResult,
28
+ } from '@ibgib/core-gib/dist/common/other/graph-helper.mjs';
29
+ ```
30
+
31
+ ### Return Type: `FlatIbGibGraph`
32
+ All graph extraction functions return a flat map (`FlatIbGibGraph` / `GetGraphResult`) structured as:
33
+ ```typescript
34
+ export type FlatIbGibGraph = { [addr: IbGibAddr]: IbGib_V1 };
35
+ ```
36
+ - **Keys**: `IbGibAddr` string (computed via `getIbGibAddr({ ibGib })`).
37
+ - **Values**: Complete `IbGib_V1` data structure.
38
+ - **Primitives**: Primitive ibgibs (e.g. `gib === GIB` or primitive ibs) are automatically filtered out and excluded from the graph.
39
+
40
+ ---
41
+
42
+ ## 2. Function Signatures & Options
43
+
44
+ ```typescript
45
+ export interface GetGraphOptions {
46
+ /** Single source ibGib object */
47
+ ibGib?: IbGib_V1;
48
+ /** Multiple source ibGib objects */
49
+ ibGibs?: IbGib_V1[];
50
+ /** Single source ibGib address string */
51
+ ibGibAddr?: IbGibAddr;
52
+ /** Multiple source ibGib address strings */
53
+ ibGibAddrs?: IbGibAddr[];
54
+
55
+ /** Space within which to resolve & fetch missing ibgibs. */
56
+ space: IbGibSpaceAny | null;
57
+
58
+ /**
59
+ * If true, queries space for latest timeline tips and includes newly added rel8d nodes.
60
+ * If false, performs backward-only DAG traversal through past rel8ns.
61
+ */
62
+ live?: boolean;
63
+
64
+ /** List of ibGib addresses to skip fetching. */
65
+ skipAddrs?: IbGibAddr[];
66
+
67
+ /** Blacklist of relationship names to skip during traversal (e.g. ['dna']). */
68
+ skipRel8nNames?: string[];
69
+
70
+ /** Whitelist of relationship names to traverse (e.g. ['comment', 'pic']). */
71
+ onlyRel8nNames?: string[];
72
+
73
+ /** Maximum retries when getting addresses from space if not immediately found. */
74
+ maxRetries?: number;
75
+
76
+ /** Delay in milliseconds between space fetch retries. */
77
+ msBetweenRetries?: number;
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ ## 3. Real Code Patterns Sampled Across `libs/core-gib/src/sync/`
84
+
85
+ Below are real usage patterns extracted across 15 distinct files in `libs/core-gib/src/sync/`:
86
+
87
+ ### Pattern 1: Single `ibGib` Object + Dedicated Space
88
+ *Sampled from:* `sync-saga-coordinator.mts` (Line 1984), `sync-innerspace-deep-updates.respec.mts` (Line 116), `sync-withid.pingpong.respec.mts` (Line 170)
89
+
90
+ ```typescript
91
+ // Fetch full graph for a single starting node within a space
92
+ const depGraph = await getDependencyGraph({
93
+ ibGib: rootItemIbGib,
94
+ space: sourceSpace,
95
+ });
96
+ // Result: depGraph contains { [addr]: ibGib } for rootItemIbGib and all its child dependencies
97
+ ```
98
+
99
+ ---
100
+
101
+ ### Pattern 2: Array of `ibGibs` Objects
102
+ *Sampled from:* `sync-innerspace-dest-ahead.respec.mts` (Line 99), `sync-innerspace-dest-ahead.withid.respec.mts` (Line 127)
103
+
104
+ ```typescript
105
+ // Fetch graph for multiple starting objects in a single pass
106
+ const initialDepGraph = await getDependencyGraph({
107
+ ibGibs: [version0IbGib, version1IbGib],
108
+ space: sourceSpace,
109
+ });
110
+ ```
111
+
112
+ ---
113
+
114
+ ### Pattern 3: Single `ibGibAddr` String
115
+ *Sampled from:* `sync-innerspace-dest-ahead.withid.respec.mts` (Line 207 & 208)
116
+
117
+ ```typescript
118
+ // Fetch graph starting from a known address string (automatically fetched from space)
119
+ const sourceV2Graph = await getDependencyGraph({
120
+ ibGibAddr: r1_alpha_v2_dest_newer_addr,
121
+ space: sourceSpace,
122
+ });
123
+
124
+ const destV2Graph = await getDependencyGraph({
125
+ ibGibAddr: r1_alpha_v2_dest_newer_addr,
126
+ space: destSpace,
127
+ });
128
+ ```
129
+
130
+ ---
131
+
132
+ ### Pattern 4: Multiple `ibGibAddrs` Strings in `sync-saga-coordinator`
133
+ *Sampled from:* `sync-saga-coordinator.mts` (Line 864 & Line 1717)
134
+
135
+ ```typescript
136
+ // Used during SyncSaga domain analysis to fetch transitive closures for multiple target addresses
137
+ const fullGraph = await getDependencyGraph({
138
+ ibGibAddrs: targetDomainAddrs,
139
+ space: localSpace,
140
+ live: false,
141
+ });
142
+ ```
143
+
144
+ ---
145
+
146
+ ### Pattern 5: Live Timeline Query (`live: true` vs `live: false`)
147
+ *Sampled from:* `sync-conflict-text-merge.respec.mts` (Lines 194, 199, 343, 348), `sync-saga-coordinator.mts` (Line 2706)
148
+
149
+ ```typescript
150
+ // live: true queries the space's metastones for the latest timeline tips
151
+ const liveSourceGraph = await getDependencyGraph({
152
+ ibGib: rootFolderItem,
153
+ space: sourceSpace,
154
+ live: true,
155
+ });
156
+
157
+ // live: false performs historical DAG walk backwards only (no space metastone queries)
158
+ const historicalGraph = await getDependencyGraph({
159
+ ibGib: rootFolderItem,
160
+ space: sourceSpace,
161
+ live: false,
162
+ });
163
+ ```
164
+
165
+ ---
166
+
167
+ ### Pattern 6: Comparing Two Graphs (`graphsAreEquivalent`)
168
+ *Sampled from:* `sync-conflict-text-merge.respec.mts`, `sync-innerspace-deep-updates.withid.respec.mts`
169
+
170
+ ```typescript
171
+ import { graphsAreEquivalent } from '@ibgib/core-gib/dist/common/other/graph-helper.mjs';
172
+
173
+ const graphsMatch = graphsAreEquivalent({
174
+ graphA: sourceDepGraph,
175
+ graphB: destDepGraph,
176
+ });
177
+
178
+ if (graphsMatch) {
179
+ console.log('Both spaces contain identical dependency graphs.');
180
+ }
181
+ ```
182
+
183
+ ---
184
+
185
+ ### Pattern 7: Computing Delta Graphs (`getDeltaDependencyGraph`)
186
+ *Sampled from:* `sync-saga-coordinator.mts` (Line 2706), `graph-helper.mts`
187
+
188
+ ```typescript
189
+ import { getDeltaDependencyGraph } from '@ibgib/core-gib/dist/common/other/graph-helper.mjs';
190
+
191
+ // Finds nodes present in sourceGraph that are NOT present in destGraph
192
+ const deltaGraph = await getDeltaDependencyGraph({
193
+ sourceGraph: sourceBranchDepGraph,
194
+ destGraph: targetBranchDepGraph,
195
+ });
196
+ // deltaGraph contains only the new/differing ibGib nodes
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 4. Key Operational Nuances & Edge Cases
202
+
203
+ 1. **Space Resolution & Fallback**:
204
+ - `space` is required to resolve missing `ibGib` addresses. If an address in `rel8ns` is not already in memory (`ibGibs` or `gotten`), `getDependencyGraph` calls `space.get({ arg: addr })`.
205
+ 2. **Primitive IbGib Auto-Filtering**:
206
+ - Primitive ibgibs (where `gib === GIB` or primitive ibs) are automatically ignored and NOT included in `FlatIbGibGraph`.
207
+ 3. **Timeline Frames vs. Historical Walk**:
208
+ - When branching to a new branch sub-space (`b2s_<newBranch>`), `getDependencyGraph` extracts the flat graph map of all folder, file, and binary nodes.
209
+ - To register timelines in the new branch space: iterate through the graph values, sort by timeline history (`past` / `ancestor`), and call `registerNewIbGib` (or `putInSpace` + `persistTransformResult`) in order so indexing metastones track timeline tips cleanly.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: ibgib-implementation-plan
3
+ description: Guidelines and template for structuring, creating, and updating persistent [what]_IMPLEMENTATION.md files in the ibgib codebase.
4
+ ---
5
+
6
+ # ibgib Implementation Plan (`[what]_IMPLEMENTATION.md`)
7
+
8
+ This skill defines the structure, conventions, and workflow for creating and maintaining persistent `[what]_IMPLEMENTATION.md` files across the `ibgib` monorepo.
9
+
10
+ ## Purpose
11
+
12
+ In complex `ibgib` architectural initiatives, single-session AI artifacts (like transient implementation plans or scratch notes) can be lost across chat sessions. A `[what]_IMPLEMENTATION.md` file serves as a **living, persistent design document, execution tracker, and technical decision log** for a specific sub-project or feature milestone (e.g. `VCS_PLANNING_IMPLEMENTATION.md`, `SSO_IMPLEMENTATION.md`, `TS7_IMPLEMENTATION.md`).
13
+
14
+ ## Standard File Location
15
+
16
+ Implementation plan files should be placed either in:
17
+ * `docs/[what]_IMPLEMENTATION.md` (for monorepo-wide or domain initiatives, e.g. `docs/vcs/VCS_PLANNING_IMPLEMENTATION.md` or `docs/VCS_IMPLEMENTATION.md`)
18
+ * `docs/[feature]/[what]_IMPLEMENTATION.md` (for targeted domain areas, e.g. `docs/identity/SSO_IMPLEMENTATION.md`)
19
+
20
+ ---
21
+
22
+ ## Standard Structural Schema
23
+
24
+ Every `[what]_IMPLEMENTATION.md` file MUST follow this high-level structure, adapting or adding sub-sections as relevant:
25
+
26
+ ```markdown
27
+ # [Feature / Subsystem Name] Implementation Plan ([WHAT_CODE_NAME])
28
+
29
+ ## ๐Ÿ“Œ Executive Summary & Architectural Model
30
+
31
+ * **Goal & Overview**: Concise summary of what this implementation achieves.
32
+ * **Architectural Principles**: Core domain models, DAG dynamics, trade-offs, security model, and identity integration.
33
+ * **Schemas & Naming Conventions**: Strict naming formats (e.g., kebab-case delimiters, flatcase inner tokens, pool IDs, rel8n labels).
34
+
35
+ ---
36
+
37
+ ## ๐Ÿ› ๏ธ Build Chain & Environment Setup
38
+
39
+ * **Workspace Build Chain**: Required build commands and dependency propagation steps (e.g., `npm run build:core-gib` vs `npm run chain:build:web-gib`).
40
+ * **Environment Configuration**: Required `.env` variables, port settings, or hardware/OS constraints.
41
+
42
+ ---
43
+
44
+ ## โฑ๏ธ Baseline & Decision Log / Journal
45
+
46
+ ### Baseline Metrics (if performance/refactoring focused)
47
+ * Table of initial timings, size measurements, or code line counts.
48
+
49
+ ### Architectural Decision Log (Journal Entries)
50
+ * **Entry N ([Date])**: Context, root cause analysis, evaluation of alternatives, and finalized resolution.
51
+
52
+ ---
53
+
54
+ ## ๐Ÿ“‹ Step-by-Step Implementation Checklist
55
+
56
+ Break the work into small, incremental, independently verifiable steps:
57
+
58
+ ### Step 1: [Component / Sub-system Name]
59
+ - [ ] **1.1 [Sub-task Title]**: Description of changes.
60
+ - Linked files: [`basename.mts`](file:///absolute/path/to/file.mts#L10-L30)
61
+ - [ ] **1.2 [Sub-task Title]**: Description of changes.
62
+
63
+ ### Step 2: [Next Phase / Integration]
64
+ - [ ] **2.1 [Sub-task Title]**: Description of changes.
65
+
66
+ ---
67
+
68
+ ## ๐Ÿงช Testing & Verification Strategy
69
+
70
+ * **Unit & Integration Tests**: `respec-gib` test commands (`npm run test:core-gib`) and specific `ifWeMight` focus instructions.
71
+ * **Manual & E2E Checks**: Step-by-step verification steps in browser or CLI environment.
72
+
73
+ ---
74
+
75
+ ## ๐Ÿ”Œ Upstream Upgrades & Lower-Lib PR Requests (Optional)
76
+
77
+ _note: these are not PRs proper, because we're not using git. This is just to convey what to do if/when an agent wants to modify a lower lib, which they absolutely should NOT do. If this workaround doesn't work, the agent should stop and explain the blocker, just like any developer working on a complex task._
78
+
79
+ * **Application-Level Shims**: List of local shims created in `src/shims/[lib_name]/...` to avoid unvetted modifications to lower-level libraries (anything found in `/libs`, e.g., `libs/helper-gib`, `libs/ts-gib`, etc.).
80
+ * **Proposed Upstream Upgrades**: Descriptions of missing lower-level features or helpers identified during implementation that should be refactored upstream in future iterations.
81
+
82
+ ---
83
+
84
+ ## ๐Ÿ’ก Addendum & Backlog
85
+
86
+ * **Deferred Scope**: Features explicitly postponed to future iterations.
87
+ * **Technical Debt / Security Alerts**: Notes on future refactoring or alert mechanisms needed.
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Best Practices & Guidelines
93
+
94
+ 1. **Explicit File Links**: Always use clickable file links using absolute file paths (e.g. `[filename.mts](file:///path/to/file.mts)` or `[filename.mts#L10-L20](file:///path/to/file.mts#L10-L20)`).
95
+ 2. **Incremental Updates**: Update task checkboxes (`- [ ]` $\to$ `- [x]`) and add journal entries in real-time as tasks progress.
96
+ 3. **Strict Casing & Naming**: Maintain consistency with `ibgib` conventions (flatcase inner tokens, kebab-case component IDs, explicit transform names like `fork`, `mut8`, `rel8`).
97
+ 4. **Preserve Context**: When starting a new conversation prompt for a sub-task, reference the corresponding `[what]_IMPLEMENTATION.md` file so any agent can instantly regain full architectural context.
98
+ 5. **Positive Lower-Lib Shim Workflow**:
99
+ * Direct modifications to foundational libraries (`libs/ts-gib`, `libs/core-gib`, `libs/encrypt-gib`, `libs/helper-gib`) should be avoided during application-level feature development unless explicitly authorized.
100
+ * When an agent encounters a limitation or missing helper in a lower-level library, the recommended workflow is to **create a local application shim** inside the application's source directory (e.g., `src/shims/core-gib/space/custom-space-helper.mts` or `src/shims/ts-gib/transforms/custom-transform-shim.mts`).
101
+ * If necessary, WET copy and adapt the required helper logic locally.
102
+ * Document all shims under the **"Upstream Upgrades & Lower-Lib PR Requests"** section in the active `[what]_IMPLEMENTATION.md` file for future upstream monorepo integration.