eve-hub 0.8.0 → 0.8.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.
- package/CHANGELOG.md +12 -0
- package/kit-modules.json +0 -1
- package/mention-gate.d.mts +0 -1
- package/mention-gate.mjs +4 -56
- package/package.json +1 -1
- package/stubs.mjs +0 -2
- package/templates/workspace-protocol.md +1 -1
- package/tools/post_message.d.ts +2 -2
- package/tools/post_message.js +2 -2
- package/tools/react.d.ts +2 -0
- package/tools/react.js +3 -3
- package/world.mjs +11099 -103
- package/hooks/mention-gate.d.ts +0 -2
- package/hooks/mention-gate.js +0 -31
package/hooks/mention-gate.d.ts
DELETED
package/hooks/mention-gate.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { getVercelOidcToken } from "@vercel/oidc";
|
|
2
|
-
import { defineHook } from "eve/hooks";
|
|
3
|
-
import { registryBase, registryFetch } from "../registry-fetch.mjs";
|
|
4
|
-
import { credentialCache, hubCredentialLoader, screenInbound } from "../mention-gate.mjs";
|
|
5
|
-
// The mention gate, on the bot's side: before the main model runs a turn an
|
|
6
|
-
// @-mention or a DM woke, a cheap model decides from this bot's instructions
|
|
7
|
-
// and the delivery whether a reply is needed. On a skip the hub posts
|
|
8
|
-
// "<bot> skipped: <reason>" and the turn is cancelled before any model call.
|
|
9
|
-
// Any failure answers. The hub names the bot from its session and serves its
|
|
10
|
-
// instructions, so a deployed bot and a Mac bot run the same code. Its AI Gateway
|
|
11
|
-
// credential is an OIDC token for the workspace's bots project: a deployed bot
|
|
12
|
-
// carries its own, and a Mac bot has none, so it asks the hub for one.
|
|
13
|
-
// See packages/agent-kit/mention-gate.mjs.
|
|
14
|
-
const deploymentToken = async () => ({ ok: true, token: await getVercelOidcToken() });
|
|
15
|
-
const credential = credentialCache(process.env.VERCEL ? deploymentToken : hubCredentialLoader(registryFetch));
|
|
16
|
-
export default defineHook({
|
|
17
|
-
events: {
|
|
18
|
-
async "message.received"(event, ctx) {
|
|
19
|
-
if (ctx.session.parent || !(process.env.VERCEL || process.env.HUB_TOKEN))
|
|
20
|
-
return; // subagents are never gated; nor is a bot with no hosted hub
|
|
21
|
-
const { cancel } = await screenInbound({
|
|
22
|
-
text: event.data.message,
|
|
23
|
-
sessionId: ctx.session.id,
|
|
24
|
-
registryUrl: registryBase(),
|
|
25
|
-
credential,
|
|
26
|
-
});
|
|
27
|
-
if (cancel)
|
|
28
|
-
ctx.cancel();
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|