@cluesmith/codev 2.0.0-rc.61 → 2.0.0-rc.64

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 (150) hide show
  1. package/dashboard/dist/assets/index-C7FtNK6Y.css +32 -0
  2. package/dashboard/dist/assets/index-DZuzzh0T.js +131 -0
  3. package/dashboard/dist/assets/index-DZuzzh0T.js.map +1 -0
  4. package/dashboard/dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +75 -50
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  9. package/dist/agent-farm/commands/architect.js +38 -48
  10. package/dist/agent-farm/commands/architect.js.map +1 -1
  11. package/dist/agent-farm/commands/attach.d.ts.map +1 -1
  12. package/dist/agent-farm/commands/attach.js +14 -35
  13. package/dist/agent-farm/commands/attach.js.map +1 -1
  14. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  15. package/dist/agent-farm/commands/cleanup.js +17 -18
  16. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  17. package/dist/agent-farm/commands/consult.d.ts +3 -4
  18. package/dist/agent-farm/commands/consult.d.ts.map +1 -1
  19. package/dist/agent-farm/commands/consult.js +27 -37
  20. package/dist/agent-farm/commands/consult.js.map +1 -1
  21. package/dist/agent-farm/commands/open.d.ts.map +1 -1
  22. package/dist/agent-farm/commands/open.js +17 -31
  23. package/dist/agent-farm/commands/open.js.map +1 -1
  24. package/dist/agent-farm/commands/shell.d.ts.map +1 -1
  25. package/dist/agent-farm/commands/shell.js +27 -38
  26. package/dist/agent-farm/commands/shell.js.map +1 -1
  27. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  28. package/dist/agent-farm/commands/spawn.js +113 -90
  29. package/dist/agent-farm/commands/spawn.js.map +1 -1
  30. package/dist/agent-farm/commands/start.d.ts +7 -20
  31. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  32. package/dist/agent-farm/commands/start.js +3 -242
  33. package/dist/agent-farm/commands/start.js.map +1 -1
  34. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  35. package/dist/agent-farm/commands/status.js +22 -29
  36. package/dist/agent-farm/commands/status.js.map +1 -1
  37. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  38. package/dist/agent-farm/commands/stop.js +43 -172
  39. package/dist/agent-farm/commands/stop.js.map +1 -1
  40. package/dist/agent-farm/commands/tower-cloud.d.ts +47 -0
  41. package/dist/agent-farm/commands/tower-cloud.d.ts.map +1 -0
  42. package/dist/agent-farm/commands/tower-cloud.js +316 -0
  43. package/dist/agent-farm/commands/tower-cloud.js.map +1 -0
  44. package/dist/agent-farm/db/index.d.ts +6 -2
  45. package/dist/agent-farm/db/index.d.ts.map +1 -1
  46. package/dist/agent-farm/db/index.js +56 -31
  47. package/dist/agent-farm/db/index.js.map +1 -1
  48. package/dist/agent-farm/db/migrate.d.ts +0 -4
  49. package/dist/agent-farm/db/migrate.d.ts.map +1 -1
  50. package/dist/agent-farm/db/migrate.js +0 -46
  51. package/dist/agent-farm/db/migrate.js.map +1 -1
  52. package/dist/agent-farm/db/schema.d.ts +3 -3
  53. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  54. package/dist/agent-farm/db/schema.js +3 -17
  55. package/dist/agent-farm/db/schema.js.map +1 -1
  56. package/dist/agent-farm/db/types.d.ts +0 -10
  57. package/dist/agent-farm/db/types.d.ts.map +1 -1
  58. package/dist/agent-farm/db/types.js +0 -8
  59. package/dist/agent-farm/db/types.js.map +1 -1
  60. package/dist/agent-farm/hq-connector.d.ts +1 -1
  61. package/dist/agent-farm/hq-connector.js +1 -1
  62. package/dist/agent-farm/lib/cloud-config.d.ts +46 -0
  63. package/dist/agent-farm/lib/cloud-config.d.ts.map +1 -0
  64. package/dist/agent-farm/lib/cloud-config.js +106 -0
  65. package/dist/agent-farm/lib/cloud-config.js.map +1 -0
  66. package/dist/agent-farm/lib/tower-client.d.ts +7 -5
  67. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  68. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  69. package/dist/agent-farm/lib/tunnel-client.d.ts +117 -0
  70. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -0
  71. package/dist/agent-farm/lib/tunnel-client.js +502 -0
  72. package/dist/agent-farm/lib/tunnel-client.js.map +1 -0
  73. package/dist/agent-farm/servers/tower-server.js +559 -341
  74. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  75. package/dist/agent-farm/state.d.ts +2 -2
  76. package/dist/agent-farm/state.d.ts.map +1 -1
  77. package/dist/agent-farm/state.js +6 -16
  78. package/dist/agent-farm/state.js.map +1 -1
  79. package/dist/agent-farm/types.d.ts +1 -18
  80. package/dist/agent-farm/types.d.ts.map +1 -1
  81. package/dist/agent-farm/utils/config.d.ts +0 -5
  82. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  83. package/dist/agent-farm/utils/config.js +0 -31
  84. package/dist/agent-farm/utils/config.js.map +1 -1
  85. package/dist/agent-farm/utils/file-tabs.d.ts +27 -0
  86. package/dist/agent-farm/utils/file-tabs.d.ts.map +1 -0
  87. package/dist/agent-farm/utils/file-tabs.js +46 -0
  88. package/dist/agent-farm/utils/file-tabs.js.map +1 -0
  89. package/dist/agent-farm/utils/gate-status.d.ts +16 -0
  90. package/dist/agent-farm/utils/gate-status.d.ts.map +1 -0
  91. package/dist/agent-farm/utils/gate-status.js +79 -0
  92. package/dist/agent-farm/utils/gate-status.js.map +1 -0
  93. package/dist/agent-farm/utils/gate-watcher.d.ts +38 -0
  94. package/dist/agent-farm/utils/gate-watcher.d.ts.map +1 -0
  95. package/dist/agent-farm/utils/gate-watcher.js +122 -0
  96. package/dist/agent-farm/utils/gate-watcher.js.map +1 -0
  97. package/dist/agent-farm/utils/index.d.ts +0 -1
  98. package/dist/agent-farm/utils/index.d.ts.map +1 -1
  99. package/dist/agent-farm/utils/index.js +0 -1
  100. package/dist/agent-farm/utils/index.js.map +1 -1
  101. package/dist/agent-farm/utils/notifications.js +1 -1
  102. package/dist/agent-farm/utils/notifications.js.map +1 -1
  103. package/dist/agent-farm/utils/server-utils.d.ts +1 -1
  104. package/dist/agent-farm/utils/server-utils.js +1 -1
  105. package/dist/agent-farm/utils/session.d.ts +10 -0
  106. package/dist/agent-farm/utils/session.d.ts.map +1 -0
  107. package/dist/agent-farm/utils/session.js +12 -0
  108. package/dist/agent-farm/utils/session.js.map +1 -0
  109. package/dist/commands/adopt.js +1 -1
  110. package/dist/commands/adopt.js.map +1 -1
  111. package/dist/commands/consult/index.d.ts.map +1 -1
  112. package/dist/commands/consult/index.js +23 -14
  113. package/dist/commands/consult/index.js.map +1 -1
  114. package/dist/commands/init.js +1 -1
  115. package/dist/commands/init.js.map +1 -1
  116. package/dist/commands/porch/index.d.ts.map +1 -1
  117. package/dist/commands/porch/index.js +35 -12
  118. package/dist/commands/porch/index.js.map +1 -1
  119. package/dist/commands/porch/next.js +11 -3
  120. package/dist/commands/porch/next.js.map +1 -1
  121. package/dist/commands/porch/verdict.d.ts +8 -0
  122. package/dist/commands/porch/verdict.d.ts.map +1 -1
  123. package/dist/commands/porch/verdict.js +13 -0
  124. package/dist/commands/porch/verdict.js.map +1 -1
  125. package/dist/terminal/pty-session.d.ts +2 -0
  126. package/dist/terminal/pty-session.d.ts.map +1 -1
  127. package/dist/terminal/pty-session.js +4 -0
  128. package/dist/terminal/pty-session.js.map +1 -1
  129. package/package.json +1 -1
  130. package/skeleton/.claude/skills/af/SKILL.md +15 -0
  131. package/skeleton/protocols/spir/prompts/review.md +15 -16
  132. package/skeleton/protocols/spir/protocol.json +4 -0
  133. package/skeleton/protocols/spir/templates/review.md +81 -199
  134. package/skeleton/resources/commands/agent-farm.md +38 -2
  135. package/templates/tower.html +7 -150
  136. package/dashboard/dist/assets/index-CXloFYpB.css +0 -32
  137. package/dashboard/dist/assets/index-Ca2fjOJf.js +0 -131
  138. package/dashboard/dist/assets/index-Ca2fjOJf.js.map +0 -1
  139. package/dist/agent-farm/utils/orphan-handler.d.ts +0 -27
  140. package/dist/agent-farm/utils/orphan-handler.d.ts.map +0 -1
  141. package/dist/agent-farm/utils/orphan-handler.js +0 -149
  142. package/dist/agent-farm/utils/orphan-handler.js.map +0 -1
  143. package/dist/agent-farm/utils/port-registry.d.ts +0 -57
  144. package/dist/agent-farm/utils/port-registry.d.ts.map +0 -1
  145. package/dist/agent-farm/utils/port-registry.js +0 -166
  146. package/dist/agent-farm/utils/port-registry.js.map +0 -1
  147. package/dist/agent-farm/utils/terminal-ports.d.ts +0 -18
  148. package/dist/agent-farm/utils/terminal-ports.d.ts.map +0 -1
  149. package/dist/agent-farm/utils/terminal-ports.js +0 -35
  150. package/dist/agent-farm/utils/terminal-ports.js.map +0 -1
@@ -1,27 +0,0 @@
1
- /**
2
- * Orphan Handler
3
- *
4
- * Detects and handles orphaned tmux sessions from previous agent-farm runs.
5
- * This prevents resource leaks and ensures clean startup.
6
- *
7
- * IMPORTANT: Only cleans up sessions for THIS project (based on port).
8
- * Sessions from other projects are left alone.
9
- */
10
- /**
11
- * Check for and handle orphaned sessions on startup
12
- *
13
- * Returns the number of sessions that were cleaned up.
14
- */
15
- export declare function handleOrphanedSessions(options?: {
16
- kill?: boolean;
17
- silent?: boolean;
18
- }): Promise<number>;
19
- /**
20
- * Check for stale artifacts from bash script era
21
- */
22
- export declare function checkStaleArtifacts(codevDir: string): string[];
23
- /**
24
- * Warn about stale artifacts if found
25
- */
26
- export declare function warnAboutStaleArtifacts(codevDir: string): void;
27
- //# sourceMappingURL=orphan-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orphan-handler.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/orphan-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkFH;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCvB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB9D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAU9D"}
@@ -1,149 +0,0 @@
1
- /**
2
- * Orphan Handler
3
- *
4
- * Detects and handles orphaned tmux sessions from previous agent-farm runs.
5
- * This prevents resource leaks and ensures clean startup.
6
- *
7
- * IMPORTANT: Only cleans up sessions for THIS project (based on port).
8
- * Sessions from other projects are left alone.
9
- */
10
- import { existsSync } from 'node:fs';
11
- import { resolve } from 'node:path';
12
- import { logger } from './logger.js';
13
- import { run } from './shell.js';
14
- import { getConfig } from './config.js';
15
- import { loadState, setArchitect } from '../state.js';
16
- /**
17
- * Check if a process is still running
18
- */
19
- function isProcessAlive(pid) {
20
- try {
21
- process.kill(pid, 0);
22
- return true;
23
- }
24
- catch {
25
- return false;
26
- }
27
- }
28
- /**
29
- * Find tmux sessions that match THIS project's agent-farm patterns
30
- * Only matches sessions with this project's port to avoid killing other projects
31
- */
32
- async function findOrphanedSessions() {
33
- const config = getConfig();
34
- const architectPort = config.architectPort;
35
- const state = loadState();
36
- // Project-specific patterns - only match THIS project's architect session
37
- const architectPattern = new RegExp(`^af-architect-${architectPort}$`);
38
- const legacyArchitectPattern = /^af-architect$/;
39
- try {
40
- const result = await run('tmux list-sessions -F "#{session_name}" 2>/dev/null');
41
- const sessions = result.stdout.trim().split('\n').filter(Boolean);
42
- const orphans = [];
43
- for (const name of sessions) {
44
- // Check architect sessions - only orphaned if PID is dead
45
- if (architectPattern.test(name) || legacyArchitectPattern.test(name)) {
46
- // If we have state for this architect, check if PID is still alive
47
- if (state.architect) {
48
- if (!isProcessAlive(state.architect.pid)) {
49
- // PID is dead but session exists - this is orphaned
50
- orphans.push({ name, type: 'architect' });
51
- }
52
- // If PID is alive, session is NOT orphaned - skip it
53
- }
54
- else {
55
- // No state entry but session exists - orphaned
56
- orphans.push({ name, type: 'architect' });
57
- }
58
- }
59
- // Note: builder and util sessions use different naming now (af-shell-UXXXXXX)
60
- // Those are managed by their own state entries and don't need orphan detection
61
- }
62
- return orphans;
63
- }
64
- catch {
65
- // tmux not available or no sessions
66
- return [];
67
- }
68
- }
69
- /**
70
- * Kill an orphaned tmux session
71
- */
72
- async function killSession(name) {
73
- try {
74
- await run(`tmux kill-session -t "${name}" 2>/dev/null`);
75
- return true;
76
- }
77
- catch {
78
- return false;
79
- }
80
- }
81
- /**
82
- * Check for and handle orphaned sessions on startup
83
- *
84
- * Returns the number of sessions that were cleaned up.
85
- */
86
- export async function handleOrphanedSessions(options = {}) {
87
- const orphans = await findOrphanedSessions();
88
- if (orphans.length === 0) {
89
- return 0;
90
- }
91
- if (!options.silent) {
92
- logger.warn(`Found ${orphans.length} orphaned tmux session(s) from previous run:`);
93
- for (const orphan of orphans) {
94
- logger.info(` - ${orphan.name} (${orphan.type})`);
95
- }
96
- }
97
- if (options.kill) {
98
- let killed = 0;
99
- for (const orphan of orphans) {
100
- if (await killSession(orphan.name)) {
101
- killed++;
102
- // Clear state entry for killed architects
103
- if (orphan.type === 'architect') {
104
- setArchitect(null);
105
- }
106
- if (!options.silent) {
107
- logger.debug(` Killed: ${orphan.name}`);
108
- }
109
- }
110
- }
111
- if (!options.silent) {
112
- logger.info(`Cleaned up ${killed} orphaned session(s)`);
113
- }
114
- return killed;
115
- }
116
- return 0;
117
- }
118
- /**
119
- * Check for stale artifacts from bash script era
120
- */
121
- export function checkStaleArtifacts(codevDir) {
122
- const staleFiles = [
123
- 'builders.md', // Old bash state file
124
- '.architect.pid',
125
- '.architect.log',
126
- ];
127
- const found = [];
128
- for (const file of staleFiles) {
129
- const path = resolve(codevDir, file);
130
- if (existsSync(path)) {
131
- found.push(file);
132
- }
133
- }
134
- return found;
135
- }
136
- /**
137
- * Warn about stale artifacts if found
138
- */
139
- export function warnAboutStaleArtifacts(codevDir) {
140
- const stale = checkStaleArtifacts(codevDir);
141
- if (stale.length > 0) {
142
- logger.warn('Found stale artifacts from previous bash-based architect:');
143
- for (const file of stale) {
144
- logger.info(` - ${file}`);
145
- }
146
- logger.info('These can be safely deleted. The new TypeScript implementation uses .agent-farm/');
147
- }
148
- }
149
- //# sourceMappingURL=orphan-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orphan-handler.js","sourceRoot":"","sources":["../../../src/agent-farm/utils/orphan-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAOD;;;GAGG;AACH,KAAK,UAAU,oBAAoB;IACjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IAC3C,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAE1B,0EAA0E;IAC1E,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,iBAAiB,aAAa,GAAG,CAAC,CAAC;IACvE,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;IAEhD,IAAI,CAAC;QACH,MAAM,MA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AAsB;QACtC,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;IAEF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,KAAK,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;QACzE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Global Port Registry
3
- *
4
- * Manages port block allocation across multiple repositories to prevent
5
- * port conflicts when running multiple architect sessions simultaneously.
6
- *
7
- * Registry location: ~/.agent-farm/global.db
8
- * Each repository gets a 100-port block (e.g., 4200-4299, 4300-4399, etc.)
9
- *
10
- * Uses SQLite with ACID transactions for proper concurrency handling.
11
- */
12
- import { closeGlobalDb } from '../db/index.js';
13
- /**
14
- * Clean up stale registry entries (projects that no longer exist or have dead PIDs)
15
- * Note: This function is now synchronous
16
- */
17
- export declare function cleanupStaleEntries(): {
18
- removed: string[];
19
- remaining: number;
20
- };
21
- /**
22
- * Get or allocate a port block for a project
23
- * Returns the base port for the project's block
24
- * Note: This function is now synchronous and uses BEGIN IMMEDIATE for atomicity
25
- */
26
- export declare function getPortBlock(projectRoot: string): number;
27
- /**
28
- * Get port configuration for a project
29
- * Returns all port assignments based on the project's base port
30
- */
31
- export interface ProjectPorts {
32
- basePort: number;
33
- dashboardPort: number;
34
- architectPort: number;
35
- builderPortRange: [number, number];
36
- utilPortRange: [number, number];
37
- }
38
- export declare function getProjectPorts(projectRoot: string): ProjectPorts;
39
- /**
40
- * List all registered projects and their port blocks
41
- */
42
- export declare function listAllocations(): Array<{
43
- path: string;
44
- basePort: number;
45
- registered: string;
46
- lastUsed?: string;
47
- exists: boolean;
48
- pid?: number;
49
- pidAlive?: boolean;
50
- }>;
51
- /**
52
- * Remove a project's port allocation
53
- * Note: This function is now synchronous
54
- */
55
- export declare function removeAllocation(projectRoot: string): boolean;
56
- export { closeGlobalDb };
57
- //# sourceMappingURL=port-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"port-registry.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAe,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAiC5D;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAgC9E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2DxD;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAEjC;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAWjE;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,KAAK,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAcD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAQ7D;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,166 +0,0 @@
1
- /**
2
- * Global Port Registry
3
- *
4
- * Manages port block allocation across multiple repositories to prevent
5
- * port conflicts when running multiple architect sessions simultaneously.
6
- *
7
- * Registry location: ~/.agent-farm/global.db
8
- * Each repository gets a 100-port block (e.g., 4200-4299, 4300-4399, etc.)
9
- *
10
- * Uses SQLite with ACID transactions for proper concurrency handling.
11
- */
12
- import { existsSync } from 'node:fs';
13
- import { resolve } from 'node:path';
14
- import { getGlobalDb, closeGlobalDb } from '../db/index.js';
15
- // Base port for first allocation (configurable via AF_BASE_PORT env var)
16
- const BASE_PORT = parseInt(process.env.AF_BASE_PORT || '4200', 10);
17
- // Ports per project
18
- const PORT_BLOCK_SIZE = 100;
19
- // Maximum allocations (4200-9999 = ~58 projects)
20
- const MAX_ALLOCATIONS = 58;
21
- // Port blocks to skip (base ports that conflict with system services)
22
- // 5000: macOS AirPlay Receiver (ControlCenter)
23
- const BLOCKED_PORT_BLOCKS = [5000];
24
- /**
25
- * Check if a process is still running
26
- */
27
- function isProcessAlive(pid) {
28
- try {
29
- process.kill(pid, 0);
30
- return true;
31
- }
32
- catch {
33
- return false;
34
- }
35
- }
36
- /**
37
- * Check if a project path still exists on disk
38
- */
39
- function projectExists(projectPath) {
40
- return existsSync(projectPath);
41
- }
42
- /**
43
- * Clean up stale registry entries (projects that no longer exist or have dead PIDs)
44
- * Note: This function is now synchronous
45
- */
46
- export function cleanupStaleEntries() {
47
- const db = getGlobalDb();
48
- const removed = [];
49
- // Get all allocations
50
- const allocations = db.prepare('SELECT * FROM port_allocations').all();
51
- const cleanup = db.transaction(() => {
52
- for (const alloc of allocations) {
53
- // Remove if project doesn't exist (skip synthetic keys like "remote:...")
54
- if (!alloc.project_path.startsWith('remote:') && !projectExists(alloc.project_path)) {
55
- removed.push(alloc.project_path);
56
- db.prepare('DELETE FROM port_allocations WHERE project_path = ?').run(alloc.project_path);
57
- continue;
58
- }
59
- // Clear PID if process is stale (process no longer running)
60
- // Don't remove the entry, just clear the PID - project still exists
61
- if (alloc.pid && !isProcessAlive(alloc.pid)) {
62
- db.prepare('UPDATE port_allocations SET pid = NULL WHERE project_path = ?').run(alloc.project_path);
63
- }
64
- }
65
- });
66
- cleanup();
67
- const remaining = db.prepare('SELECT COUNT(*) as count FROM port_allocations').get();
68
- return {
69
- removed,
70
- remaining: remaining.count,
71
- };
72
- }
73
- /**
74
- * Get or allocate a port block for a project
75
- * Returns the base port for the project's block
76
- * Note: This function is now synchronous and uses BEGIN IMMEDIATE for atomicity
77
- */
78
- export function getPortBlock(projectRoot) {
79
- // Normalize path for consistent keys
80
- // Don't resolve synthetic keys like "remote:..." - they're not real paths
81
- const normalizedPath = projectRoot.startsWith('remote:') ? projectRoot : resolve(projectRoot);
82
- const db = getGlobalDb();
83
- // Use immediate transaction to prevent race conditions
84
- const allocate = db.transaction(() => {
85
- // Check if project already has an allocation
86
- const existing = db.prepare('SELECT * FROM port_allocations WHERE project_path = ?')
87
- .get(normalizedPath);
88
- if (existing) {
89
- // Update last used timestamp and PID
90
- db.prepare(`
91
- UPDATE port_allocations
92
- SET last_used_at = datetime('now'), pid = ?
93
- WHERE project_path = ?
94
- `).run(process.pid, normalizedPath);
95
- return existing.base_port;
96
- }
97
- // Find next available port block (with gap recycling)
98
- // Get all allocated ports as a Set for O(1) lookup
99
- const allocated = new Set(db.prepare('SELECT base_port FROM port_allocations').all()
100
- .map(row => row.base_port));
101
- // Find the first available port starting from BASE_PORT
102
- let nextPort = BASE_PORT;
103
- const maxPossiblePort = BASE_PORT + (MAX_ALLOCATIONS * PORT_BLOCK_SIZE);
104
- while (nextPort < maxPossiblePort) {
105
- // Skip if already allocated or blocked
106
- if (!allocated.has(nextPort) && !BLOCKED_PORT_BLOCKS.includes(nextPort)) {
107
- break;
108
- }
109
- nextPort += PORT_BLOCK_SIZE;
110
- }
111
- // Ensure we found an available port
112
- if (nextPort >= maxPossiblePort) {
113
- throw new Error('No available port blocks. Maximum allocations reached.');
114
- }
115
- // Insert new allocation
116
- db.prepare(`
117
- INSERT INTO port_allocations (project_path, base_port, pid)
118
- VALUES (?, ?, ?)
119
- `).run(normalizedPath, nextPort, process.pid);
120
- return nextPort;
121
- });
122
- // Use immediate() to serialize with other writers
123
- return allocate.immediate();
124
- }
125
- export function getProjectPorts(projectRoot) {
126
- const basePort = getPortBlock(projectRoot);
127
- return {
128
- basePort,
129
- dashboardPort: basePort, // 4200
130
- architectPort: basePort + 1, // 4201
131
- builderPortRange: [basePort + 10, basePort + 29], // 4210-4229
132
- utilPortRange: [basePort + 30, basePort + 49], // 4230-4249
133
- // openPortRange removed - Spec 0092: files now served through Tower at 4100
134
- };
135
- }
136
- /**
137
- * List all registered projects and their port blocks
138
- */
139
- export function listAllocations() {
140
- const db = getGlobalDb();
141
- const allocations = db.prepare('SELECT * FROM port_allocations ORDER BY base_port').all();
142
- return allocations.map((alloc) => ({
143
- path: alloc.project_path,
144
- basePort: alloc.base_port,
145
- registered: alloc.registered_at,
146
- lastUsed: alloc.last_used_at,
147
- // Remote keys are synthetic - can't check if they exist, assume true
148
- exists: alloc.project_path.startsWith('remote:') || projectExists(alloc.project_path),
149
- pid: alloc.pid ?? undefined,
150
- pidAlive: alloc.pid ? isProcessAlive(alloc.pid) : undefined,
151
- }));
152
- }
153
- /**
154
- * Remove a project's port allocation
155
- * Note: This function is now synchronous
156
- */
157
- export function removeAllocation(projectRoot) {
158
- // Don't resolve synthetic keys like "remote:..."
159
- const normalizedPath = projectRoot.startsWith('remote:') ? projectRoot : resolve(projectRoot);
160
- const db = getGlobalDb();
161
- const result = db.prepare('DELETE FROM port_allocations WHERE project_path = ?').run(normalizedPath);
162
- return result.changes > 0;
163
- }
164
- // Re-export closeGlobalDb for cleanup
165
- export { closeGlobalDb };
166
- //# sourceMappingURL=port-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"port-registry.js","sourceRoot":"","sources":["../../../src/agent-farm/utils/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5D,yEAAyE;AACzE,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACnE,oBAAoB;AACpB,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,iDAAiD;AACjD,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sEAAsE;AACtE,+CAA+C;AAC/C,MAAM,mBAAmB,GAAG,CAAC,IAAI,CAAC,CAAC;AAEnC;;GAEG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,WAAmB;IACxC,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,G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Ac,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,iDAAiD;IACjD,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9F,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAErG,OAAO,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Terminal port lookup utility (Spec 0062 - Secure Remote Access)
3
- *
4
- * Provides the port lookup function used by the dashboard reverse proxy.
5
- * Extracted to a separate module for testability.
6
- */
7
- import type { DashboardState } from '../types.js';
8
- /**
9
- * Get the port for a given terminal ID
10
- * Returns null if the terminal is not found
11
- *
12
- * Terminal ID formats:
13
- * - 'architect' -> architect terminal
14
- * - 'builder-{id}' -> builder terminal
15
- * - 'util-{id}' -> utility terminal
16
- */
17
- export declare function getPortForTerminal(terminalId: string, state: DashboardState): number | null;
18
- //# sourceMappingURL=terminal-ports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terminal-ports.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/terminal-ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAqB3F"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Terminal port lookup utility (Spec 0062 - Secure Remote Access)
3
- *
4
- * Provides the port lookup function used by the dashboard reverse proxy.
5
- * Extracted to a separate module for testability.
6
- */
7
- /**
8
- * Get the port for a given terminal ID
9
- * Returns null if the terminal is not found
10
- *
11
- * Terminal ID formats:
12
- * - 'architect' -> architect terminal
13
- * - 'builder-{id}' -> builder terminal
14
- * - 'util-{id}' -> utility terminal
15
- */
16
- export function getPortForTerminal(terminalId, state) {
17
- // Architect terminal
18
- if (terminalId === 'architect') {
19
- return state.architect?.port || null;
20
- }
21
- // Builder terminal (format: builder-{id})
22
- if (terminalId.startsWith('builder-')) {
23
- const builderId = terminalId.replace('builder-', '');
24
- const builder = state.builders.find(b => b.id === builderId);
25
- return builder?.port || null;
26
- }
27
- // Utility terminal (format: util-{id})
28
- if (terminalId.startsWith('util-')) {
29
- const utilId = terminalId.replace('util-', '');
30
- const util = state.utils.find(u => u.id === utilId);
31
- return util?.port || null;
32
- }
33
- return null;
34
- }
35
- //# sourceMappingURL=terminal-ports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terminal-ports.js","sourceRoot":"","sources":["../../../src/agent-farm/utils/terminal-ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,KAAqB;IAC1E,qBAAqB;IACrB,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,SAAS,EAAE,IAAI,IAAI,IAAI,CAAC;IACvC,CAAC;IAED,0CAA0C;IAC1C,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;QAC7D,OAAO,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC;IAC/B,CAAC;IAED,uCAAuC;IACvC,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;QACpD,OAAO,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC;IAC5B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}