@covibes/zeroshot 1.0.1
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/CHANGELOG.md +167 -0
- package/LICENSE +21 -0
- package/README.md +364 -0
- package/cli/index.js +3990 -0
- package/cluster-templates/base-templates/debug-workflow.json +181 -0
- package/cluster-templates/base-templates/full-workflow.json +455 -0
- package/cluster-templates/base-templates/single-worker.json +48 -0
- package/cluster-templates/base-templates/worker-validator.json +131 -0
- package/cluster-templates/conductor-bootstrap.json +122 -0
- package/cluster-templates/conductor-junior-bootstrap.json +69 -0
- package/docker/zeroshot-cluster/Dockerfile +132 -0
- package/lib/completion.js +174 -0
- package/lib/id-detector.js +53 -0
- package/lib/settings.js +97 -0
- package/lib/stream-json-parser.js +236 -0
- package/package.json +121 -0
- package/src/agent/agent-config.js +121 -0
- package/src/agent/agent-context-builder.js +241 -0
- package/src/agent/agent-hook-executor.js +329 -0
- package/src/agent/agent-lifecycle.js +555 -0
- package/src/agent/agent-stuck-detector.js +256 -0
- package/src/agent/agent-task-executor.js +1034 -0
- package/src/agent/agent-trigger-evaluator.js +67 -0
- package/src/agent-wrapper.js +459 -0
- package/src/agents/git-pusher-agent.json +20 -0
- package/src/attach/attach-client.js +438 -0
- package/src/attach/attach-server.js +543 -0
- package/src/attach/index.js +35 -0
- package/src/attach/protocol.js +220 -0
- package/src/attach/ring-buffer.js +121 -0
- package/src/attach/socket-discovery.js +242 -0
- package/src/claude-task-runner.js +468 -0
- package/src/config-router.js +80 -0
- package/src/config-validator.js +598 -0
- package/src/github.js +103 -0
- package/src/isolation-manager.js +1042 -0
- package/src/ledger.js +429 -0
- package/src/logic-engine.js +223 -0
- package/src/message-bus-bridge.js +139 -0
- package/src/message-bus.js +202 -0
- package/src/name-generator.js +232 -0
- package/src/orchestrator.js +1938 -0
- package/src/schemas/sub-cluster.js +156 -0
- package/src/sub-cluster-wrapper.js +545 -0
- package/src/task-runner.js +28 -0
- package/src/template-resolver.js +347 -0
- package/src/tui/CHANGES.txt +133 -0
- package/src/tui/LAYOUT.md +261 -0
- package/src/tui/README.txt +192 -0
- package/src/tui/TWO-LEVEL-NAVIGATION.md +186 -0
- package/src/tui/data-poller.js +325 -0
- package/src/tui/demo.js +208 -0
- package/src/tui/formatters.js +123 -0
- package/src/tui/index.js +193 -0
- package/src/tui/keybindings.js +383 -0
- package/src/tui/layout.js +317 -0
- package/src/tui/renderer.js +194 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MessageBusBridge - Bridges parent and child message buses
|
|
3
|
+
*
|
|
4
|
+
* Forwards specified topics between parent and child clusters while maintaining
|
|
5
|
+
* isolation and preventing message loops.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Forward specified parent topics to child (contextStrategy.parentTopics)
|
|
9
|
+
* - Forward child completion events to parent
|
|
10
|
+
* - Namespace child topics to avoid collisions
|
|
11
|
+
* - Prevent message loops via forwarding flags
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
class MessageBusBridge {
|
|
15
|
+
constructor(parentBus, childBus, config) {
|
|
16
|
+
this.parentBus = parentBus;
|
|
17
|
+
this.childBus = childBus;
|
|
18
|
+
this.config = config;
|
|
19
|
+
|
|
20
|
+
this.parentUnsubscribe = null;
|
|
21
|
+
this.childUnsubscribe = null;
|
|
22
|
+
this.active = false;
|
|
23
|
+
|
|
24
|
+
this._setupBridge();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Set up bidirectional message forwarding
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
_setupBridge() {
|
|
32
|
+
// Forward specified parent topics to child
|
|
33
|
+
if (this.config.parentTopics && this.config.parentTopics.length > 0) {
|
|
34
|
+
this.parentUnsubscribe = this.parentBus.subscribe((message) => {
|
|
35
|
+
this._forwardParentToChild(message);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Forward child completion/failure events to parent
|
|
40
|
+
this.childUnsubscribe = this.childBus.subscribe((message) => {
|
|
41
|
+
this._forwardChildToParent(message);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
this.active = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Forward parent message to child cluster
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
_forwardParentToChild(message) {
|
|
52
|
+
// Only forward messages from parent cluster
|
|
53
|
+
if (message.cluster_id !== this.config.parentClusterId) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Only forward topics specified in config
|
|
58
|
+
if (!this.config.parentTopics.includes(message.topic)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Skip already-forwarded messages (prevent loops)
|
|
63
|
+
if (message.metadata?.forwarded) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Forward to child with metadata flag
|
|
68
|
+
this.childBus.publish({
|
|
69
|
+
...message,
|
|
70
|
+
cluster_id: this.config.childClusterId,
|
|
71
|
+
metadata: {
|
|
72
|
+
...message.metadata,
|
|
73
|
+
forwarded: true,
|
|
74
|
+
forwardedFrom: this.config.parentClusterId,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Forward child message to parent cluster
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
_forwardChildToParent(message) {
|
|
84
|
+
// Only forward messages from child cluster
|
|
85
|
+
if (message.cluster_id !== this.config.childClusterId) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Only forward completion/failure events
|
|
90
|
+
const forwardTopics = ['CLUSTER_COMPLETE', 'CLUSTER_FAILED', 'AGENT_ERROR'];
|
|
91
|
+
if (!forwardTopics.includes(message.topic)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Skip already-forwarded messages (prevent loops)
|
|
96
|
+
if (message.metadata?.forwarded) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Forward to parent with namespaced topic and metadata flag
|
|
101
|
+
this.parentBus.publish({
|
|
102
|
+
...message,
|
|
103
|
+
cluster_id: this.config.parentClusterId,
|
|
104
|
+
topic: `CHILD_${message.topic}`,
|
|
105
|
+
metadata: {
|
|
106
|
+
...message.metadata,
|
|
107
|
+
forwarded: true,
|
|
108
|
+
forwardedFrom: this.config.childClusterId,
|
|
109
|
+
childClusterId: this.config.childClusterId,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Close the bridge and stop forwarding
|
|
116
|
+
*/
|
|
117
|
+
close() {
|
|
118
|
+
if (this.parentUnsubscribe) {
|
|
119
|
+
this.parentUnsubscribe();
|
|
120
|
+
this.parentUnsubscribe = null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (this.childUnsubscribe) {
|
|
124
|
+
this.childUnsubscribe();
|
|
125
|
+
this.childUnsubscribe = null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this.active = false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Check if bridge is active
|
|
133
|
+
*/
|
|
134
|
+
isActive() {
|
|
135
|
+
return this.active;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
module.exports = MessageBusBridge;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MessageBus - Pub/sub layer over Ledger with WebSocket support
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - High-level publish/subscribe API
|
|
6
|
+
* - WebSocket broadcasting for UI clients
|
|
7
|
+
* - Topic-based routing
|
|
8
|
+
* - Real-time event distribution
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const EventEmitter = require('events');
|
|
12
|
+
const Ledger = require('./ledger');
|
|
13
|
+
|
|
14
|
+
// Expected listeners per cluster:
|
|
15
|
+
// - 5 orchestrator subscriptions (CLUSTER_COMPLETE, CLUSTER_FAILED, AGENT_ERROR, AGENT_LIFECYCLE, CLUSTER_OPERATIONS)
|
|
16
|
+
// - 1 ledger internal
|
|
17
|
+
// - 1 per agent (can be 10+ with dynamic spawning)
|
|
18
|
+
// - topic-specific listeners
|
|
19
|
+
const MAX_LISTENERS = 50;
|
|
20
|
+
|
|
21
|
+
class MessageBus extends EventEmitter {
|
|
22
|
+
constructor(ledger) {
|
|
23
|
+
super();
|
|
24
|
+
this.setMaxListeners(MAX_LISTENERS);
|
|
25
|
+
this.ledger = ledger || new Ledger();
|
|
26
|
+
this.wsClients = new Set();
|
|
27
|
+
|
|
28
|
+
// Forward ledger events
|
|
29
|
+
this.ledger.on('message', (message) => {
|
|
30
|
+
this.emit('message', message);
|
|
31
|
+
this._broadcastToWebSocket(message);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Publish a message to the ledger
|
|
37
|
+
* @param {Object} message - Message to publish
|
|
38
|
+
* @returns {Object} Published message with ID
|
|
39
|
+
*/
|
|
40
|
+
publish(message) {
|
|
41
|
+
if (!message.cluster_id) {
|
|
42
|
+
throw new Error('cluster_id is required');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!message.topic) {
|
|
46
|
+
throw new Error('topic is required');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!message.sender) {
|
|
50
|
+
throw new Error('sender is required');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const published = this.ledger.append(message);
|
|
54
|
+
|
|
55
|
+
// Emit to topic-specific listeners
|
|
56
|
+
this.emit(`topic:${message.topic}`, published);
|
|
57
|
+
|
|
58
|
+
return published;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to all messages
|
|
63
|
+
* @param {Function} callback - Called with each message
|
|
64
|
+
* @returns {Function} Unsubscribe function
|
|
65
|
+
*/
|
|
66
|
+
subscribe(callback) {
|
|
67
|
+
this.on('message', callback);
|
|
68
|
+
return () => this.off('message', callback);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Subscribe to specific topic
|
|
73
|
+
* @param {String} topic - Topic to subscribe to
|
|
74
|
+
* @param {Function} callback - Called with matching messages
|
|
75
|
+
* @returns {Function} Unsubscribe function
|
|
76
|
+
*/
|
|
77
|
+
subscribeTopic(topic, callback) {
|
|
78
|
+
const event = `topic:${topic}`;
|
|
79
|
+
this.on(event, callback);
|
|
80
|
+
return () => this.off(event, callback);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Subscribe to multiple topics
|
|
85
|
+
* @param {Array<String>} topics - Topics to subscribe to
|
|
86
|
+
* @param {Function} callback - Called with matching messages
|
|
87
|
+
* @returns {Function} Unsubscribe function
|
|
88
|
+
*/
|
|
89
|
+
subscribeTopics(topics, callback) {
|
|
90
|
+
const unsubscribers = topics.map((topic) => this.subscribeTopic(topic, callback));
|
|
91
|
+
return () => unsubscribers.forEach((unsub) => unsub());
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Query messages (passthrough to ledger)
|
|
96
|
+
*/
|
|
97
|
+
query(criteria) {
|
|
98
|
+
return this.ledger.query(criteria);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Find last message (passthrough to ledger)
|
|
103
|
+
*/
|
|
104
|
+
findLast(criteria) {
|
|
105
|
+
return this.ledger.findLast(criteria);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Count messages (passthrough to ledger)
|
|
110
|
+
*/
|
|
111
|
+
count(criteria) {
|
|
112
|
+
return this.ledger.count(criteria);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Get messages since timestamp (passthrough to ledger)
|
|
117
|
+
*/
|
|
118
|
+
since(params) {
|
|
119
|
+
return this.ledger.since(params);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get all messages (passthrough to ledger)
|
|
124
|
+
*/
|
|
125
|
+
getAll(cluster_id) {
|
|
126
|
+
return this.ledger.getAll(cluster_id);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Register a WebSocket client for broadcasts
|
|
131
|
+
* @param {WebSocket} ws - WebSocket connection
|
|
132
|
+
*/
|
|
133
|
+
addWebSocketClient(ws) {
|
|
134
|
+
this.wsClients.add(ws);
|
|
135
|
+
|
|
136
|
+
ws.on('close', () => {
|
|
137
|
+
this.wsClients.delete(ws);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
ws.on('error', () => {
|
|
141
|
+
this.wsClients.delete(ws);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Remove a WebSocket client
|
|
147
|
+
* @param {WebSocket} ws - WebSocket connection
|
|
148
|
+
*/
|
|
149
|
+
removeWebSocketClient(ws) {
|
|
150
|
+
this.wsClients.delete(ws);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Broadcast message to all WebSocket clients
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
_broadcastToWebSocket(message) {
|
|
158
|
+
const payload = JSON.stringify({
|
|
159
|
+
type: 'message',
|
|
160
|
+
data: message,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
for (const ws of this.wsClients) {
|
|
164
|
+
if (ws.readyState === 1) {
|
|
165
|
+
// OPEN
|
|
166
|
+
try {
|
|
167
|
+
ws.send(payload);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error('WebSocket send error:', error);
|
|
170
|
+
this.wsClients.delete(ws);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Close the message bus
|
|
178
|
+
*/
|
|
179
|
+
close() {
|
|
180
|
+
// Close all WebSocket connections
|
|
181
|
+
for (const ws of this.wsClients) {
|
|
182
|
+
try {
|
|
183
|
+
ws.close();
|
|
184
|
+
} catch {
|
|
185
|
+
// Ignore errors on close
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
this.wsClients.clear();
|
|
189
|
+
|
|
190
|
+
// Close ledger
|
|
191
|
+
this.ledger.close();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Clear all messages (for testing)
|
|
196
|
+
*/
|
|
197
|
+
clear() {
|
|
198
|
+
this.ledger.clear();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
module.exports = MessageBus;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable name generator (like Weights & Biases)
|
|
3
|
+
* Generates names like "wandering-forest-42" or "bright-star-17"
|
|
4
|
+
*
|
|
5
|
+
* No prefix - short forms used everywhere for simplicity
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const ADJECTIVES = [
|
|
9
|
+
// Colors
|
|
10
|
+
'amber',
|
|
11
|
+
'azure',
|
|
12
|
+
'crimson',
|
|
13
|
+
'emerald',
|
|
14
|
+
'golden',
|
|
15
|
+
'indigo',
|
|
16
|
+
'jade',
|
|
17
|
+
'ruby',
|
|
18
|
+
'sapphire',
|
|
19
|
+
'silver',
|
|
20
|
+
'violet',
|
|
21
|
+
'bronze',
|
|
22
|
+
'coral',
|
|
23
|
+
'ivory',
|
|
24
|
+
'pearl',
|
|
25
|
+
'platinum',
|
|
26
|
+
'scarlet',
|
|
27
|
+
'cobalt',
|
|
28
|
+
'copper',
|
|
29
|
+
'obsidian',
|
|
30
|
+
'onyx',
|
|
31
|
+
'opal',
|
|
32
|
+
'topaz',
|
|
33
|
+
'turquoise',
|
|
34
|
+
// Nature
|
|
35
|
+
'wandering',
|
|
36
|
+
'bright',
|
|
37
|
+
'silent',
|
|
38
|
+
'ancient',
|
|
39
|
+
'swift',
|
|
40
|
+
'noble',
|
|
41
|
+
'bold',
|
|
42
|
+
'wild',
|
|
43
|
+
'gentle',
|
|
44
|
+
'hidden',
|
|
45
|
+
'fierce',
|
|
46
|
+
'calm',
|
|
47
|
+
'frozen',
|
|
48
|
+
'misty',
|
|
49
|
+
'stormy',
|
|
50
|
+
'sunny',
|
|
51
|
+
// Cosmic
|
|
52
|
+
'cosmic',
|
|
53
|
+
'crystal',
|
|
54
|
+
'electric',
|
|
55
|
+
'lunar',
|
|
56
|
+
'solar',
|
|
57
|
+
'stellar',
|
|
58
|
+
'astral',
|
|
59
|
+
'orbital',
|
|
60
|
+
'mystic',
|
|
61
|
+
'quantum',
|
|
62
|
+
'radiant',
|
|
63
|
+
'twilight',
|
|
64
|
+
'vivid',
|
|
65
|
+
'zen',
|
|
66
|
+
'infinite',
|
|
67
|
+
'eternal',
|
|
68
|
+
// Tech/Abstract
|
|
69
|
+
'clever',
|
|
70
|
+
'rapid',
|
|
71
|
+
'steady',
|
|
72
|
+
'agile',
|
|
73
|
+
'nimble',
|
|
74
|
+
'keen',
|
|
75
|
+
'sharp',
|
|
76
|
+
'quick',
|
|
77
|
+
'prime',
|
|
78
|
+
'binary',
|
|
79
|
+
'neural',
|
|
80
|
+
'atomic',
|
|
81
|
+
'sonic',
|
|
82
|
+
'hyper',
|
|
83
|
+
'mega',
|
|
84
|
+
'ultra',
|
|
85
|
+
// Descriptive
|
|
86
|
+
'blazing',
|
|
87
|
+
'gleaming',
|
|
88
|
+
'glowing',
|
|
89
|
+
'shining',
|
|
90
|
+
'burning',
|
|
91
|
+
'flaming',
|
|
92
|
+
'sparkling',
|
|
93
|
+
'dazzling',
|
|
94
|
+
'roaring',
|
|
95
|
+
'rushing',
|
|
96
|
+
'soaring',
|
|
97
|
+
'flying',
|
|
98
|
+
'rising',
|
|
99
|
+
'falling',
|
|
100
|
+
'spinning',
|
|
101
|
+
'dancing',
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
const NOUNS = [
|
|
105
|
+
// Nature
|
|
106
|
+
'forest',
|
|
107
|
+
'river',
|
|
108
|
+
'mountain',
|
|
109
|
+
'ocean',
|
|
110
|
+
'thunder',
|
|
111
|
+
'canyon',
|
|
112
|
+
'summit',
|
|
113
|
+
'valley',
|
|
114
|
+
'cascade',
|
|
115
|
+
'glacier',
|
|
116
|
+
'volcano',
|
|
117
|
+
'desert',
|
|
118
|
+
'meadow',
|
|
119
|
+
'tundra',
|
|
120
|
+
'jungle',
|
|
121
|
+
'reef',
|
|
122
|
+
// Space
|
|
123
|
+
'star',
|
|
124
|
+
'comet',
|
|
125
|
+
'nebula',
|
|
126
|
+
'galaxy',
|
|
127
|
+
'pulsar',
|
|
128
|
+
'quasar',
|
|
129
|
+
'aurora',
|
|
130
|
+
'eclipse',
|
|
131
|
+
'meteor',
|
|
132
|
+
'nova',
|
|
133
|
+
'cosmos',
|
|
134
|
+
'orbit',
|
|
135
|
+
'void',
|
|
136
|
+
'horizon',
|
|
137
|
+
'zenith',
|
|
138
|
+
'equinox',
|
|
139
|
+
// Mythical
|
|
140
|
+
'phoenix',
|
|
141
|
+
'dragon',
|
|
142
|
+
'griffin',
|
|
143
|
+
'sphinx',
|
|
144
|
+
'hydra',
|
|
145
|
+
'kraken',
|
|
146
|
+
'titan',
|
|
147
|
+
'atlas',
|
|
148
|
+
'oracle',
|
|
149
|
+
'rune',
|
|
150
|
+
'sigil',
|
|
151
|
+
'glyph',
|
|
152
|
+
'totem',
|
|
153
|
+
'aegis',
|
|
154
|
+
'aether',
|
|
155
|
+
'flux',
|
|
156
|
+
// Animals
|
|
157
|
+
'falcon',
|
|
158
|
+
'eagle',
|
|
159
|
+
'wolf',
|
|
160
|
+
'bear',
|
|
161
|
+
'tiger',
|
|
162
|
+
'hawk',
|
|
163
|
+
'lion',
|
|
164
|
+
'panther',
|
|
165
|
+
'raven',
|
|
166
|
+
'serpent',
|
|
167
|
+
'shark',
|
|
168
|
+
'owl',
|
|
169
|
+
'fox',
|
|
170
|
+
'lynx',
|
|
171
|
+
'viper',
|
|
172
|
+
'condor',
|
|
173
|
+
// Architecture
|
|
174
|
+
'citadel',
|
|
175
|
+
'temple',
|
|
176
|
+
'spire',
|
|
177
|
+
'tower',
|
|
178
|
+
'fortress',
|
|
179
|
+
'bastion',
|
|
180
|
+
'vault',
|
|
181
|
+
'sanctum',
|
|
182
|
+
'beacon',
|
|
183
|
+
'arch',
|
|
184
|
+
'bridge',
|
|
185
|
+
'gate',
|
|
186
|
+
'hall',
|
|
187
|
+
'keep',
|
|
188
|
+
'dome',
|
|
189
|
+
'obelisk',
|
|
190
|
+
// Abstract
|
|
191
|
+
'cipher',
|
|
192
|
+
'echo',
|
|
193
|
+
'nexus',
|
|
194
|
+
'prism',
|
|
195
|
+
'relic',
|
|
196
|
+
'vertex',
|
|
197
|
+
'vortex',
|
|
198
|
+
'pulse',
|
|
199
|
+
'surge',
|
|
200
|
+
'spark',
|
|
201
|
+
'flame',
|
|
202
|
+
'storm',
|
|
203
|
+
'wave',
|
|
204
|
+
'drift',
|
|
205
|
+
'shift',
|
|
206
|
+
'core',
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
// 96 adjectives × 96 nouns × 100 numbers = 921,600 combinations
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Generate a human-readable name
|
|
213
|
+
* @param {string} _prefix - DEPRECATED: Ignored for backwards compat, short form always used
|
|
214
|
+
* @returns {string} Human-readable name (e.g., 'wandering-forest-42')
|
|
215
|
+
*/
|
|
216
|
+
function generateName(_prefix = '') {
|
|
217
|
+
const adjective = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)];
|
|
218
|
+
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)];
|
|
219
|
+
const number = Math.floor(Math.random() * 100);
|
|
220
|
+
|
|
221
|
+
return `${adjective}-${noun}-${number}`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Generate a short unique suffix (for collision prevention)
|
|
226
|
+
* @returns {string} Short random suffix (e.g., 'a3f9')
|
|
227
|
+
*/
|
|
228
|
+
function generateSuffix() {
|
|
229
|
+
return Math.random().toString(36).slice(2, 6);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
module.exports = { generateName, generateSuffix };
|