@axlsdk/axl 0.13.7 → 0.14.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
@@ -571,6 +571,8 @@ interface StateStore {
571
571
  saveEvalResult?(entry: EvalHistoryEntry): Promise<void>;
572
572
  /** List eval history entries (most recent first). */
573
573
  listEvalResults?(limit?: number): Promise<EvalHistoryEntry[]>;
574
+ /** Delete an eval history entry by id. Returns true if an entry was deleted. */
575
+ deleteEvalResult?(id: string): Promise<boolean>;
574
576
  /** List all session IDs (used by Studio session browser). */
575
577
  listSessions?(): Promise<string[]>;
576
578
  close?(): Promise<void>;
@@ -1409,6 +1411,14 @@ declare class AxlRuntime extends EventEmitter {
1409
1411
  getExecution(executionId: string): Promise<ExecutionInfo | undefined>;
1410
1412
  /** Save an eval result to history. */
1411
1413
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1414
+ /**
1415
+ * Delete an eval history entry by id. Removes from in-memory cache and
1416
+ * the configured StateStore. Returns true if an entry was actually removed.
1417
+ *
1418
+ * Ensures lazy-loaded history is loaded first so the in-memory cache and
1419
+ * the store can't drift apart on the deletion path.
1420
+ */
1421
+ deleteEvalResult(id: string): Promise<boolean>;
1412
1422
  /** Get eval result history (most recent first). */
1413
1423
  getEvalHistory(): Promise<EvalHistoryEntry[]>;
1414
1424
  /** List pending human decisions. */
@@ -1488,6 +1498,15 @@ declare class AxlRuntime extends EventEmitter {
1488
1498
  reasoning: number;
1489
1499
  };
1490
1500
  agentCalls: number;
1501
+ /**
1502
+ * Unique workflow names observed during execution, ordered by first
1503
+ * appearance (outermost first for nested calls). Captured automatically
1504
+ * from `workflow_start` trace events — callers don't need to declare
1505
+ * anything. Parallel mechanism to `models`.
1506
+ */
1507
+ workflows: string[];
1508
+ /** Call counts per workflow, if workflows.length > 0. */
1509
+ workflowCallCounts?: Record<string, number>;
1491
1510
  };
1492
1511
  }>;
1493
1512
  /** Register an execution ID with the active cost scope for trackCost() attribution. */
@@ -1798,6 +1817,7 @@ declare class MemoryStore implements StateStore {
1798
1817
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1799
1818
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1800
1819
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1820
+ deleteEvalResult(id: string): Promise<boolean>;
1801
1821
  listSessions(): Promise<string[]>;
1802
1822
  close(): Promise<void>;
1803
1823
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1840,6 +1860,7 @@ declare class SQLiteStore implements StateStore {
1840
1860
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1841
1861
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1842
1862
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1863
+ deleteEvalResult(id: string): Promise<boolean>;
1843
1864
  listSessions(): Promise<string[]>;
1844
1865
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1845
1866
  getMemory(scope: string, key: string): Promise<unknown | null>;
@@ -1903,6 +1924,7 @@ declare class RedisStore implements StateStore {
1903
1924
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1904
1925
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1905
1926
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1927
+ deleteEvalResult(id: string): Promise<boolean>;
1906
1928
  listSessions(): Promise<string[]>;
1907
1929
  /** Close the Redis connection. */
1908
1930
  close(): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -571,6 +571,8 @@ interface StateStore {
571
571
  saveEvalResult?(entry: EvalHistoryEntry): Promise<void>;
572
572
  /** List eval history entries (most recent first). */
573
573
  listEvalResults?(limit?: number): Promise<EvalHistoryEntry[]>;
574
+ /** Delete an eval history entry by id. Returns true if an entry was deleted. */
575
+ deleteEvalResult?(id: string): Promise<boolean>;
574
576
  /** List all session IDs (used by Studio session browser). */
575
577
  listSessions?(): Promise<string[]>;
576
578
  close?(): Promise<void>;
@@ -1409,6 +1411,14 @@ declare class AxlRuntime extends EventEmitter {
1409
1411
  getExecution(executionId: string): Promise<ExecutionInfo | undefined>;
1410
1412
  /** Save an eval result to history. */
1411
1413
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1414
+ /**
1415
+ * Delete an eval history entry by id. Removes from in-memory cache and
1416
+ * the configured StateStore. Returns true if an entry was actually removed.
1417
+ *
1418
+ * Ensures lazy-loaded history is loaded first so the in-memory cache and
1419
+ * the store can't drift apart on the deletion path.
1420
+ */
1421
+ deleteEvalResult(id: string): Promise<boolean>;
1412
1422
  /** Get eval result history (most recent first). */
1413
1423
  getEvalHistory(): Promise<EvalHistoryEntry[]>;
1414
1424
  /** List pending human decisions. */
@@ -1488,6 +1498,15 @@ declare class AxlRuntime extends EventEmitter {
1488
1498
  reasoning: number;
1489
1499
  };
1490
1500
  agentCalls: number;
1501
+ /**
1502
+ * Unique workflow names observed during execution, ordered by first
1503
+ * appearance (outermost first for nested calls). Captured automatically
1504
+ * from `workflow_start` trace events — callers don't need to declare
1505
+ * anything. Parallel mechanism to `models`.
1506
+ */
1507
+ workflows: string[];
1508
+ /** Call counts per workflow, if workflows.length > 0. */
1509
+ workflowCallCounts?: Record<string, number>;
1491
1510
  };
1492
1511
  }>;
1493
1512
  /** Register an execution ID with the active cost scope for trackCost() attribution. */
@@ -1798,6 +1817,7 @@ declare class MemoryStore implements StateStore {
1798
1817
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1799
1818
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1800
1819
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1820
+ deleteEvalResult(id: string): Promise<boolean>;
1801
1821
  listSessions(): Promise<string[]>;
1802
1822
  close(): Promise<void>;
1803
1823
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1840,6 +1860,7 @@ declare class SQLiteStore implements StateStore {
1840
1860
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1841
1861
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1842
1862
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1863
+ deleteEvalResult(id: string): Promise<boolean>;
1843
1864
  listSessions(): Promise<string[]>;
1844
1865
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1845
1866
  getMemory(scope: string, key: string): Promise<unknown | null>;
@@ -1903,6 +1924,7 @@ declare class RedisStore implements StateStore {
1903
1924
  listExecutions(limit?: number): Promise<ExecutionInfo[]>;
1904
1925
  saveEvalResult(entry: EvalHistoryEntry): Promise<void>;
1905
1926
  listEvalResults(limit?: number): Promise<EvalHistoryEntry[]>;
1927
+ deleteEvalResult(id: string): Promise<boolean>;
1906
1928
  listSessions(): Promise<string[]>;
1907
1929
  /** Close the Redis connection. */
1908
1930
  close(): Promise<void>;
package/dist/index.js CHANGED
@@ -4082,6 +4082,9 @@ var MemoryStore = class {
4082
4082
  const result = limit ? sorted.slice(0, limit) : sorted;
4083
4083
  return result.map((e) => structuredClone(e));
4084
4084
  }
4085
+ async deleteEvalResult(id) {
4086
+ return this.evalHistory.delete(id);
4087
+ }
4085
4088
  // ── Sessions (Studio introspection) ─────────────────────────────────
4086
4089
  async listSessions() {
4087
4090
  return [...this.sessions.keys()];
@@ -4390,6 +4393,10 @@ var SQLiteStore = class {
4390
4393
  data: safeJsonParse(r.data)
4391
4394
  }));
4392
4395
  }
4396
+ async deleteEvalResult(id) {
4397
+ const result = this.db.prepare("DELETE FROM eval_history WHERE id = ?").run(id);
4398
+ return result.changes > 0;
4399
+ }
4393
4400
  // ── Sessions (Studio introspection) ────────────────────────────────────
4394
4401
  async listSessions() {
4395
4402
  const rows = this.db.prepare("SELECT session_id FROM sessions").all();
@@ -5874,6 +5881,24 @@ var AxlRuntime = class extends EventEmitter2 {
5874
5881
  await this.stateStore.saveEvalResult(entry);
5875
5882
  }
5876
5883
  }
5884
+ /**
5885
+ * Delete an eval history entry by id. Removes from in-memory cache and
5886
+ * the configured StateStore. Returns true if an entry was actually removed.
5887
+ *
5888
+ * Ensures lazy-loaded history is loaded first so the in-memory cache and
5889
+ * the store can't drift apart on the deletion path.
5890
+ */
5891
+ async deleteEvalResult(id) {
5892
+ await this.getEvalHistory();
5893
+ const beforeLength = this.evalHistory.length;
5894
+ this.evalHistory = this.evalHistory.filter((e) => e.id !== id);
5895
+ const removedFromMemory = this.evalHistory.length < beforeLength;
5896
+ let removedFromStore = false;
5897
+ if (this.stateStore.deleteEvalResult) {
5898
+ removedFromStore = await this.stateStore.deleteEvalResult(id);
5899
+ }
5900
+ return removedFromMemory || removedFromStore;
5901
+ }
5877
5902
  /** Get eval result history (most recent first). */
5878
5903
  async getEvalHistory() {
5879
5904
  if (!this.evalHistoryLoadPromise && this.stateStore.listEvalResults) {
@@ -6049,6 +6074,7 @@ var AxlRuntime = class extends EventEmitter2 {
6049
6074
  parent: parentScope
6050
6075
  };
6051
6076
  const modelCalls = /* @__PURE__ */ new Map();
6077
+ const workflowCalls = /* @__PURE__ */ new Map();
6052
6078
  const tokens = { input: 0, output: 0, reasoning: 0 };
6053
6079
  let agentCalls = 0;
6054
6080
  const listener = (event) => {
@@ -6063,6 +6089,18 @@ var AxlRuntime = class extends EventEmitter2 {
6063
6089
  tokens.reasoning += event.tokens.reasoning ?? 0;
6064
6090
  }
6065
6091
  }
6092
+ let workflowName;
6093
+ if (event.type === "workflow_start" && event.workflow) {
6094
+ workflowName = event.workflow;
6095
+ } else if (event.type === "log" && event.data && typeof event.data === "object") {
6096
+ const d = event.data;
6097
+ if (d.event === "workflow_start" && typeof d.workflow === "string") {
6098
+ workflowName = d.workflow;
6099
+ }
6100
+ }
6101
+ if (workflowName) {
6102
+ workflowCalls.set(workflowName, (workflowCalls.get(workflowName) ?? 0) + 1);
6103
+ }
6066
6104
  };
6067
6105
  this.setMaxListeners(this.getMaxListeners() + 1);
6068
6106
  this.on("trace", listener);
@@ -6075,7 +6113,9 @@ var AxlRuntime = class extends EventEmitter2 {
6075
6113
  models: [...modelCalls.keys()],
6076
6114
  modelCallCounts: modelCalls.size > 0 ? Object.fromEntries(modelCalls) : void 0,
6077
6115
  tokens,
6078
- agentCalls
6116
+ agentCalls,
6117
+ workflows: [...workflowCalls.keys()],
6118
+ workflowCallCounts: workflowCalls.size > 0 ? Object.fromEntries(workflowCalls) : void 0
6079
6119
  }
6080
6120
  };
6081
6121
  } finally {
@@ -6353,6 +6393,11 @@ var RedisStore = class _RedisStore {
6353
6393
  entries.sort((a, b) => b.timestamp - a.timestamp);
6354
6394
  return limit ? entries.slice(0, limit) : entries;
6355
6395
  }
6396
+ async deleteEvalResult(id) {
6397
+ await this.client.sRem(this.evalHistorySetKey(), id);
6398
+ const deleted = await this.client.del(this.evalHistoryKey(id));
6399
+ return deleted > 0;
6400
+ }
6356
6401
  // ── Sessions (Studio introspection) ────────────────────────────────────
6357
6402
  async listSessions() {
6358
6403
  return this.client.sMembers("axl:session-ids");