deeplyzer 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/analysis/deep/generate/ganerateAgent.js +11 -9
- package/analysis/deep/orchestratorAgent.js +20 -27
- package/analysis/deep/runner/runnerAgent.js +170 -0
- package/engine.js +8 -8
- package/globals.js +1 -1
- package/index.js +2 -0
- package/package.json +1 -1
- package/prompts/deep.generate +445 -0
- package/prompts/deep.runner.assess.command +43 -0
- package/prompts/deep.runner.command +168 -0
- package/prompts/{deep.env.runtime → deep.runner.runtime} +29 -7
- package/prompts/graph.identify.runner +82 -0
- package/services/{environmentService.js → runnerIdentificationService.js} +17 -17
- package/session/sessionManager.js +1 -1
- package/utils/fileUtil.js +0 -8
- package/utils/logger.js +5 -5
- package/analysis/deep/env/environmentAgent.js +0 -125
- package/analysis/deep/plan/planAgent.js +0 -26
- package/prompts/deep.generate.output +0 -31
- package/prompts/deep.plans +0 -153
- package/prompts/graph.environment +0 -154
- /package/prompts/{deep.env.assess → deep.runner.assess.runtime} +0 -0
|
@@ -9,7 +9,8 @@ Setup Instructions:
|
|
|
9
9
|
Previous execution results:
|
|
10
10
|
***RESULTS***
|
|
11
11
|
|
|
12
|
-
Instructions
|
|
12
|
+
## Instructions
|
|
13
|
+
|
|
13
14
|
1. Identify the runtimes and system-level tools required by the setup instructions.
|
|
14
15
|
2. Check previous execution results to determine which requirements are already available.
|
|
15
16
|
3. If availability is unclear, generate simple commands to check their presence and version.
|
|
@@ -18,28 +19,49 @@ Instructions:
|
|
|
18
19
|
6. Ensure commands are ordered by prerequisites.
|
|
19
20
|
7. Do not install application packages, libraries, or modules.
|
|
20
21
|
8. Do not reinstall anything that is already available.
|
|
22
|
+
9. Do not assume the current working directory or rely on project-specific files unless explicitly provided in the setup instructions.
|
|
23
|
+
|
|
24
|
+
## OS-SPECIFIC COMMAND GENERATION
|
|
21
25
|
|
|
22
|
-
OS-SPECIFIC COMMAND GENERATION
|
|
23
26
|
1. Identify the operating system from ***OS***.
|
|
24
27
|
2. Generate commands exclusively using syntax supported by that operating system.
|
|
25
28
|
3. Select the appropriate shell and command interpreter:
|
|
26
29
|
- win32: Windows CMD or PowerShell.
|
|
27
30
|
- linux: Linux shell (Bash).
|
|
28
31
|
- darwin: macOS shell (Bash or Zsh).
|
|
29
|
-
4. Adapt directory creation,
|
|
32
|
+
4. Adapt directory creation, environment variables, executable invocation and file operations to the selected OS.
|
|
30
33
|
5. Use the appropriate runtime executable (e.g. python, python3, node).
|
|
31
34
|
6. Handle OS-specific command chaining, quoting and exit codes correctly.
|
|
32
35
|
7. Never generate commands from another operating system.
|
|
33
|
-
8. If the OS is unknown or unsupported,
|
|
36
|
+
8. If the OS is unknown or unsupported, return an empty array.
|
|
37
|
+
|
|
38
|
+
## COMMAND REQUIREMENTS
|
|
39
|
+
|
|
40
|
+
- Generate only installation commands for missing runtimes and system-level tools.
|
|
41
|
+
- Do not generate commands to install application dependencies or project packages.
|
|
42
|
+
- Do not repeat installations already confirmed successful.
|
|
43
|
+
- Prefer standard package managers and installation methods supported by the target OS.
|
|
44
|
+
- Ensure commands are directly executable.
|
|
45
|
+
- Order commands according to prerequisite dependencies.
|
|
46
|
+
- Do not include explanations or comments inside command strings.
|
|
47
|
+
- If a required tool is already available, do not include its installation command.
|
|
48
|
+
- If availability cannot be established, generate a diagnostic command rather than assuming it is missing.
|
|
34
49
|
|
|
35
|
-
|
|
50
|
+
## OUTPUT FORMAT
|
|
51
|
+
|
|
52
|
+
Return ONLY a valid JSON array of strings, where each string represents one executable installation or diagnostic command.
|
|
36
53
|
|
|
37
54
|
Example:
|
|
55
|
+
|
|
38
56
|
{
|
|
39
|
-
commands: [
|
|
57
|
+
"commands": [
|
|
40
58
|
"install python",
|
|
41
59
|
"install java"
|
|
42
60
|
]
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
If all requirements are satisfied, return:
|
|
63
|
+
If all requirements are satisfied, return:
|
|
64
|
+
|
|
65
|
+
{
|
|
66
|
+
"commands": []
|
|
67
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# WORKFLOW RUNNER IDENTIFICATION PROMPT
|
|
2
|
+
|
|
3
|
+
You are a workflow runner identification engine responsible for identifying the most suitable execution runner for supplied project files.
|
|
4
|
+
|
|
5
|
+
## INPUT
|
|
6
|
+
|
|
7
|
+
### FILE DATA
|
|
8
|
+
***FILES***
|
|
9
|
+
|
|
10
|
+
### AVAILABLE WORKFLOW RUNNERS
|
|
11
|
+
***WORKFLOW_RUNNERS***
|
|
12
|
+
|
|
13
|
+
## 1. OBJECTIVE
|
|
14
|
+
|
|
15
|
+
Analyze all supplied files collectively and identify the minimum number of workflow runners required.
|
|
16
|
+
|
|
17
|
+
Group related files that belong to the same application or execution workflow.
|
|
18
|
+
|
|
19
|
+
## 2. RUNNER SELECTION
|
|
20
|
+
|
|
21
|
+
For each identified application:
|
|
22
|
+
|
|
23
|
+
1. Evaluate all available workflow runners.
|
|
24
|
+
2. Select the most suitable runner based on its name, description, and capabilities.
|
|
25
|
+
3. Prefer specialized runners over general-purpose runners.
|
|
26
|
+
4. Do not require an exact technology or framework match.
|
|
27
|
+
5. Use the exact runner `name` supplied.
|
|
28
|
+
6. Use `"dynamic"` only when no available runner is reasonably suitable.
|
|
29
|
+
7. Do not select `"dynamic"` merely because execution details are incomplete.
|
|
30
|
+
|
|
31
|
+
## 3. FILE ASSOCIATION
|
|
32
|
+
|
|
33
|
+
For each selected runner:
|
|
34
|
+
|
|
35
|
+
1. Include all supplied files relevant to the application or workflow.
|
|
36
|
+
2. Use exact filenames from the input.
|
|
37
|
+
3. Do not include file paths or directory paths.
|
|
38
|
+
4. Include source files, configuration files, dependency manifests, and other files that contribute to the application.
|
|
39
|
+
5. Exclude unrelated files.
|
|
40
|
+
6. Do not create separate runners unnecessarily.
|
|
41
|
+
7. Shared files may belong to multiple runners when genuinely applicable.
|
|
42
|
+
8. Do not create a runner solely to accommodate an individual file.
|
|
43
|
+
|
|
44
|
+
## 4. HOLISTIC ANALYSIS
|
|
45
|
+
|
|
46
|
+
- Analyze the complete file collection before selecting runners.
|
|
47
|
+
- Identify related and independent applications.
|
|
48
|
+
- Group files according to their execution requirements.
|
|
49
|
+
- Avoid splitting a single application across multiple runners unnecessarily.
|
|
50
|
+
- Identify separate runners only when applications have genuinely independent execution workflows.
|
|
51
|
+
- Ensure every relevant file is associated with an appropriate runner.
|
|
52
|
+
|
|
53
|
+
## 5. OUTPUT FORMAT
|
|
54
|
+
|
|
55
|
+
Return strictly valid JSON using exactly this structure:
|
|
56
|
+
|
|
57
|
+
{
|
|
58
|
+
"runners": [
|
|
59
|
+
{
|
|
60
|
+
"workflowRunner": "runner-name-or-dynamic",
|
|
61
|
+
"files": [
|
|
62
|
+
"filename1",
|
|
63
|
+
"filename2"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
## 6. FINAL VALIDATION
|
|
70
|
+
|
|
71
|
+
Before responding, verify that:
|
|
72
|
+
|
|
73
|
+
- The most suitable available runner was selected for each application.
|
|
74
|
+
- All available runners were considered.
|
|
75
|
+
- Dynamic was selected only when no predefined runner was suitable.
|
|
76
|
+
- The minimum number of runners was identified.
|
|
77
|
+
- All relevant files were assigned correctly.
|
|
78
|
+
- No unrelated files were included.
|
|
79
|
+
- Exact filenames were preserved.
|
|
80
|
+
- The output contains only the specified JSON structure.
|
|
81
|
+
|
|
82
|
+
Return only valid JSON. Do not include explanations, markdown, comments, or additional properties.
|
|
@@ -5,15 +5,15 @@ const globals = require("../globals");
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class RunnerIdentificationService {
|
|
9
9
|
static baseDir = path.join(process.cwd(), ".deeplyzer");
|
|
10
|
-
static
|
|
10
|
+
static runnersFile = path.join(RunnerIdentificationService.baseDir, "runners.json");
|
|
11
11
|
|
|
12
12
|
constructor() {
|
|
13
13
|
this.llm = new LLM(globals.config.llm);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async
|
|
16
|
+
async identify() {
|
|
17
17
|
const files = globals.graphs.map(graph => graph.file).filter(Boolean);
|
|
18
18
|
let openPackageDefinitions = this._readOpenPackageDefinitions();
|
|
19
19
|
openPackageDefinitions = JSON.parse(openPackageDefinitions);
|
|
@@ -21,17 +21,17 @@ class EnvironmentService {
|
|
|
21
21
|
|
|
22
22
|
const definitions = openPackageDefinitions.map(item => ({ name: item.name, description: item.description }));
|
|
23
23
|
|
|
24
|
-
let prompt = PromptsUtil.read("graph.
|
|
24
|
+
let prompt = PromptsUtil.read("graph.identify.runner");
|
|
25
25
|
prompt = prompt.replaceAll("***FILES***", JSON.stringify(files));
|
|
26
26
|
prompt = prompt.replaceAll("***WORKFLOW_RUNNERS***", JSON.stringify(definitions));
|
|
27
|
-
Logger.detailed("
|
|
27
|
+
Logger.detailed("Identify Runners Prompt: " + prompt);
|
|
28
28
|
|
|
29
29
|
const response = await this.llm.generate({ prompt: prompt, json: true });
|
|
30
|
-
Logger.detailed("
|
|
30
|
+
Logger.detailed("Identify Runners: " + JSON.stringify(response));
|
|
31
31
|
|
|
32
|
-
this.
|
|
32
|
+
this._saveRunners(response.runners);
|
|
33
33
|
|
|
34
|
-
return response.
|
|
34
|
+
return response.runners;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
_readOpenPackageDefinitions() {
|
|
@@ -41,30 +41,30 @@ class EnvironmentService {
|
|
|
41
41
|
return content;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
if (!fs.existsSync(
|
|
44
|
+
loadRunners() {
|
|
45
|
+
if (!fs.existsSync(RunnerIdentificationService.runnersFile)) {
|
|
46
46
|
return [];
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
return JSON.parse(
|
|
51
|
-
fs.readFileSync(
|
|
51
|
+
fs.readFileSync(RunnerIdentificationService.runnersFile, "utf8")
|
|
52
52
|
);
|
|
53
53
|
} catch (error) {
|
|
54
|
-
throw new Error(`Failed to load
|
|
54
|
+
throw new Error(`Failed to load runners: ${error.message}`);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
fs.mkdirSync(
|
|
58
|
+
_saveRunners(runners) {
|
|
59
|
+
fs.mkdirSync(RunnerIdentificationService.baseDir, { recursive: true });
|
|
60
60
|
|
|
61
61
|
fs.writeFileSync(
|
|
62
|
-
|
|
63
|
-
JSON.stringify(
|
|
62
|
+
RunnerIdentificationService.runnersFile,
|
|
63
|
+
JSON.stringify(runners, null, 4),
|
|
64
64
|
"utf8"
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
module.exports =
|
|
70
|
+
module.exports = RunnerIdentificationService;
|
|
@@ -16,7 +16,7 @@ class SessionManager {
|
|
|
16
16
|
BUILD_NODES: "build_nodes",
|
|
17
17
|
CONNECT_EDGES: "connect_edges",
|
|
18
18
|
BUILD_WORKFLOWS: "build_workflows",
|
|
19
|
-
DEFINE_ENVIRONMENTS: "
|
|
19
|
+
DEFINE_ENVIRONMENTS: "identify_runners",
|
|
20
20
|
STATIC_ANALYSIS: "static_analysis",
|
|
21
21
|
DEEP_ANALYSIS: "deep_analysis",
|
|
22
22
|
};
|
package/utils/fileUtil.js
CHANGED
|
@@ -18,10 +18,6 @@ class FileUtil {
|
|
|
18
18
|
|
|
19
19
|
fs.mkdirSync(root, { recursive: true });
|
|
20
20
|
|
|
21
|
-
if (!Array.isArray(files)) {
|
|
22
|
-
files = [files];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
const savedFiles = [];
|
|
26
22
|
|
|
27
23
|
for (const file of files) {
|
|
@@ -31,10 +27,6 @@ class FileUtil {
|
|
|
31
27
|
|
|
32
28
|
const filename = path.basename(file.filename);
|
|
33
29
|
|
|
34
|
-
if (filename !== file.filename || !filename.endsWith(".py")) {
|
|
35
|
-
throw new Error(`Invalid filename: ${file.filename}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
30
|
let destination = path.resolve(root, filename);
|
|
39
31
|
|
|
40
32
|
try {
|
package/utils/logger.js
CHANGED
|
@@ -19,9 +19,9 @@ class Logger {
|
|
|
19
19
|
|
|
20
20
|
if (!this.logPath) return;
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const logLevel = globals.log_level;
|
|
23
23
|
|
|
24
|
-
this.currentLevel = Logger.LEVELS[
|
|
24
|
+
this.currentLevel = Logger.LEVELS[logLevel] ?? Logger.LEVELS.DETAILED;
|
|
25
25
|
|
|
26
26
|
fs.mkdirSync(this.logPath, { recursive: true });
|
|
27
27
|
}
|
|
@@ -41,9 +41,9 @@ class Logger {
|
|
|
41
41
|
static _write(level, message) {
|
|
42
42
|
if (Logger.LEVELS[level] > this.currentLevel) return;
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const formattedMessage = typeof message === 'string' ? message : JSON.stringify(message);
|
|
45
|
+
|
|
46
|
+
const logLine = `[${new Date().toISOString()}] [${level}] ${formattedMessage}`;
|
|
47
47
|
|
|
48
48
|
// Console logging (DETAILED is suppressed)
|
|
49
49
|
switch (level) {
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
const LLM = require('../../../llm/llm');
|
|
2
|
-
const PromptsUtil = require('../../../utils/promptsUtil');
|
|
3
|
-
const Logger = require('../../../utils/logger');
|
|
4
|
-
const globals = require('../../../globals');
|
|
5
|
-
const execUtil = require('../../../utils/execUtil');
|
|
6
|
-
|
|
7
|
-
class EnvironmentAgent {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.existingEnvironments = [];
|
|
10
|
-
|
|
11
|
-
this.llm = new LLM(globals.config.llm);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async setup(workflow) {
|
|
15
|
-
const environment = this._findEnvironment(workflow);
|
|
16
|
-
|
|
17
|
-
if (!this.existingEnvironments.includes(environment.name)) {
|
|
18
|
-
let results = [];
|
|
19
|
-
|
|
20
|
-
// install runtime
|
|
21
|
-
for (let attempts = 0; attempts < 3; attempts++) {
|
|
22
|
-
results = await this._setupRuntime(environment.runtime, results);
|
|
23
|
-
const assessment = await this._assessResults(environment.runtime, results);
|
|
24
|
-
|
|
25
|
-
if (assessment) {
|
|
26
|
-
this.existingEnvironments.push(environment.name);
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// install open package if required for the environment
|
|
32
|
-
const workflowRunnerPackage = globals.openPackages.find(item => item.name === environment.workflowRunner);
|
|
33
|
-
if (workflowRunnerPackage) {
|
|
34
|
-
results = await this._setupOpenPackage(workflowRunnerPackage.name, workflowRunnerPackage.installations);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const complete = this.existingEnvironments.includes(environment.name);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
complete: complete,
|
|
42
|
-
environment: environment
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async _setupOpenPackage(packageName, installations) {
|
|
47
|
-
const results = [];
|
|
48
|
-
|
|
49
|
-
const installResult = await execUtil.installPackage(packageName);
|
|
50
|
-
results.push(installResult);
|
|
51
|
-
|
|
52
|
-
if (installResult.success) {
|
|
53
|
-
const loadResult = await execUtil.loadPackage(packageName);
|
|
54
|
-
results.push(loadResult);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if(installations && installations.length > 0) {
|
|
58
|
-
for(const installation of installations) {
|
|
59
|
-
await execUtil.exec(installation);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return results;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async _setupRuntime(runtimeDetails, existingResults) {
|
|
67
|
-
let prompt = PromptsUtil.read("deep.env.runtime");
|
|
68
|
-
prompt = prompt.replaceAll("***RUNTIME_DETAILS***", runtimeDetails);
|
|
69
|
-
prompt = prompt.replaceAll("***OS***", process.platform);
|
|
70
|
-
prompt = prompt.replaceAll("***RESULTS***", JSON.stringify(existingResults ?? "NONE"));
|
|
71
|
-
Logger.detailed("Setup runtime details: " + prompt);
|
|
72
|
-
|
|
73
|
-
const response = await this.llm.generate({ prompt: prompt, json: true });
|
|
74
|
-
Logger.detailed("Commands Generated: " + JSON.stringify(response));
|
|
75
|
-
|
|
76
|
-
const results = [];
|
|
77
|
-
for(const command of response.commands) {
|
|
78
|
-
const result = await execUtil.exec(command);
|
|
79
|
-
|
|
80
|
-
results.push(result);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return results;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async _assessResults(runtimeDetails, results) {
|
|
87
|
-
let prompt = PromptsUtil.read("deep.env.assess");
|
|
88
|
-
prompt = prompt.replaceAll("***RUNTIME_DETAILS***", runtimeDetails);
|
|
89
|
-
prompt = prompt.replaceAll("***RESULTS***", JSON.stringify(results ?? "NONE"));
|
|
90
|
-
Logger.detailed("Setup runtime details: " + prompt);
|
|
91
|
-
|
|
92
|
-
const response = await this.llm.generate({ prompt: prompt, text: true });
|
|
93
|
-
Logger.detailed("Setup Exit: " + response);
|
|
94
|
-
|
|
95
|
-
return String(response || "").trim().toUpperCase() === "TRUE";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
_findEnvironment(workflow) {
|
|
99
|
-
// 1. Collect node IDs
|
|
100
|
-
const nodeIds = new Set([
|
|
101
|
-
workflow.node,
|
|
102
|
-
...(workflow.childNodes || [])
|
|
103
|
-
]);
|
|
104
|
-
|
|
105
|
-
// 2. Map node IDs to source files
|
|
106
|
-
const sourceFiles = new Set();
|
|
107
|
-
|
|
108
|
-
for (const graph of globals.graphs || []) {
|
|
109
|
-
const nodes = graph.graph?.nodes || [];
|
|
110
|
-
|
|
111
|
-
if (nodes.some(node => nodeIds.has(node.id))) {
|
|
112
|
-
if (graph.file?.file) {
|
|
113
|
-
sourceFiles.add(graph.file.file);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 3. Find matching environments
|
|
119
|
-
return (globals.environments || []).find(environment =>
|
|
120
|
-
(environment.files || []).some(file => sourceFiles.has(file))
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
module.exports = EnvironmentAgent;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const LLM = require('../../../llm/llm');
|
|
2
|
-
const PromptsUtil = require('../../../utils/promptsUtil');
|
|
3
|
-
const Logger = require('../../../utils/logger');
|
|
4
|
-
const globals = require("../../../globals");
|
|
5
|
-
|
|
6
|
-
class PlanAgent {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.llm = new LLM(globals.config.llm);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async plan(src, runtime) {
|
|
12
|
-
// prompt for prompt, sequence, formatted output
|
|
13
|
-
let prompt = PromptsUtil.read("deep.plans");
|
|
14
|
-
prompt = prompt.replaceAll("***SOURCE***", src);
|
|
15
|
-
prompt = prompt.replaceAll("***OS***", process.platform);
|
|
16
|
-
prompt = prompt.replaceAll("***RUNTIME***", runtime);
|
|
17
|
-
Logger.detailed("Generated Plans Prompt: " + prompt);
|
|
18
|
-
|
|
19
|
-
const response = await this.llm.generate({ prompt: prompt, json: true });
|
|
20
|
-
Logger.detailed("Generated Plans: " + JSON.stringify(response));
|
|
21
|
-
|
|
22
|
-
return response.plans;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = PlanAgent;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
**SOURCE**
|
|
2
|
-
***SOURCE***
|
|
3
|
-
|
|
4
|
-
**OPERATING SYSTEM:**
|
|
5
|
-
***OS***
|
|
6
|
-
|
|
7
|
-
Generate all required files and return them as a JSON array.
|
|
8
|
-
|
|
9
|
-
Each array element must contain exactly two fields:
|
|
10
|
-
|
|
11
|
-
- `filename`: File name including extension.
|
|
12
|
-
- `content`: Complete source code or content of the file.
|
|
13
|
-
|
|
14
|
-
Requirements:
|
|
15
|
-
1. Generate complete file contents, not descriptions, summaries, or pseudocode.
|
|
16
|
-
2. Preserve proper formatting, indentation, and line breaks.
|
|
17
|
-
3. Escape special characters correctly to ensure valid JSON.
|
|
18
|
-
4. Do not include Markdown code fences inside file content.
|
|
19
|
-
5. Generate a separate array element for each file.
|
|
20
|
-
6. Do not include directory paths in filenames.
|
|
21
|
-
7. If no files need to be generated, return an empty array.
|
|
22
|
-
8. Do not include any explanatory text before or after the JSON.
|
|
23
|
-
|
|
24
|
-
**Output format:**
|
|
25
|
-
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
"filename": "example.py",
|
|
29
|
-
"content": "Complete source code of the file"
|
|
30
|
-
}
|
|
31
|
-
]
|
package/prompts/deep.plans
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# EXECUTION PLAN GENERATOR
|
|
2
|
-
|
|
3
|
-
You are an execution planner responsible for converting supplied source code or descriptive instructions into the smallest practical sequence of executable plans.
|
|
4
|
-
|
|
5
|
-
Your objective is to generate pseudocode for scripts that execute and validate the intended functionality.
|
|
6
|
-
|
|
7
|
-
## INPUT
|
|
8
|
-
|
|
9
|
-
**SOURCE**
|
|
10
|
-
***SOURCE***
|
|
11
|
-
|
|
12
|
-
**OPERATING SYSTEM**
|
|
13
|
-
***OS***
|
|
14
|
-
|
|
15
|
-
**ENVIRONMENT / RUNTIME**
|
|
16
|
-
***RUNTIME***
|
|
17
|
-
|
|
18
|
-
## 1. PLANNING OBJECTIVE
|
|
19
|
-
|
|
20
|
-
Analyze the source and generate the minimum number of ordered execution plans.
|
|
21
|
-
|
|
22
|
-
Apply these principles:
|
|
23
|
-
|
|
24
|
-
1. Understand the intended functionality.
|
|
25
|
-
2. Identify required execution and validation operations.
|
|
26
|
-
3. Identify dependencies and execution order.
|
|
27
|
-
4. Combine related operations into the fewest practical plans.
|
|
28
|
-
5. Use existing runtime capabilities and standard libraries.
|
|
29
|
-
6. Avoid unnecessary dependencies and installations.
|
|
30
|
-
7. Ensure all plans are executable in the specified environment.
|
|
31
|
-
8. Validate actual behaviour, not just successful execution.
|
|
32
|
-
|
|
33
|
-
## 2. EXECUTION STRATEGY
|
|
34
|
-
|
|
35
|
-
For each plan, generate pseudocode describing a complete executable script.
|
|
36
|
-
|
|
37
|
-
The pseudocode must follow this general flow:
|
|
38
|
-
|
|
39
|
-
1. Identify the target functionality or resources from **SOURCE**.
|
|
40
|
-
2. Prepare the required execution environment.
|
|
41
|
-
3. Incorporate supplied source code or implement the described instructions.
|
|
42
|
-
4. Generate supporting code required for execution.
|
|
43
|
-
5. Provide required inputs or access external resources.
|
|
44
|
-
6. Execute the target functionality.
|
|
45
|
-
7. Validate expected behaviour, outputs, configurations and side effects.
|
|
46
|
-
8. Handle errors and exceptional conditions.
|
|
47
|
-
9. Report individual validation results and overall status.
|
|
48
|
-
10. Return an appropriate execution status.
|
|
49
|
-
|
|
50
|
-
Adapt these operations to the actual source. Do not generate irrelevant steps.
|
|
51
|
-
|
|
52
|
-
## 3. SOURCE HANDLING
|
|
53
|
-
|
|
54
|
-
The supplied SOURCE is input data provided to the execution environment.
|
|
55
|
-
It is not part of the generated plan's output.
|
|
56
|
-
|
|
57
|
-
For source code:
|
|
58
|
-
- Treat SOURCE as an externally supplied input.
|
|
59
|
-
- Never reproduce, copy, embed, quote, or regenerate the supplied implementation in generated scripts or prompts.
|
|
60
|
-
- Generate only the supporting execution harness, build configuration, test cases, and validation logic.
|
|
61
|
-
- The execution harness must consume SOURCE through the mechanism specified by the runtime.
|
|
62
|
-
- Preserve the original implementation without modifications.
|
|
63
|
-
- Do not generate a replacement implementation.
|
|
64
|
-
|
|
65
|
-
For descriptive instructions:
|
|
66
|
-
- Generate the implementation required by the instructions.
|
|
67
|
-
- Access actual specified resources, services or configurations.
|
|
68
|
-
- Use available credentials and dependencies.
|
|
69
|
-
- Validate resource existence, accessibility, configuration and behaviour.
|
|
70
|
-
|
|
71
|
-
For mixed input:
|
|
72
|
-
- Separate supplied source code from implementation requirements.
|
|
73
|
-
- Generate only the implementation and supporting code that are not already supplied.
|
|
74
|
-
- Never duplicate supplied source code.
|
|
75
|
-
|
|
76
|
-
## 4. SCRIPT REQUIREMENTS
|
|
77
|
-
|
|
78
|
-
- Generate self-contained scripts wherever practical.
|
|
79
|
-
- Prefer a single script over multiple files.
|
|
80
|
-
- Use native runtime capabilities and standard libraries.
|
|
81
|
-
- Do not use pytest, unittest or any external testing framework.
|
|
82
|
-
- Implement custom validation using native language features.
|
|
83
|
-
- Do not require interactive manual input.
|
|
84
|
-
- Do not fabricate credentials, resource identifiers or expected results.
|
|
85
|
-
- Avoid destructive operations unless explicitly required.
|
|
86
|
-
- Report skipped or incomplete validations accurately.
|
|
87
|
-
- Return a non-zero exit status when required validations fail.
|
|
88
|
-
|
|
89
|
-
## 5. PLAN GENERATION RULES
|
|
90
|
-
|
|
91
|
-
- Each plan represents one logical execution unit.
|
|
92
|
-
- Execute plans in dependency order.
|
|
93
|
-
- Combine compatible operations.
|
|
94
|
-
- Split plans only when necessary.
|
|
95
|
-
- Avoid redundant commands and scripts.
|
|
96
|
-
- Do not assume unavailable dependencies or capabilities.
|
|
97
|
-
- Generate concrete commands compatible with the operating system.
|
|
98
|
-
- Ensure generated scripts are actually executed.
|
|
99
|
-
|
|
100
|
-
OS-SPECIFIC COMMAND GENERATION
|
|
101
|
-
1. Identify the operating system from ***OS***.
|
|
102
|
-
2. Generate commands exclusively using syntax supported by that operating system.
|
|
103
|
-
3. Select the appropriate shell and command interpreter:
|
|
104
|
-
- win32: Windows CMD or PowerShell.
|
|
105
|
-
- linux: Linux shell (Bash).
|
|
106
|
-
- darwin: macOS shell (Bash or Zsh).
|
|
107
|
-
4. Adapt directory creation, file paths, environment variables, executable invocation and file operations to the selected OS.
|
|
108
|
-
5. Use the appropriate runtime executable (e.g. python, python3, node).
|
|
109
|
-
6. Handle OS-specific command chaining, quoting and exit codes correctly.
|
|
110
|
-
7. Never generate commands from another operating system.
|
|
111
|
-
8. If the OS is unknown or unsupported, do not assume a shell; report the limitation.
|
|
112
|
-
|
|
113
|
-
## OUTPUT FORMAT
|
|
114
|
-
|
|
115
|
-
Return ONLY a valid JSON object.
|
|
116
|
-
|
|
117
|
-
{
|
|
118
|
-
"plans": [
|
|
119
|
-
{
|
|
120
|
-
"prompt": "Pseudocode describing what code to generate and which files to create.",
|
|
121
|
-
"commands": [
|
|
122
|
-
"command to execute first",
|
|
123
|
-
"command to execute next"
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
Each plan must contain exactly:
|
|
130
|
-
- `prompt`: Must explicitly specify every file to create, its path, filename, contents or implementation responsibilities, and dependencies between generated files. Describe the complete pseudocode for generating the required code.
|
|
131
|
-
- `commands`: An ordered array of executable commands to run after the files have been generated.
|
|
132
|
-
|
|
133
|
-
## FILE GENERATION RULES
|
|
134
|
-
|
|
135
|
-
1. Explicitly specify all files that must be created.
|
|
136
|
-
2. Specify the filename and relative or absolute path for every file.
|
|
137
|
-
3. Specify the purpose and contents of each file.
|
|
138
|
-
4. Include all supporting code required for execution and validation.
|
|
139
|
-
5. Prefer a single self-contained script whenever practical.
|
|
140
|
-
6. Do not assume generated files already exist.
|
|
141
|
-
7. Do not generate unnecessary files.
|
|
142
|
-
8. Ensure commands reference the exact generated filenames and paths.
|
|
143
|
-
|
|
144
|
-
## COMMAND EXECUTION RULES
|
|
145
|
-
|
|
146
|
-
1. Commands must execute in sequential order.
|
|
147
|
-
2. The first command must prepare the required working directory if necessary.
|
|
148
|
-
3. Include dependency installation only when strictly required.
|
|
149
|
-
4. Execute generated scripts using the specified runtime.
|
|
150
|
-
5. Include subsequent commands for additional validation only when necessary.
|
|
151
|
-
6. Do not include file-generation instructions as executable commands unless the environment explicitly supports them.
|
|
152
|
-
7. Never reference a file that has not been specified in the prompt.
|
|
153
|
-
8. Do not use placeholders or interactive commands.
|