@smithers-orchestrator/components 0.24.0 → 0.24.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithers-orchestrator/components",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "description": "React components for Smithers workflows",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,15 +24,15 @@
24
24
  "react": "^19.2.5",
25
25
  "react-dom": "^19.2.5",
26
26
  "zod": "^4.3.6",
27
- "@smithers-orchestrator/agents": "0.24.0",
28
- "@smithers-orchestrator/db": "0.24.0",
29
- "@smithers-orchestrator/driver": "0.24.0",
30
- "@smithers-orchestrator/errors": "0.24.0",
31
- "@smithers-orchestrator/graph": "0.24.0",
32
- "@smithers-orchestrator/memory": "0.24.0",
33
- "@smithers-orchestrator/scheduler": "0.24.0",
34
- "@smithers-orchestrator/react-reconciler": "0.24.0",
35
- "@smithers-orchestrator/observability": "0.24.0"
27
+ "@smithers-orchestrator/agents": "0.24.2",
28
+ "@smithers-orchestrator/db": "0.24.2",
29
+ "@smithers-orchestrator/graph": "0.24.2",
30
+ "@smithers-orchestrator/errors": "0.24.2",
31
+ "@smithers-orchestrator/driver": "0.24.2",
32
+ "@smithers-orchestrator/observability": "0.24.2",
33
+ "@smithers-orchestrator/react-reconciler": "0.24.2",
34
+ "@smithers-orchestrator/scheduler": "0.24.2",
35
+ "@smithers-orchestrator/memory": "0.24.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@tanstack/react-query": "^5.99.1",
@@ -4,6 +4,5 @@
4
4
  export type AspectAccumulator = {
5
5
  totalTokens: number;
6
6
  totalLatencyMs: number;
7
- totalCostUsd: number;
8
7
  taskCount: number;
9
8
  };
@@ -1,7 +1,6 @@
1
1
  // @smithers-type-exports-begin
2
2
  /** @typedef {import("./AspectAccumulator.ts").AspectAccumulator} AspectAccumulator */
3
3
  /** @typedef {import("./AspectContextValue.ts").AspectContextValue} AspectContextValue */
4
- /** @typedef {import("./CostBudgetConfig.ts").CostBudgetConfig} CostBudgetConfig */
5
4
  /** @typedef {import("./LatencySloConfig.ts").LatencySloConfig} LatencySloConfig */
6
5
  /** @typedef {import("./TokenBudgetConfig.ts").TokenBudgetConfig} TokenBudgetConfig */
7
6
  /** @typedef {import("./TrackingConfig.ts").TrackingConfig} TrackingConfig */
@@ -10,7 +9,8 @@
10
9
  import React from "react";
11
10
  /**
12
11
  * React context that propagates Aspects configuration down the component tree.
13
- * Budget configuration is declarative metadata and is not enforced yet.
12
+ * Tasks read from this context to attach budgets the engine enforces and to
13
+ * track metrics.
14
14
  * @type {React.Context<AspectContextValue | null>}
15
15
  */
16
16
  export const AspectContext = React.createContext(/** @type {AspectContextValue | null} */ (null));
@@ -23,7 +23,6 @@ export function createAccumulator() {
23
23
  return {
24
24
  totalTokens: 0,
25
25
  totalLatencyMs: 0,
26
- totalCostUsd: 0,
27
26
  taskCount: 0,
28
27
  };
29
28
  }
@@ -1,6 +1,5 @@
1
1
  import type { TokenBudgetConfig } from "./TokenBudgetConfig.ts";
2
2
  import type { LatencySloConfig } from "./LatencySloConfig.ts";
3
- import type { CostBudgetConfig } from "./CostBudgetConfig.ts";
4
3
  import type { TrackingConfig } from "./TrackingConfig.ts";
5
4
  import type { AspectAccumulator } from "./AspectAccumulator.ts";
6
5
 
@@ -10,7 +9,6 @@ import type { AspectAccumulator } from "./AspectAccumulator.ts";
10
9
  export type AspectContextValue = {
11
10
  tokenBudget?: TokenBudgetConfig;
12
11
  latencySlo?: LatencySloConfig;
13
- costBudget?: CostBudgetConfig;
14
12
  tracking: TrackingConfig;
15
13
  accumulator: AspectAccumulator;
16
14
  };
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * Latency SLO configuration for Aspects.
3
3
  *
4
- * Runtime enforcement is not implemented yet; this is declarative metadata.
4
+ * The engine enforces the scope-wide `maxMs` wall-clock SLO at task-dispatch
5
+ * time, measured from the run's start.
5
6
  */
6
7
  export type LatencySloConfig = {
7
- /** Maximum total latency in milliseconds across all tasks. */
8
+ /** Maximum total wall-clock latency in milliseconds across all tasks. */
8
9
  maxMs: number;
9
- /** Optional per-task latency limit in milliseconds. */
10
+ /** Optional per-task latency limit in milliseconds. Not enforced yet. */
10
11
  perTask?: number;
11
- /** Requested future behavior when the SLO is exceeded. Default: "fail". */
12
+ /** Behavior when the SLO is exceeded. Default: "fail". */
12
13
  onExceeded?: "fail" | "warn";
13
14
  };
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * Token budget configuration for Aspects.
3
3
  *
4
- * Runtime enforcement is not implemented yet; this is declarative metadata.
4
+ * The engine accumulates per-run token usage and enforces `max` at
5
+ * task-dispatch time.
5
6
  */
6
7
  export type TokenBudgetConfig = {
7
8
  /** Maximum total tokens across all tasks within the Aspects scope. */
8
9
  max: number;
9
- /** Optional per-task token limit. */
10
+ /** Optional per-task token limit. Not enforced yet. */
10
11
  perTask?: number;
11
- /** Requested future behavior when the budget is exceeded. Default: "fail". */
12
+ /** Behavior when the budget is exceeded. Default: "fail". */
12
13
  onExceeded?: "fail" | "warn" | "skip-remaining";
13
14
  };
@@ -6,6 +6,4 @@ export type TrackingConfig = {
6
6
  tokens?: boolean;
7
7
  /** Track latency. Default: true. */
8
8
  latency?: boolean;
9
- /** Track cost. Default: true. */
10
- cost?: boolean;
11
9
  };
@@ -1,7 +1,6 @@
1
1
  // @smithers-type-exports-begin
2
2
  /** @typedef {import("./AspectAccumulator.ts").AspectAccumulator} AspectAccumulator */
3
3
  /** @typedef {import("./AspectContextValue.ts").AspectContextValue} AspectContextValue */
4
- /** @typedef {import("./CostBudgetConfig.ts").CostBudgetConfig} CostBudgetConfig */
5
4
  /** @typedef {import("./LatencySloConfig.ts").LatencySloConfig} LatencySloConfig */
6
5
  /** @typedef {import("./TokenBudgetConfig.ts").TokenBudgetConfig} TokenBudgetConfig */
7
6
  /** @typedef {import("./TrackingConfig.ts").TrackingConfig} TrackingConfig */
@@ -9,8 +9,8 @@ import { AspectContext, createAccumulator, } from "../aspects/AspectContext.js";
9
9
  *
10
10
  * Wraps a section of the workflow tree and propagates token budgets,
11
11
  * latency SLOs, and cost budgets to all descendant Task components
12
- * without modifying individual tasks. Runtime budget enforcement is not
13
- * implemented yet.
12
+ * without modifying individual tasks. The engine enforces the scope-wide
13
+ * budgets at task-dispatch time.
14
14
  *
15
15
  * ```tsx
16
16
  * <Aspects tokenBudget={{ max: 100_000, perTask: 20_000, onExceeded: "warn" }}>
@@ -21,18 +21,16 @@ import { AspectContext, createAccumulator, } from "../aspects/AspectContext.js";
21
21
  * @param {AspectsProps} props
22
22
  */
23
23
  export function Aspects(props) {
24
- const { tokenBudget, latencySlo, costBudget, tracking, children } = props;
24
+ const { tokenBudget, latencySlo, tracking, children } = props;
25
25
  // Merge with parent context if nested
26
26
  const parentCtx = React.useContext(AspectContext);
27
27
  const resolvedTracking = {
28
28
  tokens: tracking?.tokens ?? parentCtx?.tracking?.tokens ?? true,
29
29
  latency: tracking?.latency ?? parentCtx?.tracking?.latency ?? true,
30
- cost: tracking?.cost ?? parentCtx?.tracking?.cost ?? true,
31
30
  };
32
31
  const value = {
33
32
  tokenBudget: tokenBudget ?? parentCtx?.tokenBudget,
34
33
  latencySlo: latencySlo ?? parentCtx?.latencySlo,
35
- costBudget: costBudget ?? parentCtx?.costBudget,
36
34
  tracking: resolvedTracking,
37
35
  accumulator: parentCtx?.accumulator ?? createAccumulator(),
38
36
  };
@@ -1,16 +1,13 @@
1
1
  import type React from "react";
2
2
  import type { TokenBudgetConfig } from "../aspects/TokenBudgetConfig.ts";
3
3
  import type { LatencySloConfig } from "../aspects/LatencySloConfig.ts";
4
- import type { CostBudgetConfig } from "../aspects/CostBudgetConfig.ts";
5
4
  import type { TrackingConfig } from "../aspects/TrackingConfig.ts";
6
5
 
7
6
  export type AspectsProps = {
8
- /** Token budget metadata. Runtime enforcement is not implemented yet. */
7
+ /** Token budget max total tokens, optional per-task limit, and exceeded behavior. */
9
8
  tokenBudget?: TokenBudgetConfig;
10
- /** Latency SLO metadata. Runtime enforcement is not implemented yet. */
9
+ /** Latency SLO max total wall-clock latency and exceeded behavior. */
11
10
  latencySlo?: LatencySloConfig;
12
- /** Cost budget metadata. Runtime enforcement is not implemented yet. */
13
- costBudget?: CostBudgetConfig;
14
11
  /** Which metrics to track. Defaults to all enabled. */
15
12
  tracking?: TrackingConfig;
16
13
  /** Workflow content these aspects apply to. */
@@ -223,8 +223,8 @@ export function Task(props) {
223
223
  ctx?.recordDeferredDep?.(props.id, depNodeIds ?? []);
224
224
  return null;
225
225
  }
226
- // Build aspect metadata to attach to the task element. Budget metadata is
227
- // declarative only until runtime enforcement is implemented.
226
+ // Build aspect metadata to attach to the task element so the engine can
227
+ // enforce budgets and track metrics at execution time.
228
228
  const aspectMeta = aspectCtx ? buildAspectMeta(aspectCtx) : undefined;
229
229
  const agentChain = Array.isArray(agent)
230
230
  ? fallbackAgent
@@ -287,12 +287,11 @@ export function Task(props) {
287
287
  }
288
288
  /**
289
289
  * Build the __aspects metadata object from the current AspectContext.
290
- * This is attached to the smithers:task element props. Budget metadata is not
291
- * enforced by the runtime yet.
290
+ * This is attached to the smithers:task element props so the engine can read
291
+ * budgets and tracking config at execution time.
292
292
  * @param {{
293
293
  * tokenBudget?: unknown;
294
294
  * latencySlo?: unknown;
295
- * costBudget?: unknown;
296
295
  * tracking?: unknown;
297
296
  * accumulator?: unknown;
298
297
  * }} aspectCtx
@@ -303,7 +302,6 @@ function buildAspectMeta(aspectCtx) {
303
302
  __aspects: {
304
303
  tokenBudget: aspectCtx.tokenBudget,
305
304
  latencySlo: aspectCtx.latencySlo,
306
- costBudget: aspectCtx.costBudget,
307
305
  tracking: aspectCtx.tracking,
308
306
  accumulator: aspectCtx.accumulator,
309
307
  },
package/src/index.d.ts CHANGED
@@ -800,43 +800,33 @@ type BranchProps$2 = {
800
800
  /**
801
801
  * Token budget configuration for Aspects.
802
802
  *
803
- * Runtime enforcement is not implemented yet; this is declarative metadata.
803
+ * The engine accumulates per-run token usage and enforces `max` at
804
+ * task-dispatch time.
804
805
  */
805
806
  type TokenBudgetConfig = {
806
807
  /** Maximum total tokens across all tasks within the Aspects scope. */
807
808
  max: number;
808
- /** Optional per-task token limit. */
809
+ /** Optional per-task token limit. Not enforced yet. */
809
810
  perTask?: number;
810
- /** Requested future behavior when the budget is exceeded. Default: "fail". */
811
+ /** Behavior when the budget is exceeded. Default: "fail". */
811
812
  onExceeded?: "fail" | "warn" | "skip-remaining";
812
813
  };
813
814
 
814
815
  /**
815
816
  * Latency SLO configuration for Aspects.
816
817
  *
817
- * Runtime enforcement is not implemented yet; this is declarative metadata.
818
+ * The engine enforces the scope-wide `maxMs` wall-clock SLO at task-dispatch
819
+ * time, measured from the run's start.
818
820
  */
819
821
  type LatencySloConfig = {
820
- /** Maximum total latency in milliseconds across all tasks. */
822
+ /** Maximum total wall-clock latency in milliseconds across all tasks. */
821
823
  maxMs: number;
822
- /** Optional per-task latency limit in milliseconds. */
824
+ /** Optional per-task latency limit in milliseconds. Not enforced yet. */
823
825
  perTask?: number;
824
- /** Requested future behavior when the SLO is exceeded. Default: "fail". */
826
+ /** Behavior when the SLO is exceeded. Default: "fail". */
825
827
  onExceeded?: "fail" | "warn";
826
828
  };
827
829
 
828
- /**
829
- * Cost budget configuration for Aspects.
830
- *
831
- * Runtime enforcement is not implemented yet; this is declarative metadata.
832
- */
833
- type CostBudgetConfig = {
834
- /** Maximum total cost in USD across all tasks within the Aspects scope. */
835
- maxUsd: number;
836
- /** Requested future behavior when the budget is exceeded. Default: "fail". */
837
- onExceeded?: "fail" | "warn" | "skip-remaining";
838
- };
839
-
840
830
  /**
841
831
  * Tracking configuration — which metrics to track.
842
832
  */
@@ -845,17 +835,13 @@ type TrackingConfig = {
845
835
  tokens?: boolean;
846
836
  /** Track latency. Default: true. */
847
837
  latency?: boolean;
848
- /** Track cost. Default: true. */
849
- cost?: boolean;
850
838
  };
851
839
 
852
840
  type AspectsProps$2 = {
853
- /** Token budget metadata. Runtime enforcement is not implemented yet. */
841
+ /** Token budget max total tokens, optional per-task limit, and exceeded behavior. */
854
842
  tokenBudget?: TokenBudgetConfig;
855
- /** Latency SLO metadata. Runtime enforcement is not implemented yet. */
843
+ /** Latency SLO max total wall-clock latency and exceeded behavior. */
856
844
  latencySlo?: LatencySloConfig;
857
- /** Cost budget metadata. Runtime enforcement is not implemented yet. */
858
- costBudget?: CostBudgetConfig;
859
845
  /** Which metrics to track. Defaults to all enabled. */
860
846
  tracking?: TrackingConfig;
861
847
  /** Workflow content these aspects apply to. */
@@ -1400,7 +1386,6 @@ type TryCatchFinallyProps$1 = TryCatchFinallyProps$2;
1400
1386
  type AspectAccumulator = {
1401
1387
  totalTokens: number;
1402
1388
  totalLatencyMs: number;
1403
- totalCostUsd: number;
1404
1389
  taskCount: number;
1405
1390
  };
1406
1391
 
@@ -1410,7 +1395,6 @@ type AspectAccumulator = {
1410
1395
  type AspectContextValue = {
1411
1396
  tokenBudget?: TokenBudgetConfig;
1412
1397
  latencySlo?: LatencySloConfig;
1413
- costBudget?: CostBudgetConfig;
1414
1398
  tracking: TrackingConfig;
1415
1399
  accumulator: AspectAccumulator;
1416
1400
  };
@@ -1,11 +0,0 @@
1
- /**
2
- * Cost budget configuration for Aspects.
3
- *
4
- * Runtime enforcement is not implemented yet; this is declarative metadata.
5
- */
6
- export type CostBudgetConfig = {
7
- /** Maximum total cost in USD across all tasks within the Aspects scope. */
8
- maxUsd: number;
9
- /** Requested future behavior when the budget is exceeded. Default: "fail". */
10
- onExceeded?: "fail" | "warn" | "skip-remaining";
11
- };