@undefineds.co/xpod 0.4.33 → 0.4.35
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/http/SubgraphSparqlHttpHandler.d.ts +32 -0
- package/dist/http/SubgraphSparqlHttpHandler.js +448 -1
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +36 -0
- package/dist/storage/rdf/QleverSparqlEngine.d.ts +15 -0
- package/dist/storage/rdf/QleverSparqlEngine.js +40 -0
- package/dist/storage/rdf/QleverSparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/RdfAccessScope.d.ts +12 -0
- package/dist/storage/rdf/RdfAccessScope.js +63 -3
- package/dist/storage/rdf/RdfQuerySparqlEngine.d.ts +7 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.js +30 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/index.d.ts +1 -1
- package/dist/storage/rdf/index.js +6 -2
- package/dist/storage/sparql/SubgraphQueryEngine.d.ts +5 -0
- package/dist/storage/sparql/SubgraphQueryEngine.js +9 -0
- package/dist/storage/sparql/SubgraphQueryEngine.jsonld +16 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.d.ts +32 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.js +8 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +35 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +9 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +32 -6
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +1 -0
- package/node_modules/@undefineds.co/ai-connections/package.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/ai-connections-client.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.d.ts +16 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.js +80 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/request.js +19 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/types.d.ts +31 -0
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/build-provenance.json +4 -4
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/index.json +15 -15
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/provider-catalog/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/service-access-resources/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source/package.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source-inventory.json +11 -11
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/provider-catalog-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/service-access-resources-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/package.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/build-provenance.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/index.json +3 -3
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/source-inventory.json +1 -1
- package/node_modules/@undefineds.co/xpod-afs/dist/licenses/cli-producer-original-binding.json +1 -1
- package/node_modules/@undefineds.co/xpod-cli/dist/producer-materials/index.json +1 -1
- package/package.json +4 -4
- package/static/dashboard/assets/{AccountAuthBoundary-D2peXpst.js → AccountAuthBoundary-DXBGmvsI.js} +1 -1
- package/static/dashboard/assets/{DesktopOidcCallback-DXWArav6.js → DesktopOidcCallback-p24MYq1P.js} +1 -1
- package/static/dashboard/assets/{DevicePages-BULFk95K.js → DevicePages-DbvhTnse.js} +1 -1
- package/static/dashboard/assets/ModelsPage-UMDnRyLA.js +12 -0
- package/static/dashboard/assets/{PaneListHeader-BSfEbecP.js → PaneListHeader-DkEH0TT_.js} +1 -1
- package/static/dashboard/assets/{PodDeletionAuthorizationPanel-CH-Sx18g.js → PodDeletionAuthorizationPanel-CzrI8Pgw.js} +3 -3
- package/static/dashboard/assets/{PodPage-BMpejIra.js → PodPage-TaiWqMBx.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-H_Jj6WfF.js → SystemSettingsPage-D4gQjDt1.js} +1 -1
- package/static/dashboard/assets/{TasksPage-CTDxlQra.js → TasksPage-CmkiMYil.js} +1 -1
- package/static/dashboard/assets/{WebDesktopEntry-Ch7-0C9a.js → WebDesktopEntry-D9kEfhbz.js} +1 -1
- package/static/dashboard/assets/{XpodAiConnectionsPodStore-ggRE9fmE.js → XpodAiConnectionsPodStore-orY8vQFl.js} +2 -2
- package/static/dashboard/assets/{XpodShellApp-Bwf9UmeJ.js → XpodShellApp-DR65DMOb.js} +4 -4
- package/static/dashboard/assets/{account-session-CVzooxS2.js → account-session-BZ2ttIdq.js} +1 -1
- package/static/dashboard/assets/{button-DGh2QVt2.js → button-_rwfCMMH.js} +1 -1
- package/static/dashboard/assets/{collection-runtime-DwV_9rt2.js → collection-runtime-C74icLtf.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-yLhAxnfL.js → createLucideIcon-DrgScGhc.js} +1 -1
- package/static/dashboard/assets/{dashboard-xbXlitKr.js → dashboard--DWjqkYt.js} +2 -2
- package/static/dashboard/assets/{index-CMigfjqD.js → index-D6dB-UNq.js} +1 -1
- package/static/dashboard/assets/{index-BSiKqEdo.js → index-dx5sc4rE.js} +1 -1
- package/static/dashboard/assets/{label-CrDv_y1q.js → label-D02Jpvm9.js} +1 -1
- package/static/dashboard/assets/{list-BJM0nqti.js → list-DpFAisnq.js} +1 -1
- package/static/dashboard/assets/{nav-item-style-CQbGyYLb.js → nav-item-style-B1-0JkON.js} +1 -1
- package/static/dashboard/assets/{safe-continuation-ZTBQTFWB.js → safe-continuation-DUTIOFe5.js} +1 -1
- package/static/dashboard/assets/{section-header-CWHRWGXl.js → section-header-CtBnllbG.js} +1 -1
- package/static/dashboard/assets/{setting-row-qWtxYGK1.js → setting-row-D_JPuHAJ.js} +1 -1
- package/static/dashboard/assets/{xpod-remembered-login-DPMxurVN.js → xpod-remembered-login-CtmMI8xG.js} +3 -3
- package/static/dashboard/dashboard.html +1 -1
- package/static/settings/assets/{AccountAuthBoundary-4Ywjpb8o.js → AccountAuthBoundary-njIhHpLf.js} +1 -1
- package/static/settings/assets/{DesktopOidcCallback-CAmwMT_J.js → DesktopOidcCallback-BjjNwTxc.js} +1 -1
- package/static/settings/assets/{DevicePages-DvuHyfHo.js → DevicePages-FFJMu_zL.js} +1 -1
- package/static/settings/assets/ModelsPage-6567dZKQ.js +12 -0
- package/static/settings/assets/{PaneListHeader-CuFgIbhe.js → PaneListHeader-CuPah5aC.js} +1 -1
- package/static/settings/assets/{PodDeletionAuthorizationPanel-DdNgDHH5.js → PodDeletionAuthorizationPanel-aJCKasGz.js} +3 -3
- package/static/settings/assets/{PodPage-DnWCNGTO.js → PodPage-BA0DQ3AB.js} +1 -1
- package/static/settings/assets/{SystemSettingsPage-k9P_wQcl.js → SystemSettingsPage-BNPH4VWf.js} +1 -1
- package/static/settings/assets/{TasksPage-Dk7gUH3J.js → TasksPage-B5m82wjD.js} +1 -1
- package/static/settings/assets/{WebDesktopEntry-DJwPVVnU.js → WebDesktopEntry-DgwwIUhg.js} +1 -1
- package/static/settings/assets/{XpodAiConnectionsPodStore-BtJQiJsx.js → XpodAiConnectionsPodStore-BJm-rFPs.js} +2 -2
- package/static/settings/assets/{XpodShellApp-B47vEQJp.js → XpodShellApp-BwvekJJR.js} +4 -4
- package/static/settings/assets/{XpodThemeProvider-Ciuwo_yl.js → XpodThemeProvider-DyX0rUID.js} +2 -2
- package/static/settings/assets/{account-session-CMc10iEj.js → account-session-D6vibAra.js} +1 -1
- package/static/settings/assets/auth-callback-DXxmF0-p.js +1 -0
- package/static/settings/assets/{button-D1dGKY1f.js → button-CV4KJ59A.js} +1 -1
- package/static/settings/assets/{collection-runtime-hK37-47o.js → collection-runtime-CARp4Cii.js} +1 -1
- package/static/settings/assets/{createLucideIcon-nEiQH43b.js → createLucideIcon-BIwq0vQx.js} +1 -1
- package/static/settings/assets/{index-DNdvma6J.js → index-D-LgcKAb.js} +1 -1
- package/static/settings/assets/{label-C3EGk_2E.js → label-CFTl2bC_.js} +1 -1
- package/static/settings/assets/{list-BensBGZp.js → list-D2aO7Nu-.js} +1 -1
- package/static/settings/assets/{nav-item-style-BOKCPNz8.js → nav-item-style-BKpK5_1m.js} +1 -1
- package/static/settings/assets/{safe-continuation-BPwW6jdq.js → safe-continuation-DRRY_t4F.js} +1 -1
- package/static/settings/assets/{section-header-DOSj5RvJ.js → section-header-COECjyL5.js} +1 -1
- package/static/settings/assets/{setting-row-C9k4cGNM.js → setting-row-cGgL78vR.js} +1 -1
- package/static/settings/assets/{settings-DtP5C8hi.js → settings-Bvrm5N-k.js} +1 -1
- package/static/settings/assets/{xpod-remembered-login-DKFG-zi3.js → xpod-remembered-login-YAmn8ZiP.js} +3 -3
- package/static/settings/auth-callback.html +2 -2
- package/static/settings/settings.html +2 -2
- package/static/dashboard/assets/ModelsPage-xvsVzhGZ.js +0 -12
- package/static/settings/assets/ModelsPage-BDXqetwk.js +0 -12
- package/static/settings/assets/auth-callback-fcOBaX2w.js +0 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RdfAccessMode = void 0;
|
|
3
|
+
exports.METADATA_GRAPH_PREFIX = exports.RdfAccessMode = void 0;
|
|
4
4
|
exports.isRestrictiveRdfAccessScope = isRestrictiveRdfAccessScope;
|
|
5
5
|
exports.rdfAccessCacheScope = rdfAccessCacheScope;
|
|
6
6
|
exports.applyRdfAccessScope = applyRdfAccessScope;
|
|
7
|
+
exports.isMetadataGraphIri = isMetadataGraphIri;
|
|
8
|
+
exports.metadataResourceForGraph = metadataResourceForGraph;
|
|
7
9
|
exports.filterRdfAccessGraphs = filterRdfAccessGraphs;
|
|
10
|
+
exports.rdfReadGraphAllowed = rdfReadGraphAllowed;
|
|
8
11
|
exports.rdfAccessGraphAllowed = rdfAccessGraphAllowed;
|
|
9
12
|
const n3_1 = require("n3");
|
|
10
13
|
const types_1 = require("../quint/types");
|
|
@@ -66,6 +69,15 @@ function mergeRdfQueryCacheScopes(existing, access) {
|
|
|
66
69
|
}
|
|
67
70
|
return [existing, access];
|
|
68
71
|
}
|
|
72
|
+
/** Metadata facets are stored under the literal scheme prefix `meta:`. */
|
|
73
|
+
exports.METADATA_GRAPH_PREFIX = 'meta:';
|
|
74
|
+
function isMetadataGraphIri(graph) {
|
|
75
|
+
return graph.startsWith(exports.METADATA_GRAPH_PREFIX) && !graph.startsWith(`${exports.METADATA_GRAPH_PREFIX}${exports.METADATA_GRAPH_PREFIX}`);
|
|
76
|
+
}
|
|
77
|
+
/** The subject resource a metadata facet graph belongs to. */
|
|
78
|
+
function metadataResourceForGraph(graph) {
|
|
79
|
+
return isMetadataGraphIri(graph) ? graph.slice(exports.METADATA_GRAPH_PREFIX.length) : undefined;
|
|
80
|
+
}
|
|
69
81
|
function filterRdfAccessGraphs(graphs, scope) {
|
|
70
82
|
if (!scope) {
|
|
71
83
|
return new Set(graphs);
|
|
@@ -78,6 +90,50 @@ function filterRdfAccessGraphs(graphs, scope) {
|
|
|
78
90
|
}
|
|
79
91
|
return filtered;
|
|
80
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Read-side graph permission. A metadata facet graph is readable exactly when
|
|
95
|
+
* its subject resource is readable; the alias never widens the subject ACL.
|
|
96
|
+
* This is deliberately separate from {@link rdfAccessGraphAllowed}, which stays
|
|
97
|
+
* the literal write guard.
|
|
98
|
+
*/
|
|
99
|
+
function rdfReadGraphAllowed(graph, scope) {
|
|
100
|
+
const resource = metadataResourceForGraph(graph);
|
|
101
|
+
// A metadata-namespace scope is created ONLY by the explicit metadata read
|
|
102
|
+
// request (`queryMetadataBindings`/`listMetadataGraphs` prefix the base with
|
|
103
|
+
// `meta:`). Every ordinary read scope uses the data base, and there the
|
|
104
|
+
// `meta:` alias must stay invisible: widening it here would expose facets to
|
|
105
|
+
// ASK/CONSTRUCT/subqueries that never perform the per-subject authorization.
|
|
106
|
+
const metadataScope = scope.basePath.startsWith(exports.METADATA_GRAPH_PREFIX);
|
|
107
|
+
const resourceBase = metadataScope
|
|
108
|
+
? scope.basePath.slice(exports.METADATA_GRAPH_PREFIX.length)
|
|
109
|
+
: scope.basePath;
|
|
110
|
+
// Canonical-equivalent aliasing: a scope expressed over `meta:<base>` and a
|
|
111
|
+
// scope expressed over `<base>` name the same subject resources, so an
|
|
112
|
+
// explicit deny of either form must win over the literal allow below.
|
|
113
|
+
const aliases = resource === undefined
|
|
114
|
+
? [graph, `${exports.METADATA_GRAPH_PREFIX}${graph}`]
|
|
115
|
+
: [graph, resource];
|
|
116
|
+
if ((scope.deniedGraphUrls ?? []).some((denied) => aliases.includes(denied))) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if ((scope.deniedGraphPrefixes ?? []).some((prefix) => aliases.some((alias) => alias.startsWith(prefix))
|
|
120
|
+
|| (prefix === exports.METADATA_GRAPH_PREFIX && resource !== undefined)
|
|
121
|
+
|| (prefix.startsWith(exports.METADATA_GRAPH_PREFIX) && aliases.includes(prefix.slice(exports.METADATA_GRAPH_PREFIX.length))))) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (rdfAccessGraphAllowed(graph, scope)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (!metadataScope || resource === undefined || !resource.startsWith(resourceBase)) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (scope.allowedGraphUrls !== undefined
|
|
131
|
+
&& !scope.allowedGraphUrls.includes(graph)
|
|
132
|
+
&& !scope.allowedGraphUrls.includes(resource)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
81
137
|
function rdfAccessGraphAllowed(graph, scope) {
|
|
82
138
|
if (!graph.startsWith(scope.basePath)) {
|
|
83
139
|
return false;
|
|
@@ -181,9 +237,13 @@ function scopePattern(pattern, filters, scope, state) {
|
|
|
181
237
|
// Resolving it here rather than inside one engine means every query path - the
|
|
182
238
|
// public authority, the Pod endpoint, a direct engine query - reads the same
|
|
183
239
|
// rule. See docs/rdf-graph-semantics.md.
|
|
240
|
+
// A metadata facet graph is always exact, even when its IRI ends in `/`
|
|
241
|
+
// because its subject is a container. Only data graph IRIs keep the
|
|
242
|
+
// container-prefix meaning.
|
|
184
243
|
const containerPrefix = (0, types_1.isTerm)(requested)
|
|
185
244
|
&& requested.termType === 'NamedNode'
|
|
186
245
|
&& requested.value.endsWith('/')
|
|
246
|
+
&& !isMetadataGraphIri(requested.value)
|
|
187
247
|
? { $startsWith: requested.value }
|
|
188
248
|
: undefined;
|
|
189
249
|
const graph = containerPrefix
|
|
@@ -210,7 +270,7 @@ function scopePattern(pattern, filters, scope, state) {
|
|
|
210
270
|
}
|
|
211
271
|
: { ...pattern, ...(defaultGraphSourceScope ? { sourceScope: defaultGraphSourceScope } : {}) };
|
|
212
272
|
}
|
|
213
|
-
return
|
|
273
|
+
return rdfReadGraphAllowed(graph.value, scope)
|
|
214
274
|
? { ...pattern, ...(sourceScope ? { sourceScope } : {}) }
|
|
215
275
|
: { ...pattern, graph: state.impossibleGraph, ...(sourceScope ? { sourceScope } : {}) };
|
|
216
276
|
}
|
|
@@ -246,7 +306,7 @@ function scopeGraphOperators(graph, scope, impossibleGraph) {
|
|
|
246
306
|
}
|
|
247
307
|
if (scope.allowedGraphUrls !== undefined) {
|
|
248
308
|
const allowedTerms = scope.allowedGraphUrls
|
|
249
|
-
.filter((url) =>
|
|
309
|
+
.filter((url) => rdfReadGraphAllowed(url, scope) && graphOperatorsMayMatch(operators, url))
|
|
250
310
|
.map((url) => n3_1.DataFactory.namedNode(url));
|
|
251
311
|
if (allowedTerms.length === 0) {
|
|
252
312
|
return impossibleGraph;
|
|
@@ -25,6 +25,13 @@ export declare class RdfQuerySparqlEngine implements SparqlEngine {
|
|
|
25
25
|
queryQuads(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<AsyncIterator<Quad>>;
|
|
26
26
|
queryVoid(_query: string, _basePath: string, _accessScope?: RdfAccessScope, _options?: SparqlVoidOptions): Promise<void>;
|
|
27
27
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
28
|
+
/**
|
|
29
|
+
* Metadata facet reads run under the literal `meta:` scheme for this base so
|
|
30
|
+
* the data-prefix scope can never admit a facet accidentally. Collection
|
|
31
|
+
* discovery lists facet graphs from that same namespace.
|
|
32
|
+
*/
|
|
33
|
+
queryMetadataBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<RdfBindingsStream>;
|
|
34
|
+
listMetadataGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
35
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
29
36
|
close(): Promise<void>;
|
|
30
37
|
private context;
|
|
@@ -98,6 +98,36 @@ class RdfQuerySparqlEngine {
|
|
|
98
98
|
}
|
|
99
99
|
return new asynciterator_1.ArrayIterator(quads);
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Metadata facet reads run under the literal `meta:` scheme for this base so
|
|
103
|
+
* the data-prefix scope can never admit a facet accidentally. Collection
|
|
104
|
+
* discovery lists facet graphs from that same namespace.
|
|
105
|
+
*/
|
|
106
|
+
async queryMetadataBindings(query, basePath, accessScope, options) {
|
|
107
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
108
|
+
return this.queryBindings(query, metadataBase, {
|
|
109
|
+
...accessScope,
|
|
110
|
+
basePath: metadataBase,
|
|
111
|
+
mode: RdfAccessScope_1.RdfAccessMode.READ,
|
|
112
|
+
}, options);
|
|
113
|
+
}
|
|
114
|
+
async listMetadataGraphs(basePath, accessScope) {
|
|
115
|
+
const metadataBase = `${RdfAccessScope_1.METADATA_GRAPH_PREFIX}${basePath}`;
|
|
116
|
+
const stream = await this.queryBindings('SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }', metadataBase, { ...accessScope, basePath: metadataBase, mode: RdfAccessScope_1.RdfAccessMode.READ });
|
|
117
|
+
const graphs = new Set();
|
|
118
|
+
for await (const binding of stream) {
|
|
119
|
+
const graph = binding.get('g');
|
|
120
|
+
if (graph?.termType === 'NamedNode' && graph.value.startsWith(metadataBase)) {
|
|
121
|
+
graphs.add(graph.value);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const metaScope = {
|
|
125
|
+
...accessScope,
|
|
126
|
+
basePath: metadataBase,
|
|
127
|
+
mode: RdfAccessScope_1.RdfAccessMode.READ,
|
|
128
|
+
};
|
|
129
|
+
return new Set([...graphs].filter((graph) => (0, RdfAccessScope_1.rdfReadGraphAllowed)(graph, metaScope)));
|
|
130
|
+
}
|
|
101
131
|
async listGraphs(basePath, accessScope) {
|
|
102
132
|
const stream = await this.queryBindings('SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }', basePath, accessScope);
|
|
103
133
|
const graphs = new Set();
|
|
@@ -51,6 +51,14 @@
|
|
|
51
51
|
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_constructGraph",
|
|
52
52
|
"memberFieldName": "constructGraph"
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_queryMetadataBindings",
|
|
56
|
+
"memberFieldName": "queryMetadataBindings"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_listMetadataGraphs",
|
|
60
|
+
"memberFieldName": "listMetadataGraphs"
|
|
61
|
+
},
|
|
54
62
|
{
|
|
55
63
|
"@id": "undefineds:dist/storage/rdf/RdfQuerySparqlEngine.jsonld#RdfQuerySparqlEngine__member_listGraphs",
|
|
56
64
|
"memberFieldName": "listGraphs"
|
|
@@ -13,7 +13,7 @@ export type { PostgresRdfSqlExecutor } from './PostgresRdfSqlExecutor';
|
|
|
13
13
|
export { isLineAddressableRdf, isLineAddressableRdfContentType, isLineAddressableRdfPath, isRdfDocument, isRdfDocumentContentType, isRdfDocumentPath, isSafeRdfDocumentContentType, normalizeContentType, rdfContentTypeForPath, } from './RdfContentTypes';
|
|
14
14
|
export { RdfShadowComparator, canonicalQuadKey, diffQuads } from './RdfShadowComparator';
|
|
15
15
|
export { RdfQueryExecutor, variable as rdfVar } from './RdfQueryExecutor';
|
|
16
|
-
export { applyRdfAccessScope, filterRdfAccessGraphs, isRestrictiveRdfAccessScope, rdfAccessCacheScope, rdfAccessGraphAllowed, type RdfAccessMode, type RdfAccessScope, } from './RdfAccessScope';
|
|
16
|
+
export { METADATA_GRAPH_PREFIX, applyRdfAccessScope, filterRdfAccessGraphs, isMetadataGraphIri, isRestrictiveRdfAccessScope, metadataResourceForGraph, rdfAccessCacheScope, rdfAccessGraphAllowed, rdfReadGraphAllowed, type RdfAccessMode, type RdfAccessScope, } from './RdfAccessScope';
|
|
17
17
|
export { SolidRdfEngine, type LocalNativeSparqlClientLike, type SolidRdfEngineOptions, } from './SolidRdfEngine';
|
|
18
18
|
export { LocalQleverNativeSparqlClient, LocalQleverRuntimeError, type LocalQleverNativeSparqlClientOptions, type LocalQleverRuntimeErrorCode, } from './LocalQleverNativeSparqlClient';
|
|
19
19
|
export { QleverSparqlEngine } from './QleverSparqlEngine';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.RDF_MODELS_SYNTHETIC_MESSAGE_QUADS = exports.seedRdfModelsSearchFusionIndexes = exports.runRdfModelsShadowBenchmark = exports.runRdfModelsRdf3xShadowBenchmark = exports.runRdfModelsPostgresBenchmark = exports.runRdfModelsBenchmark = exports.rdfModelsSearchFusionBroadSourceCountForScale = exports.rdfModelsBenchmarkScaleTargetQuads = exports.rdfModelsBenchmarkSyntheticPodCount = exports.rdfModelsBenchmarkTargetSatisfied = exports.rdfModelsBenchmarkScaleSatisfied = exports.rdfModelsBenchmarkProfileRequiresSearchFusion = exports.syntheticMessagesForRdfModelsTargetQuads = exports.estimateRdfModelsSyntheticQuadCount = exports.defaultSyntheticMessagesForRdfModelsScale = exports.buildRdfModelsBenchmarkSeed = exports.RDF_MODELS_BENCHMARK_POD = exports.rdfModelsSearchFusionQueryBenchmarkCaseNames = exports.rdfModelsSearchFusionQueryBenchmarkCases = exports.rdfModelsQueryBenchmarkCasesForProfile = exports.rdfModelsQueryBenchmarkCaseNames = exports.rdfModelsQueryBenchmarkCases = exports.rdfModelsPostgresQueryBenchmarkCasesForProfile = exports.rdfModelsPostgresQueryBenchmarkCaseNames = exports.rdfModelsPostgresQueryBenchmarkCases = exports.rdfModelsPostgresMaterializedQueryBenchmarkCaseNames = exports.rdfModelsPostgresMaterializedQueryBenchmarkCases = exports.rdfModelsExtremeQueryBenchmarkCaseNames = exports.rdfModelsExtremeQueryBenchmarkCases = exports.rdfModelsExtremeBenchmarkCaseNames = exports.rdfModelsExtremeBenchmarkCases = exports.rdfModelsBenchmarkCasesForProfile = exports.rdfModelsBenchmarkCaseNames = exports.rdfModelsBenchmarkCases = exports.assertServerOwnedNativeSparqlQuery = void 0;
|
|
3
|
+
exports.DisabledSparqlFeatureError = exports.PostgresRdfEngine = exports.RdfQuerySparqlEngine = exports.QleverSparqlEngine = exports.LocalQleverRuntimeError = exports.LocalQleverNativeSparqlClient = exports.SolidRdfEngine = exports.rdfReadGraphAllowed = exports.rdfAccessGraphAllowed = exports.rdfAccessCacheScope = exports.metadataResourceForGraph = exports.isRestrictiveRdfAccessScope = exports.isMetadataGraphIri = exports.filterRdfAccessGraphs = exports.applyRdfAccessScope = exports.METADATA_GRAPH_PREFIX = exports.rdfVar = exports.RdfQueryExecutor = exports.diffQuads = exports.canonicalQuadKey = exports.RdfShadowComparator = exports.rdfContentTypeForPath = exports.normalizeContentType = exports.isSafeRdfDocumentContentType = exports.isRdfDocumentPath = exports.isRdfDocumentContentType = exports.isRdfDocument = exports.isLineAddressableRdfPath = exports.isLineAddressableRdfContentType = exports.isLineAddressableRdf = exports.PostgresRdfStatisticsStore = exports.PostgresRdfVectorIndex = exports.RdfVectorIndex = exports.RDF_VECTOR_SCHEMA_VERSION = exports.PostgresRdfTextIndex = exports.rdfTextIndexPolicyRole = exports.parseRdfTextProjectionQuads = exports.createRdfEntityTextChunksFromText = exports.createRdfEntityTextChunks = exports.tokenizeNormalizedRdfText = exports.RdfTextIndex = exports.RDF_TEXT_SCHEMA_VERSION = exports.Rdf3xIndex = exports.RdfQuadIndex = exports.rdfNumericValue = exports.isRdfNumericTerm = exports.isRdfNumericDatatype = exports.isFiniteNumericLexical = exports.RDF_NUMERIC_DATATYPES = exports.RdfTermDictionary = void 0;
|
|
4
|
+
exports.RDF_MODELS_SYNTHETIC_MESSAGE_QUADS = exports.seedRdfModelsSearchFusionIndexes = exports.runRdfModelsShadowBenchmark = exports.runRdfModelsRdf3xShadowBenchmark = exports.runRdfModelsPostgresBenchmark = exports.runRdfModelsBenchmark = exports.rdfModelsSearchFusionBroadSourceCountForScale = exports.rdfModelsBenchmarkScaleTargetQuads = exports.rdfModelsBenchmarkSyntheticPodCount = exports.rdfModelsBenchmarkTargetSatisfied = exports.rdfModelsBenchmarkScaleSatisfied = exports.rdfModelsBenchmarkProfileRequiresSearchFusion = exports.syntheticMessagesForRdfModelsTargetQuads = exports.estimateRdfModelsSyntheticQuadCount = exports.defaultSyntheticMessagesForRdfModelsScale = exports.buildRdfModelsBenchmarkSeed = exports.RDF_MODELS_BENCHMARK_POD = exports.rdfModelsSearchFusionQueryBenchmarkCaseNames = exports.rdfModelsSearchFusionQueryBenchmarkCases = exports.rdfModelsQueryBenchmarkCasesForProfile = exports.rdfModelsQueryBenchmarkCaseNames = exports.rdfModelsQueryBenchmarkCases = exports.rdfModelsPostgresQueryBenchmarkCasesForProfile = exports.rdfModelsPostgresQueryBenchmarkCaseNames = exports.rdfModelsPostgresQueryBenchmarkCases = exports.rdfModelsPostgresMaterializedQueryBenchmarkCaseNames = exports.rdfModelsPostgresMaterializedQueryBenchmarkCases = exports.rdfModelsExtremeQueryBenchmarkCaseNames = exports.rdfModelsExtremeQueryBenchmarkCases = exports.rdfModelsExtremeBenchmarkCaseNames = exports.rdfModelsExtremeBenchmarkCases = exports.rdfModelsBenchmarkCasesForProfile = exports.rdfModelsBenchmarkCaseNames = exports.rdfModelsBenchmarkCases = exports.assertServerOwnedNativeSparqlQuery = exports.sparqlCorrectionForCapability = exports.UnsupportedSparqlQueryError = exports.NativeSparqlTimeoutError = exports.NativeSparqlExecutionError = void 0;
|
|
5
5
|
var RdfTermDictionary_1 = require("./RdfTermDictionary");
|
|
6
6
|
Object.defineProperty(exports, "RdfTermDictionary", { enumerable: true, get: function () { return RdfTermDictionary_1.RdfTermDictionary; } });
|
|
7
7
|
var RdfTermSemantics_1 = require("./RdfTermSemantics");
|
|
@@ -50,11 +50,15 @@ var RdfQueryExecutor_1 = require("./RdfQueryExecutor");
|
|
|
50
50
|
Object.defineProperty(exports, "RdfQueryExecutor", { enumerable: true, get: function () { return RdfQueryExecutor_1.RdfQueryExecutor; } });
|
|
51
51
|
Object.defineProperty(exports, "rdfVar", { enumerable: true, get: function () { return RdfQueryExecutor_1.variable; } });
|
|
52
52
|
var RdfAccessScope_1 = require("./RdfAccessScope");
|
|
53
|
+
Object.defineProperty(exports, "METADATA_GRAPH_PREFIX", { enumerable: true, get: function () { return RdfAccessScope_1.METADATA_GRAPH_PREFIX; } });
|
|
53
54
|
Object.defineProperty(exports, "applyRdfAccessScope", { enumerable: true, get: function () { return RdfAccessScope_1.applyRdfAccessScope; } });
|
|
54
55
|
Object.defineProperty(exports, "filterRdfAccessGraphs", { enumerable: true, get: function () { return RdfAccessScope_1.filterRdfAccessGraphs; } });
|
|
56
|
+
Object.defineProperty(exports, "isMetadataGraphIri", { enumerable: true, get: function () { return RdfAccessScope_1.isMetadataGraphIri; } });
|
|
55
57
|
Object.defineProperty(exports, "isRestrictiveRdfAccessScope", { enumerable: true, get: function () { return RdfAccessScope_1.isRestrictiveRdfAccessScope; } });
|
|
58
|
+
Object.defineProperty(exports, "metadataResourceForGraph", { enumerable: true, get: function () { return RdfAccessScope_1.metadataResourceForGraph; } });
|
|
56
59
|
Object.defineProperty(exports, "rdfAccessCacheScope", { enumerable: true, get: function () { return RdfAccessScope_1.rdfAccessCacheScope; } });
|
|
57
60
|
Object.defineProperty(exports, "rdfAccessGraphAllowed", { enumerable: true, get: function () { return RdfAccessScope_1.rdfAccessGraphAllowed; } });
|
|
61
|
+
Object.defineProperty(exports, "rdfReadGraphAllowed", { enumerable: true, get: function () { return RdfAccessScope_1.rdfReadGraphAllowed; } });
|
|
58
62
|
var SolidRdfEngine_1 = require("./SolidRdfEngine");
|
|
59
63
|
Object.defineProperty(exports, "SolidRdfEngine", { enumerable: true, get: function () { return SolidRdfEngine_1.SolidRdfEngine; } });
|
|
60
64
|
var LocalQleverNativeSparqlClient_1 = require("./LocalQleverNativeSparqlClient");
|
|
@@ -25,6 +25,9 @@ export interface SparqlEngine {
|
|
|
25
25
|
queryVoid(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlVoidOptions): Promise<void>;
|
|
26
26
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
27
27
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
|
+
/** Optional: explicit metadata facet read. Absent means the engine cannot serve it. */
|
|
29
|
+
queryMetadataBindings?(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<any>;
|
|
30
|
+
listMetadataGraphs?(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
28
31
|
close(): Promise<void>;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
@@ -46,5 +49,7 @@ export declare class SubgraphQueryEngine {
|
|
|
46
49
|
queryVoid(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlVoidOptions): Promise<void>;
|
|
47
50
|
constructGraph(graph: string, basePath: string, accessScope?: RdfAccessScope): Promise<AsyncIterator<Quad>>;
|
|
48
51
|
listGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
52
|
+
queryMetadataBindings(query: string, basePath: string, accessScope?: RdfAccessScope, options?: SparqlQueryOptions): Promise<any>;
|
|
53
|
+
listMetadataGraphs(basePath: string, accessScope?: RdfAccessScope): Promise<Set<string>>;
|
|
49
54
|
close(): Promise<void>;
|
|
50
55
|
}
|
|
@@ -34,6 +34,15 @@ class SubgraphQueryEngine {
|
|
|
34
34
|
async listGraphs(basePath, accessScope) {
|
|
35
35
|
return this.impl.listGraphs(basePath, accessScope);
|
|
36
36
|
}
|
|
37
|
+
async queryMetadataBindings(query, basePath, accessScope, options) {
|
|
38
|
+
if (!this.impl.queryMetadataBindings) {
|
|
39
|
+
throw new Error('This SPARQL engine does not expose metadata facet reads.');
|
|
40
|
+
}
|
|
41
|
+
return this.impl.queryMetadataBindings(query, basePath, accessScope, options);
|
|
42
|
+
}
|
|
43
|
+
async listMetadataGraphs(basePath, accessScope) {
|
|
44
|
+
return this.impl.listMetadataGraphs ? this.impl.listMetadataGraphs(basePath, accessScope) : new Set();
|
|
45
|
+
}
|
|
37
46
|
async close() {
|
|
38
47
|
return this.impl.close();
|
|
39
48
|
}
|
|
@@ -35,6 +35,14 @@
|
|
|
35
35
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_listGraphs",
|
|
36
36
|
"memberFieldName": "listGraphs"
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_queryMetadataBindings",
|
|
40
|
+
"memberFieldName": "queryMetadataBindings"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_listMetadataGraphs",
|
|
44
|
+
"memberFieldName": "listMetadataGraphs"
|
|
45
|
+
},
|
|
38
46
|
{
|
|
39
47
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SparqlEngine__member_close",
|
|
40
48
|
"memberFieldName": "close"
|
|
@@ -91,6 +99,14 @@
|
|
|
91
99
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_listGraphs",
|
|
92
100
|
"memberFieldName": "listGraphs"
|
|
93
101
|
},
|
|
102
|
+
{
|
|
103
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_queryMetadataBindings",
|
|
104
|
+
"memberFieldName": "queryMetadataBindings"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_listMetadataGraphs",
|
|
108
|
+
"memberFieldName": "listMetadataGraphs"
|
|
109
|
+
},
|
|
94
110
|
{
|
|
95
111
|
"@id": "undefineds:dist/storage/sparql/SubgraphQueryEngine.jsonld#SubgraphQueryEngine__member_close",
|
|
96
112
|
"memberFieldName": "close"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AiBuiltinProviderSummary } from './contract/ai-connections-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* The deployment's own read-only AI Connections.
|
|
4
|
+
*
|
|
5
|
+
* These are not Pod providers: the server declares them about itself
|
|
6
|
+
* (`builtin: true` + `readOnly: true`), the user owns no credential for them,
|
|
7
|
+
* and there is nothing here to enable, disable, edit or delete. Rendering them
|
|
8
|
+
* on their own section is what keeps a personal-catalog failure from erasing a
|
|
9
|
+
* directory the caller never had to read the Pod for.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The four states of the declared directory, kept apart on purpose.
|
|
13
|
+
*
|
|
14
|
+
* A failed read and a successful empty read look identical on screen if both are
|
|
15
|
+
* projected to `[]`, and then the page tells the user "there are none" when it
|
|
16
|
+
* simply does not know. That is the same false certainty as the original
|
|
17
|
+
* zero-model pane, so they stay distinct here.
|
|
18
|
+
*/
|
|
19
|
+
export type BuiltinDirectoryState = {
|
|
20
|
+
status: 'unsupported';
|
|
21
|
+
} | {
|
|
22
|
+
status: 'loading';
|
|
23
|
+
} | {
|
|
24
|
+
status: 'failed';
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
status: 'ready';
|
|
28
|
+
providers: AiBuiltinProviderSummary[];
|
|
29
|
+
};
|
|
30
|
+
export declare function AiBuiltinProvidersSection({ state }: {
|
|
31
|
+
state: BuiltinDirectoryState;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge, EmptyState, InlineNotice } from '@undefineds.co/shared-ui';
|
|
3
|
+
import { Server } from 'lucide-react';
|
|
4
|
+
export function AiBuiltinProvidersSection({ state }) {
|
|
5
|
+
const catalog = state.status === 'ready' ? state.providers : [];
|
|
6
|
+
const modelCount = catalog.reduce((total, provider) => total + provider.models.length, 0);
|
|
7
|
+
return (_jsxs("section", { className: "space-y-8", "aria-label": "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B", children: [_jsx("div", { "data-testid": "builtin-providers-header", className: "flex flex-wrap items-center justify-between gap-2", children: _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [_jsxs("h3", { className: "flex items-center gap-2 text-sm font-medium leading-normal text-foreground/90", children: [_jsx(Server, { "aria-hidden": "true", className: "h-4 w-4 text-primary" }), "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B"] }), state.status === 'ready' ? (_jsx("span", { className: "text-xs leading-normal text-muted-foreground", children: `共 ${catalog.length} 个提供商 · ${modelCount} 个模型` })) : null, _jsx("span", { className: "text-xs leading-normal text-muted-foreground", children: "\u7531\u5F53\u524D\u90E8\u7F72\u63D0\u4F9B\uFF0C\u53EA\u8BFB" })] }) }), state.status === 'unsupported' ? (_jsx(EmptyState, { description: "\u8FD9\u4E2A\u5BA2\u6237\u7AEF\u65E0\u6CD5\u8BFB\u53D6\u90E8\u7F72\u5185\u7F6E\u6A21\u578B\u76EE\u5F55" })) : state.status === 'loading' ? (_jsx(EmptyState, { description: "\u90E8\u7F72\u5185\u7F6E\u6A21\u578B\u76EE\u5F55\u5C1A\u672A\u5C31\u7EEA" })) : state.status === 'failed' ? (_jsx(InlineNotice, { tone: "destructive", role: "alert", children: `部署内置模型目录读取失败:${state.message}` })) : catalog.length === 0 ? (_jsx(EmptyState, { description: "\u5F53\u524D\u90E8\u7F72\u6CA1\u6709\u5185\u7F6E\u6A21\u578B" })) : (_jsx("div", { className: "space-y-4", children: catalog.map((provider) => (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-foreground/90", children: provider.name }), _jsx("code", { className: "font-mono text-[10px] text-muted-foreground opacity-70", children: provider.id }), _jsx(Badge, { variant: "outline", className: "shrink-0 text-[10px] font-normal", children: "\u53EA\u8BFB" })] }), provider.models.length === 0 ? (_jsx("p", { className: "text-xs text-muted-foreground", children: "\u8BE5\u63D0\u4F9B\u5546\u672A\u58F0\u660E\u6A21\u578B" })) : (_jsx("ul", { "aria-label": `${provider.name} 的模型`, className: "grid gap-2", children: provider.models.map((model) => (_jsx("li", { className: "flex items-center gap-3 rounded-lg border border-border/40 bg-card p-3", children: _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "truncate text-sm font-medium text-foreground/90", children: model.displayName ?? model.id }), _jsx("div", { className: "mt-0.5 flex items-center gap-1.5", children: _jsx("code", { className: "max-w-[300px] truncate font-mono text-[10px] text-muted-foreground opacity-70", children: model.id }) })] }) }, `${provider.id}\0${model.id}`))) }))] }, provider.id))) }))] }));
|
|
8
|
+
}
|
|
@@ -107,6 +107,40 @@ export function AiConnectionsPanel({ client, onAuthorizeService, renderToaster =
|
|
|
107
107
|
.catch(() => undefined);
|
|
108
108
|
return () => { active = false; };
|
|
109
109
|
}, [client, gatewayCatalogVersion]);
|
|
110
|
+
/**
|
|
111
|
+
* The deployment's declared read-only directory, on its own request.
|
|
112
|
+
*
|
|
113
|
+
* It must not share a promise with `listProviders`/`listModels`: a Pod read
|
|
114
|
+
* that fails (or a personal catalogue that is simply empty) says nothing about
|
|
115
|
+
* what the deployment itself offers, and coupling them is exactly how a real
|
|
116
|
+
* built-in row disappeared from the page. The four outcomes stay distinct —
|
|
117
|
+
* unsupported / loading / failed / ready — because a failed read must never be
|
|
118
|
+
* rendered as "there are none", and a personal failure must stay its own
|
|
119
|
+
* message.
|
|
120
|
+
*/
|
|
121
|
+
const [builtinDirectory, setBuiltinDirectory] = useState(() => (typeof client.listBuiltinProviders === 'function' ? { status: 'loading' } : { status: 'unsupported' }));
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const read = client.listBuiltinProviders;
|
|
124
|
+
if (!read) {
|
|
125
|
+
setBuiltinDirectory({ status: 'unsupported' });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let active = true;
|
|
129
|
+
setBuiltinDirectory({ status: 'loading' });
|
|
130
|
+
void read.call(client)
|
|
131
|
+
.then((providers) => {
|
|
132
|
+
if (active)
|
|
133
|
+
setBuiltinDirectory({ status: 'ready', providers });
|
|
134
|
+
})
|
|
135
|
+
.catch((cause) => {
|
|
136
|
+
if (active)
|
|
137
|
+
setBuiltinDirectory({ status: 'failed', message: aiConnectionsErrorMessage(cause) });
|
|
138
|
+
});
|
|
139
|
+
// A response for a replaced client (or an unmounted page) is never adopted.
|
|
140
|
+
return () => { active = false; };
|
|
141
|
+
// The directory is deployment-wide and static, so it follows the client
|
|
142
|
+
// only: a Pod write must not cost a second read of a fact it cannot change.
|
|
143
|
+
}, [client]);
|
|
110
144
|
// A result is only current for the client + catalog revision it was loaded for;
|
|
111
145
|
// a stale response (or a not-yet-reloaded catalog) reads as undefined.
|
|
112
146
|
const gatewayModels = gatewayCatalog?.client === client
|
|
@@ -732,7 +766,7 @@ export function AiConnectionsPanel({ client, onAuthorizeService, renderToaster =
|
|
|
732
766
|
values: { ...current.values, [definition.id]: value },
|
|
733
767
|
})), onBeginApiKey: () => void beginApiKey(definition.id), onBeginOffering: (offering, mode, method) => void beginOfferingConnect(definition.id, offering, mode, method), onCancelConnect: (attempt) => void cancelConnect(definition.id, attempt), onBeginBrowser: () => void beginBrowserConnect(definition), onSaveApiKey: () => void saveApiKey(definition), onDisconnect: (credential) => void disconnect(definition.id, credential?.id), onCreateApiKeyCredential: (offering, input) => createApiKeyCredential(definition.id, offering, input), onCreateLocalCredential: (offering, method) => createLocalCredential(definition.id, offering, method), onUpdateCredential: (credential, patch) => updateProviderCredential(definition.id, credential, patch), onDeleteCredential: (credential) => void deleteProviderCredential(definition.id, credential), onTestCredential: (credential) => void testProviderCredential(definition.id, credential), onReorderCredentials: (offering, credentials, fromIndex, toIndex) => void reorderProviderCredentials(definition.id, offering, credentials, fromIndex, toIndex), onRefreshQuota: (offering, credential) => void refreshQuota(definition.id, offering, credential), verifyPending: Boolean(verifyingProviders[definition.id]), onVerify: () => void verifyProvider(definition.id), onAddModel: () => openModelEditor(definition.id), onEditModel: (model) => openModelEditor(definition.id, model), onDeleteModel: (model) => void deleteProviderModel(definition.id, model), onModelSelectionChange: handleModelSelectionChange, onDismissError: () => setProviderError(definition.id) }, definition.id));
|
|
734
768
|
})] }));
|
|
735
|
-
const keyContent = (_jsx(AiGatewayKeysSection, { client: client, onAuthorizeService: onAuthorizeService, clientConfigurationBridge: clientConfigurationBridge, gatewayModels: gatewayModels, modelSelection: gatewayModelSelection, liveRevision: liveRevision }));
|
|
769
|
+
const keyContent = (_jsx(AiGatewayKeysSection, { client: client, onAuthorizeService: onAuthorizeService, clientConfigurationBridge: clientConfigurationBridge, gatewayModels: gatewayModels, modelSelection: gatewayModelSelection, liveRevision: liveRevision, builtinDirectory: builtinDirectory }));
|
|
736
770
|
return (_jsxs("div", { "data-testid": "ai-connections-panel", className: "mx-auto w-full max-w-5xl space-y-10 px-4 py-6 sm:px-8 sm:py-8", children: [renderToaster ? _jsx(Toaster, {}) : null, selectedSection === 'keys' ? keyContent : null, selectedSection === 'provider' ? providerContent : null, selectedSection === 'provider' && modelEditor ? (_jsx(AiModelEditorDialog, { open: true, providerName: PROVIDERS.find((definition) => definition.id === modelEditor.provider)?.name ?? modelEditor.provider, initialValue: modelEditor.model
|
|
737
771
|
? {
|
|
738
772
|
id: modelEditor.model.id,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AiConnectionsClient, AiGatewayModel } from './contract/ai-connections-client.js';
|
|
2
2
|
import { type AiClientConfigurationBridge } from './AiClientConfigurationSection.js';
|
|
3
3
|
import { type GatewayModelSelection } from './AiGatewayModelsSection.js';
|
|
4
|
+
import { type BuiltinDirectoryState } from './AiBuiltinProvidersSection.js';
|
|
4
5
|
/**
|
|
5
6
|
* The Xpod provider page. From a coding client's point of view Xpod is just
|
|
6
7
|
* another provider, so this surface shares the provider pages' components: the
|
|
@@ -8,7 +9,7 @@ import { type GatewayModelSelection } from './AiGatewayModelsSection.js';
|
|
|
8
9
|
* over `AiModelCatalog`), and the same endpoint list (`AiEndpointList`) that the
|
|
9
10
|
* provider pages use for their offerings' protocols.
|
|
10
11
|
*/
|
|
11
|
-
export declare function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision, }: {
|
|
12
|
+
export declare function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision, builtinDirectory, }: {
|
|
12
13
|
client: AiConnectionsClient;
|
|
13
14
|
onAuthorizeService?: () => Promise<void>;
|
|
14
15
|
clientConfigurationBridge?: AiClientConfigurationBridge;
|
|
@@ -20,4 +21,11 @@ export declare function AiGatewayKeysSection({ client, onAuthorizeService, clien
|
|
|
20
21
|
* client, a script); the Key list lives in that table and re-reads with it.
|
|
21
22
|
*/
|
|
22
23
|
liveRevision?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The deployment's declared read-only directory, read by the caller on its own
|
|
26
|
+
* request. It is rendered next to the key surface precisely because it does
|
|
27
|
+
* not depend on the personal catalogue that the keys need.
|
|
28
|
+
*/
|
|
29
|
+
/** The declared directory's explicit read state, owned by the caller. */
|
|
30
|
+
builtinDirectory?: BuiltinDirectoryState;
|
|
23
31
|
}): import("react").JSX.Element;
|
|
@@ -11,6 +11,7 @@ import { xpodProtocolEndpoints } from './gateway-endpoints.js';
|
|
|
11
11
|
import { XPOD_AVATAR } from './provider-visuals.js';
|
|
12
12
|
import { AiGatewayKeyRow } from './AiGatewayKeyRow.js';
|
|
13
13
|
import { AiGatewayModelsSection } from './AiGatewayModelsSection.js';
|
|
14
|
+
import { AiBuiltinProvidersSection } from './AiBuiltinProvidersSection.js';
|
|
14
15
|
const DEFAULT_KEY_NAME = '我的 Xpod 密钥';
|
|
15
16
|
const CREATED_NOTIFICATION = 'Xpod 密钥 已创建,请复制或应用到客户端。';
|
|
16
17
|
const UNPERSISTED_COPY_MESSAGE = '这个 Xpod 密钥 只在创建时可见:请销毁它,然后重新创建并立即复制或应用。';
|
|
@@ -25,8 +26,19 @@ const XPOD_CREDENTIAL_NOTE = '密钥允许客户端以你的 WebID 访问整个
|
|
|
25
26
|
* over `AiModelCatalog`), and the same endpoint list (`AiEndpointList`) that the
|
|
26
27
|
* provider pages use for their offerings' protocols.
|
|
27
28
|
*/
|
|
28
|
-
export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision = 0, }) {
|
|
29
|
+
export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigurationBridge, gatewayModels, modelSelection, liveRevision = 0, builtinDirectory, }) {
|
|
29
30
|
const bridge = clientConfigurationBridge?.available === false ? undefined : clientConfigurationBridge;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this client can manage keys at all.
|
|
33
|
+
*
|
|
34
|
+
* A client built without the Account client-credentials capability declares
|
|
35
|
+
* `gatewayKeyManagement: false`; every key call it exposes throws
|
|
36
|
+
* `account_client_credentials_unavailable`. That is a declared absence of the
|
|
37
|
+
* surface, so the page says so instead of issuing a request it knows fails.
|
|
38
|
+
* `undefined` is a client that predates the declaration and is still probed,
|
|
39
|
+
* so an older host keeps its real behaviour.
|
|
40
|
+
*/
|
|
41
|
+
const keyManagementUnsupported = client.gatewayKeyManagement === false;
|
|
30
42
|
const [busyKeyId, setBusyKeyId] = useState();
|
|
31
43
|
const operation = useRef(false);
|
|
32
44
|
const verificationGeneration = useRef(0);
|
|
@@ -122,6 +134,18 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
122
134
|
// The wrapper cache belongs to the session that created the keys; a new
|
|
123
135
|
// client means a new session and no copy may survive it.
|
|
124
136
|
plaintexts.current.clear();
|
|
137
|
+
// A declared-absent capability is not a failure to report: the page renders
|
|
138
|
+
// its own statement and there is no list to read.
|
|
139
|
+
if (keyManagementUnsupported) {
|
|
140
|
+
setKeys([]);
|
|
141
|
+
setLoadError(undefined);
|
|
142
|
+
setLoading(false);
|
|
143
|
+
return () => {
|
|
144
|
+
active = false;
|
|
145
|
+
if (notification.current)
|
|
146
|
+
dismissToast(notification.current);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
125
149
|
void client.listGatewayKeys()
|
|
126
150
|
.then((records) => {
|
|
127
151
|
if (active)
|
|
@@ -140,7 +164,7 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
140
164
|
if (notification.current)
|
|
141
165
|
dismissToast(notification.current);
|
|
142
166
|
};
|
|
143
|
-
}, [client, notifyError, adoptRecords]);
|
|
167
|
+
}, [client, notifyError, adoptRecords, keyManagementUnsupported]);
|
|
144
168
|
// The keys themselves are Account-owned and load without any Pod permission,
|
|
145
169
|
// but a key is only usable while Xpod may read the Pod, so the page still
|
|
146
170
|
// says so instead of letting an unusable list look healthy.
|
|
@@ -160,7 +184,7 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
160
184
|
// A change made elsewhere only needs new rows: it must not drop the wrapper
|
|
161
185
|
// copies this session is still showing, nor flash the loading state.
|
|
162
186
|
useEffect(() => {
|
|
163
|
-
if (liveRevision === 0)
|
|
187
|
+
if (liveRevision === 0 || keyManagementUnsupported)
|
|
164
188
|
return;
|
|
165
189
|
let active = true;
|
|
166
190
|
void client.listGatewayKeys()
|
|
@@ -172,7 +196,7 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
172
196
|
return () => {
|
|
173
197
|
active = false;
|
|
174
198
|
};
|
|
175
|
-
}, [client, liveRevision, adoptRecords]);
|
|
199
|
+
}, [client, liveRevision, adoptRecords, keyManagementUnsupported]);
|
|
176
200
|
const authorize = async () => {
|
|
177
201
|
if (!onAuthorizeService || authorizing)
|
|
178
202
|
return;
|
|
@@ -375,7 +399,7 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
375
399
|
}
|
|
376
400
|
};
|
|
377
401
|
return (_jsx(TooltipProvider, { children: _jsx(Dialog, { open: showCreate, onOpenChange: (open) => { if (!open && (creating || applying))
|
|
378
|
-
return; setShowCreate(open); }, children: _jsxs("section", { className: "space-y-8", "aria-label": "Xpod \u5BC6\u94A5", children: [_jsx(AiProviderHeader, { name: "Xpod", mark: "XP", avatar: XPOD_AVATAR, infoLabel: "Xpod \u8BF4\u660E", infoLines: [XPOD_DESCRIPTION, XPOD_CREDENTIAL_NOTE], link: { href: client.apiBase, label: '访问 Xpod' }, badge: (_jsx(Badge, { variant: keys.length > 0 ? 'default' : 'secondary', children: keys.length > 0 ? `已签发 ${keys.length} 个` : '未配置' })) }), _jsxs("section", { className: "space-y-3", "aria-label": "\u5F53\u524D\u8FDE\u63A5", children: [_jsx(SectionHeader, { level: 3, title: _jsxs(_Fragment, { children: [_jsx(Settings2, { "aria-hidden": "true", className: "h-4 w-4 text-primary" }), "\u5F53\u524D\u8FDE\u63A5"] }), titleClassName: "flex items-center gap-2 font-medium text-foreground/90", actions: (_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-8 gap-1.5 text-xs", "aria-label": "\u65B0\u5EFA Xpod \u5BC6\u94A5", disabled: creating || loading, onClick: openCreate, children: [_jsx(Plus, { "aria-hidden": "true", className: "h-3.5 w-3.5" }), "Xpod \u5BC6\u94A5"] }) })) }), loadError || serviceAccessMissing ? _jsx(InlineNotice, { tone: "destructive", role: "alert", action: serviceAccessMissing && onAuthorizeService ? _jsx(Button, { size: "sm", disabled: authorizing, onClick: () => void authorize(), children: authorizing ? '正在授权…' : '允许 Xpod 访问' }) : undefined, children: loadError ?? 'Xpod 尚未获准访问这个 Pod' }) : null, loading ? (_jsxs("div", { className: "flex items-center gap-2 py-6 text-sm text-muted-foreground", children: [_jsx(Loader2, { "aria-hidden": "true", className: "h-4 w-4 animate-spin" }), "\u6B63\u5728\u8BFB\u53D6 Xpod \u5BC6\u94A5"] })) : loadError ? null : keys.length === 0 ? (_jsx("p", { className: "py-2 text-xs text-muted-foreground", children: "\u5C1A\u672A\u7B7E\u53D1 Xpod \u5BC6\u94A5" })) : (_jsx(ListSurface, { asChild: true, className: "divide-y-0 border-border/70 bg-transparent", children: _jsx("ul", { "aria-label": "Xpod \u5BC6\u94A5 \u5217\u8868", children: keys.map((record) => (_jsx(AiGatewayKeyRow, { record: record, busy: Boolean(busyKeyId), confirming: confirmingKeyId === record.id, configurationStatus: record.appliedTo && AI_CONNECTIONS_CLIENTS.includes(record.appliedTo)
|
|
402
|
+
return; setShowCreate(open); }, children: _jsxs("section", { className: "space-y-8", "aria-label": "Xpod \u5BC6\u94A5", children: [_jsx(AiProviderHeader, { name: "Xpod", mark: "XP", avatar: XPOD_AVATAR, infoLabel: "Xpod \u8BF4\u660E", infoLines: [XPOD_DESCRIPTION, XPOD_CREDENTIAL_NOTE], link: { href: client.apiBase, label: '访问 Xpod' }, badge: (_jsx(Badge, { variant: keys.length > 0 ? 'default' : 'secondary', children: keys.length > 0 ? `已签发 ${keys.length} 个` : '未配置' })) }), _jsxs("section", { className: "space-y-3", "aria-label": "\u5F53\u524D\u8FDE\u63A5", children: [_jsx(SectionHeader, { level: 3, title: _jsxs(_Fragment, { children: [_jsx(Settings2, { "aria-hidden": "true", className: "h-4 w-4 text-primary" }), "\u5F53\u524D\u8FDE\u63A5"] }), titleClassName: "flex items-center gap-2 font-medium text-foreground/90", actions: keyManagementUnsupported ? undefined : (_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-8 gap-1.5 text-xs", "aria-label": "\u65B0\u5EFA Xpod \u5BC6\u94A5", disabled: creating || loading, onClick: openCreate, children: [_jsx(Plus, { "aria-hidden": "true", className: "h-3.5 w-3.5" }), "Xpod \u5BC6\u94A5"] }) })) }), keyManagementUnsupported ? (_jsx(InlineNotice, { tone: "info", children: "\u5F53\u524D\u5BA2\u6237\u7AEF\u6CA1\u6709 Account \u5BA2\u6237\u7AEF\u51ED\u636E\u80FD\u529B\uFF0C\u56E0\u6B64\u8FD9\u91CC\u4E0D\u63D0\u4F9B Xpod \u5BC6\u94A5\u7BA1\u7406\u3002\u5DF2\u53D1\u5E03\u7684\u6A21\u578B\u4ECD\u7136\u53EF\u7528\u3002" })) : null, loadError || serviceAccessMissing ? _jsx(InlineNotice, { tone: "destructive", role: "alert", action: serviceAccessMissing && onAuthorizeService ? _jsx(Button, { size: "sm", disabled: authorizing, onClick: () => void authorize(), children: authorizing ? '正在授权…' : '允许 Xpod 访问' }) : undefined, children: loadError ?? 'Xpod 尚未获准访问这个 Pod' }) : null, keyManagementUnsupported ? null : loading ? (_jsxs("div", { className: "flex items-center gap-2 py-6 text-sm text-muted-foreground", children: [_jsx(Loader2, { "aria-hidden": "true", className: "h-4 w-4 animate-spin" }), "\u6B63\u5728\u8BFB\u53D6 Xpod \u5BC6\u94A5"] })) : loadError ? null : keys.length === 0 ? (_jsx("p", { className: "py-2 text-xs text-muted-foreground", children: "\u5C1A\u672A\u7B7E\u53D1 Xpod \u5BC6\u94A5" })) : (_jsx(ListSurface, { asChild: true, className: "divide-y-0 border-border/70 bg-transparent", children: _jsx("ul", { "aria-label": "Xpod \u5BC6\u94A5 \u5217\u8868", children: keys.map((record) => (_jsx(AiGatewayKeyRow, { record: record, busy: Boolean(busyKeyId), confirming: confirmingKeyId === record.id, configurationStatus: record.appliedTo && AI_CONNECTIONS_CLIENTS.includes(record.appliedTo)
|
|
379
403
|
? clientStatuses[record.appliedTo] : undefined, onTest: verificationPlan(record) ? () => void testConfiguration(record) : undefined, testing: testingKeyId === record.id, onReissue: () => {
|
|
380
404
|
beginAnother();
|
|
381
405
|
setName(record.name ?? DEFAULT_KEY_NAME);
|
|
@@ -384,7 +408,9 @@ export function AiGatewayKeysSection({ client, onAuthorizeService, clientConfigu
|
|
|
384
408
|
}, onRequestDestroy: () => setConfirmingKeyId(record.id), onCancelDestroy: () => setConfirmingKeyId((current) => (current === record.id ? undefined : current)), onDestroy: () => {
|
|
385
409
|
setConfirmingKeyId(undefined);
|
|
386
410
|
void destroy(record);
|
|
387
|
-
} }, record.id))) }) }))] }), _jsx(
|
|
411
|
+
} }, record.id))) }) }))] }), _jsx(AiBuiltinProvidersSection, { state: builtinDirectory ?? (typeof client.listBuiltinProviders === 'function'
|
|
412
|
+
? { status: 'loading' }
|
|
413
|
+
: { status: 'unsupported' }) }), _jsx(AiGatewayModelsSection, { models: gatewayModels, selection: modelSelection }), _jsxs(DialogContent, { className: "sm:max-w-md", "aria-describedby": undefined, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: issued ? 'Xpod 密钥 已签发' : '新建 Xpod 密钥' }) }), issued ? (_jsxs("div", { className: "space-y-5", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsxs("p", { className: "text-sm", children: ["\u5DF2\u7B7E\u53D1\u300C", issued.name || '未命名 Xpod 密钥', "\u300D\uFF0C\u7528\u9014\uFF1A", issuedClient ? AI_CLIENT_LABELS[issuedClient] : '只复制', "\u3002"] }), _jsx("p", { className: "text-xs text-muted-foreground", children: "\u5BC6\u94A5\u53EA\u663E\u793A\u8FD9\u4E00\u6B21\uFF0C\u8BF7\u7ACB\u5373\u590D\u5236\u3002\u8303\u56F4\uFF1A\u6574\u4E2A Pod\u3002" })] }), issued.maskedHint ? (_jsx("code", { className: "block truncate rounded-md border border-border/60 bg-muted/30 px-3 py-2 font-mono text-xs text-muted-foreground", children: issued.maskedHint })) : null, _jsx(AiEndpointList, { endpoints: xpodProtocolEndpoints(client.apiBase), copy: true, display: "protocol" }), !bridge ? (_jsx("p", { className: "text-xs text-muted-foreground", children: "\u5F53\u524D Web \u73AF\u5883\u65E0\u6CD5\u81EA\u52A8\u5199\u5165\u5BA2\u6237\u7AEF\u914D\u7F6E\uFF0C\u8BF7\u590D\u5236\u540E\u624B\u52A8\u7C98\u8D34\uFF1B\u81EA\u52A8\u5E94\u7528\u9700\u8981\u672C\u673A\u8FDE\u63A5\u3002" })) : null, error ? _jsx("p", { role: "alert", className: "text-sm text-destructive", children: error }) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(AiCopyButton, { value: () => sessionPlaintext(issued, UNPERSISTED_COPY_MESSAGE), label: "Xpod \u5BC6\u94A5", text: "\u590D\u5236 Xpod \u5BC6\u94A5", disabled: applying, iconClassName: "mr-1.5 h-3.5 w-3.5", copiedIconClassName: "mr-1.5 h-3.5 w-3.5 text-emerald-600", onError: (cause) => setError(errorMessage(cause)) }), issuedClient ? _jsx(AiCopyButton, { value: () => manualConfigurationText(issuedClient, client.apiBase, sessionPlaintext(issued, UNPERSISTED_COPY_MESSAGE)), label: `${AI_CLIENT_LABELS[issuedClient]} 配置`, text: `复制 ${AI_CLIENT_LABELS[issuedClient]} 配置`, disabled: applying, iconClassName: "mr-1.5 h-3.5 w-3.5", copiedIconClassName: "mr-1.5 h-3.5 w-3.5 text-emerald-600", onError: (cause) => setError(errorMessage(cause)) }) : null, bridge && issuedClient ? (appliedClient ? (_jsxs("span", { role: "status", className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [_jsx(Check, { "aria-hidden": "true", className: "h-3.5 w-3.5" }), "\u5DF2\u5E94\u7528\u5230 ", AI_CLIENT_LABELS[appliedClient]] })) : (_jsxs(Button, { type: "button", size: "sm", disabled: applying || clientStatuses[issuedClient]?.status === 'unavailable', "aria-label": `写入 ${AI_CLIENT_LABELS[issuedClient]}`, onClick: () => void apply(), children: [applying ? _jsx(Loader2, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null, applying ? '正在应用…' : `写入 ${AI_CLIENT_LABELS[issuedClient]}`] }))) : null] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "ghost", disabled: applying, onClick: beginAnother, children: "\u518D\u5EFA\u4E00\u4E2A" }), _jsx(Button, { type: "button", variant: "outline", onClick: () => setShowCreate(false), children: "\u5B8C\u6210" })] })] })) : (_jsxs("form", { className: "space-y-5", onSubmit: (event) => { event.preventDefault(); if (!creating)
|
|
388
414
|
void create(); }, children: [_jsxs("label", { className: "block space-y-2", children: [_jsx("span", { className: "text-sm font-medium", children: "\u540D\u79F0" }), _jsx(Input, { autoFocus: true, "aria-label": "Xpod \u5BC6\u94A5 \u540D\u79F0", value: name, disabled: creating, onChange: (event) => setName(event.target.value) })] }), _jsxs("label", { className: "block space-y-2", children: [_jsx("span", { className: "text-sm font-medium", children: "\u7ED9\u54EA\u4E2A\u5BA2\u6237\u7AEF\u7528" }), _jsxs(NativeSelect, { "aria-label": "Xpod \u5BC6\u94A5 \u7528\u9014", value: purpose, disabled: creating, onChange: (event) => setPurpose(event.target.value), children: [_jsx("option", { value: "", children: "\u4E0D\u5199\u5165\uFF0C\u53EA\u590D\u5236" }), AI_CONNECTIONS_CLIENTS.map((clientId) => (_jsxs("option", { value: clientId, children: [AI_CLIENT_LABELS[clientId], bridge ? (clientStatuses[clientId]?.status === 'unavailable' ? ' · 未安装' : clientStatuses[clientId] ? ' · 可配置' : ' · 检测中') : ' · 只复制配置'] }, clientId)))] })] }), _jsx("p", { className: "text-xs leading-normal text-muted-foreground", children: "\u5BA2\u6237\u7AEF\u9ED8\u8BA4\u8DDF\u968F Pod \u7684\u667A\u80FD\u6A21\u578B\u3002" }), error ? _jsx("p", { role: "alert", className: "text-sm text-destructive", children: error }) : null, _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", disabled: creating, onClick: () => setShowCreate(false), children: "\u53D6\u6D88" }), _jsxs(Button, { type: "submit", "aria-label": "\u521B\u5EFA Xpod \u5BC6\u94A5", disabled: creating || !name.trim(), children: [creating ? _jsx(Loader2, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }) : null, creating ? '正在创建…' : '创建 Xpod 密钥'] })] })] }))] })] }) }) }));
|
|
389
415
|
}
|
|
390
416
|
function errorCode(error) {
|
|
@@ -4,6 +4,7 @@ export * from './AiClientConfigurationSection.js';
|
|
|
4
4
|
export * from './AiConnectionsPanel.js';
|
|
5
5
|
export * from './AiCopyButton.js';
|
|
6
6
|
export * from './AiEndpointList.js';
|
|
7
|
+
export * from './AiBuiltinProvidersSection.js';
|
|
7
8
|
export * from './AiGatewayKeysSection.js';
|
|
8
9
|
export * from './AiInfoTooltip.js';
|
|
9
10
|
export * from './AiProviderHeader.js';
|
|
@@ -10,6 +10,7 @@ export * from './AiClientConfigurationSection.js';
|
|
|
10
10
|
export * from './AiConnectionsPanel.js';
|
|
11
11
|
export * from './AiCopyButton.js';
|
|
12
12
|
export * from './AiEndpointList.js';
|
|
13
|
+
export * from './AiBuiltinProvidersSection.js';
|
|
13
14
|
export * from './AiGatewayKeysSection.js';
|
|
14
15
|
export * from './AiInfoTooltip.js';
|
|
15
16
|
export * from './AiProviderHeader.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undefineds.co/ai-connections",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@undefineds.co/pod-collections": "0.1.6",
|
|
52
52
|
"@undefineds.co/shared-ui": "0.1.5",
|
|
53
53
|
"lucide-react": "^0.525.0",
|
|
54
|
-
"@undefineds.co/ai-connections-runtime": "0.1.
|
|
54
|
+
"@undefineds.co/ai-connections-runtime": "0.1.6"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^19.2.0"
|
package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/ai-connections-client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { AI_CONNECTIONS_PROVIDERS } from './client/types.js';
|
|
14
14
|
export { PLATFORM_MODEL_ROLES, matchesPlatformModelRole } from './client/gateway-model-roles.js';
|
|
15
|
-
export type { AiConnectAttempt, AiConnectionBeginOptions, AiConnectionsClient, AiConnectionsCredential, AiConnectionsMode, AiConnectionsProvider, AiConnectStatus, AiGatewayModel, AiGatewayCatalogModel, AiProviderAuthorizationMethod, AiProviderAuthorizationMethodId, AiProviderAuthorizationMethodsSummary, AiProviderConnectionSummary, AiProviderCredentialSummary, AiProviderOffering, AiProviderSummary, AiProviderSummaryStatus, AiQuotaSnapshot, AiQuotaWindow, CreateApiKeyCredentialInput, CreatedGatewayKey, CustomProviderModel, DiscoveredProviderModel, GatewayKeyRecord, ProviderModelDiscovery, TestProviderCredentialInput, UpdateProviderCredentialInput, } from './client/types.js';
|
|
15
|
+
export type { AiBuiltinProviderSummary, AiConnectAttempt, AiConnectionBeginOptions, AiConnectionsClient, AiConnectionsCredential, AiConnectionsMode, AiConnectionsProvider, AiConnectStatus, AiGatewayModel, AiGatewayCatalogModel, AiProviderAuthorizationMethod, AiProviderAuthorizationMethodId, AiProviderAuthorizationMethodsSummary, AiProviderConnectionSummary, AiProviderCredentialSummary, AiProviderOffering, AiProviderSummary, AiProviderSummaryStatus, AiQuotaSnapshot, AiQuotaWindow, CreateApiKeyCredentialInput, CreatedGatewayKey, CustomProviderModel, DiscoveredProviderModel, GatewayKeyRecord, ProviderModelDiscovery, TestProviderCredentialInput, UpdateProviderCredentialInput, } from './client/types.js';
|
|
16
16
|
export { AiConnectionsRequestError, aiConnectionsErrorCode, normalizeProxyUrl, redactProxyUrl, } from './client/normalize.js';
|
|
17
17
|
export { createAiConnectionsClient, resolveAiConnectionsApiBase } from './client/request.js';
|
|
18
18
|
/**
|