@vertesia/client 1.6.0-dev.20260918.115658Z → 1.6.0-dev.20261004.085740Z
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/lib/AppsApi.d.ts +5 -0
- package/lib/AppsApi.d.ts.map +1 -1
- package/lib/AppsApi.js +9 -0
- package/lib/AppsApi.js.map +1 -1
- package/lib/EnvironmentsApi.d.ts +2 -1
- package/lib/EnvironmentsApi.d.ts.map +1 -1
- package/lib/EnvironmentsApi.js +3 -0
- package/lib/EnvironmentsApi.js.map +1 -1
- package/lib/InferenceProfilesApi.d.ts +14 -0
- package/lib/InferenceProfilesApi.d.ts.map +1 -0
- package/lib/InferenceProfilesApi.js +33 -0
- package/lib/InferenceProfilesApi.js.map +1 -0
- package/lib/InteractionBase.d.ts +2 -878
- package/lib/InteractionBase.d.ts.map +1 -1
- package/lib/InteractionConfigurationsApi.d.ts +9 -0
- package/lib/InteractionConfigurationsApi.d.ts.map +1 -0
- package/lib/InteractionConfigurationsApi.js +16 -0
- package/lib/InteractionConfigurationsApi.js.map +1 -0
- package/lib/InteractionOutput.d.ts +4 -0
- package/lib/InteractionOutput.d.ts.map +1 -1
- package/lib/InteractionOutput.js +13 -0
- package/lib/InteractionOutput.js.map +1 -1
- package/lib/InteractionsApi.d.ts +2 -7
- package/lib/InteractionsApi.d.ts.map +1 -1
- package/lib/InteractionsApi.js.map +1 -1
- package/lib/InternalAccountsApi.d.ts +7 -0
- package/lib/InternalAccountsApi.d.ts.map +1 -0
- package/lib/InternalAccountsApi.js +10 -0
- package/lib/InternalAccountsApi.js.map +1 -0
- package/lib/InternalRunBudgetsApi.d.ts +8 -0
- package/lib/InternalRunBudgetsApi.d.ts.map +1 -0
- package/lib/InternalRunBudgetsApi.js +11 -0
- package/lib/InternalRunBudgetsApi.js.map +1 -0
- package/lib/OAuthServerApi.d.ts +2 -1
- package/lib/OAuthServerApi.d.ts.map +1 -1
- package/lib/OAuthServerApi.js +3 -0
- package/lib/OAuthServerApi.js.map +1 -1
- package/lib/client.d.ts +10 -10
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +10 -0
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/store/AgentsApi.d.ts +6 -1
- package/lib/store/AgentsApi.d.ts.map +1 -1
- package/lib/store/AgentsApi.js +22 -0
- package/lib/store/AgentsApi.js.map +1 -1
- package/lib/store/ContentApi.d.ts +111 -0
- package/lib/store/ContentApi.d.ts.map +1 -0
- package/lib/store/ContentApi.js +83 -0
- package/lib/store/ContentApi.js.map +1 -0
- package/lib/store/DataApi.d.ts +1 -1
- package/lib/store/DataApi.js +1 -1
- package/lib/store/IndexingApi.d.ts +1 -1
- package/lib/store/IndexingApi.d.ts.map +1 -1
- package/lib/store/IndexingApi.js +2 -1
- package/lib/store/IndexingApi.js.map +1 -1
- package/lib/store/client.d.ts +2 -0
- package/lib/store/client.d.ts.map +1 -1
- package/lib/store/client.js +2 -0
- package/lib/store/client.js.map +1 -1
- package/lib/store/index.d.ts +1 -0
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +1 -0
- package/lib/store/index.js.map +1 -1
- package/lib/vertesia-client.js +4 -4
- package/lib/vertesia-client.js.map +1 -1
- package/package.json +12 -11
- package/src/AppsApi.ts +11 -0
- package/src/EnvironmentsApi.ts +6 -0
- package/src/InferenceProfilesApi.ts +47 -0
- package/src/InteractionConfigurationsApi.ts +20 -0
- package/src/InteractionOutput.ts +15 -0
- package/src/InteractionsApi.ts +2 -9
- package/src/InternalAccountsApi.ts +12 -0
- package/src/InternalRunBudgetsApi.ts +13 -0
- package/src/OAuthServerApi.ts +6 -0
- package/src/client.ts +12 -0
- package/src/index.ts +2 -0
- package/src/store/AgentsApi.ts +26 -0
- package/src/store/ContentApi.ts +158 -0
- package/src/store/DataApi.ts +1 -1
- package/src/store/IndexingApi.ts +2 -0
- package/src/store/client.ts +2 -0
- package/src/store/index.ts +1 -0
- package/src/AccountApi.test.ts +0 -30
- package/src/AppsApi.test.ts +0 -132
- package/src/EnvironmentsApi.test.ts +0 -39
- package/src/InteractionOutput.test.ts +0 -324
- package/src/OAuthServerApi.test.ts +0 -56
- package/src/ProjectsApi.test.ts +0 -33
- package/src/RunsApi.test.ts +0 -24
- package/src/ViewsApi.test.ts +0 -38
- package/src/bundle-isolation.test.ts +0 -37
- package/src/client.test.ts +0 -332
- package/src/execute.test.ts +0 -22
- package/src/store/AgentsApi.artifacts.test.ts +0 -119
- package/src/store/AgentsApi.history.test.ts +0 -29
- package/src/store/AgentsApi.stream.test.ts +0 -354
- package/src/store/DataApi.test.ts +0 -42
- package/src/store/EmbeddingsApi.test.ts +0 -31
- package/src/store/EventsApi.test.ts +0 -131
- package/src/store/FilesApi.test.ts +0 -105
- package/src/store/ObjectsApi.test.ts +0 -50
- package/src/store/ProcessApi.test.ts +0 -24
- package/src/store/ViewsApi.test.ts +0 -33
- package/src/store/signed-url.test.ts +0 -204
- package/src/store/stream-gap.test.ts +0 -230
- package/src/store/stream-termination.test.ts +0 -82
- package/src/store/uploadMimeType.test.ts +0 -22
package/package.json
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/client",
|
|
3
|
-
"version": "1.6.0-dev.
|
|
3
|
+
"version": "1.6.0-dev.20261004.085740Z",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib",
|
|
9
9
|
"src",
|
|
10
|
+
"!src/**/*.test.*",
|
|
10
11
|
"tsconfig.dist.json"
|
|
11
12
|
],
|
|
12
13
|
"license": "Apache-2.0",
|
|
13
14
|
"devDependencies": {
|
|
14
|
-
"@types/node": "^24.13.
|
|
15
|
+
"@types/node": "^24.13.6",
|
|
15
16
|
"@vertesia/tsconfig": "0.1.0",
|
|
16
|
-
"rolldown": "1.2.
|
|
17
|
+
"rolldown": "1.2.9",
|
|
17
18
|
"typescript": "7.0.2",
|
|
18
|
-
"vitest": "5.0.
|
|
19
|
+
"vitest": "5.0.1"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"@llumiverse/common": "1.6.0-dev.
|
|
22
|
-
"@vertesia/api-fetch-client": "1.6.0-dev.
|
|
23
|
-
"@vertesia/common": "1.6.0-dev.
|
|
24
|
-
"eventsource": "^5.1.
|
|
22
|
+
"@llumiverse/common": "1.6.0-dev.20261004.083934Z",
|
|
23
|
+
"@vertesia/api-fetch-client": "1.6.0-dev.20261004.085740Z",
|
|
24
|
+
"@vertesia/common": "1.6.0-dev.20261004.085740Z",
|
|
25
|
+
"eventsource": "^5.1.2"
|
|
25
26
|
},
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
@@ -48,13 +49,13 @@
|
|
|
48
49
|
"ai",
|
|
49
50
|
"typescript"
|
|
50
51
|
],
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b51b6dc9262f81f55e2424d1e57190060f6068d7",
|
|
52
53
|
"scripts": {
|
|
53
54
|
"lint": "biome lint src",
|
|
54
55
|
"clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
|
|
55
|
-
"build": "pnpm run clean:lib && tsc -p tsconfig.json && pnpm exec rolldown -c rolldown.config.js",
|
|
56
|
+
"build": "pnpm run clean:lib && tsc --checkers 1 -p tsconfig.json && pnpm exec rolldown -c rolldown.config.js",
|
|
56
57
|
"clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo",
|
|
57
58
|
"test": "vitest run",
|
|
58
|
-
"typecheck:test": "tsc -p tsconfig.test.json --noEmit"
|
|
59
|
+
"typecheck:test": "tsc --checkers 1 -p tsconfig.test.json --noEmit"
|
|
59
60
|
}
|
|
60
61
|
}
|
package/src/AppsApi.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
StartAppDevelopmentTaskRequest,
|
|
40
40
|
StartAppScaffoldRequest,
|
|
41
41
|
StartAppScaffoldResponse,
|
|
42
|
+
UpdateAppInstallationOAuthApprovalPayload,
|
|
42
43
|
UpdateAppInstallationToolAllowlistPayload,
|
|
43
44
|
UpdateAppPayload,
|
|
44
45
|
UpsertAppVersionRequest,
|
|
@@ -429,6 +430,16 @@ export default class AppsApi extends ApiTopic {
|
|
|
429
430
|
});
|
|
430
431
|
}
|
|
431
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Set project-admin approval for an installation's OAuth scopes.
|
|
435
|
+
* Pass an empty list to revoke approval.
|
|
436
|
+
*/
|
|
437
|
+
updateOAuthApproval(installId: string, approved_scopes: string[]): Promise<AppInstallationWithManifest> {
|
|
438
|
+
return this.put(`/installations/${installId}/oauth-approval`, {
|
|
439
|
+
payload: { approved_scopes } satisfies UpdateAppInstallationOAuthApprovalPayload,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
432
443
|
/**
|
|
433
444
|
* Update the tool allowlist for an app installation.
|
|
434
445
|
* Pass null to remove all restrictions (all tools permitted).
|
package/src/EnvironmentsApi.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type {
|
|
|
15
15
|
ExecutionEnvironmentUpdatePayload,
|
|
16
16
|
MigrateInteractionsPayload,
|
|
17
17
|
MigrateInteractionsResult,
|
|
18
|
+
RunBudgetCapability,
|
|
19
|
+
RunBudgetCapabilityQuery,
|
|
18
20
|
} from '@vertesia/common';
|
|
19
21
|
|
|
20
22
|
export default class EnvironmentsApi extends ApiTopic {
|
|
@@ -38,6 +40,10 @@ export default class EnvironmentsApi extends ApiTopic {
|
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
runBudgetCapability(id: string, query: RunBudgetCapabilityQuery): Promise<RunBudgetCapability> {
|
|
44
|
+
return this.get(`/${id}/run-budget-capability`, { query });
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
retrieve(id: string): Promise<ExecutionEnvironment> {
|
|
42
48
|
return this.get(`/${id}`);
|
|
43
49
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
CreateInferenceProfilePayload,
|
|
4
|
+
DeleteByIdResult,
|
|
5
|
+
InferenceProfile,
|
|
6
|
+
InferenceProfileRecord,
|
|
7
|
+
InferenceProfileUsage,
|
|
8
|
+
InferenceProfileUsageQuery,
|
|
9
|
+
ProjectConfiguration,
|
|
10
|
+
ProjectInferenceProfiles,
|
|
11
|
+
UpdateInferenceProfilePayload,
|
|
12
|
+
} from '@vertesia/common';
|
|
13
|
+
|
|
14
|
+
export default class InferenceProfilesApi extends ApiTopic {
|
|
15
|
+
constructor(parent: ClientBase) {
|
|
16
|
+
super(parent, '/api/v1/inference-profiles');
|
|
17
|
+
}
|
|
18
|
+
/** Read a category or base default, including projects awaiting the defaults migration. */
|
|
19
|
+
async getDefault(
|
|
20
|
+
configuration: Pick<ProjectConfiguration, 'inference' | 'defaults'>,
|
|
21
|
+
category?: keyof NonNullable<ProjectInferenceProfiles['system']>,
|
|
22
|
+
): Promise<InferenceProfileRecord | InferenceProfile | undefined> {
|
|
23
|
+
const settings = configuration.inference;
|
|
24
|
+
const id = (category ? settings?.system?.[category] : undefined) ?? settings?.default_profile;
|
|
25
|
+
if (id) return this.retrieve(id);
|
|
26
|
+
return (category ? configuration.defaults?.system?.[category] : undefined) ?? configuration.defaults?.base;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
list(): Promise<InferenceProfileRecord[]> {
|
|
30
|
+
return this.get('/');
|
|
31
|
+
}
|
|
32
|
+
retrieve(id: string): Promise<InferenceProfileRecord> {
|
|
33
|
+
return this.get(`/${encodeURIComponent(id)}`);
|
|
34
|
+
}
|
|
35
|
+
usage(id: string, query: InferenceProfileUsageQuery = {}): Promise<InferenceProfileUsage> {
|
|
36
|
+
return this.get(`/${encodeURIComponent(id)}/usage`, { query });
|
|
37
|
+
}
|
|
38
|
+
create(payload: CreateInferenceProfilePayload): Promise<InferenceProfileRecord> {
|
|
39
|
+
return this.post('/', { payload });
|
|
40
|
+
}
|
|
41
|
+
update(id: string, payload: UpdateInferenceProfilePayload): Promise<InferenceProfileRecord> {
|
|
42
|
+
return this.put(`/${encodeURIComponent(id)}`, { payload });
|
|
43
|
+
}
|
|
44
|
+
delete(id: string): Promise<DeleteByIdResult> {
|
|
45
|
+
return this.del(`/${encodeURIComponent(id)}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { InteractionConfigurationResult, UpdateInteractionConfigurationPayload } from '@vertesia/common';
|
|
3
|
+
|
|
4
|
+
export default class InteractionConfigurationsApi extends ApiTopic {
|
|
5
|
+
constructor(parent: ClientBase) {
|
|
6
|
+
super(parent, '/api/v1/interaction-configurations');
|
|
7
|
+
}
|
|
8
|
+
retrieve(interactionId: string): Promise<InteractionConfigurationResult> {
|
|
9
|
+
return this.get(`/${encodeURIComponent(interactionId)}`);
|
|
10
|
+
}
|
|
11
|
+
update(
|
|
12
|
+
interactionId: string,
|
|
13
|
+
payload: UpdateInteractionConfigurationPayload,
|
|
14
|
+
): Promise<InteractionConfigurationResult> {
|
|
15
|
+
return this.put(`/${encodeURIComponent(interactionId)}`, { payload });
|
|
16
|
+
}
|
|
17
|
+
delete(interactionId: string): Promise<InteractionConfigurationResult> {
|
|
18
|
+
return this.del(`/${encodeURIComponent(interactionId)}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/InteractionOutput.ts
CHANGED
|
@@ -217,6 +217,21 @@ export class InteractionOutput<T = unknown> {
|
|
|
217
217
|
return this.results.filter((r) => r.type === 'image').map((r) => r.value);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
hasAudio(): boolean {
|
|
221
|
+
return this.results.some((r) => r.type === 'audio');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Get complete audio metadata and its durable file reference. */
|
|
225
|
+
audios() {
|
|
226
|
+
return this.results.filter((r) => r.type === 'audio');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
audio() {
|
|
230
|
+
const result = this.audios()[0];
|
|
231
|
+
if (!result) throw new Error('No audio result found');
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
|
|
220
235
|
/** Get the first video result URI. */
|
|
221
236
|
video(): string {
|
|
222
237
|
const videoResult = this.results.find((r) => r.type === 'video');
|
package/src/InteractionsApi.ts
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
RateLimitRequestPayload,
|
|
31
31
|
RateLimitRequestResponse,
|
|
32
32
|
ResolvedInteractionExecutionInfo,
|
|
33
|
+
ResolveInteractionQuery,
|
|
33
34
|
} from '@vertesia/common';
|
|
34
35
|
import type { VertesiaClient } from './client.js';
|
|
35
36
|
import { checkRateLimit, executeInteraction, executeInteractionAsync, executeInteractionByName } from './execute.js';
|
|
@@ -341,15 +342,7 @@ export default class InteractionsApi extends ApiTopic {
|
|
|
341
342
|
* @param options Optional environment and/or model to resolve with
|
|
342
343
|
* @returns ResolvedInteractionExecutionInfo with the resolved environment and model
|
|
343
344
|
*/
|
|
344
|
-
resolve(
|
|
345
|
-
nameOrId: string,
|
|
346
|
-
options?: {
|
|
347
|
-
environment?: string;
|
|
348
|
-
model?: string;
|
|
349
|
-
hasImage?: boolean;
|
|
350
|
-
hasVideo?: boolean;
|
|
351
|
-
},
|
|
352
|
-
): Promise<ResolvedInteractionExecutionInfo> {
|
|
345
|
+
resolve(nameOrId: string, options?: ResolveInteractionQuery): Promise<ResolvedInteractionExecutionInfo> {
|
|
353
346
|
return this.get(`/resolve/${encodeURIComponent(nameOrId)}`, {
|
|
354
347
|
query: options,
|
|
355
348
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { AccountApiVersionPolicy } from '@vertesia/common';
|
|
3
|
+
|
|
4
|
+
export default class InternalAccountsApi extends ApiTopic {
|
|
5
|
+
constructor(parent: ClientBase) {
|
|
6
|
+
super(parent, '/internal/accounts');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getApiVersionPolicy(accountId: string): Promise<AccountApiVersionPolicy> {
|
|
10
|
+
return this.get(`/${encodeURIComponent(accountId)}/api-version-policy`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { ReadRunBudgetUsagePayload, RunBudgetTotals } from '@vertesia/common';
|
|
3
|
+
|
|
4
|
+
/** Workload-authenticated accounting operations. Ordinary user tokens are not accepted. */
|
|
5
|
+
export default class InternalRunBudgetsApi extends ApiTopic {
|
|
6
|
+
constructor(parent: ClientBase) {
|
|
7
|
+
super(parent, '/internal/run-budget');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
usage(payload: ReadRunBudgetUsagePayload): Promise<RunBudgetTotals> {
|
|
11
|
+
return this.post('/usage', { payload });
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/OAuthServerApi.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
OAuthDeviceAuthorizationRequest,
|
|
8
8
|
OAuthDeviceAuthorizationResponse,
|
|
9
9
|
OAuthGrantableScopesResponse,
|
|
10
|
+
OAuthLoginDecisionResponse,
|
|
11
|
+
OAuthLoginPayload,
|
|
10
12
|
} from '@vertesia/common';
|
|
11
13
|
|
|
12
14
|
export default class OAuthServerApi extends ClientBase {
|
|
@@ -20,6 +22,10 @@ export default class OAuthServerApi extends ClientBase {
|
|
|
20
22
|
this.verboseErrors = parent.verboseErrors;
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
login(requestId: string, payload: OAuthLoginPayload): Promise<OAuthLoginDecisionResponse> {
|
|
26
|
+
return this.post(`/requests/${encodeURIComponent(requestId)}/login`, { payload });
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
get headers() {
|
|
24
30
|
return this.parent.headers;
|
|
25
31
|
}
|
package/src/client.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbstractFetchClient, type FETCH_FN, type IRequestRetryPolicy } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type { AppSessionTokenRequest, AppSessionTokenResponse } from '@vertesia/common';
|
|
2
3
|
import { APP_VERSION_HEADER, type AuthTokenPayload, type AuthTokenResponse } from '@vertesia/common';
|
|
3
4
|
import AccountApi from './AccountApi.js';
|
|
4
5
|
import AccountsApi from './AccountsApi.js';
|
|
@@ -10,7 +11,10 @@ import CommandsApi from './CommandsApi.js';
|
|
|
10
11
|
import DelegationGrantsApi from './DelegationGrantsApi.js';
|
|
11
12
|
import EnvironmentsApi from './EnvironmentsApi.js';
|
|
12
13
|
import { IamApi } from './IamApi.js';
|
|
14
|
+
import InferenceProfilesApi from './InferenceProfilesApi.js';
|
|
15
|
+
import InteractionConfigurationsApi from './InteractionConfigurationsApi.js';
|
|
13
16
|
import InteractionsApi from './InteractionsApi.js';
|
|
17
|
+
import InternalRunBudgetsApi from './InternalRunBudgetsApi.js';
|
|
14
18
|
import InternalSecretsApi from './InternalSecretsApi.js';
|
|
15
19
|
import OAuthClientsApi from './OAuthClientsApi.js';
|
|
16
20
|
import OAuthGrantsApi from './OAuthGrantsApi.js';
|
|
@@ -125,6 +129,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
125
129
|
remoteMcpConnections: RemoteMcpConnectionsApi;
|
|
126
130
|
secrets: SecretsApi;
|
|
127
131
|
internalSecrets: InternalSecretsApi;
|
|
132
|
+
internalRunBudgets: InternalRunBudgetsApi;
|
|
128
133
|
|
|
129
134
|
/**
|
|
130
135
|
* Create a client from the given token.
|
|
@@ -257,6 +262,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
257
262
|
this.remoteMcpConnections = new RemoteMcpConnectionsApi(this);
|
|
258
263
|
this.secrets = new SecretsApi(this);
|
|
259
264
|
this.internalSecrets = new InternalSecretsApi(this);
|
|
265
|
+
this.internalRunBudgets = new InternalRunBudgetsApi(this);
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
withApiVersion(version: string | number | null) {
|
|
@@ -412,6 +418,10 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
412
418
|
*
|
|
413
419
|
* @returns AuthTokenResponse
|
|
414
420
|
*/
|
|
421
|
+
async mintAppSessionToken(request: AppSessionTokenRequest): Promise<AppSessionTokenResponse> {
|
|
422
|
+
return this.post<AppSessionTokenResponse>(`${this.tokenServerUrl}/token/app-session`, { payload: request });
|
|
423
|
+
}
|
|
424
|
+
|
|
415
425
|
async getAuthToken(token?: string): Promise<AuthTokenResponse> {
|
|
416
426
|
// Route through the base client (absolute URL) so the call benefits from the
|
|
417
427
|
// retry policy. The default retry methods exclude POST as non-idempotent, but
|
|
@@ -440,6 +450,8 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
440
450
|
}
|
|
441
451
|
|
|
442
452
|
projects = new ProjectsApi(this);
|
|
453
|
+
interactionConfigurations = new InteractionConfigurationsApi(this);
|
|
454
|
+
inferenceProfiles = new InferenceProfilesApi(this);
|
|
443
455
|
environments = new EnvironmentsApi(this);
|
|
444
456
|
interactions = new InteractionsApi(this);
|
|
445
457
|
skills = new SkillsApi(this);
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { default as DelegationGrantsApi } from './DelegationGrantsApi.js';
|
|
|
7
7
|
export type { GroupsQueryOptions } from './GroupsApi.js';
|
|
8
8
|
export * from './InteractionBase.js';
|
|
9
9
|
export * from './InteractionOutput.js';
|
|
10
|
+
export { default as InternalAccountsApi } from './InternalAccountsApi.js';
|
|
11
|
+
export { default as InternalRunBudgetsApi } from './InternalRunBudgetsApi.js';
|
|
10
12
|
export { default as InternalSecretsApi } from './InternalSecretsApi.js';
|
|
11
13
|
export * from './managed-sse.js';
|
|
12
14
|
export { default as OAuthClientsApi } from './OAuthClientsApi.js';
|
package/src/store/AgentsApi.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type AgentRunInternals,
|
|
13
13
|
type AgentRunResponse,
|
|
14
14
|
type AgentRunUpdatesResponse,
|
|
15
|
+
type AllocateAgentRunBudgetPayload,
|
|
15
16
|
type BindRunWorkflowPayload,
|
|
16
17
|
type CreateAgentRunPayload,
|
|
17
18
|
type CreateProcessRunPayload,
|
|
@@ -226,6 +227,14 @@ export class AgentsApi extends ApiTopic {
|
|
|
226
227
|
return this.post(`/${id}/restart`, {});
|
|
227
228
|
}
|
|
228
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Add token budget to a run paused because its budget ran out; the run resumes from where it
|
|
232
|
+
* stopped. The amount is added to the limit the run was granted, so usage past it is paid first.
|
|
233
|
+
*/
|
|
234
|
+
allocateBudget(id: string, payload: AllocateAgentRunBudgetPayload): Promise<SignalAgentResponse> {
|
|
235
|
+
return this.post(`/${id}/budget`, { payload });
|
|
236
|
+
}
|
|
237
|
+
|
|
229
238
|
/**
|
|
230
239
|
* Fork a conversation into a new agent run.
|
|
231
240
|
*/
|
|
@@ -435,6 +444,15 @@ export class AgentsApi extends ApiTopic {
|
|
|
435
444
|
);
|
|
436
445
|
};
|
|
437
446
|
|
|
447
|
+
// A 404 while polling means the run itself is gone (deleted, or never persisted): nothing
|
|
448
|
+
// will ever arrive, so stop instead of polling the missing resource every 5s forever.
|
|
449
|
+
const isRunGone = (error: unknown): boolean =>
|
|
450
|
+
typeof error === 'object' && error !== null && (error as { status?: unknown }).status === 404;
|
|
451
|
+
const exitBecauseRunGone = () => {
|
|
452
|
+
console.warn(`Agent stream ${id}: the run no longer exists (404); stopping the polling fallback.`);
|
|
453
|
+
exit(null);
|
|
454
|
+
};
|
|
455
|
+
|
|
438
456
|
const pollTick = async () => {
|
|
439
457
|
if (isClosed || !isPolling) return;
|
|
440
458
|
let polledMessages = false;
|
|
@@ -456,6 +474,10 @@ export class AgentsApi extends ApiTopic {
|
|
|
456
474
|
}
|
|
457
475
|
}
|
|
458
476
|
} catch (err) {
|
|
477
|
+
if (isRunGone(err)) {
|
|
478
|
+
exitBecauseRunGone();
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
459
481
|
warnPollFailure('GET /updates', err);
|
|
460
482
|
}
|
|
461
483
|
if (isClosed || !isPolling) return;
|
|
@@ -468,6 +490,10 @@ export class AgentsApi extends ApiTopic {
|
|
|
468
490
|
}
|
|
469
491
|
if (polledMessages) consecutivePollFailures = 0;
|
|
470
492
|
} catch (err) {
|
|
493
|
+
if (isRunGone(err)) {
|
|
494
|
+
exitBecauseRunGone();
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
471
497
|
warnPollFailure('run status check', err);
|
|
472
498
|
}
|
|
473
499
|
if (isClosed || !isPolling) return;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
|
|
2
|
+
import type {
|
|
3
|
+
Collection,
|
|
4
|
+
ComplexSearchPayload,
|
|
5
|
+
ComputedFacetResponse,
|
|
6
|
+
ContentObject,
|
|
7
|
+
ContentObjectItem,
|
|
8
|
+
GetFileUrlResponse,
|
|
9
|
+
GetRenditionResponse,
|
|
10
|
+
} from '@vertesia/common';
|
|
11
|
+
|
|
12
|
+
/** A project sharing content with the caller. */
|
|
13
|
+
export interface SharedProjectRef {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A lightweight entry in a shared browse listing (root list or collection members). */
|
|
19
|
+
export interface SharedContentEntry {
|
|
20
|
+
type: 'object' | 'collection';
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
modified_at: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Result of resolving a bare content id: the entity, its type, and the project it lives in. */
|
|
27
|
+
export type ResolvedContent =
|
|
28
|
+
| { type: 'object'; projectId: string; entity: ContentObject }
|
|
29
|
+
| { type: 'collection'; projectId: string; entity: Collection };
|
|
30
|
+
|
|
31
|
+
/** A cross-project search hit, stamped with its owner project and relevance score. */
|
|
32
|
+
export type ContentSearchHit = ContentObjectItem & { projectId: string; score: number };
|
|
33
|
+
|
|
34
|
+
/** Which projects a cross-project content search covered. */
|
|
35
|
+
export interface SharedSearchCoverage {
|
|
36
|
+
/** 'hybrid' when vector search ran on at least one field, otherwise 'text'. */
|
|
37
|
+
mode: 'text' | 'hybrid';
|
|
38
|
+
/** Project ids actually searched — full-text spans every reachable project. */
|
|
39
|
+
searched: string[];
|
|
40
|
+
/** Reachable project ids excluded from the vector pass as embedding-incompatible (hybrid only). */
|
|
41
|
+
vectorIncompatible: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Response of the cross-project content search: the hits plus `coverage`. This is an object envelope —
|
|
46
|
+
* distinct from the plain array returned by the single-project object search — so callers can tell the
|
|
47
|
+
* two apart (array = project search, `{ results, coverage }` = cross-project search).
|
|
48
|
+
*/
|
|
49
|
+
export interface ContentSearchResponse {
|
|
50
|
+
results: ContentSearchHit[];
|
|
51
|
+
/** Facets computed across every reachable project. */
|
|
52
|
+
facets: ComputedFacetResponse;
|
|
53
|
+
coverage: SharedSearchCoverage;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Read-only client for the `/api/content` namespace: browse and read content shared by other
|
|
58
|
+
* projects in the account, resolve a bare content id, and search across the caller's reachable
|
|
59
|
+
* content (current project + shared projects). There are no write operations.
|
|
60
|
+
*/
|
|
61
|
+
export class ContentApi extends ApiTopic {
|
|
62
|
+
constructor(parent: ClientBase) {
|
|
63
|
+
super(parent, '/api/v1/content');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The projects sharing content with the caller (`{ id, name }`). */
|
|
67
|
+
listSharedProjects(): Promise<SharedProjectRef[]> {
|
|
68
|
+
return this.get('/shared');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Shared COLLECTIONS at a browse level — the root collections of a shared project (no `parentId`),
|
|
73
|
+
* or the sub-collections of `parentId` within it. Bounded set, returned in full, newest first.
|
|
74
|
+
*/
|
|
75
|
+
sharedCollections(projectId: string, parentId?: string): Promise<SharedContentEntry[]> {
|
|
76
|
+
const path = parentId ? `/shared/${projectId}/${parentId}` : `/shared/${projectId}`;
|
|
77
|
+
return this.get(path, { query: { list: 'collections' } });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A page of shared OBJECTS at a browse level — the root objects of a shared project (no `parentId`),
|
|
82
|
+
* or the member objects of `parentId` within it. Paginated via `from`/`limit`, newest first.
|
|
83
|
+
*/
|
|
84
|
+
sharedObjects(
|
|
85
|
+
projectId: string,
|
|
86
|
+
parentId?: string,
|
|
87
|
+
options?: { from?: number; limit?: number },
|
|
88
|
+
): Promise<SharedContentEntry[]> {
|
|
89
|
+
const path = parentId ? `/shared/${projectId}/${parentId}` : `/shared/${projectId}`;
|
|
90
|
+
return this.get(path, { query: { list: 'objects', from: options?.from, limit: options?.limit } });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Read a shared entity's detail: an object id → the full object; a collection id → its meta. */
|
|
94
|
+
getShared(projectId: string, id: string): Promise<ContentObject | Collection> {
|
|
95
|
+
return this.get(`/shared/${projectId}/${id}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A rendition (visual content) of a shared object — the rendered file (image / PDF) from the owner
|
|
100
|
+
* project's storage. `format`: 'jpeg' | 'png' | 'webp' | 'pdf' | 'docx'. Returns `{ status, renditions:
|
|
101
|
+
* url[] }`; rejects with 404 if no rendition of that format has been generated yet by the owner project.
|
|
102
|
+
*/
|
|
103
|
+
getSharedRendition(
|
|
104
|
+
projectId: string,
|
|
105
|
+
id: string,
|
|
106
|
+
format: string,
|
|
107
|
+
options?: { max_hw?: number },
|
|
108
|
+
): Promise<GetRenditionResponse> {
|
|
109
|
+
return this.get(`/shared/${projectId}/${id}/renditions/${format}`, {
|
|
110
|
+
query: { max_hw: options?.max_hw },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Signed download URL for a shared object's OWN file (its content source) from the owner project's
|
|
116
|
+
* storage — used to preview a native PDF/image or download the existing file cross-project.
|
|
117
|
+
* `disposition` 'attachment' forces a download (default 'inline'). Rejects with 404 if the object
|
|
118
|
+
* isn't shared/authorized or has no content source. Read-only: never generates anything.
|
|
119
|
+
*/
|
|
120
|
+
getSharedFileUrl(
|
|
121
|
+
projectId: string,
|
|
122
|
+
id: string,
|
|
123
|
+
disposition?: 'inline' | 'attachment',
|
|
124
|
+
): Promise<GetFileUrlResponse> {
|
|
125
|
+
return this.get(`/shared/${projectId}/${id}/file`, { query: { disposition } });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Resolve a bare content id when the project is unknown — the current project is checked first,
|
|
130
|
+
* then the shared projects. Returns the entity, its type, and the resolved projectId.
|
|
131
|
+
*/
|
|
132
|
+
resolve(objectId: string): Promise<ResolvedContent> {
|
|
133
|
+
return this.get(`/resolve/${objectId}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Search content reachable by the caller (current project + shared projects). Takes the same
|
|
138
|
+
* `ComplexSearchPayload` as `objects.search` — full-text, vector/hybrid, filters and facets — applied
|
|
139
|
+
* across every reachable project (vector runs only over embedding-compatible ones). `onlyShared` drops
|
|
140
|
+
* the current project. Pagination (`payload.limit`/`offset`) is text-only; a vector/hybrid run returns
|
|
141
|
+
* a top-N window. Returns `{ results, facets, coverage }` — each hit stamped with its owner projectId,
|
|
142
|
+
* plus which projects were searched vs. excluded from the vector pass.
|
|
143
|
+
*/
|
|
144
|
+
search(payload: ComplexSearchPayload, options?: { onlyShared?: boolean }): Promise<ContentSearchResponse> {
|
|
145
|
+
return this.post('/search', {
|
|
146
|
+
payload,
|
|
147
|
+
query: { onlyShared: options?.onlyShared ? 'true' : undefined },
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The CURRENT project's shared roots (collections + documents) — the Manage view. Requires
|
|
153
|
+
* content-admin. Unshare an entry via the regular collection/object update with `shared_root: false`.
|
|
154
|
+
*/
|
|
155
|
+
managed(): Promise<SharedContentEntry[]> {
|
|
156
|
+
return this.get('/managed');
|
|
157
|
+
}
|
|
158
|
+
}
|
package/src/store/DataApi.ts
CHANGED
|
@@ -463,7 +463,7 @@ export class DataApi extends ApiTopic {
|
|
|
463
463
|
* const info = await client.data.getDownloadInfo(storeId);
|
|
464
464
|
* // Download if gcs_generation changed
|
|
465
465
|
* if (info.gcs_generation !== localGeneration) {
|
|
466
|
-
* await downloadFile(info.url, '
|
|
466
|
+
* await downloadFile(info.url, 'databases/store.duckdb');
|
|
467
467
|
* }
|
|
468
468
|
* ```
|
|
469
469
|
*/
|
package/src/store/IndexingApi.ts
CHANGED
|
@@ -335,12 +335,14 @@ export class IndexingApi extends ApiTopic {
|
|
|
335
335
|
targetIndex: string,
|
|
336
336
|
alias?: string,
|
|
337
337
|
backend?: ElasticsearchBackend,
|
|
338
|
+
cleanup?: boolean,
|
|
338
339
|
): Promise<SwapAliasResult> {
|
|
339
340
|
return this.zenoBulkPost('/reindex/swap-alias', {
|
|
340
341
|
tenant_id: tenantId,
|
|
341
342
|
target_index: targetIndex,
|
|
342
343
|
alias,
|
|
343
344
|
backend,
|
|
345
|
+
cleanup,
|
|
344
346
|
} satisfies SwapAliasRequest);
|
|
345
347
|
}
|
|
346
348
|
}
|
package/src/store/client.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { APP_VERSION_HEADER, type BulkOperationPayload, type BulkOperationRespon
|
|
|
8
8
|
import { warnUnknownOptions } from '../unknown-options.js';
|
|
9
9
|
import { AgentsApi } from './AgentsApi.js';
|
|
10
10
|
import { CollectionsApi } from './CollectionsApi.js';
|
|
11
|
+
import { ContentApi } from './ContentApi.js';
|
|
11
12
|
import { CostApi } from './CostApi.js';
|
|
12
13
|
import { DataApi } from './DataApi.js';
|
|
13
14
|
import { EmailApi } from './EmailApi.js';
|
|
@@ -122,6 +123,7 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
|
|
|
122
123
|
agents = new AgentsApi(this);
|
|
123
124
|
cost = new CostApi(this);
|
|
124
125
|
objects = new ObjectsApi(this);
|
|
126
|
+
content = new ContentApi(this);
|
|
125
127
|
types = new TypesApi(this);
|
|
126
128
|
workflows = new WorkflowsApi(this);
|
|
127
129
|
schedules = new SchedulesApi(this);
|
package/src/store/index.ts
CHANGED
package/src/AccountApi.test.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { VertesiaClient } from './client.js';
|
|
3
|
-
|
|
4
|
-
describe('AccountApi', () => {
|
|
5
|
-
it('returns onboarding.completed_at as the ISO string received over JSON', async () => {
|
|
6
|
-
const completedAt = '2026-07-29T10:00:00.000Z';
|
|
7
|
-
const fetchMock = vi.fn(async () => {
|
|
8
|
-
return new Response(
|
|
9
|
-
JSON.stringify({
|
|
10
|
-
id: 'account-id',
|
|
11
|
-
onboarding: { completed: true, completed_at: completedAt },
|
|
12
|
-
}),
|
|
13
|
-
{
|
|
14
|
-
status: 200,
|
|
15
|
-
headers: { 'content-type': 'application/json' },
|
|
16
|
-
},
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
const client = new VertesiaClient({
|
|
20
|
-
serverUrl: 'https://api.example.com',
|
|
21
|
-
storeUrl: 'https://api.example.com',
|
|
22
|
-
fetch: fetchMock,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const account = await client.account.info();
|
|
26
|
-
|
|
27
|
-
expect(account.onboarding.completed_at).toBe(completedAt);
|
|
28
|
-
expect(account.onboarding.completed_at).not.toBeInstanceOf(Date);
|
|
29
|
-
});
|
|
30
|
-
});
|