profclaw 0.0.1-beta.2 → 2.0.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 (156) hide show
  1. package/CHANGELOG.md +21 -38
  2. package/CONTRIBUTING.md +3 -5
  3. package/README.md +128 -63
  4. package/dist/chat/execution/tools/index.d.ts +1 -1
  5. package/dist/chat/execution/tools/index.js +41 -2
  6. package/dist/chat/providers/slack/index.d.ts +2 -2
  7. package/dist/cli/commands/models.js +39 -26
  8. package/dist/cli/commands/onboard.js +64 -79
  9. package/dist/cli/commands/setup.js +293 -90
  10. package/dist/cli/index.js +0 -6
  11. package/dist/cli/providers.d.ts +15 -0
  12. package/dist/cli/providers.js +41 -0
  13. package/dist/core/deployment.js +2 -0
  14. package/dist/providers/ai-sdk.js +26 -6
  15. package/dist/routes/channels.d.ts +12 -0
  16. package/dist/routes/channels.js +166 -0
  17. package/dist/server/route-loader.js +1 -0
  18. package/dist/server.js +115 -109
  19. package/package.json +1 -1
  20. package/skills/git-workflow/SKILL.md +3 -3
  21. package/ui/dist/assets/{ActivityView-DIPQSJ_d.js → ActivityView-BeshZXmE.js} +1 -1
  22. package/ui/dist/assets/{AgentList-CqyaYrcq.js → AgentList-QVHeldPi.js} +1 -1
  23. package/ui/dist/assets/{AnalyticsDashboard-C-mjuGHT.js → AnalyticsDashboard-C9R97dXE.js} +1 -1
  24. package/ui/dist/assets/{AreaChart-CfYWmbtr.js → AreaChart-B73gaiVQ.js} +1 -1
  25. package/ui/dist/assets/{CartesianChart-BaQ3It0c.js → CartesianChart-CXYL2R-A.js} +1 -1
  26. package/ui/dist/assets/{ChatView-DxxQy6pl.js → ChatView-qjZErlrp.js} +1 -1
  27. package/ui/dist/assets/{CostsDashboard-CDBBcGkg.js → CostsDashboard-O4DCLy1i.js} +1 -1
  28. package/ui/dist/assets/{EstimateSelect-CDjf5qKl.js → EstimateSelect-1hQf4Osk.js} +1 -1
  29. package/ui/dist/assets/{FloatingChatbot-CZHjvJIe.js → FloatingChatbot-BZBzrJxd.js} +1 -1
  30. package/ui/dist/assets/{InviteCodeManagement-DTm-IPTm.js → InviteCodeManagement-LEoGqYeA.js} +1 -1
  31. package/ui/dist/assets/{ProjectDetail-DlYUcOss.js → ProjectDetail--gPfvATB.js} +1 -1
  32. package/ui/dist/assets/{ProjectIcon-BMRpnM04.js → ProjectIcon-Chd_ofsw.js} +1 -1
  33. package/ui/dist/assets/{ProjectList-D85TN0i0.js → ProjectList-BvUfVB6c.js} +1 -1
  34. package/ui/dist/assets/{Settings-CgPqzUvj.js → Settings-1kaf7VHE.js} +1 -1
  35. package/ui/dist/assets/{StatusIndicator-yig0uZEA.js → StatusIndicator-pRfkNcdV.js} +1 -1
  36. package/ui/dist/assets/{SummaryDetail-CwLAfHgJ.js → SummaryDetail-DV3AmONk.js} +1 -1
  37. package/ui/dist/assets/{SummaryList-BvS5Idnu.js → SummaryList-B6kXiTxL.js} +1 -1
  38. package/ui/dist/assets/{TaskDetail-zarC1fOt.js → TaskDetail-CV6CzbOS.js} +1 -1
  39. package/ui/dist/assets/{TaskList-CyJq3ANE.js → TaskList-DL7brQKd.js} +1 -1
  40. package/ui/dist/assets/{TicketBoard-BlWr3-iH.js → TicketBoard-CrkkFj7C.js} +1 -1
  41. package/ui/dist/assets/{TicketDetail-DmqWKj2W.js → TicketDetail-hnnYclpD.js} +1 -1
  42. package/ui/dist/assets/{TicketList-Scj4pMWa.js → TicketList-CsDAyQCL.js} +1 -1
  43. package/ui/dist/assets/{UserManagement-BH7uG7dw.js → UserManagement-BGFQyTSr.js} +1 -1
  44. package/ui/dist/assets/{ViewSwitcher-3HzZUdWn.js → ViewSwitcher-CnL0OqA8.js} +1 -1
  45. package/ui/dist/assets/{alert-dialog-DWPb2IfQ.js → alert-dialog-SKM6Gjz4.js} +1 -1
  46. package/ui/dist/assets/{archive-CGck7gxR.js → archive-BsLa7brF.js} +1 -1
  47. package/ui/dist/assets/{badge-DEmc3Z_l.js → badge-CVHH1a-v.js} +1 -1
  48. package/ui/dist/assets/{brain-CfFdLVqb.js → brain-6o_RHVpe.js} +1 -1
  49. package/ui/dist/assets/{bug-DqSGPUUE.js → bug-CmZI7jqM.js} +1 -1
  50. package/ui/dist/assets/{calendar-BuZ4zbPW.js → calendar-Bf0t2B82.js} +1 -1
  51. package/ui/dist/assets/{chevron-up-DcJ4LL_N.js → chevron-up-CoUsOvZj.js} +1 -1
  52. package/ui/dist/assets/{circle-x-C78PNZjF.js → circle-x-Dgw11LgT.js} +1 -1
  53. package/ui/dist/assets/{constants-DhDjZe4P.js → constants-Q5Zivl-a.js} +1 -1
  54. package/ui/dist/assets/{cpu-Ck6AoG8c.js → cpu-DiPMQICV.js} +1 -1
  55. package/ui/dist/assets/{database-CA2w8Lvt.js → database-BwTfupDi.js} +1 -1
  56. package/ui/dist/assets/{dialog-BOdGWhgE.js → dialog-BUqN9Psj.js} +1 -1
  57. package/ui/dist/assets/{ellipsis-FhHKRbfl.js → ellipsis-UJx4Xnf6.js} +1 -1
  58. package/ui/dist/assets/{ellipsis-vertical-CO0UqE4-.js → ellipsis-vertical-DoULYEKn.js} +1 -1
  59. package/ui/dist/assets/{file-code-ChnhYYj1.js → file-code-B2UrJLwi.js} +1 -1
  60. package/ui/dist/assets/{folder-open-CHwA1-ve.js → folder-open-BJi577JH.js} +1 -1
  61. package/ui/dist/assets/{funnel-ByEjRFNB.js → funnel-PkaD_HSR.js} +1 -1
  62. package/ui/dist/assets/{git-branch-GTOPQgU4.js → git-branch-C_K30am0.js} +1 -1
  63. package/ui/dist/assets/{git-commit-horizontal-F5M84Kut.js → git-commit-horizontal-IT6ecxWQ.js} +1 -1
  64. package/ui/dist/assets/{globe-CQWfr7hT.js → globe-f-jjCa_g.js} +1 -1
  65. package/ui/dist/assets/{hash-nKC9gtLg.js → hash-DNEv8Elo.js} +1 -1
  66. package/ui/dist/assets/{history-DfFSA9xJ.js → history-BQSBo_1Q.js} +1 -1
  67. package/ui/dist/assets/{index-DHGvP9mp.js → index-BUmnwPQr.js} +1 -1
  68. package/ui/dist/assets/{index-Z4-RtZcs.js → index-BfF5G4Cw.js} +1 -1
  69. package/ui/dist/assets/{index-DeI8lKRR.js → index-C8N375c2.js} +1 -1
  70. package/ui/dist/assets/index-CuxnqVVz.css +1 -0
  71. package/ui/dist/assets/{index-Ca3vk7Gq.js → index-CzMM3QOk.js} +1 -1
  72. package/ui/dist/assets/{index--JkIxVXb.js → index-lJlNPFVJ.js} +3 -3
  73. package/ui/dist/assets/{index-a4Fxq0Hb.js → index-nS3EErDg.js} +1 -1
  74. package/ui/dist/assets/{layers-DFeLExSa.js → layers-jFqVrWMD.js} +1 -1
  75. package/ui/dist/assets/{layout-dashboard-WmgjMhWF.js → layout-dashboard-CcKt1hXw.js} +1 -1
  76. package/ui/dist/assets/{lightbulb-Bo8hEr7B.js → lightbulb-Jhp7FvbU.js} +1 -1
  77. package/ui/dist/assets/{link-2-YqrpQXBH.js → link-2-DdO7ostF.js} +1 -1
  78. package/ui/dist/assets/{markdown-renderer-Croje6Xe.js → markdown-renderer-n1ToC4XQ.js} +1 -1
  79. package/ui/dist/assets/{message-square-CD0H5hot.js → message-square-CBgH65X7.js} +1 -1
  80. package/ui/dist/assets/{pencil-DpFnj5dn.js → pencil-CYXCEPQh.js} +1 -1
  81. package/ui/dist/assets/{play-DVgea_jT.js → play-d1ONaH0-.js} +1 -1
  82. package/ui/dist/assets/{popover-JXecfWG5.js → popover-CrmZgoWu.js} +1 -1
  83. package/ui/dist/assets/{progress-C1ghf1Fu.js → progress-uv4SPkL5.js} +1 -1
  84. package/ui/dist/assets/{rocket-BFxPYGx9.js → rocket-DhvUetsk.js} +1 -1
  85. package/ui/dist/assets/{select-MADP8m6Q.js → select-CeQ8AHGy.js} +1 -1
  86. package/ui/dist/assets/{send-eYnW_7n-.js → send-P0r5D7td.js} +1 -1
  87. package/ui/dist/assets/{server-CPMaysH8.js → server-CVHTZB72.js} +1 -1
  88. package/ui/dist/assets/{settings-2-scXUOuE_.js → settings-2-ocj5uHGx.js} +1 -1
  89. package/ui/dist/assets/{sheet-r6NSOxi-.js → sheet-DuQExSho.js} +1 -1
  90. package/ui/dist/assets/{shield-check-PEr7nmVw.js → shield-check-DfVdE34l.js} +1 -1
  91. package/ui/dist/assets/{shield-off-CLtXio62.js → shield-off-8l0J6R-8.js} +1 -1
  92. package/ui/dist/assets/{skeleton-C9oEzNlU.js → skeleton-TFiFJ3nB.js} +1 -1
  93. package/ui/dist/assets/{smartphone-DusFfY0U.js → smartphone-77_g3SQn.js} +1 -1
  94. package/ui/dist/assets/{square-e1yxB2eR.js → square-Ckzsr3Rn.js} +1 -1
  95. package/ui/dist/assets/{switch-tNs0n-kz.js → switch-CAePkd6k.js} +1 -1
  96. package/ui/dist/assets/{table-CXxtLicg.js → table-ZjAZ7hkt.js} +1 -1
  97. package/ui/dist/assets/{tag-tAwMmQ9G.js → tag-C35mgoEv.js} +1 -1
  98. package/ui/dist/assets/{textarea-BjiEeIWh.js → textarea-DsVPnSgR.js} +1 -1
  99. package/ui/dist/assets/{timer-Vel1N3RP.js → timer-DHJBS2w1.js} +1 -1
  100. package/ui/dist/assets/{tooltip-ZMwtfr1J.js → tooltip-BYmQ331W.js} +1 -1
  101. package/ui/dist/assets/{trash-2-eM-CNwsZ.js → trash-2-keO5tKPE.js} +1 -1
  102. package/ui/dist/assets/{trending-up-BGafmjRo.js → trending-up-BBv8KbrY.js} +1 -1
  103. package/ui/dist/assets/{wand-sparkles-DPvcd9Pi.js → wand-sparkles-BusQ52ZK.js} +1 -1
  104. package/ui/dist/assets/{wrench-B8s3zYVV.js → wrench-02YaOSiK.js} +1 -1
  105. package/ui/dist/index.html +2 -2
  106. package/dist/chat/auto-reply.d.ts +0 -90
  107. package/dist/chat/auto-reply.js +0 -272
  108. package/dist/chat/execution/pty.d.ts +0 -92
  109. package/dist/chat/execution/pty.js +0 -285
  110. package/dist/chat/execution/tools/glinr-ops.d.ts +0 -202
  111. package/dist/chat/execution/tools/glinr-ops.js +0 -694
  112. package/dist/cli/commands/browser.d.ts +0 -3
  113. package/dist/cli/commands/browser.js +0 -138
  114. package/dist/cli/commands/canvas.d.ts +0 -3
  115. package/dist/cli/commands/canvas.js +0 -155
  116. package/dist/cli/commands/nodes.d.ts +0 -3
  117. package/dist/cli/commands/nodes.js +0 -193
  118. package/dist/diagnostics/exporters.d.ts +0 -21
  119. package/dist/diagnostics/exporters.js +0 -138
  120. package/dist/diagnostics/index.d.ts +0 -10
  121. package/dist/diagnostics/index.js +0 -9
  122. package/dist/diagnostics/middleware.d.ts +0 -12
  123. package/dist/diagnostics/middleware.js +0 -58
  124. package/dist/diagnostics/tracer.d.ts +0 -133
  125. package/dist/diagnostics/tracer.js +0 -257
  126. package/dist/discovery/index.d.ts +0 -8
  127. package/dist/discovery/index.js +0 -7
  128. package/dist/discovery/mdns.d.ts +0 -40
  129. package/dist/discovery/mdns.js +0 -249
  130. package/dist/plugins/registry.d.ts +0 -122
  131. package/dist/plugins/registry.js +0 -352
  132. package/dist/plugins/sandbox.d.ts +0 -77
  133. package/dist/plugins/sandbox.js +0 -287
  134. package/dist/plugins/search/brave.d.ts +0 -9
  135. package/dist/plugins/search/brave.js +0 -157
  136. package/dist/plugins/search/duckduckgo.d.ts +0 -9
  137. package/dist/plugins/search/duckduckgo.js +0 -171
  138. package/dist/plugins/search/index.d.ts +0 -13
  139. package/dist/plugins/search/index.js +0 -23
  140. package/dist/plugins/search/searxng.d.ts +0 -9
  141. package/dist/plugins/search/searxng.js +0 -170
  142. package/dist/plugins/search/serper.d.ts +0 -9
  143. package/dist/plugins/search/serper.js +0 -135
  144. package/dist/plugins/search/tavily.d.ts +0 -9
  145. package/dist/plugins/search/tavily.js +0 -146
  146. package/dist/providers/adapters/anthropic.d.ts +0 -26
  147. package/dist/providers/adapters/anthropic.js +0 -306
  148. package/dist/providers/adapters/base.d.ts +0 -53
  149. package/dist/providers/adapters/base.js +0 -99
  150. package/dist/providers/adapters/ollama.d.ts +0 -30
  151. package/dist/providers/adapters/ollama.js +0 -292
  152. package/dist/utils/ai-cache.d.ts +0 -72
  153. package/dist/utils/ai-cache.js +0 -204
  154. package/dist/utils/file-lock.d.ts +0 -85
  155. package/dist/utils/file-lock.js +0 -204
  156. package/ui/dist/assets/index-WclMPci1.css +0 -1
@@ -1,249 +0,0 @@
1
- /**
2
- * mDNS/DNS-SD Local Discovery
3
- *
4
- * Announces profClaw instance on the local network using multicast DNS.
5
- * Enables automatic discovery of profClaw nodes on the LAN.
6
- * Uses Node.js dgram (UDP) - no external dependencies.
7
- */
8
- import { createSocket } from 'dgram';
9
- import { hostname, networkInterfaces } from 'os';
10
- import { logger } from '../utils/logger.js';
11
- const MDNS_ADDRESS = '224.0.0.251';
12
- const MDNS_PORT = 5353;
13
- // DNS record type constants
14
- const DNS_TYPE_A = 1;
15
- const DNS_TYPE_PTR = 12;
16
- const DNS_TYPE_TXT = 16;
17
- const DNS_TYPE_SRV = 33;
18
- const DNS_CLASS_IN = 1;
19
- const DNS_CACHE_FLUSH = 0x8000;
20
- let socket = null;
21
- let announceInterval = null;
22
- const discoveredNodes = new Map();
23
- /**
24
- * Encode a DNS name (e.g. "_profclaw._tcp.local") into wire format
25
- */
26
- function encodeName(name) {
27
- const parts = name.split('.');
28
- const buffers = [];
29
- for (const part of parts) {
30
- const len = Buffer.alloc(1);
31
- len.writeUInt8(part.length);
32
- buffers.push(len, Buffer.from(part, 'utf-8'));
33
- }
34
- buffers.push(Buffer.alloc(1)); // null terminator
35
- return Buffer.concat(buffers);
36
- }
37
- /**
38
- * Build an mDNS announcement packet
39
- */
40
- function buildAnnouncementPacket(config) {
41
- const instanceName = config.instanceName || `profclaw-${hostname()}`;
42
- const serviceType = config.serviceType || '_profclaw._tcp.local';
43
- const fullName = `${instanceName}.${serviceType}`;
44
- const hostName = `${hostname()}.local`;
45
- // Header: ID=0, flags=0x8400 (response, authoritative), 0 questions, 4 answers
46
- const header = Buffer.alloc(12);
47
- header.writeUInt16BE(0x0000, 0); // ID
48
- header.writeUInt16BE(0x8400, 2); // Flags: response, authoritative
49
- header.writeUInt16BE(0, 4); // Questions
50
- header.writeUInt16BE(4, 6); // Answers (PTR + SRV + TXT + A)
51
- header.writeUInt16BE(0, 8); // Authority
52
- header.writeUInt16BE(0, 10); // Additional
53
- const records = [header];
54
- // PTR record: serviceType -> fullName
55
- const ptrName = encodeName(serviceType);
56
- const ptrData = encodeName(fullName);
57
- const ptrRecord = Buffer.alloc(10);
58
- ptrRecord.writeUInt16BE(DNS_TYPE_PTR, 0);
59
- ptrRecord.writeUInt16BE(DNS_CLASS_IN, 2);
60
- ptrRecord.writeUInt32BE(4500, 4); // TTL: 75 minutes
61
- ptrRecord.writeUInt16BE(ptrData.length, 8);
62
- records.push(ptrName, ptrRecord, ptrData);
63
- // SRV record: fullName -> host:port
64
- const srvName = encodeName(fullName);
65
- const srvTarget = encodeName(hostName);
66
- const srvRecord = Buffer.alloc(16);
67
- srvRecord.writeUInt16BE(DNS_TYPE_SRV, 0);
68
- srvRecord.writeUInt16BE(DNS_CLASS_IN | DNS_CACHE_FLUSH, 2);
69
- srvRecord.writeUInt32BE(120, 4); // TTL: 2 minutes
70
- srvRecord.writeUInt16BE(srvTarget.length + 6, 8); // data length
71
- srvRecord.writeUInt16BE(0, 10); // Priority
72
- srvRecord.writeUInt16BE(0, 12); // Weight
73
- srvRecord.writeUInt16BE(config.port, 14);
74
- records.push(srvName, srvRecord, srvTarget);
75
- // TXT record
76
- const txtName = encodeName(fullName);
77
- const txtPairs = [];
78
- const txt = {
79
- version: '2.0.0',
80
- mode: process.env.PROFCLAW_MODE ?? 'mini',
81
- ...config.txtRecords,
82
- };
83
- for (const [key, value] of Object.entries(txt)) {
84
- const pair = `${key}=${value}`;
85
- const pairBuf = Buffer.alloc(1 + pair.length);
86
- pairBuf.writeUInt8(pair.length, 0);
87
- pairBuf.write(pair, 1, 'utf-8');
88
- txtPairs.push(pairBuf);
89
- }
90
- const txtData = Buffer.concat(txtPairs);
91
- const txtRecord = Buffer.alloc(10);
92
- txtRecord.writeUInt16BE(DNS_TYPE_TXT, 0);
93
- txtRecord.writeUInt16BE(DNS_CLASS_IN | DNS_CACHE_FLUSH, 2);
94
- txtRecord.writeUInt32BE(4500, 4);
95
- txtRecord.writeUInt16BE(txtData.length, 8);
96
- records.push(txtName, txtRecord, txtData);
97
- // A record: hostname -> IP
98
- const aName = encodeName(hostName);
99
- const ip = getLocalIPv4();
100
- const ipParts = ip.split('.').map(Number);
101
- const aData = Buffer.from(ipParts);
102
- const aRecord = Buffer.alloc(10);
103
- aRecord.writeUInt16BE(DNS_TYPE_A, 0);
104
- aRecord.writeUInt16BE(DNS_CLASS_IN | DNS_CACHE_FLUSH, 2);
105
- aRecord.writeUInt32BE(120, 4);
106
- aRecord.writeUInt16BE(4, 8);
107
- records.push(aName, aRecord, aData);
108
- return Buffer.concat(records);
109
- }
110
- /**
111
- * Get the primary local IPv4 address
112
- */
113
- function getLocalIPv4() {
114
- const interfaces = networkInterfaces();
115
- for (const name of Object.keys(interfaces)) {
116
- const addrs = interfaces[name];
117
- if (!addrs)
118
- continue;
119
- for (const addr of addrs) {
120
- if (addr.family === 'IPv4' && !addr.internal) {
121
- return addr.address;
122
- }
123
- }
124
- }
125
- return '127.0.0.1';
126
- }
127
- /**
128
- * Handle incoming mDNS packet (discover other nodes)
129
- */
130
- function handleIncomingPacket(msg, sourceAddress) {
131
- try {
132
- // Simple check: is this a profclaw announcement?
133
- const content = msg.toString('utf-8', 0, Math.min(msg.length, 512));
134
- if (!content.includes('_profclaw'))
135
- return;
136
- // Extract version and mode from TXT records (simplified parsing)
137
- const versionMatch = content.match(/version=([^\x00]+)/);
138
- const modeMatch = content.match(/mode=([^\x00]+)/);
139
- const existing = discoveredNodes.get(sourceAddress);
140
- discoveredNodes.set(sourceAddress, {
141
- name: existing?.name || `profclaw@${sourceAddress}`,
142
- host: sourceAddress,
143
- port: existing?.port || 3000,
144
- addresses: [sourceAddress],
145
- txt: {
146
- version: versionMatch?.[1] ?? 'unknown',
147
- mode: modeMatch?.[1] ?? 'unknown',
148
- },
149
- lastSeen: Date.now(),
150
- });
151
- logger.debug('[mDNS] Discovered node', { address: sourceAddress });
152
- }
153
- catch {
154
- // Ignore malformed packets
155
- }
156
- }
157
- /**
158
- * Start mDNS announcement
159
- */
160
- export function startMDNS(config) {
161
- if (socket) {
162
- logger.warn('[mDNS] Already running');
163
- return;
164
- }
165
- try {
166
- socket = createSocket({ type: 'udp4', reuseAddr: true });
167
- socket.on('error', (err) => {
168
- // Port 5353 often requires elevated permissions
169
- logger.warn('[mDNS] Socket error (may need elevated permissions)', { error: err.message });
170
- stopMDNS();
171
- });
172
- socket.on('listening', () => {
173
- try {
174
- socket?.addMembership(MDNS_ADDRESS);
175
- logger.info('[mDNS] Joined multicast group', { address: MDNS_ADDRESS, port: MDNS_PORT });
176
- }
177
- catch (err) {
178
- logger.warn('[mDNS] Failed to join multicast group', {
179
- error: err instanceof Error ? err.message : 'Unknown',
180
- });
181
- }
182
- });
183
- socket.on('message', (msg, rinfo) => {
184
- handleIncomingPacket(msg, rinfo.address);
185
- });
186
- socket.bind(MDNS_PORT, () => {
187
- // Send initial announcement
188
- const packet = buildAnnouncementPacket(config);
189
- socket?.send(packet, 0, packet.length, MDNS_PORT, MDNS_ADDRESS);
190
- // Re-announce every 60 seconds
191
- announceInterval = setInterval(() => {
192
- if (socket) {
193
- const pkt = buildAnnouncementPacket(config);
194
- socket.send(pkt, 0, pkt.length, MDNS_PORT, MDNS_ADDRESS);
195
- }
196
- }, 60_000);
197
- logger.info('[mDNS] Discovery started', {
198
- name: config.instanceName || `profclaw-${hostname()}`,
199
- port: config.port,
200
- ip: getLocalIPv4(),
201
- });
202
- });
203
- }
204
- catch (err) {
205
- logger.warn('[mDNS] Failed to start (non-fatal)', {
206
- error: err instanceof Error ? err.message : 'Unknown',
207
- });
208
- }
209
- }
210
- /**
211
- * Stop mDNS announcement
212
- */
213
- export function stopMDNS() {
214
- if (announceInterval) {
215
- clearInterval(announceInterval);
216
- announceInterval = null;
217
- }
218
- if (socket) {
219
- try {
220
- socket.dropMembership(MDNS_ADDRESS);
221
- }
222
- catch {
223
- // Ignore - socket may already be closed
224
- }
225
- socket.close();
226
- socket = null;
227
- logger.info('[mDNS] Discovery stopped');
228
- }
229
- }
230
- /**
231
- * Get list of discovered profClaw nodes on the network
232
- */
233
- export function getDiscoveredNodes() {
234
- // Prune stale nodes (not seen in 5 minutes)
235
- const staleThreshold = Date.now() - 300_000;
236
- for (const [key, node] of discoveredNodes) {
237
- if (node.lastSeen < staleThreshold) {
238
- discoveredNodes.delete(key);
239
- }
240
- }
241
- return Array.from(discoveredNodes.values());
242
- }
243
- /**
244
- * Check if mDNS is currently running
245
- */
246
- export function isMDNSRunning() {
247
- return socket !== null;
248
- }
249
- //# sourceMappingURL=mdns.js.map
@@ -1,122 +0,0 @@
1
- /**
2
- * profClaw Plugin Registry
3
- *
4
- * Manages plugin registration, instantiation, and health monitoring.
5
- */
6
- import type { PluginConfig, PluginHealth, PluginMetadata, SearchProvider, SearchPluginDefinition, ToolProvider, ToolPluginDefinition, PluginSettingsSchema } from './types.js';
7
- declare class SearchProviderRegistry {
8
- private definitions;
9
- private instances;
10
- private configs;
11
- private healthCache;
12
- private readonly HEALTH_CACHE_TTL;
13
- /**
14
- * Register a search provider plugin
15
- */
16
- register(definition: SearchPluginDefinition): void;
17
- /**
18
- * Unregister a search provider
19
- */
20
- unregister(pluginId: string): void;
21
- /**
22
- * Create a provider instance from config
23
- */
24
- create(config: PluginConfig): SearchProvider;
25
- /**
26
- * Get provider by config ID
27
- */
28
- get(configId: string): SearchProvider | undefined;
29
- /**
30
- * Get all active (enabled) providers
31
- */
32
- getActive(): SearchProvider[];
33
- /**
34
- * Get primary (highest priority enabled) provider
35
- */
36
- getPrimary(): SearchProvider | undefined;
37
- /**
38
- * List all registered plugin IDs
39
- */
40
- listRegistered(): string[];
41
- /**
42
- * Get plugin metadata
43
- */
44
- getMetadata(pluginId: string): PluginMetadata | undefined;
45
- /**
46
- * Get all plugin metadata
47
- */
48
- getAllMetadata(): PluginMetadata[];
49
- /**
50
- * Get settings schema for a plugin
51
- */
52
- getSettingsSchema(pluginId: string): PluginSettingsSchema | undefined;
53
- /**
54
- * Get config by instance
55
- */
56
- private getConfigByInstance;
57
- /**
58
- * Get all configs
59
- */
60
- getAllConfigs(): PluginConfig[];
61
- /**
62
- * Update config
63
- */
64
- updateConfig(configId: string, updates: Partial<PluginConfig>): void;
65
- /**
66
- * Delete config and instance
67
- */
68
- deleteConfig(configId: string): void;
69
- /**
70
- * Get health status (cached)
71
- */
72
- getHealth(configId: string): Promise<PluginHealth>;
73
- /**
74
- * Search with automatic fallback
75
- */
76
- search(query: string, options?: Parameters<SearchProvider['search']>[1], preferredProvider?: string): Promise<ReturnType<SearchProvider['search']>>;
77
- }
78
- declare class ToolProviderRegistry {
79
- private definitions;
80
- private instances;
81
- private configs;
82
- register(definition: ToolPluginDefinition): void;
83
- unregister(pluginId: string): void;
84
- create(config: PluginConfig): ToolProvider;
85
- get(configId: string): ToolProvider | undefined;
86
- getActive(): ToolProvider[];
87
- listRegistered(): string[];
88
- getMetadata(pluginId: string): PluginMetadata | undefined;
89
- getAllMetadata(): PluginMetadata[];
90
- getSettingsSchema(pluginId: string): PluginSettingsSchema | undefined;
91
- getAllConfigs(): PluginConfig[];
92
- updateConfig(configId: string, updates: Partial<PluginConfig>): void;
93
- deleteConfig(configId: string): void;
94
- /**
95
- * Get all available tools across all providers
96
- */
97
- getAllTools(): Array<{
98
- provider: string;
99
- tool: ToolProvider['tools'][0];
100
- }>;
101
- /**
102
- * Execute a tool by name
103
- */
104
- execute(toolName: string, params: Record<string, unknown>): Promise<ReturnType<ToolProvider['execute']>>;
105
- }
106
- declare class PluginManager {
107
- readonly search: SearchProviderRegistry;
108
- readonly tools: ToolProviderRegistry;
109
- /**
110
- * Initialize built-in plugins
111
- */
112
- initialize(): Promise<void>;
113
- /**
114
- * Get all plugin metadata across categories
115
- */
116
- getAllPlugins(): Array<PluginMetadata & {
117
- category: 'search' | 'tool';
118
- }>;
119
- }
120
- export declare function getPluginManager(): PluginManager;
121
- export { SearchProviderRegistry, ToolProviderRegistry, PluginManager };
122
- //# sourceMappingURL=registry.d.ts.map