autonomous-flow-daemon 1.6.0 → 1.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +85 -85
  2. package/LICENSE +21 -21
  3. package/README-ko.md +282 -0
  4. package/README.md +282 -266
  5. package/mcp-config.json +10 -10
  6. package/package.json +4 -2
  7. package/src/adapters/index.ts +370 -370
  8. package/src/cli.ts +162 -127
  9. package/src/commands/benchmark.ts +187 -187
  10. package/src/commands/correlate.ts +180 -0
  11. package/src/commands/dashboard.ts +404 -0
  12. package/src/commands/evolution.ts +84 -1
  13. package/src/commands/fix.ts +158 -158
  14. package/src/commands/lang.ts +41 -41
  15. package/src/commands/plugin.ts +110 -0
  16. package/src/commands/restart.ts +14 -14
  17. package/src/commands/score.ts +276 -276
  18. package/src/commands/start.ts +155 -155
  19. package/src/commands/status.ts +157 -157
  20. package/src/commands/stop.ts +68 -68
  21. package/src/commands/suggest.ts +211 -0
  22. package/src/commands/sync.ts +329 -16
  23. package/src/constants.ts +32 -32
  24. package/src/core/boast.ts +280 -280
  25. package/src/core/config.ts +49 -49
  26. package/src/core/correlation-engine.ts +265 -0
  27. package/src/core/db.ts +145 -117
  28. package/src/core/discovery.ts +65 -65
  29. package/src/core/federation.ts +129 -0
  30. package/src/core/hologram/engine.ts +71 -71
  31. package/src/core/hologram/fallback.ts +11 -11
  32. package/src/core/hologram/go-extractor.ts +203 -0
  33. package/src/core/hologram/incremental.ts +227 -227
  34. package/src/core/hologram/py-extractor.ts +132 -132
  35. package/src/core/hologram/rust-extractor.ts +244 -0
  36. package/src/core/hologram/ts-extractor.ts +406 -320
  37. package/src/core/hologram/types.ts +27 -25
  38. package/src/core/hologram.ts +73 -71
  39. package/src/core/i18n/messages.ts +309 -309
  40. package/src/core/locale.ts +88 -88
  41. package/src/core/log-rotate.ts +33 -33
  42. package/src/core/log-utils.ts +38 -38
  43. package/src/core/lru-map.ts +61 -61
  44. package/src/core/notify.ts +74 -74
  45. package/src/core/plugin-manager.ts +225 -0
  46. package/src/core/rule-suggestion.ts +127 -0
  47. package/src/core/validator-generator.ts +224 -0
  48. package/src/core/workspace.ts +28 -28
  49. package/src/daemon/client.ts +78 -65
  50. package/src/daemon/event-batcher.ts +108 -108
  51. package/src/daemon/guards.ts +13 -13
  52. package/src/daemon/http-routes.ts +376 -293
  53. package/src/daemon/mcp-handler.ts +575 -270
  54. package/src/daemon/mcp-subscriptions.ts +81 -0
  55. package/src/daemon/mesh.ts +51 -0
  56. package/src/daemon/server.ts +655 -590
  57. package/src/daemon/types.ts +121 -100
  58. package/src/daemon/workspace-map.ts +104 -92
  59. package/src/platform.ts +60 -60
  60. package/src/version.ts +15 -15
  61. package/README.ko.md +0 -266
package/src/cli.ts CHANGED
@@ -1,127 +1,162 @@
1
- #!/usr/bin/env bun
2
- import { Command } from "commander";
3
- import { startCommand } from "./commands/start";
4
- import { stopCommand } from "./commands/stop";
5
- import { restartCommand } from "./commands/restart";
6
- import { statusCommand } from "./commands/status";
7
- import { scoreCommand } from "./commands/score";
8
- import { fixCommand } from "./commands/fix";
9
- import { syncCommand } from "./commands/sync";
10
- import { diagnoseCommand } from "./commands/diagnose";
11
- import { doctorCommand } from "./commands/doctor";
12
-
13
- import { vaccineCommand } from "./commands/vaccine";
14
- import { langCommand } from "./commands/lang";
15
- import { evolutionCommand } from "./commands/evolution";
16
- import { mcpCommand } from "./commands/mcp";
17
- import { statsCommand } from "./commands/stats";
18
- import { hooksCommand } from "./commands/hooks";
19
- import { benchmarkCommand } from "./commands/benchmark";
20
- import { APP_VERSION } from "./version";
21
- import { trackCliCommand } from "./core/telemetry";
22
-
23
- const program = new Command();
24
-
25
- program
26
- .name("afd")
27
- .description("Autonomous Flow Daemon - The Immune System for AI Workflows")
28
- .version(APP_VERSION);
29
-
30
- program.hook("preAction", (thisCommand) => {
31
- trackCliCommand(thisCommand.name());
32
- });
33
-
34
- program
35
- .command("start")
36
- .description("Start the afd daemon (background file watcher)")
37
- .option("--mcp", "Run in MCP stdio mode (for Claude Code tool integration)")
38
- .action(startCommand);
39
-
40
- program
41
- .command("stop")
42
- .description("Stop the afd daemon")
43
- .option("--clean", "Remove all injected hooks and MCP registrations")
44
- .action(stopCommand);
45
-
46
- program
47
- .command("restart")
48
- .description("Restart the afd daemon (stop + start)")
49
- .action(restartCommand);
50
-
51
- program
52
- .command("status")
53
- .description("Quick health check — daemon, hooks, defenses, quarantine")
54
- .action(statusCommand);
55
-
56
- program
57
- .command("score")
58
- .description("Show current diagnostic stats from the daemon")
59
- .action(scoreCommand);
60
-
61
- program
62
- .command("fix")
63
- .description("Auto-fix detected issues in AI workflow config")
64
- .action(fixCommand);
65
-
66
- program
67
- .command("sync")
68
- .description("Synchronize AI agent configs across team")
69
- .option("--push", "Push local antibodies to team vaccine store")
70
- .option("--pull", "Pull antibodies from team vaccine store")
71
- .option("--remote <url>", "Remote vaccine store URL (future)")
72
- .action(syncCommand);
73
-
74
- program
75
- .command("doctor")
76
- .description("Deep health analysis with recommendations and auto-fix")
77
- .option("--fix", "Auto-fix detected issues")
78
- .action(doctorCommand);
79
-
80
- program
81
- .command("diagnose")
82
- .description("Run headless diagnosis (used by auto-heal hooks)")
83
- .option("--format <type>", "Output format: a2a or human", "human")
84
- .option("--auto-heal", "Auto-apply patches for known antibodies")
85
- .action(diagnoseCommand);
86
-
87
- program
88
- .command("vaccine [subcommand] [arg]")
89
- .description("Vaccine registry: list, search, install, publish")
90
- .action(vaccineCommand);
91
-
92
- program
93
- .command("evolution")
94
- .description("Self-Evolution: analyze quarantined failures and generate lessons for AI agents")
95
- .action(evolutionCommand);
96
-
97
- program
98
- .command("mcp [subcommand]")
99
- .description("MCP server management (install)")
100
- .action(mcpCommand);
101
-
102
- program
103
- .command("lang [language]")
104
- .description("Show or change display language (en, ko)")
105
- .option("--list", "Show all supported languages")
106
- .action(langCommand);
107
-
108
- program
109
- .command("stats")
110
- .description("Feature usage telemetry dashboard (developer-only)")
111
- .option("--days <n>", "Number of days to aggregate", "7")
112
- .action(statsCommand);
113
-
114
- program
115
- .command("hooks [subcommand]")
116
- .description("Hook Manager: inspect and sync hook ordering (afd → omc → user)")
117
- .action(hooksCommand);
118
-
119
- program
120
- .command("benchmark")
121
- .description("Hologram AST compression benchmark across all source files")
122
- .option("--sort <key>", "Sort by: savings (default), size, name")
123
- .option("--top <n>", "Show only top N files")
124
- .option("--json", "Output raw JSON for programmatic use")
125
- .action(benchmarkCommand);
126
-
127
- program.parse();
1
+ #!/usr/bin/env bun
2
+ import { Command } from "commander";
3
+ import { startCommand } from "./commands/start";
4
+ import { stopCommand } from "./commands/stop";
5
+ import { restartCommand } from "./commands/restart";
6
+ import { statusCommand } from "./commands/status";
7
+ import { scoreCommand } from "./commands/score";
8
+ import { dashboardCommand } from "./commands/dashboard";
9
+ import { fixCommand } from "./commands/fix";
10
+ import { syncCommand } from "./commands/sync";
11
+ import { diagnoseCommand } from "./commands/diagnose";
12
+ import { doctorCommand } from "./commands/doctor";
13
+
14
+ import { vaccineCommand } from "./commands/vaccine";
15
+ import { langCommand } from "./commands/lang";
16
+ import { evolutionCommand } from "./commands/evolution";
17
+ import { mcpCommand } from "./commands/mcp";
18
+ import { statsCommand } from "./commands/stats";
19
+ import { hooksCommand } from "./commands/hooks";
20
+ import { benchmarkCommand } from "./commands/benchmark";
21
+ import { suggestCommand } from "./commands/suggest";
22
+ import { correlateCommand } from "./commands/correlate";
23
+ import { pluginCommand } from "./commands/plugin";
24
+ import { APP_VERSION } from "./version";
25
+ import { trackCliCommand } from "./core/telemetry";
26
+
27
+ const program = new Command();
28
+
29
+ program
30
+ .name("afd")
31
+ .description("Autonomous Flow Daemon - The Immune System for AI Workflows")
32
+ .version(APP_VERSION);
33
+
34
+ program.hook("preAction", (thisCommand) => {
35
+ trackCliCommand(thisCommand.name());
36
+ });
37
+
38
+ program
39
+ .command("start")
40
+ .description("Start the afd daemon (background file watcher)")
41
+ .option("--mcp", "Run in MCP stdio mode (for Claude Code tool integration)")
42
+ .action(startCommand);
43
+
44
+ program
45
+ .command("stop")
46
+ .description("Stop the afd daemon")
47
+ .option("--clean", "Remove all injected hooks and MCP registrations")
48
+ .action(stopCommand);
49
+
50
+ program
51
+ .command("restart")
52
+ .description("Restart the afd daemon (stop + start)")
53
+ .action(restartCommand);
54
+
55
+ program
56
+ .command("status")
57
+ .description("Quick health check — daemon, hooks, defenses, quarantine")
58
+ .action(statusCommand);
59
+
60
+ program
61
+ .command("score")
62
+ .description("Show current diagnostic stats from the daemon")
63
+ .action(scoreCommand);
64
+
65
+ program
66
+ .command("dashboard")
67
+ .description("Live token savings dashboard — real-time TUI (Ctrl+C to exit)")
68
+ .action(dashboardCommand);
69
+
70
+ program
71
+ .command("fix")
72
+ .description("Auto-fix detected issues in AI workflow config")
73
+ .action(fixCommand);
74
+
75
+ program
76
+ .command("sync")
77
+ .description("Synchronize AI agent configs across team")
78
+ .option("--push", "Push local antibodies to team vaccine store")
79
+ .option("--pull", "Pull antibodies from team vaccine store")
80
+ .option("--remote <url>", "Remote vaccine store URL for push/pull")
81
+ .option("--local-mesh", "Bidirectional sync with all live mesh peers (monorepo)")
82
+ .action(syncCommand);
83
+
84
+ program
85
+ .command("doctor")
86
+ .description("Deep health analysis with recommendations and auto-fix")
87
+ .option("--fix", "Auto-fix detected issues")
88
+ .action(doctorCommand);
89
+
90
+ program
91
+ .command("diagnose")
92
+ .description("Run headless diagnosis (used by auto-heal hooks)")
93
+ .option("--format <type>", "Output format: a2a or human", "human")
94
+ .option("--auto-heal", "Auto-apply patches for known antibodies")
95
+ .action(diagnoseCommand);
96
+
97
+ program
98
+ .command("vaccine [subcommand] [arg]")
99
+ .description("Vaccine registry: list, search, install, publish")
100
+ .action(vaccineCommand);
101
+
102
+ program
103
+ .command("evolution")
104
+ .description("Self-Evolution: analyze quarantined failures and generate lessons for AI agents")
105
+ .option("--generate", "Auto-generate validators from all quarantine patterns")
106
+ .action(evolutionCommand);
107
+
108
+ program
109
+ .command("suggest")
110
+ .description("Suggest validators based on recurring failure patterns in mistake history")
111
+ .option("--days <n>", "Analysis window in days", "30")
112
+ .option("--min <n>", "Minimum frequency threshold", "3")
113
+ .option("--apply", "Auto-generate validators for uncovered patterns")
114
+ .option("--cross", "Annotate suggestions matching cross-project hotspots as Community Verified")
115
+ .action(suggestCommand);
116
+
117
+ program
118
+ .command("correlate")
119
+ .description("Cross-project pattern correlation — surface Global Hotspot patterns across federated scopes")
120
+ .option("--min-scopes <n>", "Minimum distinct scopes to qualify as a global hotspot", "2")
121
+ .option("--apply", "Auto-generate global validators for uncovered hotspots")
122
+ .option("--include-local", "Include local-scope antibodies in the analysis")
123
+ .action(correlateCommand);
124
+
125
+ program
126
+ .command("mcp [subcommand]")
127
+ .description("MCP server management (install)")
128
+ .action(mcpCommand);
129
+
130
+ program
131
+ .command("lang [language]")
132
+ .description("Show or change display language (en, ko)")
133
+ .option("--list", "Show all supported languages")
134
+ .action(langCommand);
135
+
136
+ program
137
+ .command("stats")
138
+ .description("Feature usage telemetry dashboard (developer-only)")
139
+ .option("--days <n>", "Number of days to aggregate", "7")
140
+ .action(statsCommand);
141
+
142
+ program
143
+ .command("hooks [subcommand]")
144
+ .description("Hook Manager: inspect and sync hook ordering (afd → omc → user)")
145
+ .action(hooksCommand);
146
+
147
+ program
148
+ .command("benchmark")
149
+ .description("Hologram AST compression benchmark across all source files")
150
+ .option("--sort <key>", "Sort by: savings (default), size, name")
151
+ .option("--top <n>", "Show only top N files")
152
+ .option("--json", "Output raw JSON for programmatic use")
153
+ .action(benchmarkCommand);
154
+
155
+ program
156
+ .command("plugin")
157
+ .description("Manage third-party validator plugins (install, list, remove)")
158
+ .argument("[subcommand]", "install | list | remove")
159
+ .argument("[arg]", "npm package name or plugin name")
160
+ .action(pluginCommand);
161
+
162
+ program.parse();