@tryvira/sdk 0.1.11 → 0.1.13

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 CHANGED
@@ -1,90 +1,90 @@
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
+
88
+ ## Documentation
89
+
90
+ See the public Vira documentation at https://github.com/hrpering/tryvira.
package/dist/index.js CHANGED
@@ -658,6 +658,10 @@ var ViraClient = class {
658
658
  { idempotencyKey: options.idempotencyKey }
659
659
  );
660
660
  }
661
+ createManualRelease(input, options = {}) {
662
+ if (!input || typeof input !== "object" || !input.manualApproval) throw new Error("SDK_MANUAL_RELEASE_APPROVAL_REQUIRED");
663
+ return this.createRelease(input, { idempotencyKey: options.idempotencyKey });
664
+ }
661
665
  recordDeploymentComparison(deploymentId, comparison, options = {}) {
662
666
  required(deploymentId, "SDK_DEPLOYMENT_ID_REQUIRED");
663
667
  return this.request(
@@ -28,6 +28,27 @@ export interface ViraResponse<T = unknown> {
28
28
  body: T;
29
29
  requestId: string;
30
30
  }
31
+ export interface BehaviorProjection {
32
+ rendered: string;
33
+ projectionDigest: string;
34
+ programDigest: string;
35
+ [key: string]: unknown;
36
+ }
37
+ export interface ProjectionReceipt {
38
+ projectionDigest: string;
39
+ programDigest: string;
40
+ artifactDigest: string;
41
+ receiptDigest: string;
42
+ [key: string]: unknown;
43
+ }
44
+ export interface RuntimeResolution {
45
+ behaviorPoint: string;
46
+ strategySelection?: ClientBody | null;
47
+ behaviorProjection?: BehaviorProjection;
48
+ projectionReceipt?: ProjectionReceipt;
49
+ projectionMode?: "active" | "unavailable" | "not-applicable";
50
+ [key: string]: unknown;
51
+ }
31
52
  export interface ConnectOnceResult {
32
53
  system: ClientBody;
33
54
  connection: ClientBody;
@@ -188,13 +209,13 @@ export declare class ViraClient {
188
209
  executionBoundary?: Record<string, unknown>;
189
210
  semanticContext?: Record<string, unknown>;
190
211
  idempotencyKey?: string;
191
- }): Promise<ViraResponse<ClientBody> | null>;
212
+ }): Promise<ViraResponse<RuntimeResolution> | null>;
192
213
  /** Resolve a runtime route from a governed execution boundary and semantic context. */
193
214
  resolveBoundary(input: {
194
215
  executionBoundary: Record<string, unknown>;
195
216
  semanticContext?: Record<string, unknown>;
196
217
  idempotencyKey?: string;
197
- }): Promise<ViraResponse<ClientBody> | null>;
218
+ }): Promise<ViraResponse<RuntimeResolution> | null>;
198
219
  resolveSemantic(input: {
199
220
  input: string;
200
221
  profile?: Record<string, unknown>;
@@ -216,7 +237,7 @@ export declare class ViraClient {
216
237
  idempotencyKey?: string;
217
238
  }): Promise<{
218
239
  semantic: ViraResponse<ClientBody>;
219
- runtime: ViraResponse<ClientBody> | null;
240
+ runtime: ViraResponse<RuntimeResolution> | null;
220
241
  } | null>;
221
242
  listBehaviorStrategies(): Promise<ViraResponse<ClientBody> | null>;
222
243
  deleteBehaviorStrategy(strategyId: string, options?: {
@@ -338,6 +359,9 @@ export declare class ViraClient {
338
359
  createRelease(input: ClientBody, options?: {
339
360
  idempotencyKey?: string;
340
361
  }): Promise<ViraResponse<ClientBody> | null>;
362
+ createManualRelease(input: ClientBody, options?: {
363
+ idempotencyKey?: string;
364
+ }): Promise<ViraResponse<ClientBody> | null>;
341
365
  recordDeploymentComparison(deploymentId: string, comparison: ClientBody, options?: {
342
366
  idempotencyKey?: string;
343
367
  }): Promise<ViraResponse<ClientBody> | null>;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "name": "@tryvira/sdk",
3
- "version": "0.1.11",
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.13",
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
+ }