eve-hub 0.16.22 → 0.16.23
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/execution-context.mjs +6 -2
- package/package.json +1 -1
- package/prepare.mjs +8 -6
package/execution-context.mjs
CHANGED
|
@@ -22,8 +22,12 @@ const claims = (jwt) => JSON.parse(Buffer.from(jwt.split(".")[1], "base64url").t
|
|
|
22
22
|
|
|
23
23
|
export function deploymentFacts(env = process.env) {
|
|
24
24
|
const oidc = env.VERCEL_OIDC_TOKEN ? claims(env.VERCEL_OIDC_TOKEN) : {};
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// An uploaded build has no git metadata. Onboarding's first one is the workspace repo's, which the hub names in
|
|
26
|
+
// HUB_GITHUB_REPO (`owner/name`) before the repo exists, so its bots get the git extension too.
|
|
27
|
+
const [hubOwner, hubSlug] = (env.HUB_GITHUB_REPO ?? "").split("/");
|
|
28
|
+
const git = env.VERCEL_GIT_REPO_OWNER && env.VERCEL_GIT_REPO_SLUG ? [env.VERCEL_GIT_REPO_OWNER, env.VERCEL_GIT_REPO_SLUG] : hubOwner && hubSlug ? [hubOwner, hubSlug] : undefined;
|
|
29
|
+
const repoOwner = git?.[0];
|
|
30
|
+
const repo = git ? `${git[0]}/${git[1]}` : undefined;
|
|
27
31
|
return {
|
|
28
32
|
team: oidc.owner,
|
|
29
33
|
project: oidc.project,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-hub",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.23",
|
|
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",
|
package/prepare.mjs
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
// Vercel Kit connection is wired in, every bot of a build from a repo gets eve's git extension, and the
|
|
14
14
|
// workspace's memory and each bot's team architecture are embedded in the bots' memory providers, (a function has no workspace cwd);
|
|
15
15
|
// - /hub/manifest: the roster and the commit sha the deployment was built
|
|
16
|
-
// from
|
|
17
|
-
//
|
|
16
|
+
// from (its deployment id when it was uploaded, not built from git), for the
|
|
17
|
+
// hub to sync from: a custom channel on main, routed in vercel.mjs. From the
|
|
18
|
+
// hub, as on each bot's eve channel (hub-oidc.mjs).
|
|
18
19
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
19
20
|
import { createRequire } from "node:module";
|
|
20
21
|
import { basename, dirname, join } from "node:path";
|
|
@@ -123,9 +124,10 @@ import workspace from "../../../../hub.manifest.json" with { type: "json" };
|
|
|
123
124
|
// The roster, humans and subagent cap as deployed, Mac bots included, and the eve-hub and eve versions that built it, for the hub to sync from:
|
|
124
125
|
// hub.manifest.json is bundled at build, so a push whose deploy fails never
|
|
125
126
|
// changes it. \`sha\` is the commit the deployment was built from, which the hub
|
|
126
|
-
// syncs by
|
|
127
|
-
// has no
|
|
128
|
-
|
|
127
|
+
// syncs by. An uploaded deployment (onboarding's first, built while the repo is
|
|
128
|
+
// made) has no commit, so it answers its own deployment id, which the hub reads
|
|
129
|
+
// from the project's production deployment.
|
|
130
|
+
const sha = process.env.VERCEL_GIT_COMMIT_SHA || process.env.VERCEL_DEPLOYMENT_ID;
|
|
129
131
|
const { agents, humans, subagentCap, hopLimit } = parseWorkspace(workspace);
|
|
130
132
|
const manifest = { sha, kit: ${JSON.stringify(KIT_VERSION)}, eve: ${JSON.stringify(EVE_VERSION)}, agents, humans, subagentCap, ...(hopLimit === undefined ? {} : { hopLimit }) };
|
|
131
133
|
|
|
@@ -133,7 +135,7 @@ export default defineChannel({
|
|
|
133
135
|
routes: [
|
|
134
136
|
GET("/hub/manifest", async (request) => {
|
|
135
137
|
if (!(await isHubRequest(request, getVercelOidcToken))) return new Response("unauthorized", { status: 401 });
|
|
136
|
-
if (!sha) return new Response("no commit sha: this
|
|
138
|
+
if (!sha) return new Response("no commit sha or deployment id: this isn't a Vercel deployment", { status: 500 });
|
|
137
139
|
return Response.json(manifest);
|
|
138
140
|
}),
|
|
139
141
|
],
|