eve 0.39.3 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/src/chunks/{use-eve-agent-CTI9fHaO.js → use-eve-agent-C0SG1Ttk.js} +4 -1
- package/dist/src/chunks/{use-eve-agent-DlkXRQVo.js → use-eve-agent-D71oDil7.js} +4 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +7 -6
- package/dist/src/compiled/@linqapp/chat-sdk-adapter/LICENSE +201 -0
- package/dist/src/compiled/@linqapp/chat-sdk-adapter/index.d.ts +3 -0
- package/dist/src/compiled/@linqapp/chat-sdk-adapter/index.js +8 -0
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +9 -5
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +31 -12
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +49 -1
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +81 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization.d.ts +10 -2
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +10 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +96 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +2 -1
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +38 -1
- package/dist/src/compiled/@workflow/world/node-http-flag.d.ts +41 -0
- package/dist/src/compiled/@workflow/world/node-http.d.ts +81 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-B8K0pwpH.js → attribute-changes-DXbpwBdw.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{dist-BRGbNjhD.js → dist-Dk0aQqFO.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{env-config-DxamfI7T.js → env-config-L94XftKz.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{private-z_2Kcwee.js → private-CuQ4HTFC.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +15 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-TYZ9zwoZ.js → ws-transport-Ct6yyRWZ.js} +1 -1
- package/dist/src/compiled/shadcn-registry/index.d.ts +1 -0
- package/dist/src/compiled/shadcn-registry/index.js +285 -379
- package/dist/src/execution/sandbox/logging-session.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +1 -0
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/parent/control-shared.d.ts +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +1 -1
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/public/channels/linq/inboundContent.d.ts +4 -0
- package/dist/src/public/channels/linq/inboundContent.js +1 -0
- package/dist/src/public/channels/linq/index.d.ts +1 -0
- package/dist/src/public/channels/linq/index.js +1 -0
- package/dist/src/public/channels/linq/linqChannel.d.ts +66 -0
- package/dist/src/public/channels/linq/linqChannel.js +1 -0
- package/dist/src/public/channels/teams/api.js +2 -2
- package/dist/src/public/channels/teams/defaults.js +1 -1
- package/dist/src/public/channels/teams/hitl.d.ts +9 -0
- package/dist/src/public/channels/teams/hitl.js +1 -1
- package/dist/src/public/channels/teams/index.d.ts +1 -1
- package/dist/src/public/channels/teams/index.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +8 -0
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/runtime/framework-tools/tasks.d.ts +1 -5
- package/dist/src/runtime/framework-tools/tasks.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/setup/integrations/linq/connect.d.ts +32 -0
- package/dist/src/setup/integrations/linq/connect.js +1 -0
- package/dist/src/setup/integrations/linq/setup.d.ts +22 -0
- package/dist/src/setup/integrations/linq/setup.js +15 -0
- package/dist/src/setup/integrations/registry.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
- package/dist/src/setup/scaffold/create/web-template.js +74 -50
- package/dist/src/shared/empty-delivery.d.ts +1 -1
- package/dist/src/shared/empty-delivery.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/linq.mdx +67 -0
- package/docs/channels/meta.json +1 -0
- package/docs/channels/overview.mdx +3 -2
- package/docs/channels/teams.mdx +2 -0
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/meta.json +2 -1
- package/package.json +12 -6
- package/dist/src/compiled/_chunks/workflow/frames-DoexhtxJ.js +0 -3
- package/dist/src/compiled/_chunks/workflow/resume-hook-DO_MuJlY.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-lq7-eG0l.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-7TgF3i-e.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-BBG5cZTy.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BPSgt1Wg.js +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.41.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0569638: Add a first-class Linq iMessage and SMS channel with managed Vercel Connect and portable credential setup paths. Connect setup can provision a new Linq account and line or connect an existing account with its partner API token.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- bdf5f63: Improve the generated web chat experience with immediate thinking feedback, a disabled composer while responses stream, clearer cancellation controls, and visible turn failures.
|
|
12
|
+
- c47350f: Rebuild untransformed session-scoped dynamic tool executors and approval policies on durable continuations so dependency-created tools remain available after replay.
|
|
13
|
+
- c47350f: Update Teams tool-approval cards only after approval settlement, with the outcome and the Teams responder who acted.
|
|
14
|
+
- 9e19fa4: Keep active client streams attached across authorization parking boundaries so connection callbacks resume browser chats automatically.
|
|
15
|
+
|
|
16
|
+
## 0.40.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- 2838bb3: Remove `task_peek` from experimental background tasks and include completed results and failures directly in task notifications. Conditionally delivered task wakes can remain silent when that result was already covered by an earlier response.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- e843b4d: Registry browsing now uses titles returned by the catalog, avoiding a separate request for every displayed item.
|
|
25
|
+
- 899e079: Keep `eve info --json` output valid JSON by omitting the CLI banner.
|
|
26
|
+
- cda9539: Redact brokered credential transforms when sandbox network policies are written to bootstrap logs.
|
|
27
|
+
- 87c61a1: Update eve's bundled Workflow SDK packages to the latest 5.0.0 beta releases, picking up a replay-determinism fix for branch wake order under concurrent replays.
|
|
28
|
+
|
|
3
29
|
## 0.39.3
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1075,6 +1075,7 @@ var ClientSession = class ClientSession {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
async *#createEventStream(initialStreamIndex, input) {
|
|
1077
1077
|
let eventCount = 0;
|
|
1078
|
+
const pendingAuthorizations = /* @__PURE__ */ new Set();
|
|
1078
1079
|
try {
|
|
1079
1080
|
for await (const event of this.#readStream({
|
|
1080
1081
|
headers: input.headers,
|
|
@@ -1084,8 +1085,10 @@ var ClientSession = class ClientSession {
|
|
|
1084
1085
|
streamReconnectPolicy: input.streamReconnectPolicy
|
|
1085
1086
|
})) {
|
|
1086
1087
|
eventCount += 1;
|
|
1088
|
+
if (event.type === "authorization.required" && event.data.webhookUrl !== void 0) pendingAuthorizations.add(event.data.name);
|
|
1089
|
+
else if (event.type === "authorization.completed") pendingAuthorizations.delete(event.data.name);
|
|
1087
1090
|
yield event;
|
|
1088
|
-
if (isCurrentTurnBoundaryEvent(event)) break;
|
|
1091
|
+
if (isCurrentTurnBoundaryEvent(event) && (event.type !== "session.waiting" || pendingAuthorizations.size === 0)) break;
|
|
1089
1092
|
}
|
|
1090
1093
|
} finally {
|
|
1091
1094
|
this.#state = {
|
|
@@ -1075,6 +1075,7 @@ var ClientSession = class ClientSession {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
async *#createEventStream(initialStreamIndex, input) {
|
|
1077
1077
|
let eventCount = 0;
|
|
1078
|
+
const pendingAuthorizations = /* @__PURE__ */ new Set();
|
|
1078
1079
|
try {
|
|
1079
1080
|
for await (const event of this.#readStream({
|
|
1080
1081
|
headers: input.headers,
|
|
@@ -1084,8 +1085,10 @@ var ClientSession = class ClientSession {
|
|
|
1084
1085
|
streamReconnectPolicy: input.streamReconnectPolicy
|
|
1085
1086
|
})) {
|
|
1086
1087
|
eventCount += 1;
|
|
1088
|
+
if (event.type === "authorization.required" && event.data.webhookUrl !== void 0) pendingAuthorizations.add(event.data.name);
|
|
1089
|
+
else if (event.type === "authorization.completed") pendingAuthorizations.delete(event.data.name);
|
|
1087
1090
|
yield event;
|
|
1088
|
-
if (isCurrentTurnBoundaryEvent(event)) break;
|
|
1091
|
+
if (isCurrentTurnBoundaryEvent(event) && (event.type !== "session.waiting" || pendingAuthorizations.size === 0)) break;
|
|
1089
1092
|
}
|
|
1090
1093
|
} finally {
|
|
1091
1094
|
this.#state = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasInteractiveTerminal}from"./preconditions.js";import{reportHeadlessSetupCompletion,serializeHeadlessSetupEvent}from"./setup-headless.js";import{runDeclaredSetups}from"./registry-declared-setups.js";import{runRegistryPackage}from"./registry-package.js";import{eveMetadataFromRegistryItem,parseOfficialRegistrySearchMetadata}from"./registry-metadata.js";import{printRegistrySearchResults,registryViewText}from"./registry-presentation.js";import{addRegistryMappings,readRegistryConfig}from"./registry-project.js";import{errorMessage,resolveRegistryItemForAdd,runRegistryAction,setupReminder,setupResumeCommand}from"./registry-recovery.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createPrompter}from"#setup/prompter.js";import{WizardCancelledError}from"#setup/step.js";import{addRegistryItems,getRegistryItems,searchRegistries}from"#compiled/shadcn-registry/index.js";import semver from"#compiled/semver/index.js";const defaultAddCommandDependencies={createPrompter,hasInteractiveTerminal,loadSetupCommandRunner:async()=>(await import(`./registry-setup-command.js`)).runRegistrySetupCommand};function resolveOfficialRegistryUrl(e=process.env.EVE_DEV_OFFICIAL_REGISTRY_URL){if(e===void 0)return`https://eve.dev/r`;let t;try{t=new URL(e)}catch{throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`);if(t.username!==``||t.password!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include credentials.`);if(t.search!==``||t.hash!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include a query or fragment.`);return t.pathname=t.pathname.replace(/\/+$/,``),t.toString().replace(/\/$/,``)}const OFFICIAL_REGISTRY=resolveOfficialRegistryUrl(),OFFICIAL_CATALOG=`${OFFICIAL_REGISTRY}/registry.json`,SKILLS_REGISTRY=`@skills`;function isRegistryAddress(e){return e.startsWith(`@`)||/^https?:\/\//.test(e)}function itemAddress(e){return isRegistryAddress(e)?e:`${OFFICIAL_REGISTRY}/${e}.json`}async function installOfficialRegistryItem(e,t,n={}){let r=await readEveRegistryConfig(e);await addRegistryItems([itemAddress(t)],{config:r,cwd:e,overwrite:n.overwrite})}function assertCompatibleEveVersion(e){if(e===void 0)return;let t=resolveInstalledPackageInfo().version;if(semver.validRange(e)===null)throw Error(`Registry item has an invalid eve version requirement: ${e}.`);if(!semver.subset(t,e))throw Error(`This registry item requires eve ${e}, but this project is using eve ${t}. Upgrade eve and run the command again.`)}function isOfficialItemAddress(e){return e.startsWith(`${OFFICIAL_REGISTRY}/`)}function withBuiltInRegistries(e){return{...e,registries:{[SKILLS_REGISTRY]:`https://www.skills.sh/r/{name}?agent=eve`,...e.registries}}}async function readEveRegistryConfig(e){return withBuiltInRegistries(await readRegistryConfig(e))}function configuredRegistrySources(e){return Object.keys(e.registries??{})}function validateRegistrySource(e){if(e!==void 0&&!isRegistryAddress(e))throw Error(`Registry sources must be a namespace or URL: ${e}`)}async function loadOfficialSearchMetadata(){let e=await fetch(OFFICIAL_CATALOG);if(!e.ok)throw Error(`Could not read the eve registry (${e.status}).`);return parseOfficialRegistrySearchMetadata(await e.json())}function searchItemAddress(e){return e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument}function enrichSearchItem(e,t){let n=searchItemAddress(e);return{item:e,address:n,...t.get(n)}}function registrySourceLabel(e){return e===OFFICIAL_CATALOG?`eve`:e===SKILLS_REGISTRY?`skills.sh`:e}function searchPresentationSections(e,t,n){return e.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{label:registrySourceLabel(e),items:r.items.map(e=>enrichSearchItem(e,n)),total:r.pagination.total}]})}async function printAddSuggestions(e,t,n){try{let r=n.split(`/`).at(-1)||n,{resultsBySource:i,sources:a,metadataByAddress:o}=await searchRegistryCatalog(t,{limit:5,query:r}),c=searchPresentationSections(a,i,o);if(c.every(e=>e.items.length===0))return;e.log(`Did you mean?`),printRegistrySearchResults(e,{query:r,sections:c})}catch{}}async function searchRegistryCatalog(e,t){validateRegistrySource(t.source);let n=await readEveRegistryConfig(e),r=t.source?[t.source]:[OFFICIAL_CATALOG,...configuredRegistrySources(n).filter(e=>t.query!==void 0||e!==SKILLS_REGISTRY)],i=await Promise.all(r.map(async e=>{try{return{result:await searchRegistries([e],{config:n,limit:t.limit??100,query:t.query}),source:e}}catch(t){return{error:t,source:e}}})),a=[],o=new Map;for(let e of i)if(`error`in e)a.push({message:errorMessage(e.error),registry:e.source});else{let t=e.result.errors??[];if(a.push(...t),t.length===0){let t=e.result.items.filter(t=>t.registry===e.source);o.set(e.source,{...e.result,items:t,pagination:{...e.result.pagination,total:e.result.items.length===t.length?e.result.pagination.total:0}})}}let s=new Map(a.map(e=>[`${e.registry}\0${e.message}`,e])),c=o.has(OFFICIAL_CATALOG)?await loadOfficialSearchMetadata():new Map,l=o.get(OFFICIAL_CATALOG);l!==void 0&&l.items.sort((e,t)=>{let rank=e=>c.get(searchItemAddress(e))?.implementation===`native`?0:1;return rank(e)-rank(t)});let u=[...o.values()];return{config:n,result:{items:u.flatMap(e=>e.items),pagination:{hasMore:u.some(e=>e.pagination.hasMore),limit:t.limit??100,offset:0,total:u.reduce((e,t)=>e+t.pagination.total,0)},...s.size>0?{errors:[...s.values()]}:{}},resultsBySource:o,sources:r,metadataByAddress:c}}function registryManifestTitle(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.title;return typeof t==`string`?t:void 0}async function browseRegistryCatalog(e,t={}){let{config:n,result:r}=await searchRegistryCatalog(e,t),i=await Promise.all(r.items.map(async e=>{let[t]=await getRegistryItems([e.addCommandArgument],{config:n});return t}));return{items:r.items.map((e,t)=>{let n={address:e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument,name:e.name,source:e.registry===OFFICIAL_CATALOG?`Vercel`:e.registry},r=registryManifestTitle(i[t]);return r!==void 0&&(n.title=r),e.type!==void 0&&(n.type=e.type),e.description!==void 0&&(n.description=e.description),n}),total:r.pagination.total,errors:r.errors??[]}}async function browseRegistryItems(e,t,n,r,i={}){let{result:a,resultsBySource:o,sources:c,metadataByAddress:l}=await searchRegistryCatalog(t,{limit:i.limit,query:n,source:r}),u=a.errors??[];if(i.json||o.size>0){let t=a.items.map(e=>({...e,...l.get(searchItemAddress(e))})),r={query:n,sections:searchPresentationSections(c,o,l)};i.json&&(r.json={...a,items:t}),printRegistrySearchResults(e,r)}for(let t of u)e.error(`${t.registry}: ${t.message}`);u.length>0&&(process.exitCode=1)}async function getRegistryItemManifest(e,t){let n=await readEveRegistryConfig(e),r=await getRegistryItems([itemAddress(t)],{config:n});return r.length===1?r[0]:r}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode,c=await runAddCommand(o,e,t,{...n,yes:n.prompter===void 0||n.yes,setupAuthorized:n.prompter!==void 0},r);if(process.exitCode=s,i!==void 0)throw Error(i);let l={output:a};return c!==void 0&&(l.setup=c),l}async function runAddCommand(e,t,o,s,c=defaultAddCommandDependencies){return runRegistryAction(e,t,async()=>{let l=await readEveRegistryConfig(t),u=itemAddress(o);if(s.skipInstall===!0){if(s.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(s.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(u))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let d=await resolveRegistryItemForAdd(e,async()=>(await getRegistryItems([u],{config:l}))[0],()=>printAddSuggestions(e,t,o));if(!d.found)return;let f=d.item,p=isOfficialItemAddress(u)?eveMetadataFromRegistryItem(f):void 0;if(assertCompatibleEveVersion(p?.requires),p?.components!==void 0){if(!isOfficialItemAddress(u))throw Error(`Registry packages require the official eve registry.`);return reportCompletion(e,o,await runRegistryPackage({logger:e,appRoot:t,item:o,components:p.components,config:l,options:s,dependencies:c,operations:{itemAddress,metadata:eveMetadataFromRegistryItem,assertCompatibleVersion:assertCompatibleEveVersion,runSetups:({item:n,setups:i,prompter:a})=>runDeclaredSetups({logger:e,appRoot:t,item:n,setups:i,options:{yes:s.yes,nonInteractive:s.nonInteractive,answers:s.answers,prompter:a,signal:s.signal},dependencies:c,cancelledReminder:setupReminder(n,`cancelled`),resumeCommand:setupResumeCommand(n)}),setupReminder:e=>setupReminder(e,`skipped`)}}),s)}if(s.skipInstall===!0){if(p?.setup===void 0)throw Error(`Registry item "${o}" does not declare a setup flow.`);return reportCompletion(e,o,await runDeclaredSetups({logger:e,appRoot:t,item:o,setups:p.setup,options:s,dependencies:c,cancelledReminder:setupReminder(o,`cancelled`),resumeCommand:setupResumeCommand(o)}),s)}if(await addRegistryItems([u],{config:l,cwd:t,overwrite:s.overwrite,silent:s.silent}),p?.setup===void 0)return reportCompletion(e,o,{facts:[]},s);let m=c.hasInteractiveTerminal?.()??defaultAddCommandDependencies.hasInteractiveTerminal();if(s.nonInteractive&&e.log(serializeHeadlessSetupEvent({version:1,type:`progress`,message:s.skipInstall?`Setup ${o}`:`Installed ${o}`})),s.skipSetup===!0){if(s.nonInteractive)return reportCompletion(e,o,{facts:[]},s);e.log(setupReminder(o,`skipped`));return}if(!s.nonInteractive&&!s.yes&&!m&&s.setupAuthorized!==!0){e.log(setupReminder(o,`skipped`));return}if(!s.nonInteractive&&!s.yes&&s.setupAuthorized!==!0)try{if(await(s.prompter??c.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${o} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`){e.log(setupReminder(o,`skipped`));return}}catch(t){if(!(t instanceof WizardCancelledError))throw t;e.log(setupReminder(o,`cancelled`));return}return reportCompletion(e,o,await runDeclaredSetups({logger:e,appRoot:t,item:o,setups:p.setup,options:s,dependencies:c,cancelledReminder:setupReminder(o,`cancelled`),resumeCommand:setupResumeCommand(o)}),s)})}function reportCompletion(e,n,r,i){return reportHeadlessSetupCompletion({logger:e,item:n,completion:r,nonInteractive:i.nonInteractive})}async function runRegistryAddCommand(e,t,n){await runRegistryAction(e,t,async()=>{let r=await addRegistryMappings(t,n);for(let t of r.skippedBuiltIn)e.log(`Skipped ${t} because it is built in.`);for(let t of r.skippedExisting)e.log(`Skipped ${t} because it is already configured.`);r.added.length>0&&e.log(`Added ${r.added.join(`, `)} to package.json.`)})}async function runRegistryListCommand(e,t,n,r={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,void 0,n,r))}async function runRegistrySearchCommand(e,t,n,r,i={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,n,r,{...i,limit:i.limit??10}))}async function runRegistryViewCommand(e,t,n,r={}){await runRegistryAction(e,t,async()=>{let i=await readEveRegistryConfig(t),a=await getRegistryItems([itemAddress(n)],{config:i}),o=a.length===1?a[0]:a;e.log(r.json?JSON.stringify(o,null,2):registryViewText(n,o))})}export{browseRegistryCatalog,getRegistryItemManifest,installOfficialRegistryItem,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
|
|
1
|
+
import{hasInteractiveTerminal}from"./preconditions.js";import{reportHeadlessSetupCompletion,serializeHeadlessSetupEvent}from"./setup-headless.js";import{runDeclaredSetups}from"./registry-declared-setups.js";import{runRegistryPackage}from"./registry-package.js";import{eveMetadataFromRegistryItem,parseOfficialRegistrySearchMetadata}from"./registry-metadata.js";import{printRegistrySearchResults,registryViewText}from"./registry-presentation.js";import{addRegistryMappings,readRegistryConfig}from"./registry-project.js";import{errorMessage,resolveRegistryItemForAdd,runRegistryAction,setupReminder,setupResumeCommand}from"./registry-recovery.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createPrompter}from"#setup/prompter.js";import{WizardCancelledError}from"#setup/step.js";import{addRegistryItems,getRegistryItems,searchRegistries}from"#compiled/shadcn-registry/index.js";import semver from"#compiled/semver/index.js";const defaultAddCommandDependencies={createPrompter,hasInteractiveTerminal,loadSetupCommandRunner:async()=>(await import(`./registry-setup-command.js`)).runRegistrySetupCommand};function resolveOfficialRegistryUrl(e=process.env.EVE_DEV_OFFICIAL_REGISTRY_URL){if(e===void 0)return`https://eve.dev/r`;let t;try{t=new URL(e)}catch{throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`);if(t.username!==``||t.password!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include credentials.`);if(t.search!==``||t.hash!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include a query or fragment.`);return t.pathname=t.pathname.replace(/\/+$/,``),t.toString().replace(/\/$/,``)}const OFFICIAL_REGISTRY=resolveOfficialRegistryUrl(),OFFICIAL_CATALOG=`${OFFICIAL_REGISTRY}/registry.json`,SKILLS_REGISTRY=`@skills`;function isRegistryAddress(e){return e.startsWith(`@`)||/^https?:\/\//.test(e)}function itemAddress(e){return isRegistryAddress(e)?e:`${OFFICIAL_REGISTRY}/${e}.json`}async function installOfficialRegistryItem(e,t,n={}){let r=await readEveRegistryConfig(e);await addRegistryItems([itemAddress(t)],{config:r,cwd:e,overwrite:n.overwrite})}function assertCompatibleEveVersion(e){if(e===void 0)return;let t=resolveInstalledPackageInfo().version;if(semver.validRange(e)===null)throw Error(`Registry item has an invalid eve version requirement: ${e}.`);if(!semver.subset(t,e))throw Error(`This registry item requires eve ${e}, but this project is using eve ${t}. Upgrade eve and run the command again.`)}function isOfficialItemAddress(e){return e.startsWith(`${OFFICIAL_REGISTRY}/`)}function withBuiltInRegistries(e){return{...e,registries:{[SKILLS_REGISTRY]:`https://www.skills.sh/r/{name}?agent=eve`,...e.registries}}}async function readEveRegistryConfig(e){return withBuiltInRegistries(await readRegistryConfig(e))}function configuredRegistrySources(e){return Object.keys(e.registries??{})}function validateRegistrySource(e){if(e!==void 0&&!isRegistryAddress(e))throw Error(`Registry sources must be a namespace or URL: ${e}`)}async function loadOfficialSearchMetadata(){let e=await fetch(OFFICIAL_CATALOG);if(!e.ok)throw Error(`Could not read the eve registry (${e.status}).`);return parseOfficialRegistrySearchMetadata(await e.json())}function searchItemAddress(e){return e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument}function enrichSearchItem(e,t){let n=searchItemAddress(e);return{item:e,address:n,...t.get(n)}}function registrySourceLabel(e){return e===OFFICIAL_CATALOG?`eve`:e===SKILLS_REGISTRY?`skills.sh`:e}function searchPresentationSections(e,t,n){return e.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{label:registrySourceLabel(e),items:r.items.map(e=>enrichSearchItem(e,n)),total:r.pagination.total}]})}async function printAddSuggestions(e,t,n){try{let r=n.split(`/`).at(-1)||n,{resultsBySource:i,sources:a,metadataByAddress:o}=await searchRegistryCatalog(t,{limit:5,query:r}),c=searchPresentationSections(a,i,o);if(c.every(e=>e.items.length===0))return;e.log(`Did you mean?`),printRegistrySearchResults(e,{query:r,sections:c})}catch{}}async function searchRegistryCatalog(e,t){validateRegistrySource(t.source);let n=await readEveRegistryConfig(e),r=t.source?[t.source]:[OFFICIAL_CATALOG,...configuredRegistrySources(n).filter(e=>t.query!==void 0||e!==SKILLS_REGISTRY)],i=await Promise.all(r.map(async e=>{try{return{result:await searchRegistries([e],{config:n,limit:t.limit??100,query:t.query}),source:e}}catch(t){return{error:t,source:e}}})),a=[],o=new Map;for(let e of i)if(`error`in e)a.push({message:errorMessage(e.error),registry:e.source});else{let t=e.result.errors??[];if(a.push(...t),t.length===0){let t=e.result.items.filter(t=>t.registry===e.source);o.set(e.source,{...e.result,items:t,pagination:{...e.result.pagination,total:e.result.items.length===t.length?e.result.pagination.total:0}})}}let s=new Map(a.map(e=>[`${e.registry}\0${e.message}`,e])),c=o.has(OFFICIAL_CATALOG)?await loadOfficialSearchMetadata():new Map,l=o.get(OFFICIAL_CATALOG);l!==void 0&&l.items.sort((e,t)=>{let rank=e=>c.get(searchItemAddress(e))?.implementation===`native`?0:1;return rank(e)-rank(t)});let u=[...o.values()];return{config:n,result:{items:u.flatMap(e=>e.items),pagination:{hasMore:u.some(e=>e.pagination.hasMore),limit:t.limit??100,offset:0,total:u.reduce((e,t)=>e+t.pagination.total,0)},...s.size>0?{errors:[...s.values()]}:{}},resultsBySource:o,sources:r,metadataByAddress:c}}async function browseRegistryCatalog(e,t={}){let{result:n}=await searchRegistryCatalog(e,t);return{items:n.items.map(e=>{let t={address:e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument,name:e.name,source:e.registry===OFFICIAL_CATALOG?`Vercel`:e.registry};return e.title!==void 0&&(t.title=e.title),e.type!==void 0&&(t.type=e.type),e.description!==void 0&&(t.description=e.description),t}),total:n.pagination.total,errors:n.errors??[]}}async function browseRegistryItems(e,t,n,r,i={}){let{result:a,resultsBySource:o,sources:c,metadataByAddress:l}=await searchRegistryCatalog(t,{limit:i.limit,query:n,source:r}),u=a.errors??[];if(i.json||o.size>0){let t=a.items.map(e=>({...e,...l.get(searchItemAddress(e))})),r={query:n,sections:searchPresentationSections(c,o,l)};i.json&&(r.json={...a,items:t}),printRegistrySearchResults(e,r)}for(let t of u)e.error(`${t.registry}: ${t.message}`);u.length>0&&(process.exitCode=1)}async function getRegistryItemManifest(e,t){let n=await readEveRegistryConfig(e),r=await getRegistryItems([itemAddress(t)],{config:n});return r.length===1?r[0]:r}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode,c=await runAddCommand(o,e,t,{...n,yes:n.prompter===void 0||n.yes,setupAuthorized:n.prompter!==void 0},r);if(process.exitCode=s,i!==void 0)throw Error(i);let l={output:a};return c!==void 0&&(l.setup=c),l}async function runAddCommand(e,t,o,s,c=defaultAddCommandDependencies){return runRegistryAction(e,t,async()=>{let l=await readEveRegistryConfig(t),u=itemAddress(o);if(s.skipInstall===!0){if(s.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(s.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(u))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let d=await resolveRegistryItemForAdd(e,async()=>(await getRegistryItems([u],{config:l}))[0],()=>printAddSuggestions(e,t,o));if(!d.found)return;let f=d.item,p=isOfficialItemAddress(u)?eveMetadataFromRegistryItem(f):void 0;if(assertCompatibleEveVersion(p?.requires),p?.components!==void 0){if(!isOfficialItemAddress(u))throw Error(`Registry packages require the official eve registry.`);return reportCompletion(e,o,await runRegistryPackage({logger:e,appRoot:t,item:o,components:p.components,config:l,options:s,dependencies:c,operations:{itemAddress,metadata:eveMetadataFromRegistryItem,assertCompatibleVersion:assertCompatibleEveVersion,runSetups:({item:n,setups:i,prompter:a})=>runDeclaredSetups({logger:e,appRoot:t,item:n,setups:i,options:{yes:s.yes,nonInteractive:s.nonInteractive,answers:s.answers,prompter:a,signal:s.signal},dependencies:c,cancelledReminder:setupReminder(n,`cancelled`),resumeCommand:setupResumeCommand(n)}),setupReminder:e=>setupReminder(e,`skipped`)}}),s)}if(s.skipInstall===!0){if(p?.setup===void 0)throw Error(`Registry item "${o}" does not declare a setup flow.`);return reportCompletion(e,o,await runDeclaredSetups({logger:e,appRoot:t,item:o,setups:p.setup,options:s,dependencies:c,cancelledReminder:setupReminder(o,`cancelled`),resumeCommand:setupResumeCommand(o)}),s)}if(await addRegistryItems([u],{config:l,cwd:t,overwrite:s.overwrite,silent:s.silent}),p?.setup===void 0)return reportCompletion(e,o,{facts:[]},s);let m=c.hasInteractiveTerminal?.()??defaultAddCommandDependencies.hasInteractiveTerminal();if(s.nonInteractive&&e.log(serializeHeadlessSetupEvent({version:1,type:`progress`,message:s.skipInstall?`Setup ${o}`:`Installed ${o}`})),s.skipSetup===!0){if(s.nonInteractive)return reportCompletion(e,o,{facts:[]},s);e.log(setupReminder(o,`skipped`));return}if(!s.nonInteractive&&!s.yes&&!m&&s.setupAuthorized!==!0){e.log(setupReminder(o,`skipped`));return}if(!s.nonInteractive&&!s.yes&&s.setupAuthorized!==!0)try{if(await(s.prompter??c.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${o} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`){e.log(setupReminder(o,`skipped`));return}}catch(t){if(!(t instanceof WizardCancelledError))throw t;e.log(setupReminder(o,`cancelled`));return}return reportCompletion(e,o,await runDeclaredSetups({logger:e,appRoot:t,item:o,setups:p.setup,options:s,dependencies:c,cancelledReminder:setupReminder(o,`cancelled`),resumeCommand:setupResumeCommand(o)}),s)})}function reportCompletion(e,n,r,i){return reportHeadlessSetupCompletion({logger:e,item:n,completion:r,nonInteractive:i.nonInteractive})}async function runRegistryAddCommand(e,t,n){await runRegistryAction(e,t,async()=>{let r=await addRegistryMappings(t,n);for(let t of r.skippedBuiltIn)e.log(`Skipped ${t} because it is built in.`);for(let t of r.skippedExisting)e.log(`Skipped ${t} because it is already configured.`);r.added.length>0&&e.log(`Added ${r.added.join(`, `)} to package.json.`)})}async function runRegistryListCommand(e,t,n,r={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,void 0,n,r))}async function runRegistrySearchCommand(e,t,n,r,i={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,n,r,{...i,limit:i.limit??10}))}async function runRegistryViewCommand(e,t,n,r={}){await runRegistryAction(e,t,async()=>{let i=await readEveRegistryConfig(t),a=await getRegistryItems([itemAddress(n)],{config:i}),o=a.length===1?a[0]:a;e.log(r.json?JSON.stringify(o,null,2):registryViewText(n,o))})}export{browseRegistryCatalog,getRegistryItemManifest,installOfficialRegistryItem,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`prompt`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_search:{verb:`Discover`,pastVerb:`Discovered`,argKey:`keywords`,singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},task_cancel:{verb:`Cancel`,pastVerb:`Cancelled`,argKey:`taskIds`,extractItem:taskIdsArg,singularNoun:`task`,pluralNoun:`tasks`},
|
|
1
|
+
import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`prompt`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_search:{verb:`Discover`,pastVerb:`Discovered`,argKey:`keywords`,singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},task_cancel:{verb:`Cancel`,pastVerb:`Cancelled`,argKey:`taskIds`,extractItem:taskIdsArg,singularNoun:`task`,pluralNoun:`tasks`},task_sleep:{verb:`Pause`,pastVerb:`Paused`,argKey:`seconds`,extractItem:sleepSecondsArg,singularNoun:`pause`,pluralNoun:`pauses`},task_update:{verb:`Update`,pastVerb:`Updated`,argKey:`message`,singularNoun:`parent`,pluralNoun:`parents`},web_fetch:{verb:`Fetch`,pastVerb:`Fetched`,argKey:`url`,singularNoun:`URL`,pluralNoun:`URLs`},web_search:{verb:`Search`,pastVerb:`Searched`,argKey:`query`,extractItem:e=>salientArg(e,`objective`)??salientArg(e,`search_query`)??salientArg(e,`searchQuery`)??webSearchActionArg(e),singularNoun:`query`,pluralNoun:`queries`}};function presentWriteFileTool(a,o,s){let c=readWriteFileInput(a,o);if(c===void 0)return{title:a,subtitle:summarizeToolArgs(o),summarizeResult:summarizeToolResult};let l=diffWriteDetail(s?.previousContent,c.content,s?.existed).map(e=>e.kind===`gap`?e:{...e,text:stripTerminalControls(e.text)});return{title:`${WRITE_FILE_VERB} ${salientLine(c.path)??c.path}`,doneTitle:`Wrote ${salientLine(c.path)??c.path}`,subtitle:``,summarizeResult:()=>void 0,detail:l,keepDetailWhenDone:!0}}function readWriteFileInput(e,t){if(toolBaseName(e)!==`write_file`||typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.filePath,i=n.content;if(!(typeof r!=`string`||r.trim().length===0)&&typeof i==`string`)return{path:r,content:i}}function presentTool(n,r,i){let c=toolBaseName(n);if(c===`todo`)return presentTodoTool(r);if(c===`write_file`)return presentWriteFileTool(n,r,i);if(i?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${c}`,doneTitle:`Delegated ${c}`,subtitle:salientArg(r,`message`)??``,summarizeResult:()=>void 0};if(c===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};let l=BUILTIN_TOOL_COPY[c];if(l!==void 0){let e=salientArg(r,l.argKey)??l.extractItem?.(r);if(e!==void 0)return{title:`${l.verb} ${e}`,doneTitle:`${l.pastVerb} ${e}`,subtitle:``,summarizeResult:()=>void 0,group:{verb:l.verb,pastVerb:l.pastVerb,singularNoun:l.singularNoun,pluralNoun:l.pluralNoun,item:e}}}return{title:n,subtitle:summarizeToolArgs(r),summarizeResult:summarizeToolResult}}function presentPreparingTool(e,t){let n=toolBaseName(e);if(n===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};if(t?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${n} …`,subtitle:``,summarizeResult:()=>void 0};let r=n===`write_file`?WRITE_FILE_VERB:BUILTIN_TOOL_COPY[n]?.verb;return{title:r===void 0?e:`${r} …`,subtitle:r===void 0?`preparing…`:``,summarizeResult:()=>void 0}}function isPanelRoutedTool(e){let t=toolBaseName(e);return t===`todo`||t===`ask_question`}function toolBaseName(e){return e.split(/[.:/]/u).at(-1)??e}function presentTodoTool(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e.todos:void 0;return Array.isArray(t)?{title:`Update todo list`,subtitle:`${t.length} task${t.length===1?``:`s`}`,summarizeResult:()=>void 0}:{title:`Read todo list`,subtitle:``,summarizeResult:()=>void 0}}function webSearchActionArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.action;if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.queries;if(Array.isArray(r)){let e=r.filter(e=>typeof e==`string`).map(salientLine).filter(e=>e!==void 0).join(`, `);if(e.length>0)return e}for(let e of[`query`,`url`,`pattern`]){let t=n[e];if(typeof t==`string`){let e=salientLine(t);if(e!==void 0)return e}}}function taskIdsArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.taskIds;if(!Array.isArray(t))return;let n=t.filter(e=>typeof e==`string`);if(n.length!==0)return salientLine(n.join(`, `))}function sleepSecondsArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.seconds;if(!(typeof t!=`number`||!Number.isFinite(t)))return`${String(t)}s`}function salientArg(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];if(typeof n==`string`)return salientLine(n)}function salientLine(e){let t=stripTerminalControls(e).split(/\r?\n/u).find(e=>e.trim().length>0)?.trim()??``;return t.length>0?t:void 0}export{isPanelRoutedTool,presentPreparingTool,presentTool,readWriteFileInput,toolBaseName};
|
package/dist/src/cli/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{applicationCommand}from"#cli/application-command.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";import{FORCED_EXIT_BACKSTOP_MS,installShutdownSignal,waitForShutdownSignal}from"#cli/shutdown.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{eveCliBanner}from"#cli/banner.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{findCliApplicationRoot,resolveCliApplicationProject}from"#cli/application-root.js";import{registerIntegrationCommands}from"#cli/commands/register-integration-commands.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{registerRegistryCommands}from"#cli/commands/register-registry-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{registerAcpCommand}from"#cli/acp/command.js";import{waitForServerOrStop,waitForUiOrServer}from"#cli/dev/wait-for-ui.js";import{registerRuntimeInvokeCommand}from"#cli/invoke/command.js";import{parseContextSizeOption,parseDisplayMode,parseLogsMode,parsePortOption,parseReasoningOption,parseStatsMode}from"#cli/option-parsers.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{resumeDevelopmentRuntimeArtifacts,suspendDevelopmentRuntimeArtifacts}from"#services/dev-client/runtime-artifacts.js";const devBootLog=createLogger(`dev.boot`);function createDevBootProgressReporter(e){return t=>{switch(t.type){case`phase-started`:e?.update(`Building your agent`,t.phase),devBootLog.debug(t.phase);return;case`phase-finished`:devBootLog.debug(`${t.phase} finished`,{ms:t.elapsedMs});return;case`before-first-paint`:e?.stop();return;default:return t}}}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#cli/dev/local-server-process.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,n,p){let g=resolveInstalledPackageInfo().version,_=new Command,v=createCliTheme();_.name(`eve`).description(`Build and run an eve application.`).version(g).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{[`info`,`dev`,`init`].includes(n.name())&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}}),applicationCommand(_.command(`channels`).description(`Manage user-authored channels in the current project.`).command(`list`),p).description(`List user-authored channels in the current project.`).option(`--json`,`Output as JSON`).action(async t=>{let{runChannelsListCommand:n}=await import(`#cli/commands/channels.js`);await n(e,p.project,t)}),registerIntegrationCommands({program:_,logger:e,applicationContext:p});let b=_.command(`extension`).description(`Create and build reusable eve extension packages.`);b.command(`init [target]`).description(`Create a new eve extension package.`).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve extension init.`);let{runExtensionInitCommand:r}=await import(`#cli/commands/extension-init.js`);await r(e,p.root,t)}),b.command(`build`).description(`Build the current package as an eve extension.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);t(p.root);let{runExtensionBuildCommand:n}=await import(`#cli/commands/extension-build.js`);await n(e,p.root)}),registerRegistryCommands({program:_,logger:e,applicationContext:p}),_.command(`init [target]`).description(`Create a new eve agent, or add one to an existing project directory.`).option(`--channel-web-nextjs`,`Add the Web Chat application (Next.js)`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve init.`);let{runInitCommand:r}=await import(`#cli/commands/init.js`);await r(e,p.root,t,{channelWebNextjs:n.channelWebNextjs,model:n.model,reasoning:n.reasoning})}),applicationCommand(_.command(`set`),p).description(`Change root agent model settings.`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).action(async t=>{let{runSetCommand:n}=await import(`#cli/commands/set.js`);await n(e,p.root,t)}),registerProjectCommands({program:_,logger:e,applicationContext:p}),registerBuildCommand({applicationContext:p,buildHost:n.buildHost,logger:e,program:_}),applicationCommand(_.command(`start`),p).description(`Start a built eve application.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).action(async t=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);r(p.root);let i=await(n.startProductionHost??await loadStartProductionHost())(p.root,{host:t.host,port:t.port});e.log(renderCliTaggedLine(v,{message:`server listening at ${i.url}`,tag:`start`,tone:`success`})),await waitForShutdownSignal({close:()=>i.close(),wait:()=>i.wait()})}),registerRuntimeInvokeCommand({applicationContext:p,logger:e,program:_,runtime:n}),registerAcpCommand({applicationContext:p,eveVersion:g,program:_,resolveVerifiedRemoteDevelopmentClient:n.resolveVerifiedRemoteDevelopmentClient,runAcpServer:n.runAcpServer,startHost:n.startHost}),applicationCommand(_.command(`dev`),p,e=>resolveDevelopmentUrlTarget(e.opts(),e.processedArgs[0])===void 0).description(`Start the eve development server or connect to an existing URL.`).argument(`[url]`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 2000)`,parsePortOption).option(`-u, --url <url>`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`-H, --header <header>`,`Request header for a URL target, in "Name: value" form (repeatable)`,parseDevelopmentHeaderOption).option(`--no-ui`,`Start the server without an interactive UI`).option(`--name <name>`,`Title shown in the terminal UI (defaults to the app folder name)`).option(`--input <text>`,`Pre-fill the prompt input, or start onboarding with /model`).option(`--tools <mode>`,`How tool calls render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--reasoning <mode>`,`How reasoning renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--subagents <mode>`,`How subagent sections render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--connection-auth <mode>`,`How connection authorization renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--assistant-response-stats <mode>`,`Assistant header statistic: tokens | tokensPerSecond`,parseStatsMode).option(`--context-size <tokens>`,`Model context window size, shown as a usage percentage`,parseContextSizeOption).option(`--logs <mode>`,`Which server/agent logs to show: all | stderr | sandbox | none`,parseLogsMode).addHelpText(`after`,`
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{Command,CommanderError,InvalidArgumentError}from"#compiled/commander/index.js";import{applicationCommand}from"#cli/application-command.js";import{parseDevelopmentHeaderOption,resolveDevelopmentUrlTarget}from"#cli/dev/url-target.js";import{parseDevelopmentServerUrl}from"#cli/dev/url.js";import{FORCED_EXIT_BACKSTOP_MS,installShutdownSignal,waitForShutdownSignal}from"#cli/shutdown.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,renderCliTaggedLine}from"#cli/ui/output.js";import{isCodingAgentLaunch}from"#cli/agent-detection.js";import{eveCliBanner}from"#cli/banner.js";import{startCliLiveRow}from"#cli/ui/live-row.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{registerBuildCommand}from"#cli/commands/build.js";import{resolveApplicationRoot}from"#internal/application/paths.js";import{findCliApplicationRoot,resolveCliApplicationProject}from"#cli/application-root.js";import{registerIntegrationCommands}from"#cli/commands/register-integration-commands.js";import{registerProjectCommands}from"#cli/commands/register-project-commands.js";import{registerRegistryCommands}from"#cli/commands/register-registry-commands.js";import{resolveDevUiMode,resolveTuiDisplayOptions}from"#cli/dev/ui-options.js";import{registerAcpCommand}from"#cli/acp/command.js";import{waitForServerOrStop,waitForUiOrServer}from"#cli/dev/wait-for-ui.js";import{registerRuntimeInvokeCommand}from"#cli/invoke/command.js";import{parseContextSizeOption,parseDisplayMode,parseLogsMode,parsePortOption,parseReasoningOption,parseStatsMode}from"#cli/option-parsers.js";import{resolveTuiTitle}from"#cli/dev/tui/target.js";import{resumeDevelopmentRuntimeArtifacts,suspendDevelopmentRuntimeArtifacts}from"#services/dev-client/runtime-artifacts.js";const devBootLog=createLogger(`dev.boot`);function createDevBootProgressReporter(e){return t=>{switch(t.type){case`phase-started`:e?.update(`Building your agent`,t.phase),devBootLog.debug(t.phase);return;case`phase-finished`:devBootLog.debug(`${t.phase} finished`,{ms:t.elapsedMs});return;case`before-first-paint`:e?.stop();return;default:return t}}}async function loadPrintApplicationInfo(){return(await import(`#cli/commands/info.js`)).printApplicationInfo}async function loadRunDevelopmentTui(){return(await import(`#cli/dev/tui/tui.js`)).runDevelopmentTui}async function loadRunEvalCommand(){return(await import(`#evals/cli/eval.js`)).runEvalCommand}async function loadStartHost(){return(await import(`#cli/dev/local-server-process.js`)).createDevelopmentServer}const loadIsActiveDevelopmentServerForApp=async()=>(await import(`#internal/nitro/host.js`)).isActiveDevelopmentServerForApp;async function loadStartProductionHost(){return(await import(`#internal/nitro/host.js`)).startProductionServer}function hasInteractiveTerminal(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}function createCliProgram(e,n,p){let g=resolveInstalledPackageInfo().version,_=new Command,v=createCliTheme();_.name(`eve`).description(`Build and run an eve application.`).version(g).showHelpAfterError().exitOverride().hook(`preAction`,(t,n)=>{let{json:r}=n.opts();[`info`,`dev`,`init`].includes(n.name())&&!r&&e.log(eveCliBanner())}).configureOutput({writeErr:t=>{e.error(t.trimEnd())},writeOut:t=>{e.log(t.trimEnd())}}),applicationCommand(_.command(`channels`).description(`Manage user-authored channels in the current project.`).command(`list`),p).description(`List user-authored channels in the current project.`).option(`--json`,`Output as JSON`).action(async t=>{let{runChannelsListCommand:n}=await import(`#cli/commands/channels.js`);await n(e,p.project,t)}),registerIntegrationCommands({program:_,logger:e,applicationContext:p});let b=_.command(`extension`).description(`Create and build reusable eve extension packages.`);b.command(`init [target]`).description(`Create a new eve extension package.`).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve extension init.`);let{runExtensionInitCommand:r}=await import(`#cli/commands/extension-init.js`);await r(e,p.root,t)}),b.command(`build`).description(`Build the current package as an eve extension.`).action(async()=>{let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);t(p.root);let{runExtensionBuildCommand:n}=await import(`#cli/commands/extension-build.js`);await n(e,p.root)}),registerRegistryCommands({program:_,logger:e,applicationContext:p}),_.command(`init [target]`).description(`Create a new eve agent, or add one to an existing project directory.`).option(`--channel-web-nextjs`,`Add the Web Chat application (Next.js)`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).option(`-y, --yes`,`Accepted for compatibility; has no effect`).action(async(t,n)=>{n.yes&&e.error(`warning: --yes has no effect for eve init.`);let{runInitCommand:r}=await import(`#cli/commands/init.js`);await r(e,p.root,t,{channelWebNextjs:n.channelWebNextjs,model:n.model,reasoning:n.reasoning})}),applicationCommand(_.command(`set`),p).description(`Change root agent model settings.`).option(`--model <model>`,`Set the agent model (provider/model-id)`).option(`--reasoning <effort>`,`Set reasoning (provider-default|none|minimal|low|medium|high|xhigh)`,parseReasoningOption).action(async t=>{let{runSetCommand:n}=await import(`#cli/commands/set.js`);await n(e,p.root,t)}),registerProjectCommands({program:_,logger:e,applicationContext:p}),registerBuildCommand({applicationContext:p,buildHost:n.buildHost,logger:e,program:_}),applicationCommand(_.command(`start`),p).description(`Start a built eve application.`).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 3000)`,parsePortOption).action(async t=>{let{loadDevelopmentEnvironmentFiles:r}=await import(`#cli/dev/environment.js`);r(p.root);let i=await(n.startProductionHost??await loadStartProductionHost())(p.root,{host:t.host,port:t.port});e.log(renderCliTaggedLine(v,{message:`server listening at ${i.url}`,tag:`start`,tone:`success`})),await waitForShutdownSignal({close:()=>i.close(),wait:()=>i.wait()})}),registerRuntimeInvokeCommand({applicationContext:p,logger:e,program:_,runtime:n}),registerAcpCommand({applicationContext:p,eveVersion:g,program:_,resolveVerifiedRemoteDevelopmentClient:n.resolveVerifiedRemoteDevelopmentClient,runAcpServer:n.runAcpServer,startHost:n.startHost}),applicationCommand(_.command(`dev`),p,e=>resolveDevelopmentUrlTarget(e.opts(),e.processedArgs[0])===void 0).description(`Start the eve development server or connect to an existing URL.`).argument(`[url]`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`--host <host>`,`Host interface to bind`).option(`--port <port>`,`Port to listen on (defaults to $PORT, then 2000)`,parsePortOption).option(`-u, --url <url>`,`Connect to an existing server URL`,parseDevelopmentServerUrl).option(`-H, --header <header>`,`Request header for a URL target, in "Name: value" form (repeatable)`,parseDevelopmentHeaderOption).option(`--no-ui`,`Start the server without an interactive UI`).option(`--name <name>`,`Title shown in the terminal UI (defaults to the app folder name)`).option(`--input <text>`,`Pre-fill the prompt input, or start onboarding with /model`).option(`--tools <mode>`,`How tool calls render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--reasoning <mode>`,`How reasoning renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--subagents <mode>`,`How subagent sections render: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--connection-auth <mode>`,`How connection authorization renders: full | collapsed | auto-collapsed | hidden`,parseDisplayMode).option(`--assistant-response-stats <mode>`,`Assistant header statistic: tokens | tokensPerSecond`,parseStatsMode).option(`--context-size <tokens>`,`Model context window size, shown as a usage percentage`,parseContextSizeOption).option(`--logs <mode>`,`Which server/agent logs to show: all | stderr | sandbox | none`,parseLogsMode).addHelpText(`after`,`
|
|
2
2
|
You can also pass a bare URL, for example: eve dev https://example.com
|
|
3
3
|
`).action(async(t,i)=>{let a=resolveDevelopmentUrlTarget(i,t),s=a?.serverUrl,u=hasInteractiveTerminal(),d=resolveDevUiMode({options:i,interactive:u});if(i.input!==void 0&&d===`headless`)throw new InvalidArgumentError(`--input requires the interactive UI.`);let f=!1;s!==void 0&&(f=await(n.isActiveDevelopmentServerForApp??await loadIsActiveDevelopmentServerForApp())({appRoot:p.root,serverUrl:s}));let runInteractiveUi=async(e,t,r)=>{let o=await devBootPhase(`loading interactive UI`,async()=>n.runDevelopmentTui??await loadRunDevelopmentTui(),t),c=resolveTuiDisplayOptions(i),l=s===void 0||f?{kind:`local`,serverUrl:e.serverUrl,workspaceRoot:e.appRoot??p.root}:{kind:`remote`,serverUrl:e.serverUrl,workspaceRoot:p.root},u=resolveTuiTitle({name:i.name,target:l});u!==void 0&&(c.name=u);let d={target:l,initialInput:i.input,onBootProgress:t,lifecycle:r,...c};l.kind===`local`&&(d.withExclusiveTerminal=async t=>await(async()=>{if(!await suspendDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl}))throw Error(`Could not pause the development server for integration setup.`);try{return await t()}finally{await resumeDevelopmentRuntimeArtifacts({serverUrl:e.serverUrl,silent:!0})}})()),a?.headers===void 0?await o(d):await o({...d,headers:a.headers})};if(s){let{loadDevelopmentEnvironmentFiles:t}=await import(`#cli/dev/environment.js`);if(t(p.root),e.log(`↗ ${f?`local`:`remote`} mode targeting ${v.info(new URL(s).host)}`),d===`headless`){e.log(renderCliTaggedLine(v,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`}));return}e.log(``);let n=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS});try{await runInteractiveUi({serverUrl:s},void 0,n)}finally{n.dispose()}return}d===`tui`&&e.log(``);let m=d===`tui`?startCliLiveRow(e):void 0,h=createDevBootProgressReporter(m);m?.update(`Building your agent`);let g,_,closeServer=()=>g===void 0?Promise.resolve():(_??=g.close(),_.catch(()=>void 0),_),y=installShutdownSignal({exitAfterMs:FORCED_EXIT_BACKSTOP_MS,onStop:()=>{closeServer()}});try{g=(n.startHost??await loadStartHost())(p.root,{existing:d===`tui`?`attach-if-unconfigured`:`reject`,host:i.host,onBootProgress:h,port:i.port});let t=(await Promise.race([g.start().then(e=>({handle:e})),y.stopped.then(()=>({handle:void 0}))])).handle;if(t===void 0)return;if(d!==`tui`&&e.log(renderCliTaggedLine(v,{message:`server listening at ${t.url}`,tag:`dev`,tone:`success`})),d===`headless`){i.ui!==!1&&!u&&e.log(renderCliTaggedLine(v,{message:`Interactive UI disabled because the current terminal is not a TTY.`,tag:`dev`,tone:`warning`})),await waitForServerOrStop(g,y);return}await waitForUiOrServer({handle:t,lifecycle:y,server:g,runUi:async()=>await runInteractiveUi({appRoot:t.appRoot,serverUrl:t.url},h,y)})}finally{m?.stop(),await closeServer(),y.dispose()}});let x=_.command(`logs`).description("Inspect local `eve dev` diagnostic logs (.eve/logs).");return applicationCommand(x.command(`show [logid]`,{isDefault:!0}),p).description(`Print a diagnostic log (the most recent when logid is omitted).`).option(`--dump`,`Prepend the log's environment dump (.dump sibling)`).option(`--events`,`Interleave session events from the local workflow store`).action(async(t,n)=>{let{runLogsShowCommand:r}=await import(`#cli/commands/logs.js`);await r(e,p.root,t,n)}),applicationCommand(x.command(`ls`),p).description(`List diagnostic logs, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runLogsListCommand:n}=await import(`#cli/commands/logs.js`);await n(e,p.root,t)}),applicationCommand(_.command(`traces [trace]`),p).usage(`[options] [trace]
|
|
4
4
|
eve traces ls [options]`).description("Show a local `eve dev` trace (the most recent when trace is omitted).").option(`--verbose`,`Expand every span with all attributes and events`).option(`--json`,`Output as JSON`).action(async(t,n)=>{let{runTraceShowCommand:r}=await import(`#cli/commands/trace.js`);await r(e,p.root,t,n)}).command(`ls`).description(`List local traces, most recent first.`).option(`--json`,`Output as JSON`).action(async t=>{let{runTraceListCommand:n}=await import(`#cli/commands/trace.js`);await n(e,p.root,t)}),applicationCommand(_.command(`info`),p).description(`Print resolved application information.`).option(`--json`,`Output as JSON`).action(async t=>{await(n.printApplicationInfo??await loadPrintApplicationInfo())(e,p.root,t)}),applicationCommand(_.command(`eval`),p).description(`Run evals against an eve agent.`).argument(`[evalIds...]`,`Eval ids (or directory prefixes) to run (all discovered evals when omitted)`).option(`--url <url>`,`Remote agent URL (skip local host startup)`,parseDevelopmentServerUrl).option(`--tag <tag...>`,`Run only evals carrying a tag`).option(`--exclude-tag <tag...>`,`Skip evals carrying a tag`).option(`--strict`,`Fail the exit code when any score falls below its threshold`).option(`--list`,`Print discovered evals without running them`).option(`--timeout <ms>`,`Per-eval timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent eval executions`).option(`--json`,`Output results as JSON`).option(`--junit <path>`,`Write JUnit XML results to a file`).option(`--skip-report`,`Skip eval-defined reporters (e.g. Braintrust)`).option(`--verbose`,`Stream per-eval t.log lines to stdout`).action(async(t,r)=>{await(n.runEvalCommand??await loadRunEvalCommand())(t,r,e,p.root)}),_}async function runCli(e=process.argv.slice(2),t=console,r={}){let i={root:resolveApplicationRoot(),async resolve(){let e=await(r.resolveApplicationProject??resolveCliApplicationProject)(i.root);i.project=e,i.root=e.appRoot}},a=createCliProgram(t,r,i),o=e;if(o.length===0){let e=await(r.findApplicationRoot??findCliApplicationRoot)(i.root);e===void 0?o=[`init`]:(i.root=e,o=[`dev`])}try{await a.parseAsync(o,{from:`user`})}catch(e){if(e instanceof CommanderError){if(e.exitCode===0)return;let n=await(r.isCodingAgentLaunch??isCodingAgentLaunch)();if(o[0]===`init`&&n){let{initAgentInstructions:e}=await import(`#cli/commands/agent-instructions.js`);t.log(e())}throw Error(e.message)}throw e}}export{resolveDevUiMode,resolveTuiDisplayOptions,runCli};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_SESSION_ROUTE_PATH,createEveSessionRoutePath}from"#protocol/routes.js";import{EVE_SESSION_ID_HEADER,isCurrentTurnBoundaryEvent}from"#protocol/message.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{followStreamIterable}from"#client/open-stream.js";import{cancelClientSession,clearClientSession,compactClientSession,resetClientSession}from"#client/session-controls.js";import{serializeOutputSchema}from"#shared/tool-schema.js";var ClientSession=class ClientSession{#e;#t;constructor(e,t){this.#e=e,this.#t=t}static async create(t,n){let r=await postTurn(t,EVE_SESSION_ROUTE_PATH,n,!0),i=await readSessionId(r),a=new ClientSession(t,{sessionId:i,streamIndex:0});return{response:a.#r(r,n,0),session:a}}get state(){return this.#t}async snapshot(e){e?.signal?.throwIfAborted();let t=[];for await(let n of this.#o({follow:!1,signal:e?.signal,startIndex:0}))t.push(n);return e?.signal?.throwIfAborted(),{events:t,session:{sessionId:this.#t.sessionId,streamIndex:t.length}}}async send(e,t={}){return await this.#n({...t,message:e})}async respond(e,t={}){if(e.length===0)throw Error(`ClientSession.respond() requires at least one input response.`);return await this.#n({...t,inputResponses:e})}async#n(e){let n=this.#t.streamIndex,r=await postTurn(this.#e,createEveSessionRoutePath(this.#t.sessionId),e,!1);if(await readSessionId(r,this.#t.sessionId)!==this.#t.sessionId)throw Error(`Message route returned a different session id.`);return this.#r(r,e,n)}async cancel(e){return await cancelClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}async clear(){return await clearClientSession({context:this.#e,sessionId:this.#t.sessionId})}async compact(){return await compactClientSession({context:this.#e,sessionId:this.#t.sessionId})}async reset(e){return await resetClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}stream(e){if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#a(e)}#r(e,t,n){return e.body?.cancel().catch(()=>{}),new MessageResponse({cancelTurn:async e=>await this.cancel({turnId:e}),createStream:()=>this.#i(n,t),sessionId:this.#t.sessionId})}async*#i(e,t){let n=0;try{for await(let
|
|
1
|
+
import{EVE_SESSION_ROUTE_PATH,createEveSessionRoutePath}from"#protocol/routes.js";import{EVE_SESSION_ID_HEADER,isCurrentTurnBoundaryEvent}from"#protocol/message.js";import{ClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{MessageResponse}from"#client/message-response.js";import{followStreamIterable}from"#client/open-stream.js";import{cancelClientSession,clearClientSession,compactClientSession,resetClientSession}from"#client/session-controls.js";import{serializeOutputSchema}from"#shared/tool-schema.js";var ClientSession=class ClientSession{#e;#t;constructor(e,t){this.#e=e,this.#t=t}static async create(t,n){let r=await postTurn(t,EVE_SESSION_ROUTE_PATH,n,!0),i=await readSessionId(r),a=new ClientSession(t,{sessionId:i,streamIndex:0});return{response:a.#r(r,n,0),session:a}}get state(){return this.#t}async snapshot(e){e?.signal?.throwIfAborted();let t=[];for await(let n of this.#o({follow:!1,signal:e?.signal,startIndex:0}))t.push(n);return e?.signal?.throwIfAborted(),{events:t,session:{sessionId:this.#t.sessionId,streamIndex:t.length}}}async send(e,t={}){return await this.#n({...t,message:e})}async respond(e,t={}){if(e.length===0)throw Error(`ClientSession.respond() requires at least one input response.`);return await this.#n({...t,inputResponses:e})}async#n(e){let n=this.#t.streamIndex,r=await postTurn(this.#e,createEveSessionRoutePath(this.#t.sessionId),e,!1);if(await readSessionId(r,this.#t.sessionId)!==this.#t.sessionId)throw Error(`Message route returned a different session id.`);return this.#r(r,e,n)}async cancel(e){return await cancelClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}async clear(){return await clearClientSession({context:this.#e,sessionId:this.#t.sessionId})}async compact(){return await compactClientSession({context:this.#e,sessionId:this.#t.sessionId})}async reset(e){return await resetClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}stream(e){if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#a(e)}#r(e,t,n){return e.body?.cancel().catch(()=>{}),new MessageResponse({cancelTurn:async e=>await this.cancel({turnId:e}),createStream:()=>this.#i(n,t),sessionId:this.#t.sessionId})}async*#i(e,t){let n=0,i=new Set;try{for await(let a of this.#o({headers:t.headers,keepAlive:shouldKeepActiveTurnAlive(t.streamReconnectPolicy),signal:t.signal,startIndex:e,streamReconnectPolicy:t.streamReconnectPolicy}))if(n+=1,a.type===`authorization.required`&&a.data.webhookUrl!==void 0?i.add(a.data.name):a.type===`authorization.completed`&&i.delete(a.data.name),yield a,isCurrentTurnBoundaryEvent(a)&&(a.type!==`session.waiting`||i.size===0))break}finally{this.#t={sessionId:this.#t.sessionId,streamIndex:e+n}}}async*#a(e){let t=e?.startIndex??this.#t.streamIndex,n=0;try{for await(let r of this.#o({follow:e?.follow,signal:e?.signal,startIndex:t,streamReconnectPolicy:e?.streamReconnectPolicy}))n+=1,yield r}finally{t>=0&&(this.#t={sessionId:this.#t.sessionId,streamIndex:t+n})}}#o(e){return followStreamIterable({follow:e.follow,host:this.#e.host,keepAlive:e.keepAlive,resolveHeaders:()=>this.#e.resolveHeaders(e.headers),redirect:this.#e.redirect,sessionId:this.#t.sessionId,signal:e.signal,startIndex:e.startIndex,streamReconnectPolicy:e.streamReconnectPolicy})}};function shouldKeepActiveTurnAlive(e){return e&&`reconnect`in e?!1:e?.streamIdleReconnectPolicy?.maxAttempts===void 0}async function postTurn(e,t,n,r){let o=createMessageBody(n,r);if(o===null)throw Error(r?`Creating a session requires a non-empty message.`:`A session turn requires a non-empty message or inputResponses.`);let s=await e.resolveHeaders(n.headers);s.set(`content-type`,`application/json`);let c=await fetch(createClientUrl(e.host,t),{body:JSON.stringify(o),headers:s,method:`POST`,redirect:e.redirect,signal:n.signal??null});if(!c.ok){let e=await c.text();throw new ClientError(c.status,e,c.headers)}return c}async function readSessionId(e,t){let r=await e.json(),i=(typeof r.sessionId==`string`?r.sessionId:void 0)??e.headers.get(EVE_SESSION_ID_HEADER)?.trim()??t;if(!i)throw Error(`Message route did not return a session id.`);return i}function createMessageBody(e,t){let n={};e.message!==void 0&&(n.message=e.message),e.inputResponses!==void 0&&e.inputResponses.length>0&&(n.inputResponses=e.inputResponses),!t&&e.message!==void 0&&e.turnPolicy!==void 0&&(n.turnPolicy=e.turnPolicy),e.clientContext!==void 0&&(n.clientContext=e.clientContext);let r=serializeOutputSchema(e.outputSchema);return r!==void 0&&(n.outputSchema=r),t&&n.message===void 0||n.message===void 0&&n.inputResponses===void 0?null:n}export{ClientSession};
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"@opentelemetry/otlp-transformer": "0.214.0",
|
|
25
25
|
"@ai-sdk/otel": "1.0.58",
|
|
26
26
|
"@photon-ai/chat-adapter-imessage": "3.2.0",
|
|
27
|
+
"@linqapp/chat-sdk-adapter": "0.3.0",
|
|
27
28
|
"picocolors": "1.1.1",
|
|
28
29
|
"@ai-sdk/provider": "4.0.7",
|
|
29
30
|
"@ai-sdk/provider-utils": "5.0.25",
|
|
30
31
|
"semver": "7.8.4",
|
|
31
|
-
"shadcn": "4.
|
|
32
|
+
"shadcn": "4.18.0",
|
|
32
33
|
"@standard-schema/spec": "1.1.0",
|
|
33
34
|
"turndown": "7.2.4",
|
|
34
35
|
"@vercel/detect-agent": "1.2.3",
|
|
@@ -36,16 +37,16 @@
|
|
|
36
37
|
"@vercel/otel": "2.1.3",
|
|
37
38
|
"@vercel/sandbox-drives": "2.10.0-beta.0",
|
|
38
39
|
"@vercel/sandbox": "2.8.0",
|
|
39
|
-
"@workflow/core": "5.0.0-beta.
|
|
40
|
+
"@workflow/core": "5.0.0-beta.43",
|
|
40
41
|
"@workflow/errors": "5.0.0-beta.17",
|
|
41
42
|
"@workflow/serde": "5.0.0-beta.2",
|
|
42
|
-
"@workflow/world": "5.0.0-beta.
|
|
43
|
-
"@workflow/world-local": "5.0.0-beta.
|
|
44
|
-
"@workflow/world-vercel": "5.0.0-beta.
|
|
43
|
+
"@workflow/world": "5.0.0-beta.28",
|
|
44
|
+
"@workflow/world-local": "5.0.0-beta.37",
|
|
45
|
+
"@workflow/world-vercel": "5.0.0-beta.39",
|
|
45
46
|
"zod": "4.4.3",
|
|
46
47
|
"zod-validation-error": "5.0.0"
|
|
47
48
|
},
|
|
48
|
-
"scriptHash": "
|
|
49
|
+
"scriptHash": "3df641b560424ccb204931fa6e23d3cfbb23d4068df6a553db4574dda958a32a",
|
|
49
50
|
"toolVersions": {
|
|
50
51
|
"rolldown": "1.1.5"
|
|
51
52
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Linq
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|