@neotx/core 0.1.0-alpha.1 → 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.d.ts CHANGED
@@ -1009,7 +1009,6 @@ declare function runWithRecovery(options: RecoveryOptions): Promise<SessionResul
1009
1009
 
1010
1010
  declare const supervisorDaemonStateSchema: z.ZodObject<{
1011
1011
  pid: z.ZodNumber;
1012
- tmuxSession: z.ZodString;
1013
1012
  sessionId: z.ZodString;
1014
1013
  port: z.ZodNumber;
1015
1014
  cwd: z.ZodString;
package/dist/index.js CHANGED
@@ -2164,7 +2164,6 @@ function objectDepth(obj, current = 0) {
2164
2164
  import { z as z4 } from "zod";
2165
2165
  var supervisorDaemonStateSchema = z4.object({
2166
2166
  pid: z4.number(),
2167
- tmuxSession: z4.string(),
2168
2167
  sessionId: z4.string(),
2169
2168
  port: z4.number(),
2170
2169
  cwd: z4.string(),
@@ -2522,7 +2521,6 @@ import { randomUUID as randomUUID3 } from "crypto";
2522
2521
  import { readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
2523
2522
  import { homedir as homedir2 } from "os";
2524
2523
  import path12 from "path";
2525
- import { fileURLToPath } from "url";
2526
2524
 
2527
2525
  // src/supervisor/memory.ts
2528
2526
  import { appendFile as appendFile5, readFile as readFile8, rename as rename2, writeFile as writeFile4 } from "fs/promises";
@@ -2659,23 +2657,74 @@ function buildHeartbeatPrompt(opts) {
2659
2657
  You orchestrate developer agents across repositories. You make decisions autonomously.
2660
2658
 
2661
2659
  Your job:
2662
- 1. Process any incoming events (webhooks, user messages, run completions)
2663
- 2. Decide what actions to take (dispatch agents, check status, respond to users)
2664
- 3. Update your memory with relevant context for future heartbeats
2665
- 4. If nothing to do, simply acknowledge and wait
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
2666
2664
 
2667
- Available commands (via bash):
2668
- neo run <agent> --prompt "..." [--repo <path>] dispatch an agent
2669
- neo runs --short [--all] check recent runs
2670
- neo cost --short [--all] check budget
2671
- neo agents list available agents
2665
+ ## Commands
2672
2666
 
2673
- IMPORTANT: Always include a <memory>...</memory> block at the end of your response with your updated memory.
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
+ \`\`\`
2674
2723
 
2675
2724
  ## Reporting
2676
- Use the \`mcp__neo__report_progress\` tool to log your decisions, actions and blockers.
2677
- Always report what you're doing and why \u2014 these logs are your audit trail.
2678
- Types: "decision" (what you chose), "action" (what you did), "blocker" (what's stuck), "progress" (status update).`);
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.`);
2679
2728
  if (opts.customInstructions) {
2680
2729
  sections.push(`## Custom instructions
2681
2730
  ${opts.customInstructions}`);
@@ -2892,32 +2941,19 @@ var HeartbeatLoop = class {
2892
2941
  let turnCount = 0;
2893
2942
  try {
2894
2943
  const sdk = await import("@anthropic-ai/claude-agent-sdk");
2895
- const allowedTools = ["Bash", "Read", "mcp__neo__*"];
2944
+ const allowedTools = ["Bash", "Read"];
2896
2945
  if (this.config.mcpServers) {
2897
2946
  for (const name of Object.keys(this.config.mcpServers)) {
2898
2947
  allowedTools.push(`mcp__${name}__*`);
2899
2948
  }
2900
2949
  }
2901
- const mcpInternalPath = path12.join(
2902
- path12.dirname(fileURLToPath(import.meta.url)),
2903
- "mcp-internal.js"
2904
- );
2905
- const mcpServers = {
2906
- neo: {
2907
- type: "stdio",
2908
- command: "node",
2909
- args: [mcpInternalPath],
2910
- env: { NEO_ACTIVITY_PATH: this.activityLog.filePath }
2911
- },
2912
- ...this.config.mcpServers ?? {}
2913
- };
2914
2950
  const queryOptions = {
2915
2951
  cwd: homedir2(),
2916
2952
  maxTurns: 50,
2917
2953
  allowedTools,
2918
2954
  permissionMode: "bypassPermissions",
2919
2955
  allowDangerouslySkipPermissions: true,
2920
- mcpServers
2956
+ mcpServers: this.config.mcpServers ?? {}
2921
2957
  };
2922
2958
  const stream = sdk.query({ prompt, options: queryOptions });
2923
2959
  for await (const message of stream) {
@@ -3230,7 +3266,6 @@ var SupervisorDaemon = class {
3230
3266
  await this.webhookServer.start();
3231
3267
  await this.writeState({
3232
3268
  pid: process.pid,
3233
- tmuxSession: `neo-${this.name}`,
3234
3269
  sessionId: this.sessionId,
3235
3270
  port: this.config.supervisor.port,
3236
3271
  cwd: homedir3(),