@tryvira/opencode 0.1.15 → 0.1.16

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -507,7 +507,12 @@ var ViraClient = class {
507
507
  async createHostActionApproval(input) {
508
508
  required(input.sessionId, "SDK_ACTION_SESSION_REQUIRED");
509
509
  required(input.dataVersion, "SDK_ACTION_DATA_VERSION_REQUIRED");
510
- 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
+ required(input.confirmation.proposalId, "SDK_ACTION_CONFIRMATION_PROPOSAL_REQUIRED");
511
+ required(input.confirmation.toolName, "SDK_ACTION_CONFIRMATION_TOOL_REQUIRED");
512
+ required(input.confirmation.argumentsDigest, "SDK_ACTION_CONFIRMATION_ARGUMENTS_REQUIRED");
513
+ required(input.confirmation.requestContextDigest, "SDK_ACTION_CONFIRMATION_CONTEXT_REQUIRED");
514
+ required(input.confirmation.acknowledgedAt, "SDK_ACTION_CONFIRMATION_TIME_REQUIRED");
515
+ return this.request({ method: "POST", path: "/v1/runtime/actions/approvals", body: { sessionId: input.sessionId, dataVersion: input.dataVersion, proposal: input.proposal, confirmation: input.confirmation, ...input.ttlSeconds !== void 0 ? { ttlSeconds: input.ttlSeconds } : {} } });
511
516
  }
512
517
  listBehaviorStrategies() {
513
518
  return this.request({
@@ -1277,7 +1282,7 @@ async function authorizeWithOneShotCustomerConfirmation(input) {
1277
1282
  } catch (error) {
1278
1283
  if (errorCode(error) !== "RUNTIME_ACTION_USER_APPROVAL_REQUIRED" || input.approvalId || typeof input.confirmAction !== "function") return { decision: "BLOCK", reasonCode: errorCode(error) || "RUNTIME_ACTION_AUTHORIZATION_FAILED" };
1279
1284
  if (await input.confirmAction({ ...input.proposal, approvalRequired: true }) !== true) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_CUSTOMER_CONFIRMATION_DENIED" };
1280
- const issued = await input.client.createHostActionApproval({ sessionId: input.sessionId, dataVersion: input.dataVersion, proposal: input.proposalBody, confirmed: true });
1285
+ const issued = await input.client.createHostActionApproval({ sessionId: input.sessionId, dataVersion: input.dataVersion, proposal: input.proposalBody, confirmation: { proposalId: text(input.proposalBody.proposal_id), toolName: text(input.proposalBody.tool_key), argumentsDigest: text(input.proposalBody.arguments_digest), requestContextDigest: text(input.proposalBody.request_context_digest), acknowledgedAt: (/* @__PURE__ */ new Date()).toISOString() } });
1281
1286
  const approvalId = text(record(issued?.body).approvalId);
1282
1287
  if (!approvalId) return { decision: "ERROR", reasonCode: "RUNTIME_ACTION_APPROVAL_RECEIPT_MISSING" };
1283
1288
  try {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
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
8
  "files": ["dist/index.js", "README.md"],
9
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.55"},
10
+ "dependencies": {"@tryvira/sdk": "0.1.56"},
11
11
  "peerDependencies": {"effect": "^4.0.0"},
12
12
  "engines": {"node": ">=20"},
13
13
  "license": "MIT"