eve 0.47.2 → 0.47.3
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 +14 -0
- package/dist/src/channel/activity-renderer.d.ts +21 -0
- package/dist/src/channel/activity-renderer.js +1 -0
- package/dist/src/channel/activity-sink.d.ts +2 -0
- package/dist/src/channel/activity-sink.js +1 -0
- package/dist/src/channel/auth/oidc.js +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/compiled-channel.d.ts +2 -0
- package/dist/src/channel/compiled-channel.js +2 -2
- package/dist/src/channel/forwarded-principal.js +1 -1
- package/dist/src/channel/session.d.ts +3 -2
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +11 -0
- package/dist/src/chunks/{use-eve-agent-CacMaX4P.js → use-eve-agent-DjYwFJF7.js} +1 -0
- package/dist/src/chunks/{use-eve-agent-kmlFdOBB.js → use-eve-agent-DkUB0Ok4.js} +1 -0
- package/dist/src/cli/dev/tui/status-line.d.ts +6 -0
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +4 -4
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/context/keys.d.ts +2 -1
- package/dist/src/context/keys.js +1 -1
- package/dist/src/eve-channel/activity-observer-request.d.ts +7 -0
- package/dist/src/eve-channel/activity-observer-request.js +1 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +3 -1
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/execution/activity-collector.d.ts +12 -0
- package/dist/src/execution/activity-collector.js +1 -0
- package/dist/src/execution/activity-events.d.ts +7 -0
- package/dist/src/execution/activity-events.js +1 -0
- package/dist/src/execution/activity-route.d.ts +2 -0
- package/dist/src/execution/activity-route.js +1 -0
- package/dist/src/execution/activity-text.d.ts +3 -0
- package/dist/src/execution/activity-text.js +1 -0
- package/dist/src/execution/activity-work-id.d.ts +9 -0
- package/dist/src/execution/activity-work-id.js +1 -0
- package/dist/src/execution/activity-work.d.ts +20 -0
- package/dist/src/execution/activity-work.js +1 -0
- package/dist/src/execution/agent-handle-dispatch.d.ts +3 -1
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +8 -0
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +3 -1
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
- package/dist/src/execution/session-activity-projection.d.ts +14 -0
- package/dist/src/execution/session-activity-projection.js +1 -0
- package/dist/src/execution/session-activity-renderer-step.d.ts +15 -0
- package/dist/src/execution/session-activity-renderer-step.js +1 -0
- package/dist/src/execution/session-activity.d.ts +6 -0
- package/dist/src/execution/session-activity.js +1 -0
- package/dist/src/execution/session-callback-request.d.ts +1 -0
- package/dist/src/execution/session-callback-request.js +1 -1
- package/dist/src/execution/session-callback-route.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-start-local.d.ts +1 -0
- package/dist/src/execution/subagent-start-local.js +1 -1
- package/dist/src/execution/subagent-start-remote.d.ts +1 -0
- package/dist/src/execution/subagent-start-remote.js +1 -1
- package/dist/src/execution/subagent-tool.d.ts +2 -1
- package/dist/src/execution/subagent-tool.js +1 -1
- package/dist/src/execution/submit-activity.d.ts +7 -0
- package/dist/src/execution/submit-activity.js +1 -0
- package/dist/src/execution/tasks/child/steps.d.ts +8 -0
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +3 -0
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +3 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/connection-search.js +1 -1
- package/dist/src/execution/tools/subagent/local.js +1 -1
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/web-fetch/request.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +4 -0
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.d.ts +478 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.js +1 -0
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/ai-sdk-telemetry.d.ts +5 -1
- package/dist/src/harness/ai-sdk-telemetry.js +1 -1
- package/dist/src/harness/approval-delivery-coordinator.js +1 -1
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
- package/dist/src/harness/instrumentation/content-policy.d.ts +3 -5
- package/dist/src/harness/instrumentation/content-policy.js +1 -1
- package/dist/src/harness/instrumentation/dispatch.js +1 -1
- package/dist/src/harness/instrumentation/lifecycle.d.ts +10 -4
- package/dist/src/harness/instrumentation/runtime-context.js +1 -1
- package/dist/src/harness/instrumentation/runtime.d.ts +3 -3
- package/dist/src/harness/prepare-trace-context.d.ts +3 -3
- package/dist/src/harness/prepare-trace-context.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/user-agent.d.ts +2 -0
- package/dist/src/internal/user-agent.js +1 -1
- package/dist/src/protocol/activity.d.ts +105 -0
- package/dist/src/protocol/activity.js +1 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +4 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
- package/dist/src/setup/gateway-models.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +9 -5
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +0 -2
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +3 -3
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.d.ts +3 -3
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-trace-context-store.d.ts +3 -0
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +2 -0
- package/dist/src/tracing/otel-declaration.d.ts +7 -3
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/reference/cli.md +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.47.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9d28f89: Identify requests from the `eve dev` terminal UI with an `eve-tui/<version>` User-Agent product token while preserving caller-supplied User-Agent values.
|
|
8
|
+
- cace2c5: Add the internal versioned protocol and reducer used by channel activity renderers.
|
|
9
|
+
- 76f1bbd: Show authored-source rebuild and load progress in the `eve dev` status bar, even when server logs are hidden.
|
|
10
|
+
- 44c6af2: Report root, delegated work, action, and blocker lifecycle to activity collectors.
|
|
11
|
+
- b8a635c: Generated Sign in with Vercel Web Chat starters now place the account control at the top-left, opposite the new-chat action, with a smaller profile image.
|
|
12
|
+
- 05b12e3: Instrumentation-provider content delivery now depends only on each provider's `capture` declaration: providers that declare `capture: "content"` receive full event content regardless of channel audience or OpenTelemetry `tracePolicy`. Separately, a `tracePolicy` that drops the eve trace no longer disables AI SDK telemetry: metadata-only AI spans (model, tokens, and timing, without message content) are still emitted into the ambient Workflow trace, and `agent.session` is not emitted.
|
|
13
|
+
- 17d2445: Keep earlier Slack approval cards visibly settled when several approvals share one message and are answered out of order.
|
|
14
|
+
- 55649a5: Preserve normal follow-up messages while an approval with responder authorization remains pending.
|
|
15
|
+
- 3c8f2fe: Collect and render activity independently from the root agent session.
|
|
16
|
+
|
|
3
17
|
## 0.47.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
2
|
+
import type { ActivitySnapshotV1 } from "#protocol/activity.js";
|
|
3
|
+
export interface ChannelActivityRenderer {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
render(input: {
|
|
6
|
+
readonly destination: Readonly<Record<string, unknown>>;
|
|
7
|
+
readonly snapshot: ActivitySnapshotV1;
|
|
8
|
+
readonly state: unknown;
|
|
9
|
+
}): Promise<unknown>;
|
|
10
|
+
dispose?(input: {
|
|
11
|
+
readonly destination: Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly state: unknown;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface ChannelActivityPresentation {
|
|
16
|
+
readonly destination: (state: Record<string, unknown> | undefined) => Readonly<Record<string, unknown>>;
|
|
17
|
+
readonly renderers: readonly ChannelActivityRenderer[];
|
|
18
|
+
}
|
|
19
|
+
export declare function attachChannelActivityPresentation(adapter: ChannelAdapter, presentation: ChannelActivityPresentation): void;
|
|
20
|
+
export declare function copyChannelActivityPresentation(source: ChannelAdapter, target: ChannelAdapter): void;
|
|
21
|
+
export declare function getChannelActivityPresentation(adapter: ChannelAdapter): ChannelActivityPresentation | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const CHANNEL_ACTIVITY_PRESENTATION=Symbol.for(`eve.channel.activityPresentation`);function attachChannelActivityPresentation(e,t){Object.defineProperty(e,CHANNEL_ACTIVITY_PRESENTATION,{configurable:!0,enumerable:!1,value:t})}function copyChannelActivityPresentation(e,t){let n=Object.getOwnPropertyDescriptor(e,CHANNEL_ACTIVITY_PRESENTATION);n!==void 0&&Object.defineProperty(t,CHANNEL_ACTIVITY_PRESENTATION,n)}function getChannelActivityPresentation(e){return e[CHANNEL_ACTIVITY_PRESENTATION]}export{attachChannelActivityPresentation,copyChannelActivityPresentation,getChannelActivityPresentation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{EVE_ACTIVITY_ROUTE_PATTERN}from"#protocol/routes.js";import{isReservedIpAddress}from"#shared/network-address.js";const schema=z.object({url:z.string().min(1),version:z.literal(1)}).strict();function parseActivitySink(e){if(e===void 0)return;let t=schema.safeParse(e);if(!t.success)throw Error(`Expected activitySink version 1.`);let n;try{n=new URL(t.data.url)}catch{throw Error(`Activity sink url must be absolute.`)}let r=EVE_ACTIVITY_ROUTE_PATTERN.slice(0,-6),i=n.pathname.slice(n.pathname.lastIndexOf(r)+r.length);if(n.pathname.lastIndexOf(r)<0||i.length<32)throw Error(`Activity sink url must contain an opaque activity token.`);if(isReservedIpAddress(n.hostname))throw Error(`Activity sink url host must not be a private or reserved address.`);return t.data}export{parseActivitySink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{createRemoteJWKSet,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#channel/auth/token-claims.js";import{isVercelOidcIssuer}from"#shared/vercel-project.js";const oidcDiscoveryDocumentSchema=z.object({issuer:z.string().optional(),jwks_uri:z.string().url()}).passthrough(),oidcDiscoveryDocumentCache=new Map,oidcJwksCache=new Map;async function authenticateOidcStrategy(e){let t;try{t=await getOidcRemoteJwks(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to load OIDC discovery metadata. ${e instanceof Error?e.message:`Unknown discovery failure.`}`}}try{let a=await jwtVerify(e.token,t,{audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});if(e.strategy.acceptCurrentVercelProject&&isVercelOidcIssuer(e.strategy.issuer)&&a.payload.external_sub!==void 0)return typeof a.payload.external_sub!=`string`||a.payload.external_sub.length===0||!currentVercelProjectMatches({payload:a.payload,strategy:e.strategy})||!currentVercelEnvironmentMatches({payload:a.payload,strategy:e.strategy})?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,issuerClaims:[`external_iss`,`connector_id`],payload:a.payload,principalType:`user`,subjectClaim:`external_sub`})};if(e.strategy.acceptCurrentVercelProject&&isVercelOidcIssuer(e.strategy.issuer)&&a.payload.user_id!==void 0){if(typeof a.payload.user_id!=`string`||a.payload.user_id.length===0||a.payload.environment!==`development`||!currentVercelProjectMatches({payload:a.payload,strategy:e.strategy}))return{kind:`caller-not-allowed`};if(currentVercelEnvironmentMatches({payload:a.payload,strategy:e.strategy}))return{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:a.payload,principalType:`user`,subjectClaim:`user_id`})}}if(typeof a.payload.sub!=`string`||a.payload.sub.length===0)return{kind:`not-authenticated`};let o=e.strategy.acceptCurrentVercelProject&&isCurrentVercelProjectToken({issuer:e.strategy.issuer,payload:a.payload,strategy:e.strategy}),s=o&&isCurrentVercelEnvironmentToken({payload:a.payload,strategy:e.strategy});return!o&&!areTokenClaimMatchersSatisfied(a.payload,e.strategy)?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:a.payload,principalType:s?`runtime`:`service`})}}catch{return{kind:`not-authenticated`}}}async function getOidcRemoteJwks(e){let n=await getOidcDiscoveryDocument(e.discoveryUrl),r=oidcJwksCache.get(n.jwks_uri);if(r!==void 0)return r;let i=createRemoteJWKSet(new URL(n.jwks_uri));return oidcJwksCache.set(n.jwks_uri,i),i}async function getOidcDiscoveryDocument(e){let t=oidcDiscoveryDocumentCache.get(e);if(t!==void 0)return await t;let n=fetch(e,{headers:{accept:`application/json`}}).then(async e=>{if(!e.ok)throw Error(`Discovery route returned HTTP ${e.status}.`);return oidcDiscoveryDocumentSchema.parse(await e.json())}).catch(t=>{throw oidcDiscoveryDocumentCache.delete(e),t});return oidcDiscoveryDocumentCache.set(e,n),await n}function isCurrentVercelProjectToken(e){if(!isVercelOidcIssuer(e.issuer))return!1;let t=e.strategy.currentVercelProject;return t!==void 0&&typeof e.payload.project_id==`string`&&e.payload.project_id===t.projectId}function currentVercelProjectMatches(e){let t=e.strategy.currentVercelProject;return t!==void 0&&typeof e.payload.project_id==`string`&&e.payload.project_id===t.projectId}function isCurrentVercelEnvironmentToken(e){let t=e.strategy.currentVercelProject?.environment;return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}function currentVercelEnvironmentMatches(e){let t=e.strategy.currentVercelProject?.environment;return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}export{authenticateOidcStrategy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSession,sessionCallbackToTurnCaller}from"#channel/session.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{normalizeSendInput,serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{isRuntimeSessionOwnershipConflictError}from"#execution/runtime-errors.js";import{isReservedSessionCommandToken}from"#execution/session-command-token.js";function createChannelAddress(r){let i=r.metadata??{},a=`${r.channelName}:${r.continuationToken}`;if(isReservedSessionCommandToken(a))throw Error(`Channel address "${a}" uses eve's reserved session namespace.`);return{continuationToken:r.continuationToken,async deliver(n,o){let s=i.channelKind!==void 0&&i.channelName!==void 0?createChannelDeliveryMetadata(i):void 0,c=normalizeSendInput(n),l=sessionCallbackToTurnCaller(o.callback),u={auth:o.auth,delivery:s,kind:`send`,payload:{...c,message:serializeUrlFilePartsInMessage(c.message)},requestId:i.requestId,turnPolicy:c.message===void 0?void 0:o.turnPolicy??r.turnPolicy??DEFAULT_TURN_POLICY},d=l===void 0?u:{...u,caller:l},dispatch=async()=>{let t=await r.runtime.dispatchContinuation({command:d,continuationToken:a});return t.status===`accepted`?createSession(t.sessionId,r.runtime,{...i,turnPolicy:r.turnPolicy}):void 0},f=await dispatch();if(f!==void 0)return f;if(c.inputResponses&&c.inputResponses.length>0)throw Error(`Cannot deliver inputResponses — the target session was not found via continuation token.`);let p=o.state,m=
|
|
1
|
+
import{createSession,sessionCallbackToTurnCaller}from"#channel/session.js";import{copyChannelActivityPresentation}from"#channel/activity-renderer.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{normalizeSendInput,serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{isRuntimeSessionOwnershipConflictError}from"#execution/runtime-errors.js";import{isReservedSessionCommandToken}from"#execution/session-command-token.js";function createChannelAddress(r){let i=r.metadata??{},a=`${r.channelName}:${r.continuationToken}`;if(isReservedSessionCommandToken(a))throw Error(`Channel address "${a}" uses eve's reserved session namespace.`);return{continuationToken:r.continuationToken,async deliver(n,o){let s=i.channelKind!==void 0&&i.channelName!==void 0?createChannelDeliveryMetadata(i):void 0,c=normalizeSendInput(n),l=sessionCallbackToTurnCaller(o.callback),u={auth:o.auth,delivery:s,kind:`send`,payload:{...c,message:serializeUrlFilePartsInMessage(c.message)},requestId:i.requestId,turnPolicy:c.message===void 0?void 0:o.turnPolicy??r.turnPolicy??DEFAULT_TURN_POLICY},d=l===void 0?u:{...u,caller:l},dispatch=async()=>{let t=await r.runtime.dispatchContinuation({command:d,continuationToken:a});return t.status===`accepted`?createSession(t.sessionId,r.runtime,{...i,turnPolicy:r.turnPolicy}):void 0},f=await dispatch();if(f!==void 0)return f;if(c.inputResponses&&c.inputResponses.length>0)throw Error(`Cannot deliver inputResponses — the target session was not found via continuation token.`);let p=o.state,m=p===void 0?r.adapter:{...r.adapter,state:{...r.adapter.state,...p}};m!==r.adapter&©ChannelActivityPresentation(r.adapter,m);let h=o.mode===`task`?void 0:{requestInput:!0},g={adapter:m,auth:o.auth,capabilities:h,callback:o.callback,channelName:r.channelName,continuationToken:a,delivery:s,initiatorAuth:o.initiatorAuth,input:{context:c.context,message:serializeUrlFilePartsInMessage(c.message)??``,outputSchema:c.outputSchema},mode:o.mode??`conversation`,requestId:i.requestId,title:o.title};try{return createSession((await r.runtime.createSession(g)).sessionId,r.runtime,{...i,turnPolicy:r.turnPolicy})}catch(e){if(!isRuntimeSessionOwnershipConflictError(e))throw e;let t=await dispatch();if(t!==void 0)return t;throw e}},async send(e,t){return await this.deliver({message:e},t)},async respond(e,t){if(e===void 0||e.length===0)throw Error(`respond() requires at least one input response.`);return await this.deliver({inputResponses:e},t)},async cancel(e){return await r.runtime.dispatchContinuation({command:{kind:`cancel`,turnId:e?.turnId},continuationToken:a})},async compact(){return await r.runtime.dispatchContinuation({command:{kind:`compact`},continuationToken:a})},async clear(){return await r.runtime.dispatchContinuation({command:{kind:`clear`},continuationToken:a})},async reset(e){return await r.runtime.dispatchContinuation({command:{kind:`reset`,reason:e?.reason},continuationToken:a})},async resolveSession(){let t=await r.runtime.resolveContinuation(a);return t===void 0?void 0:createSession(t.sessionId,r.runtime,{...i,turnPolicy:r.turnPolicy})}}}function createChannelAddressFn(e){return t=>createChannelAddress({...e,continuationToken:t})}export{createChannelAddress,createChannelAddressFn};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChannelAdapter } from "#channel/adapter.js";
|
|
2
|
+
import { type ChannelActivityPresentation } from "#channel/activity-renderer.js";
|
|
2
3
|
import type { UserContent } from "ai";
|
|
3
4
|
import type { ChannelReceiveContext } from "#channel/channel-operations.js";
|
|
4
5
|
import type { NormalizedChannelCorsOptions } from "#channel/cors.js";
|
|
@@ -25,4 +26,5 @@ export interface CompiledChannel<TState = undefined, TReceiveTarget = Record<str
|
|
|
25
26
|
}
|
|
26
27
|
export declare function isCompiledChannel(value: unknown): value is CompiledChannel;
|
|
27
28
|
export declare function getChannelInstrumentationKind(value: unknown): string | undefined;
|
|
29
|
+
export declare function setChannelActivityRenderers(channel: unknown, input: ChannelActivityPresentation): void;
|
|
28
30
|
export declare function setChannelInstrumentationKind(channel: CompiledChannel, kind: string): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const CHANNEL_SENTINEL=`eve:channel`,CHANNEL_INSTRUMENTATION_KIND=Symbol.for(`eve.channel.instrumentationKind`),CHANNEL_INSTRUMENTATION_KINDS=Symbol.for(`eve.channel.instrumentationKinds`),channelInstrumentationKindGlobal=globalThis;channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS]??=new Map;const channelInstrumentationKinds=channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS];function isCompiledChannel(e){return typeof e==`object`&&!!e&&e.__kind===`eve:channel`}function getChannelInstrumentationKind(e){if(!isCompiledChannel(e))return;let t=Reflect.get(e,CHANNEL_INSTRUMENTATION_KIND);if(typeof t==`string`&&t.length>0)return t;let
|
|
2
|
-
`)}export{CHANNEL_SENTINEL,getChannelInstrumentationKind,isCompiledChannel,setChannelInstrumentationKind};
|
|
1
|
+
import{attachChannelActivityPresentation}from"#channel/activity-renderer.js";const CHANNEL_SENTINEL=`eve:channel`,CHANNEL_INSTRUMENTATION_KIND=Symbol.for(`eve.channel.instrumentationKind`),CHANNEL_INSTRUMENTATION_KINDS=Symbol.for(`eve.channel.instrumentationKinds`),channelInstrumentationKindGlobal=globalThis;channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS]??=new Map;const channelInstrumentationKinds=channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS];function isCompiledChannel(e){return typeof e==`object`&&!!e&&e.__kind===`eve:channel`}function getChannelInstrumentationKind(e){if(!isCompiledChannel(e))return;let t=Reflect.get(e,CHANNEL_INSTRUMENTATION_KIND);if(typeof t==`string`&&t.length>0)return t;let r=e.adapter.kind;if(typeof r==`string`&&r.startsWith(`channel:`))return r;let i=channelRouteSignature(e);return i===void 0?void 0:channelInstrumentationKinds.get(i)}function setChannelActivityRenderers(t,n){if(!isCompiledChannel(t))throw TypeError(`Expected a compiled channel.`);attachChannelActivityPresentation(t.adapter,n)}function setChannelInstrumentationKind(e,t){Object.defineProperty(e,CHANNEL_INSTRUMENTATION_KIND,{configurable:!0,enumerable:!1,value:t});let r=channelRouteSignature(e);r!==void 0&&channelInstrumentationKinds.set(r,t)}function channelRouteSignature(e){if(e.routes.length!==0)return e.routes.map(e=>`${e.method.toUpperCase()} ${e.path}`).sort().join(`
|
|
2
|
+
`)}export{CHANNEL_SENTINEL,getChannelInstrumentationKind,isCompiledChannel,setChannelActivityRenderers,setChannelInstrumentationKind};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{createLogger,logError}from"#internal/logging.js";const log=createLogger(`channel.forwarded-principal`),FORWARDED_BY_ATTRIBUTE=`eve:forwarded-by`,attributeValueSchema=z.union([z.string(),z.array(z.string()).readonly()]),forwardedPrincipalContextSchema=z.object({attributes:z.record(z.string(),attributeValueSchema).readonly(),authenticator:z.string().min(1),issuer:z.string().min(1).optional(),principalId:z.string().min(1),principalType:z.string().min(1),subject:z.string().min(1).optional()}).strict(),forwardedPrincipalSchema=z.object({current:forwardedPrincipalContextSchema,initiator:forwardedPrincipalContextSchema.optional()}).strict();async function resolveForwardedPrincipal(e){let t=e.payload.forwardedPrincipal;if(t===void 0)return{accepted:!1,auth:e.forwarder};if(e.trustedForwarders===void 0)return Response.json({error:`This deployment does not accept a forwarded principal.`,ok:!1},{status:403});let n=parseForwardedPrincipal(t);if(!n.ok)return Response.json({error:n.message,ok:!1},{status:400});let r;try{r=await e.trustedForwarders(e.forwarder)}catch(t){let n=logError(log,`trustedForwarders handler failed`,t,{forwarder:e.forwarder.principalId});return Response.json({error:`trustedForwarders handler failed.`,errorId:n,ok:!1},{status:500})}if(!r)return Response.json({error:`Caller is not authorized to assert a forwarded principal.`,ok:!1},{status:403});let i=stampForwardedBy(n.forwardedPrincipal.current,e.forwarder.principalId);return{accepted:!0,auth:i,initiatorAuth:n.forwardedPrincipal.initiator===void 0?i:stampForwardedBy(n.forwardedPrincipal.initiator,e.forwarder.principalId)}}function parseForwardedPrincipal(e){let t=forwardedPrincipalSchema.safeParse(e);if(t.success){let e=toSessionAuthContext(t.data.current);return{forwardedPrincipal:t.data.initiator===void 0?{current:e}:{current:e,initiator:toSessionAuthContext(t.data.initiator)},ok:!0}}return{cause:t.error,message:formatForwardedPrincipalParseError(t.error),ok:!1}}function stampForwardedBy(e,t){return{...e,attributes:{...e.attributes,[FORWARDED_BY_ATTRIBUTE]:t}}}function toSessionAuthContext(e){let t={attributes:e.attributes,authenticator:e.authenticator,principalId:e.principalId,principalType:e.principalType};return e.issuer!==void 0&&(t.issuer=e.issuer),e.subject!==void 0&&(t.subject=e.subject),t}function formatForwardedPrincipalParseError(e){return`Invalid forwardedPrincipal metadata: ${e.issues.map(e=>`${e.path.length===0?`forwardedPrincipal`:`forwardedPrincipal.${e.path.join(`.`)}`}: ${e.message}`).join(`; `)}`}export{FORWARDED_BY_ATTRIBUTE,parseForwardedPrincipal,resolveForwardedPrincipal,stampForwardedBy};
|
|
@@ -2,7 +2,7 @@ import type { ContextAccessor } from "#context/key.js";
|
|
|
2
2
|
import { type ChannelDeliverySource } from "#channel/delivery-metadata.js";
|
|
3
3
|
import type { MessageStreamEvent } from "#protocol/message.js";
|
|
4
4
|
import type { UserContent } from "ai";
|
|
5
|
-
import type { CancelTurnResult, ClearSessionResult, CompactSessionResult, ResetSessionResult, Runtime, SessionAuthContext, SessionCallback, SessionSendCommandResult, TurnPolicy, TurnCaller } from "#channel/types.js";
|
|
5
|
+
import type { ActivityObserverConfig, CancelTurnResult, ClearSessionResult, CompactSessionResult, ResetSessionResult, Runtime, SessionAuthContext, SessionCallback, SessionSendCommandResult, TurnPolicy, TurnCaller } from "#channel/types.js";
|
|
6
6
|
import type { SessionAuth } from "#context/keys.js";
|
|
7
7
|
import { type InputResponse, type StrictInputResponses } from "#shared/input.js";
|
|
8
8
|
import type { JsonObject } from "#shared/json.js";
|
|
@@ -32,6 +32,7 @@ export interface Session {
|
|
|
32
32
|
getStreamTailIndex(): Promise<number>;
|
|
33
33
|
}
|
|
34
34
|
interface SessionDeliveryOptions {
|
|
35
|
+
readonly activityObserver?: ActivityObserverConfig;
|
|
35
36
|
readonly auth: SessionAuthContext | null;
|
|
36
37
|
/** Public callback destination for a delegated continuation turn. */
|
|
37
38
|
readonly callback?: SessionCallback;
|
|
@@ -78,5 +79,5 @@ export declare function createAttachSessionFn(runtime: Runtime, metadata?: Parti
|
|
|
78
79
|
*/
|
|
79
80
|
export declare function buildSessionHandle(accessor: ContextAccessor): SessionHandle;
|
|
80
81
|
/** @internal Converts validated public callback metadata into runtime turn routing. */
|
|
81
|
-
export declare function sessionCallbackToTurnCaller(callback: SessionCallback | undefined): TurnCaller | undefined;
|
|
82
|
+
export declare function sessionCallbackToTurnCaller(callback: SessionCallback | undefined, activityObserver?: ActivityObserverConfig): TurnCaller | undefined;
|
|
82
83
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{parseInputResponses}from"#shared/input.js";import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";function createSession(e,i,a={}){return{id:e,async send(r,o){let s=createDelivery(a),c=sessionCallbackToTurnCaller(o.callback),l={message:serializeUrlFilePartsInMessage(r)};o.context!==void 0&&(l.context=o.context),o.outputSchema!==void 0&&(l.outputSchema=o.outputSchema);let u={auth:o.auth,delivery:s,kind:`send`,payload:l,requestId:a.requestId,turnPolicy:o.turnPolicy??a.turnPolicy??DEFAULT_TURN_POLICY};return await i.dispatchSession({command:c===void 0?u:{...u,caller:c},sessionId:e})},async respond(t,n){if(t.length===0)throw Error(`respond() requires at least one input response.`);let o=parseInputResponses(t),s=sessionCallbackToTurnCaller(n.callback),c=createDelivery(a),l={inputResponses:o};n.context!==void 0&&(l.context=n.context),n.outputSchema!==void 0&&(l.outputSchema=n.outputSchema);let u={auth:n.auth,delivery:c,kind:`send`,payload:l,requestId:a.requestId};return await i.dispatchSession({command:s===void 0?u:{...u,caller:s},sessionId:e})},async cancel(t){return await i.dispatchSession({command:{kind:`cancel`,taskId:t?.taskId,turnId:t?.turnId},sessionId:e})},async compact(){return await i.dispatchSession({command:{kind:`compact`},sessionId:e})},async clear(){return await i.dispatchSession({command:{kind:`clear`},sessionId:e})},async reset(t){return await i.dispatchSession({command:{kind:`reset`,reason:t?.reason},sessionId:e})},async getEventStream(t){return i.getEventStream(e,t)},async getStreamTailIndex(){return i.getStreamTailIndex(e)}}}function createAttachSessionFn(e,t={}){return n=>createSession(n,e,t)}function createDelivery(t){return t.channelKind!==void 0&&t.channelName!==void 0?createChannelDeliveryMetadata(t):void 0}function buildSessionHandle(e){return{get id(){return e.get(SessionIdKey)??``},get auth(){return{current:e.get(AuthKey)??null,initiator:e.get(InitiatorAuthKey)??null}},get continuation(){let t=e.get(ContinuationTokenKey);if(!(t===void 0||t.length===0))return{token:toChannelLocalContinuationToken(t),rekey(n){let r=namespaceContinuationToken(t,n);t!==r&&e.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}`}function sessionCallbackToTurnCaller(e){return e===void 0?void 0:{callId:e.callId,replyTo:{kind:`callback`,token:e.token,url:e.url},subagentName:e.subagentName,taskId:e.taskId}}export{buildSessionHandle,createAttachSessionFn,createSession,sessionCallbackToTurnCaller};
|
|
1
|
+
import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{serializeUrlFilePartsInMessage}from"#channel/send-input.js";import{DEFAULT_TURN_POLICY}from"#channel/types.js";import{parseInputResponses}from"#shared/input.js";import{AuthKey,ContinuationTokenKey,InitiatorAuthKey,SessionIdKey}from"#context/keys.js";import{toChannelLocalContinuationToken}from"#shared/continuation-token.js";function createSession(e,i,a={}){return{id:e,async send(r,o){let s=createDelivery(a),c=sessionCallbackToTurnCaller(o.callback,o.activityObserver),l={message:serializeUrlFilePartsInMessage(r)};o.context!==void 0&&(l.context=o.context),o.outputSchema!==void 0&&(l.outputSchema=o.outputSchema);let u={auth:o.auth,delivery:s,kind:`send`,payload:l,requestId:a.requestId,turnPolicy:o.turnPolicy??a.turnPolicy??DEFAULT_TURN_POLICY};return await i.dispatchSession({command:c===void 0?u:{...u,caller:c},sessionId:e})},async respond(t,n){if(t.length===0)throw Error(`respond() requires at least one input response.`);let o=parseInputResponses(t),s=sessionCallbackToTurnCaller(n.callback,n.activityObserver),c=createDelivery(a),l={inputResponses:o};n.context!==void 0&&(l.context=n.context),n.outputSchema!==void 0&&(l.outputSchema=n.outputSchema);let u={auth:n.auth,delivery:c,kind:`send`,payload:l,requestId:a.requestId};return await i.dispatchSession({command:s===void 0?u:{...u,caller:s},sessionId:e})},async cancel(t){return await i.dispatchSession({command:{kind:`cancel`,taskId:t?.taskId,turnId:t?.turnId},sessionId:e})},async compact(){return await i.dispatchSession({command:{kind:`compact`},sessionId:e})},async clear(){return await i.dispatchSession({command:{kind:`clear`},sessionId:e})},async reset(t){return await i.dispatchSession({command:{kind:`reset`,reason:t?.reason},sessionId:e})},async getEventStream(t){return i.getEventStream(e,t)},async getStreamTailIndex(){return i.getStreamTailIndex(e)}}}function createAttachSessionFn(e,t={}){return n=>createSession(n,e,t)}function createDelivery(t){return t.channelKind!==void 0&&t.channelName!==void 0?createChannelDeliveryMetadata(t):void 0}function buildSessionHandle(e){return{get id(){return e.get(SessionIdKey)??``},get auth(){return{current:e.get(AuthKey)??null,initiator:e.get(InitiatorAuthKey)??null}},get continuation(){let t=e.get(ContinuationTokenKey);if(!(t===void 0||t.length===0))return{token:toChannelLocalContinuationToken(t),rekey(n){let r=namespaceContinuationToken(t,n);t!==r&&e.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}`}function sessionCallbackToTurnCaller(e,t){return e===void 0?void 0:{activityObserver:t,callId:e.callId,replyTo:{kind:`callback`,token:e.token,url:e.url},subagentName:e.subagentName,taskId:e.taskId}}export{buildSessionHandle,createAttachSessionFn,createSession,sessionCallbackToTurnCaller};
|
|
@@ -113,6 +113,7 @@ export interface SessionAuthContext {
|
|
|
113
113
|
export type EventEmitFn = (event: UnstampedMessageStreamEvent) => Promise<void>;
|
|
114
114
|
/** Framework-internal caller waiting for one delegated conversation turn. */
|
|
115
115
|
export interface TurnCaller {
|
|
116
|
+
readonly activityObserver?: ActivityObserverConfig;
|
|
116
117
|
readonly callId: string;
|
|
117
118
|
readonly subagentName: string;
|
|
118
119
|
/** Present when this turn is the executor for a durable background task. */
|
|
@@ -326,6 +327,14 @@ export type HookPayload = ClearSessionHookPayload | CompactSessionHookPayload |
|
|
|
326
327
|
* terminal session result. Conversation sessions use this as their first turn's
|
|
327
328
|
* caller; each continuation supplies the caller for that turn.
|
|
328
329
|
*/
|
|
330
|
+
export interface ActivitySinkV1 {
|
|
331
|
+
readonly url: string;
|
|
332
|
+
readonly version: 1;
|
|
333
|
+
}
|
|
334
|
+
export interface ActivityObserverConfig {
|
|
335
|
+
readonly sink: ActivitySinkV1;
|
|
336
|
+
readonly workIdentity?: import("#protocol/activity.js").ActivityWorkIdentityV1;
|
|
337
|
+
}
|
|
329
338
|
export interface SessionCallback {
|
|
330
339
|
readonly callId: string;
|
|
331
340
|
readonly subagentName: string;
|
|
@@ -399,6 +408,8 @@ export interface RunInput {
|
|
|
399
408
|
* the caller for their own turn.
|
|
400
409
|
*/
|
|
401
410
|
readonly callback?: SessionCallback;
|
|
411
|
+
/** Private collector capability and current work lineage. */
|
|
412
|
+
readonly activityObserver?: ActivityObserverConfig;
|
|
402
413
|
/**
|
|
403
414
|
* Session continuation token for delivery and hook creation. Channels can
|
|
404
415
|
* re-key the session during the first turn via
|
|
@@ -24,6 +24,7 @@ const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:
|
|
|
24
24
|
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
25
25
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
26
26
|
const EVE_TASK_INPUT_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/task-input/:token`;
|
|
27
|
+
const EVE_ACTIVITY_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/activity/:token`;
|
|
27
28
|
function createEveSessionRoutePath(sessionId) {
|
|
28
29
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
29
30
|
}
|
|
@@ -24,6 +24,7 @@ const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:
|
|
|
24
24
|
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
25
25
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
26
26
|
const EVE_TASK_INPUT_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/task-input/:token`;
|
|
27
|
+
const EVE_ACTIVITY_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/activity/:token`;
|
|
27
28
|
function createEveSessionRoutePath(sessionId) {
|
|
28
29
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
29
30
|
}
|
|
@@ -3,7 +3,13 @@ import type { LogDisplayMode } from "./log-display-mode.js";
|
|
|
3
3
|
import type { RemoteConnectionSnapshot } from "./remote-connection.js";
|
|
4
4
|
import type { VercelStatusSnapshot } from "./vercel-status.js";
|
|
5
5
|
import type { ModelEndpointStatus } from "#shared/model-endpoint-status.js";
|
|
6
|
+
export interface DevBuildStatus {
|
|
7
|
+
readonly phase: "building" | "complete";
|
|
8
|
+
readonly summary: string;
|
|
9
|
+
}
|
|
6
10
|
export interface StatusLineInput {
|
|
11
|
+
/** Transient authored-source build state, independent of the server log filter. */
|
|
12
|
+
devBuild?: DevBuildStatus;
|
|
7
13
|
/** Port of the connected local development server; omitted for remote sessions. */
|
|
8
14
|
serverPort?: string;
|
|
9
15
|
/** Resolved model slug, e.g. "anthropic/claude-sonnet-5"; absent when `/eve/v1/info` failed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{remoteHost}from"./target.js";import{clipVisible,stripAnsi,visibleLength}from"#cli/ui/terminal-text.js";import{formatModelSummary}from"#shared/model-summary.js";function renderModel(e){if(e.model===void 0)return;let t=e.theme.colors,r={model:e.model};if(e.reasoning!==void 0&&(r.reasoning=e.reasoning),e.fastMode===!0&&(r.fastGlyph=e.theme.glyph.fast),e.remote!==void 0){r.model=stripAnsi(e.model).replace(/\s+/gu,` `).trim();let a=stripAnsi(formatModelSummary(r)).replace(/\s+/gu,` `).trim();return t.dim(a)}return t.dim(formatModelSummary(r))}function renderServerPort(e){if(e.remote!==void 0||e.serverPort===void 0)return;let t=e.theme.colors;return t.inverse(t.gray(` :${e.serverPort} `))}const EXTERNAL_PROVIDER_DISPLAY_NAMES={codex:`chatgpt-sub`};function renderEndpoint(e){if(e.remote!==void 0||e.endpoint===void 0)return;let t=e.theme.colors,n=e.theme.glyph,clause=(e,n)=>`${t.dim(`via `)}${e}${t.dim(n)}`;if(e.endpoint.kind===`external`){let r=EXTERNAL_PROVIDER_DISPLAY_NAMES[e.endpoint.provider]??e.endpoint.provider;return{text:`${t.dim(`via ${r}`)}${n.external}`,standalone:!1}}if(e.endpoint.kind===`chatgpt`)switch(e.endpoint.state){case`ready`:return{text:`${t.dim(`via chatgpt-sub`)}${n.external}`,standalone:!1};case`checking`:return{text:t.dim(`chatgpt-sub checking…`),standalone:!0};case`signed-out`:case`reauth-required`:return{text:t.yellow(`${n.warning} chatgpt-sub login · codex login`),standalone:!0};case`unavailable`:return{text:t.yellow(`${n.warning} chatgpt-sub unavailable`),standalone:!0}}if(!e.endpoint.connected)return{text:t.yellow(`${n.warning} ai-gateway`),standalone:!0};if(e.endpoint.credential===`api-key`)return{text:clause(`ai-gateway`,`(api-key)`),standalone:!1};let r=e.vercel?.identity?.projectName;return{text:clause(`ai-gateway`,`(${r===void 0?`oidc`:`oidc:${r}`})`),standalone:!1}}function buildStatusLine(e){let{theme:n,width:i}=e,a=n.colors,o=e.logLevel===void 0?void 0:a.cyan(`logs: ${e.logLevel}`),
|
|
1
|
+
import{remoteHost}from"./target.js";import{clipVisible,stripAnsi,visibleLength}from"#cli/ui/terminal-text.js";import{formatModelSummary}from"#shared/model-summary.js";function formatDevBuildStatus(e,t){let n=e.phase===`complete`;return`${n?t.glyph.success:t.glyph.validating} ${n?e.summary.replace(/ changed$/u,` updated`):`${e.summary.replace(/ (?:added|changed|removed)$/u,``)} updating…`}`}function renderModel(e){if(e.model===void 0)return;let t=e.theme.colors,r={model:e.model};if(e.reasoning!==void 0&&(r.reasoning=e.reasoning),e.fastMode===!0&&(r.fastGlyph=e.theme.glyph.fast),e.remote!==void 0){r.model=stripAnsi(e.model).replace(/\s+/gu,` `).trim();let a=stripAnsi(formatModelSummary(r)).replace(/\s+/gu,` `).trim();return t.dim(a)}return t.dim(formatModelSummary(r))}function renderServerPort(e){if(e.remote!==void 0||e.serverPort===void 0)return;let t=e.theme.colors;return t.inverse(t.gray(` :${e.serverPort} `))}const EXTERNAL_PROVIDER_DISPLAY_NAMES={codex:`chatgpt-sub`};function renderEndpoint(e){if(e.remote!==void 0||e.endpoint===void 0)return;let t=e.theme.colors,n=e.theme.glyph,clause=(e,n)=>`${t.dim(`via `)}${e}${t.dim(n)}`;if(e.endpoint.kind===`external`){let r=EXTERNAL_PROVIDER_DISPLAY_NAMES[e.endpoint.provider]??e.endpoint.provider;return{text:`${t.dim(`via ${r}`)}${n.external}`,standalone:!1}}if(e.endpoint.kind===`chatgpt`)switch(e.endpoint.state){case`ready`:return{text:`${t.dim(`via chatgpt-sub`)}${n.external}`,standalone:!1};case`checking`:return{text:t.dim(`chatgpt-sub checking…`),standalone:!0};case`signed-out`:case`reauth-required`:return{text:t.yellow(`${n.warning} chatgpt-sub login · codex login`),standalone:!0};case`unavailable`:return{text:t.yellow(`${n.warning} chatgpt-sub unavailable`),standalone:!0}}if(!e.endpoint.connected)return{text:t.yellow(`${n.warning} ai-gateway`),standalone:!0};if(e.endpoint.credential===`api-key`)return{text:clause(`ai-gateway`,`(api-key)`),standalone:!1};let r=e.vercel?.identity?.projectName;return{text:clause(`ai-gateway`,`(${r===void 0?`oidc`:`oidc:${r}`})`),standalone:!1}}function buildStatusLine(e){let{theme:n,width:i}=e,a=n.colors,o=e.devBuild===void 0?void 0:formatDevBuildStatus(e.devBuild,n),s=e.logLevel===void 0?void 0:a.cyan(`logs: ${e.logLevel}`),c=renderServerPort(e),l=renderModel(e),u=e.remote===void 0?void 0:formatRemoteStatus(e.remote,n),d=renderEndpoint(e),f=u?.full??c,p=u?.badge??c,m=d!==void 0&&!d.standalone&&l!==void 0,h=m?`${l} ${d.text}`:l,g=d===void 0||m?void 0:d.text,compose=(e,t)=>{let n=t.filter(e=>e!==void 0).join(` `);return e===void 0||n.length===0?e??n:`${e} ${n}`},_=[compose(f,[s,h,g]),compose(f,[s,l]),compose(f,[s]),compose(p,[s]),compose(p,[])];if(o!==void 0){for(let e of _){let t=visibleLength(e),n=visibleLength(o);if(!(t+(t>0?2:0)+n>i))return`${e}${` `.repeat(i-t-n)}${o}`}return clipVisible(o,i)}if(_[0].length!==0){for(let e of _)if(e.length>0&&visibleLength(e)<=i)return e;return clipVisible(_.findLast(e=>e.length>0),i)}}function formatRemoteStatus(t,n){let r=n.colors,i=t.deployment===void 0?remoteHost(t.target):`${t.deployment.projectName} (${t.deployment.environment})`,a=formatRemoteBadge(` ${n.unicode?`↗`:`->`} ${i} `,t.connection.state,n),o;switch(t.connection.state){case`checking`:o=r.dim(`Checking access…`);break;case`ready`:break;case`auth-required`:o=r.yellow(`Authenticate via OIDC`);break;case`authenticating`:o=r.dim(`Authenticating via OIDC…`);break;case`auth-failed`:o=r.yellow(`Authentication failed`);break;case`unavailable`:o=r.yellow(`Remote unavailable`);break}return{badge:a,full:o===void 0?a:`${a} ${o}`}}function formatRemoteBadge(e,t,n){let r=n.colors;switch(t){case`checking`:return r.inverse(r.gray(e));case`ready`:return r.inverse(r.blue(e));case`unavailable`:case`auth-required`:case`authenticating`:case`auth-failed`:return r.inverse(r.yellow(e))}}export{buildStatusLine};
|