@tryvira/opencode 0.1.45 → 0.1.47
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 +5 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1952,11 +1952,13 @@ var v1Fallback = { async server(rawContext = {}) {
|
|
|
1952
1952
|
const identity = (input) => ({ ...scope, hostName: options.hostName ?? "opencode", hostVersion, aiSystemId: required2(connectedIdentity?.aiSystemId ?? options.aiSystemId ?? env("VIRA_AI_SYSTEM_ID"), "VIRA_HOST_AI_SYSTEM_REQUIRED"), connectionId: required2(connectedIdentity?.connectionId ?? options.connectionId ?? env("VIRA_CONNECTION_ID"), "VIRA_HOST_CONNECTION_REQUIRED"), conversationId: required2(input.sessionID ?? input.conversationId ?? input.id, "VIRA_HOST_SESSION_REQUIRED"), sessionId: text2(input.sessionID ?? input.sessionId ?? input.conversationId) || void 0 });
|
|
1953
1953
|
const partsText = (value) => Array.isArray(value) ? value.map((part) => text2(asRecord(part).text)).filter(Boolean).join("\n") : "";
|
|
1954
1954
|
const persistCompletedText = async (raw) => {
|
|
1955
|
-
const
|
|
1955
|
+
const envelope = asRecord(raw);
|
|
1956
|
+
const event = asRecord(envelope.event ?? raw);
|
|
1956
1957
|
const data = asRecord(event.data ?? event.properties);
|
|
1957
1958
|
if (text2(event.type) !== "session.text.ended") return;
|
|
1958
|
-
const
|
|
1959
|
-
const
|
|
1959
|
+
const part = asRecord(data.part ?? data.message ?? data.output);
|
|
1960
|
+
const sessionID = text2(data.sessionID ?? data.sessionId ?? part.sessionID ?? part.sessionId);
|
|
1961
|
+
const output = text2(data.text ?? data.content ?? part.text ?? part.content);
|
|
1960
1962
|
if (!sessionID || !output.trim()) return;
|
|
1961
1963
|
const current = identity({ sessionID });
|
|
1962
1964
|
const messageID = text2(data.assistantMessageID) || text2(data.textID) || digest2(output).slice(0, 16);
|