eve 0.84.1 → 0.86.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.
- package/README.md +7 -4
- package/dist/CHANGELOG.md +38 -0
- package/dist/src/channel/channel-operations.d.ts +2 -18
- package/dist/src/channel/compiled-channel.d.ts +3 -7
- package/dist/src/channel/cross-channel-receive.d.ts +9 -10
- package/dist/src/channel/cross-channel-receive.js +1 -1
- package/dist/src/channel/schedule.js +1 -1
- package/dist/src/channel/session.d.ts +26 -4
- package/dist/src/channel/session.js +1 -1
- package/dist/src/chunks/{use-eve-agent-DMeP0JOF.js → use-eve-agent-B2jCfcnG.js} +3 -2
- package/dist/src/chunks/{use-eve-agent-DP5Rso9C.js → use-eve-agent-DCLFi26P.js} +3 -2
- package/dist/src/cli/commands/agent-prompt/collect-intent.md +2 -1
- package/dist/src/cli/commands/agent-prompt/scaffold.md +1 -2
- package/dist/src/cli/dev/tui/runner.d.ts +1 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/types.d.ts +5 -4
- package/dist/src/compiled/.vendor-stamp.json +4 -4
- package/dist/src/compiled/@vercel/schedules/index.d.ts +45 -6
- package/dist/src/compiled/@vercel/schedules/index.js +2 -2
- package/dist/src/context/keys.d.ts +7 -0
- package/dist/src/context/keys.js +1 -1
- package/dist/src/execution/agent-sessions/context.d.ts +5 -1
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/legacy-session/snapshot.d.ts +1 -2
- package/dist/src/execution/legacy-session/snapshot.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/public-destination.d.ts +3 -0
- package/dist/src/execution/public-destination.js +1 -1
- package/dist/src/execution/publish-session-events.js +1 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/answer-caller.d.ts +9 -5
- package/dist/src/execution/session/answer-caller.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.d.ts +16 -5
- package/dist/src/execution/session/checkpoint-migrations.js +1 -1
- package/dist/src/execution/session/checkpoint-refusal.d.ts +4 -0
- package/dist/src/execution/session/checkpoint-refusal.js +1 -0
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/handoff-steps.d.ts +7 -1
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/imported-conversation.d.ts +2 -0
- package/dist/src/execution/session/imported-conversation.js +1 -0
- package/dist/src/execution/session/interrupted-step.js +1 -1
- package/dist/src/execution/session/pre-v27-checkpoint.d.ts +36 -0
- package/dist/src/execution/session/pre-v27-checkpoint.js +1 -0
- package/dist/src/execution/session/principal.d.ts +8 -0
- package/dist/src/execution/session/principal.js +1 -1
- package/dist/src/execution/session/program.d.ts +2 -0
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session-callback-request.js +1 -1
- package/dist/src/execution/tool-auth.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/channel-to.d.ts +12 -0
- package/dist/src/execution/tools/channel-to.js +1 -0
- package/dist/src/execution/tools/workflow/body.d.ts +3 -0
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +5 -0
- package/dist/src/execution/tools/workflow/step-execution.js +1 -1
- package/dist/src/execution/tools/workflow/step.js +1 -1
- package/dist/src/execution/workflow-callback-url.d.ts +2 -3
- package/dist/src/execution/workflow-callback-url.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/attachment-staging.d.ts +2 -2
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/compaction/step.js +1 -1
- package/dist/src/harness/model-call/call.js +1 -1
- package/dist/src/harness/model-call/run.js +1 -1
- package/dist/src/harness/session-machine/transitions.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/attachments/limited-read.d.ts +2 -0
- package/dist/src/internal/attachments/limited-read.js +1 -1
- package/dist/src/internal/attachments/url-refs.js +1 -1
- package/dist/src/internal/capability-error.d.ts +3 -0
- package/dist/src/internal/capability-error.js +1 -0
- package/dist/src/internal/nitro/routes/schedule-collection-consumer.js +1 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/linq/inboundContent.js +1 -1
- package/dist/src/public/channels/slack/answers.d.ts +2 -3
- package/dist/src/public/channels/slack/answers.js +1 -1
- package/dist/src/public/channels/slack/api.d.ts +23 -3
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/app-manifest.d.ts +2 -0
- package/dist/src/public/channels/slack/app-manifest.js +1 -1
- package/dist/src/public/channels/slack/auth.d.ts +2 -1
- package/dist/src/public/channels/slack/auth.js +1 -1
- package/dist/src/public/channels/slack/code-channel.d.ts +42 -0
- package/dist/src/public/channels/slack/code-channel.js +1 -0
- package/dist/src/public/channels/slack/defaults.d.ts +7 -3
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/public/channels/slack/hitl.d.ts +7 -17
- package/dist/src/public/channels/slack/hitl.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +4 -3
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/interaction-cards.d.ts +0 -2
- package/dist/src/public/channels/slack/interaction-cards.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/open-code-channel.d.ts +30 -0
- package/dist/src/public/channels/slack/open-code-channel.js +1 -0
- package/dist/src/public/channels/slack/private-approval-delivery.d.ts +16 -4
- package/dist/src/public/channels/slack/private-approval-delivery.js +1 -1
- package/dist/src/public/channels/slack/renderers.d.ts +58 -6
- package/dist/src/public/channels/slack/renderers.js +1 -1
- package/dist/src/public/channels/slack/reply-delivery.d.ts +4 -0
- package/dist/src/public/channels/slack/reply-delivery.js +1 -1
- package/dist/src/public/channels/slack/request-card-render.d.ts +45 -0
- package/dist/src/public/channels/slack/request-card-render.js +1 -0
- package/dist/src/public/channels/slack/request-cards.d.ts +35 -0
- package/dist/src/public/channels/slack/request-cards.js +3 -0
- package/dist/src/public/channels/slack/sign-in-cancel.d.ts +3 -5
- package/dist/src/public/channels/slack/sign-in-cancel.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +109 -22
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/task-card.d.ts +3 -3
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/slack/thread-status.js +1 -1
- package/dist/src/public/channels/teams/api.js +1 -1
- package/dist/src/public/channels/teams/defaults.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/teams/verify.d.ts +9 -5
- package/dist/src/public/channels/teams/verify.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
- package/dist/src/public/schedules/providers/vercel.d.ts +2 -0
- package/dist/src/public/schedules/providers/vercel.js +1 -1
- package/dist/src/public/schedules/subscription.d.ts +10 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/setup/index.d.ts +1 -1
- package/dist/src/setup/primitives/index.d.ts +1 -1
- package/dist/src/setup/primitives/pm/run.d.ts +0 -2
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/channel-definition.d.ts +4 -4
- package/dist/src/subagents/adapter.js +1 -1
- package/dist/src/subagents/parent-notification.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/definition.d.ts +21 -0
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tools/workflow-definition.d.ts +4 -4
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +16 -3
- package/docs/channels/eve.mdx +3 -5
- package/docs/channels/linq.mdx +1 -1
- package/docs/channels/slack.mdx +185 -18
- package/docs/channels/teams.mdx +6 -2
- package/docs/concepts/project-structure.mdx +1 -1
- package/docs/concepts/security-model.md +4 -0
- package/docs/concepts/upgrade-to-v27-events.md +70 -2
- package/docs/experimental/dynamic-schedules.mdx +2 -2
- package/docs/getting-started.mdx +2 -0
- package/docs/guides/auth-and-route-protection.md +1 -0
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/deployment/self-hosting.md +1 -1
- package/docs/guides/frontend/meta.json +1 -0
- package/docs/guides/frontend/nextjs.mdx +329 -121
- package/docs/guides/frontend/overview.mdx +115 -335
- package/docs/guides/frontend/tanstack.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +5 -5
- package/docs/guides/frontend/use-eve-agent-vue.mdx +5 -5
- package/docs/guides/frontend/use-eve-agent.mdx +385 -0
- package/docs/guides/hooks.md +1 -1
- package/docs/guides/remote-agents.md +10 -0
- package/docs/guides/self-modification.md +6 -0
- package/docs/patterns/fork-conversations-into-new-threads.md +159 -0
- package/docs/patterns/meta.json +1 -0
- package/docs/reference/cli.md +1 -2
- package/docs/sandbox/index.mdx +1 -1
- package/docs/schedules.mdx +1 -1
- package/docs/tools/overview.mdx +34 -0
- package/docs/tools/workflows.mdx +47 -5
- package/package.json +13 -21
- package/CHANGELOG.md +0 -3076
- package/dist/src/public/channels/slack/approval-cards.d.ts +0 -25
- package/dist/src/public/channels/slack/approval-cards.js +0 -2
- package/dist/src/self-modification/agent.d.ts +0 -12
- package/dist/src/self-modification/agent.js +0 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Fork Conversations into a New Thread"
|
|
3
|
+
description: "Copy a conversation into a new thread from a tool, so each conversation continues on its own."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Forking copies a conversation into a new session in a new thread, such as a side thread in the same
|
|
7
|
+
channel or a thread in someone's direct messages. The new session starts with the conversation so
|
|
8
|
+
far. After the fork, each conversation continues on its own: a later message in one never reaches
|
|
9
|
+
the other.
|
|
10
|
+
|
|
11
|
+
A fork needs a target that always starts a new session. A Slack target with only a `channelId`
|
|
12
|
+
starts a new thread in any channel the app is in, or in a DM. Many other built-in channels reuse one
|
|
13
|
+
session per chat, so sending the transcript there adds it to the person's existing conversation
|
|
14
|
+
instead of forking.
|
|
15
|
+
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
Build the fork as a [tool](../tools) so the model decides when to call it. The tool does
|
|
19
|
+
three things:
|
|
20
|
+
|
|
21
|
+
1. **Identify the destination.** Start a new thread in the current channel, read from
|
|
22
|
+
`ctx.session.auth.current`, open a new direct conversation with the caller, or send a new
|
|
23
|
+
message elsewhere.
|
|
24
|
+
2. **Decide what context to seed the new session with.** Turn `ctx.messages`, the conversation the
|
|
25
|
+
model saw, into the text messages the new session should have access to.
|
|
26
|
+
3. **Start the forked session.** Call `ctx.to(channel, target).send(...)` with a first message and
|
|
27
|
+
the selected messages as `history`, the same call a route makes for a
|
|
28
|
+
[cross-channel hand-off](../channels/custom#cross-channel-hand-off). The channel's `receive` hook
|
|
29
|
+
maps the target to a new thread and session, and the message runs the fork's first turn.
|
|
30
|
+
|
|
31
|
+
## Fork into a new Slack thread
|
|
32
|
+
|
|
33
|
+
This tool lets someone in a Slack thread say "split this off into its own thread":
|
|
34
|
+
|
|
35
|
+
```ts title="agent/tools/fork_thread.ts"
|
|
36
|
+
import { isChannel } from "eve/channels";
|
|
37
|
+
import { defineTool, type ToolContext } from "eve/tools";
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
import slack from "../channels/slack";
|
|
40
|
+
|
|
41
|
+
export default defineTool({
|
|
42
|
+
description: "Continue this conversation in a new thread in the current Slack channel.",
|
|
43
|
+
inputSchema: z.object({}),
|
|
44
|
+
async execute(_input, ctx) {
|
|
45
|
+
if (!isChannel(ctx.channel, slack) || ctx.channel.metadata.channelId === null)
|
|
46
|
+
return { forked: false, reason: "This conversation is not in Slack." };
|
|
47
|
+
const { channelId } = ctx.channel.metadata;
|
|
48
|
+
const auth = ctx.session.auth.current;
|
|
49
|
+
|
|
50
|
+
const history = toHistory(ctx.messages);
|
|
51
|
+
const delivery = await ctx.to(slack, { channelId }).send("Continue this conversation here.", {
|
|
52
|
+
auth,
|
|
53
|
+
history,
|
|
54
|
+
idempotencyKey: `${ctx.session.id}:${ctx.callId}`,
|
|
55
|
+
});
|
|
56
|
+
return { forked: true, sessionId: delivery.sessionId };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function toHistory(messages: ToolContext["messages"]) {
|
|
61
|
+
return messages.flatMap((message) => {
|
|
62
|
+
if (message.role !== "user" && message.role !== "assistant") return [];
|
|
63
|
+
const text =
|
|
64
|
+
typeof message.content === "string"
|
|
65
|
+
? message.content
|
|
66
|
+
: message.content.flatMap((part) => (part.type === "text" ? [part.text] : [])).join("");
|
|
67
|
+
return text === "" ? [] : [{ role: message.role, text }];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`ctx.channel` is the channel serving the calling session, and `isChannel` narrows its `metadata`
|
|
73
|
+
to the Slack channel's, which includes the conversation's `channelId`. A call from anywhere else,
|
|
74
|
+
such as a schedule or another channel, gets `forked: false`.
|
|
75
|
+
|
|
76
|
+
A Slack target with only a `channelId` posts the agent's first reply as a new top-level message,
|
|
77
|
+
which becomes the fork's thread. Every call starts a new thread and session. To fork into a
|
|
78
|
+
different channel, pass that channel's id instead; the app must be a member of it.
|
|
79
|
+
|
|
80
|
+
People continue the fork under the channel's usual rules. By default, a reply in a channel thread
|
|
81
|
+
reaches the agent only when it mentions the app. See
|
|
82
|
+
[Continue conversations without repeated mentions](../channels/slack#continue-conversations-without-repeated-mentions)
|
|
83
|
+
to answer every reply in an active thread.
|
|
84
|
+
|
|
85
|
+
### Fork into direct messages
|
|
86
|
+
|
|
87
|
+
To move the conversation into the caller's DMs instead, open a direct conversation with their
|
|
88
|
+
Slack user id and use its channel id as the target:
|
|
89
|
+
|
|
90
|
+
```ts title="agent/tools/fork_to_dm.ts"
|
|
91
|
+
import { callSlackApi } from "eve/channels/slack";
|
|
92
|
+
|
|
93
|
+
// In execute(), replace the channelId lookup:
|
|
94
|
+
const auth = ctx.session.auth.current;
|
|
95
|
+
const userId = auth?.attributes.user_id;
|
|
96
|
+
if (!isChannel(ctx.channel, slack) || typeof userId !== "string")
|
|
97
|
+
return { forked: false, reason: "No Slack user to message." };
|
|
98
|
+
const channelId = await openDirectMessage(userId);
|
|
99
|
+
|
|
100
|
+
async function openDirectMessage(userId: string) {
|
|
101
|
+
const response = await callSlackApi({
|
|
102
|
+
botToken: process.env.SLACK_BOT_TOKEN,
|
|
103
|
+
operation: "conversations.open",
|
|
104
|
+
body: { users: userId },
|
|
105
|
+
});
|
|
106
|
+
if (!response.ok) throw new Error(`conversations.open failed: ${String(response.error)}`);
|
|
107
|
+
return (response.channel as { id: string }).id;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The caller's `user_id` comes from `auth.current`, not `ctx.channel.metadata.triggeringUserId`,
|
|
112
|
+
which is whoever started the thread.
|
|
113
|
+
|
|
114
|
+
`conversations.open` needs the `im:write` scope. The example reads `SLACK_BOT_TOKEN`. If your
|
|
115
|
+
channel uses Vercel Connect, pass the connector's `botToken` resolver to `callSlackApi` instead.
|
|
116
|
+
|
|
117
|
+
In the DM, the agent's first reply becomes a thread root, and replies in that thread continue the
|
|
118
|
+
fork. A new top-level DM starts a separate session. The built-in Slack DM handler answers without
|
|
119
|
+
a mention, and needs the `message.im` event and the `im:history` scope; see
|
|
120
|
+
[Message hooks](../channels/slack#message-hooks).
|
|
121
|
+
|
|
122
|
+
## What the new session sees
|
|
123
|
+
|
|
124
|
+
The fork's first model call sees the copied messages as earlier user and assistant turns, followed
|
|
125
|
+
by the message. `toHistory` keeps the text of user messages and assistant replies, including the
|
|
126
|
+
message that asked for the fork. It leaves out tool calls, files, and reasoning. `ctx.messages`
|
|
127
|
+
also carries eve's context messages, such as request context and recalled memory, and a tool can't
|
|
128
|
+
tell them apart from the conversation yet, so the fork sees them too. The fork's agent can repeat
|
|
129
|
+
anything in the copied history, so only fork into a channel whose members may see that
|
|
130
|
+
conversation, including a DM's. See [Start from prior history](../channels/eve#start-from-prior-history) for how history
|
|
131
|
+
joins a session.
|
|
132
|
+
|
|
133
|
+
After the fork, the original conversation and the fork are separate sessions:
|
|
134
|
+
|
|
135
|
+
- A message in the original thread reaches only its session.
|
|
136
|
+
- A message in the fork's thread reaches only the fork's session.
|
|
137
|
+
- Both keep the conversation from before the fork.
|
|
138
|
+
|
|
139
|
+
The fork runs the root agent with the auth you pass, here the caller's. Only a tool on the root
|
|
140
|
+
agent can fork: `ctx.to()` throws in a subagent, a root copy, or a remote agent call, since the
|
|
141
|
+
fork would outlive the delegation and act for the caller.
|
|
142
|
+
|
|
143
|
+
## Retries and repeated forks
|
|
144
|
+
|
|
145
|
+
Each call starts a new thread. A tool call that retries runs the tool again with the same
|
|
146
|
+
`ctx.callId`, so Slack maps the retry to the same thread and session, which gets the message once.
|
|
147
|
+
The key also chooses the Slack thread, so it has to be unique across every session that forks
|
|
148
|
+
into this channel, not only across retries. `ctx.callId` is unique only within one session, which
|
|
149
|
+
is why the key includes `ctx.session.id`.
|
|
150
|
+
To stop the model from forking the same conversation twice, say so in the tool's
|
|
151
|
+
`description`, or record each fork in your app and check for one before sending.
|
|
152
|
+
|
|
153
|
+
In a [workflow tool](../tools/workflows), call `ctx.to()` in a `"use step"` helper that receives
|
|
154
|
+
`ctx`, as you would `ctx.getSandbox()`.
|
|
155
|
+
|
|
156
|
+
## Fork from an earlier point
|
|
157
|
+
|
|
158
|
+
To leave out the latest turns, slice `ctx.messages` before converting it. `ctx.messages` reflects
|
|
159
|
+
history projection and compaction, so a long conversation arrives as the model last saw it.
|
package/docs/patterns/meta.json
CHANGED
package/docs/reference/cli.md
CHANGED
|
@@ -34,7 +34,7 @@ eve collects CLI telemetry by default to improve the command-line interface. Run
|
|
|
34
34
|
## `eve init`
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
eve init [target] [--model <provider/model-id>] [--reasoning <effort>] [--
|
|
37
|
+
eve init [target] [--model <provider/model-id>] [--reasoning <effort>] [--non-interactive]
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Creates a new agent app or adds an agent to an existing app. Always installs dependencies. New directories also initialize Git.
|
|
@@ -55,7 +55,6 @@ After scaffolding in an interactive human terminal, eve opens the TUI directly.
|
|
|
55
55
|
| ----------------------- | ------ | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
56
56
|
| `--model <model>` | string | `openai/gpt-6-luna-fast` | Set the root agent's AI Gateway model ID. |
|
|
57
57
|
| `--reasoning <effort>` | enum | `high` without `--model`; otherwise provider default | Set reasoning to `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`. `provider-default` leaves the field unauthored. |
|
|
58
|
-
| `--channel-web-nextjs` | flag | off | Add the Web Chat app (Next.js). Not for existing projects — run `eve add channel/web` there instead. |
|
|
59
58
|
| `-n, --non-interactive` | flag | off | Scaffold and install dependencies without starting development. |
|
|
60
59
|
|
|
61
60
|
## `eve extension`
|
package/docs/sandbox/index.mdx
CHANGED
|
@@ -69,7 +69,7 @@ export default defineSandbox(async ({ session }) => {
|
|
|
69
69
|
});
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
When a client prewarms a session, for example with `useEveAgent({ prewarm: true })`, eve runs the selector before the first message arrives. `session.auth` then describes the request that created the session, and the first message's `onMessage` hook can return a different identity. Do not derive per-user sandbox options or `defineState()` values from `session.auth` in an agent whose clients prewarm sessions: eve keeps both from the prewarming run. See [prewarming](/docs/guides/frontend/
|
|
72
|
+
When a client prewarms a session, for example with `useEveAgent({ prewarm: true })`, eve runs the selector before the first message arrives. `session.auth` then describes the request that created the session, and the first message's `onMessage` hook can return a different identity. Do not derive per-user sandbox options or `defineState()` values from `session.auth` in an agent whose clients prewarm sessions: eve keeps both from the prewarming run. See [prewarming](/docs/guides/frontend/use-eve-agent#prewarming) for when eve prewarms a session.
|
|
73
73
|
|
|
74
74
|
The environment export is required because `eve build` prepares immutable environment inputs before a session exists.
|
|
75
75
|
|
package/docs/schedules.mdx
CHANGED
|
@@ -81,7 +81,7 @@ export default defineSchedule({
|
|
|
81
81
|
|
|
82
82
|
Every run delivers the agent's reply to the channel. To skip a run when there is nothing to report, check that condition in the handler before calling `send`. When only the agent can tell, add the opt-in [`no_reply`](/docs/concepts/built-in-tools#no_reply) tool and ask the agent to call it when there is nothing to report; the run then posts nothing.
|
|
83
83
|
|
|
84
|
-
- `to(channel, target).send(message, { auth })`: starts a session on another channel. It has the same contract as a route handler's `ctx.to(...)` handle.
|
|
84
|
+
- `to(channel, target).send(message, { auth, ...options })`: starts a session on another channel. It has the same contract and [options](./channels/custom#cross-channel-hand-off) as a route handler's `ctx.to(...)` handle.
|
|
85
85
|
- `waitUntil(promise)`: extends the cron task's lifetime so the parked session and any in-flight fetches settle before the task ends. Wrap the `send` call in it.
|
|
86
86
|
- `appAuth`: the app principal (`{ authenticator: "app", principalId: "eve:app", principalType: "runtime" }`). Pass it as `to(...).send(..., { auth: appAuth })` for work the agent does on its own behalf.
|
|
87
87
|
|
package/docs/tools/overview.mdx
CHANGED
|
@@ -254,6 +254,8 @@ examples.
|
|
|
254
254
|
- `ctx.messages`: the model input for the step that requested this call, the same messages a [dynamic capability's](/docs/guides/dynamic-capabilities) `ctx.messages()` returns before that call.
|
|
255
255
|
- `ctx.abortSignal`: aborts when the active turn is cancelled. Pass it to cancellation-aware work; sandbox sessions from `ctx.getSandbox()` are already bound to it.
|
|
256
256
|
- `ctx.getSandbox()`: the live [sandbox](/docs/sandbox) handle.
|
|
257
|
+
- `ctx.channel`: the channel serving the session, as [hooks](/docs/guides/hooks) and [dynamic resolvers](/docs/guides/dynamic-capabilities) read it: `kind`, `continuationToken`, and `metadata`, what the channel's `metadata(state)` hook projects, such as a Slack thread's `channelId` and `threadTs`.
|
|
258
|
+
- `ctx.to(channel, target)`: starts or continues a session on one of the agent's channels. See [Start channel sessions](#start-channel-sessions-ctxto).
|
|
257
259
|
|
|
258
260
|
Running in the app runtime is what lets a tool import shared code from `lib/`, read `process.env`, and take part in eve’s durable pause/resume model.
|
|
259
261
|
|
|
@@ -261,6 +263,38 @@ eve never runs authored tools during discovery. The model sees descriptors first
|
|
|
261
263
|
|
|
262
264
|
Use operation-specific idempotency keys for external writes such as charges or emails. Approval records consent; it does not deduplicate an operation. See [Crash recovery](/docs/concepts/execution-model-and-durability#resuming-after-a-crash).
|
|
263
265
|
|
|
266
|
+
### Start channel sessions: `ctx.to`
|
|
267
|
+
|
|
268
|
+
`ctx.to(channel, target).send(message, options)` starts a session on one of the agent's channels, or continues the one at that target, through the channel's `receive` hook. It's the same call as a route handler's [cross-channel hand-off](/docs/channels/custom#cross-channel-hand-off), with the same [options](/docs/channels/custom#cross-channel-hand-off), and returns the delivery, whose `sessionId` names the session. Use it when the model decides that work should continue somewhere people can follow it, such as a new Slack thread:
|
|
269
|
+
|
|
270
|
+
```ts title="agent/tools/escalate.ts"
|
|
271
|
+
import { defineTool } from "eve/tools";
|
|
272
|
+
import { z } from "zod";
|
|
273
|
+
import slack from "../channels/slack";
|
|
274
|
+
|
|
275
|
+
export default defineTool({
|
|
276
|
+
description: "Hand this investigation to the on-call channel in Slack.",
|
|
277
|
+
inputSchema: z.object({ summary: z.string() }),
|
|
278
|
+
async execute({ summary }, ctx) {
|
|
279
|
+
const delivery = await ctx
|
|
280
|
+
.to(slack, { channelId: "C0123ABC" })
|
|
281
|
+
.send("Take over this investigation.", {
|
|
282
|
+
auth: ctx.session.auth.current,
|
|
283
|
+
history: [{ role: "user", text: summary }],
|
|
284
|
+
idempotencyKey: `${ctx.session.id}:${ctx.callId}`,
|
|
285
|
+
});
|
|
286
|
+
return { sessionId: delivery.sessionId };
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
- The session belongs to the channel. People on that channel continue it, it has no parent, and it keeps running after the tool returns.
|
|
292
|
+
- It runs the root agent with the `auth` you pass. Pass `ctx.session.auth.current` to start it as the caller.
|
|
293
|
+
- A tool call that retries runs the tool again. Pass `` idempotencyKey: `${ctx.session.id}:${ctx.callId}` ``, and the session at the target gets the message once. The destination session dedupes keys from every sender, and `ctx.callId` alone is unique only within the calling session, so include the session id. Built-in channels map a retry to the same session, including a Slack target with only a `channelId`. A platform post made before the session exists, such as an `initialMessage`, repeats.
|
|
294
|
+
- `ctx.to()` throws in a delegated session: a subagent, a root copy, or a remote agent call. A session it started would outlive the delegation and act for the caller, so return the result and send from a tool on the root agent.
|
|
295
|
+
|
|
296
|
+
See [Fork conversations into a new thread](/docs/patterns/fork-conversations-into-new-threads) for a tool that copies the current conversation into a new Slack thread.
|
|
297
|
+
|
|
264
298
|
## When a tool throws
|
|
265
299
|
|
|
266
300
|
If an authored tool's `execute` function throws, eve records the call as `call.settled` with `outcome: "failed"` and gives the error to the model as a tool error. The model can respond, choose another action, or call the tool again. eve does not automatically call the tool again based on the exception type, an upstream HTTP status, or a `retryable` property.
|
package/docs/tools/workflows.mdx
CHANGED
|
@@ -85,14 +85,14 @@ or days later, the run resumes, deploys, and returns. The model sees one tool re
|
|
|
85
85
|
`start`, `getRun`, and `resumeHook` from `workflow/api` belong in steps. Your app does not install
|
|
86
86
|
the SDK; for types, new projects list `eve/workflow-modules` in the tsconfig `types`.
|
|
87
87
|
- In an `execute` or `task` body, `ctx` is a `WorkflowToolContext` with `session`, `callId`,
|
|
88
|
-
`toolName`, `abortSignal`, `agent`, `agents`, and `ask`. A `serve` body gets a
|
|
89
|
-
`WorkflowServeContext` with `session`, `toolName`,
|
|
88
|
+
`toolName`, `abortSignal`, `channel`, `agent`, `agents`, and `ask`. A `serve` body gets a
|
|
89
|
+
`WorkflowServeContext` with `session`, `toolName`, `channel`,
|
|
90
90
|
`agent`, `agents`, `ask`, and `reply`; each call it receives carries its own `callId` and
|
|
91
91
|
`abortSignal`.
|
|
92
92
|
A `"use step"` helper that receives `ctx` directly gets a restricted `WorkflowStepToolContext` with
|
|
93
|
-
`session`, `callId`, `toolName`, `abortSignal`, `getSandbox`, `getToken`, and `
|
|
94
|
-
`ctx.agent()
|
|
95
|
-
Call `getSandbox`, `getToken`, and `
|
|
93
|
+
`session`, `callId`, `toolName`, `abortSignal`, `channel`, `getSandbox`, `getToken`, `requireAuth`, and `to`. Read `ctx.agents`, and call
|
|
94
|
+
`ctx.agent()` and `ctx.ask()` in the workflow body; pass only the serializable values the step needs.
|
|
95
|
+
Call `getSandbox`, `getToken`, `requireAuth`, and `to` in a step: the workflow body throws when it calls them.
|
|
96
96
|
- The tool's input must be a JSON object. Workflow bodies are for static tools under `agent/tools/`,
|
|
97
97
|
not tools a `defineDynamic` function returns.
|
|
98
98
|
|
|
@@ -782,6 +782,48 @@ When an authored tool accepts a JSON Schema supplied by the model, represent tha
|
|
|
782
782
|
|
|
783
783
|
This pattern controls specialist selection, not whether the parent model delegates at all. Route before the parent model runs if every incoming request must go through Jev.
|
|
784
784
|
|
|
785
|
+
## Start channel sessions: `ctx.to`
|
|
786
|
+
|
|
787
|
+
A workflow tool reaches the agent's channels with [`ctx.to(channel, target)`](/docs/tools#start-channel-sessions-ctxto), as an ordinary tool does. Call it in a `"use step"` helper that receives `ctx`, like `ctx.getSandbox()`; the workflow body throws when it calls it:
|
|
788
|
+
|
|
789
|
+
```ts title="agent/tools/open_incident_channel.ts"
|
|
790
|
+
import { defineWorkflowTool, type WorkflowStepToolContext } from "eve/tools";
|
|
791
|
+
import { z } from "zod";
|
|
792
|
+
import slack from "../channels/slack";
|
|
793
|
+
import { createIncidentChannel } from "../lib/incidents";
|
|
794
|
+
|
|
795
|
+
export default defineWorkflowTool({
|
|
796
|
+
description: "Open a Slack channel for an incident and continue the investigation there.",
|
|
797
|
+
inputSchema: z.object({ title: z.string(), summary: z.string() }),
|
|
798
|
+
async task({ title, summary }, ctx) {
|
|
799
|
+
"use workflow";
|
|
800
|
+
const channelId = await createChannel(title);
|
|
801
|
+
return await openIncident(ctx, channelId, summary);
|
|
802
|
+
},
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
async function createChannel(title: string) {
|
|
806
|
+
"use step";
|
|
807
|
+
return await createIncidentChannel(title);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
async function openIncident(ctx: WorkflowStepToolContext, channelId: string, summary: string) {
|
|
811
|
+
"use step";
|
|
812
|
+
const delivery = await ctx
|
|
813
|
+
.to(slack, { channelId })
|
|
814
|
+
.send("Continue the investigation in this channel.", {
|
|
815
|
+
auth: ctx.session.auth.current,
|
|
816
|
+
history: [{ role: "user", text: summary }],
|
|
817
|
+
idempotencyKey: `${ctx.session.id}:${ctx.callId}:incident`,
|
|
818
|
+
});
|
|
819
|
+
return { channelId, sessionId: delivery.sessionId };
|
|
820
|
+
}
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
A step that fails retries, so pass an `idempotencyKey` the retry repeats. The destination session dedupes keys from every sender, and `ctx.callId` is unique only within the calling session and is the same for every step of the call, so include `ctx.session.id` and add a label for each send. Create the channel in its own step: a retried send step then reuses the recorded `channelId` instead of creating another channel.
|
|
824
|
+
|
|
825
|
+
`ctx.channel` holds the `kind`, `continuationToken`, and `metadata` of the channel serving the calling session, in the workflow body and in steps, as in [ordinary tools](/docs/tools#the-ctx-parameter).
|
|
826
|
+
|
|
785
827
|
## Report progress: `yield`
|
|
786
828
|
|
|
787
829
|
A workflow body may be an async generator whose yields report progress. After processing a yield,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"bin",
|
|
39
39
|
"dist",
|
|
40
40
|
"docs",
|
|
41
|
-
"CHANGELOG.md",
|
|
42
41
|
"NOTICE",
|
|
43
42
|
"README.md"
|
|
44
43
|
],
|
|
@@ -483,12 +482,6 @@
|
|
|
483
482
|
"default": "./dist/src/public/channels/linear/index.js"
|
|
484
483
|
},
|
|
485
484
|
"./package.json": "./package.json",
|
|
486
|
-
"./internal/self-modification/agent": {
|
|
487
|
-
"eve-source": "./dist/src/self-modification/agent.js",
|
|
488
|
-
"types": "./dist/src/self-modification/agent.d.ts",
|
|
489
|
-
"import": "./dist/src/self-modification/agent.js",
|
|
490
|
-
"default": "./dist/src/self-modification/agent.js"
|
|
491
|
-
},
|
|
492
485
|
"./internal/self-modification/sandbox": {
|
|
493
486
|
"eve-source": "./dist/src/self-modification/sandbox.js",
|
|
494
487
|
"types": "./dist/src/self-modification/sandbox.d.ts",
|
|
@@ -611,7 +604,7 @@
|
|
|
611
604
|
"@types/json-schema": "7.0.15",
|
|
612
605
|
"@types/react": "19.2.15",
|
|
613
606
|
"@types/react-test-renderer": "19.1.0",
|
|
614
|
-
"@vercel/agent-runs": "0.0.
|
|
607
|
+
"@vercel/agent-runs": "0.0.2",
|
|
615
608
|
"@vercel/blob": "2.8.0",
|
|
616
609
|
"@vercel/connect": "2.5.2",
|
|
617
610
|
"@vercel/detect-agent": "1.2.3",
|
|
@@ -619,7 +612,7 @@
|
|
|
619
612
|
"@vercel/otel": "2.1.3",
|
|
620
613
|
"@vercel/queue": "0.5.1",
|
|
621
614
|
"@vercel/sandbox": "3.9.0",
|
|
622
|
-
"@vercel/schedules": "0.0.0-alpha.
|
|
615
|
+
"@vercel/schedules": "0.0.0-alpha.19",
|
|
623
616
|
"@vercel/sdk": "1.28.8",
|
|
624
617
|
"@workflow/core": "5.2.3",
|
|
625
618
|
"@workflow/errors": "5.0.5",
|
|
@@ -741,22 +734,21 @@
|
|
|
741
734
|
},
|
|
742
735
|
"scripts": {
|
|
743
736
|
"clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
744
|
-
"build": "pnpm run check:bin-runtime-dependencies &&
|
|
737
|
+
"build": "pnpm run check:bin-runtime-dependencies && node ./scripts/build-js.mjs && node ./scripts/copy-docs.mjs && node ./scripts/stamp-version-tokens.mjs",
|
|
745
738
|
"build:compiled": "node ./scripts/vendor-compiled.mjs",
|
|
746
739
|
"build:js": "node ./scripts/build-js.mjs",
|
|
747
|
-
"build:types": "
|
|
740
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
748
741
|
"check:bin-runtime-dependencies": "node ./scripts/check-bin-runtime-dependencies.mjs",
|
|
749
742
|
"dev": "pnpm run build:compiled && node ./scripts/copy-runtime-assets.mjs && tsc -p tsconfig.dev.json --watch --preserveWatchOutput",
|
|
750
|
-
"test": "
|
|
751
|
-
"test:
|
|
752
|
-
"test:
|
|
753
|
-
"test:
|
|
754
|
-
"test:
|
|
755
|
-
"test:
|
|
756
|
-
"
|
|
757
|
-
"typecheck": "pnpm run check:web-template && pnpm run build:compiled && tsc -p tsconfig.json --noEmit",
|
|
743
|
+
"test:webchat": "vitest run --config vitest.browser.config.ts",
|
|
744
|
+
"test:framework-fixtures": "vitest run --config vitest.framework-fixtures.config.ts",
|
|
745
|
+
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
746
|
+
"test:scenario": "vitest run --config vitest.scenario.config.ts",
|
|
747
|
+
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
748
|
+
"test:watch": "vitest --config vitest.unit.config.ts",
|
|
749
|
+
"typecheck": "pnpm run check:web-template && tsc -p tsconfig.json --noEmit",
|
|
758
750
|
"generate:web-template": "node src/setup/build.ts --write",
|
|
759
751
|
"check:web-template": "node src/setup/build.ts --check",
|
|
760
|
-
"test:tui": "
|
|
752
|
+
"test:tui": "tsc -p tsconfig.tui.json --noEmit && node test/tui-client/run-all.mjs"
|
|
761
753
|
}
|
|
762
754
|
}
|