@tryvira/sdk 0.1.44 → 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.44
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,
@@ -59,6 +59,18 @@ export interface TaskRunChildMode {
59
59
  semanticTaskKey: string;
60
60
  mode: "SINGLE" | "STRATEGY";
61
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
+ }
62
74
  export interface TaskRunRouteRequest {
63
75
  input: string;
64
76
  requestedMode?: TaskRunRequestedMode;
@@ -267,7 +279,7 @@ export declare class ViraClient {
267
279
  [key: string]: unknown;
268
280
  })[], options?: {
269
281
  idempotencyKey?: string;
270
- }): Promise<ViraResponse<ClientBody> | null>;
282
+ }): Promise<ViraResponse<SemanticResolveBody> | null>;
271
283
  observeSdk(delivery: ClientBody, options?: {
272
284
  idempotencyKey?: string;
273
285
  }): Promise<ViraResponse<ClientBody> | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/sdk",
3
- "version": "0.1.44",
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"},