@tryvira/sdk 0.1.22 → 0.1.24

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vira / Esad Türkel
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vira / Esad Türkel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,90 +1,94 @@
1
- # @tryvira/sdk
2
-
3
- MIT-licensed client library. The Vira service, application, and backend remain
4
- proprietary and are governed separately.
5
-
6
- Typed JavaScript/TypeScript client for Vira's scoped control and runtime APIs.
7
-
8
- ## Install
9
-
10
- ```bash
11
- npm install @tryvira/sdk
12
- ```
13
-
14
- The client sends requests to Vira; it does not execute tools locally or create a second
15
- authority/telemetry store. Use a customer API key for hosted deployments and a local
16
- development key only with the local stack.
17
-
18
- ## Connect and record an observation
19
-
20
- ```ts
21
- import { ViraClient } from '@tryvira/sdk';
22
-
23
- const vira = new ViraClient({
24
- baseUrl: process.env.VIRA_CONTROL_URL ?? 'http://127.0.0.1:4185',
25
- apiKey: process.env.VIRA_API_KEY,
26
- });
27
-
28
- const connected = await vira.connectOnce({
29
- name: 'my-agent', systemType: 'custom-agent',
30
- organizationId: 'org', projectId: 'project', environmentId: 'local',
31
- adapterType: 'custom-node', adapterVersion: '1',
32
- });
33
-
34
- const systemId = String(connected?.body.system?.id);
35
- const connectionId = String(connected?.body.connection?.id);
36
- await vira.observe({
37
- eventId: `event-${Date.now()}`,
38
- eventType: 'model.response',
39
- aiSystemId: systemId,
40
- connectionId,
41
- payload: { message: 'A model response was produced.' },
42
- }, { idempotencyKey: `event-${Date.now()}` });
43
- ```
44
-
45
- ## Semantic and runtime resolution
46
-
47
- Semantic resolution finds an eligible governed target. Runtime resolution is the effectful
48
- boundary and therefore requires a released behavior point, scope and idempotency key.
49
-
50
- ```ts
51
- const semantic = await vira.resolveSemantic({
52
- input: 'answer a customer billing question',
53
- profile: { domain: 'support' },
54
- });
55
-
56
- const runtime = await vira.resolveRuntime({
57
- behaviorPoint: 'support.answer',
58
- executionBoundary: { organizationId: 'org', projectId: 'project', environmentId: 'local' },
59
- idempotencyKey: 'runtime-request-001',
60
- });
61
- ```
62
-
63
- Do not treat a semantic result as authorization. The server remains the authority and may
64
- abstain, deny or require a released revision.
65
-
66
- ## Packs and Strategy executions
67
-
68
- The normal pack lifecycle is import → install → evaluate → approve → release. Strategy
69
- execution starts only from an immutable, released artifact and can be continued with
70
- state/references when it reaches `WAITING_USER` or `WAITING_HOST`.
71
-
72
- ```ts
73
- const packs = await vira.listPacks();
74
- const imported = await vira.importPack({
75
- manifest: { id: 'example.pack', name: 'Example', version: '1.0.0' },
76
- objects: {},
77
- idempotencyKey: 'pack-import-001',
78
- });
79
- console.log(packs?.body, imported?.body);
80
-
81
- const continued = await vira.continueStrategyExecution('execution-id', {
82
- authorityDigest: 'digest-from-the-execution',
83
- state: { answer: 'approved' },
84
- references: { userInput: { answer: 'approved' } },
85
- });
86
- ```
87
-
88
- ## Documentation
89
-
90
- See the public Vira documentation at https://github.com/hrpering/tryvira.
1
+ # @tryvira/sdk
2
+
3
+ MIT-licensed client library. The Vira service, application, and backend remain
4
+ proprietary and are governed separately.
5
+
6
+ Typed JavaScript/TypeScript client for Vira's scoped control and runtime APIs.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @tryvira/sdk
12
+ ```
13
+
14
+ The client sends requests to Vira; it does not execute tools locally or create a second
15
+ authority/telemetry store. Use a customer API key for hosted deployments and a local
16
+ development key only with the local stack.
17
+
18
+ ## Connect and record an observation
19
+
20
+ ```ts
21
+ import { ViraClient } from '@tryvira/sdk';
22
+
23
+ const vira = new ViraClient({
24
+ baseUrl: process.env.VIRA_CONTROL_URL ?? 'http://127.0.0.1:4185',
25
+ apiKey: process.env.VIRA_API_KEY,
26
+ });
27
+
28
+ const connected = await vira.connectOnce({
29
+ name: 'my-agent', systemType: 'custom-agent',
30
+ organizationId: 'org', projectId: 'project', environmentId: 'local',
31
+ adapterType: 'custom-node', adapterVersion: '1',
32
+ });
33
+
34
+ const systemId = String(connected?.body.system?.id);
35
+ const connectionId = String(connected?.body.connection?.id);
36
+ await vira.observe({
37
+ eventId: `event-${Date.now()}`,
38
+ eventType: 'model.response',
39
+ aiSystemId: systemId,
40
+ connectionId,
41
+ payload: { message: 'A model response was produced.' },
42
+ }, { idempotencyKey: `event-${Date.now()}` });
43
+ ```
44
+
45
+ ## Semantic and runtime resolution
46
+
47
+ Semantic resolution finds an eligible governed target. Runtime resolution is the effectful
48
+ boundary and therefore requires a released behavior point, scope and idempotency key.
49
+
50
+ ```ts
51
+ const semantic = await vira.resolveSemantic({
52
+ input: 'answer a customer billing question',
53
+ profile: { domain: 'support' },
54
+ });
55
+
56
+ const runtime = await vira.resolveRuntime({
57
+ behaviorPoint: 'support.answer',
58
+ executionBoundary: { organizationId: 'org', projectId: 'project', environmentId: 'local' },
59
+ idempotencyKey: 'runtime-request-001',
60
+ });
61
+ ```
62
+
63
+ Do not treat a semantic result as authorization. The server remains the authority and may
64
+ abstain, deny or require a released revision.
65
+
66
+ ## Packs and Strategy executions
67
+
68
+ The normal pack lifecycle is import → install → evaluate → approve → release. Strategy
69
+ execution starts only from an immutable, released artifact and can be continued with
70
+ state/references when it reaches `WAITING_USER` or `WAITING_HOST`.
71
+
72
+ ```ts
73
+ const packs = await vira.listPacks();
74
+ const imported = await vira.importPack({
75
+ manifest: { id: 'example.pack', name: 'Example', version: '1.0.0' },
76
+ objects: {},
77
+ idempotencyKey: 'pack-import-001',
78
+ });
79
+ console.log(packs?.body, imported?.body);
80
+
81
+ const continued = await vira.continueStrategyExecution('execution-id', {
82
+ authorityDigest: 'digest-from-the-execution',
83
+ state: { answer: 'approved' },
84
+ references: { userInput: { answer: 'approved' } },
85
+ });
86
+
87
+ // Pack evaluation consumes a persisted, server-verified evaluation. The SDK
88
+ // never accepts a client-provided passed/score as release evidence.
89
+ await vira.evaluatePack('pack-id', { evaluationId: 'evaluation-id' });
90
+ ```
91
+
92
+ ## Documentation
93
+
94
+ See the public Vira documentation at https://github.com/hrpering/tryvira.
package/dist/index.js CHANGED
@@ -68,7 +68,10 @@ var ViraClient = class {
68
68
  ...this.defaultHeaders
69
69
  };
70
70
  if (request.body) headers["content-type"] = "application/json";
71
- if (this.apiKey) headers.authorization = `Bearer ${this.apiKey}`;
71
+ if (this.apiKey) {
72
+ headers.authorization = `Bearer ${this.apiKey}`;
73
+ headers["x-vira-api-key"] = this.apiKey;
74
+ }
72
75
  if (options.idempotencyKey)
73
76
  headers["idempotency-key"] = options.idempotencyKey;
74
77
  const retryable = request.method === "GET" || Boolean(options.idempotencyKey);
@@ -294,11 +297,12 @@ var ViraClient = class {
294
297
  }
295
298
  evaluatePack(packId, input) {
296
299
  required(packId, "SDK_PACK_ID_REQUIRED");
300
+ required(input?.evaluationId, "SDK_EVALUATION_ID_REQUIRED");
297
301
  return this.request(
298
302
  {
299
303
  method: "POST",
300
304
  path: `/v1/packs/${encodeURIComponent(packId)}/evaluate`,
301
- body: { ...input }
305
+ body: { evaluationId: input.evaluationId }
302
306
  },
303
307
  { idempotencyKey: `sdk:pack:evaluate:${packId}` }
304
308
  );
@@ -232,9 +232,7 @@ export declare class ViraClient {
232
232
  }): Promise<ViraResponse<ClientBody> | null>;
233
233
  installPack(packId: string, variables?: Record<string, unknown>): Promise<ViraResponse<ClientBody> | null>;
234
234
  evaluatePack(packId: string, input: {
235
- passed: boolean;
236
- score?: number;
237
- runId?: string;
235
+ evaluationId: string;
238
236
  }): Promise<ViraResponse<ClientBody> | null>;
239
237
  approvePack(packId: string, options?: {
240
238
  manualApproval?: boolean;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "name": "@tryvira/sdk",
3
- "version": "0.1.22",
4
- "description": "Typed Vira SDK for connect-once, observation and governed runtime execution.",
5
- "keywords": ["vira", "ai-governance", "ai-runtime", "semantic-routing"],
6
- "engines": {"node": ">=20"},
7
- "repository": {"type": "git", "url": "https://github.com/hrpering/tryvira.git"},
8
- "homepage": "https://github.com/hrpering/tryvira#readme",
9
- "bugs": {"url": "https://github.com/hrpering/tryvira/issues"},
10
- "type": "module",
11
- "main": "./dist/index.js",
12
- "types": "./dist/index.d.ts",
13
- "exports": {".": {"types": "./dist/index.d.ts", "import": "./dist/index.js"}},
14
- "files": ["dist/index.js", "dist/index.d.ts", "dist/js-client.d.ts", "README.md"],
15
- "publishConfig": {"access": "public"},
16
- "scripts": {"build": "node ../../scripts/build-publishable-packages.mjs sdk", "pack:check": "npm run build && npm pack --dry-run && npm run public:surface:smoke", "public:surface:smoke": "node ../../scripts/public-surface-contract-acceptance.mjs --sdk-package", "prepublishOnly": "npm run pack:check && npm run public:surface:smoke", "publish:public": "npm run pack:check && npm run public:surface:smoke && npm publish --access public"},
17
- "license": "MIT"
18
- }
1
+ {
2
+ "name": "@tryvira/sdk",
3
+ "version": "0.1.24",
4
+ "description": "Typed Vira SDK for connect-once, observation and governed runtime execution.",
5
+ "keywords": ["vira", "ai-governance", "ai-runtime", "semantic-routing"],
6
+ "engines": {"node": ">=20"},
7
+ "repository": {"type": "git", "url": "https://github.com/hrpering/tryvira.git"},
8
+ "homepage": "https://github.com/hrpering/tryvira#readme",
9
+ "bugs": {"url": "https://github.com/hrpering/tryvira/issues"},
10
+ "type": "module",
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {".": {"types": "./dist/index.d.ts", "import": "./dist/index.js"}},
14
+ "files": ["dist/index.js", "dist/index.d.ts", "dist/js-client.d.ts", "README.md"],
15
+ "publishConfig": {"access": "public"},
16
+ "scripts": {"build": "node ../../scripts/build-publishable-packages.mjs sdk", "pack:check": "npm run build && npm pack --dry-run && npm run public:surface:smoke", "public:surface:smoke": "node ../../scripts/public-surface-contract-acceptance.mjs --sdk-package", "prepublishOnly": "npm run pack:check && npm run public:surface:smoke", "publish:public": "npm run pack:check && npm run public:surface:smoke && npm publish --access public"},
17
+ "license": "MIT"
18
+ }