@xpert-ai/xpert-sdk 0.0.17 → 0.1.1
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/client.d.ts +73 -3
- package/dist/client.js +200 -6
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +200 -6
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/schema.d.ts +266 -1
- package/dist/schema.js.map +1 -1
- package/dist/schema.mjs.map +1 -1
- package/dist/tests/projects-connectors.test.d.ts +1 -0
- package/dist/tests/projects-connectors.test.js +372 -0
- package/dist/tests/projects-connectors.test.js.map +1 -0
- package/dist/tests/projects-connectors.test.mjs +372 -0
- package/dist/tests/projects-connectors.test.mjs.map +1 -0
- package/dist/tests/sse.test.js +17 -0
- package/dist/tests/sse.test.js.map +1 -1
- package/dist/tests/sse.test.mjs +17 -0
- package/dist/tests/sse.test.mjs.map +1 -1
- package/dist/tests/view-hosts.test.js +30 -1
- package/dist/tests/view-hosts.test.js.map +1 -1
- package/dist/tests/view-hosts.test.mjs +30 -1
- package/dist/tests/view-hosts.test.mjs.map +1 -1
- package/dist/utils/sse.js +10 -4
- package/dist/utils/sse.js.map +1 -1
- package/dist/utils/sse.mjs +10 -4
- package/dist/utils/sse.mjs.map +1 -1
- package/dist/view-extension.d.ts +46 -0
- package/dist/view-extension.js +2 -0
- package/dist/view-extension.js.map +1 -1
- package/dist/view-extension.mjs +2 -0
- package/dist/view-extension.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Assistant, AssistantGraph, AssistantSortBy, AssistantSelectField, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronSelectField, CronCreateForThreadResponse, CronCreateResponse, CronSortBy, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadContextUsage, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, Knowledgebase, ChatConversation, ChatMessage, ChatMessageFeedback, ChatTaskSummarySection, ChatTaskSummarySectionPage, ChatTaskSummarySnapshot, Pagination, RuntimeCapabilitiesResponse, AssistantModelsResponse, SandboxManagedService, SandboxManagedServiceLogs, SandboxManagedServicePreviewSession, SandboxManagedServiceStartInput, ThreadGoal, ThreadGoalPatchRequest, ThreadGoalSetRequest } from "./schema.js";
|
|
1
|
+
import { Assistant, AssistantGraph, AssistantSortBy, AssistantSelectField, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronSelectField, CronCreateForThreadResponse, CronCreateResponse, CronSortBy, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadContextUsage, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, Knowledgebase, ChatConversation, ChatMessage, ChatMessageFeedback, ChatTaskSummarySection, ChatTaskSummarySectionPage, ChatTaskSummarySnapshot, Pagination, RuntimeCapabilitiesResponse, AssistantModelsResponse, SandboxManagedService, SandboxManagedServiceLogs, SandboxManagedServicePreviewSession, SandboxManagedServiceStartInput, ThreadGoal, ThreadGoalPatchRequest, ThreadGoalSetRequest, XpertProject, XpertProjectListOptions, XpertWorkspaceFile, XpertWorkspaceFileListOptions, XpertWorkspace, XpertWorkspaceDefaultOptions, ConnectorConnectRequest, ConnectorConnectResponse, ConnectorConsentRequest, ConnectorBinding, ConnectorBindingCreateRequest, ConnectorPersonalAccountInstance, ConnectorRuntimeOptionsResponse, ConnectorScope, ConnectorOAuthStatusResponse, ConnectorStrategyDefinition } from "./schema.js";
|
|
2
2
|
import type { Command, CronsCreatePayload, OnConflictBehavior, RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent } from "./types.js";
|
|
3
3
|
import type { StreamMode, ThreadStreamMode, TypedAsyncGenerator } from "./types.stream.js";
|
|
4
4
|
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
|
|
@@ -137,10 +137,12 @@ export declare class AssistantsClient extends BaseClient {
|
|
|
137
137
|
* Get runtime-selectable skills and plugin middlewares for an assistant.
|
|
138
138
|
*
|
|
139
139
|
* @param assistantId The ID of the assistant.
|
|
140
|
+
* @param options.projectId Optional Project used to resolve Project-scoped capabilities.
|
|
140
141
|
* @param options.signal Optional abort signal.
|
|
141
142
|
* @returns Runtime capabilities available to the assistant.
|
|
142
143
|
*/
|
|
143
144
|
getRuntimeCapabilities(assistantId: string, options?: {
|
|
145
|
+
projectId?: string;
|
|
144
146
|
signal?: AbortSignal;
|
|
145
147
|
}): Promise<RuntimeCapabilitiesResponse>;
|
|
146
148
|
/** Get the Primary and user-selectable runtime models for an Assistant. */
|
|
@@ -251,11 +253,11 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
|
|
|
251
253
|
*/
|
|
252
254
|
get<ValuesType = TStateType>(threadId: string): Promise<Thread<ValuesType>>;
|
|
253
255
|
/**
|
|
254
|
-
* Get
|
|
256
|
+
* Get the last measured context usage for an agent in a thread.
|
|
255
257
|
*
|
|
256
258
|
* @param threadId ID of the thread.
|
|
257
259
|
* @param options.agentKey Agent key for usage filtering.
|
|
258
|
-
* @returns
|
|
260
|
+
* @returns Usage and freshness; run_id and updated_at identify the measurement.
|
|
259
261
|
*/
|
|
260
262
|
getContextUsage(threadId: string, options?: {
|
|
261
263
|
agentKey?: string;
|
|
@@ -720,12 +722,79 @@ export declare class Client<TStateType = DefaultValues, TUpdateType = TStateType
|
|
|
720
722
|
* The client for Xpert extension views and their workspace-file grants.
|
|
721
723
|
*/
|
|
722
724
|
viewHosts: ViewHostsClient;
|
|
725
|
+
/**
|
|
726
|
+
* The client for projects available to the current Xpert user.
|
|
727
|
+
*/
|
|
728
|
+
projects: ProjectsClient;
|
|
729
|
+
/**
|
|
730
|
+
* The client for Xpert-specific workspace resources.
|
|
731
|
+
*/
|
|
732
|
+
xperts: XpertsClient;
|
|
733
|
+
/**
|
|
734
|
+
* The client for workspaces available to the current Xpert user.
|
|
735
|
+
*/
|
|
736
|
+
workspaces: WorkspacesClient;
|
|
737
|
+
/**
|
|
738
|
+
* The client for scoped Connector definitions and authorizations.
|
|
739
|
+
*/
|
|
740
|
+
connectors: ConnectorsClient;
|
|
723
741
|
/**
|
|
724
742
|
* The client for MCP publications and MCP App runtime operations.
|
|
725
743
|
*/
|
|
726
744
|
mcp: McpClient;
|
|
727
745
|
constructor(config?: ClientConfig);
|
|
728
746
|
}
|
|
747
|
+
export declare class ProjectsClient extends BaseClient {
|
|
748
|
+
constructor(config?: ClientConfig);
|
|
749
|
+
list(options: XpertProjectListOptions): Promise<Pagination<XpertProject>>;
|
|
750
|
+
get(projectId: string, options?: {
|
|
751
|
+
signal?: AbortSignal;
|
|
752
|
+
}): Promise<XpertProject>;
|
|
753
|
+
listFiles(projectId: string, options?: XpertWorkspaceFileListOptions): Promise<XpertWorkspaceFile[]>;
|
|
754
|
+
}
|
|
755
|
+
export declare class XpertsClient extends BaseClient {
|
|
756
|
+
constructor(config?: ClientConfig);
|
|
757
|
+
listWorkspaceFiles(xpertId: string, options?: XpertWorkspaceFileListOptions): Promise<XpertWorkspaceFile[]>;
|
|
758
|
+
}
|
|
759
|
+
export declare class WorkspacesClient extends BaseClient {
|
|
760
|
+
constructor(config?: ClientConfig);
|
|
761
|
+
getDefault(options?: XpertWorkspaceDefaultOptions): Promise<XpertWorkspace | null>;
|
|
762
|
+
}
|
|
763
|
+
export declare class ConnectorsClient extends BaseClient {
|
|
764
|
+
constructor(config?: ClientConfig);
|
|
765
|
+
runtimeOptions(xpertId: string, options?: {
|
|
766
|
+
projectId?: string;
|
|
767
|
+
signal?: AbortSignal;
|
|
768
|
+
}): Promise<ConnectorRuntimeOptionsResponse>;
|
|
769
|
+
listBindings(scope: ConnectorScope, options?: {
|
|
770
|
+
signal?: AbortSignal;
|
|
771
|
+
}): Promise<ConnectorBinding[]>;
|
|
772
|
+
definitions(scope: ConnectorScope, options?: {
|
|
773
|
+
signal?: AbortSignal;
|
|
774
|
+
}): Promise<ConnectorStrategyDefinition[]>;
|
|
775
|
+
createBinding(input: ConnectorBindingCreateRequest, options?: {
|
|
776
|
+
signal?: AbortSignal;
|
|
777
|
+
}): Promise<ConnectorBinding>;
|
|
778
|
+
deleteBinding(bindingId: string, options?: {
|
|
779
|
+
signal?: AbortSignal;
|
|
780
|
+
}): Promise<void>;
|
|
781
|
+
connect(bindingId: string, input: ConnectorConnectRequest, options?: {
|
|
782
|
+
signal?: AbortSignal;
|
|
783
|
+
}): Promise<ConnectorConnectResponse>;
|
|
784
|
+
authorizationStatus(bindingId: string, options?: {
|
|
785
|
+
xpertId?: string;
|
|
786
|
+
signal?: AbortSignal;
|
|
787
|
+
}): Promise<ConnectorOAuthStatusResponse>;
|
|
788
|
+
consent(bindingId: string, input?: ConnectorConsentRequest, options?: {
|
|
789
|
+
signal?: AbortSignal;
|
|
790
|
+
}): Promise<ConnectorBinding>;
|
|
791
|
+
disconnectPersonalAccount(accountId: string, options?: {
|
|
792
|
+
signal?: AbortSignal;
|
|
793
|
+
}): Promise<void>;
|
|
794
|
+
listPersonalAccounts(options?: {
|
|
795
|
+
signal?: AbortSignal;
|
|
796
|
+
}): Promise<ConnectorPersonalAccountInstance[]>;
|
|
797
|
+
}
|
|
729
798
|
export declare class ContextsClient extends BaseClient {
|
|
730
799
|
uploadFile<TResponse = unknown>(file: Blob | BufferSource | string, options?: {
|
|
731
800
|
filename?: string;
|
|
@@ -777,6 +846,7 @@ export declare class ViewHostsClient extends BaseClient {
|
|
|
777
846
|
export declare class ConversationsClient extends BaseClient {
|
|
778
847
|
create(payload: Partial<ChatConversation>): Promise<ChatConversation>;
|
|
779
848
|
get(conversationId: string): Promise<ChatConversation>;
|
|
849
|
+
listWorkspaceFiles(conversationId: string, options?: XpertWorkspaceFileListOptions): Promise<XpertWorkspaceFile[]>;
|
|
780
850
|
update(conversationId: string, payload: Partial<ChatConversation>): Promise<ChatConversation>;
|
|
781
851
|
delete(conversationId: string): Promise<void>;
|
|
782
852
|
search(query?: {
|
package/dist/client.js
CHANGED
|
@@ -365,11 +365,15 @@ export class AssistantsClient extends BaseClient {
|
|
|
365
365
|
* Get runtime-selectable skills and plugin middlewares for an assistant.
|
|
366
366
|
*
|
|
367
367
|
* @param assistantId The ID of the assistant.
|
|
368
|
+
* @param options.projectId Optional Project used to resolve Project-scoped capabilities.
|
|
368
369
|
* @param options.signal Optional abort signal.
|
|
369
370
|
* @returns Runtime capabilities available to the assistant.
|
|
370
371
|
*/
|
|
371
372
|
async getRuntimeCapabilities(assistantId, options) {
|
|
372
373
|
return this.fetch(`/assistants/${assistantId}/runtime-capabilities`, {
|
|
374
|
+
params: options?.projectId
|
|
375
|
+
? { projectId: options.projectId }
|
|
376
|
+
: undefined,
|
|
373
377
|
signal: options?.signal,
|
|
374
378
|
});
|
|
375
379
|
}
|
|
@@ -525,11 +529,11 @@ export class ThreadsClient extends BaseClient {
|
|
|
525
529
|
return this.fetch(`/threads/${threadId}`);
|
|
526
530
|
}
|
|
527
531
|
/**
|
|
528
|
-
* Get
|
|
532
|
+
* Get the last measured context usage for an agent in a thread.
|
|
529
533
|
*
|
|
530
534
|
* @param threadId ID of the thread.
|
|
531
535
|
* @param options.agentKey Agent key for usage filtering.
|
|
532
|
-
* @returns
|
|
536
|
+
* @returns Usage and freshness; run_id and updated_at identify the measurement.
|
|
533
537
|
*/
|
|
534
538
|
async getContextUsage(threadId, options) {
|
|
535
539
|
return this.fetch(`/threads/${threadId}/context-usage`, {
|
|
@@ -1287,6 +1291,22 @@ export class Client {
|
|
|
1287
1291
|
* The client for Xpert extension views and their workspace-file grants.
|
|
1288
1292
|
*/
|
|
1289
1293
|
viewHosts;
|
|
1294
|
+
/**
|
|
1295
|
+
* The client for projects available to the current Xpert user.
|
|
1296
|
+
*/
|
|
1297
|
+
projects;
|
|
1298
|
+
/**
|
|
1299
|
+
* The client for Xpert-specific workspace resources.
|
|
1300
|
+
*/
|
|
1301
|
+
xperts;
|
|
1302
|
+
/**
|
|
1303
|
+
* The client for workspaces available to the current Xpert user.
|
|
1304
|
+
*/
|
|
1305
|
+
workspaces;
|
|
1306
|
+
/**
|
|
1307
|
+
* The client for scoped Connector definitions and authorizations.
|
|
1308
|
+
*/
|
|
1309
|
+
connectors;
|
|
1290
1310
|
/**
|
|
1291
1311
|
* The client for MCP publications and MCP App runtime operations.
|
|
1292
1312
|
*/
|
|
@@ -1324,6 +1344,10 @@ export class Client {
|
|
|
1324
1344
|
this.conversations = new ConversationsClient(config);
|
|
1325
1345
|
this.sandbox = new SandboxClient(config);
|
|
1326
1346
|
this.viewHosts = new ViewHostsClient(config);
|
|
1347
|
+
this.projects = new ProjectsClient(config);
|
|
1348
|
+
this.xperts = new XpertsClient(config);
|
|
1349
|
+
this.workspaces = new WorkspacesClient(config);
|
|
1350
|
+
this.connectors = new ConnectorsClient(config);
|
|
1327
1351
|
this.mcp = new McpClient(new McpTransportClient(config));
|
|
1328
1352
|
this["~ui"] = new UiClient(config);
|
|
1329
1353
|
}
|
|
@@ -1336,6 +1360,148 @@ class McpTransportClient extends BaseClient {
|
|
|
1336
1360
|
return this.fetch(path, options);
|
|
1337
1361
|
}
|
|
1338
1362
|
}
|
|
1363
|
+
function workspaceFileListParams(options) {
|
|
1364
|
+
return {
|
|
1365
|
+
path: options.path,
|
|
1366
|
+
deepth: options.depth,
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
export class ProjectsClient extends BaseClient {
|
|
1370
|
+
constructor(config) {
|
|
1371
|
+
super({
|
|
1372
|
+
...config,
|
|
1373
|
+
apiUrl: deriveXpertApiUrl(config?.apiUrl, "xpert-project"),
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
async list(options) {
|
|
1377
|
+
return this.fetch("/available", {
|
|
1378
|
+
params: {
|
|
1379
|
+
xpertId: options.xpertId,
|
|
1380
|
+
status: options.status ?? "active",
|
|
1381
|
+
skip: options.skip ?? 0,
|
|
1382
|
+
take: options.take ?? 100,
|
|
1383
|
+
},
|
|
1384
|
+
signal: options.signal,
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
async get(projectId, options) {
|
|
1388
|
+
return this.fetch(`/${encodeURIComponent(projectId)}`, {
|
|
1389
|
+
signal: options?.signal,
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
async listFiles(projectId, options = {}) {
|
|
1393
|
+
return this.fetch(`/${encodeURIComponent(projectId)}/files`, {
|
|
1394
|
+
params: workspaceFileListParams(options),
|
|
1395
|
+
signal: options.signal,
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
export class XpertsClient extends BaseClient {
|
|
1400
|
+
constructor(config) {
|
|
1401
|
+
super({
|
|
1402
|
+
...config,
|
|
1403
|
+
apiUrl: deriveXpertApiUrl(config?.apiUrl, "xpert"),
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
async listWorkspaceFiles(xpertId, options = {}) {
|
|
1407
|
+
return this.fetch(`/${encodeURIComponent(xpertId)}/workspace/files`, {
|
|
1408
|
+
params: workspaceFileListParams(options),
|
|
1409
|
+
signal: options.signal,
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
export class WorkspacesClient extends BaseClient {
|
|
1414
|
+
constructor(config) {
|
|
1415
|
+
super({
|
|
1416
|
+
...config,
|
|
1417
|
+
apiUrl: deriveXpertApiUrl(config?.apiUrl, "xpert-workspace"),
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
async getDefault(options = {}) {
|
|
1421
|
+
return this.fetch("/my/default", {
|
|
1422
|
+
params: options.purpose ? { purpose: options.purpose } : undefined,
|
|
1423
|
+
signal: options.signal,
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
export class ConnectorsClient extends BaseClient {
|
|
1428
|
+
constructor(config) {
|
|
1429
|
+
super({
|
|
1430
|
+
...config,
|
|
1431
|
+
apiUrl: deriveXpertApiUrl(config?.apiUrl, "connector"),
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
async runtimeOptions(xpertId, options) {
|
|
1435
|
+
return this.fetch("/runtime-options", {
|
|
1436
|
+
params: {
|
|
1437
|
+
xpertId,
|
|
1438
|
+
projectId: options?.projectId,
|
|
1439
|
+
},
|
|
1440
|
+
signal: options?.signal,
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
async listBindings(scope, options) {
|
|
1444
|
+
return this.fetch("/bindings", {
|
|
1445
|
+
params: connectorScopeParams(scope),
|
|
1446
|
+
signal: options?.signal,
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
async definitions(scope, options) {
|
|
1450
|
+
return this.fetch("/definitions", {
|
|
1451
|
+
params: connectorScopeParams(scope),
|
|
1452
|
+
signal: options?.signal,
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
async createBinding(input, options) {
|
|
1456
|
+
return this.fetch("/bindings", {
|
|
1457
|
+
method: "POST",
|
|
1458
|
+
json: input,
|
|
1459
|
+
signal: options?.signal,
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
async deleteBinding(bindingId, options) {
|
|
1463
|
+
await this.fetch(`/bindings/${encodeURIComponent(bindingId)}`, {
|
|
1464
|
+
method: "DELETE",
|
|
1465
|
+
signal: options?.signal,
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
async connect(bindingId, input, options) {
|
|
1469
|
+
return this.fetch(`/bindings/${encodeURIComponent(bindingId)}/connect`, {
|
|
1470
|
+
method: "POST",
|
|
1471
|
+
json: input,
|
|
1472
|
+
signal: options?.signal,
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
async authorizationStatus(bindingId, options) {
|
|
1476
|
+
return this.fetch(`/bindings/${encodeURIComponent(bindingId)}/authorization-status`, {
|
|
1477
|
+
params: options?.xpertId ? { xpertId: options.xpertId } : undefined,
|
|
1478
|
+
signal: options?.signal,
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
async consent(bindingId, input = {}, options) {
|
|
1482
|
+
return this.fetch(`/bindings/${encodeURIComponent(bindingId)}/consent`, {
|
|
1483
|
+
method: "POST",
|
|
1484
|
+
json: input,
|
|
1485
|
+
signal: options?.signal,
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
async disconnectPersonalAccount(accountId, options) {
|
|
1489
|
+
await this.fetch(`/personal-accounts/${encodeURIComponent(accountId)}`, {
|
|
1490
|
+
method: "DELETE",
|
|
1491
|
+
signal: options?.signal,
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
async listPersonalAccounts(options) {
|
|
1495
|
+
return this.fetch("/personal-accounts", {
|
|
1496
|
+
signal: options?.signal,
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function connectorScopeParams(scope) {
|
|
1501
|
+
return scope.type === "project"
|
|
1502
|
+
? { scopeType: scope.type, scopeId: scope.projectId }
|
|
1503
|
+
: { scopeType: scope.type, scopeId: scope.workspaceId };
|
|
1504
|
+
}
|
|
1339
1505
|
/**
|
|
1340
1506
|
* @internal Used to obtain a stable key representing the client.
|
|
1341
1507
|
*/
|
|
@@ -1556,7 +1722,8 @@ class WorkspaceViewFilesClient extends BaseClient {
|
|
|
1556
1722
|
return this.fetch("/view-sessions", {
|
|
1557
1723
|
method: "POST",
|
|
1558
1724
|
credentials: "include",
|
|
1559
|
-
json: { hostType, hostId, viewKey },
|
|
1725
|
+
json: { hostType, hostId, viewKey, runtimeScope: options?.runtimeScope },
|
|
1726
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1560
1727
|
signal: options?.signal,
|
|
1561
1728
|
});
|
|
1562
1729
|
}
|
|
@@ -1585,26 +1752,37 @@ export class ViewHostsClient extends BaseClient {
|
|
|
1585
1752
|
this.workspaceFiles = new WorkspaceViewFilesClient(config);
|
|
1586
1753
|
}
|
|
1587
1754
|
listSlotViews(hostType, hostId, slot, options) {
|
|
1588
|
-
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/slots/${encodeViewPathSegment(slot)}/views`, {
|
|
1755
|
+
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/slots/${encodeViewPathSegment(slot)}/views`, {
|
|
1756
|
+
signal: options?.signal,
|
|
1757
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1758
|
+
});
|
|
1589
1759
|
}
|
|
1590
1760
|
getManifest(hostType, hostId, viewKey, options) {
|
|
1591
|
-
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/manifest`, {
|
|
1761
|
+
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/manifest`, {
|
|
1762
|
+
signal: options?.signal,
|
|
1763
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1764
|
+
});
|
|
1592
1765
|
}
|
|
1593
1766
|
getData(hostType, hostId, viewKey, query = {}, options) {
|
|
1594
1767
|
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/data`, {
|
|
1595
1768
|
params: createViewQueryParams(query),
|
|
1769
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1596
1770
|
signal: options?.signal,
|
|
1597
1771
|
});
|
|
1598
1772
|
}
|
|
1599
1773
|
getRemoteComponentEntry(hostType, hostId, viewKey, options) {
|
|
1600
1774
|
return this.fetchText(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/remote-component/entry`, {
|
|
1601
|
-
headers: {
|
|
1775
|
+
headers: {
|
|
1776
|
+
Accept: "text/html",
|
|
1777
|
+
...createViewRuntimeHeaders(options?.runtimeScope),
|
|
1778
|
+
},
|
|
1602
1779
|
signal: options?.signal,
|
|
1603
1780
|
});
|
|
1604
1781
|
}
|
|
1605
1782
|
getParameterOptions(hostType, hostId, viewKey, parameterKey, query = {}, options) {
|
|
1606
1783
|
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/parameters/${encodeViewPathSegment(parameterKey)}/options`, {
|
|
1607
1784
|
params: createParameterOptionsParams(query),
|
|
1785
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1608
1786
|
signal: options?.signal,
|
|
1609
1787
|
});
|
|
1610
1788
|
}
|
|
@@ -1612,6 +1790,7 @@ export class ViewHostsClient extends BaseClient {
|
|
|
1612
1790
|
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/actions/${encodeViewPathSegment(actionKey)}`, {
|
|
1613
1791
|
method: "POST",
|
|
1614
1792
|
json: request,
|
|
1793
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1615
1794
|
signal: options?.signal,
|
|
1616
1795
|
});
|
|
1617
1796
|
}
|
|
@@ -1634,6 +1813,7 @@ export class ViewHostsClient extends BaseClient {
|
|
|
1634
1813
|
return this.fetch(`/${encodeViewPathSegment(hostType)}/${encodeViewPathSegment(hostId)}/views/${encodeViewPathSegment(viewKey)}/actions/${encodeViewPathSegment(actionKey)}/file`, {
|
|
1635
1814
|
method: "POST",
|
|
1636
1815
|
body: formData,
|
|
1816
|
+
headers: createViewRuntimeHeaders(options?.runtimeScope),
|
|
1637
1817
|
signal: options?.signal,
|
|
1638
1818
|
});
|
|
1639
1819
|
}
|
|
@@ -1647,6 +1827,14 @@ export class ViewHostsClient extends BaseClient {
|
|
|
1647
1827
|
return this.workspaceFiles.revokeSession(sessionId, options);
|
|
1648
1828
|
}
|
|
1649
1829
|
}
|
|
1830
|
+
function createViewRuntimeHeaders(scope) {
|
|
1831
|
+
return {
|
|
1832
|
+
...(scope?.projectId ? { "x-xpert-view-project-id": scope.projectId } : {}),
|
|
1833
|
+
...(scope?.conversationId
|
|
1834
|
+
? { "x-xpert-view-conversation-id": scope.conversationId }
|
|
1835
|
+
: {}),
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1650
1838
|
// Conversations Client
|
|
1651
1839
|
export class ConversationsClient extends BaseClient {
|
|
1652
1840
|
async create(payload) {
|
|
@@ -1658,6 +1846,12 @@ export class ConversationsClient extends BaseClient {
|
|
|
1658
1846
|
async get(conversationId) {
|
|
1659
1847
|
return this.fetch(`/conversations/${conversationId}`);
|
|
1660
1848
|
}
|
|
1849
|
+
async listWorkspaceFiles(conversationId, options = {}) {
|
|
1850
|
+
return this.fetch(`/conversations/${encodeURIComponent(conversationId)}/files`, {
|
|
1851
|
+
params: workspaceFileListParams(options),
|
|
1852
|
+
signal: options.signal,
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1661
1855
|
async update(conversationId, payload) {
|
|
1662
1856
|
return this.fetch(`/conversations/${conversationId}`, {
|
|
1663
1857
|
method: "PATCH",
|