@tryvira/opencode 0.1.23 → 0.1.25

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
@@ -1,4 +1,4 @@
1
- # `@tryvira/opencode` 0.1.23
1
+ # `@tryvira/opencode` 0.1.25
2
2
 
3
3
  OpenCode V2 server plugin for Vira host lifecycle governance. The package default
4
4
  exports the V2 setup surface plus a compatibility `server()` transport required
package/dist/index.js CHANGED
@@ -200,13 +200,27 @@ var ViraClient = class {
200
200
  );
201
201
  }
202
202
  async connectOnce(input) {
203
- const systemResult = await this.connectSystem(input);
203
+ let systemResult;
204
+ try {
205
+ systemResult = await this.connectSystem(input);
206
+ } catch (error) {
207
+ if (!(input.reuseExistingConnectionOnConflict !== false && error instanceof ViraApiError && error.status === 409)) throw error;
208
+ const listed = await this.listAISystems();
209
+ if (!listed) throw error;
210
+ const systems = Array.isArray(listed?.body?.systems) ? listed.body.systems : [];
211
+ const reused = systems.find(
212
+ (system) => String(system.name ?? "") === input.name && String(system.systemType ?? "") === input.systemType && String(system.organizationId ?? "") === input.organizationId && String(system.projectId ?? "") === input.projectId && String(system.environmentId ?? "") === input.environmentId
213
+ );
214
+ if (!reused) throw error;
215
+ systemResult = { status: listed.status, requestId: listed.requestId, body: { system: reused } };
216
+ }
204
217
  if (!systemResult) return null;
205
218
  const systemId = String(systemResult.body.system.id ?? "");
206
219
  required(systemId, "SDK_SYSTEM_ID_MISSING");
207
220
  let connectionResult;
208
221
  try {
209
222
  connectionResult = await this.connectAdapter(systemId, {
223
+ id: input.id,
210
224
  adapterType: input.adapterType,
211
225
  adapterVersion: input.adapterVersion,
212
226
  capabilities: input.capabilities,
@@ -1585,7 +1599,7 @@ var hostVersionFor = (options, rawContext = {}) => {
1585
1599
  return options.hostVersion?.trim() || text2(app.version).trim() || text2(raw.version).trim() || envValue("VIRA_HOST_VERSION")?.trim() || "unknown";
1586
1600
  };
1587
1601
  var adapterVersionFor = (options) => options.adapterVersion ?? envValue("VIRA_ADAPTER_VERSION") ?? "1";
1588
- var openCodeConnectConfig = (scope, options) => ({ ...scope, name: "OpenCode", systemType: "agent", adapterType: "custom-node", adapterVersion: adapterVersionFor(options), capabilities: ["conversation_input", "conversation_output", "model_call", "tool_selection", "tool_execution", "external_action", "user_feedback", "business_outcome"], privacyPolicy: { allowConversationText: false, allowToolArguments: false }, idempotencyKey: "opencode:vira:connect:capabilities-v1", reuseExistingConnectionOnConflict: true });
1602
+ var openCodeConnectConfig = (scope, options) => ({ ...scope, name: "OpenCode", systemType: "agent", adapterType: "custom-node", adapterVersion: adapterVersionFor(options), id: "connection-opencode-luna", capabilities: ["conversation_input", "conversation_output", "model_call", "tool_selection", "tool_execution", "external_action", "user_feedback", "business_outcome"], privacyPolicy: { allowConversationText: false, allowToolArguments: false }, idempotencyKey: "opencode:vira:connect:capabilities-v1", reuseExistingConnectionOnConflict: true });
1589
1603
  var resolveOpenCodeToolBinding = (tools, toolName) => {
1590
1604
  const allowedToolIds = Array.isArray(tools.allowed_tool_ids) ? tools.allowed_tool_ids.map(text2) : [];
1591
1605
  const bindings = Array.isArray(tools.tool_bindings) ? tools.tool_bindings.filter((value) => value && typeof value === "object").map((value) => asRecord(value)) : [];
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
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 && node ../../scripts/opencode-plugin-smoke.mjs && node ../../scripts/opencode-plugin-host-acceptance.mjs"},
10
- "dependencies": {"@tryvira/sdk": "0.1.60"},
10
+ "dependencies": {"@tryvira/sdk": "0.1.62"},
11
11
  "peerDependencies": {"effect": "^4.0.0"},
12
12
  "engines": {"node": ">=20"},
13
13
  "license": "MIT"