@neotx/core 0.1.0-alpha.2 → 0.1.0-alpha.3
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/index.js +66 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2521,7 +2521,6 @@ import { randomUUID as randomUUID3 } from "crypto";
|
|
|
2521
2521
|
import { readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
|
|
2522
2522
|
import { homedir as homedir2 } from "os";
|
|
2523
2523
|
import path12 from "path";
|
|
2524
|
-
import { fileURLToPath } from "url";
|
|
2525
2524
|
|
|
2526
2525
|
// src/supervisor/memory.ts
|
|
2527
2526
|
import { appendFile as appendFile5, readFile as readFile8, rename as rename2, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -2658,23 +2657,74 @@ function buildHeartbeatPrompt(opts) {
|
|
|
2658
2657
|
You orchestrate developer agents across repositories. You make decisions autonomously.
|
|
2659
2658
|
|
|
2660
2659
|
Your job:
|
|
2661
|
-
1. Process
|
|
2662
|
-
2.
|
|
2663
|
-
3. Update your memory with
|
|
2664
|
-
4. If nothing to do,
|
|
2660
|
+
1. Process incoming events (webhooks, user messages, run completions)
|
|
2661
|
+
2. Dispatch agents, check status, or respond to users
|
|
2662
|
+
3. Update your memory with context for future heartbeats
|
|
2663
|
+
4. If nothing to do, acknowledge and wait
|
|
2665
2664
|
|
|
2666
|
-
|
|
2667
|
-
neo run <agent> --prompt "..." [--repo <path>] dispatch an agent
|
|
2668
|
-
neo runs --short [--all] check recent runs
|
|
2669
|
-
neo cost --short [--all] check budget
|
|
2670
|
-
neo agents list available agents
|
|
2665
|
+
## Commands
|
|
2671
2666
|
|
|
2672
|
-
|
|
2667
|
+
### Dispatching agents
|
|
2668
|
+
\`\`\`bash
|
|
2669
|
+
neo run <agent> --prompt "..." --repo <path> [--priority critical|high|medium|low] [--meta '<json>']
|
|
2670
|
+
\`\`\`
|
|
2671
|
+
|
|
2672
|
+
The \`--meta\` flag accepts a JSON object attached to the run and all its events. It serves two purposes:
|
|
2673
|
+
1. **Traceability**: links every run to its source (ticket, PR, branch) for cost tracking and audit.
|
|
2674
|
+
2. **Idempotency**: neo deduplicates dispatches by metadata \u2014 same \`--meta\` twice is rejected.
|
|
2675
|
+
|
|
2676
|
+
Always pass \`--meta\` when dispatching. Include at minimum the source identifier and pipeline stage. See your custom instructions for the exact fields required by your workflow.
|
|
2677
|
+
|
|
2678
|
+
**Standard metadata fields:**
|
|
2679
|
+
|
|
2680
|
+
| Field | When | Description |
|
|
2681
|
+
|-------|------|-------------|
|
|
2682
|
+
| \`ticketId\` | always | Source ticket identifier for traceability |
|
|
2683
|
+
| \`stage\` | always | Pipeline stage: \`refine\`, \`develop\`, \`review\`, \`fix\` |
|
|
2684
|
+
| \`branch\` | if exists | Git branch the agent should work on |
|
|
2685
|
+
| \`prNumber\` | if exists | GitHub PR number |
|
|
2686
|
+
| \`cycle\` | fix stage | Fixer\u2192review cycle count (for anti-loop guards) |
|
|
2687
|
+
|
|
2688
|
+
**Branch & PR rules:**
|
|
2689
|
+
- First dispatch (develop): no branch/PR yet \u2014 instruct the agent in \`--prompt\` to create a feature branch and open a PR. Omit \`branch\` and \`prNumber\` from \`--meta\`.
|
|
2690
|
+
- Subsequent dispatches (review/fix): branch and PR exist \u2014 pass \`branch\` and \`prNumber\` in \`--meta\` and reference them in \`--prompt\`.
|
|
2691
|
+
|
|
2692
|
+
Examples:
|
|
2693
|
+
\`\`\`bash
|
|
2694
|
+
# First dispatch \u2014 instruct agent to create branch + PR
|
|
2695
|
+
neo run developer --prompt "Implement feature X. Criteria: ... Create branch feat/PROJ-42-feature-x and open a PR when done." \\
|
|
2696
|
+
--repo /path/to/repo \\
|
|
2697
|
+
--meta '{"ticketId":"PROJ-42","stage":"develop"}'
|
|
2698
|
+
|
|
2699
|
+
# Review \u2014 reference existing branch and PR
|
|
2700
|
+
neo run reviewer-quality --prompt "Review PR #73 on branch feat/PROJ-42-feature-x." \\
|
|
2701
|
+
--repo /path/to/repo \\
|
|
2702
|
+
--meta '{"ticketId":"PROJ-42","stage":"review","branch":"feat/PROJ-42-feature-x","prNumber":73}'
|
|
2703
|
+
|
|
2704
|
+
# Fix \u2014 instruct to push to existing branch
|
|
2705
|
+
neo run fixer --prompt "Fix issues from review on PR #73 (branch feat/PROJ-42-feature-x): ... Push fixes to the existing branch." \\
|
|
2706
|
+
--repo /path/to/repo \\
|
|
2707
|
+
--meta '{"ticketId":"PROJ-42","stage":"fix","branch":"feat/PROJ-42-feature-x","prNumber":73,"cycle":2}'
|
|
2708
|
+
|
|
2709
|
+
# Architect \u2014 read-only, no branch needed
|
|
2710
|
+
neo run architect --prompt "Design decomposition for feature Y" \\
|
|
2711
|
+
--repo /path/to/repo \\
|
|
2712
|
+
--meta '{"ticketId":"PROJ-99","stage":"refine"}'
|
|
2713
|
+
\`\`\`
|
|
2714
|
+
|
|
2715
|
+
### Other commands
|
|
2716
|
+
\`\`\`bash
|
|
2717
|
+
neo runs --short [--all] # check recent runs
|
|
2718
|
+
neo runs <runId> # full run details
|
|
2719
|
+
neo cost --short [--all] # check budget
|
|
2720
|
+
neo agents # list available agents
|
|
2721
|
+
neo log <type> "<message>" # log a progress report (types: decision, action, blocker, progress)
|
|
2722
|
+
\`\`\`
|
|
2673
2723
|
|
|
2674
2724
|
## Reporting
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2725
|
+
Log every decision and action with \`neo log\`. These logs are your audit trail.
|
|
2726
|
+
|
|
2727
|
+
IMPORTANT: Always include a <memory>...</memory> block at the end of your response with your updated memory.`);
|
|
2678
2728
|
if (opts.customInstructions) {
|
|
2679
2729
|
sections.push(`## Custom instructions
|
|
2680
2730
|
${opts.customInstructions}`);
|
|
@@ -2891,32 +2941,19 @@ var HeartbeatLoop = class {
|
|
|
2891
2941
|
let turnCount = 0;
|
|
2892
2942
|
try {
|
|
2893
2943
|
const sdk = await import("@anthropic-ai/claude-agent-sdk");
|
|
2894
|
-
const allowedTools = ["Bash", "Read"
|
|
2944
|
+
const allowedTools = ["Bash", "Read"];
|
|
2895
2945
|
if (this.config.mcpServers) {
|
|
2896
2946
|
for (const name of Object.keys(this.config.mcpServers)) {
|
|
2897
2947
|
allowedTools.push(`mcp__${name}__*`);
|
|
2898
2948
|
}
|
|
2899
2949
|
}
|
|
2900
|
-
const mcpInternalPath = path12.join(
|
|
2901
|
-
path12.dirname(fileURLToPath(import.meta.url)),
|
|
2902
|
-
"mcp-internal.js"
|
|
2903
|
-
);
|
|
2904
|
-
const mcpServers = {
|
|
2905
|
-
neo: {
|
|
2906
|
-
type: "stdio",
|
|
2907
|
-
command: "node",
|
|
2908
|
-
args: [mcpInternalPath],
|
|
2909
|
-
env: { NEO_ACTIVITY_PATH: this.activityLog.filePath }
|
|
2910
|
-
},
|
|
2911
|
-
...this.config.mcpServers ?? {}
|
|
2912
|
-
};
|
|
2913
2950
|
const queryOptions = {
|
|
2914
2951
|
cwd: homedir2(),
|
|
2915
2952
|
maxTurns: 50,
|
|
2916
2953
|
allowedTools,
|
|
2917
2954
|
permissionMode: "bypassPermissions",
|
|
2918
2955
|
allowDangerouslySkipPermissions: true,
|
|
2919
|
-
mcpServers
|
|
2956
|
+
mcpServers: this.config.mcpServers ?? {}
|
|
2920
2957
|
};
|
|
2921
2958
|
const stream = sdk.query({ prompt, options: queryOptions });
|
|
2922
2959
|
for await (const message of stream) {
|