@tryvira/sdk 0.1.63 → 0.1.65
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/dist/index.js +12 -5
- package/dist/js-client.d.ts +1 -0
- package/package.json +1 -1
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;
|
|
@@ -741,7 +741,7 @@ var ViraClient = class {
|
|
|
741
741
|
if (input.input === void 0 || input.input === null) throw new Error("SDK_TASKRUN_INPUT_REQUIRED");
|
|
742
742
|
const id = () => globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
743
743
|
const requestId = input.requestId ?? `sdk-task-run-${id()}`;
|
|
744
|
-
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);
|
|
744
|
+
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 } : {}, ...input.hostCapabilities ? { hostCapabilities: [...input.hostCapabilities] } : {} }, options);
|
|
745
745
|
}
|
|
746
746
|
getTaskRun(taskRunId) {
|
|
747
747
|
required(taskRunId, "SDK_TASKRUN_ID_REQUIRED");
|
|
@@ -1220,7 +1220,7 @@ function buildObservationRequest(event) {
|
|
|
1220
1220
|
});
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
|
-
// sdks/framework-adapters.ts
|
|
1223
|
+
// ../../sdks/framework-adapters.ts
|
|
1224
1224
|
function createFrameworkRuntimeCore(client) {
|
|
1225
1225
|
if (!client) throw new Error("SDK_FRAMEWORK_CLIENT_REQUIRED");
|
|
1226
1226
|
return Object.freeze({
|
|
@@ -1304,7 +1304,7 @@ function createFrameworkAdapters(client) {
|
|
|
1304
1304
|
return Object.freeze(Object.fromEntries(["openai-agents", "vercel-ai", "langchain", "langgraph", "otel", "mcp"].map((name) => [name, createFrameworkObservationAdapter(client, name)])));
|
|
1305
1305
|
}
|
|
1306
1306
|
|
|
1307
|
-
// sdks/host-lifecycle.ts
|
|
1307
|
+
// ../../sdks/host-lifecycle.ts
|
|
1308
1308
|
import { createHash } from "node:crypto";
|
|
1309
1309
|
function resolveHostToolBinding(bindings, hostToolName) {
|
|
1310
1310
|
const name = hostToolName.trim();
|
|
@@ -1440,7 +1440,14 @@ function createViraHostRuntime(client, config) {
|
|
|
1440
1440
|
if (!semantic) return { status: "unavailable", reasonCode: "VIRA_SEMANTIC_UNAVAILABLE" };
|
|
1441
1441
|
if (semantic.multiTask === true && semantic.taskKeys?.length > 1 && typeof client.startTaskRunFromPrompt === "function") {
|
|
1442
1442
|
try {
|
|
1443
|
-
const
|
|
1443
|
+
const hostCapabilities = [
|
|
1444
|
+
...capabilities.canObserveModel ? ["conversation_input", "conversation_output", "model_call"] : [],
|
|
1445
|
+
...capabilities.canInjectContext ? ["behavior_projection"] : [],
|
|
1446
|
+
...capabilities.canInterceptToolBefore ? ["tool_selection", "tool_execution"] : [],
|
|
1447
|
+
...capabilities.canPreventSideEffect ? ["external_action"] : [],
|
|
1448
|
+
...capabilities.canInspectToolAfter ? ["tool_result"] : []
|
|
1449
|
+
];
|
|
1450
|
+
const admitted = await withTimeout(client.startTaskRunFromPrompt({ input: request.input, taskRunId: `host-task-run-${request.requestId}`, requestId: request.requestId, conversationId: request.conversationId, traceRootRef: request.traceId, ...request.connectionId ? { connectionId: request.connectionId } : {}, hostCapabilities }), timeoutMs, "SDK_HOST_TASKRUN_ADMISSION_TIMEOUT");
|
|
1444
1451
|
const admittedBody = bodyOf(admitted);
|
|
1445
1452
|
const taskRun = admittedBody.taskRun && typeof admittedBody.taskRun === "object" ? admittedBody.taskRun : {};
|
|
1446
1453
|
const taskRunId = typeof taskRun.taskRunId === "string" ? taskRun.taskRunId : `host-task-run-${request.requestId}`;
|
package/dist/js-client.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
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"},
|