eve 0.88.1 → 0.89.0

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 (39) hide show
  1. package/CHANGELOG.md +10 -15
  2. package/dist/src/chunks/{use-eve-agent-BExXjBv6.js → use-eve-agent-Bbl4H5aA.js} +19 -2
  3. package/dist/src/chunks/{use-eve-agent-C0KHCyb9.js → use-eve-agent-CNpxgKEH.js} +19 -2
  4. package/dist/src/client/conversation.js +1 -1
  5. package/dist/src/client/transcript.d.ts +7 -4
  6. package/dist/src/client/transcript.js +1 -1
  7. package/dist/src/compiled/.vendor-stamp.json +1 -1
  8. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  9. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  10. package/dist/src/extensions/git/extension/extension.d.ts +12 -9
  11. package/dist/src/extensions/git/extension/extension.js +1 -1
  12. package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +4 -12
  13. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  14. package/dist/src/extensions/git/extension/lib/github-guidance.js +4 -4
  15. package/dist/src/extensions/git/extension/lib/github-shell-schema.d.ts +3 -5
  16. package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
  17. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +31 -21
  18. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
  19. package/dist/src/extensions/git/extension/lib/signed-commit.js +1 -1
  20. package/dist/src/extensions/git/tools.d.ts +2 -10
  21. package/dist/src/internal/application/stamped-package-version.js +1 -1
  22. package/dist/src/protocol/session-events/families/delivery.d.ts +3 -2
  23. package/dist/src/runtime/subagents/workflow.js +1 -1
  24. package/dist/src/setup/scaffold/create/project.js +1 -1
  25. package/dist/src/shared/session-history.d.ts +4 -2
  26. package/dist/src/shared/session-history.js +1 -1
  27. package/dist/src/svelte/index.js +1 -1
  28. package/dist/src/svelte/use-eve-agent.js +1 -1
  29. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  30. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  31. package/dist/src/vue/index.js +1 -1
  32. package/dist/src/vue/use-eve-agent.js +1 -1
  33. package/docs/channels/eve.mdx +1 -1
  34. package/docs/code-extension.mdx +17 -60
  35. package/docs/concepts/execution-model-and-durability.mdx +1 -1
  36. package/docs/concepts/sessions-runs-and-streaming.md +3 -1
  37. package/docs/guides/client/streaming.mdx +1 -1
  38. package/docs/guides/frontend/use-eve-agent.mdx +1 -1
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,19 +1,14 @@
1
- # eve 0.88.1
1
+ # eve 0.89.0
2
2
 
3
- Released 2026-10-29 · [Compare with 0.88.0](https://github.com/vercel/eve/compare/eve%400.88.0...eve%400.88.1)
3
+ Released 2026-10-29 · [Compare with 0.88.1](https://github.com/vercel/eve/compare/eve%400.88.1...eve%400.89.0)
4
4
 
5
- ## Features
5
+ ## Breaking Changes
6
6
 
7
- - Approval spans now record who approved or denied the call as `agent.approval.responder.type` and `agent.approval.responder.id`, an approved call's tool span records its approver as `agent.tool.approver.type` and `agent.tool.approver.id`, and the `interaction.settled` instrumentation event carries the same `responder`.
8
- An approved call runs as the requester, so until now traces showed only the requester and an audit had to read the session stream to find the approver. The responder's id follows the same rule as the turn's principal ids: it is recorded only when the trace policy records both inputs and outputs and the conversation is public or running in development. ([#5596](https://github.com/vercel/eve/pull/5596))
9
- - The MCP channel's `agent_get` now returns an optional `statusMessage` while an invocation is `working`.
10
- It names the tool call that is running, using the tool's activity label when it has one, so MCP clients can show progress instead of a bare `working`. ([#5314](https://github.com/vercel/eve/pull/5314))
7
+ - Client `messages` now show only the session's current conversation, so messages from before a clear no longer appear.
8
+ `messages` and `transcriptOf()` follow each turn's `follows` and a completed context change's `selects`, as `conversation(view)` does, and leave out turns outside the conversation. The session `view` still holds every retained turn. ([#5597](https://github.com/vercel/eve/pull/5597))
9
+ - The `gh` tool takes an optional `repository` instead of `permissions`, runs any `gh` or `git` subcommand, and leaves every access decision to `github.authorize`.
10
+ `github.principalType` is now required and decides what `authorize` receives: `{ argv, auth, owner, repository, token }` for `"app"`, and `{ argv, auth, repository, token }` for `"user"`, where `repository` may be `null`. eve no longer matches `--repo` and other explicit targets against the declared repository or limits `git` to `fetch`, `ls-remote`, `pull`, and `push`; check `argv` in `authorize` if your policy depends on them. ([#5595](https://github.com/vercel/eve/pull/5595))
11
+ - `history` passed to `send()`, `create()`, or the eve channel's `onMessage` now rejects an entry with a field other than `id`, `role`, or `text` instead of dropping it.
12
+ `InvalidSessionHistoryError` names the entry and its unknown fields. Map stored messages to `{ id, role, text }` before passing them, so fields a later release accepts never change what an existing caller sends. ([#5597](https://github.com/vercel/eve/pull/5597))
11
13
 
12
- ## Bug Fixes
13
-
14
- - Release notes now list breaking changes first and use plain headings, one paragraph per change, and a single compare link.
15
- A `minor` changeset always appears under Breaking Changes, so breaking changes merged with an internal PR title are no longer left out. The 0.86.0 and 0.87.0 notes now include the two breaking changes they missed. ([#5588](https://github.com/vercel/eve/pull/5588))
16
- - Upgrade `undici` to `8.12.3` for the security fixes published in `8.12.2`.
17
- A TLS 1.2 server that renegotiates to a certificate for another host now fails the `web_fetch` request instead of crashing the process. Thanks @pedro757 for reporting this in #5589. ([#5591](https://github.com/vercel/eve/pull/5591))
18
-
19
- For an upgrade across multiple releases, review each version between the installed and target versions in the [target version's changelog](https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%400.88.1/packages/eve/CHANGELOG.md).
14
+ For an upgrade across multiple releases, review each version between the installed and target versions in the [target version's changelog](https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%400.89.0/packages/eve/CHANGELOG.md).
@@ -1409,6 +1409,21 @@ function activeTurn(view) {
1409
1409
  const row = latest === void 0 ? void 0 : view.turns[latest];
1410
1410
  return row !== void 0 && row.status !== "settled" ? row : void 0;
1411
1411
  }
1412
+ function conversation(view) {
1413
+ const selection = view.selection;
1414
+ const start = selection === void 0 ? view.session.latestTurnId : selection?.turnId;
1415
+ const turns = [];
1416
+ const seen = /* @__PURE__ */ new Set();
1417
+ let id = start;
1418
+ while (id !== void 0 && id !== null && !seen.has(id)) {
1419
+ seen.add(id);
1420
+ const row = view.turns[id];
1421
+ if (row === void 0) break;
1422
+ turns.push(row);
1423
+ id = row.follows;
1424
+ }
1425
+ return turns.reverse();
1426
+ }
1412
1427
  function failure(view, turnId) {
1413
1428
  const row = turnId === void 0 ? void 0 : view.turns[turnId];
1414
1429
  if (row?.outcome === "failed") return row.error ?? {
@@ -3896,6 +3911,8 @@ var Conversation = class {
3896
3911
  return interactions;
3897
3912
  }
3898
3913
  #orderedMessages() {
3914
+ const turnIds = conversation(this.view).map((turn) => turn.turnId);
3915
+ const inConversation = new Set(turnIds);
3899
3916
  const sent = /* @__PURE__ */ new Map();
3900
3917
  const imported = /* @__PURE__ */ new Map();
3901
3918
  for (const row of Object.values(this.view.deliveries)) {
@@ -3928,7 +3945,7 @@ var Conversation = class {
3928
3945
  }
3929
3946
  const local = /* @__PURE__ */ new Map();
3930
3947
  for (const submission of this.#submissions) {
3931
- const turnId = submission.turnId !== void 0 && this.view.turns[submission.turnId] !== void 0 ? submission.turnId : void 0;
3948
+ const turnId = submission.turnId !== void 0 && inConversation.has(submission.turnId) ? submission.turnId : void 0;
3932
3949
  const message = {
3933
3950
  id: `optimistic:${submission.id}:user`,
3934
3951
  metadata: {
@@ -3946,7 +3963,7 @@ var Conversation = class {
3946
3963
  else messages.push(message);
3947
3964
  }
3948
3965
  const messages = [];
3949
- for (const turnId of Object.keys(this.view.turns)) {
3966
+ for (const turnId of turnIds) {
3950
3967
  const placed = [
3951
3968
  ...(imported.get(turnId) ?? []).map((entry) => ({
3952
3969
  ...entry,
@@ -1410,6 +1410,21 @@ function activeTurn(view) {
1410
1410
  const row = latest === void 0 ? void 0 : view.turns[latest];
1411
1411
  return row !== void 0 && row.status !== "settled" ? row : void 0;
1412
1412
  }
1413
+ function conversation(view) {
1414
+ const selection = view.selection;
1415
+ const start = selection === void 0 ? view.session.latestTurnId : selection?.turnId;
1416
+ const turns = [];
1417
+ const seen = /* @__PURE__ */ new Set();
1418
+ let id = start;
1419
+ while (id !== void 0 && id !== null && !seen.has(id)) {
1420
+ seen.add(id);
1421
+ const row = view.turns[id];
1422
+ if (row === void 0) break;
1423
+ turns.push(row);
1424
+ id = row.follows;
1425
+ }
1426
+ return turns.reverse();
1427
+ }
1413
1428
  function failure(view, turnId) {
1414
1429
  const row = turnId === void 0 ? void 0 : view.turns[turnId];
1415
1430
  if (row?.outcome === "failed") return row.error ?? {
@@ -3897,6 +3912,8 @@ var Conversation = class {
3897
3912
  return interactions;
3898
3913
  }
3899
3914
  #orderedMessages() {
3915
+ const turnIds = conversation(this.view).map((turn) => turn.turnId);
3916
+ const inConversation = new Set(turnIds);
3900
3917
  const sent = /* @__PURE__ */ new Map();
3901
3918
  const imported = /* @__PURE__ */ new Map();
3902
3919
  for (const row of Object.values(this.view.deliveries)) {
@@ -3929,7 +3946,7 @@ var Conversation = class {
3929
3946
  }
3930
3947
  const local = /* @__PURE__ */ new Map();
3931
3948
  for (const submission of this.#submissions) {
3932
- const turnId = submission.turnId !== void 0 && this.view.turns[submission.turnId] !== void 0 ? submission.turnId : void 0;
3949
+ const turnId = submission.turnId !== void 0 && inConversation.has(submission.turnId) ? submission.turnId : void 0;
3933
3950
  const message = {
3934
3951
  id: `optimistic:${submission.id}:user`,
3935
3952
  metadata: {
@@ -3947,7 +3964,7 @@ var Conversation = class {
3947
3964
  else messages.push(message);
3948
3965
  }
3949
3966
  const messages = [];
3950
- for (const turnId of Object.keys(this.view.turns)) {
3967
+ for (const turnId of turnIds) {
3951
3968
  const placed = [
3952
3969
  ...(imported.get(turnId) ?? []).map((entry) => ({
3953
3970
  ...entry,
@@ -1 +1 @@
1
- import{isFactType}from"#protocol/session-events/catalog.js";import{emptyPreviews,emptySessionView,foldReceivedEvent}from"#protocol/session-projection/fold.js";import{callPlace,interaction,interactionPlace}from"#protocol/session-projection/reader.js";import{runTurn}from"#protocol/session-projection/selectors.js";import{snapshotOf}from"#protocol/session-projection/session-view.js";import{assistantMessages,importedMessages,userMessage}from"#client/messages.js";import{answersDeliveryId}from"#shared/answers-delivery-id.js";var Conversation=class{view=emptySessionView();previews=emptyPreviews();#e;#t;#n=[];#r=new Map;#i=[];#a=!1;#o=new Map;#s=new Map;#c=new Map;#l=new Map;#u=new Map;#d=`all`;#f;#p;#m=-1;observe(e){let t=e.meta?.position,n=this.#e;if(t!==void 0&&n!==void 0&&(t.line<n.line||t.line===n.line&&t.index<=n.index))return!1;if(t!==void 0&&(this.#e=t),this.#n.push(e),e.meta?.endOfLine===!1)return!0;let r=this.#n;this.#n=[],this.#t=this.#e;for(let e of r){foldReceivedEvent(this.view,e,this.previews),e.type===`delivery.consumed`&&(e.data.history?.length??0)>0&&this.#l.set(e.data.deliveryId,importedMessages(e.data.deliveryId,e.data.history)),isFactType(e.type)&&(this.#p=void 0);for(let t of touchedTurns(this.view,this.previews,e))this.#g(t)}return this.#x(),this.#f=void 0,!0}advancePosition(e){this.#n.length!==0||e<=this.view.position||(this.view.position=e,this.#f=void 0,this.#p=void 0)}discardUncommitted(){this.#n=[],this.#e=this.#t}answer(e){let t=e.map(e=>({answer:e,deliveryId:void 0}));for(let e of t)this.view.interactions[e.answer.interactionId]?.status===`open`&&this.#r.set(e.answer.interactionId,e);this.#_();let retract=()=>{for(let e of t){let t=e.answer.interactionId;this.#r.get(t)===e&&this.#r.delete(t)}this.#_()};return retract.accept=e=>{for(let n of t)n.deliveryId=e;this.#x(),this.#_()},retract}confirmSubmission(e,t){this.#u.set(t,e),this.#f=void 0}holdUnconfirmedMessages(e){this.#a!==e&&(this.#a=e,this.#f=void 0)}setSubmissions(e){this.#i=e,this.#f=void 0}get submissions(){return this.#i}observeAgent(e,t){this.#o.set(e,t),this.#f=void 0}get state(){if(this.#f!==void 0)return this.#f;let{previews:e,view:t}=this,n=this.#v(),r=this.#d===`all`?void 0:new Set([...this.#d,...Object.values(t.turns).flatMap(e=>e.status===`running`?[e.turnId]:[])]),i=assistantMessages({interactions:n,previews:e,view:t},r);r===void 0&&(this.#s=new Map);for(let[e,t]of i)t.length===0?this.#s.delete(e):this.#s.set(e,t);this.#d=new Set;let a={agents:this.#b(),view:this.#h,messages:this.#y()};return this.#f=a,a}get#h(){return this.#p!==void 0&&this.#m===this.view.position?this.#p:(this.#m=this.view.position,this.#p=snapshotOf(this.view,this.previews))}#g(e){this.#d!==`all`&&this.#d.add(e)}#_(){this.#d=`all`,this.#f=void 0}#v(){let e={};for(let t of Object.keys(this.view.interactions)){let n=interaction(this.view,t);if(n===void 0)continue;let r=this.#r.get(t)?.answer;e[t]=r!==void 0&&n.status===`open`?{...n,answer:r}:n}return e}#y(){let e=new Map,t=new Map;for(let n of Object.values(this.view.deliveries)){if(n.consumedAt===void 0||n.turnId===void 0)continue;let r=n.consumedAt,i=(this.#l.get(n.deliveryId)??[]).map(e=>({at:r,message:e}));i.length>0&&t.set(n.turnId,[...t.get(n.turnId)??[],...i]);let a=this.#u.get(n.deliveryId),o=this.#c.get(n.deliveryId);if(this.#a&&o===void 0&&a===void 0)continue;if(o===void 0){if(o=userMessage(n),o===void 0)continue;this.#c.set(n.deliveryId,o)}let s=a===void 0?o:{...o,id:`optimistic:${a}:user`},c={at:n.consumedAt,message:s},l=e.get(n.turnId);l===void 0?e.set(n.turnId,[c]):l.push(c)}let n=new Map;for(let e of this.#i){let t=e.turnId!==void 0&&this.view.turns[e.turnId]!==void 0?e.turnId:void 0,r={id:`optimistic:${e.id}:user`,metadata:{optimistic:!0,status:e.error===void 0?`submitted`:`failed`},parts:[{text:e.message,type:`text`}],role:`user`},i=n.get(t);i===void 0?n.set(t,[r]):i.push(r)}let r=[];for(let i of Object.keys(this.view.turns)){let a=[...(t.get(i)??[]).map(e=>({...e,rank:-1})),...(e.get(i)??[]).map(e=>({...e,rank:0})),...(this.#s.get(i)??[]).map(e=>({...e,rank:1}))].sort((e,t)=>e.at-t.at||e.rank-t.rank);r.push(...a.map(e=>e.message),...n.get(i)??[])}return r.push(...n.get(void 0)??[]),r}#b(){let e={};for(let t of Object.values(this.view.children)){let n=`callId`in t.owner?t.owner.callId:void 0,r={owner:t.owner,name:t.name,observation:this.#o.get(t.sessionId)??{status:`not-followed`},sessionId:t.sessionId};n===void 0?`taskId`in t.owner&&(r.taskId=t.owner.taskId):(r.callId=n,r.turnId=callPlace(this.view,n)?.turnId,r.taskId=this.view.calls[n]?.taskId),e[t.sessionId]=r}return e}#x(){for(let[e,t]of this.#r)t.deliveryId!==void 0&&(this.view.deliveries[t.deliveryId]!==void 0||this.view.deliveries[answersDeliveryId(t.deliveryId)]!==void 0)&&(this.#r.delete(e),this.#_())}};function conversationOf(e){let t=new Conversation;for(let n of e)t.observe(n);return t.state}function touchedTurns(e,t,n){let r=n.scope,i=n.data??{},a=new Set,add=e=>{e!==void 0&&a.add(e)};add(r?.turnId),typeof i.turnId==`string`&&add(i.turnId);let o=typeof i.runId==`string`?i.runId:typeof i.partId==`string`?e.parts[i.partId]?.runId??t.parts[i.partId]?.runId:void 0;o!==void 0&&add(runTurn(e,o)),typeof i.callId==`string`&&add(callPlace(e,i.callId)?.turnId);let s=typeof i.interactionId==`string`?i.interactionId:typeof i.responseId==`string`?e.responses[i.responseId]?.interactionId:void 0,c=s===void 0?void 0:e.interactions[s];return c!==void 0&&(add(interactionPlace(e,c).turnId),`callId`in c.subject&&add(callPlace(e,c.subject.callId)?.turnId)),[...a]}export{Conversation,conversationOf};
1
+ import{isFactType}from"#protocol/session-events/catalog.js";import{emptyPreviews,emptySessionView,foldReceivedEvent}from"#protocol/session-projection/fold.js";import{callPlace,interaction,interactionPlace}from"#protocol/session-projection/reader.js";import{conversation,runTurn}from"#protocol/session-projection/selectors.js";import{snapshotOf}from"#protocol/session-projection/session-view.js";import{assistantMessages,importedMessages,userMessage}from"#client/messages.js";import{answersDeliveryId}from"#shared/answers-delivery-id.js";var Conversation=class{view=emptySessionView();previews=emptyPreviews();#e;#t;#n=[];#r=new Map;#i=[];#a=!1;#o=new Map;#s=new Map;#c=new Map;#l=new Map;#u=new Map;#d=`all`;#f;#p;#m=-1;observe(e){let t=e.meta?.position,n=this.#e;if(t!==void 0&&n!==void 0&&(t.line<n.line||t.line===n.line&&t.index<=n.index))return!1;if(t!==void 0&&(this.#e=t),this.#n.push(e),e.meta?.endOfLine===!1)return!0;let r=this.#n;this.#n=[],this.#t=this.#e;for(let e of r){foldReceivedEvent(this.view,e,this.previews),e.type===`delivery.consumed`&&(e.data.history?.length??0)>0&&this.#l.set(e.data.deliveryId,importedMessages(e.data.deliveryId,e.data.history)),isFactType(e.type)&&(this.#p=void 0);for(let t of touchedTurns(this.view,this.previews,e))this.#g(t)}return this.#x(),this.#f=void 0,!0}advancePosition(e){this.#n.length!==0||e<=this.view.position||(this.view.position=e,this.#f=void 0,this.#p=void 0)}discardUncommitted(){this.#n=[],this.#e=this.#t}answer(e){let t=e.map(e=>({answer:e,deliveryId:void 0}));for(let e of t)this.view.interactions[e.answer.interactionId]?.status===`open`&&this.#r.set(e.answer.interactionId,e);this.#_();let retract=()=>{for(let e of t){let t=e.answer.interactionId;this.#r.get(t)===e&&this.#r.delete(t)}this.#_()};return retract.accept=e=>{for(let n of t)n.deliveryId=e;this.#x(),this.#_()},retract}confirmSubmission(e,t){this.#u.set(t,e),this.#f=void 0}holdUnconfirmedMessages(e){this.#a!==e&&(this.#a=e,this.#f=void 0)}setSubmissions(e){this.#i=e,this.#f=void 0}get submissions(){return this.#i}observeAgent(e,t){this.#o.set(e,t),this.#f=void 0}get state(){if(this.#f!==void 0)return this.#f;let{previews:e,view:t}=this,n=this.#v(),r=this.#d===`all`?void 0:new Set([...this.#d,...Object.values(t.turns).flatMap(e=>e.status===`running`?[e.turnId]:[])]),i=assistantMessages({interactions:n,previews:e,view:t},r);r===void 0&&(this.#s=new Map);for(let[e,t]of i)t.length===0?this.#s.delete(e):this.#s.set(e,t);this.#d=new Set;let a={agents:this.#b(),view:this.#h,messages:this.#y()};return this.#f=a,a}get#h(){return this.#p!==void 0&&this.#m===this.view.position?this.#p:(this.#m=this.view.position,this.#p=snapshotOf(this.view,this.previews))}#g(e){this.#d!==`all`&&this.#d.add(e)}#_(){this.#d=`all`,this.#f=void 0}#v(){let e={};for(let t of Object.keys(this.view.interactions)){let n=interaction(this.view,t);if(n===void 0)continue;let r=this.#r.get(t)?.answer;e[t]=r!==void 0&&n.status===`open`?{...n,answer:r}:n}return e}#y(){let e=conversation(this.view).map(e=>e.turnId),t=new Set(e),n=new Map,r=new Map;for(let e of Object.values(this.view.deliveries)){if(e.consumedAt===void 0||e.turnId===void 0)continue;let t=e.consumedAt,i=(this.#l.get(e.deliveryId)??[]).map(e=>({at:t,message:e}));i.length>0&&r.set(e.turnId,[...r.get(e.turnId)??[],...i]);let a=this.#u.get(e.deliveryId),o=this.#c.get(e.deliveryId);if(this.#a&&o===void 0&&a===void 0)continue;if(o===void 0){if(o=userMessage(e),o===void 0)continue;this.#c.set(e.deliveryId,o)}let s=a===void 0?o:{...o,id:`optimistic:${a}:user`},c={at:e.consumedAt,message:s},l=n.get(e.turnId);l===void 0?n.set(e.turnId,[c]):l.push(c)}let i=new Map;for(let e of this.#i){let n=e.turnId!==void 0&&t.has(e.turnId)?e.turnId:void 0,r={id:`optimistic:${e.id}:user`,metadata:{optimistic:!0,status:e.error===void 0?`submitted`:`failed`},parts:[{text:e.message,type:`text`}],role:`user`},a=i.get(n);a===void 0?i.set(n,[r]):a.push(r)}let a=[];for(let t of e){let e=[...(r.get(t)??[]).map(e=>({...e,rank:-1})),...(n.get(t)??[]).map(e=>({...e,rank:0})),...(this.#s.get(t)??[]).map(e=>({...e,rank:1}))].sort((e,t)=>e.at-t.at||e.rank-t.rank);a.push(...e.map(e=>e.message),...i.get(t)??[])}return a.push(...i.get(void 0)??[]),a}#b(){let e={};for(let t of Object.values(this.view.children)){let n=`callId`in t.owner?t.owner.callId:void 0,r={owner:t.owner,name:t.name,observation:this.#o.get(t.sessionId)??{status:`not-followed`},sessionId:t.sessionId};n===void 0?`taskId`in t.owner&&(r.taskId=t.owner.taskId):(r.callId=n,r.turnId=callPlace(this.view,n)?.turnId,r.taskId=this.view.calls[n]?.taskId),e[t.sessionId]=r}return e}#x(){for(let[e,t]of this.#r)t.deliveryId!==void 0&&(this.view.deliveries[t.deliveryId]!==void 0||this.view.deliveries[answersDeliveryId(t.deliveryId)]!==void 0)&&(this.#r.delete(e),this.#_())}};function conversationOf(e){let t=new Conversation;for(let n of e)t.observe(n);return t.state}function touchedTurns(e,t,n){let r=n.scope,i=n.data??{},a=new Set,add=e=>{e!==void 0&&a.add(e)};add(r?.turnId),typeof i.turnId==`string`&&add(i.turnId);let o=typeof i.runId==`string`?i.runId:typeof i.partId==`string`?e.parts[i.partId]?.runId??t.parts[i.partId]?.runId:void 0;o!==void 0&&add(runTurn(e,o)),typeof i.callId==`string`&&add(callPlace(e,i.callId)?.turnId);let s=typeof i.interactionId==`string`?i.interactionId:typeof i.responseId==`string`?e.responses[i.responseId]?.interactionId:void 0,c=s===void 0?void 0:e.interactions[s];return c!==void 0&&(add(interactionPlace(e,c).turnId),`callId`in c.subject&&add(callPlace(e,c.subject.callId)?.turnId)),[...a]}export{Conversation,conversationOf};
@@ -6,7 +6,7 @@ export interface TranscriptMessage {
6
6
  }
7
7
  /** A session's text conversation, as {@link transcriptOf} reads it. */
8
8
  export interface TranscriptData {
9
- /** Messages since the session's last clear, oldest first. */
9
+ /** The messages of the session's current conversation, oldest first. */
10
10
  readonly messages: readonly TranscriptMessage[];
11
11
  }
12
12
  /** Options for {@link transcriptOf}. */
@@ -24,9 +24,12 @@ export interface TranscriptOptions {
24
24
  * The user's text is what each consumed delivery carries, after the history it imported; the
25
25
  * assistant's is each completed reply part. When one line consumes several deliveries, their
26
26
  * history comes before their messages, as the model reads them. Reasoning, narration, tool calls
27
- * and results, attachments, interactions, and interrupted or unfinished output are left out. A completed clear (`context.settled` selecting
28
- * nothing), or a reset that ended a stranded session, starts the transcript over, so text the
29
- * session no longer holds is never returned.
27
+ * and results, attachments, interactions, and interrupted or unfinished output are left out.
28
+ *
29
+ * Only the session's current conversation is returned: the newest turn, or the one a later
30
+ * context change selected, and the turns it follows back. A completed clear (`context.settled`
31
+ * selecting nothing), or a reset that ended a stranded session, starts the transcript over, so
32
+ * text the session no longer holds is never returned.
30
33
  *
31
34
  * @example
32
35
  * ```ts
@@ -1,2 +1,2 @@
1
- function transcriptOf(e,t={}){let{maxMessages:n}=t;if(n!==void 0&&(!Number.isSafeInteger(n)||n<=0))throw TypeError(`transcriptOf: "maxMessages" must be a positive integer; received ${String(n)}.`);let r=[],i,a,append=e=>{e.text.trim().length>0&&r.push(e)};for(let t of e){let e=t.meta?.position?.line;switch((t.type!==`delivery.consumed`||a?.line!==e)&&(a=void 0),t.type){case`delivery.admitted`:t.data.source!==void 0&&`control`in t.data.source&&t.data.source.control===`reset`&&(i=t.data.deliveryId);break;case`delivery.consumed`:{a??={at:r.length,line:e};let n=(t.data.history??[]).filter(({text:e})=>e.trim().length>0).map(({role:e,text:t})=>({role:e,text:t}));r.splice(a.at,0,...n),a.at+=n.length,append({role:`user`,text:textOf(t.data.parts)});break}case`content.completed`:t.data.kind===`text`&&t.data.phase===`reply`&&t.data.interrupted!==!0&&typeof t.data.value==`string`&&append({role:`assistant`,text:t.data.value});break;case`context.settled`:t.data.selects===null&&(r=[]);break;case`session.ended`:t.data.cause!==void 0&&`deliveryId`in t.data.cause&&t.data.cause.deliveryId===i&&(r=[])}}return{messages:n===void 0?r:r.slice(-n)}}function textOf(e){return e.flatMap(e=>e.kind===`text`?[e.text]:[]).join(`
1
+ function transcriptOf(e,t={}){let{maxMessages:n}=t;if(n!==void 0&&(!Number.isSafeInteger(n)||n<=0))throw TypeError(`transcriptOf: "maxMessages" must be a positive integer; received ${String(n)}.`);let r=[],i=new Map,a,o,s,c,append=(e,t)=>{e.text.trim().length>0&&r.push({message:e,turnId:t})};for(let t of e){let e=t.meta?.position?.line;switch((t.type!==`delivery.consumed`||c?.line!==e)&&(c=void 0),t.type){case`delivery.admitted`:t.data.source!==void 0&&`control`in t.data.source&&t.data.source.control===`reset`&&(s=t.data.deliveryId);break;case`turn.started`:i.set(t.data.turnId,t.data.follows),a=t.data.turnId,o=void 0;break;case`delivery.consumed`:{let{turnId:n}=t.data;c??={at:r.length,line:e};let i=(t.data.history??[]).filter(({text:e})=>e.trim().length>0).map(({role:e,text:t})=>({message:{role:e,text:t},turnId:n}));r.splice(c.at,0,...i),c.at+=i.length,append({role:`user`,text:textOf(t.data.parts)},n);break}case`content.completed`:t.data.kind===`text`&&t.data.phase===`reply`&&t.data.interrupted!==!0&&typeof t.data.value==`string`&&append({role:`assistant`,text:t.data.value},t.scope?.turnId);break;case`context.settled`:if(t.data.outcome!==`completed`||t.data.selects===void 0)break;t.data.selects===null&&(r=[]),o=t.data.selects===null?null:t.data.selects.turnId;break;case`session.ended`:t.data.cause!==void 0&&`deliveryId`in t.data.cause&&t.data.cause.deliveryId===s&&(r=[])}}let l=conversationTurns(i,o===void 0?a:o),u=r.flatMap(({message:e,turnId:t})=>t===void 0||!i.has(t)||l.has(t)?[e]:[]);return{messages:n===void 0?u:u.slice(-n)}}function conversationTurns(e,t){let n=new Set,r=t;for(;r!=null&&!n.has(r);)n.add(r),r=e.get(r);return n}function textOf(e){return e.flatMap(e=>e.kind===`text`?[e.text]:[]).join(`
2
2
  `)}export{transcriptOf};
@@ -61,7 +61,7 @@
61
61
  "zod": "4.5.4",
62
62
  "zod-validation-error": "5.0.0"
63
63
  },
64
- "scriptHash": "8d606c6729fcbfca8be615a4186723cebba6b9e35208bf6c160be584417b2928",
64
+ "scriptHash": "04ba57b3b68f1f35520e6305a5a09628e1de93cd9434ee708f492c3bea8cf83d",
65
65
  "toolVersions": {
66
66
  "rolldown": "1.2.9",
67
67
  "typescript": "7.0.2"
@@ -1 +1 @@
1
- import{runJsProgram}from"#execution/dynamic-workflow/workflow.js";async function runWorkflowProgramTask(e,t){"use workflow";return runJsProgram(e.js,t,{maxSubagents:e.maxSubagents??0})}runWorkflowProgramTask.workflowId=`workflow//eve@0.88.1//runWorkflowProgramTask`;export{runWorkflowProgramTask};
1
+ import{runJsProgram}from"#execution/dynamic-workflow/workflow.js";async function runWorkflowProgramTask(e,t){"use workflow";return runJsProgram(e.js,t,{maxSubagents:e.maxSubagents??0})}runWorkflowProgramTask.workflowId=`workflow//eve@0.89.0//runWorkflowProgramTask`;export{runWorkflowProgramTask};
@@ -1 +1 @@
1
- import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{reply:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({signal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@0.88.1//runAgentRouterTask`;export{runAgentRouterTask};
1
+ import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{reply:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({signal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@0.89.0//runAgentRouterTask`;export{runAgentRouterTask};
@@ -1,20 +1,23 @@
1
1
  import { z } from "zod";
2
- import type { GitHubAttribution, GitHubAuthorize, GitHubConfig } from "./lib/github-shell.ts";
2
+ import type { GitHubAppAuthorizeRequest, GitHubAttribution, GitHubAuthorize, GitHubConfig, GitHubUserAuthorizeRequest } from "./lib/github-shell.ts";
3
3
  export type { GitHubLeaseRule } from "./lib/github-shell.ts";
4
4
  export type { GitHubCoAuthor } from "./lib/github-shell.ts";
5
- export type { GitHubAuthorize, GitHubAuthorizeRequest } from "./lib/github-shell.ts";
5
+ export type { GitHubAppAuthorizeRequest, GitHubAuthorize, GitHubAuthorizeRequest, GitHubUserAuthorizeRequest, } from "./lib/github-shell.ts";
6
6
  export type GitHubLeaseBroker = GitHubConfig["broker"];
7
7
  export type { GitHubAttribution } from "./lib/github-shell.ts";
8
8
  declare const _default: import("eve/extension").ExtensionHandle<z.ZodObject<{
9
- github: z.ZodOptional<z.ZodObject<{
9
+ github: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
10
10
  connector: z.ZodString;
11
11
  broker: z.ZodCustom<(sandbox: import("../../../shared/sandbox-session.ts").SandboxSession, rules: Readonly<Record<string, readonly import("./lib/github-shell.ts").GitHubLeaseRule[]>> | null) => Promise<void>, (sandbox: import("../../../shared/sandbox-session.ts").SandboxSession, rules: Readonly<Record<string, readonly import("./lib/github-shell.ts").GitHubLeaseRule[]>> | null) => Promise<void>>;
12
12
  attribution: z.ZodOptional<z.ZodCustom<GitHubAttribution, GitHubAttribution>>;
13
- authorize: z.ZodCustom<GitHubAuthorize, GitHubAuthorize>;
14
- principalType: z.ZodOptional<z.ZodEnum<{
15
- app: "app";
16
- user: "user";
17
- }>>;
18
- }, z.core.$strip>>;
13
+ authorize: z.ZodCustom<GitHubAuthorize<GitHubAppAuthorizeRequest>, GitHubAuthorize<GitHubAppAuthorizeRequest>>;
14
+ principalType: z.ZodLiteral<"app">;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ connector: z.ZodString;
17
+ broker: z.ZodCustom<(sandbox: import("../../../shared/sandbox-session.ts").SandboxSession, rules: Readonly<Record<string, readonly import("./lib/github-shell.ts").GitHubLeaseRule[]>> | null) => Promise<void>, (sandbox: import("../../../shared/sandbox-session.ts").SandboxSession, rules: Readonly<Record<string, readonly import("./lib/github-shell.ts").GitHubLeaseRule[]>> | null) => Promise<void>>;
18
+ attribution: z.ZodOptional<z.ZodCustom<GitHubAttribution, GitHubAttribution>>;
19
+ authorize: z.ZodCustom<GitHubAuthorize<GitHubUserAuthorizeRequest>, GitHubAuthorize<GitHubUserAuthorizeRequest>>;
20
+ principalType: z.ZodLiteral<"user">;
21
+ }, z.core.$strip>], "principalType">>;
19
22
  }, z.core.$strip>>;
20
23
  export default _default;
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";import{defineExtension}from"eve/extension";const fn=()=>z.custom(e=>typeof e==`function`);var extension_default=defineExtension({config:z.object({github:z.object({connector:z.string().min(1),broker:fn(),attribution:fn().optional(),authorize:fn(),principalType:z.enum([`app`,`user`]).optional()}).optional()})});export{extension_default as default};
1
+ import{z}from"#compiled/zod/index.js";import{defineExtension}from"eve/extension";const fn=()=>z.custom(e=>typeof e==`function`),githubBase={connector:z.string().min(1),broker:fn(),attribution:fn().optional()};var extension_default=defineExtension({config:z.object({github:z.discriminatedUnion(`principalType`,[z.object({...githubBase,authorize:fn(),principalType:z.literal(`app`)}),z.object({...githubBase,authorize:fn(),principalType:z.literal(`user`)})]).optional()})});export{extension_default as default};
@@ -1,7 +1,7 @@
1
1
  import { type GitHubConfig } from "./github-shell.ts";
2
2
  declare const GH_TOOL_SCOPE: {
3
- readonly repository: "Connect mints the real token for only that repository, and the sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. GitHub rejects access outside the token's server-side repository scope; commands that explicitly name another repository with -R, --repo, --repo=, or a repository argument to gh repo clone, view, or fork are denied before minting.";
4
- readonly caller: "Connect resolves the caller's own GitHub token for that command, and the sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. The token carries the caller's GitHub permissions, so GitHub allows whatever the caller can access; commands that explicitly name another repository with -R, --repo, --repo=, or a repository argument to gh repo clone, view, or fork are denied before the token is resolved.";
3
+ readonly repository: "Connect mints a GitHub App installation token for that repository, or for the owner's installation when repository is an owner.";
4
+ readonly caller: "Connect resolves the caller's own GitHub token, which carries the caller's GitHub permissions, so GitHub allows whatever the caller can access.";
5
5
  };
6
6
  /** Describes the `gh` tool for app-installation (`repository`) or user-scoped (`caller`) tokens. */
7
7
  export declare function ghToolDescription(scope: keyof typeof GH_TOOL_SCOPE): string;
@@ -9,11 +9,7 @@ export declare const GH_TOOL_DESCRIPTION: string;
9
9
  /** The Connect-brokered `gh` tool, rebuilt by the dynamic resolver with its current config. */
10
10
  export declare function defineGhTool(github: () => GitHubConfig | undefined, description?: string): import("eve/tools").ToolDefinition<{
11
11
  command: string;
12
- permissions: {
13
- provider: "github";
14
- repositories: string[];
15
- access: "write";
16
- }[];
12
+ repository?: string | undefined;
17
13
  description: string;
18
14
  workingDirectory?: string | undefined;
19
15
  }, {
@@ -24,11 +20,7 @@ export declare function defineGhTool(github: () => GitHubConfig | undefined, des
24
20
  }> & {
25
21
  execute(input: {
26
22
  command: string;
27
- permissions: {
28
- provider: "github";
29
- repositories: string[];
30
- access: "write";
31
- }[];
23
+ repository?: string | undefined;
32
24
  description: string;
33
25
  workingDirectory?: string | undefined;
34
26
  }, ctx: import("eve/tools").ToolContext): Promise<import("./github-shell.ts").GitHubShellOutput>;
@@ -1 +1 @@
1
- import{executeGitHubShell,githubShellApproval}from"./github-shell.js";import{githubShellInputSchema}from"./github-shell-schema.js";import{z}from"#compiled/zod/index.js";import{defineTool}from"eve/tools";const GH_TOOL_SCOPE={repository:`Connect mints the real token for only that repository, and the sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. GitHub rejects access outside the token's server-side repository scope; commands that explicitly name another repository with -R, --repo, --repo=, or a repository argument to gh repo clone, view, or fork are denied before minting.`,caller:`Connect resolves the caller's own GitHub token for that command, and the sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. The token carries the caller's GitHub permissions, so GitHub allows whatever the caller can access; commands that explicitly name another repository with -R, --repo, --repo=, or a repository argument to gh repo clone, view, or fork are denied before the token is resolved.`};function ghToolDescription(e){return`Run one authenticated GitHub command in the sandbox. The full gh CLI surface is available. Commands run without an approval prompt; description records the GitHub-side result the command intends to produce. Declare exactly one owner/name repository; the agent's access policy decides which repositories commands may use. ${GH_TOOL_SCOPE[e]} Use simple argv quoting only, never environment assignments, pipes, redirects, substitutions, or other shell syntax. gh alias and extension commands may execute local code, but remain sandboxed. Use git here only for authenticated fetch, pull, push, or ls-remote against a strictly validated origin, and use gh-signed-commit only with --repo. Use ordinary bash for local git status, diff, add, commit, and rebase.`}const GH_TOOL_DESCRIPTION=ghToolDescription(`repository`),ghOutputSchema=z.object({exitCode:z.number().int(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()});function defineGhTool(e,t=ghToolDescription(e()?.principalType===`user`?`caller`:`repository`)){return defineTool({description:t,approval:({toolInput:e})=>githubShellApproval(e),inputSchema:githubShellInputSchema,outputSchema:ghOutputSchema,execute(t,n){return executeGitHubShell(t,e(),{context:n,auth:n.session.auth.current,getToken:(e,t)=>n.getToken(e,t),requireAuth:(e,t)=>n.requireAuth(e,t),getSandbox:()=>n.getSandbox(),sessionId:n.session.id})}})}export{GH_TOOL_DESCRIPTION,defineGhTool,ghToolDescription};
1
+ import{githubShellInputSchema}from"./github-shell-schema.js";import{executeGitHubShell,githubShellApproval}from"./github-shell.js";import{z}from"#compiled/zod/index.js";import{defineTool}from"eve/tools";const GH_TOOL_SCOPE={repository:`Connect mints a GitHub App installation token for that repository, or for the owner's installation when repository is an owner.`,caller:`Connect resolves the caller's own GitHub token, which carries the caller's GitHub permissions, so GitHub allows whatever the caller can access.`},GH_TOOL_REPOSITORY={repository:`Set repository to the owner/name the command acts on, or to an owner for discovery such as gh repo list <owner> or gh search repos --owner <owner>.`,caller:`Set repository to the owner/name the command acts on, or omit it for commands that act on no single repository, such as gh repo list <owner>, gh search repos, or gh api user/repos.`};function ghToolDescription(e){return`Run one authenticated gh, git, or gh-signed-commit command in the sandbox. The full gh and git CLI surface is available. ${GH_TOOL_REPOSITORY[e]} The agent's access policy decides whether each command runs. ${GH_TOOL_SCOPE[e]} The sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. Commands run without an approval prompt; description records the GitHub-side result the command intends to produce. Use simple argv quoting only, never environment assignments, pipes, redirects, substitutions, or other shell syntax. gh alias and extension commands may execute local code, but remain sandboxed. Use gh-signed-commit only with --repo. Use ordinary bash for local git status, diff, add, commit, and rebase.`}const GH_TOOL_DESCRIPTION=ghToolDescription(`repository`),ghOutputSchema=z.object({exitCode:z.number().int(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()});function defineGhTool(e,t=ghToolDescription(e()?.principalType===`user`?`caller`:`repository`)){return defineTool({description:t,approval:({toolInput:e})=>githubShellApproval(e),inputSchema:githubShellInputSchema,outputSchema:ghOutputSchema,execute(t,n){return executeGitHubShell(t,e(),{context:n,auth:n.session.auth.current,getToken:(e,t)=>n.getToken(e,t),requireAuth:(e,t)=>n.requireAuth(e,t),getSandbox:()=>n.getSandbox(),sessionId:n.session.id})}})}export{GH_TOOL_DESCRIPTION,defineGhTool,ghToolDescription};
@@ -1,10 +1,10 @@
1
- const TOKEN_SCOPE={repository:{token:"Connect mints the real token for only the declared repository. The sandbox process receives only a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. GitHub rejects access outside the token's server-side repository scope.",context:"Commands without an explicit repository may use normal `gh` context, but their token remains scoped to the declared repository."},caller:{token:"Connect resolves the caller's own GitHub token for each command. The sandbox process receives only a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. The token carries the caller's GitHub permissions, so access is limited to what the caller can reach on GitHub.",context:"Commands without an explicit repository may use normal `gh` context."}},connectInstructions=e=>`# GitHub
1
+ const TOKEN_SCOPE={repository:{token:`Connect mints a GitHub App installation token for the declared repository, or for the owner's installation when you declare only an owner.`,repository:"Set `repository` to the `owner/name` the command acts on, or to an owner for discovery."},caller:{token:`Connect resolves the caller's own GitHub token for each command. It carries the caller's GitHub permissions, so access is limited to what the caller can reach on GitHub.`,repository:"Set `repository` to the `owner/name` the command acts on, or omit it for commands that act on no single repository, such as `gh repo list <owner>`, `gh search repos`, or `gh api user/repos`."}},connectInstructions=e=>`# GitHub
2
2
 
3
- GitHub credentials are not available to ordinary \`bash\`. Use the \`gh\` tool for every authenticated GitHub operation. The full \`gh\` CLI surface is available. Declare exactly one \`owner/name\` repository with write-capable access; the agent's access policy decides which repositories commands may use. Authenticated commands run without an approval prompt; describe the intended GitHub-side result accurately in \`description\`. ${e.token} Never put credentials in URLs or commands. If access is denied, report it plainly and stop.
3
+ GitHub credentials are not available to ordinary \`bash\`. Use the \`gh\` tool for every authenticated GitHub operation: \`gh\`, \`git\`, and \`gh-signed-commit\` commands. The full \`gh\` and \`git\` CLI surface is available. ${e.repository} The agent's access policy decides whether each command runs. Authenticated commands run without an approval prompt; describe the intended GitHub-side result accurately in \`description\`. ${e.token} The sandbox process receives only a placeholder \`GH_TOKEN\`, and the firewall exchanges it on matching GitHub requests. Never put credentials in URLs or commands. If access is denied, report it plainly and stop.
4
4
 
5
- Pass commands as simple argv with ordinary quoting. Do not use environment assignments, pipes, redirects, substitutions, or other shell syntax. ${e.context} An explicit \`-R\`, \`--repo\`, \`--repo=\`, or repository argument to \`gh repo clone\`, \`view\`, or \`fork\` must match the declaration.
5
+ Pass commands as simple argv with ordinary quoting. Do not use environment assignments, pipes, redirects, substitutions, or other shell syntax.
6
6
 
7
- Determine the repositories needed to complete the task through source discovery and investigation, even when the requester does not name them. Do not ask the requester to enumerate repositories that can be discovered, and never default to the current agent's repository. The agent may select additional repositories as the work reveals them. Each authenticated command declares exactly one target repository and mints a credential lease for that repository at the moment it is needed, so cross-repository work uses separate scoped commands and leases.
7
+ Find the repositories a task needs yourself, even when the requester does not name them or names them loosely. Search with \`gh repo list <owner>\`, \`gh search repos <query>\`, or \`gh search repos --owner <owner> <query>\`, and suggest the closest match when a name does not resolve. Do not ask the requester for an exact \`owner/name\` you can discover, and never default to the current agent's repository. Each command declares its own target, so cross-repository work uses separate commands.
8
8
 
9
9
  Clone with \`gh repo clone owner/name\`. Use authenticated \`git fetch\`, \`git pull\`, \`git push\`, and \`git ls-remote\` through the \`gh\` tool too. Local \`git status\`, \`diff\`, \`add\`, \`commit\`, and \`rebase\` remain ordinary \`bash\` commands because they need no GitHub credential.
10
10
 
@@ -1,11 +1,9 @@
1
1
  import { z } from "zod";
2
+ /** An `owner` or `owner/name` GitHub target. */
3
+ export declare const GITHUB_TARGET: RegExp;
2
4
  export declare const githubShellInputSchema: z.ZodObject<{
3
5
  command: z.ZodString;
4
- permissions: z.ZodArray<z.ZodObject<{
5
- provider: z.ZodLiteral<"github">;
6
- repositories: z.ZodArray<z.ZodString>;
7
- access: z.ZodLiteral<"write">;
8
- }, z.core.$strip>>;
6
+ repository: z.ZodOptional<z.ZodString>;
9
7
  description: z.ZodString;
10
8
  workingDirectory: z.ZodOptional<z.ZodString>;
11
9
  }, z.core.$strip>;
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";const permissionSchema=z.object({provider:z.literal(`github`),repositories:z.array(z.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/u)).length(1),access:z.literal(`write`)}),githubShellInputSchema=z.object({command:z.string().trim().min(1).max(2e4),permissions:z.array(permissionSchema).length(1),description:z.string().trim().min(1).max(500).describe(`the concrete GitHub-side result expected from this command`),workingDirectory:z.string().trim().min(1).max(1e3).optional().describe(`sandbox workspace directory; defaults to the workspace root`)});export{githubShellInputSchema};
1
+ import{z}from"#compiled/zod/index.js";const GITHUB_TARGET=/^([A-Za-z0-9][A-Za-z0-9-]*)(?:\/([A-Za-z0-9._-]+))?$/u,githubShellInputSchema=z.object({command:z.string().trim().min(1).max(2e4),repository:z.string().trim().regex(GITHUB_TARGET).optional().describe(`the owner/name repository the command acts on, or an owner for discovery such as gh repo list <owner>; omit for commands tied to no owner`),description:z.string().trim().min(1).max(500).describe(`the concrete GitHub-side result expected from this command`),workingDirectory:z.string().trim().min(1).max(1e3).optional().describe(`sandbox workspace directory; defaults to the workspace root`)});export{GITHUB_TARGET,githubShellInputSchema};
@@ -3,15 +3,11 @@ import type { SandboxSession } from "eve/sandbox";
3
3
  import type { ToolContext } from "eve/tools";
4
4
  import { type GitHubCoAuthor } from "./attribution.ts";
5
5
  export type { GitHubCoAuthor } from "./attribution.ts";
6
- export interface GitHubPermission {
7
- readonly access: "write";
8
- readonly provider: "github";
9
- readonly repositories: readonly string[];
10
- }
11
6
  export interface GitHubShellInput {
12
7
  readonly command: string;
13
8
  readonly description: string;
14
- readonly permissions: readonly GitHubPermission[];
9
+ /** The `owner/name` repository the command acts on, an `owner` for discovery, or omitted. */
10
+ readonly repository?: string;
15
11
  readonly workingDirectory?: string;
16
12
  }
17
13
  export interface GitHubShellOutput {
@@ -22,7 +18,7 @@ export interface GitHubShellOutput {
22
18
  }
23
19
  /** Resolves the co-author credited by this turn's GitHub publishing commands. */
24
20
  export type GitHubAttribution = (ctx: ToolContext) => GitHubCoAuthor | null | PromiseLike<GitHubCoAuthor | null>;
25
- export interface GitHubConfig {
21
+ interface GitHubConfigBase {
26
22
  /**
27
23
  * Resolves who the current turn publishes for. When it returns a person,
28
24
  * `gh-signed-commit` messages and `gh pr create` bodies end with their
@@ -31,27 +27,41 @@ export interface GitHubConfig {
31
27
  * requester's linked accounts.
32
28
  */
33
29
  readonly attribution?: GitHubAttribution;
34
- /** The only repository access control: commands run only when it returns `true`. */
35
- readonly authorize: GitHubAuthorize;
36
30
  readonly broker: (sandbox: SandboxSession, rules: Readonly<Record<string, readonly GitHubLeaseRule[]>> | null) => Promise<void>;
37
31
  readonly connector: string;
38
- /**
39
- * `"app"` (default) mints GitHub App installation tokens. `"user"` resolves
40
- * the caller's own token through `ctx.getToken`, signing them in when needed.
41
- */
42
- readonly principalType?: "app" | "user";
43
32
  }
44
- /** What an `authorize` callback sees before a `gh` command runs. */
45
- export interface GitHubAuthorizeRequest {
33
+ /** Mints GitHub App installation tokens scoped to the declared repository or owner. */
34
+ export interface GitHubAppConfig extends GitHubConfigBase {
35
+ /** The only access control: commands run only when it returns `true`. */
36
+ readonly authorize: GitHubAuthorize<GitHubAppAuthorizeRequest>;
37
+ readonly principalType: "app";
38
+ }
39
+ /** Resolves the caller's own token through `ctx.getToken`, signing them in when needed. */
40
+ export interface GitHubUserConfig extends GitHubConfigBase {
41
+ /** The only access control: commands run only when it returns `true`. */
42
+ readonly authorize: GitHubAuthorize<GitHubUserAuthorizeRequest>;
43
+ readonly principalType: "user";
44
+ }
45
+ export type GitHubConfig = GitHubAppConfig | GitHubUserConfig;
46
+ /** What an `authorize` callback sees before a `gh` command runs with the caller's own token. */
47
+ export interface GitHubUserAuthorizeRequest {
48
+ /** The parsed command, such as `["gh", "pr", "view", "7", "--repo", "acme/widgets"]`. */
49
+ readonly argv: readonly string[];
46
50
  /** The session's current caller, or `null` when the session has none. */
47
51
  readonly auth: SessionAuthContext | null;
48
- /** The `owner/name` repository the command declared, which every explicit command target matches. */
49
- readonly repository: string;
52
+ /** The `owner/name` repository the command declared, or `null`. */
53
+ readonly repository: string | null;
50
54
  /** The token Connect minted for this command, for API lookups. It reaches the command only after `authorize` returns `true`. */
51
55
  readonly token: string;
52
56
  }
53
- /** Decides whether the session's caller may run a `gh` command against one repository. */
54
- export type GitHubAuthorize = (request: GitHubAuthorizeRequest) => boolean | Promise<boolean>;
57
+ /** What an `authorize` callback sees before a `gh` command runs with an installation token. */
58
+ export interface GitHubAppAuthorizeRequest extends GitHubUserAuthorizeRequest {
59
+ /** The owner whose installation minted the token. */
60
+ readonly owner: string;
61
+ }
62
+ export type GitHubAuthorizeRequest = GitHubAppAuthorizeRequest | GitHubUserAuthorizeRequest;
63
+ /** Decides whether the session's caller may run one `gh` command; the agent's only access control. */
64
+ export type GitHubAuthorize<Request extends GitHubAuthorizeRequest = GitHubAuthorizeRequest> = (request: Request) => boolean | Promise<boolean>;
55
65
  export interface GitHubLeaseRule {
56
66
  readonly match?: {
57
67
  readonly headers?: readonly {
@@ -76,7 +86,7 @@ interface GitHubShellDependencies {
76
86
  authorizationDetails: {
77
87
  type: "github_app_installation";
78
88
  org: string;
79
- repositories: string[];
89
+ repositories?: string[];
80
90
  }[];
81
91
  subject: {
82
92
  type: "app";
@@ -1 +1 @@
1
- import{attributeCommand,coAuthorTrailer,isAttributable}from"./attribution.js";import{connectUserAuthorization}from"./connect-user-auth.js";import{shellQuote}from"./shell.js";import{validateRepositoryRoot}from"./repository-root.js";import{GITHUB_TOOLING_PATHS}from"./tooling.js";import{posix}from"node:path";import{getToken}from"#compiled/@vercel/connect/index.js";const MAX_OUTPUT_BYTES=1e5,leaseQueues=new Map,ALLOWED_GIT_REMOTE_COMMANDS=new Set([`fetch`,`ls-remote`,`pull`,`push`]),GITHUB_UNAUTHORIZED=/HTTP 401\b|Bad credentials|Authentication failed for|failed: 401\b/u;function githubShellApproval(e){if(!e)return`not-applicable`;try{return validateGitHubShellInput(e),`not-applicable`}catch(e){return{type:`denied`,reason:e instanceof Error?e.message:`Invalid GitHub command.`}}}async function executeGitHubShell(e,t,n){if(!t)throw Error(`GitHub command access is not configured for this agent.`);let r=validateGitHubShellInput(e),i=await n.getSandbox(),a=resolveWorkingDirectory(i,e.workingDirectory);(r[0]===`git`||r[0]===`gh-signed-commit`)&&(a=await validateRepositoryRoot(i,a));let o=e.permissions[0].repositories,s=await assertCommandTargets(r,o,a,i),c=crypto.randomUUID(),l=`/tmp/eve-git-body-${c}.md`,{repository:u,owner:d,name:f}=declaredRepository(o),p=n.auth??null,m,h;if(t.principalType===`user`){if(!n.getToken||!n.requireAuth)throw Error(`User-scoped GitHub access requires ctx.getToken and ctx.requireAuth.`);m=connectUserAuthorization(t.connector),{token:h}=await n.getToken(m)}else h=await(n.getConnectToken??getToken)(t.connector,{authorizationDetails:[{type:`github_app_installation`,org:d,repositories:[f]}],subject:{type:`app`}});if(!h)throw Error(`Connect returned an empty token for ${JSON.stringify(t.connector)}.`);if(!await t.authorize({auth:p,repository:u,token:h}))throw Error(`The current caller is not authorized to access ${u}.`);let g=t.attribution&&n.context&&isAttributable(r)?await t.attribution(n.context):null,_=g?await attributeCommand(r,coAuthorTrailer(g),i,a,l):r,v=executablePath(_[0]),y=s?[`-c`,`protocol.allow=never`,`-c`,`protocol.https.allow=always`,_[1],`https://github.com/${s}.git`,..._.slice(3)]:_.slice(1),b=`cd ${shellQuote(a)} && exec ${shellQuote(v)} ${y.map(shellQuote).join(` `)}`,x=`Basic ${Buffer.from(`x-access-token:${h}`).toString(`base64`)}`,S=`eve-github-${c}`,C=`/tmp/eve-code-gh-${c}`,w=`Basic ${Buffer.from(`x-access-token:${S}`).toString(`base64`)}`,T;try{T=await withGitHubCredentialLease(i,n.sessionId,{authorization:x,placeholder:S,placeholderAuthorization:w,token:h},()=>{let e={GH_CONFIG_DIR:C,GH_PROMPT_DISABLED:`1`};return r[0]!==`git`&&(e.GH_TOKEN=S),e.GIT_CONFIG_COUNT=`2`,e.GIT_CONFIG_KEY_0=`http.https://github.com/.extraheader`,e.GIT_CONFIG_VALUE_0=`Authorization: ${w}`,e.GIT_CONFIG_KEY_1=`core.hooksPath`,e.GIT_CONFIG_VALUE_1=`/dev/null`,e.GIT_TERMINAL_PROMPT=`0`,e.PATH=`/usr/local/bin:/usr/bin:/bin`,i.run({command:b,env:e})},t.broker)}finally{await i.removePath({path:C,recursive:!0,force:!0}),await i.removePath({path:l,force:!0})}m&&T.exitCode!==0&&GITHUB_UNAUTHORIZED.test(T.stderr)&&n.requireAuth(m);let E=sanitizeOutput(T.stdout,h,x),D=sanitizeOutput(T.stderr,h,x);return{exitCode:T.exitCode,stdout:E.value,stderr:D.value,truncated:E.truncated||D.truncated}}async function withGitHubCredentialLease(e,t,n,r,i){let a=leaseQueues.get(t)??Promise.resolve(),o,s=new Promise(e=>{o=e}),c=a.then(()=>s);leaseQueues.set(t,c),await a;try{return await i(e,{"api.github.com":[{match:{headers:[{key:{exact:`authorization`},value:{regex:`^(?:token|Bearer) ${n.placeholder}$`}}]},transform:[{headers:{authorization:`Bearer ${n.token}`}}]}],"github.com":[{match:{headers:[{key:{exact:`authorization`},value:{exact:n.placeholderAuthorization}}]},transform:[{headers:{authorization:n.authorization}}]}]}),await r()}finally{try{await i(e,null)}finally{o(),leaseQueues.get(t)===c&&leaseQueues.delete(t)}}}function parseCommand(e){let t=e.trim();if(!t)throw Error(`GitHub command must not be empty.`);let n=[],r=``,i=null,a=!1,o=!1;for(let e of t){if(a){r+=e,a=!1,o=!0;continue}if(e===`\\`&&i!==`single`){a=!0,o=!0;continue}if(i===`single`){e===`'`?i=null:r+=e;continue}if(i===`double`){if(e===`"`)i=null;else if(e===`$`||e==="`")throw unsupportedSyntax();else r+=e;continue}if(e===`'`)i=`single`,o=!0;else if(e===`"`)i=`double`,o=!0;else if(/\s/u.test(e))o&&=(n.push(r),r=``,!1);else if(";&|<>$`(){}".includes(e))throw unsupportedSyntax();else r+=e,o=!0}if(a||i)throw Error(`GitHub command contains an unfinished quote or escape.`);if(o&&n.push(r),n.length===0)throw Error(`GitHub command must not be empty.`);return n}function validateGitHubShellInput(e){let t=parseCommand(e.command),n=e.permissions[0];if(e.permissions.length!==1||n?.provider!==`github`)throw Error(`Exactly one GitHub permission is required.`);if(n.access!==`write`)throw Error(`GitHub App commands require explicit write-capable access.`);if(!e.description.trim())throw Error(`description must describe the intended result.`);let[r,i]=t;if(r===`gh`){if(!i)throw Error(`A gh subcommand is required.`)}else if(r===`git`){if(!i||!ALLOWED_GIT_REMOTE_COMMANDS.has(i))throw Error(`Authenticated git supports only fetch, ls-remote, pull, and push; clone with gh repo clone.`)}else if(r!==`gh-signed-commit`)throw Error(`GitHub commands must use gh, an authenticated git remote command, or gh-signed-commit.`);return t}async function assertCommandTargets(e,t,n,r){let i=new Set(t.map(e=>e.toLowerCase())),a,o;if(e[0]===`git`){if(e[2]!==`origin`)throw Error(`Authenticated git commands must use the validated origin remote.`);let t=e[1]===`push`,i=await r.run({command:`cd ${shellQuote(n)} && git remote get-url ${t?`--push `:``}origin`,env:{GIT_TERMINAL_PROMPT:`0`,PATH:`/usr/bin:/bin`}});if(i.exitCode!==0)throw Error(`Could not resolve the origin GitHub repository.`);a=repositoryFromRemote(i.stdout.trim()),o=[a]}else if(e[0]===`gh-signed-commit`){if(o=repoFlagTargets(e.slice(1)),o.length===0)throw Error(`gh-signed-commit requires an explicit --repo owner/repository target.`)}else o=repoFlagTargets(e.slice(1)),e[1]===`repo`&&(e[2]===`clone`||e[2]===`view`||e[2]===`fork`)&&e[3]&&!e[3].startsWith(`-`)&&o.push(canonicalRepository(e[3]));for(let e of o)if(!i.has(e.toLowerCase()))throw Error(`Command target ${JSON.stringify(e)} is not in the declared repositories.`);return a}function repoFlagTargets(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===`--repo`||r===`-R`){let i=e[n+1];if(!i)throw Error(`${r} requires an owner/repository value.`);t.push(canonicalRepository(i)),n+=1}else r?.startsWith(`--repo=`)&&t.push(canonicalRepository(r.slice(7)))}return t}function repositoryFromRemote(e){let t=/^https:\/\/github\.com\/([^/]+\/[^/]+?)(?:\.git)?$/iu.exec(e);if(t?.[1])return canonicalRepository(t[1]);let n=/^git@github\.com:([^/]+\/[^/]+?)(?:\.git)?$/iu.exec(e);if(n?.[1])return canonicalRepository(n[1]);throw Error(`The origin remote is not a canonical GitHub repository URL.`)}function canonicalRepository(e){let t=e.replace(/\.git$/iu,``);if(!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/u.test(t))throw Error(`Invalid GitHub repository ${JSON.stringify(e)}.`);return t}function declaredRepository(e){if(e.length!==1)throw Error(`Exactly one GitHub repository is required.`);let t=e[0],n=/^([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)$/u.exec(t);if(!n)throw Error(`Invalid GitHub repository ${JSON.stringify(t)}.`);return{repository:t,owner:n[1],name:n[2]}}function executablePath(e){return e===`gh`?GITHUB_TOOLING_PATHS.ghReal:e===`gh-signed-commit`?GITHUB_TOOLING_PATHS.trustedSignedCommit:`git`}function resolveWorkingDirectory(e,t){let n=posix.resolve(`/`,e.resolvePath(``)),r=posix.resolve(`/`,e.resolvePath(t?.trim()||``));if(r!==n&&!r.startsWith(`${n}/`))throw Error(`GitHub command workingDirectory must stay inside the sandbox workspace.`);return r}function sanitizeOutput(e,t,n){let r=e.replaceAll(t,`[redacted]`).replaceAll(n,`[redacted]`);return Buffer.byteLength(r)<=MAX_OUTPUT_BYTES?{value:r,truncated:!1}:{value:`[output truncated: showing final ${MAX_OUTPUT_BYTES} bytes]\n${Buffer.from(r).subarray(-1e5).toString()}`,truncated:!0}}function unsupportedSyntax(){return Error(`GitHub commands support argv syntax only, not pipes, redirects, substitutions, or shell operators.`)}export{executeGitHubShell,githubShellApproval,parseCommand};
1
+ import{attributeCommand,coAuthorTrailer,isAttributable}from"./attribution.js";import{connectUserAuthorization}from"./connect-user-auth.js";import{shellQuote}from"./shell.js";import{validateRepositoryRoot}from"./repository-root.js";import{GITHUB_TARGET}from"./github-shell-schema.js";import{GITHUB_TOOLING_PATHS}from"./tooling.js";import{posix}from"node:path";import{getToken}from"#compiled/@vercel/connect/index.js";const MAX_OUTPUT_BYTES=1e5,leaseQueues=new Map,EXECUTABLES=new Set([`gh`,`git`,`gh-signed-commit`]),GITHUB_UNAUTHORIZED=/HTTP 401\b|Bad credentials|Authentication failed for|failed: 401\b/u;function githubShellApproval(e){if(!e)return`not-applicable`;try{return validateGitHubShellInput(e),`not-applicable`}catch(e){return{type:`denied`,reason:e instanceof Error?e.message:`Invalid GitHub command.`}}}async function executeGitHubShell(e,t,n){if(!t)throw Error(`GitHub command access is not configured for this agent.`);let{argv:r,target:{owner:i,repository:a,name:o}}=validateGitHubShellInput(e);if(t.principalType===`user`?i&&!a:!i)throw Error(t.principalType===`user`?`Set repository to owner/name or omit it; user tokens are not scoped to an owner.`:`App tokens need repository set to an owner or owner/name.`);let s=await n.getSandbox(),c=resolveWorkingDirectory(s,e.workingDirectory);r[0]===`gh-signed-commit`&&(c=await validateRepositoryRoot(s,c));let l=crypto.randomUUID(),u=`/tmp/eve-git-body-${l}.md`,d=n.auth??null,f,p;if(t.principalType===`user`){if(!n.getToken||!n.requireAuth)throw Error(`User-scoped GitHub access requires ctx.getToken and ctx.requireAuth.`);f=connectUserAuthorization(t.connector),{token:p}=await n.getToken(f)}else{let e={type:`github_app_installation`,org:i};o&&(e.repositories=[o]),p=await(n.getConnectToken??getToken)(t.connector,{authorizationDetails:[e],subject:{type:`app`}})}if(!p)throw Error(`Connect returned an empty token for ${JSON.stringify(t.connector)}.`);if(!(t.principalType===`user`?await t.authorize({argv:r,auth:d,repository:a,token:p}):await t.authorize({argv:r,auth:d,owner:i,repository:a,token:p})))throw Error(`The current caller is not authorized to run this command${a?` on ${a}`:i?` for ${i}`:``}.`);let m=t.attribution&&n.context&&isAttributable(r)?await t.attribution(n.context):null,h=m?await attributeCommand(r,coAuthorTrailer(m),s,c,u):r,g=executablePath(h[0]),_=`cd ${shellQuote(c)} && exec ${shellQuote(g)} ${h.slice(1).map(shellQuote).join(` `)}`,v=`Basic ${Buffer.from(`x-access-token:${p}`).toString(`base64`)}`,y=`eve-github-${l}`,b=`/tmp/eve-code-gh-${l}`,x=`Basic ${Buffer.from(`x-access-token:${y}`).toString(`base64`)}`,S;try{S=await withGitHubCredentialLease(s,n.sessionId,{authorization:v,placeholder:y,placeholderAuthorization:x,token:p},()=>{let e={GH_CONFIG_DIR:b,GH_PROMPT_DISABLED:`1`};r[0]!==`git`&&(e.GH_TOKEN=y);let t=[[`http.https://github.com/.extraheader`,`Authorization: ${x}`],[`url.https://github.com/.insteadOf`,`git@github.com:`],[`url.https://github.com/.insteadOf`,`ssh://git@github.com/`],[`core.hooksPath`,`/dev/null`],[`protocol.allow`,`never`],[`protocol.https.allow`,`always`]];return e.GIT_CONFIG_COUNT=String(t.length),t.forEach(([t,n],r)=>{e[`GIT_CONFIG_KEY_${r}`]=t,e[`GIT_CONFIG_VALUE_${r}`]=n}),e.GIT_TERMINAL_PROMPT=`0`,e.PATH=`/usr/local/bin:/usr/bin:/bin`,s.run({command:_,env:e})},t.broker)}finally{await s.removePath({path:b,recursive:!0,force:!0}),await s.removePath({path:u,force:!0})}f&&S.exitCode!==0&&GITHUB_UNAUTHORIZED.test(S.stderr)&&n.requireAuth(f);let C=sanitizeOutput(S.stdout,p,v),w=sanitizeOutput(S.stderr,p,v);return{exitCode:S.exitCode,stdout:C.value,stderr:w.value,truncated:C.truncated||w.truncated}}async function withGitHubCredentialLease(e,t,n,r,i){let a=leaseQueues.get(t)??Promise.resolve(),o,s=new Promise(e=>{o=e}),c=a.then(()=>s);leaseQueues.set(t,c),await a;try{return await i(e,{"api.github.com":[{match:{headers:[{key:{exact:`authorization`},value:{regex:`^(?:token|Bearer) ${n.placeholder}$`}}]},transform:[{headers:{authorization:`Bearer ${n.token}`}}]}],"github.com":[{match:{headers:[{key:{exact:`authorization`},value:{exact:n.placeholderAuthorization}}]},transform:[{headers:{authorization:n.authorization}}]}]}),await r()}finally{try{await i(e,null)}finally{o(),leaseQueues.get(t)===c&&leaseQueues.delete(t)}}}function parseCommand(e){let t=e.trim();if(!t)throw Error(`GitHub command must not be empty.`);let n=[],r=``,i=null,a=!1,o=!1;for(let e of t){if(a){r+=e,a=!1,o=!0;continue}if(e===`\\`&&i!==`single`){a=!0,o=!0;continue}if(i===`single`){e===`'`?i=null:r+=e;continue}if(i===`double`){if(e===`"`)i=null;else if(e===`$`||e==="`")throw unsupportedSyntax();else r+=e;continue}if(e===`'`)i=`single`,o=!0;else if(e===`"`)i=`double`,o=!0;else if(/\s/u.test(e))o&&=(n.push(r),r=``,!1);else if(";&|<>$`(){}".includes(e))throw unsupportedSyntax();else r+=e,o=!0}if(a||i)throw Error(`GitHub command contains an unfinished quote or escape.`);if(o&&n.push(r),n.length===0)throw Error(`GitHub command must not be empty.`);return n}function validateGitHubShellInput(e){let t=parseCommand(e.command);if(!e.description.trim())throw Error(`description must describe the intended result.`);if(!EXECUTABLES.has(t[0]))throw Error(`GitHub commands must use gh, git, or gh-signed-commit.`);if(t.length<2)throw Error(`A ${t[0]} subcommand or argument is required.`);return{argv:t,target:declaredTarget(e.repository)}}function declaredTarget(e){let t=e?.trim();if(!t)return{owner:null,repository:null,name:null};let n=GITHUB_TARGET.exec(t.replace(/\.git$/iu,``));if(!n)throw Error(`Invalid GitHub repository or owner ${JSON.stringify(e)}.`);let[,r,i]=n;return{owner:r,repository:i?`${r}/${i}`:null,name:i??null}}function executablePath(e){return e===`gh`?GITHUB_TOOLING_PATHS.ghReal:e===`gh-signed-commit`?GITHUB_TOOLING_PATHS.trustedSignedCommit:`git`}function resolveWorkingDirectory(e,t){let n=posix.resolve(`/`,e.resolvePath(``)),r=posix.resolve(`/`,e.resolvePath(t?.trim()||``));if(r!==n&&!r.startsWith(`${n}/`))throw Error(`GitHub command workingDirectory must stay inside the sandbox workspace.`);return r}function sanitizeOutput(e,t,n){let r=e.replaceAll(t,`[redacted]`).replaceAll(n,`[redacted]`);return Buffer.byteLength(r)<=MAX_OUTPUT_BYTES?{value:r,truncated:!1}:{value:`[output truncated: showing final ${MAX_OUTPUT_BYTES} bytes]\n${Buffer.from(r).subarray(-1e5).toString()}`,truncated:!0}}function unsupportedSyntax(){return Error(`GitHub commands support argv syntax only, not pipes, redirects, substitutions, or shell operators.`)}export{executeGitHubShell,githubShellApproval,parseCommand};
@@ -15,7 +15,7 @@ for (let i = 0; i < args.length; i += 1) {
15
15
  if (!/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/.test(options.repo || "")) fail("--repo owner/name is required");
16
16
  if (!options.branch) fail("--branch is required");
17
17
  if (!options.message) fail("-m headline is required");
18
- if (!process.env.GH_TOKEN) fail('GH_TOKEN is not set; invoke the configured authenticated gh tool with command "gh-signed-commit --repo owner/name --branch branch -m headline", permissions [{"provider":"github","repositories":["owner/name"],"access":"write"}], a description of the intended commit, and workingDirectory set to the repository. Use the same repository for --repo and permissions; the tool supplies the scoped credential lease.');
18
+ if (!process.env.GH_TOKEN) fail('GH_TOKEN is not set; invoke the configured authenticated gh tool with command "gh-signed-commit --repo owner/name --branch branch -m headline", repository "owner/name", a description of the intended commit, and workingDirectory set to the repository. Use the same repository for --repo and repository; the tool supplies the credential lease.');
19
19
 
20
20
  const [owner, repo] = options.repo.split("/");
21
21
  const api = "https://api.github.com";
@@ -1,11 +1,7 @@
1
1
  /** The Connect-brokered `gh` tool, bound to the `eve/extensions/git` mount's `github` config. */
2
2
  export declare const gh: import("../../tools/definition.ts").ToolDefinition<{
3
3
  command: string;
4
- permissions: {
5
- provider: "github";
6
- repositories: string[];
7
- access: "write";
8
- }[];
4
+ repository?: string | undefined;
9
5
  description: string;
10
6
  workingDirectory?: string | undefined;
11
7
  }, {
@@ -16,11 +12,7 @@ export declare const gh: import("../../tools/definition.ts").ToolDefinition<{
16
12
  }> & {
17
13
  execute(input: {
18
14
  command: string;
19
- permissions: {
20
- provider: "github";
21
- repositories: string[];
22
- access: "write";
23
- }[];
15
+ repository?: string | undefined;
24
16
  description: string;
25
17
  workingDirectory?: string | undefined;
26
18
  }, ctx: import("../../tools/definition.ts").ToolContext): Promise<import("./extension/lib/github-shell.ts").GitHubShellOutput>;
@@ -1 +1 @@
1
- const STAMPED_PACKAGE_VERSION=`0.88.1`;function readStampedPackageVersion(){return STAMPED_PACKAGE_VERSION.startsWith(`__`)?void 0:STAMPED_PACKAGE_VERSION}export{readStampedPackageVersion};
1
+ const STAMPED_PACKAGE_VERSION=`0.89.0`;function readStampedPackageVersion(){return STAMPED_PACKAGE_VERSION.startsWith(`__`)?void 0:STAMPED_PACKAGE_VERSION}export{readStampedPackageVersion};
@@ -20,13 +20,14 @@ export interface DeliveryAdmittedData {
20
20
  readonly source?: DeliverySource;
21
21
  }
22
22
  /**
23
- * A message from conversation eve did not run, such as a transcript an app stored. It is text
24
- * only: it names no turn or call, and records nothing eve did.
23
+ * A message from conversation eve did not run, such as a transcript an app stored. It names no
24
+ * turn or call, and records nothing eve ran.
25
25
  */
26
26
  export interface ImportedMessage {
27
27
  /** The app's own id for the message, when it gave one. eve never reads it. */
28
28
  readonly id?: string;
29
29
  readonly role: "user" | "assistant";
30
+ /** The message's plain text. */
30
31
  readonly text: string;
31
32
  }
32
33
  export interface DeliveryConsumedData {
@@ -1 +1 @@
1
- async function agentToolServeWorkflow(e,t){"use workflow";let n=t.agent(t.toolName),r=sendToAgent(n,await e()),i=e();for(;;){let a=await nextCallOrResult(i,r);if(a.kind===`call`){r=await forwardCall(n,r,a.call),i=e();continue}if(!r.signal.aborted){if(a.result.status===`failed`)throw Error(`The agent's turn failed: ${a.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let o=e();if(o!==i){r=sendToAgent(n,await i),i=o;continue}t.reply(a.result.reply??``)}r=sendToAgent(n,await i),i=e()}}async function agentWithModelServeWorkflow(e,t){"use workflow";let n=await e(),r=n.input.model.trim();if(r===``)throw TypeError(`agent model must not be empty.`);let i=t.agent(`agent`,{model:r}),a=sendToModelAgent(i,n,r),o=e();for(;;){let n=await nextModelCallOrResult(o,a);if(n.kind===`call`){a=await forwardModelCall(i,a,n.call,r),o=e();continue}if(!a.signal.aborted){if(n.result.status===`failed`)throw Error(`The agent's turn failed: ${n.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let s=e();if(s!==o){a=sendToModelAgent(i,await o,r),o=s;continue}t.reply(n.result.reply??``)}a=sendToModelAgent(i,await o,r),o=e()}}function sendToAgent(e,t){return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}function sendToModelAgent(e,t,n){if(t.input.model!==n)throw Error(`An agent task keeps the model it started with. This task has ended; start a new task to use another model.`);return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}async function nextCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function nextModelCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function forwardCall(e,t,n){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToAgent(e,n)}async function forwardModelCall(e,t,n,r){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToModelAgent(e,n,r)}agentToolServeWorkflow.workflowId=`workflow//eve//agentToolServeWorkflow`,agentWithModelServeWorkflow.workflowId=`workflow//eve@0.88.1//agentWithModelServeWorkflow`;export{agentToolServeWorkflow,agentWithModelServeWorkflow};
1
+ async function agentToolServeWorkflow(e,t){"use workflow";let n=t.agent(t.toolName),r=sendToAgent(n,await e()),i=e();for(;;){let a=await nextCallOrResult(i,r);if(a.kind===`call`){r=await forwardCall(n,r,a.call),i=e();continue}if(!r.signal.aborted){if(a.result.status===`failed`)throw Error(`The agent's turn failed: ${a.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let o=e();if(o!==i){r=sendToAgent(n,await i),i=o;continue}t.reply(a.result.reply??``)}r=sendToAgent(n,await i),i=e()}}async function agentWithModelServeWorkflow(e,t){"use workflow";let n=await e(),r=n.input.model.trim();if(r===``)throw TypeError(`agent model must not be empty.`);let i=t.agent(`agent`,{model:r}),a=sendToModelAgent(i,n,r),o=e();for(;;){let n=await nextModelCallOrResult(o,a);if(n.kind===`call`){a=await forwardModelCall(i,a,n.call,r),o=e();continue}if(!a.signal.aborted){if(n.result.status===`failed`)throw Error(`The agent's turn failed: ${n.result.error.message}\nThis task has ended; to retry, call ${t.toolName} without taskId.`);let s=e();if(s!==o){a=sendToModelAgent(i,await o,r),o=s;continue}t.reply(n.result.reply??``)}a=sendToModelAgent(i,await o,r),o=e()}}function sendToAgent(e,t){return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}function sendToModelAgent(e,t,n){if(t.input.model!==n)throw Error(`An agent task keeps the model it started with. This task has ended; start a new task to use another model.`);return{result:e.send(t.input.message,{signal:t.abortSignal}).then(e=>e.result()),signal:t.abortSignal}}async function nextCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function nextModelCallOrResult(e,t){return await Promise.race([t.result.then(e=>({kind:`result`,result:e})),e.then(e=>({call:e,kind:`call`}))])}async function forwardCall(e,t,n){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToAgent(e,n)}async function forwardModelCall(e,t,n,r){return t.signal.aborted&&await t.result.catch(()=>void 0),sendToModelAgent(e,n,r)}agentToolServeWorkflow.workflowId=`workflow//eve//agentToolServeWorkflow`,agentWithModelServeWorkflow.workflowId=`workflow//eve@0.89.0//agentWithModelServeWorkflow`;export{agentToolServeWorkflow,agentWithModelServeWorkflow};
@@ -1,4 +1,4 @@
1
- import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{DEFAULT_CONNECT_PACKAGE_VERSION,resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_CHANNEL_TEMPLATES}from"./web-template.js";import{AGENT_INSTRUCTIONS_TEMPLATE}from"./instructions-template.js";import{SCAFFOLDED_AGENT_PATHS}from"./agent-paths.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.137`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.88.1`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{[SCAFFOLDED_AGENT_PATHS.config]:renderAgentTemplate(e,t),[SCAFFOLDED_AGENT_PATHS.channel]:WEB_CHANNEL_TEMPLATES.default,[SCAFFOLDED_AGENT_PATHS.instructions]:AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,t){let n=parseChatGptModelSelection(e);return n===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(n)}),\n${reasoningTemplateLine(t)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,t){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(t.model)!==void 0?renderAgentTemplate(t.model,t.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
1
+ import{pinnedNodeEngineMajor}from"../../node-engine.js";import{parseChatGptModelSelection}from"../../../shared/chatgpt-model.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{blockingCreateInPlaceEntries}from"../create-in-place.js";import{DEFAULT_CONNECT_PACKAGE_VERSION,resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_CHANNEL_TEMPLATES}from"./web-template.js";import{AGENT_INSTRUCTIONS_TEMPLATE}from"./instructions-template.js";import{SCAFFOLDED_AGENT_PATHS}from"./agent-paths.js";import{mkdir,readdir,stat}from"node:fs/promises";import{basename,join,resolve}from"node:path";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,DEFAULT_AI_PACKAGE_VERSION=`^7.0.137`,DEFAULT_ZOD_PACKAGE_VERSION=`4.5.4`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.89.0`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e,t){return{[SCAFFOLDED_AGENT_PATHS.config]:renderAgentTemplate(e,t),[SCAFFOLDED_AGENT_PATHS.channel]:WEB_CHANNEL_TEMPLATES.default,[SCAFFOLDED_AGENT_PATHS.instructions]:AGENT_INSTRUCTIONS_TEMPLATE}}function renderAgentTemplate(e,t){let n=parseChatGptModelSelection(e);return n===void 0?BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t)):`import { defineAgent } from "eve";\nimport { chatgpt } from "eve/models/openai";\n\nexport default defineAgent({\n model: chatgpt(${JSON.stringify(n)}),\n${reasoningTemplateLine(t)}});\n`}function reasoningTemplateLine(e){return e===void 0||e===`provider-default`?``:` reasoning: "${e}",\n`}function renderTemplate(e,t){return e===BASE_AGENT_TEMPLATE&&parseChatGptModelSelection(t.model)!==void 0?renderAgentTemplate(t.model,t.reasoning):e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_REASONING__`,reasoningTemplateLine(t.reasoning)).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
2
2
 
3
3
  export default defineAgent({
4
4
  model: "__EVE_INIT_MODEL__",
@@ -16,7 +16,9 @@ export declare class InvalidSessionHistoryError extends Error {
16
16
  readonly name = "InvalidSessionHistoryError";
17
17
  }
18
18
  /**
19
- * Validates `history` at the send boundary and returns a normalized copy that
20
- * carries only contract fields. Returns `undefined` when `history` is omitted.
19
+ * Validates `history` at the send boundary and returns a normalized copy.
20
+ * Returns `undefined` when `history` is omitted. An entry with a field outside
21
+ * the contract is rejected, not dropped, so no caller already sends a field a
22
+ * later release starts to read.
21
23
  */
22
24
  export declare function validateSessionHistory(history: unknown): readonly SessionHistoryMessage[] | undefined;
@@ -1 +1 @@
1
- import{isObject}from"#shared/guards.js";var InvalidSessionHistoryError=class extends Error{name=`InvalidSessionHistoryError`};function validateSessionHistory(e){if(e===void 0)return;if(!Array.isArray(e))throw new InvalidSessionHistoryError(`history must be an array of messages.`);let t=new Set;return e.map((e,n)=>{let r=`history[${n}]`;if(!isObject(e))throw new InvalidSessionHistoryError(`${r} must be an object.`);let{id:i,role:a,text:o}=e;if(a!==`user`&&a!==`assistant`)throw new InvalidSessionHistoryError(`${r}.role must be "user" or "assistant".`);if(typeof o!=`string`||o.trim().length===0)throw new InvalidSessionHistoryError(`${r}.text must be a non-empty string.`);let s={role:a,text:o};if(i===void 0)return s;if(typeof i!=`string`||i.length===0)throw new InvalidSessionHistoryError(`${r}.id must be a non-empty string.`);if(t.has(i))throw new InvalidSessionHistoryError(`${r}.id "${i}" is not unique.`);return t.add(i),{...s,id:i}})}export{InvalidSessionHistoryError,validateSessionHistory};
1
+ import{isObject}from"#shared/guards.js";var InvalidSessionHistoryError=class extends Error{name=`InvalidSessionHistoryError`};const HISTORY_FIELDS=[`id`,`role`,`text`];function validateSessionHistory(e){if(e===void 0)return;if(!Array.isArray(e))throw new InvalidSessionHistoryError(`history must be an array of messages.`);let t=new Set;return e.map((e,n)=>{let r=`history[${n}]`;if(!isObject(e))throw new InvalidSessionHistoryError(`${r} must be an object.`);rejectUnknownFields(e,r);let{id:i,role:a,text:o}=e;if(a!==`user`&&a!==`assistant`)throw new InvalidSessionHistoryError(`${r}.role must be "user" or "assistant".`);if(typeof o!=`string`||o.trim().length===0)throw new InvalidSessionHistoryError(`${r}.text must be a non-empty string.`);let s={role:a,text:o};if(i===void 0)return s;if(typeof i!=`string`||i.length===0)throw new InvalidSessionHistoryError(`${r}.id must be a non-empty string.`);if(t.has(i))throw new InvalidSessionHistoryError(`${r}.id "${i}" is not unique.`);return t.add(i),{...s,id:i}})}function rejectUnknownFields(e,t){let n=Object.keys(e).filter(t=>!HISTORY_FIELDS.includes(t)&&e[t]!==void 0);if(n.length===0)return;let r=n.slice(0,8).sort().map(e=>JSON.stringify(e.length>128?`${e.slice(0,128)}…`:e)),i=n.length>8?` (and more)`:``;throw new InvalidSessionHistoryError(`${t} has unknown field${n.length===1?``:`s`} ${r.join(`, `)}${i}. Accepted fields: ${HISTORY_FIELDS.join(`, `)}.`)}export{InvalidSessionHistoryError,validateSessionHistory};
@@ -1,3 +1,3 @@
1
- import { n as signInEnding, t as useEveAgent } from "../chunks/use-eve-agent-C0KHCyb9.js";
1
+ import { n as signInEnding, t as useEveAgent } from "../chunks/use-eve-agent-CNpxgKEH.js";
2
2
 
3
3
  export { signInEnding, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-C0KHCyb9.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-CNpxgKEH.js";
2
2
 
3
3
  export { useEveAgent };
@@ -1 +1 @@
1
- async function executeAskQuestionTool(e,t){"use workflow";return toAskQuestionOutput(await t.ask(toAskQuestionRequest(e)))}function toAskQuestionRequest(e){let t=e.options?.map(e=>({description:e.description,id:e.label,label:e.label}));return{allowFreeform:!0,display:t===void 0?`text`:`select`,prompt:e.question,...t!==void 0&&{options:t}}}function toAskQuestionOutput(e){switch(e.status){case`answered`:return{answer:e.optionId??e.text??``,status:`answered`};case`cancelled`:return{interrupted:!0};case`unavailable`:return{status:`unavailable`}}}executeAskQuestionTool.workflowId=`workflow//eve@0.88.1//executeAskQuestionTool`;export{executeAskQuestionTool,toAskQuestionOutput,toAskQuestionRequest};
1
+ async function executeAskQuestionTool(e,t){"use workflow";return toAskQuestionOutput(await t.ask(toAskQuestionRequest(e)))}function toAskQuestionRequest(e){let t=e.options?.map(e=>({description:e.description,id:e.label,label:e.label}));return{allowFreeform:!0,display:t===void 0?`text`:`select`,prompt:e.question,...t!==void 0&&{options:t}}}function toAskQuestionOutput(e){switch(e.status){case`answered`:return{answer:e.optionId??e.text??``,status:`answered`};case`cancelled`:return{interrupted:!0};case`unavailable`:return{status:`unavailable`}}}executeAskQuestionTool.workflowId=`workflow//eve@0.89.0//executeAskQuestionTool`;export{executeAskQuestionTool,toAskQuestionOutput,toAskQuestionRequest};
@@ -1 +1 @@
1
- import{sleep}from"#compiled/@workflow/core/index.js";async function executeSleepTool(e,t){"use workflow";if(t.abortSignal.aborted)return{interrupted:!0};let n=new Promise(e=>t.abortSignal.addEventListener(`abort`,()=>e(`interrupted`),{once:!0})),r=sleep(Math.ceil(e.seconds*1e3)).then(()=>`elapsed`);return await Promise.race([r,n])===`elapsed`?{waitedSeconds:e.seconds}:{interrupted:!0}}executeSleepTool.workflowId=`workflow//eve@0.88.1//executeSleepTool`;export{executeSleepTool};
1
+ import{sleep}from"#compiled/@workflow/core/index.js";async function executeSleepTool(e,t){"use workflow";if(t.abortSignal.aborted)return{interrupted:!0};let n=new Promise(e=>t.abortSignal.addEventListener(`abort`,()=>e(`interrupted`),{once:!0})),r=sleep(Math.ceil(e.seconds*1e3)).then(()=>`elapsed`);return await Promise.race([r,n])===`elapsed`?{waitedSeconds:e.seconds}:{interrupted:!0}}executeSleepTool.workflowId=`workflow//eve@0.89.0//executeSleepTool`;export{executeSleepTool};
@@ -1,3 +1,3 @@
1
- import { n as signInEnding, t as useEveAgent } from "../chunks/use-eve-agent-BExXjBv6.js";
1
+ import { n as signInEnding, t as useEveAgent } from "../chunks/use-eve-agent-Bbl4H5aA.js";
2
2
 
3
3
  export { signInEnding, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-BExXjBv6.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-Bbl4H5aA.js";
2
2
 
3
3
  export { useEveAgent };
@@ -456,7 +456,7 @@ When the session at the address is [stranded](../guides/deployment/self-hosting#
456
456
 
457
457
  `send()` accepts the same `history` option. The entries are added right before that message and its `context`, whether the send creates the session or continues it. The eve channel's `onMessage` can return `history` the same way. It applies to every message it is returned for, so return it only when the message should carry those turns.
458
458
 
459
- Each entry has a `role` of `"user"` or `"assistant"`, non-empty `text`, and an optional `id` that is unique within the call. Invalid history throws an `InvalidSessionHistoryError`, exported from `eve/channels`, that names the entry and the rule it broke. eve doesn't cap how many entries or how much text one call carries. Your route decides how much stored conversation to load, so trim long conversations there, for example to the newest messages. Tool calls, files, and reasoning are not supported.
459
+ Each entry has a `role` of `"user"` or `"assistant"`, non-empty `text`, and an optional `id` that is unique within the call. An entry with any other field is rejected, not dropped, so map your stored messages to these fields. Invalid history throws an `InvalidSessionHistoryError`, exported from `eve/channels`, that names the entry and the rule it broke. eve doesn't cap how many entries or how much text one call carries. Your route decides how much stored conversation to load, so trim long conversations there, for example to the newest messages. Tool calls, files, and reasoning are not supported.
460
460
 
461
461
  eve never accepts `history` from a client request body. Resolve it on the server and authorize the caller against the stored conversation.
462
462
 
@@ -98,62 +98,22 @@ 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.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` |
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.principalType` | With `github` | `"app"` for GitHub App installation tokens, or `"user"` for the caller's own token |
106
+ | `github.authorize` | With `github` | `authorize(request)` returns `true` to let a `gh` call run |
107
+ | `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null` |
108
108
 
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.
109
+ Each `gh` call runs one `gh`, `git`, or `gh-signed-commit` command. 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` 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.
111
+ ### Control access with `authorize`
112
112
 
113
- The simplest policy limits the agent to one organization. Compare owners case-insensitively, as GitHub does:
113
+ `github.authorize` is the agent's only access control: a command runs only when it returns `true`, and the token never reaches the sandbox otherwise. It runs before every `gh` call with the parsed `argv`, the caller's `auth`, the `repository` the call declared (or `null`), and the minted `token`. What the token reaches depends on `principalType`:
114
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):
130
-
131
- ```ts title="agent/extensions/git.ts"
132
- import git from "eve/extensions/git";
133
-
134
- import { brokerGitHubLease } from "../lib/github";
135
-
136
- export default git({
137
- github: {
138
- connector: "github/my-agent",
139
- broker: brokerGitHubLease,
140
- // GitHub channel sessions carry the commenter's login as `auth.subject`.
141
- async authorize({ auth, repository, token }) {
142
- if (!repository.toLowerCase().startsWith("acme/")) return false;
143
- if (auth?.authenticator !== "github-webhook" || !auth.subject) return false;
144
- const response = await fetch(
145
- `https://api.github.com/repos/${repository}/collaborators/${auth.subject}`,
146
- { headers: { authorization: `Bearer ${token}` } },
147
- );
148
- return response.status === 204;
149
- },
150
- },
151
- });
152
- ```
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:
115
+ - **`"app"`**: a GitHub App installation token for the declared repository, or for the whole installation when the call declares only an owner. `authorize` also receives that `owner`.
116
+ - **`"user"`**: the caller's own token, which reaches whatever the caller can on GitHub. eve signs the caller in when needed and again when GitHub rejects the token. `authorize` receives no `owner`, because the token is not scoped to one. `repository` is only what the model declared, and nothing ties it to the command, so it is a hint, not a boundary. Gate user-mode calls on `auth` instead, for example `({ auth }) => auth !== null`.
157
117
 
158
118
  ```ts title="agent/extensions/git.ts"
159
119
  import git from "eve/extensions/git";
@@ -164,16 +124,12 @@ export default git({
164
124
  github: {
165
125
  connector: "github/my-agent",
166
126
  broker: brokerGitHubLease,
167
- authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
168
- principalType: "user",
127
+ principalType: "app",
128
+ authorize: ({ owner }) => owner.toLowerCase() === "acme",
169
129
  },
170
130
  });
171
131
  ```
172
132
 
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
-
177
133
  ### Credit the person behind a turn
178
134
 
179
135
  Commits made by the `gh` tool are authored by the GitHub App. Return a verified user mapping from
@@ -193,7 +149,8 @@ export default git({
193
149
  github: {
194
150
  connector: "github/my-agent",
195
151
  broker: brokerGitHubLease,
196
- authorize: ({ repository }) => repository.toLowerCase().startsWith("acme/"),
152
+ principalType: "app",
153
+ authorize: ({ owner }) => owner.toLowerCase() === "acme",
197
154
  attribution: (ctx) => coAuthorFor(ctx.session.auth.current),
198
155
  },
199
156
  });
@@ -223,7 +180,7 @@ directory, `agent/extensions/code/extension.ts`.
223
180
 
224
181
  For a custom GitHub command tool, `eve/extensions/git/sandbox` exports
225
182
  `executeGitHubShell(input, config, dependencies)` and `githubShellApproval(input)`.
226
- The execution helper enforces repository and command constraints and brokers a
183
+ The execution helper parses the command, calls `authorize`, and brokers a
227
184
  credential lease; dependencies supply the session ID and sandbox access. Reuse
228
185
  `githubShellApproval` to reject invalid command inputs through the approval
229
186
  policy rather than bypassing those constraints.
@@ -121,7 +121,7 @@ export default defineDynamic(async (ctx) => {
121
121
 
122
122
  The memo runs before the replacement's first model call, and the instruction enters the replacement's durable history once, ahead of the new message. In a session that replaced no other, `ctx.session.predecessor` is undefined and the instruction contributes nothing.
123
123
 
124
- `transcriptOf()` keeps the history each consumed delivery imported, the text of each consumed delivery, and each completed reply part, oldest first, as `{ role, text }` messages. Reasoning, narration, tool calls and results, attachments, interactions, and interrupted output are left out. A clear in the stranded session starts the transcript over, so text the user cleared is never returned. `sessions.attach()` also converts older session history to v27 events. That conversion reads from the beginning to reconstruct the conversation, even when `startIndex` requests a later position. `maxMessages` keeps only the newest messages in the resulting transcript.
124
+ `transcriptOf()` keeps the history each consumed delivery imported, the text of each consumed delivery, and each completed reply part, oldest first, as `{ role, text }` messages. Reasoning, narration, tool calls and results, attachments, interactions, and interrupted output are left out. Only the session's current conversation is kept: a clear in the stranded session starts the transcript over, so text the user cleared is never returned. `sessions.attach()` also converts older session history to v27 events. That conversion reads from the beginning to reconstruct the conversation, even when `startIndex` requests a later position. `maxMessages` keeps only the newest messages in the resulting transcript.
125
125
 
126
126
  The read and the prompt are yours to bound:
127
127
 
@@ -106,6 +106,8 @@ Facts are grouped into families. Lifecycle facts introduce, update, or settle an
106
106
  | `context` | `context.started`, `context.settled` | A context change: `kind` `"compaction"` or `"clear"`. |
107
107
  | `usage` | `usage.recorded` | Model spend, owned by the run, call, or context change that spent it. |
108
108
 
109
+ The conversation is a chain of turns. Each `turn.started` names the turn it `follows`, the one whose conversation it continues, or `null` for a first turn. A completed `context.settled` can change the conversation with `selects`: `null` empties it, as a clear does, and `{ turnId }` makes that earlier turn its newest, leaving out the turns after it. The next turn then follows the selected one. Either can name any earlier turn, so read the conversation with `conversation(view)` instead of assuming it holds every turn in order.
110
+
109
111
  Progress records are `content.delta` (a text or reasoning delta for a `partId`), `call.input` (a raw tool-input delta for a `callId`), and `call.progress` (a preliminary output snapshot for a `callId`).
110
112
 
111
113
  Call labels use `capability.label` before execution, `call.progress.data.label` for a progress
@@ -132,7 +134,7 @@ Within stream version 27, a later minor release can add:
132
134
  - fact types that only add information: a new family, or an update to a row such as `model.retried`, never the only way an entity opens or ends;
133
135
  - progress record types;
134
136
  - optional fields;
135
- - outcomes, interaction kinds, displays, and option styles.
137
+ - outcomes, interaction kinds, context-change kinds, displays, and option styles.
136
138
 
137
139
  It never removes or renames a fact or field, changes what a fact means or which role it plays in its entity's lifecycle, or adds a required field. Anything else is a new stream version, which readers refuse.
138
140
 
@@ -24,7 +24,7 @@ for await (const event of delivery.stream()) {
24
24
 
25
25
  The cancellation delivery settles when the command is applied, including a no-op for a turn that already ended. Continue reading the original message's delivery to observe its outcome and advance its cursor. A live idle session also accepts cancellation; it does not return a separate `no_active_turn` result.
26
26
 
27
- Between turns, `session.compact()` queues context compaction without sending model input. `session.clear()` removes model-message history while retaining the session and its durable resources. Await their deliveries before sending another turn:
27
+ Between turns, `session.compact()` queues context compaction without sending model input. `session.clear()` removes model-message history while retaining the session and its durable resources. Client `messages` and `transcriptOf()` then leave out everything before the clear. Await their deliveries before sending another turn:
28
28
 
29
29
  ```ts
30
30
  const compaction = await session.compact();
@@ -11,7 +11,7 @@ React, [Vue](./use-eve-agent-vue), and [Svelte](./use-eve-agent-svelte) share th
11
11
 
12
12
  | Field | What it is |
13
13
  | ------------------ | ------------------------------------------------------------------------------ |
14
- | `messages` | Messages to render, including your submitted messages before eve confirms them |
14
+ | `messages` | The current conversation, and your submitted messages before eve confirms them |
15
15
  | `status` | Outstanding work: `"idle"`, `"busy"`, or `"resuming"`. See [Status](#status) |
16
16
  | `error` | The latest session creation, stream, resume, or turn failure |
17
17
  | `view` | Immutable session snapshot. Query it with functions from `eve/events` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.88.1",
3
+ "version": "0.89.0",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [