@hexabot-ai/agentic 3.5.0-beta.0 → 3.6.0-beta.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/README.md +12 -3
- package/dist/cjs/action/abstract-action.js +51 -35
- package/dist/cjs/bindings/base-binding.js +229 -211
- package/dist/cjs/checkpoint.js +1 -1
- package/dist/cjs/context.js +2 -3
- package/dist/cjs/dsl.types.js +44 -90
- package/dist/cjs/errors.js +13 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/resume-payload.js +11 -1
- package/dist/cjs/runner-runtime-control.js +39 -27
- package/dist/cjs/step-executors/conditional-executor.js +2 -7
- package/dist/cjs/step-executors/loop-executor.js +14 -28
- package/dist/cjs/step-executors/parallel-executor.js +14 -25
- package/dist/cjs/step-executors/scope.js +25 -0
- package/dist/cjs/step-executors/skip-helpers.js +26 -34
- package/dist/cjs/step-executors/task-executor.js +58 -69
- package/dist/cjs/utils/flow-steps.js +41 -0
- package/dist/cjs/utils/naming.js +10 -10
- package/dist/cjs/utils/object-path.js +51 -0
- package/dist/cjs/utils/timeout.js +16 -39
- package/dist/cjs/validation-issue.js +14 -1
- package/dist/cjs/workflow-compiler.js +52 -96
- package/dist/cjs/workflow-fingerprint.js +22 -11
- package/dist/cjs/workflow-runner.js +19 -25
- package/dist/cjs/workflow-values.js +9 -7
- package/dist/cjs/workflow.js +44 -103
- package/dist/esm/action/abstract-action.js +51 -35
- package/dist/esm/bindings/base-binding.js +229 -211
- package/dist/esm/checkpoint.js +2 -2
- package/dist/esm/context.js +2 -3
- package/dist/esm/dsl.types.js +42 -88
- package/dist/esm/errors.js +11 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/resume-payload.js +10 -1
- package/dist/esm/runner-runtime-control.js +39 -27
- package/dist/esm/step-executors/conditional-executor.js +2 -7
- package/dist/esm/step-executors/loop-executor.js +14 -28
- package/dist/esm/step-executors/parallel-executor.js +14 -25
- package/dist/esm/step-executors/scope.js +21 -0
- package/dist/esm/step-executors/skip-helpers.js +27 -35
- package/dist/esm/step-executors/task-executor.js +58 -69
- package/dist/esm/utils/flow-steps.js +37 -0
- package/dist/esm/utils/naming.js +9 -9
- package/dist/esm/utils/object-path.js +46 -0
- package/dist/esm/utils/timeout.js +16 -39
- package/dist/esm/validation-issue.js +11 -0
- package/dist/esm/workflow-compiler.js +50 -95
- package/dist/esm/workflow-fingerprint.js +22 -11
- package/dist/esm/workflow-runner.js +21 -27
- package/dist/esm/workflow-values.js +7 -6
- package/dist/esm/workflow.js +43 -103
- package/dist/types/action/abstract-action.d.ts +7 -1
- package/dist/types/action/abstract-action.d.ts.map +1 -1
- package/dist/types/bindings/base-binding.d.ts +10 -0
- package/dist/types/bindings/base-binding.d.ts.map +1 -1
- package/dist/types/context.d.ts +2 -3
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/dsl.types.d.ts +7 -12
- package/dist/types/dsl.types.d.ts.map +1 -1
- package/dist/types/errors.d.ts +9 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resume-payload.d.ts +7 -0
- package/dist/types/resume-payload.d.ts.map +1 -1
- package/dist/types/runner-runtime-control.d.ts.map +1 -1
- package/dist/types/step-executors/conditional-executor.d.ts.map +1 -1
- package/dist/types/step-executors/loop-executor.d.ts +2 -4
- package/dist/types/step-executors/loop-executor.d.ts.map +1 -1
- package/dist/types/step-executors/parallel-executor.d.ts.map +1 -1
- package/dist/types/step-executors/scope.d.ts +12 -0
- package/dist/types/step-executors/scope.d.ts.map +1 -0
- package/dist/types/step-executors/skip-helpers.d.ts +2 -8
- package/dist/types/step-executors/skip-helpers.d.ts.map +1 -1
- package/dist/types/step-executors/task-executor.d.ts.map +1 -1
- package/dist/types/utils/flow-steps.d.ts +16 -0
- package/dist/types/utils/flow-steps.d.ts.map +1 -0
- package/dist/types/utils/naming.d.ts +7 -7
- package/dist/types/utils/naming.d.ts.map +1 -1
- package/dist/types/utils/object-path.d.ts +11 -0
- package/dist/types/utils/object-path.d.ts.map +1 -0
- package/dist/types/utils/timeout.d.ts.map +1 -1
- package/dist/types/validation-issue.d.ts +13 -0
- package/dist/types/validation-issue.d.ts.map +1 -1
- package/dist/types/workflow-compiler.d.ts +15 -1
- package/dist/types/workflow-compiler.d.ts.map +1 -1
- package/dist/types/workflow-fingerprint.d.ts.map +1 -1
- package/dist/types/workflow-runner.d.ts +2 -0
- package/dist/types/workflow-runner.d.ts.map +1 -1
- package/dist/types/workflow-values.d.ts +2 -0
- package/dist/types/workflow-values.d.ts.map +1 -1
- package/dist/types/workflow.d.ts +2 -1
- package/dist/types/workflow.d.ts.map +1 -1
- package/examples/defs-bindings-agent/actions/ai-agent.ts +5 -3
- package/examples/defs-bindings-agent/actions/{caculate-score.ts → calculate-score.ts} +8 -8
- package/examples/defs-bindings-agent/actions/index.ts +2 -2
- package/examples/defs-bindings-agent/workflow.yml +2 -2
- package/examples/full/workflow.yml +20 -15
- package/examples/suspend-resume/workflow.yml +6 -3
- package/package.json +8 -5
- package/src/__tests__/checkpoint.test.ts +6 -1
- package/src/__tests__/resume-payload.test.ts +29 -0
- package/src/__tests__/test-helpers.ts +1 -1
- package/src/__tests__/validation.test.ts +330 -0
- package/src/__tests__/workflow-compiler.test.ts +278 -3
- package/src/__tests__/workflow-definition-path.test.ts +2 -0
- package/src/__tests__/workflow-fingerprint.test.ts +65 -0
- package/src/__tests__/workflow-runner.test.ts +280 -5
- package/src/__tests__/workflow-values.test.ts +13 -0
- package/src/__tests__/workflow.test.ts +4 -2
- package/src/action/__tests__/abstract-action-timing.test.ts +92 -0
- package/src/action/abstract-action.ts +67 -40
- package/src/bindings/base-binding.test.ts +470 -0
- package/src/bindings/base-binding.ts +344 -267
- package/src/checkpoint.ts +2 -4
- package/src/context.ts +2 -3
- package/src/dsl.types.ts +75 -154
- package/src/errors.ts +15 -0
- package/src/index.ts +2 -0
- package/src/resume-payload.ts +13 -3
- package/src/runner-runtime-control.ts +52 -29
- package/src/step-executors/conditional-executor.ts +3 -7
- package/src/step-executors/loop-executor.test.ts +55 -0
- package/src/step-executors/loop-executor.ts +16 -50
- package/src/step-executors/parallel-executor.ts +14 -37
- package/src/step-executors/scope.ts +30 -0
- package/src/step-executors/skip-helpers.test.ts +133 -0
- package/src/step-executors/skip-helpers.ts +43 -76
- package/src/step-executors/task-executor.test.ts +130 -1
- package/src/step-executors/task-executor.ts +109 -79
- package/src/utils/flow-steps.test.ts +121 -0
- package/src/utils/flow-steps.ts +62 -0
- package/src/utils/naming.test.ts +50 -0
- package/src/utils/naming.ts +11 -11
- package/src/utils/object-path.test.ts +70 -0
- package/src/utils/object-path.ts +67 -0
- package/src/utils/timeout.test.ts +152 -0
- package/src/utils/timeout.ts +26 -44
- package/src/validation-issue.test.ts +70 -0
- package/src/validation-issue.ts +27 -0
- package/src/workflow-compiler.ts +118 -180
- package/src/workflow-fingerprint.ts +23 -12
- package/src/workflow-runner.ts +28 -27
- package/src/workflow-values.ts +9 -7
- package/src/workflow.ts +58 -140
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LoopFrame } from '../checkpoint';
|
|
2
2
|
import type { EvaluationScope, ExecutionState, LoopStep } from '../workflow-types';
|
|
3
3
|
import type { StepExecutorEnv } from './types';
|
|
4
|
-
type LoopScope = EvaluationScope;
|
|
5
4
|
/**
|
|
6
5
|
* Execute a loop step by iterating over input items and executing child steps.
|
|
7
6
|
*
|
|
@@ -22,7 +21,7 @@ export declare function executeLoop(env: StepExecutorEnv, step: LoopStep, state:
|
|
|
22
21
|
* @param previous Previous accumulator value to merge with.
|
|
23
22
|
* @returns The updated accumulator value.
|
|
24
23
|
*/
|
|
25
|
-
export declare function updateAccumulator(step: LoopStep, scope:
|
|
24
|
+
export declare function updateAccumulator(step: LoopStep, scope: EvaluationScope, previous: unknown): Promise<unknown>;
|
|
26
25
|
/**
|
|
27
26
|
* Determine whether loop execution should stop based on the `until` condition.
|
|
28
27
|
*
|
|
@@ -30,6 +29,5 @@ export declare function updateAccumulator(step: LoopStep, scope: LoopScope, prev
|
|
|
30
29
|
* @param scope Current evaluation scope for expressions.
|
|
31
30
|
* @returns True if the loop should stop, otherwise false.
|
|
32
31
|
*/
|
|
33
|
-
export declare function shouldStopLoop(step: LoopStep, scope:
|
|
34
|
-
export {};
|
|
32
|
+
export declare function shouldStopLoop(step: LoopStep, scope: EvaluationScope): Promise<boolean>;
|
|
35
33
|
//# sourceMappingURL=loop-executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/loop-executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,QAAQ,EAET,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"loop-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/loop-executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,QAAQ,EAET,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC5B,KAAK,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAM3B;AAqJD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,OAAO,CAAC,CAQlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallel-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/parallel-executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA0B/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC5B,KAAK,CAAC,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"parallel-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/parallel-executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAEV,cAAc,EACd,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA0B/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC5B,KAAK,CAAC,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAuC/B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EvaluationScope, ExecutionState } from '../workflow-types';
|
|
2
|
+
import type { StepExecutorEnv } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Expose the live state of a step to its expressions.
|
|
5
|
+
*
|
|
6
|
+
* @param env Executor environment, for the context state.
|
|
7
|
+
* @param state Execution state of the step.
|
|
8
|
+
* @param overrides The iteration and accumulator a loop evaluates with.
|
|
9
|
+
* @returns The scope expressions are evaluated against.
|
|
10
|
+
*/
|
|
11
|
+
export declare const buildEvaluationScope: (env: Pick<StepExecutorEnv, "context">, state: ExecutionState, overrides?: Pick<EvaluationScope, "iteration" | "accumulator">) => EvaluationScope;
|
|
12
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/step-executors/scope.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,KAAK,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EACrC,OAAO,cAAc,EACrB,YAAW,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,aAAa,CAAM,KACjE,eAOD,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import type { ActionSnapshot } from '../context';
|
|
2
|
-
import { type StepInfo, type WorkflowEventMap } from '../workflow-event-emitter';
|
|
3
1
|
import type { CompiledStep } from '../workflow-types';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
buildInstanceStepInfo: (step: CompiledStep, iterationStack: number[]) => StepInfo;
|
|
7
|
-
markSnapshot: (step: StepInfo, status: ActionSnapshot['status'], reason?: string) => void;
|
|
8
|
-
emit: <K extends keyof WorkflowEventMap>(event: K, payload: WorkflowEventMap[K]) => void;
|
|
9
|
-
};
|
|
2
|
+
import type { StepExecutorEnv } from './types';
|
|
3
|
+
type SkipStepEnv = Pick<StepExecutorEnv, 'runId' | 'buildInstanceStepInfo' | 'markSnapshot' | 'emit'>;
|
|
10
4
|
export declare const markStepsSkipped: (env: SkipStepEnv, steps: CompiledStep[], iterationStack: number[], reason?: string) => void;
|
|
11
5
|
export declare const markStepsCancelled: (env: SkipStepEnv, steps: CompiledStep[], iterationStack: number[], reason?: string) => void;
|
|
12
6
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skip-helpers.d.ts","sourceRoot":"","sources":["../../../src/step-executors/skip-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skip-helpers.d.ts","sourceRoot":"","sources":["../../../src/step-executors/skip-helpers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,KAAK,WAAW,GAAG,IAAI,CACrB,eAAe,EACf,OAAO,GAAG,uBAAuB,GAAG,cAAc,GAAG,MAAM,CAC5D,CAAC;AAqCF,eAAO,MAAM,gBAAgB,GAC3B,KAAK,WAAW,EAChB,OAAO,YAAY,EAAE,EACrB,gBAAgB,MAAM,EAAE,EACxB,SAAS,MAAM,SAKhB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,KAAK,WAAW,EAChB,OAAO,YAAY,EAAE,EACrB,gBAAgB,MAAM,EAAE,EACxB,SAAS,MAAM,SAShB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/task-executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../../src/step-executors/task-executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAiBvB,OAAO,KAAK,EAAgB,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ/C;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,KAAK,CAAC,EAAE,SAAS,GAChB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CA2H3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FlowStep } from '../dsl.types';
|
|
2
|
+
type DefinitionPath = Array<string | number>;
|
|
3
|
+
/** A `do` step: the task it runs, and where the reference sits. */
|
|
4
|
+
export type TaskReference = {
|
|
5
|
+
taskId: string;
|
|
6
|
+
path: DefinitionPath;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* List every task reference of a flow, depth first, in flow order.
|
|
10
|
+
*
|
|
11
|
+
* @param steps The flow, or a nested step list.
|
|
12
|
+
* @param basePath Path of `steps` inside the workflow definition.
|
|
13
|
+
*/
|
|
14
|
+
export declare const collectTaskReferences: (steps: FlowStep[], basePath?: DefinitionPath) => TaskReference[];
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=flow-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-steps.d.ts","sourceRoot":"","sources":["../../../src/utils/flow-steps.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,KAAK,cAAc,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7C,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AA2BF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,QAAQ,EAAE,EACjB,WAAU,cAAyB,KAClC,aAAa,EAWZ,CAAC"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export declare const SNAKE_CASE_REGEX: RegExp;
|
|
2
2
|
export type WorkflowEntity = 'action' | 'workflow' | 'predicate';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether the provided string is snake_case compliant.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Text to evaluate.
|
|
7
|
+
* @returns `true` when the value is snake_case; otherwise `false`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isSnakeCaseName: (value: string) => boolean;
|
|
3
10
|
/**
|
|
4
11
|
* Verifies that names follow the snake_case convention required by the system.
|
|
5
12
|
*
|
|
@@ -8,13 +15,6 @@ export type WorkflowEntity = 'action' | 'workflow' | 'predicate';
|
|
|
8
15
|
* @throws Error when the name is not snake_case.
|
|
9
16
|
*/
|
|
10
17
|
export declare function assertSnakeCaseName(name: string, entity: WorkflowEntity): void;
|
|
11
|
-
/**
|
|
12
|
-
* Checks whether the provided string is snake_case compliant.
|
|
13
|
-
*
|
|
14
|
-
* @param value - Text to evaluate.
|
|
15
|
-
* @returns `true` when the value is snake_case; otherwise `false`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const isSnakeCaseName: (value: string) => boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Converts arbitrary text into snake_case for use in workflow entities.
|
|
20
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../../src/utils/naming.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAA+B,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAEjE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,GACrB,IAAI,CAMN;AAED;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../../src/utils/naming.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,QAA+B,CAAC;AAE7D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,OAClB,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,GACrB,IAAI,CAMN;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWjD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a nested value. Array segments must be numbers; a path that leaves
|
|
3
|
+
* the value resolves to `undefined`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getValueAtPath: (value: unknown, path: ReadonlyArray<string | number>) => unknown;
|
|
6
|
+
/**
|
|
7
|
+
* Copy a value with one nested value replaced; the input is left untouched.
|
|
8
|
+
* A path that does not fit the value returns it as is.
|
|
9
|
+
*/
|
|
10
|
+
export declare const setValueAtPath: <T>(value: T, path: ReadonlyArray<string | number>, nextValue: unknown) => T;
|
|
11
|
+
//# sourceMappingURL=object-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-path.d.ts","sourceRoot":"","sources":["../../../src/utils/object-path.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,MAAM,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,KACnC,OAaQ,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAC9B,OAAO,CAAC,EACR,MAAM,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACpC,WAAW,OAAO,KACjB,CA8BF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/utils/timeout.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,YAAY,MAAM,EAClB,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAmBd,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/utils/timeout.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,YAAY,MAAM,EAClB,SAAS,WAAW,KACnB,OAAO,CAAC,IAAI,CAmBd,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CA+CZ"}
|
|
@@ -13,4 +13,17 @@ export type WorkflowValidationIssue = {
|
|
|
13
13
|
bindingKind?: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const issueMessages: (issues: WorkflowValidationIssue[]) => string[];
|
|
16
|
+
/** The fields of a schema (zod) issue that validation issues are built from. */
|
|
17
|
+
type SchemaIssue = {
|
|
18
|
+
path: readonly PropertyKey[];
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
/** Keep the segments of a schema issue path that can locate a YAML node. */
|
|
22
|
+
export declare const toIssuePath: (path: readonly PropertyKey[]) => Array<string | number>;
|
|
23
|
+
/**
|
|
24
|
+
* Turn schema issues into validation issues located under `basePath`, the
|
|
25
|
+
* path of the value the schema checked.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toValidationIssues: (code: WorkflowValidationIssueCode, schemaIssues: readonly SchemaIssue[], basePath?: Array<string | number>) => WorkflowValidationIssue[];
|
|
28
|
+
export {};
|
|
16
29
|
//# sourceMappingURL=validation-issue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-issue.d.ts","sourceRoot":"","sources":["../../src/validation-issue.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,2BAA2B,GACnC,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,2BAA2B,GAC3B,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,aAAa,GACb,qBAAqB,GACrB,eAAe,CAAC;AAEpB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,2BAA2B,CAAC;IAClC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,uBAAuB,EAAE,KAAG,MAAM,EAClC,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation-issue.d.ts","sourceRoot":"","sources":["../../src/validation-issue.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,2BAA2B,GACnC,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,2BAA2B,GAC3B,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,aAAa,GACb,qBAAqB,GACrB,eAAe,CAAC;AAEpB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,2BAA2B,CAAC;IAClC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ,uBAAuB,EAAE,KAAG,MAAM,EAClC,CAAC;AAEvC,gFAAgF;AAChF,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,4EAA4E;AAC5E,eAAO,MAAM,WAAW,GACtB,MAAM,SAAS,WAAW,EAAE,KAC3B,KAAK,CAAC,MAAM,GAAG,MAAM,CAIrB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,2BAA2B,EACjC,cAAc,SAAS,WAAW,EAAE,EACpC,WAAU,KAAK,CAAC,MAAM,GAAG,MAAM,CAAM,KACpC,uBAAuB,EAKrB,CAAC"}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
1
2
|
import type { Action } from './action/action.types';
|
|
2
3
|
import type { BindingKindSchemas } from './bindings/base-binding';
|
|
3
|
-
import type { WorkflowDefinition } from './dsl.types';
|
|
4
|
+
import type { WorkflowDefinition, WorkflowInputSchema } from './dsl.types';
|
|
4
5
|
import type { CompiledWorkflow } from './workflow-types';
|
|
5
6
|
import { type CompileValueOptions } from './workflow-values';
|
|
6
7
|
export type WorkflowCompileOptions = CompileValueOptions & {
|
|
7
8
|
actions: Record<string, Action>;
|
|
8
9
|
bindingKinds?: BindingKindSchemas;
|
|
9
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Build the parser of a workflow's input payload from its `inputs.schema`.
|
|
13
|
+
*
|
|
14
|
+
* This is the one conversion from that JSON Schema to a parser: the runner
|
|
15
|
+
* uses it when a run starts, and a host that checks an input before creating
|
|
16
|
+
* a run should use it too, so both accept and refuse the same payloads. The
|
|
17
|
+
* parser applies the schema's `default` values.
|
|
18
|
+
*
|
|
19
|
+
* @param schema The JSON Schema under `inputs.schema`, when one is declared.
|
|
20
|
+
* @returns A parser of the input payload; it accepts any object without a schema.
|
|
21
|
+
* @throws When the schema is not a JSON Schema zod can read.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildWorkflowInputParser: (schema?: WorkflowInputSchema) => ZodType<Record<string, unknown>>;
|
|
10
24
|
/** Compile a workflow definition into structures consumable by the runtime. */
|
|
11
25
|
export declare const compileWorkflow: (definition: WorkflowDefinition, options: WorkflowCompileOptions) => CompiledWorkflow;
|
|
12
26
|
//# sourceMappingURL=workflow-compiler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-compiler.d.ts","sourceRoot":"","sources":["../../src/workflow-compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow-compiler.d.ts","sourceRoot":"","sources":["../../src/workflow-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAKlE,OAAO,KAAK,EAKV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAIV,gBAAgB,EAIjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC;AASF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,mBAAmB,KAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGX,CAAC;AAqKxB,+EAA+E;AAC/E,eAAO,MAAM,eAAe,GAC1B,YAAY,kBAAkB,EAC9B,SAAS,sBAAsB,KAC9B,gBAcF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-fingerprint.d.ts","sourceRoot":"","sources":["../../src/workflow-fingerprint.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAIV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"workflow-fingerprint.d.ts","sourceRoot":"","sources":["../../src/workflow-fingerprint.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAIV,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAO1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,gBAAgB,KAAG,MAehE,CAAC"}
|
|
@@ -59,6 +59,8 @@ export declare class WorkflowRunner {
|
|
|
59
59
|
*
|
|
60
60
|
* @param args Input payload and context to seed execution.
|
|
61
61
|
* @returns Execution result including status and snapshot.
|
|
62
|
+
* @throws {WorkflowInputRejectedError} When the input payload does not match
|
|
63
|
+
* the workflow's `inputs.schema`; nothing ran and the runner is unchanged.
|
|
62
64
|
*/
|
|
63
65
|
start(args: RunnerStartArgs): Promise<WorkflowRunResult>;
|
|
64
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-runner.d.ts","sourceRoot":"","sources":["../../src/workflow-runner.ts"],"names":[],"mappings":"AAMA,OAAO,EAaL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAmBnB,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EAEd,gBAAgB,EAChB,eAAe,EAEf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-runner.d.ts","sourceRoot":"","sources":["../../src/workflow-runner.ts"],"names":[],"mappings":"AAMA,OAAO,EAaL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAmBnB,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EAEd,gBAAgB,EAChB,eAAe,EAEf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAqC1B;;;GAGG;AACH,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAG5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAGhC,OAAO,CAAC,MAAM,CAA8C;IAG5D,OAAO,CAAC,SAAS,CAAsC;IAGvD,OAAO,CAAC,OAAO,CAA2C;IAG1D,OAAO,CAAC,UAAU,CAAC,CAAqB;IAGxC,OAAO,CAAC,cAAc,CAAC,CAAuB;IAG9C,OAAO,CAAC,KAAK,CAAC,CAAiB;IAG/B,OAAO,CAAC,OAAO,CAAC,CAAsB;IAEtC;;;;;OAKG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAA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;CAOhC"}
|
|
@@ -4,6 +4,8 @@ export type { JsonataFunctionConfig, JsonataFunctionImplementation, JsonataFunct
|
|
|
4
4
|
export type CompileValueOptions = {
|
|
5
5
|
jsonataFunctions?: JsonataFunctionRegistry;
|
|
6
6
|
};
|
|
7
|
+
/** Strings starting with `=` are JSONata expressions; anything else is a literal. */
|
|
8
|
+
export declare const isExpressionString: (value: unknown) => value is string;
|
|
7
9
|
/**
|
|
8
10
|
* Prepares a workflow value for evaluation.
|
|
9
11
|
* Strings prefixed with `=` are treated as JSONata expressions; everything else is a literal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-values.d.ts","sourceRoot":"","sources":["../../src/workflow-values.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-values.d.ts","sourceRoot":"","sources":["../../src/workflow-values.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,mBAAmB,GAAG;IAChC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;CAC5C,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACT,CAAC;AAsErD;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,OAAO,EACd,UAAU,mBAAmB,KAC5B,aAWF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,aAAa,EACvB,OAAO,eAAe,KACrB,OAAO,CAAC,OAAO,CAgBjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,eAAe,GAAG,SAAS,EACpC,OAAO,eAAe,KACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,OAAO,CAAC,QAAQ,CAAC,EACxB,WAAW,OAAO,CAAC,QAAQ,CAAC,KAC3B,OAAO,CAAC,QAAQ,CAsBlB,CAAC"}
|
package/dist/types/workflow.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { WorkflowDefinition, type FlowStep } from './dsl.types';
|
|
|
4
4
|
import { type WorkflowCompileOptions } from './workflow-compiler';
|
|
5
5
|
import { WorkflowRunner } from './workflow-runner';
|
|
6
6
|
import type { WorkflowRunOptions } from './workflow-types';
|
|
7
|
-
export { compileWorkflow } from './workflow-compiler';
|
|
7
|
+
export { buildWorkflowInputParser, compileWorkflow } from './workflow-compiler';
|
|
8
8
|
export { WorkflowEventEmitter } from './workflow-event-emitter';
|
|
9
9
|
export { WorkflowRunner } from './workflow-runner';
|
|
10
10
|
export type { WorkflowRunOptions, WorkflowRunResult } from './workflow-types';
|
|
@@ -27,6 +27,7 @@ export declare class Workflow {
|
|
|
27
27
|
* YAML is validated and compiled before being wrapped in a {@link Workflow} instance.
|
|
28
28
|
*/
|
|
29
29
|
static fromYaml(yaml: string, options: WorkflowCompileOptions): Workflow;
|
|
30
|
+
private static validateAndCompile;
|
|
30
31
|
/**
|
|
31
32
|
* Convert a workflow definition to YAML.
|
|
32
33
|
* The definition is validated before serialization.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/workflow.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,0BAA0B,EAEhC,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,kBAAkB,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QAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,cAAc;CAGnB"}
|
|
@@ -12,10 +12,10 @@ import { defineAction } from '../../../src';
|
|
|
12
12
|
import type { AgentBindings } from '../bindings';
|
|
13
13
|
import type { AgentExampleContext } from '../context';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { calculateScore } from './calculate-score';
|
|
16
16
|
|
|
17
17
|
const actionRegistry = {
|
|
18
|
-
|
|
18
|
+
calculate_score: calculateScore,
|
|
19
19
|
} as const;
|
|
20
20
|
const inputSchema = z.strictObject({
|
|
21
21
|
prompt: z.string(),
|
|
@@ -56,7 +56,9 @@ const resolveTools = (
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
tools[toolName] = tool({
|
|
59
|
-
description:
|
|
59
|
+
description:
|
|
60
|
+
toolDefinition.description ??
|
|
61
|
+
`Workflow tool "${toolName}" delegates to action "${action.name}".`,
|
|
60
62
|
inputSchema: action.inputSchema,
|
|
61
63
|
execute: async (payload) =>
|
|
62
64
|
action.run(payload, context, toolDefinition.settings as any),
|
|
@@ -21,17 +21,17 @@ const settingSchema = z.strictObject({
|
|
|
21
21
|
multiplier: z.number().default(1),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
24
|
+
type CalculateScoreInput = z.infer<typeof inputSchema>;
|
|
25
|
+
type CalculateScoreOutput = z.infer<typeof outputSchema>;
|
|
26
|
+
type CalculateScoreSettings = z.infer<typeof settingSchema>;
|
|
27
27
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
export const calculateScore = defineAction<
|
|
29
|
+
CalculateScoreInput,
|
|
30
|
+
CalculateScoreOutput,
|
|
31
31
|
AgentExampleContext,
|
|
32
|
-
|
|
32
|
+
CalculateScoreSettings
|
|
33
33
|
>({
|
|
34
|
-
name: '
|
|
34
|
+
name: 'calculate_score',
|
|
35
35
|
description: 'Calculates a score with score = multiplier * x + bias.',
|
|
36
36
|
inputSchema,
|
|
37
37
|
outputSchema,
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import type { Action } from '../../../src';
|
|
8
8
|
|
|
9
9
|
import { aiAgent } from './ai-agent';
|
|
10
|
-
import {
|
|
10
|
+
import { calculateScore } from './calculate-score';
|
|
11
11
|
|
|
12
12
|
export const defsBindingsActions: Record<string, Action> = {
|
|
13
13
|
ai_agent: aiAgent,
|
|
14
|
-
|
|
14
|
+
calculate_score: calculateScore,
|
|
15
15
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
defs:
|
|
3
3
|
calculate:
|
|
4
4
|
kind: tools
|
|
5
|
-
action:
|
|
5
|
+
action: calculate_score
|
|
6
6
|
description: "LLM Tool to calculate the score"
|
|
7
7
|
settings:
|
|
8
8
|
multiplier: 2
|
|
@@ -11,7 +11,7 @@ defs:
|
|
|
11
11
|
kind: task
|
|
12
12
|
action: ai_agent
|
|
13
13
|
inputs:
|
|
14
|
-
prompt: "
|
|
14
|
+
prompt: "Calculate the score for x=10"
|
|
15
15
|
system: "You are a helpful assistant"
|
|
16
16
|
settings:
|
|
17
17
|
provider: "openai"
|
|
@@ -4,24 +4,29 @@
|
|
|
4
4
|
---
|
|
5
5
|
# End-to-end assistant that classifies a user request, collects signals, performs a human-in-the-loop
|
|
6
6
|
# clarification (pausing the run until the user replies), branches by intent/priority, and delivers an email.
|
|
7
|
-
# Declares
|
|
7
|
+
# Declares the payload the caller provides when starting a run, as a JSON Schema of type object.
|
|
8
|
+
# A payload that does not match is refused before anything runs; "default" values are filled in.
|
|
8
9
|
inputs:
|
|
9
10
|
schema:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
user_email:
|
|
14
|
-
type: string
|
|
15
|
-
description: "Where to send the response."
|
|
16
|
-
priority:
|
|
17
|
-
type: string
|
|
18
|
-
enum: ["low", "normal", "high"]
|
|
19
|
-
description: "Used for routing/escalation decisions."
|
|
20
|
-
attachments:
|
|
21
|
-
type: array
|
|
22
|
-
items:
|
|
11
|
+
type: object
|
|
12
|
+
properties:
|
|
13
|
+
query:
|
|
23
14
|
type: string
|
|
24
|
-
|
|
15
|
+
description: "Natural language request or question from the user."
|
|
16
|
+
user_email:
|
|
17
|
+
type: string
|
|
18
|
+
description: "Where to send the response."
|
|
19
|
+
priority:
|
|
20
|
+
type: string
|
|
21
|
+
enum: ["low", "normal", "high"]
|
|
22
|
+
default: "normal"
|
|
23
|
+
description: "Used for routing/escalation decisions."
|
|
24
|
+
attachments:
|
|
25
|
+
type: array
|
|
26
|
+
items:
|
|
27
|
+
type: string
|
|
28
|
+
description: "Optional file ids that the user attached with the request."
|
|
29
|
+
required: [query, user_email]
|
|
25
30
|
|
|
26
31
|
# Context is provided by the runtime (read-only) and accessed with $context.* inside tasks.
|
|
27
32
|
# Include any long-term state here (thread ids, transcripts, briefs) instead of a separate memory block.
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Minimal flow that pauses until an external reply is supplied.
|
|
2
2
|
inputs:
|
|
3
3
|
schema:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type: object
|
|
5
|
+
properties:
|
|
6
|
+
question:
|
|
7
|
+
type: string
|
|
8
|
+
description: "Prompt shown to the user when the workflow suspends."
|
|
9
|
+
required: [question]
|
|
7
10
|
|
|
8
11
|
defs:
|
|
9
12
|
wait_for_confirmation:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexabot-ai/agentic",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-beta.0",
|
|
4
4
|
"description": "Schemas and utilities for the Hexabot agentic workflow DSL.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -24,18 +24,21 @@
|
|
|
24
24
|
"zod": "^4.6.7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
27
|
+
"@ai-sdk/openai": "^3.0.7",
|
|
28
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
29
29
|
"@types/jest": "^30.0.0",
|
|
30
30
|
"@types/node": "^24.1.0",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
32
|
+
"@typescript-eslint/parser": "^8.46.0",
|
|
33
|
+
"ai": "^6.0.20",
|
|
31
34
|
"eslint": "^9.37.0",
|
|
32
35
|
"eslint-config-prettier": "^10.1.8",
|
|
33
|
-
"eslint-import-resolver-typescript": "^4.4.4",
|
|
34
36
|
"eslint-plugin-header": "^3.1.1",
|
|
35
37
|
"eslint-plugin-import": "^2.32.0",
|
|
38
|
+
"globals": "^14.0.0",
|
|
39
|
+
"jest": "^30.2.0",
|
|
36
40
|
"lint-staged": "^15.3.0",
|
|
37
41
|
"prettier": "^3.6.2",
|
|
38
|
-
"jest": "^30.2.0",
|
|
39
42
|
"ts-jest": "^29.4.5",
|
|
40
43
|
"typescript": "^5.8.3"
|
|
41
44
|
},
|
|
@@ -727,7 +727,12 @@ describe('checkpoint validation', () => {
|
|
|
727
727
|
const error = expectRejected(broken, WorkflowCheckpointInvalidError);
|
|
728
728
|
|
|
729
729
|
expect(error.code).toBe('malformed');
|
|
730
|
-
expect(error.issues
|
|
730
|
+
expect(error.issues).toEqual(
|
|
731
|
+
expect.arrayContaining([expect.stringMatching(/^root\.index: /)]),
|
|
732
|
+
);
|
|
733
|
+
expect(error.message).toContain(
|
|
734
|
+
'Checkpoint does not match the expected shape: ',
|
|
735
|
+
);
|
|
731
736
|
});
|
|
732
737
|
|
|
733
738
|
it('reports frames that do not line up with the flow', async () => {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
describeResumePayload,
|
|
14
14
|
findNonJsonTypes,
|
|
15
15
|
isPayloadOptional,
|
|
16
|
+
rejectResumePayload,
|
|
16
17
|
} from '../resume-payload';
|
|
17
18
|
import { StepType } from '../workflow-event-emitter';
|
|
18
19
|
|
|
@@ -243,3 +244,31 @@ describe('checkResumePayload', () => {
|
|
|
243
244
|
).toBe(true);
|
|
244
245
|
});
|
|
245
246
|
});
|
|
247
|
+
|
|
248
|
+
describe('rejectResumePayload', () => {
|
|
249
|
+
it('lists one "<path>: <message>" line per issue, (root) for the payload itself', () => {
|
|
250
|
+
const nested = z
|
|
251
|
+
.object({ user: z.object({ name: z.string() }) })
|
|
252
|
+
.safeParse({ user: { name: 1 } });
|
|
253
|
+
const root = z.string().safeParse(1);
|
|
254
|
+
if (nested.success || root.success) {
|
|
255
|
+
throw new Error('Expected both payloads to be refused');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const error = rejectResumePayload('wait "w1"', [
|
|
259
|
+
...nested.error.issues,
|
|
260
|
+
...root.error.issues,
|
|
261
|
+
]);
|
|
262
|
+
|
|
263
|
+
expect(error).toBeInstanceOf(WorkflowResumeRejectedError);
|
|
264
|
+
expect(error.issues).toEqual([
|
|
265
|
+
'user.name: Invalid input: expected string, received number',
|
|
266
|
+
'(root): Invalid input: expected string, received number',
|
|
267
|
+
]);
|
|
268
|
+
expect(error.message).toBe(
|
|
269
|
+
'Resume payload for wait "w1" was rejected: ' +
|
|
270
|
+
'user.name: Invalid input: expected string, received number; ' +
|
|
271
|
+
'(root): Invalid input: expected string, received number',
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
});
|