@tryvira/opencode 0.1.24 → 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.24
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,7 +200,20 @@ 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");
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.24",
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.61"},
10
+ "dependencies": {"@tryvira/sdk": "0.1.62"},
11
11
  "peerDependencies": {"effect": "^4.0.0"},
12
12
  "engines": {"node": ">=20"},
13
13
  "license": "MIT"