eve 0.34.0 → 0.35.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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/dist/src/chunks/{use-eve-agent-BNdcle_M.js → use-eve-agent-COmP-H8R.js} +6 -3
- package/dist/src/chunks/{use-eve-agent-FJkEMXYk.js → use-eve-agent-CnppTEFk.js} +6 -3
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/commands/trace-detail.d.ts +3 -2
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +4 -6
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -2
- package/dist/src/client/agent-info-schema.d.ts +12 -4
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/index.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/@chat-adapter/slack/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +1 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +92 -35
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -2
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +25 -23
- package/dist/src/compiled/@workflow/world/queue.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +53 -0
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +36 -1
- package/dist/src/compiled/@workflow/world/steps.d.ts +4 -0
- package/dist/src/compiled/@workflow/world/ulid.d.ts +6 -0
- package/dist/src/compiled/@workflow/world-local/index.js +4 -4
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -17
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-6OqdYdi4.js → attribute-changes-BoH7JsWp.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-DlFv0aHY.js +40 -0
- package/dist/src/compiled/_chunks/workflow/env-config-DxamfI7T.js +1 -0
- package/dist/src/compiled/_chunks/workflow/frames-CTpeJYEQ.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{functions-CXb61C6h.js → functions-CeeNvKsq.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BPQHjeY5.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DQ5dOyjm.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +1 -0
- package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-CUIybhQ2.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-DK2lnH6U.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{wrapper-CDq65xJV.js → wrapper-CMGju7QA.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport-Csi6Cydc.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +8 -8
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-extension.d.ts +3 -3
- package/dist/src/compiler/normalize-extension.js +1 -1
- package/dist/src/compiler/normalize-instructions.d.ts +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -3
- package/dist/src/context/dynamic-instruction-lifecycle.d.ts +5 -1
- package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +6 -2
- package/dist/src/context/keys.js +1 -1
- package/dist/src/discover/manifest.d.ts +1 -1
- package/dist/src/discover/manifest.js +1 -1
- package/dist/src/evals/index.d.ts +2 -2
- package/dist/src/evals/reporters/index.d.ts +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +5 -0
- package/dist/src/evals/runner/execute-eval.js +1 -1
- package/dist/src/evals/runner/execute-task.d.ts +3 -0
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/types.d.ts +28 -2
- package/dist/src/evals/runner/run-evals.js +1 -1
- package/dist/src/evals/session.d.ts +11 -2
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +10 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-trace-context.d.ts +11 -0
- package/dist/src/execution/workflow-trace-context.js +1 -0
- package/dist/src/harness/ai-sdk-hook-bridge.d.ts +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
- package/dist/src/harness/emission.d.ts +2 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/instrumentation/config.js +1 -0
- package/dist/src/harness/{instrumentation-content.d.ts → instrumentation/content.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.d.ts → instrumentation/dispatch.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-dispatch.js → instrumentation/dispatch.js} +1 -1
- package/dist/src/harness/{instrumentation-lifecycle.d.ts → instrumentation/lifecycle.d.ts} +3 -6
- package/dist/src/harness/{instrumentation-lifecycle.js → instrumentation/lifecycle.js} +1 -1
- package/dist/src/harness/{instrumentation-native-events.d.ts → instrumentation/native-events.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-native-events.js → instrumentation/native-events.js} +1 -1
- package/dist/src/harness/{instrumentation-providers.d.ts → instrumentation/providers.d.ts} +1 -1
- package/dist/src/harness/{instrumentation-providers.js → instrumentation/providers.js} +1 -1
- package/dist/src/harness/{instrumentation-runtime.d.ts → instrumentation/runtime.d.ts} +4 -2
- package/dist/src/harness/{instrumentation-state.d.ts → instrumentation/state.d.ts} +1 -1
- package/dist/src/harness/parent-lineage.d.ts +1 -1
- package/dist/src/harness/prepare-trace-context.d.ts +16 -0
- package/dist/src/harness/prepare-trace-context.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.d.ts +3 -3
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/instrumentation.d.ts +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +4 -3
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/vercel/project-link.d.ts +1 -1
- package/dist/src/internal/vercel/project-link.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +10 -9
- package/dist/src/internal/vercel-agent-summary.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/protocol/message.d.ts +15 -1
- package/dist/src/protocol/message.js +1 -1
- package/dist/src/public/channels/github/auth.d.ts +30 -0
- package/dist/src/public/channels/github/auth.js +2 -2
- package/dist/src/public/channels/github/defaults.d.ts +4 -4
- package/dist/src/public/channels/github/defaults.js +1 -1
- package/dist/src/public/channels/github/dispatch.d.ts +3 -2
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +7 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/index.d.ts +1 -1
- package/dist/src/public/definitions/instructions.d.ts +14 -4
- package/dist/src/public/definitions/instructions.js +1 -1
- package/dist/src/public/definitions/tool.d.ts +5 -8
- package/dist/src/public/instructions/index.d.ts +1 -2
- package/dist/src/public/instructions/index.js +1 -1
- package/dist/src/public/instrumentation/index.d.ts +4 -3
- package/dist/src/public/instrumentation/otel.d.ts +5 -4
- package/dist/src/public/instrumentation/provider.d.ts +2 -2
- package/dist/src/runtime/agent/bootstrap.d.ts +2 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/prompt/compose.d.ts +1 -1
- package/dist/src/runtime/prompt/compose.js +3 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/types.d.ts +4 -3
- package/dist/src/setup/project-resolution.d.ts +3 -3
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.d.ts +0 -9
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slackbot.d.ts +2 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/shared/dynamic-tool-definition.d.ts +3 -4
- package/dist/src/shared/instructions-definition.d.ts +15 -11
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +4 -2
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.d.ts +17 -0
- package/dist/src/tracing/agent-otel-session-context.js +1 -0
- package/dist/src/tracing/agent-otel-usage.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +1 -1
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -2
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-traces.d.ts +3 -3
- package/dist/src/tracing/local-traces.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +2 -2
- package/dist/src/tracing/otel-declaration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +18 -20
- package/docs/agent-config.md +5 -5
- package/docs/channels/eve.mdx +10 -56
- package/docs/channels/github.mdx +1 -1
- package/docs/channels/meta.json +1 -0
- package/docs/concepts/context-control.md +32 -56
- package/docs/concepts/default-harness.md +2 -2
- package/docs/concepts/execution-model-and-durability.mdx +4 -4
- package/docs/concepts/meta.json +3 -1
- package/docs/concepts/sessions-runs-and-streaming.md +22 -10
- package/docs/{guides → concepts}/state.md +3 -3
- package/docs/connections/mcp.mdx +6 -89
- package/docs/connections/meta.json +1 -0
- package/docs/connections/openapi.mdx +5 -69
- package/docs/connections/overview.mdx +29 -3
- package/docs/evals/meta.json +1 -0
- package/docs/evals/reporters.mdx +14 -4
- package/docs/extensions.md +1 -1
- package/docs/getting-started.mdx +175 -13
- package/docs/guides/auth-and-route-protection.md +3 -18
- package/docs/guides/client/meta.json +2 -1
- package/docs/guides/client/output-schema.mdx +2 -2
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/deployment/meta.json +1 -0
- package/docs/guides/deployment/overview.md +1 -1
- package/docs/guides/deployment/self-hosting.md +3 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/dev-tui.md +3 -13
- package/docs/guides/dynamic-capabilities.md +26 -4
- package/docs/guides/frontend/meta.json +2 -1
- package/docs/guides/frontend/nextjs.mdx +1 -10
- package/docs/guides/frontend/nuxt.mdx +1 -10
- package/docs/guides/frontend/overview.mdx +12 -3
- package/docs/guides/frontend/sveltekit.mdx +1 -10
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +39 -126
- package/docs/guides/frontend/use-eve-agent-vue.mdx +40 -139
- package/docs/guides/instrumentation.md +15 -15
- package/docs/guides/meta.json +1 -5
- package/docs/guides/remote-agents.md +9 -9
- package/docs/guides/session-context.md +34 -103
- package/docs/install-integrations.mdx +1 -1
- package/docs/instructions.mdx +45 -12
- package/docs/meta.json +24 -13
- package/docs/patterns/dynamic-scheduling.md +1 -1
- package/docs/patterns/meta.json +1 -0
- package/docs/patterns/multi-tenant-approvals.md +1 -1
- package/docs/patterns/multi-tenant-auth.md +1 -1
- package/docs/patterns/multi-tenant-memory.md +4 -3
- package/docs/{guides → protocols}/acp.md +1 -1
- package/docs/protocols/meta.json +5 -0
- package/docs/reference/cli.md +34 -34
- package/docs/reference/meta.json +1 -1
- package/docs/reference/typescript-api.md +4 -2
- package/docs/{subagents.mdx → subagents/index.mdx} +2 -2
- package/docs/subagents/meta.json +5 -0
- package/docs/{guides/dynamic-workflows.md → subagents/workflow-tool.md} +6 -6
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tools/meta.json +1 -0
- package/docs/tools/overview.mdx +1 -1
- package/docs/tutorial/connect-a-warehouse.mdx +1 -1
- package/docs/tutorial/meta.json +1 -0
- package/docs/tutorial/remember-definitions.mdx +2 -2
- package/docs/tutorial/ship-it.mdx +2 -2
- package/package.json +4 -4
- package/dist/src/compiled/_chunks/workflow/dist-C8PhDW9B.js +0 -1
- package/dist/src/compiled/_chunks/workflow/functions-xMPAeWFr.js +0 -1
- package/dist/src/compiled/_chunks/workflow/node-Smb57EnG.js +0 -40
- package/dist/src/compiled/_chunks/workflow/resume-hook-BrduAuFX.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-CX7_sJnW.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-tsb2HjWK.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-BNc_0O4m.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BYKVqrwc.js +0 -15
- package/dist/src/harness/instrumentation-config.js +0 -1
- package/docs/installation.mdx +0 -66
- package/docs/project-structure.mdx +0 -53
- package/docs/reference/project-layout.md +0 -123
- /package/dist/src/harness/{instrumentation-config.d.ts → instrumentation/config.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-content.js → instrumentation/content.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.d.ts → instrumentation/runtime-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-runtime-context.js → instrumentation/runtime-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-runtime.js → instrumentation/runtime.js} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.d.ts → instrumentation/setup-context.d.ts} +0 -0
- /package/dist/src/harness/{instrumentation-setup-context.js → instrumentation/setup-context.js} +0 -0
- /package/dist/src/harness/{instrumentation-state.js → instrumentation/state.js} +0 -0
- /package/docs/{guides → protocols}/ucp.mdx +0 -0
|
@@ -1,94 +1,66 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "useEveAgent (Vue)"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use the eve Vue composable and its Vue-specific reactive interface."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
`useEveAgent()` from `eve/vue`
|
|
6
|
+
`useEveAgent()` from `eve/vue` exposes the shared eve frontend client as Vue computed refs and methods. Read the [frontend overview](./overview) for session behavior, messages, human input, authorization, callbacks, reducers, and persistence. This page covers the Vue-specific interface.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Import the composable from `eve/vue`. Its state is exposed as `ComputedRef`s, so you read it unwrapped in templates:
|
|
11
|
-
|
|
12
|
-
```vue
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
import { useEveAgent } from "eve/vue";
|
|
15
|
-
|
|
16
|
-
const { data } = useEveAgent();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
<div v-for="message in data.messages" :key="message.id">
|
|
21
|
-
<p>{{ message.role }}: {{ message.parts }}</p>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
```
|
|
8
|
+
Nuxt users normally receive the composable as an auto-import after registering the [`eve/nuxt` module](./nuxt).
|
|
25
9
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
| Property | Type | Description |
|
|
29
|
-
| --------- | ---------------------------------------------- | ------------------------------------------------------------------------- |
|
|
30
|
-
| `data` | `ComputedRef<TData>` | Projected state. With the default reducer, `EveMessageData` (`messages`). |
|
|
31
|
-
| `status` | `ComputedRef<UseEveAgentStatus>` | `"ready"`, `"submitted"`, `"streaming"`, or `"error"`. |
|
|
32
|
-
| `error` | `ComputedRef<Error \| undefined>` | Last transport-level error. |
|
|
33
|
-
| `events` | `ComputedRef<readonly MessageStreamEvent[]>` | Raw server events for this session. |
|
|
34
|
-
| `session` | `ComputedRef<ClientSessionState \| undefined>` | Fixed session ID and stream cursor. |
|
|
35
|
-
| `send` | `(message, options?) => Promise<void>` | Send text or a multi-part message. |
|
|
36
|
-
| `respond` | `(inputResponses, options?) => Promise<void>` | Answer pending HITL input requests. |
|
|
37
|
-
| `stop` | `() => void` | Abort the client's in-flight stream. |
|
|
38
|
-
| `reset` | `() => void` | Clear state and start a new session. |
|
|
10
|
+
## Basic usage
|
|
39
11
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Send a message
|
|
12
|
+
Import the composable from `eve/vue`. Its state is exposed as `ComputedRef`s, so templates unwrap it automatically:
|
|
43
13
|
|
|
44
14
|
```vue
|
|
45
15
|
<script setup lang="ts">
|
|
46
|
-
import { ref } from "vue";
|
|
47
16
|
import { useEveAgent } from "eve/vue";
|
|
17
|
+
import { computed, ref } from "vue";
|
|
48
18
|
|
|
49
|
-
const { send } = useEveAgent();
|
|
19
|
+
const { data, status, send } = useEveAgent();
|
|
50
20
|
const message = ref("");
|
|
21
|
+
const isBusy = computed(() => status.value === "submitted" || status.value === "streaming");
|
|
51
22
|
|
|
52
23
|
async function handleSubmit() {
|
|
53
24
|
const text = message.value.trim();
|
|
54
|
-
if (!text) return;
|
|
25
|
+
if (!text || isBusy.value) return;
|
|
55
26
|
message.value = "";
|
|
56
27
|
await send(text);
|
|
57
28
|
}
|
|
58
29
|
</script>
|
|
59
30
|
|
|
60
31
|
<template>
|
|
32
|
+
<div v-for="item in data.messages" :key="item.id">
|
|
33
|
+
<p>{{ item.role }}: {{ item.parts }}</p>
|
|
34
|
+
</div>
|
|
61
35
|
<form @submit.prevent="handleSubmit">
|
|
62
|
-
<input v-model="message"
|
|
63
|
-
<button type="submit">Send</button>
|
|
36
|
+
<input v-model="message" :disabled="isBusy" />
|
|
37
|
+
<button type="submit" :disabled="isBusy">Send</button>
|
|
64
38
|
</form>
|
|
65
39
|
</template>
|
|
66
40
|
```
|
|
67
41
|
|
|
68
|
-
|
|
42
|
+
## What it returns
|
|
69
43
|
|
|
70
|
-
|
|
71
|
-
<script setup lang="ts">
|
|
72
|
-
import { useEveAgent } from "eve/vue";
|
|
44
|
+
The state fields are computed refs; the commands are ordinary methods:
|
|
73
45
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
46
|
+
| Property | Vue shape |
|
|
47
|
+
| ---------------------------------- | ---------------------------------------------- |
|
|
48
|
+
| `data` | `ComputedRef<TData>` |
|
|
49
|
+
| `status` | `ComputedRef<UseEveAgentStatus>` |
|
|
50
|
+
| `error` | `ComputedRef<Error \| undefined>` |
|
|
51
|
+
| `events` | `ComputedRef<readonly MessageStreamEvent[]>` |
|
|
52
|
+
| `session` | `ComputedRef<ClientSessionState \| undefined>` |
|
|
53
|
+
| `send`, `respond`, `stop`, `reset` | Methods |
|
|
54
|
+
|
|
55
|
+
Destructuring preserves reactivity because each state value remains a ref. Read refs with `.value` in `<script>` and without `.value` in a template. The [shared returned-state reference](./overview#returned-state) describes what each value and command does.
|
|
56
|
+
|
|
57
|
+
## Send a message
|
|
58
|
+
|
|
59
|
+
Call `send(text)` for text or pass content parts for attachments. The API and transport behavior match the [shared sending guide](./overview#sending-and-streaming); only reactive access differs in Vue.
|
|
88
60
|
|
|
89
61
|
## Human-in-the-loop prompts
|
|
90
62
|
|
|
91
|
-
|
|
63
|
+
Pending requests appear in `data.value.messages`. Use the Vue exports when narrowing message parts, then answer through `respond()`:
|
|
92
64
|
|
|
93
65
|
```vue
|
|
94
66
|
<script setup lang="ts">
|
|
@@ -132,101 +104,30 @@ const pendingRequests = computed(() =>
|
|
|
132
104
|
</template>
|
|
133
105
|
```
|
|
134
106
|
|
|
135
|
-
|
|
107
|
+
See [Human-in-the-loop prompts](./overview#human-in-the-loop-prompts) for request semantics and rendering guidance.
|
|
136
108
|
|
|
137
109
|
## Stop, reset, and resume
|
|
138
110
|
|
|
139
|
-
`stop()`
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
const agent = useEveAgent({
|
|
143
|
-
initialSession: savedSessionState,
|
|
144
|
-
initialEvents: savedEvents,
|
|
145
|
-
onSessionChange: (session) => {
|
|
146
|
-
localStorage.setItem("eve-session", JSON.stringify(session));
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
```
|
|
111
|
+
Call `stop()` to detach the browser stream without cancelling server-side work, and `reset()` to clear local state and start a new session. Pass `initialSession` and `initialEvents` to restore a saved conversation. See [Resumable sessions](./overview#resumable-sessions) for the persistence contract and [Sending and streaming](./overview#sending-and-streaming) for cancellation behavior.
|
|
150
112
|
|
|
151
113
|
## Custom host and credentials
|
|
152
114
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```ts
|
|
156
|
-
const agent = useEveAgent({
|
|
157
|
-
host: "https://agent.example.com",
|
|
158
|
-
headers: async () => ({
|
|
159
|
-
authorization: `Bearer ${await getAccessToken()}`,
|
|
160
|
-
}),
|
|
161
|
-
});
|
|
162
|
-
```
|
|
115
|
+
Pass `host`, `auth`, or `headers` to the composable using the same options as the other frontend bindings. See [Custom hosts and headers](./overview#custom-hosts-and-headers).
|
|
163
116
|
|
|
164
117
|
## Attach page context per turn
|
|
165
118
|
|
|
166
|
-
`clientContext`
|
|
167
|
-
|
|
168
|
-
```ts
|
|
169
|
-
await send("What should I do on this screen?", {
|
|
170
|
-
clientContext: { route: "/billing", plan: "pro", seatsUsed: 4 },
|
|
171
|
-
});
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
To attach the same context to every turn without threading it through each call site, pass `prepareSend`. It runs right before each send and returns the (possibly augmented) turn:
|
|
175
|
-
|
|
176
|
-
```ts
|
|
177
|
-
const agent = useEveAgent({
|
|
178
|
-
prepareSend: (input) => ({
|
|
179
|
-
...input,
|
|
180
|
-
clientContext: { route: location.pathname },
|
|
181
|
-
}),
|
|
182
|
-
});
|
|
183
|
-
```
|
|
119
|
+
Pass `clientContext` to `send()` or `respond()`, or use `prepareSend` to add context before every turn. See [Attach page context per turn](./overview#attach-page-context-per-turn).
|
|
184
120
|
|
|
185
121
|
## Lifecycle callbacks
|
|
186
122
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- `onEvent(event)`: fires for each eve stream event as it arrives.
|
|
190
|
-
- `onError(error)`: fires with the last `Error` when a turn fails.
|
|
191
|
-
- `onFinish(snapshot)`: fires with the final snapshot once a turn settles.
|
|
192
|
-
- `onSessionChange(session)`: fires when the session cursor advances. Persist it to resume across reloads.
|
|
193
|
-
|
|
194
|
-
```ts
|
|
195
|
-
const agent = useEveAgent({
|
|
196
|
-
onEvent: (event) => console.debug(event.type),
|
|
197
|
-
onError: (error) => console.error(error.message),
|
|
198
|
-
onFinish: (snapshot) => console.log(snapshot.status),
|
|
199
|
-
});
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
The `optimistic` option (default `true`) projects submitted user messages into `data` before eve confirms them with a `message.received` event. These are reducer-facing projection events only; `events` stays the authoritative eve stream.
|
|
123
|
+
Pass `onEvent`, `onError`, `onFinish`, or `onSessionChange` when the application needs lifecycle notifications. See [Lifecycle callbacks](./overview#lifecycle-callbacks) for callback timing and optimistic projection behavior.
|
|
203
124
|
|
|
204
125
|
## Custom reducer
|
|
205
126
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
```ts
|
|
209
|
-
import { useEveAgent } from "eve/vue";
|
|
210
|
-
import type { EveAgentReducer } from "eve/vue";
|
|
211
|
-
|
|
212
|
-
interface ToolLog {
|
|
213
|
-
readonly toolCalls: number;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const toolCounter: EveAgentReducer<ToolLog> = {
|
|
217
|
-
initial: () => ({ toolCalls: 0 }),
|
|
218
|
-
reduce: (data, event) =>
|
|
219
|
-
event.type === "actions.requested" ? { toolCalls: data.toolCalls + 1 } : data,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
const agent = useEveAgent({ reducer: toolCounter });
|
|
223
|
-
// agent.data.value is ToolLog
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
`reduce(data, event)` receives both authoritative eve stream events and client projection events (`client.message.submitted`, `client.message.failed`, `client.input.responded`). Handle the client events too if you want optimistic and HITL state in your projection. Otherwise, return `data` unchanged for them.
|
|
127
|
+
Import `EveAgentReducer` from `eve/vue` when projecting events into application-specific state. The resulting `data` remains a `ComputedRef<TData>`. See [Custom reducer](./overview#custom-reducer) for the reducer contract and client projection events.
|
|
227
128
|
|
|
228
129
|
## What to read next
|
|
229
130
|
|
|
230
|
-
- [Nuxt](./nuxt): module
|
|
231
|
-
- [Frontend overview](./overview): the shared
|
|
232
|
-
- [Sessions, runs
|
|
131
|
+
- [Nuxt](./nuxt): register the module and mount the eve runtime.
|
|
132
|
+
- [Frontend overview](./overview): use the shared frontend API.
|
|
133
|
+
- [Sessions, runs, and streaming](../../concepts/sessions-runs-and-streaming): understand the underlying session protocol.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
2
|
+
title: "Observability"
|
|
3
3
|
description: "Trace an agent with OpenTelemetry in instrumentation.ts, read the workflow run tags eve emits, and debug discovery with eve info and the common-failures table."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -48,11 +48,11 @@ Any OTel-compatible backend works (Braintrust, PostHog, Raindrop, Arize, Honeyco
|
|
|
48
48
|
|
|
49
49
|
Three more fields control what the AI SDK records inside those spans (see the AI SDK's [telemetry reference](https://ai-sdk.dev/docs/ai-sdk-core/telemetry)):
|
|
50
50
|
|
|
51
|
-
- `recordInputs` records full message history on each step span
|
|
52
|
-
- `recordOutputs` records model outputs on spans
|
|
51
|
+
- `recordInputs` records full message history on each step span. It defaults to `false`; set it to `true` to include input content.
|
|
52
|
+
- `recordOutputs` records model outputs on spans. It defaults to `false`; set it to `true` to include output content.
|
|
53
53
|
- `functionId` overrides the function name on spans (defaults to the agent name).
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
eve records metadata without model or tool inputs and outputs by default. Enable either content category only after reviewing the exporter and its data-retention path.
|
|
56
56
|
|
|
57
57
|
You are responsible for ensuring any observability or eval provider is approved for the data exported to it.
|
|
58
58
|
|
|
@@ -173,20 +173,20 @@ Tag writes are best-effort: a failure is logged once per process and then swallo
|
|
|
173
173
|
|
|
174
174
|
These tags power the **Agent Runs** tab in the Vercel dashboard. When you deploy on Vercel, the platform auto-detects `eve` as the framework and surfaces an Agent Runs view under your project's **Observability** tab, where you can browse sessions and drill into each conversation's trace, with no `instrumentation.ts` required. The tab is currently gated per team. See [Deploy to Vercel](./deployment/vercel#inspect-agent-runs) for enablement. Agent Runs is separate from the OpenTelemetry export above. Use OTel when you want spans in Braintrust, PostHog, Datadog, or another third-party backend.
|
|
175
175
|
|
|
176
|
-
Note: By default, telemetry records full message history and model outputs You may need to disclose these data flows in your privacy materials if utilized.
|
|
177
|
-
|
|
178
176
|
## Local traces
|
|
179
177
|
|
|
180
178
|
Without an `instrumentation.ts`, `eve dev` records spans to disk — one trace per session, with turns, model steps, and tool calls. Read them two ways:
|
|
181
179
|
|
|
182
|
-
- [`/traces`](dev-tui#
|
|
180
|
+
- [`/traces`](dev-tui#logs-and-traces) in the dev TUI: a live trace viewer that replays captured content as a conversation.
|
|
183
181
|
- [`eve traces`](../reference/cli#eve-traces): a span tree in the terminal, `eve traces ls` to list. Works after `eve dev` exits.
|
|
184
182
|
|
|
183
|
+
Local traces omit model and tool inputs and outputs by default. Set `EVE_TRACES_CONTENT=on` in `.env.local` to capture that content.
|
|
184
|
+
|
|
185
185
|
Writing `instrumentation.ts` replaces this: your `setup` takes over and nothing is recorded locally. For span attributes, retention, and the `EVE_TRACES*` variables, see [`eve traces`](../reference/cli#eve-traces).
|
|
186
186
|
|
|
187
187
|
## Debugging
|
|
188
188
|
|
|
189
|
-
`eve info` is the fastest way to see what eve actually picked up: the active tools, skills, subagents, schedules, routes, and discovery diagnostics. eve also writes inspectable artifacts under `.eve/`, kept even when discovery hits errors:
|
|
189
|
+
`eve info` is the fastest way to see what eve actually picked up: ordered static instructions with their roles, plus the active tools, skills, subagents, schedules, routes, and discovery diagnostics. Dynamic instruction results exist only at runtime and are not part of this static inspection. eve also writes inspectable artifacts under `.eve/`, kept even when discovery hits errors:
|
|
190
190
|
|
|
191
191
|
| Artifact | Tells you |
|
|
192
192
|
| ------------------------------- | ------------------------------------------- |
|
|
@@ -199,13 +199,13 @@ When `eve build` fails on discovery errors, the CLI prints the full diagnostics
|
|
|
199
199
|
|
|
200
200
|
### Common failures
|
|
201
201
|
|
|
202
|
-
| Symptom | Likely cause and fix
|
|
203
|
-
| --------------------------------------------- |
|
|
204
|
-
| Tool not discovered (the model never sees it) | Run `eve info`. Confirm the file is in the right slot (`agent/tools/<name>.ts`) and default-exports `defineTool(...)`, and check `.eve/diagnostics.json` for shape errors. `schedules/` are root-only.
|
|
205
|
-
| Model won't call a tool it should | Tighten the tool `description` and `inputSchema`; put procedural guidance in a [skill](../skills), not the description. Confirm it's in the active set with `eve info`.
|
|
206
|
-
| Stuck on `session.waiting` | The turn is parked for input. Answer the pending approval or question, or POST a follow-up to `/eve/v1/session/:sessionId`.
|
|
207
|
-
| 401 on production routes | Expected: auth fails closed. Replace `placeholderAuth()` with your route policy. Use `vercelOidc()` only for Vercel-issued tokens; otherwise configure `httpBasic()`, JWT/OIDC helpers, or a custom `AuthFn`. See [
|
|
208
|
-
| Build fails with discovery errors | Read the printed diagnostics and `.eve/diagnostics.json`; confirm the root-vs-subagent boundary is valid and secrets come from env vars.
|
|
202
|
+
| Symptom | Likely cause and fix |
|
|
203
|
+
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
204
|
+
| Tool not discovered (the model never sees it) | Run `eve info`. Confirm the file is in the right slot (`agent/tools/<name>.ts`) and default-exports `defineTool(...)`, and check `.eve/diagnostics.json` for shape errors. `schedules/` are root-only. |
|
|
205
|
+
| Model won't call a tool it should | Tighten the tool `description` and `inputSchema`; put procedural guidance in a [skill](../skills), not the description. Confirm it's in the active set with `eve info`. |
|
|
206
|
+
| Stuck on `session.waiting` | The turn is parked for input. Answer the pending approval or question, or POST a follow-up to `/eve/v1/session/:sessionId`. |
|
|
207
|
+
| 401 on production routes | Expected: auth fails closed. Replace `placeholderAuth()` with your route policy. Use `vercelOidc()` only for Vercel-issued tokens; otherwise configure `httpBasic()`, JWT/OIDC helpers, or a custom `AuthFn`. See [Authentication](./auth-and-route-protection). |
|
|
208
|
+
| Build fails with discovery errors | Read the printed diagnostics and `.eve/diagnostics.json`; confirm the root-vs-subagent boundary is valid and secrets come from env vars. |
|
|
209
209
|
|
|
210
210
|
## What to read next
|
|
211
211
|
|
package/docs/guides/meta.json
CHANGED
|
@@ -20,14 +20,14 @@ export default defineRemoteAgent({
|
|
|
20
20
|
|
|
21
21
|
`defineRemoteAgent` accepts:
|
|
22
22
|
|
|
23
|
-
| Parameter | Type | Required | Default | Description
|
|
24
|
-
| ------------------ | --------------------------------------------- | -------- | ----------------- |
|
|
25
|
-
| `url` | `string \| (() => string \| Promise<string>)` | Yes | n/a | Base URL of the remote eve deployment to call. A string is baked at compile time; a function is resolved at runtime (see [Runtime URLs](#runtime-urls)).
|
|
26
|
-
| `description` | `string` | Yes | n/a | Model-visible delegation description.
|
|
27
|
-
| `auth` | `OutboundAuthFn` | No | none | Outbound auth hook from `eve/agents/auth`.
|
|
28
|
-
| `forwardPrincipal` | `boolean` | No | `false` | Forward the dispatching turn's session principal to the remote deployment (see [Forwarding the caller identity](#forwarding-the-caller-identity)).
|
|
29
|
-
| `headers` | `HeadersValue` | No | none | Static or lazily resolved request headers.
|
|
30
|
-
| `path` | `string` | No | `/eve/v1/session` | Route appended to `url` for the create-session request.
|
|
23
|
+
| Parameter | Type | Required | Default | Description |
|
|
24
|
+
| ------------------ | --------------------------------------------- | -------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
25
|
+
| `url` | `string \| (() => string \| Promise<string>)` | Yes | n/a | Base URL of the remote eve deployment to call. A string is baked at compile time; a function is resolved at runtime (see [Runtime URLs](#runtime-urls)). |
|
|
26
|
+
| `description` | `string` | Yes | n/a | Model-visible delegation description. |
|
|
27
|
+
| `auth` | `OutboundAuthFn` | No | none | Outbound auth hook from `eve/agents/auth`. |
|
|
28
|
+
| `forwardPrincipal` | `boolean` | No | `false` | Forward the dispatching turn's session principal to the remote deployment (see [Forwarding the caller identity](#forwarding-the-caller-identity)). |
|
|
29
|
+
| `headers` | `HeadersValue` | No | none | Static or lazily resolved request headers. |
|
|
30
|
+
| `path` | `string` | No | `/eve/v1/session` | Route appended to `url` for the create-session request. |
|
|
31
31
|
| `outputSchema` | `StandardSchema \| JSON Schema` | No | none | Structured return type the caller requires. Enforced by the remote agent like any task-mode output schema. Set it on the definition to apply to every call, or override it per call. |
|
|
32
32
|
|
|
33
33
|
## Dynamic remote agents
|
|
@@ -135,5 +135,5 @@ Both failure paths surface to the parent as a failed tool result, so the caller
|
|
|
135
135
|
## What to read next
|
|
136
136
|
|
|
137
137
|
- Local delegation and the isolation boundary → [Subagents](../subagents)
|
|
138
|
-
- Have the model orchestrate remote agents programmatically → [
|
|
138
|
+
- Have the model orchestrate remote agents programmatically → [Workflow Tool](../subagents/workflow-tool)
|
|
139
139
|
- Securing the receiving deployment → [Auth & route protection](./auth-and-route-protection)
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Session Context"
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use ctx.session and runtime accessors inside eve-managed execution."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
eve
|
|
6
|
+
eve passes a runtime `ctx` to tool executors, hook handlers, channel event handlers, and connection auth and header resolvers. Use it to inspect the active session and reach resources bound to that execution.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
| Accessor | Provides | Full guide |
|
|
9
|
+
| ---------------------------- | --------------------------------------------------------- | ----------------------------------------------- |
|
|
10
|
+
| `ctx.session` | Session identity, turn metadata, auth, and parent lineage | This page |
|
|
11
|
+
| `ctx.getSandbox()` | The current agent's live sandbox handle | [Sandbox](../sandbox) |
|
|
12
|
+
| `ctx.getSkill(identifier)` | A handle for a skill visible to the current agent | [Skills](../skills#read-skill-files-at-runtime) |
|
|
13
|
+
| `defineState(name, initial)` | Durable typed state shared by runtime code in one session | [State](../concepts/state) |
|
|
12
14
|
|
|
13
|
-
These APIs work only
|
|
15
|
+
These APIs work only during eve-managed runtime execution. Calling them during module evaluation, discovery, or a build throws.
|
|
14
16
|
|
|
15
17
|
## `ctx.session`
|
|
16
18
|
|
|
17
|
-
`ctx.session`
|
|
19
|
+
`ctx.session` describes the durable session and active turn:
|
|
18
20
|
|
|
19
21
|
```ts title="agent/tools/who_called_me.ts"
|
|
20
22
|
import { defineTool } from "eve/tools";
|
|
@@ -37,132 +39,61 @@ export default defineTool({
|
|
|
37
39
|
});
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
Public
|
|
42
|
+
Public fields include:
|
|
41
43
|
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
- `turn.
|
|
46
|
-
- `
|
|
47
|
-
-
|
|
44
|
+
- `id`: the durable session ID.
|
|
45
|
+
- `turn.id`: the current turn ID.
|
|
46
|
+
- `turn.sequence`: the turn's position in the session.
|
|
47
|
+
- `auth.current`: the caller for the active inbound turn.
|
|
48
|
+
- `auth.initiator`: the caller that started the session.
|
|
49
|
+
- `parent`: the parent call, session, root session, and turn for a child subagent session.
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- `auth.current` is the caller for the active inbound turn.
|
|
52
|
-
- `auth.initiator` is the caller that started the durable session.
|
|
53
|
-
- Unprotected agents expose both as `null`.
|
|
54
|
-
- Top-level schedule sessions expose the framework app principal (`principalId: "eve:app"`, `principalType: "runtime"`).
|
|
55
|
-
- `parent` is present for child subagent sessions and includes the parent `callId`, `sessionId`, `rootSessionId`, and `turn`.
|
|
51
|
+
Unprotected agents expose `auth.current` and `auth.initiator` as `null`. Top-level schedule sessions use the framework app principal (`principalId: "eve:app"`, `principalType: "runtime"`). See [Authentication](./auth-and-route-protection#what-reaches-ctxsessionauth) for how inbound identity becomes session auth.
|
|
56
52
|
|
|
57
53
|
## `ctx.getSandbox()`
|
|
58
54
|
|
|
59
|
-
`ctx.getSandbox()`
|
|
55
|
+
Call `ctx.getSandbox()` when authored runtime code needs filesystem or process access in the current agent's sandbox:
|
|
60
56
|
|
|
61
57
|
```ts
|
|
62
58
|
const sandbox = await ctx.getSandbox();
|
|
63
59
|
const result = await sandbox.run({ command: "npm test" });
|
|
64
60
|
```
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
- It takes no arguments. Each agent has exactly one sandbox.
|
|
69
|
-
- It is async because eve binds or restores sandbox state lazily.
|
|
70
|
-
- It only works when sandbox access is attached to the active runtime path.
|
|
71
|
-
- Visibility is node-local. A subagent sees its own sandbox, not the parent's.
|
|
72
|
-
- The returned `RuntimeSandboxSession` extends the ordinary sandbox I/O surface
|
|
73
|
-
with `stop()`. It is exported from `eve/sandbox`.
|
|
74
|
-
|
|
75
|
-
Call `stop()` to release sandbox compute while preserving the durable session
|
|
76
|
-
and its filesystem:
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
const sandbox = await ctx.getSandbox();
|
|
80
|
-
await sandbox.stop();
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Each backend implements this with its native lifecycle operation. Treat the
|
|
84
|
-
stop as the end of sandbox work in the current callback; a later callback calls
|
|
85
|
-
`ctx.getSandbox()` normally and eve reopens the same durable session. Vercel
|
|
86
|
-
also supports using the same handle again: its next command or file operation
|
|
87
|
-
automatically resumes the sandbox, just as it would after an inactivity
|
|
88
|
-
timeout. No separate eve reconnect state is created, and provider failures
|
|
89
|
-
reject the returned promise.
|
|
90
|
-
|
|
91
|
-
`SandboxSession` also exposes `resolvePath(path)`, which returns the live backend-native path for a logical `/workspace/...` location. Use it when authored code needs that path before passing it to shell code or a child process.
|
|
92
|
-
|
|
93
|
-
See [Sandbox](../sandbox) for lifecycle details.
|
|
62
|
+
The accessor is asynchronous because eve may need to bind or restore the sandbox. A subagent sees its own sandbox, not its parent's. The returned runtime handle can also stop compute while preserving the durable sandbox state. See [Sandbox](../sandbox#using-the-sandbox) for the I/O API and lifecycle.
|
|
94
63
|
|
|
95
64
|
## `ctx.getSkill(identifier)`
|
|
96
65
|
|
|
97
|
-
`ctx.getSkill(identifier)`
|
|
66
|
+
Call `ctx.getSkill(identifier)` to read a packaged skill's supporting files:
|
|
98
67
|
|
|
99
68
|
```ts
|
|
100
69
|
const skill = ctx.getSkill("research");
|
|
101
70
|
const notes = await skill.file("references/checklist.md").text();
|
|
102
71
|
```
|
|
103
72
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- It is synchronous. File content is read lazily from the active sandbox.
|
|
107
|
-
- It only works when sandbox access is attached to the active runtime path.
|
|
108
|
-
- `identifier` is the path-derived skill id.
|
|
109
|
-
- Visibility follows the current agent's sandbox.
|
|
110
|
-
- A missing skill surfaces when a file accessor reads a missing sandbox path.
|
|
111
|
-
- The returned handle exposes `name` and `file(relativePath)`.
|
|
112
|
-
|
|
113
|
-
See [Skills](../skills) for the full authoring model.
|
|
73
|
+
The accessor is synchronous; file content is read lazily from the active sandbox. Visibility follows the current agent. See [Skills](../skills#read-skill-files-at-runtime) for the complete handle behavior.
|
|
114
74
|
|
|
115
75
|
## Custom state with `defineState`
|
|
116
76
|
|
|
117
|
-
Use `defineState`
|
|
118
|
-
|
|
119
|
-
```ts title="agent/lib/budget.ts"
|
|
120
|
-
import { defineState } from "eve/context";
|
|
121
|
-
|
|
122
|
-
interface BudgetState {
|
|
123
|
-
readonly count: number;
|
|
124
|
-
readonly cap: number;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export const budget = defineState<BudgetState>("myapp.budget", () => ({
|
|
128
|
-
count: 0,
|
|
129
|
-
cap: 25,
|
|
130
|
-
}));
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
`get()` reads the current value (returning `initial()` on first access), and `update(fn)` applies a function to it. Both throw outside a managed scope. See [State](./state) for the full read/write model and examples from tools and hooks.
|
|
77
|
+
Use `defineState` for durable per-session values that tools, hooks, and channel handlers share. Unlike the `ctx` accessors, import it from `eve/context` and declare the handle at module scope. Its `get()` and `update()` methods still require active eve execution. See [State](../concepts/state) for the read, update, reset, and subagent-isolation model.
|
|
134
78
|
|
|
135
79
|
## Where these APIs work
|
|
136
80
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
- inside `defineTool(...).execute(input, ctx)`
|
|
140
|
-
- inside connection `auth: (ctx) => provider` and `headers: (ctx) => values` resolvers
|
|
141
|
-
- inside authored callbacks eve runs inside the runtime
|
|
142
|
-
- after asynchronous boundaries inside the same authored execution chain
|
|
143
|
-
|
|
144
|
-
Unsafe places:
|
|
81
|
+
Runtime context is available:
|
|
145
82
|
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
83
|
+
- inside `defineTool(...).execute(input, ctx)`;
|
|
84
|
+
- inside connection `auth` and `headers` resolvers;
|
|
85
|
+
- inside channel and hook callbacks that receive `ctx`;
|
|
86
|
+
- after asynchronous boundaries within the same authored execution chain.
|
|
149
87
|
|
|
150
|
-
|
|
88
|
+
Runtime context is not available during top-level module evaluation, build scripts, or discovery. Declare reusable definitions and state handles at module scope, but call their context-dependent methods only from an eve-managed callback.
|
|
151
89
|
|
|
152
90
|
## How it works
|
|
153
91
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
1. The runtime populates durable seed values (auth, session id, compiled bundle).
|
|
157
|
-
2. Before each step, the framework derives step-local values (session metadata, sandbox access, skill access) from the durable state.
|
|
158
|
-
3. Authored code runs inside the managed scope, so `ctx` and `defineState` accessors resolve automatically.
|
|
159
|
-
4. After the step, the framework commits mutable state (for example sandbox changes) back to the durable session.
|
|
160
|
-
|
|
161
|
-
The framework manages this lifecycle. Authored code only uses `ctx` and the public accessors.
|
|
92
|
+
eve establishes the managed context before invoking authored runtime code and keeps it available across asynchronous work in that execution chain. The framework binds durable session data and step-local resources, then commits mutable state at the step boundary. Authored code uses the public accessors rather than managing this lifecycle.
|
|
162
93
|
|
|
163
94
|
## What to read next
|
|
164
95
|
|
|
165
|
-
- [State](
|
|
166
|
-
- [
|
|
167
|
-
- [
|
|
168
|
-
- [
|
|
96
|
+
- [State](../concepts/state): durable typed values scoped to one session.
|
|
97
|
+
- [Sandbox](../sandbox): runtime filesystem and process access.
|
|
98
|
+
- [Skills](../skills): load procedures and read packaged skill files.
|
|
99
|
+
- [Sessions, runs, and streaming](../concepts/sessions-runs-and-streaming): the durable session and event contract.
|