@kortix/sdk 0.12.5 → 0.12.6
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/README.md +23 -1
- package/dist/core/client/kortix.d.ts +30 -0
- package/dist/core/client/kortix.d.ts.map +1 -1
- package/dist/core/client/kortix.js +27 -0
- package/dist/core/client/kortix.js.map +1 -1
- package/dist/core/http/api-client.d.ts.map +1 -1
- package/dist/core/http/api-client.js +41 -16
- package/dist/core/http/api-client.js.map +1 -1
- package/dist/core/rest/projects-client/apps.d.ts +216 -0
- package/dist/core/rest/projects-client/apps.d.ts.map +1 -0
- package/dist/core/rest/projects-client/apps.js +105 -0
- package/dist/core/rest/projects-client/apps.js.map +1 -0
- package/dist/core/rest/projects-client/connectors.d.ts +5 -0
- package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
- package/dist/core/rest/projects-client/connectors.js.map +1 -1
- package/dist/core/rest/projects-client/index.d.ts +1 -0
- package/dist/core/rest/projects-client/index.d.ts.map +1 -1
- package/dist/core/rest/projects-client/index.js +1 -0
- package/dist/core/rest/projects-client/index.js.map +1 -1
- package/dist/core/rest/projects-client/projects.d.ts +1 -1
- package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
- package/dist/core/rest/projects-client/projects.js.map +1 -1
- package/dist/kortix.esm.min.js +16 -16
- package/dist/kortix.global.js +16 -16
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +13 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/invalidate-project.d.ts +76 -0
- package/dist/react/invalidate-project.d.ts.map +1 -0
- package/dist/react/invalidate-project.js +72 -0
- package/dist/react/invalidate-project.js.map +1 -0
- package/dist/react/provider-refresh.d.ts.map +1 -1
- package/dist/react/provider-refresh.js +12 -3
- package/dist/react/provider-refresh.js.map +1 -1
- package/dist/react/query-contracts.d.ts +112 -0
- package/dist/react/query-contracts.d.ts.map +1 -0
- package/dist/react/query-contracts.js +100 -0
- package/dist/react/query-contracts.js.map +1 -0
- package/dist/react/query-keys.d.ts +251 -0
- package/dist/react/query-keys.d.ts.map +1 -0
- package/dist/react/query-keys.js +249 -0
- package/dist/react/query-keys.js.map +1 -0
- package/dist/react/session-title-sync.d.ts.map +1 -1
- package/dist/react/session-title-sync.js +14 -4
- package/dist/react/session-title-sync.js.map +1 -1
- package/dist/react/use-admin-accounts.d.ts +85 -0
- package/dist/react/use-admin-accounts.d.ts.map +1 -1
- package/dist/react/use-admin-accounts.js +100 -0
- package/dist/react/use-admin-accounts.js.map +1 -1
- package/dist/react/use-admin-activity-analytics.d.ts +91 -0
- package/dist/react/use-admin-activity-analytics.d.ts.map +1 -0
- package/dist/react/use-admin-activity-analytics.js +83 -0
- package/dist/react/use-admin-activity-analytics.js.map +1 -0
- package/dist/react/use-admin-projects.d.ts +50 -0
- package/dist/react/use-admin-projects.d.ts.map +1 -0
- package/dist/react/use-admin-projects.js +28 -0
- package/dist/react/use-admin-projects.js.map +1 -0
- package/dist/react/use-canonical-opencode-session.d.ts.map +1 -1
- package/dist/react/use-canonical-opencode-session.js +12 -7
- package/dist/react/use-canonical-opencode-session.js.map +1 -1
- package/dist/react/use-gateway-catalog-sync.d.ts.map +1 -1
- package/dist/react/use-gateway-catalog-sync.js +5 -2
- package/dist/react/use-gateway-catalog-sync.js.map +1 -1
- package/dist/react/use-model-defaults.d.ts.map +1 -1
- package/dist/react/use-model-defaults.js +3 -1
- package/dist/react/use-model-defaults.js.map +1 -1
- package/dist/react/use-model-enablement.d.ts.map +1 -1
- package/dist/react/use-model-enablement.js +6 -2
- package/dist/react/use-model-enablement.js.map +1 -1
- package/dist/react/use-opencode-events/handle-event.d.ts +6 -0
- package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -1
- package/dist/react/use-opencode-events/handle-event.js +3 -3
- package/dist/react/use-opencode-events/handle-event.js.map +1 -1
- package/dist/react/use-opencode-events/helpers.d.ts +27 -1
- package/dist/react/use-opencode-events/helpers.d.ts.map +1 -1
- package/dist/react/use-opencode-events/helpers.js +31 -6
- package/dist/react/use-opencode-events/helpers.js.map +1 -1
- package/dist/react/use-opencode-events/index.d.ts.map +1 -1
- package/dist/react/use-opencode-events/index.js +8 -0
- package/dist/react/use-opencode-events/index.js.map +1 -1
- package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -1
- package/dist/react/use-opencode-sessions/agents.js +10 -1
- package/dist/react/use-opencode-sessions/agents.js.map +1 -1
- package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -1
- package/dist/react/use-opencode-sessions/providers.js +9 -2
- package/dist/react/use-opencode-sessions/providers.js.map +1 -1
- package/dist/react/use-project-apps.d.ts +410 -0
- package/dist/react/use-project-apps.d.ts.map +1 -0
- package/dist/react/use-project-apps.js +98 -0
- package/dist/react/use-project-apps.js.map +1 -0
- package/dist/react/use-project-config.d.ts +7 -0
- package/dist/react/use-project-config.d.ts.map +1 -1
- package/dist/react/use-project-config.js +14 -4
- package/dist/react/use-project-config.js.map +1 -1
- package/dist/react/use-project-models.d.ts.map +1 -1
- package/dist/react/use-project-models.js +8 -2
- package/dist/react/use-project-models.js.map +1 -1
- package/dist/react/use-project-name.d.ts +23 -0
- package/dist/react/use-project-name.d.ts.map +1 -0
- package/dist/react/use-project-name.js +44 -0
- package/dist/react/use-project-name.js.map +1 -0
- package/dist/react/use-project-secrets.d.ts +5 -2
- package/dist/react/use-project-secrets.d.ts.map +1 -1
- package/dist/react/use-project-secrets.js +8 -2
- package/dist/react/use-project-secrets.js.map +1 -1
- package/dist/react/use-project-session.d.ts +40 -0
- package/dist/react/use-project-session.d.ts.map +1 -0
- package/dist/react/use-project-session.js +49 -0
- package/dist/react/use-project-session.js.map +1 -0
- package/dist/react/use-project-triggers.d.ts +4 -2
- package/dist/react/use-project-triggers.d.ts.map +1 -1
- package/dist/react/use-project-triggers.js +7 -2
- package/dist/react/use-project-triggers.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
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
|
+
/**
|
|
7
|
+
* The ONLY way to read a project's name.
|
|
8
|
+
*
|
|
9
|
+
* The two-titles bug was not an invalidation gap, it was two sources for one
|
|
10
|
+
* fact: `project-switcher.tsx` read `activeProject?.name` off the projects
|
|
11
|
+
* LIST and fell back to the detail, while `project-home.tsx` read the detail
|
|
12
|
+
* alone. Any divergence between the two caches rendered as two different names
|
|
13
|
+
* on one screen.
|
|
14
|
+
*
|
|
15
|
+
* One accessor makes that structurally impossible rather than merely currently
|
|
16
|
+
* invalidated. Do not reintroduce a `??` fallback to another source here.
|
|
17
|
+
*/
|
|
18
|
+
export function useProjectName(projectId) {
|
|
19
|
+
const { data } = useQuery({
|
|
20
|
+
queryKey: qk.project.detail(projectId ?? ''),
|
|
21
|
+
queryFn: () => getProjectDetail(projectId),
|
|
22
|
+
enabled: Boolean(projectId),
|
|
23
|
+
...contract('config'),
|
|
24
|
+
});
|
|
25
|
+
return data?.project?.name;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The owning account id, read off the SAME `qk.project.detail(id)` entry
|
|
29
|
+
* `useProjectName` reads — every capability surface already mounts that
|
|
30
|
+
* observer, so this shares the cache instead of adding a fetch. Previously
|
|
31
|
+
* lived in `apps/web`'s `project-detail-query.ts` as a host-local hook; moved
|
|
32
|
+
* here because `qk.project.detail` + `contract('config')` is SDK-owned
|
|
33
|
+
* wiring, not something a host should hand-roll a second time.
|
|
34
|
+
*/
|
|
35
|
+
export function useProjectAccountId(projectId) {
|
|
36
|
+
const { data } = useQuery({
|
|
37
|
+
queryKey: qk.project.detail(projectId ?? ''),
|
|
38
|
+
queryFn: () => getProjectDetail(projectId),
|
|
39
|
+
enabled: Boolean(projectId),
|
|
40
|
+
...contract('config'),
|
|
41
|
+
});
|
|
42
|
+
return data?.project?.account_id;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=use-project-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-name.js","sourceRoot":"","sources":["../../src/react/use-project-name.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,SAA6B;IAC1D,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAmB,CAAC;QACpD,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;QAC3B,GAAG,QAAQ,CAAC,QAAQ,CAAC;KACtB,CAAC,CAAC;IACH,OAAO,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA6B;IAC/D,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAmB,CAAC;QACpD,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;QAC3B,GAAG,QAAQ,CAAC,QAAQ,CAAC;KACtB,CAAC,CAAC;IACH,OAAO,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC;AACnC,CAAC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { setPersonalProjectSecret, type ProjectSecretsResponse } from '../core/rest/projects-client/index.js';
|
|
2
2
|
/** Stable query-key factory — reuse this to read/invalidate the same cache
|
|
3
3
|
* entry `useProjectSecrets` populates (e.g. from a settings page shell that
|
|
4
|
-
* doesn't itself call the hook).
|
|
5
|
-
|
|
4
|
+
* doesn't itself call the hook). Delegates to `qk.project.secrets` — the
|
|
5
|
+
* SAME entry every other `listProjectSecrets` reader in `apps/web` shares
|
|
6
|
+
* (Customize secrets view, agents view, connected-providers, the LLM
|
|
7
|
+
* provider connect forms). */
|
|
8
|
+
export declare const projectSecretsKey: (projectId: string | null | undefined) => readonly ["kx", "project", string, "secrets"];
|
|
6
9
|
/**
|
|
7
10
|
* Project secrets — list + the mutations a settings screen needs (shared
|
|
8
11
|
* upsert/remove, personal-override set/remove). Thin React Query binding
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-secrets.d.ts","sourceRoot":"","sources":["../../src/react/use-project-secrets.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,wBAAwB,EAExB,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-project-secrets.d.ts","sourceRoot":"","sources":["../../src/react/use-project-secrets.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,wBAAwB,EAExB,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AAItC;;;;;+BAK+B;AAC/B,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,GAAG,IAAI,GAAG,SAAS,kDACjC,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;;;;;;;;;;;;cAyBvC,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA7D,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA7D,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA7D,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA7D,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAA7D,MAAM;eAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3F"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { deletePersonalProjectSecret, deleteProjectSecret, listProjectSecrets, setPersonalProjectSecret, upsertProjectSecret, } from '../core/rest/projects-client/index.js';
|
|
4
|
+
import { contract } from './query-contracts.js';
|
|
5
|
+
import { qk } from './query-keys.js';
|
|
4
6
|
/** Stable query-key factory — reuse this to read/invalidate the same cache
|
|
5
7
|
* entry `useProjectSecrets` populates (e.g. from a settings page shell that
|
|
6
|
-
* doesn't itself call the hook).
|
|
7
|
-
|
|
8
|
+
* doesn't itself call the hook). Delegates to `qk.project.secrets` — the
|
|
9
|
+
* SAME entry every other `listProjectSecrets` reader in `apps/web` shares
|
|
10
|
+
* (Customize secrets view, agents view, connected-providers, the LLM
|
|
11
|
+
* provider connect forms). */
|
|
12
|
+
export const projectSecretsKey = (projectId) => qk.project.secrets(projectId ?? '');
|
|
8
13
|
/**
|
|
9
14
|
* Project secrets — list + the mutations a settings screen needs (shared
|
|
10
15
|
* upsert/remove, personal-override set/remove). Thin React Query binding
|
|
@@ -18,6 +23,7 @@ export function useProjectSecrets(projectId) {
|
|
|
18
23
|
queryKey,
|
|
19
24
|
queryFn: () => listProjectSecrets(projectId),
|
|
20
25
|
enabled: !!projectId,
|
|
26
|
+
...contract('config'),
|
|
21
27
|
});
|
|
22
28
|
const invalidate = () => queryClient.invalidateQueries({ queryKey });
|
|
23
29
|
const upsert = useMutation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-secrets.js","sourceRoot":"","sources":["../../src/react/use-project-secrets.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-project-secrets.js","sourceRoot":"","sources":["../../src/react/use-project-secrets.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;+BAK+B;AAC/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAoC,EAAE,EAAE,CACxE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MA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CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type ProjectSession } from '../core/rest/projects-client/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The ONLY way to read one Kortix session row.
|
|
4
|
+
*
|
|
5
|
+
* `qk.project.session(projectId, sessionId)` had three independent readers,
|
|
6
|
+
* and the migration that unified their KEY left their CONTRACTS apart — the
|
|
7
|
+
* narrower half of the same bug:
|
|
8
|
+
*
|
|
9
|
+
* use-canonical-opencode-session.ts staleTime: 10_000, showErrors: false
|
|
10
|
+
* session-files-panel.tsx contract('inventory'), default errors
|
|
11
|
+
* session-changes-shared.tsx contract('inventory'), default errors
|
|
12
|
+
*
|
|
13
|
+
* Both halves were mount-order dependent. `staleTime` is per-OBSERVER, so how
|
|
14
|
+
* long the row stayed fresh depended on which surface happened to be mounted.
|
|
15
|
+
* Worse, `queryFn` is per-ENTRY — TanStack keeps exactly one per cached query
|
|
16
|
+
* and the first observer to mount installs it — so whether a failed read
|
|
17
|
+
* raised a toast depended on whether the session page or the Changes panel
|
|
18
|
+
* got there first.
|
|
19
|
+
*
|
|
20
|
+
* `showErrors: false` wins for every reader, deliberately. Each one's failure
|
|
21
|
+
* path is already a silent, correct fallback that the UI never surfaces:
|
|
22
|
+
* `resolveSessionPin` treats a missing pin as "still resolving" and the two
|
|
23
|
+
* panels fall back to `base_ref = 'main'`. Nothing renders an error state or
|
|
24
|
+
* offers a retry, so a toast is noise the user cannot act on. It is also
|
|
25
|
+
* exactly the wrong moment for one — the session page issues this read during
|
|
26
|
+
* boot and in the idle-stopped window, where a transient miss is expected and
|
|
27
|
+
* self-heals. And `showErrors` is a client-side PRESENTATION flag: it does not
|
|
28
|
+
* change the request or the response, so it cannot justify separate keys the
|
|
29
|
+
* way `scope` does for `qk.project.sessions` (see `query-keys.ts`). One
|
|
30
|
+
* entity, one entry, one fetcher.
|
|
31
|
+
*
|
|
32
|
+
* `enabled` stays per-call-site on purpose. It decides whether THIS surface
|
|
33
|
+
* subscribes, not what the shared entry holds, so surfaces are free to
|
|
34
|
+
* disagree — the session page skips the read entirely when `POST /start`
|
|
35
|
+
* already handed it the pin.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useProjectSession(projectId: string | undefined, sessionId: string | undefined, options?: {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
}): import("@tanstack/react-query").UseQueryResult<NoInfer<ProjectSession>, Error>;
|
|
40
|
+
//# sourceMappingURL=use-project-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-session.d.ts","sourceRoot":"","sources":["../../src/react/use-project-session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,kFAShC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { getProjectSession } from '../core/rest/projects-client/index.js';
|
|
4
|
+
import { contract } from './query-contracts.js';
|
|
5
|
+
import { qk } from './query-keys.js';
|
|
6
|
+
/**
|
|
7
|
+
* The ONLY way to read one Kortix session row.
|
|
8
|
+
*
|
|
9
|
+
* `qk.project.session(projectId, sessionId)` had three independent readers,
|
|
10
|
+
* and the migration that unified their KEY left their CONTRACTS apart — the
|
|
11
|
+
* narrower half of the same bug:
|
|
12
|
+
*
|
|
13
|
+
* use-canonical-opencode-session.ts staleTime: 10_000, showErrors: false
|
|
14
|
+
* session-files-panel.tsx contract('inventory'), default errors
|
|
15
|
+
* session-changes-shared.tsx contract('inventory'), default errors
|
|
16
|
+
*
|
|
17
|
+
* Both halves were mount-order dependent. `staleTime` is per-OBSERVER, so how
|
|
18
|
+
* long the row stayed fresh depended on which surface happened to be mounted.
|
|
19
|
+
* Worse, `queryFn` is per-ENTRY — TanStack keeps exactly one per cached query
|
|
20
|
+
* and the first observer to mount installs it — so whether a failed read
|
|
21
|
+
* raised a toast depended on whether the session page or the Changes panel
|
|
22
|
+
* got there first.
|
|
23
|
+
*
|
|
24
|
+
* `showErrors: false` wins for every reader, deliberately. Each one's failure
|
|
25
|
+
* path is already a silent, correct fallback that the UI never surfaces:
|
|
26
|
+
* `resolveSessionPin` treats a missing pin as "still resolving" and the two
|
|
27
|
+
* panels fall back to `base_ref = 'main'`. Nothing renders an error state or
|
|
28
|
+
* offers a retry, so a toast is noise the user cannot act on. It is also
|
|
29
|
+
* exactly the wrong moment for one — the session page issues this read during
|
|
30
|
+
* boot and in the idle-stopped window, where a transient miss is expected and
|
|
31
|
+
* self-heals. And `showErrors` is a client-side PRESENTATION flag: it does not
|
|
32
|
+
* change the request or the response, so it cannot justify separate keys the
|
|
33
|
+
* way `scope` does for `qk.project.sessions` (see `query-keys.ts`). One
|
|
34
|
+
* entity, one entry, one fetcher.
|
|
35
|
+
*
|
|
36
|
+
* `enabled` stays per-call-site on purpose. It decides whether THIS surface
|
|
37
|
+
* subscribes, not what the shared entry holds, so surfaces are free to
|
|
38
|
+
* disagree — the session page skips the read entirely when `POST /start`
|
|
39
|
+
* already handed it the pin.
|
|
40
|
+
*/
|
|
41
|
+
export function useProjectSession(projectId, sessionId, options) {
|
|
42
|
+
return useQuery({
|
|
43
|
+
queryKey: qk.project.session(projectId ?? '', sessionId ?? ''),
|
|
44
|
+
queryFn: () => getProjectSession(projectId, sessionId, { showErrors: false }),
|
|
45
|
+
enabled: Boolean(projectId) && Boolean(sessionId) && (options?.enabled ?? true),
|
|
46
|
+
...contract('inventory'),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=use-project-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-session.js","sourceRoot":"","sources":["../../src/react/use-project-session.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAuB,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAA6B,EAC7B,SAA6B,EAC7B,OAA+B;IAE/B,OAAO,QAAQ,CAAiB;QAC9B,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,EAAE,SAAS,IAAI,EAAE,CAAC;QAC9D,OAAO,EAAE,GAAG,EAAE,CACZ,iBAAiB,CAAC,SAAmB,EAAE,SAAmB,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACpF,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;QAC/E,GAAG,QAAQ,CAAC,WAAW,CAAC;KACzB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { updateProjectTrigger, type ProjectTriggerListing } from '../core/rest/projects-client/index.js';
|
|
2
2
|
/** Stable query-key factory — reuse to read/invalidate the same cache entry
|
|
3
|
-
* `useProjectTriggers` populates.
|
|
4
|
-
|
|
3
|
+
* `useProjectTriggers` populates. Delegates to `qk.project.triggers` — the
|
|
4
|
+
* SAME entry the Customize settings pause switch and the schedule/triggers
|
|
5
|
+
* view build directly via `qk.project.triggers(id)` too. */
|
|
6
|
+
export declare const projectTriggersKey: (projectId: string | null | undefined) => readonly ["kx", "project", string, "triggers"];
|
|
5
7
|
/**
|
|
6
8
|
* Project triggers (cron/webhook, file-defined in the repo manifest) — list +
|
|
7
9
|
* create/update/remove/fire. Thin React Query binding over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-triggers.d.ts","sourceRoot":"","sources":["../../src/react/use-project-triggers.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,oBAAoB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use-project-triggers.d.ts","sourceRoot":"","sources":["../../src/react/use-project-triggers.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,oBAAoB,EACpB,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;AAItC;;;6DAG6D;AAC7D,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,GAAG,IAAI,GAAG,SAAS,mDACjC,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;;;cAoBxC,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzD,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzD,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzD,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzD,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAzD,MAAM;eAAS,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBvF"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { createProjectTrigger, deleteProjectTrigger, fireProjectTrigger, listProjectTriggers, updateProjectTrigger, } from '../core/rest/projects-client/index.js';
|
|
4
|
+
import { contract } from './query-contracts.js';
|
|
5
|
+
import { qk } from './query-keys.js';
|
|
4
6
|
/** Stable query-key factory — reuse to read/invalidate the same cache entry
|
|
5
|
-
* `useProjectTriggers` populates.
|
|
6
|
-
|
|
7
|
+
* `useProjectTriggers` populates. Delegates to `qk.project.triggers` — the
|
|
8
|
+
* SAME entry the Customize settings pause switch and the schedule/triggers
|
|
9
|
+
* view build directly via `qk.project.triggers(id)` too. */
|
|
10
|
+
export const projectTriggersKey = (projectId) => qk.project.triggers(projectId ?? '');
|
|
7
11
|
/**
|
|
8
12
|
* Project triggers (cron/webhook, file-defined in the repo manifest) — list +
|
|
9
13
|
* create/update/remove/fire. Thin React Query binding over
|
|
@@ -17,6 +21,7 @@ export function useProjectTriggers(projectId) {
|
|
|
17
21
|
queryKey,
|
|
18
22
|
queryFn: () => listProjectTriggers(projectId),
|
|
19
23
|
enabled: !!projectId,
|
|
24
|
+
...contract('config'),
|
|
20
25
|
});
|
|
21
26
|
const invalidate = () => queryClient.invalidateQueries({ queryKey });
|
|
22
27
|
const create = useMutation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-triggers.js","sourceRoot":"","sources":["../../src/react/use-project-triggers.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB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AM,MAAM,GAAG,WAAW,CAAC;QACzB,UAAU,EAAE,CAAC,IAAyE,EAAE,EAAE,CACxF,oBAAoB,CAAC,SAAmB,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;QAClE,SAAS,EAAE,UAAU;KACtB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,WAAW,CAAC;QACzB,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,oBAAoB,CAAC,SAAmB,EAAE,IAAI,CAAC;QAC7E,SAAS,EAAE,UAAU;KACtB,CAAC,CAAC;IAEH,yEAAyE;IACzE,wEAAwE;IACxE,6BAA6B;IAC7B,MAAM,IAAI,GAAG,WAAW,CAAC;QACvB,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,kBAAkB,CAAC,SAAmB,EAAE,IAAI,CAAC;KAC5E,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kortix/sdk",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "Official Kortix frontend TypeScript SDK — one typed client for the Kortix agent platform. 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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kortix/llm-catalog": "0.12.
|
|
23
|
+
"@kortix/llm-catalog": "0.12.6",
|
|
24
24
|
"@opencode-ai/sdk": "1.17.11",
|
|
25
25
|
"zustand": "^5.0.3"
|
|
26
26
|
},
|