eve 0.30.3 → 0.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/src/channel/cancel.d.ts +1 -3
  3. package/dist/src/channel/cancel.js +1 -1
  4. package/dist/src/channel/clear-session.js +1 -1
  5. package/dist/src/channel/compact-session.js +1 -1
  6. package/dist/src/channel/reset-session.d.ts +1 -3
  7. package/dist/src/channel/reset-session.js +1 -1
  8. package/dist/src/channel/resolve-active-session.js +1 -1
  9. package/dist/src/channel/schedule.js +1 -1
  10. package/dist/src/channel/send.js +1 -1
  11. package/dist/src/channel/session.js +1 -1
  12. package/dist/src/channel/types.d.ts +55 -20
  13. package/dist/src/cli/commands/register-registry-commands.d.ts +1 -1
  14. package/dist/src/cli/commands/register-registry-commands.js +1 -1
  15. package/dist/src/cli/commands/registry-project.js +1 -1
  16. package/dist/src/cli/commands/registry.d.ts +6 -1
  17. package/dist/src/cli/commands/registry.js +6 -1
  18. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
  19. package/dist/src/cli/dev/tui/traces/trace-view.js +2 -2
  20. package/dist/src/compiled/.vendor-stamp.json +1 -1
  21. package/dist/src/compiled/shadcn-registry/index.js +364 -364
  22. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  23. package/dist/src/execution/forward-turn-cancellation-step.d.ts +6 -0
  24. package/dist/src/execution/forward-turn-cancellation-step.js +1 -0
  25. package/dist/src/execution/runtime-errors.d.ts +12 -0
  26. package/dist/src/execution/runtime-errors.js +1 -1
  27. package/dist/src/execution/sandbox/abort-bound-session.js +1 -1
  28. package/dist/src/execution/session-command-inbox.d.ts +22 -0
  29. package/dist/src/execution/session-command-inbox.js +1 -0
  30. package/dist/src/execution/session-command-token.d.ts +2 -0
  31. package/dist/src/execution/session-command-token.js +1 -0
  32. package/dist/src/execution/session-timeout-control.d.ts +4 -3
  33. package/dist/src/execution/session-timeout-control.js +1 -1
  34. package/dist/src/execution/turn-cancellation-control.d.ts +3 -3
  35. package/dist/src/execution/turn-cancellation-control.js +1 -1
  36. package/dist/src/execution/turn-cancellation-token.d.ts +3 -3
  37. package/dist/src/execution/turn-cancellation-token.js +1 -1
  38. package/dist/src/execution/turn-control-protocol.js +1 -1
  39. package/dist/src/execution/turn-control-receiver.d.ts +9 -5
  40. package/dist/src/execution/turn-control-receiver.js +1 -1
  41. package/dist/src/execution/turn-dispatch.d.ts +5 -4
  42. package/dist/src/execution/turn-dispatch.js +1 -1
  43. package/dist/src/execution/turn-workflow.d.ts +1 -1
  44. package/dist/src/execution/turn-workflow.js +1 -1
  45. package/dist/src/execution/workflow-entry.d.ts +1 -1
  46. package/dist/src/execution/workflow-entry.js +1 -1
  47. package/dist/src/execution/workflow-runtime.d.ts +1 -1
  48. package/dist/src/execution/workflow-runtime.js +1 -1
  49. package/dist/src/execution/workflow-steps.js +1 -1
  50. package/dist/src/internal/application/package.js +1 -1
  51. package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
  52. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  53. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  54. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  55. package/dist/src/setup/scaffold/create/project.js +1 -1
  56. package/docs/channels/eve.mdx +2 -0
  57. package/docs/guides/client/messages.mdx +1 -1
  58. package/docs/guides/client/output-schema.mdx +1 -1
  59. package/docs/guides/client/overview.mdx +1 -1
  60. package/docs/guides/dev-tui.md +1 -1
  61. package/docs/guides/instrumentation.md +10 -42
  62. package/docs/install-integrations.mdx +13 -3
  63. package/docs/reference/cli.md +19 -2
  64. package/package.json +2 -2
  65. package/dist/src/execution/session-delivery-hook.d.ts +0 -22
  66. package/dist/src/execution/session-delivery-hook.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # eve
2
2
 
3
+ ## 0.30.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 5ee18e2: Prevent successful local `eve invoke` commands from logging a spurious Workflow queue 503 while their temporary development server shuts down.
8
+ - d8fc092: Format registry search results as concise, width-aware entries and limit searches to 10 matches by default. Use `--limit` to request up to 100 results.
9
+ - 557000b: Add skills.sh as a built-in registry, so `eve registry search --registry @skills <query>` and `eve add @skills/<skill>` work without project configuration.
10
+ - 1953d20: Prevent sandbox abort listeners from accumulating across repeated operations in a turn.
11
+ - 7086776: Route session controls and follow-up messages through one durable command inbox shared by stable session IDs and rekeyable channel addresses.
12
+
13
+ ## 0.30.4
14
+
15
+ ### Patch Changes
16
+
17
+ - fc87d23: Dev runtime snapshots no longer copy the `.workflow-vitest` test cache. In
18
+ workspaces that had run integration tests, this directory was duplicated into
19
+ every generation under `.eve/dev-runtime/snapshots` — tens of megabytes per
20
+ rebuild that nothing at dev runtime reads.
21
+
3
22
  ## 0.30.3
4
23
 
5
24
  ### Patch Changes
@@ -1,8 +1,6 @@
1
1
  import type { CancelFn } from "#channel/routes.js";
2
2
  import type { Runtime } from "#channel/types.js";
3
3
  /**
4
- * Builds the route-handler `cancel` helper for one channel. Resolves the
5
- * channel-local continuation token to its owning session without delivering
6
- * input, then delegates to the runtime's session-id-addressed cancellation.
4
+ * Builds the route-handler `cancel` helper for one channel.
7
5
  */
8
6
  export declare function createCancelFn(runtime: Runtime, channelName: string): CancelFn;
@@ -1 +1 @@
1
- function createCancelFn(e,t){return async n=>{let r=`${t}:${n.continuationToken}`,i=await e.resolveSession(r);return i===void 0?{status:`no_active_turn`}:await e.cancelTurn({sessionId:i.sessionId,turnId:n.turnId})}}export{createCancelFn};
1
+ function createCancelFn(e,t){return async n=>await e.dispatchContinuation({command:{kind:`cancel`,turnId:n.turnId},continuationToken:`${t}:${n.continuationToken}`})}export{createCancelFn};
@@ -1 +1 @@
1
- function createClearFn(e,t){return async n=>await e.clearSession({continuationToken:`${t}:${n.continuationToken}`})}export{createClearFn};
1
+ function createClearFn(e,t){return async n=>await e.dispatchContinuation({command:{kind:`clear`},continuationToken:`${t}:${n.continuationToken}`})}export{createClearFn};
@@ -1 +1 @@
1
- function createCompactFn(e,t){return async n=>await e.compactSession({continuationToken:`${t}:${n.continuationToken}`})}export{createCompactFn};
1
+ function createCompactFn(e,t){return async n=>await e.dispatchContinuation({command:{kind:`compact`},continuationToken:`${t}:${n.continuationToken}`})}export{createCompactFn};
@@ -1,8 +1,6 @@
1
1
  import type { ResetFn } from "#channel/routes.js";
2
2
  import type { Runtime } from "#channel/types.js";
3
3
  /**
4
- * Builds a channel-scoped session reset helper. It resolves an owner once and
5
- * retires that observed session id, so it can never cancel a later owner that
6
- * claimed the same continuation token.
4
+ * Builds a channel-scoped session reset helper.
7
5
  */
8
6
  export declare function createResetFn(runtime: Runtime, channelName: string): ResetFn;
@@ -1 +1 @@
1
- function createResetFn(e,t){return async n=>{let r=`${t}:${n.continuationToken}`,i=await e.resolveSession(r);return i===void 0?{status:`no_active_session`}:(await e.terminateSession({reason:n.reason,sessionId:i.sessionId}),{status:`reset`,previousSessionId:i.sessionId})}}export{createResetFn};
1
+ function createResetFn(e,t){return async n=>{let r=`${t}:${n.continuationToken}`;return await e.dispatchContinuation({command:{kind:`reset`,reason:n.reason},continuationToken:r})}}export{createResetFn};
@@ -1 +1 @@
1
- function createResolveActiveSessionFn(e,t){return({continuationToken:n})=>e.resolveSession(`${t}:${n}`)}export{createResolveActiveSessionFn};
1
+ function createResolveActiveSessionFn(e,t){return({continuationToken:n})=>e.resolveContinuation(`${t}:${n}`)}export{createResolveActiveSessionFn};
@@ -1 +1 @@
1
- import{createSession}from"#channel/session.js";import{SCHEDULE_APP_AUTH,SCHEDULE_APP_AUTH as SCHEDULE_APP_AUTH$1}from"#channel/schedule-auth.js";import{createCrossChannelReceiveFn,toCrossChannelTargets}from"#channel/cross-channel-receive.js";import{expectFunction}from"#internal/authored-module.js";const SCHEDULE_ADAPTER_KIND=`schedule`,SCHEDULE_ADAPTER={kind:SCHEDULE_ADAPTER_KIND};var ScheduleDispatcher=class{runtime;channels;constructor(e){this.runtime=e.runtime,this.channels=e.channels}async trigger(e){let t=[],i=[],a=createCrossChannelReceiveFn(this.runtime,toCrossChannelTargets(this.channels)),o={appAuth:SCHEDULE_APP_AUTH$1,receive:async(e,n)=>{let r=await a(e,n);return t.push(r),r},waitUntil(e){i.push(e)}};if(e.run)await e.run(o);else if(e.markdown!==void 0){let n=await this.runMarkdown(e.markdown);t.push(n)}else throw Error(`Schedule "${e.scheduleId}" has neither "run" nor "markdown" — at least one must be set.`);return{sessions:t,waitUntilTasks:i}}async runMarkdown(t){let r=await this.runtime.run({adapter:SCHEDULE_ADAPTER,auth:SCHEDULE_APP_AUTH$1,input:{message:t},mode:`task`});return createSession(r.sessionId,r.continuationToken,this.runtime)}};function expectScheduleRun(e,t,n){let r=e;if(typeof r!=`object`||!r)throw Error(`Schedule export "${n??`default`}" from "${t}" must be an object.`);return expectFunction(r.run,`Expected the schedule export "${n??`default`}" from "${t}" to export a \`run\` handler function.`)}export{SCHEDULE_ADAPTER,SCHEDULE_ADAPTER_KIND,SCHEDULE_APP_AUTH,ScheduleDispatcher,expectScheduleRun};
1
+ import{createSession}from"#channel/session.js";import{SCHEDULE_APP_AUTH,SCHEDULE_APP_AUTH as SCHEDULE_APP_AUTH$1}from"#channel/schedule-auth.js";import{createCrossChannelReceiveFn,toCrossChannelTargets}from"#channel/cross-channel-receive.js";import{expectFunction}from"#internal/authored-module.js";const SCHEDULE_ADAPTER_KIND=`schedule`,SCHEDULE_ADAPTER={kind:SCHEDULE_ADAPTER_KIND};var ScheduleDispatcher=class{runtime;channels;constructor(e){this.runtime=e.runtime,this.channels=e.channels}async trigger(e){let t=[],i=[],a=createCrossChannelReceiveFn(this.runtime,toCrossChannelTargets(this.channels)),o={appAuth:SCHEDULE_APP_AUTH$1,receive:async(e,n)=>{let r=await a(e,n);return t.push(r),r},waitUntil(e){i.push(e)}};if(e.run)await e.run(o);else if(e.markdown!==void 0){let n=await this.runMarkdown(e.markdown);t.push(n)}else throw Error(`Schedule "${e.scheduleId}" has neither "run" nor "markdown" — at least one must be set.`);return{sessions:t,waitUntilTasks:i}}async runMarkdown(t){let r=await this.runtime.createSession({adapter:SCHEDULE_ADAPTER,auth:SCHEDULE_APP_AUTH$1,input:{message:t},mode:`task`});return createSession(r.sessionId,r.continuationToken,this.runtime)}};function expectScheduleRun(e,t,n){let r=e;if(typeof r!=`object`||!r)throw Error(`Schedule export "${n??`default`}" from "${t}" must be an object.`);return expectFunction(r.run,`Expected the schedule export "${n??`default`}" from "${t}" to export a \`run\` handler function.`)}export{SCHEDULE_ADAPTER,SCHEDULE_ADAPTER_KIND,SCHEDULE_APP_AUTH,ScheduleDispatcher,expectScheduleRun};
@@ -1 +1 @@
1
- import{createSession}from"#channel/session.js";import{isRuntimeNoActiveSessionError}from"#execution/runtime-errors.js";import{serializeUrlFilePart}from"#internal/attachments/url-refs.js";function createSendFn(n,r,i,a={}){return async(o,s)=>{let c=s,{auth:l,callback:u,caller:d,capabilities:f,initiatorAuth:p,state:m,title:h}=c,g=c.intent??`resume-or-start`,_=c.mode??`conversation`,v=c.continuationToken,y=`${i}:${v}`,{message:b,inputResponses:x,context:S,outputSchema:C}=normalizeSendInput(o),w=serializeUrlFilePartsInMessage(b);try{let t={auth:l,caller:d,continuationToken:y,requestId:a.requestId,payload:{inputResponses:x,message:w,context:S,outputSchema:C}},{sessionId:r}=await n.deliver(t);return createSession(r,v,n)}catch(e){if(!isRuntimeNoActiveSessionError(e)||g===`resume`)throw e}if(x&&x.length>0)throw Error(`Cannot deliver inputResponses — the target session was not found via continuation token.`);let T={adapter:m?{...r,state:{...r.state,...m}}:r,auth:l,capabilities:f??(_===`conversation`?{requestInput:!0}:void 0),channelName:i,callback:u,continuationToken:y,input:{message:w??``,context:S,outputSchema:C},mode:_,requestId:a.requestId,title:h};return p!==void 0&&(T.initiatorAuth=p),createSession((await n.run(T)).sessionId,v,n)}}function serializeUrlFilePartsInMessage(e){if(e===void 0||typeof e==`string`)return e;let t=!1,r=e.map(e=>e.type===`file`&&e.data instanceof URL&&e.data.protocol!==`data:`?(t=!0,{...e,data:serializeUrlFilePart(e.data)}):e);return t?r:e}function normalizeSendInput(e){return typeof e==`string`||Array.isArray(e)?{message:e}:e}export{createSendFn};
1
+ import{createSession}from"#channel/session.js";import{RuntimeNoActiveSessionError,isRuntimeSessionOwnershipConflictError}from"#execution/runtime-errors.js";import{serializeUrlFilePart}from"#internal/attachments/url-refs.js";function createSendFn(r,i,a,o={}){return async(s,c)=>{let l=c,{auth:u,callback:d,caller:f,capabilities:p,initiatorAuth:m,state:h,title:g}=l,_=l.intent??`resume-or-start`,v=l.mode??`conversation`,y=l.continuationToken,b=`${a}:${y}`,{message:x,inputResponses:S,context:C,outputSchema:w}=normalizeSendInput(s),T=serializeUrlFilePartsInMessage(x),E={auth:u,caller:f,kind:`send`,payload:{inputResponses:S,message:T,context:C,outputSchema:w},requestId:o.requestId},dispatch=async()=>{let t=await r.dispatchContinuation({command:E,continuationToken:b});return t.status===`accepted`?createSession(t.sessionId,y,r):void 0},D=await dispatch();if(D!==void 0)return D;if(_===`resume`)throw new RuntimeNoActiveSessionError(b);if(S&&S.length>0)throw Error(`Cannot deliver inputResponses — the target session was not found via continuation token.`);let O={adapter:h?{...i,state:{...i.state,...h}}:i,auth:u,capabilities:p??(v===`conversation`?{requestInput:!0}:void 0),channelName:a,callback:d,continuationToken:b,input:{message:T??``,context:C,outputSchema:w},mode:v,requestId:o.requestId,title:g};m!==void 0&&(O.initiatorAuth=m);try{return createSession((await r.createSession(O)).sessionId,y,r)}catch(e){if(!isRuntimeSessionOwnershipConflictError(e))throw e;let t=await dispatch();if(t!==void 0)return t;throw e}}}function serializeUrlFilePartsInMessage(e){if(e===void 0||typeof e==`string`)return e;let t=!1,n=e.map(e=>e.type===`file`&&e.data instanceof URL&&e.data.protocol!==`data:`?(t=!0,{...e,data:serializeUrlFilePart(e.data)}):e);return t?n:e}function normalizeSendInput(e){return typeof e==`string`||Array.isArray(e)?{message:e}:e}export{createSendFn};
@@ -1 +1 @@
1
- import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";function createSession(e,t,n){return{id:e,continuationToken:t,async cancel(t){return n.cancelTurn({sessionId:e,turnId:t?.turnId})},async getEventStream(t){return n.getEventStream(e,t)},async getStreamTailIndex(){return n.getStreamTailIndex(e)}}}function createGetSessionFn(e){return t=>createSession(t,``,e)}function buildSessionHandle(i){return{get id(){return i.get(SessionIdKey)??``},get continuationToken(){return i.get(ContinuationTokenKey)??``},get auth(){return{current:i.get(AuthKey)??null,initiator:i.get(InitiatorAuthKey)??null}},setContinuationToken(e){let n=i.get(ContinuationTokenKey)??``,r=namespaceContinuationToken(n,e);n!==r&&i.set(ContinuationTokenKey,r)}}}function namespaceContinuationToken(e,t){let n=e.indexOf(`:`);if(n<=0)throw Error(`Cannot set session continuation token without an existing namespaced continuation token. Start the session with a placeholder continuationToken.`);return`${e.slice(0,n+1)}${t}`}export{buildSessionHandle,createGetSessionFn,createSession};
1
+ import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";function createSession(e,t,n){return{id:e,continuationToken:t,async cancel(t){return n.dispatchSession({command:{kind:`cancel`,turnId:t?.turnId},sessionId:e})},async getEventStream(t){return n.getEventStream(e,t)},async getStreamTailIndex(){return n.getStreamTailIndex(e)}}}function createGetSessionFn(e){return t=>createSession(t,``,e)}function buildSessionHandle(i){return{get id(){return i.get(SessionIdKey)??``},get continuationToken(){return i.get(ContinuationTokenKey)??``},get auth(){return{current:i.get(AuthKey)??null,initiator:i.get(InitiatorAuthKey)??null}},setContinuationToken(e){let n=i.get(ContinuationTokenKey)??``,r=namespaceContinuationToken(n,e);n!==r&&i.set(ContinuationTokenKey,r)}}}function namespaceContinuationToken(e,t){let n=e.indexOf(`:`);if(n<=0)throw Error(`Cannot set session continuation token without an existing namespaced continuation token. Start the session with a placeholder continuationToken.`);return`${e.slice(0,n+1)}${t}`}export{buildSessionHandle,createGetSessionFn,createSession};
@@ -153,6 +153,53 @@ export interface DeliverPayload {
153
153
  readonly outputSchema?: JsonObject;
154
154
  readonly [key: string]: unknown;
155
155
  }
156
+ /** One command accepted by a durable session inbox. */
157
+ export type SessionCommand = {
158
+ readonly auth?: SessionAuthContext | null;
159
+ readonly caller?: TurnCaller;
160
+ readonly kind: "send";
161
+ readonly payload: DeliverPayload;
162
+ readonly requestId?: string;
163
+ } | {
164
+ readonly kind: "cancel";
165
+ readonly turnId?: string;
166
+ } | {
167
+ readonly kind: "compact";
168
+ } | {
169
+ readonly kind: "clear";
170
+ } | {
171
+ readonly kind: "reset";
172
+ readonly reason?: string;
173
+ };
174
+ export type SessionSendCommandResult = {
175
+ readonly status: "accepted";
176
+ readonly sessionId: string;
177
+ } | {
178
+ readonly status: "session_not_active";
179
+ };
180
+ export type ResetSessionCommandResult = {
181
+ readonly status: "reset";
182
+ readonly previousSessionId: string;
183
+ } | {
184
+ readonly status: "no_active_session";
185
+ };
186
+ export type SessionCommandResult<TCommand extends SessionCommand = SessionCommand> = TCommand extends {
187
+ readonly kind: "send";
188
+ } ? SessionSendCommandResult : TCommand extends {
189
+ readonly kind: "cancel";
190
+ } ? CancelTurnResult : TCommand extends {
191
+ readonly kind: "compact";
192
+ } ? CompactSessionResult : TCommand extends {
193
+ readonly kind: "clear";
194
+ } ? ClearSessionResult : ResetSessionCommandResult;
195
+ export interface DispatchContinuationInput<TCommand extends SessionCommand = SessionCommand> {
196
+ readonly command: TCommand;
197
+ readonly continuationToken: string;
198
+ }
199
+ export interface DispatchSessionInput<TCommand extends SessionCommand = SessionCommand> {
200
+ readonly command: TCommand;
201
+ readonly sessionId: string;
202
+ }
156
203
  /**
157
204
  * Deliver payload sent through the workflow `resumeHook`.
158
205
  *
@@ -168,7 +215,7 @@ export interface DeliverHookPayload {
168
215
  readonly kind: "deliver";
169
216
  readonly payloads: readonly DeliverPayload[];
170
217
  }
171
- /** Internal deadline signal sent through the session's delivery hook. */
218
+ /** Internal deadline signal sent through the stable session command inbox. */
172
219
  export interface SessionTimeoutHookPayload {
173
220
  readonly kind: "session-timeout";
174
221
  }
@@ -280,7 +327,7 @@ export interface SessionCapabilities {
280
327
  readonly requestInput?: boolean;
281
328
  }
282
329
  /**
283
- * Single input shape consumed by {@link Runtime.run} for both root runs
330
+ * Single input shape consumed by {@link Runtime.createSession} for both root runs
284
331
  * (started by routes) and delegated child runs (started by the
285
332
  * subagent tool wrapper).
286
333
  */
@@ -387,8 +434,8 @@ export type RunResult = {
387
434
  readonly status: "waiting";
388
435
  };
389
436
  /**
390
- * Handle returned immediately by `runtime.run()` before the step loop
391
- * completes.
437
+ * Handle returned by `runtime.createSession()` once the command inbox is ready,
438
+ * before the step loop completes.
392
439
  *
393
440
  * Carries the identifiers needed for stream endpoints.
394
441
  */
@@ -412,27 +459,15 @@ export interface Runtime {
412
459
  * time), builds the seeded {@link AlsContext}, and drives the step loop to
413
460
  * completion.
414
461
  */
415
- run(input: RunInput): Promise<RunHandle>;
416
- /** Requests cancellation of a session's in-flight turn. */
417
- cancelTurn(input: CancelTurnInput): Promise<CancelTurnResult>;
418
- /** Queues context compaction on the session owning a continuation token. */
419
- compactSession(input: CompactSessionInput): Promise<CompactSessionResult>;
420
- /** Queues a context clear on the session owning a continuation token. */
421
- clearSession(input: ClearSessionInput): Promise<ClearSessionResult>;
422
- /** Terminally retires a session and releases its non-retained continuation hooks. */
423
- terminateSession(input: TerminateSessionInput): Promise<TerminateSessionResult>;
424
- /**
425
- * Delivers a follow-up message to a parked session.
426
- */
427
- deliver(input: DeliverInput): Promise<{
428
- sessionId: string;
429
- }>;
462
+ createSession(input: RunInput): Promise<RunHandle>;
463
+ dispatchContinuation<TCommand extends SessionCommand>(input: DispatchContinuationInput<TCommand>): Promise<SessionCommandResult<TCommand>>;
464
+ dispatchSession<TCommand extends SessionCommand>(input: DispatchSessionInput<TCommand>): Promise<SessionCommandResult<TCommand>>;
430
465
  /**
431
466
  * Resolves the session that currently owns a continuation token without
432
467
  * delivering input or starting a run. Returns `undefined` when no session
433
468
  * owns the token.
434
469
  */
435
- resolveSession(continuationToken: string): Promise<{
470
+ resolveContinuation(continuationToken: string): Promise<{
436
471
  sessionId: string;
437
472
  } | undefined>;
438
473
  /**
@@ -1,4 +1,4 @@
1
- import type { Command } from "#compiled/commander/index.js";
1
+ import { type Command } from "#compiled/commander/index.js";
2
2
  interface RegistryCommandLogger {
3
3
  error(message: string): void;
4
4
  log(message: string): void;
@@ -1 +1 @@
1
- function registerRegistryCommands(e){let{appRoot:t,logger:n,program:r}=e;r.command(`add <item>`).description(`Install a registry item; relative paths use the official eve registry.`).option(`-o, --overwrite`,`Overwrite existing files.`).option(`--skip-install`,`Run the item's setup flow without installing it.`).option(`--skip-setup`,`Skip the item's setup flow.`).option(`-y, --yes`,`Run setup and accept its recommended defaults.`).action(async(e,r)=>{let{runAddCommand:i}=await import(`./registry.js`);await i(n,t,e,r)});let i=r.command(`registry`).description(`Configure and browse extension and agent registry catalogs.`);i.command(`add <registries...>`).description(`Add registry namespace mappings to package.json.`).action(async e=>{let{runRegistryAddCommand:r}=await import(`./registry.js`);await r(n,t,e)}),i.command(`list`).description(`List items from all registries or one source.`).option(`-r, --registry <source>`,`List items from one registry.`).option(`--json`,`Output as JSON`).action(async e=>{let{runRegistryListCommand:r}=await import(`./registry.js`);await r(n,t,e.registry,e)}),i.command(`search <query>`).description(`Search all registries or one source.`).option(`-r, --registry <source>`,`Search one registry.`).option(`--json`,`Output as JSON`).action(async(e,r)=>{let{runRegistrySearchCommand:i}=await import(`./registry.js`);await i(n,t,e,r.registry,r)}),i.command(`view <item>`).description(`Print one registry item as JSON.`).action(async e=>{let{runRegistryViewCommand:r}=await import(`./registry.js`);await r(n,t,e)})}export{registerRegistryCommands};
1
+ import{InvalidArgumentError}from"#compiled/commander/index.js";function parseSearchLimit(t){if(!/^\d+$/u.test(t))throw new InvalidArgumentError(`Expected a positive integer, received "${t}".`);let n=Number(t);if(n<1||n>100)throw new InvalidArgumentError(`Expected a limit between 1 and 100, received "${t}".`);return n}function registerRegistryCommands(e){let{appRoot:t,logger:n,program:r}=e;r.command(`add <item>`).description(`Install a registry item; relative paths use the official eve registry.`).option(`-o, --overwrite`,`Overwrite existing files.`).option(`--skip-install`,`Run the item's setup flow without installing it.`).option(`--skip-setup`,`Skip the item's setup flow.`).option(`-y, --yes`,`Run setup and accept its recommended defaults.`).action(async(e,r)=>{let{runAddCommand:i}=await import(`./registry.js`);await i(n,t,e,r)});let i=r.command(`registry`).description(`Configure and browse extension and agent registry catalogs.`);i.command(`add <registries...>`).description(`Add registry namespace mappings to package.json.`).action(async e=>{let{runRegistryAddCommand:r}=await import(`./registry.js`);await r(n,t,e)}),i.command(`list`).description(`List items from all registries or one source.`).option(`-r, --registry <source>`,`List items from one registry.`).option(`--json`,`Output as JSON`).action(async e=>{let{runRegistryListCommand:r}=await import(`./registry.js`);await r(n,t,e.registry,e)}),i.command(`search <query>`).description(`Search all registries or one source.`).option(`-r, --registry <source>`,`Search one registry.`).option(`--limit <count>`,`Maximum results to return (default: 10).`,parseSearchLimit,10).option(`--json`,`Output as JSON`).action(async(e,r)=>{let{runRegistrySearchCommand:i}=await import(`./registry.js`);await i(n,t,e,r.registry,r)}),i.command(`view <item>`).description(`Print one registry item as JSON.`).action(async e=>{let{runRegistryViewCommand:r}=await import(`./registry.js`);await r(n,t,e)})}export{registerRegistryCommands};
@@ -1 +1 @@
1
- import{readFile,writeFile}from"node:fs/promises";import{join}from"node:path";function errorMessage(e){return e instanceof Error?e.message:String(e)}function isRegistrySource(e){return typeof e==`string`?!0:typeof e!=`object`||!e||!(`url`in e)?!1:typeof e.url==`string`}function parseRegistries(e,t){if(t===void 0)return{};if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${e} has an invalid registries field.`);let n={};for(let[r,i]of Object.entries(t)){if(!r.startsWith(`@`)||!isRegistrySource(i))throw Error(`${e} has an invalid registry entry for ${r}.`);n[r]=i}return n}async function readRegistryPackage(t){let r=join(t,`package.json`),i;try{i=JSON.parse(await readFile(r,`utf8`))}catch(e){throw Error(`Could not read ${r}: ${errorMessage(e)}`)}if(typeof i!=`object`||!i||Array.isArray(i))throw Error(`${r} must contain a JSON object.`);let a=i;return{path:r,document:a,config:{registries:parseRegistries(r,a.registries)}}}function parseRegistryMapping(e){let t=e.indexOf(`=`),n=t===-1?e:e.slice(0,t),r=t===-1?``:e.slice(t+1);if(!n.startsWith(`@`))throw Error(`Registry namespaces must start with @: ${n}`);if(!r.includes(`{name}`))throw Error(`Pass a registry URL containing {name}, for example ${n}=https://example.com/r/{name}.json.`);return{namespace:n,url:r}}async function readRegistryConfig(e){return(await readRegistryPackage(e)).config}async function addRegistryMappings(e,n){if(n.length===0)throw Error(`Pass at least one registry to add.`);let r=await readRegistryPackage(e),i=n.map(parseRegistryMapping),a={...r.config.registries},o={added:[],skippedBuiltIn:[],skippedExisting:[]};for(let e of i)e.namespace===`@shadcn`?o.skippedBuiltIn.push(e.namespace):a[e.namespace]===void 0?(a[e.namespace]=e.url,o.added.push(e.namespace)):o.skippedExisting.push(e.namespace);return o.added.length>0&&await writeFile(r.path,`${JSON.stringify({...r.document,registries:a},null,2)}\n`,`utf8`),o}export{addRegistryMappings,readRegistryConfig};
1
+ import{readFile,writeFile}from"node:fs/promises";import{join}from"node:path";function errorMessage(e){return e instanceof Error?e.message:String(e)}function isRegistrySource(e){return typeof e==`string`?!0:typeof e!=`object`||!e||!(`url`in e)?!1:typeof e.url==`string`}function parseRegistries(e,t){if(t===void 0)return{};if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`${e} has an invalid registries field.`);let n={};for(let[r,i]of Object.entries(t)){if(!r.startsWith(`@`)||!isRegistrySource(i))throw Error(`${e} has an invalid registry entry for ${r}.`);n[r]=i}return n}async function readRegistryPackage(t){let r=join(t,`package.json`),i;try{i=JSON.parse(await readFile(r,`utf8`))}catch(e){throw Error(`Could not read ${r}: ${errorMessage(e)}`)}if(typeof i!=`object`||!i||Array.isArray(i))throw Error(`${r} must contain a JSON object.`);let a=i;return{path:r,document:a,config:{registries:parseRegistries(r,a.registries)}}}function parseRegistryMapping(e){let t=e.indexOf(`=`),n=t===-1?e:e.slice(0,t),r=t===-1?``:e.slice(t+1);if(!n.startsWith(`@`))throw Error(`Registry namespaces must start with @: ${n}`);if(!r.includes(`{name}`))throw Error(`Pass a registry URL containing {name}, for example ${n}=https://example.com/r/{name}.json.`);return{namespace:n,url:r}}async function readRegistryConfig(e){return(await readRegistryPackage(e)).config}async function addRegistryMappings(e,n){if(n.length===0)throw Error(`Pass at least one registry to add.`);let r=await readRegistryPackage(e),i=n.map(parseRegistryMapping),a={...r.config.registries},o={added:[],skippedBuiltIn:[],skippedExisting:[]};for(let e of i)e.namespace===`@shadcn`||e.namespace===`@skills`?o.skippedBuiltIn.push(e.namespace):a[e.namespace]===void 0?(a[e.namespace]=e.url,o.added.push(e.namespace)):o.skippedExisting.push(e.namespace);return o.added.length>0&&await writeFile(r.path,`${JSON.stringify({...r.document,registries:a},null,2)}\n`,`utf8`),o}export{addRegistryMappings,readRegistryConfig};
@@ -17,6 +17,11 @@ export interface RegistryCommandOptions {
17
17
  /** Emit the underlying registry result as JSON. */
18
18
  json?: boolean;
19
19
  }
20
+ /** Options for searching registry catalogs. */
21
+ export interface RegistrySearchCommandOptions extends RegistryCommandOptions {
22
+ /** Maximum number of matching items to return. */
23
+ limit?: number;
24
+ }
20
25
  export interface RegistrySetupDependencies {
21
26
  loadSetupCommandRunner(): Promise<typeof runRegistrySetupCommand>;
22
27
  }
@@ -73,6 +78,6 @@ export declare function runRegistryAddCommand(logger: RegistryCommandLogger, app
73
78
  /** Lists registry items from every configured source or one selected source. */
74
79
  export declare function runRegistryListCommand(logger: RegistryCommandLogger, appRoot: string, source?: string, options?: RegistryCommandOptions): Promise<void>;
75
80
  /** Searches registry items across every configured source or one selected source. */
76
- export declare function runRegistrySearchCommand(logger: RegistryCommandLogger, appRoot: string, query: string, source?: string, options?: RegistryCommandOptions): Promise<void>;
81
+ export declare function runRegistrySearchCommand(logger: RegistryCommandLogger, appRoot: string, query: string, source?: string, options?: RegistrySearchCommandOptions): Promise<void>;
77
82
  /** Prints one official, configured, or URL-addressed registry item as JSON. */
78
83
  export declare function runRegistryViewCommand(logger: RegistryCommandLogger, appRoot: string, item: string): Promise<void>;
@@ -1 +1,6 @@
1
- import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{addRegistryMappings,readRegistryConfig}from"./registry-project.js";import{z}from"#compiled/zod/index.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{isEveProject}from"#setup/scaffold/index.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,isInteractive:()=>process.stdin.isTTY===!0&&process.stdout.isTTY===!0,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`;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,r={}){let i=await readRegistryConfig(e);await addRegistryItems([itemAddress(t)],{config:i,cwd:e,overwrite:r.overwrite})}const EveRegistryItemMetadataSchema=z.object({meta:z.object({eve:z.object({requires:z.string().optional(),setup:z.object({package:z.string().min(1),bin:z.string().min(1),args:z.array(z.string()).default([])}).optional()}).optional()}).optional()});function eveMetadataFromRegistryItem(e){return EveRegistryItemMetadataSchema.parse(e).meta?.eve}function setupResumeCommand(e){return`eve add ${/^[\w@./:-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`} --skip-install`}function setupReminder(e,t){return`${t===`cancelled`?`Setup cancelled.`:`Setup skipped.`} Run \`${setupResumeCommand(e)}\` when you're ready.`}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 errorMessage(e){return e instanceof Error?e.message:String(e)}async function runRegistryAction(t,n,r){if(!await isEveProject(n)){t.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}try{await r()}catch(e){t.error(errorMessage(e)),process.exitCode=1}}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}`)}function printSearchResults(e,t,n){if(n.json){e.log(JSON.stringify(t,null,2));return}if(t.items.length===0){e.log(`No registry items found.`);return}let r=`${t.pagination.total} item${t.pagination.total===1?``:`s`}`,i=n.query===void 0?``:` matching "${n.query}"`,a=`${n.sources.length} registr${n.sources.length===1?`y`:`ies`}`;e.log(`Found ${r}${i} in ${a}`),e.log(``);for(let r of t.items){let t=r.registry===OFFICIAL_CATALOG?r.name:r.addCommandArgument,i=n.query===void 0&&r.description?` — ${r.description}`:``;e.log(`${t}${i}`)}}async function searchRegistryCatalog(e,t){validateRegistrySource(t.source);let r=await readRegistryConfig(e),i=t.source?[t.source]:[OFFICIAL_CATALOG,...configuredRegistrySources(r)];return{config:r,result:await searchRegistries(i,{config:r,continueOnError:i.length>1,limit:100,query:t.query}),sources:i}}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,sources:o}=await searchRegistryCatalog(t,{query:n,source:r}),s=a.errors??[];(i.json||s.length<o.length)&&printSearchResults(e,a,{...i,query:n,sources:o});for(let t of s)e.error(`${t.registry}: ${t.message}`);s.length>0&&(process.exitCode=1)}async function getRegistryItemManifest(e,t){let r=await readRegistryConfig(e),i=await getRegistryItems([itemAddress(t)],{config:r});return i.length===1?i[0]:i}async function runDeclaredSetup(e,t,n,r,i,a){if(r===void 0)return;let s=await a.loadSetupCommandRunner();try{let a=i.prompter??createPrompter(),c=await s(t,{...r,args:[...r.args,...i.yes?[`--yes`]:[]]},n,{prompter:a,signal:i.signal});if(c.kind===`cancelled`)e.log(setupReminder(n,`cancelled`));else for(let t of c.output)e.log(t)}catch(e){throw Error(`${errorMessage(e)} Try again with \`${setupResumeCommand(n)}\`.`)}}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode;if(await runAddCommand(o,e,t,{...n,yes:!0},r),process.exitCode=s,i!==void 0)throw Error(i);return a}async function runAddCommand(e,t,r,i,a=defaultAddCommandDependencies){await runRegistryAction(e,t,async()=>{let o=await readRegistryConfig(t),l=itemAddress(r);if(i.skipInstall===!0){if(i.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(i.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(l))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let[u]=await getRegistryItems([l],{config:o}),d=isOfficialItemAddress(l)?eveMetadataFromRegistryItem(u):void 0;if(assertCompatibleEveVersion(d?.requires),i.skipInstall===!0){if(d?.setup===void 0)throw Error(`Registry item "${r}" does not declare a setup flow.`);await runDeclaredSetup(e,t,r,d.setup,i,a);return}if(await addRegistryItems([l],{config:o,cwd:t,overwrite:i.overwrite,silent:i.silent}),d?.setup===void 0)return;let f=a.isInteractive?.()??defaultAddCommandDependencies.isInteractive();if(i.skipSetup===!0||!i.yes&&!f){e.log(setupReminder(r,`skipped`));return}if(!i.yes)try{if(await(a.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${r} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`){e.log(setupReminder(r,`skipped`));return}}catch(t){if(!(t instanceof WizardCancelledError))throw t;e.log(setupReminder(r,`cancelled`));return}await runDeclaredSetup(e,t,r,d.setup,i,a)})}async function runRegistryAddCommand(e,n,r){await runRegistryAction(e,n,async()=>{let i=await addRegistryMappings(n,r);for(let t of i.skippedBuiltIn)e.log(`Skipped ${t} because it is built in.`);for(let t of i.skippedExisting)e.log(`Skipped ${t} because it is already configured.`);i.added.length>0&&e.log(`Added ${i.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))}async function runRegistryViewCommand(e,t,r){await runRegistryAction(e,t,async()=>{let i=await readRegistryConfig(t),a=await getRegistryItems([itemAddress(r)],{config:i});e.log(JSON.stringify(a.length===1?a[0]:a,null,2))})}export{browseRegistryCatalog,getRegistryItemManifest,installOfficialRegistryItem,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
1
+ import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{addRegistryMappings,readRegistryConfig}from"./registry-project.js";import{z}from"#compiled/zod/index.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createCliTheme,sanitizeForTerminal}from"#cli/ui/output.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{WizardCancelledError}from"#setup/step.js";import{addRegistryItems,getRegistryItems,searchRegistries}from"#compiled/shadcn-registry/index.js";import{clipVisible,wrapVisibleLine}from"#cli/ui/terminal-text.js";import semver from"#compiled/semver/index.js";const defaultAddCommandDependencies={createPrompter,isInteractive:()=>process.stdin.isTTY===!0&&process.stdout.isTTY===!0,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})}const EveRegistryItemMetadataSchema=z.object({meta:z.object({eve:z.object({requires:z.string().optional(),setup:z.object({package:z.string().min(1),bin:z.string().min(1),args:z.array(z.string()).default([])}).optional()}).optional()}).optional()});function eveMetadataFromRegistryItem(e){return EveRegistryItemMetadataSchema.parse(e).meta?.eve}function setupResumeCommand(e){return`eve add ${/^[\w@./:-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`} --skip-install`}function setupReminder(e,t){return`${t===`cancelled`?`Setup cancelled.`:`Setup skipped.`} Run \`${setupResumeCommand(e)}\` when you're ready.`}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 errorMessage(e){return e instanceof Error?e.message:String(e)}async function runRegistryAction(t,n,r){if(!await isEveProject(n)){t.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}try{await r()}catch(e){t.error(errorMessage(e)),process.exitCode=1}}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}`)}function normalizeRegistryText(e){return sanitizeForTerminal(e).replaceAll(`\\"`,`"`).replaceAll(`\\'`,`'`).replaceAll(/\s+/gu,` `).trim()}function registryDescriptionSummary(e){let t=normalizeRegistryText(e);return t.match(/^.*?[.!?](?=\s|$)/u)?.[0]??t}function searchItemAddress(e){return normalizeRegistryText(e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument)}function searchItemFallbackTitle(e){let t=normalizeRegistryText(e.name);return t.split(`/`).at(-1)??t}function renderSearchItem(e,t,n){let r=Math.max(1,t-4),i=wrapVisibleLine(searchItemAddress(e),r),a=[` ${n.label(searchItemFallbackTitle(e))}`,...i.map(e=>` ${e}`)];if(!e.description)return a.join(`
2
+ `);let o=registryDescriptionSummary(e.description);if(o.length===0)return a.join(`
3
+ `);let s=wrapVisibleLine(o,r),c=s.length<=2?s:[s[0],`${clipVisible(s[1],Math.max(1,r-1)).trimEnd()}…`];return a.push(...c.map(e=>n.muted(` ${e}`))),a.join(`
4
+ `)}function registrySourceLabel(e){return e===OFFICIAL_CATALOG?`eve`:e===SKILLS_REGISTRY?`skills.sh`:e}function printSearchResults(e,t,n){if(n.json){e.log(JSON.stringify(t,null,2));return}if(t.items.length===0){let t=n.query&&normalizeRegistryText(n.query);e.log(t?`No registry items match "${t}".`:`No registry items found.`);return}let r=createCliTheme(),i=Math.max(20,process.stdout.columns??80),o=n.sources.flatMap(e=>{let t=n.resultsBySource.get(e);if(t===void 0||t.items.length===0)return[];let{pagination:a}=t,o=`${a.total} result${a.total===1?``:`s`}`,s=t.items.length<a.total?`showing ${t.items.length} of ${o}`:o;return[[`${r.label(registrySourceLabel(e))} ${r.muted(`(${s})`)}`,...t.items.map(e=>renderSearchItem(e,i,r))].join(`
5
+ `)]});e.log(o.join(`
6
+ `))}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.values()];return{config:n,result:{items:c.flatMap(e=>e.items),pagination:{hasMore:c.some(e=>e.pagination.hasMore),limit:t.limit??100,offset:0,total:c.reduce((e,t)=>e+t.pagination.total,0)},...s.size>0?{errors:[...s.values()]}:{}},resultsBySource:o,sources:r}}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:s}=await searchRegistryCatalog(t,{limit:i.limit,query:n,source:r}),c=a.errors??[];(i.json||o.size>0)&&printSearchResults(e,a,{...i,query:n,resultsBySource:o,sources:s});for(let t of c)e.error(`${t.registry}: ${t.message}`);c.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 runDeclaredSetup(e,t,n,r,i,a){if(r===void 0)return;let o=await a.loadSetupCommandRunner();try{let a=i.prompter??createPrompter(),s=await o(t,{...r,args:[...r.args,...i.yes?[`--yes`]:[]]},n,{prompter:a,signal:i.signal});if(s.kind===`cancelled`)e.log(setupReminder(n,`cancelled`));else for(let t of s.output)e.log(t)}catch(e){throw Error(`${errorMessage(e)} Try again with \`${setupResumeCommand(n)}\`.`)}}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode;if(await runAddCommand(o,e,t,{...n,yes:!0},r),process.exitCode=s,i!==void 0)throw Error(i);return a}async function runAddCommand(e,t,n,r,i=defaultAddCommandDependencies){await runRegistryAction(e,t,async()=>{let a=await readEveRegistryConfig(t),o=itemAddress(n);if(r.skipInstall===!0){if(r.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(r.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(o))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let[s]=await getRegistryItems([o],{config:a}),c=isOfficialItemAddress(o)?eveMetadataFromRegistryItem(s):void 0;if(assertCompatibleEveVersion(c?.requires),r.skipInstall===!0){if(c?.setup===void 0)throw Error(`Registry item "${n}" does not declare a setup flow.`);await runDeclaredSetup(e,t,n,c.setup,r,i);return}if(await addRegistryItems([o],{config:a,cwd:t,overwrite:r.overwrite,silent:r.silent}),c?.setup===void 0)return;let l=i.isInteractive?.()??defaultAddCommandDependencies.isInteractive();if(r.skipSetup===!0||!r.yes&&!l){e.log(setupReminder(n,`skipped`));return}if(!r.yes)try{if(await(i.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${n} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`){e.log(setupReminder(n,`skipped`));return}}catch(t){if(!(t instanceof WizardCancelledError))throw t;e.log(setupReminder(n,`cancelled`));return}await runDeclaredSetup(e,t,n,c.setup,r,i)})}async function runRegistryAddCommand(e,n,r){await runRegistryAction(e,n,async()=>{let i=await addRegistryMappings(n,r);for(let t of i.skippedBuiltIn)e.log(`Skipped ${t} because it is built in.`);for(let t of i.skippedExisting)e.log(`Skipped ${t} because it is already configured.`);i.added.length>0&&e.log(`Added ${i.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){await runRegistryAction(e,t,async()=>{let r=await readEveRegistryConfig(t),i=await getRegistryItems([itemAddress(n)],{config:r});e.log(JSON.stringify(i.length===1?i[0]:i,null,2))})}export{browseRegistryCatalog,getRegistryItemManifest,installOfficialRegistryItem,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
@@ -1,2 +1,2 @@
1
- import{formatCompactTokenCount}from"../stream-format.js";import{formatPayloadContent,wrapPlainText}from"./trace-content.js";import{SURFACE_CLOSE}from"./trace-surfaces.js";import{formatElapsed}from"#cli/format-elapsed.js";import{compareLocalTraceSpans}from"#tracing/local-trace-reader.js";import{clipVisible,stripTerminalControls,visibleLength}from"#cli/ui/terminal-text.js";function buildConversationItems(e){let t=new Map(e.spans.map(e=>[e.spanId,e])),n=new Map;for(let t of e.spans){if(t.parentSpanId===void 0)continue;let e=n.get(t.parentSpanId)??[];e.push(t),n.set(t.parentSpanId,e)}for(let e of n.values())e.sort(compareLocalTraceSpans);let r=e.spans.filter(e=>e.name===`agent.turn`);r.sort(compareLocalTraceSpans);let i=[];for(let e of r){let r=turnSubagent(e),o=[],walk=e=>{o.push(e);for(let t of n.get(e.spanId)??[])walk(t)};if(walk(e),o.sort(compareLocalTraceSpans),i.length===0){let e=o.find(e=>isModelSpan(e)&&typeof e.attributes[`ai.prompt.system`]==`string`),t=e?.attributes[`ai.prompt.system`];e!==void 0&&typeof t==`string`&&t.length>0&&i.push({item:{kind:`system`,durationMs:0,error:!1,span:e,subagent:r,text:t},order:0n})}let c=extractUserText(o.find(isModelSpan));c!==void 0&&i.push({item:{kind:`user`,durationMs:0,error:!1,span:e,subagent:r,text:c},order:e.startTimeNs});for(let e of o)if(isModelSpan(e)){let n=stringAttribute(e,`ai.response.text`),a=stringAttribute(e,`ai.response.reasoning`),o=numberAttribute(e,`agent.usage.input_tokens`)!==void 0||numberAttribute(e,`agent.usage.output_tokens`)!==void 0,c=e.attributes[`ai.response.tool_calls`]!==void 0;if((n===void 0||n.trim().length===0)&&(a===void 0||a.trim().length===0)&&!o&&!c&&e.statusCode!==2)continue;i.push({item:{kind:`assistant`,costUsd:stepCostUsd(e,t),durationMs:spanDurationMs(e),error:e.statusCode===2,inputTokens:numberAttribute(e,`agent.usage.input_tokens`),model:stringAttribute(e,`gen_ai.request.model`),outputTokens:numberAttribute(e,`agent.usage.output_tokens`),reasoning:a,span:e,subagent:r,text:n,toolCallNames:c?parseToolCallNames(stringAttribute(e,`ai.response.tool_calls`)):void 0},order:e.startTimeNs});for(let t of parseProviderToolResults(stringAttribute(e,`ai.response.tool_results`)))i.push({item:{kind:`tool`,args:t.args,durationMs:0,error:t.error,name:stripTerminalControls(t.name),result:t.result,span:e,subagent:r},order:e.startTimeNs})}else e.name===`ai.toolCall`&&i.push({item:{kind:`tool`,args:stringAttribute(e,`gen_ai.tool.call.arguments`),durationMs:spanDurationMs(e),error:e.statusCode===2,name:stripTerminalControls(stringAttribute(e,`gen_ai.tool.name`)??`tool`),result:unwrapJsonString(stringAttribute(e,`gen_ai.tool.call.result`)),span:e,subagent:r},order:e.startTimeNs})}return i.sort((e,t)=>e.order===t.order?0:e.order<t.order?-1:1).map(e=>e.item)}function turnSubagent(e){let t=stringAttribute(e,`agent.parent.turn.id`);if(t===void 0)return;let n=stringAttribute(e,`agent.subagent.name`);return{name:n===void 0?void 0:stripTerminalControls(n),parentCallId:stringAttribute(e,`agent.parent.call_id`),parentTurnId:t}}function renderConversationItem(r,a,o,c,l,u){let{colors:d,glyph:f}=o,p=Math.max(8,a-8),m=conversationItemExpandable(r,a),h=o.color?u:void 0,g=h?.primaryText??d.white,_,v,y=[];if(r.kind===`tool`){let e=d.bold(g(r.name??`tool`));_=`${foldMarker(l,m,o)}${e}`,v=r.durationMs>0?d.dim(formatElapsed(r.durationMs)):``;let n=r.args===void 0?[]:formatPayloadContent(r.args,p),a=r.result===void 0?[]:formatPayloadContent(r.result,p),s=l?n:capLines(n,p),c=l?a:capLines(a,p);s.length>0&&y.push(``,d.dim(`Input:`),``,...s),c.length>0&&y.push(``,d.dim(`Output:`),``,...c)}else if(r.kind===`system`){_=`${foldMarker(l,m,o)}${d.bold(g(`system`))}`,v=d.dim(`~${formatCompactTokenCount(estimateTokens(r.text??``))} tokens`);let t=wrapPlainText(r.text??``,p);y.push(...l?t:capLines(t,p))}else if(r.kind===`assistant`){_=`${foldMarker(l,m,o)}${d.bold(g(`assistant`))}${r.model===void 0?``:d.dim(` · ${stripTerminalControls(r.model)}`)}`,v=assistantMetrics(r,f,d);let e=r.reasoning===void 0||r.reasoning.trim().length===0?[]:wrapPlainText(r.reasoning,p),t=r.text===void 0||r.text.trim().length===0?[]:wrapPlainText(r.text,p),i=(l?e:capLines(e,p)).map(e=>d.dim(e)),a=l?t:capLines(t,p);if(i.length>0&&(y.push(d.dim(`Thought:`),``,...i),a.length>0&&y.push(``)),y.push(...a),(r.text===void 0||r.text.trim().length===0)&&r.toolCallNames!==void 0&&r.toolCallNames.length>0){i.length>0&&y.push(``);for(let e of r.toolCallNames)y.push(d.dim(`→ ${e}`))}}else{let e=r.kind===`user`&&r.subagent!==void 0?`task`:r.kind;_=`${foldMarker(l,m,o)}${d.bold(g(e))}`,v=``;let t=r.text===void 0||r.text.trim().length===0?[]:wrapPlainText(r.text,p);y.push(...l?t:capLines(t,p))}if(r.subagent!==void 0){let e=r.subagent.name===void 0?`subagent`:`subagent:${r.subagent.name}`;_+=d.dim(` · ${e}`)}r.error&&(_+=` ${d.red(f.error)}`),!l&&m?y.push(`…`,``,d.dim(`Click to expand`)):l&&m&&y.push(``,d.dim(`Click to collapse`));let b=h===void 0?void 0:r.error?h.errorHeader:h.header,x=h===void 0?void 0:r.error?h.errorBody:h.body,S=railCell(o,c,r.error,h);return[cardRow(``,a,o,S,b),cardSplitRow(_,v,a,o,S,b),cardRow(``,a,o,S,b),cardRow(``,a,o,S,x),...y.map(e=>cardRow(e,a,o,S,x)),cardRow(``,a,o,S,x)]}function cardRow(e,t,n,i,a){let s=clipVisible(e,Math.max(1,t-8)),l=` `.repeat(Math.max(0,t-8-visibleLength(s)));return a===void 0||!n.color?` ${i} ${s}${l} `:` ${i}${a} ${s.replaceAll(`\x1B[0m`,`\x1b[0m${a}`)}\x1b[0m${a}${l} ${SURFACE_CLOSE} `}function railCell(e,t,n,r){let{colors:i,glyph:a}=e;if(t){let t=e.unicode?`▌`:a.rule;return r===void 0?i.white(t):r.primaryText(t)}return r===void 0?n?i.red(a.rule):i.dim(a.rule):` `}function cardSplitRow(e,t,n,r,i,a){if(visibleLength(t)===0)return cardRow(e,n,r,i,a);let s=Math.max(1,n-8),l=visibleLength(t),u=clipVisible(e,Math.max(1,s-l-2));return cardRow(`${u}${` `.repeat(Math.max(2,s-visibleLength(u)-l))}${t}`,n,r,i,a)}function assistantMetrics(t,n,r){let a=[];return t.durationMs>0&&a.push(formatElapsed(t.durationMs)),t.inputTokens!==void 0&&a.push(`${n.arrowUp}${formatCompactTokenCount(t.inputTokens)}`),t.outputTokens!==void 0&&a.push(`${n.arrowDown}${formatCompactTokenCount(t.outputTokens)}`),t.costUsd!==void 0&&a.push(formatCost(t.costUsd)),a.length===0?``:r.dim(a.join(` · `))}function formatCost(e){return e>=.01?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`}function stepCostUsd(e,t){let n=e;for(;n.parentSpanId!==void 0;){if(n=t.get(n.parentSpanId),n===void 0)return;if(n.name===`agent.step`)return numberAttribute(n,`gen_ai.usage.cost`)}}function foldMarker(e,t,n){return e?`${n.colors.dim(`▾`)} `:t?`${n.colors.dim(`▸`)} `:``}function capLines(e,t){return e.length<=3?[...e]:[...e.slice(0,2),clipVisible(e[2],Math.max(1,t))]}function conversationItemLineCount(e,t,n,r){return renderConversationItem(e,t,n,!1,r).length}function conversationItemExpandable(e,r){let i=Math.max(8,r-8);if(e.kind===`tool`){let n=e.args===void 0?0:formatPayloadContent(e.args,i-2).length,r=e.result===void 0?0:formatPayloadContent(e.result,i-2).length;return n>3||r>3}if(e.kind===`system`)return wrapPlainText(e.text??``,i).length>3;if(e.kind===`user`)return(e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,i).length)>3;let a=e.reasoning===void 0||e.reasoning.trim().length===0?0:wrapPlainText(e.reasoning,i).length,o=e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,i).length;return a>3||o>3}function estimateTokens(e){return Math.ceil(e.length/4)}function extractUserText(e){if(e===void 0)return;let t=e.attributes[`ai.prompt.messages`];if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}if(Array.isArray(n))for(let e=n.length-1;e>=0;--e){let t=n[e];if(!isRecord(t)||t.role!==`user`)continue;let r=contentText(t.content).trim();if(r.length>0)return r}}function contentText(e){return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>isRecord(e)&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
1
+ import{formatCompactTokenCount}from"../stream-format.js";import{formatPayloadContent,wrapPlainText}from"./trace-content.js";import{SURFACE_CLOSE}from"./trace-surfaces.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,stripTerminalControls,visibleLength}from"#cli/ui/terminal-text.js";import{compareLocalTraceSpans}from"#tracing/local-trace-reader.js";function buildConversationItems(e){let t=new Map(e.spans.map(e=>[e.spanId,e])),n=new Map;for(let t of e.spans){if(t.parentSpanId===void 0)continue;let e=n.get(t.parentSpanId)??[];e.push(t),n.set(t.parentSpanId,e)}for(let e of n.values())e.sort(compareLocalTraceSpans);let r=e.spans.filter(e=>e.name===`agent.turn`);r.sort(compareLocalTraceSpans);let i=[];for(let e of r){let r=turnSubagent(e),a=[],walk=e=>{a.push(e);for(let t of n.get(e.spanId)??[])walk(t)};if(walk(e),a.sort(compareLocalTraceSpans),i.length===0){let e=a.find(e=>isModelSpan(e)&&typeof e.attributes[`ai.prompt.system`]==`string`),t=e?.attributes[`ai.prompt.system`];e!==void 0&&typeof t==`string`&&t.length>0&&i.push({item:{kind:`system`,durationMs:0,error:!1,span:e,subagent:r,text:t},order:0n})}let s=extractUserText(a.find(isModelSpan));s!==void 0&&i.push({item:{kind:`user`,durationMs:0,error:!1,span:e,subagent:r,text:s},order:e.startTimeNs});for(let e of a)if(isModelSpan(e)){let n=stringAttribute(e,`ai.response.text`),a=stringAttribute(e,`ai.response.reasoning`),s=numberAttribute(e,`agent.usage.input_tokens`)!==void 0||numberAttribute(e,`agent.usage.output_tokens`)!==void 0,c=e.attributes[`ai.response.tool_calls`]!==void 0;if((n===void 0||n.trim().length===0)&&(a===void 0||a.trim().length===0)&&!s&&!c&&e.statusCode!==2)continue;i.push({item:{kind:`assistant`,costUsd:stepCostUsd(e,t),durationMs:spanDurationMs(e),error:e.statusCode===2,inputTokens:numberAttribute(e,`agent.usage.input_tokens`),model:stringAttribute(e,`gen_ai.request.model`),outputTokens:numberAttribute(e,`agent.usage.output_tokens`),reasoning:a,span:e,subagent:r,text:n,toolCallNames:c?parseToolCallNames(stringAttribute(e,`ai.response.tool_calls`)):void 0},order:e.startTimeNs});for(let t of parseProviderToolResults(stringAttribute(e,`ai.response.tool_results`)))i.push({item:{kind:`tool`,args:t.args,durationMs:0,error:t.error,name:stripTerminalControls(t.name),result:t.result,span:e,subagent:r},order:e.startTimeNs})}else e.name===`ai.toolCall`&&i.push({item:{kind:`tool`,args:stringAttribute(e,`gen_ai.tool.call.arguments`),durationMs:spanDurationMs(e),error:e.statusCode===2,name:stripTerminalControls(stringAttribute(e,`gen_ai.tool.name`)??`tool`),result:unwrapJsonString(stringAttribute(e,`gen_ai.tool.call.result`)),span:e,subagent:r},order:e.startTimeNs})}return i.sort((e,t)=>e.order===t.order?0:e.order<t.order?-1:1).map(e=>e.item)}function turnSubagent(e){let t=stringAttribute(e,`agent.parent.turn.id`);if(t===void 0)return;let n=stringAttribute(e,`agent.subagent.name`);return{name:n===void 0?void 0:stripTerminalControls(n),parentCallId:stringAttribute(e,`agent.parent.call_id`),parentTurnId:t}}function renderConversationItem(r,a,s,c,l,u){let{colors:d,glyph:f}=s,p=Math.max(8,a-8),m=conversationItemExpandable(r,a),h=s.color?u:void 0,g=h?.primaryText??d.white,_,v,y=[];if(r.kind===`tool`){let e=d.bold(g(r.name??`tool`));_=`${foldMarker(l,m,s)}${e}`,v=r.durationMs>0?d.dim(formatElapsed(r.durationMs)):``;let n=r.args===void 0?[]:formatPayloadContent(r.args,p),a=r.result===void 0?[]:formatPayloadContent(r.result,p),o=l?n:capLines(n,p),c=l?a:capLines(a,p);o.length>0&&y.push(``,d.dim(`Input:`),``,...o),c.length>0&&y.push(``,d.dim(`Output:`),``,...c)}else if(r.kind===`system`){_=`${foldMarker(l,m,s)}${d.bold(g(`system`))}`,v=d.dim(`~${formatCompactTokenCount(estimateTokens(r.text??``))} tokens`);let t=wrapPlainText(r.text??``,p);y.push(...l?t:capLines(t,p))}else if(r.kind===`assistant`){_=`${foldMarker(l,m,s)}${d.bold(g(`assistant`))}${r.model===void 0?``:d.dim(` · ${stripTerminalControls(r.model)}`)}`,v=assistantMetrics(r,f,d);let e=r.reasoning===void 0||r.reasoning.trim().length===0?[]:wrapPlainText(r.reasoning,p),t=r.text===void 0||r.text.trim().length===0?[]:wrapPlainText(r.text,p),i=(l?e:capLines(e,p)).map(e=>d.dim(e)),a=l?t:capLines(t,p);if(i.length>0&&(y.push(d.dim(`Thought:`),``,...i),a.length>0&&y.push(``)),y.push(...a),(r.text===void 0||r.text.trim().length===0)&&r.toolCallNames!==void 0&&r.toolCallNames.length>0){i.length>0&&y.push(``);for(let e of r.toolCallNames)y.push(d.dim(`→ ${e}`))}}else{let e=r.kind===`user`&&r.subagent!==void 0?`task`:r.kind;_=`${foldMarker(l,m,s)}${d.bold(g(e))}`,v=``;let t=r.text===void 0||r.text.trim().length===0?[]:wrapPlainText(r.text,p);y.push(...l?t:capLines(t,p))}if(r.subagent!==void 0){let e=r.subagent.name===void 0?`subagent`:`subagent:${r.subagent.name}`;_+=d.dim(` · ${e}`)}r.error&&(_+=` ${d.red(f.error)}`),!l&&m?y.push(`…`,``,d.dim(`Click to expand`)):l&&m&&y.push(``,d.dim(`Click to collapse`));let b=h===void 0?void 0:r.error?h.errorHeader:h.header,x=h===void 0?void 0:r.error?h.errorBody:h.body,S=railCell(s,c,r.error,h);return[cardRow(``,a,s,S,b),cardSplitRow(_,v,a,s,S,b),cardRow(``,a,s,S,b),cardRow(``,a,s,S,x),...y.map(e=>cardRow(e,a,s,S,x)),cardRow(``,a,s,S,x)]}function cardRow(e,t,n,i,o){let c=clipVisible(e,Math.max(1,t-8)),l=` `.repeat(Math.max(0,t-8-visibleLength(c)));return o===void 0||!n.color?` ${i} ${c}${l} `:` ${i}${o} ${c.replaceAll(`\x1B[0m`,`\x1b[0m${o}`)}\x1b[0m${o}${l} ${SURFACE_CLOSE} `}function railCell(e,t,n,r){let{colors:i,glyph:a}=e;if(t){let t=e.unicode?`▌`:a.rule;return r===void 0?i.white(t):r.primaryText(t)}return r===void 0?n?i.red(a.rule):i.dim(a.rule):` `}function cardSplitRow(e,t,n,r,i,o){if(visibleLength(t)===0)return cardRow(e,n,r,i,o);let c=Math.max(1,n-8),l=visibleLength(t),u=clipVisible(e,Math.max(1,c-l-2));return cardRow(`${u}${` `.repeat(Math.max(2,c-visibleLength(u)-l))}${t}`,n,r,i,o)}function assistantMetrics(t,n,r){let a=[];return t.durationMs>0&&a.push(formatElapsed(t.durationMs)),t.inputTokens!==void 0&&a.push(`${n.arrowUp}${formatCompactTokenCount(t.inputTokens)}`),t.outputTokens!==void 0&&a.push(`${n.arrowDown}${formatCompactTokenCount(t.outputTokens)}`),t.costUsd!==void 0&&a.push(formatCost(t.costUsd)),a.length===0?``:r.dim(a.join(` · `))}function formatCost(e){return e>=.01?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`}function stepCostUsd(e,t){let n=e;for(;n.parentSpanId!==void 0;){if(n=t.get(n.parentSpanId),n===void 0)return;if(n.name===`agent.step`)return numberAttribute(n,`gen_ai.usage.cost`)}}function foldMarker(e,t,n){return e?`${n.colors.dim(`▾`)} `:t?`${n.colors.dim(`▸`)} `:``}function capLines(e,t){return e.length<=3?[...e]:[...e.slice(0,2),clipVisible(e[2],Math.max(1,t))]}function conversationItemLineCount(e,t,n,r){return renderConversationItem(e,t,n,!1,r).length}function conversationItemExpandable(e,r){let i=Math.max(8,r-8);if(e.kind===`tool`){let n=e.args===void 0?0:formatPayloadContent(e.args,i-2).length,r=e.result===void 0?0:formatPayloadContent(e.result,i-2).length;return n>3||r>3}if(e.kind===`system`)return wrapPlainText(e.text??``,i).length>3;if(e.kind===`user`)return(e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,i).length)>3;let a=e.reasoning===void 0||e.reasoning.trim().length===0?0:wrapPlainText(e.reasoning,i).length,o=e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,i).length;return a>3||o>3}function estimateTokens(e){return Math.ceil(e.length/4)}function extractUserText(e){if(e===void 0)return;let t=e.attributes[`ai.prompt.messages`];if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}if(Array.isArray(n))for(let e=n.length-1;e>=0;--e){let t=n[e];if(!isRecord(t)||t.role!==`user`)continue;let r=contentText(t.content).trim();if(r.length>0)return r}}function contentText(e){return typeof e==`string`?e:Array.isArray(e)?e.filter(e=>isRecord(e)&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
2
2
  `):``}function unwrapJsonString(e){if(e!==void 0)try{let t=JSON.parse(e);return typeof t==`string`?t:e}catch{return e}}function isModelSpan(e){return e.name.startsWith(`ai.`)&&e.name.includes(`do`)}function parseToolCallNames(e){if(e!==void 0)try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>isRecord(e)&&typeof e.toolName==`string`).map(e=>e.toolName):void 0}catch{return}}function parseProviderToolResults(e){if(e===void 0)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let asText=e=>typeof e==`string`?e:e===void 0?void 0:JSON.stringify(e);return t.filter(isRecord).map(e=>{let t=`error`in e;return{args:asText(e.input),error:t,name:typeof e.toolName==`string`?e.toolName:`tool`,result:asText(t?e.error:e.output)}})}catch{return[]}}function stringAttribute(e,t){let n=e.attributes[t];return typeof n==`string`?n:void 0}function numberAttribute(e,t){let n=e.attributes[t];return typeof n==`number`?n:void 0}function spanDurationMs(e){return Math.max(0,Number(e.endTimeNs-e.startTimeNs)/1e6)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{buildConversationItems,conversationItemExpandable,conversationItemLineCount,renderConversationItem};
@@ -1,2 +1,2 @@
1
- import{formatAttributeContent}from"./trace-content.js";import{renderConversationItem}from"./trace-conversation.js";import{orderedTextSelection,selectedTraceViewerSpan}from"./trace-viewer-state.js";import{formatElapsed}from"#cli/format-elapsed.js";import{describeLocalTraceSpan}from"#tracing/local-trace-reader.js";import{clipVisible,sliceVisible,stripAnsi,stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";function renderTraceViewer(e,t){let{width:n,height:r,theme:i}=t,a=chromeStyles(i,t.surfaces),o=Math.max(1,r-3-3),s=e.panelOpen?panelWidthFor(n):0,c=Math.max(20,n-(s===0?0:s+1)),l=panelDetailLines(e,s,i,t.surfaces),u=o,d=[];if(d.push(...renderHeader(e,t)),e.traces.length===0)d.push(...renderEmptyState(t,i,o));else if(e.trace===void 0)d.push(...center(o,a.muted(`Loading trace…`)));else{let r=renderConversation(e,t,c,o);for(let t=0;t<o;t+=1){let i=r[t]??``;if(s===0){d.push(i);continue}let a=l[e.panelScroll+t]??``;e.textSelection!==void 0&&e.textSelection.region===`panel`&&(a=highlightSelection(a,e.panelScroll+t,e.textSelection,s)),d.push(joinPanels(i,c,a,n))}}return d.push(...renderFooter(e,n,i,t.surfaces)),t.toast!==void 0&&overlayToast(d,t.toast,n,i,t.surfaces),{rows:d,panelTotalRows:l.length,timelineViewportRows:o,panelViewportRows:u,contentWidth:c}}function chromeStyles(e,t){let n=e.color?t:void 0;return{muted:n?.mutedText??e.colors.dim,primary:n?.primaryText??(e=>e)}}function overlayToast(e,t,n,r,i){let a=` ${stripTerminalControls(t)} `,o=visibleLength(a),s=r.unicode?`▌`:r.glyph.rule,c=r.color?i:void 0,d=c===void 0?``:c.body,f=c?.primaryText??r.colors.white,p=r.color?`\x1B[0m`:``,m=[`${d}${f(s)}${` `.repeat(o)}${p}`,`${d}${f(s)}${f(a)}${p}`,`${d}${f(s)}${` `.repeat(o)}${p}`];for(let[t,r]of m.entries()){let i=2+t;if(i>=e.length)break;e[i]=overlayRight(e[i],r,n,1)}}function overlayRight(e,t,n,r){let i=Math.max(0,n-r-visibleLength(t)),a=visibleLength(e);return`${sliceVisible(a<i?e+` `.repeat(i-a):e,i)}\x1b[0m${t}`}const CONVERSATION_CONTENT_KEYS=new Set([`ai.prompt.messages`,`ai.prompt.system`,`ai.response.reasoning`,`ai.response.text`,`ai.response.tool_calls`,`ai.response.tool_results`,`gen_ai.tool.call.arguments`,`gen_ai.tool.call.result`]);function renderSpanDetail(t,n,r,s){let{colors:c}=r,{muted:u,primary:f}=chromeStyles(r,s?.surfaces),p=[],m=stripTerminalControls(t.name);p.push(...wrapVisibleLine(c.bold(f(m)),n));let h=describeLocalTraceSpan(t).map(stripTerminalControls);h.length>0&&p.push(u(h.join(`, `))),p.push(``);let fact=(e,t)=>`${u(e.padEnd(10))}${t}`,g=t.statusCode===2;p.push(fact(`status`,g?c.red(`ERROR`):c.green(`ok`))),p.push(fact(`duration`,formatElapsed(durationMs(t.startTimeNs,t.endTimeNs)))),p.push(fact(`started`,clockTime(t.startTimeNs))),p.push(fact(`span`,t.spanId)),t.parentSpanId!==void 0&&p.push(fact(`parent`,t.parentSpanId)),t.scope!==void 0&&p.push(fact(`scope`,stripTerminalControls(t.scope))),p.push(``);let _=Object.keys(t.attributes).filter(e=>s?.excludeKeys?.has(e)!==!0).sort();if(_.length===0)p.push(u(`no attributes`));else{p.push(u(`attributes (${_.length})`));for(let i of _){let a=formatAttributeContent(i,t.attributes[i],r,n-2),o=stripTerminalControls(i);if(a.length===1)p.push(...wrapVisibleLine(`${u(o)} ${a[0]}`,n));else{p.push(u(o));for(let e of a)p.push(` ${e}`)}}}return p.map(e=>clipVisible(e,n))}function renderHeader(e,t){let{theme:n,width:r}=t,{colors:a,glyph:s}=n,{muted:c,primary:d}=chromeStyles(n,t.surfaces),f=[];if(e.trace?.agentName!==void 0&&f.push(stripTerminalControls(e.trace.agentName)),e.trace?.sessionId!==void 0&&f.push(`session ${stripTerminalControls(e.trace.sessionId)}`),e.trace!==void 0){let n=t.activeWindowEndNs!==void 0&&t.activeWindowEndNs>e.trace.endTimeNs?t.activeWindowEndNs:e.trace.endTimeNs;f.push(clockTime(e.trace.startTimeNs),`${e.trace.spans.length} span${e.trace.spans.length===1?``:`s`}`,formatElapsed(durationMs(e.trace.startTimeNs,n)))}let p=`${a.bold(d(`${s.brand} traces`))}${f.length===0?``:c(` · ${f.join(` · `)}`)}`,m=e.traces.length===0?``:c(`[${e.traceIndex+1}/${e.traces.length}]`),h=[t.activeWindowEndNs===void 0?``:a.green(`● live`),m].filter(e=>e.length>0).join(` `);return[``,clipVisible(joinRight(` ${clipVisible(p,Math.max(0,r-visibleLength(h)-2))}`,h,r),r),``]}function renderConversation(e,t,n,r){let{theme:i}=t;if(e.conversationItems.length===0)return[chromeStyles(i,t.surfaces).muted(` No conversation content in this trace — content capture may be off (EVE_TRACES_CONTENT).`)];let a=conversationLines(e,n,i,t.surfaces).slice(e.scrollRow,e.scrollRow+r);return e.textSelection===void 0||e.textSelection.region!==`conversation`?a:a.map((t,r)=>highlightSelection(t,e.scrollRow+r,e.textSelection,n))}function conversationLines(e,n,r,i){let a=[];for(let o=0;o<e.conversationItems.length;o+=1)a.push(...renderConversationItem(e.conversationItems[o],n,r,o===e.selectedRow,e.expandedItems.has(o),i),``);return a}function panelDetailLines(e,t,n,i){let a=selectedTraceViewerSpan(e);return!e.panelOpen||t<=0||a===void 0?[]:[``,...renderSpanDetail(a,Math.max(16,t-3),n,{excludeKeys:CONVERSATION_CONTENT_KEYS,surfaces:i}).map(e=>` ${e}`)]}function conversationSelectionText(e,t,n,r,i){return selectionText(conversationLines(e,t,n,i),r)}function panelSelectionText(e,t,n,r){return selectionText(panelDetailLines(e,e.panelOpen?panelWidthFor(t):0,n),r)}function selectionText(e,t){let{start:r,end:i}=orderedTextSelection(t),a=[];for(let t=Math.max(0,r.line);t<=i.line&&t<e.length;t+=1){let n=stripAnsi(e[t]),o=t===r.line?r.column:0,l=t===i.line?i.column+1:1/0,u=l===1/0?n:sliceVisible(n,l),d=sliceVisible(n,o).length;a.push(u.slice(d).trimEnd())}return a.join(`
2
- `)}function highlightSelection(e,t,r,i){let{start:a,end:o}=orderedTextSelection(r);if(t<a.line||t>o.line)return e;let c=t===a.line?a.column:0,l=t===o.line?o.column+1:i,d=visibleLength(e),f=d<l?e+` `.repeat(l-d):e,p=sliceVisible(f,c),m=sliceVisible(f,l),h=m.slice(p.length),g=f.slice(m.length);return h.length===0?e:`${p}\x1b[7m${h.replaceAll(`\x1B[0m`,`\x1B[0m\x1B[7m`)}\x1b[27m${g}`}function renderFooter(e,t,n,r){let{colors:i}=n,{muted:a}=chromeStyles(n,r),[s,c]=n.unicode?[`↑↓`,`←→`]:[`^/v`,`</>`],l=e.panelFocus?`${s} scroll · tab cards · esc back`:`${s} select · ${c} expand · enter attrs · tab focus · [ ] traces · q close`,u=e.conversationItems.length,d=u===0?``:a(`item ${e.selectedRow+1}/${u}`),f=[e.notice===void 0?``:i.yellow(e.notice),d].filter(e=>e.length>0).join(a(` · `));return[``,clipVisible(` ${a(l)}`,t),clipVisible(f.length===0?``:` ${f}`,t)]}function renderEmptyState(e,t,n){let{muted:r,primary:i}=chromeStyles(t,e.surfaces),[a,o]=e.tracingDisabled===!0?[`Tracing is disabled (EVE_TRACES=off).`,`Re-enable it and spans stream in live.`]:[`No local traces yet.`,`Chat with your agent — spans stream in live.`];return center(n,t.colors.bold(i(a)),r(o))}function center(e,...t){let n=Array.from({length:e},()=>``),r=Math.max(0,Math.floor(e/2)-1);return t.forEach((t,i)=>{r+i<e&&(n[r+i]=t)}),n}function joinPanels(e,t,n,r){let i=Math.max(0,r-t-1);return`${padTo(e,t)} ${clipVisible(n,i)}`}function joinRight(e,t,n){if(t.length===0)return e;let r=Math.max(1,n-visibleLength(e)-visibleLength(t));return`${e}${` `.repeat(r)}${t}`}function padTo(e,t){let n=visibleLength(e);return n>=t?clipVisible(e,t):e+` `.repeat(t-n)}function panelWidthFor(e){return e<42?0:Math.min(64,Math.max(20,Math.floor(e*.42)),e-20-1)}function durationMs(e,t){return Math.max(0,Number(t-e)/1e6)}function clockTime(e){let t=new Date(Number(e/1000000n)),pad=(e,t=2)=>String(e).padStart(t,`0`);return`${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}.${pad(t.getMilliseconds(),3)}`}export{conversationSelectionText,panelSelectionText,renderSpanDetail,renderTraceViewer};
1
+ import{formatAttributeContent}from"./trace-content.js";import{renderConversationItem}from"./trace-conversation.js";import{orderedTextSelection,selectedTraceViewerSpan}from"./trace-viewer-state.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,sliceVisible,stripAnsi,stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{describeLocalTraceSpan}from"#tracing/local-trace-reader.js";function renderTraceViewer(e,t){let{width:n,height:r,theme:i}=t,a=chromeStyles(i,t.surfaces),o=Math.max(1,r-3-3),s=e.panelOpen?panelWidthFor(n):0,c=Math.max(20,n-(s===0?0:s+1)),l=panelDetailLines(e,s,i,t.surfaces),u=o,d=[];if(d.push(...renderHeader(e,t)),e.traces.length===0)d.push(...renderEmptyState(t,i,o));else if(e.trace===void 0)d.push(...center(o,a.muted(`Loading trace…`)));else{let r=renderConversation(e,t,c,o);for(let t=0;t<o;t+=1){let i=r[t]??``;if(s===0){d.push(i);continue}let a=l[e.panelScroll+t]??``;e.textSelection!==void 0&&e.textSelection.region===`panel`&&(a=highlightSelection(a,e.panelScroll+t,e.textSelection,s)),d.push(joinPanels(i,c,a,n))}}return d.push(...renderFooter(e,n,i,t.surfaces)),t.toast!==void 0&&overlayToast(d,t.toast,n,i,t.surfaces),{rows:d,panelTotalRows:l.length,timelineViewportRows:o,panelViewportRows:u,contentWidth:c}}function chromeStyles(e,t){let n=e.color?t:void 0;return{muted:n?.mutedText??e.colors.dim,primary:n?.primaryText??(e=>e)}}function overlayToast(e,t,n,r,i){let a=` ${stripTerminalControls(t)} `,o=visibleLength(a),s=r.unicode?`▌`:r.glyph.rule,u=r.color?i:void 0,d=u===void 0?``:u.body,f=u?.primaryText??r.colors.white,p=r.color?`\x1B[0m`:``,m=[`${d}${f(s)}${` `.repeat(o)}${p}`,`${d}${f(s)}${f(a)}${p}`,`${d}${f(s)}${` `.repeat(o)}${p}`];for(let[t,r]of m.entries()){let i=2+t;if(i>=e.length)break;e[i]=overlayRight(e[i],r,n,1)}}function overlayRight(e,t,n,r){let i=Math.max(0,n-r-visibleLength(t)),a=visibleLength(e);return`${sliceVisible(a<i?e+` `.repeat(i-a):e,i)}\x1b[0m${t}`}const CONVERSATION_CONTENT_KEYS=new Set([`ai.prompt.messages`,`ai.prompt.system`,`ai.response.reasoning`,`ai.response.text`,`ai.response.tool_calls`,`ai.response.tool_results`,`gen_ai.tool.call.arguments`,`gen_ai.tool.call.result`]);function renderSpanDetail(t,n,r,o){let{colors:s}=r,{muted:l,primary:f}=chromeStyles(r,o?.surfaces),p=[],m=stripTerminalControls(t.name);p.push(...wrapVisibleLine(s.bold(f(m)),n));let h=describeLocalTraceSpan(t).map(stripTerminalControls);h.length>0&&p.push(l(h.join(`, `))),p.push(``);let fact=(e,t)=>`${l(e.padEnd(10))}${t}`,g=t.statusCode===2;p.push(fact(`status`,g?s.red(`ERROR`):s.green(`ok`))),p.push(fact(`duration`,formatElapsed(durationMs(t.startTimeNs,t.endTimeNs)))),p.push(fact(`started`,clockTime(t.startTimeNs))),p.push(fact(`span`,t.spanId)),t.parentSpanId!==void 0&&p.push(fact(`parent`,t.parentSpanId)),t.scope!==void 0&&p.push(fact(`scope`,stripTerminalControls(t.scope))),p.push(``);let _=Object.keys(t.attributes).filter(e=>o?.excludeKeys?.has(e)!==!0).sort();if(_.length===0)p.push(l(`no attributes`));else{p.push(l(`attributes (${_.length})`));for(let i of _){let a=formatAttributeContent(i,t.attributes[i],r,n-2),o=stripTerminalControls(i);if(a.length===1)p.push(...wrapVisibleLine(`${l(o)} ${a[0]}`,n));else{p.push(l(o));for(let e of a)p.push(` ${e}`)}}}return p.map(e=>clipVisible(e,n))}function renderHeader(e,t){let{theme:n,width:r}=t,{colors:o,glyph:s}=n,{muted:u,primary:d}=chromeStyles(n,t.surfaces),f=[];if(e.trace?.agentName!==void 0&&f.push(stripTerminalControls(e.trace.agentName)),e.trace?.sessionId!==void 0&&f.push(`session ${stripTerminalControls(e.trace.sessionId)}`),e.trace!==void 0){let n=t.activeWindowEndNs!==void 0&&t.activeWindowEndNs>e.trace.endTimeNs?t.activeWindowEndNs:e.trace.endTimeNs;f.push(clockTime(e.trace.startTimeNs),`${e.trace.spans.length} span${e.trace.spans.length===1?``:`s`}`,formatElapsed(durationMs(e.trace.startTimeNs,n)))}let p=`${o.bold(d(`${s.brand} traces`))}${f.length===0?``:u(` · ${f.join(` · `)}`)}`,m=e.traces.length===0?``:u(`[${e.traceIndex+1}/${e.traces.length}]`),h=[t.activeWindowEndNs===void 0?``:o.green(`● live`),m].filter(e=>e.length>0).join(` `);return[``,clipVisible(joinRight(` ${clipVisible(p,Math.max(0,r-visibleLength(h)-2))}`,h,r),r),``]}function renderConversation(e,t,n,r){let{theme:i}=t;if(e.conversationItems.length===0)return[chromeStyles(i,t.surfaces).muted(` No conversation content in this trace — content capture may be off (EVE_TRACES_CONTENT).`)];let a=conversationLines(e,n,i,t.surfaces).slice(e.scrollRow,e.scrollRow+r);return e.textSelection===void 0||e.textSelection.region!==`conversation`?a:a.map((t,r)=>highlightSelection(t,e.scrollRow+r,e.textSelection,n))}function conversationLines(e,n,r,i){let a=[];for(let o=0;o<e.conversationItems.length;o+=1)a.push(...renderConversationItem(e.conversationItems[o],n,r,o===e.selectedRow,e.expandedItems.has(o),i),``);return a}function panelDetailLines(e,t,n,i){let a=selectedTraceViewerSpan(e);return!e.panelOpen||t<=0||a===void 0?[]:[``,...renderSpanDetail(a,Math.max(16,t-3),n,{excludeKeys:CONVERSATION_CONTENT_KEYS,surfaces:i}).map(e=>` ${e}`)]}function conversationSelectionText(e,t,n,r,i){return selectionText(conversationLines(e,t,n,i),r)}function panelSelectionText(e,t,n,r){return selectionText(panelDetailLines(e,e.panelOpen?panelWidthFor(t):0,n),r)}function selectionText(e,t){let{start:r,end:i}=orderedTextSelection(t),a=[];for(let t=Math.max(0,r.line);t<=i.line&&t<e.length;t+=1){let n=stripAnsi(e[t]),c=t===r.line?r.column:0,l=t===i.line?i.column+1:1/0,u=l===1/0?n:sliceVisible(n,l),d=sliceVisible(n,c).length;a.push(u.slice(d).trimEnd())}return a.join(`
2
+ `)}function highlightSelection(e,t,r,i){let{start:a,end:s}=orderedTextSelection(r);if(t<a.line||t>s.line)return e;let c=t===a.line?a.column:0,u=t===s.line?s.column+1:i,d=visibleLength(e),f=d<u?e+` `.repeat(u-d):e,p=sliceVisible(f,c),m=sliceVisible(f,u),h=m.slice(p.length),g=f.slice(m.length);return h.length===0?e:`${p}\x1b[7m${h.replaceAll(`\x1B[0m`,`\x1B[0m\x1B[7m`)}\x1b[27m${g}`}function renderFooter(e,t,n,r){let{colors:i}=n,{muted:o}=chromeStyles(n,r),[s,c]=n.unicode?[`↑↓`,`←→`]:[`^/v`,`</>`],l=e.panelFocus?`${s} scroll · tab cards · esc back`:`${s} select · ${c} expand · enter attrs · tab focus · [ ] traces · q close`,u=e.conversationItems.length,d=u===0?``:o(`item ${e.selectedRow+1}/${u}`),f=[e.notice===void 0?``:i.yellow(e.notice),d].filter(e=>e.length>0).join(o(` · `));return[``,clipVisible(` ${o(l)}`,t),clipVisible(f.length===0?``:` ${f}`,t)]}function renderEmptyState(e,t,n){let{muted:r,primary:i}=chromeStyles(t,e.surfaces),[a,o]=e.tracingDisabled===!0?[`Tracing is disabled (EVE_TRACES=off).`,`Re-enable it and spans stream in live.`]:[`No local traces yet.`,`Chat with your agent — spans stream in live.`];return center(n,t.colors.bold(i(a)),r(o))}function center(e,...t){let n=Array.from({length:e},()=>``),r=Math.max(0,Math.floor(e/2)-1);return t.forEach((t,i)=>{r+i<e&&(n[r+i]=t)}),n}function joinPanels(e,t,n,r){let i=Math.max(0,r-t-1);return`${padTo(e,t)} ${clipVisible(n,i)}`}function joinRight(e,t,n){if(t.length===0)return e;let r=Math.max(1,n-visibleLength(e)-visibleLength(t));return`${e}${` `.repeat(r)}${t}`}function padTo(e,t){let n=visibleLength(e);return n>=t?clipVisible(e,t):e+` `.repeat(t-n)}function panelWidthFor(e){return e<42?0:Math.min(64,Math.max(20,Math.floor(e*.42)),e-20-1)}function durationMs(e,t){return Math.max(0,Number(t-e)/1e6)}function clockTime(e){let t=new Date(Number(e/1000000n)),pad=(e,t=2)=>String(e).padStart(t,`0`);return`${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}.${pad(t.getMilliseconds(),3)}`}export{conversationSelectionText,panelSelectionText,renderSpanDetail,renderTraceViewer};
@@ -27,7 +27,7 @@
27
27
  "@ai-sdk/provider": "4.0.4",
28
28
  "@ai-sdk/provider-utils": "5.0.13",
29
29
  "semver": "7.8.4",
30
- "shadcn": "4.16.0",
30
+ "shadcn": "4.16.1",
31
31
  "@standard-schema/spec": "1.1.0",
32
32
  "turndown": "7.2.4",
33
33
  "@vercel/detect-agent": "1.2.3",