eve 0.13.6 → 0.13.7
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 +10 -0
- package/dist/src/cli/banner.d.ts +2 -4
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/agent-prompt/build-and-verify.md +7 -4
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +1 -0
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/runtime/connections/principal.js +1 -1
- package/dist/src/setup/primitives/run-vercel.d.ts +8 -0
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +6 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +0 -17
- package/docs/README.md +2 -2
- package/docs/channels/linear.mdx +1 -1
- package/docs/connections/mcp.mdx +61 -0
- package/docs/connections/meta.json +4 -0
- package/docs/connections/openapi.mdx +68 -0
- package/docs/{connections.mdx → connections/overview.mdx} +28 -63
- package/docs/getting-started.mdx +0 -6
- package/docs/introduction.mdx +2 -8
- package/docs/reference/typescript-api.md +20 -19
- package/docs/tutorial/connect-a-warehouse.mdx +3 -3
- package/docs/tutorial/ship-it.mdx +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.13.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c8014d1: Improve Vercel Connect-backed connection auth by allowing authored definitions to include the `evict` hook and clarifying `principal_required` guidance when user-scoped connections run without an authenticated user principal.
|
|
8
|
+
- ff44c4c: Clarify scaffolded guidance for locating bundled eve package docs in workspaces and local installs.
|
|
9
|
+
- 30c5965: Preserve dynamic tool approval gates when session- and turn-scoped tools are replayed from durable metadata. If a replayed approval callback cannot be recovered, eve now requires approval by default instead of silently running the tool unguarded.
|
|
10
|
+
- 55af52e: Acknowledge Slack view submissions with an empty response body so submitted modals close without an error.
|
|
11
|
+
- dd960df: Fix Vercel CLI detection on Windows by invoking npm's command shims through `cmd.exe`, so an installed `vercel` command is no longer misreported as missing.
|
|
12
|
+
|
|
3
13
|
## 0.13.6
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/src/cli/banner.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export declare const EVE_WORDMARK = "eve";
|
|
2
|
-
export declare const EVE_BETA_TERMS_URL = "https://vercel.com/docs/release-phases/public-beta-agreement";
|
|
3
2
|
/**
|
|
4
3
|
* The boot banner shared by every CLI command that announces itself: the eve
|
|
5
|
-
* badge plus the installed version
|
|
6
|
-
*
|
|
7
|
-
* own variant.
|
|
4
|
+
* badge plus the installed version. Printed only by the CLI program's
|
|
5
|
+
* pre-action hook so commands never compose their own variant.
|
|
8
6
|
*/
|
|
9
7
|
export declare function eveCliBanner(): string;
|
package/dist/src/cli/banner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM}from"../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";var import_picocolors=__toESM(require_picocolors(),1);const EVE_WORDMARK=`eve
|
|
1
|
+
import{__toESM}from"../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";var import_picocolors=__toESM(require_picocolors(),1);const EVE_WORDMARK=`eve`;function eveCliBanner(){let{version:e}=resolveInstalledPackageInfo();return`${import_picocolors.default.bgBlack(import_picocolors.default.white(`☰eve `))} ${import_picocolors.default.dim(`v${e}`)}`}export{EVE_WORDMARK,eveCliBanner};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
## Build it out, then verify
|
|
2
2
|
|
|
3
3
|
Work from the project directory. Once eve is installed, the full docs are bundled
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
with the installed package and match its version exactly. In most installs, they
|
|
5
|
+
are at `node_modules/eve/docs/`. In workspaces or local package installs, resolve
|
|
6
|
+
the installed `eve` package location first and read its `docs/` directory. If
|
|
7
|
+
package docs are unavailable, use https://eve.dev/docs as a fallback. Read
|
|
8
|
+
`README.md` in the package docs first, then the guide for what you're adding,
|
|
9
|
+
such as `connections`, `channels/slack`, or `guides/auth-and-route-protection`
|
|
10
|
+
for the Vercel Connect flow.
|
|
8
11
|
|
|
9
12
|
- Put the purpose in `agent/instructions.md` (the always-on system prompt),
|
|
10
13
|
replacing the scaffold's placeholder with what the user said the agent should
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{truncate}from"./tool-format.js";
|
|
1
|
+
import{truncate}from"./tool-format.js";const AGENT_HEADER_TIPS=[`Use /channels to add more ways to reach your agent.`,`Use /deploy to see your agent go live.`,`Type /help to see every command.`];function pickAgentHeaderTip(e=Math.random){return AGENT_HEADER_TIPS[Math.min(AGENT_HEADER_TIPS.length-1,Math.floor(e()*AGENT_HEADER_TIPS.length))]}function buildAgentHeader(t){let{theme:n,info:r,name:i,width:a}=t,o=n.colors,s=[],c=o.bold(`eve`);if(s.push(` ${c} ${o.dim(truncate(i,Math.max(8,a-8)))}`),r&&(r.diagnostics.discoveryErrors>0||r.diagnostics.discoveryWarnings>0)){let e=[];r.diagnostics.discoveryErrors>0&&e.push(o.red(`${r.diagnostics.discoveryErrors} error${plural(r.diagnostics.discoveryErrors)}`)),r.diagnostics.discoveryWarnings>0&&e.push(o.yellow(`${r.diagnostics.discoveryWarnings} warning${plural(r.diagnostics.discoveryWarnings)}`)),s.push(` ${o.dim(n.glyph.warning)} ${e.join(o.dim(` · `))}`)}return t.tip!==void 0&&s.push(` ${o.dim(truncate(t.tip,Math.max(8,a-2)))}`),s}function plural(e){return e===1?``:`s`}export{AGENT_HEADER_TIPS,buildAgentHeader,pickAgentHeaderTip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{LiveStepToolsKey,SessionDynamicToolMetadataKey,TurnDynamicToolMetadataKey}from"#context/keys.js";import{jsonSchema}from"ai";import{buildCallbackContext}from"#context/build-callback-context.js";const log=createLogger(`dynamic-tools`);function lookupStepFunction(e){try{let t=globalThis[Symbol.for(`@workflow/core//registeredSteps`)];return t===void 0?null:t.get(e)||null}catch{return null}}function replayTools(e){let t=[];for(let n of e){if(!n.executeStepFnName||!n.closureVars){log.warn(`Dynamic tool "${n.name}" has no registered step function — skipping on this step. The bundler transform may not have processed this tool file.`);continue}let e=lookupStepFunction(n.executeStepFnName);if(!e){log.warn(`Dynamic tool "${n.name}" references step function "${n.executeStepFnName}" which is not registered — skipping on this step.`);continue}t.push({description:n.description,execute:t=>e(n.closureVars,t,buildCallbackContext()),inputSchema:jsonSchema(n.inputSchema),name:n.name,outputSchema:n.outputSchema===void 0?void 0:jsonSchema(n.outputSchema)})}return t}function buildDynamicTools(e){let r=e.get(LiveStepToolsKey)??[],i=replayTools(e.get(TurnDynamicToolMetadataKey)??[]),a=replayTools(e.get(SessionDynamicToolMetadataKey)??[]);return[...r,...i,...a]}export{buildDynamicTools};
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{LiveStepToolsKey,SessionDynamicToolMetadataKey,TurnDynamicToolMetadataKey}from"#context/keys.js";import{jsonSchema}from"ai";import{buildCallbackContext}from"#context/build-callback-context.js";const log=createLogger(`dynamic-tools`);function lookupStepFunction(e){try{let t=globalThis[Symbol.for(`@workflow/core//registeredSteps`)];return t===void 0?null:t.get(e)||null}catch{return null}}function replayTools(e){let t=[];for(let n of e){if(!n.executeStepFnName||!n.closureVars){log.warn(`Dynamic tool "${n.name}" has no registered step function — skipping on this step. The bundler transform may not have processed this tool file.`);continue}let e=lookupStepFunction(n.executeStepFnName);if(!e){log.warn(`Dynamic tool "${n.name}" references step function "${n.executeStepFnName}" which is not registered — skipping on this step.`);continue}t.push({description:n.description,execute:t=>e(n.closureVars,t,buildCallbackContext()),inputSchema:jsonSchema(n.inputSchema),name:n.name,needsApproval:buildReplayedNeedsApproval(n),outputSchema:n.outputSchema===void 0?void 0:jsonSchema(n.outputSchema)})}return t}function buildReplayedNeedsApproval(e){if(e.needsApprovalStepFnName===void 0)return;let t=lookupStepFunction(e.needsApprovalStepFnName);return t===null?(log.warn(`Dynamic tool "${e.name}" references approval function "${e.needsApprovalStepFnName}" which is not registered — requiring approval by default.`),()=>!0):n=>!!t(e.closureVars??{},n)}function buildDynamicTools(e){let r=e.get(LiveStepToolsKey)??[],i=replayTools(e.get(TurnDynamicToolMetadataKey)??[]),a=replayTools(e.get(SessionDynamicToolMetadataKey)??[]);return[...r,...i,...a]}export{buildDynamicTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{LiveStepToolsKey,SessionDynamicToolMetadataKey,TurnDynamicToolMetadataKey}from"#context/keys.js";import{toErrorMessage}from"#shared/errors.js";import{ALLOWED_DYNAMIC_TOOL_EVENTS,isBrandedToolEntry}from"#shared/dynamic-tool-definition.js";import{jsonSchema,zodSchema}from"ai";import{buildCallbackContext}from"#context/build-callback-context.js";import{buildResolveContext}from"#context/dynamic-resolve-context.js";import{normalizeJsonSchemaDefinition}from"#internal/json-schema.js";const log=createLogger(`dynamic-tools`);function toHarnessToolDefinition(e,t){return{description:t.description,execute:e=>t.execute(e,buildCallbackContext()),inputSchema:convertInputSchema(t.inputSchema),name:e,needsApproval:t.needsApproval,outputSchema:convertOptionalOutputSchema(t.outputSchema),...t.toModelOutput===void 0?{}:{toModelOutput:t.toModelOutput}}}function convertInputSchema(e){return typeof e==`object`&&e&&`~standard`in e?zodSchema(e):jsonSchema(e)}function convertOptionalOutputSchema(e){if(e!==void 0)return typeof e==`object`&&e&&`~standard`in e?zodSchema(e):jsonSchema(e)}function qualifyDynamicToolNames(e,t,n){let r=Object.keys(n),i=[];if(r.length===0)return i;if(t)return i.push({name:e,entryKey:r[0],entry:n[r[0]]}),i;for(let e of r)i.push({name:e,entryKey:e,entry:n[e]});return i}function replayDynamicSessionTools(e,t){let n=[];for(let t of e){if(!t.executeStepFnName||!t.closureVars){log.warn(`Dynamic tool "${t.name}" has no registered step function — skipping on this step. The bundler transform may not have processed this tool file.`);continue}let e=lookupStepFunction(t.executeStepFnName);if(!e){log.warn(`Dynamic tool "${t.name}" references step function "${t.executeStepFnName}" which is not registered — skipping on this step.`);continue}n.push({description:t.description,execute:n=>e(t.closureVars,n,buildCallbackContext()),inputSchema:jsonSchema(t.inputSchema),name:t.name,outputSchema:t.outputSchema===void 0?void 0:jsonSchema(t.outputSchema)})}return n}function getStepRegistry(){let e=Symbol.for(`@workflow/core//registeredSteps`),t=globalThis,n=t[e];return n===void 0&&(n=new Map,t[e]=n),n}function lookupStepFunction(e){try{return getStepRegistry().get(e)||null}catch{return null}}function registerStepFunction(e,t){getStepRegistry().set(e,t)}function safeSerialize(e){try{return JSON.parse(JSON.stringify(e))}catch{return{}}}function durableKeyForEvent(e){switch(e){case`session.started`:return SessionDynamicToolMetadataKey;case`turn.started`:return TurnDynamicToolMetadataKey;default:return}}async function resolveToolsFromEvent(e,t,n,r){let a=await Promise.allSettled(t.map(async t=>{let i=t.events[n.type];if(i===void 0)return null;let a=await i(n,buildResolveContext(e,r));if(a==null)return null;let s,c;return isBrandedToolEntry(a)?(s={_single:a},c=!0):(s=a,c=!1),{resolver:t,entries:s,isSingle:c}})),s=[],c=[],l=new Map;for(let e of a){if(e.status===`rejected`){log.error(`Dynamic tool resolver (${n.type}) threw — skipping.`,{error:toErrorMessage(e.reason)});continue}if(e.value===null)continue;let{resolver:t,entries:r,isSingle:a}=e.value,o=qualifyDynamicToolNames(t.slug,a,r);for(let{name:e,entryKey:
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{LiveStepToolsKey,SessionDynamicToolMetadataKey,TurnDynamicToolMetadataKey}from"#context/keys.js";import{toErrorMessage}from"#shared/errors.js";import{ALLOWED_DYNAMIC_TOOL_EVENTS,isBrandedToolEntry}from"#shared/dynamic-tool-definition.js";import{jsonSchema,zodSchema}from"ai";import{buildCallbackContext}from"#context/build-callback-context.js";import{buildResolveContext}from"#context/dynamic-resolve-context.js";import{normalizeJsonSchemaDefinition}from"#internal/json-schema.js";const log=createLogger(`dynamic-tools`);function toHarnessToolDefinition(e,t){return{description:t.description,execute:e=>t.execute(e,buildCallbackContext()),inputSchema:convertInputSchema(t.inputSchema),name:e,needsApproval:t.needsApproval,outputSchema:convertOptionalOutputSchema(t.outputSchema),...t.toModelOutput===void 0?{}:{toModelOutput:t.toModelOutput}}}function convertInputSchema(e){return typeof e==`object`&&e&&`~standard`in e?zodSchema(e):jsonSchema(e)}function convertOptionalOutputSchema(e){if(e!==void 0)return typeof e==`object`&&e&&`~standard`in e?zodSchema(e):jsonSchema(e)}function qualifyDynamicToolNames(e,t,n){let r=Object.keys(n),i=[];if(r.length===0)return i;if(t)return i.push({name:e,entryKey:r[0],entry:n[r[0]]}),i;for(let e of r)i.push({name:e,entryKey:e,entry:n[e]});return i}function replayDynamicSessionTools(e,t){let n=[];for(let t of e){if(!t.executeStepFnName||!t.closureVars){log.warn(`Dynamic tool "${t.name}" has no registered step function — skipping on this step. The bundler transform may not have processed this tool file.`);continue}let e=lookupStepFunction(t.executeStepFnName);if(!e){log.warn(`Dynamic tool "${t.name}" references step function "${t.executeStepFnName}" which is not registered — skipping on this step.`);continue}n.push({description:t.description,execute:n=>e(t.closureVars,n,buildCallbackContext()),inputSchema:jsonSchema(t.inputSchema),name:t.name,outputSchema:t.outputSchema===void 0?void 0:jsonSchema(t.outputSchema)})}return n}function getStepRegistry(){let e=Symbol.for(`@workflow/core//registeredSteps`),t=globalThis,n=t[e];return n===void 0&&(n=new Map,t[e]=n),n}function lookupStepFunction(e){try{return getStepRegistry().get(e)||null}catch{return null}}function registerStepFunction(e,t){getStepRegistry().set(e,t)}function safeSerialize(e){try{return JSON.parse(JSON.stringify(e))}catch{return{}}}function durableKeyForEvent(e){switch(e){case`session.started`:return SessionDynamicToolMetadataKey;case`turn.started`:return TurnDynamicToolMetadataKey;default:return}}async function resolveToolsFromEvent(e,t,n,r){let a=await Promise.allSettled(t.map(async t=>{let i=t.events[n.type];if(i===void 0)return null;let a=await i(n,buildResolveContext(e,r));if(a==null)return null;let s,c;return isBrandedToolEntry(a)?(s={_single:a},c=!0):(s=a,c=!1),{resolver:t,entries:s,isSingle:c}})),s=[],c=[],l=new Map;for(let e of a){if(e.status===`rejected`){log.error(`Dynamic tool resolver (${n.type}) threw — skipping.`,{error:toErrorMessage(e.reason)});continue}if(e.value===null)continue;let{resolver:t,entries:r,isSingle:a}=e.value,o=qualifyDynamicToolNames(t.slug,a,r);for(let{name:e,entryKey:r,entry:i}of o){let a=l.get(e);if(a!==void 0&&a!==t.slug)throw Error(`Dynamic tool "${e}" from resolver "${t.slug}" collides with dynamic resolver "${a}". Namespace the map key manually, e.g. "${t.slug}__${e}".`);if(l.set(e,t.slug),c.push(toHarnessToolDefinition(e,i)),n.type===`step.started`)continue;let o=`__executeStepFn`in i?i.__executeStepFn:void 0,u=`__closureVars`in i?i.__closureVars:void 0,f=o?.stepId,p=u===void 0?void 0:safeSerialize(u);if(f===void 0){let e=`eve:framework-dynamic:${t.slug}:${r}`,n=i.execute.bind(i);registerStepFunction(e,(e,t,r)=>n(t,r)),f=e,p={}}let m;if(i.needsApproval!==void 0){m=`eve:dynamic-tool-approval:${t.slug}:${r}`;let e=i.needsApproval.bind(i);registerStepFunction(m,(t,n)=>e(n))}s.push({name:e,description:i.description,inputSchema:normalizeJsonSchemaDefinition(i.inputSchema),outputSchema:i.outputSchema===void 0?void 0:normalizeJsonSchemaDefinition(i.outputSchema,`output`),resolverSlug:t.slug,entryKey:r,executeStepFnName:f,needsApprovalStepFnName:m,closureVars:p})}}return{metadata:s,liveTools:c}}async function dispatchDynamicToolEvent(e){let{ctx:n,resolvers:r,event:i,messages:o}=e;if(!ALLOWED_DYNAMIC_TOOL_EVENTS.has(i.type))return;let s=r.filter(e=>e.eventNames.includes(i.type));if(s.length===0)return;let{metadata:c,liveTools:l}=await resolveToolsFromEvent(n,s,i,o);if(i.type===`step.started`){n.setVirtualContext(LiveStepToolsKey,l);return}let u=durableKeyForEvent(i.type);if(u===void 0)return;let d=new Set(s.map(e=>e.slug)),f=(n.get(u)??[]).filter(e=>!d.has(e.resolverSlug));n.set(u,[...f,...c])}export{dispatchDynamicToolEvent,replayDynamicSessionTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire}from"node:module";import{existsSync,readFileSync,realpathSync}from"node:fs";import{basename,dirname,join}from"node:path";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{fileURLToPath}from"node:url";let cachedPackageInfo;const BUNDLED_FALLBACK_PACKAGE_VERSION=`0.13.
|
|
1
|
+
import{createRequire}from"node:module";import{existsSync,readFileSync,realpathSync}from"node:fs";import{basename,dirname,join}from"node:path";import{EVE_PACKAGE_NAME}from"#internal/package-name.js";import{fileURLToPath}from"node:url";let cachedPackageInfo;const BUNDLED_FALLBACK_PACKAGE_VERSION=`0.13.7`,WORKFLOW_MODULE_ALIASES={"workflow/errors":`src/compiled/@workflow/errors/index.js`,"workflow/internal/private":`src/compiled/@workflow/core/private.js`};function resolveFallbackPackageVersion(){return BUNDLED_FALLBACK_PACKAGE_VERSION.startsWith(`__`)?`0.0.0`:BUNDLED_FALLBACK_PACKAGE_VERSION}const FALLBACK_PACKAGE_INFO={name:EVE_PACKAGE_NAME,version:resolveFallbackPackageVersion()};function resolveCurrentModulePath(){return typeof __filename==`string`?__filename:resolveCurrentModulePathFromStack()}function resolveCurrentModulePathFromStack(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error().stack?.[0]?.getFileName();if(typeof e!=`string`||e.length===0)throw Error(`Failed to resolve the current module path from the stack trace.`);return e.startsWith(`file:`)?fileURLToPath(e):e}finally{Error.prepareStackTrace=e}}const require=createRequire(resolveCurrentModulePath());function isBuildOutputPackageRoot(e){return basename(e)===`dist`&&existsSync(join(dirname(e),`package.json`))}function resolvePackageBuildRoot(){let e=dirname(realpathSync(resolveCurrentModulePath()));for(;;){if(isBuildOutputPackageRoot(e))return e;let t=dirname(e);if(t===e)return null;e=t}}function findNearestPackageRoot(e){let n=e;for(;;){if(existsSync(join(n,`package.json`))&&!isBuildOutputPackageRoot(n))return n;let r=dirname(n);if(r===n)throw Error(`Failed to resolve package root from "${e}".`);n=r}}function resolvePackageRoot(){return findNearestPackageRoot(dirname(realpathSync(resolveCurrentModulePath())))}function tryResolvePackageRoot(){try{return resolvePackageRoot()}catch{return}}function rewriteSourceFilePathForBuild(e){return e.replace(/\.[cm]?tsx?$/,`.js`)}function resolvePackageSourceFilePath(e){let t=resolvePackageBuildRoot();return t===null?join(resolvePackageRoot(),e):join(t,rewriteSourceFilePathForBuild(e))}function resolvePackageSourceDirectoryPath(e){let t=resolvePackageBuildRoot();return join(t===null?resolvePackageRoot():t,e)}function resolvePackageDependencyPath(e){return require.resolve(e)}function resolvePackageCompiledFilePath(e){let t=resolvePackageBuildRoot();return t===null?join(resolvePackageRoot(),`.generated`,`compiled`,e.replace(/^src\/compiled\//,``)):join(t,e)}function normalizeInstalledPackageInfo(e){let t=e;if(!(typeof t.name!=`string`||typeof t.version!=`string`))return{name:t.name,version:t.version}}function tryReadInstalledPackageInfo(e,t){let r=normalizeInstalledPackageInfo(JSON.parse(readFileSync(e,`utf8`)));if(r?.name===t)return r}function resolveInstalledPackageInfo(){if(cachedPackageInfo)return cachedPackageInfo;let e=tryResolvePackageRoot(),t=e===void 0?void 0:tryReadInstalledPackageInfo(join(e,`package.json`),EVE_PACKAGE_NAME);if(t)return cachedPackageInfo=t,cachedPackageInfo;try{let e=tryReadInstalledPackageInfo(require.resolve(`${EVE_PACKAGE_NAME}/package.json`),EVE_PACKAGE_NAME);if(e)return cachedPackageInfo=e,cachedPackageInfo}catch{}return cachedPackageInfo={...FALLBACK_PACKAGE_INFO},cachedPackageInfo}function resolveWorkflowModulePath(e){if(e===`workflow`)return resolvePackageSourceFilePath(`src/internal/workflow/index.ts`);if(e===`workflow/api`||e===`workflow/runtime`)return resolvePackageSourceFilePath(`src/internal/workflow/runtime.ts`);if(e===`workflow/internal/builtins`)return resolvePackageSourceFilePath(`src/internal/workflow/builtins.ts`);let t=WORKFLOW_MODULE_ALIASES[e];return t===void 0?require.resolve(e):resolvePackageCompiledFilePath(t)}export{resolveInstalledPackageInfo,resolvePackageDependencyPath,resolvePackageRoot,resolvePackageSourceDirectoryPath,resolvePackageSourceFilePath,resolveWorkflowModulePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectObjectRecord,expectOnlyKnownKeys}from"#internal/authored-module.js";import{normalizeAuthorizationSpec}from"#runtime/connections/validate-authorization.js";const KNOWN_TOP_LEVEL_KEYS=[`approval`,`auth`,`description`,`headers`,`tools`,`url`],KNOWN_OPENAPI_TOP_LEVEL_KEYS=[`approval`,`auth`,`baseUrl`,`description`,`headers`,`operations`,`spec`],KNOWN_AUTHORIZATION_KEYS=[`completeAuthorization`,`getToken`,`principalType`,`startAuthorization`,`vercelConnect`];function normalizeMcpClientConnectionDefinition(n,i){let a=expectObjectRecord(n,i);expectOnlyKnownKeys(a,KNOWN_TOP_LEVEL_KEYS,i),validateUrl(a,i),validateDescription(a,i);let o=normalizeAuthorization(a,i),s=normalizeHeaders(a,i),c=normalizeToolFilter(a,i);if(o!==void 0&&s!==void 0&&typeof s!=`function`&&Object.keys(s).some(e=>e.toLowerCase()===`authorization`))throw Error(`${i} "headers" must not include an "Authorization" key when "auth" is also provided.`);let l={description:a.description,url:a.url};if(o!==void 0&&(l.auth=o),s!==void 0&&(l.headers=s),c!==void 0&&(l.tools=c),a.approval!==void 0){if(typeof a.approval!=`function`)throw Error(`${i} The "approval" field must be a function when provided.`);l.approval=a.approval}return l}function normalizeOpenApiConnectionDefinition(n,r){let a=expectObjectRecord(n,r);expectOnlyKnownKeys(a,KNOWN_OPENAPI_TOP_LEVEL_KEYS,r),validateSpec(a,r),validateBaseUrl(a,r),validateDescription(a,r);let o=normalizeAuthorization(a,r),s=normalizeHeaders(a,r),c=normalizeFilterField(a,`operations`,r);if(o!==void 0&&s!==void 0&&typeof s!=`function`&&Object.keys(s).some(e=>e.toLowerCase()===`authorization`))throw Error(`${r} "headers" must not include an "Authorization" key when "auth" is also provided.`);let l={description:a.description,spec:a.spec};if(a.baseUrl!==void 0&&(l.baseUrl=a.baseUrl),o!==void 0&&(l.auth=o),s!==void 0&&(l.headers=s),c!==void 0&&(l.operations=c),a.approval!==void 0){if(typeof a.approval!=`function`)throw Error(`${r} The "approval" field must be a function when provided.`);l.approval=a.approval}return l}function validateSpec(e,t){let n=e.spec;if(typeof n==`string`){if(!URL.canParse(n))throw Error(`${t} The "spec" field must be a valid URL when provided as a string.`);let e=new URL(n);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw Error(`${t} The "spec" URL must use the http or https protocol, got "${e.protocol}".`);return}if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`${t} The "spec" field must be a URL string or an inline OpenAPI document object.`)}function validateBaseUrl(e,t){if(e.baseUrl===void 0)return;if(typeof e.baseUrl!=`string`||!URL.canParse(e.baseUrl))throw Error(`${t} The "baseUrl" field must be a valid URL when provided.`);let n=new URL(e.baseUrl);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`${t} The "baseUrl" field must use the http or https protocol, got "${n.protocol}".`)}function validateUrl(e,t){if(typeof e.url!=`string`||!URL.canParse(e.url))throw Error(`${t} The "url" field must be a valid URL.`);let n=new URL(e.url);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`${t} The "url" field must use the http or https protocol, got "${n.protocol}".`)}function validateDescription(e,t){if(typeof e.description!=`string`||e.description.length===0)throw Error(`${t} The "description" field must be a non-empty string.`)}function normalizeAuthorization(r,i){if(r.auth===void 0)return;let o=expectObjectRecord(r.auth,`${i} The "auth" field must be an object with a "getToken" method.`);return expectOnlyKnownKeys(o,KNOWN_AUTHORIZATION_KEYS,`${i} The "auth" field`),normalizeAuthorizationSpec(o,i)}function normalizeHeaders(e,t){if(e.headers===void 0)return;if(typeof e.headers==`function`)return e.headers;if(typeof e.headers!=`object`||e.headers===null||Array.isArray(e.headers))throw Error(`${t} The "headers" field must be a plain object or a function.`);let n=e.headers;for(let[e,r]of Object.entries(n)){let n=typeof r;if(n!==`string`&&n!==`function`&&n!==`object`||n===`object`&&(r===null||typeof r.then!=`function`))throw Error(`${t} The "headers.${e}" value must be a string, Promise, or function.`)}return n}function normalizeToolFilter(e,t){return normalizeFilterField(e,`tools`,t)}function normalizeFilterField(e,t,n){let r=e[t];if(r===void 0)return;if(typeof r!=`object`||!r||Array.isArray(r))throw Error(`${n} The "${t}" field must specify either "allow" or "block".`);let i=r,a=`allow`in i,o=`block`in i;if(a&&o)throw Error(`${n} The "${t}" field must specify either "allow" or "block", not both.`);if(!a&&!o)throw Error(`${n} The "${t}" field must specify either "allow" or "block".`);return a?(validateStringArray(i.allow,`${n} The "${t}.allow"`),{allow:i.allow}):(validateStringArray(i.block,`${n} The "${t}.block"`),{block:i.block})}function validateStringArray(e,t){if(!Array.isArray(e))throw Error(`${t} field must be an array of strings.`);for(let n=0;n<e.length;n++)if(typeof e[n]!=`string`)throw Error(`${t}[${n}] must be a string.`)}export{normalizeMcpClientConnectionDefinition,normalizeOpenApiConnectionDefinition};
|
|
1
|
+
import{expectObjectRecord,expectOnlyKnownKeys}from"#internal/authored-module.js";import{normalizeAuthorizationSpec}from"#runtime/connections/validate-authorization.js";const KNOWN_TOP_LEVEL_KEYS=[`approval`,`auth`,`description`,`headers`,`tools`,`url`],KNOWN_OPENAPI_TOP_LEVEL_KEYS=[`approval`,`auth`,`baseUrl`,`description`,`headers`,`operations`,`spec`],KNOWN_AUTHORIZATION_KEYS=[`completeAuthorization`,`evict`,`getToken`,`principalType`,`startAuthorization`,`vercelConnect`];function normalizeMcpClientConnectionDefinition(n,i){let a=expectObjectRecord(n,i);expectOnlyKnownKeys(a,KNOWN_TOP_LEVEL_KEYS,i),validateUrl(a,i),validateDescription(a,i);let o=normalizeAuthorization(a,i),s=normalizeHeaders(a,i),c=normalizeToolFilter(a,i);if(o!==void 0&&s!==void 0&&typeof s!=`function`&&Object.keys(s).some(e=>e.toLowerCase()===`authorization`))throw Error(`${i} "headers" must not include an "Authorization" key when "auth" is also provided.`);let l={description:a.description,url:a.url};if(o!==void 0&&(l.auth=o),s!==void 0&&(l.headers=s),c!==void 0&&(l.tools=c),a.approval!==void 0){if(typeof a.approval!=`function`)throw Error(`${i} The "approval" field must be a function when provided.`);l.approval=a.approval}return l}function normalizeOpenApiConnectionDefinition(n,r){let a=expectObjectRecord(n,r);expectOnlyKnownKeys(a,KNOWN_OPENAPI_TOP_LEVEL_KEYS,r),validateSpec(a,r),validateBaseUrl(a,r),validateDescription(a,r);let o=normalizeAuthorization(a,r),s=normalizeHeaders(a,r),c=normalizeFilterField(a,`operations`,r);if(o!==void 0&&s!==void 0&&typeof s!=`function`&&Object.keys(s).some(e=>e.toLowerCase()===`authorization`))throw Error(`${r} "headers" must not include an "Authorization" key when "auth" is also provided.`);let l={description:a.description,spec:a.spec};if(a.baseUrl!==void 0&&(l.baseUrl=a.baseUrl),o!==void 0&&(l.auth=o),s!==void 0&&(l.headers=s),c!==void 0&&(l.operations=c),a.approval!==void 0){if(typeof a.approval!=`function`)throw Error(`${r} The "approval" field must be a function when provided.`);l.approval=a.approval}return l}function validateSpec(e,t){let n=e.spec;if(typeof n==`string`){if(!URL.canParse(n))throw Error(`${t} The "spec" field must be a valid URL when provided as a string.`);let e=new URL(n);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw Error(`${t} The "spec" URL must use the http or https protocol, got "${e.protocol}".`);return}if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`${t} The "spec" field must be a URL string or an inline OpenAPI document object.`)}function validateBaseUrl(e,t){if(e.baseUrl===void 0)return;if(typeof e.baseUrl!=`string`||!URL.canParse(e.baseUrl))throw Error(`${t} The "baseUrl" field must be a valid URL when provided.`);let n=new URL(e.baseUrl);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`${t} The "baseUrl" field must use the http or https protocol, got "${n.protocol}".`)}function validateUrl(e,t){if(typeof e.url!=`string`||!URL.canParse(e.url))throw Error(`${t} The "url" field must be a valid URL.`);let n=new URL(e.url);if(n.protocol!==`https:`&&n.protocol!==`http:`)throw Error(`${t} The "url" field must use the http or https protocol, got "${n.protocol}".`)}function validateDescription(e,t){if(typeof e.description!=`string`||e.description.length===0)throw Error(`${t} The "description" field must be a non-empty string.`)}function normalizeAuthorization(r,i){if(r.auth===void 0)return;let o=expectObjectRecord(r.auth,`${i} The "auth" field must be an object with a "getToken" method.`);return expectOnlyKnownKeys(o,KNOWN_AUTHORIZATION_KEYS,`${i} The "auth" field`),normalizeAuthorizationSpec(o,i)}function normalizeHeaders(e,t){if(e.headers===void 0)return;if(typeof e.headers==`function`)return e.headers;if(typeof e.headers!=`object`||e.headers===null||Array.isArray(e.headers))throw Error(`${t} The "headers" field must be a plain object or a function.`);let n=e.headers;for(let[e,r]of Object.entries(n)){let n=typeof r;if(n!==`string`&&n!==`function`&&n!==`object`||n===`object`&&(r===null||typeof r.then!=`function`))throw Error(`${t} The "headers.${e}" value must be a string, Promise, or function.`)}return n}function normalizeToolFilter(e,t){return normalizeFilterField(e,`tools`,t)}function normalizeFilterField(e,t,n){let r=e[t];if(r===void 0)return;if(typeof r!=`object`||!r||Array.isArray(r))throw Error(`${n} The "${t}" field must specify either "allow" or "block".`);let i=r,a=`allow`in i,o=`block`in i;if(a&&o)throw Error(`${n} The "${t}" field must specify either "allow" or "block", not both.`);if(!a&&!o)throw Error(`${n} The "${t}" field must specify either "allow" or "block".`);return a?(validateStringArray(i.allow,`${n} The "${t}.allow"`),{allow:i.allow}):(validateStringArray(i.block,`${n} The "${t}.block"`),{block:i.block})}function validateStringArray(e,t){if(!Array.isArray(e))throw Error(`${t} field must be an array of strings.`);for(let n=0;n<e.length;n++)if(typeof e[n]!=`string`)throw Error(`${t}[${n}] must be a string.`)}export{normalizeMcpClientConnectionDefinition,normalizeOpenApiConnectionDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{buildSlackBinding,resolveSlackBotToken,slackContinuationToken}from"#public/channels/slack/api.js";import{buildSlackAuthContext}from"#public/channels/slack/auth.js";import{HITL_FREEFORM_MODAL_ACTION_ID,HITL_FREEFORM_MODAL_BLOCK_ID,HITL_FREEFORM_MODAL_CALLBACK_ID,buildAnsweredBlocks,buildFreeformModalView,deriveHitlResponse,freeformRequestIdFromActionId,isFreeformAction,isHitlAction}from"#public/channels/slack/hitl.js";const log=createLogger(`slack.interactions`);function parseBlockActionsPayload(e){let t=e.actions;if(!Array.isArray(t))return null;let n=e.channel?.id,r=e.message,i=r?.thread_ts??r?.ts;if(!n||!i)return null;let a=e.team,o=e.user,s=a?.id??o.team_id,c={id:o.id,username:o.username,name:o.name},l=r?.blocks??[];return{actions:t.map(e=>({actionId:String(e.action_id??``),value:e.value==null?void 0:String(e.value),blockId:e.block_id==null?void 0:String(e.block_id),selectedOptionValue:extractSelectedOptionValue(e),messageTs:r?.ts,label:extractActionLabel(e),user:c})),channelId:n,threadTs:i,teamId:s,messageBlocks:l}}function extractSelectedOptionValue(e){let t=e.selected_option;return typeof t?.value==`string`?t.value:void 0}function extractActionLabel(e){let t=e.selected_option?.text?.text;if(typeof t==`string`&&t.length>0)return t;let n=e.text?.text;if(typeof n==`string`&&n.length>0)return n}function findPromptBlock(e){for(let t of e)if(typeof t==`object`&&t&&t.type===`section`)return t}function readPromptTextFromBlocks(e){let t=findPromptBlock(e)?.text?.text;return typeof t==`string`&&t.length>0?t:void 0}async function handleInteractionPost(e,n,a){let o=new Response(`ok`,{status:200}),s=new URLSearchParams(e).get(`payload`);if(!s)return o;let c;try{c=JSON.parse(s)}catch{return log.warn(`failed to parse Slack interaction payload`),o}if(c?.type===`view_submission`)return handleViewSubmission(c,n,a);let l=parseBlockActionsPayload(c);if(!l)return o;let d=l.actions.find(e=>isFreeformAction(e.actionId));if(d)return await openFreeformModal({payload:c,interaction:l,freeformAction:d,deps:a}),o;let m=slackContinuationToken(l.channelId,l.threadTs),h=l.actions.map(deriveHitlResponse).filter(e=>e!==null);if(h.length>0){let e=l.actions[0]?.user;if(!e)return o;n.waitUntil(n.send({inputResponses:h},{auth:buildSlackAuthContext({channelId:l.channelId,teamId:l.teamId,threadTs:l.threadTs,userId:e.id,userName:e.username??e.name}),continuationToken:m,state:{channelId:l.channelId,threadTs:l.threadTs,teamId:l.teamId??null,triggeringUserId:e.id}}).catch(e=>{log.error(`HITL interaction delivery failed`,{error:e})})),n.waitUntil(updateAnsweredHitlCard(l,a).catch(e=>{log.error(`HITL answered-card update failed`,{error:e})}))}let g=a.config.onInteraction;if(g){let e=l.actions.filter(e=>!isHitlAction(e.actionId));if(e.length>0){let{thread:r,slack:i}=buildSlackBinding({botToken:a.config.credentials?.botToken,channelId:l.channelId,threadTs:l.threadTs,teamId:l.teamId}),o={thread:r,slack:i};for(let t of e)n.waitUntil(Promise.resolve(g(t,o)).catch(e=>{log.error(`custom interaction handler failed`,{error:e})}))}}return o}async function openFreeformModal(e){let t=e.payload.trigger_id;if(typeof t!=`string`||t.length===0){log.warn(`freeform button click missing trigger_id — cannot open modal`);return}let i=freeformRequestIdFromActionId(e.freeformAction.actionId)??e.freeformAction.value;if(!i){log.warn(`freeform button click missing requestId`);return}let a=e.freeformAction.messageTs;if(!a){log.warn(`freeform button click missing messageTs`);return}let o=buildFreeformModalView({metadata:{continuationToken:slackContinuationToken(e.interaction.channelId,e.interaction.threadTs),channelId:e.interaction.channelId,threadTs:e.interaction.threadTs,messageTs:a,requestId:i},prompt:readPromptTextFromBlocks(e.interaction.messageBlocks)}),s=await resolveSlackBotToken(e.deps.config.credentials?.botToken),c=await fetch(`https://slack.com/api/views.open`,{method:`POST`,headers:{authorization:`Bearer ${s}`,"content-type":`application/json; charset=utf-8`},body:JSON.stringify({trigger_id:t,view:o})});c.ok||log.error(`Slack views.open returned non-2xx`,{status:c.status})}async function handleViewSubmission(e,t,n){let r=new Response(
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{buildSlackBinding,resolveSlackBotToken,slackContinuationToken}from"#public/channels/slack/api.js";import{buildSlackAuthContext}from"#public/channels/slack/auth.js";import{HITL_FREEFORM_MODAL_ACTION_ID,HITL_FREEFORM_MODAL_BLOCK_ID,HITL_FREEFORM_MODAL_CALLBACK_ID,buildAnsweredBlocks,buildFreeformModalView,deriveHitlResponse,freeformRequestIdFromActionId,isFreeformAction,isHitlAction}from"#public/channels/slack/hitl.js";const log=createLogger(`slack.interactions`);function parseBlockActionsPayload(e){let t=e.actions;if(!Array.isArray(t))return null;let n=e.channel?.id,r=e.message,i=r?.thread_ts??r?.ts;if(!n||!i)return null;let a=e.team,o=e.user,s=a?.id??o.team_id,c={id:o.id,username:o.username,name:o.name},l=r?.blocks??[];return{actions:t.map(e=>({actionId:String(e.action_id??``),value:e.value==null?void 0:String(e.value),blockId:e.block_id==null?void 0:String(e.block_id),selectedOptionValue:extractSelectedOptionValue(e),messageTs:r?.ts,label:extractActionLabel(e),user:c})),channelId:n,threadTs:i,teamId:s,messageBlocks:l}}function extractSelectedOptionValue(e){let t=e.selected_option;return typeof t?.value==`string`?t.value:void 0}function extractActionLabel(e){let t=e.selected_option?.text?.text;if(typeof t==`string`&&t.length>0)return t;let n=e.text?.text;if(typeof n==`string`&&n.length>0)return n}function findPromptBlock(e){for(let t of e)if(typeof t==`object`&&t&&t.type===`section`)return t}function readPromptTextFromBlocks(e){let t=findPromptBlock(e)?.text?.text;return typeof t==`string`&&t.length>0?t:void 0}async function handleInteractionPost(e,n,a){let o=new Response(`ok`,{status:200}),s=new URLSearchParams(e).get(`payload`);if(!s)return o;let c;try{c=JSON.parse(s)}catch{return log.warn(`failed to parse Slack interaction payload`),o}if(c?.type===`view_submission`)return handleViewSubmission(c,n,a);let l=parseBlockActionsPayload(c);if(!l)return o;let d=l.actions.find(e=>isFreeformAction(e.actionId));if(d)return await openFreeformModal({payload:c,interaction:l,freeformAction:d,deps:a}),o;let m=slackContinuationToken(l.channelId,l.threadTs),h=l.actions.map(deriveHitlResponse).filter(e=>e!==null);if(h.length>0){let e=l.actions[0]?.user;if(!e)return o;n.waitUntil(n.send({inputResponses:h},{auth:buildSlackAuthContext({channelId:l.channelId,teamId:l.teamId,threadTs:l.threadTs,userId:e.id,userName:e.username??e.name}),continuationToken:m,state:{channelId:l.channelId,threadTs:l.threadTs,teamId:l.teamId??null,triggeringUserId:e.id}}).catch(e=>{log.error(`HITL interaction delivery failed`,{error:e})})),n.waitUntil(updateAnsweredHitlCard(l,a).catch(e=>{log.error(`HITL answered-card update failed`,{error:e})}))}let g=a.config.onInteraction;if(g){let e=l.actions.filter(e=>!isHitlAction(e.actionId));if(e.length>0){let{thread:r,slack:i}=buildSlackBinding({botToken:a.config.credentials?.botToken,channelId:l.channelId,threadTs:l.threadTs,teamId:l.teamId}),o={thread:r,slack:i};for(let t of e)n.waitUntil(Promise.resolve(g(t,o)).catch(e=>{log.error(`custom interaction handler failed`,{error:e})}))}}return o}async function openFreeformModal(e){let t=e.payload.trigger_id;if(typeof t!=`string`||t.length===0){log.warn(`freeform button click missing trigger_id — cannot open modal`);return}let i=freeformRequestIdFromActionId(e.freeformAction.actionId)??e.freeformAction.value;if(!i){log.warn(`freeform button click missing requestId`);return}let a=e.freeformAction.messageTs;if(!a){log.warn(`freeform button click missing messageTs`);return}let o=buildFreeformModalView({metadata:{continuationToken:slackContinuationToken(e.interaction.channelId,e.interaction.threadTs),channelId:e.interaction.channelId,threadTs:e.interaction.threadTs,messageTs:a,requestId:i},prompt:readPromptTextFromBlocks(e.interaction.messageBlocks)}),s=await resolveSlackBotToken(e.deps.config.credentials?.botToken),c=await fetch(`https://slack.com/api/views.open`,{method:`POST`,headers:{authorization:`Bearer ${s}`,"content-type":`application/json; charset=utf-8`},body:JSON.stringify({trigger_id:t,view:o})});c.ok||log.error(`Slack views.open returned non-2xx`,{status:c.status})}async function handleViewSubmission(e,t,n){let r=new Response(null,{status:200}),c=e.view;if(c?.callback_id!==HITL_FREEFORM_MODAL_CALLBACK_ID)return r;let l;try{l=JSON.parse(c.private_metadata??``)}catch{return log.warn(`freeform view_submission carries invalid private_metadata`),r}if(!l.continuationToken||!l.requestId||!l.messageTs||!l.channelId||!l.threadTs)return r;let u=c.state?.values?.[HITL_FREEFORM_MODAL_BLOCK_ID]?.[HITL_FREEFORM_MODAL_ACTION_ID]?.value,d=typeof u==`string`?u:``;if(d.length===0)return r;let f=e.team,p=e.user,m=p.id,h=p.team_id??f?.id??null;return t.waitUntil(t.send({inputResponses:[{requestId:l.requestId,text:d}]},{auth:buildSlackAuthContext({channelId:l.channelId,teamId:h,threadTs:l.threadTs,userId:p.id,userName:p.username??p.name}),continuationToken:l.continuationToken,state:{channelId:l.channelId,threadTs:l.threadTs,teamId:h,triggeringUserId:m}}).catch(e=>{log.error(`freeform answer delivery failed`,{error:e})})),t.waitUntil(updateAnsweredFreeformCard({channelId:l.channelId,messageTs:l.messageTs,answerLabel:d,userId:m??void 0,deps:n}).catch(e=>{log.error(`freeform answered-card update failed`,{error:e})})),r}async function updateAnsweredHitlCard(e,t){let r=e.actions.find(e=>isHitlAction(e.actionId));if(!r||!r.messageTs)return;let i=r.label??r.selectedOptionValue??r.value;if(!i)return;let a=buildAnsweredBlocks({promptBlock:findPromptBlock(e.messageBlocks),answerLabel:i,userId:r.user.id}),o=await resolveSlackBotToken(t.config.credentials?.botToken),s=await fetch(`https://slack.com/api/chat.update`,{method:`POST`,headers:{authorization:`Bearer ${o}`,"content-type":`application/json; charset=utf-8`},body:JSON.stringify({channel:e.channelId,ts:r.messageTs,blocks:a,text:`Answered: ${i}`})});if(!s.ok)throw Error(`Slack chat.update returned HTTP ${s.status}`)}async function updateAnsweredFreeformCard(e){let t=buildAnsweredBlocks({promptBlock:void 0,answerLabel:e.answerLabel,userId:e.userId}),r=await resolveSlackBotToken(e.deps.config.credentials?.botToken),i=await fetch(`https://slack.com/api/chat.update`,{method:`POST`,headers:{authorization:`Bearer ${r}`,"content-type":`application/json; charset=utf-8`},body:JSON.stringify({channel:e.channelId,ts:e.messageTs,blocks:t,text:`Answered: ${e.answerLabel}`})});if(!i.ok)throw Error(`Slack chat.update returned HTTP ${i.status}`)}export{handleInteractionPost,parseBlockActionsPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AuthKey}from"#context/keys.js";import{contextStorage}from"#context/container.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";function principalKey(e){return e.type===`app`?`app`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(
|
|
1
|
+
import{AuthKey}from"#context/keys.js";import{contextStorage}from"#context/container.js";import{ConnectionAuthorizationFailedError}from"#public/connections/errors.js";function principalKey(e){return e.type===`app`?`app`:`user:${e.issuer}:${e.id}`}function resolveConnectionPrincipal(r,i,a=contextStorage.getStore()){if(i.principalType===`app`)return{type:`app`};let o=a?.get(AuthKey);if(o==null||o.principalType!==`user`)throw new ConnectionAuthorizationFailedError(r,{message:buildUserPrincipalRequiredMessage(r,a,o?.principalType),reason:`principal_required`,retryable:!1});return{attributes:o.attributes,id:o.principalId,issuer:o.issuer??o.authenticator,type:`user`}}function buildUserPrincipalRequiredMessage(e,t,n){let r;return r=t===void 0?`it was invoked outside an eve context, so no authenticated user can be resolved.`:n===void 0?`the active session has no authenticated user.`:`the active session is scoped to "${n}", not an authenticated user.`,`Connection "${e}" is user-scoped, but ${r} User-scoped connections require route auth that resolves an authenticated user. If this connection should use credentials shared by the agent instead, configure it as an app-scoped connection.`}export{principalKey,resolveConnectionPrincipal};
|
|
@@ -17,6 +17,13 @@ export interface RunVercelOptions {
|
|
|
17
17
|
*/
|
|
18
18
|
timeoutMs?: number;
|
|
19
19
|
}
|
|
20
|
+
interface VercelCliInvocation {
|
|
21
|
+
command: string;
|
|
22
|
+
commandArgs: string[];
|
|
23
|
+
shell?: boolean;
|
|
24
|
+
}
|
|
25
|
+
type Platform = NodeJS.Platform;
|
|
26
|
+
export declare function resolveVercelInvocation(cwd: string, args?: string[], platform?: Platform): VercelCliInvocation;
|
|
20
27
|
/**
|
|
21
28
|
* Runs a Vercel CLI command with the Connect feature flag enabled.
|
|
22
29
|
*
|
|
@@ -73,3 +80,4 @@ export type VercelCaptureResult = {
|
|
|
73
80
|
* streamed to it and the failure summary is appended after a non-zero exit.
|
|
74
81
|
*/
|
|
75
82
|
export declare function captureVercel(args: string[], options: RunVercelOptions): Promise<VercelCaptureResult>;
|
|
83
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withoutCodingAgentMarkers}from"./coding-agent-env.js";import{createProcessOutputBuffer}from"./process-output.js";import{armProcessAbort}from"./process-abort.js";import{accessSync,constants,existsSync,statSync}from"node:fs";import{dirname,join,resolve}from"node:path";import{spawn}from"node:child_process";const CONNECT_FEATURE_FLAG_ENV={FF_CONNECT_ENABLED:`1`},VERCEL_NOT_FOUND_MESSAGE=`Vercel CLI not found. Install with: npm i -g vercel@latest`;function buildSpawnEnv(t){return{...withoutCodingAgentMarkers(process.env),...CONNECT_FEATURE_FLAG_ENV,...t}}function commandArgs(e,t){return!t||e.includes(`--non-interactive`)?e:[...e,`--non-interactive`]}function existingDir(e){let t=resolve(e);for(;!existsSync(t);){let e=dirname(t);if(e===t)break;t=e}return t}function armDeadline(e,t,n){if(t===void 0)return()=>{};let r=setTimeout(()=>{n(),e.kill(`SIGTERM`);let t=setTimeout(()=>e.kill(`SIGKILL`),5e3);t.unref(),e.once(`close`,()=>clearTimeout(t))},t);return r.unref(),()=>clearTimeout(r)}function timeoutMessage(e,t){return`vercel ${e.join(` `)} timed out after ${Math.round(t/1e3)}s and was aborted.`}function abortMessage(e){return`vercel ${e.join(` `)} was aborted.`}function isAbortError(e,t){return t?.aborted===!0||e.name===`AbortError`||e.code===`ABORT_ERR`}function ancestorDirectories(e){let t=[],n=resolve(e);for(;;){t.push(n);let e=dirname(n);if(e===n)return t;n=e}}function findExecutable(e){try{if(accessSync(e,constants.F_OK|constants.X_OK),statSync(e).isFile())return e}catch{return}}function findLocalVercel(e){for(let
|
|
1
|
+
import{withoutCodingAgentMarkers}from"./coding-agent-env.js";import{createProcessOutputBuffer}from"./process-output.js";import{armProcessAbort}from"./process-abort.js";import{accessSync,constants,existsSync,statSync}from"node:fs";import{dirname,join,resolve}from"node:path";import{spawn}from"node:child_process";const CONNECT_FEATURE_FLAG_ENV={FF_CONNECT_ENABLED:`1`},VERCEL_NOT_FOUND_MESSAGE=`Vercel CLI not found. Install with: npm i -g vercel@latest`;function buildSpawnEnv(t){return{...withoutCodingAgentMarkers(process.env),...CONNECT_FEATURE_FLAG_ENV,...t}}function commandArgs(e,t){return!t||e.includes(`--non-interactive`)?e:[...e,`--non-interactive`]}function existingDir(e){let t=resolve(e);for(;!existsSync(t);){let e=dirname(t);if(e===t)break;t=e}return t}function armDeadline(e,t,n){if(t===void 0)return()=>{};let r=setTimeout(()=>{n(),e.kill(`SIGTERM`);let t=setTimeout(()=>e.kill(`SIGKILL`),5e3);t.unref(),e.once(`close`,()=>clearTimeout(t))},t);return r.unref(),()=>clearTimeout(r)}function timeoutMessage(e,t){return`vercel ${e.join(` `)} timed out after ${Math.round(t/1e3)}s and was aborted.`}function abortMessage(e){return`vercel ${e.join(` `)} was aborted.`}function isAbortError(e,t){return t?.aborted===!0||e.name===`AbortError`||e.code===`ABORT_ERR`}function ancestorDirectories(e){let t=[],n=resolve(e);for(;;){t.push(n);let e=dirname(n);if(e===n)return t;n=e}}function findExecutable(e){try{if(accessSync(e,constants.F_OK|constants.X_OK),statSync(e).isFile())return e}catch{return}}function vercelExecutableNames(e){return e===`win32`?[`vercel.cmd`,`vercel.exe`]:[`vercel`]}function findLocalVercel(e,t){for(let n of ancestorDirectories(e))for(let e of vercelExecutableNames(t)){let t=findExecutable(join(n,`node_modules`,`.bin`,e));if(t!==void 0)return t}}function resolveVercelInvocation(e,t=[],n=process.platform){let r=findLocalVercel(e,n);return n===`win32`?{command:r??`vercel`,commandArgs:t,shell:!0}:r===void 0?{command:`vercel`,commandArgs:t}:{command:r,commandArgs:t}}function stdioForRun(e){return e.onOutput?[e.nonInteractive?`ignore`:`inherit`,`pipe`,`pipe`]:e.nonInteractive?[`ignore`,`pipe`,`pipe`]:`inherit`}async function runVercel(e,r){return r.signal?.aborted===!0?!1:new Promise(i=>{let a=existingDir(r.cwd),o=resolveVercelInvocation(a,commandArgs(e,r.nonInteractive)),s=r.onOutput&&createProcessOutputBuffer(r.onOutput),c=spawn(o.command,o.commandArgs,{cwd:a,stdio:stdioForRun(r),env:buildSpawnEnv(r.extraEnv??{}),shell:o.shell,signal:r.signal}),l=armProcessAbort(c,r.signal);c.stdout?.on(`data`,e=>s?.write(`stdout`,e)),c.stderr?.on(`data`,e=>s?.write(`stderr`,e));let u=!1;function settle(e){u||(u=!0,s?.flush(),i(e))}function reportFailure(e){r.onOutput?r.onOutput({stream:`stderr`,text:e}):process.stderr.write(`\n${e}\n`)}let d=armDeadline(c,r.timeoutMs,()=>{reportFailure(timeoutMessage(e,r.timeoutMs??0)),settle(!1)});c.on(`error`,t=>{isAbortError(t,r.signal)||(t.code===`ENOENT`?(l(),d(),reportFailure(VERCEL_NOT_FOUND_MESSAGE),settle(!1)):(l(),d(),reportFailure(`vercel ${e.join(` `)} failed: ${t.message}`),settle(!1)))}),c.on(`close`,t=>{if(l(),d(),r.signal?.aborted===!0){settle(!1);return}!u&&t!==0&&t!==null&&(s?.flush(),reportFailure(`vercel ${e.join(` `)} exited with code ${t}.`)),settle(t===0)})})}async function runVercelCaptureStdout(e,r){return r.signal?.aborted===!0?{ok:!1,stdout:``}:new Promise(i=>{let a=existingDir(r.cwd),o=resolveVercelInvocation(a,commandArgs(e,r.nonInteractive)),s=r.onOutput&&createProcessOutputBuffer(r.onOutput),c=spawn(o.command,o.commandArgs,{cwd:a,stdio:[r.nonInteractive?`ignore`:`inherit`,`pipe`,r.onOutput?`pipe`:`inherit`],env:buildSpawnEnv(r.extraEnv??{}),shell:o.shell,signal:r.signal}),l=armProcessAbort(c,r.signal),u=[];c.stdout?.on(`data`,e=>u.push(e.toString(`utf8`))),c.stderr?.on(`data`,e=>s?.write(`stderr`,e));let d=!1;function settle(e){d||(d=!0,s?.flush(),i({ok:e,stdout:u.join(``)}))}function reportFailure(e){r.onOutput?r.onOutput({stream:`stderr`,text:e}):process.stderr.write(`\n${e}\n`)}let f=armDeadline(c,r.timeoutMs,()=>{reportFailure(timeoutMessage(e,r.timeoutMs??0)),settle(!1)});c.on(`error`,t=>{isAbortError(t,r.signal)||(l(),f(),reportFailure(t.code===`ENOENT`?VERCEL_NOT_FOUND_MESSAGE:`vercel ${e.join(` `)} failed: ${t.message}`),settle(!1))}),c.on(`close`,t=>{if(l(),f(),r.signal?.aborted===!0){settle(!1);return}!d&&t!==0&&t!==null&&reportFailure(`vercel ${e.join(` `)} exited with code ${t}.`),settle(t===0)})})}async function captureVercel(e,r){return r.signal?.aborted===!0?{ok:!1,failure:{errno:`ABORT_ERR`,stdout:``,stderr:``,message:abortMessage(e)}}:new Promise(i=>{let a=existingDir(r.cwd),o=resolveVercelInvocation(a,commandArgs(e,r.nonInteractive)),s=r.onOutput&&createProcessOutputBuffer(r.onOutput),c=spawn(o.command,o.commandArgs,{cwd:a,stdio:[`ignore`,`pipe`,`pipe`],env:buildSpawnEnv(r.extraEnv??{}),shell:o.shell,signal:r.signal}),l=armProcessAbort(c,r.signal),u=[],d=[];c.stdout?.on(`data`,e=>u.push(e.toString(`utf8`))),c.stderr?.on(`data`,e=>{d.push(e.toString(`utf8`)),s?.write(`stderr`,e)});let f=!1;function fail(e,t=!0){f||(f=!0,s?.flush(),t&&r.onOutput?.({stream:`stderr`,text:e.message}),i({ok:!1,failure:e}))}function succeed(){f||(f=!0,s?.flush(),i({ok:!0,stdout:u.join(``)}))}let p=armDeadline(c,r.timeoutMs,()=>{fail({code:null,stdout:u.join(``),stderr:d.join(``),message:timeoutMessage(e,r.timeoutMs??0)})});c.on(`error`,t=>{isAbortError(t,r.signal)||(l(),p(),fail({errno:t.code,stdout:u.join(``),stderr:d.join(``),message:t.code===`ENOENT`?VERCEL_NOT_FOUND_MESSAGE:`vercel ${e.join(` `)} failed: ${t.message}`}))}),c.on(`close`,t=>{if(l(),p(),r.signal?.aborted===!0){fail({errno:`ABORT_ERR`,stdout:u.join(``),stderr:d.join(``),message:abortMessage(e)},!1);return}if(t!==0&&t!==null){fail({code:t,stdout:u.join(``),stderr:d.join(``),message:`vercel ${e.join(` `)} exited with code ${t}.`});return}succeed()})})}export{captureVercel,resolveVercelInvocation,runVercel,runVercelCaptureStdout};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`7.0.0-beta.178`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.13.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`7.0.0-beta.178`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.13.7`,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){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).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__",
|
|
@@ -75,7 +75,11 @@ dist
|
|
|
75
75
|
dist
|
|
76
76
|
`,"AGENTS.md":`# eve Agent App
|
|
77
77
|
|
|
78
|
-
This project uses the eve framework. Before writing code,
|
|
78
|
+
This project uses the eve framework. Before writing code, read the relevant guide
|
|
79
|
+
from the installed eve package docs. In most installs, those docs are at
|
|
80
|
+
\`node_modules/eve/docs/\`. In workspaces or local package installs, resolve the
|
|
81
|
+
installed \`eve\` package location first and read its \`docs/\` directory. If
|
|
82
|
+
package docs are unavailable, use https://eve.dev/docs as a fallback.
|
|
79
83
|
`,"CLAUDE.md":`@AGENTS.md
|
|
80
84
|
`};function templateFiles(e,t){return{"agent/agent.ts":e?`import { defineAgent } from "eve";
|
|
81
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const WEB_APP_TEMPLATE_FILES: {
|
|
2
2
|
readonly "agent/channels/eve.ts": 'import { eveChannel } from "eve/channels/eve";\nimport { localDev, placeholderAuth, vercelOidc } from "eve/channels/auth";\n\nexport default eveChannel({\n auth: [\n // Open on localhost for `eve dev` and the REPL; ignored in production.\n localDev(),\n // Lets the eve TUI and your Vercel deployments reach the deployed agent.\n vercelOidc(),\n // This placeholder will not allow browser requests in production.\n // Replace it with your app\'s auth provider, like Auth.js or Clerk,\n // or use none() for a public demo.\n placeholderAuth(),\n ],\n});\n';
|
|
3
|
-
readonly "app/_components/agent-chat.tsx": '"use client";\n\nimport { useEveAgent } from "eve/react";\nimport { AlertCircleIcon } from "lucide-react";\nimport {\n Conversation,\n ConversationContent,\n ConversationScrollButton,\n} from "@/components/ai-elements/conversation";\nimport {\n PromptInput,\n type PromptInputMessage,\n PromptInputSubmit,\n PromptInputTextarea,\n} from "@/components/ai-elements/prompt-input";\nimport { cn } from "@/lib/utils";\nimport { AgentMessage } from "./agent-message";\n\nconst AGENT_NAME = "__EVE_INIT_APP_NAME__";\
|
|
3
|
+
readonly "app/_components/agent-chat.tsx": '"use client";\n\nimport { useEveAgent } from "eve/react";\nimport { AlertCircleIcon } from "lucide-react";\nimport {\n Conversation,\n ConversationContent,\n ConversationScrollButton,\n} from "@/components/ai-elements/conversation";\nimport {\n PromptInput,\n type PromptInputMessage,\n PromptInputSubmit,\n PromptInputTextarea,\n} from "@/components/ai-elements/prompt-input";\nimport { cn } from "@/lib/utils";\nimport { AgentMessage } from "./agent-message";\n\nconst AGENT_NAME = "__EVE_INIT_APP_NAME__";\n\ntype AgentStatus = ReturnType<typeof useEveAgent>["status"];\n\nexport function AgentChat() {\n const agent = useEveAgent();\n const isBusy = agent.status === "submitted" || agent.status === "streaming";\n const isEmpty = agent.data.messages.length === 0;\n\n const handleSubmit = async (message: PromptInputMessage) => {\n const text = message.text.trim();\n if (!text || isBusy) return;\n\n await agent.send({ message: text });\n };\n\n const composer = (\n <PromptInput onSubmit={handleSubmit}>\n <PromptInputTextarea placeholder="Send a message…" />\n <PromptInputSubmit onStop={agent.stop} status={agent.status} />\n </PromptInput>\n );\n\n return (\n <main className="flex h-dvh flex-col overflow-hidden bg-background text-foreground">\n {isEmpty ? null : (\n <header className="flex h-14 shrink-0 items-center justify-center gap-3 pl-4 pr-2">\n <span className="flex min-w-0 items-center gap-2">\n <span className="truncate text-muted-foreground text-sm">{AGENT_NAME}</span>\n <StatusDot status={agent.status} />\n </span>\n </header>\n )}\n\n {agent.error ? (\n <div className="mx-auto w-full max-w-3xl shrink-0 px-4 pt-2 sm:px-6">\n <div className="flex items-start gap-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm">\n <AlertCircleIcon className="mt-0.5 size-4 shrink-0 text-destructive" />\n <div>\n <p className="font-medium">Request failed</p>\n <p className="mt-0.5 text-muted-foreground">{agent.error.message}</p>\n </div>\n </div>\n </div>\n ) : null}\n\n {isEmpty ? null : (\n <Conversation className="min-h-0 flex-1">\n <ConversationContent className="mx-auto w-full max-w-3xl gap-6 px-4 py-6 sm:px-6">\n {agent.data.messages.map((message, index) => (\n <AgentMessage\n canRespond={!isBusy}\n isStreaming={\n agent.status === "streaming" && index === agent.data.messages.length - 1\n }\n key={message.id}\n message={message}\n onInputResponses={(inputResponses) => agent.send({ inputResponses })}\n />\n ))}\n </ConversationContent>\n <ConversationScrollButton />\n </Conversation>\n )}\n\n <div\n className={cn(\n "mx-auto w-full px-4 sm:px-6",\n isEmpty\n ? "flex max-w-xl flex-1 flex-col items-center justify-center gap-8 pb-[10vh]"\n : "max-w-3xl shrink-0 pb-6",\n )}\n >\n {isEmpty ? (\n <div className="flex flex-col items-center gap-3 text-center">\n <h1 className="font-medium text-5xl tracking-tighter">{AGENT_NAME}</h1>\n </div>\n ) : null}\n <div className="w-full">{composer}</div>\n </div>\n </main>\n );\n}\n\nfunction StatusDot({ status }: { readonly status: AgentStatus }) {\n const isLive = status === "submitted" || status === "streaming";\n const tone =\n status === "error"\n ? "bg-destructive"\n : isLive\n ? "bg-emerald-500"\n : status === "ready"\n ? "bg-muted-foreground"\n : "bg-muted-foreground/50";\n\n return (\n <span className="relative flex size-1">\n {isLive ? (\n <span\n className={cn(\n "absolute inline-flex size-full animate-ping rounded-full opacity-75",\n tone,\n )}\n />\n ) : null}\n <span className={cn("relative inline-flex size-1 rounded-full transition-colors", tone)} />\n </span>\n );\n}\n';
|
|
4
4
|
readonly "app/_components/agent-message.tsx": '"use client";\n\nimport type { EveDynamicToolPart, EveMessage, EveMessagePart } from "eve/react";\nimport { Message, MessageContent, MessageResponse } from "@/components/ai-elements/message";\nimport { Reasoning, ReasoningContent, ReasoningTrigger } from "@/components/ai-elements/reasoning";\nimport {\n Tool,\n ToolContent,\n ToolHeader,\n ToolInput,\n ToolOutput,\n} from "@/components/ai-elements/tool";\nimport { Button } from "@/components/ui/button";\n\nexport type AgentInputResponse = {\n readonly optionId?: string;\n readonly requestId: string;\n readonly text?: string;\n};\n\nexport function AgentMessage({\n canRespond,\n isStreaming,\n message,\n onInputResponses,\n}: {\n readonly canRespond: boolean;\n readonly isStreaming: boolean;\n readonly message: EveMessage;\n readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;\n}) {\n const lastTextIndex = message.parts.reduce(\n (last, part, index) => (part.type === "text" ? index : last),\n -1,\n );\n\n return (\n <Message\n data-optimistic={message.metadata?.optimistic ? "true" : undefined}\n from={message.role}\n >\n <MessageContent>\n {message.parts.map((part, index) => (\n <AgentMessagePart\n canRespond={canRespond}\n key={partKey(part, index)}\n onInputResponses={onInputResponses}\n part={part}\n showCaret={isStreaming && message.role === "assistant" && index === lastTextIndex}\n />\n ))}\n </MessageContent>\n </Message>\n );\n}\n\nfunction AgentMessagePart({\n canRespond,\n onInputResponses,\n part,\n showCaret,\n}: {\n readonly canRespond: boolean;\n readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;\n readonly part: EveMessagePart;\n readonly showCaret: boolean;\n}) {\n switch (part.type) {\n case "step-start":\n return null;\n case "text":\n return (\n <MessageResponse caret="block" isAnimating={showCaret}>\n {part.text}\n </MessageResponse>\n );\n case "reasoning":\n return (\n <Reasoning defaultOpen isStreaming={part.state === "streaming"}>\n <ReasoningTrigger />\n <ReasoningContent>{part.text}</ReasoningContent>\n </Reasoning>\n );\n case "dynamic-tool":\n return (\n <Tool\n defaultOpen={part.state === "approval-requested" || part.state === "approval-responded"}\n >\n <ToolHeader\n state={part.state}\n title={part.toolName}\n toolName={part.toolName}\n type="dynamic-tool"\n />\n <ToolContent>\n <ToolInput input={part.input} />\n <InputRequestActions\n canRespond={canRespond}\n part={part}\n onInputResponses={onInputResponses}\n />\n <ToolOutput errorText={part.errorText} output={part.output} />\n </ToolContent>\n </Tool>\n );\n }\n}\n\nfunction InputRequestActions({\n canRespond,\n onInputResponses,\n part,\n}: {\n readonly canRespond: boolean;\n readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;\n readonly part: EveDynamicToolPart;\n}) {\n const inputRequest = part.toolMetadata?.eve?.inputRequest;\n if (!inputRequest) {\n return null;\n }\n\n const inputResponse = part.toolMetadata?.eve?.inputResponse;\n const selectedOption = inputRequest.options?.find(\n (option) => option.id === inputResponse?.optionId,\n );\n\n return (\n <div className="space-y-3 rounded-md border border-yellow-500/30 bg-yellow-500/5 p-3">\n <p className="text-muted-foreground text-sm">{inputRequest.prompt}</p>\n {inputResponse ? (\n <p className="font-medium text-sm">\n Responded: {selectedOption?.label ?? inputResponse.text ?? inputResponse.optionId}\n </p>\n ) : (\n <div className="flex flex-wrap gap-2">\n {inputRequest.options?.map((option) => (\n <Button\n disabled={!canRespond}\n key={option.id}\n onClick={() => {\n void onInputResponses([\n {\n optionId: option.id,\n requestId: inputRequest.requestId,\n },\n ]);\n }}\n size="sm"\n type="button"\n variant={option.style === "danger" ? "destructive" : "default"}\n >\n {option.label}\n </Button>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nfunction partKey(part: EveMessagePart, index: number): string {\n switch (part.type) {\n case "dynamic-tool":\n return part.toolCallId;\n default:\n return `${part.type}:${index}`;\n }\n}\n';
|
|
5
5
|
readonly "app/globals.css": '@import "tailwindcss";\n@source "../node_modules/streamdown/dist/*.js";\n\n@theme inline {\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-card-foreground: var(--card-foreground);\n --color-popover: var(--popover);\n --color-popover-foreground: var(--popover-foreground);\n --color-primary: var(--primary);\n --color-primary-foreground: var(--primary-foreground);\n --color-secondary: var(--secondary);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-muted: var(--muted);\n --color-muted-foreground: var(--muted-foreground);\n --color-accent: var(--accent);\n --color-accent-foreground: var(--accent-foreground);\n --color-destructive: var(--destructive);\n --color-border: var(--border);\n --color-input: var(--input);\n --color-ring: var(--ring);\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --font-sans: "Geist", "Geist Fallback", ui-sans-serif, system-ui, sans-serif;\n --font-mono: "Geist Mono", "Geist Mono Fallback", ui-monospace, monospace;\n}\n\n:root {\n color-scheme: light;\n /* Soft neutral page with white elevated surfaces so cards/composer pop. */\n --background: oklch(0.971 0 0);\n --foreground: oklch(0.16 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.16 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.16 0 0);\n --primary: oklch(0.19 0 0);\n --primary-foreground: oklch(0.985 0 0);\n --secondary: oklch(0.94 0 0);\n --secondary-foreground: oklch(0.19 0 0);\n --muted: oklch(0.94 0 0);\n --muted-foreground: oklch(0.6 0 0);\n --accent: oklch(0.94 0 0);\n --accent-foreground: oklch(0.19 0 0);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.916 0 0);\n --input: oklch(0.916 0 0);\n --ring: oklch(0.708 0 0);\n --radius: 0.625rem;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.205 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.205 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.922 0 0);\n --primary-foreground: oklch(0.205 0 0);\n --secondary: oklch(0.269 0 0);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.269 0 0);\n --muted-foreground: oklch(0.708 0 0);\n --accent: oklch(0.269 0 0);\n --accent-foreground: oklch(0.985 0 0);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n --ring: oklch(0.556 0 0);\n }\n}\n\n* {\n border-color: var(--border);\n}\n\nhtml {\n height: 100%;\n}\n\nbody {\n min-height: 100%;\n margin: 0;\n background: var(--background);\n font-family: var(--font-sans);\n}\n\nbutton,\ninput,\ntextarea {\n font: inherit;\n}\n';
|
|
6
6
|
readonly "app/layout.tsx": 'import type { Metadata } from "next";\nimport { Geist, Geist_Mono } from "next/font/google";\nimport type { ReactNode } from "react";\nimport { TooltipProvider } from "@/components/ui/tooltip";\nimport { cn } from "@/lib/utils";\nimport "./globals.css";\n\nconst sans = Geist({\n variable: "--font-sans",\n subsets: ["latin"],\n weight: "variable",\n display: "swap",\n});\n\nconst mono = Geist_Mono({\n variable: "--font-mono",\n subsets: ["latin"],\n weight: "variable",\n display: "swap",\n});\n\nexport const metadata: Metadata = {\n title: "__EVE_INIT_APP_NAME__",\n description: "A Next.js starter for eve agents with AI Elements.",\n};\n\nexport default function RootLayout({ children }: { readonly children: ReactNode }) {\n return (\n <html className={cn(sans.variable, mono.variable)} lang="en">\n <body>\n <TooltipProvider>{children}</TooltipProvider>\n </body>\n </html>\n );\n}\n';
|
|
@@ -32,7 +32,6 @@ import { cn } from "@/lib/utils";
|
|
|
32
32
|
import { AgentMessage } from "./agent-message";
|
|
33
33
|
|
|
34
34
|
const AGENT_NAME = "__EVE_INIT_APP_NAME__";
|
|
35
|
-
const BETA_TERMS_HREF = "https://vercel.com/docs/release-phases/public-beta-agreement";
|
|
36
35
|
|
|
37
36
|
type AgentStatus = ReturnType<typeof useEveAgent>["status"];
|
|
38
37
|
|
|
@@ -63,14 +62,6 @@ export function AgentChat() {
|
|
|
63
62
|
<span className="truncate text-muted-foreground text-sm">{AGENT_NAME}</span>
|
|
64
63
|
<StatusDot status={agent.status} />
|
|
65
64
|
</span>
|
|
66
|
-
<a
|
|
67
|
-
className="rounded-full border border-amber-500/30 px-2 py-0.5 font-medium text-amber-700 text-xs transition-colors hover:bg-amber-500/10 dark:text-amber-300"
|
|
68
|
-
href={BETA_TERMS_HREF}
|
|
69
|
-
rel="noreferrer"
|
|
70
|
-
target="_blank"
|
|
71
|
-
>
|
|
72
|
-
Public preview
|
|
73
|
-
</a>
|
|
74
65
|
</header>
|
|
75
66
|
)}
|
|
76
67
|
|
|
@@ -116,14 +107,6 @@ export function AgentChat() {
|
|
|
116
107
|
{isEmpty ? (
|
|
117
108
|
<div className="flex flex-col items-center gap-3 text-center">
|
|
118
109
|
<h1 className="font-medium text-5xl tracking-tighter">{AGENT_NAME}</h1>
|
|
119
|
-
<a
|
|
120
|
-
className="rounded-full border border-amber-500/30 px-2 py-0.5 font-medium text-amber-700 text-xs transition-colors hover:bg-amber-500/10 dark:text-amber-300"
|
|
121
|
-
href={BETA_TERMS_HREF}
|
|
122
|
-
rel="noreferrer"
|
|
123
|
-
target="_blank"
|
|
124
|
-
>
|
|
125
|
-
Public preview
|
|
126
|
-
</a>
|
|
127
110
|
</div>
|
|
128
111
|
) : null}
|
|
129
112
|
<div className="w-full">{composer}</div>
|
package/docs/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Important naming note:
|
|
|
12
12
|
|
|
13
13
|
## Legal and safeguards
|
|
14
14
|
|
|
15
|
-
eve is
|
|
15
|
+
eve is in preview; the framework, APIs, documentation, and behavior may change before general availability.
|
|
16
16
|
|
|
17
17
|
As the deployer, it is your responsibility to ensure your agent complies with applicable laws.
|
|
18
18
|
|
|
@@ -41,7 +41,7 @@ Read in this order:
|
|
|
41
41
|
6. [Context Control](./concepts/context-control.md)
|
|
42
42
|
7. [Skills](./skills.mdx)
|
|
43
43
|
8. [Tools](./tools/overview.mdx)
|
|
44
|
-
9. [Connections](./connections.mdx)
|
|
44
|
+
9. [Connections](./connections/overview.mdx)
|
|
45
45
|
10. [Sandboxes](./sandbox.mdx)
|
|
46
46
|
11. [Channels](./channels/overview.mdx)
|
|
47
47
|
12. [Session Context](./reference/typescript-api.md)
|
package/docs/channels/linear.mdx
CHANGED
|
@@ -158,4 +158,4 @@ For issue or comment targets, the channel calls Linear's proactive Agent Session
|
|
|
158
158
|
## What to read next
|
|
159
159
|
|
|
160
160
|
- [Channels overview](./overview): the channel contract and every built-in channel
|
|
161
|
-
- [
|
|
161
|
+
- [MCP connections](../connections/mcp): use the Linear MCP connection when the agent needs to inspect or edit Linear data from another channel
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "MCP Connections"
|
|
3
|
+
description: "Connect an eve agent to a remote MCP server and control which tools the model can discover."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
MCP connections point eve at an MCP server you do not author. The server publishes its tools and schemas, and eve exposes matched tools to the model through `connection_search`.
|
|
7
|
+
|
|
8
|
+
Use MCP when the service already has an MCP server, when the server needs to own tool schemas dynamically, or when one connection should expose a family of related remote tools.
|
|
9
|
+
|
|
10
|
+
## Define an MCP connection
|
|
11
|
+
|
|
12
|
+
`defineMcpClientConnection` needs a `url` and a `description`:
|
|
13
|
+
|
|
14
|
+
```ts title="agent/connections/linear.ts"
|
|
15
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
16
|
+
|
|
17
|
+
export default defineMcpClientConnection({
|
|
18
|
+
url: "https://mcp.linear.app/sse",
|
|
19
|
+
description: "Linear workspace: issues, projects, cycles, and comments.",
|
|
20
|
+
auth: {
|
|
21
|
+
getToken: async () => ({ token: process.env.LINEAR_API_TOKEN! }),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The `url` must speak Streamable HTTP or SSE. Write the `description` for the model, not for yourself. It shows up in `connection_search`, and the model uses it to decide which connection to query.
|
|
27
|
+
|
|
28
|
+
The file path provides the connection name. `agent/connections/linear.ts` registers as `linear`, and remote tools appear as `linear__<tool>` after discovery.
|
|
29
|
+
|
|
30
|
+
## Tool filters
|
|
31
|
+
|
|
32
|
+
To narrow which remote tools the model sees, set exactly one of `tools.allow` or `tools.block`. Filtered-out tools do not appear in `connection_search`:
|
|
33
|
+
|
|
34
|
+
```ts title="agent/connections/linear.ts"
|
|
35
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
36
|
+
|
|
37
|
+
export default defineMcpClientConnection({
|
|
38
|
+
url: "https://mcp.linear.app/sse",
|
|
39
|
+
description: "Linear: read-only.",
|
|
40
|
+
auth: { getToken: async () => ({ token: process.env.LINEAR_API_TOKEN! }) },
|
|
41
|
+
tools: { allow: ["search_issues", "get_issue"] },
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use `allow` for the smallest safe surface, especially on MCP servers that expose write tools alongside read tools. Use `block` only when the server has a broad stable surface and you need to hide a few tools.
|
|
46
|
+
|
|
47
|
+
## Auth, headers, and approval
|
|
48
|
+
|
|
49
|
+
MCP connections support the shared connection options:
|
|
50
|
+
|
|
51
|
+
- `auth` for static tokens, Vercel Connect, or self-hosted interactive OAuth.
|
|
52
|
+
- `headers` for API-key schemes or extra server configuration.
|
|
53
|
+
- `approval` for human-in-the-loop gates before connection tools run.
|
|
54
|
+
|
|
55
|
+
See [Connections](/docs/connections) for the shared auth, headers, and approval shapes.
|
|
56
|
+
|
|
57
|
+
## What to read next
|
|
58
|
+
|
|
59
|
+
- [OpenAPI connections](./openapi): generate tools from OpenAPI operations.
|
|
60
|
+
- [Auth & route protection](../guides/auth-and-route-protection): the full interactive-OAuth flow with Vercel Connect.
|
|
61
|
+
- [Security model](../concepts/security-model): how connection credentials stay out of the model's reach.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "OpenAPI Connections"
|
|
3
|
+
description: "Turn an OpenAPI 3.x document into eve connection tools, one tool per operation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
OpenAPI connections turn any OpenAPI 3.x document into connection tools, one per operation. Use OpenAPI when a service already publishes an HTTP API contract and you want eve to derive the model-facing tools from that contract.
|
|
7
|
+
|
|
8
|
+
## Define an OpenAPI connection
|
|
9
|
+
|
|
10
|
+
`defineOpenAPIConnection` takes an HTTPS URL that eve fetches at runtime, or an inline parsed object:
|
|
11
|
+
|
|
12
|
+
```ts title="agent/connections/petstore.ts"
|
|
13
|
+
import { defineOpenAPIConnection } from "eve/connections";
|
|
14
|
+
|
|
15
|
+
export default defineOpenAPIConnection({
|
|
16
|
+
spec: "https://petstore3.swagger.io/api/v3/openapi.json",
|
|
17
|
+
description: "Pet store inventory and orders.",
|
|
18
|
+
auth: { getToken: async () => ({ token: process.env.PETSTORE_TOKEN! }) },
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Each operation becomes `<connection>__<operationId>` (e.g. `petstore__getInventory`). When an operation has no `operationId`, eve derives a deterministic `<method>_<sanitized-path>` name instead.
|
|
23
|
+
|
|
24
|
+
The file path provides the connection name. `agent/connections/petstore.ts` registers as `petstore`, so operation tools are qualified under `petstore__`.
|
|
25
|
+
|
|
26
|
+
## OpenAPI fields
|
|
27
|
+
|
|
28
|
+
OpenAPI connections use the shared connection fields from [Connections](/docs/connections), plus two OpenAPI-specific fields:
|
|
29
|
+
|
|
30
|
+
| Field | Purpose |
|
|
31
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `baseUrl` | Base URL operation paths resolve against. Optional; defaults to the document's first usable `servers` entry. |
|
|
33
|
+
| `operations` | Filter keyed on `operationId` (`allow` or `block`). Mirrors `tools` on MCP connections, but names operations. |
|
|
34
|
+
|
|
35
|
+
Use `baseUrl` when the spec's `servers` list is absent, points at the wrong environment, or needs to be pinned for this agent.
|
|
36
|
+
|
|
37
|
+
## Operation filters
|
|
38
|
+
|
|
39
|
+
To narrow which generated tools the model sees, set exactly one of `operations.allow` or `operations.block`:
|
|
40
|
+
|
|
41
|
+
```ts title="agent/connections/petstore.ts"
|
|
42
|
+
import { defineOpenAPIConnection } from "eve/connections";
|
|
43
|
+
|
|
44
|
+
export default defineOpenAPIConnection({
|
|
45
|
+
spec: "https://petstore3.swagger.io/api/v3/openapi.json",
|
|
46
|
+
description: "Pet store inventory and orders.",
|
|
47
|
+
auth: { getToken: async () => ({ token: process.env.PETSTORE_TOKEN! }) },
|
|
48
|
+
operations: { allow: ["getInventory", "placeOrder"] },
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Filters match `operationId`. If an operation does not declare one, use the deterministic name eve derives from the method and path.
|
|
53
|
+
|
|
54
|
+
## Auth, headers, and approval
|
|
55
|
+
|
|
56
|
+
OpenAPI connections support the shared connection options:
|
|
57
|
+
|
|
58
|
+
- `auth` for static tokens, Vercel Connect, or self-hosted interactive OAuth.
|
|
59
|
+
- `headers` for API-key schemes or extra server configuration.
|
|
60
|
+
- `approval` for human-in-the-loop gates before generated operation tools run.
|
|
61
|
+
|
|
62
|
+
See [Connections](/docs/connections) for the shared auth, headers, and approval shapes.
|
|
63
|
+
|
|
64
|
+
## What to read next
|
|
65
|
+
|
|
66
|
+
- [MCP connections](./mcp): connect to remote MCP servers.
|
|
67
|
+
- [Auth & route protection](../guides/auth-and-route-protection): the full interactive-OAuth flow with Vercel Connect.
|
|
68
|
+
- [Security model](../concepts/security-model): how connection credentials stay out of the model's reach.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Connections"
|
|
3
3
|
description: "Expose external MCP and OpenAPI servers to the model, with connection tokens the model never sees."
|
|
4
|
+
url: /connections
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
A connection wires an agent into an external server you don't author, either an MCP server (Linear, GitHub, a warehouse) or any HTTP API with an OpenAPI document. eve handles the parts you'd otherwise hand-roll, discovering the remote tools, surfacing them to the model, and brokering auth.
|
|
@@ -9,23 +10,17 @@ Connections live under `agent/connections/`. The runtime name comes from the fil
|
|
|
9
10
|
|
|
10
11
|
## MCP connections
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Use an MCP connection when the external service already exposes an MCP server. The server publishes its tools and schemas, and eve makes the matched tools callable by the model.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
import { defineMcpClientConnection } from "eve/connections";
|
|
15
|
+
Read [MCP connections](/docs/connections/mcp) for `defineMcpClientConnection`, transport requirements, and MCP tool filters.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
auth: {
|
|
21
|
-
getToken: async () => ({ token: process.env.LINEAR_API_TOKEN! }),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
```
|
|
17
|
+
## OpenAPI connections
|
|
18
|
+
|
|
19
|
+
Use an OpenAPI connection when the service exposes an OpenAPI 3.x document. eve turns operations in the document into connection tools, one per operation.
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
Read [OpenAPI connections](/docs/connections/openapi) for `defineOpenAPIConnection`, `baseUrl`, and operation filters.
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
## Static-token auth
|
|
29
24
|
|
|
30
25
|
`getToken` returns a `TokenResult` (`{ token, expiresAt? }`), and eve sends it as `Authorization: Bearer <token>` on every request. Because it runs on each connection attempt, you can mint a fresh token from wherever you keep secrets, including an env var, a secrets manager, an internal vault, or your own OAuth exchange. If the token has a known TTL, set `expiresAt` (milliseconds since epoch) and eve refreshes ahead of time rather than waiting for a `401`.
|
|
31
26
|
|
|
@@ -33,24 +28,28 @@ When `getToken` is the only auth, `principalType` defaults to `"app"`: one share
|
|
|
33
28
|
|
|
34
29
|
eve resolves and caches connection tokens per step; they never land in conversation history or reach the model.
|
|
35
30
|
|
|
36
|
-
|
|
31
|
+
## No auth
|
|
37
32
|
|
|
38
33
|
Drop `auth` entirely for servers that need no token, such as a localhost server during development or a public one:
|
|
39
34
|
|
|
40
|
-
```ts
|
|
35
|
+
```ts title="agent/connections/local.ts"
|
|
36
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
37
|
+
|
|
41
38
|
export default defineMcpClientConnection({
|
|
42
39
|
url: "http://localhost:3001/mcp",
|
|
43
40
|
description: "Local dev server.",
|
|
44
41
|
});
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
Use no-auth connections only for services that are intentionally public, local-only, or otherwise protected outside eve. Do not use no-auth connections for sensitive third-party services.
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
## Headers
|
|
50
47
|
|
|
51
|
-
Use `headers` when the server wants a non-Bearer scheme (an API-key header) or extra configuration. Headers stack on top of `auth
|
|
48
|
+
Use `headers` when the server wants a non-Bearer scheme (an API-key header) or extra configuration. Headers stack on top of `auth` and work for both MCP and OpenAPI connections:
|
|
49
|
+
|
|
50
|
+
```ts title="agent/connections/example.ts"
|
|
51
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
52
52
|
|
|
53
|
-
```ts
|
|
54
53
|
export default defineMcpClientConnection({
|
|
55
54
|
url: "https://example.com/mcp",
|
|
56
55
|
description: "Example service.",
|
|
@@ -58,24 +57,12 @@ export default defineMcpClientConnection({
|
|
|
58
57
|
});
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
To narrow which remote tools the model sees, set exactly one of `tools.allow` or `tools.block`. Filtered-out tools do not appear in `connection_search`:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
export default defineMcpClientConnection({
|
|
67
|
-
url: "https://mcp.linear.app/sse",
|
|
68
|
-
description: "Linear: read-only.",
|
|
69
|
-
auth: { getToken: async () => ({ token: process.env.LINEAR_API_TOKEN! }) },
|
|
70
|
-
tools: { allow: ["search_issues", "get_issue"] },
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Per-connection approval
|
|
60
|
+
## Per-connection approval
|
|
75
61
|
|
|
76
62
|
To put every tool a connection serves behind a human, use the helpers from `eve/tools/approval`:
|
|
77
63
|
|
|
78
|
-
```ts
|
|
64
|
+
```ts title="agent/connections/linear.ts"
|
|
65
|
+
import { defineMcpClientConnection } from "eve/connections";
|
|
79
66
|
import { once } from "eve/tools/approval";
|
|
80
67
|
|
|
81
68
|
export default defineMcpClientConnection({
|
|
@@ -86,32 +73,9 @@ export default defineMcpClientConnection({
|
|
|
86
73
|
});
|
|
87
74
|
```
|
|
88
75
|
|
|
89
|
-
`never()` lets every call through, `once()` asks for approval the first time in a session, and `always()` asks every time. The pause and resume is the same human-in-the-loop flow covered in [Tools](
|
|
90
|
-
|
|
91
|
-
For connection tools that can create, modify, delete, transmit, purchase, message, or access sensitive data, use approval, tool allow-lists, or other safeguards appropriate to the action.
|
|
92
|
-
|
|
93
|
-
## OpenAPI connections
|
|
94
|
-
|
|
95
|
-
`defineOpenAPIConnection` turns any OpenAPI 3.x document into connection tools, one per operation. Pass an HTTPS URL eve fetches at runtime, or an inline parsed object:
|
|
96
|
-
|
|
97
|
-
```ts title="agent/connections/petstore.ts"
|
|
98
|
-
import { defineOpenAPIConnection } from "eve/connections";
|
|
99
|
-
|
|
100
|
-
export default defineOpenAPIConnection({
|
|
101
|
-
spec: "https://petstore3.swagger.io/api/v3/openapi.json",
|
|
102
|
-
description: "Pet store inventory and orders.",
|
|
103
|
-
auth: { getToken: async () => ({ token: process.env.PETSTORE_TOKEN! }) },
|
|
104
|
-
});
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Each operation becomes `<connection>__<operationId>` (e.g. `petstore__getInventory`). When an operation has no `operationId`, eve derives a deterministic `<method>_<sanitized-path>` name instead.
|
|
108
|
-
|
|
109
|
-
`auth`, `headers`, and `approval` work exactly as they do for MCP. There are two fields specific to OpenAPI:
|
|
76
|
+
`never()` lets every call through, `once()` asks for approval the first time in a session, and `always()` asks every time. The pause and resume is the same human-in-the-loop flow covered in [Tools](/docs/tools).
|
|
110
77
|
|
|
111
|
-
|
|
112
|
-
| ------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
113
|
-
| `baseUrl` | Base URL operation paths resolve against. Optional; defaults to the document's first usable `servers` entry. |
|
|
114
|
-
| `operations` | Filter keyed on `operationId` (`allow` or `block`). Mirrors `tools` on MCP connections, but names operations not tools. |
|
|
78
|
+
For connection tools that can create, modify, delete, transmit, purchase, message, or access sensitive data, use approval, allow-lists, or other safeguards appropriate to the action.
|
|
115
79
|
|
|
116
80
|
## Interactive OAuth via Vercel Connect
|
|
117
81
|
|
|
@@ -128,7 +92,7 @@ export default defineMcpClientConnection({
|
|
|
128
92
|
});
|
|
129
93
|
```
|
|
130
94
|
|
|
131
|
-
`"linear/myagent"` is the UID you chose when registering the Connect client. Connect-managed OAuth is user-scoped by default, so the runtime resolves the per-user token before each tool call. The full setup (Connect client provisioning, project linking, the runtime consent flow) lives in [Auth & route protection](
|
|
95
|
+
`"linear/myagent"` is the UID you chose when registering the Connect client. Connect-managed OAuth is user-scoped by default, so the runtime resolves the per-user token before each tool call. The full setup (Connect client provisioning, project linking, the runtime consent flow) lives in [Auth & route protection](/docs/guides/auth-and-route-protection).
|
|
132
96
|
|
|
133
97
|
## Self-hosted interactive OAuth
|
|
134
98
|
|
|
@@ -236,7 +200,8 @@ A tool can require both sign-in (`auth`) and a human approval. The model's appro
|
|
|
236
200
|
|
|
237
201
|
## What to read next
|
|
238
202
|
|
|
203
|
+
- [MCP connections](/docs/connections/mcp): connect to remote MCP servers.
|
|
204
|
+
- [OpenAPI connections](/docs/connections/openapi): generate tools from OpenAPI operations.
|
|
239
205
|
- [Integrations](/integrations): browse every channel and connection eve ships, in one gallery.
|
|
240
|
-
- [Tools](
|
|
241
|
-
- [
|
|
242
|
-
- [Security model](./concepts/security-model): how connection credentials stay out of the model's reach.
|
|
206
|
+
- [Tools](/docs/tools): authored tools live alongside connection-provided tools; the same approval helpers apply.
|
|
207
|
+
- [Security model](/docs/concepts/security-model): how connection credentials stay out of the model's reach.
|
package/docs/getting-started.mdx
CHANGED
|
@@ -5,12 +5,6 @@ description: "Install eve, scaffold your first agent, give it a tool, and run it
|
|
|
5
5
|
|
|
6
6
|
eve is a filesystem-first framework for durable agents. You write capabilities under `agent/`, and eve runs the model loop, persists every session, and serves the agent over HTTP and platform channels. You'll scaffold an app, add a tool, run it locally, then create, stream, and continue a session over HTTP.
|
|
7
7
|
|
|
8
|
-
<Callout>
|
|
9
|
-
eve is currently in beta and subject to the [Vercel beta
|
|
10
|
-
terms](https://vercel.com/docs/release-phases/public-beta-agreement); the framework, APIs,
|
|
11
|
-
documentation, and behavior may change before general availability.
|
|
12
|
-
</Callout>
|
|
13
|
-
|
|
14
8
|
## Prerequisites
|
|
15
9
|
|
|
16
10
|
- Node 24 or newer
|
package/docs/introduction.mdx
CHANGED
|
@@ -7,12 +7,6 @@ eve is a framework for building durable agents as ordinary files in a TypeScript
|
|
|
7
7
|
|
|
8
8
|
Instead of one large configuration object, each part of your agent gets a clear home. Instructions go in one file, tools in one folder, channels in another. eve discovers that structure and turns it into an agent that runs locally, serves HTTP, connects to other platforms, and keeps working across many turns.
|
|
9
9
|
|
|
10
|
-
<Callout>
|
|
11
|
-
eve is currently in beta and subject to the [Vercel beta
|
|
12
|
-
terms](https://vercel.com/docs/release-phases/public-beta-agreement); the framework, APIs,
|
|
13
|
-
documentation, and behavior may change before general availability.
|
|
14
|
-
</Callout>
|
|
15
|
-
|
|
16
10
|
## An eve project at a glance
|
|
17
11
|
|
|
18
12
|
A small eve app looks like this:
|
|
@@ -90,7 +84,7 @@ As the agent grows, each concern still has a predictable home:
|
|
|
90
84
|
|
|
91
85
|
| Path | Add it when you need... |
|
|
92
86
|
| ------------------------------- | ------------------------------------------------ |
|
|
93
|
-
| [`connections/`](./connections) | Tools from external MCP
|
|
87
|
+
| [`connections/`](./connections) | Tools from external MCP or OpenAPI services |
|
|
94
88
|
| [`hooks/`](./guides/hooks) | Code that reacts to lifecycle and stream events |
|
|
95
89
|
| [`sandbox/`](./sandbox) | A controlled workspace for files and commands |
|
|
96
90
|
| [`subagents/`](./subagents) | Specialist agents the root agent can delegate to |
|
|
@@ -105,5 +99,5 @@ The result stays readable before it runs. The directory tells you what the agent
|
|
|
105
99
|
- [Tools](./tools): the typed actions your agent calls
|
|
106
100
|
- [Instructions](./instructions): the always-on system prompt that shapes behavior
|
|
107
101
|
- [Channels](./channels/overview): reach the agent from Slack, Discord, or a web UI
|
|
108
|
-
- [Connections](./connections): pull in tools from external
|
|
102
|
+
- [Connections](./connections): pull in tools from external services
|
|
109
103
|
- [Project layout](./reference/project-layout): every authored slot under `agent/`
|
|
@@ -30,25 +30,26 @@ export default defineTool({
|
|
|
30
30
|
|
|
31
31
|
## The define\* helpers
|
|
32
32
|
|
|
33
|
-
| Helper
|
|
34
|
-
|
|
|
35
|
-
| `defineAgent`
|
|
36
|
-
| `defineTool`
|
|
37
|
-
| `defineDynamic`
|
|
38
|
-
| `defineMcpClientConnection
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
33
|
+
| Helper | Import from | Authored at | Guide |
|
|
34
|
+
| ----------------------------------------------------- | --------------------------------------------- | ------------------------------------ | ------------------------------------------------------ |
|
|
35
|
+
| `defineAgent` | `eve` | `agent/agent.ts` | [agent.ts](../agent-config) |
|
|
36
|
+
| `defineTool` | `eve/tools` | `agent/tools/<name>.ts` | [Tools](../tools) |
|
|
37
|
+
| `defineDynamic` | `eve/tools`, `eve/skills`, `eve/instructions` | `agent/{tools,skills,instructions}/` | [Dynamic capabilities](../guides/dynamic-capabilities) |
|
|
38
|
+
| `defineMcpClientConnection` | `eve/connections` | `agent/connections/<name>.ts` | [MCP connections](../connections/mcp) |
|
|
39
|
+
| `defineOpenAPIConnection` | `eve/connections` | `agent/connections/<name>.ts` | [OpenAPI connections](../connections/openapi) |
|
|
40
|
+
| `defineChannel` | `eve/channels` | `agent/channels/<name>.ts` | [Custom channels](../channels/custom) |
|
|
41
|
+
| `eveChannel`, `slackChannel`, and the other platforms | `eve/channels/<platform>` | `agent/channels/<platform>.ts` | [Channels](../channels/overview) |
|
|
42
|
+
| `defineSkill` | `eve/skills` | `agent/skills/<name>.ts` | [Skills](../skills) |
|
|
43
|
+
| `defineInstructions` | `eve/instructions` | `agent/instructions.ts` | [Instructions](../instructions) |
|
|
44
|
+
| `defineHook` | `eve/hooks` | `agent/hooks/<slug>.ts` | [Hooks](../guides/hooks) |
|
|
45
|
+
| `defineSchedule` | `eve/schedules` | `agent/schedules/<name>.ts` | [Schedules](../schedules) |
|
|
46
|
+
| `defineState` | `eve/context` | tools, hooks, lifecycle | [Session context](../guides/session-context) |
|
|
47
|
+
| `defineSandbox` | `eve/sandbox` | `agent/sandbox.ts` | [Sandbox](../sandbox) |
|
|
48
|
+
| `defineInstrumentation` | `eve/instrumentation` | `agent/instrumentation.ts` | [instrumentation.ts](../guides/instrumentation) |
|
|
49
|
+
| `defineRemoteAgent` | `eve` | `agent/subagents/<id>/agent.ts` | [Remote agents](../guides/remote-agents) |
|
|
50
|
+
| `defineEval` | `eve/evals` | `evals/*.eval.ts` | [Evals](../evals/overview) |
|
|
51
|
+
| `defineEvalConfig` | `eve/evals` | `evals/evals.config.ts` | [Evals](../evals/overview) |
|
|
52
|
+
| `useEveAgent` | `eve/react`, `eve/vue`, `eve/svelte` | frontend | [Frontend](../guides/frontend/overview) |
|
|
52
53
|
|
|
53
54
|
A few non-`define*` helpers round out the set: `disableTool` and `ExperimentalWorkflow` from `eve/tools` (see [Default harness](../concepts/default-harness)), the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval predicates `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`). `AgentWorkflowDefinition` and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape.
|
|
54
55
|
|
|
@@ -33,7 +33,7 @@ Once Connect is enabled on your account, wire it up:
|
|
|
33
33
|
3. Link the client to your project.
|
|
34
34
|
4. Run `vercel link` and `vercel env pull` so `VERCEL_OIDC_TOKEN` is available locally.
|
|
35
35
|
|
|
36
|
-
For the full reference, see [
|
|
36
|
+
For the full reference, see [MCP connections](../connections/mcp).
|
|
37
37
|
|
|
38
38
|
## What the user sees
|
|
39
39
|
|
|
@@ -49,8 +49,8 @@ The first time, the model picks a warehouse tool but there's no token yet, so th
|
|
|
49
49
|
|
|
50
50
|
Right before each request to the MCP server, eve resolves the bearer and sends it as `Authorization: Bearer <token>`. The model only ever sees tool names, descriptions, and results. The credential stays out of its reach.
|
|
51
51
|
|
|
52
|
-
If you want more control, gate the connection behind approval (`approval: once()`) or narrow which tools the model sees (`tools.allow`). See [
|
|
52
|
+
If you want more control, gate the connection behind approval (`approval: once()`) or narrow which tools the model sees (`tools.allow`). See [MCP connections](../connections/mcp).
|
|
53
53
|
|
|
54
54
|
→ Next: [Run analysis](./run-analysis)
|
|
55
55
|
|
|
56
|
-
Learn more: [
|
|
56
|
+
Learn more: [MCP connections](../connections/mcp) · [Auth and route protection](../guides/auth-and-route-protection)
|
|
@@ -148,7 +148,7 @@ Across the nine steps you built and shipped one agent, and along the way you use
|
|
|
148
148
|
|
|
149
149
|
## Next steps
|
|
150
150
|
|
|
151
|
-
- [
|
|
151
|
+
- [MCP connections](../connections/mcp) for tool allowlists and per-connection approval.
|
|
152
152
|
- [Sandbox](../sandbox) for backends, lifecycle, and network policy.
|
|
153
153
|
- [Dynamic capabilities](../guides/dynamic-capabilities) for schema-derived dynamic tools, a read-only analyst subagent, and model-authored report workflows on this same example.
|
|
154
154
|
- [Auth and route protection](../guides/auth-and-route-protection) for production auth patterns.
|