@sweny-ai/core 0.1.199 → 0.1.201

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/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export type { WorkflowInputs, WorkflowInputField, WorkflowInputType, InputValida
3
3
  export { WORKFLOW_INPUT_TYPES } from "./inputs.js";
4
4
  import type { Source as _Source, ResolvedSource as _ResolvedSource } from "./sources.js";
5
5
  import type { ToolClass } from "./harness/types.js";
6
- import type { Budget, BudgetOverrun } from "./budget.js";
6
+ import type { Budget, BudgetOverrun, SpendBreakdown } from "./budget.js";
7
7
  import type { DeciderConfig, DeciderRecord } from "./decider.js";
8
8
  export type JSONSchema = Record<string, unknown>;
9
9
  /** Context passed to tool handlers at execution time */
@@ -873,6 +873,16 @@ export type ExecutionEvent = {
873
873
  type: "node:exit";
874
874
  node: string;
875
875
  result: NodeResult;
876
+ }
877
+ /**
878
+ * A finished node's result changed after its `node:exit` (a budget stop at
879
+ * the route that followed it). Not a second exit: consumers that keep each
880
+ * node's final result replace it; timers and step printers ignore it.
881
+ */
882
+ | {
883
+ type: "node:amended";
884
+ node: string;
885
+ result: NodeResult;
876
886
  } | {
877
887
  type: "node:progress";
878
888
  node: string;
@@ -951,6 +961,13 @@ export interface ExecutionTrace {
951
961
  * URL, an open breaker or a spent call cap. Absent when nothing turned it off.
952
962
  */
953
963
  deciderOff?: string;
964
+ /**
965
+ * Model spend by kind: agent `node` runs and the executor's own `judge`,
966
+ * `route`, `reflect` (retry reflection) and `screen` completions. Absent
967
+ * unless one of those own completions reported usage. The run budget is
968
+ * over the sum. `node` covers every attempt of every visit.
969
+ */
970
+ spend?: SpendBreakdown;
954
971
  }
955
972
  /** Result of execute() — final node results + full execution trace */
956
973
  export interface ExecutionResult {
@@ -1047,6 +1064,14 @@ export interface Claude {
1047
1064
  timeoutMs?: number;
1048
1065
  /** Caller-supplied abort signal. Aborting it interrupts the query. */
1049
1066
  signal?: AbortSignal;
1067
+ /**
1068
+ * Called once with the completion's total usage, when the harness reports
1069
+ * it, before the outcome is known (a failed completion was still billed).
1070
+ * Unlike `run`'s `onUsage`, which streams cumulative reports while a node
1071
+ * runs, this is one report per completion. The executor counts it against
1072
+ * the run budget. A hook that throws never changes the result.
1073
+ */
1074
+ onUsage?: (usage: NodeUsage) => void;
1050
1075
  }): Promise<string | null>;
1051
1076
  /**
1052
1077
  * Single-completion free-text query. No tools, no output schema.
@@ -1064,6 +1089,14 @@ export interface Claude {
1064
1089
  timeoutMs?: number;
1065
1090
  /** Caller-supplied abort signal. Aborting it interrupts the query. */
1066
1091
  signal?: AbortSignal;
1092
+ /**
1093
+ * Called once with the completion's total usage, when the harness reports
1094
+ * it, before the outcome is known (a failed completion was still billed).
1095
+ * Unlike `run`'s `onUsage`, which streams cumulative reports while a node
1096
+ * runs, this is one report per completion. The executor counts it against
1097
+ * the run budget. A hook that throws never changes the result.
1098
+ */
1099
+ onUsage?: (usage: NodeUsage) => void;
1067
1100
  }): Promise<string>;
1068
1101
  }
1069
1102
  export interface McpServerConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sweny-ai/core",
3
- "version": "0.1.199",
3
+ "version": "0.1.201",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sweny": "./dist/cli/main.js"