@tryvira/opencode 0.1.43 → 0.1.45

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 +19 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1954,9 +1954,9 @@ var v1Fallback = { async server(rawContext = {}) {
1954
1954
  const persistCompletedText = async (raw) => {
1955
1955
  const event = asRecord(raw);
1956
1956
  const data = asRecord(event.data ?? event.properties);
1957
- if (text2(event.type) !== "session.next.text.ended") return;
1958
- const sessionID = text2(data.sessionID);
1959
- const output = text2(data.text);
1957
+ if (text2(event.type) !== "session.text.ended") return;
1958
+ const sessionID = text2(data.sessionID ?? data.sessionId);
1959
+ const output = text2(data.text ?? data.content);
1960
1960
  if (!sessionID || !output.trim()) return;
1961
1961
  const current = identity({ sessionID });
1962
1962
  const messageID = text2(data.assistantMessageID) || text2(data.textID) || digest2(output).slice(0, 16);
@@ -1998,6 +1998,22 @@ Assistant: ${output}`, consent: true, privacy: "CONSENTED_TENANT" }, { idempoten
1998
1998
  } catch {
1999
1999
  }
2000
2000
  },
2001
+ "experimental.text.complete": async (input, output) => {
2002
+ try {
2003
+ const sessionID = text2(input.sessionID);
2004
+ const completed = text2(output.text);
2005
+ if (!sessionID || !completed.trim()) return;
2006
+ const current = identity({ sessionID });
2007
+ const messageID = text2(input.messageID) || text2(input.partID) || digest2(completed).slice(0, 16);
2008
+ await recordConversationOutput(client, current, { eventId: `${sessionID}:assistant:${messageID}`, output: completed, conversationId: sessionID, requestId: messageID });
2009
+ if (options.teachConsent === true) {
2010
+ const prompt = prompts.take(sessionID);
2011
+ if (prompt) await client.submitTeachConversationEvidence({ id: `opencode-teach:${sessionID}:${messageID}`, conversationId: sessionID, message: `User: ${prompt}
2012
+ Assistant: ${completed}`, consent: true, privacy: "CONSENTED_TENANT" }, { idempotencyKey: `opencode:teach:${sessionID}:${messageID}` });
2013
+ }
2014
+ } catch {
2015
+ }
2016
+ },
2001
2017
  "chat.message": async (input, output) => {
2002
2018
  const sessionId = text2(input.sessionID ?? input.conversationId ?? input.id);
2003
2019
  const message = asRecord(output.message ?? input.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvira/opencode",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "OpenCode host lifecycle integration for Vira",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",