@ibgib/web-gib 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/app-bootstrap/bootstrap.d.mts +90 -0
- package/dist/app-bootstrap/bootstrap.d.mts.map +1 -0
- package/dist/app-bootstrap/bootstrap.mjs +404 -0
- package/dist/app-bootstrap/bootstrap.mjs.map +1 -0
- package/dist/app-bootstrap/init-orchestration.d.mts +75 -0
- package/dist/app-bootstrap/init-orchestration.d.mts.map +1 -0
- package/dist/app-bootstrap/init-orchestration.mjs +211 -0
- package/dist/app-bootstrap/init-orchestration.mjs.map +1 -0
- package/dist/app-bootstrap/types.d.mts +163 -0
- package/dist/app-bootstrap/types.d.mts.map +1 -0
- package/dist/app-bootstrap/types.mjs +15 -0
- package/dist/app-bootstrap/types.mjs.map +1 -0
- package/dist/constants.d.mts +10 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +10 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/helpers.d.mts +0 -7
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +0 -25
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.d.mts +16 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/app-bootstrap/bootstrap.mts +570 -0
- package/src/app-bootstrap/init-orchestration.mts +244 -0
- package/src/app-bootstrap/types.mts +190 -0
- package/src/constants.mts +10 -0
- package/src/helpers.mts +1 -23
- package/src/index.mts +28 -2
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/SKILL.md +7 -7
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/types.mts.template +0 -3
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module init-orchestration
|
|
3
|
+
*
|
|
4
|
+
* Shared web orchestration functions for booting ibgib-based frontend apps.
|
|
5
|
+
*
|
|
6
|
+
* ## what belongs here
|
|
7
|
+
*
|
|
8
|
+
* Functions that define the startup sequence and are identical across all
|
|
9
|
+
* ibgib apps. These depend only on the IbGibAmbientContextConfig seam.
|
|
10
|
+
* App-specific logic (typed globalThis accessors, component helpers) belongs
|
|
11
|
+
* in each app's own helpers.web.mts.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { delay, extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
15
|
+
|
|
16
|
+
import { storageGet } from "../storage/storage-helpers.web.mjs";
|
|
17
|
+
import { initAppStorage } from "../helpers.web.mjs";
|
|
18
|
+
import { getGlobalMetaspace_waitIfNeeded } from "../helpers.mjs";
|
|
19
|
+
import { IbGibDynamicComponentMetaCtorOpts } from "../ui/component/component-types.mjs";
|
|
20
|
+
import { IbGibGlobalThisInfo } from "../types.mjs";
|
|
21
|
+
import { IbGibAmbientContextConfig, IbGibGlobalThis_Common, IbGibGlobalThis_IbGibApp } from "./types.mjs";
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Storage initialization
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initializes the IndexedDB stores required by an ibgib app.
|
|
29
|
+
*
|
|
30
|
+
* Call once on DOMContentLoaded, before the bootstrap script is dynamically
|
|
31
|
+
* loaded. This ensures storage is available when the metaspace initializes.
|
|
32
|
+
*/
|
|
33
|
+
export async function initIbGibStorage(config: IbGibAmbientContextConfig): Promise<void> {
|
|
34
|
+
const lc = `[${initIbGibStorage.name}]`;
|
|
35
|
+
try {
|
|
36
|
+
await initAppStorage({
|
|
37
|
+
infos: [
|
|
38
|
+
{
|
|
39
|
+
dbName: config.dbName,
|
|
40
|
+
storeNames: [config.storeName, ...(config.additionalStoreNames ?? [])],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// globalThis initialization
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Sets up globalThis.ibgib.[globalThisKey] for the given app config.
|
|
56
|
+
*
|
|
57
|
+
* Idempotent — safe to call multiple times. The root `globalThis.ibgib` object
|
|
58
|
+
* is created if it doesn't exist, then the per-app sub-key is populated.
|
|
59
|
+
*
|
|
60
|
+
* @param config The app's ambient context config.
|
|
61
|
+
* @param globalThisKey The snake_case key for this app's namespace under
|
|
62
|
+
* `globalThis.ibgib` (e.g. `'my_app'`, `'cool_new_thing'`).
|
|
63
|
+
* @param version Optional semver string (from AUTO_GENERATED_VERSION).
|
|
64
|
+
*/
|
|
65
|
+
export function initIbGibGlobalThis(
|
|
66
|
+
config: IbGibAmbientContextConfig,
|
|
67
|
+
globalThisKey: string,
|
|
68
|
+
version?: string,
|
|
69
|
+
): void {
|
|
70
|
+
const lc = `[${initIbGibGlobalThis.name}]`;
|
|
71
|
+
try {
|
|
72
|
+
// Ensure the root ibgib object exists
|
|
73
|
+
if (!(globalThis as any).ibgib) {
|
|
74
|
+
(globalThis as any).ibgib = {
|
|
75
|
+
dbName_hack: config.dbName,
|
|
76
|
+
apiKeyName_hack: config.apiKeyName,
|
|
77
|
+
storeName_hack: config.storeName,
|
|
78
|
+
} satisfies IbGibGlobalThisInfo;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Populate the per-app namespace
|
|
82
|
+
if (!(globalThis as any).ibgib[globalThisKey]) {
|
|
83
|
+
(globalThis as any).ibgib[globalThisKey] = {
|
|
84
|
+
version,
|
|
85
|
+
spaceShim: {},
|
|
86
|
+
fnDefaultGetAPIKey: async () => {
|
|
87
|
+
const apiKey = await storageGet({
|
|
88
|
+
dbName: config.dbName,
|
|
89
|
+
storeName: config.storeName,
|
|
90
|
+
key: config.apiKeyName,
|
|
91
|
+
});
|
|
92
|
+
return apiKey ?? '';
|
|
93
|
+
},
|
|
94
|
+
dbName_hack: config.dbName,
|
|
95
|
+
apiKeyName_hack: config.apiKeyName,
|
|
96
|
+
storeName_hack: config.storeName,
|
|
97
|
+
} satisfies IbGibGlobalThis_IbGibApp;
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
// globalThis accessors
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the raw IbGibGlobalThis_Common for the given key.
|
|
111
|
+
* Typed as the Common base — use the app-specific typed accessor for
|
|
112
|
+
* full-type access.
|
|
113
|
+
*/
|
|
114
|
+
export function getIbGibGlobalThis_Common(globalThisKey: string): IbGibGlobalThis_Common {
|
|
115
|
+
const lc = `[${getIbGibGlobalThis_Common.name}]`;
|
|
116
|
+
const g = (globalThis as any).ibgib?.[globalThisKey];
|
|
117
|
+
if (!g) {
|
|
118
|
+
throw new Error(`${lc} (UNEXPECTED) globalThis.ibgib.${globalThisKey} not initialized. (E: 8f621732ibgib-commonfe25)`);
|
|
119
|
+
}
|
|
120
|
+
return g as IbGibGlobalThis_Common;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Returns the IbGibGlobalThis_IbGibApp for the given key, initializing it
|
|
125
|
+
* from config if not yet present.
|
|
126
|
+
*/
|
|
127
|
+
export function getIbGibGlobalThis_IbGibApp(
|
|
128
|
+
globalThisKey: string,
|
|
129
|
+
config?: IbGibAmbientContextConfig,
|
|
130
|
+
version?: string,
|
|
131
|
+
): IbGibGlobalThis_IbGibApp {
|
|
132
|
+
if (!(globalThis as any).ibgib?.[globalThisKey]) {
|
|
133
|
+
if (!config) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
`Global context not initialized and config not provided for key '${globalThisKey}'.`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
initIbGibGlobalThis(config, globalThisKey, version);
|
|
139
|
+
}
|
|
140
|
+
return (globalThis as any).ibgib[globalThisKey] as IbGibGlobalThis_IbGibApp;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// API key helper
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns a function that retrieves the AI API key from storage at call time.
|
|
149
|
+
* The globalThisKey links back to the per-app namespace for DB/store/key names.
|
|
150
|
+
*/
|
|
151
|
+
export function getDefaultFnGetAPIKey(
|
|
152
|
+
globalThisKey: string,
|
|
153
|
+
): () => Promise<string> {
|
|
154
|
+
return async () => {
|
|
155
|
+
const gb = getIbGibGlobalThis_IbGibApp(globalThisKey);
|
|
156
|
+
return (await storageGet({
|
|
157
|
+
dbName: gb.dbName_hack,
|
|
158
|
+
storeName: gb.storeName_hack,
|
|
159
|
+
key: gb.apiKeyName_hack,
|
|
160
|
+
})) ?? '';
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
// Dynamic bootstrap loading
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Dynamically imports the bootstrap module at the given path and calls the
|
|
170
|
+
* named export bootstrap function.
|
|
171
|
+
*
|
|
172
|
+
* Called after DOMContentLoaded so the heavy ibgib import graph does not block
|
|
173
|
+
* first paint.
|
|
174
|
+
*
|
|
175
|
+
* @param path Path to bootstrap.mjs (relative to the app's index.mts).
|
|
176
|
+
* @param bootstrapFnName The exported async function to call. Defaults to
|
|
177
|
+
* `'bootstrapApp'` — override with the app-specific function name
|
|
178
|
+
* (e.g. `'bootstrapMyAppApp'`).
|
|
179
|
+
*/
|
|
180
|
+
export async function dynamicallyLoadBootstrapScript(
|
|
181
|
+
path: string,
|
|
182
|
+
bootstrapFnName: string = 'bootstrapApp',
|
|
183
|
+
): Promise<void> {
|
|
184
|
+
const lc = `[${dynamicallyLoadBootstrapScript.name}]`;
|
|
185
|
+
try {
|
|
186
|
+
const module = await import(path);
|
|
187
|
+
const fn = module[bootstrapFnName];
|
|
188
|
+
if (typeof fn !== 'function') {
|
|
189
|
+
throw new Error(
|
|
190
|
+
`${lc} Bootstrap function '${bootstrapFnName}' not found in '${path}'. ` +
|
|
191
|
+
`Available exports: ${Object.keys(module).join(', ')} (E: 9c36085eibgib-common26)`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
await fn();
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// Component constructor args helper
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Returns the standard ctor options object for IbGib dynamic components.
|
|
207
|
+
*
|
|
208
|
+
* Provides two things components need at construction time:
|
|
209
|
+
* 1. `fnGetMetaspace` — accesses the global metaspace once initialized
|
|
210
|
+
* 2. `bootstrapPromise` — components can await this to defer their own init
|
|
211
|
+
* until the App witness and metaspace are fully ready
|
|
212
|
+
*
|
|
213
|
+
* @param globalThisKey The per-app namespace key used to find the bootstrap
|
|
214
|
+
* promise on globalThis.
|
|
215
|
+
*/
|
|
216
|
+
export function getComponentCtorArg(globalThisKey: string): IbGibDynamicComponentMetaCtorOpts {
|
|
217
|
+
const fnGetMetaspace = async () => getGlobalMetaspace_waitIfNeeded();
|
|
218
|
+
|
|
219
|
+
const bootstrapPromiseWrapper = new Promise<void>(async (resolve, reject) => {
|
|
220
|
+
try {
|
|
221
|
+
let maxTries = 100_000;
|
|
222
|
+
let counter = 0;
|
|
223
|
+
let bootstrapPromise: Promise<void> | undefined;
|
|
224
|
+
do {
|
|
225
|
+
bootstrapPromise =
|
|
226
|
+
getIbGibGlobalThis_IbGibApp(globalThisKey)?.bootstrapPromise;
|
|
227
|
+
counter++;
|
|
228
|
+
if (counter > maxTries) { break; }
|
|
229
|
+
await delay(10);
|
|
230
|
+
} while (bootstrapPromise === undefined);
|
|
231
|
+
if (!bootstrapPromise) {
|
|
232
|
+
throw new Error(
|
|
233
|
+
`Timed out waiting for bootstrapPromise on key '${globalThisKey}'. (E: 4c48ce92ibgib-common26)`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
await bootstrapPromise;
|
|
237
|
+
resolve();
|
|
238
|
+
} catch (error) {
|
|
239
|
+
reject(error);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
return { fnGetMetaspace, bootstrapPromise: bootstrapPromiseWrapper };
|
|
244
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module types
|
|
3
|
+
*
|
|
4
|
+
* Shared type definitions for ibgib-based frontend apps.
|
|
5
|
+
*
|
|
6
|
+
* ## notes
|
|
7
|
+
*
|
|
8
|
+
* Three layers of globalThis state:
|
|
9
|
+
* IbGibGlobalThisInfo (@ibgib/web-gib — the root ibgib slot)
|
|
10
|
+
* └── IbGibGlobalThis_Common (bootstrap promise tracking)
|
|
11
|
+
* └── IbGibGlobalThis_IbGibApp (all ibgib App witness apps)
|
|
12
|
+
* └── IbGibGlobalThis_[AppName] (per-app extensions)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { IbGibRel8ns_V1, IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
16
|
+
import { CommentData_V1 } from "@ibgib/core-gib/dist/common/comment/comment-types.mjs";
|
|
17
|
+
import { RCLIArgInfo } from "@ibgib/helper-gib/dist/rcli/rcli-types.mjs";
|
|
18
|
+
|
|
19
|
+
import { LiveProxyIbGib } from "../witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs";
|
|
20
|
+
import { IbGibGlobalThisInfo } from "../types.mjs";
|
|
21
|
+
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// App ambient context config
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Configuration object that parameterizes an ibgib app's storage substrates.
|
|
28
|
+
*
|
|
29
|
+
* This is the primary seam between the framework layer and a specific app.
|
|
30
|
+
* Every downstream app creates exactly one APP_CONFIG and passes it to the
|
|
31
|
+
* framework helpers.
|
|
32
|
+
*
|
|
33
|
+
* ## notes
|
|
34
|
+
*
|
|
35
|
+
* Intended to be upstreamed into @ibgib/web-gib.
|
|
36
|
+
*/
|
|
37
|
+
export interface IbGibAmbientContextConfig {
|
|
38
|
+
/** Target IndexedDB database name */
|
|
39
|
+
dbName: string;
|
|
40
|
+
/** Primary object store name */
|
|
41
|
+
storeName: string;
|
|
42
|
+
/** Additional stores to initialize alongside the primary (e.g., ZERO_SPACE_ID) */
|
|
43
|
+
additionalStoreNames?: string[];
|
|
44
|
+
/** The IndexedDB key under which the AI API key is persisted */
|
|
45
|
+
apiKeyName: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Space shim (RCLI pathing compat layer)
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Per-space shim that mimics a filesystem CWD context for ibgib RCLI compat.
|
|
54
|
+
*/
|
|
55
|
+
export interface SpaceShimGlobalInfo {
|
|
56
|
+
/**
|
|
57
|
+
* The initial cwd() value when the RCLI was started. Used as the context
|
|
58
|
+
* path the user types commands from.
|
|
59
|
+
*/
|
|
60
|
+
initialCwd: string;
|
|
61
|
+
/** The active CWD, updated by pass-through `cd` commands. */
|
|
62
|
+
cwd: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Bootstrap request comment (RCLI plumbing)
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
/** @see {@link RequestCommentIbGib_V1} */
|
|
70
|
+
export interface RequestCommentData_V1 extends CommentData_V1 {
|
|
71
|
+
/** As close to the raw args as we can get. */
|
|
72
|
+
args: string[];
|
|
73
|
+
/** Interpreted infos for args. */
|
|
74
|
+
interpretedArgInfos: RCLIArgInfo[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface RequestCommentRel8ns_V1 extends IbGibRel8ns_V1 { }
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Special Comment ibgib that acts as a "request" — the command analog from RCLI.
|
|
81
|
+
*
|
|
82
|
+
* The raw text of the command is `text` from `CommentData_V1`.
|
|
83
|
+
*/
|
|
84
|
+
export interface RequestCommentIbGib_V1
|
|
85
|
+
extends IbGib_V1<RequestCommentData_V1, RequestCommentRel8ns_V1> {
|
|
86
|
+
/** Kluge for one-off commandlines during initial development. */
|
|
87
|
+
oneOff: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Identity (optional — WIP as of April 2026)
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Framework-level identity interface.
|
|
96
|
+
*
|
|
97
|
+
* ## design notes
|
|
98
|
+
*
|
|
99
|
+
* The implementation is entirely consumer-supplied. The framework defines only
|
|
100
|
+
* the shape of the slot so shells and components can react to auth state
|
|
101
|
+
* without coupling to a specific identity mechanism.
|
|
102
|
+
*
|
|
103
|
+
* For ibgib apps, the typical implementation will be keystone-based (a Merkle
|
|
104
|
+
* DAG proof of cryptographic identity continuity), not token-based.
|
|
105
|
+
*
|
|
106
|
+
* ## WIP caveat (atow April 2026)
|
|
107
|
+
*
|
|
108
|
+
* The keystone identity implementation in @ibgib/core-gib is still under
|
|
109
|
+
* active development. This interface represents the intended framework
|
|
110
|
+
* contract. Check the ibgib-libs sync/keystone module for the current
|
|
111
|
+
* implementation status before using.
|
|
112
|
+
*/
|
|
113
|
+
export interface IbGibIdentityContext {
|
|
114
|
+
/** Whether identity resolution has completed (does not imply authenticated). */
|
|
115
|
+
resolved: boolean;
|
|
116
|
+
/** Whether the current session has a verified identity. */
|
|
117
|
+
authenticated: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* App-specific identity payload.
|
|
120
|
+
* For ibgib: typically `{ keystoneAddr, userIbGibAddr }`.
|
|
121
|
+
*/
|
|
122
|
+
data?: Record<string, any>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// GlobalThis layers
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Layer 1: Fields shared across ALL ibgib web apps.
|
|
131
|
+
*
|
|
132
|
+
* Extends IbGibGlobalThisInfo from @ibgib/web-gib (the root ibgib slot).
|
|
133
|
+
* Intended to be upstreamed into @ibgib/web-gib.
|
|
134
|
+
*/
|
|
135
|
+
export interface IbGibGlobalThis_Common extends IbGibGlobalThisInfo {
|
|
136
|
+
/**
|
|
137
|
+
* Set to true when bootstrap has been triggered.
|
|
138
|
+
* There is no "bootstrapComplete" — await {@link bootstrapPromise} instead.
|
|
139
|
+
*/
|
|
140
|
+
bootstrapStarted?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* The promise returned by the bootstrap function. Components await this
|
|
143
|
+
* to defer initialization until the App witness and metaspace are ready.
|
|
144
|
+
*/
|
|
145
|
+
bootstrapPromise?: Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Singleton chronologys component. Should not be destroyed for the
|
|
148
|
+
* duration of the page session.
|
|
149
|
+
*/
|
|
150
|
+
chronologysComponent?: any;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Layer 2: Fields shared by any app that follows the ibgib App witness pattern.
|
|
155
|
+
*
|
|
156
|
+
* Apps using the bootstrap factory pattern extend this interface and add only
|
|
157
|
+
* their app-specific fields.
|
|
158
|
+
*
|
|
159
|
+
* ## notes
|
|
160
|
+
*
|
|
161
|
+
* Intended to be upstreamed into @ibgib/web-gib as IbGibGlobalThis_IbGibApp.
|
|
162
|
+
*/
|
|
163
|
+
export interface IbGibGlobalThis_IbGibApp extends IbGibGlobalThis_Common {
|
|
164
|
+
/** Semver string generated at build time. */
|
|
165
|
+
version?: string;
|
|
166
|
+
/** Per-space RCLI pathing shim. */
|
|
167
|
+
spaceShim: { [spaceId: string]: SpaceShimGlobalInfo };
|
|
168
|
+
/** When true, verbose output is enabled for the session. */
|
|
169
|
+
verbose?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Looks up the AI API key from IndexedDB storage.
|
|
172
|
+
* Stored as a function so the key is never cached in memory at the global level.
|
|
173
|
+
*/
|
|
174
|
+
fnDefaultGetAPIKey: () => Promise<string>;
|
|
175
|
+
/** The initial "command" comment ibgib created at bootstrap time. */
|
|
176
|
+
initialCommentIbGib?: IbGib_V1;
|
|
177
|
+
/** Live proxy wrapping {@link initialCommentIbGib} for reactive subscriptions. */
|
|
178
|
+
initialCommentIbGibProxy?: LiveProxyIbGib;
|
|
179
|
+
/**
|
|
180
|
+
* Optional identity context. Populated by the consumer's resolveIdentity()
|
|
181
|
+
* callback in the bootstrap options.
|
|
182
|
+
*
|
|
183
|
+
* - `undefined`: no identity mechanism configured
|
|
184
|
+
* - `null`: identity resolution was attempted; user is unauthenticated
|
|
185
|
+
* - `IbGibIdentityContext`: identity resolved (check `.authenticated`)
|
|
186
|
+
*
|
|
187
|
+
* @see {@link IbGibIdentityContext}
|
|
188
|
+
*/
|
|
189
|
+
identity?: IbGibIdentityContext | null;
|
|
190
|
+
}
|
package/src/constants.mts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { tagTextToIb } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Library-internal toggle for verbose logging.
|
|
6
|
+
*
|
|
7
|
+
* ## Usage note
|
|
8
|
+
*
|
|
9
|
+
* This is an ibgib-pattern meant to be redefined per project. Downstream apps
|
|
10
|
+
* should NOT import this from web-gib, but instead define their own
|
|
11
|
+
* `GLOBAL_LOG_A_LOT` constant for their own logging needs.
|
|
12
|
+
*/
|
|
3
13
|
export const GLOBAL_LOG_A_LOT = false;
|
|
4
14
|
export const GLOBAL_TIMER_NAME = '[web^gib timer]';
|
|
5
15
|
/**
|
package/src/helpers.mts
CHANGED
|
@@ -908,26 +908,4 @@ export function getColorStrings(translucentAlpha: number, drivingHash: string):
|
|
|
908
908
|
return [color, colorTranslucent, colorContrast];
|
|
909
909
|
};
|
|
910
910
|
|
|
911
|
-
|
|
912
|
-
* If this is Dynamically import bootstrapBlankCanvasApp AFTER initial layout,
|
|
913
|
-
* so we don't incur the speed penalty of loading all of the ibgib-related code.
|
|
914
|
-
*/
|
|
915
|
-
export async function dynamicallyLoadBootstrapScript({
|
|
916
|
-
bootstrapPath,
|
|
917
|
-
}: {
|
|
918
|
-
bootstrapPath: string,
|
|
919
|
-
}): Promise<void> {
|
|
920
|
-
const lc = `[${dynamicallyLoadBootstrapScript.name}]`;
|
|
921
|
-
try {
|
|
922
|
-
if (logalot) { console.log(`${lc} starting... (I: 2308b22b90dbad13086d0c0d6ef9a325)`); }
|
|
923
|
-
// const globalIbGib = getIbGibGlobalThis_BlankGib();
|
|
924
|
-
// const module = await import('./bootstrap.mjs');
|
|
925
|
-
const module = await import(bootstrapPath);
|
|
926
|
-
await module.bootstrapBlankCanvasApp();
|
|
927
|
-
} catch (error) {
|
|
928
|
-
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
929
|
-
throw error;
|
|
930
|
-
} finally {
|
|
931
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
932
|
-
}
|
|
933
|
-
}
|
|
911
|
+
|
package/src/index.mts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @ibgib/web-gib
|
|
3
|
+
*
|
|
4
|
+
* Front Door: Streamlined App Bootstrapping
|
|
5
|
+
*/
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
export {
|
|
8
|
+
bootstrapIbGibApp
|
|
9
|
+
} from "./app-bootstrap/bootstrap.mjs";
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
IbGibAmbientContextConfig,
|
|
13
|
+
IbGibGlobalThis_IbGibApp
|
|
14
|
+
} from "./app-bootstrap/types.mjs";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
initIbGibStorage,
|
|
18
|
+
dynamicallyLoadBootstrapScript,
|
|
19
|
+
getComponentCtorArg
|
|
20
|
+
} from "./app-bootstrap/init-orchestration.mjs";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Toolbox: Library Internals
|
|
24
|
+
* (Only export what's necessary for advanced users)
|
|
25
|
+
*/
|
|
26
|
+
export * from "./constants.mjs";
|
|
27
|
+
export * from "./types.mjs";
|
|
28
|
+
export * from "./helpers.web.mjs";
|
|
29
|
+
export * from "./helpers.mjs";
|
|
@@ -36,13 +36,13 @@ This skill is often the first step in creating a new app, or used to "ibgib-ify"
|
|
|
36
36
|
|
|
37
37
|
| Token | Example value | How it's computed |
|
|
38
38
|
|---|---|---|
|
|
39
|
-
| `{{APP_HUMAN_NAME}}` | `
|
|
40
|
-
| `{{APP_NAME_UPPER}}` | `
|
|
41
|
-
| `{{APP_CLASSNAME_PREFIX}}` | `
|
|
42
|
-
| `{{APP_DIR_NAME}}` | `
|
|
43
|
-
| `{{DB_NAME}}` | `
|
|
44
|
-
| `{{STORE_NAME}}` | `
|
|
45
|
-
| `{{APP_UUID}}` | `
|
|
39
|
+
| `{{APP_HUMAN_NAME}}` | `My App` | Asked of developer |
|
|
40
|
+
| `{{APP_NAME_UPPER}}` | `MY_APP` | Uppercase + underscores of app name |
|
|
41
|
+
| `{{APP_CLASSNAME_PREFIX}}` | `MyApp` | PascalCase, no suffix |
|
|
42
|
+
| `{{APP_DIR_NAME}}` | `my-app` | kebab-case |
|
|
43
|
+
| `{{DB_NAME}}` | `my_app_db` | Asked of developer |
|
|
44
|
+
| `{{STORE_NAME}}` | `my_app_store` | Asked of developer |
|
|
45
|
+
| `{{APP_UUID}}` | `3a95fe65cbda2833b59cadff4e279826` | **Generated fresh** with `generate-id.js`. |
|
|
46
46
|
|
|
47
47
|
---
|
|
48
48
|
|
package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/types.mts.template
CHANGED
|
@@ -7,9 +7,6 @@ import { IbGibGlobalThisInfo } from "@ibgib/web-gib/dist/types.mjs";
|
|
|
7
7
|
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// App-level ambient context config
|
|
10
|
-
//
|
|
11
|
-
// NOTE: This interface is intentionally agnostic to pulmoniq or any other
|
|
12
|
-
// domain. It should eventually be upstreamed into @ibgib/web-gib.
|
|
13
10
|
// ---------------------------------------------------------------------------
|
|
14
11
|
|
|
15
12
|
/**
|