@ibgib/web-gib 0.0.1 → 0.0.2
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/CHANGELOG.md +4 -426
- package/dist/api/commands/chat/get-context-info.mjs +1 -1
- package/dist/api/commands/chat/get-context-info.mjs.map +1 -1
- package/dist/api/commands/chat/tell-user.mjs +1 -1
- package/dist/api/commands/chat/tell-user.mjs.map +1 -1
- package/dist/api/commands/ibgib/get-ibgibs.mjs +1 -1
- package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -1
- package/dist/api/commands/ibgib/mut8-ibgib.mjs +1 -1
- package/dist/api/commands/ibgib/mut8-ibgib.mjs.map +1 -1
- package/dist/api/commands/templates/api-function-info.template.mjs +1 -1
- package/dist/api/commands/templates/api-function-info.template.mjs.map +1 -1
- package/dist/api/commands/text/text-edit.mjs +1 -1
- package/dist/api/commands/text/text-edit.mjs.map +1 -1
- package/dist/constants.d.mts +14 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +14 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/helpers.d.mts +84 -0
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +216 -2
- package/dist/helpers.mjs.map +1 -1
- package/dist/helpers.web.d.mts +3 -4
- package/dist/helpers.web.d.mts.map +1 -1
- package/dist/helpers.web.mjs +19 -23
- package/dist/helpers.web.mjs.map +1 -1
- package/dist/types.d.mts +75 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/types.web.d.mts +5 -38
- package/dist/types.web.d.mts.map +1 -1
- package/dist/witness/agent/agent-one-file.mjs +1 -1
- package/dist/witness/agent/agent-one-file.mjs.map +1 -1
- package/dist/witness/agent/agents-service-v1.mjs +1 -1
- package/dist/witness/agent/agents-service-v1.mjs.map +1 -1
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -1
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs +3 -3
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/commands/chat/get-context-info.mts +1 -1
- package/src/api/commands/chat/tell-user.mts +1 -1
- package/src/api/commands/ibgib/get-ibgibs.mts +1 -1
- package/src/api/commands/ibgib/mut8-ibgib.mts +1 -1
- package/src/api/commands/templates/api-function-info.template.mts +1 -1
- package/src/api/commands/text/text-edit.mts +1 -1
- package/src/constants.mts +14 -0
- package/src/helpers.mts +197 -2
- package/src/helpers.web.mts +18 -27
- package/src/types.mts +76 -0
- package/src/types.web.mts +5 -38
- package/src/witness/agent/agent-one-file.mts +1 -1
- package/src/witness/agent/agents-service-v1.mts +1 -1
- package/src/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mts +4 -4
|
@@ -13,7 +13,7 @@ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
|
13
13
|
import { getCommandService } from "../command-service-v1.mjs";
|
|
14
14
|
import { CommandDataBase } from "../command-types.mjs";
|
|
15
15
|
import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
|
|
16
|
-
import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.
|
|
16
|
+
import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.mjs";
|
|
17
17
|
import {
|
|
18
18
|
getAddlMetadataTextForAgentText,
|
|
19
19
|
} from "../../../witness/agent/agent-one-file.mjs";
|
|
@@ -28,7 +28,7 @@ import { APIFunctionInfo } from "../../api-types.mjs";
|
|
|
28
28
|
import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
29
29
|
import { getCommandService } from "../command-service-v1.mjs";
|
|
30
30
|
import { CommandDataBase } from "../command-types.mjs";
|
|
31
|
-
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.
|
|
31
|
+
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.mjs';
|
|
32
32
|
import { FUNCTION_CALL_EXAMPLES_HEADER } from '../../api-constants.mjs';
|
|
33
33
|
import { getLatestAddrs } from '@ibgib/core-gib/dist/witness/space/space-helper.mjs';
|
|
34
34
|
|
|
@@ -25,7 +25,7 @@ import { APIFunctionInfo } from "../../api-types.mjs";
|
|
|
25
25
|
import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
26
26
|
import { getCommandService } from "../command-service-v1.mjs";
|
|
27
27
|
import { CommandDataBase } from "../command-types.mjs";
|
|
28
|
-
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.
|
|
28
|
+
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.mjs';
|
|
29
29
|
import { FUNCTION_CALL_EXAMPLES_HEADER } from '../../api-constants.mjs';
|
|
30
30
|
import { getProjectSafeName, parseProjectIb } from '../../../common/project/project-helper.mjs';
|
|
31
31
|
import { mut8Timeline } from '@ibgib/core-gib/dist/timeline/timeline-api.mjs';
|
|
@@ -30,7 +30,7 @@ import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
|
30
30
|
import { getCommandService } from "../command-service-v1.mjs";
|
|
31
31
|
import { CommandDataBase } from "../command-types.mjs";
|
|
32
32
|
import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
|
|
33
|
-
// import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.
|
|
33
|
+
// import { getGlobalMetaspace_waitIfNeeded } from "../../../helpers.mjs";
|
|
34
34
|
|
|
35
35
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
36
36
|
|
|
@@ -25,7 +25,7 @@ import { APIFunctionInfo } from "../../api-types.mjs";
|
|
|
25
25
|
import { COMMAND_BASE_SCHEMA_PROPERTIES } from "../command-constants.mjs";
|
|
26
26
|
import { getCommandService } from "../command-service-v1.mjs";
|
|
27
27
|
import { CommandDataBase } from "../command-types.mjs";
|
|
28
|
-
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.
|
|
28
|
+
import { getGlobalMetaspace_waitIfNeeded } from '../../../helpers.mjs';
|
|
29
29
|
import { FUNCTION_CALL_EXAMPLES_HEADER } from '../../api-constants.mjs';
|
|
30
30
|
|
|
31
31
|
const logalot = GLOBAL_LOG_A_LOT;
|
package/src/constants.mts
CHANGED
|
@@ -2,6 +2,20 @@ import { tagTextToIb } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs"
|
|
|
2
2
|
|
|
3
3
|
export const GLOBAL_LOG_A_LOT = false;
|
|
4
4
|
export const GLOBAL_TIMER_NAME = '[web^gib timer]';
|
|
5
|
+
/**
|
|
6
|
+
* `globalThis[GLOBAL_THIS_IBGIB_KEY]`
|
|
7
|
+
*
|
|
8
|
+
* So the pattern for other apps/libs is:
|
|
9
|
+
*
|
|
10
|
+
* `globalThis[GLOBAL_THIS_IBGIB_KEY][APP_SPECIFIC_GLOBAL_KEY]`
|
|
11
|
+
*
|
|
12
|
+
* and given the value of this continues to be `"ibgib"`:
|
|
13
|
+
* `globalThis.ibgib.[APP_SPECIFIC_GLOBAL_KEY]`
|
|
14
|
+
*
|
|
15
|
+
* @example globalThis.ibgib.myApp
|
|
16
|
+
* @example globalThis.ibgib.blankGib
|
|
17
|
+
*/
|
|
18
|
+
export const GLOBAL_THIS_IBGIB_KEY = 'ibgib';
|
|
5
19
|
|
|
6
20
|
/**
|
|
7
21
|
* regex for what we think of as a gemini api key.
|
package/src/helpers.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clone, extractErrorMsg, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
1
|
+
import { clone, delay, extractErrorMsg, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
2
|
import { IbGib_V1, Rel8n } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
3
3
|
import { getIbAndGib, getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
4
4
|
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
@@ -10,7 +10,8 @@ import { MetaspaceService } from "@ibgib/core-gib/dist/witness/space/metaspace/m
|
|
|
10
10
|
import { IbGibSpaceAny } from "@ibgib/core-gib/dist/witness/space/space-base-v1.mjs";
|
|
11
11
|
import { SpecialIbGibType } from "@ibgib/core-gib/dist/common/other/other-types.mjs";
|
|
12
12
|
|
|
13
|
-
import { GLOBAL_LOG_A_LOT, } from "./constants.mjs";
|
|
13
|
+
import { GLOBAL_LOG_A_LOT, GLOBAL_THIS_IBGIB_KEY, } from "./constants.mjs";
|
|
14
|
+
import { IbGibGlobalThisInfo } from "./types.mjs";
|
|
14
15
|
|
|
15
16
|
const logalot = GLOBAL_LOG_A_LOT; // change this when you want to turn off verbose logging
|
|
16
17
|
|
|
@@ -572,3 +573,197 @@ export function getShortenedStringWithEllipsis({
|
|
|
572
573
|
if (logalot) { console.log(`${lc} complete.`); }
|
|
573
574
|
}
|
|
574
575
|
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* location for globals to be used across ALL ibgib apps/libs, present and future.
|
|
579
|
+
*
|
|
580
|
+
* NOTE: Very little should be in here, since it pertains to such a broad scope.
|
|
581
|
+
*
|
|
582
|
+
* ## how to use this class
|
|
583
|
+
*
|
|
584
|
+
* ibgib apps are expected to have a metaspace singleton, and this is expected to be
|
|
585
|
+
*/
|
|
586
|
+
export class IbGibGlobalThis_IbGib {
|
|
587
|
+
private lc: string = `[${IbGibGlobalThis_IbGib.name}]`;
|
|
588
|
+
|
|
589
|
+
private _metaspacesByAppId: { [appId: string]: MetaspaceService } = {};
|
|
590
|
+
private _globalThisObjectsByAppId: { [appId: string]: any } = {};
|
|
591
|
+
|
|
592
|
+
constructor() {
|
|
593
|
+
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* The metaspace should already be initialized.
|
|
598
|
+
*
|
|
599
|
+
* @throws if metaspace.initialized is falsy
|
|
600
|
+
*
|
|
601
|
+
* @see {@link IbGibGlobalThis_IbGib} for general instructions on how to use
|
|
602
|
+
* this class.
|
|
603
|
+
*/
|
|
604
|
+
public async registerInitializedMetaspace({
|
|
605
|
+
appId,
|
|
606
|
+
metaspace,
|
|
607
|
+
}: {
|
|
608
|
+
appId: string,
|
|
609
|
+
metaspace: MetaspaceService,
|
|
610
|
+
}): Promise<void> {
|
|
611
|
+
const lc = `${this.lc}[${this.registerInitializedMetaspace.name}]`;
|
|
612
|
+
try {
|
|
613
|
+
if (logalot) { console.log(`${lc} starting... (I: d65058fb49953ac8bff6823cbc464825)`); }
|
|
614
|
+
if (this._metaspacesByAppId[appId]) { throw new Error(`appId (${appId}) already has a metaspace registered. (E: 1601f88722b849bdd85b6b98075e8225)`); }
|
|
615
|
+
|
|
616
|
+
if (metaspace.initialized) {
|
|
617
|
+
this._metaspacesByAppId[appId] = metaspace;
|
|
618
|
+
} else {
|
|
619
|
+
throw new Error(`metaspace.initialized is false. (E: 00e361cff998dd54e4f7b8a10106ed25)`);
|
|
620
|
+
}
|
|
621
|
+
} catch (error) {
|
|
622
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
623
|
+
throw error;
|
|
624
|
+
} finally {
|
|
625
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* sync call to a metaspace that was registered by the appId.
|
|
630
|
+
*
|
|
631
|
+
* @throws If no metaspace was registered with the {@link appId}
|
|
632
|
+
*
|
|
633
|
+
* @see {@link IbGibGlobalThis_IbGib} for general instructions on how to use
|
|
634
|
+
* this class.
|
|
635
|
+
*/
|
|
636
|
+
getMetaspace({ appId }: { appId: string }): MetaspaceService {
|
|
637
|
+
const lc = `${this.lc}[${this.getMetaspace.name}]`;
|
|
638
|
+
try {
|
|
639
|
+
if (logalot) { console.log(`${lc} starting... (I: b918969698bf80cf18a03a3b91385525)`); }
|
|
640
|
+
const metaspace = this._metaspacesByAppId[appId];
|
|
641
|
+
if (metaspace) {
|
|
642
|
+
return metaspace;
|
|
643
|
+
} else {
|
|
644
|
+
throw new Error(`NOT FOUND: appId (${appId}) does not have a metaspace registered. (E: 0ebcf95fb208d2d3f27edb06260d9d25)`);
|
|
645
|
+
}
|
|
646
|
+
} catch (error) {
|
|
647
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
648
|
+
throw error;
|
|
649
|
+
} finally {
|
|
650
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Registers an app-specific global object for global state with ibgib apps,
|
|
655
|
+
* on the ibgib global object (atow 12/2025 this is `globalThis.ibgib`).
|
|
656
|
+
* @see {@link IbGibGlobalThis_IbGib.getGlobalThis}
|
|
657
|
+
*
|
|
658
|
+
* @see {@link IbGibGlobalThis_IbGib} for general instructions on how to use
|
|
659
|
+
* this class.
|
|
660
|
+
*/
|
|
661
|
+
registerGlobalThis<TGlobalInfo>({ appId, appGlobal }: { appId: string, appGlobal: TGlobalInfo }): void {
|
|
662
|
+
const lc = `${this.lc}[${this.registerGlobalThis.name}]`;
|
|
663
|
+
try {
|
|
664
|
+
if (logalot) { console.log(`${lc} starting... (I: 0680ec122948fe23cd0f4c3a61451825)`); }
|
|
665
|
+
if (this._globalThisObjectsByAppId[appId]) { throw new Error(`appId (${appId}) already has a globalThis object registered. (E: 1e71e8859a8b94c9a85af595818cd825)`); }
|
|
666
|
+
|
|
667
|
+
this._globalThisObjectsByAppId[appId] = appGlobal;
|
|
668
|
+
} catch (error) {
|
|
669
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
670
|
+
throw error;
|
|
671
|
+
} finally {
|
|
672
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Get the app-specific global object on globalThis.ibgib that was
|
|
678
|
+
* (or should have been) registered by the {@link appId}
|
|
679
|
+
*
|
|
680
|
+
* @throws if no globalThis obj was registered with `appId`
|
|
681
|
+
* @see {@link IbGibGlobalThis_IbGib.registerGlobalThis}
|
|
682
|
+
*
|
|
683
|
+
* @see {@link IbGibGlobalThis_IbGib} for general instructions on how to use
|
|
684
|
+
* this class.
|
|
685
|
+
*/
|
|
686
|
+
getGlobalThis<TGlobalInfo>({ appId }: { appId: string }): TGlobalInfo {
|
|
687
|
+
const lc = `${this.lc}[${this.getGlobalThis.name}]`;
|
|
688
|
+
try {
|
|
689
|
+
if (logalot) { console.log(`${lc} starting... (I: f59f58a8344664092877a0f8b43c1125)`); }
|
|
690
|
+
|
|
691
|
+
const globalThisObj = this._globalThisObjectsByAppId[appId] as (TGlobalInfo | undefined);
|
|
692
|
+
if (globalThisObj) {
|
|
693
|
+
return globalThisObj;
|
|
694
|
+
} else {
|
|
695
|
+
throw new Error(`NOT FOUND: appId (${appId}) does not have a globalThis object registered. (E: 8e3b08d05c475399781871d2a12ba825)`);
|
|
696
|
+
}
|
|
697
|
+
} catch (error) {
|
|
698
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
699
|
+
throw error;
|
|
700
|
+
} finally {
|
|
701
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
*
|
|
708
|
+
*/
|
|
709
|
+
export function getIbGibGlobalThis_IbGib(): IbGibGlobalThisInfo {
|
|
710
|
+
const lc = `[${getIbGibGlobalThis_IbGib.name}]`;
|
|
711
|
+
try {
|
|
712
|
+
if (logalot) { console.log(`${lc} starting... (I: 890f53e984d69461d9f4ded8741fcc25)`); }
|
|
713
|
+
|
|
714
|
+
let result = globalThis[GLOBAL_THIS_IBGIB_KEY];
|
|
715
|
+
if (!result) {
|
|
716
|
+
console.log(`${lc} initializing globalThis.${GLOBAL_THIS_IBGIB_KEY}... (I: 9d9ff1813448d9a1b82b0e5790a74825)`);
|
|
717
|
+
result = {};
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
return result;
|
|
721
|
+
} catch (error) {
|
|
722
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
723
|
+
throw error;
|
|
724
|
+
} finally {
|
|
725
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* helper that waits until the global metaspace is initialized and then returns
|
|
731
|
+
* that metaspace.
|
|
732
|
+
*
|
|
733
|
+
* NOTE: This does not have a max count breakout or cancellation. The metaspace
|
|
734
|
+
* is simply integral to the website and this is not expected to fail (otherwise
|
|
735
|
+
* the entire website is foo anyway).
|
|
736
|
+
*
|
|
737
|
+
* ## driving use case
|
|
738
|
+
*
|
|
739
|
+
* when the router tries to load a route that is based on an ibgib, the
|
|
740
|
+
* metaspace is required.
|
|
741
|
+
*/
|
|
742
|
+
export async function getGlobalMetaspace_waitIfNeeded({
|
|
743
|
+
delayIntervalMs = 50
|
|
744
|
+
}: {
|
|
745
|
+
delayIntervalMs: number
|
|
746
|
+
} = { delayIntervalMs: 50 }): Promise<MetaspaceService> {
|
|
747
|
+
const lc = `[${getGlobalMetaspace_waitIfNeeded.name}]`;
|
|
748
|
+
try {
|
|
749
|
+
if (logalot) { console.log(`${lc} starting... (I: 4acc22d08dd1100503f9b0423f302925)`); }
|
|
750
|
+
let metaspace: MetaspaceService | undefined;
|
|
751
|
+
while (!metaspace) {
|
|
752
|
+
if (getIbGibGlobalThis_IbGib().metaspace) {
|
|
753
|
+
metaspace = getIbGibGlobalThis_IbGib().metaspace!;
|
|
754
|
+
}
|
|
755
|
+
if (!metaspace) {
|
|
756
|
+
// global metaspace is loading. we have loaded html immediately
|
|
757
|
+
// out of the gate and the metaspace hasn't initialized yet.
|
|
758
|
+
console.log(`${lc} metaspace still not initialized. delayIntervalMs: ${delayIntervalMs} until next retry... (I: 490f77ac4ded1d7d3c0340e460404125)`);
|
|
759
|
+
await delay(delayIntervalMs);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return metaspace;
|
|
763
|
+
} catch (error) {
|
|
764
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
765
|
+
throw error;
|
|
766
|
+
} finally {
|
|
767
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
768
|
+
}
|
|
769
|
+
}
|
package/src/helpers.web.mts
CHANGED
|
@@ -17,18 +17,16 @@ import { FlatIbGibGraph } from "@ibgib/core-gib/dist/common/other/graph-types.mj
|
|
|
17
17
|
import { decompressIbGibGraphFromString, deserializeStringToGraph } from "@ibgib/core-gib/dist/common/other/other-helper.web.mjs";
|
|
18
18
|
import { getRawExportIbGib } from "@ibgib/core-gib/dist/common/import-export/import-export-helper.web.mjs";
|
|
19
19
|
import { IbGibSpaceAny } from "@ibgib/core-gib/dist/witness/space/space-base-v1.mjs";
|
|
20
|
-
import { ZERO_SPACE_ID } from "@ibgib/core-gib/dist/witness/space/space-constants.mjs";
|
|
21
20
|
|
|
22
21
|
import {
|
|
23
|
-
GLOBAL_LOG_A_LOT,
|
|
24
|
-
|
|
25
|
-
DEFAULT_IBGIB_TRANSLUCENT,
|
|
26
|
-
GEMINI_API_KEY_REGEXP,
|
|
22
|
+
GLOBAL_LOG_A_LOT, DEFAULT_IBGIB_COLOR, DEFAULT_IBGIB_COLOR_CONTRAST,
|
|
23
|
+
DEFAULT_IBGIB_TRANSLUCENT, GEMINI_API_KEY_REGEXP,
|
|
27
24
|
CONFIG_OPTION_GEMINI_API_KEY_LOCATION_HELP
|
|
28
25
|
} from "./constants.mjs";
|
|
29
26
|
import { showFullscreenDialog } from "./ui/ui-helpers.mjs";
|
|
30
27
|
import { initializeStorage, storageCreateStoreIfNotExist, storageDBExists, storageGet, storagePut } from "./storage/storage-helpers.web.mjs";
|
|
31
|
-
import { GibColorInfo } from "./types.
|
|
28
|
+
import { GibColorInfo } from "./types.mjs";
|
|
29
|
+
import { getIbGibGlobalThis_IbGib } from "./helpers.mjs";
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -1221,26 +1219,14 @@ export function shadowRoot_getElementById<TElement extends Element = HTMLElement
|
|
|
1221
1219
|
return getElementById_throwsIfFalsy<TElement>({ id, shadowRoot });
|
|
1222
1220
|
}
|
|
1223
1221
|
|
|
1224
|
-
|
|
1225
|
-
export function getGlobalMetaspace_waitIfNeeded(): Promise<MetaspaceService> {
|
|
1226
|
-
const lc = `[${getGlobalMetaspace_waitIfNeeded.name}]`;
|
|
1227
|
-
try {
|
|
1228
|
-
if (logalot) { console.log(`${lc} starting... (I: 96e9b89ef4986c33e819340ec7d05325)`); }
|
|
1229
|
-
throw new Error(`not implemented (E: eb1258f32cb543ce684812845dd28c25)`);
|
|
1230
|
-
} catch (error) {
|
|
1231
|
-
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
1232
|
-
throw error;
|
|
1233
|
-
} finally {
|
|
1234
|
-
if (logalot) { console.log(`${lc} complete.`); }
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
export function getGlobalStoreName(): Promise<string> {
|
|
1222
|
+
export function getGlobalStoreName(): string {
|
|
1239
1223
|
const lc = `[${getGlobalStoreName.name}]`;
|
|
1240
1224
|
try {
|
|
1241
1225
|
if (logalot) { console.log(`${lc} starting... (I: 62a29f9982b4b5ecd91ff58ca4dd6825)`); }
|
|
1242
|
-
// ARMY_STORE
|
|
1243
|
-
|
|
1226
|
+
// ARMY_STORE in blankgib
|
|
1227
|
+
const hackGlobal = getIbGibGlobalThis_IbGib();
|
|
1228
|
+
if (!hackGlobal.storeName_hack) { throw new Error(`(UNEXPECTED) global store name falsy? (E: 3b9b680f6a980debbb877c9a13fb2625)`); }
|
|
1229
|
+
return hackGlobal.storeName_hack;
|
|
1244
1230
|
} catch (error) {
|
|
1245
1231
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
1246
1232
|
throw error;
|
|
@@ -1253,8 +1239,10 @@ export function getGlobalDbName(): string {
|
|
|
1253
1239
|
const lc = `[${getGlobalDbName.name}]`;
|
|
1254
1240
|
try {
|
|
1255
1241
|
if (logalot) { console.log(`${lc} starting... (I: 8c8f08728fc7384f87697377358cc825)`); }
|
|
1256
|
-
// BLANK_GIB_DB_NAME
|
|
1257
|
-
|
|
1242
|
+
// BLANK_GIB_DB_NAME in blankgib
|
|
1243
|
+
const hackGlobal = getIbGibGlobalThis_IbGib();
|
|
1244
|
+
if (!hackGlobal.dbName_hack) { throw new Error(`(UNEXPECTED) global db name falsy? (E: 3aa028d5e4088f3f3841aae94ac02825)`); }
|
|
1245
|
+
return hackGlobal.dbName_hack;
|
|
1258
1246
|
} catch (error) {
|
|
1259
1247
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
1260
1248
|
throw error;
|
|
@@ -1263,11 +1251,14 @@ export function getGlobalDbName(): string {
|
|
|
1263
1251
|
}
|
|
1264
1252
|
}
|
|
1265
1253
|
|
|
1266
|
-
export function getGlobalIndexedDbKey_APIKey():
|
|
1254
|
+
export function getGlobalIndexedDbKey_APIKey(): string {
|
|
1267
1255
|
const lc = `[${getGlobalIndexedDbKey_APIKey.name}]`;
|
|
1268
1256
|
try {
|
|
1269
1257
|
if (logalot) { console.log(`${lc} starting... (I: 59a2510a85051f97ed15fbc8825b6825)`); }
|
|
1270
|
-
|
|
1258
|
+
// BEE_KEY in blankgib
|
|
1259
|
+
const hackGlobal = getIbGibGlobalThis_IbGib();
|
|
1260
|
+
if (!hackGlobal.apiKeyName_hack) { throw new Error(`(UNEXPECTED) global api key name falsy? (E: 1782e812f0c87f54b8059468a5b60125)`); }
|
|
1261
|
+
return hackGlobal.apiKeyName_hack;
|
|
1271
1262
|
} catch (error) {
|
|
1272
1263
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
1273
1264
|
throw error;
|
package/src/types.mts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Gib } from "@ibgib/ts-gib/dist/types.mjs";
|
|
2
|
+
import { GibInfo } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
3
|
+
import { MetaspaceService } from "@ibgib/core-gib/dist/witness/space/metaspace/metaspace-types.mjs";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* deterministically driven colors based on a given {@link gib}
|
|
7
|
+
*/
|
|
8
|
+
export interface GibColorInfo {
|
|
9
|
+
/**
|
|
10
|
+
* Gib that was used to drive the color calculation
|
|
11
|
+
*/
|
|
12
|
+
gib: Gib;
|
|
13
|
+
gibInfo: GibInfo;
|
|
14
|
+
/**
|
|
15
|
+
* Color that corresponds to the punctiliar part of {@link gib}
|
|
16
|
+
*/
|
|
17
|
+
punctiliarColor: string;
|
|
18
|
+
/**
|
|
19
|
+
* Translucent version of {@link punctiliarColor}
|
|
20
|
+
*/
|
|
21
|
+
punctiliarColorTranslucent: string;
|
|
22
|
+
/**
|
|
23
|
+
* contrasting color against punctiliar color
|
|
24
|
+
*/
|
|
25
|
+
punctiliarColorContrast: string;
|
|
26
|
+
/**
|
|
27
|
+
* Color that corresponds to the tjp (timeline) part of {@link gib}
|
|
28
|
+
*/
|
|
29
|
+
tjpColor?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Translucent version of {@link tjpColor}
|
|
32
|
+
*/
|
|
33
|
+
tjpColorTranslucent?: string;
|
|
34
|
+
/**
|
|
35
|
+
* contrasting color against tjp color
|
|
36
|
+
*/
|
|
37
|
+
tjpColorContrast?: string;
|
|
38
|
+
/**
|
|
39
|
+
* If there was an error deriving the color info, this will show the error
|
|
40
|
+
* message.
|
|
41
|
+
*/
|
|
42
|
+
errorMsg?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* hack. ibgib apps need to have access to global state that really should be
|
|
47
|
+
* tied to them alone (if we even should have global state in the first place).
|
|
48
|
+
*
|
|
49
|
+
* Most importantly, we need a metaspace, db name, and a store name.
|
|
50
|
+
*
|
|
51
|
+
* I'm just shoving it here because life is life.
|
|
52
|
+
*
|
|
53
|
+
* ## how to use
|
|
54
|
+
*
|
|
55
|
+
* Going to shove this in globalThis.ibgib, but other web apps may want to just
|
|
56
|
+
* descend from this and store it in their own places, e.g.,
|
|
57
|
+
* `globalThis.ibgib.myApp`
|
|
58
|
+
*/
|
|
59
|
+
export interface IbGibGlobalThisInfo {
|
|
60
|
+
/**
|
|
61
|
+
* @see {@link IbGibGlobalThisInfo}
|
|
62
|
+
*/
|
|
63
|
+
metaspace?: MetaspaceService;
|
|
64
|
+
/**
|
|
65
|
+
* @see {@link IbGibGlobalThisInfo}
|
|
66
|
+
*/
|
|
67
|
+
dbName_hack: string;
|
|
68
|
+
/**
|
|
69
|
+
* @see {@link IbGibGlobalThisInfo}
|
|
70
|
+
*/
|
|
71
|
+
storeName_hack: string;
|
|
72
|
+
/**
|
|
73
|
+
* @see {@link IbGibGlobalThisInfo}
|
|
74
|
+
*/
|
|
75
|
+
apiKeyName_hack: string;
|
|
76
|
+
}
|
package/src/types.web.mts
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GibInfo } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
1
|
+
import { IbGibGlobalThisInfo } from "./types.mjs";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* @see {@link IbGibGlobalThisInfo}
|
|
6
5
|
*/
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
gib: Gib;
|
|
12
|
-
gibInfo: GibInfo;
|
|
13
|
-
/**
|
|
14
|
-
* Color that corresponds to the punctiliar part of {@link gib}
|
|
15
|
-
*/
|
|
16
|
-
punctiliarColor: string;
|
|
17
|
-
/**
|
|
18
|
-
* Translucent version of {@link punctiliarColor}
|
|
19
|
-
*/
|
|
20
|
-
punctiliarColorTranslucent: string;
|
|
21
|
-
/**
|
|
22
|
-
* contrasting color against punctiliar color
|
|
23
|
-
*/
|
|
24
|
-
punctiliarColorContrast: string;
|
|
25
|
-
/**
|
|
26
|
-
* Color that corresponds to the tjp (timeline) part of {@link gib}
|
|
27
|
-
*/
|
|
28
|
-
tjpColor?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Translucent version of {@link tjpColor}
|
|
31
|
-
*/
|
|
32
|
-
tjpColorTranslucent?: string;
|
|
33
|
-
/**
|
|
34
|
-
* contrasting color against tjp color
|
|
35
|
-
*/
|
|
36
|
-
tjpColorContrast?: string;
|
|
37
|
-
/**
|
|
38
|
-
* If there was an error deriving the color info, this will show the error
|
|
39
|
-
* message.
|
|
40
|
-
*/
|
|
41
|
-
errorMsg?: string;
|
|
6
|
+
export interface IbGibGlobalThisInfo_Web extends IbGibGlobalThisInfo {
|
|
7
|
+
dbName: string;
|
|
8
|
+
storeName: string;
|
|
42
9
|
}
|
|
@@ -34,7 +34,7 @@ import { getAllFunctionInfos, } from '../../api/api-index.mjs';
|
|
|
34
34
|
import { FUNCTION_INFO_REL8N_NAME, FunctionInfoIbGib_V1, createFunctionInfoIbGib } from './function-info/function-info-one-file.mjs';
|
|
35
35
|
import { GeminiModel } from './gemini/gemini-constants.mjs';
|
|
36
36
|
import { PromptAPIResult_Gemini } from './gemini/gemini-types.mjs';
|
|
37
|
-
import { getGlobalMetaspace_waitIfNeeded } from '../../helpers.
|
|
37
|
+
import { getGlobalMetaspace_waitIfNeeded } from '../../helpers.mjs';
|
|
38
38
|
import { updateAgentIndex } from './agent-helpers.mjs';
|
|
39
39
|
import { getAgentsSvc } from './agents-service-v1.mjs';
|
|
40
40
|
import { LiveProxyIbGib } from '../live-proxy-ibgib/live-proxy-ibgib-one-file.mjs';
|
|
@@ -12,7 +12,7 @@ import { toDto } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
|
|
|
12
12
|
import { updateSpecialIndex } from "@ibgib/core-gib/dist/timeline/timeline-api.mjs";
|
|
13
13
|
|
|
14
14
|
import { GLOBAL_LOG_A_LOT, HARDCODED_PROMPT_TAG_TEXT } from "../../constants.mjs";
|
|
15
|
-
import { getGlobalMetaspace_waitIfNeeded } from "../../helpers.
|
|
15
|
+
import { getGlobalMetaspace_waitIfNeeded } from "../../helpers.mjs";
|
|
16
16
|
import { getAgents, getConcreteAgentFactory, getTag_Agents } from "./agent-helpers.mjs";
|
|
17
17
|
import { AddTextInfo, AgentWitnessAny, AgentWitnessData_V1, AgentWitnessIbGib_V1, getAgentIb, parseAgentIb, taggifyForPrompt } from "./agent-one-file.mjs";
|
|
18
18
|
import { AgentDtoToWitnessFunction, CreateNewAgentArg, CreateNewAgentResult } from "./agent-types.mjs";
|
|
@@ -2,19 +2,19 @@ import { extractErrorMsg, pretty } from "@ibgib/helper-gib/dist/helpers/utils-he
|
|
|
2
2
|
import { Ib, IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
3
3
|
import { IbGib_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
4
4
|
import { GIB, IB, ROOT } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
5
|
+
import { Factory_V1 } from "@ibgib/ts-gib/dist/V1/factory.mjs";
|
|
5
6
|
import { WitnessWithContextBase_V1 } from "@ibgib/core-gib/dist/witness/witness-with-context/witness-with-context-base-v1.mjs";
|
|
6
7
|
import { IbGibTimelineUpdateInfo } from "@ibgib/core-gib/dist/common/other/other-types.mjs";
|
|
7
8
|
import { ObservableWitness, } from "@ibgib/core-gib/dist/common/pubsub/observable/observable-types.mjs";
|
|
8
9
|
import { newupSubject } from "@ibgib/core-gib/dist/common/pubsub/subject/subject-helper.mjs";
|
|
9
10
|
import { SubjectWitness } from "@ibgib/core-gib/dist/common/pubsub/subject/subject-types.mjs";
|
|
10
|
-
|
|
11
|
-
import { GLOBAL_LOG_A_LOT } from "../../constants.mjs";
|
|
12
11
|
import { WitnessWithContextData_V1, WitnessWithContextRel8ns_V1 } from "@ibgib/core-gib/dist/witness/witness-with-context/witness-with-context-types.mjs";
|
|
13
12
|
import { IbGibSpaceAny } from "@ibgib/core-gib/dist/witness/space/space-base-v1.mjs";
|
|
14
|
-
import { getGlobalMetaspace_waitIfNeeded } from "../../helpers.web.mjs";
|
|
15
13
|
import { isSpaceIb } from "@ibgib/core-gib/dist/witness/space/space-helper.mjs";
|
|
16
14
|
import { SpaceId } from "@ibgib/core-gib/dist/witness/space/space-types.mjs";
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
import { GLOBAL_LOG_A_LOT } from "../../constants.mjs";
|
|
17
|
+
import { getGlobalMetaspace_waitIfNeeded } from "../../helpers.mjs";
|
|
18
18
|
|
|
19
19
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
20
20
|
|