@bytexbyte/nxtlinq-ai-agent-ui-react-development 0.4.4 → 0.4.7

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.
@@ -0,0 +1,16 @@
1
+ export type WaitForAITPermissionsOptions<T> = {
2
+ readAIT: () => Promise<T | undefined>;
3
+ getPermissions: (ait: T) => readonly string[];
4
+ expectedPermissions: readonly string[];
5
+ attempts?: number;
6
+ delayMs?: number;
7
+ sleep?: (delayMs: number) => Promise<void>;
8
+ };
9
+ export declare function includesAITPermissions(actualPermissions: readonly string[], expectedPermissions: readonly string[]): boolean;
10
+ /**
11
+ * Wait until the AIT read path can observe a newly submitted permission set.
12
+ * Stale reads are deliberately discarded so callers never downgrade their
13
+ * optimistic local state while the chain/RPC read path is catching up.
14
+ */
15
+ export declare function waitForAITPermissions<T>({ readAIT, getPermissions, expectedPermissions, attempts, delayMs, sleep, }: WaitForAITPermissionsOptions<T>): Promise<T | undefined>;
16
+ //# sourceMappingURL=aitPermissionPropagation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aitPermissionPropagation.d.ts","sourceRoot":"","sources":["../src/aitPermissionPropagation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI;IAC5C,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACtC,cAAc,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,MAAM,EAAE,CAAC;IAC9C,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,SAAS,MAAM,EAAE,EACpC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GACrC,OAAO,CAGT;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,EAC7C,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,QAAa,EACb,OAAa,EACb,KAA6E,GAC9E,EAAE,4BAA4B,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAU1D"}
@@ -0,0 +1,21 @@
1
+ export function includesAITPermissions(actualPermissions, expectedPermissions) {
2
+ return actualPermissions.includes('ALL')
3
+ || expectedPermissions.every((permission) => actualPermissions.includes(permission));
4
+ }
5
+ /**
6
+ * Wait until the AIT read path can observe a newly submitted permission set.
7
+ * Stale reads are deliberately discarded so callers never downgrade their
8
+ * optimistic local state while the chain/RPC read path is catching up.
9
+ */
10
+ export async function waitForAITPermissions({ readAIT, getPermissions, expectedPermissions, attempts = 10, delayMs = 750, sleep = (duration) => new Promise((resolve) => setTimeout(resolve, duration)), }) {
11
+ const totalAttempts = Math.max(1, attempts);
12
+ for (let attempt = 0; attempt < totalAttempts; attempt += 1) {
13
+ const ait = await readAIT();
14
+ if (ait && includesAITPermissions(getPermissions(ait), expectedPermissions)) {
15
+ return ait;
16
+ }
17
+ if (attempt + 1 < totalAttempts)
18
+ await sleep(delayMs);
19
+ }
20
+ return undefined;
21
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAQ/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAw+FlD,CAAC"}
1
+ {"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA+B/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AA0B/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAggGlD,CAAC"}