@interf/compiler 0.5.1 → 0.6.3
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 +160 -201
- package/builtin-workflows/interf/README.md +22 -10
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +8 -5
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +3 -0
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +18 -2
- package/builtin-workflows/interf/improve/SKILL.md +4 -4
- package/builtin-workflows/interf/use/query/SKILL.md +1 -1
- package/builtin-workflows/interf/workflow.json +19 -5
- package/builtin-workflows/interf/{compiled.schema.json → workflow.schema.json} +10 -3
- package/dist/bin.js +2 -28
- package/dist/{commands → cli/commands}/check-draft.d.ts +2 -2
- package/dist/{commands → cli/commands}/check-draft.js +13 -13
- package/dist/{commands → cli/commands}/compile-controller.d.ts +3 -3
- package/dist/{commands → cli/commands}/compile-controller.js +39 -44
- package/dist/cli/commands/compile.d.ts +33 -0
- package/dist/{commands → cli/commands}/compile.js +107 -33
- package/dist/{commands → cli/commands}/compiled-flow.d.ts +3 -4
- package/dist/{commands → cli/commands}/compiled-flow.js +9 -14
- package/dist/{commands → cli/commands}/create-workflow-wizard.d.ts +20 -2
- package/dist/cli/commands/create-workflow-wizard.js +288 -0
- package/dist/{commands → cli/commands}/create.d.ts +2 -2
- package/dist/cli/commands/create.js +166 -0
- package/dist/cli/commands/dataset-selection.d.ts +6 -0
- package/dist/cli/commands/dataset-selection.js +11 -0
- package/dist/{commands → cli/commands}/default.js +5 -5
- package/dist/{commands → cli/commands}/doctor.js +12 -13
- package/dist/{commands → cli/commands}/executor-flow.d.ts +2 -2
- package/dist/{commands → cli/commands}/executor-flow.js +17 -17
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/{commands → cli/commands}/init.js +202 -109
- package/dist/{commands → cli/commands}/list.js +9 -6
- package/dist/{commands → cli/commands}/reset.js +5 -5
- package/dist/{commands → cli/commands}/source-config-wizard.d.ts +10 -5
- package/dist/{commands → cli/commands}/source-config-wizard.js +202 -95
- package/dist/{commands → cli/commands}/status.js +20 -11
- package/dist/{commands → cli/commands}/test-flow.d.ts +13 -4
- package/dist/{commands → cli/commands}/test-flow.js +30 -26
- package/dist/cli/commands/test.d.ts +14 -0
- package/dist/{commands → cli/commands}/test.js +48 -40
- package/dist/{commands → cli/commands}/verify.js +4 -4
- package/dist/cli/index.d.ts +21 -0
- package/dist/cli/index.js +33 -0
- package/dist/index.d.ts +22 -11
- package/dist/index.js +15 -6
- package/dist/lib/agent-args.d.ts +1 -3
- package/dist/lib/agent-args.js +1 -42
- package/dist/lib/agent-constants.d.ts +1 -5
- package/dist/lib/agent-constants.js +1 -28
- package/dist/lib/agent-detection.d.ts +1 -7
- package/dist/lib/agent-detection.js +1 -65
- package/dist/lib/agent-execution.d.ts +1 -2
- package/dist/lib/agent-execution.js +1 -242
- package/dist/lib/agent-logs.d.ts +1 -2
- package/dist/lib/agent-logs.js +1 -17
- package/dist/lib/agent-preflight.d.ts +1 -7
- package/dist/lib/agent-preflight.js +1 -76
- package/dist/lib/agent-render.d.ts +1 -8
- package/dist/lib/agent-render.js +1 -218
- package/dist/lib/agent-shells.d.ts +1 -44
- package/dist/lib/agent-shells.js +1 -847
- package/dist/lib/agent-status.d.ts +1 -3
- package/dist/lib/agent-status.js +1 -58
- package/dist/lib/agent-types.d.ts +1 -30
- package/dist/lib/agent-types.js +1 -1
- package/dist/lib/agents.d.ts +1 -6
- package/dist/lib/agents.js +1 -5
- package/dist/lib/builtin-compiled-workflow.d.ts +1 -129
- package/dist/lib/builtin-compiled-workflow.js +1 -153
- package/dist/lib/compiled-compile.d.ts +1 -52
- package/dist/lib/compiled-compile.js +1 -274
- package/dist/lib/compiled-paths.d.ts +1 -39
- package/dist/lib/compiled-paths.js +3 -103
- package/dist/lib/compiled-raw.d.ts +1 -49
- package/dist/lib/compiled-raw.js +3 -102
- package/dist/lib/compiled-reset.d.ts +1 -1
- package/dist/lib/compiled-reset.js +3 -44
- package/dist/lib/compiled-schema.d.ts +1 -27
- package/dist/lib/compiled-schema.js +1 -110
- package/dist/lib/discovery.d.ts +1 -1
- package/dist/lib/discovery.js +2 -2
- package/dist/lib/execution-profile.d.ts +1 -17
- package/dist/lib/execution-profile.js +1 -84
- package/dist/lib/executors.d.ts +1 -32
- package/dist/lib/executors.js +1 -43
- package/dist/lib/interf-bootstrap.d.ts +1 -3
- package/dist/lib/interf-bootstrap.js +3 -18
- package/dist/lib/interf-detect.d.ts +1 -33
- package/dist/lib/interf-detect.js +3 -176
- package/dist/lib/interf-scaffold.d.ts +1 -2
- package/dist/lib/interf-scaffold.js +3 -121
- package/dist/lib/interf-workflow-package.d.ts +1 -20
- package/dist/lib/interf-workflow-package.js +1 -276
- package/dist/lib/interf.d.ts +1 -5
- package/dist/lib/interf.js +3 -4
- package/dist/lib/local-workflows.d.ts +1 -53
- package/dist/lib/local-workflows.js +1 -399
- package/dist/lib/package-root.d.ts +1 -0
- package/dist/lib/package-root.js +1 -0
- package/dist/lib/project-paths.d.ts +1 -11
- package/dist/lib/project-paths.js +3 -32
- package/dist/lib/runtime-acceptance.d.ts +1 -9
- package/dist/lib/runtime-acceptance.js +1 -257
- package/dist/lib/runtime-contracts.d.ts +1 -2
- package/dist/lib/runtime-contracts.js +1 -47
- package/dist/lib/runtime-inventory.d.ts +1 -7
- package/dist/lib/runtime-inventory.js +1 -29
- package/dist/lib/runtime-paths.d.ts +1 -7
- package/dist/lib/runtime-paths.js +1 -23
- package/dist/lib/runtime-prompt.d.ts +1 -2
- package/dist/lib/runtime-prompt.js +1 -46
- package/dist/lib/runtime-reconcile.d.ts +1 -2
- package/dist/lib/runtime-reconcile.js +1 -156
- package/dist/lib/runtime-runs.d.ts +1 -11
- package/dist/lib/runtime-runs.js +1 -250
- package/dist/lib/runtime-types.d.ts +1 -43
- package/dist/lib/runtime-types.js +1 -1
- package/dist/lib/runtime.d.ts +1 -6
- package/dist/lib/runtime.js +1 -5
- package/dist/lib/schema.d.ts +4 -1016
- package/dist/lib/schema.js +6 -539
- package/dist/lib/source-config.d.ts +1 -39
- package/dist/lib/source-config.js +3 -293
- package/dist/lib/state-artifacts.d.ts +1 -8
- package/dist/lib/state-artifacts.js +1 -13
- package/dist/lib/state-health.d.ts +1 -4
- package/dist/lib/state-health.js +1 -132
- package/dist/lib/state-io.d.ts +1 -10
- package/dist/lib/state-io.js +1 -76
- package/dist/lib/state-paths.d.ts +1 -4
- package/dist/lib/state-paths.js +1 -13
- package/dist/lib/state-view.d.ts +1 -4
- package/dist/lib/state-view.js +1 -103
- package/dist/lib/state.d.ts +1 -6
- package/dist/lib/state.js +1 -5
- package/dist/lib/test-execution.d.ts +1 -14
- package/dist/lib/test-execution.js +3 -525
- package/dist/lib/test-matrices.d.ts +1 -90
- package/dist/lib/test-matrices.js +3 -96
- package/dist/lib/test-paths.d.ts +1 -12
- package/dist/lib/test-paths.js +3 -59
- package/dist/lib/test-profile-presets.d.ts +1 -57
- package/dist/lib/test-profile-presets.js +3 -50
- package/dist/lib/test-sandbox.d.ts +1 -11
- package/dist/lib/test-sandbox.js +3 -105
- package/dist/lib/test-specs.d.ts +1 -7
- package/dist/lib/test-specs.js +3 -114
- package/dist/lib/test-targets.d.ts +1 -5
- package/dist/lib/test-targets.js +3 -38
- package/dist/lib/test-types.d.ts +1 -17
- package/dist/lib/test-types.js +3 -1
- package/dist/lib/test.d.ts +1 -4
- package/dist/lib/test.js +3 -3
- package/dist/lib/validate-compiled.d.ts +1 -27
- package/dist/lib/validate-compiled.js +1 -238
- package/dist/lib/validate-helpers.d.ts +1 -12
- package/dist/lib/validate-helpers.js +1 -41
- package/dist/lib/validate.d.ts +1 -19
- package/dist/lib/validate.js +1 -256
- package/dist/lib/workflow-authoring.d.ts +1 -0
- package/dist/lib/workflow-authoring.js +1 -0
- package/dist/lib/workflow-definitions.d.ts +1 -68
- package/dist/lib/workflow-definitions.js +1 -206
- package/dist/lib/workflow-edit-session.d.ts +1 -0
- package/dist/lib/workflow-edit-session.js +1 -0
- package/dist/lib/workflow-edit-utils.d.ts +1 -0
- package/dist/lib/workflow-edit-utils.js +1 -0
- package/dist/lib/workflow-helpers.d.ts +1 -38
- package/dist/lib/workflow-helpers.js +1 -167
- package/dist/lib/workflow-improvement.d.ts +1 -22
- package/dist/lib/workflow-improvement.js +1 -396
- package/dist/lib/workflow-primitives.d.ts +1 -2
- package/dist/lib/workflow-primitives.js +1 -5
- package/dist/lib/workflow-review-paths.d.ts +1 -10
- package/dist/lib/workflow-review-paths.js +1 -27
- package/dist/lib/workflow-stage-policy.d.ts +1 -0
- package/dist/lib/workflow-stage-policy.js +1 -0
- package/dist/lib/workflow-stage-runner.d.ts +1 -41
- package/dist/lib/workflow-stage-runner.js +1 -109
- package/dist/lib/workflows.d.ts +1 -15
- package/dist/lib/workflows.js +1 -31
- package/dist/packages/agents/index.d.ts +17 -0
- package/dist/packages/agents/index.js +15 -0
- package/dist/packages/agents/lib/agents.d.ts +6 -0
- package/dist/packages/agents/lib/agents.js +5 -0
- package/dist/packages/agents/lib/args.d.ts +4 -0
- package/dist/packages/agents/lib/args.js +52 -0
- package/dist/packages/agents/lib/constants.d.ts +5 -0
- package/dist/packages/agents/lib/constants.js +28 -0
- package/dist/packages/agents/lib/detection.d.ts +7 -0
- package/dist/packages/agents/lib/detection.js +65 -0
- package/dist/packages/agents/lib/execution-profile.d.ts +17 -0
- package/dist/packages/agents/lib/execution-profile.js +84 -0
- package/dist/packages/agents/lib/execution.d.ts +2 -0
- package/dist/packages/agents/lib/execution.js +243 -0
- package/dist/packages/agents/lib/executors.d.ts +32 -0
- package/dist/packages/agents/lib/executors.js +45 -0
- package/dist/packages/agents/lib/logs.d.ts +2 -0
- package/dist/packages/agents/lib/logs.js +17 -0
- package/dist/packages/agents/lib/preflight.d.ts +7 -0
- package/dist/packages/agents/lib/preflight.js +77 -0
- package/dist/packages/agents/lib/render.d.ts +8 -0
- package/dist/packages/agents/lib/render.js +218 -0
- package/dist/packages/agents/lib/schema.d.ts +8 -0
- package/dist/packages/agents/lib/schema.js +7 -0
- package/dist/packages/agents/lib/shells.d.ts +69 -0
- package/dist/packages/agents/lib/shells.js +1021 -0
- package/dist/packages/agents/lib/status.d.ts +3 -0
- package/dist/packages/agents/lib/status.js +58 -0
- package/dist/packages/agents/lib/types.d.ts +30 -0
- package/dist/packages/agents/lib/types.js +1 -0
- package/dist/{lib → packages/agents/lib}/user-config.d.ts +1 -0
- package/dist/{lib → packages/agents/lib}/user-config.js +3 -2
- package/dist/packages/compiler/compiled-compile.d.ts +48 -0
- package/dist/packages/compiler/compiled-compile.js +256 -0
- package/dist/packages/compiler/compiled-schema.d.ts +31 -0
- package/dist/packages/compiler/compiled-schema.js +141 -0
- package/dist/packages/compiler/index.d.ts +24 -0
- package/dist/packages/compiler/index.js +23 -0
- package/dist/packages/compiler/lib/schema.d.ts +684 -0
- package/dist/packages/compiler/lib/schema.js +361 -0
- package/dist/packages/compiler/runtime-acceptance.d.ts +9 -0
- package/dist/packages/compiler/runtime-acceptance.js +269 -0
- package/dist/packages/compiler/runtime-contracts.d.ts +2 -0
- package/dist/packages/compiler/runtime-contracts.js +48 -0
- package/dist/packages/compiler/runtime-inventory.d.ts +7 -0
- package/dist/packages/compiler/runtime-inventory.js +29 -0
- package/dist/packages/compiler/runtime-paths.d.ts +8 -0
- package/dist/packages/compiler/runtime-paths.js +26 -0
- package/dist/packages/compiler/runtime-prompt.d.ts +2 -0
- package/dist/packages/compiler/runtime-prompt.js +48 -0
- package/dist/packages/compiler/runtime-reconcile.d.ts +2 -0
- package/dist/packages/compiler/runtime-reconcile.js +193 -0
- package/dist/packages/compiler/runtime-runs.d.ts +11 -0
- package/dist/packages/compiler/runtime-runs.js +262 -0
- package/dist/packages/compiler/runtime-types.d.ts +43 -0
- package/dist/packages/compiler/runtime-types.js +1 -0
- package/dist/packages/compiler/runtime.d.ts +6 -0
- package/dist/packages/compiler/runtime.js +5 -0
- package/dist/packages/compiler/state-artifacts.d.ts +8 -0
- package/dist/packages/compiler/state-artifacts.js +13 -0
- package/dist/packages/compiler/state-health.d.ts +4 -0
- package/dist/packages/compiler/state-health.js +132 -0
- package/dist/packages/compiler/state-io.d.ts +10 -0
- package/dist/packages/compiler/state-io.js +76 -0
- package/dist/packages/compiler/state-paths.d.ts +4 -0
- package/dist/packages/compiler/state-paths.js +13 -0
- package/dist/packages/compiler/state-view.d.ts +4 -0
- package/dist/packages/compiler/state-view.js +103 -0
- package/dist/packages/compiler/state.d.ts +7 -0
- package/dist/packages/compiler/state.js +12 -0
- package/dist/packages/compiler/validate-compiled.d.ts +27 -0
- package/dist/packages/compiler/validate-compiled.js +241 -0
- package/dist/packages/compiler/validate-helpers.d.ts +12 -0
- package/dist/packages/compiler/validate-helpers.js +41 -0
- package/dist/packages/compiler/validate.d.ts +21 -0
- package/dist/packages/compiler/validate.js +249 -0
- package/dist/packages/compiler/workflow-primitives.d.ts +2 -0
- package/dist/packages/compiler/workflow-primitives.js +5 -0
- package/dist/packages/compiler/workflows.d.ts +15 -0
- package/dist/packages/compiler/workflows.js +31 -0
- package/dist/packages/project-model/compiled-paths.d.ts +40 -0
- package/dist/packages/project-model/compiled-paths.js +106 -0
- package/dist/packages/project-model/compiled-raw.d.ts +49 -0
- package/dist/packages/project-model/compiled-raw.js +102 -0
- package/dist/packages/project-model/compiled-reset.d.ts +2 -0
- package/dist/packages/project-model/compiled-reset.js +72 -0
- package/dist/packages/project-model/index.d.ts +11 -0
- package/dist/packages/project-model/index.js +10 -0
- package/dist/packages/project-model/interf-bootstrap.d.ts +3 -0
- package/dist/packages/project-model/interf-bootstrap.js +18 -0
- package/dist/packages/project-model/interf-detect.d.ts +33 -0
- package/dist/packages/project-model/interf-detect.js +176 -0
- package/dist/packages/project-model/interf-scaffold.d.ts +2 -0
- package/dist/packages/project-model/interf-scaffold.js +124 -0
- package/dist/packages/project-model/interf.d.ts +5 -0
- package/dist/packages/project-model/interf.js +4 -0
- package/dist/packages/project-model/lib/schema.d.ts +125 -0
- package/dist/packages/project-model/lib/schema.js +62 -0
- package/dist/packages/project-model/project-paths.d.ts +11 -0
- package/dist/packages/project-model/project-paths.js +32 -0
- package/dist/packages/project-model/source-config.d.ts +38 -0
- package/dist/packages/project-model/source-config.js +297 -0
- package/dist/packages/testing/index.d.ts +13 -0
- package/dist/packages/testing/index.js +10 -0
- package/dist/packages/testing/lib/schema.d.ts +261 -0
- package/dist/packages/testing/lib/schema.js +119 -0
- package/dist/packages/testing/test-execution.d.ts +14 -0
- package/dist/packages/testing/test-execution.js +525 -0
- package/dist/packages/testing/test-matrices.d.ts +90 -0
- package/dist/packages/testing/test-matrices.js +96 -0
- package/dist/packages/testing/test-paths.d.ts +12 -0
- package/dist/packages/testing/test-paths.js +59 -0
- package/dist/packages/testing/test-profile-presets.d.ts +57 -0
- package/dist/packages/testing/test-profile-presets.js +50 -0
- package/dist/packages/testing/test-sandbox.d.ts +11 -0
- package/dist/packages/testing/test-sandbox.js +105 -0
- package/dist/packages/testing/test-specs.d.ts +7 -0
- package/dist/packages/testing/test-specs.js +114 -0
- package/dist/packages/testing/test-targets.d.ts +5 -0
- package/dist/packages/testing/test-targets.js +38 -0
- package/dist/packages/testing/test-types.d.ts +16 -0
- package/dist/packages/testing/test-types.js +1 -0
- package/dist/packages/testing/test.d.ts +4 -0
- package/dist/packages/testing/test.js +3 -0
- package/dist/packages/workflow-authoring/index.d.ts +4 -0
- package/dist/packages/workflow-authoring/index.js +4 -0
- package/dist/packages/workflow-authoring/lib/workflow-edit-utils.d.ts +10 -0
- package/dist/packages/workflow-authoring/lib/workflow-edit-utils.js +39 -0
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +26 -0
- package/dist/packages/workflow-authoring/workflow-authoring.js +120 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +16 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +57 -0
- package/dist/packages/workflow-authoring/workflow-improvement.d.ts +23 -0
- package/dist/packages/workflow-authoring/workflow-improvement.js +209 -0
- package/dist/packages/workflow-package/builtin-compiled-workflow.d.ts +38 -0
- package/dist/packages/workflow-package/builtin-compiled-workflow.js +94 -0
- package/dist/packages/workflow-package/index.d.ts +9 -0
- package/dist/packages/workflow-package/index.js +9 -0
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +25 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +342 -0
- package/dist/{lib/config.d.ts → packages/workflow-package/lib/package-root.d.ts} +0 -1
- package/dist/packages/workflow-package/lib/package-root.js +6 -0
- package/dist/packages/workflow-package/local-workflows.d.ts +54 -0
- package/dist/packages/workflow-package/local-workflows.js +422 -0
- package/dist/packages/workflow-package/workflow-definitions.d.ts +78 -0
- package/dist/packages/workflow-package/workflow-definitions.js +203 -0
- package/dist/packages/workflow-package/workflow-helpers.d.ts +38 -0
- package/dist/packages/workflow-package/workflow-helpers.js +167 -0
- package/dist/packages/workflow-package/workflow-review-paths.d.ts +10 -0
- package/dist/packages/workflow-package/workflow-review-paths.js +27 -0
- package/dist/packages/workflow-package/workflow-stage-policy.d.ts +5 -0
- package/dist/packages/workflow-package/workflow-stage-policy.js +31 -0
- package/dist/packages/workflow-package/workflow-stage-runner.d.ts +41 -0
- package/dist/packages/workflow-package/workflow-stage-runner.js +109 -0
- package/package.json +44 -21
- package/dist/commands/compile.d.ts +0 -15
- package/dist/commands/create-workflow-wizard.js +0 -125
- package/dist/commands/create.js +0 -162
- package/dist/commands/init.d.ts +0 -3
- package/dist/commands/test.d.ts +0 -9
- package/dist/lib/compiled-home.d.ts +0 -5
- package/dist/lib/compiled-home.js +0 -32
- package/dist/lib/config.js +0 -9
- package/dist/lib/obsidian.d.ts +0 -1
- package/dist/lib/obsidian.js +0 -15
- package/dist/lib/summarize-plan.d.ts +0 -17
- package/dist/lib/summarize-plan.js +0 -120
- /package/dist/{commands → cli/commands}/default.d.ts +0 -0
- /package/dist/{commands → cli/commands}/doctor.d.ts +0 -0
- /package/dist/{commands → cli/commands}/list.d.ts +0 -0
- /package/dist/{commands → cli/commands}/reset.d.ts +0 -0
- /package/dist/{commands → cli/commands}/status.d.ts +0 -0
- /package/dist/{commands → cli/commands}/verify.d.ts +0 -0
|
@@ -1,41 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type RuntimeContractType, type RuntimeStageInstructions } from "./schema.js";
|
|
3
|
-
import { type RuntimeStageContractDraft } from "./runtime.js";
|
|
4
|
-
import { type WorkflowReporter, type WorkflowStageResult } from "./workflow-helpers.js";
|
|
5
|
-
interface WorkflowStageShape<TContractType extends RuntimeContractType> {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
contractType: TContractType;
|
|
9
|
-
}
|
|
10
|
-
interface ExecuteValidatedStageOptions<TContractType extends RuntimeContractType> {
|
|
11
|
-
executor: WorkflowExecutor;
|
|
12
|
-
compiledPath: string;
|
|
13
|
-
executionPath?: string;
|
|
14
|
-
targetName: string;
|
|
15
|
-
workflow: string;
|
|
16
|
-
workflowSourcePath?: string;
|
|
17
|
-
stageDefinition: WorkflowStageShape<TContractType>;
|
|
18
|
-
instructions: RuntimeStageInstructions;
|
|
19
|
-
summary: string;
|
|
20
|
-
contract: RuntimeStageContractDraft;
|
|
21
|
-
statusLines: string[];
|
|
22
|
-
reporter?: WorkflowReporter;
|
|
23
|
-
completionCheck?: (() => boolean) | null;
|
|
24
|
-
syncWrites?: (() => void) | null;
|
|
25
|
-
reconcile?: (() => boolean) | null;
|
|
26
|
-
refreshArtifacts?: (() => void) | null;
|
|
27
|
-
validate: () => {
|
|
28
|
-
ok: boolean;
|
|
29
|
-
summary: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
interface ExecuteValidatedSummarizeStageOptions<TContractType extends RuntimeContractType> extends ExecuteValidatedStageOptions<TContractType> {
|
|
33
|
-
startingSummaryCount: number;
|
|
34
|
-
targetCount: number;
|
|
35
|
-
}
|
|
36
|
-
export declare function findStageByContractType<TStage extends {
|
|
37
|
-
contractType: string;
|
|
38
|
-
}>(stages: TStage[], contractType: TStage["contractType"]): TStage;
|
|
39
|
-
export declare function executeValidatedStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedStageOptions<TContractType>): Promise<WorkflowStageResult>;
|
|
40
|
-
export declare function executeValidatedSummarizeStage<TContractType extends RuntimeContractType>(options: ExecuteValidatedSummarizeStageOptions<TContractType>): Promise<WorkflowStageResult>;
|
|
41
|
-
export {};
|
|
1
|
+
export * from "../packages/workflow-package/workflow-stage-runner.js";
|
|
@@ -1,109 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { reportValidationFailure, validateStageOutcome, } from "./workflow-helpers.js";
|
|
3
|
-
export function findStageByContractType(stages, contractType) {
|
|
4
|
-
const stage = stages.find((candidate) => candidate.contractType === contractType);
|
|
5
|
-
if (!stage) {
|
|
6
|
-
throw new Error(`Missing workflow stage for contract type: ${contractType}`);
|
|
7
|
-
}
|
|
8
|
-
return stage;
|
|
9
|
-
}
|
|
10
|
-
export async function executeValidatedStage(options) {
|
|
11
|
-
const completionCheck = options.completionCheck
|
|
12
|
-
? () => {
|
|
13
|
-
options.syncWrites?.();
|
|
14
|
-
options.reconcile?.();
|
|
15
|
-
return options.completionCheck?.() === true;
|
|
16
|
-
}
|
|
17
|
-
: undefined;
|
|
18
|
-
const code = await runExecutorStage({
|
|
19
|
-
executor: options.executor,
|
|
20
|
-
compiledPath: options.compiledPath,
|
|
21
|
-
executionPath: options.executionPath,
|
|
22
|
-
compiledName: options.targetName,
|
|
23
|
-
workflow: options.workflow,
|
|
24
|
-
workflowSourcePath: options.workflowSourcePath,
|
|
25
|
-
stage: options.stageDefinition.id,
|
|
26
|
-
stageLabel: options.stageDefinition.label,
|
|
27
|
-
contractType: options.stageDefinition.contractType,
|
|
28
|
-
summary: options.summary,
|
|
29
|
-
contract: options.contract,
|
|
30
|
-
buildPrompt: (contractPath) => buildStagePrompt(options.instructions, contractPath, options.statusLines),
|
|
31
|
-
completionCheck,
|
|
32
|
-
});
|
|
33
|
-
return finalizeValidatedStage(options, code);
|
|
34
|
-
}
|
|
35
|
-
export async function executeValidatedSummarizeStage(options) {
|
|
36
|
-
const completionCheck = options.completionCheck
|
|
37
|
-
? () => {
|
|
38
|
-
options.syncWrites?.();
|
|
39
|
-
options.reconcile?.();
|
|
40
|
-
return options.completionCheck?.() === true;
|
|
41
|
-
}
|
|
42
|
-
: undefined;
|
|
43
|
-
const code = await runExecutorSummarizeStage({
|
|
44
|
-
executor: options.executor,
|
|
45
|
-
compiledPath: options.compiledPath,
|
|
46
|
-
executionPath: options.executionPath,
|
|
47
|
-
compiledName: options.targetName,
|
|
48
|
-
workflow: options.workflow,
|
|
49
|
-
workflowSourcePath: options.workflowSourcePath,
|
|
50
|
-
stage: options.stageDefinition.id,
|
|
51
|
-
stageLabel: options.stageDefinition.label,
|
|
52
|
-
contractType: options.stageDefinition.contractType,
|
|
53
|
-
summary: options.summary,
|
|
54
|
-
contract: options.contract,
|
|
55
|
-
buildPrompt: (contractPath) => buildStagePrompt(options.instructions, contractPath, options.statusLines),
|
|
56
|
-
completionCheck,
|
|
57
|
-
startingSummaryCount: options.startingSummaryCount,
|
|
58
|
-
targetCount: options.targetCount,
|
|
59
|
-
});
|
|
60
|
-
return finalizeValidatedStage(options, code);
|
|
61
|
-
}
|
|
62
|
-
function finalizeValidatedStage(options, code) {
|
|
63
|
-
const refreshAndValidate = () => {
|
|
64
|
-
options.syncWrites?.();
|
|
65
|
-
options.reconcile?.();
|
|
66
|
-
options.refreshArtifacts?.();
|
|
67
|
-
return validateStageOutcome(options.compiledPath, options.validate());
|
|
68
|
-
};
|
|
69
|
-
if (code !== 0) {
|
|
70
|
-
let completionSatisfied = false;
|
|
71
|
-
try {
|
|
72
|
-
options.syncWrites?.();
|
|
73
|
-
options.reconcile?.();
|
|
74
|
-
completionSatisfied = options.completionCheck?.() === true;
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
completionSatisfied = false;
|
|
78
|
-
}
|
|
79
|
-
if (completionSatisfied) {
|
|
80
|
-
const validation = refreshAndValidate();
|
|
81
|
-
if (validation.ok) {
|
|
82
|
-
markRuntimeRunSucceededAfterValidation(options.compiledPath, validation.summary);
|
|
83
|
-
return {
|
|
84
|
-
ok: true,
|
|
85
|
-
code: 0,
|
|
86
|
-
summary: validation.summary,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
reportValidationFailure(options.reporter, validation.summary);
|
|
90
|
-
markRuntimeRunFailedAfterValidation(options.compiledPath, validation.summary);
|
|
91
|
-
return {
|
|
92
|
-
ok: false,
|
|
93
|
-
code,
|
|
94
|
-
summary: validation.summary,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return { ok: false, code };
|
|
98
|
-
}
|
|
99
|
-
const validation = refreshAndValidate();
|
|
100
|
-
if (!validation.ok) {
|
|
101
|
-
reportValidationFailure(options.reporter, validation.summary);
|
|
102
|
-
markRuntimeRunFailedAfterValidation(options.compiledPath, validation.summary);
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
ok: validation.ok,
|
|
106
|
-
code: validation.ok ? 0 : 1,
|
|
107
|
-
summary: validation.summary,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
1
|
+
export * from "../packages/workflow-package/workflow-stage-runner.js";
|
package/dist/lib/workflows.d.ts
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type { WorkflowReporter, WorkflowStageResult, LocalSkillContractExtension } from "./workflow-helpers.js";
|
|
3
|
-
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
|
|
4
|
-
export type CompiledCheck = "compiled" | "stage";
|
|
5
|
-
export interface DetectedInterfTarget {
|
|
6
|
-
path: string;
|
|
7
|
-
kind: "compiled";
|
|
8
|
-
engineType: "compiled";
|
|
9
|
-
config: InterfConfig;
|
|
10
|
-
}
|
|
11
|
-
export declare function detectCompiled(cwd: string): DetectedInterfTarget | null;
|
|
12
|
-
export declare function createCompiled(name: string, sourcePath: string, workflowId?: string, about?: string, datasetPath?: string): string;
|
|
13
|
-
export declare function verifyCompiledCheck(check: CompiledCheck, compiledPath: string): import("./validate-compiled.js").CompiledWorkflowValidation;
|
|
14
|
-
export { runCompiledSummarize, runCompiledCompile, compileCompiled, resolveCompiledContext, compiledExecutionStages, } from "./compiled-compile.js";
|
|
15
|
-
export type { CompiledSummarizeResult, CompiledCompileResult, CompiledStageExecutionDefinition, StageShellRetentionMode, } from "./compiled-compile.js";
|
|
1
|
+
export * from "../packages/compiler/workflows.js";
|
package/dist/lib/workflows.js
CHANGED
|
@@ -1,31 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { detectInterf } from "./interf.js";
|
|
3
|
-
import { validateCompiledCompile, } from "./validate.js";
|
|
4
|
-
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
|
|
5
|
-
export function detectCompiled(cwd) {
|
|
6
|
-
const detected = detectInterf(cwd);
|
|
7
|
-
if (!detected)
|
|
8
|
-
return null;
|
|
9
|
-
return {
|
|
10
|
-
path: detected.path,
|
|
11
|
-
kind: "compiled",
|
|
12
|
-
engineType: "compiled",
|
|
13
|
-
config: detected.config,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath = sourcePath) {
|
|
17
|
-
return createCompiledScaffold(name, sourcePath, workflowId, about, datasetPath);
|
|
18
|
-
}
|
|
19
|
-
export function verifyCompiledCheck(check, compiledPath) {
|
|
20
|
-
switch (check) {
|
|
21
|
-
case "compiled":
|
|
22
|
-
return validateCompiledCompile(compiledPath);
|
|
23
|
-
case "stage":
|
|
24
|
-
return validateCompiledCompile(compiledPath);
|
|
25
|
-
default: {
|
|
26
|
-
const exhaustiveCheck = check;
|
|
27
|
-
throw new Error(`Unknown compiled check: ${exhaustiveCheck}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export { runCompiledSummarize, runCompiledCompile, compileCompiled, resolveCompiledContext, compiledExecutionStages, } from "./compiled-compile.js";
|
|
1
|
+
export * from "../packages/compiler/workflows.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * as args from "./lib/args.js";
|
|
2
|
+
export * as constants from "./lib/constants.js";
|
|
3
|
+
export * as detection from "./lib/detection.js";
|
|
4
|
+
export * as execution from "./lib/execution.js";
|
|
5
|
+
export * as logs from "./lib/logs.js";
|
|
6
|
+
export * as preflight from "./lib/preflight.js";
|
|
7
|
+
export * as render from "./lib/render.js";
|
|
8
|
+
export * as shells from "./lib/shells.js";
|
|
9
|
+
export * as status from "./lib/status.js";
|
|
10
|
+
export * as types from "./lib/types.js";
|
|
11
|
+
export * as agents from "./lib/agents.js";
|
|
12
|
+
export * as executionProfile from "./lib/execution-profile.js";
|
|
13
|
+
export * as executors from "./lib/executors.js";
|
|
14
|
+
export * as schema from "./lib/schema.js";
|
|
15
|
+
export * as userConfig from "./lib/user-config.js";
|
|
16
|
+
export type { Agent, } from "./lib/types.js";
|
|
17
|
+
export type { WorkflowExecutionProfile, WorkflowExecutor, WorkflowExecutorKind, } from "./lib/executors.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * as args from "./lib/args.js";
|
|
2
|
+
export * as constants from "./lib/constants.js";
|
|
3
|
+
export * as detection from "./lib/detection.js";
|
|
4
|
+
export * as execution from "./lib/execution.js";
|
|
5
|
+
export * as logs from "./lib/logs.js";
|
|
6
|
+
export * as preflight from "./lib/preflight.js";
|
|
7
|
+
export * as render from "./lib/render.js";
|
|
8
|
+
export * as shells from "./lib/shells.js";
|
|
9
|
+
export * as status from "./lib/status.js";
|
|
10
|
+
export * as types from "./lib/types.js";
|
|
11
|
+
export * as agents from "./lib/agents.js";
|
|
12
|
+
export * as executionProfile from "./lib/execution-profile.js";
|
|
13
|
+
export * as executors from "./lib/executors.js";
|
|
14
|
+
export * as schema from "./lib/schema.js";
|
|
15
|
+
export * as userConfig from "./lib/user-config.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { Agent, AgentAutomationReadiness, AgentPreflightOptions, AgentPreflightResult, SpawnAgentOptions, } from "./types.js";
|
|
2
|
+
export { detectAgents, supportsAutomatedRuns, resolveAgent, } from "./detection.js";
|
|
3
|
+
export { buildAgentPreflightPrompt, runAgentPreflight, ensureAgentAutomatedRunReady, } from "./preflight.js";
|
|
4
|
+
export { spawnAgent, } from "./execution.js";
|
|
5
|
+
export { buildAgentArgs, buildAgentEnv } from "./args.js";
|
|
6
|
+
export { extractAgentFailureStatus, classifyTerminalVisibleStatus, hasAgentStalled, } from "./status.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { detectAgents, supportsAutomatedRuns, resolveAgent, } from "./detection.js";
|
|
2
|
+
export { buildAgentPreflightPrompt, runAgentPreflight, ensureAgentAutomatedRunReady, } from "./preflight.js";
|
|
3
|
+
export { spawnAgent, } from "./execution.js";
|
|
4
|
+
export { buildAgentArgs, buildAgentEnv } from "./args.js";
|
|
5
|
+
export { extractAgentFailureStatus, classifyTerminalVisibleStatus, hasAgentStalled, } from "./status.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowExecutionProfile } from "./executors.js";
|
|
2
|
+
import type { Agent } from "./types.js";
|
|
3
|
+
export declare function buildAgentEnv(agent: Agent, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
4
|
+
export declare function buildAgentArgs(agent: Agent, prompt: string, executionProfile?: WorkflowExecutionProfile): string[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const CODEX_SANDBOX_MODE = `work${"space-write"}`;
|
|
2
|
+
export function buildAgentEnv(agent, baseEnv = process.env) {
|
|
3
|
+
const env = { ...baseEnv };
|
|
4
|
+
if (agent.name === "codex") {
|
|
5
|
+
// Codex executes Bash-tool commands inside its own sandbox. Let Codex
|
|
6
|
+
// choose a sandbox-safe default shell instead of inheriting a host-only
|
|
7
|
+
// login shell path such as /bin/zsh.
|
|
8
|
+
delete env.SHELL;
|
|
9
|
+
}
|
|
10
|
+
return env;
|
|
11
|
+
}
|
|
12
|
+
export function buildAgentArgs(agent, prompt, executionProfile = {}) {
|
|
13
|
+
if (agent.name === "claude-code") {
|
|
14
|
+
const args = [
|
|
15
|
+
"-p",
|
|
16
|
+
prompt,
|
|
17
|
+
"--output-format",
|
|
18
|
+
"stream-json",
|
|
19
|
+
"--verbose",
|
|
20
|
+
"--allowedTools",
|
|
21
|
+
"Read,Write,Edit,Bash,Grep,Glob,Agent",
|
|
22
|
+
];
|
|
23
|
+
if (executionProfile.model) {
|
|
24
|
+
args.push("--model", executionProfile.model);
|
|
25
|
+
}
|
|
26
|
+
if (executionProfile.effort) {
|
|
27
|
+
args.push("--effort", executionProfile.effort);
|
|
28
|
+
}
|
|
29
|
+
return args;
|
|
30
|
+
}
|
|
31
|
+
if (agent.name === "codex") {
|
|
32
|
+
const args = [
|
|
33
|
+
"exec",
|
|
34
|
+
"--json",
|
|
35
|
+
"-s",
|
|
36
|
+
CODEX_SANDBOX_MODE,
|
|
37
|
+
"--skip-git-repo-check",
|
|
38
|
+
];
|
|
39
|
+
if (executionProfile.model) {
|
|
40
|
+
args.push("--model", executionProfile.model);
|
|
41
|
+
}
|
|
42
|
+
if (executionProfile.profile) {
|
|
43
|
+
args.push("--profile", executionProfile.profile);
|
|
44
|
+
}
|
|
45
|
+
if (executionProfile.effort) {
|
|
46
|
+
args.push("-c", `model_reasoning_effort=${JSON.stringify(executionProfile.effort)}`);
|
|
47
|
+
}
|
|
48
|
+
args.push(prompt);
|
|
49
|
+
return args;
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Agent "${agent.displayName}" is not yet supported for automated compile runs.`);
|
|
52
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
export const SHOW_AGENT_TOOL_EVENTS = process.env.INTERF_DEBUG_AGENT_TOOLS === "1";
|
|
4
|
+
export const AGENTS = [
|
|
5
|
+
{
|
|
6
|
+
name: "claude-code",
|
|
7
|
+
displayName: "Claude Code",
|
|
8
|
+
skillsDir: join(homedir(), ".claude", "skills"),
|
|
9
|
+
command: "claude",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "codex",
|
|
13
|
+
displayName: "Codex",
|
|
14
|
+
skillsDir: join(homedir(), ".codex", "skills"),
|
|
15
|
+
command: "codex",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "cursor",
|
|
19
|
+
displayName: "Cursor",
|
|
20
|
+
skillsDir: join(homedir(), ".cursor", "skills"),
|
|
21
|
+
command: "cursor",
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
export const CODEX_NOISE_PATTERNS = [
|
|
25
|
+
/codex_core_skills::loader: failed to stat skills entry .*\/(interf-[^ ]+|compiled\/[^ ]+) \(symlink\): No such file or directory/,
|
|
26
|
+
/codex_core::codex: failed to load skill .*\/gstack\/SKILL\.md: invalid description: exceeds maximum length of 1024 characters/,
|
|
27
|
+
];
|
|
28
|
+
export const VISIBLE_STATUS_PREFIXES = ["STATUS:", "DONE:", "BLOCKED:", "ERROR:"];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { loadUserConfig } from "./user-config.js";
|
|
6
|
+
import { AGENTS } from "./constants.js";
|
|
7
|
+
export function detectAgents() {
|
|
8
|
+
return AGENTS.filter((agent) => {
|
|
9
|
+
const dir = join(homedir(), `.${agent.name === "claude-code" ? "claude" : agent.name}`);
|
|
10
|
+
return existsSync(dir);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function commandExists(command) {
|
|
14
|
+
try {
|
|
15
|
+
execFileSync("which", [command], { stdio: "ignore" });
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function supportsAutomatedRuns(agent) {
|
|
23
|
+
return agent.name === "claude-code" || agent.name === "codex";
|
|
24
|
+
}
|
|
25
|
+
export function resolveAgent() {
|
|
26
|
+
const config = loadUserConfig();
|
|
27
|
+
if (config) {
|
|
28
|
+
const configured = AGENTS.find((agent) => agent.command === config.agentCommand) ??
|
|
29
|
+
AGENTS.find((agent) => agent.name === config.agent) ??
|
|
30
|
+
AGENTS.find((agent) => agent.displayName === config.agent);
|
|
31
|
+
if (!configured) {
|
|
32
|
+
return {
|
|
33
|
+
agent: null,
|
|
34
|
+
error: `Configured agent "${config.agent}" is not supported by this Interf build. Run \`interf\` or \`interf init\` to choose a supported agent.`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (!commandExists(configured.command)) {
|
|
38
|
+
return {
|
|
39
|
+
agent: null,
|
|
40
|
+
error: `Configured agent "${configured.displayName}" is not available in PATH. Run \`interf\` or \`interf init\` to reconfigure.`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (!supportsAutomatedRuns(configured)) {
|
|
44
|
+
return {
|
|
45
|
+
agent: null,
|
|
46
|
+
error: `Configured agent "${configured.displayName}" is detected, but this Interf build can only automate Claude Code or Codex. Run \`interf\` or \`interf init\` and choose one of those agents.`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return { agent: configured };
|
|
50
|
+
}
|
|
51
|
+
const detected = detectAgents().filter((agent) => commandExists(agent.command) && supportsAutomatedRuns(agent));
|
|
52
|
+
if (detected.length === 0) {
|
|
53
|
+
return {
|
|
54
|
+
agent: null,
|
|
55
|
+
error: "No coding agent detected. Install Claude Code or Codex.",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (detected.length > 1) {
|
|
59
|
+
return {
|
|
60
|
+
agent: null,
|
|
61
|
+
error: "Multiple coding agents detected but no default is configured. Run `interf` or `interf init` to choose which agent local runs should use.",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return { agent: detected[0] };
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Argv } from "yargs";
|
|
2
|
+
import type { Agent } from "./types.js";
|
|
3
|
+
import type { WorkflowExecutionProfile } from "./executors.js";
|
|
4
|
+
type AgentLike = Pick<Agent, "name"> | string | null | undefined;
|
|
5
|
+
export declare function addExecutionProfileOptions<T extends Argv>(yargs: T): T;
|
|
6
|
+
type ExecutionProfileArgSource = Record<string, unknown> & {
|
|
7
|
+
model?: unknown;
|
|
8
|
+
profile?: unknown;
|
|
9
|
+
effort?: unknown;
|
|
10
|
+
timeoutMs?: unknown;
|
|
11
|
+
"timeout-ms"?: unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare function executionProfileFromArgv(argv: ExecutionProfileArgSource): WorkflowExecutionProfile;
|
|
14
|
+
export declare function applyInternalAcceptanceExecutionProfileDefaults(agent: AgentLike, overrides?: WorkflowExecutionProfile): WorkflowExecutionProfile;
|
|
15
|
+
export declare function hasWorkflowExecutionProfile(profile: WorkflowExecutionProfile | null | undefined): boolean;
|
|
16
|
+
export declare function formatWorkflowExecutionProfile(profile: WorkflowExecutionProfile | null | undefined): string | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const INTERNAL_ACCEPTANCE_DEFAULTS = {
|
|
2
|
+
"claude-code": {
|
|
3
|
+
model: "claude-sonnet-4-6",
|
|
4
|
+
effort: "low",
|
|
5
|
+
},
|
|
6
|
+
codex: {
|
|
7
|
+
model: "gpt-5.4-mini",
|
|
8
|
+
effort: "low",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
function readAgentName(agent) {
|
|
12
|
+
if (!agent)
|
|
13
|
+
return null;
|
|
14
|
+
return typeof agent === "string" ? agent : agent.name;
|
|
15
|
+
}
|
|
16
|
+
function normalizeOptionalString(value) {
|
|
17
|
+
if (typeof value !== "string")
|
|
18
|
+
return null;
|
|
19
|
+
const trimmed = value.trim();
|
|
20
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
21
|
+
}
|
|
22
|
+
function normalizeOptionalTimeout(value) {
|
|
23
|
+
if (value === undefined || value === null || value === "")
|
|
24
|
+
return null;
|
|
25
|
+
const parsed = typeof value === "number" ? value : Number.parseInt(String(value), 10);
|
|
26
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
27
|
+
throw new Error(`Invalid timeout: ${String(value)}`);
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
export function addExecutionProfileOptions(yargs) {
|
|
32
|
+
return yargs
|
|
33
|
+
.option("model", {
|
|
34
|
+
type: "string",
|
|
35
|
+
describe: "Override the local executor model for this run",
|
|
36
|
+
})
|
|
37
|
+
.option("profile", {
|
|
38
|
+
type: "string",
|
|
39
|
+
describe: "Executor-specific profile override for this run",
|
|
40
|
+
})
|
|
41
|
+
.option("effort", {
|
|
42
|
+
type: "string",
|
|
43
|
+
describe: "Override the model reasoning effort for this run",
|
|
44
|
+
})
|
|
45
|
+
.option("timeout-ms", {
|
|
46
|
+
type: "number",
|
|
47
|
+
describe: "Interrupt the local executor after this much inactivity",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function executionProfileFromArgv(argv) {
|
|
51
|
+
return {
|
|
52
|
+
model: normalizeOptionalString(argv.model),
|
|
53
|
+
profile: normalizeOptionalString(argv.profile),
|
|
54
|
+
effort: normalizeOptionalString(argv.effort),
|
|
55
|
+
timeoutMs: normalizeOptionalTimeout(argv.timeoutMs ?? argv["timeout-ms"]),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function applyInternalAcceptanceExecutionProfileDefaults(agent, overrides = {}) {
|
|
59
|
+
const defaults = INTERNAL_ACCEPTANCE_DEFAULTS[readAgentName(agent) ?? ""];
|
|
60
|
+
const profile = overrides.profile ?? null;
|
|
61
|
+
const explicitEffort = overrides.effort ?? null;
|
|
62
|
+
return {
|
|
63
|
+
model: overrides.model ?? defaults?.model ?? null,
|
|
64
|
+
profile,
|
|
65
|
+
effort: explicitEffort ?? (profile ? null : defaults?.effort ?? null),
|
|
66
|
+
timeoutMs: overrides.timeoutMs ?? null,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function hasWorkflowExecutionProfile(profile) {
|
|
70
|
+
return Boolean(profile?.model ||
|
|
71
|
+
profile?.profile ||
|
|
72
|
+
profile?.effort ||
|
|
73
|
+
profile?.timeoutMs);
|
|
74
|
+
}
|
|
75
|
+
export function formatWorkflowExecutionProfile(profile) {
|
|
76
|
+
if (!hasWorkflowExecutionProfile(profile))
|
|
77
|
+
return null;
|
|
78
|
+
return JSON.stringify({
|
|
79
|
+
...(profile?.model ? { model: profile.model } : {}),
|
|
80
|
+
...(profile?.profile ? { profile: profile.profile } : {}),
|
|
81
|
+
...(profile?.effort ? { effort: profile.effort } : {}),
|
|
82
|
+
...(profile?.timeoutMs ? { timeout_ms: profile.timeoutMs } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|