@tryvira/sdk 0.1.43 → 0.1.46

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
@@ -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.43
10
+ npm install @tryvira/sdk@0.1.46
11
11
  ```
12
12
 
13
13
  Configure the organization, project, and environment for every request. Keep the API
@@ -72,6 +72,14 @@ const semantic = await vira.resolveSemantic({
72
72
  profile: { domain: "support" },
73
73
  });
74
74
 
75
+ // A non-select result is explicit and fail-closed. For example,
76
+ // semantic.body.receipt.abstainReason can be
77
+ // `NO_EXACT_MATCH`, `PROVIDER_CONFIDENCE_BELOW_THRESHOLD`, or
78
+ // `PROVIDER_WINNER_MARGIN`. It is diagnostic evidence, never runtime authority.
79
+ if (semantic?.body.receipt?.outcome !== "select") {
80
+ console.info("Vira did not activate a task:", semantic?.body.receipt?.abstainReason);
81
+ }
82
+
75
83
  const runtime = await vira.resolveRuntime({
76
84
  behaviorPoint: "support.answer_billing",
77
85
  executionBoundary: scope,
@@ -125,11 +133,73 @@ await vira.approvePack(packId);
125
133
  await vira.releasePack(packId);
126
134
  ```
127
135
 
136
+ If a governed TaskRun is paused, use `continueTaskRun`. If a run is `FAILED`,
137
+ `BLOCKED`, or `PARTIAL`, `retryTaskRun` reuses the server-owned immutable plan
138
+ and queues a new execution. Both operations require the current state version;
139
+ completed and cancelled runs cannot be retried.
140
+
141
+ ```ts
142
+ await vira.continueTaskRun("monthly-report-001", stateVersion, { cursor: "approval-1" });
143
+ await vira.retryTaskRun("monthly-report-001", stateVersion);
144
+ ```
145
+
128
146
  Never submit a client-created `passed`, `score`, or receipt as release evidence. Vira
129
147
  binds evaluation to the materialized Pack digest and immutable release identity. Use
130
148
  `previewPackUpgrade` before changing an installed Pack so conflicts and preserved
131
149
  overrides are visible first.
132
150
 
151
+ ## Resolve and admit a TaskRun
152
+
153
+ TaskRun routing is server-owned and AUTO is the normal path. Submit the user intent
154
+ with `startTaskRunFromPrompt`; Vira selects a released canonical Task and the
155
+ concrete SINGLE, STRATEGY, COMPOUND, or HYBRID execution mode. The server owns the
156
+ actor, host capabilities, effect classes, and plan authority. This route does not
157
+ invent a Behavior Point, grant tools, or publish a Strategy/Compound artifact.
158
+
159
+ ```ts
160
+ const route = await vira.resolveTaskRun({
161
+ input: "Prepare a customer report and send it for approval",
162
+ });
163
+
164
+ if (route.body.route !== "ROUTED") {
165
+ // NEEDS_CLARIFICATION, ABSTAIN, DENIED, and UNSUPPORTED_HOST are safe outcomes.
166
+ return route.body;
167
+ }
168
+
169
+ const admitted = await vira.startTaskRunFromPrompt({
170
+ input: "Prepare a customer report and send it for approval",
171
+ budget: { maxChildren: 4, maxCalls: 6, maxCostMicros: 50000 },
172
+ }, { idempotencyKey: "task-run:customer-report-request-001" });
173
+
174
+ // requestedMode, hybridPlan, hostCapabilities and ownerActorRef remain available
175
+ // as advanced/legacy overrides, but are not needed for the normal integration.
176
+ ```
177
+
178
+ After `connectOnce`, the SDK binds the returned connection to later TaskRuns.
179
+ The server then resolves that connected host's verified capability attestation;
180
+ the application does not need to copy an attestation ID into each prompt. If
181
+ an application intentionally manages more than one connection, it may provide
182
+ `connectionId` on the request or in the client options so the server can select
183
+ the correct host while preserving scope checks.
184
+
185
+ `resolveTaskRun` is a proposal-only read. `startTaskRun` is an admission mutation
186
+ and remains subject to the server’s scope, authority, artifact, budget, and release
187
+ gates. If the run pauses, use the persisted state version for continuation or
188
+ cancellation; never guess a version or patch arbitrary state:
189
+
190
+ ```ts
191
+ const current = await vira.getTaskRun("customer-report-run-001");
192
+ const version = Number(current.body.taskRun.stateVersion);
193
+ await vira.continueTaskRun("customer-report-run-001", version, {
194
+ cursor: "approval-answer-001",
195
+ idempotencyKey: "task-run:continue:approval-answer-001",
196
+ });
197
+ await vira.cancelTaskRun("customer-report-run-001", version, {
198
+ idempotencyKey: "task-run:cancel:customer-report-run-001",
199
+ });
200
+ const events = await vira.listTaskRunEvents("customer-report-run-001");
201
+ ```
202
+
133
203
  ## Errors and retries
134
204
 
135
205
  - Send an idempotency key with mutations.
@@ -0,0 +1,83 @@
1
+ import type { ViraClient } from './js-client.ts';
2
+ export type FrameworkAdapterName = 'openai-agents' | 'vercel-ai' | 'langchain' | 'langgraph' | 'otel' | 'mcp';
3
+ export type FrameworkExecutionMode = 'observe' | 'enforce';
4
+ export interface FrameworkEvent {
5
+ eventId: string;
6
+ aiSystemId: string;
7
+ connectionId: string;
8
+ organizationId: string;
9
+ projectId: string;
10
+ environmentId: string;
11
+ eventType?: string;
12
+ traceId?: string;
13
+ spanId?: string;
14
+ payload?: unknown;
15
+ attributes?: unknown;
16
+ [key: string]: unknown;
17
+ }
18
+ export interface FrameworkObservationAdapter {
19
+ readonly framework: FrameworkAdapterName;
20
+ observe(event: FrameworkEvent, kind: 'trace' | 'outcome' | 'feedback' | 'observation'): Promise<unknown> | unknown;
21
+ }
22
+ export interface FrameworkLifecycleAdapter extends FrameworkObservationAdapter {
23
+ resolveBoundary(input: {
24
+ executionBoundary: Record<string, unknown>;
25
+ semanticContext?: Record<string, unknown>;
26
+ idempotencyKey?: string;
27
+ }): Promise<unknown>;
28
+ start(event: FrameworkEvent): Promise<unknown> | unknown;
29
+ complete(event: FrameworkEvent): Promise<unknown> | unknown;
30
+ error(event: FrameworkEvent & {
31
+ errorCode?: string;
32
+ }): Promise<unknown> | unknown;
33
+ toolStart(event: FrameworkEvent & {
34
+ toolRef: string;
35
+ }): Promise<unknown> | unknown;
36
+ toolComplete(event: FrameworkEvent & {
37
+ toolRef: string;
38
+ resultDigest?: string;
39
+ }): Promise<unknown> | unknown;
40
+ }
41
+ export interface RuntimeHookRequest {
42
+ executionBoundary?: Record<string, unknown>;
43
+ semanticContext?: Record<string, unknown>;
44
+ behaviorPoint?: string;
45
+ [key: string]: unknown;
46
+ }
47
+ export interface RuntimeHookResult {
48
+ resolution: unknown;
49
+ request: RuntimeHookRequest;
50
+ behaviorPoint?: string;
51
+ }
52
+ /** Shared boundary-aware resolver used by every TypeScript framework bridge. */
53
+ export declare function resolveFrameworkBoundary(client: ViraClient, request: RuntimeHookRequest): Promise<RuntimeHookResult>;
54
+ export interface RuntimeHooks {
55
+ resolve(request: RuntimeHookRequest): Promise<RuntimeHookResult>;
56
+ onStart(request: RuntimeHookRequest): Promise<RuntimeHookResult>;
57
+ enrichTrace<T extends Record<string, unknown>>(trace: T, routed: RuntimeHookResult): T & {
58
+ behaviorPoint: string;
59
+ };
60
+ }
61
+ export declare function createGenericRuntimeHooks(client: ViraClient): RuntimeHooks;
62
+ export declare const createOpenAIAgentsHooks: typeof createGenericRuntimeHooks;
63
+ export declare const createLangGraphHooks: typeof createGenericRuntimeHooks;
64
+ export declare const createGenericHttpHooks: typeof createGenericRuntimeHooks;
65
+ export declare const createOpenAICompatibleHooks: typeof createGenericRuntimeHooks;
66
+ export declare const createMastraHooks: typeof createGenericRuntimeHooks;
67
+ export declare const createVercelAIHooks: typeof createGenericRuntimeHooks;
68
+ /** Vercel AI middleware bridge; never discards the boundary route. */
69
+ export declare function createViraMiddleware(client: ViraClient): Readonly<{
70
+ resolve: (request: RuntimeHookRequest) => Promise<RuntimeHookResult>;
71
+ onRequest: (request: RuntimeHookRequest) => Promise<RuntimeHookResult>;
72
+ enrichTrace: <T extends Record<string, unknown>>(trace: T, routed: RuntimeHookResult) => T & {
73
+ behaviorPoint: string;
74
+ };
75
+ }>;
76
+ /** Maps framework callbacks into the existing ViraClient authority boundary. */
77
+ export declare function createFrameworkObservationAdapter(client: ViraClient, framework: FrameworkAdapterName): FrameworkObservationAdapter;
78
+ export declare function createFrameworkLifecycleAdapter(client: ViraClient, framework: FrameworkAdapterName, options?: {
79
+ mode?: FrameworkExecutionMode;
80
+ }): FrameworkLifecycleAdapter & {
81
+ readonly mode: FrameworkExecutionMode;
82
+ };
83
+ export declare function createFrameworkAdapters(client: ViraClient): Readonly<Record<FrameworkAdapterName, FrameworkObservationAdapter>>;
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./js-client.js";
2
+ export * from "./framework-adapters.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // sdks/js-client.ts
1
+ // ../../sdks/js-client.ts
2
2
  var ViraApiError = class extends Error {
3
3
  status;
4
4
  body;
@@ -52,6 +52,7 @@ var ViraClient = class {
52
52
  retries;
53
53
  failureMode;
54
54
  defaultHeaders;
55
+ boundConnectionId;
55
56
  constructor(options) {
56
57
  this.baseUrl = normalizeBaseUrl(options.baseUrl, options.allowInsecureLocalhost === true);
57
58
  this.apiKey = options.apiKey;
@@ -63,6 +64,7 @@ var ViraClient = class {
63
64
  this.retries = Math.max(0, Math.min(options.retries ?? 2, 5));
64
65
  this.failureMode = options.failureMode ?? "throw";
65
66
  this.defaultHeaders = options.defaultHeaders ?? {};
67
+ this.boundConnectionId = options.connectionId;
66
68
  this.evaluations = {
67
69
  createPlan: (input, options2 = {}) => this.createEvaluationPlan(input, options2),
68
70
  get: (id) => this.getEvaluation(id),
@@ -204,6 +206,8 @@ var ViraClient = class {
204
206
  idempotencyKey: input.idempotencyKey
205
207
  });
206
208
  if (!connectionResult) return null;
209
+ const connectedId = String(connectionResult.body.connection?.id ?? "").trim();
210
+ if (connectedId) this.boundConnectionId = connectedId;
207
211
  return {
208
212
  status: connectionResult.status,
209
213
  requestId: connectionResult.requestId,
@@ -628,6 +632,47 @@ var ViraClient = class {
628
632
  body: {}
629
633
  });
630
634
  }
635
+ resolveTaskRun(input) {
636
+ required(input.input, "SDK_TASKRUN_INPUT_REQUIRED");
637
+ if (input.requestedMode) required(input.requestedMode, "SDK_TASKRUN_MODE_REQUIRED");
638
+ const connectionId = input.connectionId ?? this.boundConnectionId;
639
+ return this.request({ method: "POST", path: "/v1/task-runs/resolve", body: { ...input, ...connectionId ? { connectionId } : {} } }, { idempotencyKey: `sdk:task-run:resolve:${input.input}` });
640
+ }
641
+ startTaskRun(input, options = {}) {
642
+ for (const value of [input.taskRunId, input.requestId]) required(value, "SDK_TASKRUN_ADMISSION_FIELD_REQUIRED");
643
+ if (input.input === void 0 || input.input === null) throw new Error("SDK_TASKRUN_INPUT_REQUIRED");
644
+ const body = { ...input, ...input.ownerActorRef ? { ownerActorRef: input.ownerActorRef } : {}, ...input.requestedMode ? { requestedMode: input.requestedMode } : {}, ...!input.connectionId && this.boundConnectionId ? { connectionId: this.boundConnectionId } : {} };
645
+ return this.request({ method: "POST", path: "/v1/task-runs", body }, { idempotencyKey: options.idempotencyKey ?? `sdk:task-run:start:${input.requestId}` });
646
+ }
647
+ startTaskRunFromPrompt(input, options = {}) {
648
+ if (input.input === void 0 || input.input === null) throw new Error("SDK_TASKRUN_INPUT_REQUIRED");
649
+ const id = () => globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(16).slice(2)}`;
650
+ const requestId = input.requestId ?? `sdk-task-run-${id()}`;
651
+ return this.startTaskRun({ taskRunId: input.taskRunId ?? `task-run-${id()}`, requestId, input: input.input, ...input.conversationId ? { conversationId: input.conversationId } : {}, ...input.episodeId ? { episodeId: input.episodeId } : {}, ...input.traceRootRef ? { traceRootRef: input.traceRootRef } : {}, ...input.budget ? { budget: input.budget } : {}, ...input.connectionId ? { connectionId: input.connectionId } : {} }, options);
652
+ }
653
+ getTaskRun(taskRunId) {
654
+ required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
655
+ return this.request({ method: "GET", path: `/v1/task-runs/${encodeURIComponent(taskRunId)}` });
656
+ }
657
+ listTaskRunEvents(taskRunId) {
658
+ required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
659
+ return this.request({ method: "GET", path: `/v1/task-runs/${encodeURIComponent(taskRunId)}/events` });
660
+ }
661
+ continueTaskRun(taskRunId, expectedVersion, options = {}) {
662
+ required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
663
+ if (!Number.isInteger(expectedVersion) || expectedVersion < 0) throw new Error("SDK_TASKRUN_STATE_VERSION_REQUIRED");
664
+ return this.request({ method: "POST", path: `/v1/task-runs/${encodeURIComponent(taskRunId)}/continue`, body: { expectedVersion, ...options.cursor ? { cursor: options.cursor } : {} } }, { idempotencyKey: options.idempotencyKey ?? `sdk:task-run:continue:${taskRunId}:${expectedVersion}` });
665
+ }
666
+ cancelTaskRun(taskRunId, expectedVersion, options = {}) {
667
+ required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
668
+ if (!Number.isInteger(expectedVersion) || expectedVersion < 0) throw new Error("SDK_TASKRUN_STATE_VERSION_REQUIRED");
669
+ return this.request({ method: "POST", path: `/v1/task-runs/${encodeURIComponent(taskRunId)}/cancel`, body: { expectedVersion } }, { idempotencyKey: options.idempotencyKey ?? `sdk:task-run:cancel:${taskRunId}:${expectedVersion}` });
670
+ }
671
+ retryTaskRun(taskRunId, expectedVersion, options = {}) {
672
+ required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
673
+ if (!Number.isInteger(expectedVersion) || expectedVersion < 0) throw new Error("SDK_TASKRUN_STATE_VERSION_REQUIRED");
674
+ return this.request({ method: "POST", path: `/v1/task-runs/${encodeURIComponent(taskRunId)}/retry`, body: { expectedVersion } }, { idempotencyKey: options.idempotencyKey ?? `sdk:task-run:retry:${taskRunId}:${expectedVersion}` });
675
+ }
631
676
  listBehaviorPrograms() {
632
677
  return this.request({
633
678
  method: "GET",
@@ -1074,6 +1119,73 @@ function buildObservationRequest(event) {
1074
1119
  body: Object.freeze({ ...event })
1075
1120
  });
1076
1121
  }
1122
+
1123
+ // ../../sdks/framework-adapters.ts
1124
+ async function resolveFrameworkBoundary(client, request) {
1125
+ if (!request || typeof request !== "object") throw new Error("SDK_RUNTIME_REQUEST_REQUIRED");
1126
+ const resolution = request.executionBoundary ? await client.resolveBoundary({
1127
+ executionBoundary: request.executionBoundary,
1128
+ ...request.semanticContext ? { semanticContext: request.semanticContext } : {}
1129
+ }) : await client.resolveRuntime({
1130
+ ...request.behaviorPoint ? { behaviorPoint: request.behaviorPoint } : {},
1131
+ ...request.semanticContext ? { semanticContext: request.semanticContext } : {}
1132
+ });
1133
+ const body = resolution && typeof resolution === "object" && "body" in resolution ? resolution.body : resolution;
1134
+ const routed = body && typeof body === "object" && typeof body.behaviorPoint === "string" ? String(body.behaviorPoint) : void 0;
1135
+ if (!routed?.trim()) throw new Error("SDK_RUNTIME_ROUTE_UNRESOLVED");
1136
+ return { resolution, behaviorPoint: routed, request: { ...request, behaviorPoint: routed, semanticContext: { ...request.semanticContext ?? {}, behaviorPoint: routed } } };
1137
+ }
1138
+ function createGenericRuntimeHooks(client) {
1139
+ const resolve = (request) => resolveFrameworkBoundary(client, request);
1140
+ return Object.freeze({
1141
+ resolve,
1142
+ onStart: resolve,
1143
+ enrichTrace: (trace, routed) => ({ ...trace, behaviorPoint: routed.behaviorPoint })
1144
+ });
1145
+ }
1146
+ var createOpenAIAgentsHooks = createGenericRuntimeHooks;
1147
+ var createLangGraphHooks = createGenericRuntimeHooks;
1148
+ var createGenericHttpHooks = createGenericRuntimeHooks;
1149
+ var createOpenAICompatibleHooks = createGenericRuntimeHooks;
1150
+ var createMastraHooks = createGenericRuntimeHooks;
1151
+ var createVercelAIHooks = createGenericRuntimeHooks;
1152
+ function createViraMiddleware(client) {
1153
+ const hooks = createGenericRuntimeHooks(client);
1154
+ return Object.freeze({
1155
+ resolve: hooks.resolve,
1156
+ onRequest: hooks.onStart,
1157
+ enrichTrace: hooks.enrichTrace
1158
+ });
1159
+ }
1160
+ var eventType = { trace: "model.response", outcome: "business.outcome", feedback: "feedback.user" };
1161
+ var lifecycleType = { start: "execution.started", complete: "execution.completed", error: "execution.failed", toolStart: "tool.called", toolComplete: "tool.result" };
1162
+ function createFrameworkObservationAdapter(client, framework) {
1163
+ if (!client || !["openai-agents", "vercel-ai", "langchain", "langgraph", "otel", "mcp"].includes(framework)) throw new Error("SDK_FRAMEWORK_ADAPTER_INVALID");
1164
+ return Object.freeze({ framework, observe(event, kind) {
1165
+ if (!event?.eventId || !event.aiSystemId || !event.connectionId || kind === "observation" && !event.eventType) throw new Error("SDK_FRAMEWORK_EVENT_REQUIRED");
1166
+ const input = { ...event, eventType: kind === "observation" ? event.eventType : eventType[kind] };
1167
+ return client.observe(input);
1168
+ } });
1169
+ }
1170
+ function createFrameworkLifecycleAdapter(client, framework, options = {}) {
1171
+ const mode = options.mode ?? "observe";
1172
+ if (mode !== "observe" && mode !== "enforce") throw new Error("SDK_FRAMEWORK_MODE_INVALID");
1173
+ const observation = createFrameworkObservationAdapter(client, framework);
1174
+ const emit = (event, type) => observation.observe({ ...event, eventType: type }, "observation");
1175
+ return Object.freeze({
1176
+ ...observation,
1177
+ mode,
1178
+ resolveBoundary: (input) => client.resolveBoundary(input),
1179
+ start: (event) => emit(event, lifecycleType.start),
1180
+ complete: (event) => emit(event, lifecycleType.complete),
1181
+ error: (event) => emit(event, lifecycleType.error),
1182
+ toolStart: (event) => emit(event, lifecycleType.toolStart),
1183
+ toolComplete: (event) => emit(event, lifecycleType.toolComplete)
1184
+ });
1185
+ }
1186
+ function createFrameworkAdapters(client) {
1187
+ return Object.freeze(Object.fromEntries(["openai-agents", "vercel-ai", "langchain", "langgraph", "otel", "mcp"].map((name) => [name, createFrameworkObservationAdapter(client, name)])));
1188
+ }
1077
1189
  export {
1078
1190
  ViraApiError,
1079
1191
  ViraClient,
@@ -1081,5 +1193,17 @@ export {
1081
1193
  buildDocsQueryRequest,
1082
1194
  buildObservationRequest,
1083
1195
  buildPublicContentRequest,
1084
- buildRuntimeRequest
1196
+ buildRuntimeRequest,
1197
+ createFrameworkAdapters,
1198
+ createFrameworkLifecycleAdapter,
1199
+ createFrameworkObservationAdapter,
1200
+ createGenericHttpHooks,
1201
+ createGenericRuntimeHooks,
1202
+ createLangGraphHooks,
1203
+ createMastraHooks,
1204
+ createOpenAIAgentsHooks,
1205
+ createOpenAICompatibleHooks,
1206
+ createVercelAIHooks,
1207
+ createViraMiddleware,
1208
+ resolveFrameworkBoundary
1085
1209
  };
@@ -24,6 +24,8 @@ export interface ViraClientOptions {
24
24
  retries?: number;
25
25
  failureMode?: SdkFailureMode;
26
26
  defaultHeaders?: Readonly<Record<string, string>>;
27
+ /** Connection selected by connectOnce or supplied by the host integration. */
28
+ connectionId?: string;
27
29
  }
28
30
  export interface ViraResponse<T = unknown> {
29
31
  status: number;
@@ -51,6 +53,63 @@ export interface RuntimeResolution {
51
53
  projectionMode?: "active" | "unavailable" | "not-applicable";
52
54
  [key: string]: unknown;
53
55
  }
56
+ export type TaskRunMode = "SINGLE" | "STRATEGY" | "COMPOUND" | "HYBRID";
57
+ export type TaskRunRequestedMode = TaskRunMode | "AUTO";
58
+ export interface TaskRunChildMode {
59
+ semanticTaskKey: string;
60
+ mode: "SINGLE" | "STRATEGY";
61
+ }
62
+ export type SemanticAbstainReason = "EXACT_NEGATIVE_MATCH" | "NO_EXACT_MATCH" | "PROVIDER_TASK_NOT_FOUND" | "PROVIDER_EXCLUDED_TASK" | "PROVIDER_CONFIDENCE_BELOW_THRESHOLD" | "PROVIDER_WINNER_MARGIN" | "SEMANTIC_PROVIDER_TIMEOUT";
63
+ export interface SemanticActivationReceipt extends Record<string, unknown> {
64
+ outcome: "select" | "continue" | "switch" | "clarify" | "abstain" | "unknown";
65
+ taskKey?: string;
66
+ confidence: number;
67
+ runnerUpConfidence: number;
68
+ abstainReason?: SemanticAbstainReason;
69
+ clarifyReason?: "AMBIGUOUS_MATCH" | "PROVIDER_LOW_CONFIDENCE";
70
+ }
71
+ export interface SemanticResolveBody extends Record<string, unknown> {
72
+ receipt?: SemanticActivationReceipt;
73
+ }
74
+ export interface TaskRunRouteRequest {
75
+ input: string;
76
+ requestedMode?: TaskRunRequestedMode;
77
+ intentCount?: number;
78
+ hostCapabilities?: readonly string[];
79
+ hybridPlan?: readonly TaskRunChildMode[];
80
+ connectionId?: string;
81
+ }
82
+ export interface TaskRunBudget {
83
+ maxChildren?: number;
84
+ maxCalls?: number;
85
+ maxLatencyMs?: number;
86
+ maxCostMicros?: number;
87
+ }
88
+ export interface TaskRunAdmissionRequest {
89
+ taskRunId: string;
90
+ requestId: string;
91
+ input: unknown;
92
+ ownerActorRef?: string;
93
+ requestedMode?: TaskRunRequestedMode;
94
+ hostCapabilities?: readonly string[];
95
+ hybridPlan?: readonly TaskRunChildMode[];
96
+ compoundPlanId?: string;
97
+ conversationId?: string;
98
+ episodeId?: string;
99
+ traceRootRef?: string;
100
+ budget?: TaskRunBudget;
101
+ connectionId?: string;
102
+ }
103
+ export interface TaskRunPromptRequest {
104
+ input: unknown;
105
+ taskRunId?: string;
106
+ requestId?: string;
107
+ conversationId?: string;
108
+ episodeId?: string;
109
+ traceRootRef?: string;
110
+ budget?: TaskRunBudget;
111
+ connectionId?: string;
112
+ }
54
113
  export interface ConnectOnceResult {
55
114
  system: ClientBody;
56
115
  connection: ClientBody;
@@ -131,6 +190,7 @@ export declare class ViraClient {
131
190
  private readonly retries;
132
191
  private readonly failureMode;
133
192
  private readonly defaultHeaders;
193
+ private boundConnectionId?;
134
194
  constructor(options: ViraClientOptions);
135
195
  private request;
136
196
  connectSystem(input: {
@@ -219,7 +279,7 @@ export declare class ViraClient {
219
279
  [key: string]: unknown;
220
280
  })[], options?: {
221
281
  idempotencyKey?: string;
222
- }): Promise<ViraResponse<ClientBody> | null>;
282
+ }): Promise<ViraResponse<SemanticResolveBody> | null>;
223
283
  observeSdk(delivery: ClientBody, options?: {
224
284
  idempotencyKey?: string;
225
285
  }): Promise<ViraResponse<ClientBody> | null>;
@@ -375,6 +435,25 @@ export declare class ViraClient {
375
435
  getStrategyExecutionTrace(executionId: string): Promise<ViraResponse<ClientBody> | null>;
376
436
  continueStrategyExecution(executionId: string, continuation?: string | StrategyContinuationInput): Promise<ViraResponse<ClientBody> | null>;
377
437
  cancelStrategyExecution(executionId: string): Promise<ViraResponse<ClientBody> | null>;
438
+ resolveTaskRun(input: TaskRunRouteRequest): Promise<ViraResponse<ClientBody> | null>;
439
+ startTaskRun(input: TaskRunAdmissionRequest, options?: {
440
+ idempotencyKey?: string;
441
+ }): Promise<ViraResponse<ClientBody> | null>;
442
+ startTaskRunFromPrompt(input: TaskRunPromptRequest, options?: {
443
+ idempotencyKey?: string;
444
+ }): Promise<ViraResponse<ClientBody> | null>;
445
+ getTaskRun(taskRunId: string): Promise<ViraResponse<ClientBody> | null>;
446
+ listTaskRunEvents(taskRunId: string): Promise<ViraResponse<ClientBody> | null>;
447
+ continueTaskRun(taskRunId: string, expectedVersion: number, options?: {
448
+ cursor?: string;
449
+ idempotencyKey?: string;
450
+ }): Promise<ViraResponse<ClientBody> | null>;
451
+ cancelTaskRun(taskRunId: string, expectedVersion: number, options?: {
452
+ idempotencyKey?: string;
453
+ }): Promise<ViraResponse<ClientBody> | null>;
454
+ retryTaskRun(taskRunId: string, expectedVersion: number, options?: {
455
+ idempotencyKey?: string;
456
+ }): Promise<ViraResponse<ClientBody> | null>;
378
457
  listBehaviorPrograms(): Promise<ViraResponse<{
379
458
  programs: readonly ClientBody[];
380
459
  }> | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/sdk",
3
- "version": "0.1.43",
3
+ "version": "0.1.46",
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"},
@@ -11,7 +11,7 @@
11
11
  "main": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
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"],
14
+ "files": ["dist/index.js", "dist/index.d.ts", "dist/js-client.d.ts", "dist/framework-adapters.d.ts", "README.md"],
15
15
  "publishConfig": {"access": "public"},
16
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
17
  "license": "MIT"