@tryvira/opencode 0.1.28 → 0.1.29
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 +1 -1
- package/dist/index.js +21 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1688,6 +1688,24 @@ var v2Plugin = Plugin.define({
|
|
|
1688
1688
|
}
|
|
1689
1689
|
};
|
|
1690
1690
|
const nativeConfirm = desktopPermission.confirm;
|
|
1691
|
+
let bootstrapAiSystemId = options.aiSystemId ?? env("VIRA_AI_SYSTEM_ID") ?? "";
|
|
1692
|
+
let bootstrapConnectionId = options.connectionId ?? env("VIRA_CONNECTION_ID") ?? "";
|
|
1693
|
+
if (!bootstrapAiSystemId || !bootstrapConnectionId) {
|
|
1694
|
+
try {
|
|
1695
|
+
const listed = await client.listAISystems();
|
|
1696
|
+
const system = listed?.body?.systems?.find((item) => String(item.name ?? "") === "OpenCode" && String(item.systemType ?? "") === "agent" && String(item.organizationId ?? "") === scope.organizationId && String(item.projectId ?? "") === scope.projectId && String(item.environmentId ?? "") === scope.environmentId);
|
|
1697
|
+
if (system?.id) {
|
|
1698
|
+
const connections = await client.listSystemConnections(String(system.id));
|
|
1699
|
+
const requested = new Set(openCodeConnectConfig(scope, options).capabilities);
|
|
1700
|
+
const connection = connections?.body?.connections?.find((item) => String(item.adapterType ?? "") === "custom-node" && requested.size <= (Array.isArray(item.capabilities) ? item.capabilities.length : 0) && [...requested].every((capability) => Array.isArray(item.capabilities) && item.capabilities.includes(capability)));
|
|
1701
|
+
if (connection?.id) {
|
|
1702
|
+
bootstrapAiSystemId = String(system.id);
|
|
1703
|
+
bootstrapConnectionId = String(connection.id);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
} catch {
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1691
1709
|
const runtime = createViraHostRuntime(client, { mode, capabilities, authorizeAction: options.authorizeAction ?? (async (proposal) => {
|
|
1692
1710
|
const bound = actionContexts.get(contextKey(proposal));
|
|
1693
1711
|
if (!bound) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_CONTEXT_UNAVAILABLE" };
|
|
@@ -1711,9 +1729,9 @@ var v2Plugin = Plugin.define({
|
|
|
1711
1729
|
if (!dataVersion) return { decision: "BLOCK", reasonCode: "RUNTIME_ACTION_DATA_VERSION_UNAVAILABLE" };
|
|
1712
1730
|
const refs = Array.isArray(bound.context.signal_attestation_refs) ? bound.context.signal_attestation_refs : [];
|
|
1713
1731
|
return authorizeWithOneShotCustomerConfirmation({ client, proposal, proposalBody, signalAttestationRefs: refs, executionId: bound.executionId, sessionId: proposal.sessionId ?? proposal.conversationId, dataVersion, scope, context: bound.context, confirmAction: options.confirmAction ?? nativeConfirm, approvalId: approval?.approvalId });
|
|
1714
|
-
}), ...
|
|
1715
|
-
let connectedAiSystemId =
|
|
1716
|
-
let connectedConnectionId =
|
|
1732
|
+
}), ...bootstrapAiSystemId && bootstrapConnectionId ? {} : { connect: openCodeConnectConfig(scope, options) } });
|
|
1733
|
+
let connectedAiSystemId = bootstrapAiSystemId;
|
|
1734
|
+
let connectedConnectionId = bootstrapConnectionId;
|
|
1717
1735
|
if (!connectedAiSystemId || !connectedConnectionId) {
|
|
1718
1736
|
await runtime.connectOnce();
|
|
1719
1737
|
const identity = runtime.getConnectionIdentity();
|