aegiscode 3.1.10 → 3.4.2

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 (209) hide show
  1. package/bin/aegis.js +165 -0
  2. package/package.json +18 -86
  3. package/LICENSE +0 -21
  4. package/README.md +0 -394
  5. package/dist/main.js +0 -2171
  6. package/gui/run-gui.cjs +0 -13
  7. package/src/agent/Agent.ts +0 -903
  8. package/src/agent/SimpleAgent.ts +0 -48
  9. package/src/agent/index.ts +0 -54
  10. package/src/agent/orchestrator/AppBuilder.ts +0 -443
  11. package/src/agent/orchestrator/CouncilAgent.ts +0 -310
  12. package/src/agent/orchestrator/DiscussionRoom.ts +0 -462
  13. package/src/agent/orchestrator/OrchestratorAgent.ts +0 -637
  14. package/src/agent/orchestrator/index.ts +0 -38
  15. package/src/agent/orchestrator/utils.ts +0 -397
  16. package/src/agent/pricing.ts +0 -115
  17. package/src/agent/router.ts +0 -74
  18. package/src/agent/routerStats.ts +0 -121
  19. package/src/agent/types.ts +0 -318
  20. package/src/auth/login.ts +0 -383
  21. package/src/cli/config.ts +0 -189
  22. package/src/cli/index.ts +0 -17
  23. package/src/cli/middleware.ts +0 -119
  24. package/src/cli/types.ts +0 -75
  25. package/src/config/ConfigManager.ts +0 -587
  26. package/src/config/index.ts +0 -7
  27. package/src/config/types.ts +0 -584
  28. package/src/context/CompactionService.ts +0 -300
  29. package/src/context/ContextManager.ts +0 -450
  30. package/src/context/FileAnalyzer.ts +0 -267
  31. package/src/context/TokenCounter.ts +0 -265
  32. package/src/context/index.ts +0 -27
  33. package/src/context/storage/CacheStore.ts +0 -176
  34. package/src/context/storage/JSONLStore.ts +0 -201
  35. package/src/context/storage/MemoryStore.ts +0 -205
  36. package/src/context/storage/PersistentStore.ts +0 -327
  37. package/src/context/storage/index.ts +0 -9
  38. package/src/context/storage/pathUtils.ts +0 -114
  39. package/src/context/test.ts +0 -309
  40. package/src/context/types.ts +0 -268
  41. package/src/hooks/HookExecutor.ts +0 -434
  42. package/src/hooks/HookManager.ts +0 -596
  43. package/src/hooks/HookService.ts +0 -269
  44. package/src/hooks/Matcher.ts +0 -157
  45. package/src/hooks/index.ts +0 -63
  46. package/src/hooks/types.ts +0 -424
  47. package/src/main.tsx +0 -596
  48. package/src/mcp/HealthMonitor.ts +0 -150
  49. package/src/mcp/McpClient.ts +0 -491
  50. package/src/mcp/McpRegistry.ts +0 -321
  51. package/src/mcp/createMcpTool.ts +0 -251
  52. package/src/mcp/index.ts +0 -15
  53. package/src/mcp/server.ts +0 -334
  54. package/src/mcp/test-server.ts +0 -88
  55. package/src/mcp/test.ts +0 -372
  56. package/src/mcp/types.ts +0 -247
  57. package/src/memory/AgentMemoryBus.ts +0 -432
  58. package/src/memory/CloudSync.ts +0 -99
  59. package/src/memory/DriveSync.ts +0 -106
  60. package/src/memory/SharedMemory.ts +0 -951
  61. package/src/memory/index.ts +0 -14
  62. package/src/memory/machineFingerprint.ts +0 -40
  63. package/src/orchestrator/SubAgentMetadata.ts +0 -136
  64. package/src/prompts/builder.ts +0 -213
  65. package/src/prompts/default.ts +0 -144
  66. package/src/prompts/index.ts +0 -16
  67. package/src/prompts/plan.ts +0 -64
  68. package/src/prompts/test.ts +0 -78
  69. package/src/services/AnthropicChatService.ts +0 -341
  70. package/src/services/ChatService.ts +0 -347
  71. package/src/services/ClaudeCliChatService.ts +0 -256
  72. package/src/services/CloudSync.ts +0 -168
  73. package/src/services/CostLedger.ts +0 -211
  74. package/src/services/Heartbeat.ts +0 -135
  75. package/src/services/LearningCollector.ts +0 -291
  76. package/src/services/OllamaInstaller.ts +0 -342
  77. package/src/services/VersionChecker.ts +0 -445
  78. package/src/services/index.ts +0 -57
  79. package/src/services/streaming/OpenAIEventAdapter.ts +0 -126
  80. package/src/services/streaming/RenderingProfile.ts +0 -90
  81. package/src/services/streaming/StreamEventParser.ts +0 -181
  82. package/src/services/streaming/ThrottledRenderer.ts +0 -139
  83. package/src/services/streaming/TranscriptBuffer.ts +0 -574
  84. package/src/services/streaming/eventStatusMap.ts +0 -52
  85. package/src/services/streaming/index.ts +0 -46
  86. package/src/services/streaming/renderFormatting.ts +0 -79
  87. package/src/services/streaming/types.ts +0 -234
  88. package/src/skills/SkillLoader.ts +0 -126
  89. package/src/skills/SkillRegistry.ts +0 -366
  90. package/src/skills/index.ts +0 -48
  91. package/src/skills/types.ts +0 -146
  92. package/src/slash-commands/billing.ts +0 -70
  93. package/src/slash-commands/build.ts +0 -413
  94. package/src/slash-commands/builtinCommands.ts +0 -2733
  95. package/src/slash-commands/clone.ts +0 -242
  96. package/src/slash-commands/council.ts +0 -125
  97. package/src/slash-commands/custom/CustomCommandExecutor.ts +0 -143
  98. package/src/slash-commands/custom/CustomCommandLoader.ts +0 -251
  99. package/src/slash-commands/custom/CustomCommandRegistry.ts +0 -144
  100. package/src/slash-commands/custom/index.ts +0 -7
  101. package/src/slash-commands/debate.ts +0 -254
  102. package/src/slash-commands/gmail.ts +0 -105
  103. package/src/slash-commands/index.ts +0 -388
  104. package/src/slash-commands/mcpCommand.ts +0 -205
  105. package/src/slash-commands/types.ts +0 -201
  106. package/src/store/index.ts +0 -76
  107. package/src/store/selectors.ts +0 -246
  108. package/src/store/slices/appSlice.ts +0 -205
  109. package/src/store/slices/commandSlice.ts +0 -115
  110. package/src/store/slices/configSlice.ts +0 -46
  111. package/src/store/slices/focusSlice.ts +0 -64
  112. package/src/store/slices/index.ts +0 -9
  113. package/src/store/slices/sessionSlice.ts +0 -424
  114. package/src/store/streaming-buffer.ts +0 -425
  115. package/src/store/test.ts +0 -296
  116. package/src/store/types.ts +0 -274
  117. package/src/store/vanilla.ts +0 -186
  118. package/src/tools/builtin/bash.ts +0 -236
  119. package/src/tools/builtin/council.ts +0 -105
  120. package/src/tools/builtin/edit.ts +0 -213
  121. package/src/tools/builtin/glob.ts +0 -136
  122. package/src/tools/builtin/grep.ts +0 -263
  123. package/src/tools/builtin/index.ts +0 -61
  124. package/src/tools/builtin/memory.ts +0 -66
  125. package/src/tools/builtin/read.ts +0 -168
  126. package/src/tools/builtin/skill.ts +0 -97
  127. package/src/tools/builtin/snapshot.ts +0 -40
  128. package/src/tools/builtin/task.ts +0 -106
  129. package/src/tools/builtin/write.ts +0 -134
  130. package/src/tools/createTool.ts +0 -221
  131. package/src/tools/execution/ExecutionPipeline.ts +0 -263
  132. package/src/tools/execution/index.ts +0 -40
  133. package/src/tools/execution/stages/CacheStage.ts +0 -131
  134. package/src/tools/execution/stages/ConfirmationStage.ts +0 -203
  135. package/src/tools/execution/stages/DiscoveryStage.ts +0 -46
  136. package/src/tools/execution/stages/ExecutionStage.ts +0 -48
  137. package/src/tools/execution/stages/FormattingStage.ts +0 -44
  138. package/src/tools/execution/stages/HookStage.ts +0 -72
  139. package/src/tools/execution/stages/PermissionStage.ts +0 -287
  140. package/src/tools/execution/stages/PostHookStage.ts +0 -71
  141. package/src/tools/execution/stages/index.ts +0 -12
  142. package/src/tools/execution/test.ts +0 -266
  143. package/src/tools/execution/types.ts +0 -273
  144. package/src/tools/index.ts +0 -81
  145. package/src/tools/registry.ts +0 -304
  146. package/src/tools/schemas.ts +0 -109
  147. package/src/tools/test.ts +0 -220
  148. package/src/tools/types.ts +0 -175
  149. package/src/tools/validation/PermissionChecker.ts +0 -242
  150. package/src/tools/validation/SensitiveFileDetector.ts +0 -210
  151. package/src/tools/validation/index.ts +0 -11
  152. package/src/ui/App.tsx +0 -166
  153. package/src/ui/components/AegisInterface.tsx +0 -484
  154. package/src/ui/components/common/ChatSearch.tsx +0 -150
  155. package/src/ui/components/common/ErrorBoundary.tsx +0 -82
  156. package/src/ui/components/common/ExitMessage.tsx +0 -120
  157. package/src/ui/components/common/LoadingIndicator.tsx +0 -49
  158. package/src/ui/components/common/index.ts +0 -6
  159. package/src/ui/components/dialog/ConfirmationPrompt.tsx +0 -208
  160. package/src/ui/components/dialog/InteractiveSelector.tsx +0 -149
  161. package/src/ui/components/dialog/SetupWizard.tsx +0 -297
  162. package/src/ui/components/dialog/UpdatePrompt.tsx +0 -155
  163. package/src/ui/components/dialog/index.ts +0 -8
  164. package/src/ui/components/index.ts +0 -28
  165. package/src/ui/components/input/CommandSuggestions.tsx +0 -139
  166. package/src/ui/components/input/CustomTextInput.tsx +0 -220
  167. package/src/ui/components/input/InputArea.tsx +0 -361
  168. package/src/ui/components/input/PromptSuggestions.tsx +0 -66
  169. package/src/ui/components/input/index.ts +0 -6
  170. package/src/ui/components/layout/ChatStatusBar.tsx +0 -90
  171. package/src/ui/components/layout/ContextBar.tsx +0 -79
  172. package/src/ui/components/layout/MessageArea.tsx +0 -96
  173. package/src/ui/components/layout/MessageList.tsx +0 -647
  174. package/src/ui/components/layout/MessageSeparator.tsx +0 -26
  175. package/src/ui/components/layout/WelcomeMessage.tsx +0 -93
  176. package/src/ui/components/layout/index.ts +0 -7
  177. package/src/ui/components/markdown/CodeHighlighter.tsx +0 -292
  178. package/src/ui/components/markdown/MessageRenderer.tsx +0 -1211
  179. package/src/ui/components/markdown/index.ts +0 -8
  180. package/src/ui/components/markdown/parser.ts +0 -336
  181. package/src/ui/components/markdown/types.ts +0 -66
  182. package/src/ui/focus/FocusManager.ts +0 -137
  183. package/src/ui/focus/index.ts +0 -13
  184. package/src/ui/focus/types.ts +0 -54
  185. package/src/ui/focus/useFocus.ts +0 -75
  186. package/src/ui/hooks/index.ts +0 -11
  187. package/src/ui/hooks/useAgent.ts +0 -284
  188. package/src/ui/hooks/useCommandHistory.ts +0 -87
  189. package/src/ui/hooks/useCommandProcessor.ts +0 -443
  190. package/src/ui/hooks/useConfirmation.ts +0 -99
  191. package/src/ui/hooks/useCtrlCHandler.ts +0 -100
  192. package/src/ui/hooks/useInputBuffer.ts +0 -122
  193. package/src/ui/hooks/useTerminalSize.ts +0 -68
  194. package/src/ui/hooks/useTerminalWidth.ts +0 -5
  195. package/src/ui/hooks/useWindowedList.ts +0 -118
  196. package/src/ui/render-debugger.ts +0 -621
  197. package/src/ui/test.ts +0 -189
  198. package/src/ui/themes/ThemeManager.ts +0 -332
  199. package/src/ui/themes/aegisTheme.ts +0 -87
  200. package/src/ui/themes/darkTheme.ts +0 -87
  201. package/src/ui/themes/defaultTheme.ts +0 -85
  202. package/src/ui/themes/index.ts +0 -10
  203. package/src/ui/themes/lightTheme.ts +0 -89
  204. package/src/ui/themes/popularThemes.ts +0 -187
  205. package/src/ui/themes/types.ts +0 -130
  206. package/src/utils/clipboard.ts +0 -48
  207. package/src/utils/debug.ts +0 -43
  208. package/src/utils/environment.ts +0 -68
  209. package/src/utils/index.ts +0 -10
@@ -1,310 +0,0 @@
1
- /**
2
- * CouncilAgent — Multi-agent deliberation and voting
3
- *
4
- * Upgraded from /council slash-command into a programmable
5
- * deliberation system that can be invoked from the agent loop.
6
- *
7
- * Features:
8
- * - Configurable roles with custom system prompts
9
- * - Weighted voting (each agent can have a vote weight)
10
- * - Structured deliberation with reasoning
11
- * - Customizable voting rules (consensus, majority, supermajority)
12
- */
13
-
14
- import type { AgentConfig } from '../types.js';
15
- import { agentDebug } from '../../utils/debug.js';
16
- import { OrchestratorAgent, type SubAgentConfig } from './OrchestratorAgent.js';
17
-
18
- // ========== Types ==========
19
-
20
- export type VoteValue = 'approve' | 'reject' | 'abstain';
21
-
22
- export interface VoteResult {
23
- agentName: string;
24
- role: string;
25
- vote: VoteValue;
26
- reasoning: string;
27
- weight: number;
28
- color: string;
29
- }
30
-
31
- export interface DeliberationConfig {
32
- /** Rule for determining outcome */
33
- rule: 'majority' | 'supermajority' | 'unanimous' | 'weighted';
34
- /** For supermajority: fraction required (e.g., 0.66) */
35
- supermajorityThreshold?: number;
36
- /** Max tokens per agent response */
37
- maxTokensPerAgent?: number;
38
- /** Whether agents see each other's votes (for iteration) */
39
- enableIteration?: boolean;
40
- /** Max deliberation rounds */
41
- maxRounds?: number;
42
- }
43
-
44
- export interface DeliberationResult {
45
- approved: boolean;
46
- voteResults: VoteResult[];
47
- summary: string;
48
- config: DeliberationConfig;
49
- rounds: number;
50
- }
51
-
52
- // ========== Constants ==========
53
-
54
- const COLORS = [
55
- '\x1b[38;2;0;229;192m', // teal
56
- '\x1b[38;2;124;111;212m', // purple
57
- '\x1b[38;2;244;114;182m', // pink
58
- '\x1b[38;2;249;115;22m', // orange
59
- '\x1b[38;2;34;197;94m', // green
60
- '\x1b[38;2;239;68;68m', // red
61
- '\x1b[38;2;56;189;248m', // sky
62
- '\x1b[38;2;250;204;21m', // yellow
63
- ];
64
-
65
- // ========== Council Agent ==========
66
-
67
- export class CouncilAgent {
68
- private orchestrator: OrchestratorAgent;
69
- private config: DeliberationConfig;
70
- private agentRoles: Map<string, { role: string; weight: number; color: string }> = new Map();
71
-
72
- constructor(
73
- name: string,
74
- orchestratorConfig: AgentConfig,
75
- deliberationConfig: Partial<DeliberationConfig> = {}
76
- ) {
77
- this.orchestrator = new OrchestratorAgent(
78
- name,
79
- 'You are the AEGIS Council moderator. Synthesize deliberation results.'
80
- );
81
- this.config = {
82
- rule: 'majority',
83
- maxTokensPerAgent: 300,
84
- enableIteration: false,
85
- maxRounds: 1,
86
- ...deliberationConfig,
87
- };
88
- }
89
-
90
- /**
91
- * Register a council member with a specific role and vote weight
92
- */
93
- addMember(
94
- name: string,
95
- role: string,
96
- systemPrompt: string,
97
- weight: number = 1,
98
- config: AgentConfig,
99
- tools?: string[],
100
- ): void {
101
- const colorIndex = this.agentRoles.size % COLORS.length;
102
- const color = COLORS[colorIndex];
103
-
104
- const subConfig: SubAgentConfig = {
105
- name,
106
- role,
107
- systemPrompt,
108
- config,
109
- tools,
110
- };
111
-
112
- this.orchestrator.registerAgent(subConfig);
113
- this.agentRoles.set(name, { role, weight, color });
114
- }
115
-
116
- /**
117
- * Remove a council member
118
- */
119
- removeMember(name: string): void {
120
- this.orchestrator.unregisterAgent(name);
121
- this.agentRoles.delete(name);
122
- }
123
-
124
- /**
125
- * Get all registered council members
126
- */
127
- getMembers(): { name: string; role: string; weight: number }[] {
128
- return Array.from(this.agentRoles.entries()).map(([name, info]) => ({
129
- name,
130
- role: info.role,
131
- weight: info.weight,
132
- }));
133
- }
134
-
135
- /**
136
- * Convene the council to deliberate on a question
137
- */
138
- async deliberate(question: string, sessionId?: string): Promise<DeliberationResult> {
139
- const members = this.getMembers();
140
- if (members.length === 0) {
141
- throw new Error('CouncilAgent: No members registered. Add members before deliberating.');
142
- }
143
-
144
- let allResults: VoteResult[] = [];
145
- const rounds = Math.min(this.config.maxRounds || 1, 3);
146
-
147
- for (let round = 0; round < rounds; round++) {
148
- const subTasks: Record<string, string> = {};
149
-
150
- for (const member of members) {
151
- const previousContext = round > 0
152
- ? allResults
153
- .map(r => `${r.agentName} (${r.role}): Voted ${r.vote} — ${r.reasoning}`)
154
- .join('\n')
155
- : '';
156
-
157
- subTasks[member.name] = this.config.enableIteration && previousContext
158
- ? `Question: "${question}"\n\nPrevious round votes:\n${previousContext}\n\nBased on the discussion, state your FINAL VOTE and reasoning.\nRespond with:\nVOTE: approve, reject, or abstain\nREASONING: 1-3 sentences explaining your position.`
159
- : `Question: "${question}"\n\nState your vote and reasoning.\nRespond with:\nVOTE: approve, reject, or abstain\nREASONING: 1-3 sentences explaining your position.`;
160
- }
161
-
162
- const orchestration = await this.orchestrator.orchestrate(
163
- question,
164
- subTasks,
165
- members[0]?.name,
166
- sessionId,
167
- );
168
-
169
- // Parse votes from responses
170
- allResults = orchestration.responses.map(r => {
171
- const info = this.agentRoles.get(r.agentName);
172
- const content = r.content || '';
173
- const vote: VoteValue = content.includes('VOTE: approve')
174
- ? 'approve'
175
- : content.includes('VOTE: reject')
176
- ? 'reject'
177
- : 'abstain';
178
- const reasoning = content.split('REASONING:')[1]
179
- ? content.split('REASONING:')[1].trim().slice(0, 300)
180
- : content.slice(0, 200);
181
-
182
- return {
183
- agentName: r.agentName,
184
- role: info?.role || 'member',
185
- vote,
186
- reasoning,
187
- weight: info?.weight || 1,
188
- color: info?.color || COLORS[0],
189
- };
190
- });
191
-
192
- // Check if consensus reached early (for iterative mode)
193
- if (this.config.enableIteration && this.evaluateDecision(allResults).settled) {
194
- break;
195
- }
196
- }
197
-
198
- const decision = this.evaluateDecision(allResults);
199
- const summary = this.buildSummary(question, allResults, decision);
200
-
201
- return {
202
- approved: decision.approved,
203
- voteResults: allResults,
204
- summary,
205
- config: this.config,
206
- rounds,
207
- };
208
- }
209
-
210
- // ========== Private ==========
211
-
212
- private evaluateDecision(votes: VoteResult[]): {
213
- approved: boolean;
214
- settled: boolean;
215
- for: number;
216
- against: number;
217
- abstained: number;
218
- } {
219
- let forWeight = 0;
220
- let againstWeight = 0;
221
- let abstainedWeight = 0;
222
- let forCount = 0;
223
- let againstCount = 0;
224
- let abstainedCount = 0;
225
-
226
- for (const v of votes) {
227
- switch (v.vote) {
228
- case 'approve':
229
- forWeight += v.weight;
230
- forCount++;
231
- break;
232
- case 'reject':
233
- againstWeight += v.weight;
234
- againstCount++;
235
- break;
236
- case 'abstain':
237
- abstainedWeight += v.weight;
238
- abstainedCount++;
239
- break;
240
- }
241
- }
242
-
243
- const totalWeight = forWeight + againstWeight + abstainedWeight;
244
- const totalVoting = forWeight + againstWeight;
245
- const totalCount = forCount + againstCount + abstainedCount;
246
-
247
- switch (this.config.rule) {
248
- case 'unanimous':
249
- return {
250
- approved: forCount === totalCount && forCount > 0,
251
- settled: true,
252
- for: forCount,
253
- against: againstCount,
254
- abstained: abstainedCount,
255
- };
256
- case 'supermajority': {
257
- const threshold = this.config.supermajorityThreshold || 0.66;
258
- const weightedRatio = totalVoting > 0 ? forWeight / totalVoting : 0;
259
- return {
260
- approved: weightedRatio >= threshold,
261
- settled: true,
262
- for: forCount,
263
- against: againstCount,
264
- abstained: abstainedCount,
265
- };
266
- }
267
- case 'weighted':
268
- return {
269
- approved: forWeight > againstWeight,
270
- settled: true,
271
- for: forCount,
272
- against: againstCount,
273
- abstained: abstainedCount,
274
- };
275
- case 'majority':
276
- default:
277
- return {
278
- approved: forCount > againstCount,
279
- settled: forCount !== againstCount || forCount > 0,
280
- for: forCount,
281
- against: againstCount,
282
- abstained: abstainedCount,
283
- };
284
- }
285
- }
286
-
287
- private buildSummary(
288
- question: string,
289
- votes: VoteResult[],
290
- decision: { approved: boolean; for: number; against: number; abstained: number }
291
- ): string {
292
- const lines: string[] = [];
293
- lines.push('## ⬡ AEGIS COUNCIL');
294
- lines.push(`**Question:** ${question}`);
295
- lines.push('');
296
-
297
- for (const v of votes) {
298
- const emoji = v.vote === 'approve' ? '✅' : v.vote === 'reject' ? '❌' : '⚫';
299
- lines.push(`${v.color}${v.agentName}${'\x1b[0m'} · ${v.role}`);
300
- lines.push(` ${emoji} ${v.vote.toUpperCase()} (weight: ${v.weight}) — ${v.reasoning}`);
301
- lines.push('');
302
- }
303
-
304
- const verdict = decision.approved ? '✅ APPROVED' : '❌ REJECTED';
305
- lines.push('---');
306
- lines.push(`${verdict} · ${decision.for} FOR · ${decision.against} AGAINST · ${decision.abstained} ABSTAINED`);
307
-
308
- return lines.join('\n');
309
- }
310
- }