@tryvira/sdk 0.1.40 → 0.1.42
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/README.md +2 -1
- package/dist/index.js +8 -0
- package/dist/js-client.d.ts +18 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ approved behavior, and resolve it at runtime.
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @tryvira/sdk@0.1.
|
|
10
|
+
npm install @tryvira/sdk@0.1.42
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Configure the organization, project, and environment for every request. Keep the API
|
|
@@ -48,6 +48,7 @@ const connected = await vira.connectOnce({
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
await vira.observe({
|
|
51
|
+
...scope,
|
|
51
52
|
eventId: randomUUID(),
|
|
52
53
|
eventType: "model.response",
|
|
53
54
|
aiSystemId: String(connected.body.system.id),
|
package/dist/index.js
CHANGED
|
@@ -212,6 +212,8 @@ var ViraClient = class {
|
|
|
212
212
|
observeBatch(events, options = {}) {
|
|
213
213
|
if (!Array.isArray(events) || events.length < 1 || events.length > 100)
|
|
214
214
|
throw new Error("SDK_OBSERVATION_BATCH_INVALID");
|
|
215
|
+
if (events.some((event) => !event.organizationId?.trim() || !event.projectId?.trim() || !event.environmentId?.trim()))
|
|
216
|
+
throw new Error("SDK_OBSERVATION_SCOPE_REQUIRED");
|
|
215
217
|
return this.request(
|
|
216
218
|
{
|
|
217
219
|
method: "POST",
|
|
@@ -290,6 +292,10 @@ var ViraClient = class {
|
|
|
290
292
|
path: "/v1/packs"
|
|
291
293
|
});
|
|
292
294
|
}
|
|
295
|
+
deletePack(packId, options = {}) {
|
|
296
|
+
required(packId, "SDK_PACK_ID_REQUIRED");
|
|
297
|
+
return this.request({ method: "DELETE", path: `/v1/packs/${encodeURIComponent(packId)}`, body: { confirm: options.confirm === true } }, { idempotencyKey: options.idempotencyKey ?? `sdk:delete:pack:${packId}` });
|
|
298
|
+
}
|
|
293
299
|
importPack(input) {
|
|
294
300
|
if (!input?.manifest && !input?.archiveBase64)
|
|
295
301
|
throw new Error("SDK_PACK_MANIFEST_OR_ARCHIVE_REQUIRED");
|
|
@@ -1024,6 +1030,8 @@ function buildAISystemRequest(input) {
|
|
|
1024
1030
|
});
|
|
1025
1031
|
}
|
|
1026
1032
|
function buildObservationRequest(event) {
|
|
1033
|
+
if (!event?.organizationId?.trim() || !event?.projectId?.trim() || !event?.environmentId?.trim())
|
|
1034
|
+
throw new Error("SDK_OBSERVATION_SCOPE_REQUIRED");
|
|
1027
1035
|
if (!event?.eventId || !event.eventType || !event.aiSystemId || !event.connectionId)
|
|
1028
1036
|
throw new Error("SDK_OBSERVATION_FIELD_REQUIRED");
|
|
1029
1037
|
return Object.freeze({
|
package/dist/js-client.d.ts
CHANGED
|
@@ -105,7 +105,12 @@ export declare class ViraApiError extends Error {
|
|
|
105
105
|
constructor(message: string, status: number, body: unknown, requestId: string);
|
|
106
106
|
}
|
|
107
107
|
type ClientBody = Record<string, unknown>;
|
|
108
|
-
type
|
|
108
|
+
type ClientObservationScope = {
|
|
109
|
+
organizationId: string;
|
|
110
|
+
projectId: string;
|
|
111
|
+
environmentId: string;
|
|
112
|
+
};
|
|
113
|
+
type ClientObservation = ClientObservationScope & {
|
|
109
114
|
eventId: string;
|
|
110
115
|
eventType: string;
|
|
111
116
|
aiSystemId: string;
|
|
@@ -172,7 +177,7 @@ export declare class ViraClient {
|
|
|
172
177
|
observe(event: ClientObservation, options?: {
|
|
173
178
|
idempotencyKey?: string;
|
|
174
179
|
}): Promise<ViraResponse<ClientBody> | null>;
|
|
175
|
-
trace(event: {
|
|
180
|
+
trace(event: ClientObservationScope & {
|
|
176
181
|
eventId: string;
|
|
177
182
|
aiSystemId: string;
|
|
178
183
|
connectionId: string;
|
|
@@ -188,7 +193,7 @@ export declare class ViraClient {
|
|
|
188
193
|
query?: string;
|
|
189
194
|
event?: string;
|
|
190
195
|
}): Promise<ViraResponse<ClientBody> | null>;
|
|
191
|
-
outcome(event: {
|
|
196
|
+
outcome(event: ClientObservationScope & {
|
|
192
197
|
eventId: string;
|
|
193
198
|
aiSystemId: string;
|
|
194
199
|
connectionId: string;
|
|
@@ -196,7 +201,7 @@ export declare class ViraClient {
|
|
|
196
201
|
}, options?: {
|
|
197
202
|
idempotencyKey?: string;
|
|
198
203
|
}): Promise<ViraResponse<ClientBody> | null>;
|
|
199
|
-
feedback(event: {
|
|
204
|
+
feedback(event: ClientObservationScope & {
|
|
200
205
|
eventId: string;
|
|
201
206
|
aiSystemId: string;
|
|
202
207
|
connectionId: string;
|
|
@@ -204,13 +209,13 @@ export declare class ViraClient {
|
|
|
204
209
|
}, options?: {
|
|
205
210
|
idempotencyKey?: string;
|
|
206
211
|
}): Promise<ViraResponse<ClientBody> | null>;
|
|
207
|
-
observeBatch(events: readonly {
|
|
212
|
+
observeBatch(events: readonly (ClientObservationScope & {
|
|
208
213
|
eventId: string;
|
|
209
214
|
eventType: string;
|
|
210
215
|
aiSystemId: string;
|
|
211
216
|
connectionId: string;
|
|
212
217
|
[key: string]: unknown;
|
|
213
|
-
}[], options?: {
|
|
218
|
+
})[], options?: {
|
|
214
219
|
idempotencyKey?: string;
|
|
215
220
|
}): Promise<ViraResponse<ClientBody> | null>;
|
|
216
221
|
observeSdk(delivery: ClientBody, options?: {
|
|
@@ -242,6 +247,10 @@ export declare class ViraClient {
|
|
|
242
247
|
listPacks(): Promise<ViraResponse<{
|
|
243
248
|
packs: readonly ClientBody[];
|
|
244
249
|
}> | null>;
|
|
250
|
+
deletePack(packId: string, options?: {
|
|
251
|
+
confirm?: boolean;
|
|
252
|
+
idempotencyKey?: string;
|
|
253
|
+
}): Promise<ViraResponse<ClientBody> | null>;
|
|
245
254
|
importPack(input: {
|
|
246
255
|
manifest?: unknown;
|
|
247
256
|
objects?: Record<string, unknown>;
|
|
@@ -576,6 +585,9 @@ export declare function buildAISystemRequest(input: {
|
|
|
576
585
|
environmentId: string;
|
|
577
586
|
}): SdkRequest;
|
|
578
587
|
export declare function buildObservationRequest(event: {
|
|
588
|
+
organizationId: string;
|
|
589
|
+
projectId: string;
|
|
590
|
+
environmentId: string;
|
|
579
591
|
eventId: string;
|
|
580
592
|
eventType: string;
|
|
581
593
|
aiSystemId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"description": "Typed Vira SDK for connect-once, observation and governed runtime execution.",
|
|
5
5
|
"keywords": ["vira", "ai-governance", "ai-runtime", "semantic-routing"],
|
|
6
6
|
"engines": {"node": ">=20"},
|