@interf/compiler 0.3.4 → 0.4.1
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 +128 -149
- package/builtin-workflows/interf/README.md +19 -0
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +28 -0
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +18 -0
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +18 -0
- package/builtin-workflows/interf/improve/SKILL.md +18 -0
- package/builtin-workflows/interf/use/query/SKILL.md +28 -0
- package/builtin-workflows/interf/workflow.json +120 -0
- package/builtin-workflows/interf/workspace.schema.json +75 -0
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +0 -1
- package/dist/commands/compile-controller.d.ts +14 -0
- package/dist/commands/compile-controller.js +409 -0
- package/dist/commands/compile.d.ts +8 -9
- package/dist/commands/compile.js +151 -153
- package/dist/commands/create-workflow-wizard.d.ts +4 -2
- package/dist/commands/create-workflow-wizard.js +33 -31
- package/dist/commands/create.d.ts +0 -1
- package/dist/commands/create.js +15 -11
- package/dist/commands/default.d.ts +0 -1
- package/dist/commands/default.js +0 -1
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/doctor.js +1 -16
- package/dist/commands/executor-flow.d.ts +0 -1
- package/dist/commands/executor-flow.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +71 -14
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/commands/reset.d.ts +0 -1
- package/dist/commands/reset.js +0 -1
- package/dist/commands/source-config-wizard.d.ts +28 -7
- package/dist/commands/source-config-wizard.js +159 -63
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/status.js +0 -1
- package/dist/commands/test-flow.d.ts +20 -10
- package/dist/commands/test-flow.js +89 -23
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +36 -72
- package/dist/commands/verify.d.ts +0 -1
- package/dist/commands/verify.js +0 -1
- package/dist/commands/workspace-flow.d.ts +3 -3
- package/dist/commands/workspace-flow.js +30 -12
- package/dist/index.d.ts +5 -6
- package/dist/index.js +3 -4
- package/dist/lib/agent-args.d.ts +0 -1
- package/dist/lib/agent-args.js +0 -1
- package/dist/lib/agent-constants.d.ts +0 -1
- package/dist/lib/agent-constants.js +0 -1
- package/dist/lib/agent-detection.d.ts +0 -1
- package/dist/lib/agent-detection.js +0 -1
- package/dist/lib/agent-execution.d.ts +0 -1
- package/dist/lib/agent-execution.js +47 -12
- package/dist/lib/agent-logs.d.ts +0 -1
- package/dist/lib/agent-logs.js +0 -1
- package/dist/lib/agent-preflight.d.ts +0 -1
- package/dist/lib/agent-preflight.js +1 -2
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +30 -3
- package/dist/lib/agent-shells.js +517 -54
- package/dist/lib/agent-status.d.ts +0 -1
- package/dist/lib/agent-status.js +0 -1
- package/dist/lib/agent-types.d.ts +0 -1
- package/dist/lib/agent-types.js +0 -1
- package/dist/lib/agents.d.ts +0 -9
- package/dist/lib/agents.js +0 -9
- package/dist/lib/chart-guidance.d.ts +1 -0
- package/dist/lib/chart-guidance.js +8 -0
- package/dist/lib/config.d.ts +0 -3
- package/dist/lib/config.js +0 -5
- package/dist/lib/discovery.d.ts +0 -1
- package/dist/lib/discovery.js +0 -1
- package/dist/lib/execution-profile.d.ts +0 -1
- package/dist/lib/execution-profile.js +0 -1
- package/dist/lib/executors.d.ts +0 -1
- package/dist/lib/executors.js +0 -1
- package/dist/lib/filesystem.d.ts +0 -1
- package/dist/lib/filesystem.js +0 -1
- package/dist/lib/interf-bootstrap.d.ts +0 -1
- package/dist/lib/interf-bootstrap.js +6 -2
- package/dist/lib/interf-detect.d.ts +2 -2
- package/dist/lib/interf-detect.js +25 -8
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +54 -21
- package/dist/lib/interf-workflow-package.d.ts +18 -1
- package/dist/lib/interf-workflow-package.js +164 -23
- package/dist/lib/interf.d.ts +1 -2
- package/dist/lib/interf.js +1 -2
- package/dist/lib/local-workflows.d.ts +10 -5
- package/dist/lib/local-workflows.js +208 -97
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/obsidian.d.ts +0 -1
- package/dist/lib/obsidian.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/registry.d.ts +0 -1
- package/dist/lib/registry.js +0 -1
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +1 -2
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +14 -8
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +5 -10
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +8 -23
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +7 -3
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +4 -5
- package/dist/lib/runtime-types.d.ts +0 -1
- package/dist/lib/runtime-types.js +0 -1
- package/dist/lib/runtime.d.ts +0 -1
- package/dist/lib/runtime.js +0 -1
- package/dist/lib/schema.d.ts +356 -51
- package/dist/lib/schema.js +189 -54
- package/dist/lib/source-config.d.ts +17 -8
- package/dist/lib/source-config.js +125 -11
- package/dist/lib/state-artifacts.d.ts +0 -1
- package/dist/lib/state-artifacts.js +0 -1
- package/dist/lib/state-health.d.ts +0 -1
- package/dist/lib/state-health.js +2 -3
- package/dist/lib/state-io.d.ts +1 -1
- package/dist/lib/state-io.js +9 -10
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +5 -11
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +7 -8
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/summarize-plan.d.ts +0 -1
- package/dist/lib/summarize-plan.js +3 -3
- package/dist/lib/test-execution.d.ts +14 -0
- package/dist/lib/{benchmark-execution.js → test-execution.js} +122 -120
- package/dist/lib/test-matrices.d.ts +90 -0
- package/dist/lib/test-matrices.js +96 -0
- package/dist/lib/test-paths.d.ts +12 -0
- package/dist/lib/test-paths.js +44 -0
- package/dist/lib/test-profile-presets.d.ts +57 -0
- package/dist/lib/test-profile-presets.js +50 -0
- package/dist/lib/test-sandbox.d.ts +11 -0
- package/dist/lib/{benchmark-sandbox.js → test-sandbox.js} +18 -13
- package/dist/lib/test-specs.d.ts +7 -0
- package/dist/lib/test-specs.js +114 -0
- package/dist/lib/test-targets.d.ts +5 -0
- package/dist/lib/test-targets.js +38 -0
- package/dist/lib/test-types.d.ts +17 -0
- package/dist/lib/test-types.js +1 -0
- package/dist/lib/test.d.ts +4 -0
- package/dist/lib/test.js +3 -0
- package/dist/lib/user-config.d.ts +0 -1
- package/dist/lib/user-config.js +0 -1
- package/dist/lib/util.d.ts +0 -2
- package/dist/lib/util.js +0 -2
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate-workspace.d.ts +0 -1
- package/dist/lib/validate-workspace.js +34 -25
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +55 -9
- package/dist/lib/workflow-abi.d.ts +138 -0
- package/dist/lib/workflow-abi.js +181 -0
- package/dist/lib/workflow-definitions.d.ts +26 -5
- package/dist/lib/workflow-definitions.js +105 -168
- package/dist/lib/workflow-helpers.d.ts +1 -2
- package/dist/lib/workflow-helpers.js +32 -21
- package/dist/lib/workflow-improvement.d.ts +22 -0
- package/dist/lib/workflow-improvement.js +396 -0
- package/dist/lib/workflow-review-paths.d.ts +10 -0
- package/dist/lib/workflow-review-paths.js +27 -0
- package/dist/lib/workflow-stage-runner.d.ts +1 -1
- package/dist/lib/workflow-stage-runner.js +4 -1
- package/dist/lib/workflows.d.ts +1 -2
- package/dist/lib/workflows.js +1 -2
- package/dist/lib/workspace-compile.d.ts +0 -1
- package/dist/lib/workspace-compile.js +146 -109
- package/dist/lib/workspace-home.d.ts +5 -0
- package/dist/lib/workspace-home.js +32 -0
- package/dist/lib/workspace-layout.d.ts +2 -0
- package/dist/lib/workspace-layout.js +60 -0
- package/dist/lib/workspace-paths.d.ts +41 -0
- package/dist/lib/workspace-paths.js +107 -0
- package/dist/lib/workspace-raw.d.ts +20 -2
- package/dist/lib/workspace-raw.js +6 -8
- package/dist/lib/workspace-reset.d.ts +0 -1
- package/dist/lib/workspace-reset.js +27 -5
- package/dist/lib/workspace-schema.d.ts +1 -10
- package/dist/lib/workspace-schema.js +16 -74
- package/package.json +16 -15
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/create-workflow-wizard.d.ts.map +0 -1
- package/dist/commands/create-workflow-wizard.js.map +0 -1
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/default.d.ts.map +0 -1
- package/dist/commands/default.js.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/executor-flow.d.ts.map +0 -1
- package/dist/commands/executor-flow.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js.map +0 -1
- package/dist/commands/source-config-wizard.d.ts.map +0 -1
- package/dist/commands/source-config-wizard.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/test-flow.d.ts.map +0 -1
- package/dist/commands/test-flow.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/verify.d.ts.map +0 -1
- package/dist/commands/verify.js.map +0 -1
- package/dist/commands/workspace-flow.d.ts.map +0 -1
- package/dist/commands/workspace-flow.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/agent-args.d.ts.map +0 -1
- package/dist/lib/agent-args.js.map +0 -1
- package/dist/lib/agent-constants.d.ts.map +0 -1
- package/dist/lib/agent-constants.js.map +0 -1
- package/dist/lib/agent-detection.d.ts.map +0 -1
- package/dist/lib/agent-detection.js.map +0 -1
- package/dist/lib/agent-execution.d.ts.map +0 -1
- package/dist/lib/agent-execution.js.map +0 -1
- package/dist/lib/agent-logs.d.ts.map +0 -1
- package/dist/lib/agent-logs.js.map +0 -1
- package/dist/lib/agent-preflight.d.ts.map +0 -1
- package/dist/lib/agent-preflight.js.map +0 -1
- package/dist/lib/agent-render.d.ts.map +0 -1
- package/dist/lib/agent-render.js.map +0 -1
- package/dist/lib/agent-shells.d.ts.map +0 -1
- package/dist/lib/agent-shells.js.map +0 -1
- package/dist/lib/agent-skills.d.ts +0 -21
- package/dist/lib/agent-skills.d.ts.map +0 -1
- package/dist/lib/agent-skills.js +0 -215
- package/dist/lib/agent-skills.js.map +0 -1
- package/dist/lib/agent-status.d.ts.map +0 -1
- package/dist/lib/agent-status.js.map +0 -1
- package/dist/lib/agent-types.d.ts.map +0 -1
- package/dist/lib/agent-types.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/benchmark-execution.d.ts +0 -13
- package/dist/lib/benchmark-execution.d.ts.map +0 -1
- package/dist/lib/benchmark-execution.js.map +0 -1
- package/dist/lib/benchmark-paths.d.ts +0 -13
- package/dist/lib/benchmark-paths.d.ts.map +0 -1
- package/dist/lib/benchmark-paths.js +0 -44
- package/dist/lib/benchmark-paths.js.map +0 -1
- package/dist/lib/benchmark-sandbox.d.ts +0 -12
- package/dist/lib/benchmark-sandbox.d.ts.map +0 -1
- package/dist/lib/benchmark-sandbox.js.map +0 -1
- package/dist/lib/benchmark-specs.d.ts +0 -8
- package/dist/lib/benchmark-specs.d.ts.map +0 -1
- package/dist/lib/benchmark-specs.js +0 -115
- package/dist/lib/benchmark-specs.js.map +0 -1
- package/dist/lib/benchmark-targets.d.ts +0 -5
- package/dist/lib/benchmark-targets.d.ts.map +0 -1
- package/dist/lib/benchmark-targets.js +0 -38
- package/dist/lib/benchmark-targets.js.map +0 -1
- package/dist/lib/benchmark-types.d.ts +0 -18
- package/dist/lib/benchmark-types.d.ts.map +0 -1
- package/dist/lib/benchmark-types.js +0 -2
- package/dist/lib/benchmark-types.js.map +0 -1
- package/dist/lib/benchmark.d.ts +0 -5
- package/dist/lib/benchmark.d.ts.map +0 -1
- package/dist/lib/benchmark.js +0 -4
- package/dist/lib/benchmark.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/discovery.d.ts.map +0 -1
- package/dist/lib/discovery.js.map +0 -1
- package/dist/lib/eval-packs.d.ts +0 -158
- package/dist/lib/eval-packs.d.ts.map +0 -1
- package/dist/lib/eval-packs.js +0 -149
- package/dist/lib/eval-packs.js.map +0 -1
- package/dist/lib/execution-profile.d.ts.map +0 -1
- package/dist/lib/execution-profile.js.map +0 -1
- package/dist/lib/executors.d.ts.map +0 -1
- package/dist/lib/executors.js.map +0 -1
- package/dist/lib/filesystem.d.ts.map +0 -1
- package/dist/lib/filesystem.js.map +0 -1
- package/dist/lib/interf-bootstrap.d.ts.map +0 -1
- package/dist/lib/interf-bootstrap.js.map +0 -1
- package/dist/lib/interf-detect.d.ts.map +0 -1
- package/dist/lib/interf-detect.js.map +0 -1
- package/dist/lib/interf-scaffold.d.ts.map +0 -1
- package/dist/lib/interf-scaffold.js.map +0 -1
- package/dist/lib/interf-workflow-package.d.ts.map +0 -1
- package/dist/lib/interf-workflow-package.js.map +0 -1
- package/dist/lib/interf.d.ts.map +0 -1
- package/dist/lib/interf.js.map +0 -1
- package/dist/lib/local-workflows.d.ts.map +0 -1
- package/dist/lib/local-workflows.js.map +0 -1
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/obsidian.d.ts.map +0 -1
- package/dist/lib/obsidian.js.map +0 -1
- package/dist/lib/parse.d.ts.map +0 -1
- package/dist/lib/parse.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/runtime-acceptance.d.ts.map +0 -1
- package/dist/lib/runtime-acceptance.js.map +0 -1
- package/dist/lib/runtime-contracts.d.ts.map +0 -1
- package/dist/lib/runtime-contracts.js.map +0 -1
- package/dist/lib/runtime-paths.d.ts.map +0 -1
- package/dist/lib/runtime-paths.js.map +0 -1
- package/dist/lib/runtime-prompt.d.ts.map +0 -1
- package/dist/lib/runtime-prompt.js.map +0 -1
- package/dist/lib/runtime-reconcile.d.ts.map +0 -1
- package/dist/lib/runtime-reconcile.js.map +0 -1
- package/dist/lib/runtime-runs.d.ts.map +0 -1
- package/dist/lib/runtime-runs.js.map +0 -1
- package/dist/lib/runtime-types.d.ts.map +0 -1
- package/dist/lib/runtime-types.js.map +0 -1
- package/dist/lib/runtime.d.ts.map +0 -1
- package/dist/lib/runtime.js.map +0 -1
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/schema.js.map +0 -1
- package/dist/lib/source-config.d.ts.map +0 -1
- package/dist/lib/source-config.js.map +0 -1
- package/dist/lib/state-artifacts.d.ts.map +0 -1
- package/dist/lib/state-artifacts.js.map +0 -1
- package/dist/lib/state-health.d.ts.map +0 -1
- package/dist/lib/state-health.js.map +0 -1
- package/dist/lib/state-io.d.ts.map +0 -1
- package/dist/lib/state-io.js.map +0 -1
- package/dist/lib/state-paths.d.ts.map +0 -1
- package/dist/lib/state-paths.js.map +0 -1
- package/dist/lib/state-view.d.ts.map +0 -1
- package/dist/lib/state-view.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/summarize-plan.d.ts.map +0 -1
- package/dist/lib/summarize-plan.js.map +0 -1
- package/dist/lib/user-config.d.ts.map +0 -1
- package/dist/lib/user-config.js.map +0 -1
- package/dist/lib/util.d.ts.map +0 -1
- package/dist/lib/util.js.map +0 -1
- package/dist/lib/validate-helpers.d.ts.map +0 -1
- package/dist/lib/validate-helpers.js.map +0 -1
- package/dist/lib/validate-workspace.d.ts.map +0 -1
- package/dist/lib/validate-workspace.js.map +0 -1
- package/dist/lib/validate.d.ts.map +0 -1
- package/dist/lib/validate.js.map +0 -1
- package/dist/lib/workflow-definitions.d.ts.map +0 -1
- package/dist/lib/workflow-definitions.js.map +0 -1
- package/dist/lib/workflow-helpers.d.ts.map +0 -1
- package/dist/lib/workflow-helpers.js.map +0 -1
- package/dist/lib/workflow-stage-runner.d.ts.map +0 -1
- package/dist/lib/workflow-stage-runner.js.map +0 -1
- package/dist/lib/workflow-starter-docs.d.ts +0 -7
- package/dist/lib/workflow-starter-docs.d.ts.map +0 -1
- package/dist/lib/workflow-starter-docs.js +0 -3
- package/dist/lib/workflow-starter-docs.js.map +0 -1
- package/dist/lib/workflows.d.ts.map +0 -1
- package/dist/lib/workflows.js.map +0 -1
- package/dist/lib/workspace-compile.d.ts.map +0 -1
- package/dist/lib/workspace-compile.js.map +0 -1
- package/dist/lib/workspace-docs.d.ts +0 -3
- package/dist/lib/workspace-docs.d.ts.map +0 -1
- package/dist/lib/workspace-docs.js +0 -82
- package/dist/lib/workspace-docs.js.map +0 -1
- package/dist/lib/workspace-raw.d.ts.map +0 -1
- package/dist/lib/workspace-raw.js.map +0 -1
- package/dist/lib/workspace-reset.d.ts.map +0 -1
- package/dist/lib/workspace-reset.js.map +0 -1
- package/dist/lib/workspace-schema.d.ts.map +0 -1
- package/dist/lib/workspace-schema.js.map +0 -1
- package/skills/benchmark/SKILL.md +0 -122
- package/skills/workflow/create/SKILL.md +0 -141
- package/skills/workspace/shape/SKILL.md +0 -15
- package/skills/workspace/structure/SKILL.md +0 -15
- package/skills/workspace/summarize/SKILL.md +0 -15
- package/templates/workspace/README.md +0 -24
- package/templates/workspace/interfignore +0 -2
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import { ensureRequiredSkill, extractRequiredSkill, } from "./agent-skills.js";
|
|
4
3
|
import { CODEX_NOISE_PATTERNS } from "./agent-constants.js";
|
|
5
4
|
import { buildAgentArgs } from "./agent-args.js";
|
|
6
5
|
import { appendAgentEventLog, appendAgentStatusLog } from "./agent-logs.js";
|
|
7
6
|
import { displayAgentEvent, emitVisibleAgentText, summarizeAgentToolActivity, } from "./agent-render.js";
|
|
8
7
|
import { classifyTerminalVisibleStatus, extractAgentFailureStatus, hasAgentStalled, } from "./agent-status.js";
|
|
8
|
+
const STOP_SIGNAL_GRACE_MS = 1500;
|
|
9
9
|
export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
10
|
-
const requiredSkill = extractRequiredSkill(prompt);
|
|
11
|
-
const skillError = ensureRequiredSkill(agent, requiredSkill);
|
|
12
|
-
if (skillError) {
|
|
13
|
-
console.log(chalk.red(` ${skillError}`));
|
|
14
|
-
return Promise.resolve(1);
|
|
15
|
-
}
|
|
16
10
|
return new Promise((resolve) => {
|
|
17
11
|
const args = buildAgentArgs(agent, prompt, options.executionProfile);
|
|
18
12
|
appendAgentEventLog(options.eventLogPath, {
|
|
@@ -41,7 +35,47 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
41
35
|
let failureStatus = null;
|
|
42
36
|
let terminalSignalSent = false;
|
|
43
37
|
let lastToolActivity = null;
|
|
38
|
+
let stopPhase = "running";
|
|
39
|
+
let stopTimer = null;
|
|
44
40
|
const lastVisibleText = { current: null };
|
|
41
|
+
const clearStopTimer = () => {
|
|
42
|
+
if (!stopTimer)
|
|
43
|
+
return;
|
|
44
|
+
clearTimeout(stopTimer);
|
|
45
|
+
stopTimer = null;
|
|
46
|
+
};
|
|
47
|
+
const requestProcessStop = (signal = "SIGINT") => {
|
|
48
|
+
if (proc.exitCode != null)
|
|
49
|
+
return;
|
|
50
|
+
if (signal === "SIGINT") {
|
|
51
|
+
if (stopPhase !== "running")
|
|
52
|
+
return;
|
|
53
|
+
stopPhase = "sigint";
|
|
54
|
+
}
|
|
55
|
+
else if (signal === "SIGTERM") {
|
|
56
|
+
if (stopPhase === "sigterm" || stopPhase === "sigkill")
|
|
57
|
+
return;
|
|
58
|
+
stopPhase = "sigterm";
|
|
59
|
+
}
|
|
60
|
+
else if (signal === "SIGKILL") {
|
|
61
|
+
if (stopPhase === "sigkill")
|
|
62
|
+
return;
|
|
63
|
+
stopPhase = "sigkill";
|
|
64
|
+
}
|
|
65
|
+
appendAgentEventLog(options.eventLogPath, {
|
|
66
|
+
type: "signal",
|
|
67
|
+
signal,
|
|
68
|
+
});
|
|
69
|
+
proc.kill(signal);
|
|
70
|
+
clearStopTimer();
|
|
71
|
+
if (signal === "SIGKILL")
|
|
72
|
+
return;
|
|
73
|
+
stopTimer = setTimeout(() => {
|
|
74
|
+
if (proc.exitCode != null)
|
|
75
|
+
return;
|
|
76
|
+
requestProcessStop(signal === "SIGINT" ? "SIGTERM" : "SIGKILL");
|
|
77
|
+
}, STOP_SIGNAL_GRACE_MS);
|
|
78
|
+
};
|
|
45
79
|
const heartbeat = setInterval(() => {
|
|
46
80
|
const now = Date.now();
|
|
47
81
|
const minQuietMs = sawVisibleEvent ? 15000 : 8000;
|
|
@@ -62,7 +96,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
62
96
|
appendAgentStatusLog(options.statusLogPath, label);
|
|
63
97
|
}, 5000);
|
|
64
98
|
const forwardSignal = () => {
|
|
65
|
-
|
|
99
|
+
requestProcessStop("SIGINT");
|
|
66
100
|
};
|
|
67
101
|
const maybeInterruptAfterTerminalStatus = () => {
|
|
68
102
|
if (options.completionCheck)
|
|
@@ -81,7 +115,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
81
115
|
else if (terminalKind === "failure") {
|
|
82
116
|
failureStatus ||= lastVisibleText.terminalStatus;
|
|
83
117
|
}
|
|
84
|
-
|
|
118
|
+
requestProcessStop("SIGINT");
|
|
85
119
|
};
|
|
86
120
|
const timeout = typeof timeoutMs === "number" && timeoutMs > 0
|
|
87
121
|
? setInterval(() => {
|
|
@@ -96,7 +130,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
96
130
|
idle_ms: idleMs,
|
|
97
131
|
});
|
|
98
132
|
console.log(chalk.red(` ${agent.displayName} stalled for ${Math.round(idleMs / 1000)}s without agent output.`));
|
|
99
|
-
|
|
133
|
+
requestProcessStop("SIGINT");
|
|
100
134
|
}, 2000)
|
|
101
135
|
: null;
|
|
102
136
|
const completionPoll = options.completionCheck
|
|
@@ -110,7 +144,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
110
144
|
appendAgentEventLog(options.eventLogPath, {
|
|
111
145
|
type: "completion-check-satisfied",
|
|
112
146
|
});
|
|
113
|
-
|
|
147
|
+
requestProcessStop("SIGINT");
|
|
114
148
|
}
|
|
115
149
|
catch {
|
|
116
150
|
// Ignore completion check failures and let the agent continue.
|
|
@@ -179,6 +213,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
179
213
|
clearInterval(timeout);
|
|
180
214
|
if (completionPoll)
|
|
181
215
|
clearInterval(completionPoll);
|
|
216
|
+
clearStopTimer();
|
|
182
217
|
process.removeListener("SIGINT", forwardSignal);
|
|
183
218
|
const finalCode = timedOut ? 124 : failureStatus ? 1 : completionSatisfied ? 0 : (code ?? 0);
|
|
184
219
|
appendAgentEventLog(options.eventLogPath, {
|
|
@@ -194,6 +229,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
194
229
|
clearInterval(timeout);
|
|
195
230
|
if (completionPoll)
|
|
196
231
|
clearInterval(completionPoll);
|
|
232
|
+
clearStopTimer();
|
|
197
233
|
process.removeListener("SIGINT", forwardSignal);
|
|
198
234
|
appendAgentEventLog(options.eventLogPath, {
|
|
199
235
|
type: "error",
|
|
@@ -204,4 +240,3 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
204
240
|
});
|
|
205
241
|
});
|
|
206
242
|
}
|
|
207
|
-
//# sourceMappingURL=agent-execution.js.map
|
package/dist/lib/agent-logs.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export declare function appendAgentEventLog(eventLogPath: string | null | undefined, event: Record<string, unknown>): void;
|
|
2
2
|
export declare function appendAgentStatusLog(statusLogPath: string | null | undefined, text: string): void;
|
|
3
|
-
//# sourceMappingURL=agent-logs.d.ts.map
|
package/dist/lib/agent-logs.js
CHANGED
|
@@ -15,7 +15,7 @@ export function buildAgentPreflightPrompt() {
|
|
|
15
15
|
].join(" ");
|
|
16
16
|
}
|
|
17
17
|
export function runAgentPreflight(agent, options = {}) {
|
|
18
|
-
const timeoutMs = options.timeoutMs ??
|
|
18
|
+
const timeoutMs = options.timeoutMs ?? 60000;
|
|
19
19
|
const spawnSyncImpl = options.spawnSyncImpl ?? spawnSync;
|
|
20
20
|
const dirPath = mkdtempSync(join(tmpdir(), "interf-doctor-"));
|
|
21
21
|
try {
|
|
@@ -74,4 +74,3 @@ function sanitizeAgentStderr(stderr) {
|
|
|
74
74
|
.join("\n")
|
|
75
75
|
.trim();
|
|
76
76
|
}
|
|
77
|
-
//# sourceMappingURL=agent-preflight.js.map
|
|
@@ -6,4 +6,3 @@ export interface VisibleTextState {
|
|
|
6
6
|
export declare function emitVisibleAgentText(text: string, statusLogPath: string | null | undefined, lastVisibleText?: VisibleTextState): boolean;
|
|
7
7
|
export declare function displayAgentEvent(event: Record<string, unknown>, statusLogPath: string | null | undefined, lastVisibleText: VisibleTextState): boolean;
|
|
8
8
|
export declare function summarizeAgentToolActivity(event: Record<string, unknown>): string | null;
|
|
9
|
-
//# sourceMappingURL=agent-render.d.ts.map
|
package/dist/lib/agent-render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeContractType, WorkflowZoneId } from "./schema.js";
|
|
1
|
+
import type { RuntimeContractType, WorkflowImprovementContext, WorkflowZoneId } from "./schema.js";
|
|
2
2
|
export interface NativeStageDefinition {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
@@ -8,10 +8,37 @@ export interface NativeStageDefinition {
|
|
|
8
8
|
reads: WorkflowZoneId[];
|
|
9
9
|
writes: WorkflowZoneId[];
|
|
10
10
|
}
|
|
11
|
+
export declare function renderWorkspaceAgents(name: string, workflowId: string, about?: string, options?: {
|
|
12
|
+
workflowOriginSelected?: string | null;
|
|
13
|
+
workflowLocalDraft?: boolean;
|
|
14
|
+
}): string;
|
|
15
|
+
export declare function renderWorkspaceQuerySkill(): string;
|
|
16
|
+
export declare function syncStageExecutionShellWrites(workspacePath: string, shellRoot: string, stage: NativeStageDefinition): void;
|
|
11
17
|
export declare function renderClaudeBootstrap(content: string): string;
|
|
12
18
|
export declare function pruneStageExecutionShells(workspacePath: string): void;
|
|
13
|
-
export declare function projectWorkspaceQueryShell(workspacePath: string, workspaceName: string, workflowId: string, about?: string
|
|
19
|
+
export declare function projectWorkspaceQueryShell(workspacePath: string, workspaceName: string, workflowId: string, about?: string, options?: {
|
|
20
|
+
workflowOriginSelected?: string | null;
|
|
21
|
+
workflowLocalDraft?: boolean;
|
|
22
|
+
}): boolean;
|
|
23
|
+
export declare function projectRawTestQueryShell(rootPath: string): boolean;
|
|
14
24
|
export declare function createStageExecutionShell(workspacePath: string, workspaceName: string, workflowId: string, stage: NativeStageDefinition): {
|
|
15
25
|
rootPath: string;
|
|
16
26
|
};
|
|
17
|
-
|
|
27
|
+
export declare function freezeStageExecutionShell(rootPath: string): string | null;
|
|
28
|
+
export declare function createWorkflowImprovementShell(options: {
|
|
29
|
+
workspacePath: string;
|
|
30
|
+
workspaceName: string;
|
|
31
|
+
workflowId: string;
|
|
32
|
+
runId: string;
|
|
33
|
+
loopIndex: number;
|
|
34
|
+
context: WorkflowImprovementContext;
|
|
35
|
+
}): {
|
|
36
|
+
rootPath: string;
|
|
37
|
+
loopRootPath: string;
|
|
38
|
+
workflowBeforePath: string;
|
|
39
|
+
workflowAfterPath: string;
|
|
40
|
+
promptLogPath: string;
|
|
41
|
+
eventLogPath: string;
|
|
42
|
+
statusLogPath: string;
|
|
43
|
+
};
|
|
44
|
+
export declare function freezeWorkflowImprovementShell(rootPath: string): string | null;
|