@ycodium-ai/agent-opencode 0.2.4688 → 0.2.5029
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 +39 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const require = __ycodiumCreateRequire(import.meta.url);
|
|
|
5
5
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
6
6
|
|
|
7
7
|
// ../../packages/plugin-api/src/version.ts
|
|
8
|
-
var PLUGIN_API_VERSION =
|
|
8
|
+
var PLUGIN_API_VERSION = 143;
|
|
9
9
|
|
|
10
10
|
// src/card.ts
|
|
11
11
|
var OPENCODE_DRIVER_KIND = "opencode";
|
|
@@ -2833,6 +2833,33 @@ function handleOpenCodeCompactionEvent(input) {
|
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
2835
|
|
|
2836
|
+
// src/permissionStatement.ts
|
|
2837
|
+
var RESOURCE_ARG_BY_ACTION = {
|
|
2838
|
+
external_directory: "path",
|
|
2839
|
+
webfetch: "url",
|
|
2840
|
+
websearch: "query"
|
|
2841
|
+
};
|
|
2842
|
+
var PATCH_METADATA_ARGS = ["files", "diff"];
|
|
2843
|
+
var nonEmpty = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
2844
|
+
function openCodePermissionRequest(input) {
|
|
2845
|
+
const metadata = isRecord2(input.metadata) ? input.metadata : void 0;
|
|
2846
|
+
const resourceArg = RESOURCE_ARG_BY_ACTION[input.action];
|
|
2847
|
+
const resource = resourceArg !== void 0 && metadata?.[resourceArg] === void 0 && input.resources.length > 0 ? { [resourceArg]: input.resources.join("\n") } : void 0;
|
|
2848
|
+
const args = metadata === void 0 && resource === void 0 ? void 0 : { ...resource, ...metadata };
|
|
2849
|
+
const itemType = input.toolItemType;
|
|
2850
|
+
const description = itemType === "command_execution" || itemType === "collab_agent_tool_call" ? nonEmpty(input.toolInput?.["description"]) : void 0;
|
|
2851
|
+
const command = input.action === "shell" ? nonEmpty(input.toolInput?.["command"]) ?? nonEmpty(input.resources.join("\n")) : void 0;
|
|
2852
|
+
const coveredArgs = input.hasFileChanges && metadata !== void 0 ? PATCH_METADATA_ARGS.filter((name) => metadata[name] !== void 0) : [];
|
|
2853
|
+
return {
|
|
2854
|
+
args,
|
|
2855
|
+
statement: {
|
|
2856
|
+
...description !== void 0 ? { description } : {},
|
|
2857
|
+
...command !== void 0 ? { command } : {},
|
|
2858
|
+
...coveredArgs.length > 0 ? { coveredArgs } : {}
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2836
2863
|
// src/toolEvents.ts
|
|
2837
2864
|
var text2 = (data, key) => {
|
|
2838
2865
|
const value = data[key];
|
|
@@ -2941,6 +2968,15 @@ async function openPermission(context, data) {
|
|
|
2941
2968
|
const fileChanges = fileChangesOf(data["metadata"]);
|
|
2942
2969
|
const source = data["source"];
|
|
2943
2970
|
const toolCallId = isRecord2(source) ? text2(source, "id") : void 0;
|
|
2971
|
+
const toolName = toolCallId === void 0 ? void 0 : context.toolNames.get(toolCallId);
|
|
2972
|
+
const { args, statement } = openCodePermissionRequest({
|
|
2973
|
+
action,
|
|
2974
|
+
resources,
|
|
2975
|
+
metadata: data["metadata"],
|
|
2976
|
+
hasFileChanges: fileChanges !== void 0,
|
|
2977
|
+
toolItemType: toolName === void 0 ? void 0 : openCodeToolItemType(toolName),
|
|
2978
|
+
toolInput: toolCallId === void 0 ? void 0 : context.toolInputs.get(toolCallId)
|
|
2979
|
+
});
|
|
2944
2980
|
context.pendingPermissions.set(requestId, {
|
|
2945
2981
|
action,
|
|
2946
2982
|
sessionId,
|
|
@@ -2953,8 +2989,9 @@ async function openPermission(context, data) {
|
|
|
2953
2989
|
requestType,
|
|
2954
2990
|
detail: resources.length > 0 ? resources.join("\n") : action,
|
|
2955
2991
|
...requestType === "unknown" ? { toolName: action } : {},
|
|
2956
|
-
...
|
|
2992
|
+
...args === void 0 ? {} : { args },
|
|
2957
2993
|
...fileChanges ? { fileChanges } : {},
|
|
2994
|
+
statement,
|
|
2958
2995
|
declineReasonRelay: "native"
|
|
2959
2996
|
},
|
|
2960
2997
|
{ requestId }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-opencode",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5029",
|
|
4
4
|
"description": "OpenCode executor: OpenCode CLI (2.x) over its HTTP API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,10 +21,10 @@
|
|
|
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.
|
|
25
|
-
"ycodium-
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.5029",
|
|
25
|
+
"ycodium-sse-stream": "0.0.0",
|
|
26
26
|
"ycodium-executor-testing": "0.0.0",
|
|
27
|
-
"ycodium-
|
|
27
|
+
"ycodium-fetch-ports": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|