@w6w/embed 0.2.1 → 0.2.11
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/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
- package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
- package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
- package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
- package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
- package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
- package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
- package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
- package/dist/ModelRoutesManager-BGESQahw.js +345 -0
- package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
- package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
- package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
- package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
- package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
- package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
- package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
- package/dist/chrome/ConfirmModal.d.ts +4 -1
- package/dist/chrome/workspace.d.ts +4 -0
- package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
- package/dist/coerce-input-DttlcSdO.js.map +1 -0
- package/dist/connections-D7cgXhDS.js +119 -0
- package/dist/connections-D7cgXhDS.js.map +1 -0
- package/dist/credentials-DaQU3Ca_.js +171 -0
- package/dist/credentials-DaQU3Ca_.js.map +1 -0
- package/dist/document-sources-UCwe8x77.js +91 -0
- package/dist/document-sources-UCwe8x77.js.map +1 -0
- package/dist/draft.mjs +1 -1
- package/dist/editor/BindingBanner.d.ts +13 -0
- package/dist/editor/CallableEditorFrame.d.ts +7 -0
- package/dist/editor/EndpointCards.d.ts +4 -1
- package/dist/editor/PublishControl.d.ts +19 -0
- package/dist/editor/TargetSelector.d.ts +15 -0
- package/dist/editor/TargetSelector.types.d.ts +2 -0
- package/dist/editor/definition.d.ts +2 -0
- package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
- package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
- package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
- package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
- package/dist/editor.mjs +1 -1
- package/dist/editors.mjs +768 -621
- package/dist/editors.mjs.map +1 -1
- package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
- package/dist/endpoints-DSRo1Lc5.js.map +1 -0
- package/dist/fields-DvS8XZFc.js +21 -0
- package/dist/fields-DvS8XZFc.js.map +1 -0
- package/dist/forms/ModelBudgetsManager.d.ts +9 -0
- package/dist/forms/ModelRoutesManager.d.ts +14 -0
- package/dist/forms.d.ts +4 -0
- package/dist/forms.mjs +611 -212
- package/dist/forms.mjs.map +1 -1
- package/dist/index.mjs +119 -112
- package/dist/index.mjs.map +1 -1
- package/dist/lib/binding-problems.d.ts +38 -0
- package/dist/lib/code-rail.d.ts +4 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/invoke-error.d.ts +1 -0
- package/dist/lib/sdk-snippets.d.ts +1 -1
- package/dist/lib/target-fields.d.ts +8 -0
- package/dist/lib/trigger-preview.d.ts +1 -0
- package/dist/lib/workflow-live-run.d.ts +9 -2
- package/dist/lib/workflow-nodes.d.ts +5 -0
- package/dist/lib/workflow-validity.d.ts +1 -0
- package/dist/lib.mjs +72 -70
- package/dist/lists/ConnectionDependents.d.ts +31 -0
- package/dist/lists/ConnectionDetail.d.ts +4 -1
- package/dist/lists/ConnectionList.d.ts +4 -1
- package/dist/lists/CredentialDetail.d.ts +15 -0
- package/dist/lists/CredentialList.d.ts +14 -0
- package/dist/lists/ModelCatalog.d.ts +12 -0
- package/dist/lists/ModelUsage.d.ts +12 -0
- package/dist/lists.d.ts +8 -0
- package/dist/lists.mjs +1322 -604
- package/dist/lists.mjs.map +1 -1
- package/dist/models-bAayQPJ_.js +270 -0
- package/dist/models-bAayQPJ_.js.map +1 -0
- package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
- package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
- package/dist/rail.mjs +4 -4
- package/dist/repos/agents-studio-agents.d.ts +52 -0
- package/dist/repos/agents-studio-assets.d.ts +68 -0
- package/dist/repos/connections.d.ts +30 -12
- package/dist/repos/credentials.d.ts +83 -0
- package/dist/repos/endpoints.d.ts +9 -3
- package/dist/repos/fields.d.ts +34 -0
- package/dist/repos/functions.d.ts +7 -5
- package/dist/repos/index.d.ts +5 -0
- package/dist/repos/models.d.ts +289 -0
- package/dist/repos.mjs +613 -176
- package/dist/repos.mjs.map +1 -1
- package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
- package/dist/slug-BVdgiP_L.js.map +1 -0
- package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
- package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
- package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
- package/dist/spec-import-CW6R_Wk1.js.map +1 -0
- package/dist/theme-context-E2ZhlXDX.js +6 -0
- package/dist/theme-context-E2ZhlXDX.js.map +1 -0
- package/dist/theme-context.d.ts +2 -0
- package/dist/trigger-preview-DKxfjzUY.js +145 -0
- package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
- package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
- package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
- package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
- package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
- package/package.json +1 -1
- package/src/styles.css +2 -6
- package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
- package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
- package/dist/coerce-input-BicYr7nc.js.map +0 -1
- package/dist/connections-CjjYeRqb.js +0 -78
- package/dist/connections-CjjYeRqb.js.map +0 -1
- package/dist/document-sources-C0grrtdq.js +0 -86
- package/dist/document-sources-C0grrtdq.js.map +0 -1
- package/dist/editor-tools-RxmY5iyi.js.map +0 -1
- package/dist/endpoints-B2ynbZo-.js.map +0 -1
- package/dist/slug-C4ktDPdy.js.map +0 -1
- package/dist/spec-import-CjmxyZDR.js.map +0 -1
- package/dist/trigger-preview-VPkrryDl.js +0 -120
- package/dist/trigger-preview-VPkrryDl.js.map +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { W6WClient } from '@w6w/sdk';
|
|
3
|
+
import { CredentialDependents, CredentialListFilter, CredentialSummary, CredentialTestResult } from '@w6w/sdk/console';
|
|
4
|
+
export type { CredentialDependents, CredentialListFilter, CredentialSummary, CredentialTestResult, } from '@w6w/sdk/console';
|
|
5
|
+
export declare const credentialsKey: readonly ["credentials"];
|
|
6
|
+
export declare const credentialKey: (id: string) => readonly ["credential", string];
|
|
7
|
+
export declare const credentialDependentsKey: (id: string) => readonly ["credential-dependents", string];
|
|
8
|
+
/**
|
|
9
|
+
* A credential write (rotate, enable/disable, delete) changes what every connection on it
|
|
10
|
+
* reports, so the credential keys AND every cached connection (single and per-app) go stale.
|
|
11
|
+
*/
|
|
12
|
+
export declare function invalidateAfterCredentialWrite(qc: QueryClient, id: string): void;
|
|
13
|
+
export declare function listCredentials(client: W6WClient, filter?: CredentialListFilter): Promise<CredentialSummary[]>;
|
|
14
|
+
export declare function getCredential(client: W6WClient, id: string): Promise<CredentialSummary>;
|
|
15
|
+
export declare function createCredential(client: W6WClient, body: {
|
|
16
|
+
name: string;
|
|
17
|
+
contract: string;
|
|
18
|
+
source: Record<string, unknown>;
|
|
19
|
+
}): Promise<CredentialSummary>;
|
|
20
|
+
/** Rename. */
|
|
21
|
+
export declare function updateCredential(client: W6WClient, id: string, body: {
|
|
22
|
+
name: string;
|
|
23
|
+
}): Promise<CredentialSummary>;
|
|
24
|
+
export declare function rotateCredential(client: W6WClient, id: string, body: {
|
|
25
|
+
source: Record<string, unknown>;
|
|
26
|
+
}): Promise<CredentialSummary>;
|
|
27
|
+
export declare function setCredentialStatus(client: W6WClient, id: string, status: "active" | "disabled"): Promise<CredentialSummary>;
|
|
28
|
+
export declare function testCredential(client: W6WClient, id: string): Promise<CredentialTestResult>;
|
|
29
|
+
export declare function getCredentialDependents(client: W6WClient, id: string): Promise<CredentialDependents>;
|
|
30
|
+
export type DeleteCredentialResult = {
|
|
31
|
+
ok: true;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
dependents: CredentialDependents;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Delete. A 409 `credential_in_use` is data — `{ ok: false, dependents }` — not a thrown error;
|
|
38
|
+
* every other failure rejects. There is no `force`: a credential in use is never deleted.
|
|
39
|
+
* Wire (RECONCILE R-11): `{ error: { code, message, dependents: { connections } } }`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function deleteCredential(client: W6WClient, id: string): Promise<DeleteCredentialResult>;
|
|
42
|
+
export declare function useCredentialsQuery(filter?: CredentialListFilter): import('@tanstack/react-query').UseQueryResult<NoInfer<CredentialSummary[]>, Error>;
|
|
43
|
+
export declare function useCredentialQuery(id: string): import('@tanstack/react-query').UseQueryResult<NoInfer<CredentialSummary>, Error>;
|
|
44
|
+
export declare function useCredentialDependentsQuery(id: string, enabled?: boolean): import('@tanstack/react-query').UseQueryResult<NoInfer<CredentialDependents>, Error>;
|
|
45
|
+
export declare function useCreateCredentialMutation(): import('@tanstack/react-query').UseMutationResult<CredentialSummary, Error, {
|
|
46
|
+
name: string;
|
|
47
|
+
contract: string;
|
|
48
|
+
source: Record<string, unknown>;
|
|
49
|
+
}, unknown>;
|
|
50
|
+
/** Rename touches only the credential keys: no connection's state changes. */
|
|
51
|
+
export declare function useUpdateCredentialMutation(id: string): import('@tanstack/react-query').UseMutationResult<CredentialSummary, Error, {
|
|
52
|
+
name: string;
|
|
53
|
+
}, unknown>;
|
|
54
|
+
export declare function useRotateCredentialMutation(id: string): import('@tanstack/react-query').UseMutationResult<CredentialSummary, Error, {
|
|
55
|
+
source: Record<string, unknown>;
|
|
56
|
+
}, unknown>;
|
|
57
|
+
export declare function useSetCredentialStatusMutation(id: string): import('@tanstack/react-query').UseMutationResult<CredentialSummary, Error, "active" | "disabled", unknown>;
|
|
58
|
+
export declare function useTestCredentialMutation(id: string): import('@tanstack/react-query').UseMutationResult<CredentialTestResult, Error, void, unknown>;
|
|
59
|
+
export declare function useDeleteCredentialMutation(): import('@tanstack/react-query').UseMutationResult<DeleteCredentialResult, Error, string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* The eight optional `W6WApi` credential methods over `client` (this module may not import
|
|
62
|
+
* `@w6w/ui`, so the signatures are checked where they are spread into a `W6WApi`: Studio's
|
|
63
|
+
* facade, and `W6WEmbedProvider`'s bridge). `deleteCredential` rejects on a
|
|
64
|
+
* 409 with the response body attached as `.body` (as `withApiErrorBody` does in the react adapter).
|
|
65
|
+
*/
|
|
66
|
+
export declare function credentialUiMethods(client: W6WClient): {
|
|
67
|
+
listCredentials: (filter?: CredentialListFilter) => Promise<CredentialSummary[]>;
|
|
68
|
+
createCredential: (body: {
|
|
69
|
+
name: string;
|
|
70
|
+
contract: string;
|
|
71
|
+
source: Record<string, unknown>;
|
|
72
|
+
}) => Promise<CredentialSummary>;
|
|
73
|
+
getCredential: (id: string) => Promise<CredentialSummary>;
|
|
74
|
+
rotateCredential: (id: string, body: {
|
|
75
|
+
source: Record<string, unknown>;
|
|
76
|
+
}) => Promise<CredentialSummary>;
|
|
77
|
+
setCredentialStatus: (id: string, status: "active" | "disabled") => Promise<CredentialSummary>;
|
|
78
|
+
testCredential: (id: string) => Promise<CredentialTestResult>;
|
|
79
|
+
credentialDependents: (id: string) => Promise<CredentialDependents>;
|
|
80
|
+
deleteCredential: (id: string) => Promise<void>;
|
|
81
|
+
};
|
|
82
|
+
/** Fills ONLY the credential methods that are not functions on `adapter`; keeps the rest. */
|
|
83
|
+
export declare function withCredentialMethods<T extends object>(adapter: T, client: W6WClient): T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { W6WClient } from '@w6w/sdk';
|
|
2
|
-
import { EndpointDef as SdkEndpointDef, EndpointSummary as SdkEndpointSummary, EndpointTarget as SdkEndpointTarget } from '@w6w/sdk/console';
|
|
2
|
+
import { EndpointInvokeResult, EndpointDef as SdkEndpointDef, EndpointSummary as SdkEndpointSummary, EndpointTarget as SdkEndpointTarget } from '@w6w/sdk/console';
|
|
3
3
|
export type { ActionTarget, CallableRef, CallableOnError, ErrorHandlerTarget, EndpointAuthMode, EndpointInput, EndpointInvokeResult, EndpointSecurity, EndpointTarget, ErrorReroute, Exposure, RetryPolicy, } from '@w6w/sdk/console';
|
|
4
4
|
export { SECRET_MASK } from '@w6w/sdk/console';
|
|
5
5
|
/** An Endpoint's OWN target: the alias-only `endpoint` arm excluded, mirroring the
|
|
@@ -108,8 +108,14 @@ export declare function useGuardedSaveEndpointMutation(): import('@tanstack/reac
|
|
|
108
108
|
definition: unknown;
|
|
109
109
|
ifUnmodifiedSince: string | null;
|
|
110
110
|
}, unknown>;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
/**
|
|
112
|
+
* `POST /endpoints/:id/invoke` through `client.request` (D2). Answers `{ kind, output }`, or a 202
|
|
113
|
+
* `{ kind: "workflow", runId }` (success). `allowUnpublished: true` only when the caller opts in.
|
|
114
|
+
*/
|
|
115
|
+
export declare function invokeEndpoint(client: W6WClient, id: string, input: Record<string, unknown>, opts?: {
|
|
116
|
+
allowUnpublished?: boolean;
|
|
117
|
+
}): Promise<EndpointInvokeResult>;
|
|
118
|
+
export declare function useInvokeEndpointMutation(): import('@tanstack/react-query').UseMutationResult<EndpointInvokeResult, Error, {
|
|
113
119
|
id: string;
|
|
114
120
|
input: Record<string, unknown>;
|
|
115
121
|
}, unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { W6WClient } from '@w6w/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Dynamic-field resolution — `POST /apps/:id/actions/:key/fields` over `client.request()`.
|
|
4
|
+
* A 424 (the vendor lookup failed) becomes a per-field error result so one bad lookup does not
|
|
5
|
+
* blank the form; every other failure (400/403/404/network/abort) rethrows for the ui to handle.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Structural mirror of ui's `W6WApi.resolveActionFields` shapes (this barrel may not import
|
|
9
|
+
* `@w6w/ui`); the facade/UiBridge assignment typechecks against W6WApi structurally.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResolveActionFieldsBody {
|
|
12
|
+
connectionId: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
reason: "init" | "change";
|
|
15
|
+
form: Record<string, unknown>;
|
|
16
|
+
previous?: Record<string, unknown>;
|
|
17
|
+
changed?: string[];
|
|
18
|
+
fields: string[];
|
|
19
|
+
unresolved: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ResolveActionFieldsResult {
|
|
22
|
+
fields: Record<string, {
|
|
23
|
+
options?: {
|
|
24
|
+
value: string | number;
|
|
25
|
+
label: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
}[];
|
|
28
|
+
error?: string;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export interface ResolveActionFieldsOpts {
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export declare function resolveActionFields(client: W6WClient, appId: string, actionKey: string, body: ResolveActionFieldsBody, opts?: ResolveActionFieldsOpts): Promise<ResolveActionFieldsResult>;
|
|
@@ -58,12 +58,14 @@ export interface FunctionInvokeResult {
|
|
|
58
58
|
durationMs?: number;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* `
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* `POST /functions/:id/invoke` through the `client.request` escape hatch (D2: no wrappers change).
|
|
62
|
+
* The route answers the invocation frame `{ kind: "function", output, invocationId, status,
|
|
63
|
+
* durationMs }`. `allowUnpublished: true` is sent ONLY when the caller opts in (the editor's Test
|
|
64
|
+
* invoke hook); every other caller keeps the publish gate, so the key is absent otherwise.
|
|
65
65
|
*/
|
|
66
|
-
export declare function invokeFunction(client: W6WClient, id: string, inputs: Record<string, unknown
|
|
66
|
+
export declare function invokeFunction(client: W6WClient, id: string, inputs: Record<string, unknown>, opts?: {
|
|
67
|
+
allowUnpublished?: boolean;
|
|
68
|
+
}): Promise<FunctionInvokeResult>;
|
|
67
69
|
export declare function useInvokeFunctionMutation(): import('@tanstack/react-query').UseMutationResult<FunctionInvokeResult, Error, {
|
|
68
70
|
id: string;
|
|
69
71
|
inputs: Record<string, unknown>;
|
package/dist/repos/index.d.ts
CHANGED
|
@@ -26,7 +26,12 @@ export * from './endpoints.ts';
|
|
|
26
26
|
export * from './spec-export.ts';
|
|
27
27
|
export * from './apps.ts';
|
|
28
28
|
export * from './connections.ts';
|
|
29
|
+
export * from './credentials.ts';
|
|
29
30
|
export * from './saved-tests.ts';
|
|
30
31
|
export * from './reliability.ts';
|
|
31
32
|
export * from './dashboard.ts';
|
|
32
33
|
export * from './api-calls.ts';
|
|
34
|
+
export * from './models.ts';
|
|
35
|
+
export * from './agents-studio-agents.ts';
|
|
36
|
+
export * from './agents-studio-assets.ts';
|
|
37
|
+
export * from './fields.ts';
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { W6WClient } from '@w6w/sdk';
|
|
2
|
+
export interface ModelRates {
|
|
3
|
+
input?: number;
|
|
4
|
+
output?: number;
|
|
5
|
+
cachedInput?: number;
|
|
6
|
+
cacheWrite?: number;
|
|
7
|
+
perRequest?: number;
|
|
8
|
+
currency?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelRate {
|
|
11
|
+
id: string;
|
|
12
|
+
modelId: string;
|
|
13
|
+
effectiveFrom: string;
|
|
14
|
+
rates: ModelRates;
|
|
15
|
+
source: "seed" | "tenant";
|
|
16
|
+
}
|
|
17
|
+
export interface Model {
|
|
18
|
+
id: string;
|
|
19
|
+
providerAppId: string;
|
|
20
|
+
provider: string;
|
|
21
|
+
nativeId: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
capabilities: unknown;
|
|
24
|
+
limits: {
|
|
25
|
+
maxInputTokens?: number;
|
|
26
|
+
maxOutputTokens?: number;
|
|
27
|
+
};
|
|
28
|
+
status: "active" | "deprecated" | "blocked";
|
|
29
|
+
source: "discovered" | "manual";
|
|
30
|
+
currentRate: ModelRate | null;
|
|
31
|
+
discoveredAt: string | null;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ModelFallback {
|
|
36
|
+
model: string;
|
|
37
|
+
connection: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ModelRoute {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
project: string;
|
|
43
|
+
modelId: string;
|
|
44
|
+
connectionId: string;
|
|
45
|
+
fallbacks: ModelFallback[];
|
|
46
|
+
defaults: Record<string, unknown>;
|
|
47
|
+
status: "active" | "broken";
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ModelRouteInput {
|
|
52
|
+
name: string;
|
|
53
|
+
model: string;
|
|
54
|
+
connection: string;
|
|
55
|
+
fallbacks?: ModelFallback[];
|
|
56
|
+
defaults?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export type ModelRoutePatch = Partial<Omit<ModelRouteInput, "name">>;
|
|
59
|
+
export interface ModelBudgetLimits {
|
|
60
|
+
requests?: number;
|
|
61
|
+
tokens?: number;
|
|
62
|
+
costMinor?: number;
|
|
63
|
+
currency?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ModelBudget {
|
|
66
|
+
id: string;
|
|
67
|
+
scopeKind: string;
|
|
68
|
+
scopeId: string | null;
|
|
69
|
+
window: string;
|
|
70
|
+
limits: ModelBudgetLimits;
|
|
71
|
+
onBreach: "block" | "warn";
|
|
72
|
+
}
|
|
73
|
+
export interface ModelBudgetInput {
|
|
74
|
+
scopeKind: string;
|
|
75
|
+
scopeId?: string;
|
|
76
|
+
window: string;
|
|
77
|
+
limits: ModelBudgetLimits;
|
|
78
|
+
onBreach: "block" | "warn";
|
|
79
|
+
}
|
|
80
|
+
export type ModelBudgetPatch = Partial<Omit<ModelBudgetInput, "scopeKind" | "scopeId">>;
|
|
81
|
+
export interface ModelBudgetUsageCounts {
|
|
82
|
+
requests: number;
|
|
83
|
+
tokens: number;
|
|
84
|
+
costMinor: number;
|
|
85
|
+
}
|
|
86
|
+
export interface ModelBudgetUsage {
|
|
87
|
+
budgetId: string;
|
|
88
|
+
window: string;
|
|
89
|
+
windowStart: string;
|
|
90
|
+
limits: ModelBudgetLimits;
|
|
91
|
+
used: ModelBudgetUsageCounts;
|
|
92
|
+
reserved: ModelBudgetUsageCounts;
|
|
93
|
+
}
|
|
94
|
+
export interface ModelCost {
|
|
95
|
+
currency: string;
|
|
96
|
+
amountMinor: number;
|
|
97
|
+
}
|
|
98
|
+
export interface ModelUsageGroup {
|
|
99
|
+
key: string;
|
|
100
|
+
requests: number;
|
|
101
|
+
totalTokens: number;
|
|
102
|
+
cost: ModelCost[];
|
|
103
|
+
}
|
|
104
|
+
export interface ModelUsageTotals {
|
|
105
|
+
requests: number;
|
|
106
|
+
inputTokens: number;
|
|
107
|
+
outputTokens: number;
|
|
108
|
+
cachedInputTokens: number;
|
|
109
|
+
cacheWriteTokens: number;
|
|
110
|
+
totalTokens: number;
|
|
111
|
+
cost: ModelCost[];
|
|
112
|
+
unpriced: number;
|
|
113
|
+
}
|
|
114
|
+
export interface ModelUsageItem {
|
|
115
|
+
id: string;
|
|
116
|
+
routeId: string | null;
|
|
117
|
+
modelId: string;
|
|
118
|
+
connectionId: string;
|
|
119
|
+
provider: string;
|
|
120
|
+
nativeId: string;
|
|
121
|
+
inputTokens: number;
|
|
122
|
+
outputTokens: number;
|
|
123
|
+
cachedInputTokens: number;
|
|
124
|
+
cacheWriteTokens: number;
|
|
125
|
+
totalTokens: number;
|
|
126
|
+
costMinor: number | null;
|
|
127
|
+
currency: string | null;
|
|
128
|
+
rateVersion: string | null;
|
|
129
|
+
durationMs: number;
|
|
130
|
+
ok: boolean;
|
|
131
|
+
errorCode: string | null;
|
|
132
|
+
invocationId: string | null;
|
|
133
|
+
runId: string | null;
|
|
134
|
+
occurredAt: string;
|
|
135
|
+
}
|
|
136
|
+
export interface ModelUsageReport {
|
|
137
|
+
totals: ModelUsageTotals;
|
|
138
|
+
totalsTruncated?: boolean | null;
|
|
139
|
+
groups?: ModelUsageGroup[];
|
|
140
|
+
items: ModelUsageItem[];
|
|
141
|
+
nextCursor: string | null;
|
|
142
|
+
}
|
|
143
|
+
export interface ModelUsageFilter {
|
|
144
|
+
route?: string;
|
|
145
|
+
model?: string;
|
|
146
|
+
from?: string;
|
|
147
|
+
to?: string;
|
|
148
|
+
groupBy?: "route" | "model" | "day";
|
|
149
|
+
limit?: number;
|
|
150
|
+
cursor?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface ModelCatalogFilter {
|
|
153
|
+
provider?: string;
|
|
154
|
+
status?: string;
|
|
155
|
+
limit?: number;
|
|
156
|
+
cursor?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface ModelCatalogPage {
|
|
159
|
+
models: Model[];
|
|
160
|
+
nextCursor: string | null;
|
|
161
|
+
}
|
|
162
|
+
export declare const modelCatalogKey: (filter?: ModelCatalogFilter) => readonly ["model-catalog", ModelCatalogFilter];
|
|
163
|
+
export declare const modelProvidersKey: readonly ["model-providers"];
|
|
164
|
+
export declare const modelRoutesKey: (projectId?: string) => readonly ["model-routes", string | undefined];
|
|
165
|
+
export declare const modelBudgetsKey: (projectId?: string) => readonly ["model-budgets", string | undefined];
|
|
166
|
+
export declare const modelBudgetUsageKey: (id: string, projectId?: string) => readonly ["model-budget-usage", string, string | undefined];
|
|
167
|
+
export declare const modelUsageKey: (projectId?: string, filter?: ModelUsageFilter) => readonly ["model-usage", string | undefined, ModelUsageFilter];
|
|
168
|
+
export declare function listModelCatalog(client: W6WClient, filter?: ModelCatalogFilter): Promise<ModelCatalogPage>;
|
|
169
|
+
/** One row of `GET /models/providers` — the descriptor the model pickers are driven by. */
|
|
170
|
+
export interface ModelProviderRow {
|
|
171
|
+
appId: string;
|
|
172
|
+
provider: string | null;
|
|
173
|
+
installed: boolean;
|
|
174
|
+
designation?: {
|
|
175
|
+
modelTypes: string[];
|
|
176
|
+
modelFamilies?: string[];
|
|
177
|
+
} | null;
|
|
178
|
+
operations?: {
|
|
179
|
+
discover: {
|
|
180
|
+
supported: boolean;
|
|
181
|
+
reason?: string;
|
|
182
|
+
};
|
|
183
|
+
complete: {
|
|
184
|
+
supported: boolean;
|
|
185
|
+
reason?: string;
|
|
186
|
+
features?: Partial<Record<ModelFeature, ModelFeatureState>>;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
/** A2 (optional): the bridge adapter serving this app; `null` = none. */
|
|
190
|
+
adapter?: {
|
|
191
|
+
provider: string;
|
|
192
|
+
contractVersion: number;
|
|
193
|
+
} | null;
|
|
194
|
+
/** A2 (optional): why this app cannot serve the caller right now. */
|
|
195
|
+
reasons?: ModelProviderReason[];
|
|
196
|
+
}
|
|
197
|
+
export type ModelFeature = "toolCalls" | "structuredOutput" | "streaming";
|
|
198
|
+
export type ModelFeatureState = "supported" | "unsupported" | "unknown";
|
|
199
|
+
export type ModelProviderReasonCode = "not_installed" | "no_adapter" | "not_entitled" | "no_connection";
|
|
200
|
+
export interface ModelProviderReason {
|
|
201
|
+
code: ModelProviderReasonCode;
|
|
202
|
+
message: string;
|
|
203
|
+
}
|
|
204
|
+
export interface CompleteSupport {
|
|
205
|
+
supported: boolean;
|
|
206
|
+
features: Partial<Record<ModelFeature, ModelFeatureState>>;
|
|
207
|
+
reasons: ModelProviderReason[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* THE support policy for `operations.complete`. Unsupported when the descriptor says so or the
|
|
211
|
+
* row names no adapter (`adapter: null`); a pre-A2 row (no `adapter`/`features`/`reasons`) falls
|
|
212
|
+
* back to `operations.complete.supported`. Unsupported rows always carry a reason.
|
|
213
|
+
*/
|
|
214
|
+
export declare function completeSupport(row: ModelProviderRow): CompleteSupport;
|
|
215
|
+
/** Follow `nextCursor` until null (or `maxPages`), concatenating `models`. */
|
|
216
|
+
export declare function loadAllModelCatalogPages(fetchPage: (cursor?: string) => Promise<ModelCatalogPage>, opts?: {
|
|
217
|
+
maxPages?: number;
|
|
218
|
+
}): Promise<{
|
|
219
|
+
models: Model[];
|
|
220
|
+
truncated: boolean;
|
|
221
|
+
}>;
|
|
222
|
+
export type ModelOperation = "discover" | "complete";
|
|
223
|
+
export interface ConnectionChoice {
|
|
224
|
+
id: string;
|
|
225
|
+
appId: string;
|
|
226
|
+
displayName: string;
|
|
227
|
+
/** Present only when the descriptor says the operation is unsupported for this provider. */
|
|
228
|
+
disabledReason?: string;
|
|
229
|
+
}
|
|
230
|
+
export declare function listModelProviders(client: W6WClient): Promise<ModelProviderRow[]>;
|
|
231
|
+
/**
|
|
232
|
+
* The connections a model picker may offer for `operation`, decided by the descriptor alone:
|
|
233
|
+
* a connection whose app has no designated provider row never appears (an `ai`-category app is
|
|
234
|
+
* not a provider); a designated row whose `discover` is unsupported appears disabled with the
|
|
235
|
+
* descriptor's reason; for `complete` the shared `completeSupport` policy decides (unsupported => disabled, never selectable).
|
|
236
|
+
*/
|
|
237
|
+
export declare function connectionChoices<C extends {
|
|
238
|
+
id: string;
|
|
239
|
+
appId: string;
|
|
240
|
+
displayName: string;
|
|
241
|
+
}>(connections: C[], providers: ModelProviderRow[], operation: ModelOperation): ConnectionChoice[];
|
|
242
|
+
/** The server answers fallbacks as `{modelId, connectionId}`; the editor works in `{model, connection}`. */
|
|
243
|
+
export declare function normaliseRoute(r: ModelRoute): ModelRoute;
|
|
244
|
+
export declare function listModelRoutes(client: W6WClient, project: string): Promise<ModelRoute[]>;
|
|
245
|
+
export declare function createModelRoute(client: W6WClient, project: string, input: ModelRouteInput): Promise<ModelRoute>;
|
|
246
|
+
export declare function updateModelRoute(client: W6WClient, project: string, name: string, patch: ModelRoutePatch): Promise<ModelRoute>;
|
|
247
|
+
export declare function deleteModelRoute(client: W6WClient, project: string, name: string): Promise<void>;
|
|
248
|
+
export declare function listModelBudgets(client: W6WClient, project: string): Promise<ModelBudget[]>;
|
|
249
|
+
export declare function createModelBudget(client: W6WClient, project: string, input: ModelBudgetInput): Promise<ModelBudget>;
|
|
250
|
+
export declare function updateModelBudget(client: W6WClient, project: string, id: string, patch: ModelBudgetPatch): Promise<ModelBudget>;
|
|
251
|
+
export declare function deleteModelBudget(client: W6WClient, project: string, id: string): Promise<void>;
|
|
252
|
+
export declare function getModelBudgetUsage(client: W6WClient, project: string, id: string): Promise<ModelBudgetUsage>;
|
|
253
|
+
export declare function getModelUsage(client: W6WClient, project: string, filter?: ModelUsageFilter): Promise<ModelUsageReport>;
|
|
254
|
+
export declare function useModelCatalogQuery(filter?: ModelCatalogFilter): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelCatalogPage>, Error>;
|
|
255
|
+
export declare function useAllModelCatalogQuery(filter?: Omit<ModelCatalogFilter, "cursor">): import('@tanstack/react-query').UseQueryResult<NoInfer<{
|
|
256
|
+
models: Model[];
|
|
257
|
+
truncated: boolean;
|
|
258
|
+
}>, Error>;
|
|
259
|
+
export declare function useModelProvidersQuery(): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelProviderRow[]>, Error>;
|
|
260
|
+
export declare function useModelRoutesQuery(projectId?: string): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelRoute[]>, Error>;
|
|
261
|
+
export declare function useModelBudgetsQuery(projectId?: string): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelBudget[]>, Error>;
|
|
262
|
+
export declare function useModelBudgetUsageQuery(id: string, projectId?: string): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelBudgetUsage>, Error>;
|
|
263
|
+
export declare function useModelUsageQuery(projectId?: string, filter?: ModelUsageFilter): import('@tanstack/react-query').UseQueryResult<NoInfer<ModelUsageReport>, Error>;
|
|
264
|
+
export declare function useCreateModelRouteMutation(): import('@tanstack/react-query').UseMutationResult<ModelRoute, Error, {
|
|
265
|
+
project: string;
|
|
266
|
+
input: ModelRouteInput;
|
|
267
|
+
}, unknown>;
|
|
268
|
+
export declare function useUpdateModelRouteMutation(): import('@tanstack/react-query').UseMutationResult<ModelRoute, Error, {
|
|
269
|
+
project: string;
|
|
270
|
+
name: string;
|
|
271
|
+
patch: ModelRoutePatch;
|
|
272
|
+
}, unknown>;
|
|
273
|
+
export declare function useDeleteModelRouteMutation(): import('@tanstack/react-query').UseMutationResult<void, Error, {
|
|
274
|
+
project: string;
|
|
275
|
+
name: string;
|
|
276
|
+
}, unknown>;
|
|
277
|
+
export declare function useCreateModelBudgetMutation(): import('@tanstack/react-query').UseMutationResult<ModelBudget, Error, {
|
|
278
|
+
project: string;
|
|
279
|
+
input: ModelBudgetInput;
|
|
280
|
+
}, unknown>;
|
|
281
|
+
export declare function useUpdateModelBudgetMutation(): import('@tanstack/react-query').UseMutationResult<ModelBudget, Error, {
|
|
282
|
+
project: string;
|
|
283
|
+
id: string;
|
|
284
|
+
patch: ModelBudgetPatch;
|
|
285
|
+
}, unknown>;
|
|
286
|
+
export declare function useDeleteModelBudgetMutation(): import('@tanstack/react-query').UseMutationResult<void, Error, {
|
|
287
|
+
project: string;
|
|
288
|
+
id: string;
|
|
289
|
+
}, unknown>;
|