@axlsdk/axl 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -220,7 +220,7 @@ type AgentConfig = {
220
220
  system: string | ((ctx: {
221
221
  metadata?: Record<string, unknown>;
222
222
  }) => string);
223
- tools?: Tool[];
223
+ tools?: Tool<any, any>[];
224
224
  handoffs?: HandoffDescriptor[];
225
225
  mcp?: string[];
226
226
  mcpTools?: string[];
@@ -611,6 +611,8 @@ interface StateStore {
611
611
  }>>;
612
612
  /** Delete a memory entry by key. */
613
613
  deleteMemory?(scope: string, key: string): Promise<void>;
614
+ /** List all session IDs (used by Studio session browser). */
615
+ listSessions?(): Promise<string[]>;
614
616
  close?(): Promise<void>;
615
617
  deleteCheckpoints?(executionId: string): Promise<void>;
616
618
  }
@@ -754,6 +756,8 @@ declare class MemoryManager {
754
756
  close(): Promise<void>;
755
757
  }
756
758
 
759
+ /** Convert a Zod schema to JSON Schema (subset). Exported for Studio tool introspection. */
760
+ declare function zodToJsonSchema(schema: z.ZodTypeAny): unknown;
757
761
  type WorkflowContextInit = {
758
762
  input: unknown;
759
763
  executionId: string;
@@ -918,9 +922,9 @@ type RetryPolicy = {
918
922
  /** Lifecycle hooks for tool execution. */
919
923
  type ToolHooks<TInput = unknown, TOutput = unknown> = {
920
924
  /** Transform input before the handler runs. Receives parsed input and workflow context. */
921
- before?: (input: TInput, ctx: WorkflowContext) => TInput | Promise<TInput>;
925
+ before?(input: TInput, ctx: WorkflowContext): TInput | Promise<TInput>;
922
926
  /** Transform output after the handler runs. Receives handler result and workflow context. */
923
- after?: (output: TOutput, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
927
+ after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
924
928
  };
925
929
  /** Tool configuration */
926
930
  type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
@@ -1064,6 +1068,8 @@ type ExecuteOptions = {
1064
1068
  declare class AxlRuntime extends EventEmitter {
1065
1069
  private config;
1066
1070
  private workflows;
1071
+ private tools;
1072
+ private agents;
1067
1073
  private providerRegistry;
1068
1074
  private stateStore;
1069
1075
  private executions;
@@ -1087,7 +1093,27 @@ declare class AxlRuntime extends EventEmitter {
1087
1093
  getMcpManager(): McpManager | undefined;
1088
1094
  private createStateStore;
1089
1095
  /** Register a workflow with the runtime. */
1090
- register(workflow: Workflow): void;
1096
+ register(workflow: Workflow<any, any>): void;
1097
+ /** Register standalone tools for Studio introspection and direct testing. */
1098
+ registerTool(...tools: Tool<any, any>[]): void;
1099
+ /** Register standalone agents for Studio playground and introspection. */
1100
+ registerAgent(...agents: Agent[]): void;
1101
+ /** Get all registered workflow names. */
1102
+ getWorkflowNames(): string[];
1103
+ /** Get a registered workflow by name. */
1104
+ getWorkflow(name: string): Workflow | undefined;
1105
+ /** Get all registered workflows. */
1106
+ getWorkflows(): Workflow[];
1107
+ /** Get all registered standalone tools. */
1108
+ getTools(): Tool[];
1109
+ /** Get a registered standalone tool by name. */
1110
+ getTool(name: string): Tool | undefined;
1111
+ /** Get all registered standalone agents. */
1112
+ getAgents(): Agent[];
1113
+ /** Get a registered standalone agent by name. */
1114
+ getAgent(name: string): Agent | undefined;
1115
+ /** Get all execution info (running + completed). */
1116
+ getExecutions(): ExecutionInfo[];
1091
1117
  /** Register a custom provider instance. */
1092
1118
  registerProvider(name: string, provider: Provider): void;
1093
1119
  /** Execute a workflow and return the result. */
@@ -1133,19 +1159,19 @@ declare class AxlRuntime extends EventEmitter {
1133
1159
  */
1134
1160
  eval(config: {
1135
1161
  workflow: string;
1136
- dataset: any;
1137
- scorers: any[];
1162
+ dataset: unknown;
1163
+ scorers: unknown[];
1138
1164
  concurrency?: number;
1139
1165
  budget?: string;
1140
- metadata?: Record<string, any>;
1141
- }): Promise<any>;
1166
+ metadata?: Record<string, unknown>;
1167
+ }): Promise<unknown>;
1142
1168
  /**
1143
1169
  * Compare two evaluation results to detect regressions and improvements.
1144
1170
  * Requires `axl-eval` as a peer dependency.
1145
1171
  *
1146
1172
  * @see Spec Section 13.6
1147
1173
  */
1148
- evalCompare(baseline: any, candidate: any): Promise<any>;
1174
+ evalCompare(baseline: unknown, candidate: unknown): Promise<unknown>;
1149
1175
  /**
1150
1176
  * Handle trace event output based on configuration.
1151
1177
  *
@@ -1419,6 +1445,7 @@ declare class MemoryStore implements StateStore {
1419
1445
  value: unknown;
1420
1446
  }>>;
1421
1447
  deleteMemory(scope: string, key: string): Promise<void>;
1448
+ listSessions(): Promise<string[]>;
1422
1449
  close(): Promise<void>;
1423
1450
  deleteCheckpoints(executionId: string): Promise<void>;
1424
1451
  private persistAwaitHumanState;
@@ -1455,6 +1482,7 @@ declare class SQLiteStore implements StateStore {
1455
1482
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1456
1483
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1457
1484
  listPendingExecutions(): Promise<string[]>;
1485
+ listSessions(): Promise<string[]>;
1458
1486
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1459
1487
  getMemory(scope: string, key: string): Promise<unknown | null>;
1460
1488
  getAllMemory(scope: string): Promise<Array<{
@@ -1502,6 +1530,7 @@ declare class RedisStore implements StateStore {
1502
1530
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1503
1531
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1504
1532
  listPendingExecutions(): Promise<string[]>;
1533
+ listSessions(): Promise<string[]>;
1505
1534
  /** Close the Redis connection. */
1506
1535
  close(): Promise<void>;
1507
1536
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1573,4 +1602,4 @@ declare class NoopSpanManager implements SpanManager {
1573
1602
  */
1574
1603
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
1575
1604
 
1576
- export { type Agent, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type RecallOptions, RedisStore, type RememberOptions, type Result, type RetryPolicy, SQLiteStore, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StreamEvent, type TelemetryConfig, TimeoutError, type Tool, type ToolCallMessage, type ToolConfig, ToolDenied, type ToolHooks, type TraceEvent, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, tool, workflow };
1605
+ export { type Agent, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type RecallOptions, RedisStore, type RememberOptions, type Result, type RetryPolicy, SQLiteStore, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StreamEvent, type TelemetryConfig, TimeoutError, type Tool, type ToolCallMessage, type ToolConfig, ToolDenied, type ToolHooks, type TraceEvent, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, tool, workflow, zodToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -220,7 +220,7 @@ type AgentConfig = {
220
220
  system: string | ((ctx: {
221
221
  metadata?: Record<string, unknown>;
222
222
  }) => string);
223
- tools?: Tool[];
223
+ tools?: Tool<any, any>[];
224
224
  handoffs?: HandoffDescriptor[];
225
225
  mcp?: string[];
226
226
  mcpTools?: string[];
@@ -611,6 +611,8 @@ interface StateStore {
611
611
  }>>;
612
612
  /** Delete a memory entry by key. */
613
613
  deleteMemory?(scope: string, key: string): Promise<void>;
614
+ /** List all session IDs (used by Studio session browser). */
615
+ listSessions?(): Promise<string[]>;
614
616
  close?(): Promise<void>;
615
617
  deleteCheckpoints?(executionId: string): Promise<void>;
616
618
  }
@@ -754,6 +756,8 @@ declare class MemoryManager {
754
756
  close(): Promise<void>;
755
757
  }
756
758
 
759
+ /** Convert a Zod schema to JSON Schema (subset). Exported for Studio tool introspection. */
760
+ declare function zodToJsonSchema(schema: z.ZodTypeAny): unknown;
757
761
  type WorkflowContextInit = {
758
762
  input: unknown;
759
763
  executionId: string;
@@ -918,9 +922,9 @@ type RetryPolicy = {
918
922
  /** Lifecycle hooks for tool execution. */
919
923
  type ToolHooks<TInput = unknown, TOutput = unknown> = {
920
924
  /** Transform input before the handler runs. Receives parsed input and workflow context. */
921
- before?: (input: TInput, ctx: WorkflowContext) => TInput | Promise<TInput>;
925
+ before?(input: TInput, ctx: WorkflowContext): TInput | Promise<TInput>;
922
926
  /** Transform output after the handler runs. Receives handler result and workflow context. */
923
- after?: (output: TOutput, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
927
+ after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
924
928
  };
925
929
  /** Tool configuration */
926
930
  type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
@@ -1064,6 +1068,8 @@ type ExecuteOptions = {
1064
1068
  declare class AxlRuntime extends EventEmitter {
1065
1069
  private config;
1066
1070
  private workflows;
1071
+ private tools;
1072
+ private agents;
1067
1073
  private providerRegistry;
1068
1074
  private stateStore;
1069
1075
  private executions;
@@ -1087,7 +1093,27 @@ declare class AxlRuntime extends EventEmitter {
1087
1093
  getMcpManager(): McpManager | undefined;
1088
1094
  private createStateStore;
1089
1095
  /** Register a workflow with the runtime. */
1090
- register(workflow: Workflow): void;
1096
+ register(workflow: Workflow<any, any>): void;
1097
+ /** Register standalone tools for Studio introspection and direct testing. */
1098
+ registerTool(...tools: Tool<any, any>[]): void;
1099
+ /** Register standalone agents for Studio playground and introspection. */
1100
+ registerAgent(...agents: Agent[]): void;
1101
+ /** Get all registered workflow names. */
1102
+ getWorkflowNames(): string[];
1103
+ /** Get a registered workflow by name. */
1104
+ getWorkflow(name: string): Workflow | undefined;
1105
+ /** Get all registered workflows. */
1106
+ getWorkflows(): Workflow[];
1107
+ /** Get all registered standalone tools. */
1108
+ getTools(): Tool[];
1109
+ /** Get a registered standalone tool by name. */
1110
+ getTool(name: string): Tool | undefined;
1111
+ /** Get all registered standalone agents. */
1112
+ getAgents(): Agent[];
1113
+ /** Get a registered standalone agent by name. */
1114
+ getAgent(name: string): Agent | undefined;
1115
+ /** Get all execution info (running + completed). */
1116
+ getExecutions(): ExecutionInfo[];
1091
1117
  /** Register a custom provider instance. */
1092
1118
  registerProvider(name: string, provider: Provider): void;
1093
1119
  /** Execute a workflow and return the result. */
@@ -1133,19 +1159,19 @@ declare class AxlRuntime extends EventEmitter {
1133
1159
  */
1134
1160
  eval(config: {
1135
1161
  workflow: string;
1136
- dataset: any;
1137
- scorers: any[];
1162
+ dataset: unknown;
1163
+ scorers: unknown[];
1138
1164
  concurrency?: number;
1139
1165
  budget?: string;
1140
- metadata?: Record<string, any>;
1141
- }): Promise<any>;
1166
+ metadata?: Record<string, unknown>;
1167
+ }): Promise<unknown>;
1142
1168
  /**
1143
1169
  * Compare two evaluation results to detect regressions and improvements.
1144
1170
  * Requires `axl-eval` as a peer dependency.
1145
1171
  *
1146
1172
  * @see Spec Section 13.6
1147
1173
  */
1148
- evalCompare(baseline: any, candidate: any): Promise<any>;
1174
+ evalCompare(baseline: unknown, candidate: unknown): Promise<unknown>;
1149
1175
  /**
1150
1176
  * Handle trace event output based on configuration.
1151
1177
  *
@@ -1419,6 +1445,7 @@ declare class MemoryStore implements StateStore {
1419
1445
  value: unknown;
1420
1446
  }>>;
1421
1447
  deleteMemory(scope: string, key: string): Promise<void>;
1448
+ listSessions(): Promise<string[]>;
1422
1449
  close(): Promise<void>;
1423
1450
  deleteCheckpoints(executionId: string): Promise<void>;
1424
1451
  private persistAwaitHumanState;
@@ -1455,6 +1482,7 @@ declare class SQLiteStore implements StateStore {
1455
1482
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1456
1483
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1457
1484
  listPendingExecutions(): Promise<string[]>;
1485
+ listSessions(): Promise<string[]>;
1458
1486
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1459
1487
  getMemory(scope: string, key: string): Promise<unknown | null>;
1460
1488
  getAllMemory(scope: string): Promise<Array<{
@@ -1502,6 +1530,7 @@ declare class RedisStore implements StateStore {
1502
1530
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1503
1531
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1504
1532
  listPendingExecutions(): Promise<string[]>;
1533
+ listSessions(): Promise<string[]>;
1505
1534
  /** Close the Redis connection. */
1506
1535
  close(): Promise<void>;
1507
1536
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1573,4 +1602,4 @@ declare class NoopSpanManager implements SpanManager {
1573
1602
  */
1574
1603
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
1575
1604
 
1576
- export { type Agent, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type RecallOptions, RedisStore, type RememberOptions, type Result, type RetryPolicy, SQLiteStore, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StreamEvent, type TelemetryConfig, TimeoutError, type Tool, type ToolCallMessage, type ToolConfig, ToolDenied, type ToolHooks, type TraceEvent, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, tool, workflow };
1605
+ export { type Agent, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type RecallOptions, RedisStore, type RememberOptions, type Result, type RetryPolicy, SQLiteStore, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StreamEvent, type TelemetryConfig, TimeoutError, type Tool, type ToolCallMessage, type ToolConfig, ToolDenied, type ToolHooks, type TraceEvent, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, tool, workflow, zodToJsonSchema };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __require
3
- } from "./chunk-EE2BCC37.js";
3
+ } from "./chunk-JBLQKU6X.js";
4
4
 
5
5
  // src/tool.ts
6
6
  var DEFAULT_MAX_STRING_LENGTH = 1e4;
@@ -102,6 +102,48 @@ function tool(config) {
102
102
  };
103
103
  }
104
104
 
105
+ // src/providers/retry.ts
106
+ var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 503, 529]);
107
+ var MAX_RETRIES = 2;
108
+ var BASE_DELAY_MS = 1e3;
109
+ function sleep2(ms, signal) {
110
+ return new Promise((resolve) => {
111
+ if (signal?.aborted) {
112
+ resolve();
113
+ return;
114
+ }
115
+ const timer = setTimeout(resolve, ms);
116
+ signal?.addEventListener(
117
+ "abort",
118
+ () => {
119
+ clearTimeout(timer);
120
+ resolve();
121
+ },
122
+ { once: true }
123
+ );
124
+ });
125
+ }
126
+ async function fetchWithRetry(input, init, maxRetries = MAX_RETRIES) {
127
+ for (let attempt = 0; ; attempt++) {
128
+ const res = await fetch(input, init);
129
+ if (res.ok || !RETRYABLE_STATUS_CODES.has(res.status) || attempt >= maxRetries) {
130
+ return res;
131
+ }
132
+ if (init?.signal?.aborted) {
133
+ return res;
134
+ }
135
+ const retryAfter = res.headers.get("retry-after");
136
+ let delay;
137
+ if (retryAfter && !isNaN(Number(retryAfter))) {
138
+ delay = Number(retryAfter) * 1e3;
139
+ } else {
140
+ delay = BASE_DELAY_MS * 2 ** attempt;
141
+ }
142
+ delay *= 0.75 + Math.random() * 0.5;
143
+ await sleep2(delay, init?.signal ?? void 0);
144
+ }
145
+ }
146
+
105
147
  // src/providers/openai.ts
106
148
  var OPENAI_PRICING = {
107
149
  "gpt-4o": [25e-7, 1e-5],
@@ -161,7 +203,7 @@ var OpenAIProvider = class {
161
203
  // ---------------------------------------------------------------------------
162
204
  async chat(messages, options) {
163
205
  const body = this.buildRequestBody(messages, options, false);
164
- const res = await fetch(`${this.baseUrl}/chat/completions`, {
206
+ const res = await fetchWithRetry(`${this.baseUrl}/chat/completions`, {
165
207
  method: "POST",
166
208
  headers: {
167
209
  "Content-Type": "application/json",
@@ -209,7 +251,7 @@ var OpenAIProvider = class {
209
251
  // ---------------------------------------------------------------------------
210
252
  async *stream(messages, options) {
211
253
  const body = this.buildRequestBody(messages, options, true);
212
- const res = await fetch(`${this.baseUrl}/chat/completions`, {
254
+ const res = await fetchWithRetry(`${this.baseUrl}/chat/completions`, {
213
255
  method: "POST",
214
256
  headers: {
215
257
  "Content-Type": "application/json",
@@ -368,7 +410,7 @@ var OpenAIResponsesProvider = class {
368
410
  // ---------------------------------------------------------------------------
369
411
  async chat(messages, options) {
370
412
  const body = this.buildRequestBody(messages, options, false);
371
- const res = await fetch(`${this.baseUrl}/responses`, {
413
+ const res = await fetchWithRetry(`${this.baseUrl}/responses`, {
372
414
  method: "POST",
373
415
  headers: {
374
416
  "Content-Type": "application/json",
@@ -390,7 +432,7 @@ var OpenAIResponsesProvider = class {
390
432
  // ---------------------------------------------------------------------------
391
433
  async *stream(messages, options) {
392
434
  const body = this.buildRequestBody(messages, options, true);
393
- const res = await fetch(`${this.baseUrl}/responses`, {
435
+ const res = await fetchWithRetry(`${this.baseUrl}/responses`, {
394
436
  method: "POST",
395
437
  headers: {
396
438
  "Content-Type": "application/json",
@@ -702,7 +744,7 @@ var AnthropicProvider = class {
702
744
  async chat(messages, options) {
703
745
  this.currentModel = options.model;
704
746
  const body = this.buildRequestBody(messages, options, false);
705
- const res = await fetch(`${this.baseUrl}/messages`, {
747
+ const res = await fetchWithRetry(`${this.baseUrl}/messages`, {
706
748
  method: "POST",
707
749
  headers: this.buildHeaders(),
708
750
  body: JSON.stringify(body),
@@ -721,7 +763,7 @@ var AnthropicProvider = class {
721
763
  // ---------------------------------------------------------------------------
722
764
  async *stream(messages, options) {
723
765
  const body = this.buildRequestBody(messages, options, true);
724
- const res = await fetch(`${this.baseUrl}/messages`, {
766
+ const res = await fetchWithRetry(`${this.baseUrl}/messages`, {
725
767
  method: "POST",
726
768
  headers: this.buildHeaders(),
727
769
  body: JSON.stringify(body),
@@ -1072,7 +1114,7 @@ var GeminiProvider = class {
1072
1114
  // ---------------------------------------------------------------------------
1073
1115
  async chat(messages, options) {
1074
1116
  const body = this.buildRequestBody(messages, options);
1075
- const res = await fetch(`${this.baseUrl}/models/${options.model}:generateContent`, {
1117
+ const res = await fetchWithRetry(`${this.baseUrl}/models/${options.model}:generateContent`, {
1076
1118
  method: "POST",
1077
1119
  headers: this.buildHeaders(),
1078
1120
  body: JSON.stringify(body),
@@ -1091,7 +1133,7 @@ var GeminiProvider = class {
1091
1133
  // ---------------------------------------------------------------------------
1092
1134
  async *stream(messages, options) {
1093
1135
  const body = this.buildRequestBody(messages, options);
1094
- const res = await fetch(
1136
+ const res = await fetchWithRetry(
1095
1137
  `${this.baseUrl}/models/${options.model}:streamGenerateContent?alt=sse`,
1096
1138
  {
1097
1139
  method: "POST",
@@ -2173,7 +2215,8 @@ Please fix and try again.`;
2173
2215
  span.setAttribute("axl.tool.duration", Date.now() - toolStart2);
2174
2216
  const isError = r && typeof r === "object" && "error" in r;
2175
2217
  span.setAttribute("axl.tool.success", !isError);
2176
- if (isError) span.setStatus("error", r.error);
2218
+ if (isError)
2219
+ span.setStatus("error", r.error);
2177
2220
  return r;
2178
2221
  }
2179
2222
  ) : await executeOverride();
@@ -2285,7 +2328,9 @@ Please fix and try again.`;
2285
2328
  try {
2286
2329
  const mcpResult = await this.mcpManager.callTool(toolName, toolArgs);
2287
2330
  toolResult2 = mcpResult;
2288
- resultContent2 = mcpResult.content.map((c) => c.type === "text" ? c.text : `[${c.type}]`).join("\n");
2331
+ resultContent2 = mcpResult.content.map(
2332
+ (c) => c.type === "text" ? c.text : `[${c.type}]`
2333
+ ).join("\n");
2289
2334
  if (mcpResult.isError) {
2290
2335
  resultContent2 = `Error: ${resultContent2}`;
2291
2336
  }
@@ -2327,7 +2372,11 @@ Please fix and try again.`;
2327
2372
  span.setAttribute("axl.tool.duration", Date.now() - toolStart);
2328
2373
  const isError = r.toolResult && typeof r.toolResult === "object" && "error" in r.toolResult;
2329
2374
  span.setAttribute("axl.tool.success", !isError);
2330
- if (isError) span.setStatus("error", r.toolResult.error);
2375
+ if (isError)
2376
+ span.setStatus(
2377
+ "error",
2378
+ r.toolResult.error
2379
+ );
2331
2380
  return r;
2332
2381
  }
2333
2382
  ) : await executeTool();
@@ -3306,6 +3355,10 @@ var MemoryStore = class {
3306
3355
  async deleteMemory(scope, key) {
3307
3356
  this.memories.get(scope)?.delete(key);
3308
3357
  }
3358
+ // ── Sessions (Studio introspection) ─────────────────────────────────
3359
+ async listSessions() {
3360
+ return [...this.sessions.keys()];
3361
+ }
3309
3362
  // ── Lifecycle ──────────────────────────────────────────────────────
3310
3363
  async close() {
3311
3364
  }
@@ -3534,6 +3587,11 @@ var SQLiteStore = class {
3534
3587
  const rows = stmt.all();
3535
3588
  return rows.map((r) => r.execution_id);
3536
3589
  }
3590
+ // ── Sessions (Studio introspection) ────────────────────────────────────
3591
+ async listSessions() {
3592
+ const rows = this.db.prepare("SELECT session_id FROM sessions").all();
3593
+ return rows.map((r) => r.session_id);
3594
+ }
3537
3595
  // ── Memory ────────────────────────────────────────────────────────────
3538
3596
  async saveMemory(scope, key, value) {
3539
3597
  this.db.prepare(
@@ -3567,7 +3625,8 @@ var RedisStore = class {
3567
3625
  constructor(url) {
3568
3626
  let Redis;
3569
3627
  try {
3570
- Redis = __require("ioredis").default ?? __require("ioredis");
3628
+ const mod = __require("ioredis");
3629
+ Redis = mod.default ?? mod;
3571
3630
  } catch {
3572
3631
  throw new Error("ioredis is required for RedisStore. Install it with: npm install ioredis");
3573
3632
  }
@@ -3617,6 +3676,7 @@ var RedisStore = class {
3617
3676
  // ── Sessions ─────────────────────────────────────────────────────────
3618
3677
  async saveSession(sessionId, history) {
3619
3678
  await this.client.set(this.sessionKey(sessionId), JSON.stringify(history));
3679
+ await this.client.sadd("axl:session-ids", sessionId);
3620
3680
  }
3621
3681
  async getSession(sessionId) {
3622
3682
  const raw = await this.client.get(this.sessionKey(sessionId));
@@ -3625,6 +3685,7 @@ var RedisStore = class {
3625
3685
  async deleteSession(sessionId) {
3626
3686
  await this.client.del(this.sessionKey(sessionId));
3627
3687
  await this.client.del(this.sessionMetaKey(sessionId));
3688
+ await this.client.srem("axl:session-ids", sessionId);
3628
3689
  }
3629
3690
  async saveSessionMeta(sessionId, key, value) {
3630
3691
  await this.client.hset(this.sessionMetaKey(sessionId), key, JSON.stringify(value));
@@ -3661,6 +3722,10 @@ var RedisStore = class {
3661
3722
  async listPendingExecutions() {
3662
3723
  return this.client.smembers(this.pendingExecSetKey());
3663
3724
  }
3725
+ // ── Sessions (Studio introspection) ────────────────────────────────────
3726
+ async listSessions() {
3727
+ return this.client.smembers("axl:session-ids");
3728
+ }
3664
3729
  /** Close the Redis connection. */
3665
3730
  async close() {
3666
3731
  await this.client.quit();
@@ -4489,7 +4554,7 @@ async function createSpanManager(config) {
4489
4554
  if (!config?.enabled) {
4490
4555
  return new NoopSpanManager();
4491
4556
  }
4492
- const { OTelSpanManager: OTelSpanManager2 } = await import("./span-manager-LGX7QHZ7.js");
4557
+ const { OTelSpanManager: OTelSpanManager2 } = await import("./span-manager-3IKXXUTZ.js");
4493
4558
  return OTelSpanManager2.create(config);
4494
4559
  }
4495
4560
 
@@ -4505,6 +4570,8 @@ function hashInput(input) {
4505
4570
  var AxlRuntime = class extends EventEmitter2 {
4506
4571
  config;
4507
4572
  workflows = /* @__PURE__ */ new Map();
4573
+ tools = /* @__PURE__ */ new Map();
4574
+ agents = /* @__PURE__ */ new Map();
4508
4575
  providerRegistry;
4509
4576
  stateStore;
4510
4577
  executions = /* @__PURE__ */ new Map();
@@ -4559,9 +4626,56 @@ var AxlRuntime = class extends EventEmitter2 {
4559
4626
  }
4560
4627
  }
4561
4628
  /** Register a workflow with the runtime. */
4629
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4562
4630
  register(workflow2) {
4563
4631
  this.workflows.set(workflow2.name, workflow2);
4564
4632
  }
4633
+ /** Register standalone tools for Studio introspection and direct testing. */
4634
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4635
+ registerTool(...tools) {
4636
+ for (const t of tools) {
4637
+ this.tools.set(t.name, t);
4638
+ }
4639
+ }
4640
+ /** Register standalone agents for Studio playground and introspection. */
4641
+ registerAgent(...agents) {
4642
+ for (const a of agents) {
4643
+ this.agents.set(a._name, a);
4644
+ }
4645
+ }
4646
+ // ── Introspection (used by Studio) ────────────────────────────────
4647
+ /** Get all registered workflow names. */
4648
+ getWorkflowNames() {
4649
+ return [...this.workflows.keys()];
4650
+ }
4651
+ /** Get a registered workflow by name. */
4652
+ getWorkflow(name) {
4653
+ return this.workflows.get(name);
4654
+ }
4655
+ /** Get all registered workflows. */
4656
+ getWorkflows() {
4657
+ return [...this.workflows.values()];
4658
+ }
4659
+ /** Get all registered standalone tools. */
4660
+ getTools() {
4661
+ return [...this.tools.values()];
4662
+ }
4663
+ /** Get a registered standalone tool by name. */
4664
+ getTool(name) {
4665
+ return this.tools.get(name);
4666
+ }
4667
+ /** Get all registered standalone agents. */
4668
+ getAgents() {
4669
+ return [...this.agents.values()];
4670
+ }
4671
+ /** Get a registered standalone agent by name. */
4672
+ getAgent(name) {
4673
+ return this.agents.get(name);
4674
+ }
4675
+ /** Get all execution info (running + completed). */
4676
+ getExecutions() {
4677
+ return [...this.executions.values()];
4678
+ }
4565
4679
  /** Register a custom provider instance. */
4566
4680
  registerProvider(name, provider) {
4567
4681
  this.providerRegistry.registerInstance(name, provider);
@@ -5260,6 +5374,7 @@ export {
5260
5374
  createSpanManager,
5261
5375
  defineConfig,
5262
5376
  tool,
5263
- workflow
5377
+ workflow,
5378
+ zodToJsonSchema
5264
5379
  };
5265
5380
  //# sourceMappingURL=index.js.map