eve-hub 0.16.16 → 0.16.18
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/connections/vercel-kit.d.ts +1 -1
- package/execution-context.mjs +1 -1
- package/package.json +4 -4
- package/prepare.mjs +40 -15
- package/vercel.mjs +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("eve").DynamicSentinel<import("eve/connections").DynamicConnectionResult, import("eve").DynamicContext>;
|
|
1
|
+
declare const _default: import("eve/connections").DynamicSentinel<import("eve/connections").DynamicConnectionResult, import("eve/connections").DynamicContext>;
|
|
2
2
|
export default _default;
|
package/execution-context.mjs
CHANGED
|
@@ -59,7 +59,7 @@ export function hostedContext({ bot, kit, removed, deployment: d, git = false },
|
|
|
59
59
|
? "- **Changing it:** commit to that repository; Vercel builds and deploys the commit."
|
|
60
60
|
: "- **Changing it:** there is no repository to commit to. The hub replaces these files on its next deploy, so an edit made only in this deployment does not last.",
|
|
61
61
|
git
|
|
62
|
-
? "- **GitHub:** goes through the `git__gh` tool (`git`, `gh`, `gh-signed-commit`), which runs each command with the human's own GitHub token, swapped in at the sandbox firewall for that command, so pushes, pull requests and commits are theirs. The shell itself holds no credential, so plain `git` and `gh` in bash cannot authenticate."
|
|
62
|
+
? "- **GitHub:** goes through the `git__gh` tool (`git`, `gh`, `gh-signed-commit`), which runs each command with the human's own GitHub token, swapped in at the sandbox firewall for that command, so pushes, pull requests and commits are theirs. The shell itself holds no credential, so plain `git` and `gh` in bash cannot authenticate. Every command declares one repository in the workspace's org. Authenticated `git fetch`, `pull`, `push` and `ls-remote` name that repository's URL as the remote, never `origin` (`git push https://github.com/owner/name.git HEAD:branch`, `git fetch https://github.com/owner/name.git +refs/heads/branch:refs/remotes/origin/branch`), and `gh-signed-commit` always takes `--repo`."
|
|
63
63
|
: "- **GitHub:** your shell has no GitHub credential: `git` cannot authenticate, so a private repository won't clone and nothing can be pushed. When a `vercel-kit` connection is listed, reach GitHub through it (eve__search, then eve__tool); otherwise tell the human this deployment has no GitHub access.",
|
|
64
64
|
"- **Memory:** the standing decisions you recall are the `memory/` and `agents/<bot>/memory/` files, built into each deployment. An entry takes effect when the deployment that contains it is live, not on your next turn; with no repository it cannot last.",
|
|
65
65
|
"- **Limits:** there is no `hub` CLI, you cannot restart yourself or any bot, and there are no host paths: your shell is a Vercel Sandbox with its own filesystem, not the owner's machine.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-hub",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.18",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Bot-side code shared by every hub agent: registry tools, the roster hook, the eve channel, the host sandbox and browser, and model helpers.",
|
|
6
6
|
"type": "module",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"./update": "./update.mjs"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@vercel/connect": "^2.
|
|
42
|
+
"@vercel/connect": "^2.7.0",
|
|
43
43
|
"@vercel/oidc": "4.0.0",
|
|
44
|
-
"eve": "~0.
|
|
44
|
+
"eve": "~1.0.0-rc.3",
|
|
45
45
|
"zod": "4.5.4"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"web-tree-sitter": "0.27.1"
|
|
56
56
|
},
|
|
57
57
|
"hubPins": {
|
|
58
|
-
"eve": "0.
|
|
58
|
+
"eve": "1.0.0-rc.3"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/prepare.mjs
CHANGED
|
@@ -53,37 +53,62 @@ import type { VercelSandboxSession } from "eve/sandbox/vercel";
|
|
|
53
53
|
// wake-ups and bot handoffs included, runs as the workspace's human (channels/eve-roster-user).
|
|
54
54
|
// The sandbox only sees a placeholder; this swaps the real token in at the sandbox firewall for
|
|
55
55
|
// that command and removes it afterwards. All other egress stays open.
|
|
56
|
+
const ORG = ${JSON.stringify(org.toLowerCase())};
|
|
57
|
+
|
|
58
|
+
// The firewall sees the request Git really sends, after any \`insteadOf\` or \`-c\` rewrite that
|
|
59
|
+
// \`authorize\` can't see, so it swaps the token in only for paths under the workspace's org.
|
|
60
|
+
// Anywhere else the placeholder goes out and GitHub answers 401. api.github.com keeps eve's rule:
|
|
61
|
+
// \`/graphql\` and \`/user\` carry no owner.
|
|
62
|
+
const ORG_PATHS: Record<string, string> = {
|
|
63
|
+
"github.com": \`(?i)^/\${ORG}/\`,
|
|
64
|
+
"uploads.github.com": \`(?i)^/repos/\${ORG}/\`,
|
|
65
|
+
};
|
|
66
|
+
const scoped = (rules: Parameters<GitHubLeaseBroker>[1]) =>
|
|
67
|
+
rules && Object.fromEntries(Object.entries(rules).map(([host, list]) => [
|
|
68
|
+
host,
|
|
69
|
+
host in ORG_PATHS ? list.map((rule) => ({ ...rule, match: { ...rule.match, path: { regex: ORG_PATHS[host] } } })) : list,
|
|
70
|
+
]));
|
|
56
71
|
const broker: GitHubLeaseBroker = async (sandbox, rules) => {
|
|
57
72
|
if (!("setNetworkPolicy" in sandbox)) throw new Error("GitHub credential leases need a Vercel Sandbox");
|
|
58
|
-
await (sandbox as VercelSandboxSession).setNetworkPolicy({ allow: { "*": [], ...rules } } as SandboxNetworkPolicy);
|
|
73
|
+
await (sandbox as VercelSandboxSession).setNetworkPolicy({ allow: { "*": [], ...scoped(rules) } } as SandboxNetworkPolicy);
|
|
59
74
|
};
|
|
60
75
|
|
|
61
|
-
|
|
76
|
+
// From eve 1.0, \`authorize\` is the only check: eve no longer refuses a command whose \`--repo\`,
|
|
77
|
+
// \`-R\` or \`gh repo clone|view|fork\` target differs from the declared repository, nor a \`git\`
|
|
78
|
+
// remote outside it, so this does. \`authorize\` can't read the sandbox, so a remote name such as
|
|
79
|
+
// \`origin\` can't be resolved: authenticated git names the declared repository's URL itself.
|
|
80
|
+
const GIT_REMOTE_COMMANDS = ["fetch", "ls-remote", "pull", "push"];
|
|
81
|
+
const targets = (argv: readonly string[]) => [
|
|
82
|
+
...argv.flatMap((a, i) => (a === "--repo" || a === "-R" ? [argv[i + 1] ?? ""] : a.startsWith("--repo=") ? [a.slice(7)] : [])),
|
|
83
|
+
...(argv[0] === "gh" && argv[1] === "repo" && ["clone", "view", "fork"].includes(argv[2] ?? "") && argv[3] && !argv[3].startsWith("-") ? [argv[3]] : []),
|
|
84
|
+
];
|
|
85
|
+
const GITHUB_URL = /^(?:https:\\/\\/github\\.com\\/|git@github\\.com:|ssh:\\/\\/git@github\\.com\\/)/i;
|
|
86
|
+
const canonical = (repo: string) => repo.toLowerCase().replace(GITHUB_URL, "").replace(/\\/$/, "").replace(/\\.git$/, "");
|
|
87
|
+
const commandTargets = (argv: readonly string[]) =>
|
|
88
|
+
argv[0] === "git" ? (GIT_REMOTE_COMMANDS.includes(argv[1] ?? "") && GITHUB_URL.test(argv[2] ?? "") ? [argv[2]] : null)
|
|
89
|
+
: argv[0] === "gh-signed-commit" ? (targets(argv).length ? targets(argv) : null)
|
|
90
|
+
: targets(argv);
|
|
62
91
|
|
|
63
92
|
export default git({
|
|
64
93
|
github: {
|
|
65
94
|
connector: ${JSON.stringify(GITHUB_CONNECTOR)},
|
|
66
95
|
broker,
|
|
67
|
-
authorize: ({ repository }) =>
|
|
96
|
+
authorize: ({ argv, repository }) => {
|
|
97
|
+
const found = commandTargets(argv);
|
|
98
|
+
return repository !== null && canonical(repository).startsWith(\`\${ORG}/\`) && found !== null && found.every((t) => canonical(t) === canonical(repository));
|
|
99
|
+
},
|
|
68
100
|
principalType: "user",
|
|
69
101
|
},
|
|
70
102
|
});
|
|
71
103
|
` });
|
|
72
104
|
|
|
73
|
-
// Bots that edit code: eve-code (apply_patch, grep
|
|
74
|
-
//
|
|
75
|
-
// subagent cap like every other subagent, not on eve's built-in default.
|
|
105
|
+
// Bots that edit code: eve-code (apply_patch, grep and the review skills), with
|
|
106
|
+
// no `github` option.
|
|
76
107
|
export const CODE_BOTS = ["builder"];
|
|
77
|
-
export const codeExtensionFiles = (
|
|
108
|
+
export const codeExtensionFiles = () => ({
|
|
78
109
|
"extensions/code/extension.ts": `import code from "eve/extensions/code";
|
|
79
|
-
import { bindRoster } from "eve-hub/roster-model";
|
|
80
|
-
import { resolveSubagent } from "eve-hub/subagent-cap";
|
|
81
|
-
import workspace from "../../../../../hub.workspace.json" with { type: "json" };
|
|
82
|
-
|
|
83
|
-
const { agents, subagentCap } = bindRoster(workspace);
|
|
84
|
-
const { model, reasoning } = resolveSubagent(agents, subagentCap, ${JSON.stringify(bot)}, "code__worker");
|
|
85
110
|
|
|
86
|
-
export default code(
|
|
111
|
+
export default code();
|
|
87
112
|
`,
|
|
88
113
|
});
|
|
89
114
|
|
|
@@ -196,7 +221,7 @@ export function prepareDeployment(dir) {
|
|
|
196
221
|
// A user token carries all of the human's write access and can't be narrowed, so a read-only bot
|
|
197
222
|
// gets none. A bot's own committed git.ts (a wider org list, say) is the workspace's and stays.
|
|
198
223
|
const git = deployment.repoOwner && !existsSync(join(bot, READ_ONLY_FILE)) && !existsSync(join(bot, GIT_EXTENSION_FILE));
|
|
199
|
-
for (const [stub, content] of Object.entries({ ...(git ? gitExtensionFiles(deployment.repoOwner) : {}), ...(code ? codeExtensionFiles(
|
|
224
|
+
for (const [stub, content] of Object.entries({ ...(git ? gitExtensionFiles(deployment.repoOwner) : {}), ...(code ? codeExtensionFiles() : {}) })) {
|
|
200
225
|
mkdirSync(dirname(join(bot, stub)), { recursive: true });
|
|
201
226
|
writeFileSync(join(bot, stub), content);
|
|
202
227
|
}
|
package/vercel.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// The repo's vercel.ts imports this default config and exports
|
|
1
|
+
// The repo's vercel.ts imports this default config and exports its keys in an object literal (Vercel's git deploy reads
|
|
2
|
+
// vercel.ts statically and rejects any other default export, so a key added here must be listed there too): Vercel
|
|
2
3
|
// evaluates it after install and before the bots' services are built, which is
|
|
3
4
|
// when the deployment's build-time changes (prepare.mjs) apply. Only in a
|
|
4
5
|
// Vercel build: elsewhere this file's cwd is a person's checkout.
|