@github-tools/eve-extension 0.3.1 → 0.3.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":"AAcA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;;AAoE1E,wBAyCE"}
|
|
@@ -4,18 +4,14 @@ import { createRequire as __eveCreateRequire } from "node:module";
|
|
|
4
4
|
__eveDirname(__eveFileURLToPath(import.meta.url));
|
|
5
5
|
__eveCreateRequire(import.meta.url);
|
|
6
6
|
import extension_default from "../extension.mjs";
|
|
7
|
-
import { executeGithubEveTool, listEveToolDescriptors, mapEveApprovalValue, resolveEveApproval } from "@github-tools/sdk/eve-runtime";
|
|
7
|
+
import { executeGithubEveTool, isEveApprovalDisabled, listEveToolDescriptors, mapEveApprovalValue, resolveEveApproval } from "@github-tools/sdk/eve-runtime";
|
|
8
8
|
import { connectGithubToken } from "@github-tools/sdk/connect";
|
|
9
9
|
import { defineDynamic, defineTool } from "eve/tools";
|
|
10
|
-
|
|
11
|
-
async function runGithubEveTool(name, input) {
|
|
12
|
-
return executeGithubEveTool(name, input, sessionOptions);
|
|
13
|
-
}
|
|
14
|
-
var github_default = defineDynamic({ events: { "session.started": async () => {
|
|
10
|
+
function buildSessionOptions() {
|
|
15
11
|
const { token, connector, connect, preset, include, exclude, requireApproval, overrides, context, author, committer, coAuthors } = extension_default.config;
|
|
16
12
|
const includeNames = include;
|
|
17
13
|
const excludeNames = exclude;
|
|
18
|
-
|
|
14
|
+
return {
|
|
19
15
|
token: connector ? connectGithubToken(connector, {
|
|
20
16
|
preset,
|
|
21
17
|
include: includeNames,
|
|
@@ -32,17 +28,31 @@ var github_default = defineDynamic({ events: { "session.started": async () => {
|
|
|
32
28
|
committer,
|
|
33
29
|
coAuthors
|
|
34
30
|
};
|
|
31
|
+
}
|
|
32
|
+
function approvalDisabled(writeTool, requireApproval, override) {
|
|
33
|
+
if (override !== void 0) return isEveApprovalDisabled(override);
|
|
34
|
+
if (!writeTool) return true;
|
|
35
|
+
if (requireApproval === false) return true;
|
|
36
|
+
if (typeof requireApproval === "object" && requireApproval !== null) return isEveApprovalDisabled(requireApproval[writeTool]);
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
async function runGithubEveTool(name, input) {
|
|
40
|
+
return executeGithubEveTool(name, input, buildSessionOptions());
|
|
41
|
+
}
|
|
42
|
+
var github_default = defineDynamic({ events: { "step.started": async () => {
|
|
43
|
+
const sessionOptions = buildSessionOptions();
|
|
35
44
|
const descriptors = listEveToolDescriptors(sessionOptions);
|
|
36
45
|
const tools = {};
|
|
37
46
|
const toolOverrides = sessionOptions.overrides;
|
|
38
47
|
for (const entry of descriptors) {
|
|
39
48
|
const name = entry.name;
|
|
40
49
|
const override = toolOverrides?.[name];
|
|
50
|
+
const skipApproval = approvalDisabled(entry.writeTool, sessionOptions.requireApproval, override?.approval);
|
|
41
51
|
tools[name] = defineTool({
|
|
42
52
|
description: override?.description ?? entry.description,
|
|
43
53
|
inputSchema: entry.inputSchema,
|
|
44
|
-
...entry.writeTool && { approval: resolveEveApproval(entry.writeTool, sessionOptions.requireApproval) },
|
|
45
|
-
...override?.approval !== void 0 && { approval: mapEveApprovalValue(override.approval) },
|
|
54
|
+
...entry.writeTool && !skipApproval && { approval: resolveEveApproval(entry.writeTool, sessionOptions.requireApproval) },
|
|
55
|
+
...override?.approval !== void 0 && !skipApproval && { approval: mapEveApprovalValue(override.approval) },
|
|
46
56
|
...override?.toModelOutput !== void 0 ? { toModelOutput: override.toModelOutput } : entry.toModelOutput ? { toModelOutput: entry.toModelOutput } : {},
|
|
47
57
|
...override?.outputSchema !== void 0 && { outputSchema: override.outputSchema },
|
|
48
58
|
execute: async (input) => runGithubEveTool(name, input)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github-tools/eve-extension",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "GitHub tools for eve, distributed as a mountable eve extension (https://eve.dev/docs/extensions)",
|
|
5
5
|
"author": "HugoRCD <hugo.richard@vercel.com>",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zod": "^4.3.6",
|
|
49
|
-
"@github-tools/sdk": "1.11.
|
|
49
|
+
"@github-tools/sdk": "1.11.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@vercel/connect": ">=0.3.2",
|