@ycodium-ai/agent-opencode 0.2.3935 → 0.2.3976

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 +15 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4,6 +4,9 @@ const require = __ycodiumCreateRequire(import.meta.url);
4
4
  // src/index.ts
5
5
  import { definePlugin } from "@ycodium-ai/plugin-api";
6
6
 
7
+ // ../../packages/plugin-api/src/version.ts
8
+ var PLUGIN_API_VERSION = 75;
9
+
7
10
  // src/card.ts
8
11
  var OPENCODE_DRIVER_KIND = "opencode";
9
12
  var OPENCODE_CARD = {
@@ -2785,6 +2788,15 @@ function openCodeRequestType(action) {
2785
2788
  return "unknown";
2786
2789
  }
2787
2790
  }
2791
+ var DATA_URI = /^data:([^;,]+);base64,(.*)$/su;
2792
+ var EXTRACTED_MEDIA = /^(?:image|audio|video)\/|^application\/pdf$/iu;
2793
+ function inlineMediaOf(part) {
2794
+ if (!isRecord2(part) || part["type"] !== "file" || typeof part["uri"] !== "string") return [];
2795
+ const match = DATA_URI.exec(part["uri"]);
2796
+ if (match === null) return [];
2797
+ const mimeType = typeof part["mime"] === "string" ? part["mime"] : match[1];
2798
+ return EXTRACTED_MEDIA.test(mimeType) ? [{ mimeType, data: match[2] }] : [];
2799
+ }
2788
2800
  function contentText(content) {
2789
2801
  if (!Array.isArray(content)) return void 0;
2790
2802
  const joined = content.map(
@@ -2972,6 +2984,7 @@ async function handleOpenCodeToolEvent(input) {
2972
2984
  }
2973
2985
  const output = contentText(data["content"]) ?? (failed && isRecord2(error) ? text2(error, "message") : void 0);
2974
2986
  const toolInput = context.toolInputs.get(callId);
2987
+ const media = Array.isArray(data["content"]) ? data["content"].flatMap(inlineMediaOf) : [];
2975
2988
  emitTool(
2976
2989
  events,
2977
2990
  context,
@@ -2984,6 +2997,7 @@ async function handleOpenCodeToolEvent(input) {
2984
2997
  data: {
2985
2998
  ...toolInput === void 0 ? {} : { input: toolInput },
2986
2999
  ...output === void 0 ? {} : { output },
3000
+ ...media.length === 0 ? {} : { content: media },
2987
3001
  ...isRecord2(data["metadata"]) ? { metadata: data["metadata"] } : {}
2988
3002
  }
2989
3003
  }
@@ -4887,7 +4901,7 @@ var executors = [
4887
4901
  ];
4888
4902
  var index_default = definePlugin({
4889
4903
  id: "agent-opencode",
4890
- apiVersion: 69,
4904
+ apiVersion: PLUGIN_API_VERSION,
4891
4905
  executors,
4892
4906
  activate(ctx) {
4893
4907
  capturedAttachments = ctx.attachments;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-opencode",
3
- "version": "0.2.3935",
3
+ "version": "0.2.3976",
4
4
  "description": "OpenCode executor: OpenCode CLI (2.x) over its HTTP API.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,9 +21,9 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.3935",
25
- "ycodium-executor-testing": "0.0.0",
24
+ "@ycodium-ai/plugin-api": "0.2.3976",
26
25
  "ycodium-fetch-ports": "0.0.0",
26
+ "ycodium-executor-testing": "0.0.0",
27
27
  "ycodium-sse-stream": "0.0.0"
28
28
  },
29
29
  "ycodium": {