@ibgib/web-gib 0.0.36 → 0.0.43

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 (46) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +116 -0
  3. package/dist/AUTO-GENERATED-version.d.mts +1 -1
  4. package/dist/AUTO-GENERATED-version.mjs +1 -1
  5. package/dist/api/commands/ui/ui-index.mjs +2 -2
  6. package/dist/api/commands/ui/ui-index.mjs.map +1 -1
  7. package/dist/api/commands/ui/update-css-variables.d.mts +13 -1
  8. package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -1
  9. package/dist/api/commands/ui/update-css-variables.mjs +46 -36
  10. package/dist/api/commands/ui/update-css-variables.mjs.map +1 -1
  11. package/dist/app-bootstrap/types.d.mts +20 -0
  12. package/dist/app-bootstrap/types.d.mts.map +1 -1
  13. package/dist/identity/identity-constants.d.mts +72 -0
  14. package/dist/identity/identity-constants.d.mts.map +1 -0
  15. package/dist/identity/identity-constants.mjs +94 -0
  16. package/dist/identity/identity-constants.mjs.map +1 -0
  17. package/dist/identity/identity-types.d.mts +214 -0
  18. package/dist/identity/identity-types.d.mts.map +1 -0
  19. package/dist/identity/identity-types.mjs +17 -0
  20. package/dist/identity/identity-types.mjs.map +1 -0
  21. package/dist/ui/ui-helpers.d.mts +31 -0
  22. package/dist/ui/ui-helpers.d.mts.map +1 -1
  23. package/dist/ui/ui-helpers.mjs +50 -1
  24. package/dist/ui/ui-helpers.mjs.map +1 -1
  25. package/package.json +5 -26
  26. package/src/AUTO-GENERATED-version.mts +1 -1
  27. package/src/api/commands/ui/ui-index.mts +2 -2
  28. package/src/api/commands/ui/update-css-variables.mts +53 -35
  29. package/src/app-bootstrap/types.mts +25 -0
  30. package/src/identity/identity-constants.mts +107 -0
  31. package/src/identity/identity-types.mts +250 -0
  32. package/src/ui/ui-helpers.mts +57 -1
  33. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/SKILL.md +11 -10
  34. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/constants.mts.template +1 -1
  35. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/helpers.web.mts.template +3 -3
  36. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/index.html.template +1 -0
  37. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/index.mts.template +1 -1
  38. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/script.mts.template +17 -0
  39. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/types.mts.template +1 -115
  40. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/app-v1.mts.template +1 -1
  41. package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/helper.mts.template +1 -1
  42. package/tools/auto-generated-agent-skills/skills/ibgib-create-shell/SKILL.md +8 -2
  43. package/.vscode/ibgib-snippets.code-snippets +0 -309
  44. package/.vscode/launch.json +0 -25
  45. package/.vscode/settings.json +0 -68
  46. package/.vscode/tasks.json +0 -38
@@ -0,0 +1,214 @@
1
+ /**
2
+ * @file identity-types.mts
3
+ * @description Type definitions for the four-tier ibgib identity hierarchy.
4
+ *
5
+ * ## Tier Overview
6
+ * ```
7
+ * META keystone → universal identity handle (cross-app, cross-device)
8
+ * └─ LOCAL keystone → device/browser-profile-scoped identity
9
+ * └─ APP-LOCAL keystone → app-scoped identity (one per app per browser profile)
10
+ * └─ SESSION keystone → session-scoped (existing sync protocol)
11
+ * ```
12
+ *
13
+ * @see docs/identity/PARADIGM.md
14
+ * @see docs/identity/KEYSTONES.md
15
+ */
16
+ import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
17
+ import { KeystoneData_V1, KeystoneIbGib_V1 } from "@ibgib/core-gib/dist/keystone/keystone-types.mjs";
18
+ /**
19
+ * Data shape for the META keystone tier.
20
+ *
21
+ * The META keystone is the user's universal identity — stable across all apps,
22
+ * devices, and time. Its `tjpGib` is the user's permanent identity handle.
23
+ *
24
+ * @see docs/identity/KEYSTONES.md#meta-keystone
25
+ * @see docs/identity/PARADIGM.md#meta-keystone
26
+ */
27
+ export interface MetaKeystoneData extends KeystoneData_V1 {
28
+ /**
29
+ * List of LOCAL keystone `tjpGib` values currently trusted by this identity.
30
+ *
31
+ * This is the **trust register** — an app verifies a user by finding the
32
+ * LOCAL keystone's tjpGib in this list from the current META frame.
33
+ *
34
+ * Mutated by: add-device evolution (append), remove-device evolution (remove).
35
+ *
36
+ * @see docs/identity/PARADIGM.md#cross-app-identity
37
+ */
38
+ trustedLocalTjpGibs: IbGibAddr[];
39
+ /**
40
+ * For custodial keystones: the publicly-visible nonce used by the custodian
41
+ * to re-derive `MasterSecret_user = KDF(server_secret, custodialNonce)`.
42
+ *
43
+ * No secrecy requirement — security comes from `server_secret` alone.
44
+ * Stored here so the custodian needs no separate mapping table.
45
+ *
46
+ * Undefined for sovereign (user-held) keystones.
47
+ *
48
+ * @see docs/identity/PARADIGM.md#custodianship--the-oauth2-path
49
+ * @see docs/identity/FLOWS.md#flow-2-first-login--custodial-path-oauth2
50
+ */
51
+ custodialNonce?: string;
52
+ }
53
+ /**
54
+ * Data shape for the LOCAL keystone tier.
55
+ *
56
+ * Device/browser-profile-scoped identity. Evolves offline. Lives in IndexedDB.
57
+ * One per browser profile per user.
58
+ *
59
+ * @see docs/identity/KEYSTONES.md#local-keystone
60
+ */
61
+ export interface LocalKeystoneData extends KeystoneData_V1 {
62
+ /**
63
+ * Map of registered APP-LOCAL keystones on this browser profile.
64
+ *
65
+ * Key: `appId`
66
+ * Value: the **first epoch** APP-LOCAL keystone `tjpGib` for that app.
67
+ *
68
+ * Subsequent epochs are authenticated transitively through the APP-LOCAL
69
+ * epoch chain — the LOCAL keystone does NOT need to evolve for epoch rotation.
70
+ *
71
+ * Mutated by: add-app evolution (set), remove-app evolution (delete).
72
+ *
73
+ * @see docs/identity/PARADIGM.md#epoch-rotation-handling-keystone-growth
74
+ */
75
+ registeredAppLocals: Record<string, IbGibAddr>;
76
+ }
77
+ /**
78
+ * Data shape for the APP-LOCAL keystone tier.
79
+ *
80
+ * App-scoped identity for a specific browser profile + app combination.
81
+ * Evolves offline. Lives in IndexedDB (client) and app server (synced).
82
+ * One per app per browser profile per user.
83
+ *
84
+ * @see docs/identity/KEYSTONES.md#app-local-keystone
85
+ */
86
+ export interface AppLocalKeystoneData extends KeystoneData_V1 {
87
+ /** The app identifier this APP-LOCAL belongs to. */
88
+ appId: string;
89
+ /**
90
+ * The LOCAL keystone `tjpGib` this APP-LOCAL is derived from.
91
+ * Used by verifiers to link APP-LOCAL trust back to LOCAL → META.
92
+ */
93
+ localTjpGib: IbGibAddr;
94
+ /**
95
+ * The META keystone `tjpGib` for this identity.
96
+ * Stored for reference/display. The authoritative trust chain is
97
+ * always verified by replaying META → LOCAL → APP-LOCAL.
98
+ */
99
+ metaTjpGib: IbGibAddr;
100
+ /**
101
+ * For epoch-chained APP-LOCAL keystones: the ibgib address of the
102
+ * **final frame** of the previous epoch. Establishes the transitive
103
+ * trust chain from the first epoch.
104
+ *
105
+ * Undefined for the first epoch (no prior epoch).
106
+ *
107
+ * @see docs/identity/PARADIGM.md#epoch-rotation-handling-keystone-growth
108
+ */
109
+ prevEpochFinalFrameAddr?: IbGibAddr;
110
+ }
111
+ /**
112
+ * The browser-local identity context for a user on this browser profile.
113
+ * Stored in IndexedDB. Reconstructed from keystone chains if lost.
114
+ *
115
+ * @see docs/identity/FLOWS.md#flow-3-return-login--same-browser-profile
116
+ * @see docs/identity/PARTIES.md#party-app-client
117
+ */
118
+ export interface LocalIdentityContext {
119
+ /** The user's universal identity handle. Used for cross-app identity. */
120
+ metaTjpGib: IbGibAddr;
121
+ /** URL of the identity service hosting the user's META keystone. */
122
+ identityServiceUrl: string;
123
+ /** This browser profile's LOCAL keystone `tjpGib`. */
124
+ localTjpGib: IbGibAddr;
125
+ }
126
+ /**
127
+ * Per-app identity context for a specific browser profile + app.
128
+ * Stored in IndexedDB by the app client.
129
+ *
130
+ * @see docs/identity/KEYSTONES.md#app-local-keystone
131
+ */
132
+ export interface AppLocalIdentityContext {
133
+ /** The user's universal identity handle. */
134
+ metaTjpGib: IbGibAddr;
135
+ /** This browser profile's LOCAL keystone `tjpGib`. */
136
+ localTjpGib: IbGibAddr;
137
+ /**
138
+ * The **current** (possibly epoch-N) APP-LOCAL keystone `tjpGib`.
139
+ * Updated in-place after each epoch rotation.
140
+ */
141
+ appLocalTjpGib: IbGibAddr;
142
+ /** The app identifier. */
143
+ appId: string;
144
+ }
145
+ /**
146
+ * The shared identity space — a write-verifying history store.
147
+ *
148
+ * NOT an authority. Verifies chain continuity on writes. Serves raw chain
149
+ * data on reads. Any party can independently verify the chain it returns.
150
+ *
151
+ * Initial deployment: hosted on the app's server. Federated by design.
152
+ *
153
+ * @see docs/identity/PARADIGM.md#the-shared-identity-space
154
+ * @see docs/identity/PARTIES.md#party-identity-service
155
+ */
156
+ export interface IIdentityService {
157
+ /**
158
+ * POST a genesis frame — accepted unconditionally if internally valid.
159
+ * Genesis is self-legitimizing: Alice's identity IS her genesis frame.
160
+ *
161
+ * @returns the `tjpGib` (ibgib address of the genesis frame)
162
+ * @throws if the frame is internally invalid (malformed structure)
163
+ */
164
+ postGenesis(frame: KeystoneIbGib_V1): Promise<{
165
+ tjpGib: IbGibAddr;
166
+ }>;
167
+ /**
168
+ * POST an evolution frame.
169
+ * Verifies chain continuity: revealed solutions must hash-match prior
170
+ * frame's commitments. Implements CAS: rejects if prior frame is stale.
171
+ *
172
+ * @throws `IdentityServiceStaleTipError` if prior frame is no longer tip
173
+ * @throws `IdentityServiceChainError` if hash pre-images are invalid
174
+ */
175
+ postEvolution(frame: KeystoneIbGib_V1): Promise<void>;
176
+ /**
177
+ * GET the full keystone chain from genesis to current tip.
178
+ *
179
+ * Does NOT change state. Safe to call without coordination.
180
+ */
181
+ getChain(tjpGib: IbGibAddr): Promise<KeystoneIbGib_V1[]>;
182
+ /**
183
+ * GET the current tip frame for a keystone.
184
+ *
185
+ * Does NOT change state.
186
+ */
187
+ getTip(tjpGib: IbGibAddr): Promise<KeystoneIbGib_V1>;
188
+ }
189
+ /**
190
+ * Inputs for deriving a tier-specific MasterSecret from a root passphrase.
191
+ *
192
+ * Each tier uses a different salt to ensure independent MasterSecrets
193
+ * even when the same passphrase is used for all tiers.
194
+ *
195
+ * @see docs/identity/KEYSTONES.md for per-tier salt conventions
196
+ * @see identity-helpers.mts for derivation functions
197
+ */
198
+ export interface MasterSecretDerivationContext {
199
+ /** The root passphrase (sovereign path) or server secret (custodial path). */
200
+ passphrase: string;
201
+ /**
202
+ * Tier-specific salt (e.g., `IDENTITY_KDF_SALT_META`, `IDENTITY_KDF_SALT_LOCAL`).
203
+ * @see identity-constants.mts
204
+ */
205
+ salt: string;
206
+ /**
207
+ * Additional device-specific entropy for LOCAL and APP-LOCAL tiers.
208
+ * Generated once per browser profile and stored in IndexedDB.
209
+ */
210
+ deviceSalt?: string;
211
+ /** For APP-LOCAL tier: the app identifier, mixed into derivation. */
212
+ appId?: string;
213
+ }
214
+ //# sourceMappingURL=identity-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-types.d.mts","sourceRoot":"","sources":["../../src/identity/identity-types.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAMrG;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD;;;;;;;;;OASG;IACH,mBAAmB,EAAE,SAAS,EAAE,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACtD;;;;;;;;;;;;OAYG;IACH,mBAAmB,EAAE,MAAM,CAAC,MAAM,EA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U,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file identity-types.mts
3
+ * @description Type definitions for the four-tier ibgib identity hierarchy.
4
+ *
5
+ * ## Tier Overview
6
+ * ```
7
+ * META keystone → universal identity handle (cross-app, cross-device)
8
+ * └─ LOCAL keystone → device/browser-profile-scoped identity
9
+ * └─ APP-LOCAL keystone → app-scoped identity (one per app per browser profile)
10
+ * └─ SESSION keystone → session-scoped (existing sync protocol)
11
+ * ```
12
+ *
13
+ * @see docs/identity/PARADIGM.md
14
+ * @see docs/identity/KEYSTONES.md
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=identity-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-types.mjs","sourceRoot":"","sources":["../../src/identity/identity-types.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -34,9 +34,40 @@ export declare function showFullscreenDialog(opts: {
34
34
  cancelButtonTitle?: string;
35
35
  isPassword?: boolean;
36
36
  }): Promise<string | undefined>;
37
+ /**
38
+ * Gets {@link UIThemeInfo} if it exists in the db ({@link dbName}) and store
39
+ * ({@link storeName}) at the given {@link key}.
40
+ *
41
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
42
+ *
43
+ * @see {@link putUIInfoInStore}
44
+ * @see {@link UI_THEME_INFO_KEY}
45
+ * @see {@link putUIInfoInStore}
46
+ * @see {@link getGlobalDbName}
47
+ * @see {@link getGlobalStoreName}
48
+ */
37
49
  export declare function getExistingUIInfo({ dbName, storeName, key, }: {
38
50
  dbName: string;
39
51
  storeName: string;
40
52
  key?: string;
41
53
  }): Promise<UIThemeInfo | undefined>;
54
+ /**
55
+ * Complementing {@link getExistingUIInfo}, this puts {@link newUIInfo} in the
56
+ * db ({@link dbName}) and into the store ({@link storeName}) at the given
57
+ * {@link key}.
58
+ *
59
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
60
+ *
61
+ * @see {@link getExistingUIInfo}
62
+ * @see {@link UI_THEME_INFO_KEY}
63
+ * @see {@link putUIInfoInStore}
64
+ * @see {@link getGlobalDbName}
65
+ * @see {@link getGlobalStoreName}
66
+ */
67
+ export declare function putUIInfoInStore({ dbName, storeName, key, newUIInfo, }: {
68
+ dbName: string;
69
+ storeName: string;
70
+ key?: string;
71
+ newUIInfo: UIThemeInfo;
72
+ }): Promise<void>;
42
73
  //# sourceMappingURL=ui-helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-helpers.d.mts","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2I9B;AAED,wBAAsB,iBAAiB,CAAC,EACpC,MAAM,EACN,SAAS,EACT,GAAuB,GAC1B,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA6BnC"}
1
+ {"version":3,"file":"ui-helpers.d.mts","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2I9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,EACpC,MAAM,EACN,SAAS,EACT,GAAuB,GAC1B,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA6BnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACnC,MAAM,EACN,SAAS,EACT,GAAuB,EACvB,SAAS,GACZ,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB"}
@@ -1,6 +1,6 @@
1
1
  import { delay, extractErrorMsg, } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
2
  import { GLOBAL_LOG_A_LOT } from "../constants.mjs";
3
- import { storageGet } from "../storage/storage-helpers.web.mjs";
3
+ import { storageGet, storagePut } from "../storage/storage-helpers.web.mjs";
4
4
  import { UI_THEME_INFO_KEY } from "./ui-constants.mjs";
5
5
  const logalot = GLOBAL_LOG_A_LOT;
6
6
  /**
@@ -159,6 +159,18 @@ export async function showFullscreenDialog(opts) {
159
159
  }
160
160
  }
161
161
  }
162
+ /**
163
+ * Gets {@link UIThemeInfo} if it exists in the db ({@link dbName}) and store
164
+ * ({@link storeName}) at the given {@link key}.
165
+ *
166
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
167
+ *
168
+ * @see {@link putUIInfoInStore}
169
+ * @see {@link UI_THEME_INFO_KEY}
170
+ * @see {@link putUIInfoInStore}
171
+ * @see {@link getGlobalDbName}
172
+ * @see {@link getGlobalStoreName}
173
+ */
162
174
  export async function getExistingUIInfo({ dbName, storeName, key = UI_THEME_INFO_KEY, }) {
163
175
  const lc = `[${getExistingUIInfo.name}]`;
164
176
  try {
@@ -195,4 +207,41 @@ export async function getExistingUIInfo({ dbName, storeName, key = UI_THEME_INFO
195
207
  }
196
208
  }
197
209
  }
210
+ /**
211
+ * Complementing {@link getExistingUIInfo}, this puts {@link newUIInfo} in the
212
+ * db ({@link dbName}) and into the store ({@link storeName}) at the given
213
+ * {@link key}.
214
+ *
215
+ * Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
216
+ *
217
+ * @see {@link getExistingUIInfo}
218
+ * @see {@link UI_THEME_INFO_KEY}
219
+ * @see {@link putUIInfoInStore}
220
+ * @see {@link getGlobalDbName}
221
+ * @see {@link getGlobalStoreName}
222
+ */
223
+ export async function putUIInfoInStore({ dbName, storeName, key = UI_THEME_INFO_KEY, newUIInfo, }) {
224
+ const lc = `[${putUIInfoInStore.name}]`;
225
+ try {
226
+ if (logalot) {
227
+ console.log(`${lc} starting... (I: 79c9ee707e426fd8c861c4ff4cf16826)`);
228
+ }
229
+ await storagePut({
230
+ dbName,
231
+ storeName,
232
+ key,
233
+ value: JSON.stringify(newUIInfo),
234
+ });
235
+ }
236
+ catch (error) {
237
+ console.error(`${lc} ${extractErrorMsg(error)}`);
238
+ throw error;
239
+ }
240
+ finally {
241
+ if (logalot) {
242
+ console.log(`${lc} complete.`);
243
+ }
244
+ }
245
+ }
246
+ ;
198
247
  //# sourceMappingURL=ui-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-helpers.mjs","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,iDAAiD,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAyB1C;IACG,MAAM,EAAE,GAAG,IAAI,oBAAoB,CAAC,IAAI,GAAG,CAAC;IAC5C,IAAI,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,oDAAoD,CAAC,CAAC;QAAC,CAAC;QAExF,qFAAqF;QACrF,8FAA8F;QAC9F,2FAA2F;QAC3F,+FAA+F;QAC/F,sGAAsG;QACtG,iGAAiG;QACjG,yGAAyG;QAEzG,MAAM,MAAM,GAAG,QAAQ,CAAC,cAAc,CAAC,mBAAmB,CAAsB,CAAC;QACjF,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,wBAAwB,CAAsB,CAAC;QAC1F,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAgB,CAAC;QACvF,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,2BAA2B,CAAgB,CAAC;QAC3F,MAAM,WAAW,G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AG,iBAAiB,EACvB,SAAS,GAMZ;IACG,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,IAAI,GAAG,CAAC;IACxC,IAAI,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,oDAAoD,CAAC,CAAC;QAAC,CAAC;QAExF,MAAM,UAAU,CAAC;YACb,MAAM;YACN,SAAS;YACT,GAAG;YACH,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;SACnC,CAAC,CAAC;IAEP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAAC,CAAC;IACpD,CAAC;AACL,CAAC;AAAA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/web-gib",
3
- "version": "0.0.36",
3
+ "version": "0.0.43",
4
4
  "description": "Framework for creating agentic ibGib web apps. Contains plumbing for ibgib components, agentic framework (currently only Gemini implemented), web-based IndexedDB storage substrate, and more.",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -11,31 +11,10 @@
11
11
  "web-gib-init-agents": "./tools/init-agents.js"
12
12
  },
13
13
  "scripts": {
14
- "clean": "node ../../node_modules/@ibgib/helper-gib/tools/clean.js ./dist",
15
- "generate:src:version": "node ./tools/generate-version-file.js",
16
- "generate:agent:skills": "node ./tools/copy-agent-skills.js",
17
- "prebuild": "npm run generate:src:version && npm run generate:agent:skills",
18
- "build": "npm run clean && tsc -b tsconfig.json --force",
19
- "build:test": "npm run clean && tsc -b tsconfig.test.json --force",
20
- "build:test:noclean": "tsc -b tsconfig.test.json --force",
21
- "test": "npm run test:both",
22
- "test:both": "npm run build:test && npm run test:node:nobuild && npm run test:browser:nobuild",
23
- "man:test:both": "use this if you want to test in both node and browser contexts",
24
- "pretest:node": "npm run build:test",
25
- "test:node": "node dist/respec-gib.node.mjs --inspect",
26
- "man:test:node": "use this if you want to build+test in node",
27
- "test:node:nobuild": "node dist/respec-gib.node.mjs --inspect",
28
- "man:test:node:nobuild": "use this if you want to test in node but its already built",
29
- "test:browser": "npm run build:test && echo \"not implemented yet\"",
30
- "man:test:browser": "use this if you want to build+test only the browser context",
31
- "test:browser:nobuild": "echo \"not implemented yet\"",
32
- "man:test:browser:nobuild": "use this if you want to test only the browser context but its already built",
33
- "test:browser:serve": "npm run build:test && echo \"not implemented yet\"",
34
- "man:test:browser:serve": "use this if you want to build+test in the browser and don't want the browser to close when your done. (i.e. you're debugging)",
35
- "test:browser:serve:nobuild": "\"not implemented yet\"",
36
- "man:test:browser:serve:nobuild": "use this if you are troubleshooting existing dist output and don't want to overwrite those files. (and you're debugging in the browser)",
14
+ "//_orchestration": "~~ ORCHESTRATION (handled by @ibgib/build-gib) ~~",
15
+ "//_publish": "~~ PUBLISH ~~",
37
16
  "pack": "npm pack --pack-destination=\"./published\"",
38
- "prepare:publish": "npm run clean && npm version patch && npm run build && npm run pack",
17
+ "prepare:publish": "npm version patch && node ../../build/dist/concrete-build/build-web-gib.mjs --prod && npm run pack",
39
18
  "man:prepare:publish": "use this to patch > build > pack for publishing to npm repo"
40
19
  },
41
20
  "type": "module",
@@ -49,7 +28,7 @@
49
28
  "license": "ISC",
50
29
  "dependencies": {
51
30
  "@google/genai": "^1.33.0",
52
- "@ibgib/core-gib": "^0.1.54",
31
+ "@ibgib/core-gib": "^0.1.55",
53
32
  "@ibgib/encrypt-gib": "^0.2.37",
54
33
  "@ibgib/helper-gib": "^0.0.36",
55
34
  "@ibgib/ts-gib": "^0.5.32"
@@ -11,4 +11,4 @@
11
11
  /**
12
12
  * this is the version of this package, auto-updated in the build process
13
13
  */
14
- export const AUTO_GENERATED_VERSION = '0.0.36';
14
+ export const AUTO_GENERATED_VERSION = '0.0.43';
@@ -1,6 +1,6 @@
1
1
  import { APIFunctionInfo } from "../../api-types.mjs";
2
- import { updateCSSVariablesFunctionInfo } from './update-css-variables.mjs';
2
+ // import { updateCSSVariablesFunctionInfo } from './update-css-variables.mjs';
3
3
 
4
4
  export const UIAgentFunctionInfos: APIFunctionInfo<any>[] = [
5
- updateCSSVariablesFunctionInfo,
5
+ // updateCSSVariablesFunctionInfo,
6
6
  ];
@@ -9,7 +9,7 @@ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
9
9
  import { UI_THEME_INFO_KEY, VALID_CSS_VARIABLES } from "../../../ui/ui-constants.mjs";
10
10
  import { storagePut } from "../../../storage/storage-helpers.web.mjs";
11
11
  import { UIThemeInfo } from "../../../ui/ui-types.mjs";
12
- import { getExistingUIInfo } from "../../../ui/ui-helpers.mjs";
12
+ import { getExistingUIInfo, putUIInfoInStore } from "../../../ui/ui-helpers.mjs";
13
13
  import { getGlobalDbName, getGlobalStoreName } from "../../../helpers.web.mjs";
14
14
 
15
15
  const logalot = GLOBAL_LOG_A_LOT;
@@ -126,7 +126,7 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
126
126
 
127
127
  // update the theme in the options
128
128
  const dbName = getGlobalDbName();
129
- const storeName = await getGlobalStoreName();
129
+ const storeName = getGlobalStoreName();
130
130
  const existingUIInfo = await getExistingUIInfo({ dbName, storeName }) ?? { cssVariableOverrides: {}, };
131
131
  const newUIInfo: UIThemeInfo = {
132
132
  ...existingUIInfo,
@@ -136,11 +136,10 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
136
136
  },
137
137
  };
138
138
 
139
- await storagePut({
139
+ await putUIInfoInStore({
140
140
  dbName,
141
- storeName: await getGlobalStoreName(),
142
- key: UI_THEME_INFO_KEY,
143
- value: JSON.stringify(newUIInfo),
141
+ storeName,
142
+ newUIInfo,
144
143
  });
145
144
  } catch (error) {
146
145
  console.error(`${lc} ${extractErrorMsg(error)}`);
@@ -152,36 +151,55 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
152
151
 
153
152
 
154
153
  /**
155
- * API function info for the updateCSSVariables command.
154
+ * Factory function to get an API function info for the updateCSSVariables
155
+ * command. This enables an agent to update the {@link cssVariables} to create
156
+ * dynamic themes, which in turn enables users to use natural language to change
157
+ * the theme.
158
+ *
159
+ * initially this was just {@link VALID_CSS_VARIABLES}, but we have changed
160
+ * this to be a dynamic factory function driven by this {@link cssVariables}.
156
161
  */
157
- export const updateCSSVariablesFunctionInfo: APIFunctionInfo<typeof updateCSSVariablesViaCmd> = {
158
- nameOrId: FUNCTION_NAME,
159
- fnViaCmd: updateCSSVariablesViaCmd,
160
- functionImpl: updateCSSVariablesImpl,
161
- cmd: CMD_CATEGORY,
162
- cmdModifiers: CMD_MODIFIERS,
163
- schema: {
164
- name: FUNCTION_NAME,
165
- description: FUNCTION_DESCRIPTION,
166
- parameters: {
167
- type: 'object',
168
- properties: {
169
- ...COMMAND_BASE_SCHEMA_PROPERTIES,
170
- cssVariables: {
171
- type: 'object',
172
- description: 'CSS variables to update when theming or otherwise changing these visual aspects of the web app per user preferences or the user directly asking for it. (atow there are no preferences saved or anything, so this is just user-driven if they ask for it.)',
173
- properties: Object.fromEntries(
174
- VALID_CSS_VARIABLES.map(varName => [
175
- varName,
176
- {
177
- type: 'string',
178
- description: `configurable css variable`,
179
- },
180
- ])
181
- ),
182
- }
162
+ export function getFunctionInfo_updateCSSVariablesFunctionInfo({
163
+ cssVariables,
164
+ }: {
165
+ /**
166
+ * list of variables that the agent has access to change.
167
+ */
168
+ cssVariables: string[],
169
+ }): APIFunctionInfo<typeof updateCSSVariablesViaCmd> {
170
+ return {
171
+ nameOrId: FUNCTION_NAME,
172
+ fnViaCmd: updateCSSVariablesViaCmd,
173
+ functionImpl: updateCSSVariablesImpl,
174
+ cmd: CMD_CATEGORY,
175
+ cmdModifiers: CMD_MODIFIERS,
176
+ schema: {
177
+ name: FUNCTION_NAME,
178
+ description: FUNCTION_DESCRIPTION,
179
+ parameters: {
180
+ type: 'object',
181
+ properties: {
182
+ ...COMMAND_BASE_SCHEMA_PROPERTIES,
183
+ cssVariables: {
184
+ type: 'object',
185
+ description: 'CSS variables to update when theming or otherwise changing these visual aspects of the web app per user preferences or the user directly asking for it. (atow there are no preferences saved or anything, so this is just user-driven if they ask for it.)',
186
+ properties: Object.fromEntries(
187
+ cssVariables.map(varName => [
188
+ varName,
189
+ {
190
+ type: 'string',
191
+ description: `configurable css variable`,
192
+ },
193
+ ])
194
+ ),
195
+ }
196
+ },
197
+ required: ['cssVariables'],
183
198
  },
184
- required: ['cssVariables'],
185
199
  },
186
- },
200
+ };
187
201
  };
202
+
203
+ export const updateCSSVariablesFunctionInfo = getFunctionInfo_updateCSSVariablesFunctionInfo({
204
+ cssVariables: VALID_CSS_VARIABLES,
205
+ });
@@ -122,6 +122,26 @@ export interface IbGibIdentityContext {
122
122
  data?: Record<string, any>;
123
123
  }
124
124
 
125
+ // ---------------------------------------------------------------------------
126
+ // UI Shell
127
+ // ---------------------------------------------------------------------------
128
+
129
+ /**
130
+ * Minimal interface for an application's UI Shell.
131
+ *
132
+ * ## design notes
133
+ *
134
+ * This is intentionally minimal to avoid coupling the bootstrap engine to a
135
+ * specific UI design (header, panels, etc.).
136
+ */
137
+ export interface IbGibAppShell {
138
+ /**
139
+ * Hook called by the bootstrap engine when the ibGib engine and metaspace
140
+ * are fully initialized and ready for interaction.
141
+ */
142
+ onEngineReady(): void;
143
+ }
144
+
125
145
  // ---------------------------------------------------------------------------
126
146
  // GlobalThis layers
127
147
  // ---------------------------------------------------------------------------
@@ -163,6 +183,11 @@ export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
163
183
  export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
164
184
  /** Semver string generated at build time. */
165
185
  version?: string;
186
+ /**
187
+ * The application's UI Shell service.
188
+ * Initialized by the consumer and registered on the globalThis.
189
+ */
190
+ shell?: IbGibAppShell;
166
191
  /** Per-space RCLI pathing shim. */
167
192
  spaceShim: { [spaceId: string]: SpaceShimGlobalInfo };
168
193
  /** When true, verbose output is enabled for the session. */