@vertesia/client 1.6.0-dev.20260923.085325Z → 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/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 -954
- 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/InteractionsApi.d.ts +2 -7
- package/lib/InteractionsApi.d.ts.map +1 -1
- package/lib/InteractionsApi.js.map +1 -1
- 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/client.d.ts +8 -10
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +7 -0
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -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 +7 -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 +11 -10
- package/src/EnvironmentsApi.ts +6 -0
- package/src/InferenceProfilesApi.ts +47 -0
- package/src/InteractionConfigurationsApi.ts +20 -0
- package/src/InteractionsApi.ts +2 -9
- package/src/InternalRunBudgetsApi.ts +13 -0
- package/src/client.ts +7 -0
- package/src/index.ts +1 -0
- package/src/store/AgentsApi.ts +9 -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 -338
- 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/app-session.test.ts +0 -23
- 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 -386
- 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 -118
- 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
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/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/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,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/client.ts
CHANGED
|
@@ -11,7 +11,10 @@ import CommandsApi from './CommandsApi.js';
|
|
|
11
11
|
import DelegationGrantsApi from './DelegationGrantsApi.js';
|
|
12
12
|
import EnvironmentsApi from './EnvironmentsApi.js';
|
|
13
13
|
import { IamApi } from './IamApi.js';
|
|
14
|
+
import InferenceProfilesApi from './InferenceProfilesApi.js';
|
|
15
|
+
import InteractionConfigurationsApi from './InteractionConfigurationsApi.js';
|
|
14
16
|
import InteractionsApi from './InteractionsApi.js';
|
|
17
|
+
import InternalRunBudgetsApi from './InternalRunBudgetsApi.js';
|
|
15
18
|
import InternalSecretsApi from './InternalSecretsApi.js';
|
|
16
19
|
import OAuthClientsApi from './OAuthClientsApi.js';
|
|
17
20
|
import OAuthGrantsApi from './OAuthGrantsApi.js';
|
|
@@ -126,6 +129,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
126
129
|
remoteMcpConnections: RemoteMcpConnectionsApi;
|
|
127
130
|
secrets: SecretsApi;
|
|
128
131
|
internalSecrets: InternalSecretsApi;
|
|
132
|
+
internalRunBudgets: InternalRunBudgetsApi;
|
|
129
133
|
|
|
130
134
|
/**
|
|
131
135
|
* Create a client from the given token.
|
|
@@ -258,6 +262,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
258
262
|
this.remoteMcpConnections = new RemoteMcpConnectionsApi(this);
|
|
259
263
|
this.secrets = new SecretsApi(this);
|
|
260
264
|
this.internalSecrets = new InternalSecretsApi(this);
|
|
265
|
+
this.internalRunBudgets = new InternalRunBudgetsApi(this);
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
withApiVersion(version: string | number | null) {
|
|
@@ -445,6 +450,8 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
|
|
|
445
450
|
}
|
|
446
451
|
|
|
447
452
|
projects = new ProjectsApi(this);
|
|
453
|
+
interactionConfigurations = new InteractionConfigurationsApi(this);
|
|
454
|
+
inferenceProfiles = new InferenceProfilesApi(this);
|
|
448
455
|
environments = new EnvironmentsApi(this);
|
|
449
456
|
interactions = new InteractionsApi(this);
|
|
450
457
|
skills = new SkillsApi(this);
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { GroupsQueryOptions } from './GroupsApi.js';
|
|
|
8
8
|
export * from './InteractionBase.js';
|
|
9
9
|
export * from './InteractionOutput.js';
|
|
10
10
|
export { default as InternalAccountsApi } from './InternalAccountsApi.js';
|
|
11
|
+
export { default as InternalRunBudgetsApi } from './InternalRunBudgetsApi.js';
|
|
11
12
|
export { default as InternalSecretsApi } from './InternalSecretsApi.js';
|
|
12
13
|
export * from './managed-sse.js';
|
|
13
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
|
*/
|
|
@@ -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
|
-
});
|
package/src/AppsApi.test.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { VertesiaClient } from './client.js';
|
|
3
|
-
|
|
4
|
-
describe('AppsApi', () => {
|
|
5
|
-
it('starts an in-place version rebuild without a caller-controlled payload', async () => {
|
|
6
|
-
const requests: Request[] = [];
|
|
7
|
-
const fetchMock = vi.fn(async () =>
|
|
8
|
-
Response.json({
|
|
9
|
-
workflow_id: 'workflow-1',
|
|
10
|
-
run_id: 'run-1',
|
|
11
|
-
app_id: 'sample-app',
|
|
12
|
-
version_id: 'version-1',
|
|
13
|
-
rebuild_version_record_id: 'record-1',
|
|
14
|
-
}),
|
|
15
|
-
);
|
|
16
|
-
const client = new VertesiaClient({
|
|
17
|
-
serverUrl: 'https://studio.example.com',
|
|
18
|
-
storeUrl: 'https://zeno.example.com',
|
|
19
|
-
fetch: fetchMock,
|
|
20
|
-
onRequest: (request) => requests.push(request),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const result = await client.apps.rebuildVersion('record-1');
|
|
24
|
-
|
|
25
|
-
expect(result.version_id).toBe('version-1');
|
|
26
|
-
expect(requests[0]?.method).toBe('POST');
|
|
27
|
-
expect(requests[0]?.url).toBe('https://studio.example.com/api/v1/apps/versions/record-1/rebuild');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('deletes a version through its dedicated endpoint', async () => {
|
|
31
|
-
const requests: Request[] = [];
|
|
32
|
-
const fetchMock = vi.fn(async () =>
|
|
33
|
-
Response.json({
|
|
34
|
-
id: 'record-1',
|
|
35
|
-
app_id: 'sample-app',
|
|
36
|
-
version_id: 'version-1',
|
|
37
|
-
deleted: true,
|
|
38
|
-
warnings: [],
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
const client = new VertesiaClient({
|
|
42
|
-
serverUrl: 'https://studio.example.com',
|
|
43
|
-
storeUrl: 'https://zeno.example.com',
|
|
44
|
-
fetch: fetchMock,
|
|
45
|
-
onRequest: (request) => requests.push(request),
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const result = await client.apps.deleteVersion('record-1');
|
|
49
|
-
|
|
50
|
-
expect(result.deleted).toBe(true);
|
|
51
|
-
expect(requests[0]?.method).toBe('DELETE');
|
|
52
|
-
expect(requests[0]?.url).toBe('https://studio.example.com/api/v1/apps/versions/record-1');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('returns the original response bytes and content type', async () => {
|
|
56
|
-
const requests: Request[] = [];
|
|
57
|
-
const bytes = new Uint8Array([0, 255, 10, 42]);
|
|
58
|
-
const fetchMock = vi.fn(
|
|
59
|
-
async () =>
|
|
60
|
-
new Response(bytes, {
|
|
61
|
-
status: 200,
|
|
62
|
-
headers: { 'content-type': 'application/octet-stream' },
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
65
|
-
const client = new VertesiaClient({
|
|
66
|
-
serverUrl: 'https://studio.example.com',
|
|
67
|
-
storeUrl: 'https://zeno.example.com',
|
|
68
|
-
fetch: fetchMock,
|
|
69
|
-
onRequest: (request) => requests.push(request),
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const response = await client.apps.getRepoFile('sample-app', 'docs/file.bin', { ref: 'feature/demo' });
|
|
73
|
-
|
|
74
|
-
expect(response.headers.get('content-type')).toBe('application/octet-stream');
|
|
75
|
-
expect(new Uint8Array(await response.arrayBuffer())).toEqual(bytes);
|
|
76
|
-
expect(requests[0]?.url).toBe(
|
|
77
|
-
'https://studio.example.com/api/v1/apps/sample-app/repo/file?path=docs%2Ffile.bin&ref=feature%2Fdemo',
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('uploads multiple documents as one multipart commit request', async () => {
|
|
82
|
-
const requests: Request[] = [];
|
|
83
|
-
const fetchMock = vi.fn(async () =>
|
|
84
|
-
Response.json({
|
|
85
|
-
ref: 'main',
|
|
86
|
-
previous_commit: '1'.repeat(40),
|
|
87
|
-
commit: '2'.repeat(40),
|
|
88
|
-
paths: ['docs/guide.md', 'docs/diagram.png'],
|
|
89
|
-
}),
|
|
90
|
-
);
|
|
91
|
-
const client = new VertesiaClient({
|
|
92
|
-
serverUrl: 'https://studio.example.com',
|
|
93
|
-
storeUrl: 'https://zeno.example.com',
|
|
94
|
-
fetch: fetchMock,
|
|
95
|
-
onRequest: (request) => requests.push(request),
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const result = await client.apps.commitRepoDocuments(
|
|
99
|
-
'sample-app',
|
|
100
|
-
[
|
|
101
|
-
{ path: 'docs/guide.md', content: new Blob(['# Guide']), fileName: 'guide.md' },
|
|
102
|
-
{ path: 'docs/diagram.png', content: new Blob([new Uint8Array([1, 2, 3])]), fileName: 'diagram.png' },
|
|
103
|
-
],
|
|
104
|
-
{ ref: 'main', expectedHead: '1'.repeat(40), message: 'Add docs' },
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
expect(result.commit).toBe('2'.repeat(40));
|
|
108
|
-
const request = requests[0];
|
|
109
|
-
if (!request) {
|
|
110
|
-
throw new Error('Expected a multipart document request');
|
|
111
|
-
}
|
|
112
|
-
expect(request.url).toBe('https://studio.example.com/api/v1/apps/sample-app/repo/documents');
|
|
113
|
-
expect(request.headers.get('content-type')).toContain('multipart/form-data; boundary=');
|
|
114
|
-
const form = await request.formData();
|
|
115
|
-
expect(JSON.parse(String(form.get('metadata')))).toEqual({
|
|
116
|
-
ref: 'main',
|
|
117
|
-
expected_head: '1'.repeat(40),
|
|
118
|
-
message: 'Add docs',
|
|
119
|
-
files: [
|
|
120
|
-
{ field: 'file_0', path: 'docs/guide.md' },
|
|
121
|
-
{ field: 'file_1', path: 'docs/diagram.png' },
|
|
122
|
-
],
|
|
123
|
-
});
|
|
124
|
-
const guideFile = form.get('file_0');
|
|
125
|
-
const diagramFile = form.get('file_1');
|
|
126
|
-
if (!(guideFile instanceof File) || !(diagramFile instanceof File)) {
|
|
127
|
-
throw new Error('Expected multipart file entries');
|
|
128
|
-
}
|
|
129
|
-
expect(guideFile.name).toBe('guide.md');
|
|
130
|
-
expect(diagramFile.size).toBe(3);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { VertesiaClient } from './client.js';
|
|
3
|
-
|
|
4
|
-
describe('EnvironmentsApi', () => {
|
|
5
|
-
it('encodes model IDs in disableModel paths', async () => {
|
|
6
|
-
const requests: Request[] = [];
|
|
7
|
-
const fetchMock = vi.fn(async () => {
|
|
8
|
-
return new Response(
|
|
9
|
-
JSON.stringify({
|
|
10
|
-
id: 'env-id',
|
|
11
|
-
name: 'Test Environment',
|
|
12
|
-
provider: 'test',
|
|
13
|
-
account: 'account-id',
|
|
14
|
-
created_by: 'user:test',
|
|
15
|
-
updated_by: 'user:test',
|
|
16
|
-
created_at: new Date(0).toISOString(),
|
|
17
|
-
updated_at: new Date(0).toISOString(),
|
|
18
|
-
}),
|
|
19
|
-
{
|
|
20
|
-
status: 200,
|
|
21
|
-
headers: { 'content-type': 'application/json' },
|
|
22
|
-
},
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const client = new VertesiaClient({
|
|
27
|
-
serverUrl: 'https://api.example.com',
|
|
28
|
-
storeUrl: 'https://api.example.com',
|
|
29
|
-
fetch: fetchMock,
|
|
30
|
-
onRequest: (request) => requests.push(request),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
await client.environments.disableModel('env-id', 'provider/model#v?1');
|
|
34
|
-
|
|
35
|
-
expect(requests[0]?.url).toBe(
|
|
36
|
-
'https://api.example.com/api/v1/environments/env-id/models/enabled/provider%2Fmodel%23v%3F1',
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
});
|