@tryvira/sdk 0.0.0-stage → 0.1.0

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 ADDED
@@ -0,0 +1 @@
1
+ Apache License 2.0
package/README.md CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @tryvira/sdk
2
+
3
+ Typed JavaScript/TypeScript client for Vira's scoped control and runtime APIs.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @tryvira/sdk
9
+ ```
10
+
11
+ The client sends requests to Vira; it does not execute tools locally or create a second
12
+ authority/telemetry store. Use a customer API key for hosted deployments and a local
13
+ development key only with the local stack.
14
+
15
+ ## Connect and record an observation
16
+
17
+ ```ts
18
+ import { ViraClient } from '@tryvira/sdk';
19
+
20
+ const vira = new ViraClient({
21
+ baseUrl: process.env.VIRA_CONTROL_URL ?? 'http://127.0.0.1:4185',
22
+ apiKey: process.env.VIRA_API_KEY,
23
+ });
24
+
25
+ const connected = await vira.connectOnce({
26
+ name: 'my-agent', systemType: 'custom-agent',
27
+ organizationId: 'org', projectId: 'project', environmentId: 'local',
28
+ adapterType: 'custom-node', adapterVersion: '1',
29
+ });
30
+
31
+ const systemId = String(connected?.body.system?.id);
32
+ const connectionId = String(connected?.body.connection?.id);
33
+ await vira.observe({
34
+ eventId: `event-${Date.now()}`,
35
+ eventType: 'model.response',
36
+ aiSystemId: systemId,
37
+ connectionId,
38
+ payload: { message: 'A model response was produced.' },
39
+ }, { idempotencyKey: `event-${Date.now()}` });
40
+ ```
41
+
42
+ ## Semantic and runtime resolution
43
+
44
+ Semantic resolution finds an eligible governed target. Runtime resolution is the effectful
45
+ boundary and therefore requires a released behavior point, scope and idempotency key.
46
+
47
+ ```ts
48
+ const semantic = await vira.resolveSemantic({
49
+ input: 'answer a customer billing question',
50
+ profile: { domain: 'support' },
51
+ });
52
+
53
+ const runtime = await vira.resolveRuntime({
54
+ behaviorPoint: 'support.answer',
55
+ executionBoundary: { organizationId: 'org', projectId: 'project', environmentId: 'local' },
56
+ idempotencyKey: 'runtime-request-001',
57
+ });
58
+ ```
59
+
60
+ Do not treat a semantic result as authorization. The server remains the authority and may
61
+ abstain, deny or require a released revision.
62
+
63
+ ## Packs and Strategy executions
64
+
65
+ The normal pack lifecycle is import → install → evaluate → approve → release. Strategy
66
+ execution starts only from an immutable, released artifact and can be continued with
67
+ state/references when it reaches `WAITING_USER` or `WAITING_HOST`.
68
+
69
+ ```ts
70
+ const packs = await vira.listPacks();
71
+ const imported = await vira.importPack({
72
+ manifest: { id: 'example.pack', name: 'Example', version: '1.0.0' },
73
+ objects: {},
74
+ idempotencyKey: 'pack-import-001',
75
+ });
76
+ console.log(packs?.body, imported?.body);
77
+
78
+ const continued = await vira.continueStrategyExecution('execution-id', {
79
+ authorityDigest: 'digest-from-the-execution',
80
+ state: { answer: 'approved' },
81
+ references: { userInput: { answer: 'approved' } },
82
+ });
83
+ ```
84
+
85
+ ## Local verification
86
+
87
+ From the repository root:
88
+
89
+ ```bash
90
+ npm run local:up
91
+ npm run local:acceptance
92
+ npm run public:surface:acceptance
93
+ ```
94
+
95
+ See [`docs/SDK_GUIDE.md`](../../docs/SDK_GUIDE.md) for the full public-client lifecycle and
96
+ [`docs/AUTH_AND_SCOPING.md`](../../docs/AUTH_AND_SCOPING.md) for credential and scope rules.
@@ -0,0 +1 @@
1
+ export * from "./js-client.js";