eve 0.79.0 → 0.79.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/src/channel/pending-authorization.d.ts +10 -0
  3. package/dist/src/channel/pending-authorization.js +1 -0
  4. package/dist/src/chunks/{use-eve-agent-BSYe_Re7.js → use-eve-agent-Ch-Q-s12.js} +43 -13
  5. package/dist/src/chunks/{use-eve-agent-B8brxCk-.js → use-eve-agent-Vsl-S0yI.js} +43 -13
  6. package/dist/src/client/abort-signal.d.ts +2 -0
  7. package/dist/src/client/abort-signal.js +1 -0
  8. package/dist/src/client/conversation-client.d.ts +2 -0
  9. package/dist/src/client/conversation-client.js +1 -1
  10. package/dist/src/client/eve-agent-store-state.d.ts +9 -0
  11. package/dist/src/client/eve-agent-store.js +1 -1
  12. package/dist/src/client/ndjson.js +1 -1
  13. package/dist/src/client/open-stream.js +1 -1
  14. package/dist/src/client/session-turn-dispatch.js +1 -1
  15. package/dist/src/client/session-utils.js +1 -1
  16. package/dist/src/client/session.js +1 -1
  17. package/dist/src/compiled/.vendor-stamp.json +2 -2
  18. package/dist/src/compiled/@eve/tracing/adapters/serialization.d.ts +2 -2
  19. package/dist/src/compiled/@eve/tracing/core/types.d.ts +6 -1
  20. package/dist/src/compiled/@eve/tracing/index.js +1 -1
  21. package/dist/src/compiled/@eve/tracing/otel.js +1 -1
  22. package/dist/src/compiled/_chunks/workflow/mcp-Bwx_LQ4q.js +5 -0
  23. package/dist/src/compiler/extension-compatibility.d.ts +18 -18
  24. package/dist/src/compiler/extension-compatibility.js +1 -1
  25. package/dist/src/compiler/project-sources.js +1 -1
  26. package/dist/src/context/memory-tools.js +1 -1
  27. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +6 -4
  28. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -1
  29. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  30. package/dist/src/eve-channel/request.js +1 -1
  31. package/dist/src/execution/authorization-callback-match.d.ts +2 -2
  32. package/dist/src/execution/authorization-callback-match.js +1 -1
  33. package/dist/src/execution/durable-session-store.js +1 -1
  34. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  35. package/dist/src/execution/forward-session-input.js +1 -1
  36. package/dist/src/execution/proxied-deliver-step.js +1 -1
  37. package/dist/src/execution/publish-session-events.d.ts +26 -5
  38. package/dist/src/execution/publish-session-events.js +1 -1
  39. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
  40. package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
  41. package/dist/src/execution/sandbox/bindings/vercel-credentials.d.ts +2 -0
  42. package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
  43. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  44. package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
  45. package/dist/src/execution/sandbox/bindings/vercel.d.ts +3 -6
  46. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  47. package/dist/src/execution/session/active-turn.d.ts +2 -1
  48. package/dist/src/execution/session/active-turn.js +1 -1
  49. package/dist/src/execution/session/checkpoint-migrations.js +1 -1
  50. package/dist/src/execution/session/handoff-steps.js +1 -1
  51. package/dist/src/execution/session/handoff.d.ts +1 -1
  52. package/dist/src/execution/session/handoff.js +1 -1
  53. package/dist/src/execution/session/input-queue.d.ts +13 -6
  54. package/dist/src/execution/session/input-queue.js +1 -1
  55. package/dist/src/execution/session/pending-turn-state.js +1 -1
  56. package/dist/src/execution/session/turn-step.js +1 -1
  57. package/dist/src/execution/session/turn.d.ts +5 -1
  58. package/dist/src/execution/session/turn.js +1 -1
  59. package/dist/src/execution/tasks/steps.d.ts +1 -1
  60. package/dist/src/execution/tasks/steps.js +1 -1
  61. package/dist/src/execution/tasks/task-id-input.js +1 -1
  62. package/dist/src/execution/tool-auth.js +1 -1
  63. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  64. package/dist/src/execution/tools/workflow/answer.d.ts +1 -1
  65. package/dist/src/execution/tools/workflow/apply-run-messages-step.d.ts +6 -2
  66. package/dist/src/execution/tools/workflow/apply-run-messages-step.js +1 -1
  67. package/dist/src/execution/tools/workflow/body.d.ts +10 -1
  68. package/dist/src/execution/tools/workflow/body.js +1 -1
  69. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  70. package/dist/src/execution/tools/workflow/serve.js +1 -1
  71. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +2 -2
  72. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -1
  73. package/dist/src/execution/workflow-callback-url.d.ts +10 -1
  74. package/dist/src/execution/workflow-callback-url.js +1 -1
  75. package/dist/src/harness/action-result-helpers.js +1 -1
  76. package/dist/src/harness/attachment-staging.js +1 -1
  77. package/dist/src/harness/authorization.d.ts +3 -13
  78. package/dist/src/harness/authorization.js +1 -1
  79. package/dist/src/harness/compaction/engine.js +3 -1
  80. package/dist/src/harness/compaction/prompt.d.ts +7 -0
  81. package/dist/src/harness/compaction/prompt.js +1 -1
  82. package/dist/src/harness/compaction/step.d.ts +1 -0
  83. package/dist/src/harness/compaction/step.js +1 -1
  84. package/dist/src/harness/coordination.js +1 -1
  85. package/dist/src/harness/hitl/approvals.d.ts +1 -1
  86. package/dist/src/harness/hitl/approvals.js +1 -1
  87. package/dist/src/harness/hitl/approved-calls.d.ts +3 -0
  88. package/dist/src/harness/hitl/approved-calls.js +1 -1
  89. package/dist/src/harness/hitl/candidates.d.ts +13 -0
  90. package/dist/src/harness/hitl/candidates.js +1 -1
  91. package/dist/src/harness/hitl/coordinator.js +1 -1
  92. package/dist/src/harness/hitl/index.d.ts +2 -5
  93. package/dist/src/harness/hitl/index.js +1 -1
  94. package/dist/src/harness/hitl/intake.js +1 -1
  95. package/dist/src/harness/{proxy-input-requests.d.ts → hitl/relays.d.ts} +3 -39
  96. package/dist/src/harness/hitl/relays.js +1 -0
  97. package/dist/src/harness/hitl/requests.d.ts +64 -0
  98. package/dist/src/harness/hitl/requests.js +1 -0
  99. package/dist/src/harness/hitl/sign-ins.d.ts +9 -0
  100. package/dist/src/harness/hitl/sign-ins.js +1 -0
  101. package/dist/src/harness/inline-tool-authorization.js +1 -1
  102. package/dist/src/harness/input-request-resolution.d.ts +2 -1
  103. package/dist/src/harness/input-request-resolution.js +1 -1
  104. package/dist/src/harness/model-call/call.js +1 -1
  105. package/dist/src/harness/model-call/model.d.ts +3 -1
  106. package/dist/src/harness/model-call/model.js +1 -1
  107. package/dist/src/harness/session-machine/commit.d.ts +14 -3
  108. package/dist/src/harness/session-machine/commit.js +1 -1
  109. package/dist/src/harness/session-machine/transitions.d.ts +16 -0
  110. package/dist/src/harness/session-machine/transitions.js +1 -1
  111. package/dist/src/instrumentation/native-events.js +1 -1
  112. package/dist/src/instrumentation/runtime.d.ts +1 -0
  113. package/dist/src/instrumentation/runtime.js +1 -1
  114. package/dist/src/internal/application/optional-package-import.d.ts +5 -0
  115. package/dist/src/internal/application/optional-package-import.js +1 -1
  116. package/dist/src/internal/application/stamped-package-version.js +1 -1
  117. package/dist/src/internal/authored-definition/source-identity.d.ts +6 -0
  118. package/dist/src/internal/authored-definition/source-identity.js +1 -1
  119. package/dist/src/internal/authored-module-map-loader.js +1 -1
  120. package/dist/src/internal/helpers/markdown.js +1 -1
  121. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  122. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  123. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -1
  124. package/dist/src/protocol/baggage.d.ts +1 -0
  125. package/dist/src/protocol/baggage.js +1 -1
  126. package/dist/src/protocol/message.d.ts +2 -0
  127. package/dist/src/protocol/message.js +1 -1
  128. package/dist/src/public/channels/teams/authorization.d.ts +53 -0
  129. package/dist/src/public/channels/teams/authorization.js +1 -0
  130. package/dist/src/public/channels/teams/defaults.js +2 -2
  131. package/dist/src/public/channels/teams/hitl.d.ts +2 -1
  132. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  133. package/dist/src/public/channels/telegram/authorization-callback.js +1 -1
  134. package/dist/src/public/definitions/connections/mcp.js +1 -1
  135. package/dist/src/public/definitions/connections/openapi.js +1 -1
  136. package/dist/src/public/next/index.js +1 -1
  137. package/dist/src/public/next/server.d.ts +11 -2
  138. package/dist/src/public/next/server.js +1 -1
  139. package/dist/src/public/sandbox/vercel.d.ts +2 -0
  140. package/dist/src/public/tools/index.d.ts +1 -1
  141. package/dist/src/public/tools/result.d.ts +10 -7
  142. package/dist/src/react/use-eve-agent.d.ts +6 -0
  143. package/dist/src/react/use-eve-agent.js +1 -1
  144. package/dist/src/runtime/authorization-context.d.ts +5 -0
  145. package/dist/src/runtime/authorization-context.js +1 -1
  146. package/dist/src/runtime/connections/mcp-tracing.js +1 -1
  147. package/dist/src/runtime/connections/openapi-operations.js +1 -1
  148. package/dist/src/runtime/connections/scoped-authorization.d.ts +6 -0
  149. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  150. package/dist/src/runtime/resolve-connection.js +1 -1
  151. package/dist/src/setup/scaffold/create/project.js +1 -1
  152. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  153. package/dist/src/setup/scaffold/create/web-template.js +18 -10
  154. package/dist/src/shared/action-types.d.ts +1 -0
  155. package/dist/src/shared/action-types.js +1 -1
  156. package/dist/src/shared/git.js +1 -1
  157. package/dist/src/shared/instrumentation-content.d.ts +1 -1
  158. package/dist/src/shared/instrumentation-content.js +1 -1
  159. package/dist/src/shared/instrumentation-decision.d.ts +3 -0
  160. package/dist/src/shared/instrumentation-decision.js +1 -1
  161. package/dist/src/shared/skill-package.js +1 -1
  162. package/dist/src/shared/trace-policy.js +1 -1
  163. package/dist/src/subagents/adapter.js +1 -1
  164. package/dist/src/subagents/event-proxy-step.d.ts +1 -1
  165. package/dist/src/subagents/event-proxy-step.js +1 -1
  166. package/dist/src/subagents/hitl-proxy.d.ts +1 -1
  167. package/dist/src/subagents/hitl-proxy.js +1 -1
  168. package/dist/src/svelte/index.js +1 -1
  169. package/dist/src/svelte/use-eve-agent.d.ts +6 -0
  170. package/dist/src/svelte/use-eve-agent.js +1 -1
  171. package/dist/src/tools/definition.d.ts +38 -1
  172. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  173. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  174. package/dist/src/tools/signature.d.ts +4 -2
  175. package/dist/src/tools/signature.js +1 -1
  176. package/dist/src/tracing/eve/agent-otel-provider.js +1 -1
  177. package/dist/src/tracing/eve/gateway.d.ts +2 -1
  178. package/dist/src/tracing/eve/gateway.js +1 -1
  179. package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
  180. package/dist/src/tracing/eve/otel-declaration.d.ts +9 -8
  181. package/dist/src/tracing/eve/policy.js +1 -1
  182. package/dist/src/vue/index.js +1 -1
  183. package/dist/src/vue/use-eve-agent.d.ts +6 -0
  184. package/dist/src/vue/use-eve-agent.js +1 -1
  185. package/docs/agent-config.md +48 -0
  186. package/docs/channels/eve.mdx +2 -0
  187. package/docs/channels/teams.mdx +6 -0
  188. package/docs/concepts/built-in-tools.md +1 -1
  189. package/docs/connections/overview.mdx +9 -6
  190. package/docs/guides/frontend/overview.mdx +10 -1
  191. package/docs/guides/hooks.md +6 -2
  192. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  193. package/docs/guides/instrumentation/otel.mdx +3 -0
  194. package/docs/reference/cli.md +1 -1
  195. package/docs/reference/typescript-api.md +7 -6
  196. package/docs/sandbox/vercel.mdx +9 -0
  197. package/docs/skills.mdx +1 -1
  198. package/docs/tools/human-in-the-loop.md +21 -0
  199. package/package.json +1 -1
  200. package/dist/src/compiled/_chunks/workflow/mcp-CrGp4EC8.js +0 -5
  201. package/dist/src/harness/proxy-input-requests.js +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "moduleFingerprints": {
3
3
  "@eve/catalog": "d5babf703f0f589f123ee2043b72bcb4823ccccbe5034315c3b70fbae7cd76a0",
4
- "@eve/tracing": "a528cd9d20e2f2549eb986fdf03ba3352014d69aec709f9758482bc8d08bb5aa",
4
+ "@eve/tracing": "f9d137e4e8838f1a359a8897b7229ecb243f441386b8e5e78fd71445be04b4ad",
5
5
  "just-secrets": "1ce67d437d0bb06df02e4e99180a3c5f5edf0010314010226e97b96d462bba5d",
6
6
  "@workflow/world-local": "a10e78551f65fc607cf75261a569d852c40bc9cfac13a7fb6e15c88bf1ccf429"
7
7
  },
@@ -61,7 +61,7 @@
61
61
  "zod": "4.5.4",
62
62
  "zod-validation-error": "5.0.0"
63
63
  },
64
- "scriptHash": "3a19e7f59d4cf18dd0aec4272f4eba4e8a23cfe1682db5801421af4da6d37069",
64
+ "scriptHash": "e2b444777326d6ef8f68b8571793402c26df6ba49dcc7943a71038e9216be63a",
65
65
  "toolVersions": {
66
66
  "rolldown": "1.2.9",
67
67
  "typescript": "7.0.2"
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /** Content attributes are capped so a giant payload cannot bloat a span segment. */
9
9
  export declare const CONTENT_ATTRIBUTE_LIMIT: number;
10
- import type { ContentSerializer } from "../core/types.js";
10
+ import type { ContentSerializer, InputMessagesContent } from "../core/types.js";
11
11
  export declare const aiSdkContentSerializer: ContentSerializer;
12
12
  export declare function telemetryByteLength(text: string): number;
13
13
  export declare function truncateTelemetryText(text: string, maxBytes: number): string;
@@ -16,7 +16,7 @@ export declare function boundedTraceError(value: Error): Error;
16
16
  /** Serializes one payload value as capped JSON. */
17
17
  export declare function contentAttribute(value: unknown): string | undefined;
18
18
  /** Serializes model messages using the OpenTelemetry GenAI message schema. */
19
- export declare function genAiInputMessagesAttribute(messages: unknown, messageKind?: (value: unknown) => string | undefined): string | undefined;
19
+ export declare function genAiInputMessagesAttribute(messages: unknown, messageKind?: (value: unknown) => string | undefined): InputMessagesContent | undefined;
20
20
  /** Serializes the system prompt using the OpenTelemetry GenAI instruction schema. */
21
21
  export declare function genAiSystemInstructionsAttribute(instructions: unknown): string | undefined;
22
22
  /** Serializes one model response using the OpenTelemetry GenAI message schema. */
@@ -115,10 +115,15 @@ export interface Usage {
115
115
  }
116
116
  /** `subagent-call` and `remote-agent-call` delegate to another agent. */
117
117
  export type ToolKind = string;
118
+ /** Capped GenAI input messages and how many of the oldest were dropped to fit. */
119
+ export interface InputMessagesContent {
120
+ readonly json: string;
121
+ readonly omitted: number;
122
+ }
118
123
  export interface ContentSerializer {
119
124
  json(value: unknown): string | undefined;
120
125
  text(value: string): string | undefined;
121
- inputMessages(value: unknown): string | undefined;
126
+ inputMessages(value: unknown): InputMessagesContent | undefined;
122
127
  instructions(value: unknown): string | undefined;
123
128
  toolDefinitions(value: unknown): string | undefined;
124
129
  outputMessages(value: readonly ContentPart[], finishReason: string): string | undefined;
@@ -1 +1 @@
1
- import{f as e,g as t,i as n,l as r,m as i,n as a,o,r as s,s as c,t as l,u,v as d}from"../../_chunks/workflow/mcp-CrGp4EC8.js";import{n as f,t as p}from"../../_chunks/workflow/delegation-BqhZ398D.js";import{createHash as m,randomBytes as h,randomUUID as g}from"node:crypto";var _=class{#e;#t;allocateSpanId(){return y(16)}deriveSpanId(e){return v(e)}deriveTraceId(e){let t=m(`sha256`).update(e).digest(`hex`).slice(0,32);return/^0+$/u.test(t)?`00000000000000000000000000000001`:t}generateSpanId(){let e=this.#e;return e===void 0?y(16):(this.#e=void 0,e)}generateTraceId(){let e=this.#t;return e===void 0?y(32):(this.#t=void 0,e)}withSpanId(e,t){this.#e=e;try{return t()}finally{this.#e=void 0}}withTraceId(e,t){this.#t=e;try{return t()}finally{this.#t=void 0}}};function v(e){let t=m(`sha256`).update(e).digest(`hex`).slice(0,16);return/^0+$/u.test(t)?`0000000000000001`:t}function y(e){let t;do{t=``;for(let n=0;n<e;n+=1)t+=`0123456789abcdef`[Math.trunc(Math.random()*16)]}while(!/[1-9a-f]/u.test(t));return t}function b(e,t,n,r){let i=!1;try{return e.run(t,()=>(i=!0,n()),r)}catch(t){if(i)throw t;if(e.suppressed!==void 0)try{return e.suppressed(()=>(i=!0,n()))}catch(e){if(i)throw e}return n()}}function x(e){function n(t,n=`complete`,r){try{return t()}catch(t){try{e.onError?.(t,{phase:n,reference:r})}catch{}return}}function r(r,i,a,o){let s=u(r.attributes,i)??r.attributes,c=i.emit?n(()=>e.telemetry.startSpan({...r,attributes:s},{reference:o,context:a}),`start`,o):void 0,l=c?.reference??{traceId:`0`.repeat(32),spanId:`0`.repeat(16),traceFlags:0},d=!1;return{reference:l,get capture(){return i},narrow(e){i=t(i,e)},get finished(){return d},setAttribute(e,t){let r=u({[e]:t},i);!d&&(r===void 0||e in r)&&n(()=>c?.setAttribute(e,r===void 0?t:r[e]))},addEvent(e,t,r){d||n(()=>c?.addEvent(e,t===void 0?void 0:u(t,i)??t,r))},fail(e,t){d||n(()=>c?.fail(i.recordOutputs?e:void 0,t??(e instanceof Error?e.name:void 0)))},setStatus(e){d||n(()=>c?.setStatus(e))},end(e){d||(d=!0,n(()=>c?.end(e)))},run(t){return d?t():b(e.telemetry,{type:r.type,reference:l,capture:i},t,a)}}}return{start:r,startReserved:(e,t,n,i)=>r(e,n,i,t)}}const S=32768,C=65536;function w(e,t){function n(n,r){try{let t=Reflect.apply(e[n],e,r);return t===void 0||new TextEncoder().encode(t).length>S?void 0:t}catch(e){try{t?.(e,{phase:`serialize`})}catch{}return}}return{json:e=>n(`json`,[e]),text:e=>n(`text`,[e]),inputMessages:e=>n(`inputMessages`,[e]),instructions:e=>n(`instructions`,[e]),toolDefinitions:e=>n(`toolDefinitions`,[e]),outputMessages:(e,t)=>n(`outputMessages`,[e,t]),toolResults:e=>n(`toolResults`,[e])}}function T(e){return new TextEncoder().encode(JSON.stringify({...e,children:void 0})).length}function ee(e){return JSON.parse(JSON.stringify(e))}function E(e,t=C,n=0){try{if(n>16||typeof e!=`object`||!e)return!1;let r=e;if(r.children!==void 0&&(!Array.isArray(r.children)||r.children.length>1e4||!r.children.every(e=>E(e,t,n+1)))||r.version!==1||r.finished!==void 0&&typeof r.finished!=`boolean`||r.childSequence!==void 0&&(!Number.isSafeInteger(r.childSequence)||r.childSequence<0)||typeof r.key!=`string`||typeof r.startTimeMs!=`number`||!Number.isFinite(r.startTimeMs)||r.reference.traceFlags!==0&&r.reference.traceFlags!==1||r.reference.tracestate!==void 0&&(typeof r.reference.tracestate!=`string`||r.reference.tracestate.length>512)||r.parent!==void 0&&(!/^[a-f0-9]{32}$/u.test(r.parent.traceId)||!/^[a-f0-9]{16}$/u.test(r.parent.spanId))||![r.identity.conversationId,r.identity.runId,r.identity.turnId].every(e=>typeof e==`string`))return!1;let i=r.data.options;return!(!{activation:[],step:[],model:[`provider`,`modelId`],tool:[`callId`,`name`],approval:[`requestId`,`callId`,`toolName`],memory:[`operation`,`phase`,`slot`,`storeId`]}[r.data.type].every(e=>typeof i[e]==`string`)||r.data.type===`activation`&&!Number.isSafeInteger(i.sequence)||r.data.type===`step`&&!Number.isSafeInteger(i.index)||r.data.type===`memory`&&i.operation!==`search_memory`&&i.operation!==`upsert_memory`||!/^[a-f0-9]{32}$/u.test(r.reference.traceId)||!/^[a-f0-9]{16}$/u.test(r.reference.spanId)||typeof r.reference.traceFlags!=`number`||![r.capture.emit,r.capture.recordInputs,r.capture.recordOutputs].every(e=>typeof e==`boolean`)||![`activation`,`step`,`model`,`tool`,`approval`,`memory`].includes(r.data.type)||typeof r.data.options!=`object`||r.data.options===null||T(r)>t)}catch{return!1}}function D(e,t){let n=e.terminal;e={...e,children:e.children?.map(n=>D({...n,capture:{emit:n.capture.emit&&e.capture.emit,recordInputs:n.capture.recordInputs&&e.capture.recordInputs,recordOutputs:n.capture.recordOutputs&&e.capture.recordOutputs}},t))},e={...e,terminal:n===void 0||e.finished?void 0:{...n,errorCode:n.errorCode??(n.error instanceof Error?n.error.name:void 0),error:e.capture.recordOutputs?n.error instanceof Error?{name:n.error.name,message:t.text(n.error.message)}:n.error:void 0,output:e.capture.recordOutputs?n.output:void 0,response:e.capture.recordOutputs?n.response:void 0,records:e.capture.recordInputs?n.records:void 0,model:n.model===void 0?void 0:{...n.model,content:e.capture.recordOutputs?n.model.content:void 0}}},e={...e,attributes:u(e.attributes??{},e.capture)??e.attributes};let r=s(e.data,e.capture),i;try{i=t.json(r)}catch{}let a=()=>{let t=s(r,{emit:e.capture.emit,recordInputs:!1,recordOutputs:!1});return t.type===`step`&&(t={...t,options:{...t.options,runtimeContext:void 0}}),t.type===`model`&&(t={...t,options:{...t.options,runtimeContext:void 0}}),JSON.parse(JSON.stringify({...e,version:1,data:t,terminal:e.terminal===void 0?void 0:{outcome:e.terminal.outcome,failed:e.terminal.failed,errorCode:e.terminal.errorCode,usage:e.terminal.usage},attributes:u(e.attributes??{},{recordInputs:!1,recordOutputs:!1})??e.attributes}))};if(i===void 0||new TextEncoder().encode(i).length>S)return a();try{let t=JSON.parse(JSON.stringify({...e,version:1,data:JSON.parse(i)}));return T(t)<=C?t:a()}catch{return a()}}const O=1e4,k={emit:!1,recordInputs:!1,recordOutputs:!1},te=new Set([`activation`,`tool`,`approval`]),ne=new Set([`tool`,`approval`]);function A(e){return encodeURIComponent(String(e))}function j(e){switch(e.type){case`step`:return`step:${A(e.options.index)}:${A(e.options.attempt??0)}`;case`tool`:return`tool:${A(e.options.callId)}`;case`approval`:return`approval:${A(e.options.requestId)}`;default:return}}function M(e){let t=e.failed||e.outcome===`failed`;return{...e,model:`result`in e?e.result:e.model,failed:t,errorCode:`errorType`in e?e.errorType:e.errorCode}}function N(e){let i=e.telemetry,d=w(e.serializer,e.onError),p=x({telemetry:i,onError:e.onError}),m=(t,n)=>{try{e.onError?.(t,n)}catch{}};function g(t,n,r,a,o){let s=i.ids;if(e.durable&&s!==void 0&&t.type!==`model`&&t.type!==`memory`){if(t.type===`activation`&&r!==void 0)return{traceId:r.traceId,spanId:s.spanId(n),traceFlags:o.emit?r.traceFlags&1:0};if(t.type===`activation`){let e=s.traceId(n);return{traceId:e,spanId:s.spanId(n),traceFlags:o.emit&&(i.samples?.(e,a)??!0)?1:0}}return r===void 0?void 0:{...r,spanId:s.spanId(n),isRemote:!1}}}async function _(e,t,n,r,i,a,o){try{return await v(e,t,n,r,i,a,o)}catch(t){return m(t,{phase:`start`,operation:n.type,reference:a.reference}),v(e,k,s(n,k),r,i,{...a,sample:!1,reference:{traceId:a.reference?.traceId??r?.reference.traceId??a.parent?.traceId??h(16).toString(`hex`),spanId:a.reference?.spanId??h(8).toString(`hex`),traceFlags:0}},o)}}async function v(h,v,y,x,S,C,w){if(C.terminal?.error!==null&&typeof C.terminal?.error==`object`&&!(C.terminal.error instanceof Error)&&`message`in C.terminal.error&&typeof C.terminal.error.message==`string`){let e=Error(C.terminal.error.message);e.name=C.terminal.errorCode??`Error`,C={...C,terminal:{...C.terminal,error:e}}}let T=C.key,E=C.startTimeMs??Date.now(),N=C.parent??x?.reference;v.emit&&(v=t(v,i.active()?.capture));let P=v,F=s(y,P),I=c({identity:h,data:F,attempt:S,capture:P,key:T,parent:N,startTimeMs:E,links:C.links},d);I={...I,attributes:{...I.attributes,...C.attributes}},F=D({key:T,identity:h,data:F,capture:P,reference:C.reference??{traceId:`0`.repeat(32),spanId:`0`.repeat(16),traceFlags:0},startTimeMs:E},d).data;let L=C.deferred??(e.durable&&te.has(F.type)),R=C.executionContext,z=C.reference??g(y,T,N,I,P);C.sample===!0&&z!==void 0&&(z={...z,traceFlags:z.traceFlags&1&&P.emit&&(N!==void 0||(i.samples?.(z.traceId,I)??!0))?1:0});let B=L?void 0:p.start(I,P,R,z),V=z??B?.reference;if(V===void 0)throw Error(`A deferred trace scope requires a reserved reference.`);let H=!!(V.traceFlags&1);P={emit:P.emit&&H,recordInputs:P.emit&&H&&P.recordInputs,recordOutputs:P.emit&&H&&P.recordOutputs},F=s(F,P);let U=C.finished??!1,W=C.terminal,G=new Map,K=new Set,q=C.childSequence??0,J=C.usage,Y=new Set(C.usageKeys??[]),X={},re=F.type===`tool`?F.options.callId:void 0;function Z(){w()}function Q(){return t(P,i.active()?.capture)}async function ie(t,n,r={}){let i=G.get(n);if(e.durable&&i!==void 0&&!i.settled)return i.refine(t,r.startTimeMs),i;if(U)throw Error(`The operation is not permitted in this trace scope.`);for(let[e,t]of G)t.settled&&G.delete(e);let o=P;G.size>=O&&(m(Error(`Trace unfinished-child limit reached.`),{phase:`start`,operation:t.type,reference:V}),o=k),t.type===`model`&&B!==void 0&&a(B,{"agent.model.id":t.options.modelId});let s=await _(h,o,t,$,t.type===`step`?{index:t.options.index,attempt:t.options.attempt??0}:S,{key:n,executionContext:R,links:r.links,startTimeMs:r.startTimeMs},w);return(o.emit||G.size<O)&&G.set(n,s),await w(),s}async function ae(e,t){let n=F.type===`step`||F.type===`activation`;for(let r of G.values())(t||!n||!ne.has(r.type))&&await r.release({failed:e.failed,error:e.error,outcome:`abandoned`})}async function oe(t){if(K.size>0&&await Promise.allSettled(K),U)return;let r=Q();r.recordOutputs||(t={...t,error:void 0}),W?.failed&&(t={...t,outcome:t.outcome===`completed`?`failed`:t.outcome,failed:!0,error:W.error,errorCode:t.errorCode??W.errorCode}),U=!0,W=t,await ae(t,t.failed===!0||!e.durable),B??=p.start(I,P,R,V);let i=F.type===`activation`&&t.usage===void 0?{...t,usage:J}:t;try{n(B,F,i,{...r,emit:P.emit},E,d)}catch(e){m(e,{phase:`complete`,operation:F.type,reference:V})}if(a(B,X),F.type===`model`&&t.model!==void 0){await x?.usage(t.model.usage,T);let e=t.model.content;if(r.recordOutputs&&P.recordOutputs&&e!==void 0){let n=d.outputMessages(e,t.model.finishReason);n!==void 0&&x?.turnContent({output:n})}}B.end(t.endTimeMs),await w()}let $={waitUntil(e){K.add(e),x?.waitUntil(e),e.then(()=>K.delete(e),()=>K.delete(e))},snapshot:()=>ee($.record()),attributes:e=>$.update({attributes:e}),modelCall:(e,t)=>$.child({type:`model`,options:e},t),fail(e){return $.error(e),$.complete({outcome:`failed`,failed:!0})},update(e){if(U)return;let t=u(e.attributes??{},Q())??e.attributes;F.type===`activation`&&(F={...F,options:{...F.options,attributes:{...F.options.attributes,...t}}}),I={...I,attributes:{...I.attributes,...t},links:e.links??I.links},B!==void 0&&a(B,t),Z()},useContext(e){R=e;for(let t of G.values())t.useContext(e)},refine(e,t){if(U||B!==void 0)return;if(t!==void 0&&t<E&&(E=t),e.type===`tool`&&F.type===`tool`){let t=F.options;F=s({type:`tool`,options:{...t,kind:t.kind??e.options.kind,arguments:t.arguments??(Q().recordInputs?e.options.arguments:void 0)}},P)}let n=c({identity:h,data:F,attempt:S,capture:P,key:T,parent:N,startTimeMs:E,links:I.links},d),r=Object.fromEntries(Object.entries(n.attributes).filter(([,e])=>e!==void 0));I={...I,name:n.name,kind:n.kind,startTimeMs:E,attributes:{...I.attributes,...r}},Z()},narrow(e){P={...t(P,e),emit:P.emit},F=s(F,P);let n=u(I.attributes,P)??I.attributes;I={...I,attributes:F.type===`activation`?{...n,"agent.trace.content.input":P.recordInputs,"agent.trace.content.output":P.recordOutputs}:n};let r=u(X,P)??X;for(let e of Object.keys(X))e in r||delete X[e];!P.recordOutputs&&W?.error!==void 0&&(W={...W,error:void 0}),B?.narrow(P);for(let e of G.values())e.narrow(P);Z()},async release(t){U?await ae(t,t.failed===!0||!e.durable):await oe(M(t))},record(){return D({version:1,finished:U,terminal:W,usage:J,usageKeys:[...Y],attributes:{...I.attributes,...X},childSequence:q,children:[...G.values()].filter(e=>!e.settled).map(e=>e.record()),key:T,identity:h,data:F,capture:P,reference:V,parent:N,startTimeMs:E,attempt:S,links:I.links},d)},get parent(){return N},get startTimeMs(){return E},child(t,n,r){if(!o(t).includes(F.type))throw Error(`The operation is not permitted in this trace scope.`);let i=n===void 0?(e.durable?j(t):void 0)??`${t.type}:${q++}`:`${t.type}:${A(n)}`;return ie(t,`${T}/${i}`,r)},find(e){let t=j(e),n=t===void 0?void 0:G.get(`${T}/${t}`);return n===void 0||n.settled?void 0:n},get children(){return[...G.values()].filter(e=>!e.settled)},type:F.type,reference:V,callId:re,get capture(){return P},mcp:l({serializer:d,...P,write(e){let t=u(e,Q())??e;Object.assign(X,t),B!==void 0&&a(B,t)},error(e,t){$.error(e,t)}}),get finished(){return U},get settled(){return U&&[...G.values()].every(e=>e.settled)},run(e,n){if(U)throw Error(`The trace scope has already finished.`);let r=t(t(P,n),i.active()?.capture),a=F.type===`tool`&&(F.options.kind===`subagent-call`||F.options.kind===`remote-agent-call`)?F.options:void 0,o=a===void 0?e:()=>f({caller:V,conversationId:h.conversationId,parentRunId:h.runId,parentCallId:a.callId,agentName:a.name,capture:r},e);return b(i,{type:$.type,reference:V,capture:r,mcp:$.mcp},o,R)},async complete(e=W??{}){U||await oe(M(e))},async usage(e,t){t!==void 0&&Y.has(t)||(t!==void 0&&Y.add(t),B!==void 0&&a(B,r(e)),J={inputTokens:e.inputTokens===void 0?J?.inputTokens:(J?.inputTokens??0)+e.inputTokens,outputTokens:e.outputTokens===void 0?J?.outputTokens:(J?.outputTokens??0)+e.outputTokens,costUsd:e.costUsd===void 0?J?.costUsd:(J?.costUsd??0)+e.costUsd},await x?.usage(e,t))},turnContent(e){if(F.type!==`activation`)return x?.turnContent(e);if(U)return;let t={};e.input!==void 0&&I.attributes[`gen_ai.input.messages`]===void 0&&(t[`gen_ai.input.messages`]=e.input),e.output!==void 0&&(t[`gen_ai.output.messages`]=e.output),Object.keys(t).length>0&&$.update({attributes:t})},error(e,t){W={...W,failed:!0,error:Q().recordOutputs?e:void 0,errorCode:t??(e instanceof Error?e.name:void 0)},B!==void 0&&B.fail(W.error,W.errorCode),Z()}};for(let e of C.children??[])G.set(e.key,await _(e.identity,t(e.capture,P),e.data,$,e.attempt,{...e,deferred:!0,executionContext:R},w));!U&&B!==void 0&&F.type===`step`&&B.addEvent(`step.started`,void 0,E);let se=I.attributes[`gen_ai.input.messages`];return!U&&F.type===`model`&&typeof se==`string`&&x?.turnContent({input:se}),$}return{start(e){return _(e.identity,e.capture,e.data,void 0,void 0,{key:e.key,parent:e.parent,reference:e.reference,sample:e.reference!==void 0&&e.data.type===`activation`,startTimeMs:e.startTimeMs,links:e.links,executionContext:e.context},e.onChange??(()=>Promise.resolve()))},async restore(e,n={}){if(!E(e)){m(Error(`Invalid tracing checkpoint.`),{phase:`restore`});return}return _(e.identity,t(e.capture,n.capture),e.data,void 0,e.attempt,{...e,deferred:!0,executionContext:n.context},n.onChange??(()=>Promise.resolve()))}}}function P(e,t,n){try{e?.(t,{phase:n})}catch{}}function F(e,t={outcome:`completed`},n){async function r(r,i){if(i===void 0)return e(r);let a=await e(r),o=t;try{let e=await a.run(()=>i(a));try{o=r.describe?.(e)??t}catch(e){P(n,e,`complete`)}return e}catch(e){throw o={outcome:`failed`,errorType:e instanceof Error?e.name:`_OTHER`,error:e},e}finally{try{await a.complete(o)}catch(e){P(n,e,`complete`)}}}return r}function I(e,t,n){let r=t=>Object.defineProperties(t,{finished:{get:()=>e.finished},capture:{get:()=>e.capture},parent:{get:()=>e.parent}}),i={type:e.type,reference:e.reference,get startTimeMs(){return e.startTimeMs},get parent(){return e.parent},get finished(){return e.finished},get capture(){return e.capture},run:(t,n)=>e.run(t,n),attributes:t=>e.attributes(t),complete:t=>e.complete(t),fail:t=>e.fail(t),recordError:(t,n)=>e.error(t,n)},a=async(t,r,i)=>I(await e.child(t,r,i),t,n),o=F(async({startTimeMs:e,...t})=>a({type:`tool`,options:t},void 0,{startTimeMs:e}),void 0,n),s=e=>e===void 0?void 0:I(e,e.record().data,n),c=F(async e=>a({type:`memory`,options:e}),void 0,n);if(t.type===`activation`)return r({...i,memory:c,links:t=>e.update({links:t}),findAttempt:t=>s(e.find({type:`step`,options:{index:t.stepIndex,attempt:t.attempt}})),findTool:t=>s(L(e,t)),attempt:F(async e=>a({type:`step`,options:{index:e.stepIndex,attempt:e.attempt,runtimeContext:e.runtimeContext,channel:e.channel}},void 0,{links:e.links}),void 0,n)});if(t.type===`step`){let t=e=>F(async t=>a({type:`tool`,options:{callId:t.callId,name:t.agentName,kind:e}}),void 0,n),s=(e,t)=>a({type:`model`,options:e},t);async function l(e,t){if(typeof t!=`function`)return s(e,t);let r=await s(e),i;try{i=await r.run(t)}catch(e){try{await r.fail(e)}catch(e){P(n,e,`complete`)}throw e}try{await r.complete({outcome:`completed`,result:i})}catch(e){P(n,e,`complete`)}return i.result}return r({...i,memory:c,tool:o,callSubAgent:t(`subagent-call`),callRemoteAgent:t(`remote-agent-call`),modelCall:l,async modelStream(t,r){let i=await s(t);try{let t=await i.run(r),a=Promise.resolve(t.completion).then(e=>i.complete({outcome:`completed`,result:e}),e=>i.fail(e)).catch(e=>P(n,e,`complete`));return e.waitUntil(a),t.result}catch(e){try{await i.fail(e)}catch(e){P(n,e,`complete`)}throw e}}})}return t.type===`tool`?r({...i,memory:c,tool:o,findApproval:n=>s(e.find({type:`approval`,options:{requestId:n,callId:t.options.callId,toolName:t.options.name}})),approval:F(async e=>a({type:`approval`,options:{...e,callId:t.options.callId,toolName:t.options.name}}),{outcome:`ignored`},n)}):i}function L(e,t){for(let n of e.children){if(n.type===`tool`&&n.callId===t)return n;if(n.type===`step`||n.type===`tool`){let e=L(n,t);if(e!==void 0)return e}}}const R={emit:!0,recordInputs:!1,recordOutputs:!1};function z(n){let r=n.telemetry??e(),i=n.checkpointer;if(i!==void 0&&r.ids===void 0)throw Error(`Durable agent tracing needs stable span IDs. Pass the AgentSpanIdGenerator installed on your tracer provider to otelTelemetry({ idGenerator }).`);let a=(e,t)=>{try{n.onError?.(e,t)}catch{}},o=N({telemetry:r,serializer:n.serializer??d,durable:i!==void 0,onError:n.onError}),s=new Map;function c(e){return i===void 0?`turn:${g()}`:[`turn`,e.runId,e.turnId].map(encodeURIComponent).join(`:`)}function l(e,t){let n=Promise.resolve();return()=>{let r=t();return i===void 0||r===void 0?n:(r.writes++,n=n.then(async()=>{try{if(r.root.settled)s.delete(e),await i.delete(e);else{let t=g();await i.set(e,ee({...r.root.record(),revision:t})),r.revision=t}}catch(e){a(e,{phase:`checkpoint`,operation:`activation`})}finally{r.writes--}}),n)}}async function u(e){try{return await i.get(e)}catch(e){a(e,{phase:`restore`,operation:`activation`});return}}async function f(e,t,n,r,a){let s=i===void 0?void 0:await u(e);if(t!==void 0&&(t.writes>0||s?.revision===t.revision))return r!==void 0&&t.root.useContext(r),a!==void 0&&t.root.narrow(a),t;let c,d=l(e,()=>c),f=s===void 0?void 0:await o.restore(s,{capture:a,context:r,onChange:d}),p=f??await n?.(d);if(p!==void 0)return c={root:p,revision:s?.revision,writes:0},f===void 0&&await d(),c}function m(e,t){let n=s.get(e),r=(async()=>t(n===void 0?void 0:await n.catch(()=>void 0)))();return s.set(e,r),r.then(t=>{(t===void 0||t.root.settled)&&s.delete(e)},()=>s.delete(e)),s.size>1e3&&s.delete(s.keys().next().value),r}function h(e,n){return i=>{let a=p(),s=t(e.capture??R,a?.capture),c=a!==void 0&&e.sequence===0,l=e.parent??(c&&a?.remote!==!0?a?.caller:void 0),u=[...c&&a?.remote===!0?[{relationship:`agent.dispatch`,context:a.caller}]:[],...e.links??[]];return o.start({identity:{...e.identity,conversationId:a?.conversationId??e.identity.conversationId,agentName:e.agentName,framework:e.framework},key:n,capture:s,parent:l,reference:r.ids===void 0?void 0:e.reference,startTimeMs:e.startTimeMs,data:{type:`activation`,options:{sequence:e.sequence,attributes:e.attributes,channel:e.channel,subagent:a!==void 0||e.lineage!==void 0,subagentName:a?.agentName??e.lineage?.agentName,parentRunId:a?.parentRunId??e.lineage?.parentRunId,parentCallId:a?.parentCallId??e.lineage?.parentCallId}},links:u.length===0?void 0:u,context:e.context,onChange:i})}}function _(e){return I(e,{type:`activation`,options:{sequence:0}},n.onError)}async function v(e){let t=c(e.identity);return _((i===void 0?await f(t,void 0,h(e,t),e.context):await m(t,n=>f(t,n,h(e,t),e.context,e.capture))).root)}async function y(e){if(i===void 0)return;let t=c(e.identity),n=await m(t,n=>f(t,n,void 0,e.context));return n===void 0?void 0:_(n.root)}async function b(e){try{await e()}catch(e){a(e,{phase:`complete`})}}async function x(e,t,n){let i=r.active(),s=await o.start({identity:t.identity,key:`memory:${g()}`,capture:t.capture??i?.capture??R,parent:t.parent??i?.reference,context:t.context,data:{type:`memory`,options:{operation:e,phase:t.phase,slot:t.slot,storeId:t.storeId}}}),c;try{c=await s.run(n)}catch(e){throw await s.fail(e).catch(e=>a(e,{phase:`complete`})),e}return await s.complete({outcome:`completed`,...t.describe?.(c)}).catch(e=>a(e,{phase:`complete`})),c}return{turn:F(v,void 0,n.onError),resume:y,memory:{search:(e,t)=>x(`search_memory`,e,t),write:(e,t)=>x(`upsert_memory`,e,t)},forceFlush:()=>b(()=>r.forceFlush()),shutdown:()=>b(()=>r.shutdown())}}export{_ as AgentSpanIdGenerator,z as createAgentTracing,i as currentCapture,e as otelTelemetry};
1
+ import{b as e,f as t,g as n,i as r,l as i,m as a,n as o,o as s,r as c,s as l,t as u,u as d,v as f}from"../../_chunks/workflow/mcp-Bwx_LQ4q.js";import{n as p,t as m}from"../../_chunks/workflow/delegation-BqhZ398D.js";import{createHash as h,randomBytes as g,randomUUID as _}from"node:crypto";var v=class{#e;#t;allocateSpanId(){return b(16)}deriveSpanId(e){return y(e)}deriveTraceId(e){let t=h(`sha256`).update(e).digest(`hex`).slice(0,32);return/^0+$/u.test(t)?`00000000000000000000000000000001`:t}generateSpanId(){let e=this.#e;return e===void 0?b(16):(this.#e=void 0,e)}generateTraceId(){let e=this.#t;return e===void 0?b(32):(this.#t=void 0,e)}withSpanId(e,t){this.#e=e;try{return t()}finally{this.#e=void 0}}withTraceId(e,t){this.#t=e;try{return t()}finally{this.#t=void 0}}};function y(e){let t=h(`sha256`).update(e).digest(`hex`).slice(0,16);return/^0+$/u.test(t)?`0000000000000001`:t}function b(e){let t;do{t=``;for(let n=0;n<e;n+=1)t+=`0123456789abcdef`[Math.trunc(Math.random()*16)]}while(!/[1-9a-f]/u.test(t));return t}function x(e,t,n,r){let i=!1;try{return e.run(t,()=>(i=!0,n()),r)}catch(t){if(i)throw t;if(e.suppressed!==void 0)try{return e.suppressed(()=>(i=!0,n()))}catch(e){if(i)throw e}return n()}}function S(e){function t(t,n=`complete`,r){try{return t()}catch(t){try{e.onError?.(t,{phase:n,reference:r})}catch{}return}}function r(r,i,a,o){let s=d(r.attributes,i)??r.attributes,c=i.emit?t(()=>e.telemetry.startSpan({...r,attributes:s},{reference:o,context:a}),`start`,o):void 0,l=c?.reference??{traceId:`0`.repeat(32),spanId:`0`.repeat(16),traceFlags:0},u=!1;return{reference:l,get capture(){return i},narrow(e){i=n(i,e)},get finished(){return u},setAttribute(e,n){let r=d({[e]:n},i);!u&&(r===void 0||e in r)&&t(()=>c?.setAttribute(e,r===void 0?n:r[e]))},addEvent(e,n,r){u||t(()=>c?.addEvent(e,n===void 0?void 0:d(n,i)??n,r))},fail(e,n){u||t(()=>c?.fail(i.recordOutputs?e:void 0,n??(e instanceof Error?e.name:void 0)))},setStatus(e){u||t(()=>c?.setStatus(e))},end(e){u||(u=!0,t(()=>c?.end(e)))},run(t){return u?t():x(e.telemetry,{type:r.type,reference:l,capture:i},t,a)}}}return{start:r,startReserved:(e,t,n,i)=>r(e,n,i,t)}}const C=32768,w=65536;function T(e,t){function n(t,n){return r(()=>Reflect.apply(e[t],e,n))}function r(e){try{let t=e();return t===void 0||new TextEncoder().encode(t).length>C?void 0:t}catch(e){try{t?.(e,{phase:`serialize`})}catch{}return}}return{json:e=>n(`json`,[e]),text:e=>n(`text`,[e]),inputMessages:t=>{let n=0,i=r(()=>{let r=e.inputMessages(t);return n=r?.omitted??0,r?.json});return i===void 0?void 0:{json:i,omitted:n}},instructions:e=>n(`instructions`,[e]),toolDefinitions:e=>n(`toolDefinitions`,[e]),outputMessages:(e,t)=>n(`outputMessages`,[e,t]),toolResults:e=>n(`toolResults`,[e])}}function E(e){return new TextEncoder().encode(JSON.stringify({...e,children:void 0})).length}function ee(e){return JSON.parse(JSON.stringify(e))}function D(e,t=w,n=0){try{if(n>16||typeof e!=`object`||!e)return!1;let r=e;if(r.children!==void 0&&(!Array.isArray(r.children)||r.children.length>1e4||!r.children.every(e=>D(e,t,n+1)))||r.version!==1||r.finished!==void 0&&typeof r.finished!=`boolean`||r.childSequence!==void 0&&(!Number.isSafeInteger(r.childSequence)||r.childSequence<0)||typeof r.key!=`string`||typeof r.startTimeMs!=`number`||!Number.isFinite(r.startTimeMs)||r.reference.traceFlags!==0&&r.reference.traceFlags!==1||r.reference.tracestate!==void 0&&(typeof r.reference.tracestate!=`string`||r.reference.tracestate.length>512)||r.parent!==void 0&&(!/^[a-f0-9]{32}$/u.test(r.parent.traceId)||!/^[a-f0-9]{16}$/u.test(r.parent.spanId))||![r.identity.conversationId,r.identity.runId,r.identity.turnId].every(e=>typeof e==`string`))return!1;let i=r.data.options;return!(!{activation:[],step:[],model:[`provider`,`modelId`],tool:[`callId`,`name`],approval:[`requestId`,`callId`,`toolName`],memory:[`operation`,`phase`,`slot`,`storeId`]}[r.data.type].every(e=>typeof i[e]==`string`)||r.data.type===`activation`&&!Number.isSafeInteger(i.sequence)||r.data.type===`step`&&!Number.isSafeInteger(i.index)||r.data.type===`memory`&&i.operation!==`search_memory`&&i.operation!==`upsert_memory`||!/^[a-f0-9]{32}$/u.test(r.reference.traceId)||!/^[a-f0-9]{16}$/u.test(r.reference.spanId)||typeof r.reference.traceFlags!=`number`||![r.capture.emit,r.capture.recordInputs,r.capture.recordOutputs].every(e=>typeof e==`boolean`)||![`activation`,`step`,`model`,`tool`,`approval`,`memory`].includes(r.data.type)||typeof r.data.options!=`object`||r.data.options===null||E(r)>t)}catch{return!1}}function O(e,t){let n=e.terminal;e={...e,children:e.children?.map(n=>O({...n,capture:{emit:n.capture.emit&&e.capture.emit,recordInputs:n.capture.recordInputs&&e.capture.recordInputs,recordOutputs:n.capture.recordOutputs&&e.capture.recordOutputs}},t))},e={...e,terminal:n===void 0||e.finished?void 0:{...n,errorCode:n.errorCode??(n.error instanceof Error?n.error.name:void 0),error:e.capture.recordOutputs?n.error instanceof Error?{name:n.error.name,message:t.text(n.error.message)}:n.error:void 0,output:e.capture.recordOutputs?n.output:void 0,response:e.capture.recordOutputs?n.response:void 0,records:e.capture.recordInputs?n.records:void 0,model:n.model===void 0?void 0:{...n.model,content:e.capture.recordOutputs?n.model.content:void 0}}},e={...e,attributes:d(e.attributes??{},e.capture)??e.attributes};let r=c(e.data,e.capture),i;try{i=t.json(r)}catch{}let a=()=>{let t=c(r,{emit:e.capture.emit,recordInputs:!1,recordOutputs:!1});return t.type===`step`&&(t={...t,options:{...t.options,runtimeContext:void 0}}),t.type===`model`&&(t={...t,options:{...t.options,runtimeContext:void 0}}),JSON.parse(JSON.stringify({...e,version:1,data:t,terminal:e.terminal===void 0?void 0:{outcome:e.terminal.outcome,failed:e.terminal.failed,errorCode:e.terminal.errorCode,usage:e.terminal.usage},attributes:d(e.attributes??{},{recordInputs:!1,recordOutputs:!1})??e.attributes}))};if(i===void 0||new TextEncoder().encode(i).length>C)return a();try{let t=JSON.parse(JSON.stringify({...e,version:1,data:JSON.parse(i)}));return E(t)<=w?t:a()}catch{return a()}}const k=1e4,A={emit:!1,recordInputs:!1,recordOutputs:!1},te=new Set([`activation`,`tool`,`approval`]),ne=new Set([`tool`,`approval`]);function j(e){return encodeURIComponent(String(e))}function re(e){switch(e.type){case`step`:return`step:${j(e.options.index)}:${j(e.options.attempt??0)}`;case`tool`:return`tool:${j(e.options.callId)}`;case`approval`:return`approval:${j(e.options.requestId)}`;default:return}}function ie(e){let t=e.failed||e.outcome===`failed`;return{...e,model:`result`in e?e.result:e.model,failed:t,errorCode:`errorType`in e?e.errorType:e.errorCode}}function M(t){let a=t.telemetry,f=T(t.serializer,t.onError),m=S({telemetry:a,onError:t.onError}),h=(e,n)=>{try{t.onError?.(e,n)}catch{}};function _(e){let t=f.json(e);try{return t===void 0?void 0:JSON.parse(t)}catch{return}}function v(e,n,r,i,o){let s=a.ids;if(t.durable&&s!==void 0&&e.type!==`model`&&e.type!==`memory`){if(e.type===`activation`&&r!==void 0)return{traceId:r.traceId,spanId:s.spanId(n),traceFlags:o.emit?r.traceFlags&1:0};if(e.type===`activation`){let e=s.traceId(n);return{traceId:e,spanId:s.spanId(n),traceFlags:o.emit&&(a.samples?.(e,i)??!0)?1:0}}return r===void 0?void 0:{...r,spanId:s.spanId(n),isRemote:!1}}}async function y(e,t,n,r,i,a,o){try{return await b(e,t,n,r,i,a,o)}catch(t){return h(t,{phase:`start`,operation:n.type,reference:a.reference}),b(e,A,c(n,A),r,i,{...a,sample:!1,reference:{traceId:a.reference?.traceId??r?.reference.traceId??a.parent?.traceId??g(16).toString(`hex`),spanId:a.reference?.spanId??g(8).toString(`hex`),traceFlags:0}},o)}}async function b(g,b,S,C,w,T,E){if(T.terminal?.error!==null&&typeof T.terminal?.error==`object`&&!(T.terminal.error instanceof Error)&&`message`in T.terminal.error&&typeof T.terminal.error.message==`string`){let e=Error(T.terminal.error.message);e.name=T.terminal.errorCode??`Error`,T={...T,terminal:{...T.terminal,error:e}}}let D=T.key,M=T.startTimeMs??Date.now(),N=T.parent??C?.reference;b.emit&&(b=n(b,a.active()?.capture));let P=b,F=c(S,P),I=l({identity:g,data:F,attempt:w,capture:P,key:D,parent:N,startTimeMs:M,links:T.links},f);I={...I,attributes:{...I.attributes,...T.attributes}},F=O({key:D,identity:g,data:F,capture:P,reference:T.reference??{traceId:`0`.repeat(32),spanId:`0`.repeat(16),traceFlags:0},startTimeMs:M},f).data;let L=T.deferred??(t.durable&&te.has(F.type)),R=T.executionContext,z=T.reference??v(S,D,N,I,P);T.sample===!0&&z!==void 0&&(z={...z,traceFlags:z.traceFlags&1&&P.emit&&(N!==void 0||(a.samples?.(z.traceId,I)??!0))?1:0});let B=L?void 0:m.start(I,P,R,z),V=z??B?.reference;if(V===void 0)throw Error(`A deferred trace scope requires a reserved reference.`);let H=!!(V.traceFlags&1);P={emit:P.emit&&H,recordInputs:P.emit&&H&&P.recordInputs,recordOutputs:P.emit&&H&&P.recordOutputs},F=c(F,P);let U=T.finished??!1,W=T.terminal,G=new Map,K=new Set,ae=T.childSequence??0,q=T.usage,J=new Set(T.usageKeys??[]),Y={},oe=F.type===`tool`?F.options.callId:void 0;function X(){E()}function Z(){return n(P,a.active()?.capture)}async function se(e,n,r={}){let i=G.get(n);if(t.durable&&i!==void 0&&!i.settled)return i.refine(e,r.startTimeMs),i;if(U)throw Error(`The operation is not permitted in this trace scope.`);for(let[e,t]of G)t.settled&&G.delete(e);let a=P;G.size>=k&&(h(Error(`Trace unfinished-child limit reached.`),{phase:`start`,operation:e.type,reference:V}),a=A),e.type===`model`&&B!==void 0&&o(B,{"agent.model.id":e.options.modelId});let s=await y(g,a,e,$,e.type===`step`?{index:e.options.index,attempt:e.options.attempt??0}:w,{key:n,executionContext:R,links:r.links,startTimeMs:r.startTimeMs},E);return(a.emit||G.size<k)&&G.set(n,s),await E(),s}async function Q(e,t){let n=F.type===`step`||F.type===`activation`;for(let r of G.values())(t||!n||!ne.has(r.type))&&await r.release({failed:e.failed,error:e.error,outcome:`abandoned`})}async function ce(e){if(K.size>0&&await Promise.allSettled(K),U)return;let n=Z();n.recordOutputs||(e={...e,error:void 0}),W?.failed&&(e={...e,outcome:e.outcome===`completed`?`failed`:e.outcome,failed:!0,error:W.error,errorCode:e.errorCode??W.errorCode}),U=!0,W=e,await Q(e,e.failed===!0||!t.durable),B??=m.start(I,P,R,V);let i=F.type===`activation`&&e.usage===void 0?{...e,usage:q}:e;try{r(B,F,i,{...n,emit:P.emit},M,f)}catch(e){h(e,{phase:`complete`,operation:F.type,reference:V})}if(o(B,Y),F.type===`model`&&e.model!==void 0){await C?.usage(e.model.usage,D);let t=e.model.content;if(n.recordOutputs&&P.recordOutputs&&t!==void 0){let n=f.outputMessages(t,e.model.finishReason);n!==void 0&&C?.turnContent({output:n})}}B.end(e.endTimeMs),await E()}let $={waitUntil(e){K.add(e),C?.waitUntil(e),e.then(()=>K.delete(e),()=>K.delete(e))},snapshot:()=>ee($.record()),attributes:e=>$.update({attributes:e}),modelCall:(e,t)=>$.child({type:`model`,options:e},t),fail(e){return $.error(e),$.complete({outcome:`failed`,failed:!0})},update(e){if(U)return;let t=d(e.attributes??{},Z())??e.attributes;F.type===`activation`&&(F={...F,options:{...F.options,attributes:{...F.options.attributes,...t}}}),I={...I,attributes:{...I.attributes,...t},links:e.links??I.links},B!==void 0&&o(B,t),X()},useContext(e){R=e;for(let t of G.values())t.useContext(e)},refine(e,t){if(U||B!==void 0)return;if(t!==void 0&&t<M&&(M=t),e.type===`tool`&&F.type===`tool`){let t=F.options;F=c({type:`tool`,options:{...t,kind:t.kind??e.options.kind,arguments:t.arguments??(Z().recordInputs?_(e.options.arguments):void 0)}},P)}let n=l({identity:g,data:F,attempt:w,capture:P,key:D,parent:N,startTimeMs:M,links:I.links},f),r=Object.fromEntries(Object.entries(n.attributes).filter(([,e])=>e!==void 0));I={...I,name:n.name,kind:n.kind,startTimeMs:M,attributes:{...I.attributes,...r}},X()},narrow(e){P={...n(P,e),emit:P.emit},F=c(F,P);let t=d(I.attributes,P)??I.attributes;I={...I,attributes:F.type===`activation`?{...t,"agent.trace.content.input":P.recordInputs,"agent.trace.content.output":P.recordOutputs}:t};let r=d(Y,P)??Y;for(let e of Object.keys(Y))e in r||delete Y[e];!P.recordOutputs&&W?.error!==void 0&&(W={...W,error:void 0}),B?.narrow(P);for(let e of G.values())e.narrow(P);X()},async release(e){U?await Q(e,e.failed===!0||!t.durable):await ce(ie(e))},record(){return O({version:1,finished:U,terminal:W,usage:q,usageKeys:[...J],attributes:{...I.attributes,...Y},childSequence:ae,children:[...G.values()].filter(e=>!e.settled).map(e=>e.record()),key:D,identity:g,data:F,capture:P,reference:V,parent:N,startTimeMs:M,attempt:w,links:I.links},f)},get parent(){return N},get startTimeMs(){return M},child(e,n,r){if(!s(e).includes(F.type))throw Error(`The operation is not permitted in this trace scope.`);let i=n===void 0?(t.durable?re(e):void 0)??`${e.type}:${ae++}`:`${e.type}:${j(n)}`;return se(e,`${D}/${i}`,r)},find(e){let t=re(e),n=t===void 0?void 0:G.get(`${D}/${t}`);return n===void 0||n.settled?void 0:n},get children(){return[...G.values()].filter(e=>!e.settled)},type:F.type,reference:V,callId:oe,get capture(){return P},mcp:u({serializer:f,...P,write(e){let t=d(e,Z())??e;Object.assign(Y,t),B!==void 0&&o(B,t)},error(e,t){$.error(e,t)}}),get finished(){return U},get settled(){return U&&[...G.values()].every(e=>e.settled)},run(e,t){if(U)throw Error(`The trace scope has already finished.`);let r=n(n(P,t),a.active()?.capture),i=F.type===`tool`&&(F.options.kind===`subagent-call`||F.options.kind===`remote-agent-call`)?F.options:void 0,o=i===void 0?e:()=>p({caller:V,conversationId:g.conversationId,parentRunId:g.runId,parentCallId:i.callId,agentName:i.name,capture:r},e);return x(a,{type:$.type,reference:V,capture:r,mcp:$.mcp},o,R)},async complete(e=W??{}){U||await ce(ie(e))},async usage(e,t){t!==void 0&&J.has(t)||(t!==void 0&&J.add(t),B!==void 0&&o(B,i(e)),q={inputTokens:e.inputTokens===void 0?q?.inputTokens:(q?.inputTokens??0)+e.inputTokens,outputTokens:e.outputTokens===void 0?q?.outputTokens:(q?.outputTokens??0)+e.outputTokens,costUsd:e.costUsd===void 0?q?.costUsd:(q?.costUsd??0)+e.costUsd},await C?.usage(e,t))},turnContent(e){if(F.type!==`activation`)return C?.turnContent(e);if(U)return;let t={};e.input!==void 0&&I.attributes[`gen_ai.input.messages`]===void 0&&(t[`gen_ai.input.messages`]=e.input),e.output!==void 0&&(t[`gen_ai.output.messages`]=e.output),Object.keys(t).length>0&&$.update({attributes:t})},error(t,n){W={...W,failed:!0,error:Z().recordOutputs?t instanceof Error?e(t):_(t):void 0,errorCode:n??(t instanceof Error?t.name:void 0)},B!==void 0&&B.fail(W.error,W.errorCode),X()}};for(let e of T.children??[])G.set(e.key,await y(e.identity,n(e.capture,P),e.data,$,e.attempt,{...e,deferred:!0,executionContext:R},E));!U&&B!==void 0&&F.type===`step`&&B.addEvent(`step.started`,void 0,M);let le=I.attributes[`gen_ai.input.messages`];return!U&&F.type===`model`&&typeof le==`string`&&C?.turnContent({input:le}),$}return{start(e){return y(e.identity,e.capture,e.data,void 0,void 0,{key:e.key,parent:e.parent,reference:e.reference,sample:e.reference!==void 0&&e.data.type===`activation`,startTimeMs:e.startTimeMs,links:e.links,executionContext:e.context},e.onChange??(()=>Promise.resolve()))},async restore(e,t={}){if(!D(e)){h(Error(`Invalid tracing checkpoint.`),{phase:`restore`});return}return y(e.identity,n(e.capture,t.capture),e.data,void 0,e.attempt,{...e,deferred:!0,executionContext:t.context},t.onChange??(()=>Promise.resolve()))}}}function N(e,t,n){try{e?.(t,{phase:n})}catch{}}function P(e,t={outcome:`completed`},n){async function r(r,i){if(i===void 0)return e(r);let a=await e(r),o=t;try{let e=await a.run(()=>i(a));try{o=r.describe?.(e)??t}catch(e){N(n,e,`complete`)}return e}catch(e){throw o={outcome:`failed`,errorType:e instanceof Error?e.name:`_OTHER`,error:e},e}finally{try{await a.complete(o)}catch(e){N(n,e,`complete`)}}}return r}function F(e,t,n){let r=t=>Object.defineProperties(t,{finished:{get:()=>e.finished},capture:{get:()=>e.capture},parent:{get:()=>e.parent}}),i={type:e.type,reference:e.reference,get startTimeMs(){return e.startTimeMs},get parent(){return e.parent},get finished(){return e.finished},get capture(){return e.capture},run:(t,n)=>e.run(t,n),attributes:t=>e.attributes(t),complete:t=>e.complete(t),fail:t=>e.fail(t),recordError:(t,n)=>e.error(t,n)},a=async(t,r,i)=>F(await e.child(t,r,i),t,n),o=P(async({startTimeMs:e,...t})=>a({type:`tool`,options:t},void 0,{startTimeMs:e}),void 0,n),s=e=>e===void 0?void 0:F(e,e.record().data,n),c=P(async e=>a({type:`memory`,options:e}),void 0,n);if(t.type===`activation`)return r({...i,memory:c,links:t=>e.update({links:t}),findAttempt:t=>s(e.find({type:`step`,options:{index:t.stepIndex,attempt:t.attempt}})),findTool:t=>s(I(e,t)),attempt:P(async e=>a({type:`step`,options:{index:e.stepIndex,attempt:e.attempt,runtimeContext:e.runtimeContext,channel:e.channel}},void 0,{links:e.links}),void 0,n)});if(t.type===`step`){let t=e=>P(async t=>a({type:`tool`,options:{callId:t.callId,name:t.agentName,kind:e}}),void 0,n),s=(e,t)=>a({type:`model`,options:e},t);async function l(e,t){if(typeof t!=`function`)return s(e,t);let r=await s(e),i;try{i=await r.run(t)}catch(e){try{await r.fail(e)}catch(e){N(n,e,`complete`)}throw e}try{await r.complete({outcome:`completed`,result:i})}catch(e){N(n,e,`complete`)}return i.result}return r({...i,memory:c,tool:o,callSubAgent:t(`subagent-call`),callRemoteAgent:t(`remote-agent-call`),modelCall:l,async modelStream(t,r){let i=await s(t);try{let t=await i.run(r),a=Promise.resolve(t.completion).then(e=>i.complete({outcome:`completed`,result:e}),e=>i.fail(e)).catch(e=>N(n,e,`complete`));return e.waitUntil(a),t.result}catch(e){try{await i.fail(e)}catch(e){N(n,e,`complete`)}throw e}}})}return t.type===`tool`?r({...i,memory:c,tool:o,findApproval:n=>s(e.find({type:`approval`,options:{requestId:n,callId:t.options.callId,toolName:t.options.name}})),approval:P(async e=>a({type:`approval`,options:{...e,callId:t.options.callId,toolName:t.options.name}}),{outcome:`ignored`},n)}):i}function I(e,t){for(let n of e.children){if(n.type===`tool`&&n.callId===t)return n;if(n.type===`step`||n.type===`tool`){let e=I(n,t);if(e!==void 0)return e}}}const L={emit:!0,recordInputs:!1,recordOutputs:!1};function R(e){let r=e.telemetry??t(),i=e.checkpointer;if(i!==void 0&&r.ids===void 0)throw Error(`Durable agent tracing needs stable span IDs. Pass the AgentSpanIdGenerator installed on your tracer provider to otelTelemetry({ idGenerator }).`);let a=(t,n)=>{try{e.onError?.(t,n)}catch{}},o=M({telemetry:r,serializer:e.serializer??f,durable:i!==void 0,onError:e.onError}),s=new Map;function c(e){return i===void 0?`turn:${_()}`:[`turn`,e.runId,e.turnId].map(encodeURIComponent).join(`:`)}function l(e,t){let n=Promise.resolve();return()=>{let r=t();return i===void 0||r===void 0?n:(r.writes++,n=n.then(async()=>{try{if(r.root.settled)s.delete(e),await i.delete(e);else{let t=_();await i.set(e,ee({...r.root.record(),revision:t})),r.revision=t}}catch(e){a(e,{phase:`checkpoint`,operation:`activation`})}finally{r.writes--}}),n)}}async function u(e){try{return await i.get(e)}catch(e){a(e,{phase:`restore`,operation:`activation`});return}}async function d(e,t,r,a,s){let c=m()?.capture;s=s===void 0?c:n(s,c);let d=i===void 0?void 0:await u(e);if(t!==void 0&&(t.writes>0||d?.revision===t.revision))return a!==void 0&&t.root.useContext(a),s!==void 0&&t.root.narrow(s),t;let f,p=l(e,()=>f),h=d===void 0?void 0:await o.restore(d,{capture:s,context:a,onChange:p}),g=h??await r?.(p);if(g!==void 0)return f={root:g,revision:d?.revision,writes:0},h===void 0&&await p(),f}function p(e,t){let n=s.get(e),r=(async()=>t(n===void 0?void 0:await n.catch(()=>void 0)))();return s.set(e,r),r.then(t=>{(t===void 0||t.root.settled)&&s.delete(e)},()=>s.delete(e)),s.size>1e3&&s.delete(s.keys().next().value),r}function h(e,t){return i=>{let a=m(),s=n(e.capture??L,a?.capture),c=a!==void 0&&e.sequence===0,l=e.parent??(c&&a?.remote!==!0?a?.caller:void 0),u=[...c&&a?.remote===!0?[{relationship:`agent.dispatch`,context:a.caller}]:[],...e.links??[]];return o.start({identity:{...e.identity,conversationId:a?.conversationId??e.identity.conversationId,agentName:e.agentName,framework:e.framework},key:t,capture:s,parent:l,reference:r.ids===void 0?void 0:e.reference,startTimeMs:e.startTimeMs,data:{type:`activation`,options:{sequence:e.sequence,attributes:e.attributes,channel:e.channel,subagent:a!==void 0||e.lineage!==void 0,subagentName:a?.agentName??e.lineage?.agentName,parentRunId:a?.parentRunId??e.lineage?.parentRunId,parentCallId:a?.parentCallId??e.lineage?.parentCallId}},links:u.length===0?void 0:u,context:e.context,onChange:i})}}function g(t){return F(t,{type:`activation`,options:{sequence:0}},e.onError)}async function v(e){let t=c(e.identity);return g((i===void 0?await d(t,void 0,h(e,t),e.context):await p(t,n=>d(t,n,h(e,t),e.context,e.capture))).root)}async function y(e){if(i===void 0)return;let t=c(e.identity),n=await p(t,n=>d(t,n,void 0,e.context));return n===void 0?void 0:g(n.root)}async function b(e){try{await e()}catch(e){a(e,{phase:`complete`})}}async function x(e,t,n){let i=r.active(),s=await o.start({identity:t.identity,key:`memory:${_()}`,capture:t.capture??i?.capture??L,parent:t.parent??i?.reference,context:t.context,data:{type:`memory`,options:{operation:e,phase:t.phase,slot:t.slot,storeId:t.storeId}}}),c;try{c=await s.run(n)}catch(e){throw await s.fail(e).catch(e=>a(e,{phase:`complete`})),e}return await s.complete({outcome:`completed`,...t.describe?.(c)}).catch(e=>a(e,{phase:`complete`})),c}return{turn:P(v,void 0,e.onError),resume:y,memory:{search:(e,t)=>x(`search_memory`,e,t),write:(e,t)=>x(`upsert_memory`,e,t)},forceFlush:()=>b(()=>r.forceFlush()),shutdown:()=>b(()=>r.shutdown())}}export{v as AgentSpanIdGenerator,R as createAgentTracing,a as currentCapture,t as otelTelemetry};
@@ -1 +1 @@
1
- import{S as e,_ as t,a as n,b as r,c as i,d as a,h as o,p as s,t as c,u as l,x as u,y as d}from"../../_chunks/workflow/mcp-CrGp4EC8.js";export{t as CONTENT_ATTRIBUTE_LIMIT,i as USAGE_FIELDS,a as activeTraceOperation,d as boundedPrincipalId,r as contentAttribute,n as invocationName,c as mcpLifecycle,u as telemetryByteLength,e as truncateTelemetryText,o as withCapture,s as withErrorContent,l as withoutDeclinedContent};
1
+ import{C as e,S as t,_ as n,a as r,c as i,d as a,h as o,p as s,t as c,u as l,x as u,y as d}from"../../_chunks/workflow/mcp-Bwx_LQ4q.js";export{n as CONTENT_ATTRIBUTE_LIMIT,i as USAGE_FIELDS,a as activeTraceOperation,d as boundedPrincipalId,u as contentAttribute,r as invocationName,c as mcpLifecycle,t as telemetryByteLength,e as truncateTelemetryText,o as withCapture,s as withErrorContent,l as withoutDeclinedContent};
@@ -0,0 +1,5 @@
1
+ import{D as e,E as t,c as n,l as r,r as i,s as a,u as o}from"./esm-DtrPCf49.js";const s=32768,c={json:m,text:h,inputMessages:e=>te(e,e=>typeof e==`string`?e:void 0),instructions:ne,toolDefinitions:oe,outputMessages:re,toolResults:ie},l=new TextEncoder,u=new TextDecoder;function d(e){return l.encode(e).length}function f(e,t){let n=e.slice(0,t+1),r=l.encode(n);if(n.length===e.length&&r.length<=t)return e;let i=`... [truncated]`.slice(0,t),a=Math.max(0,t-i.length);for(;a>0&&(r[a]&192)==128;)--a;return u.decode(r.subarray(0,a))+i}function ee(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&d(e)<=1024?e:void 0}function p(e){let t=Error(f(e.message,4096));return t.name=f(e.name,128),t.stack=e.stack===void 0?void 0:f(e.stack,8192),t}function m(e){if(e===void 0)return;let t;try{t=JSON.stringify(e)}catch{return}if(t!==void 0)return h(t)}function te(e,t){if(!Array.isArray(e))return;let n=e.flatMap(e=>{if(!S(e)||e.role===`system`||typeof e.role!=`string`)return[];let n=b(e.content);if(n.length===0)return[];let r=e.role===`user`?t?.(e.kind):void 0;return[r===void 0?{parts:n,role:e.role}:{kind:r,parts:n,role:e.role}]});for(let e=0;e<n.length;e+=1){let t=_(n.slice(e));if(t!==void 0)return{json:t,omitted:e}}let r=ce(n);return r===void 0?{json:`[]`,omitted:n.length}:{json:r,omitted:n.length-1}}function ne(e){let t=se(e);if(t!==void 0)return v(t,e=>[{content:e,type:`text`}])}function re(e,t){let n=b(e),r=t===`tool-calls`?`tool_call`:t,i=e=>[{finish_reason:r,parts:e,role:`assistant`}];return _(i(n))??v(y(n),e=>i([{content:e,type:`text`}]),!0)}function ie(e){if(e.length===0)return;let t=g(e);if(t!==void 0&&t.length<=32768)return t;for(let t=s;t>=0;t=t>=256?Math.floor(t/2):-1){let n=g(e.map(e=>ae(e,t)));if(n!==void 0&&n.length<=32768)return n}}function ae(e,t){let n={toolName:e.toolName};for(let r of[`input`,`output`,`error`]){if(!(r in e))continue;let i=e[r],a=typeof i==`string`?i:g(i)??``;n[r]=a.length<=t?a:`${a.slice(0,t)}… [truncated]`}return n}function oe(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>{if(!S(e)||typeof e.name!=`string`)return[];let t={name:e.name};return typeof e.description==`string`&&(t.description=e.description),e.inputSchema!==void 0&&(t.parameters=e.inputSchema),[t]});if(t.length===0)return;let n=[],r=2;for(let e of t){let t=g(e);if(t===void 0)break;let i=r+(n.length===0?0:1)+t.length;if(i>32768)break;n.push(t),r=i}return`[${n.join(`,`)}]`}function se(e){if(typeof e==`string`)return e.length===0?void 0:e;if(!S(e)&&!Array.isArray(e))return;let t=Array.isArray(e)?e:[e],n=[];for(let e of t)if(S(e)){if(typeof e.content==`string`)n.push(e.content);else if(Array.isArray(e.content))for(let t of e.content)S(t)&&t.type===`text`&&typeof t.text==`string`&&n.push(t.text)}let r=n.join(`
2
+
3
+ `).trim();return r.length===0?void 0:r}function h(e){if(e.length!==0)return e.length<=32768?e:`${e.slice(0,s)}… [truncated]`}function g(e){try{return JSON.stringify(e)}catch{return}}function _(e){let t=g(e);return t!==void 0&&t.length<=32768?t:void 0}function ce(e){let t=e.at(-1);if(t===void 0||typeof t.role!=`string`)return;let n=y(t.parts),r=typeof t.kind==`string`?{kind:t.kind,role:t.role}:{role:t.role};return v(n,e=>[{...r,parts:[{content:e,type:`text`}]}],!0)}function v(e,t,n=!1){if(!n&&e.length<=32768){let n=_(t(e));if(n!==void 0)return n}for(let n=Math.min(e.length,s);n>0;n-=256){let r=_(t(`${e.slice(0,n)}… [truncated]`));if(r!==void 0)return r}return _(t(`… [truncated]`))}function y(e){if(!Array.isArray(e))return``;let t=``;for(let n of e){if(!S(n)||n.type!==`text`||typeof n.content!=`string`)continue;let e=t.length===0?``:`
4
+ `,r=32769-t.length-e.length;if(r<=0)break;t+=e+n.content.slice(0,r)}return t}function b(e){if(typeof e==`string`)return[{content:e,type:`text`}];if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=le(n);e!==void 0&&t.push(e)}return t}function le(e){if(S(e)&&typeof e.type==`string`)switch(e.type){case`text`:case`reasoning`:{let t=typeof e.text==`string`?e.text:e.content;return typeof t==`string`?{content:t,type:e.type}:void 0}case`tool-call`:return{arguments:e.input,id:x(e.toolCallId)??x(e.callId)??null,name:e.toolName,type:`tool_call`};case`tool-result`:return{id:x(e.toolCallId)??x(e.callId)??null,response:ue(e.output),type:`tool_call_response`};case`tool-error`:return{id:x(e.toolCallId)??x(e.callId)??null,response:e.error instanceof Error?e.error.message:e.error,type:`tool_call_response`};default:return{type:e.type}}}function ue(e){return S(e)?(e.type===`text`||e.type===`error-text`||e.type===`json`||e.type===`error-json`)&&`value`in e?e.value:e.type===`execution-denied`?{denied:!0,reason:e.reason}:e:e}function x(e){return typeof e==`string`?e:void 0}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function de(e,t,n){e.setAttribute(`error.type`,f(n??(t instanceof Error?t.name:`_OTHER`),128));let i=t!==void 0&&!(t instanceof Error);if(i){let e=m(t),n=typeof t==`object`&&t?Reflect.get(t,`message`):void 0,r=typeof t==`string`?h(t):typeof n==`string`?h(e===void 0?n:`${n}\n${e}`):e;r!==void 0&&(t=Error(r))}if(t instanceof Error){let a=p(t);i&&n!==void 0&&(a.name=f(n,128)),e.recordException(a),e.setStatus({code:r.ERROR,message:a.message})}else e.setStatus({code:r.ERROR})}function C(e,t){let n=e.emit&&(t?.emit??!0);return{emit:n,recordInputs:n&&e.recordInputs&&(t?.recordInputs??!0),recordOutputs:n&&e.recordOutputs&&(t?.recordOutputs??!0)}}function fe(e,t){let n=e.mcp;return{type:e.type,reference:e.reference,capture:t,mcp:n===void 0?void 0:{update:e=>n.update(e),error:(e,r)=>n.error(t.recordOutputs?e:void 0,r??(e instanceof Error?e.name:void 0)),arguments:e=>{t.recordInputs&&n.arguments(e)},result:e=>{t.recordOutputs&&n.result(e)}}}}const w=e(`agent.tracing.capture`);function pe(){return a.active().getValue(w)}function T(e,t){return e.setValue(w,t)}const E=e(`agent.tracing.active-operation`),D=e(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function O(e,t){return T(e,{emit:!0,recordInputs:t,recordOutputs:t})}function k(e){return e.setValue(D,!0)}function A(e=a.active()){return typeof e.getValue==`function`?e.getValue(E):void 0}function me(e,n){let r=n??t;return e===void 0?r:i.setSpan(r,i.wrapSpanContext(j(e)))}function j(e){return{...e,traceState:e.tracestate===void 0?void 0:n(e.tracestate)}}function he(e){return{traceId:e.traceId,spanId:e.spanId,traceFlags:e.traceFlags,isRemote:e.isRemote,tracestate:e.traceState?.serialize()}}function M(e,t,n){return e?.attributes(t,n)??n}const ge={attributes(e,t){let n=t[`agent.run.id`];return _e()&&typeof n==`string`&&t[`vercel.session_id`]===void 0?{...t,"vercel.session_id":n}:t},link:(e,t)=>({"agent.link.type":t.relationship})};function _e(){return globalThis.process?.env?.VERCEL_ENV!==void 0}function ve(e={}){let n=e.provider??i.getTracerProvider(),s=n.getTracer(e.tracerName??`agent.tracing`,e.tracerVersion),c=e.mapping??ge,l=e.idGenerator;function u(t){return e[t]??(async()=>{let e=n[t];if(e===void 0)throw Error(`The tracer provider does not support ${t}.`);await e.call(n)})}function d(e,t){let n=s.startSpan(e.name,{attributes:M(c,e,e.attributes),kind:e.kind===void 0?void 0:o[e.kind],root:e.root,startTime:e.startTimeMs,links:e.links?.map(t=>({context:j(t.context),attributes:c?.link(e,t)??{"agent.link.type":t.relationship}}))},me(e.root?void 0:e.parent,t));return{reference:he(n.spanContext()),setAttribute(t,r){for(let[i,a]of Object.entries(M(c,e,{[t]:r})))a!==void 0&&n.setAttribute(i,a)},addEvent:(e,t,r)=>{n.addEvent(e,t,r)},fail:(e,t)=>de(n,e,t),setStatus:e=>{n.setStatus({code:r[e]})},end:e=>{n.end(e)}}}return{startSpan(e,{reference:t,context:n}={}){if(t===void 0||l===void 0)return d(e,n);let r=l.withTraceId(t.traceId,()=>l.withSpanId(t.spanId,()=>d(e,n)));if(r.reference.spanId!==t.spanId||r.reference.traceId!==t.traceId)throw Error(`The tracer provider must use the telemetry's ID generator.`);return r},active:()=>A(),suppressed(e){return a.with(O(k(t),!1),e)},run(e,t,n){let r=C(e.capture,A()?.capture),o=i.setSpan(n??a.active(),i.wrapSpanContext(j(e.reference)));return r=C(r,o.getValue(E)?.capture),o=o.setValue(E,fe(e,r)),o=T(o,r),(!r.emit||!(e.reference.traceFlags&1))&&(o=k(o)),a.with(o,t)},samples:(t,n)=>e.samplesTrace?.(t,{name:n.name,attributes:M(c,n,n.attributes)})??!0,ids:l===void 0?void 0:{traceId:e=>l.deriveTraceId(e),spanId:e=>l.deriveSpanId(e)},forceFlush:u(`forceFlush`),shutdown:u(`shutdown`)}}const N=new Set([`agent.channel.delivery.input`,`agent.session.title`,`agent.approval.request`,`ai.documents`,`ai.prompt`,`ai.prompt.toolChoice`,`ai.prompt.tools`,`ai.value`,`ai.values`,`gen_ai.input.messages`,`gen_ai.memory.records`,`gen_ai.system_instructions`,`gen_ai.tool.call.arguments`,`gen_ai.tool.definitions`]),P=new Set([`agent.approval.response`,`ai.embedding`,`ai.embeddings`,`ai.ranking`,`ai.response.files`,`ai.response.object`,`ai.response.reasoning`,`ai.response.text`,`ai.response.toolCalls`,`ai.response.tool_calls`,`ai.response.tool_results`,`ai.toolCall.args`,`ai.toolCall.result`,`gen_ai.output.messages`,`gen_ai.tool.call.result`]),F=`agent.trace.content.input`,I=`agent.trace.content.output`;function L(e,t){return!t.recordInputs&&N.has(e)?!0:!t.recordOutputs&&P.has(e)}function R(e,t){return!t.recordInputs&&e[F]===!0||!t.recordOutputs&&e[I]===!0}function ye(e,t,n){return e===F&&t===!0&&!n.recordInputs||e===I&&t===!0&&!n.recordOutputs?!1:t}function z(e,t){let n=Object.keys(e);if(!n.some(e=>L(e,t))&&!R(e,t))return;let r={};for(let i of n)L(i,t)||(r[i]=ye(i,e[i],t));return r}const B={costUsd:`agent.usage.cost_usd`,inputTokens:`agent.usage.input_tokens`,outputTokens:`agent.usage.output_tokens`,cacheReadTokens:`agent.usage.cache_read_tokens`,cacheWriteTokens:`agent.usage.cache_write_tokens`};function be(e){return{"agent.run.id":e.runId,"agent.trace.schema.version":4,"gen_ai.conversation.id":e.conversationId}}function V(e,t=e){return{"operation.name":t,"resource.name":e}}function H(e){return{"agent.framework.name":e?.name||void 0,"agent.framework.version":e?.version||void 0}}function U(e,t=!1){return t?{[B.costUsd]:e.costUsd,"gen_ai.usage.input_tokens":e.inputTokens,"gen_ai.usage.output_tokens":e.outputTokens,"gen_ai.usage.cache_read.input_tokens":e.inputTokenDetails?.cacheReadTokens,"gen_ai.usage.cache_write.input_tokens":e.inputTokenDetails?.cacheWriteTokens}:{[B.costUsd]:e.costUsd,[B.inputTokens]:e.inputTokens,[B.outputTokens]:e.outputTokens,[B.cacheReadTokens]:e.inputTokenDetails?.cacheReadTokens,[B.cacheWriteTokens]:e.inputTokenDetails?.cacheWriteTokens}}function W(e){let t={},n=new WeakSet,r=256;function i(e,a,o){if(!(r<=0||o>8||a==null)){if(typeof a==`string`||typeof a==`number`||typeof a==`boolean`)t[e]=a,--r;else if(Array.isArray(a))a.length<=256&&a.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`)&&new Set(a.map(e=>typeof e)).size===1&&(t[e]=a,--r);else if(typeof a==`object`&&!n.has(a)){n.add(a);for(let t of Object.keys(a)){if(r<=0)break;i(`${e}.${t}`,Reflect.get(a,t),o+1)}n.delete(a)}}}return e!==void 0&&i(`ai.settings.context`,e,0),t}const G=e=>e===void 0?`invoke_agent`:`invoke_agent ${e}`,K=e=>`chat ${e}`,q=e=>`execute_tool ${e}`,J={approval:`agent.approval`,step:`agent.step`},Y={toolArguments:`gen_ai.tool.call.arguments`,toolResult:`gen_ai.tool.call.result`,approvalRequest:`agent.approval.request`,approvalResponse:`agent.approval.response`,memoryRecords:`gen_ai.memory.records`};function X(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.setAttribute(n,r)}function Z(e){return{"agent.turn.id":e.attempt.turnId,"agent.step.index":e.attempt.index,"agent.step.attempt":e.attempt.attempt}}function Q(e,t){return z(e??{},t)??e}function xe(e,t){return{[Y.toolArguments]:t.capture.recordInputs?t.serializer.json(e):void 0}}function Se(e,t,n){n.capture.recordOutputs&&X(e,{[Y.toolResult]:n.serializer.json(t.output)})}const Ce={activation:{parents:[],prepare({options:e},t){let{identity:n,capture:r}=t;return{name:G(n.agentName),attributes:{...t.attributes,...H(n.framework),...V(G(n.agentName),`invoke_agent`),"agent.channel.kind":e.channel?.kind,"agent.session.origin":e.channel?.origin,"agent.name":n.agentName,"gen_ai.agent.name":n.agentName,"gen_ai.operation.name":`invoke_agent`,"agent.turn.id":n.turnId,"agent.turn.sequence":e.sequence,"agent.run.type":e.subagent?`subagent`:`session`,"agent.parent_call.id":e.parentCallId,"agent.parent_run.id":e.parentRunId,"agent.subagent.name":e.subagentName,"agent.trace.content.input":r.recordInputs,"agent.trace.content.output":r.recordOutputs,...Q(e.attributes,r)}}},complete(e,t,n,r){e.addEvent(`turn.started`,void 0,r.startTimeMs),(n.outcomeUnknown!==!0||n.failed===!0)&&e.addEvent(`turn.${r.outcome}`,void 0,n.endTimeMs)},redact(e,t){return{...e,options:{...e.options,attributes:Q(e.options.attributes,t)}}}},step:{parents:[`activation`],prepare({options:e},t){return{name:J.step,attributes:{...t.attributes,...H(t.identity.framework),...Z(t),...V(J.step,`workflow`),"gen_ai.operation.name":`workflow`,"agent.name":t.identity.agentName,"agent.channel.kind":e.channel?.kind===`unknown`?void 0:e.channel?.kind,"agent.session.origin":e.channel?.kind===`unknown`?void 0:e.channel?.origin,...W(e.runtimeContext)}}},complete(e,t,n){e.addEvent(n.failed?`step.failed`:`step.completed`,void 0,n.endTimeMs)}},model:{parents:[`step`],prepare({options:e},t){let n=t.capture.recordInputs&&e.messages!==void 0?t.serializer.inputMessages(e.messages):void 0;return{name:K(e.modelId),kind:`CLIENT`,attributes:{...t.attributes,...V(K(e.modelId),`chat`),"gen_ai.agent.name":t.identity.agentName,"gen_ai.operation.name":`chat`,"gen_ai.provider.name":e.provider,"gen_ai.request.model":e.modelId,...W(e.runtimeContext),...t.capture.recordInputs&&e.messages!==void 0?{"gen_ai.input.messages":n?.json,"agent.input.messages.omitted":n?.omitted||void 0,"gen_ai.system_instructions":t.serializer.instructions(e.instructions)}:void 0,"gen_ai.tool.definitions":t.capture.recordInputs?t.serializer.toolDefinitions(e.tools):void 0}}},complete(e,t,n,r){n.model!==void 0&&X(e,Oe(n.model,r.serializer,r.capture.recordOutputs))},redact(e,t){return t.recordInputs?e:{...e,options:{...e.options,messages:void 0,instructions:void 0,tools:void 0}}}},tool:{parents:[`step`,`tool`],prepare({options:e},t){let n=e.kind===`subagent-call`||e.kind===`remote-agent-call`;return{name:q(e.name),kind:e.kind===`remote-agent-call`?`CLIENT`:`INTERNAL`,attributes:{...t.attributes,...H(t.identity.framework),...Z(t),...V(q(e.name),`execute_tool`),"gen_ai.agent.name":n?e.name:t.identity.agentName,"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.name,"gen_ai.tool.type":`function`,"agent.action.kind":e.kind,"agent.action.name":e.kind===void 0?void 0:e.name,"agent.invocation.role":n?`caller`:void 0,...xe(e.arguments,t)}}},complete(e,t,n,r){n.outcome!==void 0&&X(e,{"agent.action.outcome":n.outcome}),Se(e,n,r)},redact(e,t){return t.recordInputs?e:{...e,options:{...e.options,arguments:void 0}}}},approval:{parents:[`tool`],prepare({options:e},t){return{name:J.approval,attributes:{...t.attributes,...H(t.identity.framework),...Z(t),...V(J.approval,`workflow`),"gen_ai.operation.name":`workflow`,"gen_ai.tool.call.id":e.callId,"agent.action.name":e.toolName,"agent.approval.kind":`tool-approval`,"agent.approval.request_id":e.requestId,[Y.approvalRequest]:t.capture.recordInputs?t.serializer.json(e.request):void 0}}},complete(e,t,n,r){r.capture.recordOutputs&&X(e,{[Y.approvalResponse]:r.serializer.json(n.response)})},redact(e,t){return t.recordInputs?e:{...e,options:{...e.options,request:void 0}}}},memory:{parents:[`activation`,`step`,`tool`],prepare({options:e},t){return{name:e.operation,kind:`CLIENT`,attributes:{...t.attributes,...V(e.operation),"gen_ai.operation.name":e.operation,"gen_ai.memory.store.id":e.storeId,"agent.memory.phase":e.phase,"agent.memory.slot":e.slot,"agent.turn.id":t.identity.turnId}}},complete(e,t,n,r){n.recordCount!==void 0&&X(e,{"gen_ai.memory.record.count":n.recordCount}),r.capture.recordInputs&&X(e,{[Y.memoryRecords]:r.serializer.json(n.records)})}}};function $(e){return Ce[e.type]}function we(e){return $(e).parents}function Te(e,t){let n={identity:e.identity,attributes:be(e.identity),attempt:{turnId:e.identity.turnId,index:e.attempt?.index??0,attempt:e.attempt?.attempt??0},capture:e.capture,serializer:t};return{type:e.data.type,operationId:e.key,kind:`INTERNAL`,...$(e.data).prepare(e.data,n),parent:e.parent,root:e.data.type===`activation`&&e.parent===void 0,startTimeMs:e.startTimeMs,links:e.links}}function Ee(e,t,n,r,i,a){let o=n.outcome??(n.failed?`failed`:`completed`),s=n.outcomeUnknown!==!0||n.failed===!0;(t.type===`activation`||t.type===`approval`)&&s&&X(e,{[t.type===`activation`?`agent.turn.outcome`:`agent.approval.outcome`]:o}),n.usage!==void 0&&X(e,U(n.usage,t.type===`activation`||t.type===`model`)),$(t).complete?.(e,t,n,{capture:r,startTimeMs:i,serializer:a,outcome:o}),n.failed&&e.fail(n.error,n.errorCode)}function De(e,t){return t.emit||(t={emit:!1,recordInputs:!1,recordOutputs:!1}),$(e).redact?.(e,t)??e}function Oe(e,t,n){let r={...U(e.usage,!0),"gen_ai.response.id":e.responseId,"gen_ai.response.model":e.responseModelId,"gen_ai.response.finish_reasons":[e.finishReason]};if(!n)return r;r[`ai.response.finish_reason`]=e.finishReason;let i=e.content;if(i===void 0)return r;r[`gen_ai.output.messages`]=t.outputMessages(i,e.finishReason),r[`ai.response.reasoning`]=t.text(i.filter(e=>e.type===`reasoning`).map(e=>e.text).filter(e=>e.trim().length>0).join(`
5
+ `)),r[`ai.response.text`]=t.text(i.filter(e=>e.type===`text`).map(e=>e.text).join(``));let a=i.filter(e=>e.type===`tool-call`).map(e=>({callId:e.callId,input:e.input,toolName:e.toolName}));a.length>0&&(r[`ai.response.tool_calls`]=t.json(a));let o=i.filter(e=>e.type===`tool-result`||e.type===`tool-error`).map(e=>e.type===`tool-result`?{callId:e.callId,input:e.input,output:e.output,toolName:e.toolName}:{callId:e.callId,input:e.input,error:e.error instanceof Error?e.error.message:e.error,toolName:e.toolName});return o.length>0&&(r[`ai.response.tool_results`]=t.toolResults(o)),r}function ke(e){return{update(t){t.connectionName!==void 0&&t.method!==void 0&&e.write({"agent.connection.name":t.connectionName,"mcp.method.name":t.method,"network.protocol.name":`http`,"network.transport":`tcp`,"mcp.protocol.version":t.protocolVersion,"jsonrpc.request.id":t.requestId,"gen_ai.operation.name":t.method===`tools/call`?`execute_tool`:void 0,"gen_ai.tool.name":t.method===`tools/call`?t.toolName:void 0}),t.sessionId!==void 0&&e.write({"mcp.session.id":t.sessionId}),t.statusCode!==void 0&&e.write({"rpc.response.status_code":t.statusCode})},error(t,n){e.error(e.recordOutputs?t:void 0,n??(t instanceof Error?t.name:void 0))},arguments(t){e.recordInputs&&e.write({"gen_ai.tool.call.arguments":e.serializer.json(t)})},result(t){e.recordOutputs&&e.write({"gen_ai.tool.call.result":e.serializer.json(t)})}}}export{f as C,d as S,s as _,G as a,p as b,B as c,A as d,ve as f,C as g,T as h,Ee as i,U as l,pe as m,X as n,we as o,O as p,De as r,Te as s,ke as t,z as u,c as v,m as x,ee as y};
@@ -11,8 +11,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
11
11
  readonly dropped: {};
12
12
  };
13
13
  readonly tool: {
14
- readonly current: 88;
15
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 29, 30, 31, 32, 34, 35, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88];
14
+ readonly current: 91;
15
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 29, 30, 31, 32, 34, 35, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90, 91];
16
16
  readonly dropped: {
17
17
  readonly 14: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
18
18
  readonly 15: "TaskExec replaces stageEffect with send";
@@ -75,8 +75,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
75
75
  };
76
76
  };
77
77
  readonly dynamicTool: {
78
- readonly current: 83;
79
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 31, 32, 33, 52, 54, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83];
78
+ readonly current: 85;
79
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 31, 32, 33, 52, 54, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85];
80
80
  readonly dropped: {
81
81
  readonly 21: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
82
82
  readonly 23: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
@@ -116,8 +116,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
116
116
  };
117
117
  };
118
118
  readonly channel: {
119
- readonly current: 60;
120
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60];
119
+ readonly current: 61;
120
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61];
121
121
  readonly dropped: {
122
122
  readonly 12: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
123
123
  readonly 19: "Continuation rekey was removed; channel extensions must use additive continuation.alias instead.";
@@ -139,8 +139,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
139
139
  };
140
140
  };
141
141
  readonly schedule: {
142
- readonly current: 32;
143
- readonly supported: readonly [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32];
142
+ readonly current: 33;
143
+ readonly supported: readonly [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33];
144
144
  readonly dropped: {
145
145
  readonly 5: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
146
146
  readonly 16: 'Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.';
@@ -148,8 +148,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
148
148
  };
149
149
  };
150
150
  readonly subagent: {
151
- readonly current: 37;
152
- readonly supported: readonly [3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37];
151
+ readonly current: 38;
152
+ readonly supported: readonly [3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38];
153
153
  readonly dropped: {
154
154
  readonly 1: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
155
155
  readonly 2: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
@@ -162,8 +162,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
162
162
  };
163
163
  };
164
164
  readonly connection: {
165
- readonly current: 48;
166
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48];
165
+ readonly current: 49;
166
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49];
167
167
  readonly dropped: {
168
168
  readonly 9: "Dynamic connection resolvers no longer receive conversation or channel continuation data";
169
169
  readonly 10: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
@@ -178,8 +178,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
178
178
  };
179
179
  };
180
180
  readonly hook: {
181
- readonly current: 45;
182
- readonly supported: readonly [20, 21, 22, 23, 25, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45];
181
+ readonly current: 46;
182
+ readonly supported: readonly [20, 21, 22, 23, 25, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46];
183
183
  readonly dropped: {
184
184
  readonly 1: "Model identity moved from session.started runtime metadata to step.started call attribution.";
185
185
  readonly 2: "Model identity moved from session.started runtime metadata to step.started call attribution.";
@@ -214,8 +214,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
214
214
  readonly dropped: {};
215
215
  };
216
216
  readonly dynamicSkill: {
217
- readonly current: 37;
218
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37];
217
+ readonly current: 38;
218
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38];
219
219
  readonly dropped: {
220
220
  readonly 13: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
221
221
  readonly 22: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.";
@@ -229,8 +229,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
229
229
  readonly dropped: {};
230
230
  };
231
231
  readonly dynamicInstructions: {
232
- readonly current: 38;
233
- readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38];
232
+ readonly current: 39;
233
+ readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39];
234
234
  readonly dropped: {
235
235
  readonly 14: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
236
236
  readonly 23: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.";
@@ -1 +1 @@
1
- import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:88,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,29,30,31,32,34,35,76,77,78,80,81,82,84,85,86,87,88],dropped:{14:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,15:`TaskExec replaces stageEffect with send`,16:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,17:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,18:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,19:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,20:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,21:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,22:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,28:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,33:`ctx.agent now accepts the subagent name as its first argument, derives invocation identity internally, and infers structured output types`,36:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,37:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,38:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,39:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,40:`runWorkflowProgram was made internal; use the workflow factory from eve/tools/workflow`,41:`workflow no longer accepts agents and its options argument is optional; use workflow() or workflow({ maxSubagents })`,42:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,43:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,44:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,45:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,46:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,47:`eve/experimental/evaluate was removed; import decide from eve/ai`,48:`eve/experimental/evaluate was removed; import decide from eve/ai`,49:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,50:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,51:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,52:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,53:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,54:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,55:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,56:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,57:`agentRouter() no longer accepts a model-facing outputSchema; structured subagent output is requested only through ctx.agent().`,58:`Workflow tools no longer accept execution or return background task receipts; every call blocks until it settles.`,59:`Workflow tools no longer accept execution or return background task receipts, and every call blocks until it settles. ctx.ask() no longer accepts dismissible and reports a withdrawn request as cancelled, workflow tool contexts carry interruptSignal, and ctx.agent(name) returns a session handle whose send() delivers a message and whose result() resolves the turn; ctx.agent(name, { message, agentId }) and AgentInput were removed. A ctx.ask() question parks the open turn with turn.waiting instead of ending it.`,60:`Workflow tools define exactly one of execute(input, ctx), task(input, ctx), or serve(receive, ctx): a task() call returns a receipt and runs as a task, a serve() call reaches a resumable task through receive() and its model input gains taskId, and stream events gained task.started and task.settled. Agent tools are serve() tools with taskId in place of agentId, and the subagent.* stream events were removed. ctx.interruptSignal and WorkflowTaskContext were removed: a steering message aborts the abortSignal of an execute call the turn waits on.`,61:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,62:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,63:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,64:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,65:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,66:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,67:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,68:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,69:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,70:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,71:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,72:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,73:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,74:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,75:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,79:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`,83:`webSearch provider "openai" was replaced by "native" before it shipped in a release`}},dynamicTool:{current:83,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,31,32,33,52,54,60,61,62,63,64,65,66,67,68,69,70,72,73,75,76,77,78,79,80,81,82,83],dropped:{21:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,28:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,29:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,30:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,34:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,35:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,36:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,37:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,38:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,39:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,40:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,41:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,42:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,43:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,44:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,45:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,46:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,47:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,48:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,49:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,50:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,51:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,53:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,55:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,56:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,57:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,58:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,59:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,71:`AI SDK evaluation models became decision models; auto() accepts decision models only`,74:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},channel:{current:60,supported:[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,29,31,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,54,55,56,57,58,59,60],dropped:{12:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,19:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,20:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,21:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,22:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,23:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,24:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,25:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,26:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,27:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,28:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,30:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,32:`Run mode and caller-supplied output schemas were removed from channel operations; sessions always park, and send options, audience inputs, and ConversationContext no longer carry mode, while from().send() and from().respond() no longer accept outputSchema.`,33:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text.`,34:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,35:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,53:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},schedule:{current:32,supported:[1,2,3,4,6,7,8,9,10,11,12,13,14,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],dropped:{5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,16:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,17:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},subagent:{current:37,supported:[3,4,6,7,8,9,10,11,12,13,14,15,16,19,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],dropped:{1:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,2:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,17:`Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.`,18:`Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.`,20:`Run mode was removed and agent definitions no longer declare outputSchema; sessions always park, ConversationContext no longer carries mode, and structured output is requested per turn.`,21:`Background task execution was removed: subagent results no longer carry backgroundTask, message.completed always carries text, and experimental.tasks is gone. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,22:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},connection:{current:48,supported:[1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,20,21,22,24,26,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48],dropped:{9:`Dynamic connection resolvers no longer receive conversation or channel continuation data`,10:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,25:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,27:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,28:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,29:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,30:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,31:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,42:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},hook:{current:45,supported:[20,21,22,23,25,27,31,32,33,34,35,36,37,38,39,41,42,43,44,45],dropped:{1:`Model identity moved from session.started runtime metadata to step.started call attribution.`,2:`Model identity moved from session.started runtime metadata to step.started call attribution.`,3:`Model identity moved from session.started runtime metadata to step.started call attribution.`,4:`Model identity moved from session.started runtime metadata to step.started call attribution.`,5:`Model identity moved from session.started runtime metadata to step.started call attribution.`,6:`Model identity moved from session.started runtime metadata to step.started call attribution.`,7:`Model identity moved from session.started runtime metadata to step.started call attribution.`,8:`Model identity moved from session.started runtime metadata to step.started call attribution.`,9:`Model identity moved from session.started runtime metadata to step.started call attribution.`,10:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,11:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,12:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,13:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,14:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,15:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,16:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,17:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,18:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,19:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,24:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,26:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,28:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text.`,29:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,30:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,40:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},skill:{current:3,supported:[1,2,3],dropped:{}},dynamicSkill:{current:37,supported:[1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,25,26,27,28,29,30,31,32,33,34,35,36,37],dropped:{13:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,22:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,23:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,24:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},instructions:{current:2,supported:[1,2],dropped:{}},dynamicInstructions:{current:38,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,26,27,28,29,30,31,32,33,34,35,36,37,38],dropped:{14:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,24:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,25:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},config:{current:1,supported:[1],dropped:{}},state:{current:13,supported:[1,2,3,4,5,7,9,10,12,13],dropped:{6:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,8:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,11:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestV1Schema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict(),extensionCompatibilityManifestV2Schema=extensionCompatibilityManifestV1Schema.extend({formatVersion:z.literal(2),build:z.object({externalDependencies:z.array(z.string().min(1)).readonly()}).strict().optional()}),extensionCompatibilityManifestSchema=z.union([extensionCompatibilityManifestV1Schema,extensionCompatibilityManifestV2Schema]);function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(e){return parseExtensionCompatibilityManifest(await readFile(e,`utf8`),e)}async function writeExtensionCompatibilityManifest(e,t){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(t),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
1
+ import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:91,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,29,30,31,32,34,35,76,77,78,80,81,82,84,85,86,87,88,89,90,91],dropped:{14:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,15:`TaskExec replaces stageEffect with send`,16:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,17:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,18:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,19:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,20:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,21:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,22:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,28:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,33:`ctx.agent now accepts the subagent name as its first argument, derives invocation identity internally, and infers structured output types`,36:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,37:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,38:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,39:`experimental_workflow and eve/tools/workflow were removed; migrate to the workflow factory from eve/tools/workflow`,40:`runWorkflowProgram was made internal; use the workflow factory from eve/tools/workflow`,41:`workflow no longer accepts agents and its options argument is optional; use workflow() or workflow({ maxSubagents })`,42:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,43:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,44:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,45:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,46:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,47:`eve/experimental/evaluate was removed; import decide from eve/ai`,48:`eve/experimental/evaluate was removed; import decide from eve/ai`,49:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,50:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,51:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,52:`Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.`,53:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,54:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,55:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,56:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,57:`agentRouter() no longer accepts a model-facing outputSchema; structured subagent output is requested only through ctx.agent().`,58:`Workflow tools no longer accept execution or return background task receipts; every call blocks until it settles.`,59:`Workflow tools no longer accept execution or return background task receipts, and every call blocks until it settles. ctx.ask() no longer accepts dismissible and reports a withdrawn request as cancelled, workflow tool contexts carry interruptSignal, and ctx.agent(name) returns a session handle whose send() delivers a message and whose result() resolves the turn; ctx.agent(name, { message, agentId }) and AgentInput were removed. A ctx.ask() question parks the open turn with turn.waiting instead of ending it.`,60:`Workflow tools define exactly one of execute(input, ctx), task(input, ctx), or serve(receive, ctx): a task() call returns a receipt and runs as a task, a serve() call reaches a resumable task through receive() and its model input gains taskId, and stream events gained task.started and task.settled. Agent tools are serve() tools with taskId in place of agentId, and the subagent.* stream events were removed. ctx.interruptSignal and WorkflowTaskContext were removed: a steering message aborts the abortSignal of an execute call the turn waits on.`,61:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,62:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,63:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,64:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,65:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,66:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,67:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,68:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,69:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,70:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,71:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,72:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,73:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,74:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,75:`eve/ai evaluate was renamed to decide and AI SDK evaluation models became decision models; import decide from eve/ai`,79:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`,83:`webSearch provider "openai" was replaced by "native" before it shipped in a release`}},dynamicTool:{current:85,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,31,32,33,52,54,60,61,62,63,64,65,66,67,68,69,70,72,73,75,76,77,78,79,80,81,82,83,84,85],dropped:{21:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,28:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,29:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,30:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,34:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,35:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,36:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,37:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,38:`workflowMaxSubagents was removed with experimental_workflow; configure generated-program limits with the workflow factory`,39:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,40:`Legacy session history migration was removed; user-role messages require current provenance kinds.`,41:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,42:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,43:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,44:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,45:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,46:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,47:`autoModel and eve/experimental/evaluate were removed; import auto from eve/models`,48:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,49:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,50:`Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.`,51:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,53:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,55:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,56:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,57:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,58:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,59:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,71:`AI SDK evaluation models became decision models; auto() accepts decision models only`,74:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},channel:{current:61,supported:[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,29,31,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61],dropped:{12:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,19:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,20:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,21:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,22:`Continuation rekey was removed; channel extensions must use additive continuation.alias instead.`,23:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,24:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,25:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,26:`Task views no longer expose executor bindings; background work is owned by workflow runs.`,27:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,28:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,30:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,32:`Run mode and caller-supplied output schemas were removed from channel operations; sessions always park, and send options, audience inputs, and ConversationContext no longer carry mode, while from().send() and from().respond() no longer accept outputSchema.`,33:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text.`,34:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,35:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,53:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},schedule:{current:33,supported:[1,2,3,4,6,7,8,9,10,11,12,13,14,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],dropped:{5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,16:`Background task delivery was removed: sends no longer accept taskDeliveryPolicy and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,17:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},subagent:{current:38,supported:[3,4,6,7,8,9,10,11,12,13,14,15,16,19,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],dropped:{1:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,2:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,17:`Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.`,18:`Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.`,20:`Run mode was removed and agent definitions no longer declare outputSchema; sessions always park, ConversationContext no longer carries mode, and structured output is requested per turn.`,21:`Background task execution was removed: subagent results no longer carry backgroundTask, message.completed always carries text, and experimental.tasks is gone. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,22:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},connection:{current:49,supported:[1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,19,20,21,22,24,26,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49],dropped:{9:`Dynamic connection resolvers no longer receive conversation or channel continuation data`,10:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,25:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,27:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,28:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,29:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`,30:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,31:`Approval response policies now run for Cancel as well as Approve; a policy written for Approve only could reject every Cancel.`,42:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},hook:{current:46,supported:[20,21,22,23,25,27,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46],dropped:{1:`Model identity moved from session.started runtime metadata to step.started call attribution.`,2:`Model identity moved from session.started runtime metadata to step.started call attribution.`,3:`Model identity moved from session.started runtime metadata to step.started call attribution.`,4:`Model identity moved from session.started runtime metadata to step.started call attribution.`,5:`Model identity moved from session.started runtime metadata to step.started call attribution.`,6:`Model identity moved from session.started runtime metadata to step.started call attribution.`,7:`Model identity moved from session.started runtime metadata to step.started call attribution.`,8:`Model identity moved from session.started runtime metadata to step.started call attribution.`,9:`Model identity moved from session.started runtime metadata to step.started call attribution.`,10:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,11:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,12:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,13:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,14:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,15:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,16:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,17:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,18:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,19:`The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,24:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,26:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,28:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text.`,29:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,30:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event hook events were removed; subscribe to task.started, task.settled, and agent.started.`,40:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}},skill:{current:3,supported:[1,2,3],dropped:{}},dynamicSkill:{current:38,supported:[1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,25,26,27,28,29,30,31,32,33,34,35,36,37,38],dropped:{13:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,22:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,23:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,24:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},instructions:{current:2,supported:[1,2],dropped:{}},dynamicInstructions:{current:39,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,26,27,28,29,30,31,32,33,34,35,36,37,38,39],dropped:{14:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`Run mode was removed; sessions always park and ConversationContext no longer carries mode.`,24:`Background task execution was removed: subagent results no longer carry backgroundTask and message.completed always carries text. input.resolved reports outcome "cancelled" when a workflow tool withdraws a ctx.ask() request, and stream events gained agent.started, published when a workflow run opens a ctx.agent session, and turn.waiting, which parks the open turn instead of emitting turn.completed and session.waiting.`,25:`Stream events gained task.started and task.settled, and input.requested, authorization events, and agent.started carry the taskId of the task they come from. The subagent.called, subagent.completed, subagent.started, and subagent.event stream events were removed; agent calls report task.started, task.settled, and agent.started.`}},config:{current:1,supported:[1],dropped:{}},state:{current:13,supported:[1,2,3,4,5,7,9,10,12,13],dropped:{6:`Sandbox sessions no longer expose core identity and mutable networking is provider-specific.`,8:`SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities`,11:`Sandbox provider handle hooks were renamed to onSandboxStop and onSandboxDelete.`}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestV1Schema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict(),extensionCompatibilityManifestV2Schema=extensionCompatibilityManifestV1Schema.extend({formatVersion:z.literal(2),build:z.object({externalDependencies:z.array(z.string().min(1)).readonly()}).strict().optional()}),extensionCompatibilityManifestSchema=z.union([extensionCompatibilityManifestV1Schema,extensionCompatibilityManifestV2Schema]);function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(e){return parseExtensionCompatibilityManifest(await readFile(e,`utf8`),e)}async function writeExtensionCompatibilityManifest(e,t){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(t),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
@@ -1 +1 @@
1
- import{join,posix}from"node:path";import{stripLogicalPathExtension}from"#discover/filesystem.js";import{canonicalSourceSlot,extensionMountId}from"#compiler/source-graph.js";import{mountRefNamespace}from"#discover/extensions.js";const MODULE_KIND_BY_SLOT_ROOT={agent:`config`,channels:`channel`,extensions:`extension`,hooks:`hook`,instructions:`instructions`,memory:`memory`,sandbox:`sandbox`,schedules:`schedule`,skills:`skill`,tools:`tool`};function projectAgentSources(e){let t=e.owner??{kind:`application`},n=[],r=[],i=[];projectManifest({externalDependencies:e.externalDependencies,candidates:n,projection:createApplicationManifestSourceProjection(e.extensionScope),layer:e.layer??`application`,manifest:e.manifest,nodeId:e.nodeId,subagentsPath:posix.join(e.nodePath,`subagents`),owner:t,mountId:e.mountId,declarationMountIds:new Map(e.manifest.extensions.map(t=>[t.sourceId,posix.join(e.nodePath,`extensions`,mountRefNamespace(t.logicalPath))])),resources:r,subagents:i});for(let t of[...e.manifest.resolvedExtensions].sort((e,t)=>e.namespace.localeCompare(t.namespace))){let a=extensionMountId(e.nodePath,t.namespace),o=createExtensionManifestSourceProjection(t),s={kind:`extension`,mountId:a,namespace:t.namespace,packageName:t.packageName};projectManifest({externalDependencies:mergeDependencies(e.externalDependencies,t.externalDependencies),candidates:n,projection:o,layer:`extension-package`,manifest:t.manifest,nodeId:e.nodeId,subagentsPath:posix.join(a,`subagents`),owner:s,mountId:a,resources:r,sourceIdPrefix:`ext:${t.namespace}:`,subagents:i}),t.overrides!==void 0&&projectManifest({externalDependencies:e.externalDependencies,candidates:n,projection:o,layer:`extension-override`,manifest:t.overrides,nodeId:e.nodeId,subagentsPath:posix.join(a,`subagents`),owner:{kind:`application`},mountId:a,resources:r,sourceIdPrefix:`ext-override:${t.namespace}:`,subagents:i})}return{candidates:n,resources:r,subagents:i}}function projectSelectedSources(e){let t=new Map(e.resources.map(e=>[e.candidate.sourceId,e])),n=[];for(let r of e.candidates)if(isModuleCandidate(r))n.push(projectModuleCandidate(r));else{let e=t.get(r.sourceId);e!==void 0&&n.push(e)}return n}function createFilesystemModuleCandidate(e){return{backing:{externalDependencies:[...e.externalDependencies],...e.owner.kind===`extension`&&e.extensionScope!==void 0?{extensionScope:e.extensionScope}:{},kind:`filesystem`,mountId:e.mountId,sourcePath:join(e.sourceRoot,e.source.logicalPath)},exportName:e.source.exportName,form:`direct`,layer:e.layer,logicalPath:e.logicalPath,nodeId:e.nodeId,owner:e.owner,sourceId:e.sourceId??e.source.sourceId}}function createApplicationManifestSourceProjection(e){let t={logicalPath:e=>e,name:e=>e};return e!==void 0&&(t.extensionScope=e),t}function createExtensionManifestSourceProjection(e){let{namespace:t,sourceRoot:n}=e;return{extensionScope:{namespace:t,sourceRoot:n},logicalPath:e=>qualifyExtensionContributionLogicalPath(e,t),name:e=>`${t}__${e}`}}function projectManifest(e){let{projection:t}=e,sourceId=t=>`${e.sourceIdPrefix??``}${t}`,pushModule=(n,r,i=e.mountId)=>{let a=t.logicalPath(r??n.logicalPath),o=createFilesystemModuleCandidate({externalDependencies:e.externalDependencies,...t.extensionScope===void 0?{}:{extensionScope:t.extensionScope},layer:e.layer,logicalPath:a,nodeId:e.nodeId,owner:e.owner,mountId:i,source:n,sourceId:sourceId(n.sourceId),sourceRoot:e.manifest.agentRoot});e.candidates.push(o)},pushResource=(n,r)=>{let i=t.logicalPath(r.logicalPath),a={...r,...r.sourceKind===`skill-package`?{name:t.name(r.name)}:{},logicalPath:i,sourceId:sourceId(r.sourceId)},o={backing:{kind:`resource`,sourcePath:r.sourceKind===`skill-package`?r.skillFilePath:join(e.manifest.agentRoot,r.logicalPath)},form:`direct`,layer:e.layer,logicalPath:i,nodeId:e.nodeId,owner:e.owner,sourceId:a.sourceId};e.candidates.push(o),e.resources.push({candidate:o,kind:n,source:a})};if(e.manifest.configModule!==void 0){let t=e.manifest.configModule.logicalPath;pushModule(e.manifest.configModule,canonicalSourceSlot(t)===`agent`?void 0:`agent.ts`)}for(let t of e.manifest.extensions)pushModule(t,void 0,e.declarationMountIds?.get(t.sourceId));for(let t of e.manifest.channels)pushModule(t);for(let t of e.manifest.connections)pushModule(t);for(let t of e.manifest.hooks)pushModule(t);for(let t of e.manifest.memories)pushModule(t);e.manifest.sandbox!==null&&pushModule(e.manifest.sandbox);for(let t of e.manifest.tools)pushModule(t);for(let t of e.manifest.instructions)t.sourceKind===`module`?pushModule(t):pushResource(`instructions`,t);for(let t of e.manifest.schedules)t.sourceKind===`module`?pushModule(t):pushResource(`schedule`,t);for(let t of e.manifest.skills)t.sourceKind===`module`?pushModule(t):pushResource(`skill`,t);for(let n of e.manifest.subagents){let r=t.name(n.subagentId),i=t.logicalPath(n.logicalPath);if(r===`agent`)throw Error(`Subagent "${i}" uses the reserved name "agent". Rename its path; eve reserves "agent" for the built-in root-copy target.`);let a={...n,logicalPath:i,sourceId:sourceId(n.sourceId),subagentId:r},o={backing:{kind:`resource`,sourcePath:n.entryPath},form:`direct`,layer:e.layer,logicalPath:i,nodeId:e.nodeId,owner:e.owner,sourceId:a.sourceId};e.candidates.push(o),e.subagents.push({candidate:o,mountId:e.mountId,nodePath:posix.join(e.subagentsPath,n.subagentId),...t.extensionScope===void 0?{}:{extensionScope:t.extensionScope},owner:e.owner,source:a})}}function projectModuleCandidate(e){let t={exportName:e.exportName,logicalPath:e.logicalPath,sourceId:e.sourceId,sourceKind:`module`},n=canonicalSourceSlot(e.logicalPath);if(n.startsWith(`connections/`))return{candidate:e,kind:`connection`,source:{...t,connectionName:deriveConnectionName(e.logicalPath)}};let r=MODULE_KIND_BY_SLOT_ROOT[n.split(`/`,1)[0]];if(r===void 0)throw Error(`Agent module source slot "${e.logicalPath}" is not compiled yet.`);return{candidate:e,kind:r,source:t}}function isModuleCandidate(e){return e.backing.kind!==`resource`}const EXTENSION_CONTRIBUTION_ROOTS=new Set([`channels`,`connections`,`hooks`,`instructions`,`schedules`,`skills`,`subagents`,`tools`]);function qualifyExtensionContributionLogicalPath(e,t){let n=e.split(`/`);if(n.length===1){let n=stripLogicalPathExtension(e);if(n===`instructions`||n===`system`)return`instructions/${t}${e.slice(e.lastIndexOf(`.`))}`;throw Error(`Extension source slot "${e}" cannot be namespace-scoped.`)}let r=n[0];if(!EXTENSION_CONTRIBUTION_ROOTS.has(r))throw Error(`Extension source slot "${e}" cannot be namespace-scoped.`);return n[1]=`${t}__${n[1]}`,n.join(`/`)}function deriveConnectionName(e){let t=stripLogicalPathExtension(e).replace(/^connections\//,``);return t.endsWith(`/connection`)?t.slice(0,-11):t}function mergeDependencies(...e){return[...new Set(e.flat())]}export{projectAgentSources,projectSelectedSources,qualifyExtensionContributionLogicalPath};
1
+ import{join,posix}from"node:path";import{stripLogicalPathExtension}from"#discover/filesystem.js";import{canonicalSourceSlot,extensionMountId}from"#compiler/source-graph.js";import{mountRefNamespace}from"#discover/extensions.js";const MODULE_KIND_BY_SLOT_ROOT={agent:`config`,channels:`channel`,extensions:`extension`,hooks:`hook`,instructions:`instructions`,memory:`memory`,sandbox:`sandbox`,schedules:`schedule`,skills:`skill`,tools:`tool`};function projectAgentSources(e){let t=e.owner??{kind:`application`},n=[],r=[],i=[];projectManifest({externalDependencies:e.externalDependencies,candidates:n,projection:createApplicationManifestSourceProjection(e.extensionScope),layer:e.layer??`application`,manifest:e.manifest,nodeId:e.nodeId,subagentsPath:posix.join(e.nodePath,`subagents`),owner:t,mountId:e.mountId,declarationMountIds:new Map(e.manifest.extensions.map(t=>[t.sourceId,posix.join(e.nodePath,`extensions`,mountRefNamespace(t.logicalPath))])),resources:r,subagents:i});for(let t of[...e.manifest.resolvedExtensions].sort((e,t)=>e.namespace.localeCompare(t.namespace))){let a=extensionMountId(e.nodePath,t.namespace),o=createExtensionManifestSourceProjection(t),s={kind:`extension`,mountId:a,namespace:t.namespace,packageName:t.packageName};projectManifest({externalDependencies:mergeDependencies(e.externalDependencies,t.externalDependencies),candidates:n,projection:o,layer:`extension-package`,manifest:t.manifest,nodeId:e.nodeId,subagentsPath:posix.join(a,`subagents`),owner:s,mountId:a,resources:r,sourceIdPrefix:`ext:${t.namespace}:`,subagents:i}),t.overrides!==void 0&&projectManifest({externalDependencies:e.externalDependencies,candidates:n,projection:o,layer:`extension-override`,manifest:t.overrides,nodeId:e.nodeId,subagentsPath:posix.join(a,`subagents`),owner:{kind:`application`},mountId:a,resources:r,sourceIdPrefix:`ext-override:${t.namespace}:`,subagents:i})}return{candidates:n,resources:r,subagents:i}}function projectSelectedSources(e){let t=new Map(e.resources.map(e=>[e.candidate.sourceId,e])),n=[];for(let r of e.candidates)if(isModuleCandidate(r))n.push(projectModuleCandidate(r));else{let e=t.get(r.sourceId);e!==void 0&&n.push(e)}return n}function createFilesystemModuleCandidate(e){return{backing:{externalDependencies:[...e.externalDependencies],...e.owner.kind===`extension`&&e.extensionScope!==void 0?{extensionScope:e.extensionScope}:{},kind:`filesystem`,mountId:e.mountId,sourcePath:join(e.sourceRoot,e.source.logicalPath)},exportName:e.source.exportName,form:`direct`,layer:e.layer,logicalPath:e.logicalPath,nodeId:e.nodeId,owner:e.owner,sourceId:e.sourceId??e.source.sourceId}}function createApplicationManifestSourceProjection(e){let t={logicalPath:e=>e,name:e=>e};return e!==void 0&&(t.extensionScope=e),t}function createExtensionManifestSourceProjection(e){let{namespace:t,sourceRoot:n}=e;return{extensionScope:{namespace:t,sourceRoot:n},logicalPath:e=>qualifyExtensionContributionLogicalPath(e,t),name:e=>`${t}__${e}`}}function projectManifest(e){let{projection:t}=e,sourceId=t=>`${e.sourceIdPrefix??``}${t}`,pushModule=(n,r,i=e.mountId)=>{let a=t.logicalPath(r??n.logicalPath),o=createFilesystemModuleCandidate({externalDependencies:e.externalDependencies,...t.extensionScope===void 0?{}:{extensionScope:t.extensionScope},layer:e.layer,logicalPath:a,nodeId:e.nodeId,owner:e.owner,mountId:i,source:n,sourceId:sourceId(n.sourceId),sourceRoot:e.manifest.agentRoot});e.candidates.push(o)},pushResource=(n,r)=>{let i=t.logicalPath(r.logicalPath),a={...r,...r.sourceKind===`skill-package`?{name:t.name(r.name)}:{},logicalPath:i,sourceId:sourceId(r.sourceId)},o={backing:{kind:`resource`,sourcePath:r.sourceKind===`skill-package`?r.skillFilePath:join(e.manifest.agentRoot,r.logicalPath)},form:`direct`,layer:e.layer,logicalPath:i,nodeId:e.nodeId,owner:e.owner,sourceId:a.sourceId};e.candidates.push(o),e.resources.push({candidate:o,kind:n,source:a})};if(e.manifest.configModule!==void 0){let t=e.manifest.configModule.logicalPath;pushModule(e.manifest.configModule,canonicalSourceSlot(t)===`agent`?void 0:`agent.ts`)}let n=new Set(e.manifest.resolvedExtensions.map(e=>e.namespace));for(let t of e.manifest.extensions)n.has(mountRefNamespace(t.logicalPath))&&pushModule(t,void 0,e.declarationMountIds?.get(t.sourceId));for(let t of e.manifest.channels)pushModule(t);for(let t of e.manifest.connections)pushModule(t);for(let t of e.manifest.hooks)pushModule(t);for(let t of e.manifest.memories)pushModule(t);e.manifest.sandbox!==null&&pushModule(e.manifest.sandbox);for(let t of e.manifest.tools)pushModule(t);for(let t of e.manifest.instructions)t.sourceKind===`module`?pushModule(t):pushResource(`instructions`,t);for(let t of e.manifest.schedules)t.sourceKind===`module`?pushModule(t):pushResource(`schedule`,t);for(let t of e.manifest.skills)t.sourceKind===`module`?pushModule(t):pushResource(`skill`,t);for(let n of e.manifest.subagents){let r=t.name(n.subagentId),i=t.logicalPath(n.logicalPath);if(r===`agent`)throw Error(`Subagent "${i}" uses the reserved name "agent". Rename its path; eve reserves "agent" for the built-in root-copy target.`);let a={...n,logicalPath:i,sourceId:sourceId(n.sourceId),subagentId:r},o={backing:{kind:`resource`,sourcePath:n.entryPath},form:`direct`,layer:e.layer,logicalPath:i,nodeId:e.nodeId,owner:e.owner,sourceId:a.sourceId};e.candidates.push(o),e.subagents.push({candidate:o,mountId:e.mountId,nodePath:posix.join(e.subagentsPath,n.subagentId),...t.extensionScope===void 0?{}:{extensionScope:t.extensionScope},owner:e.owner,source:a})}}function projectModuleCandidate(e){let t={exportName:e.exportName,logicalPath:e.logicalPath,sourceId:e.sourceId,sourceKind:`module`},n=canonicalSourceSlot(e.logicalPath);if(n.startsWith(`connections/`))return{candidate:e,kind:`connection`,source:{...t,connectionName:deriveConnectionName(e.logicalPath)}};let r=MODULE_KIND_BY_SLOT_ROOT[n.split(`/`,1)[0]];if(r===void 0)throw Error(`Agent module source slot "${e.logicalPath}" is not compiled yet.`);return{candidate:e,kind:r,source:t}}function isModuleCandidate(e){return e.backing.kind!==`resource`}const EXTENSION_CONTRIBUTION_ROOTS=new Set([`channels`,`connections`,`hooks`,`instructions`,`schedules`,`skills`,`subagents`,`tools`]);function qualifyExtensionContributionLogicalPath(e,t){let n=e.split(`/`);if(n.length===1){let n=stripLogicalPathExtension(e);if(n===`instructions`||n===`system`)return`instructions/${t}${e.slice(e.lastIndexOf(`.`))}`;throw Error(`Extension source slot "${e}" cannot be namespace-scoped.`)}let r=n[0];if(!EXTENSION_CONTRIBUTION_ROOTS.has(r))throw Error(`Extension source slot "${e}" cannot be namespace-scoped.`);return n[1]=`${t}__${n[1]}`,n.join(`/`)}function deriveConnectionName(e){let t=stripLogicalPathExtension(e).replace(/^connections\//,``);return t.endsWith(`/connection`)?t.slice(0,-11):t}function mergeDependencies(...e){return[...new Set(e.flat())]}export{projectAgentSources,projectSelectedSources,qualifyExtensionContributionLogicalPath};
@@ -1 +1 @@
1
- import{loadContext}from"#context/container.js";import{TurnMemoryLocksKey}from"#context/keys.js";import{parseJsonObject}from"#shared/json.js";import{defineDynamic}from"#dynamic/definition.js";import{stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{isBrandedToolEntry}from"#tools/dynamic.js";import{resolveApprovalPolicy}from"#approval/definition.js";import{markDynamicCallbackRebind}from"#internal/dynamic-tool-rebind.js";function createMemoryToolDynamicDefinition(e,t){return markDynamicCallbackRebind(defineDynamic({events:{"turn.started":async(n,r)=>{let i=loadContext().get(TurnMemoryLocksKey)?.[t];if(i===void 0||e.provider.tools===void 0)return null;let a={...r,memory:{scope:i.scope,slot:t},turn:i.turn},o=await e.provider.tools(a);if(o===null)return null;if(typeof o!=`object`||Array.isArray(o))throw Error(`Memory slot "${t}" provider.tools() must return a tool map or null.`);return Object.fromEntries(Object.entries(o).map(([n,r])=>{let i=`${t}__${n}`;if(!isBrandedToolEntry(r))throw Error(`Memory provider tool "${i}" must be created with defineTool().`);let o=e.description===void 0?r.description:`${e.description}\n\n${r.description}`,s={...r,description:o};return stampDurableDynamicToolCallbacks(s,createProviderToolCallbacks({context:a,definition:e,key:n,tool:r})),[i,s]}))}}}))}function createProviderToolCallbacks(e){let{messages:t,...n}=e.context,r=parseJsonObject({context:n,key:e.key}),loadTool=async n=>{let r=n.key,i=n.context;if(typeof r!=`string`||typeof i!=`object`||!i)throw Error(`Memory provider tool callback has an invalid durable closure.`);let a=(await e.definition.provider.tools?.(readMemoryToolsContext({...i,messages:t})))?.[r];if(a===void 0||!isBrandedToolEntry(a))throw Error(`Memory provider tool "${r}" was removed or renamed.`);return a},i={execute:{callback:async(e,t,n)=>await(await loadTool(e)).execute(t,n),closure:r}};for(let t of[`inputSchema`,`outputSchema`])e.tool[t]!==void 0&&(i[t]={callback:async e=>(await loadTool(e))[t],closure:r});return e.tool.approval!==void 0&&(i.approvalRequest={callback:async(e,t)=>await resolveApprovalPolicy((await loadTool(e)).approval)(t),closure:r},typeof e.tool.approval!=`function`&&e.tool.approval.response!==void 0&&(i.approvalResponse={callback:async(t,n)=>{let r=(await loadTool(t)).approval;if(r===void 0||typeof r==`function`||r.response===void 0)throw Error(`Memory provider tool "${e.key}" approval response was removed.`);return await r.response(n)},closure:r})),e.tool.toModelOutput!==void 0&&(i.toModelOutput={callback:async(e,t)=>await(await loadTool(e)).toModelOutput(t),closure:r}),i}function readMemoryToolsContext(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Memory provider tool callback has an invalid durable context.`);let t=e;if(typeof t.channel!=`object`||t.channel===null||typeof t.memory!=`object`||t.memory===null||!Array.isArray(t.messages)||typeof t.session!=`object`||t.session===null||typeof t.turn!=`object`||t.turn===null)throw Error(`Memory provider tool callback has an invalid durable context.`);return t}export{createMemoryToolDynamicDefinition};
1
+ import{loadContext}from"#context/container.js";import{TurnMemoryLocksKey}from"#context/keys.js";import{parseJsonObject}from"#shared/json.js";import{defineDynamic}from"#dynamic/definition.js";import{stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{isBrandedToolEntry}from"#tools/dynamic.js";import{resolveApprovalPolicy}from"#approval/definition.js";import{markDynamicCallbackRebind}from"#internal/dynamic-tool-rebind.js";function createMemoryToolDynamicDefinition(e,t){return markDynamicCallbackRebind(defineDynamic({events:{"turn.started":async(n,r)=>{let i=loadContext().get(TurnMemoryLocksKey)?.[t];if(i===void 0||e.provider.tools===void 0)return null;let a={...r,memory:{scope:i.scope,slot:t},turn:i.turn},o=await e.provider.tools(a);if(o===null)return null;if(typeof o!=`object`||Array.isArray(o))throw Error(`Memory slot "${t}" provider.tools() must return a tool map or null.`);return Object.fromEntries(Object.entries(o).map(([n,r])=>{let i=`${t}__${n}`;if(!isBrandedToolEntry(r))throw Error(`Memory provider tool "${i}" must be created with defineTool().`);let o=e.description===void 0?r.description:`${e.description}\n\n${r.description}`,s={...r,description:o};return stampDurableDynamicToolCallbacks(s,createProviderToolCallbacks({context:a,definition:e,key:n,tool:r})),[i,s]}))}}}))}function createProviderToolCallbacks(e){let{messages:t,turn:{input:n,...r},...i}=e.context,a=parseJsonObject({context:{...i,turn:r},key:e.key}),loadTool=async r=>{let i=r.key,a=r.context;if(typeof i!=`string`||typeof a!=`object`||!a)throw Error(`Memory provider tool callback has an invalid durable closure.`);let o=readMemoryToolsContext({...a,messages:t}),s=(await e.definition.provider.tools?.({...o,turn:{...o.turn,input:n}}))?.[i];if(s===void 0||!isBrandedToolEntry(s))throw Error(`Memory provider tool "${i}" was removed or renamed.`);return s},o={execute:{callback:async(e,t,n)=>await(await loadTool(e)).execute(t,n),closure:a}};for(let t of[`inputSchema`,`outputSchema`])e.tool[t]!==void 0&&(o[t]={callback:async e=>(await loadTool(e))[t],closure:a});return e.tool.approval!==void 0&&(o.approvalRequest={callback:async(e,t)=>await resolveApprovalPolicy((await loadTool(e)).approval)(t),closure:a},typeof e.tool.approval!=`function`&&e.tool.approval.response!==void 0&&(o.approvalResponse={callback:async(t,n)=>{let r=(await loadTool(t)).approval;if(r===void 0||typeof r==`function`||r.response===void 0)throw Error(`Memory provider tool "${e.key}" approval response was removed.`);return await r.response(n)},closure:a})),e.tool.toModelOutput!==void 0&&(o.toModelOutput={callback:async(e,t)=>await(await loadTool(e)).toModelOutput(t),closure:a}),o}function readMemoryToolsContext(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Memory provider tool callback has an invalid durable context.`);let t=e;if(typeof t.channel!=`object`||t.channel===null||typeof t.memory!=`object`||t.memory===null||!Array.isArray(t.messages)||typeof t.session!=`object`||t.session===null||typeof t.turn!=`object`||t.turn===null)throw Error(`Memory provider tool callback has an invalid durable context.`);return t}export{createMemoryToolDynamicDefinition};
@@ -1,9 +1,11 @@
1
1
  import type { AssertionResult } from "#evals/types.js";
2
2
  /**
3
- * The name an assertion is exported under. Gates carry a `gate:` prefix so
4
- * they do not share a column with a soft assertion of the same name, and so
5
- * experiments diff gate regressions the same way they diff soft scores.
6
- * Sinks with stricter label rules normalize this name themselves.
3
+ * The name an assertion is exported under: its label when it has one, so a
4
+ * labeled assertion keeps a stable column however its display name is built.
5
+ * Gates carry a `gate:` prefix so they do not share a column with a soft
6
+ * assertion of the same name, and so experiments diff gate regressions the
7
+ * same way they diff soft scores. Sinks with stricter label rules normalize
8
+ * this name themselves.
7
9
  */
8
10
  export declare function exportedAssertionName(assertion: AssertionResult): string;
9
11
  /** Assertions reported under one name, scored together. */
@@ -1 +1 @@
1
- function exportedAssertionName(e){return e.severity===`gate`?`gate:${e.name}`:e.name}function groupAssertionScores(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);n.set(e,{score:minScore(i?.score,r.score),assertions:[...i?.assertions??[],r]})}return n}function composeAssertionScoreMetadata(e){return e.map(({key:e,name:t,severity:n,score:r})=>({key:e,name:t,severity:n,score:r}))}function minScore(e,t){return e===void 0?t:t===void 0?e:Math.min(e,t)}export{composeAssertionScoreMetadata,exportedAssertionName,groupAssertionScores};
1
+ function exportedAssertionName(e){let t=e.key??e.name;return e.severity===`gate`?`gate:${t}`:t}function groupAssertionScores(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);n.set(e,{score:minScore(i?.score,r.score),assertions:[...i?.assertions??[],r]})}return n}function composeAssertionScoreMetadata(e){return e.map(({key:e,name:t,severity:n,score:r})=>({key:e,name:t,severity:n,score:r}))}function minScore(e,t){return e===void 0?t:t===void 0?e:Math.min(e,t)}export{composeAssertionScoreMetadata,exportedAssertionName,groupAssertionScores};
@@ -1,2 +1,2 @@
1
- import{composeAssertionScoreMetadata,exportedAssertionName,groupAssertionScores}from"#evals/runner/reporters/assertion-scores.js";import{resolveLocalGitMetadata}from"#evals/runner/resolve-git-metadata.js";function Braintrust(e={}){return new BraintrustReporter(e)}var BraintrustReporter=class{#e;#t;#n;#r=new Map;constructor(e){this.#e=e}async onRunStart(e,t){let n=await loadBraintrustSdk();this.#t=n;let r=resolveLocalGitMetadata(process.cwd());this.#r.clear();for(let t of e)this.#r.set(t.id,t);let i=resolveTags(e,t),a=resolveExperimentMetadata(e,t);this.#n=await n.init({project:this.#e.projectName??e[0]?.id??`eve evals`,projectId:this.#e.projectId,experiment:this.#e.experimentName,baseExperiment:this.#e.baseExperimentName,baseExperimentId:this.#e.baseExperimentId,update:this.#e.update,tags:i,metadata:a,noExitFlush:!0,setCurrent:!1,repoInfo:r.sha?{commit:r.sha,branch:r.branch}:null})}onEvalComplete(e){if(!this.#n)return;let t=this.#r.get(e.id),n={},r=groupAssertionScores(e.assertions,exportedAssertionName);for(let[e,t]of r)t.score!==void 0&&(n[e]=t.score);let i=e.assertions.filter(e=>e.passed===!1).map(e=>({...e})),a={...t?.metadata,eveSessionId:e.result.sessionId,eveStatus:e.result.status,eveVerdict:e.verdict,eveSkipReason:e.skipReason,eveToolCalls:e.result.derived.toolCalls.map(e=>e.name),eveSubagentCalls:e.result.derived.subagentCalls.map(e=>e.name),eveSkillLoads:e.result.derived.skillLoads.map(e=>e.skill),eveParked:e.result.derived.parked,eveAssertionScores:composeAssertionScoreMetadata(e.assertions)};e.result.traceContexts.length>0&&(a.eveTraceIds=[...new Set(e.result.traceContexts.map(e=>e.traceId))],a.eveTraceContexts=e.result.traceContexts),i.length>0&&(a.eveFailedAssertions=i),e.result.derived.failureCode&&(a.eveFailureCode=e.result.derived.failureCode);let o={toolCallCount:e.result.derived.toolCallCount,subagentCallCount:e.result.derived.subagentCallCount,messageCount:e.result.derived.messageCount,reasoningBlockCount:e.result.derived.reasoningBlockCount};this.#n.log({id:e.id,input:t?.description??``,output:e.result.output,error:e.error??void 0,scores:n,metadata:a,metrics:o,tags:t?.tags?[...t.tags]:void 0})}async onRunComplete(e){if(this.#n)try{this.#t&&await this.#t.flush();let e=await this.#n.summarize();e.experimentUrl&&console.log(`Braintrust experiment: ${e.experimentUrl}\n\n`)}finally{await this.#n.close(),this.#n=void 0,this.#t=void 0}}};async function loadBraintrustSdk(){try{return await import(`braintrust`)}catch{throw Error([`The 'braintrust' package is required for Braintrust reporting but was not found.`,``,`Install it with:`,` npm install braintrust`].join(`
1
+ import{composeAssertionScoreMetadata,exportedAssertionName,groupAssertionScores}from"#evals/runner/reporters/assertion-scores.js";import{resolveLocalGitMetadata}from"#evals/runner/resolve-git-metadata.js";function Braintrust(e={}){return new BraintrustReporter(e)}var BraintrustReporter=class{#e;#t;#n;#r=new Map;constructor(e){this.#e=e}async onRunStart(e,t){let n=await loadBraintrustSdk();this.#t=n;let r=resolveLocalGitMetadata(process.cwd());this.#r.clear();for(let t of e)this.#r.set(t.id,t);let i=resolveTags(e,t),a=resolveExperimentMetadata(e,t);this.#n=await n.init({project:this.#e.projectName??e[0]?.id??`eve evals`,projectId:this.#e.projectId,experiment:this.#e.experimentName,baseExperiment:this.#e.baseExperimentName,baseExperimentId:this.#e.baseExperimentId,update:this.#e.update,tags:i,metadata:a,noExitFlush:!0,setCurrent:!1,repoInfo:r.sha?{commit:r.sha,branch:r.branch}:null})}onEvalComplete(e){if(!this.#n)return;let t=this.#r.get(e.id),n={},r=groupAssertionScores(e.assertions,exportedAssertionName);for(let[e,t]of r)t.score!==void 0&&(n[e]=t.score);let i=e.assertions.filter(e=>e.passed===!1).map(e=>({...e})),a={...t?.metadata,eveSessionId:e.result.sessionId,eveStatus:e.result.status,eveVerdict:e.verdict,eveSkipReason:e.skipReason,eveToolCalls:e.result.derived.toolCalls.map(e=>e.name),eveSubagentCalls:e.result.derived.subagentCalls.map(e=>e.name),eveSkillLoads:e.result.derived.skillLoads.map(e=>e.skill),eveParked:e.result.derived.parked,eveAssertionScores:composeAssertionScoreMetadata(e.assertions)};e.result.traceContexts.length>0&&(a.eveTraceIds=[...new Set(e.result.traceContexts.map(e=>e.traceId))],a.eveTraceContexts=e.result.traceContexts),i.length>0&&(a.eveFailedAssertions=i),e.result.derived.failureCode&&(a.eveFailureCode=e.result.derived.failureCode);let o={toolCallCount:e.result.derived.toolCallCount,subagentCallCount:e.result.derived.subagentCallCount,messageCount:e.result.derived.messageCount,reasoningBlockCount:e.result.derived.reasoningBlockCount};this.#n.log({id:e.id,input:t?.description??``,output:e.result.output??``,error:e.error??void 0,scores:n,metadata:a,metrics:o,tags:t?.tags?[...t.tags]:void 0})}async onRunComplete(e){if(this.#n)try{this.#t&&await this.#t.flush();let e=await this.#n.summarize();e.experimentUrl&&console.log(`Braintrust experiment: ${e.experimentUrl}\n\n`)}finally{await this.#n.close(),this.#n=void 0,this.#t=void 0}}};async function loadBraintrustSdk(){try{return await import(`braintrust`)}catch{throw Error([`The 'braintrust' package is required for Braintrust reporting but was not found.`,``,`Install it with:`,` npm install braintrust`].join(`
2
2
  `))}}function resolveTags(e,t){let n=new Set([`eve`,`target:${t.kind}`]);for(let t of e){n.add(`eval:${t.id}`);for(let e of t.tags??[])n.add(e)}return[...n]}function resolveExperimentMetadata(e,t){return{eveEvalIds:e.map(e=>e.id),eveTargetKind:t.kind,eveTargetUrl:t.url,eveTimestamp:new Date().toISOString()}}export{Braintrust};