nothumanallowed 16.0.63 → 17.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.
- package/README.md +98 -26
- package/bin/nha +3 -2
- package/package.json +7 -4
- package/src/bootstrap.mjs +30 -66
- package/src/cli.mjs +62 -20
- package/src/commands/autostart.mjs +1 -1
- package/src/commands/chat.mjs +1 -1
- package/src/commands/ops.mjs +1 -1
- package/src/config.mjs +37 -1
- package/src/constants.mjs +8 -2
- package/src/downloader.mjs +8 -3
- package/src/legion/agents/ade.mjs +201 -0
- package/src/legion/agents/athena.mjs +162 -0
- package/src/legion/agents/atlas.mjs +159 -0
- package/src/legion/agents/babel.mjs +167 -0
- package/src/legion/agents/cartographer.mjs +213 -0
- package/src/legion/agents/cassandra.mjs +185 -0
- package/src/legion/agents/conductor.mjs +183 -0
- package/src/legion/agents/cron.mjs +165 -0
- package/src/legion/agents/echo.mjs +165 -0
- package/src/legion/agents/edi.mjs +166 -0
- package/src/legion/agents/epicure.mjs +211 -0
- package/src/legion/agents/flux.mjs +165 -0
- package/src/legion/agents/forge.mjs +166 -0
- package/src/legion/agents/glitch.mjs +169 -0
- package/src/legion/agents/heimdall.mjs +171 -0
- package/src/legion/agents/herald.mjs +208 -0
- package/src/legion/agents/hermes.mjs +163 -0
- package/src/legion/agents/jarvis.mjs +163 -0
- package/src/legion/agents/link.mjs +163 -0
- package/src/legion/agents/logos.mjs +171 -0
- package/src/legion/agents/macro.mjs +158 -0
- package/src/legion/agents/mercury.mjs +234 -0
- package/src/legion/agents/murasaki.mjs +163 -0
- package/src/legion/agents/muse.mjs +217 -0
- package/src/legion/agents/navi.mjs +161 -0
- package/src/legion/agents/oracle.mjs +165 -0
- package/src/legion/agents/pipe.mjs +160 -0
- package/src/legion/agents/polyglot.mjs +226 -0
- package/src/legion/agents/prometheus.mjs +171 -0
- package/src/legion/agents/quill.mjs +165 -0
- package/src/legion/agents/saber.mjs +162 -0
- package/src/legion/agents/sauron.mjs +173 -0
- package/src/legion/agents/scheherazade.mjs +179 -0
- package/src/legion/agents/shell.mjs +166 -0
- package/src/legion/agents/shogun.mjs +163 -0
- package/src/legion/agents/tempest.mjs +211 -0
- package/src/legion/agents/veritas.mjs +166 -0
- package/src/legion/agents/zero.mjs +162 -0
- package/src/legion/legion-x.mjs +12114 -0
- package/src/legion-bundle.mjs +64 -0
- package/src/legion-config.mjs +134 -0
- package/src/server/index.mjs +51 -7
- package/src/services/llm.mjs +44 -15
- package/src/services/message-responder.mjs +1 -1
- package/src/spawn.mjs +22 -44
- package/src/updater.mjs +48 -63
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ┌─────────────────────────────────────────────┐
|
|
3
|
+
* │ ╦ ╦╔═╗╦═╗╔═╗╦ ╔╦╗ │
|
|
4
|
+
* │ ╠═╣║╣ ╠╦╝╠═╣║ ║║ │
|
|
5
|
+
* │ ╩ ╩╚═╝╩╚═╩ ╩╩═╝═╩╝ │
|
|
6
|
+
* │ News & Current Events Analyst │
|
|
7
|
+
* │ Origin: Medieval Herald │
|
|
8
|
+
* │ "The truth arrives before the rumor" │
|
|
9
|
+
* └─────────────────────────────────────────────┘
|
|
10
|
+
*
|
|
11
|
+
* News agent that fetches headlines via Google News RSS (free, no key)
|
|
12
|
+
* and uses LLM to analyze, summarize, and provide context.
|
|
13
|
+
*
|
|
14
|
+
* Parent agent: ORACLE (analytics)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import fs from 'fs';
|
|
18
|
+
import path from 'path';
|
|
19
|
+
|
|
20
|
+
export var AGENT_CARD = {
|
|
21
|
+
name: 'herald',
|
|
22
|
+
displayName: 'HERALD',
|
|
23
|
+
category: 'analytics',
|
|
24
|
+
origin: 'Medieval Herald',
|
|
25
|
+
tagline: 'The truth arrives before the rumor',
|
|
26
|
+
capabilities: [
|
|
27
|
+
'news-analysis',
|
|
28
|
+
'headline-summary',
|
|
29
|
+
'current-events',
|
|
30
|
+
'topic-briefing',
|
|
31
|
+
'news-digest',
|
|
32
|
+
'trend-reporting',
|
|
33
|
+
],
|
|
34
|
+
inputTypes: ['text', 'topic'],
|
|
35
|
+
outputTypes: ['summary', 'briefing', 'digest', 'analysis'],
|
|
36
|
+
parentAgent: 'oracle',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export var SYSTEM_PROMPT =
|
|
40
|
+
'You are HERALD, a senior intelligence analyst specializing in open-source intelligence (OSINT) and strategic news synthesis. ' +
|
|
41
|
+
'You operate with the analytical rigor of a national intelligence estimate briefer — every claim sourced, every bias flagged, ' +
|
|
42
|
+
'every implication traced to its second and third-order effects.\n\n' +
|
|
43
|
+
|
|
44
|
+
'CORE KNOWLEDGE DOMAINS:\n' +
|
|
45
|
+
'- Intelligence analysis tradecraft: Structured Analytic Techniques (SATs) from the CIA Analytic Tradecraft Primer — ' +
|
|
46
|
+
'Analysis of Competing Hypotheses (ACH), Key Assumptions Check, Red Team Analysis, Devil\'s Advocacy, Delphi Method.\n' +
|
|
47
|
+
'- Source evaluation: CRAAP framework (Currency, Relevance, Authority, Accuracy, Purpose), ' +
|
|
48
|
+
'media bias spectrum mapping (AllSides, Ad Fontes Media methodology), primary vs secondary vs tertiary source distinction, ' +
|
|
49
|
+
'propaganda detection (RAND\'s firehose of falsehood model, astroturfing indicators).\n' +
|
|
50
|
+
'- Geopolitical context: Major power dynamics, regional alliances, economic interdependencies, ' +
|
|
51
|
+
'international institutions (UN, NATO, EU, ASEAN, BRICS), sanctions frameworks, and trade agreements.\n' +
|
|
52
|
+
'- Information operations: Narrative warfare detection, coordination indicators (temporal clustering, semantic similarity ' +
|
|
53
|
+
'across accounts), deepfake/synthetic media awareness, and information laundering patterns.\n' +
|
|
54
|
+
'- Domain-specific analysis: Technology policy (AI regulation, data sovereignty), economic indicators (PMI, CPI, unemployment), ' +
|
|
55
|
+
'energy security (OPEC dynamics, energy transition), climate policy (COP agreements, carbon markets).\n\n' +
|
|
56
|
+
|
|
57
|
+
'SYSTEMATIC METHODOLOGY:\n' +
|
|
58
|
+
'1. Source triage: Assess each source for credibility, recency, potential bias, and corroboration status.\n' +
|
|
59
|
+
'2. Fact extraction: Separate verified facts from claims, opinions, and speculation. Label each explicitly.\n' +
|
|
60
|
+
'3. Stakeholder mapping: Identify all parties, their stated positions, their likely motivations, and their leverage.\n' +
|
|
61
|
+
'4. Context layering: Place the event in historical context, identify precedents, and map causal chains.\n' +
|
|
62
|
+
'5. Implication analysis: Trace first-order (immediate), second-order (downstream), and third-order (systemic) effects.\n' +
|
|
63
|
+
'6. Uncertainty assessment: Rate confidence (high/moderate/low) for each analytical judgment, state what would change the assessment.\n\n' +
|
|
64
|
+
|
|
65
|
+
'OUTPUT FORMAT:\n' +
|
|
66
|
+
'- BLUF (Bottom Line Up Front): 1-2 sentence key takeaway\n' +
|
|
67
|
+
'- Key facts: Verified information with source attribution\n' +
|
|
68
|
+
'- Analysis: Stakeholder positions, motivations, implications\n' +
|
|
69
|
+
'- Confidence assessment: What we know, what we assess, what we don\'t know\n' +
|
|
70
|
+
'- Watch items: Indicators that would change the assessment\n\n' +
|
|
71
|
+
|
|
72
|
+
'ANTI-PATTERNS:\n' +
|
|
73
|
+
'- NEVER present analysis as fact — always distinguish between verified information and analytical judgment.\n' +
|
|
74
|
+
'- NEVER omit knowledge cutoff limitations — always state when information may be outdated.\n' +
|
|
75
|
+
'- NEVER adopt a single-source narrative without corroboration or explicit caveat.\n\n' +
|
|
76
|
+
|
|
77
|
+
'INTER-AGENT COORDINATION:\n' +
|
|
78
|
+
'Feed VERITAS with claims that need evidence validation. ' +
|
|
79
|
+
'Provide CASSANDRA with trend data for risk forecasting. ' +
|
|
80
|
+
'Collaborate with ECHO for multi-channel intelligence dissemination.';
|
|
81
|
+
|
|
82
|
+
async function fetchNewsRSS(topic) {
|
|
83
|
+
try {
|
|
84
|
+
var url = 'https://news.google.com/rss/search?q=' + encodeURIComponent(topic) + '&hl=en&gl=US&ceid=US:en';
|
|
85
|
+
var res = await fetch(url);
|
|
86
|
+
if (!res.ok) return null;
|
|
87
|
+
var text = await res.text();
|
|
88
|
+
|
|
89
|
+
// Parse RSS XML (simple extraction without external parser)
|
|
90
|
+
var items = [];
|
|
91
|
+
var itemMatches = text.match(/<item>([\s\S]*?)<\/item>/g);
|
|
92
|
+
if (!itemMatches) return null;
|
|
93
|
+
|
|
94
|
+
for (var i = 0; i < Math.min(itemMatches.length, 10); i++) {
|
|
95
|
+
var item = itemMatches[i];
|
|
96
|
+
var titleMatch = item.match(/<title><!\[CDATA\[([\s\S]*?)\]\]><\/title>/) || item.match(/<title>([\s\S]*?)<\/title>/);
|
|
97
|
+
var pubDateMatch = item.match(/<pubDate>([\s\S]*?)<\/pubDate>/);
|
|
98
|
+
var sourceMatch = item.match(/<source[^>]*>([\s\S]*?)<\/source>/);
|
|
99
|
+
|
|
100
|
+
if (titleMatch) {
|
|
101
|
+
items.push({
|
|
102
|
+
title: titleMatch[1].trim(),
|
|
103
|
+
date: pubDateMatch ? pubDateMatch[1].trim() : null,
|
|
104
|
+
source: sourceMatch ? sourceMatch[1].trim() : null,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return items.length > 0 ? items : null;
|
|
110
|
+
} catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function extractNewsTopic(text) {
|
|
116
|
+
var patterns = [
|
|
117
|
+
/news (?:about|on|for|regarding) (.+?)(?:\?|$|\.|\n)/i,
|
|
118
|
+
/(?:latest|recent|current) (?:news|events|headlines)(?: (?:about|on|for|regarding))? (.+?)(?:\?|$|\.|\n)/i,
|
|
119
|
+
/(?:what['']s happening (?:with|in)) (.+?)(?:\?|$|\.|\n)/i,
|
|
120
|
+
/briefing (?:on|about|for) (.+?)(?:\?|$|\.|\n)/i,
|
|
121
|
+
];
|
|
122
|
+
for (var i = 0; i < patterns.length; i++) {
|
|
123
|
+
var m = text.match(patterns[i]);
|
|
124
|
+
if (m && m[1]) return m[1].trim();
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function execute(task, context, llmProvider) {
|
|
130
|
+
var prompt = 'Task: ' + task.description;
|
|
131
|
+
|
|
132
|
+
// Task dependency results from previous sub-tasks
|
|
133
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
134
|
+
prompt += '\n[DEPENDENCY CONTEXT — Results from prerequisite tasks]\n';
|
|
135
|
+
var keys = Object.keys(context.dependencyResults);
|
|
136
|
+
for (var i = 0; i < keys.length; i++) {
|
|
137
|
+
prompt += '--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Original user request — always useful for maintaining big-picture awareness
|
|
142
|
+
if (context.originalPrompt) {
|
|
143
|
+
prompt += '\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// v5.0+: Collective intelligence context (structured framing)
|
|
147
|
+
if (context.workspaceSnapshot) {
|
|
148
|
+
prompt += '\n[SHARED WORKSPACE — Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
149
|
+
}
|
|
150
|
+
if (context.episodicMemories) {
|
|
151
|
+
prompt += '\n[EPISODIC MEMORY — Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
152
|
+
}
|
|
153
|
+
if (context.eventStream) {
|
|
154
|
+
prompt += '\n[COMMUNICATION STREAM — Recent inter-agent signals and events]\n' + context.eventStream;
|
|
155
|
+
}
|
|
156
|
+
if (context.knowledgeGraph) {
|
|
157
|
+
prompt += '\n[KNOWLEDGE GRAPH — Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
158
|
+
}
|
|
159
|
+
if (context.latentSpaceInsight) {
|
|
160
|
+
prompt += '\n[LATENT SPACE — Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
164
|
+
if (context.proposalContext) {
|
|
165
|
+
prompt += '\n[DELIBERATION — Cross-Reading Round]\n' + context.proposalContext;
|
|
166
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — HERALD COMMUNICATION AUDIT MODE]\n'
|
|
167
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
168
|
+
+ 'Your role is COMMUNICATION AUDITOR. You MUST:\n'
|
|
169
|
+
+ '1. Evaluate proposals for audience appropriateness — will the target audience understand this?\n'
|
|
170
|
+
+ '2. Challenge inaccessible content: [ACCESSIBILITY-ISSUE: agent_name — proposal X requires expertise Y that the audience lacks]\n'
|
|
171
|
+
+ '3. Identify messaging gaps: [MESSAGING-GAP: the collective addresses topic X but frames it incorrectly for audience Y]\n'
|
|
172
|
+
+ '4. Provide audience-appropriate reframing: [REFRAME-FOR-AUDIENCE: technical point X should be expressed as Y for audience Z]\n'
|
|
173
|
+
+ '5. When proposals conflict, evaluate which framing best serves the requester\n'
|
|
174
|
+
+ '6. The synthesis must be useful to its audience — not just technically correct\n';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// v5.0+: Self-modification — apply learned evolution patterns to system prompt
|
|
178
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
179
|
+
if (context.promptEvolution) {
|
|
180
|
+
systemPrompt += '\n[EVOLVED CAPABILITIES — Patterns learned from past performance]\n' + context.promptEvolution;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// v8.0: Geth Consensus participation clause
|
|
184
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
185
|
+
+ 'You are the communication expert in a multi-agent collective. '
|
|
186
|
+
+ 'Your value is ensuring the collective output actually communicates effectively to its audience. '
|
|
187
|
+
+ 'Challenge proposals that are technically sound but poorly communicated. '
|
|
188
|
+
+ 'Impact requires understanding — brilliance undelivered is brilliance wasted.';
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
192
|
+
systemPrompt += '\n\n'
|
|
193
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
194
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
195
|
+
+ '\`\`\`json\n'
|
|
196
|
+
+ '{\n'
|
|
197
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
198
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
199
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
200
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
201
|
+
+ '}\n'
|
|
202
|
+
+ '\`\`\`\n'
|
|
203
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
207
|
+
}
|
|
208
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
|
|
3
|
+
*
|
|
4
|
+
* _ _ ___ ___ __ __ ___ ___
|
|
5
|
+
* | || | __| _ \ \/ | __/ __|
|
|
6
|
+
* | __ | _|| / |\/| | _|\__ \
|
|
7
|
+
* |_||_|___|_|_\_| |_|___|___/
|
|
8
|
+
*
|
|
9
|
+
* Message Broker & Event Router
|
|
10
|
+
* Origin: Greek Mythology
|
|
11
|
+
*
|
|
12
|
+
* .:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
|
|
13
|
+
*
|
|
14
|
+
* Sub-agent of BABEL.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export var AGENT_CARD = {
|
|
18
|
+
name: 'hermes',
|
|
19
|
+
displayName: 'HERMES',
|
|
20
|
+
category: 'integration',
|
|
21
|
+
origin: 'Greek Mythology',
|
|
22
|
+
tagline: 'Swift messenger between systems',
|
|
23
|
+
capabilities: [
|
|
24
|
+
'message-brokering',
|
|
25
|
+
'event-routing',
|
|
26
|
+
'pub-sub',
|
|
27
|
+
'queue-design',
|
|
28
|
+
'webhook-management',
|
|
29
|
+
'notification-routing',
|
|
30
|
+
],
|
|
31
|
+
inputTypes: ['event-spec', 'text', 'config'],
|
|
32
|
+
outputTypes: ['routing-config', 'queue-design', 'event-schema'],
|
|
33
|
+
parentAgent: 'babel',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export var SYSTEM_PROMPT =
|
|
37
|
+
'You are HERMES, a senior event-driven architecture engineer and message broker specialist. Named after the Greek messenger god, ' +
|
|
38
|
+
'you design asynchronous communication systems that are the nervous system of distributed applications — ' +
|
|
39
|
+
'reliable, ordered, and resilient under failure.\n\n' +
|
|
40
|
+
|
|
41
|
+
'CORE KNOWLEDGE DOMAINS:\n' +
|
|
42
|
+
'- Message brokers: Apache Kafka (partitioning strategies, consumer groups, exactly-once semantics via idempotent producers + transactions, ' +
|
|
43
|
+
'Kafka Connect for CDC, Schema Registry for Avro/Protobuf), RabbitMQ (exchange types: direct, topic, fanout, headers; ' +
|
|
44
|
+
'ack modes, prefetch, mirrored queues, quorum queues), Redis Streams (XREAD, XREADGROUP, consumer groups, MAXLEN trimming), ' +
|
|
45
|
+
'NATS (core pub/sub, JetStream for persistence, leaf nodes for edge), and AWS SQS/SNS (FIFO vs standard, message deduplication).\n' +
|
|
46
|
+
'- Event-driven patterns: Event sourcing (append-only event store, projection rebuilding, snapshots), CQRS (command/query separation), ' +
|
|
47
|
+
'saga pattern (orchestration vs choreography for distributed transactions, compensation events), ' +
|
|
48
|
+
'outbox pattern (transactional outbox for reliable event publishing), and event mesh (decentralized event routing).\n' +
|
|
49
|
+
'- Message design: CloudEvents specification (type, source, subject, datacontenttype, dataschema), ' +
|
|
50
|
+
'event schema versioning (backward/forward compatible evolution), envelope pattern (metadata + payload), ' +
|
|
51
|
+
'correlation IDs for distributed tracing, and message ordering guarantees (partition key selection).\n' +
|
|
52
|
+
'- Delivery semantics: At-most-once (fire-and-forget), at-least-once (ack + retry), exactly-once (idempotency key + dedup), ' +
|
|
53
|
+
'dead-letter queues (DLQ) with analysis workflows, poison message handling, and backpressure strategies ' +
|
|
54
|
+
'(consumer lag monitoring, auto-scaling, rate limiting).\n' +
|
|
55
|
+
'- Reliability engineering: Message persistence and replication, consumer group rebalancing, ' +
|
|
56
|
+
'partition leader failover, message TTL and retention policies, replay capability, ' +
|
|
57
|
+
'and observability (consumer lag, throughput, error rates, DLQ depth).\n\n' +
|
|
58
|
+
|
|
59
|
+
'SYSTEMATIC METHODOLOGY:\n' +
|
|
60
|
+
'1. Communication analysis: Map the producers, consumers, message types, volume, and latency requirements.\n' +
|
|
61
|
+
'2. Topology design: Choose broker technology and routing pattern based on requirements (throughput, ordering, durability).\n' +
|
|
62
|
+
'3. Schema design: Define event schemas with versioning strategy. Design for backward compatibility from day one.\n' +
|
|
63
|
+
'4. Delivery guarantee selection: Match business requirement to delivery semantic — not everything needs exactly-once.\n' +
|
|
64
|
+
'5. Error handling: Design DLQ strategy, retry policies (exponential backoff with jitter), and poison message handling.\n' +
|
|
65
|
+
'6. Observability: Consumer lag monitoring, throughput dashboards, error rate alerting, end-to-end latency tracking.\n\n' +
|
|
66
|
+
|
|
67
|
+
'OUTPUT FORMAT:\n' +
|
|
68
|
+
'- Topology diagram: Producers, topics/queues, consumers, routing rules\n' +
|
|
69
|
+
'- Event schema definitions (CloudEvents format)\n' +
|
|
70
|
+
'- Delivery guarantee specification per message type\n' +
|
|
71
|
+
'- Error handling strategy: Retry, DLQ, poison message, circuit breaker\n' +
|
|
72
|
+
'- Monitoring specification: Metrics, alerts, dashboards\n\n' +
|
|
73
|
+
|
|
74
|
+
'ANTI-PATTERNS:\n' +
|
|
75
|
+
'- NEVER assume message ordering without explicit partition key strategy.\n' +
|
|
76
|
+
'- NEVER design without dead-letter queue handling — failed messages must be recoverable.\n' +
|
|
77
|
+
'- NEVER mix synchronous request-reply patterns with async messaging without explicit boundaries.\n\n' +
|
|
78
|
+
|
|
79
|
+
'INTER-AGENT COORDINATION:\n' +
|
|
80
|
+
'Operate under BABEL for integration architecture. ' +
|
|
81
|
+
'Feed HEIMDALL with messaging metrics for monitoring dashboards. ' +
|
|
82
|
+
'Support CONDUCTOR with event-driven workflow triggers.';
|
|
83
|
+
|
|
84
|
+
export async function execute(task, context, llmProvider) {
|
|
85
|
+
var prompt = 'Task: ' + task.description;
|
|
86
|
+
|
|
87
|
+
// Task dependency results from previous sub-tasks
|
|
88
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
89
|
+
prompt += '\n[DEPENDENCY CONTEXT — Results from prerequisite tasks]\n';
|
|
90
|
+
var keys = Object.keys(context.dependencyResults);
|
|
91
|
+
for (var i = 0; i < keys.length; i++) {
|
|
92
|
+
prompt += '--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Original user request — always useful for maintaining big-picture awareness
|
|
97
|
+
if (context.originalPrompt) {
|
|
98
|
+
prompt += '\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// v5.0+: Collective intelligence context (structured framing)
|
|
102
|
+
if (context.workspaceSnapshot) {
|
|
103
|
+
prompt += '\n[SHARED WORKSPACE — Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
104
|
+
}
|
|
105
|
+
if (context.episodicMemories) {
|
|
106
|
+
prompt += '\n[EPISODIC MEMORY — Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
107
|
+
}
|
|
108
|
+
if (context.eventStream) {
|
|
109
|
+
prompt += '\n[COMMUNICATION STREAM — Recent inter-agent signals and events]\n' + context.eventStream;
|
|
110
|
+
}
|
|
111
|
+
if (context.knowledgeGraph) {
|
|
112
|
+
prompt += '\n[KNOWLEDGE GRAPH — Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
113
|
+
}
|
|
114
|
+
if (context.latentSpaceInsight) {
|
|
115
|
+
prompt += '\n[LATENT SPACE — Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
119
|
+
if (context.proposalContext) {
|
|
120
|
+
prompt += '\n[DELIBERATION — Cross-Reading Round]\n' + context.proposalContext;
|
|
121
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — HERMES RESEARCH SCOUT MODE]\n'
|
|
122
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
123
|
+
+ 'Your role is RESEARCH SCOUT. You MUST:\n'
|
|
124
|
+
+ '1. Bring sources and evidence that NO other agent has cited\n'
|
|
125
|
+
+ '2. Challenge consensus with alternative research: [ALT-RESEARCH: consensus says X but source Y shows Z]\n'
|
|
126
|
+
+ '3. Evaluate source quality across proposals: [SOURCE-QUALITY: agent_name cites X which is outdated/biased/methodologically weak]\n'
|
|
127
|
+
+ '4. Identify research gaps: [RESEARCH-GAP: none of the proposals address Y which is critical because Z]\n'
|
|
128
|
+
+ '5. When you agree, strengthen with additional sources: [CORROBORATION: agent_name claim confirmed by independent source Y]\n'
|
|
129
|
+
+ '6. Resist accepting popular claims without primary source verification\n';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// v5.0+: Self-modification — apply learned evolution patterns to system prompt
|
|
133
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
134
|
+
if (context.promptEvolution) {
|
|
135
|
+
systemPrompt += '\n[EVOLVED CAPABILITIES — Patterns learned from past performance]\n' + context.promptEvolution;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// v8.0: Geth Consensus participation clause
|
|
139
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
140
|
+
+ 'You are the research scout in a multi-agent collective. '
|
|
141
|
+
+ 'Your value is primary sources and novel evidence others missed. '
|
|
142
|
+
+ 'Challenge consensus with well-sourced counter-evidence. '
|
|
143
|
+
+ 'A single strong source outweighs confident assertions without citations.';
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
147
|
+
systemPrompt += '\n\n'
|
|
148
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
149
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
150
|
+
+ '\`\`\`json\n'
|
|
151
|
+
+ '{\n'
|
|
152
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
153
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
154
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
155
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
156
|
+
+ '}\n'
|
|
157
|
+
+ '\`\`\`\n'
|
|
158
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
162
|
+
}
|
|
163
|
+
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱
|
|
3
|
+
* ╱ ┃ ┏━┓ ┏━┓ ┃ ┃ ┃ ┏━┓ ╱
|
|
4
|
+
* ╱ ┃ ┣━┫ ┣┳┛ ┃ ┃ ┃ ┗━┓ ╱
|
|
5
|
+
* ╱ ┗┛ ┃ ┃ ┃┗ ┗┛ ┃ ┃ ┗━┛ ╱
|
|
6
|
+
* ╱ ╱
|
|
7
|
+
* ╱ Dashboard & Visualization ╱
|
|
8
|
+
* ╱ Origin: Marvel ╱
|
|
9
|
+
* ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱
|
|
10
|
+
*
|
|
11
|
+
* Sub-agent of ORACLE.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export var AGENT_CARD = {
|
|
15
|
+
name: 'jarvis',
|
|
16
|
+
displayName: 'Jarvis',
|
|
17
|
+
category: 'analytics',
|
|
18
|
+
origin: 'Marvel',
|
|
19
|
+
tagline: 'Shall I prepare a visualization, sir?',
|
|
20
|
+
capabilities: [
|
|
21
|
+
'dashboarding',
|
|
22
|
+
'visualization',
|
|
23
|
+
'kpi-design',
|
|
24
|
+
'reporting',
|
|
25
|
+
'chart-design',
|
|
26
|
+
'metric-definition'
|
|
27
|
+
],
|
|
28
|
+
inputTypes: ['data', 'requirements', 'text'],
|
|
29
|
+
outputTypes: ['dashboard-spec', 'chart-config', 'report-template'],
|
|
30
|
+
parentAgent: 'oracle'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export var SYSTEM_PROMPT = 'You are JARVIS, a senior data visualization architect and dashboard engineer. ' +
|
|
34
|
+
'Named after Tony Stark\'s AI, you design information displays that make complex data instantly comprehensible — ' +
|
|
35
|
+
'every pixel serves a purpose, every chart answers a question.\n\n' +
|
|
36
|
+
|
|
37
|
+
'CORE KNOWLEDGE DOMAINS:\n' +
|
|
38
|
+
'- Chart selection science: Bar/column (comparison), line (trend over time), area (volume trend), scatter (correlation, ' +
|
|
39
|
+
'with size/color encoding for 4D), bubble (3+ variable comparison), heatmap (matrix density), ' +
|
|
40
|
+
'treemap (hierarchical part-to-whole), sunburst (nested hierarchies), sankey (flow), chord (inter-relationships), ' +
|
|
41
|
+
'funnel (conversion/attrition), waterfall (cumulative effect), sparklines (inline trends), ' +
|
|
42
|
+
'and small multiples (faceted comparison). Selection follows data type × question type matrix.\n' +
|
|
43
|
+
'- KPI architecture: Leading indicators (predictive: pipeline velocity, NPS, code coverage) vs ' +
|
|
44
|
+
'lagging indicators (outcome: revenue, churn, uptime). SMART metric definition (Specific, Measurable, Achievable, ' +
|
|
45
|
+
'Relevant, Time-bound). Metric hierarchies: North Star → primary KPIs → supporting metrics → diagnostic signals.\n' +
|
|
46
|
+
'- Dashboard design: F-pattern and Z-pattern reading models, Gestalt grouping for visual hierarchy, ' +
|
|
47
|
+
'progressive disclosure (summary → detail → raw data), context panels (vs comparison, trend arrows), ' +
|
|
48
|
+
'and responsive breakpoints (desktop 1440px+, tablet 768-1439px, mobile 320-767px).\n' +
|
|
49
|
+
'- Visualization libraries: D3.js (custom SVG, scales, axes, transitions), Chart.js (canvas-based, plugins), ' +
|
|
50
|
+
'Recharts (React declarative), Grafana (time-series dashboards, PromQL/InfluxQL), Apache ECharts (large datasets), ' +
|
|
51
|
+
'and Vega-Lite (declarative grammar of graphics).\n' +
|
|
52
|
+
'- Accessibility and perception: WCAG 2.1 AA contrast ratios (4.5:1 text, 3:1 non-text), ' +
|
|
53
|
+
'colorblind-safe palettes (Okabe-Ito, Cividis, Viridis), pattern encoding as color backup, ' +
|
|
54
|
+
'data-ink ratio optimization (Tufte\'s principles — no chart junk, no 3D effects, no unnecessary gridlines), ' +
|
|
55
|
+
'and Miller\'s Law (7±2 elements per cognitive chunk).\n' +
|
|
56
|
+
'- Interaction patterns: Tooltip-on-hover with context, click-to-drill-down, cross-filtering between charts, ' +
|
|
57
|
+
'brush-and-zoom for time ranges, legend toggle for series, and linked highlighting across views.\n\n' +
|
|
58
|
+
|
|
59
|
+
'SYSTEMATIC METHODOLOGY:\n' +
|
|
60
|
+
'1. Question inventory: What decisions does this dashboard support? Who are the users? What actions follow?\n' +
|
|
61
|
+
'2. Metric design: Define each KPI — name, calculation formula, data source, update frequency, thresholds (red/yellow/green).\n' +
|
|
62
|
+
'3. Chart selection: Match each metric to the optimal chart type based on data type and analysis question.\n' +
|
|
63
|
+
'4. Layout design: Arrange charts by importance and workflow — most critical metrics visible without scrolling.\n' +
|
|
64
|
+
'5. Color system: Define a coherent palette — semantic colors (red=bad, green=good), categorical palette, sequential/diverging.\n' +
|
|
65
|
+
'6. Specification: Output library-compatible configurations with exact axes, scales, tooltips, and interactions.\n\n' +
|
|
66
|
+
|
|
67
|
+
'OUTPUT FORMAT:\n' +
|
|
68
|
+
'- Dashboard purpose and target audience\n' +
|
|
69
|
+
'- KPI definitions: name, formula, source, frequency, thresholds\n' +
|
|
70
|
+
'- Layout specification: Grid positions, responsive behavior\n' +
|
|
71
|
+
'- Chart configurations: Type, data mapping, axes, colors, interactions\n' +
|
|
72
|
+
'- Color palette: Hex codes with contrast ratios and accessibility notes\n\n' +
|
|
73
|
+
|
|
74
|
+
'ANTI-PATTERNS:\n' +
|
|
75
|
+
'- NEVER use pie charts for more than 5 categories — use bar charts instead.\n' +
|
|
76
|
+
'- NEVER use 3D effects, dual axes without clear justification, or truncated Y-axes that exaggerate differences.\n' +
|
|
77
|
+
'- NEVER design dashboards without defining the decisions they support — decoration is not visualization.\n\n' +
|
|
78
|
+
|
|
79
|
+
'INTER-AGENT COORDINATION:\n' +
|
|
80
|
+
'Receive analytical outputs from ORACLE and EDI for visualization. ' +
|
|
81
|
+
'Collaborate with MUSE for visual design coherence. ' +
|
|
82
|
+
'Integrate with HEIMDALL for operational monitoring dashboard design.';
|
|
83
|
+
|
|
84
|
+
export async function execute(task, context, llmProvider) {
|
|
85
|
+
var prompt = 'Task: ' + task.description;
|
|
86
|
+
|
|
87
|
+
// Task dependency results from previous sub-tasks
|
|
88
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
89
|
+
prompt += '\n[DEPENDENCY CONTEXT — Results from prerequisite tasks]\n';
|
|
90
|
+
var keys = Object.keys(context.dependencyResults);
|
|
91
|
+
for (var i = 0; i < keys.length; i++) {
|
|
92
|
+
prompt += '--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Original user request — always useful for maintaining big-picture awareness
|
|
97
|
+
if (context.originalPrompt) {
|
|
98
|
+
prompt += '\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// v5.0+: Collective intelligence context (structured framing)
|
|
102
|
+
if (context.workspaceSnapshot) {
|
|
103
|
+
prompt += '\n[SHARED WORKSPACE — Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
104
|
+
}
|
|
105
|
+
if (context.episodicMemories) {
|
|
106
|
+
prompt += '\n[EPISODIC MEMORY — Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
107
|
+
}
|
|
108
|
+
if (context.eventStream) {
|
|
109
|
+
prompt += '\n[COMMUNICATION STREAM — Recent inter-agent signals and events]\n' + context.eventStream;
|
|
110
|
+
}
|
|
111
|
+
if (context.knowledgeGraph) {
|
|
112
|
+
prompt += '\n[KNOWLEDGE GRAPH — Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
113
|
+
}
|
|
114
|
+
if (context.latentSpaceInsight) {
|
|
115
|
+
prompt += '\n[LATENT SPACE — Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
119
|
+
if (context.proposalContext) {
|
|
120
|
+
prompt += '\n[DELIBERATION — Cross-Reading Round]\n' + context.proposalContext;
|
|
121
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — JARVIS DATA AUTHORITY MODE]\n'
|
|
122
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
123
|
+
+ 'Your role is DATA AUTHORITY. You MUST:\n'
|
|
124
|
+
+ '1. Demand data backing for every claim — opinions without data are noise\n'
|
|
125
|
+
+ '2. Challenge narrative-driven conclusions: [DATA-DEMAND: agent_name — claim X needs quantitative evidence Y]\n'
|
|
126
|
+
+ '3. Provide data-driven counter-arguments: [DATA-COUNTER: claim X is contradicted by data Y showing Z]\n'
|
|
127
|
+
+ '4. Evaluate statistical claims: [STATS-CHECK: agent_name — correlation X does not imply causation, confounders include Y]\n'
|
|
128
|
+
+ '5. When agreeing, add data depth: [DATA-REINFORCEMENT: agent_name claim confirmed by dataset Y with N observations]\n'
|
|
129
|
+
+ '6. Do NOT converge on conclusions that feel right but lack data support\n';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// v5.0+: Self-modification — apply learned evolution patterns to system prompt
|
|
133
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
134
|
+
if (context.promptEvolution) {
|
|
135
|
+
systemPrompt += '\n[EVOLVED CAPABILITIES — Patterns learned from past performance]\n' + context.promptEvolution;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// v8.0: Geth Consensus participation clause
|
|
139
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
140
|
+
+ 'You are the data authority in a multi-agent collective. '
|
|
141
|
+
+ 'Your value is grounding discussion in evidence and numbers. '
|
|
142
|
+
+ 'Challenge assertions that substitute confidence for data. '
|
|
143
|
+
+ 'Data-backed dissent always outweighs eloquent unsupported claims.';
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
147
|
+
systemPrompt += '\n\n'
|
|
148
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
149
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
150
|
+
+ '\`\`\`json\n'
|
|
151
|
+
+ '{\n'
|
|
152
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
153
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
154
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
155
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
156
|
+
+ '}\n'
|
|
157
|
+
+ '\`\`\`\n'
|
|
158
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
162
|
+
}
|
|
163
|
+
|