@interf/compiler 0.5.1 → 0.6.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 +126 -187
- package/builtin-workflows/interf/README.md +22 -10
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +6 -3
- 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 +2 -2
- package/builtin-workflows/interf/workflow.json +18 -4
- package/builtin-workflows/interf/{compiled.schema.json → workflow.schema.json} +9 -2
- package/dist/commands/check-draft.js +3 -3
- package/dist/commands/compile-controller.js +6 -13
- package/dist/commands/compile.d.ts +19 -1
- package/dist/commands/compile.js +98 -28
- package/dist/commands/create-workflow-wizard.d.ts +20 -2
- package/dist/commands/create-workflow-wizard.js +163 -27
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.js +67 -60
- package/dist/commands/dataset-selection.d.ts +6 -0
- package/dist/commands/dataset-selection.js +11 -0
- package/dist/commands/default.js +3 -3
- package/dist/commands/doctor.js +8 -8
- package/dist/commands/executor-flow.d.ts +1 -1
- package/dist/commands/executor-flow.js +5 -2
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.js +56 -48
- package/dist/commands/list.js +6 -3
- package/dist/commands/reset.js +1 -1
- package/dist/commands/source-config-wizard.d.ts +2 -2
- package/dist/commands/source-config-wizard.js +50 -17
- package/dist/commands/test.d.ts +0 -6
- package/dist/commands/test.js +9 -17
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/agent-args.d.ts +1 -0
- package/dist/lib/agent-args.js +10 -0
- package/dist/lib/agent-execution.js +2 -1
- package/dist/lib/agent-preflight.js +2 -1
- package/dist/lib/agent-shells.d.ts +26 -1
- package/dist/lib/agent-shells.js +213 -39
- package/dist/lib/agents.d.ts +1 -1
- package/dist/lib/agents.js +1 -1
- package/dist/lib/builtin-compiled-workflow.d.ts +6 -97
- package/dist/lib/builtin-compiled-workflow.js +66 -125
- package/dist/lib/compiled-compile.d.ts +0 -4
- package/dist/lib/compiled-compile.js +9 -28
- package/dist/lib/compiled-paths.d.ts +1 -0
- package/dist/lib/compiled-paths.js +3 -0
- package/dist/lib/compiled-reset.d.ts +1 -0
- package/dist/lib/compiled-reset.js +42 -14
- package/dist/lib/compiled-schema.d.ts +9 -5
- package/dist/lib/compiled-schema.js +45 -14
- package/dist/lib/discovery.d.ts +1 -1
- package/dist/lib/discovery.js +2 -2
- package/dist/lib/executors.d.ts +1 -1
- package/dist/lib/executors.js +2 -2
- package/dist/lib/interf-scaffold.js +4 -11
- package/dist/lib/interf-workflow-package.d.ts +8 -3
- package/dist/lib/interf-workflow-package.js +128 -62
- package/dist/lib/local-workflows.d.ts +4 -3
- package/dist/lib/local-workflows.js +126 -103
- package/dist/lib/runtime-acceptance.js +15 -3
- package/dist/lib/runtime-contracts.js +3 -2
- package/dist/lib/runtime-paths.d.ts +1 -0
- package/dist/lib/runtime-paths.js +4 -1
- package/dist/lib/runtime-prompt.js +3 -1
- package/dist/lib/runtime-reconcile.js +88 -51
- package/dist/lib/runtime-runs.js +27 -15
- package/dist/lib/runtime.d.ts +1 -1
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/schema.d.ts +71 -14
- package/dist/lib/schema.js +15 -12
- package/dist/lib/state-view.js +6 -6
- package/dist/lib/state.d.ts +1 -0
- package/dist/lib/state.js +7 -0
- package/dist/lib/test-execution.js +2 -2
- package/dist/lib/validate-compiled.js +9 -6
- package/dist/lib/validate.d.ts +3 -1
- package/dist/lib/validate.js +4 -11
- package/dist/lib/workflow-authoring.d.ts +26 -0
- package/dist/lib/workflow-authoring.js +119 -0
- package/dist/lib/workflow-definitions.d.ts +11 -1
- package/dist/lib/workflow-definitions.js +12 -15
- package/dist/lib/workflow-edit-session.d.ts +16 -0
- package/dist/lib/workflow-edit-session.js +57 -0
- package/dist/lib/workflow-edit-utils.d.ts +10 -0
- package/dist/lib/workflow-edit-utils.js +39 -0
- package/dist/lib/workflow-improvement.js +30 -217
- package/dist/lib/workflow-stage-policy.d.ts +5 -0
- package/dist/lib/workflow-stage-policy.js +31 -0
- package/package.json +4 -5
- 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
|
@@ -8,10 +8,11 @@ import { draftTruthChecks } from "./check-draft.js";
|
|
|
8
8
|
export const DEFAULT_COMPILED_NAME = "dataset1";
|
|
9
9
|
export const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "A question you can already verify from this dataset";
|
|
10
10
|
export const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
|
|
11
|
-
export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example:
|
|
11
|
+
export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board-prep questions from these files, chart reads from this report, or tax review from these exports.";
|
|
12
12
|
export const DEFAULT_DATASET_PATH_PLACEHOLDER = "./dataset1";
|
|
13
|
-
export const DEFAULT_COMPILE_RETRY_ATTEMPTS =
|
|
13
|
+
export const DEFAULT_COMPILE_RETRY_ATTEMPTS = 3;
|
|
14
14
|
export const DEFAULT_SELF_IMPROVING_LOOPS = 3;
|
|
15
|
+
const DEFAULT_SELF_IMPROVING_ATTEMPTS = 1;
|
|
15
16
|
function normalizeOptionalPromptText(value) {
|
|
16
17
|
if (typeof value !== "string")
|
|
17
18
|
return undefined;
|
|
@@ -75,9 +76,9 @@ export function defaultDatasetPathForPrompt(name, introStyle, cwd = process.cwd(
|
|
|
75
76
|
}
|
|
76
77
|
export function datasetAboutPromptMessage(introStyle) {
|
|
77
78
|
if (introStyle === "edit") {
|
|
78
|
-
return "What should this dataset stay
|
|
79
|
+
return "What task should this dataset stay focused on?";
|
|
79
80
|
}
|
|
80
|
-
return "What should this dataset
|
|
81
|
+
return "What task should this dataset help with?";
|
|
81
82
|
}
|
|
82
83
|
function formatAttemptLabel(count, noun) {
|
|
83
84
|
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
@@ -95,10 +96,29 @@ export function describeCompileLoopSelection(options) {
|
|
|
95
96
|
return "Compile once.";
|
|
96
97
|
}
|
|
97
98
|
if (mode === "retry") {
|
|
98
|
-
|
|
99
|
+
const attempts = options.maxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS;
|
|
100
|
+
return `Compile retries are enabled for this dataset (${formatAttemptLabel(attempts, "total attempt")}).`;
|
|
99
101
|
}
|
|
100
102
|
const loops = options.maxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS;
|
|
101
|
-
|
|
103
|
+
const attempts = options.maxAttempts ?? DEFAULT_SELF_IMPROVING_ATTEMPTS;
|
|
104
|
+
return `Self-improving loops are enabled for this dataset (${formatAttemptLabel(attempts, "attempt")} per variation, ${formatAttemptLabel(loops, "workflow revision")}).`;
|
|
105
|
+
}
|
|
106
|
+
async function promptCompileRetryAttempts(options) {
|
|
107
|
+
const maxAttempts = await p.text({
|
|
108
|
+
message: options.message,
|
|
109
|
+
placeholder: String(DEFAULT_COMPILE_RETRY_ATTEMPTS),
|
|
110
|
+
initialValue: String(options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS),
|
|
111
|
+
validate: (value) => {
|
|
112
|
+
const parsed = Number.parseInt(value.trim(), 10);
|
|
113
|
+
if (!Number.isInteger(parsed) || parsed < 2 || parsed > 5) {
|
|
114
|
+
return "Enter a whole number from 2 to 5";
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
if (p.isCancel(maxAttempts))
|
|
120
|
+
return null;
|
|
121
|
+
return compiledMaxAttempts(Number.parseInt(String(maxAttempts).trim(), 10)) ?? DEFAULT_COMPILE_RETRY_ATTEMPTS;
|
|
102
122
|
}
|
|
103
123
|
export async function promptCheckCases(options) {
|
|
104
124
|
p.log.info(options.heading);
|
|
@@ -263,7 +283,7 @@ async function promptCompiledChecks(options) {
|
|
|
263
283
|
if (options.initialAbout) {
|
|
264
284
|
p.log.info(`About: ${options.initialAbout}`);
|
|
265
285
|
}
|
|
266
|
-
p.log.info("Truth checks are the questions
|
|
286
|
+
p.log.info("Truth checks are the questions an agent should be able to answer from the data behind this task.");
|
|
267
287
|
const mode = await p.select({
|
|
268
288
|
message: "How do you want to create them?",
|
|
269
289
|
options: [
|
|
@@ -420,8 +440,8 @@ export async function promptCompileLoopSelection(options) {
|
|
|
420
440
|
return {};
|
|
421
441
|
}
|
|
422
442
|
const currentMode = resolveCompileLoopMode(options.initialMaxAttempts, options.initialMaxLoops);
|
|
423
|
-
const currentPromptMode = currentMode
|
|
424
|
-
const recommendedMode = options.recommendedMode ?? "
|
|
443
|
+
const currentPromptMode = currentMode;
|
|
444
|
+
const recommendedMode = options.recommendedMode ?? "once";
|
|
425
445
|
const includeCompileOnce = options.includeCompileOnce !== false;
|
|
426
446
|
const hasSavedPolicy = typeof options.initialMaxAttempts === "number" ||
|
|
427
447
|
typeof options.initialMaxLoops === "number";
|
|
@@ -447,18 +467,20 @@ export async function promptCompileLoopSelection(options) {
|
|
|
447
467
|
},
|
|
448
468
|
retry: {
|
|
449
469
|
value: "retry",
|
|
450
|
-
label: "
|
|
451
|
-
hint:
|
|
470
|
+
label: "Retry same workflow",
|
|
471
|
+
hint: `Retry compile and compiled-side truth checks up to ${options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS} total time${(options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS) === 1 ? "" : "s"} without editing the workflow`,
|
|
452
472
|
},
|
|
453
473
|
};
|
|
454
474
|
const orderedModes = (hasSavedPolicy
|
|
455
475
|
? [
|
|
456
476
|
currentPromptMode,
|
|
457
477
|
...(recommendedMode !== currentPromptMode ? [recommendedMode] : []),
|
|
478
|
+
"retry",
|
|
458
479
|
"once",
|
|
459
480
|
]
|
|
460
481
|
: [
|
|
461
482
|
recommendedMode,
|
|
483
|
+
"retry",
|
|
462
484
|
"once",
|
|
463
485
|
]).filter((mode, index, list) => list.indexOf(mode) === index)
|
|
464
486
|
.filter((mode) => includeCompileOnce || mode !== "once");
|
|
@@ -471,6 +493,17 @@ export async function promptCompileLoopSelection(options) {
|
|
|
471
493
|
if (selectedMode === "once") {
|
|
472
494
|
return {};
|
|
473
495
|
}
|
|
496
|
+
if (selectedMode === "retry") {
|
|
497
|
+
const maxAttempts = await promptCompileRetryAttempts({
|
|
498
|
+
initialMaxAttempts: options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS,
|
|
499
|
+
message: "How many total attempts should Interf try before stopping?",
|
|
500
|
+
});
|
|
501
|
+
if (maxAttempts === null)
|
|
502
|
+
return null;
|
|
503
|
+
return {
|
|
504
|
+
max_attempts: maxAttempts,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
474
507
|
const maxLoops = await promptSelfImprovingLoops({
|
|
475
508
|
initialMaxLoops: options.initialMaxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS,
|
|
476
509
|
message: "How many workflow revisions should Interf try?",
|
|
@@ -478,7 +511,7 @@ export async function promptCompileLoopSelection(options) {
|
|
|
478
511
|
if (maxLoops === null)
|
|
479
512
|
return null;
|
|
480
513
|
return {
|
|
481
|
-
max_attempts:
|
|
514
|
+
max_attempts: DEFAULT_SELF_IMPROVING_ATTEMPTS,
|
|
482
515
|
max_loops: maxLoops,
|
|
483
516
|
};
|
|
484
517
|
}
|
|
@@ -487,7 +520,7 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
487
520
|
const introStyle = options.introStyle ?? "first";
|
|
488
521
|
if (introStyle === "first") {
|
|
489
522
|
p.log.info("Pick the dataset folder you want to measure.");
|
|
490
|
-
p.log.info("Then say what this dataset should
|
|
523
|
+
p.log.info("Then say what task this dataset should help with and save a few truth checks you can verify.");
|
|
491
524
|
}
|
|
492
525
|
else if (introStyle === "additional") {
|
|
493
526
|
p.log.info("Add another dataset only if this project needs a separate folder or set of truth checks.");
|
|
@@ -544,6 +577,9 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
544
577
|
if (p.isCancel(datasetPath))
|
|
545
578
|
return null;
|
|
546
579
|
const normalizedDatasetPath = String(datasetPath).trim();
|
|
580
|
+
if (options.selectedWorkflowLabel) {
|
|
581
|
+
p.log.info(`Workflow: ${options.selectedWorkflowLabel}`);
|
|
582
|
+
}
|
|
547
583
|
let compileLoopSelection = {
|
|
548
584
|
...(typeof initial?.max_attempts === "number" ? { max_attempts: initial.max_attempts } : {}),
|
|
549
585
|
...(typeof initial?.max_loops === "number" ? { max_loops: initial.max_loops } : {}),
|
|
@@ -573,11 +609,8 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
573
609
|
initialMaxLoops: initial?.max_loops,
|
|
574
610
|
hasChecks: checks.length > 0,
|
|
575
611
|
intro: [
|
|
576
|
-
...(options.selectedWorkflowLabel
|
|
577
|
-
? [`Workflow: ${options.selectedWorkflowLabel}`]
|
|
578
|
-
: []),
|
|
579
612
|
"Compile mode",
|
|
580
|
-
"Choose whether this dataset should compile once or
|
|
613
|
+
"Choose whether this dataset should compile once, retry the same workflow, or try self-improving workflow variations on the same truth checks.",
|
|
581
614
|
],
|
|
582
615
|
});
|
|
583
616
|
if (compileLoopSelection === null)
|
package/dist/commands/test.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
|
-
import type { SourceDatasetConfig } from "../lib/schema.js";
|
|
3
|
-
export declare function resolveConfiguredDatasetSelection(options: {
|
|
4
|
-
sourcePath: string;
|
|
5
|
-
requestedDatasetName?: string | null;
|
|
6
|
-
hintedDatasetConfig?: SourceDatasetConfig | null;
|
|
7
|
-
}): SourceDatasetConfig | null;
|
|
8
2
|
export declare const testCommand: CommandModule;
|
|
9
3
|
export declare function runTestCommand(argv?: Record<string, unknown>): Promise<boolean>;
|
package/dist/commands/test.js
CHANGED
|
@@ -3,19 +3,10 @@ import * as p from "@clack/prompts";
|
|
|
3
3
|
import { detectInterf, resolveSourceControlPath, } from "../lib/interf.js";
|
|
4
4
|
import { fingerprintTruthChecks, sourceDatasetConfigFromInterfConfig, } from "../lib/source-config.js";
|
|
5
5
|
import { addExecutionProfileOptions, executionProfileFromArgv, } from "../lib/execution-profile.js";
|
|
6
|
-
import { chooseCompiledConfigToBuild, findBuiltCompiledPath,
|
|
6
|
+
import { chooseCompiledConfigToBuild, findBuiltCompiledPath, } from "./compiled-flow.js";
|
|
7
|
+
import { resolveConfiguredDatasetSelection } from "./dataset-selection.js";
|
|
7
8
|
import { printAgentTestFailures, printAgentTestMatrix, printSavedTestComparisonState, readSavedTestComparison, runSavedRawTest, runSavedCompiledTest, saveTestComparisonRun, } from "./test-flow.js";
|
|
8
9
|
import { listRunAgentOptions, promptForTestAgents, resolveNamedLocalExecutor, resolveOrConfigureLocalExecutor, } from "./executor-flow.js";
|
|
9
|
-
export function resolveConfiguredDatasetSelection(options) {
|
|
10
|
-
if (options.hintedDatasetConfig &&
|
|
11
|
-
(!options.requestedDatasetName || options.hintedDatasetConfig.name === options.requestedDatasetName)) {
|
|
12
|
-
return options.hintedDatasetConfig;
|
|
13
|
-
}
|
|
14
|
-
if (!options.requestedDatasetName) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return findSavedCompiledConfig(options.sourcePath, options.requestedDatasetName);
|
|
18
|
-
}
|
|
19
10
|
export const testCommand = {
|
|
20
11
|
command: "test",
|
|
21
12
|
describe: "Compare files as-is and a compiled dataset on saved truth checks",
|
|
@@ -156,17 +147,17 @@ async function resolveSelectedTestAgents(options) {
|
|
|
156
147
|
];
|
|
157
148
|
}
|
|
158
149
|
async function runModeForAgent(options) {
|
|
159
|
-
const
|
|
160
|
-
?
|
|
150
|
+
const rawPromise = options.mode === "raw" || options.mode === "both"
|
|
151
|
+
? runSavedRawTest({
|
|
161
152
|
sourcePath: options.sourcePath,
|
|
162
153
|
datasetConfig: options.datasetConfig,
|
|
163
154
|
executor: options.executor,
|
|
164
155
|
preserveSandboxes: options.preserveSandboxes,
|
|
165
156
|
runSuffix: options.executor.name,
|
|
166
157
|
})
|
|
167
|
-
: null;
|
|
168
|
-
const
|
|
169
|
-
?
|
|
158
|
+
: Promise.resolve(null);
|
|
159
|
+
const compiledPromise = options.mode === "compiled" || options.mode === "both"
|
|
160
|
+
? runSavedCompiledTest({
|
|
170
161
|
sourcePath: options.sourcePath,
|
|
171
162
|
datasetConfig: options.datasetConfig,
|
|
172
163
|
compiledPath: options.builtCompiledPath,
|
|
@@ -174,7 +165,8 @@ async function runModeForAgent(options) {
|
|
|
174
165
|
preserveSandboxes: options.preserveSandboxes,
|
|
175
166
|
runSuffix: options.executor.name,
|
|
176
167
|
})
|
|
177
|
-
: null;
|
|
168
|
+
: Promise.resolve(null);
|
|
169
|
+
const [rawOutcome, compiledOutcome] = await Promise.all([rawPromise, compiledPromise]);
|
|
178
170
|
return {
|
|
179
171
|
agentLabel: options.executor.displayName,
|
|
180
172
|
rawOutcome,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createCompiled, compileCompiled, runCompiledSummarize, runCompiledCompile, } from "./lib/workflows.js";
|
|
2
|
-
export { createRawTestTarget, listTestSpecs, loadTestSpec, loadTestSpecFromFile, writeTestSpec, listTestTargets, runTargetTests, runTargetTestsWithJudge, runTargetTestsAuto, saveTargetTestRun, } from "./lib/test.js";
|
|
2
|
+
export { createRawTestTarget, createCompiledTestTarget, listTestSpecs, loadTestSpec, loadTestSpecFromFile, writeTestSpec, listTestTargets, runTargetTests, runTargetTestsWithJudge, runTargetTestsAuto, saveTargetTestRun, } from "./lib/test.js";
|
|
3
3
|
export { computeCompiledHealth, } from "./lib/state.js";
|
|
4
4
|
export { SOURCE_FOLDER_CONFIG_FILE, loadSourceFolderConfig, buildTestSpecFromSourceFolderConfig, } from "./lib/source-config.js";
|
|
5
5
|
export { validateCompiledSummarize, validateCompiledCompile, } from "./lib/validate.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createCompiled, compileCompiled, runCompiledSummarize, runCompiledCompile, } from "./lib/workflows.js";
|
|
2
|
-
export { createRawTestTarget, listTestSpecs, loadTestSpec, loadTestSpecFromFile, writeTestSpec, listTestTargets, runTargetTests, runTargetTestsWithJudge, runTargetTestsAuto, saveTargetTestRun, } from "./lib/test.js";
|
|
2
|
+
export { createRawTestTarget, createCompiledTestTarget, listTestSpecs, loadTestSpec, loadTestSpecFromFile, writeTestSpec, listTestTargets, runTargetTests, runTargetTestsWithJudge, runTargetTestsAuto, saveTargetTestRun, } from "./lib/test.js";
|
|
3
3
|
export { computeCompiledHealth, } from "./lib/state.js";
|
|
4
4
|
export { SOURCE_FOLDER_CONFIG_FILE, loadSourceFolderConfig, buildTestSpecFromSourceFolderConfig, } from "./lib/source-config.js";
|
|
5
5
|
export { validateCompiledSummarize, validateCompiledCompile, } from "./lib/validate.js";
|
package/dist/lib/agent-args.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { WorkflowExecutionProfile } from "./executors.js";
|
|
2
2
|
import type { Agent } from "./agent-types.js";
|
|
3
|
+
export declare function buildAgentEnv(agent: Agent, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
3
4
|
export declare function buildAgentArgs(agent: Agent, prompt: string, executionProfile?: WorkflowExecutionProfile): string[];
|
package/dist/lib/agent-args.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
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
|
+
}
|
|
2
12
|
export function buildAgentArgs(agent, prompt, executionProfile = {}) {
|
|
3
13
|
if (agent.name === "claude-code") {
|
|
4
14
|
const args = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { CODEX_NOISE_PATTERNS } from "./agent-constants.js";
|
|
4
|
-
import { buildAgentArgs } from "./agent-args.js";
|
|
4
|
+
import { buildAgentArgs, buildAgentEnv } from "./agent-args.js";
|
|
5
5
|
import { appendAgentEventLog, appendAgentStatusLog } from "./agent-logs.js";
|
|
6
6
|
import { displayAgentEvent, emitVisibleAgentText, summarizeAgentToolActivity, } from "./agent-render.js";
|
|
7
7
|
import { classifyTerminalVisibleStatus, extractAgentFailureStatus, hasAgentStalled, } from "./agent-status.js";
|
|
@@ -20,6 +20,7 @@ export function spawnAgent(agent, dirPath, prompt, options = {}) {
|
|
|
20
20
|
appendAgentStatusLog(options.statusLogPath, launchLine);
|
|
21
21
|
const proc = spawn(agent.command, args, {
|
|
22
22
|
cwd: dirPath,
|
|
23
|
+
env: buildAgentEnv(agent),
|
|
23
24
|
stdio: ["ignore", "pipe", "pipe"],
|
|
24
25
|
});
|
|
25
26
|
const timeoutMs = options.executionProfile?.timeoutMs ?? null;
|
|
@@ -3,7 +3,7 @@ import { spawnSync } from "node:child_process";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { CODEX_NOISE_PATTERNS } from "./agent-constants.js";
|
|
6
|
-
import { buildAgentArgs } from "./agent-args.js";
|
|
6
|
+
import { buildAgentArgs, buildAgentEnv } from "./agent-args.js";
|
|
7
7
|
const successfulPreflightAgents = new Set();
|
|
8
8
|
export function buildAgentPreflightPrompt() {
|
|
9
9
|
return [
|
|
@@ -22,6 +22,7 @@ export function runAgentPreflight(agent, options = {}) {
|
|
|
22
22
|
const result = spawnSyncImpl(agent.command, buildAgentArgs(agent, buildAgentPreflightPrompt()), {
|
|
23
23
|
cwd: dirPath,
|
|
24
24
|
encoding: "utf8",
|
|
25
|
+
env: buildAgentEnv(agent),
|
|
25
26
|
timeout: timeoutMs,
|
|
26
27
|
});
|
|
27
28
|
const stdout = typeof result.stdout === "string" ? result.stdout.trim() : "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeContractType, WorkflowImprovementContext, WorkflowZoneId } from "./schema.js";
|
|
1
|
+
import type { RuntimeContractType, SourceTruthCheck, WorkflowImprovementContext, WorkflowZoneId } from "./schema.js";
|
|
2
2
|
export interface NativeStageDefinition {
|
|
3
3
|
id: string;
|
|
4
4
|
label: string;
|
|
@@ -8,6 +8,7 @@ export interface NativeStageDefinition {
|
|
|
8
8
|
reads: WorkflowZoneId[];
|
|
9
9
|
writes: WorkflowZoneId[];
|
|
10
10
|
}
|
|
11
|
+
export declare function writeNativeAgentSurface(rootPath: string, agentsContent: string, skillName: string, skillContent: string): boolean;
|
|
11
12
|
export declare function renderCompiledAgents(compiledPath: string, name: string, workflowId: string, about?: string, options?: {
|
|
12
13
|
workflowOriginSelected?: string | null;
|
|
13
14
|
workflowLocalDraft?: boolean;
|
|
@@ -15,6 +16,30 @@ export declare function renderCompiledAgents(compiledPath: string, name: string,
|
|
|
15
16
|
export declare function renderCompiledQuerySkill(): string;
|
|
16
17
|
export declare function syncStageExecutionShellWrites(compiledPath: string, shellRoot: string, stage: NativeStageDefinition, writeArtifacts?: readonly string[]): void;
|
|
17
18
|
export declare function renderClaudeBootstrap(content: string): string;
|
|
19
|
+
export interface WorkflowAuthoringPreviewInfo {
|
|
20
|
+
compiledPath: string;
|
|
21
|
+
compileResult: {
|
|
22
|
+
ok: boolean;
|
|
23
|
+
failedStage: string | null;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare function createWorkflowAuthoringShell(options: {
|
|
27
|
+
workflowPath: string;
|
|
28
|
+
workflowId: string;
|
|
29
|
+
label: string;
|
|
30
|
+
baseWorkflowId: string;
|
|
31
|
+
datasetPath: string;
|
|
32
|
+
taskPrompt: string;
|
|
33
|
+
checks: SourceTruthCheck[];
|
|
34
|
+
preview?: WorkflowAuthoringPreviewInfo | null;
|
|
35
|
+
}): {
|
|
36
|
+
rootPath: string;
|
|
37
|
+
workflowBeforePath: string;
|
|
38
|
+
workflowAfterPath: string;
|
|
39
|
+
promptLogPath: string;
|
|
40
|
+
eventLogPath: string;
|
|
41
|
+
statusLogPath: string;
|
|
42
|
+
};
|
|
18
43
|
export declare function pruneStageExecutionShells(compiledPath: string): void;
|
|
19
44
|
export declare function projectCompiledQueryShell(compiledPath: string, compiledName: string, workflowId: string, about?: string, options?: {
|
|
20
45
|
workflowOriginSelected?: string | null;
|