eve 0.87.0 → 0.88.1

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +13 -61
  2. package/dist/src/channel/interaction-prompts.d.ts +0 -2
  3. package/dist/src/channel/interaction-prompts.js +1 -1
  4. package/dist/src/compiled/.vendor-stamp.json +3 -3
  5. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  6. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  7. package/dist/src/extensions/git/extension/extension.d.ts +5 -2
  8. package/dist/src/extensions/git/extension/extension.js +1 -1
  9. package/dist/src/extensions/git/extension/instructions/github.js +1 -1
  10. package/dist/src/extensions/git/extension/lib/connect-user-auth.d.ts +15 -0
  11. package/dist/src/extensions/git/extension/lib/connect-user-auth.js +1 -0
  12. package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +8 -1
  13. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  14. package/dist/src/extensions/git/extension/lib/github-guidance.d.ts +2 -1
  15. package/dist/src/extensions/git/extension/lib/github-guidance.js +14 -1
  16. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +12 -4
  17. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
  18. package/dist/src/instrumentation/content.js +1 -1
  19. package/dist/src/instrumentation/lifecycle.d.ts +5 -0
  20. package/dist/src/instrumentation/native-events.d.ts +4 -1
  21. package/dist/src/instrumentation/native-events.js +1 -1
  22. package/dist/src/instrumentation/principal-summary.d.ts +2 -0
  23. package/dist/src/instrumentation/principal-summary.js +1 -1
  24. package/dist/src/instrumentation/runtime.js +1 -1
  25. package/dist/src/instrumentation/session-context.js +1 -1
  26. package/dist/src/internal/application/stamped-package-version.js +1 -1
  27. package/dist/src/internal/invocation/agent-invocation.d.ts +2 -0
  28. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  29. package/dist/src/protocol/session-projection/reader.d.ts +3 -1
  30. package/dist/src/protocol/session-projection/reader.js +1 -1
  31. package/dist/src/public/channels/mcp.js +1 -1
  32. package/dist/src/public/channels/slack/app-manifest.d.ts +4 -0
  33. package/dist/src/public/channels/slack/app-manifest.js +1 -1
  34. package/dist/src/public/channels/slack/auth.d.ts +1 -0
  35. package/dist/src/public/channels/slack/auth.js +1 -1
  36. package/dist/src/public/channels/slack/defaults.js +1 -1
  37. package/dist/src/public/channels/slack/inbound.d.ts +7 -0
  38. package/dist/src/public/channels/slack/index.d.ts +1 -0
  39. package/dist/src/public/channels/slack/model-context.d.ts +3 -2
  40. package/dist/src/public/channels/slack/model-context.js +3 -3
  41. package/dist/src/public/channels/slack/request-cards.js +2 -2
  42. package/dist/src/public/channels/slack/slackChannel.d.ts +26 -0
  43. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  44. package/dist/src/public/channels/slack/user-info.d.ts +64 -0
  45. package/dist/src/public/channels/slack/user-info.js +1 -0
  46. package/dist/src/runtime/subagents/workflow.js +1 -1
  47. package/dist/src/setup/scaffold/create/project.js +1 -1
  48. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  49. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  50. package/dist/src/tracing/eve/agent-approval-instrumentation.js +1 -1
  51. package/dist/src/tracing/eve/session.js +1 -1
  52. package/docs/channels/mcp.mdx +1 -1
  53. package/docs/channels/slack.mdx +68 -1
  54. package/docs/code-extension.mdx +51 -12
  55. package/docs/guides/instrumentation/instrumentation.mdx +1 -1
  56. package/docs/tools/human-in-the-loop.md +2 -0
  57. package/package.json +3 -3
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{normalizeInstrumentationChannelKind}from"#internal/instrumentation.js";import{contextStorage}from"#context/container.js";import{enteredView}from"#harness/session-machine/current.js";import{traceSessionIdOf,withOperationTraceContext}from"#tracing/eve/conversation-context.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#shared/trace-policy.js";import{ROOT_CONTEXT}from"#compiled/@opentelemetry/api/index.js";import"#instrumentation/lifecycle.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{applyPrincipalTraceDecision}from"#instrumentation/principal-summary.js";import{withChannelAudience}from"#tracing/eve/channel-audience-context.js";import{eveTurnIdentity}from"#tracing/eve/operation-input.js";import{eveActivationMetadata}from"#tracing/eve/metadata.js";function createEveSessionTracing(e){let ensureSessionContext=async t=>{let n=await e.stateStore.get(`session`,t.sessionId);if(n===void 0){let r=normalizeChannelAudience(t.channelAudience),i=resolveSessionTraceDecision(t,r,e.environment,e.tracePolicy);n={agentName:t.agentName,channelAudience:r,channelKind:t.channelKind,channelType:t.channelType,decision:i,context:initialSessionContext(e,t,i),parentLineage:t.parentLineage,rootSessionId:t.rootSessionId,traceSessionId:traceSessionIdOf(t),scheduleId:t.scheduleId,title:t.title},await e.stateStore.set(`session`,t.sessionId,n)}return n},prepareSessionTrace=async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},turnKey=(e,t)=>JSON.stringify([e,t]);async function turnFor(t,n,r){let i=await e.stateStore.get(`turn`,turnKey(t,n));if(i===void 0||!isSampledTrace(i.context))return;let a=await e.stateStore.get(`session`,t);return e.tracing.resume({identity:eveTurnIdentity({sessionId:t,rootSessionId:i.rootSessionId,turnId:n}),context:withOperationTraceContext(r??withChannelAudience(ROOT_CONTEXT,a?.channelAudience),{sessionId:t,...i})})}async function dropped(t,n){let r=await e.stateStore.get(`turn`,turnKey(t,n));return r!==void 0&&!isSampledTrace(r.context)}let prepareTurnTrace=async t=>{let n=await e.stateStore.get(`turn`,turnKey(t.sessionId,t.turnId));if(n!==void 0){let r=await e.stateStore.get(`session`,t.sessionId);return portableSpanContext(n.context,r?.decision)}let r=await ensureSessionContext(t),i=t.sequence===0,a=i?t.parentTraceContext:void 0,o=r.decision?.action===`record`,s=a!==void 0&&!(`isRemote`in a&&a.isRemote===!0),c=i?{...r.context,traceId:s?a.traceId:r.context.traceId,isRemote:!1}:{traceId:e.idGenerator.deriveTraceId(`turn:${t.idempotencyKey}`),spanId:e.idGenerator.deriveSpanId(`turn:${t.idempotencyKey}`),traceFlags:+!!o,isRemote:!1},l=r.agentName??(t.parentLineage??r.parentLineage)?.subagentName,u={agentName:l,caller:a===void 0?void 0:adoptedSpanContext(a),context:c,currentPrincipal:applyPrincipalTraceDecision(t.currentPrincipal,r.decision),initiatorPrincipal:applyPrincipalTraceDecision(t.initiatorPrincipal,r.decision),parentLineage:t.parentLineage??r.parentLineage,rootSessionId:t.rootSessionId,traceSessionId:traceSessionIdOf(t),sequence:t.sequence,startTimeMs:Date.now(),subagentName:(t.parentLineage??r.parentLineage)?.subagentName};if(isSampledTrace(c)){let n=await e.tracing.turn({...eveActivationMetadata({session:r,turn:u,sessionId:t.sessionId}),agentName:l,identity:eveTurnIdentity({...t,sessionId:t.sessionId}),framework:{name:`eve`,version:e.frameworkVersion},capture:{emit:!0,...await e.capturePolicy.forOperation(t)},reference:c,parent:s?adoptedSpanContext(a):void 0,links:activationLinks(u),startTimeMs:u.startTimeMs,context:hostContext(r.channelAudience,t)});u={...u,context:{...c,traceFlags:n.reference.traceFlags}}}return await e.stateStore.set(`turn`,turnKey(t.sessionId,t.turnId),u),portableSpanContext(u.context,r.decision)};async function endTurn(t,n,r){let i=await e.stateStore.get(`turn`,turnKey(t,n));if(i===void 0)return;let a=await e.stateStore.get(`session`,t),o=await turnFor(t,n);if(o!==void 0){let e=eveActivationMetadata({session:a,turn:i,sessionId:t});if(o.attributes(e.attributes??{}),o.links(activationLinks(i)??[]),r===void 0)await o.complete({outcomeUnknown:!0});else if(r.outcome===`failed`){let e=r.error;await o.complete({outcome:`failed`,failed:!0,error:e,errorType:e instanceof Error?e.name:void 0})}else await o.complete({outcome:r.outcome})}await e.stateStore.delete(`turn`,turnKey(t,n))}return{ensureSessionContext,prepareSessionTrace,prepareTurnTrace,turnFor,dropped,async turnSettled(e){let t=contextStorage.getStore(),n=t===void 0?void 0:enteredView(t);(n?.session.status!==`ended`||n.session.outcome!==`failed`||n.session.closedAt!==n.turns[e.turnId]?.closedAt)&&await endTurn(e.sessionId,e.turnId,{outcome:e.outcome,error:e.error})},async sessionEnded(e){e.turnId!==void 0&&await endTurn(e.sessionId,e.turnId,e.outcome===`failed`?{outcome:`failed`,error:e.error}:void 0)}}}function hostContext(e,t){return withOperationTraceContext(withChannelAudience(ROOT_CONTEXT,e),t)}function activationLinks(e){let t=[];return e.caller?.isRemote===!0&&t.push({context:e.caller,relationship:`agent.dispatch`}),e.channelDelivery?.requestTraceContext!==void 0&&t.push({context:e.channelDelivery.requestTraceContext,relationship:`channel.request`}),t.length===0?void 0:t}function portableSpanContext(e,t){return{decision:t,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function adoptedSpanContext(e){return{isRemote:`isRemote`in e&&e.isRemote===!0,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function initialSessionContext(e,t,n){let r=t.traceSeed;if(r!==void 0)return{...adoptedSpanContext(r),traceFlags:n.action===`drop`?0:r.traceFlags};let i=`session:${t.sessionId}`,a=t.parentTraceContext;return{traceId:a!==void 0&&!(`isRemote`in a&&a.isRemote===!0)?a.traceId:e.idGenerator.deriveTraceId(i),spanId:e.idGenerator.deriveSpanId(i),traceFlags:+(n.action===`record`)}}function resolveSessionTraceDecision(e,t,n,r){let i={audience:t,environment:n};return e.parentTraceContext!==void 0&&!isSampledTrace(e.parentTraceContext)?{action:`drop`}:e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?r===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(r,{agentName:e.agentName,audience:t,channel:{kind:normalizeInstrumentationChannelKind(e.channelKind??e.channelType)},environment:n,principalType:`unknown`}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):readInstrumentationDecision(e.traceSeed.decision)??{action:`drop`}}export{createEveSessionTracing};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{normalizeInstrumentationChannelKind}from"#internal/instrumentation.js";import{contextStorage}from"#context/container.js";import{enteredView}from"#harness/session-machine/current.js";import{traceSessionIdOf,withOperationTraceContext}from"#tracing/eve/conversation-context.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#shared/trace-policy.js";import{ROOT_CONTEXT}from"#compiled/@opentelemetry/api/index.js";import"#instrumentation/lifecycle.js";import{applyPrincipalTraceDecision}from"#instrumentation/principal-summary.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{withChannelAudience}from"#tracing/eve/channel-audience-context.js";import{eveTurnIdentity}from"#tracing/eve/operation-input.js";import{eveActivationMetadata}from"#tracing/eve/metadata.js";function createEveSessionTracing(e){let ensureSessionContext=async t=>{let n=await e.stateStore.get(`session`,t.sessionId);if(n===void 0){let r=normalizeChannelAudience(t.channelAudience),i=resolveSessionTraceDecision(t,r,e.environment,e.tracePolicy);n={agentName:t.agentName,channelAudience:r,channelKind:t.channelKind,channelType:t.channelType,decision:i,context:initialSessionContext(e,t,i),parentLineage:t.parentLineage,rootSessionId:t.rootSessionId,traceSessionId:traceSessionIdOf(t),scheduleId:t.scheduleId,title:t.title},await e.stateStore.set(`session`,t.sessionId,n)}return n},prepareSessionTrace=async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},turnKey=(e,t)=>JSON.stringify([e,t]);async function turnFor(t,n,r){let i=await e.stateStore.get(`turn`,turnKey(t,n));if(i===void 0||!isSampledTrace(i.context))return;let a=await e.stateStore.get(`session`,t);return e.tracing.resume({identity:eveTurnIdentity({sessionId:t,rootSessionId:i.rootSessionId,turnId:n}),context:withOperationTraceContext(r??withChannelAudience(ROOT_CONTEXT,a?.channelAudience),{sessionId:t,...i})})}async function dropped(t,n){let r=await e.stateStore.get(`turn`,turnKey(t,n));return r!==void 0&&!isSampledTrace(r.context)}let prepareTurnTrace=async t=>{let n=await e.stateStore.get(`turn`,turnKey(t.sessionId,t.turnId));if(n!==void 0){let r=await e.stateStore.get(`session`,t.sessionId);return portableSpanContext(n.context,r?.decision)}let r=await ensureSessionContext(t),i=t.sequence===0,a=i?t.parentTraceContext:void 0,o=r.decision?.action===`record`,s=a!==void 0&&!(`isRemote`in a&&a.isRemote===!0),c=i?{...r.context,traceId:s?a.traceId:r.context.traceId,isRemote:!1}:{traceId:e.idGenerator.deriveTraceId(`turn:${t.idempotencyKey}`),spanId:e.idGenerator.deriveSpanId(`turn:${t.idempotencyKey}`),traceFlags:+!!o,isRemote:!1},l=r.agentName??(t.parentLineage??r.parentLineage)?.subagentName,u={agentName:l,caller:a===void 0?void 0:adoptedSpanContext(a),context:c,currentPrincipal:applyPrincipalTraceDecision(t.currentPrincipal,r.decision),initiatorPrincipal:applyPrincipalTraceDecision(t.initiatorPrincipal,r.decision),parentLineage:t.parentLineage??r.parentLineage,rootSessionId:t.rootSessionId,traceSessionId:traceSessionIdOf(t),sequence:t.sequence,startTimeMs:Date.now(),subagentName:(t.parentLineage??r.parentLineage)?.subagentName};if(isSampledTrace(c)){let n=await e.tracing.turn({...eveActivationMetadata({session:r,turn:u,sessionId:t.sessionId}),agentName:l,identity:eveTurnIdentity({...t,sessionId:t.sessionId}),framework:{name:`eve`,version:e.frameworkVersion},capture:{emit:!0,...await e.capturePolicy.forOperation(t)},reference:c,parent:s?adoptedSpanContext(a):void 0,links:activationLinks(u),startTimeMs:u.startTimeMs,context:hostContext(r.channelAudience,t)});u={...u,context:{...c,traceFlags:n.reference.traceFlags}}}return await e.stateStore.set(`turn`,turnKey(t.sessionId,t.turnId),u),portableSpanContext(u.context,r.decision)};async function endTurn(t,n,r){let i=await e.stateStore.get(`turn`,turnKey(t,n));if(i===void 0)return;let a=await e.stateStore.get(`session`,t),o=await turnFor(t,n);if(o!==void 0){let e=eveActivationMetadata({session:a,turn:i,sessionId:t});if(o.attributes(e.attributes??{}),o.links(activationLinks(i)??[]),r===void 0)await o.complete({outcomeUnknown:!0});else if(r.outcome===`failed`){let e=r.error;await o.complete({outcome:`failed`,failed:!0,error:e,errorType:e instanceof Error?e.name:void 0})}else await o.complete({outcome:r.outcome})}await e.stateStore.delete(`turn`,turnKey(t,n))}return{ensureSessionContext,prepareSessionTrace,prepareTurnTrace,turnFor,dropped,async turnSettled(e){let t=contextStorage.getStore(),n=t===void 0?void 0:enteredView(t);(n?.session.status!==`ended`||n.session.outcome!==`failed`||n.session.closedAt!==n.turns[e.turnId]?.closedAt)&&await endTurn(e.sessionId,e.turnId,{outcome:e.outcome,error:e.error})},async sessionEnded(e){e.turnId!==void 0&&await endTurn(e.sessionId,e.turnId,e.outcome===`failed`?{outcome:`failed`,error:e.error}:void 0)}}}function hostContext(e,t){return withOperationTraceContext(withChannelAudience(ROOT_CONTEXT,e),t)}function activationLinks(e){let t=[];return e.caller?.isRemote===!0&&t.push({context:e.caller,relationship:`agent.dispatch`}),e.channelDelivery?.requestTraceContext!==void 0&&t.push({context:e.channelDelivery.requestTraceContext,relationship:`channel.request`}),t.length===0?void 0:t}function portableSpanContext(e,t){return{decision:t,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function adoptedSpanContext(e){return{isRemote:`isRemote`in e&&e.isRemote===!0,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function initialSessionContext(e,t,n){let r=t.traceSeed;if(r!==void 0)return{...adoptedSpanContext(r),traceFlags:n.action===`drop`?0:r.traceFlags};let i=`session:${t.sessionId}`,a=t.parentTraceContext;return{traceId:a!==void 0&&!(`isRemote`in a&&a.isRemote===!0)?a.traceId:e.idGenerator.deriveTraceId(i),spanId:e.idGenerator.deriveSpanId(i),traceFlags:+(n.action===`record`)}}function resolveSessionTraceDecision(e,t,n,r){let i={audience:t,environment:n};return e.parentTraceContext!==void 0&&!isSampledTrace(e.parentTraceContext)?{action:`drop`}:e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?r===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(r,{agentName:e.agentName,audience:t,channel:{kind:normalizeInstrumentationChannelKind(e.channelKind??e.channelType)},environment:n,principalType:`unknown`}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):readInstrumentationDecision(e.traceSeed.decision)??{action:`drop`}}export{createEveSessionTracing};
@@ -184,7 +184,7 @@ least `pollAfterMs` before polling again.
184
184
 
185
185
  The invocation response is discriminated by `status`:
186
186
 
187
- - `working`: work is active; continue polling according to `pollAfterMs`.
187
+ - `working`: work is active; continue polling according to `pollAfterMs`. The optional `statusMessage` describes what the agent is doing right now, such as a running tool call's [activity label](/docs/tools#label-tool-activity) or its tool name, so a client can show progress.
188
188
  - `input_required`: present `interactions`, keyed by `interactionId`, then send the complete answer batch through `agent_update`, one `{ interactionId, optionId?, text? }` response per entry. A successful update returns the current invocation state.
189
189
  - `authorization_required`: present each sign-in in `interactions`: its `signIn` URL, user code, or instructions. The connection callback resumes the invocation automatically; continue polling.
190
190
  - `completed`: the agent's turn settled, after any [tasks](/docs/tools/workflows#run-calls-as-tasks-task) it started finished. Consume the optional `result`: the final assistant message.
@@ -139,10 +139,77 @@ export default slackChannel({
139
139
  });
140
140
  ```
141
141
 
142
- The model-visible `<slack_message>` includes `sender_id`, `bot_user_id` when available, and the `is_mentioned` value from `ctx.isBotMentioned()`. Its `<content>` keeps `<@USER_ID>` intact while converting other mrkdwn to Markdown; routing is unchanged.
142
+ Each model-visible `<slack_message>` groups its metadata into blocks: `<sender>` with the sender's `type` and `id`, `<bot>` with the receiving app's `id` and the `mentioned` value from `ctx.isBotMentioned()` (inbound messages only), and `<thread>` with `team_id`, `channel_id`, `thread_ts`, and `message_ts`:
143
+
144
+ ```text
145
+ <slack_message>
146
+ <sender>
147
+ type: user
148
+ id: U01234567
149
+ </sender>
150
+ <bot>
151
+ id: U07654321
152
+ mentioned: true
153
+ </bot>
154
+ <thread>
155
+ team_id: T01234567
156
+ channel_id: C01234567
157
+ thread_ts: 1700000000.000001
158
+ message_ts: 1700000000.000004
159
+ </thread>
160
+ <content>
161
+ <@U07654321> Who owns the deploy?
162
+ </content>
163
+ </slack_message>
164
+ ```
165
+
166
+ Its `<content>` keeps `<@USER_ID>` intact while converting other mrkdwn to Markdown; routing is unchanged.
143
167
 
144
168
  When a Slack message includes a link preview, eve includes its attachment text in `<content>` alongside the sender's message, including when the link has words around it. Shared Slack messages work the same way: eve extracts the forwarded message body from Slack's message-unfurl attachment and keeps any top-level comment.
145
169
 
170
+ #### Add sender names and emails
171
+
172
+ Slack user ids identify every sender without a lookup. When the agent should also know who someone is, enable `messageContext.users`:
173
+
174
+ ```ts
175
+ import { slackChannel } from "eve/channels/slack";
176
+ import { connectSlackCredentials } from "@vercel/connect/eve";
177
+
178
+ export default slackChannel({
179
+ credentials: connectSlackCredentials("slack/my-agent"),
180
+ messageContext: { users: { email: true } },
181
+ });
182
+ ```
183
+
184
+ eve looks up each human sender with `users.info` and adds `display_name` and `real_name` to their `<sender>` block, plus `email` with `email: true`. Set `name: false` with `email: true` to add emails only. Thread context replies get the same fields. The triggering author is also written to `message.author` (`fullName`, `displayName`, `email`) and to the `full_name` and `email` attributes of [`defaultSlackAuth`](#restrict-who-can-invoke-the-agent), so a hook can gate on them. Mentions and DMs are looked up before `onAppMention` or `onDirectMessage` runs. Other channel messages are looked up only once a hook delivers them, so their hooks see the unresolved author.
185
+
186
+ `users: true` adds names only. Results are cached in memory per workspace and user for an hour, and a failed lookup is retried after a minute. A lookup that fails or takes longer than two seconds is left out, and the message is still delivered. To use your own cache, pass `resolve`; `next()` is eve's uncached `users.info` call:
187
+
188
+ ```ts
189
+ import { slackChannel } from "eve/channels/slack";
190
+ import { connectSlackCredentials } from "@vercel/connect/eve";
191
+ import { profileCache } from "../lib/profile-cache";
192
+
193
+ export default slackChannel({
194
+ credentials: connectSlackCredentials("slack/my-agent"),
195
+ messageContext: {
196
+ users: {
197
+ email: true,
198
+ resolve: async ({ userId, teamId }, next) => {
199
+ const key = `${teamId}:${userId}`;
200
+ const cached = await profileCache.get(key);
201
+ if (cached) return cached;
202
+ const profile = await next();
203
+ await profileCache.set(key, profile);
204
+ return profile;
205
+ },
206
+ },
207
+ },
208
+ });
209
+ ```
210
+
211
+ `teamId` is the workspace whose installation received the message, so key caches on it. `messageContext.users` adds the `users:read` scope to the app manifest, and `users:read.email` with `email: true`; reinstall the Slack app after enabling it. It is off by default because names and emails then reach model context, session history, and traces.
212
+
146
213
  #### Restrict who can invoke the agent
147
214
 
148
215
  A valid Slack signature proves that Slack sent the event. It does not decide which channel or person your agent should trust. Fail closed in the inbound handler before returning auth, especially when the app is installed in a shared Slack Connect channel:
@@ -98,19 +98,35 @@ export default git({});
98
98
 
99
99
  Configure `github` to broker GitHub access through Connect instead. The extension then adds the authenticated `git__gh` tool, tells the agent to use it for every authenticated GitHub operation, and switches `git__pr` to `gh-signed-commit` for repositories that require verified signatures.
100
100
 
101
- | Option | Required | Effect |
102
- | -------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
103
- | `github.connector` | With `github` | Connector that mints a GitHub token |
104
- | `github.org` | With `github` | Organization whose repositories the `gh` tool can access |
105
- | `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
106
- | `github.authorize` | No | `authorize({ auth, repository, token })` callback that allows or denies each `gh` tool invocation |
107
- | `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null` |
101
+ | Option | Required | Effect |
102
+ | ---------------------- | ------------- | -------------------------------------------------------------------------------------------- |
103
+ | `github.connector` | With `github` | Connector that mints a GitHub token |
104
+ | `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
105
+ | `github.authorize` | With `github` | `authorize({ auth, repository, token })` decides whether each `gh` tool invocation may run |
106
+ | `github.principalType` | No | `"app"` (default) for GitHub App installation tokens, or `"user"` for the caller's own token |
107
+ | `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null` |
108
108
 
109
- The `gh` tool requests a token scoped to exactly one repository in `github.org` for each invocation. The sandbox process receives a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. Your `github.broker` callback receives the header-transform rules for the command, then `null` to remove the lease. The callback must preserve your other network rules. GitHub authentication has no command-delivery option.
109
+ Each `gh` invocation declares exactly one `owner/name` repository, and every explicit command target must match it. By default the tool requests a GitHub App installation token for that owner's installation, scoped to that one repository; with `github.principalType` set to `"user"` it resolves the caller's own token instead. The sandbox process receives a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. Your `github.broker` callback receives the header-transform rules for the command, then `null` to remove the lease. The callback must preserve your other network rules. GitHub authentication has no command-delivery option.
110
110
 
111
- `github.authorize` runs during each `gh` tool execution, not when the session starts. The order is: validate the command and repository, mint the repository-scoped app token, await `authorize({ auth, repository, token })`, install the credential lease, then run the command. `auth` is the session's current caller at tool invocation, or `null`. Returning `false` stops execution before the lease is installed or the command runs. The decision applies to that invocation only; it is neither cached for the session nor repeated for each GitHub API request.
111
+ `github.authorize` is the agent's only repository access control, so it is required: a command runs only when it returns `true`. It runs during each `gh` tool execution, not when the session starts. The order is: validate the command and repository, mint the token, await `authorize({ auth, repository, token })`, install the credential lease, then run the command. `auth` is the session's current caller at tool invocation, or `null`. Returning `false` stops execution before the lease is installed or the command runs, so the token never reaches the sandbox or GitHub. The decision applies to that invocation only; it is neither cached for the session nor repeated for each GitHub API request.
112
112
 
113
- For example, use the token to check collaborator status (allowed commands still use the app token's permissions, not the collaborator's):
113
+ The simplest policy limits the agent to one organization. Compare owners case-insensitively, as GitHub does:
114
+
115
+ ```ts title="agent/extensions/git.ts"
116
+ import git from "eve/extensions/git";
117
+
118
+ import { brokerGitHubLease } from "../lib/github";
119
+
120
+ export default git({
121
+ github: {
122
+ connector: "github/my-agent",
123
+ broker: brokerGitHubLease,
124
+ authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
125
+ },
126
+ });
127
+ ```
128
+
129
+ `authorize` can also use the token to check the caller, for example their collaborator status (allowed commands still use the app token's permissions, not the collaborator's):
114
130
 
115
131
  ```ts title="agent/extensions/git.ts"
116
132
  import git from "eve/extensions/git";
@@ -120,10 +136,10 @@ import { brokerGitHubLease } from "../lib/github";
120
136
  export default git({
121
137
  github: {
122
138
  connector: "github/my-agent",
123
- org: "acme",
124
139
  broker: brokerGitHubLease,
125
140
  // GitHub channel sessions carry the commenter's login as `auth.subject`.
126
141
  async authorize({ auth, repository, token }) {
142
+ if (!repository.toLowerCase().startsWith("acme/")) return false;
127
143
  if (auth?.authenticator !== "github-webhook" || !auth.subject) return false;
128
144
  const response = await fetch(
129
145
  `https://api.github.com/repos/${repository}/collaborators/${auth.subject}`,
@@ -135,6 +151,29 @@ export default git({
135
151
  });
136
152
  ```
137
153
 
154
+ ### Run commands as the caller
155
+
156
+ By default each `gh` invocation mints a GitHub App installation token, so commands run with the installation's permissions. Set `github.principalType` to `"user"` to run them with the caller's own GitHub permissions instead, as `connect({ connector, principalType: "user" })` does for connections:
157
+
158
+ ```ts title="agent/extensions/git.ts"
159
+ import git from "eve/extensions/git";
160
+
161
+ import { brokerGitHubLease } from "../lib/github";
162
+
163
+ export default git({
164
+ github: {
165
+ connector: "github/my-agent",
166
+ broker: brokerGitHubLease,
167
+ authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
168
+ principalType: "user",
169
+ },
170
+ });
171
+ ```
172
+
173
+ The tool resolves the caller's token from `github.connector` through `ctx.getToken`. When the caller has no grant, eve signs them in and re-runs the call. The token request carries no repository details, so one grant covers every repository and later commands resolve tokens without another sign-in. When GitHub rejects the token (`HTTP 401`, `Bad credentials`, `Authentication failed`, or a `gh-signed-commit` `failed: 401`), the tool calls `ctx.requireAuth`, which evicts the token and signs the caller in again.
174
+
175
+ A user token carries the caller's GitHub permissions across every account where the GitHub App is installed, not only the declared repository. The tool description and GitHub instructions tell the model that access is limited to what the caller can reach. `github.authorize` still runs before every command, with the caller's token, and remains the agent's repository policy.
176
+
138
177
  ### Credit the person behind a turn
139
178
 
140
179
  Commits made by the `gh` tool are authored by the GitHub App. Return a verified user mapping from
@@ -153,8 +192,8 @@ import { brokerGitHubLease, coAuthorFor } from "../lib/github";
153
192
  export default git({
154
193
  github: {
155
194
  connector: "github/my-agent",
156
- org: "acme",
157
195
  broker: brokerGitHubLease,
196
+ authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
158
197
  attribution: (ctx) => coAuthorFor(ctx.session.auth.current),
159
198
  },
160
199
  });
@@ -165,7 +165,7 @@ upserting records across replays.
165
165
  | Model run | `model.started`, `model.retried`, `model.settled` | Each attempt of a model run. `model.retried` ends a failed attempt before another try; `model.settled.outcome` is `completed`, `failed`, `interrupted`, `abandoned`, or `cancelled` when the turn was cancelled. |
166
166
  | Provider call | `model.call.started`, `model.call.settled` | An individual provider call; one model attempt can make several. Settlement has `outcome: "completed"` or `"failed"`; completion carries usage, finish reason, and optional `providerMetadata`. |
167
167
  | Call | `call.requested`, `call.settled` | A tool, skill, or agent call, including direct `invokeTool` calls. `capability` identifies its kind and name. Settlement carries `completed`, `failed`, `rejected`, `interrupted`, or `abandoned`. |
168
- | User input | `interaction.opened`, `interaction.settled` | A question, approval, or budget prompt, keyed by `interactionId`. Settlement includes the interaction's `outcome` and, when recorded, its `answer`. |
168
+ | User input | `interaction.opened`, `interaction.settled` | A question, approval, or budget prompt, keyed by `interactionId`. Settlement includes the interaction's `outcome`, `responder` (who decided it), and, when recorded, its `answer`. |
169
169
  | Memory operation | `memory.operation.started`, `memory.operation.settled` | A memory search or write, with operation name, phase, and slot. Settlement has `outcome: "completed"` or `"failed"`. |
170
170
 
171
171
  A delivery that pauses for a person settles `awaiting-input`; resumed work belongs to the answer's delivery. OTel attributes a turn to a delivery only when exactly one delivery was consumed. Event `scope` includes session and run coordinates; `turnId` can be absent for compaction or direct calls. Treat `idempotencyKey` as opaque.
@@ -266,6 +266,8 @@ A message from the parent agent to a subagent never answers the subagent's tool
266
266
 
267
267
  Approval is consent only. An approved tool call runs with the requesting user's identity, connections, and credentials, including its policy recheck. The approver's access is never lent to the call. Subsequent tool calls in the turn also stay with the original owner.
268
268
 
269
+ For auditing, traces record both people: the turn span's `agent.principal.current.*` attributes name the requester, and the approval span's `agent.approval.responder.type` and `agent.approval.responder.id` name who approved or denied the call. An approved call's tool span also records its approver as `agent.tool.approver.type` and `agent.tool.approver.id`, since the tool can act on the approver's behalf. All of these ids follow one rule: they are recorded only when the trace policy records both inputs and outputs and the conversation is public or running in development. Otherwise only the type is recorded.
270
+
269
271
  A `defineTool` tool can still act on the approver's behalf when it chooses to. While an approved `defineTool` call runs, `ctx.approval.responder` is the principal who approved it, and `ctx.approval.responder.getToken(provider)` resolves that person's token for an inline provider, as `ctx.getToken(provider)` does for the requester. `ctx.session.auth.current` stays the requester. `ctx.approval` is absent for calls that needed no approval, and workflow tools don't receive it. `ctx.approval.responder.getToken(provider)` never starts a sign-in: when the approver has no token, it throws a `ConnectionAuthorizationFailedError` with `reason: "approver_authorization_required"`.
270
272
 
271
273
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.87.0",
3
+ "version": "0.88.1",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [
@@ -598,7 +598,7 @@
598
598
  },
599
599
  "dependencies": {
600
600
  "nitro": "3.0.260903-beta",
601
- "undici": "8.10.2"
601
+ "undici": "8.12.3"
602
602
  },
603
603
  "devDependencies": {
604
604
  "@agentclientprotocol/sdk": "1.3.0",
@@ -631,7 +631,7 @@
631
631
  "@types/json-schema": "7.0.15",
632
632
  "@types/react": "19.2.15",
633
633
  "@types/react-test-renderer": "19.1.0",
634
- "@vercel/agent-runs": "0.0.3",
634
+ "@vercel/agent-runs": "0.0.4",
635
635
  "@vercel/blob": "2.8.0",
636
636
  "@vercel/connect": "2.5.2",
637
637
  "@vercel/detect-agent": "1.2.3",