@nyxa/nyx-agent 0.3.3 → 0.3.5
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/cli.js +1 -1
- package/dist/commands/init.js +43 -7
- package/docs/nyxagent-v0-spec.md +5 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ program
|
|
|
17
17
|
.option("--missing", "only add missing template files")
|
|
18
18
|
.option("--harness <preset>", "harness preset: codex, claude, or custom")
|
|
19
19
|
.option("--model <name>", "model name")
|
|
20
|
-
.option("--reasoning-level <level>", "harness-neutral reasoning level")
|
|
20
|
+
.option("--reasoning-level <level>", "default harness-neutral reasoning level")
|
|
21
21
|
.option("--max-iterations <count>", "maximum work items per run")
|
|
22
22
|
.option("--work-items-source <source>", "work item source template: local or github")
|
|
23
23
|
.option("--work-items-path <path>", "local markdown work item directory")
|
package/dist/commands/init.js
CHANGED
|
@@ -6,6 +6,8 @@ import pc from "picocolors";
|
|
|
6
6
|
import { ensureDir, pathExists, readText, writeText } from "../runtime/files.js";
|
|
7
7
|
import { getNyxDir, relativeToProject } from "../runtime/paths.js";
|
|
8
8
|
const DEFAULT_OPENAI_MODEL = "gpt-5.5";
|
|
9
|
+
const GITIGNORE_MARKER = "# NyxAgent runtime artifacts";
|
|
10
|
+
const GITIGNORE_ENTRIES = [".nyxagent/runs/", ".nyxagent/state.json"];
|
|
9
11
|
export async function initCommand(options, projectRoot = process.cwd()) {
|
|
10
12
|
const root = path.resolve(projectRoot);
|
|
11
13
|
const nyxDir = getNyxDir(root);
|
|
@@ -21,6 +23,7 @@ export async function initCommand(options, projectRoot = process.cwd()) {
|
|
|
21
23
|
await ensureDir(nyxDir);
|
|
22
24
|
const templatesDir = getTemplatesDir();
|
|
23
25
|
await copyTemplateTree(templatesDir, nyxDir, Boolean(options.missing));
|
|
26
|
+
await ensureGitignoreEntries(root);
|
|
24
27
|
if (resolved) {
|
|
25
28
|
await writeText(configPath, buildConfigToml(resolved));
|
|
26
29
|
}
|
|
@@ -47,7 +50,7 @@ async function resolveInitOptions(options, root) {
|
|
|
47
50
|
}));
|
|
48
51
|
const reasoningLevel = options.reasoningLevel ??
|
|
49
52
|
(await input({
|
|
50
|
-
message: "
|
|
53
|
+
message: "Default reasoning level",
|
|
51
54
|
default: "medium"
|
|
52
55
|
}));
|
|
53
56
|
const parsedMaxIterations = options.maxIterations
|
|
@@ -146,6 +149,45 @@ async function ensureWorkItemsDirectory(root, taskPath) {
|
|
|
146
149
|
throw new Error(`Work item path is not a directory: ${taskPath}`);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
152
|
+
async function ensureGitignoreEntries(root) {
|
|
153
|
+
const gitignorePath = path.join(root, ".gitignore");
|
|
154
|
+
const current = (await pathExists(gitignorePath))
|
|
155
|
+
? await readText(gitignorePath)
|
|
156
|
+
: "";
|
|
157
|
+
const lines = current.split(/\r?\n/);
|
|
158
|
+
const existingEntries = new Set(lines.map((line) => line.trim()));
|
|
159
|
+
const missingEntries = GITIGNORE_ENTRIES.filter((entry) => !existingEntries.has(entry));
|
|
160
|
+
if (missingEntries.length === 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const markerIndex = lines.findIndex((line) => line.trim() === GITIGNORE_MARKER);
|
|
164
|
+
let updated;
|
|
165
|
+
if (markerIndex >= 0) {
|
|
166
|
+
const nextLines = [...lines];
|
|
167
|
+
nextLines.splice(markerIndex + 1, 0, ...missingEntries);
|
|
168
|
+
updated = normalizeGitignoreContent(nextLines.join("\n"));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const prefix = getGitignoreAppendPrefix(current);
|
|
172
|
+
updated = `${current}${prefix}${GITIGNORE_MARKER}\n${missingEntries.join("\n")}\n`;
|
|
173
|
+
}
|
|
174
|
+
await writeText(gitignorePath, updated);
|
|
175
|
+
}
|
|
176
|
+
function getGitignoreAppendPrefix(current) {
|
|
177
|
+
if (current.length === 0) {
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
if (current.endsWith("\n\n")) {
|
|
181
|
+
return "";
|
|
182
|
+
}
|
|
183
|
+
if (current.endsWith("\n")) {
|
|
184
|
+
return "\n";
|
|
185
|
+
}
|
|
186
|
+
return "\n\n";
|
|
187
|
+
}
|
|
188
|
+
function normalizeGitignoreContent(value) {
|
|
189
|
+
return `${value.replace(/\n*$/, "")}\n`;
|
|
190
|
+
}
|
|
149
191
|
function buildConfigToml(options) {
|
|
150
192
|
const harness = buildHarnessToml(options.harness);
|
|
151
193
|
const workItems = buildWorkItemsToml(options);
|
|
@@ -185,9 +227,6 @@ prompt = "prompts/execution.md"
|
|
|
185
227
|
next = "review"
|
|
186
228
|
max_visits_per_iteration = 3
|
|
187
229
|
|
|
188
|
-
[phases.model]
|
|
189
|
-
reasoning_level = "high"
|
|
190
|
-
|
|
191
230
|
[[phases]]
|
|
192
231
|
id = "review"
|
|
193
232
|
prompt = "prompts/review.md"
|
|
@@ -195,9 +234,6 @@ output_schema = "schemas/review.schema.json"
|
|
|
195
234
|
required_output = true
|
|
196
235
|
max_visits_per_iteration = 3
|
|
197
236
|
|
|
198
|
-
[phases.model]
|
|
199
|
-
reasoning_level = "high"
|
|
200
|
-
|
|
201
237
|
[phases.harness]
|
|
202
238
|
args = ${formatTomlArray(buildReadOnlyArgs(options.harness))}
|
|
203
239
|
|
package/docs/nyxagent-v0-spec.md
CHANGED
|
@@ -137,9 +137,6 @@ prompt = "prompts/execution.md"
|
|
|
137
137
|
next = "review"
|
|
138
138
|
max_visits_per_iteration = 3
|
|
139
139
|
|
|
140
|
-
[phases.model]
|
|
141
|
-
reasoning_level = "high"
|
|
142
|
-
|
|
143
140
|
[[phases]]
|
|
144
141
|
id = "review"
|
|
145
142
|
prompt = "prompts/review.md"
|
|
@@ -147,9 +144,6 @@ output_schema = "schemas/review.schema.json"
|
|
|
147
144
|
required_output = true
|
|
148
145
|
max_visits_per_iteration = 3
|
|
149
146
|
|
|
150
|
-
[phases.model]
|
|
151
|
-
reasoning_level = "high"
|
|
152
|
-
|
|
153
147
|
[phases.harness]
|
|
154
148
|
args = [
|
|
155
149
|
"exec",
|
|
@@ -178,7 +172,11 @@ max_visits_per_iteration = 1
|
|
|
178
172
|
item.
|
|
179
173
|
- `model.reasoning_level` is a harness-neutral string.
|
|
180
174
|
- Harness args are declarative and may interpolate config/runtime variables.
|
|
181
|
-
- Per-phase `model` and `harness` blocks override global values
|
|
175
|
+
- Per-phase `model` and `harness` blocks override global values when explicitly
|
|
176
|
+
declared.
|
|
177
|
+
- The initial selection phase is declared in `[[phases]]`, but the runtime treats
|
|
178
|
+
`workflow.entry_phase` as the selection step and expects the selection result
|
|
179
|
+
contract.
|
|
182
180
|
- `work_items` supports only `local` and `github` in v0.
|
|
183
181
|
- `work_items.max_candidates` defaults to `50` and caps the inventory sent to
|
|
184
182
|
the initial selection prompt.
|