eve 0.26.1 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/src/chunks/{use-eve-agent-CruinZmd.js → use-eve-agent-AeQLLhu9.js} +118 -92
- package/dist/src/chunks/{use-eve-agent-BkztZA0v.js → use-eve-agent-PMY2WkAt.js} +118 -92
- package/dist/src/cli/commands/info.d.ts +2 -0
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/client/message-action-parts.d.ts +43 -0
- package/dist/src/client/message-action-parts.js +1 -0
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +4 -4
- package/dist/src/compiled/@chat-adapter/slack/blocks.d.ts +47 -2
- package/dist/src/compiled/@chat-adapter/slack/blocks.js +10 -8
- package/dist/src/compiled/@chat-adapter/slack/index.d.ts +168 -8
- package/dist/src/compiled/@chat-adapter/slack/index.js +28 -28
- package/dist/src/compiled/@chat-adapter/slack/{types-AntsVifS.d.ts → types-CdGmMyOr.d.ts} +1 -1
- package/dist/src/compiled/@chat-adapter/slack/webhook.d.ts +2 -2
- package/dist/src/compiled/@chat-adapter/twilio/index.d.ts +1 -1
- package/dist/src/compiled/@chat-adapter/twilio/index.js +1 -1
- package/dist/src/compiled/@chat-adapter/twilio/webhook.d.ts +2 -2
- package/dist/src/compiled/@vercel/sandbox/index.js +12 -12
- package/dist/src/compiled/_chunks/node/{auth-Cuszvn7l.js → auth-BuQkq4Gr.js} +2 -2
- package/dist/src/compiled/_chunks/node/{dist-CdH_Yoxt.js → dist-BweCayKF.js} +42 -35
- package/dist/src/compiled/_chunks/node/{dist-Drt-_JVK.js → dist-DvkWiagq.js} +6 -4
- package/dist/src/compiled/chat/index.d.ts +17 -6
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiled/chat/{jsx-runtime-CzthIo1o.d.ts → jsx-runtime-_JEEAotp.d.ts} +125 -5
- package/dist/src/compiler/model-catalog.js +1 -1
- package/dist/src/evals/autoevals-client.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
- package/dist/src/execution/session.d.ts +0 -2
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/skills/instructions.d.ts +3 -3
- package/dist/src/execution/skills/instructions.js +2 -2
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/compaction-prompt.d.ts +19 -1
- package/dist/src/harness/compaction-prompt.js +7 -5
- package/dist/src/harness/compaction.d.ts +4 -11
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/messages.d.ts +7 -0
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/prompt-cache.d.ts +16 -5
- package/dist/src/harness/prompt-cache.js +1 -1
- package/dist/src/harness/stale-input-responses.js +2 -2
- package/dist/src/harness/token-estimate.d.ts +9 -0
- package/dist/src/harness/token-estimate.js +1 -0
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/compiled-artifacts.js +9 -3
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/gateway.d.ts +19 -0
- package/dist/src/internal/gateway.js +1 -0
- package/dist/src/internal/nitro/host/copy-host-middleware.js +1 -1
- package/dist/src/internal/user-agent.d.ts +11 -0
- package/dist/src/internal/user-agent.js +1 -0
- package/dist/src/public/channels/auth.d.ts +59 -9
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/nuxt/index.d.ts +1 -1
- package/dist/src/public/nuxt/index.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +10 -24
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/nuxt/routing.d.ts +5 -39
- package/dist/src/public/nuxt/routing.js +1 -1
- package/dist/src/public/nuxt/vercel-services.d.ts +117 -0
- package/dist/src/public/nuxt/vercel-services.js +1 -0
- package/dist/src/public/tools/defaults.d.ts +3 -3
- package/dist/src/runtime/framework-tools/index.d.ts +3 -2
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/skill.d.ts +6 -1
- package/dist/src/runtime/framework-tools/skill.js +1 -1
- package/dist/src/runtime/framework-tools/todo.js +1 -1
- package/dist/src/runtime/governance/auth/http-basic.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/setup/boxes/select-model.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/validate-gateway-key.js +1 -1
- package/dist/src/{public/next → shared}/resolve-eve-binary.d.ts +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +7 -7
- package/docs/extensions.md +115 -77
- package/docs/guides/auth-and-route-protection.md +14 -1
- package/docs/guides/frontend/nuxt.mdx +22 -1
- package/docs/meta.json +1 -0
- package/docs/reference/cli.md +1 -1
- package/docs/schedules.mdx +1 -1
- package/docs/skills.mdx +1 -1
- package/package.json +5 -5
- package/dist/src/execution/sandbox/bindings/vercel-user-agent.d.ts +0 -6
- package/dist/src/execution/sandbox/bindings/vercel-user-agent.js +0 -1
- package/dist/src/execution/workflow-skill-root.d.ts +0 -6
- package/dist/src/execution/workflow-skill-root.js +0 -1
- package/dist/src/public/nuxt/vercel-json.d.ts +0 -17
- package/dist/src/public/nuxt/vercel-json.js +0 -1
- /package/dist/src/{public/next → shared}/resolve-eve-binary.js +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,platform:i}=t,a=i?h(i):e=>e,o=[];e.title&&o.push(`${n}${a(e.title)}${n}`),e.subtitle&&o.push(a(e.subtitle));for(let t of e.children){let e=v(t,a);e&&o.push(e)}return o.join(r)}function v(t,
|
|
3
|
-
`);case`actions`:return null;case`section`:return t.children.map(e=>v(e,
|
|
4
|
-
`);case`table`:return
|
|
1
|
+
import{L as e,R as t,jt as n,q as r}from"./dist-BweCayKF.js";import i from"crypto";function a(e){return r(e)?e:typeof e==`object`&&e&&`card`in e?e.card:null}function o(e){return typeof e==`object`&&e&&`files`in e?e.files??[]:[]}function s(e){return typeof e==`object`&&e&&`attachments`in e?e.attachments??[]:[]}var c=class extends Error{adapter;code;constructor(e,t,n){super(e),this.name=`AdapterError`,this.adapter=t,this.code=n}},l=class extends c{retryAfter;constructor(e,t){super(`Rate limited by ${e}${t?`, retry after ${t}s`:``}`,e,`RATE_LIMITED`),this.name=`AdapterRateLimitError`,this.retryAfter=t}},u=class extends c{constructor(e,t){super(t||`Authentication failed for ${e}`,e,`AUTH_FAILED`),this.name=`AuthenticationError`}},d=class extends c{constructor(e,t){super(t,e,`VALIDATION_ERROR`),this.name=`ValidationError`}},f=class extends c{originalError;constructor(e,t,n){super(t||`Network error communicating with ${e}`,e,`NETWORK_ERROR`),this.name=`NetworkError`,this.originalError=n}};async function p(e,t){let{platform:n,throwOnUnsupported:r=!0}=t;if(Buffer.isBuffer(e))return e;if(e instanceof ArrayBuffer)return Buffer.from(e);if(e instanceof Blob){let t=await e.arrayBuffer();return Buffer.from(t)}if(r)throw new d(n,`Unsupported file data type`);return null}var m={slack:{primary:`primary`,danger:`danger`},gchat:{primary:`primary`,danger:`danger`},teams:{primary:`positive`,danger:`destructive`},discord:{primary:`primary`,danger:`danger`}};function h(e){return n=>t(n,e)}function g(e,t){if(e)return m[t][e]}function _(e,t={}){let{boldFormat:n=`*`,lineBreak:r=`
|
|
2
|
+
`,platform:i}=t,a=i?h(i):e=>e,o=[];e.title&&o.push(`${n}${a(e.title)}${n}`),e.subtitle&&o.push(a(e.subtitle));for(let t of e.children){let e=v(t,a);e&&o.push(e)}return o.join(r)}function v(t,r){switch(t.type){case`text`:return r(t.content);case`link`:return`${r(t.label)} (${t.url})`;case`fields`:return t.children.map(e=>`${r(e.label)}: ${r(e.value)}`).join(`
|
|
3
|
+
`);case`actions`:return null;case`section`:return t.children.map(e=>v(e,r)).filter(Boolean).join(`
|
|
4
|
+
`);case`table`:return n(t.headers,t.rows);case`divider`:return`---`;default:return e(t)}}var y=`aes-256-gcm`,b=12,x=16,S=/^[0-9a-fA-F]{64}$/;function C(e,t){let n=i.randomBytes(b),r=i.createCipheriv(y,t,n,{authTagLength:x}),a=Buffer.concat([r.update(e,`utf8`),r.final()]),o=r.getAuthTag();return{iv:n.toString(`base64`),data:a.toString(`base64`),tag:o.toString(`base64`)}}function w(e,t){let n=Buffer.from(e.iv,`base64`),r=Buffer.from(e.data,`base64`),a=Buffer.from(e.tag,`base64`),o=i.createDecipheriv(y,t,n,{authTagLength:x});return o.setAuthTag(a),Buffer.concat([o.update(r),o.final()]).toString(`utf8`)}function T(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.iv==`string`&&typeof t.data==`string`&&typeof t.tag==`string`}function E(e){let t=e.trim(),n=S.test(t),r=Buffer.from(t,n?`hex`:`base64`);if(r.length!==32)throw Error(`Encryption key must decode to exactly 32 bytes (received ${r.length}). Use a 64-char hex string or 44-char base64 string.`);return r}var D=`http://`,O=`https://`;function k(e){let t=e.charCodeAt(0);return t>=65&&t<=90||t>=97&&t<=122}function A(e){let t=e.charCodeAt(0);return t>=48&&t<=57}function j(e){return e!==void 0&&(k(e)||A(e)||e===`_`)}function M(e){return k(e)||A(e)||e===`.`||e===`-`}function N(e){return e===`<`||e===`>`||e.trim()===``}function P(e,t,n){return e.slice(t,t+n.length).toLowerCase()===n}function F(e,t,n){let r=0;if(P(e,t,O)?r=O.length:P(e,t,D)&&(r=D.length),r===0||t+r>=n)return t;let i=t+r;for(;i<n&&!N(e[i]);)i+=1;return i}function I(e,t,n){if(!(k(e[t])||A(e[t]))||t>0&&M(e[t-1]))return t;let r=t;for(;r<n&&M(e[r]);)r+=1;let i=e[r];if(i!==`/`&&i!==`?`&&i!==`#`)return t;let a=e.slice(t,r),o=a.lastIndexOf(`.`),s=a.slice(o+1);if(o<=0||s.length<2)return t;for(let e of s)if(!k(e))return t;for(r+=1;r<n&&!N(e[r]);)r+=1;return r}function L(e,t,n){if(e[t]!=="`")return t;let r=e.startsWith("```",t),i=r?"```":"`",a=t+i.length,o=e.indexOf(i,a);if(o===-1||o>=n)return t;if(!r){let n=e.indexOf(`
|
|
5
|
+
`,a);if(n!==-1&&n<o)return t}return o+i.length}function R(e,t,n,r,i){let a=``,o=t;for(;o<n;){let t=L(e,o,n);if(t>o){a+=e.slice(o,t),o=t;continue}if(i&&e[o]===`<`){let t=o+1;for(;t<n&&e[t]!==`>`&&e[t]!==`
|
|
6
|
+
`&&e[t]!==`\r`;)t+=1;if(e[t]===`>`){a+=e.slice(o,t+1),o=t+1;continue}a+=R(e,o,t,r,!1),o=t;continue}let s=F(e,o,n);if(s>o){a+=e.slice(o,s),o=s;continue}let c=I(e,o,n);if(c>o){a+=e.slice(o,c),o=c;continue}if(e[o]===`@`&&e[o-1]!==`<`&&!j(e[o-1])&&j(e[o+1])){let t=o+2;for(;t<n&&j(e[t]);)t+=1;let i=e.slice(o,t);a+=r(i,i.slice(1)),o=t;continue}a+=e[o],o+=1}return a}function z(e,t){return R(e,0,e.length,t,!0)}export{_ as a,w as c,o as d,s as f,p as g,z as h,d as i,C as l,g as m,u as n,h as o,T as p,f as r,E as s,l as t,a as u};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { P as PostableObject, h as Adapter, i as PostableObjectContext, S as StreamChunk, j as ThreadHistoryCache, k as ThreadHistoryConfig, l as StreamEvent, E as EmojiFormats, m as EmojiMapConfig, n as EmojiValue, W as WellKnownEmoji, o as CustomEmojiMap, p as AdapterPostableMessage } from './messages-BSoJG691.js';
|
|
2
|
+
export { q as ActionEvent, r as ActionHandler, A as AiAssistantMessage, b as AiFilePart, c as AiImagePart, d as AiMessage, e as AiMessagePart, f as AiTextPart, g as AiUserMessage, s as AppContextCanvasEntity, u as AppContextChangedEvent, v as AppContextChangedHandler, w as AppContextChannelEntity, x as AppContextEntity, y as AppContextEntityBase, z as AppContextListEntity, B as AppContextMessageEntity, D as AppContextUnknownEntity, F as AppHomeOpenedEvent, G as AppHomeOpenedHandler, H as AppendInput, I as AppendOptions, J as AssistantContextChangedEvent, K as AssistantContextChangedHandler, L as AssistantThreadStartedEvent, N as AssistantThreadStartedHandler, O as Attachment, Q as Author, R as Channel, U as ChannelImpl, V as ChannelInfo, a as ChannelVisibility, C as Chat, X as ChatConfig, Y as ChatInstance, Z as ConcurrencyConfig, _ as ConcurrencyStrategy, $ as ConsoleLogger, a0 as CountQuery, a1 as DeleteTarget, a2 as DirectMessageHandler, a3 as DurationString, a4 as Emoji, a5 as EphemeralMessage, a6 as FetchDirection, a7 as FetchOptions, a8 as FetchResult, a9 as FileUpload, aa as FormattedContent, ab as IdentityContext, ac as IdentityResolver, ad as LinkPreview, ae as ListQuery, af as ListThreadsOptions, ag as ListThreadsResult, ah as Lock, ai as LockScope, aj as LockScopeContext, ak as LogLevel, al as Logger, am as MarkdownTextChunk, an as MemberJoinedChannelEvent, ao as MemberJoinedChannelHandler, ap as MentionHandler, M as Message, aq as MessageContext, ar as MessageData, as as MessageHandler, at as MessageMetadata, au as MessageSubject, av as ModalClearResponse, aw as ModalCloseEvent, ax as ModalCloseHandler, ay as ModalCloseResponse, az as ModalErrorsResponse, aA as ModalPushResponse, aB as ModalResponse, aC as ModalSubmitEvent, aD as ModalSubmitHandler, aE as ModalUpdateResponse, aF as OptionsLoadEvent, aG as OptionsLoadGroup, aH as OptionsLoadHandler, aI as OptionsLoadResult, aJ as PlanUpdateChunk, aK as PostEphemeralOptions, aL as Postable, aM as PostableAst, aN as PostableCard, aO as PostableMarkdown, aP as PostableMessage, aQ as PostableRaw, aR as QueueEntry, aS as RawMessage, aT as ReactionEvent, aU as ReactionHandler, aV as ScheduledMessage, aW as SentMessage, aX as SerializedChannel, aY as SerializedMessage, aZ as SerializedThread, a_ as SlashCommandEvent, a$ as SlashCommandHandler, b0 as StateAdapter, b1 as StreamOptions, b2 as SubscribedMessageHandler, b3 as THREAD_STATE_TTL_MS, b4 as TaskUpdateChunk, b5 as Thread, b6 as ThreadImpl, b7 as ThreadInfo, b8 as ThreadSummary, T as ToAiMessagesOptions, b9 as TranscriptEntry, ba as TranscriptRole, bb as TranscriptsApi, bc as TranscriptsConfig, bd as UserInfo, be as WebhookOptions, bf as deriveChannelId, bg as isPostableObject, t as toAiMessages } from './messages-BSoJG691.js';
|
|
3
3
|
import { Root, List, Content, Blockquote, Code, Emphasis, InlineCode, Delete, Link, ListItem, Paragraph, Strong, TableCell, Table as Table$1, TableRow, Text } from './_mdast.js';
|
|
4
4
|
export { Blockquote, Code, Content, Delete, Emphasis, InlineCode, Link, List, ListItem, Table as MdastTable, Nodes, Paragraph, Root, Strong, TableCell, TableRow, Text } from './_mdast.js';
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
5
|
+
import { C as CardElement, a as CardChild, b as ChartElement, A as ActionsComponent, B as ButtonComponent, c as CardComponent, d as CardLinkComponent, T as TextComponent, e as ChartComponent, D as DividerComponent, E as ExternalSelectComponent, F as FieldComponent, f as FieldsComponent, I as ImageComponent, L as LinkButtonComponent, M as ModalComponent, R as RadioSelectComponent, S as SectionComponent, g as SelectComponent, h as SelectOptionComponent, i as Table$2, j as TextInputComponent, k as cardChildToFallbackText$1, l as fromReactElement$1, m as fromReactModalElement$1, n as isCardElement$1, o as isJSX$1, p as isModalElement$1, t as toCardElement$1, q as toModalElement$1 } from './jsx-runtime-_JEEAotp.js';
|
|
6
|
+
export { r as ActionsElement, s as ButtonElement, u as ButtonOptions, v as ButtonProps, w as ButtonStyle, x as CardJSXElement, y as CardJSXProps, z as CardLinkProps, G as CardOptions, H as CardProps, J as ChartDataPoint, K as ChartDefinition, N as ChartOptions, O as ChartSegment, P as ChartSeries, Q as ChatElement, U as ContainerProps, V as DividerElement, W as DividerProps, X as ExternalSelectElement, Y as ExternalSelectOptions, Z as ExternalSelectProps, _ as FieldElement, $ as FieldProps, a0 as FieldsElement, a1 as ImageElement, a2 as ImageProps, a3 as LinkButtonElement, a4 as LinkButtonOptions, a5 as LinkButtonProps, a6 as LinkElement, a7 as ModalChild, a8 as ModalElement, a9 as ModalOptions, aa as ModalProps, ab as PieChartDefinition, ac as RadioSelectElement, ad as RadioSelectOptions, ae as SectionElement, af as SelectElement, ag as SelectOptionElement, ah as SelectOptionProps, ai as SelectOptions, aj as SelectProps, ak as SeriesChartDefinition, al as TableAlignment, am as TableElement, an as TableOptions, ao as TextElement, ap as TextInputElement, aq as TextInputOptions, ar as TextInputProps, as as TextProps, at as TextStyle } from './jsx-runtime-_JEEAotp.js';
|
|
7
7
|
import './_workflow-serde.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -53,6 +53,8 @@ interface StartPlanOptions {
|
|
|
53
53
|
initialMessage: PlanContent;
|
|
54
54
|
}
|
|
55
55
|
interface AddTaskOptions {
|
|
56
|
+
/** When true (default), mark existing in_progress tasks complete before adding. */
|
|
57
|
+
autoCompletePrevious?: boolean;
|
|
56
58
|
/** Task details/substeps. */
|
|
57
59
|
children?: PlanContent;
|
|
58
60
|
title: PlanContent;
|
|
@@ -74,6 +76,7 @@ interface CompletePlanOptions {
|
|
|
74
76
|
*
|
|
75
77
|
* Create a plan with `new Plan({ initialMessage: "..." })` and post it with `thread.post(plan)`.
|
|
76
78
|
* After posting, use methods like `addTask()`, `updateTask()`, and `complete()` to update it.
|
|
79
|
+
* For parallel steps, pass `autoCompletePrevious: false` to `addTask()` and use `updateTask({ id })` to update individual tasks.
|
|
77
80
|
*
|
|
78
81
|
* @example
|
|
79
82
|
* ```typescript
|
|
@@ -351,7 +354,7 @@ declare const defaultEmojiResolver: EmojiResolver;
|
|
|
351
354
|
* // Returns: "Thanks! 👍"
|
|
352
355
|
* ```
|
|
353
356
|
*/
|
|
354
|
-
declare function convertEmojiPlaceholders(text: string, platform: "slack" | "gchat" | "teams" | "discord" | "messenger" | "github" | "linear" | "whatsapp", resolver?: EmojiResolver): string;
|
|
357
|
+
declare function convertEmojiPlaceholders(text: string, platform: "slack" | "gchat" | "teams" | "discord" | "messenger" | "github" | "linear" | "whatsapp" | "x", resolver?: EmojiResolver): string;
|
|
355
358
|
/** Base emoji object with well-known emoji as EmojiValue singletons */
|
|
356
359
|
type BaseEmojiHelper = {
|
|
357
360
|
[K in WellKnownEmoji]: EmojiValue;
|
|
@@ -514,6 +517,13 @@ declare function tableToAscii(node: Table$1): string;
|
|
|
514
517
|
* Used for card TableElement fallback rendering.
|
|
515
518
|
*/
|
|
516
519
|
declare function tableElementToAscii(headers: string[], rows: string[][]): string;
|
|
520
|
+
/**
|
|
521
|
+
* Render a chart element as text: the title followed by the underlying
|
|
522
|
+
* data as a padded ASCII table.
|
|
523
|
+
* Used for card ChartElement fallback rendering on platforms without
|
|
524
|
+
* native chart support.
|
|
525
|
+
*/
|
|
526
|
+
declare function chartElementToFallbackText(element: ChartElement): string;
|
|
517
527
|
/**
|
|
518
528
|
* Get children from a content node that has children.
|
|
519
529
|
* Returns empty array for nodes without children.
|
|
@@ -689,6 +699,7 @@ declare const Card: CardComponent;
|
|
|
689
699
|
declare const cardChildToFallbackText: typeof cardChildToFallbackText$1;
|
|
690
700
|
declare const CardLink: CardLinkComponent;
|
|
691
701
|
declare const CardText: TextComponent;
|
|
702
|
+
declare const Chart: ChartComponent;
|
|
692
703
|
declare const Divider: DividerComponent;
|
|
693
704
|
declare const Field: FieldComponent;
|
|
694
705
|
declare const Fields: FieldsComponent;
|
|
@@ -711,4 +722,4 @@ declare const Select: SelectComponent;
|
|
|
711
722
|
declare const SelectOption: SelectOptionComponent;
|
|
712
723
|
declare const TextInput: TextInputComponent;
|
|
713
724
|
|
|
714
|
-
export { Actions, ActionsComponent, Adapter, AdapterPostableMessage, type AddTaskOptions, BaseFormatConverter, Button, ButtonComponent, Card, CardChild, CardComponent, CardElement, CardLink, CardLinkComponent, CardText, ChatError, type CompletePlanOptions, CustomEmojiMap, DEFAULT_EMOJI_MAP, Divider, DividerComponent, EmojiFormats, EmojiMapConfig, EmojiResolver, EmojiValue, ExternalSelect, ExternalSelectComponent, Field, FieldComponent, Fields, FieldsComponent, type FormatConverter, Image, ImageComponent, LinkButton, LinkButtonComponent, LockError, type MarkdownConverter, MessageHistoryCache, type MessageHistoryConfig, Modal, ModalComponent, NotImplementedError, Plan, type PlanContent, type PlanModel, type PlanModelTask, type PlanTask, type PlanTaskStatus, PostableObject, PostableObjectContext, RadioSelect, RadioSelectComponent, RateLimitError, Section, SectionComponent, Select, SelectComponent, SelectOption, SelectOptionComponent, type StartPlanOptions, StreamChunk, StreamEvent, StreamingMarkdownRenderer, StreamingPlan, type StreamingPlanData, type StreamingPlanOptions, Table, TextComponent, TextInput, TextInputComponent, ThreadHistoryCache, ThreadHistoryConfig, type UpdateTaskInput, WellKnownEmoji, blockquote, cardChildToFallbackText, codeBlock, convertEmojiPlaceholders, createEmoji, defaultEmojiResolver, emoji, emphasis, fromFullStream, fromReactElement, fromReactModalElement, getEmoji, getNodeChildren, getNodeValue, inlineCode, isBlockquoteNode, isCardElement, isCodeNode, isDeleteNode, isEmphasisNode, isInlineCodeNode, isJSX, isLinkNode, isListItemNode, isListNode, isModalElement, isParagraphNode, isStrongNode, isTableCellNode, isTableNode, isTableRowNode, isTextNode, link, markdownToPlainText, paragraph, parseMarkdown, reviver, root, strikethrough, stringifyMarkdown, strong, tableElementToAscii, tableToAscii, text, toCardElement, toModalElement, toPlainText, walkAst };
|
|
725
|
+
export { Actions, ActionsComponent, Adapter, AdapterPostableMessage, type AddTaskOptions, BaseFormatConverter, Button, ButtonComponent, Card, CardChild, CardComponent, CardElement, CardLink, CardLinkComponent, CardText, Chart, ChartElement, ChatError, type CompletePlanOptions, CustomEmojiMap, DEFAULT_EMOJI_MAP, Divider, DividerComponent, EmojiFormats, EmojiMapConfig, EmojiResolver, EmojiValue, ExternalSelect, ExternalSelectComponent, Field, FieldComponent, Fields, FieldsComponent, type FormatConverter, Image, ImageComponent, LinkButton, LinkButtonComponent, LockError, type MarkdownConverter, MessageHistoryCache, type MessageHistoryConfig, Modal, ModalComponent, NotImplementedError, Plan, type PlanContent, type PlanModel, type PlanModelTask, type PlanTask, type PlanTaskStatus, PostableObject, PostableObjectContext, RadioSelect, RadioSelectComponent, RateLimitError, Section, SectionComponent, Select, SelectComponent, SelectOption, SelectOptionComponent, type StartPlanOptions, StreamChunk, StreamEvent, StreamingMarkdownRenderer, StreamingPlan, type StreamingPlanData, type StreamingPlanOptions, Table, TextComponent, TextInput, TextInputComponent, ThreadHistoryCache, ThreadHistoryConfig, type UpdateTaskInput, WellKnownEmoji, blockquote, cardChildToFallbackText, chartElementToFallbackText, codeBlock, convertEmojiPlaceholders, createEmoji, defaultEmojiResolver, emoji, emphasis, fromFullStream, fromReactElement, fromReactModalElement, getEmoji, getNodeChildren, getNodeValue, inlineCode, isBlockquoteNode, isCardElement, isCodeNode, isDeleteNode, isEmphasisNode, isInlineCodeNode, isJSX, isLinkNode, isListItemNode, isListNode, isModalElement, isParagraphNode, isStrongNode, isTableCellNode, isTableNode, isTableRowNode, isTextNode, link, markdownToPlainText, paragraph, parseMarkdown, reviver, root, strikethrough, stringifyMarkdown, strong, tableElementToAscii, tableToAscii, text, toCardElement, toModalElement, toPlainText, walkAst };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l,F as u,
|
|
1
|
+
import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l,F as u,Ft as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,Mt as y,N as b,Nt as x,O as S,Ot as C,P as w,Pt as T,Q as E,R as D,S as O,St as k,T as A,Tt as j,U as M,V as N,W as P,X as F,Y as I,Z as L,_ as R,_t as z,a as B,at as V,b as H,bt as U,c as W,ct as G,d as K,dt as q,et as J,f as Y,ft as X,g as Z,gt as Q,h as $,ht as ee,i as te,it as ne,j as re,jt as ie,k as ae,kt as oe,l as se,lt as ce,m as le,mt as ue,n as de,nt as fe,o as pe,ot as me,p as he,pt as ge,q as _e,r as ve,rt as ye,s as be,st as xe,t as Se,tt as Ce,u as we,ut as Te,v as Ee,vt as De,w as Oe,wt as ke,x as Ae,xt as je,y as Me,yt as Ne,z as Pe}from"../_chunks/node/dist-BweCayKF.js";export{Se as Actions,Ce as BaseFormatConverter,de as Button,ve as Card,te as CardLink,B as CardText,pe as ChannelImpl,be as Chart,W as Chat,se as ChatError,we as ConsoleLogger,K as DEFAULT_EMOJI_MAP,Y as Divider,he as EmojiResolver,le as ExternalSelect,$ as Field,Z as Fields,R as Image,Ee as LinkButton,Me as LockError,H as Message,Ae as MessageHistoryCache,O as Modal,i as NotImplementedError,Oe as Plan,A as RadioSelect,c as RateLimitError,o as Section,S as Select,ae as SelectOption,t as StreamingMarkdownRenderer,re as StreamingPlan,v as THREAD_STATE_TTL_MS,b as Table,w as TextInput,u as ThreadHistoryCache,m as ThreadImpl,fe as blockquote,_ as cardChildToFallbackText,ye as chartElementToFallbackText,ne as codeBlock,D as convertEmojiPlaceholders,Pe as createEmoji,r as defaultEmojiResolver,N as deriveChannelId,p as emoji,V as emphasis,M as fromFullStream,P as fromReactElement,f as fromReactModalElement,g as getEmoji,me as getNodeChildren,xe as getNodeValue,G as inlineCode,ce as isBlockquoteNode,_e as isCardElement,Te as isCodeNode,q as isDeleteNode,X as isEmphasisNode,ge as isInlineCodeNode,h as isJSX,ue as isLinkNode,ee as isListItemNode,Q as isListNode,I as isModalElement,z as isParagraphNode,F as isPostableObject,De as isStrongNode,Ne as isTableCellNode,U as isTableNode,je as isTableRowNode,k as isTextNode,a as link,ke as markdownToPlainText,j as paragraph,l as parseMarkdown,L as reviver,s as root,C as strikethrough,oe as stringifyMarkdown,n as strong,ie as tableElementToAscii,y as tableToAscii,x as text,J as toAiMessages,E as toCardElement,e as toModalElement,T as toPlainText,d as walkAst};
|
|
@@ -138,14 +138,67 @@ type TableAlignment = "left" | "center" | "right";
|
|
|
138
138
|
interface TableElement {
|
|
139
139
|
/** Column alignment */
|
|
140
140
|
align?: TableAlignment[];
|
|
141
|
+
/** Accessible table caption (used by platforms with native table support) */
|
|
142
|
+
caption?: string;
|
|
141
143
|
/** Column header labels */
|
|
142
144
|
headers: string[];
|
|
145
|
+
/** Rows per page on platforms that paginate tables (Slack: 1-100, default 5) */
|
|
146
|
+
pageSize?: number;
|
|
143
147
|
/** Data rows (each row is an array of cell strings) */
|
|
144
148
|
rows: string[][];
|
|
145
149
|
type: "table";
|
|
146
150
|
}
|
|
151
|
+
/** Chart segment for pie charts */
|
|
152
|
+
interface ChartSegment {
|
|
153
|
+
/** Legend label (Slack: max 20 characters) */
|
|
154
|
+
label: string;
|
|
155
|
+
/** Segment value; must be greater than 0. Rendered as a percentage of the total. */
|
|
156
|
+
value: number;
|
|
157
|
+
}
|
|
158
|
+
/** A single data point within a chart series */
|
|
159
|
+
interface ChartDataPoint {
|
|
160
|
+
/** Category label; must match an entry in the chart's `categories` */
|
|
161
|
+
label: string;
|
|
162
|
+
/** Y-axis value (negative values are permitted) */
|
|
163
|
+
value: number;
|
|
164
|
+
}
|
|
165
|
+
/** A named data series for bar, area, and line charts */
|
|
166
|
+
interface ChartSeries {
|
|
167
|
+
/** One data point per category */
|
|
168
|
+
data: ChartDataPoint[];
|
|
169
|
+
/** Legend label; must be unique within the chart (Slack: max 20 characters) */
|
|
170
|
+
name: string;
|
|
171
|
+
}
|
|
172
|
+
/** Pie chart definition */
|
|
173
|
+
interface PieChartDefinition {
|
|
174
|
+
/** Pie segments (Slack: 1-12) */
|
|
175
|
+
segments: ChartSegment[];
|
|
176
|
+
type: "pie";
|
|
177
|
+
}
|
|
178
|
+
/** Bar, area, or line chart definition */
|
|
179
|
+
interface SeriesChartDefinition {
|
|
180
|
+
/** X-axis category labels in display order (Slack: max 20 characters each) */
|
|
181
|
+
categories: string[];
|
|
182
|
+
/** Data series (Slack: 1-12); each series needs one point per category */
|
|
183
|
+
series: ChartSeries[];
|
|
184
|
+
type: "area" | "bar" | "line";
|
|
185
|
+
/** X-axis title (Slack: max 50 characters) */
|
|
186
|
+
xLabel?: string;
|
|
187
|
+
/** Y-axis title (Slack: max 50 characters) */
|
|
188
|
+
yLabel?: string;
|
|
189
|
+
}
|
|
190
|
+
/** Chart definition, discriminated by chart type */
|
|
191
|
+
type ChartDefinition = PieChartDefinition | SeriesChartDefinition;
|
|
192
|
+
/** Chart element for data visualization */
|
|
193
|
+
interface ChartElement {
|
|
194
|
+
/** Chart definition */
|
|
195
|
+
chart: ChartDefinition;
|
|
196
|
+
/** Chart title (Slack: max 50 characters) */
|
|
197
|
+
title: string;
|
|
198
|
+
type: "chart";
|
|
199
|
+
}
|
|
147
200
|
/** Union of all card child element types */
|
|
148
|
-
type CardChild = TextElement | ImageElement | DividerElement | ActionsElement | SectionElement | FieldsElement | LinkElement | TableElement;
|
|
201
|
+
type CardChild = TextElement | ImageElement | DividerElement | ActionsElement | SectionElement | FieldsElement | LinkElement | TableElement | ChartElement;
|
|
149
202
|
/** Union of all element types (including nested children) */
|
|
150
203
|
type AnyCardElement = CardChild | CardElement | ButtonElement | LinkButtonElement | LinkElement | FieldElement | SelectElement | RadioSelectElement;
|
|
151
204
|
/** Root card element */
|
|
@@ -317,8 +370,12 @@ declare function Fields(children: FieldElement[]): FieldsElement;
|
|
|
317
370
|
interface TableOptions {
|
|
318
371
|
/** Column alignment */
|
|
319
372
|
align?: TableAlignment[];
|
|
373
|
+
/** Accessible table caption (used by platforms with native table support) */
|
|
374
|
+
caption?: string;
|
|
320
375
|
/** Column header labels */
|
|
321
376
|
headers: string[];
|
|
377
|
+
/** Rows per page on platforms that paginate tables (Slack: 1-100, default 5) */
|
|
378
|
+
pageSize?: number;
|
|
322
379
|
/** Data rows */
|
|
323
380
|
rows: string[][];
|
|
324
381
|
}
|
|
@@ -337,6 +394,53 @@ interface TableOptions {
|
|
|
337
394
|
* ```
|
|
338
395
|
*/
|
|
339
396
|
declare function Table(options: TableOptions): TableElement;
|
|
397
|
+
/** Options for Chart */
|
|
398
|
+
interface ChartOptions {
|
|
399
|
+
/** Chart definition (pie segments, or bar/area/line series with categories) */
|
|
400
|
+
chart: ChartDefinition;
|
|
401
|
+
/** Chart title (Slack: max 50 characters) */
|
|
402
|
+
title: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Create a Chart element for data visualization.
|
|
406
|
+
*
|
|
407
|
+
* @example Pie chart
|
|
408
|
+
* ```ts
|
|
409
|
+
* Chart({
|
|
410
|
+
* title: "My Favorite Candy Bars",
|
|
411
|
+
* chart: {
|
|
412
|
+
* type: "pie",
|
|
413
|
+
* segments: [
|
|
414
|
+
* { label: "Kit Kat", value: 45 },
|
|
415
|
+
* { label: "Twix", value: 28 },
|
|
416
|
+
* ],
|
|
417
|
+
* },
|
|
418
|
+
* })
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
421
|
+
* @example Line chart
|
|
422
|
+
* ```ts
|
|
423
|
+
* Chart({
|
|
424
|
+
* title: "Weekly Sales",
|
|
425
|
+
* chart: {
|
|
426
|
+
* type: "line",
|
|
427
|
+
* categories: ["Week 1", "Week 2"],
|
|
428
|
+
* xLabel: "Week",
|
|
429
|
+
* yLabel: "Sales",
|
|
430
|
+
* series: [
|
|
431
|
+
* {
|
|
432
|
+
* name: "Scranton",
|
|
433
|
+
* data: [
|
|
434
|
+
* { label: "Week 1", value: 120 },
|
|
435
|
+
* { label: "Week 2", value: 135 },
|
|
436
|
+
* ],
|
|
437
|
+
* },
|
|
438
|
+
* ],
|
|
439
|
+
* },
|
|
440
|
+
* })
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
declare function Chart(options: ChartOptions): ChartElement;
|
|
340
444
|
/**
|
|
341
445
|
* Create a CardLink element for inline hyperlinks.
|
|
342
446
|
*
|
|
@@ -627,13 +731,20 @@ interface SelectOptionProps {
|
|
|
627
731
|
}
|
|
628
732
|
/** Props for Table component in JSX */
|
|
629
733
|
interface TableProps {
|
|
734
|
+
caption?: string;
|
|
630
735
|
headers: string[];
|
|
736
|
+
pageSize?: number;
|
|
631
737
|
rows: string[][];
|
|
632
738
|
}
|
|
739
|
+
/** Props for Chart component in JSX */
|
|
740
|
+
interface ChartProps {
|
|
741
|
+
chart: ChartDefinition;
|
|
742
|
+
title: string;
|
|
743
|
+
}
|
|
633
744
|
/** Union of all valid JSX props */
|
|
634
|
-
type CardJSXProps = CardProps | TextProps | ButtonProps | LinkButtonProps | CardLinkProps | ImageProps | FieldProps | ContainerProps | DividerProps | ModalProps | TextInputProps | SelectProps | ExternalSelectProps | SelectOptionProps | TableProps;
|
|
745
|
+
type CardJSXProps = CardProps | TextProps | ButtonProps | LinkButtonProps | CardLinkProps | ImageProps | FieldProps | ContainerProps | DividerProps | ModalProps | TextInputProps | SelectProps | ExternalSelectProps | SelectOptionProps | TableProps | ChartProps;
|
|
635
746
|
/** Component function type with proper overloads */
|
|
636
|
-
type CardComponentFunction = typeof Card | typeof Text | typeof Button | typeof LinkButton | typeof CardLink | typeof Image | typeof Field | typeof Divider | typeof Section | typeof Actions | typeof Fields | typeof Modal | typeof TextInput | typeof Select | typeof ExternalSelect | typeof RadioSelect | typeof SelectOption | typeof Table;
|
|
747
|
+
type CardComponentFunction = typeof Card | typeof Text | typeof Button | typeof LinkButton | typeof CardLink | typeof Image | typeof Field | typeof Divider | typeof Section | typeof Actions | typeof Fields | typeof Modal | typeof TextInput | typeof Select | typeof ExternalSelect | typeof RadioSelect | typeof SelectOption | typeof Table | typeof Chart;
|
|
637
748
|
/**
|
|
638
749
|
* Represents a JSX element from the chat JSX runtime.
|
|
639
750
|
* This is the type returned when using JSX syntax with chat components.
|
|
@@ -645,7 +756,7 @@ interface CardJSXElement<P extends CardJSXProps = CardJSXProps> {
|
|
|
645
756
|
type: CardComponentFunction;
|
|
646
757
|
}
|
|
647
758
|
/** Union of all element types that can be produced by chat components */
|
|
648
|
-
type ChatElement = CardJSXElement | CardElement | TextElement | ButtonElement | LinkButtonElement | LinkElement | ImageElement | DividerElement | ActionsElement | SectionElement | FieldsElement | FieldElement | ModalElement | TextInputElement | SelectElement | ExternalSelectElement | SelectOptionElement | RadioSelectElement | TableElement;
|
|
759
|
+
type ChatElement = CardJSXElement | CardElement | TextElement | ButtonElement | LinkButtonElement | LinkElement | ImageElement | DividerElement | ActionsElement | SectionElement | FieldsElement | FieldElement | ModalElement | TextInputElement | SelectElement | ExternalSelectElement | SelectOptionElement | RadioSelectElement | TableElement | ChartElement;
|
|
649
760
|
interface CardComponent {
|
|
650
761
|
(options?: CardOptions): CardElement;
|
|
651
762
|
(props: CardProps): ChatElement;
|
|
@@ -731,11 +842,20 @@ interface RadioSelectComponent {
|
|
|
731
842
|
}
|
|
732
843
|
interface TableComponent {
|
|
733
844
|
(options: {
|
|
845
|
+
caption?: string;
|
|
734
846
|
headers: string[];
|
|
847
|
+
pageSize?: number;
|
|
735
848
|
rows: string[][];
|
|
736
849
|
}): TableElement;
|
|
737
850
|
(props: TableProps): ChatElement;
|
|
738
851
|
}
|
|
852
|
+
interface ChartComponent {
|
|
853
|
+
(options: {
|
|
854
|
+
chart: ChartDefinition;
|
|
855
|
+
title: string;
|
|
856
|
+
}): ChartElement;
|
|
857
|
+
(props: ChartProps): ChatElement;
|
|
858
|
+
}
|
|
739
859
|
/**
|
|
740
860
|
* Type guard to check if props match CardLinkProps
|
|
741
861
|
*/
|
|
@@ -784,4 +904,4 @@ declare namespace JSX {
|
|
|
784
904
|
}
|
|
785
905
|
}
|
|
786
906
|
|
|
787
|
-
export { type
|
|
907
|
+
export { type FieldProps as $, type ActionsComponent as A, type ButtonComponent as B, type CardElement as C, type DividerComponent as D, type ExternalSelectComponent as E, type FieldComponent as F, type CardOptions as G, type CardProps as H, type ImageComponent as I, type ChartDataPoint as J, type ChartDefinition as K, type LinkButtonComponent as L, type ModalComponent as M, type ChartOptions as N, type ChartSegment as O, type ChartSeries as P, type ChatElement as Q, type RadioSelectComponent as R, type SectionComponent as S, type TextComponent as T, type ContainerProps as U, type DividerElement as V, type DividerProps as W, type ExternalSelectElement as X, type ExternalSelectOptions as Y, type ExternalSelectProps as Z, type FieldElement as _, type CardChild as a, type FieldsElement as a0, type ImageElement as a1, type ImageProps as a2, type LinkButtonElement as a3, type LinkButtonOptions as a4, type LinkButtonProps as a5, type LinkElement as a6, type ModalChild as a7, type ModalElement as a8, type ModalOptions as a9, jsx as aA, jsxDEV as aB, jsxs as aC, type ModalProps as aa, type PieChartDefinition as ab, type RadioSelectElement as ac, type RadioSelectOptions as ad, type SectionElement as ae, type SelectElement as af, type SelectOptionElement as ag, type SelectOptionProps as ah, type SelectOptions as ai, type SelectProps as aj, type SeriesChartDefinition as ak, type TableAlignment as al, type TableElement as am, type TableOptions as an, type TextElement as ao, type TextInputElement as ap, type TextInputOptions as aq, type TextInputProps as ar, type TextProps as as, type TextStyle as at, type ChartProps as au, Fragment as av, JSX as aw, type TableComponent as ax, type TableProps as ay, isCardLinkProps as az, type ChartElement as b, type CardComponent as c, type CardLinkComponent as d, type ChartComponent as e, type FieldsComponent as f, type SelectComponent as g, type SelectOptionComponent as h, Table as i, type TextInputComponent as j, cardChildToFallbackText as k, fromReactElement as l, fromReactModalElement as m, isCardElement as n, isJSX as o, isModalElement as p, toModalElement as q, type ActionsElement as r, type ButtonElement as s, toCardElement as t, type ButtonOptions as u, type ButtonProps as v, type ButtonStyle as w, type CardJSXElement as x, type CardJSXProps as y, type CardLinkProps as z };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{mkdir,readFile,writeFile}from"node:fs/promises";const COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND=`eve-model-catalog-cache`,catalogModelProviderSchema=z.object({provider:z.string().min(1),providerModelId:z.string().min(1),contextWindowTokens:z.number().int().nonnegative().optional(),maxOutputTokens:z.number().int().nonnegative().optional()}).passthrough(),catalogModelSchema=z.object({slug:z.string().min(1),providers:z.array(catalogModelProviderSchema).min(1)}).passthrough(),modelCatalogResponseSchema=z.object({models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string())}).passthrough();z.object({contextWindowTokens:z.number().int().positive(),maxOutputTokens:z.number().int().positive().optional()}).strict();const compiledRuntimeModelCatalogCacheSchema=z.object({fetchedAt:z.string(),kind:z.literal(COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND),models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string()),version:z.literal(2)}).strict(),builtInCompiledRuntimeModelLimitsById=new Map([[`anthropic/claude-opus-4.7`,{contextWindowTokens:2e5,maxOutputTokens:32e3}],[`openai/gpt-5.4`,{contextWindowTokens:4e5,maxOutputTokens:128e3}],[`openai/gpt-5.4-mini`,{contextWindowTokens:4e5,maxOutputTokens:128e3}]]);function resolveCompiledRuntimeModelCatalogCachePath(e){return join(e,`.eve`,`cache`,`model-catalog.json`)}function createCompiledRuntimeModelCatalogLoader(e){let t=null,n=null,r=null,getCachedCatalog=async()=>(t??=readModelCatalogCache(e),await t),getFetchedCatalog=async()=>{if(n!==null)throw n;if(r!==null)return await r;r=fetchAndPersistModelCatalog(e).then(e=>(t=Promise.resolve(e),e));try{return await r}catch(e){throw n=e,e}},resolveModelsFromCacheOrFetch=async()=>{let e=await getCachedCatalog();if(e!==null&&isCacheFresh(e))return e;try{return await getFetchedCatalog()}catch{return e===null?null:e}};return{async getModelLimits(e){let t=normalizeModelId(e),n=await resolveModelsFromCacheOrFetch();if(n!==null){let e=findBySlug(n.models,t);if(e)for(let t of e.providers){let e=limitsFromProvider(t);if(e!==null)return e}}return builtInCompiledRuntimeModelLimitsById.get(t)??null},async getByProviderModelId(e,t){let n=await resolveModelsFromCacheOrFetch();if(n===null)return null;let r=e.split(`.`)[0],i=n.providerAliases[r]??r,a=normalizeModelId(t);for(let e of n.models)for(let t of e.providers)if(t.provider===i&&normalizeModelId(t.providerModelId)===a){let n=limitsFromProvider(t);if(n!==null)return{slug:e.slug,limits:n}}return null}}}async function fetchAndPersistModelCatalog(e){let r=await
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{mkdir,readFile,writeFile}from"node:fs/promises";import{AI_GATEWAY_MODELS_CATALOG_URL,vercelGatewayFetch}from"#internal/gateway.js";const COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND=`eve-model-catalog-cache`,catalogModelProviderSchema=z.object({provider:z.string().min(1),providerModelId:z.string().min(1),contextWindowTokens:z.number().int().nonnegative().optional(),maxOutputTokens:z.number().int().nonnegative().optional()}).passthrough(),catalogModelSchema=z.object({slug:z.string().min(1),providers:z.array(catalogModelProviderSchema).min(1)}).passthrough(),modelCatalogResponseSchema=z.object({models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string())}).passthrough();z.object({contextWindowTokens:z.number().int().positive(),maxOutputTokens:z.number().int().positive().optional()}).strict();const compiledRuntimeModelCatalogCacheSchema=z.object({fetchedAt:z.string(),kind:z.literal(COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND),models:z.array(catalogModelSchema),providerAliases:z.record(z.string(),z.string()),version:z.literal(2)}).strict(),builtInCompiledRuntimeModelLimitsById=new Map([[`anthropic/claude-opus-4.7`,{contextWindowTokens:2e5,maxOutputTokens:32e3}],[`openai/gpt-5.4`,{contextWindowTokens:4e5,maxOutputTokens:128e3}],[`openai/gpt-5.4-mini`,{contextWindowTokens:4e5,maxOutputTokens:128e3}]]);function resolveCompiledRuntimeModelCatalogCachePath(e){return join(e,`.eve`,`cache`,`model-catalog.json`)}function createCompiledRuntimeModelCatalogLoader(e){let t=null,n=null,r=null,getCachedCatalog=async()=>(t??=readModelCatalogCache(e),await t),getFetchedCatalog=async()=>{if(n!==null)throw n;if(r!==null)return await r;r=fetchAndPersistModelCatalog(e).then(e=>(t=Promise.resolve(e),e));try{return await r}catch(e){throw n=e,e}},resolveModelsFromCacheOrFetch=async()=>{let e=await getCachedCatalog();if(e!==null&&isCacheFresh(e))return e;try{return await getFetchedCatalog()}catch{return e===null?null:e}};return{async getModelLimits(e){let t=normalizeModelId(e),n=await resolveModelsFromCacheOrFetch();if(n!==null){let e=findBySlug(n.models,t);if(e)for(let t of e.providers){let e=limitsFromProvider(t);if(e!==null)return e}}return builtInCompiledRuntimeModelLimitsById.get(t)??null},async getByProviderModelId(e,t){let n=await resolveModelsFromCacheOrFetch();if(n===null)return null;let r=e.split(`.`)[0],i=n.providerAliases[r]??r,a=normalizeModelId(t);for(let e of n.models)for(let t of e.providers)if(t.provider===i&&normalizeModelId(t.providerModelId)===a){let n=limitsFromProvider(t);if(n!==null)return{slug:e.slug,limits:n}}return null}}}async function fetchAndPersistModelCatalog(e){let r=await vercelGatewayFetch(AI_GATEWAY_MODELS_CATALOG_URL);if(!r.ok)throw Error(`AI Gateway model catalog request failed with HTTP ${r.status} ${r.statusText}.`);let o=modelCatalogResponseSchema.safeParse(await r.json());if(!o.success)throw Error(`AI Gateway model catalog response did not match the expected schema.`);let s={fetchedAt:new Date().toISOString(),kind:COMPILED_RUNTIME_MODEL_CATALOG_CACHE_KIND,models:o.data.models,providerAliases:o.data.providerAliases,version:2};try{let r=resolveCompiledRuntimeModelCatalogCachePath(e);await mkdir(join(e,`.eve`,`cache`),{recursive:!0}),await writeFile(r,`${JSON.stringify(s,null,2)}\n`,`utf8`)}catch{}return s}async function readModelCatalogCache(e){try{let t=await readFile(resolveCompiledRuntimeModelCatalogCachePath(e),`utf8`),n=compiledRuntimeModelCatalogCacheSchema.safeParse(JSON.parse(t));return n.success?n.data:null}catch(e){return e instanceof Error&&`code`in e&&typeof e.code==`string`&&e.code,null}}function findBySlug(e,t){return e.find(e=>e.slug===t)}function limitsFromProvider(e){return e.contextWindowTokens===void 0||e.contextWindowTokens<=0?null:{contextWindowTokens:e.contextWindowTokens,...e.maxOutputTokens!==void 0&&e.maxOutputTokens>0&&{maxOutputTokens:e.maxOutputTokens}}}function isCacheFresh(e){let t=Date.parse(e.fetchedAt);return Number.isFinite(t)?Date.now()-t<=864e5:!1}function normalizeModelId(e){return e.endsWith(`-thinking`)?e.slice(0,-9):e}export{catalogModelProviderSchema,catalogModelSchema,createCompiledRuntimeModelCatalogLoader,modelCatalogResponseSchema,resolveCompiledRuntimeModelCatalogCachePath};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1/node_modules/autoevals/jsdist/index.js";import{toInputSchema}from"#shared/tool-schema.js";import{generateText}from"ai";function createAutoevalsClient(e){return{chat:{completions:{create:t=>createChatCompletion(t,e)}}}}async function createChatCompletion(e,
|
|
1
|
+
import"../node_modules/.pnpm/autoevals@0.0.132_ws@8.21.1/node_modules/autoevals/jsdist/index.js";import{toInputSchema}from"#shared/tool-schema.js";import{resolveProviderHeaders}from"#internal/gateway.js";import{generateText}from"ai";function createAutoevalsClient(e){return{chat:{completions:{create:t=>createChatCompletion(t,e)}}}}async function createChatCompletion(e,r){let i=convertTools(e.tools),a=await generateText({headers:resolveProviderHeaders(r.languageModel),model:r.languageModel,messages:convertMessages(e.messages??[]),tools:Object.keys(i).length>0?i:void 0,toolChoice:convertToolChoice(e.tool_choice),providerOptions:r.providerOptions}),o=a.toolCalls.map(e=>({id:e.toolCallId,type:`function`,function:{name:e.toolName,arguments:JSON.stringify(e.input??{})}}));return{choices:[{index:0,finish_reason:o.length>0?`tool_calls`:`stop`,message:{role:`assistant`,content:a.text||null,tool_calls:o.length>0?o:void 0}}]}}function convertMessages(e){return e.map(e=>{let t=contentToText(e.content);switch(e.role){case`assistant`:return{role:`assistant`,content:t};case`developer`:case`system`:return{role:`system`,content:t};default:return{role:`user`,content:t}}})}function contentToText(e){return e==null?``:typeof e==`string`?e:e.map(e=>e.text??``).filter(Boolean).join(`
|
|
2
2
|
`)}function convertTools(t){let n={};for(let r of t??[])r.type!==`function`||r.function?.name===void 0||(n[r.function.name]={description:r.function.description,inputSchema:toInputSchema(r.function.parameters??{})});return n}function convertToolChoice(e){if(e!==void 0)return typeof e==`string`?e:{type:`tool`,toolName:e.function.name}}export{createAutoevalsClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getVercelOidcToken}from"#compiled/@vercel/oidc/index.js";import{decodeVercelOidcTokenClaims}from"#shared/vercel-project.js";import{
|
|
1
|
+
import{getVercelOidcToken}from"#compiled/@vercel/oidc/index.js";import{decodeVercelOidcTokenClaims}from"#shared/vercel-project.js";import{withPackageUserAgent}from"#internal/user-agent.js";function getVercelSandboxFetch(e){let t=e.fetch;return withPackageUserAgent(t)}async function getVercelSandboxCredentials(t){let n=readNonEmptyString(t,`teamId`)??readNonEmptyEnvironmentVariable(`VERCEL_TEAM_ID`)??readNonEmptyEnvironmentVariable(`VERCEL_ORG_ID`),r=readNonEmptyString(t,`projectId`)??readNonEmptyEnvironmentVariable(`VERCEL_PROJECT_ID`),i=readNonEmptyString(t,`token`)??readNonEmptyEnvironmentVariable(`VERCEL_OIDC_TOKEN`)??readNonEmptyEnvironmentVariable(`VERCEL_TOKEN`);return i&&n&&r?{projectId:r,teamId:n,token:i}:getVercelSandboxCredentialsFromOidcToken(await getVercelOidcToken({project:r,team:n}))}function readNonEmptyString(e,t){let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function readNonEmptyEnvironmentVariable(e){let t=process.env[e];return typeof t==`string`&&t.trim().length>0?t.trim():void 0}function getVercelSandboxCredentialsFromOidcToken(e){let n=decodeVercelOidcTokenClaims(e);if(n.ownerId===void 0||n.projectId===void 0)throw Error(`Invalid Vercel OIDC token: missing owner_id or project_id.`);return{projectId:n.projectId,teamId:n.ownerId,token:e}}export{getVercelSandboxCredentials,getVercelSandboxFetch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getVercelSandboxCredentials,getVercelSandboxFetch}from"#execution/sandbox/bindings/vercel-credentials.js";async function getNamedVercelSandbox(e){try{return await e.sandboxModule.Sandbox.get(await getVercelSandboxGetOptions(e))}catch(t){if(isSandboxMissingError(t))return null;throw Error(`Failed to look up Vercel sandbox "${e.sandboxName}": ${errorMessage(t)}`,{cause:t})}}async function getVercelSandboxGetOptions(n){let r={name:n.sandboxName,resume:!1};try{let
|
|
1
|
+
import{getVercelSandboxCredentials,getVercelSandboxFetch}from"#execution/sandbox/bindings/vercel-credentials.js";async function getNamedVercelSandbox(e){try{return await e.sandboxModule.Sandbox.get(await getVercelSandboxGetOptions(e))}catch(t){if(isSandboxMissingError(t))return null;throw Error(`Failed to look up Vercel sandbox "${e.sandboxName}": ${errorMessage(t)}`,{cause:t})}}async function getVercelSandboxGetOptions(n){let r={fetch:getVercelSandboxFetch(n.createOptions),name:n.sandboxName,resume:!1};try{let t=await getVercelSandboxCredentials(n.createOptions);return{...r,...t,signal:n.createOptions.signal}}catch{return r}}function isSandboxMissingError(e){return e instanceof Error?(e.response?.status??e.cause?.response?.status)===404:!1}function errorMessage(e){if(e instanceof Error){let t=e.json,n=e.text,r=typeof n==`string`&&n.length>0?n:t===void 0?void 0:JSON.stringify(t);return r===void 0?e.message:`${e.message}: ${r}`}return String(e)}export{getNamedVercelSandbox};
|
|
@@ -43,7 +43,6 @@ export interface CreateSessionInput {
|
|
|
43
43
|
readonly turnAgent: RuntimeTurnAgent;
|
|
44
44
|
readonly limits?: AuthoredSessionLimits;
|
|
45
45
|
readonly outputSchema?: HarnessSession["outputSchema"];
|
|
46
|
-
readonly skillRoot?: string;
|
|
47
46
|
readonly subagentDepth?: number;
|
|
48
47
|
readonly workflowMaxSubagents?: number;
|
|
49
48
|
}
|
|
@@ -60,7 +59,6 @@ export declare function refreshSessionFromTurnAgent(input: {
|
|
|
60
59
|
readonly compactionOverrides?: {
|
|
61
60
|
readonly thresholdPercent?: number;
|
|
62
61
|
};
|
|
63
|
-
readonly skillRoot?: string;
|
|
64
62
|
}): HarnessSession;
|
|
65
63
|
/**
|
|
66
64
|
* Mints a continuation token for a delegated subagent session.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION=4e7;function createCompactionConfig(e={}){let t=e.thresholdPercent??.9,n={recentWindowSize:10,threshold:e.contextWindowTokens===void 0?1e5:Math.max(1,Math.floor(e.contextWindowTokens*t))};return e.lastKnownInputTokens===void 0?n:{...n,lastKnownInputTokens:e.lastKnownInputTokens,lastKnownPromptMessageCount:e.lastKnownPromptMessageCount}}function createSession(e){let{turnAgent:t}=e,n=createSessionToolDefinitions(t),r={agent:{compactionModelReference:t.compactionModel,dynamicModelDefaultReference:t.dynamicModel===void 0?void 0:t.model,modelReference:t.model,reasoning:t.reasoning,system:createSessionSystemPrompt({
|
|
1
|
+
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION=4e7;function createCompactionConfig(e={}){let t=e.thresholdPercent??.9,n={recentWindowSize:10,threshold:e.contextWindowTokens===void 0?1e5:Math.max(1,Math.floor(e.contextWindowTokens*t))};return e.lastKnownInputTokens===void 0?n:{...n,lastKnownInputTokens:e.lastKnownInputTokens,lastKnownPromptMessageCount:e.lastKnownPromptMessageCount}}function createSession(e){let{turnAgent:t}=e,n=createSessionToolDefinitions(t),r={agent:{compactionModelReference:t.compactionModel,dynamicModelDefaultReference:t.dynamicModel===void 0?void 0:t.model,modelReference:t.model,reasoning:t.reasoning,system:createSessionSystemPrompt({turnAgent:t}),tools:n},compaction:createCompactionConfig({contextWindowTokens:t.model.contextWindowTokens,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:e.continuationToken,history:[],sessionId:e.sessionId};return e.rootSessionId!==void 0&&(r.rootSessionId=e.rootSessionId),r.limits=resolveSessionLimits(e),e.outputSchema!==void 0&&(r.outputSchema=e.outputSchema),e.subagentDepth!==void 0&&(r.subagentDepth=e.subagentDepth),e.workflowMaxSubagents!==void 0&&(r.workflowMaxSubagents=e.workflowMaxSubagents),r}function refreshSessionFromTurnAgent(e){return{...e.session,agent:{compactionModelReference:e.turnAgent.compactionModel,dynamicModelDefaultReference:e.turnAgent.dynamicModel===void 0?void 0:e.turnAgent.model,modelReference:e.turnAgent.model,reasoning:e.turnAgent.reasoning,system:createSessionSystemPrompt({turnAgent:e.turnAgent}),tools:createSessionToolDefinitions(e.turnAgent)},compaction:createCompactionConfig({contextWindowTokens:e.turnAgent.model.contextWindowTokens,lastKnownInputTokens:e.session.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.session.compaction.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent})}}function createSessionSystemPrompt(t){let n=formatAvailableSkillsSection(t.turnAgent.availableSkills??[]);return(n===null?t.turnAgent.instructions:[...t.turnAgent.instructions,n]).join(`
|
|
2
2
|
|
|
3
3
|
`)}function mintSubagentContinuationToken(e){return`subagent:${e??crypto.randomUUID()}`}function projectToDurableSession(e){let t={agent:{system:e.agent.system},continuationToken:e.continuationToken,history:e.history,sessionId:e.sessionId};return(e.compaction.lastKnownInputTokens!==void 0||e.compaction.lastKnownPromptMessageCount!==void 0)&&(t.compaction={lastKnownInputTokens:e.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.compaction.lastKnownPromptMessageCount}),e.rootSessionId!==void 0&&(t.rootSessionId=e.rootSessionId),e.limits!==void 0&&(t.limits=e.limits),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),e.sandboxState!==void 0&&(t.sandboxState=e.sandboxState),e.state!==void 0&&(t.state=e.state),e.subagentDepth!==void 0&&(t.subagentDepth=e.subagentDepth),e.workflowMaxSubagents!==void 0&&(t.workflowMaxSubagents=e.workflowMaxSubagents),t}function hydrateDurableSession(e){let{durable:t,turnAgent:n}=e,r=createSessionToolDefinitions(n),i={agent:{compactionModelReference:n.compactionModel,dynamicModelDefaultReference:n.dynamicModel===void 0?void 0:n.model,modelReference:n.model,reasoning:n.reasoning,system:t.agent.system,tools:r},compaction:createCompactionConfig({contextWindowTokens:n.model.contextWindowTokens,lastKnownInputTokens:t.compaction?.lastKnownInputTokens,lastKnownPromptMessageCount:t.compaction?.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:t.continuationToken,history:t.history,sessionId:t.sessionId};return t.rootSessionId!==void 0&&(i.rootSessionId=t.rootSessionId),t.limits!==void 0&&(i.limits=t.limits),t.outputSchema!==void 0&&(i.outputSchema=t.outputSchema),t.sandboxState!==void 0&&(i.sandboxState=t.sandboxState),t.state!==void 0&&(i.state=t.state),t.subagentDepth!==void 0&&(i.subagentDepth=t.subagentDepth),t.workflowMaxSubagents!==void 0&&(i.workflowMaxSubagents=t.workflowMaxSubagents),i}function createSessionToolDefinitions(e){return e.tools.map(e=>({description:e.description??``,inputSchema:e.inputSchema,name:e.name,outputSchema:e.outputSchema}))}function resolveSessionLimits(e){let n=e.subagentDepth!==void 0&&e.subagentDepth>0,r=resolveSessionTokenLimit({authored:e.limits?.maxInputTokensPerSession,fallback:n?void 0:DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION}),i=resolveSessionTokenLimit({authored:e.limits?.maxOutputTokensPerSession,fallback:void 0}),a={};return r!==void 0&&(a.maxInputTokensPerSession=r),i!==void 0&&(a.maxOutputTokensPerSession=i),a}function resolveSessionTokenLimit(e){return e.authored===!1?void 0:e.authored??e.fallback}export{DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION,createCompactionConfig,createSession,hydrateDurableSession,mintSubagentContinuationToken,projectToDurableSession,refreshSessionFromTurnAgent};
|
|
@@ -10,9 +10,9 @@ interface FormatAvailableSkillsSectionOptions {
|
|
|
10
10
|
*
|
|
11
11
|
* All skills are always listed regardless of activation state. Active skill
|
|
12
12
|
* instructions are never injected into the system prompt — the model already
|
|
13
|
-
* has them from the `load_skill` tool result.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* has them from the `load_skill` tool result. Without an active sandbox root,
|
|
14
|
+
* the formatter uses the canonical symbolic skill root so supporting files
|
|
15
|
+
* remain discoverable without provisioning a sandbox.
|
|
16
16
|
*
|
|
17
17
|
* Authored skills call this at graph resolution time so the section is
|
|
18
18
|
* part of the turn agent's static instructions. Dynamic skills
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function formatAvailableSkillsSection(e,t={}){return e.length===0?null:[`Available skills`,`Listed skills are available in this run. Do not claim a listed skill is inaccessible unless activation or workspace inspection actually fails.`,`If the user names a skill or the request clearly matches one of the descriptions below, call load_skill before proceeding.`,`If multiple skills match, activate the minimal set that covers the task. After activation, follow the returned instructions instead of improvising around them.`,`If activation fails, say so briefly and continue with the best available alternative.`,formatSkillLocationLine(t),"When a loaded SKILL.md mentions sibling files such as `references/foo.md`, resolve them relative to the directory containing that specific SKILL.md.",...e.map(e=>formatAvailableSkillLine({skill:e,skillRoot:t.skillRoot}))].join(`
|
|
2
|
-
`)}function formatSkillLocationLine(
|
|
1
|
+
import{FALLBACK_SKILL_ROOT,MODEL_SKILL_ROOT}from"#shared/skill-paths.js";function formatAvailableSkillsSection(e,t={}){return e.length===0?null:[`Available skills`,`Listed skills are available in this run. Do not claim a listed skill is inaccessible unless activation or workspace inspection actually fails.`,`If the user names a skill or the request clearly matches one of the descriptions below, call load_skill before proceeding.`,`If multiple skills match, activate the minimal set that covers the task. After activation, follow the returned instructions instead of improvising around them.`,`If activation fails, say so briefly and continue with the best available alternative.`,formatSkillLocationLine(t),"When a loaded SKILL.md mentions sibling files such as `references/foo.md`, resolve them relative to the directory containing that specific SKILL.md.",...e.map(e=>formatAvailableSkillLine({skill:e,skillRoot:t.skillRoot}))].join(`
|
|
2
|
+
`)}function formatSkillLocationLine(n){return n.skillRoot===void 0?`Skill files live under \`${MODEL_SKILL_ROOT}/<skill>/\`, with \`${FALLBACK_SKILL_ROOT}/<skill>/\` as the fallback when \`$HOME\` is unavailable.`:`Skill files live under \`${n.skillRoot}/<skill>/\`.`}function formatAvailableSkillLine(e){return`${`- ${e.skill.name}: ${e.skill.description}`} (path: ${e.skillRoot??MODEL_SKILL_ROOT}/${e.skill.name}/SKILL.md)`}export{formatAvailableSkillsSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callAdapterEventHandler,defaultDeliverResult}from"#channel/adapter.js";import{AuthKey,CapabilitiesKey,ModeKey}from"#context/keys.js";import{createAuthorizationCompletedEvent,encodeMessageStreamEvent,timestampHandleMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{getHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{createWorkflowRuntime,startWorkflowPreferLatest,turnWorkflowReference}from"#execution/workflow-runtime.js";import{getPendingRuntimeActionBatch}from"#harness/runtime-actions.js";import{hydrateDurableSession,refreshSessionFromTurnAgent}from"#execution/session.js";import{resumeHook}from"#internal/workflow/runtime.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{getPendingWorkflowInterrupt}from"#harness/workflow-interrupt-state.js";import{getRuntimeActionKeysFromWorkflowInterrupt,isWorkflowRuntimeActionInterrupt}from"#harness/workflow-runtime-action-state.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{runStep}from"#context/run-step.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";import{routeDeliverPayload}from"#execution/subagent-hitl-proxy.js";import{CallbackBaseUrlKey,PendingAuthorizationResultKey,clearPendingAuthorization,getPendingAuthorization}from"#harness/authorization.js";import{isTurnCancellation,throwIfTurnAborted}from"#harness/turn-cancellation.js";import{createTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{coalesceTurnInputs}from"#harness/messages.js";import{buildTurnAttributes,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{dispatchDynamicInstructionEvent}from"#context/dynamic-instruction-lifecycle.js";import{dispatchDynamicSkillEvent}from"#context/dynamic-skill-lifecycle.js";import{dispatchDynamicToolEvent}from"#context/dynamic-tool-lifecycle.js";import{hasPendingInputBatch}from"#harness/input-requests.js";import{getTurnUsageState,toUsage}from"#harness/turn-tag-state.js";import{getRuntimeActionRequestKey}from"#runtime/actions/keys.js";import{createExecutionNodeStep}from"#execution/node-step.js";import{recordSubagentUsageSpans}from"#execution/subagent-usage-span.js";
|
|
1
|
+
import{callAdapterEventHandler,defaultDeliverResult}from"#channel/adapter.js";import{AuthKey,CapabilitiesKey,ModeKey}from"#context/keys.js";import{createAuthorizationCompletedEvent,encodeMessageStreamEvent,timestampHandleMessageStreamEvent}from"#protocol/message.js";import{BundleKey,ChannelKey}from"#runtime/sessions/runtime-context-keys.js";import{getHarnessEmissionState}from"#harness/emission.js";import{deserializeContext,serializeContext}from"#context/serialize.js";import{createDurableSessionState,readDurableSession}from"#execution/durable-session-store.js";import{createWorkflowRuntime,startWorkflowPreferLatest,turnWorkflowReference}from"#execution/workflow-runtime.js";import{getPendingRuntimeActionBatch}from"#harness/runtime-actions.js";import{hydrateDurableSession,refreshSessionFromTurnAgent}from"#execution/session.js";import{resumeHook}from"#internal/workflow/runtime.js";import{buildAdapterContext}from"#channel/adapter-context.js";import{getPendingWorkflowInterrupt}from"#harness/workflow-interrupt-state.js";import{getRuntimeActionKeysFromWorkflowInterrupt,isWorkflowRuntimeActionInterrupt}from"#harness/workflow-runtime-action-state.js";import{dispatchDynamicModelEvent}from"#context/dynamic-model-lifecycle.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{setChannelContext}from"#execution/channel-context.js";import{dispatchStreamEventHooks}from"#context/hook-lifecycle.js";import{runStep}from"#context/run-step.js";import{reconcileSessionContinuationToken}from"#execution/reconcile-session-continuation-token.js";import{routeDeliverPayload}from"#execution/subagent-hitl-proxy.js";import{CallbackBaseUrlKey,PendingAuthorizationResultKey,clearPendingAuthorization,getPendingAuthorization}from"#harness/authorization.js";import{isTurnCancellation,throwIfTurnAborted}from"#harness/turn-cancellation.js";import{createTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{coalesceTurnInputs}from"#harness/messages.js";import{buildTurnAttributes,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{dispatchDynamicInstructionEvent}from"#context/dynamic-instruction-lifecycle.js";import{dispatchDynamicSkillEvent}from"#context/dynamic-skill-lifecycle.js";import{dispatchDynamicToolEvent}from"#context/dynamic-tool-lifecycle.js";import{hasPendingInputBatch}from"#harness/input-requests.js";import{getTurnUsageState,toUsage}from"#harness/turn-tag-state.js";import{getRuntimeActionRequestKey}from"#runtime/actions/keys.js";import{createExecutionNodeStep}from"#execution/node-step.js";import{recordSubagentUsageSpans}from"#execution/subagent-usage-span.js";async function turnStep(a){"use step";let o=a,s=await readDurableSession(o.sessionState),c=await deserializeContext(o.serializedContext),l=c.require(ChannelKey),u=c.require(BundleKey);try{let{getWorkflowMetadata:e}=await import(`#compiled/@workflow/core/index.js`),t=e();typeof t.url==`string`&&c.set(CallbackBaseUrlKey,resolveWorkflowCallbackBaseUrl(t.url))}catch{}let d=getPendingAuthorization(s.state),f;if(d&&o.input?.kind===`deliver`){let e=[],t=[],n=[];for(let r of o.input.payloads){let i=r.authorizationCallback;if(i){let n=d.challenges.find(e=>e.name===i.connectionName);n&&(e.push({name:n.name,resume:n.resume,callback:i.callback,hookUrl:n.hookUrl}),t.push({name:n.name,authorization:n.challenge}))}else n.push(r)}e.length>0&&(c.set(PendingAuthorizationResultKey,e),s={...s,state:clearPendingAuthorization(s.state,e.map(e=>e.name))},f=t,o=n.length>0?{...o,input:{...o.input,payloads:n}}:{...o,input:void 0})}o.input?.kind===`deliver`&&o.input.auth!==void 0&&c.set(AuthKey,o.input.auth??null);let p=hydrateDurableSession({compactionOverrides:{thresholdPercent:u.resolvedAgent.config.compaction?.thresholdPercent},durable:s,turnAgent:u.turnAgent}),m=buildAdapterContext(l,c),h;if(o.input?.kind===`deliver`){let e=[];for(let n of o.input.payloads){let r=l.deliver?await l.deliver(n,m):defaultDeliverResult(n);r!=null&&e.push(r)}h=e.length===0?void 0:e.reduce(coalesceTurnInputs)}else o.input?.kind===`runtime-action-result`&&(recordSubagentUsageSpans(o.input.results),h={runtimeActionResults:o.input.results});if(o.input?.kind===`deliver`&&setChannelContext(c,{...l,state:{...m.state}}),o.input?.kind===`deliver`&&h===void 0){let e=reconcileSessionContinuationToken(c,p),t=serializeContext(c),n=e===p?o.sessionState:createDurableSessionState({session:e});return{action:`park`,...derivePendingState(e),serializedContext:t,sessionState:n}}let g=o.parentWritable.getWriter(),_=u.hookRegistry,v=u.resolvedAgent.dynamicInstructionsResolvers??[],y=u.resolvedAgent.dynamicSkillResolvers??[],b=u.resolvedAgent.dynamicToolResolvers??[],emit=async t=>{let n=await callAdapterEventHandler(l,t,m);return setChannelContext(c,{...l,state:{...m.state}}),await g.write(encodeMessageStreamEvent(timestampHandleMessageStreamEvent(n))),n},handleEvent=async(e,t)=>{let n=await emit(e);await dispatchStreamEventHooks({ctx:c,registry:_,event:n}),n.type!==`step.started`&&await dispatchDynamicModelEvent({ctx:c,dynamicModel:u.turnAgent.dynamicModel,event:n,fallback:u.turnAgent.model,messages:t??[],scope:{moduleMap:u.moduleMap,nodeId:u.nodeId}}),await dispatchDynamicToolEvent({ctx:c,resolvers:b,event:n,messages:t??[]}),await dispatchDynamicSkillEvent({ctx:c,resolvers:y,event:n,messages:t??[]}),await dispatchDynamicInstructionEvent({ctx:c,resolvers:v,event:n,messages:t??[]})},x=c.require(ModeKey),S;try{throwIfTurnAborted(o.abortSignal),S=await runStep(c,p,async e=>{let t=resolveEffectiveOutputSchema({agentOutputSchema:u.turnAgent.outputSchema,input:h,mode:x,session:e});if(f){let e=getHarnessEmissionState(t.state);for(let{name:t,authorization:n}of f)await handleEvent(createAuthorizationCompletedEvent({authorization:n,name:t,outcome:`authorized`,sequence:e.sequence,stepIndex:e.stepIndex,turnId:e.turnId}))}let n=c.get(CapabilitiesKey);return(async(e,t)=>{let r=refreshSessionFromTurnAgent({compactionOverrides:{thresholdPercent:u.resolvedAgent.config.compaction?.thresholdPercent},session:e,turnAgent:u.turnAgent});return createExecutionNodeStep({abortSignal:o.abortSignal,capabilities:n,createRuntime:createWorkflowRuntime,handleEvent,mode:x,modelResolutionScope:{moduleMap:u.moduleMap,nodeId:u.nodeId},node:u.graph.root,workflowMaxSubagents:r.workflowMaxSubagents})(r,t)})(t,h)})}catch(e){if(!isTurnCancellation(e))throw e;return g.releaseLock(),{action:`cancelled`,serializedContext:o.serializedContext,sessionState:o.sessionState}}let C=reconcileSessionContinuationToken(c,S.session),w=serializeContext(c);S={...S,session:C};let T=createDurableSessionState({session:S.session});if(S.next!==null&&typeof S.next==`object`&&`done`in S.next){await g.close();let e=getTurnUsageState(S.session.state)?.session;return{action:`done`,output:S.next.output,isError:S.next.isError,serializedContext:w,sessionState:T,usage:e===void 0?void 0:toUsage(e)}}if(S.next===null){g.releaseLock();let e=getPendingWorkflowInterrupt(S.session.state);return e!==void 0&&isWorkflowRuntimeActionInterrupt(e.interrupt)?{action:`dispatch-workflow-runtime-actions`,pendingRuntimeActionKeys:getRuntimeActionKeysFromWorkflowInterrupt(e.interrupt),serializedContext:w,sessionState:T}:{action:`park`,...derivePendingState(S.session),serializedContext:w,sessionState:T}}return g.releaseLock(),{action:`continue`,serializedContext:w,sessionState:T}}function derivePendingState(e){let t=getPendingRuntimeActionBatch(e.state),n=getPendingAuthorization(e.state),r={authorizationNames:n?.challenges.map(e=>e.name),hasPendingAuthorization:n!==void 0,hasPendingInputBatch:hasPendingInputBatch(e.state)};return t===void 0?r:{...r,pendingRuntimeActionKeys:t.actions.map(e=>getRuntimeActionRequestKey(e))}}function resolveEffectiveOutputSchema(e){let{agentOutputSchema:t,input:n,mode:r,session:i}=e;return n?.outputSchema===void 0?r===`task`&&i.outputSchema===void 0&&t!==void 0?{...i,outputSchema:t}:i:{...i,outputSchema:n.outputSchema}}async function routeProxiedDeliverStep(e){"use step";let t=await readDurableSession(e.sessionState),n=routeDeliverPayload({payload:e.payload,state:t.state});for(let t of n.forChildren)await resumeHook(t.childContinuationToken,{auth:e.auth,kind:`deliver`,payloads:[t.payload]});return{remainder:n.forSelf}}async function dispatchTurnStep(e){"use step";return{runId:(await startWorkflowPreferLatest(turnWorkflowReference,[createTurnWorkflowInput(e)],{allowReservedAttributes:!0,attributes:normalizeEveAttributes(buildTurnAttributes({parentSessionId:e.sessionState.sessionId,requestId:e.delivery.kind===`deliver`?e.delivery.requestId:void 0,rootSessionId:readRootSessionId(e.serializedContext)??e.sessionState.sessionId}))})).runId}}export{dispatchTurnStep,resolveEffectiveOutputSchema,routeProxiedDeliverStep,turnStep};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
2
|
export declare const COMPACTION_CHECKPOINT_MARKER = "Summary of our conversation so far:";
|
|
3
|
+
/** Synthetic resumption prompt used when no real user message can be replayed. */
|
|
4
|
+
export declare const COMPACTION_RESUMPTION_MESSAGE = "Continue.";
|
|
5
|
+
/**
|
|
6
|
+
* Label line of the framework-injected todo preservation message. Owned here
|
|
7
|
+
* so compaction can recognize the message as synthetic when picking a user
|
|
8
|
+
* message to replay after compaction.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TODO_COMPACTION_PRESERVATION_LABEL = "[Your task list was preserved across context compaction]";
|
|
3
11
|
export interface CompactionPrompt {
|
|
4
12
|
readonly prompt: string;
|
|
5
13
|
readonly system: string;
|
|
@@ -9,8 +17,18 @@ export declare const COMPACTION_PROMPT_ENVELOPE: {
|
|
|
9
17
|
prompt: string;
|
|
10
18
|
system: string;
|
|
11
19
|
};
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Builds the compaction model input from framework-owned checkpoint state and
|
|
22
|
+
* older messages.
|
|
23
|
+
*
|
|
24
|
+
* Conversational text is rendered verbatim. When `transcriptBudgetTokens` is
|
|
25
|
+
* set and the rendered prompt exceeds it, conversational text is capped at
|
|
26
|
+
* {@link DEGRADED_TEXT_LIMIT} starting from the oldest entries until the
|
|
27
|
+
* prompt fits; the previous checkpoint is never truncated.
|
|
28
|
+
*/
|
|
13
29
|
export declare function createCompactionPrompt(input: {
|
|
14
30
|
readonly messages: readonly ModelMessage[];
|
|
15
31
|
readonly previousCheckpoint: string | undefined;
|
|
32
|
+
readonly transcriptBudgetTokens?: number;
|
|
16
33
|
}): CompactionPrompt;
|
|
34
|
+
export declare const TRANSCRIPT_PAYLOAD_LIMIT = 2000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const COMPACTION_CHECKPOINT_MARKER=`Summary of our conversation so far:`,COMPACTION_SYSTEM_PROMPT=`You are performing a CONTEXT CHECKPOINT COMPACTION. Create a handoff summary for another LLM that will resume the task.
|
|
1
|
+
import{estimateTokens}from"#harness/token-estimate.js";const COMPACTION_CHECKPOINT_MARKER=`Summary of our conversation so far:`,COMPACTION_RESUMPTION_MESSAGE=`Continue.`,TODO_COMPACTION_PRESERVATION_LABEL=`[Your task list was preserved across context compaction]`,COMPACTION_SYSTEM_PROMPT=`You are performing a CONTEXT CHECKPOINT COMPACTION. Create a handoff summary for another LLM that will resume the task.
|
|
2
2
|
|
|
3
3
|
Include:
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ Include:
|
|
|
7
7
|
- What remains to be done, with clear next steps
|
|
8
8
|
- Any critical data, examples, or references needed to continue
|
|
9
9
|
|
|
10
|
-
Be concise, structured, and focused on helping the next LLM seamlessly continue the work. Write in the same language as the conversation. Do not continue the conversation, answer its questions, or invent facts. Only output the handoff summary.`,COMPACTION_PROMPT_ENVELOPE={prompt:formatCompactionPrompt({previousCheckpoint:``,transcript:``}),system:COMPACTION_SYSTEM_PROMPT};function createCompactionPrompt(e){let
|
|
10
|
+
Be concise, structured, and focused on helping the next LLM seamlessly continue the work. Write in the same language as the conversation. Do not continue the conversation, answer its questions, or invent facts. Only output the handoff summary.`,COMPACTION_PROMPT_ENVELOPE={prompt:formatCompactionPrompt({previousCheckpoint:``,transcript:``}),system:COMPACTION_SYSTEM_PROMPT};function createCompactionPrompt(e){let t=e.messages.map(e=>({content:renderCompactionMessageContent(e),role:e.role}));return degradeOversizedTranscript(e,t),{prompt:formatCompactionPrompt({previousCheckpoint:e.previousCheckpoint?.trim()??`(none)`,transcript:formatCompactionTranscript(t)}),system:COMPACTION_SYSTEM_PROMPT}}function degradeOversizedTranscript(t,n){let r=t.transcriptBudgetTokens;if(r===void 0)return;let i=estimateTokens(formatCompactionPrompt({previousCheckpoint:t.previousCheckpoint?.trim()??`(none)`,transcript:formatCompactionTranscript(n)}))-r;for(let e=0;e<n.length&&i>0;e+=1){let r=n[e],a=t.messages[e];if(r===void 0||a===void 0)continue;let o=renderCompactionMessageContent(a,2e3);o.length>=r.content.length||(i-=(r.content.length-o.length)/4,n[e]={content:o,role:r.role})}}function formatCompactionPrompt(e){return`<previous-checkpoint>
|
|
11
11
|
${e.previousCheckpoint}
|
|
12
12
|
</previous-checkpoint>
|
|
13
13
|
|
|
@@ -18,7 +18,9 @@ ${e.transcript}
|
|
|
18
18
|
|
|
19
19
|
Update the previous checkpoint with the newer information in the conversation. If there is no previous checkpoint, create one from the conversation.
|
|
20
20
|
|
|
21
|
-
Make completed work explicit so the next model does not repeat it. Keep completed work separate from current and remaining work, and do not describe completed work as pending unless later messages show it must be redone. Preserve exact file paths, function names, commands, error messages, identifiers, and measured values when they are needed to continue
|
|
21
|
+
Make completed work explicit so the next model does not repeat it. Keep completed work separate from current and remaining work, and do not describe completed work as pending unless later messages show it must be redone. Preserve exact file paths, function names, commands, error messages, identifiers, and measured values when they are needed to continue.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Large tool outputs are the main thing to compress: reduce each to the findings the next model needs — what was searched or read, what it established, and the exact identifiers involved — rather than reproducing the output. The next model cannot see the originals, so nothing it would need to act on may be lost.`}function formatCompactionTranscript(e){let t=e.filter(e=>e.content.trim().length>0).map(e=>`### ${e.role}\n${e.content.trim()}`);return t.length===0?`(empty)`:t.join(`
|
|
24
|
+
|
|
25
|
+
`)}function renderCompactionMessageContent(e,t){return typeof e.content==`string`?renderConversationText(e.content,t):e.content.map(e=>renderCompactionContentPart(e,t)).filter(e=>e.length>0).join(`
|
|
26
|
+
`).trim()}function renderCompactionContentPart(e,t){switch(e.type){case`text`:return renderConversationText(e.text,t);case`reasoning`:return``;case`file`:return e.filename?`Attached file ${e.filename} (${e.mediaType})`:`Attached file attachment (${e.mediaType})`;case`tool-call`:return renderTranscriptToolCall(e,t);case`tool-result`:return renderTranscriptToolResult(e,t);default:return``}}const TRANSCRIPT_PAYLOAD_LIMIT=2e3;function renderTranscriptToolCall(e,t){return renderToolCall(e,t===void 0?TRANSCRIPT_PAYLOAD_LIMIT:280)}function renderTranscriptToolResult(e,t){let n=t===void 0?TRANSCRIPT_PAYLOAD_LIMIT:280,r=e.isError?`errored`:`returned`,i=renderPayload(e.output,n);return i?`Tool ${e.toolName} ${r} ${i}`:`Tool ${e.toolName} ${r}`}function renderToolCall(e,t){let n=renderPayload(e.input,t);return n?`Called ${e.toolName} with ${n}`:`Called ${e.toolName}`}function renderPayload(e,t){return e===void 0?``:capText(JSON.stringify(e)??``,t)}function renderConversationText(e,t){return t===void 0?e.trim():capText(e,t)}function capText(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t).trimEnd()}…`}export{COMPACTION_CHECKPOINT_MARKER,COMPACTION_PROMPT_ENVELOPE,COMPACTION_RESUMPTION_MESSAGE,TODO_COMPACTION_PRESERVATION_LABEL,TRANSCRIPT_PAYLOAD_LIMIT,createCompactionPrompt};
|