@kortix/sdk 0.14.17 → 0.14.19
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/core/client/kortix.d.ts +11 -0
- package/dist/core/client/kortix.d.ts.map +1 -1
- package/dist/core/client/project-core.d.ts.map +1 -1
- package/dist/core/client/project-operations-review.d.ts +2 -2
- package/dist/core/client/project-operations-review.d.ts.map +1 -1
- package/dist/core/client/project-operations-review.js +2 -2
- package/dist/core/client/project-operations-review.js.map +1 -1
- package/dist/core/client/project-platform-security.d.ts +15 -0
- package/dist/core/client/project-platform-security.d.ts.map +1 -1
- package/dist/core/client/project-platform-security.js +15 -0
- package/dist/core/client/project-platform-security.js.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.d.ts +10 -0
- package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
- package/dist/core/rest/platform-client/host-boundary.js +9 -0
- package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
- package/dist/core/rest/projects-client/channels.d.ts +26 -1
- package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
- package/dist/core/rest/projects-client/channels.js +33 -1
- package/dist/core/rest/projects-client/channels.js.map +1 -1
- package/dist/core/rest/projects-client/connectors.d.ts +1 -1
- package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
- package/dist/core/rest/projects-client/drives.d.ts +16 -8
- package/dist/core/rest/projects-client/drives.d.ts.map +1 -1
- package/dist/core/rest/projects-client/drives.js +2 -3
- package/dist/core/rest/projects-client/drives.js.map +1 -1
- package/dist/core/rest/projects-client/projects.d.ts +11 -5
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js +3 -2
- package/dist/core/rest/projects-client/projects.js.map +1 -1
- package/dist/core/rest/projects-client/sessions.d.ts +12 -21
- package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
- package/dist/core/rest/projects-client/sessions.js +13 -31
- package/dist/core/rest/projects-client/sessions.js.map +1 -1
- package/dist/core/rest/projects-client/triggers.d.ts +4 -3
- package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
- package/dist/core/rest/projects-client/triggers.js.map +1 -1
- package/dist/core/warm-session-pool.d.ts +27 -52
- package/dist/core/warm-session-pool.d.ts.map +1 -1
- package/dist/core/warm-session-pool.js +21 -170
- package/dist/core/warm-session-pool.js.map +1 -1
- package/dist/kortix.esm.min.js +44 -44
- package/dist/kortix.global.js +45 -45
- package/dist/react/invalidate-project.d.ts +5 -0
- package/dist/react/invalidate-project.d.ts.map +1 -1
- package/dist/react/invalidate-project.js +5 -0
- package/dist/react/invalidate-project.js.map +1 -1
- package/dist/react/prefetch-session-start.d.ts +2 -4
- package/dist/react/prefetch-session-start.d.ts.map +1 -1
- package/dist/react/prefetch-session-start.js +2 -4
- package/dist/react/prefetch-session-start.js.map +1 -1
- package/dist/react/session-start-stash.d.ts +2 -2
- package/dist/react/session-start-stash.js +2 -2
- package/dist/react/session-title-sync.d.ts +1 -5
- package/dist/react/session-title-sync.d.ts.map +1 -1
- package/dist/react/session-title-sync.js +9 -21
- package/dist/react/session-title-sync.js.map +1 -1
- package/dist/react/use-feature-flag.d.ts +4 -3
- package/dist/react/use-feature-flag.d.ts.map +1 -1
- package/dist/react/use-feature-flag.js +6 -14
- package/dist/react/use-feature-flag.js.map +1 -1
- package/dist/react/use-project-name.d.ts +8 -8
- package/dist/react/use-project-name.d.ts.map +1 -1
- package/dist/react/use-project-name.js +14 -27
- package/dist/react/use-project-name.js.map +1 -1
- package/dist/react/use-project-row.d.ts +12 -0
- package/dist/react/use-project-row.d.ts.map +1 -0
- package/dist/react/use-project-row.js +24 -0
- package/dist/react/use-project-row.js.map +1 -0
- package/package.json +4 -4
|
@@ -24,6 +24,9 @@ type ProjectDetailEntry = {
|
|
|
24
24
|
name?: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
+
type ProjectRowEntry = {
|
|
28
|
+
name?: string;
|
|
29
|
+
};
|
|
27
30
|
/**
|
|
28
31
|
* Exactly what `writeProjectNameOptimistically` overwrote, restorable with
|
|
29
32
|
* `restoreProjectName`. `lists` is an array, not a single entry, because the
|
|
@@ -34,6 +37,8 @@ type ProjectDetailEntry = {
|
|
|
34
37
|
*/
|
|
35
38
|
export interface ProjectNameSnapshot {
|
|
36
39
|
detail: ProjectDetailEntry | undefined;
|
|
40
|
+
/** The bare project row (`qk.project.summary`), which `useProjectName` reads. */
|
|
41
|
+
row?: ProjectRowEntry | undefined;
|
|
37
42
|
lists: Array<{
|
|
38
43
|
queryKey: QueryKey;
|
|
39
44
|
data: ProjectsListEntry[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidate-project.d.ts","sourceRoot":"","sources":["../../src/react/invalidate-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGnE,gFAAgF;AAChF,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"invalidate-project.d.ts","sourceRoot":"","sources":["../../src/react/invalidate-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGnE,gFAAgF;AAChF,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,KAAK,iBAAiB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9D,KAAK,kBAAkB,GAAG;IAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAC1D,KAAK,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACvC,iFAAiF;IACjF,GAAG,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,mBAAmB,CA2BrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,mBAAmB,GAC5B,IAAI,CAMN"}
|
|
@@ -20,6 +20,8 @@ export async function invalidateProjectIdentity(qc, projectId) {
|
|
|
20
20
|
await Promise.all([
|
|
21
21
|
qc.invalidateQueries({ queryKey: qk.projects.scope() }),
|
|
22
22
|
qc.invalidateQueries({ queryKey: qk.project.detail(projectId) }),
|
|
23
|
+
// The name readers (`useProjectName`) read the bare row.
|
|
24
|
+
qc.invalidateQueries({ queryKey: qk.project.summary(projectId) }),
|
|
23
25
|
]);
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
@@ -46,10 +48,12 @@ export function writeProjectNameOptimistically(qc, projectId, name) {
|
|
|
46
48
|
const lists = qc.getQueriesData(listQueries);
|
|
47
49
|
const snapshot = {
|
|
48
50
|
detail: qc.getQueryData(qk.project.detail(projectId)),
|
|
51
|
+
row: qc.getQueryData(qk.project.summary(projectId)),
|
|
49
52
|
lists: lists.map(([queryKey, data]) => ({ queryKey, data })),
|
|
50
53
|
};
|
|
51
54
|
qc.setQueriesData(listQueries, (prev) => prev?.map((p) => (p.project_id === projectId ? { ...p, name } : p)));
|
|
52
55
|
qc.setQueryData(qk.project.detail(projectId), (prev) => prev?.project ? { ...prev, project: { ...prev.project, name } } : prev);
|
|
56
|
+
qc.setQueryData(qk.project.summary(projectId), (prev) => prev ? { ...prev, name } : prev);
|
|
53
57
|
return snapshot;
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
@@ -73,5 +77,6 @@ export function restoreProjectName(qc, projectId, snapshot) {
|
|
|
73
77
|
qc.setQueryData(queryKey, data);
|
|
74
78
|
}
|
|
75
79
|
qc.setQueryData(qk.project.detail(projectId), snapshot.detail);
|
|
80
|
+
qc.setQueryData(qk.project.summary(projectId), snapshot.row);
|
|
76
81
|
}
|
|
77
82
|
//# sourceMappingURL=invalidate-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidate-project.js","sourceRoot":"","sources":["../../src/react/invalidate-project.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EAAe,EAAE,SAAiB;IACxE,MAAM,EAAE,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,EAAe,EACf,SAAiB;IAEjB,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,EAAE,CAAC,iBAA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ACnF,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAChC,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAe,EACf,SAAiB,EACjB,QAA6B;IAE7B,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChD,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/D,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -7,10 +7,8 @@ import type { QueryClient } from '@tanstack/react-query';
|
|
|
7
7
|
* bundle. Use at every createProjectSession→navigate site.
|
|
8
8
|
*
|
|
9
9
|
* Returns the prefetch promise (it never rejects — `prefetchQuery` swallows
|
|
10
|
-
* errors) so a caller can sequence work on `/start` having settled.
|
|
11
|
-
*
|
|
12
|
-
* `metadata.warm`, so a sessions-list refetch issued before it settles can
|
|
13
|
-
* still see the row hidden. Fire-and-forget callers just ignore the return.
|
|
10
|
+
* errors) so a caller can sequence work on `/start` having settled.
|
|
11
|
+
* Fire-and-forget callers just ignore the return.
|
|
14
12
|
*/
|
|
15
13
|
export declare function prefetchSessionStart(queryClient: QueryClient, projectId: string, sessionId: string): Promise<void>;
|
|
16
14
|
//# sourceMappingURL=prefetch-session-start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch-session-start.d.ts","sourceRoot":"","sources":["../../src/react/prefetch-session-start.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD
|
|
1
|
+
{"version":3,"file":"prefetch-session-start.d.ts","sourceRoot":"","sources":["../../src/react/prefetch-session-start.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -8,10 +8,8 @@ import { sessionStartKey, startProjectSession } from '../core/rest/projects-clie
|
|
|
8
8
|
* bundle. Use at every createProjectSession→navigate site.
|
|
9
9
|
*
|
|
10
10
|
* Returns the prefetch promise (it never rejects — `prefetchQuery` swallows
|
|
11
|
-
* errors) so a caller can sequence work on `/start` having settled.
|
|
12
|
-
*
|
|
13
|
-
* `metadata.warm`, so a sessions-list refetch issued before it settles can
|
|
14
|
-
* still see the row hidden. Fire-and-forget callers just ignore the return.
|
|
11
|
+
* errors) so a caller can sequence work on `/start` having settled.
|
|
12
|
+
* Fire-and-forget callers just ignore the return.
|
|
15
13
|
*/
|
|
16
14
|
export function prefetchSessionStart(queryClient, projectId, sessionId) {
|
|
17
15
|
return queryClient.prefetchQuery({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch-session-start.js","sourceRoot":"","sources":["../../src/react/prefetch-session-start.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpF
|
|
1
|
+
{"version":3,"file":"prefetch-session-start.js","sourceRoot":"","sources":["../../src/react/prefetch-session-start.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEpF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,WAAwB,EACxB,SAAiB,EACjB,SAAiB;IAEjB,OAAO,WAAW,CAAC,aAAa,CAAC;QAC/B,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC;QAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC;QACxD,SAAS,EAAE,CAAC;KACb,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -35,8 +35,8 @@ export interface StartStash {
|
|
|
35
35
|
* How long a stash stays deliverable. A stash is a hand-off for the
|
|
36
36
|
* navigation that wrote it — a failed replay restores it (re-stamped), but
|
|
37
37
|
* one that then sits unconsumed is a stale prompt, and replaying it into the
|
|
38
|
-
* session's by-then-real conversation on a much later visit is
|
|
39
|
-
* mis-delivery
|
|
38
|
+
* session's by-then-real conversation on a much later visit is a
|
|
39
|
+
* mis-delivery. 10 minutes matches
|
|
40
40
|
* the API's own bound for "how stale can a delivery be and still count"
|
|
41
41
|
* (UNDELIVERED_PROMPT_STARVATION_MS).
|
|
42
42
|
*/
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* How long a stash stays deliverable. A stash is a hand-off for the
|
|
22
22
|
* navigation that wrote it — a failed replay restores it (re-stamped), but
|
|
23
23
|
* one that then sits unconsumed is a stale prompt, and replaying it into the
|
|
24
|
-
* session's by-then-real conversation on a much later visit is
|
|
25
|
-
* mis-delivery
|
|
24
|
+
* session's by-then-real conversation on a much later visit is a
|
|
25
|
+
* mis-delivery. 10 minutes matches
|
|
26
26
|
* the API's own bound for "how stale can a delivery be and still count"
|
|
27
27
|
* (UNDELIVERED_PROMPT_STARVATION_MS).
|
|
28
28
|
*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { QueryClient } from '@tanstack/react-query';
|
|
2
|
-
type SessionTitleQueryClient = Pick<QueryClient, 'getQueryData' | 'refetchQueries'
|
|
3
|
-
/** Optional so lean test fakes (and older callers) keep working; a real
|
|
4
|
-
* QueryClient always has it. */
|
|
5
|
-
getQueryState?: QueryClient['getQueryState'];
|
|
6
|
-
};
|
|
2
|
+
type SessionTitleQueryClient = Pick<QueryClient, 'getQueryData' | 'refetchQueries'>;
|
|
7
3
|
interface SessionTitleRefreshOptions {
|
|
8
4
|
delaysMs?: number[];
|
|
9
5
|
signal?: AbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-title-sync.d.ts","sourceRoot":"","sources":["../../src/react/session-title-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-title-sync.d.ts","sourceRoot":"","sources":["../../src/react/session-title-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIzD,KAAK,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,gBAAgB,CAAC,CAAC;AAEpF,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE;AAwHD;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,WAAW,EAAE,uBAAuB,EACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { sessionStartKey } from '../core/rest/projects-client/index.js';
|
|
2
1
|
import { qk } from './query-keys.js';
|
|
3
2
|
const DEFAULT_TITLE_REFRESH_DELAYS_MS = [0, 5_000, 5_000, 10_000, 10_000, 15_000, 20_000];
|
|
4
3
|
function readRealTitle(value) {
|
|
@@ -37,13 +36,6 @@ function cachedSessionHasTitle(queryClient, projectId, sessionId) {
|
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
function refetchSessionTitleQueries(queryClient, projectId, sessionId) {
|
|
40
|
-
// An adopted warm session is revealed by /start dropping `metadata.warm`.
|
|
41
|
-
// While THIS session's /start is still in flight, a sessions-list refetch
|
|
42
|
-
// can beat it, observe the row still hidden, and overwrite the adopting
|
|
43
|
-
// tab's optimistic seed (warm-session-seed.ts in apps/web) — so the list
|
|
44
|
-
// half waits for the next ladder pass. The detail refetch stays: the
|
|
45
|
-
// session route serves the owner regardless of the marker.
|
|
46
|
-
const startFetching = queryClient.getQueryState?.(sessionStartKey(projectId, sessionId))?.fetchStatus === 'fetching';
|
|
47
39
|
return Promise.all([
|
|
48
40
|
// The LIST family — `[...sessionsScope, 'list']` — so a manager-only
|
|
49
41
|
// 'project'-scope reader picks up the resolved title too, not only the
|
|
@@ -56,19 +48,15 @@ function refetchSessionTitleQueries(queryClient, projectId, sessionId) {
|
|
|
56
48
|
// deployment: 5.8 `GET /sessions` and 6 `GET .../turn` per session open,
|
|
57
49
|
// the single largest cumulative cost on the open path. A title ladder
|
|
58
50
|
// refetches titles.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
queryKey: [...qk.project.sessionsScope(projectId), 'list-paged'],
|
|
69
|
-
type: 'active',
|
|
70
|
-
}),
|
|
71
|
-
]),
|
|
51
|
+
queryClient.refetchQueries({
|
|
52
|
+
queryKey: [...qk.project.sessionsScope(projectId), 'list'],
|
|
53
|
+
type: 'active',
|
|
54
|
+
}),
|
|
55
|
+
// The paged family: what the sidebar and the Sessions page read.
|
|
56
|
+
queryClient.refetchQueries({
|
|
57
|
+
queryKey: [...qk.project.sessionsScope(projectId), 'list-paged'],
|
|
58
|
+
type: 'active',
|
|
59
|
+
}),
|
|
72
60
|
queryClient.refetchQueries({
|
|
73
61
|
// EXACT: `qk.project.session(...)` is the PARENT of `prompts` and `turn`,
|
|
74
62
|
// so a prefix refetch here is the same accident in miniature.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-title-sync.js","sourceRoot":"","sources":["../../src/react/session-title-sync.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"session-title-sync.js","sourceRoot":"","sources":["../../src/react/session-title-sync.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAUlC,MAAM,+BAA+B,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1F,SAAS,aAAa,CAAC,KAAc;IACnC,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,IAAI,CAAC,KAAK,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,qBAAqB,CAC5B,WAA8C,EAC9C,SAAiB,EACjB,SAAiB;IAEjB,yEAAyE;IACzE,0EAA0E;IAC1E,oEAAoE;IACpE,yEAAyE;IACzE,4DAA4D;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,YAAY,CAAU,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,WAAW,CAAC,YAAY,CAAU,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAC3F,2EAA2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,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { FeatureFlagKey } from '../core/rest/projects-client/index.js';
|
|
|
3
3
|
export interface FeatureFlagState {
|
|
4
4
|
/** The server said EXACTLY `true` for this project. Never optimistic. */
|
|
5
5
|
enabled: boolean;
|
|
6
|
-
/** The project
|
|
6
|
+
/** The project row has not answered yet. Treat as "not enabled". */
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -11,8 +11,9 @@ export interface FeatureFlagState {
|
|
|
11
11
|
*
|
|
12
12
|
* Every flag-gated surface — a nav entry, a command-palette action, a page,
|
|
13
13
|
* a Customize section — reads this hook, so they light up and go dark
|
|
14
|
-
* together. Reads the shared `qk.project.
|
|
15
|
-
*
|
|
14
|
+
* together. Reads the shared bare project row (`qk.project.summary(id)`,
|
|
15
|
+
* `GET /projects/:id`, one database read), never the git-backed detail, so a
|
|
16
|
+
* flag-gated page renders without waiting on the repository.
|
|
16
17
|
*
|
|
17
18
|
* **Fail-closed by construction.** `enabled` is `=== true`, so a missing
|
|
18
19
|
* project id, an in-flight query, an error, an older server that does not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-feature-flag.d.ts","sourceRoot":"","sources":["../../src/react/use-feature-flag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-feature-flag.d.ts","sourceRoot":"","sources":["../../src/react/use-feature-flag.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAwBnE,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,GAAG,EAAE,cAAc,GAClB,gBAAgB,CAQlB"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { getProjectDetail } from '../core/rest/projects-client/index.js';
|
|
4
|
-
import { contract } from './query-contracts.js';
|
|
5
|
-
import { qk } from './query-keys.js';
|
|
2
|
+
import { useProjectRow } from './use-project-row.js';
|
|
6
3
|
/**
|
|
7
4
|
* Keys that graduated out of the flag system. Their features are on for every
|
|
8
5
|
* project and the API no longer serves them, so the fail-closed read below
|
|
@@ -28,8 +25,9 @@ const GRADUATED_FEATURE_FLAG_KEYS = new Set([
|
|
|
28
25
|
*
|
|
29
26
|
* Every flag-gated surface — a nav entry, a command-palette action, a page,
|
|
30
27
|
* a Customize section — reads this hook, so they light up and go dark
|
|
31
|
-
* together. Reads the shared `qk.project.
|
|
32
|
-
*
|
|
28
|
+
* together. Reads the shared bare project row (`qk.project.summary(id)`,
|
|
29
|
+
* `GET /projects/:id`, one database read), never the git-backed detail, so a
|
|
30
|
+
* flag-gated page renders without waiting on the repository.
|
|
33
31
|
*
|
|
34
32
|
* **Fail-closed by construction.** `enabled` is `=== true`, so a missing
|
|
35
33
|
* project id, an in-flight query, an error, an older server that does not
|
|
@@ -42,15 +40,9 @@ const GRADUATED_FEATURE_FLAG_KEYS = new Set([
|
|
|
42
40
|
* feature no longer has an off state.
|
|
43
41
|
*/
|
|
44
42
|
export function useFeatureFlag(projectId, key) {
|
|
45
|
-
const query =
|
|
46
|
-
queryKey: qk.project.detail(projectId ?? ''),
|
|
47
|
-
queryFn: () => getProjectDetail(projectId),
|
|
48
|
-
enabled: !!projectId,
|
|
49
|
-
...contract('config'),
|
|
50
|
-
refetchOnWindowFocus: false,
|
|
51
|
-
});
|
|
43
|
+
const query = useProjectRow(projectId, { refetchOnWindowFocus: false });
|
|
52
44
|
return {
|
|
53
|
-
enabled: GRADUATED_FEATURE_FLAG_KEYS.has(key) || query.data?.
|
|
45
|
+
enabled: GRADUATED_FEATURE_FLAG_KEYS.has(key) || query.data?.experimental?.[key] === true,
|
|
54
46
|
isLoading: query.isLoading,
|
|
55
47
|
};
|
|
56
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-feature-flag.js","sourceRoot":"","sources":["../../src/react/use-feature-flag.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"use-feature-flag.js","sourceRoot":"","sources":["../../src/react/use-feature-flag.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,2BAA2B,GAAgC,IAAI,GAAG,CAAC;IACvE,eAAe;IACf,cAAc;IACd,4BAA4B;IAC5B,OAAO;IACP,iBAAiB;IACjB,MAAM;IACN,aAAa;IACb,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,eAAe;IACf,yBAAyB;CAC1B,CAAC,CAAC;AAUH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAoC,EACpC,GAAmB;IAEnB,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IAExE,OAAO;QACL,OAAO,EACL,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI;QAClF,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -10,21 +10,21 @@ import type { KortixProject } from '../core/rest/projects-client/index.js';
|
|
|
10
10
|
*
|
|
11
11
|
* One accessor makes that structurally impossible rather than merely currently
|
|
12
12
|
* invalidated. Do not reintroduce a `??` fallback to another source here.
|
|
13
|
+
*
|
|
14
|
+
* The source is the bare project row (`qk.project.summary`, one database read),
|
|
15
|
+
* not the detail, which reads the repository and can take seconds: the name in
|
|
16
|
+
* the project shell must never wait on git.
|
|
13
17
|
*/
|
|
14
18
|
export declare function useProjectName(projectId: string | undefined): string | undefined;
|
|
15
19
|
/**
|
|
16
|
-
* The owning account id, read off the SAME
|
|
17
|
-
* `useProjectName` reads
|
|
18
|
-
*
|
|
19
|
-
* lived in `apps/web`'s `project-detail-query.ts` as a host-local hook; moved
|
|
20
|
-
* here because `qk.project.detail` + `contract('config')` is SDK-owned
|
|
21
|
-
* wiring, not something a host should hand-roll a second time.
|
|
20
|
+
* The owning account id, read off the SAME bare project row
|
|
21
|
+
* (`qk.project.summary(id)`, `GET /projects/:id`) `useProjectName` reads, so
|
|
22
|
+
* it shares one cache entry instead of adding a fetch.
|
|
22
23
|
*/
|
|
23
24
|
export declare function useProjectAccountId(projectId: string | undefined): string | undefined;
|
|
24
25
|
/**
|
|
25
26
|
* A project's icon — the emoji XOR the named glyph — read off the SAME
|
|
26
|
-
*
|
|
27
|
-
* read. No extra fetch, and structurally no way for the name a surface prints
|
|
27
|
+
* bare project row `useProjectName` and `useProjectAccountId` read. No extra fetch, and structurally no way for the name a surface prints
|
|
28
28
|
* and the icon it draws to come from two caches that have diverged.
|
|
29
29
|
*
|
|
30
30
|
* The two fields are returned under their STORED names (`icon`, `icon_glyph`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-name.d.ts","sourceRoot":"","sources":["../../src/react/use-project-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-project-name.d.ts","sourceRoot":"","sources":["../../src/react/use-project-name.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGhF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGrF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG,SAAS,CAIxD"}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { getProjectDetail } from '../core/rest/projects-client/index.js';
|
|
4
|
-
import { qk } from './query-keys.js';
|
|
5
|
-
import { contract } from './query-contracts.js';
|
|
6
|
-
function useProjectDetail(projectId) {
|
|
7
|
-
const id = projectId ?? '';
|
|
8
|
-
return useQuery({
|
|
9
|
-
queryKey: qk.project.detail(id),
|
|
10
|
-
queryFn: () => getProjectDetail(id),
|
|
11
|
-
enabled: Boolean(projectId),
|
|
12
|
-
...contract('config'),
|
|
13
|
-
});
|
|
14
|
-
}
|
|
2
|
+
import { useProjectRow } from './use-project-row.js';
|
|
15
3
|
/**
|
|
16
4
|
* The ONLY way to read a project's name.
|
|
17
5
|
*
|
|
@@ -23,27 +11,27 @@ function useProjectDetail(projectId) {
|
|
|
23
11
|
*
|
|
24
12
|
* One accessor makes that structurally impossible rather than merely currently
|
|
25
13
|
* invalidated. Do not reintroduce a `??` fallback to another source here.
|
|
14
|
+
*
|
|
15
|
+
* The source is the bare project row (`qk.project.summary`, one database read),
|
|
16
|
+
* not the detail, which reads the repository and can take seconds: the name in
|
|
17
|
+
* the project shell must never wait on git.
|
|
26
18
|
*/
|
|
27
19
|
export function useProjectName(projectId) {
|
|
28
|
-
const { data } =
|
|
29
|
-
return data?.
|
|
20
|
+
const { data } = useProjectRow(projectId);
|
|
21
|
+
return data?.name;
|
|
30
22
|
}
|
|
31
23
|
/**
|
|
32
|
-
* The owning account id, read off the SAME
|
|
33
|
-
* `useProjectName` reads
|
|
34
|
-
*
|
|
35
|
-
* lived in `apps/web`'s `project-detail-query.ts` as a host-local hook; moved
|
|
36
|
-
* here because `qk.project.detail` + `contract('config')` is SDK-owned
|
|
37
|
-
* wiring, not something a host should hand-roll a second time.
|
|
24
|
+
* The owning account id, read off the SAME bare project row
|
|
25
|
+
* (`qk.project.summary(id)`, `GET /projects/:id`) `useProjectName` reads, so
|
|
26
|
+
* it shares one cache entry instead of adding a fetch.
|
|
38
27
|
*/
|
|
39
28
|
export function useProjectAccountId(projectId) {
|
|
40
|
-
const { data } =
|
|
41
|
-
return data?.
|
|
29
|
+
const { data } = useProjectRow(projectId);
|
|
30
|
+
return data?.account_id;
|
|
42
31
|
}
|
|
43
32
|
/**
|
|
44
33
|
* A project's icon — the emoji XOR the named glyph — read off the SAME
|
|
45
|
-
*
|
|
46
|
-
* read. No extra fetch, and structurally no way for the name a surface prints
|
|
34
|
+
* bare project row `useProjectName` and `useProjectAccountId` read. No extra fetch, and structurally no way for the name a surface prints
|
|
47
35
|
* and the icon it draws to come from two caches that have diverged.
|
|
48
36
|
*
|
|
49
37
|
* The two fields are returned under their STORED names (`icon`, `icon_glyph`),
|
|
@@ -59,8 +47,7 @@ export function useProjectAccountId(projectId) {
|
|
|
59
47
|
* render. Read its fields; do not put it in a dependency array.
|
|
60
48
|
*/
|
|
61
49
|
export function useProjectIcon(projectId) {
|
|
62
|
-
const { data } =
|
|
63
|
-
const project = data?.project;
|
|
50
|
+
const { data: project } = useProjectRow(projectId);
|
|
64
51
|
if (!project)
|
|
65
52
|
return undefined;
|
|
66
53
|
return { icon: project.icon ?? null, icon_glyph: project.icon_glyph ?? null };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-name.js","sourceRoot":"","sources":["../../src/react/use-project-name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"use-project-name.js","sourceRoot":"","sources":["../../src/react/use-project-name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,SAA6B;IAC1D,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1C,OAAO,IAAI,EAAE,IAAI,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA6B;IAC/D,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1C,OAAO,IAAI,EAAE,UAAU,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAC5B,SAA6B;IAE7B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bare project row: `GET /projects/:id`, cached under `qk.project.summary`.
|
|
3
|
+
* One database read on the server. The project's identity (name, icon,
|
|
4
|
+
* account) and its feature flags come from here, never from the detail:
|
|
5
|
+
* `GET /projects/:id/detail` reads the repository and can take seconds, and a
|
|
6
|
+
* flag gate on it held the project page blank (2026-11-03). Internal: not on
|
|
7
|
+
* the public surface.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useProjectRow(projectId: string | null | undefined, options?: {
|
|
10
|
+
refetchOnWindowFocus?: boolean;
|
|
11
|
+
}): import("@tanstack/react-query").UseQueryResult<import("../index.js").KortixProject, Error>;
|
|
12
|
+
//# sourceMappingURL=use-project-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-row.d.ts","sourceRoot":"","sources":["../../src/react/use-project-row.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAAO,qFASnH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { getProject } from '../core/rest/projects-client/index.js';
|
|
4
|
+
import { contract } from './query-contracts.js';
|
|
5
|
+
import { qk } from './query-keys.js';
|
|
6
|
+
/**
|
|
7
|
+
* The bare project row: `GET /projects/:id`, cached under `qk.project.summary`.
|
|
8
|
+
* One database read on the server. The project's identity (name, icon,
|
|
9
|
+
* account) and its feature flags come from here, never from the detail:
|
|
10
|
+
* `GET /projects/:id/detail` reads the repository and can take seconds, and a
|
|
11
|
+
* flag gate on it held the project page blank (2026-11-03). Internal: not on
|
|
12
|
+
* the public surface.
|
|
13
|
+
*/
|
|
14
|
+
export function useProjectRow(projectId, options = {}) {
|
|
15
|
+
const id = projectId ?? '';
|
|
16
|
+
return useQuery({
|
|
17
|
+
queryKey: qk.project.summary(id),
|
|
18
|
+
queryFn: () => getProject(id),
|
|
19
|
+
enabled: Boolean(projectId),
|
|
20
|
+
...contract('config'),
|
|
21
|
+
...options,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=use-project-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-row.js","sourceRoot":"","sources":["../../src/react/use-project-row.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,SAAoC,EAAE,UAA8C,EAAE;IAClH,MAAM,EAAE,GAAG,SAAS,IAAI,EAAE,CAAC;IAC3B,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;QAC3B,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACrB,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kortix/sdk",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.19",
|
|
4
4
|
"description": "Official Kortix frontend TypeScript SDK — one typed client for the Kortix API. Unifies project/session lifecycle and live agent streaming behind a single ergonomic Session handle, so web, mobile, and white-label apps never touch the raw HTTP API or OpenCode semantics.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Elastic-2.0",
|
|
7
|
-
"homepage": "https://github.com/kortix-ai/
|
|
7
|
+
"homepage": "https://github.com/kortix-ai/CompanyOS/tree/dev/packages/sdk",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/kortix-ai/
|
|
10
|
+
"url": "git+https://github.com/kortix-ai/CompanyOS.git",
|
|
11
11
|
"directory": "packages/sdk"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@kortix/llm-catalog": "0.14.
|
|
22
|
+
"@kortix/llm-catalog": "0.14.19",
|
|
23
23
|
"zustand": "^5.0.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|