@imricci/zaker 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/align.d.ts +3 -0
- package/dist/commands/align.js +28 -0
- package/dist/commands/align.js.map +1 -0
- package/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.js +59 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/confirm.d.ts +3 -0
- package/dist/commands/confirm.js +22 -0
- package/dist/commands/confirm.js.map +1 -0
- package/dist/commands/dialog.d.ts +9 -0
- package/dist/commands/dialog.js +396 -0
- package/dist/commands/dialog.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +31 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/models.d.ts +9 -0
- package/dist/commands/models.js +65 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +69 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/run.d.ts +40 -0
- package/dist/commands/run.js +310 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +39 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/tui.d.ts +14 -0
- package/dist/commands/tui.js +394 -0
- package/dist/commands/tui.js.map +1 -0
- package/dist/core/auditor.d.ts +13 -0
- package/dist/core/auditor.js +122 -0
- package/dist/core/auditor.js.map +1 -0
- package/dist/core/c3fi.d.ts +10 -0
- package/dist/core/c3fi.js +305 -0
- package/dist/core/c3fi.js.map +1 -0
- package/dist/core/challenge.d.ts +8 -0
- package/dist/core/challenge.js +29 -0
- package/dist/core/challenge.js.map +1 -0
- package/dist/core/checkpoint.d.ts +20 -0
- package/dist/core/checkpoint.js +192 -0
- package/dist/core/checkpoint.js.map +1 -0
- package/dist/core/execution-provider.d.ts +2 -0
- package/dist/core/execution-provider.js +125 -0
- package/dist/core/execution-provider.js.map +1 -0
- package/dist/core/executor.d.ts +16 -0
- package/dist/core/executor.js +68 -0
- package/dist/core/executor.js.map +1 -0
- package/dist/core/memory.d.ts +11 -0
- package/dist/core/memory.js +105 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/planner.d.ts +146 -0
- package/dist/core/planner.js +152 -0
- package/dist/core/planner.js.map +1 -0
- package/dist/core/preflight.d.ts +6 -0
- package/dist/core/preflight.js +140 -0
- package/dist/core/preflight.js.map +1 -0
- package/dist/core/provider-onboarding.d.ts +12 -0
- package/dist/core/provider-onboarding.js +32 -0
- package/dist/core/provider-onboarding.js.map +1 -0
- package/dist/core/run-loop.d.ts +32 -0
- package/dist/core/run-loop.js +205 -0
- package/dist/core/run-loop.js.map +1 -0
- package/dist/core/scope.d.ts +3 -0
- package/dist/core/scope.js +75 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/core/types.d.ts +288 -0
- package/dist/core/types.js +11 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/verdict-panel.d.ts +29 -0
- package/dist/core/verdict-panel.js +120 -0
- package/dist/core/verdict-panel.js.map +1 -0
- package/dist/core/verifier.d.ts +2 -0
- package/dist/core/verifier.js +47 -0
- package/dist/core/verifier.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/config.d.ts +36 -0
- package/dist/infra/config.js +397 -0
- package/dist/infra/config.js.map +1 -0
- package/dist/infra/git.d.ts +6 -0
- package/dist/infra/git.js +35 -0
- package/dist/infra/git.js.map +1 -0
- package/dist/infra/hashing.d.ts +1 -0
- package/dist/infra/hashing.js +8 -0
- package/dist/infra/hashing.js.map +1 -0
- package/dist/infra/intent.d.ts +30 -0
- package/dist/infra/intent.js +357 -0
- package/dist/infra/intent.js.map +1 -0
- package/dist/infra/memory.d.ts +10 -0
- package/dist/infra/memory.js +94 -0
- package/dist/infra/memory.js.map +1 -0
- package/dist/infra/model-catalog.d.ts +27 -0
- package/dist/infra/model-catalog.js +273 -0
- package/dist/infra/model-catalog.js.map +1 -0
- package/dist/infra/process.d.ts +12 -0
- package/dist/infra/process.js +32 -0
- package/dist/infra/process.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExecutionProvider = createExecutionProvider;
|
|
4
|
+
class LocalExecutionProvider {
|
|
5
|
+
async execute(input) {
|
|
6
|
+
return {
|
|
7
|
+
patches: input.patches,
|
|
8
|
+
attempts_used: 1
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class CheapCloudExecutionProvider {
|
|
13
|
+
async execute(input) {
|
|
14
|
+
// MVP-6.5: cloud execution strategy remains behavior-compatible before dedicated provider rollout.
|
|
15
|
+
return {
|
|
16
|
+
patches: input.patches,
|
|
17
|
+
attempts_used: 1
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function extractPatchBlocks(text) {
|
|
22
|
+
const blocks = [];
|
|
23
|
+
const fenced = text.match(/```diff\s*([\s\S]*?)```/gi) || [];
|
|
24
|
+
for (const entry of fenced) {
|
|
25
|
+
const extracted = entry.replace(/```diff\s*/i, "").replace(/```$/, "").trim();
|
|
26
|
+
if (extracted) {
|
|
27
|
+
blocks.push(`${extracted}\n`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (blocks.length > 0) {
|
|
31
|
+
return blocks;
|
|
32
|
+
}
|
|
33
|
+
if (text.includes("diff --git")) {
|
|
34
|
+
return [`${text.trim()}\n`];
|
|
35
|
+
}
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
class OllamaExecutionProvider {
|
|
39
|
+
model;
|
|
40
|
+
host;
|
|
41
|
+
timeoutMs;
|
|
42
|
+
constructor(model, host, timeoutMs = 30000) {
|
|
43
|
+
this.model = model;
|
|
44
|
+
this.host = host;
|
|
45
|
+
this.timeoutMs = timeoutMs;
|
|
46
|
+
}
|
|
47
|
+
buildPrompt(input) {
|
|
48
|
+
const scopeText = [
|
|
49
|
+
`allowed_paths=${input.scope.allowed_paths.join(",")}`,
|
|
50
|
+
`forbidden_paths=${input.scope.forbidden_paths.join(",")}`
|
|
51
|
+
].join(" ");
|
|
52
|
+
const taskText = input.tasks.length > 0
|
|
53
|
+
? input.tasks.map((task) => `- [${task.id}] ${task.title}`).join("\n")
|
|
54
|
+
: "- no explicit tasks";
|
|
55
|
+
return [
|
|
56
|
+
"Return unified diff patches only.",
|
|
57
|
+
"Do not include explanations.",
|
|
58
|
+
`Goal: ${input.goal}`,
|
|
59
|
+
`Scope: ${scopeText}`,
|
|
60
|
+
"Tasks:",
|
|
61
|
+
taskText
|
|
62
|
+
].join("\n");
|
|
63
|
+
}
|
|
64
|
+
async execute(input) {
|
|
65
|
+
if (input.patches.length > 0) {
|
|
66
|
+
return {
|
|
67
|
+
patches: input.patches,
|
|
68
|
+
attempts_used: 1
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (input.tasks.length === 0) {
|
|
72
|
+
return {
|
|
73
|
+
patches: [],
|
|
74
|
+
attempts_used: 1
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
79
|
+
try {
|
|
80
|
+
const response = await fetch(`${this.host.replace(/\/+$/, "")}/api/generate`, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: {
|
|
83
|
+
"content-type": "application/json"
|
|
84
|
+
},
|
|
85
|
+
body: JSON.stringify({
|
|
86
|
+
model: this.model,
|
|
87
|
+
stream: false,
|
|
88
|
+
prompt: this.buildPrompt(input)
|
|
89
|
+
}),
|
|
90
|
+
signal: controller.signal
|
|
91
|
+
});
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
throw new Error(`ollama request failed (${response.status})`);
|
|
94
|
+
}
|
|
95
|
+
const payload = (await response.json());
|
|
96
|
+
const content = typeof payload.response === "string" ? payload.response : "";
|
|
97
|
+
return {
|
|
98
|
+
patches: extractPatchBlocks(content),
|
|
99
|
+
attempts_used: 1
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
104
|
+
throw new Error(`ollama request timeout after ${this.timeoutMs}ms`);
|
|
105
|
+
}
|
|
106
|
+
if (error instanceof Error) {
|
|
107
|
+
throw new Error(`ollama execution failed: ${error.message}`);
|
|
108
|
+
}
|
|
109
|
+
throw new Error("ollama execution failed");
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
clearTimeout(timer);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function createExecutionProvider(settings) {
|
|
117
|
+
if (settings.provider === "ollama") {
|
|
118
|
+
return new OllamaExecutionProvider(settings.model, settings.ollama_host);
|
|
119
|
+
}
|
|
120
|
+
if (settings.provider === "cheap_cloud") {
|
|
121
|
+
return new CheapCloudExecutionProvider();
|
|
122
|
+
}
|
|
123
|
+
return new LocalExecutionProvider();
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=execution-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-provider.js","sourceRoot":"","sources":["../../src/core/execution-provider.ts"],"names":[],"mappings":";;AAkIA,0DAUC;AArID,MAAM,sBAAsB;IAC1B,KAAK,CAAC,OAAO,CAAC,KAA6B;QACzC,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,aAAa,EAAE,CAAC;SACjB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,2BAA2B;IAC/B,KAAK,CAAC,OAAO,CAAC,KAA6B;QACzC,mGAAmG;QACnG,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,aAAa,EAAE,CAAC;SACjB,CAAC;IACJ,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,I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AAE,CAAC;QACxC,OAAO,IAAI,2BAA2B,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,IAAI,sBAAsB,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExecutionProvider, SOP } from "./types";
|
|
2
|
+
export interface PatchExecutionResult {
|
|
3
|
+
index: number;
|
|
4
|
+
files: string[];
|
|
5
|
+
exit_code: number;
|
|
6
|
+
stdout_excerpt: string;
|
|
7
|
+
stderr_excerpt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ExecutionResult {
|
|
10
|
+
applied_patches: number;
|
|
11
|
+
changed_files: string[];
|
|
12
|
+
patch_results: PatchExecutionResult[];
|
|
13
|
+
attempts_used: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function applyPatches(patches: string[], allowedPaths: string[], attemptsUsed?: number, cwd?: string): Promise<ExecutionResult>;
|
|
16
|
+
export declare function executeSOP(sop: SOP, allowedPaths: string[], executionProviderOrCwd?: ExecutionProvider | string, executionMaxAttempts?: number, cwd?: string): Promise<ExecutionResult>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyPatches = applyPatches;
|
|
4
|
+
exports.executeSOP = executeSOP;
|
|
5
|
+
const process_1 = require("../infra/process");
|
|
6
|
+
const scope_1 = require("./scope");
|
|
7
|
+
function excerpt(output, maxLines = 40) {
|
|
8
|
+
return output.split(/\r?\n/).slice(0, maxLines).join("\n");
|
|
9
|
+
}
|
|
10
|
+
async function applyPatches(patches, allowedPaths, attemptsUsed = 1, cwd = process.cwd()) {
|
|
11
|
+
const changedFiles = new Set();
|
|
12
|
+
const patchResults = [];
|
|
13
|
+
for (const [index, patch] of patches.entries()) {
|
|
14
|
+
const files = (0, scope_1.extractPatchedPaths)(patch);
|
|
15
|
+
if (!(0, scope_1.validatePatch)(patch, allowedPaths)) {
|
|
16
|
+
const scopeText = files.length > 0 ? files.join(", ") : "unknown files";
|
|
17
|
+
throw new Error(`Patch ${index + 1} violates allowed scope: ${scopeText}`);
|
|
18
|
+
}
|
|
19
|
+
const commandResult = await (0, process_1.runCommand)("git", ["apply", "--whitespace=nowarn", "-"], {
|
|
20
|
+
cwd,
|
|
21
|
+
input: patch
|
|
22
|
+
});
|
|
23
|
+
if (commandResult.exitCode !== 0) {
|
|
24
|
+
throw new Error(`Patch ${index + 1} failed: ${commandResult.stderr || commandResult.stdout}`);
|
|
25
|
+
}
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
changedFiles.add(file);
|
|
28
|
+
}
|
|
29
|
+
patchResults.push({
|
|
30
|
+
index: index + 1,
|
|
31
|
+
files,
|
|
32
|
+
exit_code: commandResult.exitCode,
|
|
33
|
+
stdout_excerpt: excerpt(commandResult.stdout),
|
|
34
|
+
stderr_excerpt: excerpt(commandResult.stderr)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
applied_patches: patchResults.length,
|
|
39
|
+
changed_files: Array.from(changedFiles).sort(),
|
|
40
|
+
patch_results: patchResults,
|
|
41
|
+
attempts_used: attemptsUsed
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function executeSOP(sop, allowedPaths, executionProviderOrCwd, executionMaxAttempts = 2, cwd = process.cwd()) {
|
|
45
|
+
const executionProvider = executionProviderOrCwd && typeof executionProviderOrCwd !== "string"
|
|
46
|
+
? executionProviderOrCwd
|
|
47
|
+
: undefined;
|
|
48
|
+
const effectiveCwd = typeof executionProviderOrCwd === "string" ? executionProviderOrCwd : cwd;
|
|
49
|
+
const providerOutput = executionProvider
|
|
50
|
+
? await executionProvider.execute({
|
|
51
|
+
goal: sop.goal,
|
|
52
|
+
tasks: sop.tasks ?? [],
|
|
53
|
+
scope: sop.scope,
|
|
54
|
+
limits: {
|
|
55
|
+
max_attempts: executionMaxAttempts
|
|
56
|
+
},
|
|
57
|
+
patches: sop.patches ?? []
|
|
58
|
+
})
|
|
59
|
+
: {
|
|
60
|
+
patches: sop.patches ?? [],
|
|
61
|
+
attempts_used: 1
|
|
62
|
+
};
|
|
63
|
+
if ((providerOutput.patches ?? []).length === 0 && (sop.tasks ?? []).length > 0) {
|
|
64
|
+
throw new Error("Execution contract mismatch: SOP contains tasks but no patches. Local step-to-patch synthesis is not implemented.");
|
|
65
|
+
}
|
|
66
|
+
return applyPatches(providerOutput.patches ?? [], allowedPaths, providerOutput.attempts_used, effectiveCwd);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/core/executor.ts"],"names":[],"mappings":";;AAuBA,oCA4CC;AAED,gCAwCC;AA7GD,8CAA8C;AAC9C,mCAA6D;AAkB7D,SAAS,OAAO,CAAC,MAAc,EAAE,QAAQ,GAAG,EAAE;IAC5C,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,OAAiB,EACjB,YAAsB,EACtB,YAAY,GAAG,CAAC,EAChB,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAEnB,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,MAAM,YAAY,GAA2B,EAAE,CAAC;IAEhD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAA,2BAAmB,EAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,IAAA,qBAAa,EAAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC;YACxC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IA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AAO,sBAAsB,KAAK,QAAQ;QAClE,CAAC,CAAC,sBAAsB;QACxB,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,YAAY,GAChB,OAAO,sBAAsB,KAAK,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC;IAE5E,MAAM,cAAc,GAAG,iBAAiB;QACtC,CAAC,CAAC,MAAM,iBAAiB,CAAC,OAAO,CAAC;YAC9B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE;YACtB,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE;gBACN,YAAY,EAAE,oBAAoB;aACnC;YACD,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE;SAC3B,CAAC;QACJ,CAAC,CAAC;YACE,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE;YAC1B,aAAa,EAAE,CAAC;SACjB,CAAC;IAEN,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChF,MAAM,IAAI,KAAK,CACb,mHAAmH,CACpH,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CACjB,cAAc,CAAC,OAAO,IAAI,EAAE,EAC5B,YAAY,EACZ,cAAc,CAAC,aAAa,EAC5B,YAAY,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MoloConfig } from "../infra/config";
|
|
2
|
+
import { ExecutionFailureRecord, MemoryHydration } from "./types";
|
|
3
|
+
export declare function degradedMemoryHydration(reason: string): MemoryHydration;
|
|
4
|
+
export declare function hydrateMemoryContext(config: MoloConfig, cwd?: string): Promise<MemoryHydration>;
|
|
5
|
+
export declare function buildPlanningPrompt(description: string, hydration: MemoryHydration): string;
|
|
6
|
+
export declare function recordExecutionFailure(config: MoloConfig, payload: {
|
|
7
|
+
message: string;
|
|
8
|
+
source: string;
|
|
9
|
+
confidence: number;
|
|
10
|
+
supersedes?: string;
|
|
11
|
+
}, cwd?: string): Promise<ExecutionFailureRecord | null>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.degradedMemoryHydration = degradedMemoryHydration;
|
|
4
|
+
exports.hydrateMemoryContext = hydrateMemoryContext;
|
|
5
|
+
exports.buildPlanningPrompt = buildPlanningPrompt;
|
|
6
|
+
exports.recordExecutionFailure = recordExecutionFailure;
|
|
7
|
+
const memory_1 = require("../infra/memory");
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const DEFAULT_MAX_ITEMS_PER_CATEGORY = 5;
|
|
10
|
+
function takeRecent(records, limit) {
|
|
11
|
+
return [...records]
|
|
12
|
+
.sort((left, right) => right.timestamp.localeCompare(left.timestamp))
|
|
13
|
+
.slice(0, Math.max(0, limit));
|
|
14
|
+
}
|
|
15
|
+
function formatRecords(title, records) {
|
|
16
|
+
if (records.length === 0) {
|
|
17
|
+
return `${title}: []`;
|
|
18
|
+
}
|
|
19
|
+
const lines = records.map((record) => `- [${record.id}] ${record.content} (timestamp=${record.timestamp}, source=${record.source}, confidence=${record.confidence})`);
|
|
20
|
+
return `${title}:\n${lines.join("\n")}`;
|
|
21
|
+
}
|
|
22
|
+
function buildSummary(status, source, hydratedAt, facts, decisions, constraints, executionFailures, warning) {
|
|
23
|
+
return {
|
|
24
|
+
status,
|
|
25
|
+
source,
|
|
26
|
+
hydrated_at: hydratedAt,
|
|
27
|
+
facts_count: facts.length,
|
|
28
|
+
decisions_count: decisions.length,
|
|
29
|
+
constraints_count: constraints.length,
|
|
30
|
+
execution_failure_count: executionFailures.length,
|
|
31
|
+
used_ids: [...facts, ...decisions, ...constraints, ...executionFailures].map((entry) => entry.id),
|
|
32
|
+
warning
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function buildHydration(status, source, facts, decisions, constraints, executionFailures, warning) {
|
|
36
|
+
const hydratedAt = new Date().toISOString();
|
|
37
|
+
const summary = buildSummary(status, source, hydratedAt, facts, decisions, constraints, executionFailures, warning);
|
|
38
|
+
return {
|
|
39
|
+
status,
|
|
40
|
+
source,
|
|
41
|
+
hydrated_at: hydratedAt,
|
|
42
|
+
facts,
|
|
43
|
+
decisions,
|
|
44
|
+
constraints,
|
|
45
|
+
execution_failures: executionFailures,
|
|
46
|
+
warning,
|
|
47
|
+
summary
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function degradedMemoryHydration(reason) {
|
|
51
|
+
return buildHydration("DEGRADED", types_1.MEMORY_HYDRATION_SOURCE_LOCAL_FILE, [], [], [], [], reason);
|
|
52
|
+
}
|
|
53
|
+
async function hydrateMemoryContext(config, cwd = process.cwd()) {
|
|
54
|
+
const source = types_1.MEMORY_HYDRATION_SOURCE_LOCAL_FILE;
|
|
55
|
+
const maxItems = config.memory.max_items_per_category ?? DEFAULT_MAX_ITEMS_PER_CATEGORY;
|
|
56
|
+
const memoryFile = config.memory.memory_file;
|
|
57
|
+
try {
|
|
58
|
+
const store = await (0, memory_1.readMemoryStore)(memoryFile, cwd);
|
|
59
|
+
if (!store) {
|
|
60
|
+
return degradedMemoryHydration(`Memory file not found: ${memoryFile}`);
|
|
61
|
+
}
|
|
62
|
+
const facts = takeRecent(store.facts, maxItems);
|
|
63
|
+
const decisions = takeRecent(store.decisions, maxItems);
|
|
64
|
+
const constraints = takeRecent(store.constraints, maxItems);
|
|
65
|
+
const executionFailures = takeRecent(store.execution_failures, maxItems);
|
|
66
|
+
if (facts.length + decisions.length + constraints.length === 0) {
|
|
67
|
+
return buildHydration("DEGRADED", source, facts, decisions, constraints, executionFailures, "Memory hydrate completed with zero facts/decisions/constraints entries.");
|
|
68
|
+
}
|
|
69
|
+
return buildHydration("HYDRATED", source, facts, decisions, constraints, executionFailures);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
73
|
+
return degradedMemoryHydration(`Memory hydrate failed: ${message}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function buildPlanningPrompt(description, hydration) {
|
|
77
|
+
const sections = [
|
|
78
|
+
"[MOLO_MEMORY_CONTEXT]",
|
|
79
|
+
`status: ${hydration.status}`,
|
|
80
|
+
`source: ${hydration.source}`,
|
|
81
|
+
`hydrated_at: ${hydration.hydrated_at}`,
|
|
82
|
+
formatRecords("facts", hydration.facts),
|
|
83
|
+
formatRecords("decisions", hydration.decisions),
|
|
84
|
+
formatRecords("constraints", hydration.constraints),
|
|
85
|
+
formatRecords("execution_failures", hydration.execution_failures)
|
|
86
|
+
];
|
|
87
|
+
if (hydration.warning) {
|
|
88
|
+
sections.push(`warning: ${hydration.warning}`);
|
|
89
|
+
}
|
|
90
|
+
sections.push("[/MOLO_MEMORY_CONTEXT]", "[USER_DESCRIPTION]", description.trim(), "[/USER_DESCRIPTION]");
|
|
91
|
+
return sections.join("\n");
|
|
92
|
+
}
|
|
93
|
+
async function recordExecutionFailure(config, payload, cwd = process.cwd()) {
|
|
94
|
+
const trimmedMessage = payload.message.trim();
|
|
95
|
+
if (!trimmedMessage) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return (0, memory_1.appendExecutionFailureRecord)(config.memory.memory_file, {
|
|
99
|
+
message: trimmedMessage,
|
|
100
|
+
source: payload.source,
|
|
101
|
+
confidence: payload.confidence,
|
|
102
|
+
supersedes: payload.supersedes
|
|
103
|
+
}, cwd);
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/core/memory.ts"],"names":[],"mappings":";;AAwFA,0DAUC;AAED,oDAoCC;AAED,kDAkBC;AAED,wD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AAa,CAAC,aAAa,EAAE,SAAS,CAAC,WAAW,CAAC;QACnD,aAAa,CAAC,oBAAoB,EAAE,SAAS,CAAC,kBAAkB,CAAC;KAClE,CAAC;IAEF,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,YAAY,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,WAAW,CAAC,IAAI,EAAE,EAAE,qBAAqB,CAAC,CAAC;IACzG,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAEM,KAAK,UAAU,sBAAsB,CAC1C,MAAkB,EAClB,OAKC,EACD,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IAEnB,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC9C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAA,qCAA4B,EACjC,MAAM,CAAC,MAAM,CAAC,WAAW,EACzB;QACE,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,EACD,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LLMProvider, SOP, SOPVerificationCommand } from "./types";
|
|
3
|
+
export declare const DEFAULT_ALLOWED_PATHS: string[];
|
|
4
|
+
export declare const DEFAULT_VERIFICATION_COMMANDS: SOPVerificationCommand[];
|
|
5
|
+
export declare const sopSchema: z.ZodObject<{
|
|
6
|
+
schema_version: z.ZodLiteral<"molo.sop.v1">;
|
|
7
|
+
sop_id: z.ZodString;
|
|
8
|
+
goal: z.ZodString;
|
|
9
|
+
scope: z.ZodObject<{
|
|
10
|
+
allowed_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
forbidden_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
allowed_paths: string[];
|
|
14
|
+
forbidden_paths: string[];
|
|
15
|
+
}, {
|
|
16
|
+
allowed_paths?: string[] | undefined;
|
|
17
|
+
forbidden_paths?: string[] | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
verification: z.ZodObject<{
|
|
20
|
+
commands: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
command: z.ZodString;
|
|
23
|
+
timeout_sec: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
command: string;
|
|
27
|
+
required: boolean;
|
|
28
|
+
id: string;
|
|
29
|
+
timeout_sec: number;
|
|
30
|
+
}, {
|
|
31
|
+
command: string;
|
|
32
|
+
id: string;
|
|
33
|
+
required?: boolean | undefined;
|
|
34
|
+
timeout_sec?: number | undefined;
|
|
35
|
+
}>, "many">>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
commands: {
|
|
38
|
+
command: string;
|
|
39
|
+
required: boolean;
|
|
40
|
+
id: string;
|
|
41
|
+
timeout_sec: number;
|
|
42
|
+
}[];
|
|
43
|
+
}, {
|
|
44
|
+
commands?: {
|
|
45
|
+
command: string;
|
|
46
|
+
id: string;
|
|
47
|
+
required?: boolean | undefined;
|
|
48
|
+
timeout_sec?: number | undefined;
|
|
49
|
+
}[] | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
limits: z.ZodObject<{
|
|
52
|
+
max_runtime_minutes: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
max_challenges: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
max_runtime_minutes: number;
|
|
56
|
+
max_challenges: number;
|
|
57
|
+
}, {
|
|
58
|
+
max_runtime_minutes?: number | undefined;
|
|
59
|
+
max_challenges?: number | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
skills: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
62
|
+
type: z.ZodString;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
type: string;
|
|
65
|
+
}, {
|
|
66
|
+
type: string;
|
|
67
|
+
}>, "many">>;
|
|
68
|
+
tasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
69
|
+
id: z.ZodString;
|
|
70
|
+
title: z.ZodString;
|
|
71
|
+
acceptance: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
acceptance: string[];
|
|
76
|
+
}, {
|
|
77
|
+
id: string;
|
|
78
|
+
title: string;
|
|
79
|
+
acceptance?: string[] | undefined;
|
|
80
|
+
}>, "many">>;
|
|
81
|
+
patches: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
schema_version: "molo.sop.v1";
|
|
84
|
+
sop_id: string;
|
|
85
|
+
verification: {
|
|
86
|
+
commands: {
|
|
87
|
+
command: string;
|
|
88
|
+
required: boolean;
|
|
89
|
+
id: string;
|
|
90
|
+
timeout_sec: number;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
goal: string;
|
|
94
|
+
scope: {
|
|
95
|
+
allowed_paths: string[];
|
|
96
|
+
forbidden_paths: string[];
|
|
97
|
+
};
|
|
98
|
+
limits: {
|
|
99
|
+
max_runtime_minutes: number;
|
|
100
|
+
max_challenges: number;
|
|
101
|
+
};
|
|
102
|
+
skills: {
|
|
103
|
+
type: string;
|
|
104
|
+
}[];
|
|
105
|
+
tasks: {
|
|
106
|
+
id: string;
|
|
107
|
+
title: string;
|
|
108
|
+
acceptance: string[];
|
|
109
|
+
}[];
|
|
110
|
+
patches: string[];
|
|
111
|
+
}, {
|
|
112
|
+
schema_version: "molo.sop.v1";
|
|
113
|
+
sop_id: string;
|
|
114
|
+
verification: {
|
|
115
|
+
commands?: {
|
|
116
|
+
command: string;
|
|
117
|
+
id: string;
|
|
118
|
+
required?: boolean | undefined;
|
|
119
|
+
timeout_sec?: number | undefined;
|
|
120
|
+
}[] | undefined;
|
|
121
|
+
};
|
|
122
|
+
goal: string;
|
|
123
|
+
scope: {
|
|
124
|
+
allowed_paths?: string[] | undefined;
|
|
125
|
+
forbidden_paths?: string[] | undefined;
|
|
126
|
+
};
|
|
127
|
+
limits: {
|
|
128
|
+
max_runtime_minutes?: number | undefined;
|
|
129
|
+
max_challenges?: number | undefined;
|
|
130
|
+
};
|
|
131
|
+
skills?: {
|
|
132
|
+
type: string;
|
|
133
|
+
}[] | undefined;
|
|
134
|
+
tasks?: {
|
|
135
|
+
id: string;
|
|
136
|
+
title: string;
|
|
137
|
+
acceptance?: string[] | undefined;
|
|
138
|
+
}[] | undefined;
|
|
139
|
+
patches?: string[] | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export declare function validateSOP(input: unknown, fallbackGoal?: string): SOP;
|
|
142
|
+
export declare class Planner {
|
|
143
|
+
private readonly provider;
|
|
144
|
+
constructor(provider: LLMProvider);
|
|
145
|
+
createPlan(description: string, defaultAllowedPaths?: string[], planningPrompt?: string): Promise<SOP>;
|
|
146
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Planner = exports.sopSchema = exports.DEFAULT_VERIFICATION_COMMANDS = exports.DEFAULT_ALLOWED_PATHS = void 0;
|
|
4
|
+
exports.validateSOP = validateSOP;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
exports.DEFAULT_ALLOWED_PATHS = ["src/**"];
|
|
8
|
+
exports.DEFAULT_VERIFICATION_COMMANDS = [
|
|
9
|
+
{
|
|
10
|
+
id: "test",
|
|
11
|
+
command: "npm test --silent",
|
|
12
|
+
timeout_sec: 600,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "lint",
|
|
17
|
+
command: "npm run lint",
|
|
18
|
+
timeout_sec: 600,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "build",
|
|
23
|
+
command: "npm run build",
|
|
24
|
+
timeout_sec: 600,
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
const DEFAULT_SKILLS = [
|
|
29
|
+
{ type: "preflight_check" },
|
|
30
|
+
{ type: "core_execution" },
|
|
31
|
+
{ type: "audit_checkpoint" }
|
|
32
|
+
];
|
|
33
|
+
const verificationCommandSchema = zod_1.z.object({
|
|
34
|
+
id: zod_1.z.string().min(1),
|
|
35
|
+
command: zod_1.z.string().min(1),
|
|
36
|
+
timeout_sec: zod_1.z.number().int().positive().default(600),
|
|
37
|
+
required: zod_1.z.boolean().default(true)
|
|
38
|
+
});
|
|
39
|
+
exports.sopSchema = zod_1.z.object({
|
|
40
|
+
schema_version: zod_1.z.literal(types_1.SOP_SCHEMA_VERSION),
|
|
41
|
+
sop_id: zod_1.z.string().min(1),
|
|
42
|
+
goal: zod_1.z.string().min(1),
|
|
43
|
+
scope: zod_1.z.object({
|
|
44
|
+
allowed_paths: zod_1.z.array(zod_1.z.string().min(1)).min(1).default(exports.DEFAULT_ALLOWED_PATHS),
|
|
45
|
+
forbidden_paths: zod_1.z.array(zod_1.z.string().min(1)).default([])
|
|
46
|
+
}),
|
|
47
|
+
verification: zod_1.z.object({
|
|
48
|
+
commands: zod_1.z.array(verificationCommandSchema).min(1).default(exports.DEFAULT_VERIFICATION_COMMANDS)
|
|
49
|
+
}),
|
|
50
|
+
limits: zod_1.z.object({
|
|
51
|
+
max_runtime_minutes: zod_1.z.number().int().positive().default(30),
|
|
52
|
+
max_challenges: zod_1.z.number().int().min(0).max(2).default(2)
|
|
53
|
+
}),
|
|
54
|
+
skills: zod_1.z.array(zod_1.z.object({ type: zod_1.z.string().min(1) })).default(DEFAULT_SKILLS),
|
|
55
|
+
tasks: zod_1.z
|
|
56
|
+
.array(zod_1.z.object({
|
|
57
|
+
id: zod_1.z.string().min(1),
|
|
58
|
+
title: zod_1.z.string().min(1),
|
|
59
|
+
acceptance: zod_1.z.array(zod_1.z.string().min(1)).default([])
|
|
60
|
+
}))
|
|
61
|
+
.default([]),
|
|
62
|
+
patches: zod_1.z.array(zod_1.z.string()).default([])
|
|
63
|
+
});
|
|
64
|
+
const sopInputSchema = zod_1.z.object({
|
|
65
|
+
schema_version: zod_1.z.literal(types_1.SOP_SCHEMA_VERSION).optional(),
|
|
66
|
+
sop_id: zod_1.z.string().min(1).optional(),
|
|
67
|
+
goal: zod_1.z.string().min(1).optional(),
|
|
68
|
+
scope: zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
allowed_paths: zod_1.z.array(zod_1.z.string().min(1)).min(1).optional(),
|
|
71
|
+
forbidden_paths: zod_1.z.array(zod_1.z.string().min(1)).optional()
|
|
72
|
+
})
|
|
73
|
+
.optional(),
|
|
74
|
+
verification: zod_1.z
|
|
75
|
+
.object({
|
|
76
|
+
commands: zod_1.z.array(verificationCommandSchema).min(1).optional()
|
|
77
|
+
})
|
|
78
|
+
.optional(),
|
|
79
|
+
limits: zod_1.z
|
|
80
|
+
.object({
|
|
81
|
+
max_runtime_minutes: zod_1.z.number().int().positive().optional(),
|
|
82
|
+
max_challenges: zod_1.z.number().int().min(0).max(2).optional()
|
|
83
|
+
})
|
|
84
|
+
.optional(),
|
|
85
|
+
skills: zod_1.z.array(zod_1.z.object({ type: zod_1.z.string().min(1) })).optional(),
|
|
86
|
+
tasks: zod_1.z
|
|
87
|
+
.array(zod_1.z.object({
|
|
88
|
+
id: zod_1.z.string().min(1),
|
|
89
|
+
title: zod_1.z.string().min(1),
|
|
90
|
+
acceptance: zod_1.z.array(zod_1.z.string().min(1)).default([])
|
|
91
|
+
}))
|
|
92
|
+
.optional(),
|
|
93
|
+
patches: zod_1.z.array(zod_1.z.string()).optional()
|
|
94
|
+
});
|
|
95
|
+
function dedupe(values) {
|
|
96
|
+
return Array.from(new Set(values
|
|
97
|
+
.map((value) => value.trim())
|
|
98
|
+
.filter((value) => value.length > 0)));
|
|
99
|
+
}
|
|
100
|
+
function validateSOP(input, fallbackGoal) {
|
|
101
|
+
const parsed = sopInputSchema.parse(input);
|
|
102
|
+
const goal = parsed.goal?.trim() || fallbackGoal?.trim() || "";
|
|
103
|
+
if (!goal) {
|
|
104
|
+
throw new Error("Invalid SOP: missing goal.");
|
|
105
|
+
}
|
|
106
|
+
const normalized = {
|
|
107
|
+
schema_version: types_1.SOP_SCHEMA_VERSION,
|
|
108
|
+
sop_id: parsed.sop_id?.trim() || `sop_${Date.now()}`,
|
|
109
|
+
goal,
|
|
110
|
+
scope: {
|
|
111
|
+
allowed_paths: dedupe(parsed.scope?.allowed_paths ?? exports.DEFAULT_ALLOWED_PATHS),
|
|
112
|
+
forbidden_paths: dedupe(parsed.scope?.forbidden_paths ?? [])
|
|
113
|
+
},
|
|
114
|
+
verification: {
|
|
115
|
+
commands: parsed.verification?.commands ?? exports.DEFAULT_VERIFICATION_COMMANDS.map((item) => ({ ...item }))
|
|
116
|
+
},
|
|
117
|
+
limits: {
|
|
118
|
+
max_runtime_minutes: parsed.limits?.max_runtime_minutes ?? 30,
|
|
119
|
+
max_challenges: parsed.limits?.max_challenges ?? 2
|
|
120
|
+
},
|
|
121
|
+
skills: parsed.skills ?? DEFAULT_SKILLS.map((item) => ({ ...item })),
|
|
122
|
+
tasks: parsed.tasks ?? [],
|
|
123
|
+
patches: parsed.patches ?? []
|
|
124
|
+
};
|
|
125
|
+
if (normalized.scope.allowed_paths.length === 0) {
|
|
126
|
+
normalized.scope.allowed_paths = [...exports.DEFAULT_ALLOWED_PATHS];
|
|
127
|
+
}
|
|
128
|
+
return exports.sopSchema.parse(normalized);
|
|
129
|
+
}
|
|
130
|
+
class Planner {
|
|
131
|
+
provider;
|
|
132
|
+
constructor(provider) {
|
|
133
|
+
this.provider = provider;
|
|
134
|
+
}
|
|
135
|
+
async createPlan(description, defaultAllowedPaths = exports.DEFAULT_ALLOWED_PATHS, planningPrompt) {
|
|
136
|
+
const planned = await this.provider.plan(planningPrompt ?? description);
|
|
137
|
+
const scope = planned.scope ?? {};
|
|
138
|
+
const mergedAllowedPaths = dedupe([
|
|
139
|
+
...(scope.allowed_paths ?? exports.DEFAULT_ALLOWED_PATHS),
|
|
140
|
+
...(defaultAllowedPaths ?? [])
|
|
141
|
+
]);
|
|
142
|
+
return validateSOP({
|
|
143
|
+
...planned,
|
|
144
|
+
scope: {
|
|
145
|
+
...scope,
|
|
146
|
+
allowed_paths: mergedAllowedPaths.length > 0 ? mergedAllowedPaths : [...exports.DEFAULT_ALLOWED_PATHS]
|
|
147
|
+
}
|
|
148
|
+
}, description);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.Planner = Planner;
|
|
152
|
+
//# sourceMappingURL=planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/core/planner.ts"],"names":[],"mappings":";;;AAmHA,kCAgCC;AAnJD,6BAAwB;AACxB,mCAKiB;AAEJ,QAAA,qBAAqB,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,QAAA,6BAA6B,GAA6B;IACrE;QACE,EAAE,EAAE,MAAM;QACV,OAAO,EAAE,mBAAmB;QAC5B,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE,IAAI;KACf;IACD;QACE,EAAE,EAAE,MAAM;QACV,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,GAAG;QAChB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AgC,6BAAqB,EACrD,cAAuB;QAEvB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC,CAAC;QACxE,MAAM,KAAK,GAA2B,OAAwB,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3E,MAAM,kBAAkB,GAAG,MAAM,CAAC;YAChC,GAAG,CAAC,KAAK,CAAC,aAAa,IAAI,6BAAqB,CAAC;YACjD,GAAG,CAAC,mBAAmB,IAAI,EAAE,CAAC;SAC/B,CAAC,CAAC;QACH,OAAO,WAAW,CAChB;YACE,GAAG,OAAO;YACV,KAAK,EAAE;gBACL,GAAG,KAAK;gBACR,aAAa,EAAE,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,6BAAqB,CAAC;aAC/F;SACF,EACD,WAAW,CACZ,CAAC;IACJ,CAAC;CACF;AAzBD,0BAyBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MoloConfig } from "../infra/config";
|
|
2
|
+
import { RunnerMetadata, SOP } from "./types";
|
|
3
|
+
export interface PreflightResult {
|
|
4
|
+
metadata: RunnerMetadata;
|
|
5
|
+
}
|
|
6
|
+
export declare function runPreflight(sop: SOP, config: MoloConfig, cwd?: string): Promise<PreflightResult>;
|