@vercel/agent-runs 1.0.0-rc.3 → 1.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +5 -10
  2. package/README.md +22 -2
  3. package/dist/src/adapters/otel.d.ts.map +1 -1
  4. package/dist/src/adapters/otel.js +4 -0
  5. package/dist/src/adapters/otel.js.map +1 -1
  6. package/dist/src/agent-run.d.ts +19 -2
  7. package/dist/src/agent-run.d.ts.map +1 -1
  8. package/dist/src/agent-run.js +28 -1
  9. package/dist/src/agent-run.js.map +1 -1
  10. package/dist/src/core/activation.d.ts.map +1 -1
  11. package/dist/src/core/activation.js +1 -0
  12. package/dist/src/core/activation.js.map +1 -1
  13. package/dist/src/core/memory.d.ts +11 -0
  14. package/dist/src/core/memory.d.ts.map +1 -0
  15. package/dist/src/core/memory.js +8 -0
  16. package/dist/src/core/memory.js.map +1 -0
  17. package/dist/src/core/scopes.d.ts +3 -0
  18. package/dist/src/core/scopes.d.ts.map +1 -1
  19. package/dist/src/core/scopes.js +18 -10
  20. package/dist/src/core/scopes.js.map +1 -1
  21. package/dist/src/core/snapshot.d.ts.map +1 -1
  22. package/dist/src/core/snapshot.js +1 -0
  23. package/dist/src/core/snapshot.js.map +1 -1
  24. package/dist/src/core/span-kinds.d.ts.map +1 -1
  25. package/dist/src/core/span-kinds.js +22 -1
  26. package/dist/src/core/span-kinds.js.map +1 -1
  27. package/dist/src/core/types.d.ts +14 -1
  28. package/dist/src/core/types.d.ts.map +1 -1
  29. package/dist/src/index.d.ts +2 -2
  30. package/dist/src/index.d.ts.map +1 -1
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/operations.d.ts +1 -0
  33. package/dist/src/operations.d.ts.map +1 -1
  34. package/dist/src/operations.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/adapters/otel.ts +4 -0
  37. package/src/agent-run.ts +54 -2
  38. package/src/core/activation.ts +1 -0
  39. package/src/core/memory.ts +19 -0
  40. package/src/core/scopes.ts +21 -9
  41. package/src/core/snapshot.ts +1 -0
  42. package/src/core/span-kinds.ts +25 -1
  43. package/src/core/types.ts +12 -0
  44. package/src/index.ts +2 -0
  45. package/src/operations.ts +1 -0
package/src/core/types.ts CHANGED
@@ -22,6 +22,7 @@ export type SpanType =
22
22
  | "tool"
23
23
  | "approval"
24
24
  | "memory"
25
+ | "decision"
25
26
  | "channelRequest"
26
27
  | "mcp";
27
28
  export type SpanKind = "INTERNAL" | "CLIENT" | "SERVER" | "PRODUCER" | "CONSUMER";
@@ -85,6 +86,11 @@ export interface AgentTelemetry {
85
86
  ): SpanWriter;
86
87
  /** Returns the operation active in the current execution context. */
87
88
  active(): ActiveOperation | undefined;
89
+ /**
90
+ * Returns the span active in `context`, or the current execution context, including spans
91
+ * the host started itself. Lets a decision nest under the host's span inside an operation.
92
+ */
93
+ activeSpan?(context?: ExecutionContext): TraceReference | undefined;
88
94
  /** Runs `execute` with `operation` as the active trace context. */
89
95
  run<T>(operation: ActiveOperation, execute: () => T, context?: ExecutionContext): T;
90
96
  /** Runs `execute` without creating spans. */
@@ -112,6 +118,7 @@ export interface ActiveOperation {
112
118
  readonly reference: TraceReference;
113
119
  readonly capture: CaptureDecision;
114
120
  readonly mcp?: import("./mcp.js").McpLifecycle;
121
+ readonly memory?: import("./memory.js").MemoryToolLifecycle;
115
122
  }
116
123
 
117
124
  export interface MappingContext {
@@ -196,6 +203,10 @@ export interface ModelOptions {
196
203
  readonly tools?: unknown;
197
204
  readonly runtimeContext?: Readonly<Record<string, unknown>>;
198
205
  }
206
+ export interface DecisionOptions {
207
+ readonly provider?: string;
208
+ readonly modelId: string;
209
+ }
199
210
  export interface ToolOptions {
200
211
  readonly callId: string;
201
212
  readonly name: string;
@@ -222,6 +233,7 @@ export type ScopeData =
222
233
  | { readonly type: "model"; readonly options: ModelOptions }
223
234
  | { readonly type: "tool"; readonly options: ToolOptions }
224
235
  | { readonly type: "approval"; readonly options: ApprovalOptions }
236
+ | { readonly type: "decision"; readonly options: DecisionOptions }
225
237
  | {
226
238
  readonly type: "memory";
227
239
  readonly options: {
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export {
3
3
  type AgentRun,
4
4
  type AgentRunOptions,
5
5
  type AgentMemoryTracing,
6
+ type DecisionInput,
6
7
  type TurnInput,
7
8
  type ResumeInput,
8
9
  } from "./agent-run.js";
@@ -19,6 +20,7 @@ export type {
19
20
  ApprovalInput,
20
21
  ApprovalOperation,
21
22
  MemoryOperation,
23
+ DecisionOperation,
22
24
  ModelCallReturn,
23
25
  ModelStreamReturn,
24
26
  } from "./operations.js";
package/src/operations.ts CHANGED
@@ -98,6 +98,7 @@ export interface ToolOperation extends Operation {
98
98
  export type ModelOperation = Operation;
99
99
  export type ApprovalOperation = Operation;
100
100
  export type MemoryOperation = Operation;
101
+ export type DecisionOperation = Operation;
101
102
  export interface ModelCallReturn<T> extends ModelResult {
102
103
  readonly result: T;
103
104
  }