@tryvira/opencode 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/dist/index.js +14 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -363,6 +363,11 @@ var ViraClient = class {
|
|
|
363
363
|
{ idempotencyKey: await contentIdempotencyKey(`sdk:pack:install:${packId}`, body) }
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
|
+
async diagnosePack(packId, input = {}) {
|
|
367
|
+
required(packId, "SDK_PACK_ID_REQUIRED");
|
|
368
|
+
const body = { runtimeBindings: [...input.runtimeBindings ?? []], knownVerifiers: [...input.knownVerifiers ?? []] };
|
|
369
|
+
return this.request({ method: "POST", path: `/v1/packs/${encodeURIComponent(packId)}/doctor`, body }, { idempotencyKey: await contentIdempotencyKey(`sdk:pack:doctor:${packId}`, body) });
|
|
370
|
+
}
|
|
366
371
|
async evaluatePack(packId, input) {
|
|
367
372
|
required(packId, "SDK_PACK_ID_REQUIRED");
|
|
368
373
|
required(input?.evaluationId, "SDK_EVALUATION_ID_REQUIRED");
|
|
@@ -498,6 +503,11 @@ var ViraClient = class {
|
|
|
498
503
|
body: { executionId: input.executionId, sessionId: input.sessionId, scope: input.scope, context: input.context, proposal: input.proposal, ...input.approval ? { approval: input.approval } : {} }
|
|
499
504
|
});
|
|
500
505
|
}
|
|
506
|
+
async createHostActionApproval(input) {
|
|
507
|
+
required(input.sessionId, "SDK_ACTION_SESSION_REQUIRED");
|
|
508
|
+
required(input.dataVersion, "SDK_ACTION_DATA_VERSION_REQUIRED");
|
|
509
|
+
return this.request({ method: "POST", path: "/v1/runtime/actions/approvals", body: { sessionId: input.sessionId, dataVersion: input.dataVersion, proposal: input.proposal, confirmed: input.confirmed === true, ...input.ttlSeconds !== void 0 ? { ttlSeconds: input.ttlSeconds } : {} } });
|
|
510
|
+
}
|
|
501
511
|
listBehaviorStrategies() {
|
|
502
512
|
return this.request({
|
|
503
513
|
method: "GET",
|
|
@@ -1318,8 +1328,10 @@ var v2Plugin = Plugin.define({
|
|
|
1318
1328
|
const bindingDigest = text(bound.context.binding_digest);
|
|
1319
1329
|
if (!allowedToolIds.includes(proposal.toolName) || !/^[a-f0-9]{64}$/.test(schemaDigest) || !/^[a-f0-9]{64}$/.test(bindingDigest)) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_BINDING_UNAVAILABLE" };
|
|
1320
1330
|
try {
|
|
1321
|
-
const
|
|
1322
|
-
const
|
|
1331
|
+
const proposalBody = { proposal_id: proposal.conversationId + ":" + proposal.callId, tool_key: proposal.toolName, arguments: proposal.args, arguments_digest: digest2(proposal.args), request_context_digest: digest2(bound.context), schema_digest: String(asRecord(asRecord(bound.context).tools).schema_digest ?? "") };
|
|
1332
|
+
const approvalCandidate = asRecord(asRecord(proposal).approval);
|
|
1333
|
+
const approval = typeof approvalCandidate.approvalId === "string" && approvalCandidate.approvalId.trim() ? { approvalId: approvalCandidate.approvalId.trim() } : void 0;
|
|
1334
|
+
const response = await client.authorizeHostAction({ executionId: bound.executionId, sessionId: proposal.sessionId ?? proposal.conversationId, scope, context: bound.context, proposal: proposalBody, ...approval ? { approval } : {} });
|
|
1323
1335
|
const body = asRecord(response?.body);
|
|
1324
1336
|
return body.allowed === true ? { decision: "ALLOW", authorityReceiptDigest: text(body.authority_receipt_digest), decisionDigest: text(body.decision_digest) } : { decision: "BLOCK", reasonCode: text(body.reason_code) || "POLICY_DENIED", authorityReceiptDigest: text(body.authority_receipt_digest) };
|
|
1325
1337
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvira/opencode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "OpenCode V2 host lifecycle integration for Vira",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"exports": {".": "./dist/index.js"},
|
|
8
|
-
"files": ["dist", "README.md"],
|
|
9
|
-
"scripts": {"build": "node ../../scripts/build-opencode-plugin.mjs", "pack:check": "npm run build && npm pack --dry-run"},
|
|
10
|
-
"dependencies": {"@tryvira/sdk": "0.1.
|
|
8
|
+
"files": ["dist/index.js", "README.md"],
|
|
9
|
+
"scripts": {"build": "node ../../scripts/build-opencode-plugin.mjs", "pack:check": "npm run build && npm pack --dry-run && node ../../scripts/opencode-plugin-smoke.mjs"},
|
|
10
|
+
"dependencies": {"@tryvira/sdk": "0.1.54"},
|
|
11
11
|
"peerDependencies": {"effect": "^4.0.0"},
|
|
12
12
|
"engines": {"node": ">=20"},
|
|
13
13
|
"license": "MIT"
|