@smithers-orchestrator/components 0.23.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 +10 -10
- package/src/aspects/AspectAccumulator.ts +0 -1
- package/src/aspects/AspectContext.js +2 -3
- package/src/aspects/AspectContextValue.ts +0 -2
- package/src/aspects/LatencySloConfig.ts +5 -2
- package/src/aspects/TokenBudgetConfig.ts +4 -1
- package/src/aspects/TrackingConfig.ts +0 -2
- package/src/aspects/index.js +0 -1
- package/src/components/Aspects.js +3 -4
- package/src/components/AspectsProps.ts +1 -4
- package/src/components/DriftDetector.js +27 -3
- package/src/components/DriftDetectorProps.ts +3 -2
- package/src/components/Sandbox.js +2 -0
- package/src/components/SandboxEgressConfig.ts +9 -0
- package/src/components/SandboxProps.ts +2 -0
- package/src/components/Task.js +9 -6
- package/src/components/index.js +1 -0
- package/src/index.d.ts +28 -24
- package/src/aspects/CostBudgetConfig.ts +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithers-orchestrator/components",
|
|
3
|
-
"version": "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.
|
|
28
|
-
"@smithers-orchestrator/
|
|
29
|
-
"@smithers-orchestrator/graph": "0.
|
|
30
|
-
"@smithers-orchestrator/
|
|
31
|
-
"@smithers-orchestrator/driver": "0.
|
|
32
|
-
"@smithers-orchestrator/observability": "0.
|
|
33
|
-
"@smithers-orchestrator/react-reconciler": "0.
|
|
34
|
-
"@smithers-orchestrator/scheduler": "0.
|
|
35
|
-
"@smithers-orchestrator/
|
|
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",
|
|
@@ -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
|
-
* Tasks read from this context to
|
|
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,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Latency SLO configuration for Aspects.
|
|
3
|
+
*
|
|
4
|
+
* The engine enforces the scope-wide `maxMs` wall-clock SLO at task-dispatch
|
|
5
|
+
* time, measured from the run's start.
|
|
3
6
|
*/
|
|
4
7
|
export type LatencySloConfig = {
|
|
5
|
-
/** Maximum total latency in milliseconds across all tasks. */
|
|
8
|
+
/** Maximum total wall-clock latency in milliseconds across all tasks. */
|
|
6
9
|
maxMs: number;
|
|
7
|
-
/** Optional per-task latency limit in milliseconds. */
|
|
10
|
+
/** Optional per-task latency limit in milliseconds. Not enforced yet. */
|
|
8
11
|
perTask?: number;
|
|
9
12
|
/** Behavior when the SLO is exceeded. Default: "fail". */
|
|
10
13
|
onExceeded?: "fail" | "warn";
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Token budget configuration for Aspects.
|
|
3
|
+
*
|
|
4
|
+
* The engine accumulates per-run token usage and enforces `max` at
|
|
5
|
+
* task-dispatch time.
|
|
3
6
|
*/
|
|
4
7
|
export type TokenBudgetConfig = {
|
|
5
8
|
/** Maximum total tokens across all tasks within the Aspects scope. */
|
|
6
9
|
max: number;
|
|
7
|
-
/** Optional per-task token limit. */
|
|
10
|
+
/** Optional per-task token limit. Not enforced yet. */
|
|
8
11
|
perTask?: number;
|
|
9
12
|
/** Behavior when the budget is exceeded. Default: "fail". */
|
|
10
13
|
onExceeded?: "fail" | "warn" | "skip-remaining";
|
package/src/aspects/index.js
CHANGED
|
@@ -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,7 +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.
|
|
12
|
+
* without modifying individual tasks. The engine enforces the scope-wide
|
|
13
|
+
* budgets at task-dispatch time.
|
|
13
14
|
*
|
|
14
15
|
* ```tsx
|
|
15
16
|
* <Aspects tokenBudget={{ max: 100_000, perTask: 20_000, onExceeded: "warn" }}>
|
|
@@ -20,18 +21,16 @@ import { AspectContext, createAccumulator, } from "../aspects/AspectContext.js";
|
|
|
20
21
|
* @param {AspectsProps} props
|
|
21
22
|
*/
|
|
22
23
|
export function Aspects(props) {
|
|
23
|
-
const { tokenBudget, latencySlo,
|
|
24
|
+
const { tokenBudget, latencySlo, tracking, children } = props;
|
|
24
25
|
// Merge with parent context if nested
|
|
25
26
|
const parentCtx = React.useContext(AspectContext);
|
|
26
27
|
const resolvedTracking = {
|
|
27
28
|
tokens: tracking?.tokens ?? parentCtx?.tracking?.tokens ?? true,
|
|
28
29
|
latency: tracking?.latency ?? parentCtx?.tracking?.latency ?? true,
|
|
29
|
-
cost: tracking?.cost ?? parentCtx?.tracking?.cost ?? true,
|
|
30
30
|
};
|
|
31
31
|
const value = {
|
|
32
32
|
tokenBudget: tokenBudget ?? parentCtx?.tokenBudget,
|
|
33
33
|
latencySlo: latencySlo ?? parentCtx?.latencySlo,
|
|
34
|
-
costBudget: costBudget ?? parentCtx?.costBudget,
|
|
35
34
|
tracking: resolvedTracking,
|
|
36
35
|
accumulator: parentCtx?.accumulator ?? createAccumulator(),
|
|
37
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
7
|
/** Token budget — max total tokens, optional per-task limit, and exceeded behavior. */
|
|
9
8
|
tokenBudget?: TokenBudgetConfig;
|
|
10
|
-
/** Latency SLO — max total
|
|
9
|
+
/** Latency SLO — max total wall-clock latency and exceeded behavior. */
|
|
11
10
|
latencySlo?: LatencySloConfig;
|
|
12
|
-
/** Cost budget — max total USD, and exceeded behavior. */
|
|
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. */
|
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SmithersContext } from "@smithers-orchestrator/react-reconciler/context";
|
|
2
3
|
import { Task } from "./Task.js";
|
|
3
4
|
import { Sequence } from "./Sequence.js";
|
|
4
5
|
import { Branch } from "./Branch.js";
|
|
5
6
|
import { Loop } from "./Ralph.js";
|
|
6
7
|
/** @typedef {import("./DriftDetectorProps.ts").DriftDetectorProps} DriftDetectorProps */
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @param {unknown} value
|
|
11
|
+
* @returns {value is Record<string, unknown>}
|
|
12
|
+
*/
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {unknown} comparison
|
|
19
|
+
* @param {((comparison: unknown) => boolean) | undefined} alertIf
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
function shouldAlert(comparison, alertIf) {
|
|
23
|
+
if (comparison == null) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (alertIf) {
|
|
27
|
+
return Boolean(alertIf(comparison));
|
|
28
|
+
}
|
|
29
|
+
return isRecord(comparison) && comparison.drifted === true;
|
|
30
|
+
}
|
|
31
|
+
|
|
8
32
|
/**
|
|
9
33
|
* @param {DriftDetectorProps} props
|
|
10
34
|
*/
|
|
@@ -12,9 +36,9 @@ export function DriftDetector(props) {
|
|
|
12
36
|
if (props.skipIf)
|
|
13
37
|
return null;
|
|
14
38
|
const prefix = props.id ?? "drift";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const drifted =
|
|
39
|
+
const ctx = React.useContext(SmithersContext);
|
|
40
|
+
const comparison = ctx?.outputMaybe(props.compareOutput, { nodeId: `${prefix}-compare` });
|
|
41
|
+
const drifted = shouldAlert(comparison, props.alertIf);
|
|
18
42
|
const captureTask = React.createElement(Task, {
|
|
19
43
|
id: `${prefix}-capture`,
|
|
20
44
|
output: props.captureOutput,
|
|
@@ -15,13 +15,14 @@ export type DriftDetectorProps = {
|
|
|
15
15
|
compareOutput: OutputTarget;
|
|
16
16
|
/** Static baseline data, or a function/agent that fetches it. */
|
|
17
17
|
baseline: unknown;
|
|
18
|
-
/** Condition function that determines whether to fire the alert. If omitted, uses
|
|
18
|
+
/** Condition function that determines whether to fire the alert. If omitted, uses `comparison.drifted === true`. */
|
|
19
19
|
alertIf?: (comparison: unknown) => boolean;
|
|
20
20
|
/** Element to render when drift is detected (e.g. a Task that sends a notification). */
|
|
21
21
|
alert?: React.ReactElement;
|
|
22
22
|
/** If set, wraps the detector in a Loop for periodic polling. */
|
|
23
23
|
poll?: {
|
|
24
|
-
|
|
24
|
+
/** Reserved for future delayed polling; maxPolls currently controls Loop iterations. */
|
|
25
|
+
intervalMs?: number;
|
|
25
26
|
maxPolls?: number;
|
|
26
27
|
};
|
|
27
28
|
/** Skip the entire component. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @smithers-type-exports-begin
|
|
2
2
|
/** @typedef {import("./SandboxRuntime.ts").SandboxRuntime} SandboxRuntime */
|
|
3
|
+
/** @typedef {import("./SandboxEgressConfig.ts").SandboxEgressConfig} SandboxEgressConfig */
|
|
3
4
|
/** @typedef {import("./SandboxVolumeMount.ts").SandboxVolumeMount} SandboxVolumeMount */
|
|
4
5
|
/** @typedef {import("./SandboxWorkspaceSpec.ts").SandboxWorkspaceSpec} SandboxWorkspaceSpec */
|
|
5
6
|
// @smithers-type-exports-end
|
|
@@ -25,6 +26,7 @@ export function Sandbox(props) {
|
|
|
25
26
|
allowNested: props.allowNested,
|
|
26
27
|
image: props.image,
|
|
27
28
|
env: props.env,
|
|
29
|
+
egress: props.egress,
|
|
28
30
|
ports: props.ports,
|
|
29
31
|
volumes: props.volumes,
|
|
30
32
|
memoryLimit: props.memoryLimit,
|
|
@@ -6,6 +6,7 @@ import type { OutputTarget } from "./OutputTarget.ts";
|
|
|
6
6
|
import type { SandboxRuntime } from "./SandboxRuntime.ts";
|
|
7
7
|
import type { SandboxVolumeMount } from "./SandboxVolumeMount.ts";
|
|
8
8
|
import type { SandboxWorkspaceSpec } from "./SandboxWorkspaceSpec.ts";
|
|
9
|
+
import type { SandboxEgressConfig } from "./SandboxEgressConfig.ts";
|
|
9
10
|
|
|
10
11
|
export type SandboxProps = {
|
|
11
12
|
id: string;
|
|
@@ -25,6 +26,7 @@ export type SandboxProps = {
|
|
|
25
26
|
allowNested?: boolean;
|
|
26
27
|
image?: string;
|
|
27
28
|
env?: Record<string, string>;
|
|
29
|
+
egress?: SandboxEgressConfig;
|
|
28
30
|
ports?: Array<{
|
|
29
31
|
host: number;
|
|
30
32
|
container: number;
|
package/src/components/Task.js
CHANGED
|
@@ -215,11 +215,16 @@ export function Task(props) {
|
|
|
215
215
|
const resolvedDeps = deps ? resolveDeps(ctx, deps, rest.needs) : undefined;
|
|
216
216
|
if (deps && resolvedDeps == null) {
|
|
217
217
|
// Deps not yet available — component defers until upstream tasks complete.
|
|
218
|
-
// This is normal reactive behavior; the task will re-render once deps are
|
|
218
|
+
// This is normal reactive behavior; the task will re-render once deps are
|
|
219
|
+
// ready. Record the deferral so the engine can distinguish a transient wait
|
|
220
|
+
// from a permanent one: a deferral that survives to quiescence means a
|
|
221
|
+
// dependency that can never resolve (e.g. a deps key that maps to a node id
|
|
222
|
+
// no task produces), which would otherwise be a silent skip.
|
|
223
|
+
ctx?.recordDeferredDep?.(props.id, depNodeIds ?? []);
|
|
219
224
|
return null;
|
|
220
225
|
}
|
|
221
226
|
// Build aspect metadata to attach to the task element so the engine can
|
|
222
|
-
// enforce budgets and
|
|
227
|
+
// enforce budgets and track metrics at execution time.
|
|
223
228
|
const aspectMeta = aspectCtx ? buildAspectMeta(aspectCtx) : undefined;
|
|
224
229
|
const agentChain = Array.isArray(agent)
|
|
225
230
|
? fallbackAgent
|
|
@@ -282,12 +287,11 @@ export function Task(props) {
|
|
|
282
287
|
}
|
|
283
288
|
/**
|
|
284
289
|
* Build the __aspects metadata object from the current AspectContext.
|
|
285
|
-
* This is attached to the smithers:task element props so the engine
|
|
286
|
-
*
|
|
290
|
+
* This is attached to the smithers:task element props so the engine can read
|
|
291
|
+
* budgets and tracking config at execution time.
|
|
287
292
|
* @param {{
|
|
288
293
|
* tokenBudget?: unknown;
|
|
289
294
|
* latencySlo?: unknown;
|
|
290
|
-
* costBudget?: unknown;
|
|
291
295
|
* tracking?: unknown;
|
|
292
296
|
* accumulator?: unknown;
|
|
293
297
|
* }} aspectCtx
|
|
@@ -298,7 +302,6 @@ function buildAspectMeta(aspectCtx) {
|
|
|
298
302
|
__aspects: {
|
|
299
303
|
tokenBudget: aspectCtx.tokenBudget,
|
|
300
304
|
latencySlo: aspectCtx.latencySlo,
|
|
301
|
-
costBudget: aspectCtx.costBudget,
|
|
302
305
|
tracking: aspectCtx.tracking,
|
|
303
306
|
accumulator: aspectCtx.accumulator,
|
|
304
307
|
},
|
package/src/components/index.js
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
/** @typedef {import("./SagaProps.ts").SagaProps} SagaProps */
|
|
52
52
|
/** @typedef {import("./SagaStepDef.ts").SagaStepDef} SagaStepDef */
|
|
53
53
|
/** @typedef {import("./SagaStepProps.ts").SagaStepProps} SagaStepProps */
|
|
54
|
+
/** @typedef {import("./SandboxEgressConfig.ts").SandboxEgressConfig} SandboxEgressConfig */
|
|
54
55
|
/** @typedef {import("./SandboxProps.ts").SandboxProps} SandboxProps */
|
|
55
56
|
/** @typedef {import("./SandboxRuntime.ts").SandboxRuntime} SandboxRuntime */
|
|
56
57
|
/** @typedef {import("./SandboxVolumeMount.ts").SandboxVolumeMount} SandboxVolumeMount */
|
package/src/index.d.ts
CHANGED
|
@@ -317,6 +317,16 @@ type SandboxVolumeMount$1 = {
|
|
|
317
317
|
|
|
318
318
|
type SandboxRuntime$1 = "bubblewrap" | "docker" | "codeplane";
|
|
319
319
|
|
|
320
|
+
type SandboxEgressConfig$1 = {
|
|
321
|
+
env?: Record<string, string>;
|
|
322
|
+
httpProxy?: string;
|
|
323
|
+
httpsProxy?: string;
|
|
324
|
+
noProxy?: string | string[];
|
|
325
|
+
caCertPem?: string;
|
|
326
|
+
caCertPath?: string;
|
|
327
|
+
secretBindings?: Record<string, string>;
|
|
328
|
+
};
|
|
329
|
+
|
|
320
330
|
type SandboxProps$2 = {
|
|
321
331
|
id: string;
|
|
322
332
|
/** Child workflow definition. If omitted, createSmithers-bound Sandbox wrappers may provide one. */
|
|
@@ -335,6 +345,7 @@ type SandboxProps$2 = {
|
|
|
335
345
|
allowNested?: boolean;
|
|
336
346
|
image?: string;
|
|
337
347
|
env?: Record<string, string>;
|
|
348
|
+
egress?: SandboxEgressConfig$1;
|
|
338
349
|
ports?: Array<{
|
|
339
350
|
host: number;
|
|
340
351
|
container: number;
|
|
@@ -653,13 +664,14 @@ type DriftDetectorProps$2 = {
|
|
|
653
664
|
compareOutput: OutputTarget$1;
|
|
654
665
|
/** Static baseline data, or a function/agent that fetches it. */
|
|
655
666
|
baseline: unknown;
|
|
656
|
-
/** Condition function that determines whether to fire the alert. If omitted, uses
|
|
667
|
+
/** Condition function that determines whether to fire the alert. If omitted, uses `comparison.drifted === true`. */
|
|
657
668
|
alertIf?: (comparison: unknown) => boolean;
|
|
658
669
|
/** Element to render when drift is detected (e.g. a Task that sends a notification). */
|
|
659
670
|
alert?: React.ReactElement;
|
|
660
671
|
/** If set, wraps the detector in a Loop for periodic polling. */
|
|
661
672
|
poll?: {
|
|
662
|
-
|
|
673
|
+
/** Reserved for future delayed polling; maxPolls currently controls Loop iterations. */
|
|
674
|
+
intervalMs?: number;
|
|
663
675
|
maxPolls?: number;
|
|
664
676
|
};
|
|
665
677
|
/** Skip the entire component. */
|
|
@@ -787,11 +799,14 @@ type BranchProps$2 = {
|
|
|
787
799
|
|
|
788
800
|
/**
|
|
789
801
|
* Token budget configuration for Aspects.
|
|
802
|
+
*
|
|
803
|
+
* The engine accumulates per-run token usage and enforces `max` at
|
|
804
|
+
* task-dispatch time.
|
|
790
805
|
*/
|
|
791
806
|
type TokenBudgetConfig = {
|
|
792
807
|
/** Maximum total tokens across all tasks within the Aspects scope. */
|
|
793
808
|
max: number;
|
|
794
|
-
/** Optional per-task token limit. */
|
|
809
|
+
/** Optional per-task token limit. Not enforced yet. */
|
|
795
810
|
perTask?: number;
|
|
796
811
|
/** Behavior when the budget is exceeded. Default: "fail". */
|
|
797
812
|
onExceeded?: "fail" | "warn" | "skip-remaining";
|
|
@@ -799,26 +814,19 @@ type TokenBudgetConfig = {
|
|
|
799
814
|
|
|
800
815
|
/**
|
|
801
816
|
* Latency SLO configuration for Aspects.
|
|
817
|
+
*
|
|
818
|
+
* The engine enforces the scope-wide `maxMs` wall-clock SLO at task-dispatch
|
|
819
|
+
* time, measured from the run's start.
|
|
802
820
|
*/
|
|
803
821
|
type LatencySloConfig = {
|
|
804
|
-
/** Maximum total latency in milliseconds across all tasks. */
|
|
822
|
+
/** Maximum total wall-clock latency in milliseconds across all tasks. */
|
|
805
823
|
maxMs: number;
|
|
806
|
-
/** Optional per-task latency limit in milliseconds. */
|
|
824
|
+
/** Optional per-task latency limit in milliseconds. Not enforced yet. */
|
|
807
825
|
perTask?: number;
|
|
808
826
|
/** Behavior when the SLO is exceeded. Default: "fail". */
|
|
809
827
|
onExceeded?: "fail" | "warn";
|
|
810
828
|
};
|
|
811
829
|
|
|
812
|
-
/**
|
|
813
|
-
* Cost budget configuration for Aspects.
|
|
814
|
-
*/
|
|
815
|
-
type CostBudgetConfig = {
|
|
816
|
-
/** Maximum total cost in USD across all tasks within the Aspects scope. */
|
|
817
|
-
maxUsd: number;
|
|
818
|
-
/** Behavior when the budget is exceeded. Default: "fail". */
|
|
819
|
-
onExceeded?: "fail" | "warn" | "skip-remaining";
|
|
820
|
-
};
|
|
821
|
-
|
|
822
830
|
/**
|
|
823
831
|
* Tracking configuration — which metrics to track.
|
|
824
832
|
*/
|
|
@@ -827,17 +835,13 @@ type TrackingConfig = {
|
|
|
827
835
|
tokens?: boolean;
|
|
828
836
|
/** Track latency. Default: true. */
|
|
829
837
|
latency?: boolean;
|
|
830
|
-
/** Track cost. Default: true. */
|
|
831
|
-
cost?: boolean;
|
|
832
838
|
};
|
|
833
839
|
|
|
834
840
|
type AspectsProps$2 = {
|
|
835
841
|
/** Token budget — max total tokens, optional per-task limit, and exceeded behavior. */
|
|
836
842
|
tokenBudget?: TokenBudgetConfig;
|
|
837
|
-
/** Latency SLO — max total
|
|
843
|
+
/** Latency SLO — max total wall-clock latency and exceeded behavior. */
|
|
838
844
|
latencySlo?: LatencySloConfig;
|
|
839
|
-
/** Cost budget — max total USD, and exceeded behavior. */
|
|
840
|
-
costBudget?: CostBudgetConfig;
|
|
841
845
|
/** Which metrics to track. Defaults to all enabled. */
|
|
842
846
|
tracking?: TrackingConfig;
|
|
843
847
|
/** Workflow content these aspects apply to. */
|
|
@@ -1382,7 +1386,6 @@ type TryCatchFinallyProps$1 = TryCatchFinallyProps$2;
|
|
|
1382
1386
|
type AspectAccumulator = {
|
|
1383
1387
|
totalTokens: number;
|
|
1384
1388
|
totalLatencyMs: number;
|
|
1385
|
-
totalCostUsd: number;
|
|
1386
1389
|
taskCount: number;
|
|
1387
1390
|
};
|
|
1388
1391
|
|
|
@@ -1392,7 +1395,6 @@ type AspectAccumulator = {
|
|
|
1392
1395
|
type AspectContextValue = {
|
|
1393
1396
|
tokenBudget?: TokenBudgetConfig;
|
|
1394
1397
|
latencySlo?: LatencySloConfig;
|
|
1395
|
-
costBudget?: CostBudgetConfig;
|
|
1396
1398
|
tracking: TrackingConfig;
|
|
1397
1399
|
accumulator: AspectAccumulator;
|
|
1398
1400
|
};
|
|
@@ -1402,7 +1404,8 @@ type AspectContextValue = {
|
|
|
1402
1404
|
*
|
|
1403
1405
|
* Wraps a section of the workflow tree and propagates token budgets,
|
|
1404
1406
|
* latency SLOs, and cost budgets to all descendant Task components
|
|
1405
|
-
* without modifying individual tasks.
|
|
1407
|
+
* without modifying individual tasks. Runtime budget enforcement is not
|
|
1408
|
+
* implemented yet.
|
|
1406
1409
|
*
|
|
1407
1410
|
* ```tsx
|
|
1408
1411
|
* <Aspects tokenBudget={{ max: 100_000, perTask: 20_000, onExceeded: "warn" }}>
|
|
@@ -1516,6 +1519,7 @@ type RunbookStep = RunbookStep$1;
|
|
|
1516
1519
|
type SagaProps = SagaProps$2;
|
|
1517
1520
|
type SagaStepDef = SagaStepDef$1;
|
|
1518
1521
|
type SagaStepProps = SagaStepProps$2;
|
|
1522
|
+
type SandboxEgressConfig = SandboxEgressConfig$1;
|
|
1519
1523
|
type SandboxProps = SandboxProps$2;
|
|
1520
1524
|
type SandboxRuntime = SandboxRuntime$1;
|
|
1521
1525
|
type SandboxVolumeMount = SandboxVolumeMount$1;
|
|
@@ -1599,4 +1603,4 @@ type XmlElement = _smithers_graph.XmlElement;
|
|
|
1599
1603
|
type XmlNode = _smithers_graph.XmlNode;
|
|
1600
1604
|
type XmlText = _smithers_graph.XmlText;
|
|
1601
1605
|
|
|
1602
|
-
export { Approval, type ApprovalAutoApprove, type ApprovalDecision, ApprovalGate, type ApprovalGateProps, type ApprovalMode, type ApprovalOption, type ApprovalProps, type ApprovalRanking, type ApprovalRequest, type ApprovalSelection, Aspects, type AspectsProps, Branch, type BranchProps, type CachePolicy, type CategoryConfig, type CheckConfig, CheckSuite, type CheckSuiteProps, ClassifyAndRoute, type ClassifyAndRouteProps, type ColumnDef, ContentPipeline, type ContentPipelineProps, type ContentPipelineStage, ContinueAsNew, type ContinueAsNewProps, Debate, type DebateProps, type DecisionRule, DecisionTable, type DecisionTableProps, type DepsSpec, DriftDetector, type DriftDetectorProps, type EngineDecision, EscalationChain, type EscalationChainProps, type EscalationLevel, type ExtractOptions, GatherAndSynthesize, type GatherAndSynthesizeProps, type HostElement, type HostNode, type HostText, HumanTask, type HumanTaskProps, type InferDeps, type InferOutputEntry, type InferRow, Kanban, type KanbanProps, Loop, type LoopProps, MergeQueue, type MergeQueueProps, Optimizer, type OptimizerProps, type OutputAccessor, type OutputKey, type OutputTarget, Panel, type PanelProps, type PanelistConfig, Parallel, type ParallelProps, Poller, type PollerProps, Ralph, type RalphProps, type RenderContext, type RetryPolicy, ReviewLoop, type ReviewLoopProps, type RunAuthContext, type RunOptions, type RunResult, Runbook, type RunbookProps, type RunbookStep, Saga, type SagaProps, type SagaStepDef, type SagaStepProps, Sandbox, type SandboxProps, type SandboxRuntime, type SandboxVolumeMount, type SandboxWorkspaceSpec, ScanFixVerify, type ScanFixVerifyProps, type SchemaRegistryEntry, type ScorersMap, Sequence, type SequenceProps, Signal, type SignalProps, type SmithersAlertLabels, type SmithersAlertPolicy, type SmithersAlertPolicyDefaults, type SmithersAlertPolicyRule, type SmithersAlertReaction, type SmithersAlertReactionKind, type SmithersAlertReactionRef, type SmithersAlertSeverity, type SmithersCtx, type SmithersErrorCode, type SmithersWorkflow, type SmithersWorkflowDriverOptions, type SmithersWorkflowOptions, type SourceDef, Subflow, type SubflowProps, SuperSmithers, type SuperSmithersProps, Supervisor, type SupervisorProps, Task, type TaskDescriptor, type TaskProps, Timer, type TimerProps, TryCatchFinally, type TryCatchFinallyProps, WaitForEvent, type WaitForEventProps, type WaitReason, Workflow, type WorkflowGraph, type WorkflowProps, type WorkflowRuntime, type WorkflowSession, Worktree, type WorktreeProps, type XmlElement, type XmlNode, type XmlText, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, continueAsNew, markdownComponents, renderMdx, zodSchemaToJsonExample };
|
|
1606
|
+
export { Approval, type ApprovalAutoApprove, type ApprovalDecision, ApprovalGate, type ApprovalGateProps, type ApprovalMode, type ApprovalOption, type ApprovalProps, type ApprovalRanking, type ApprovalRequest, type ApprovalSelection, Aspects, type AspectsProps, Branch, type BranchProps, type CachePolicy, type CategoryConfig, type CheckConfig, CheckSuite, type CheckSuiteProps, ClassifyAndRoute, type ClassifyAndRouteProps, type ColumnDef, ContentPipeline, type ContentPipelineProps, type ContentPipelineStage, ContinueAsNew, type ContinueAsNewProps, Debate, type DebateProps, type DecisionRule, DecisionTable, type DecisionTableProps, type DepsSpec, DriftDetector, type DriftDetectorProps, type EngineDecision, EscalationChain, type EscalationChainProps, type EscalationLevel, type ExtractOptions, GatherAndSynthesize, type GatherAndSynthesizeProps, type HostElement, type HostNode, type HostText, HumanTask, type HumanTaskProps, type InferDeps, type InferOutputEntry, type InferRow, Kanban, type KanbanProps, Loop, type LoopProps, MergeQueue, type MergeQueueProps, Optimizer, type OptimizerProps, type OutputAccessor, type OutputKey, type OutputTarget, Panel, type PanelProps, type PanelistConfig, Parallel, type ParallelProps, Poller, type PollerProps, Ralph, type RalphProps, type RenderContext, type RetryPolicy, ReviewLoop, type ReviewLoopProps, type RunAuthContext, type RunOptions, type RunResult, Runbook, type RunbookProps, type RunbookStep, Saga, type SagaProps, type SagaStepDef, type SagaStepProps, Sandbox, type SandboxEgressConfig, type SandboxProps, type SandboxRuntime, type SandboxVolumeMount, type SandboxWorkspaceSpec, ScanFixVerify, type ScanFixVerifyProps, type SchemaRegistryEntry, type ScorersMap, Sequence, type SequenceProps, Signal, type SignalProps, type SmithersAlertLabels, type SmithersAlertPolicy, type SmithersAlertPolicyDefaults, type SmithersAlertPolicyRule, type SmithersAlertReaction, type SmithersAlertReactionKind, type SmithersAlertReactionRef, type SmithersAlertSeverity, type SmithersCtx, type SmithersErrorCode, type SmithersWorkflow, type SmithersWorkflowDriverOptions, type SmithersWorkflowOptions, type SourceDef, Subflow, type SubflowProps, SuperSmithers, type SuperSmithersProps, Supervisor, type SupervisorProps, Task, type TaskDescriptor, type TaskProps, Timer, type TimerProps, TryCatchFinally, type TryCatchFinallyProps, WaitForEvent, type WaitForEventProps, type WaitReason, Workflow, type WorkflowGraph, type WorkflowProps, type WorkflowRuntime, type WorkflowSession, Worktree, type WorktreeProps, type XmlElement, type XmlNode, type XmlText, approvalDecisionSchema, approvalRankingSchema, approvalSelectionSchema, continueAsNew, markdownComponents, renderMdx, zodSchemaToJsonExample };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cost budget configuration for Aspects.
|
|
3
|
-
*/
|
|
4
|
-
export type CostBudgetConfig = {
|
|
5
|
-
/** Maximum total cost in USD across all tasks within the Aspects scope. */
|
|
6
|
-
maxUsd: number;
|
|
7
|
-
/** Behavior when the budget is exceeded. Default: "fail". */
|
|
8
|
-
onExceeded?: "fail" | "warn" | "skip-remaining";
|
|
9
|
-
};
|