@ekkos/cli 1.3.2 → 1.3.5
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/dist/capture/jsonl-rewriter.d.ts +1 -1
- package/dist/capture/jsonl-rewriter.js +3 -3
- package/dist/capture/transcript-repair.d.ts +2 -2
- package/dist/capture/transcript-repair.js +2 -2
- package/dist/commands/claw.d.ts +13 -0
- package/dist/commands/claw.js +253 -0
- package/dist/commands/dashboard.js +617 -83
- package/dist/commands/doctor.d.ts +3 -3
- package/dist/commands/doctor.js +6 -79
- package/dist/commands/gemini.d.ts +19 -0
- package/dist/commands/gemini.js +193 -0
- package/dist/commands/init.js +2 -25
- package/dist/commands/run.d.ts +0 -1
- package/dist/commands/run.js +147 -241
- package/dist/commands/scan.d.ts +21 -0
- package/dist/commands/scan.js +386 -0
- package/dist/commands/swarm-dashboard.js +156 -28
- package/dist/commands/swarm.d.ts +1 -1
- package/dist/commands/swarm.js +1 -1
- package/dist/commands/test-claude.d.ts +2 -2
- package/dist/commands/test-claude.js +3 -3
- package/dist/deploy/index.d.ts +0 -2
- package/dist/deploy/index.js +0 -2
- package/dist/deploy/settings.d.ts +2 -2
- package/dist/deploy/settings.js +42 -4
- package/dist/deploy/skills.js +1 -2
- package/dist/index.js +79 -19
- package/dist/lib/usage-parser.js +4 -3
- package/dist/utils/proxy-url.d.ts +12 -1
- package/dist/utils/proxy-url.js +16 -1
- package/dist/utils/templates.js +1 -1
- package/package.json +4 -6
- package/templates/CLAUDE.md +49 -107
- package/dist/agent/daemon.d.ts +0 -130
- package/dist/agent/daemon.js +0 -606
- package/dist/agent/health-check.d.ts +0 -35
- package/dist/agent/health-check.js +0 -243
- package/dist/agent/pty-runner.d.ts +0 -53
- package/dist/agent/pty-runner.js +0 -190
- package/dist/commands/agent.d.ts +0 -50
- package/dist/commands/agent.js +0 -544
- package/dist/commands/setup-remote.d.ts +0 -20
- package/dist/commands/setup-remote.js +0 -582
- package/dist/commands/synk.d.ts +0 -7
- package/dist/commands/synk.js +0 -339
- package/dist/synk/api.d.ts +0 -22
- package/dist/synk/api.js +0 -133
- package/dist/synk/auth.d.ts +0 -7
- package/dist/synk/auth.js +0 -30
- package/dist/synk/config.d.ts +0 -18
- package/dist/synk/config.js +0 -37
- package/dist/synk/daemon/control-client.d.ts +0 -11
- package/dist/synk/daemon/control-client.js +0 -101
- package/dist/synk/daemon/control-server.d.ts +0 -24
- package/dist/synk/daemon/control-server.js +0 -91
- package/dist/synk/daemon/run.d.ts +0 -14
- package/dist/synk/daemon/run.js +0 -338
- package/dist/synk/encryption.d.ts +0 -17
- package/dist/synk/encryption.js +0 -133
- package/dist/synk/index.d.ts +0 -13
- package/dist/synk/index.js +0 -36
- package/dist/synk/machine-client.d.ts +0 -42
- package/dist/synk/machine-client.js +0 -218
- package/dist/synk/persistence.d.ts +0 -51
- package/dist/synk/persistence.js +0 -211
- package/dist/synk/qr.d.ts +0 -5
- package/dist/synk/qr.js +0 -33
- package/dist/synk/session-bridge.d.ts +0 -58
- package/dist/synk/session-bridge.js +0 -171
- package/dist/synk/session-client.d.ts +0 -46
- package/dist/synk/session-client.js +0 -240
- package/dist/synk/types.d.ts +0 -574
- package/dist/synk/types.js +0 -74
- package/dist/utils/verify-remote-terminal.d.ts +0 -10
- package/dist/utils/verify-remote-terminal.js +0 -415
- package/templates/README.md +0 -378
- package/templates/claude-plugins/PHASE2_COMPLETION.md +0 -346
- package/templates/claude-plugins/PLUGIN_PROPOSALS.md +0 -1776
- package/templates/claude-plugins/README.md +0 -587
- package/templates/claude-plugins/agents/code-reviewer.json +0 -14
- package/templates/claude-plugins/agents/debug-detective.json +0 -15
- package/templates/claude-plugins/agents/git-companion.json +0 -14
- package/templates/claude-plugins/blog-manager/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/blog-manager/commands/blog.md +0 -691
- package/templates/claude-plugins/golden-loop-monitor/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/golden-loop-monitor/commands/loop-status.md +0 -434
- package/templates/claude-plugins/learning-tracker/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/learning-tracker/commands/my-patterns.md +0 -282
- package/templates/claude-plugins/memory-lens/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/memory-lens/commands/memory-search.md +0 -181
- package/templates/claude-plugins/pattern-coach/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/pattern-coach/commands/forge.md +0 -365
- package/templates/claude-plugins/project-schema-validator/.claude-plugin/plugin.json +0 -8
- package/templates/claude-plugins/project-schema-validator/commands/validate-schema.md +0 -582
- package/templates/commands/continue.md +0 -47
- package/templates/cursor-rules/ekkos-memory.md +0 -127
- package/templates/ekkos-manifest.json +0 -223
- package/templates/helpers/json-parse.cjs +0 -101
- package/templates/plan-template.md +0 -306
- package/templates/shared/hooks-enabled.json +0 -22
- package/templates/shared/session-words.json +0 -45
- package/templates/skills/ekkOS_Deep_Recall/Skill.md +0 -282
- package/templates/skills/ekkOS_Learn/Skill.md +0 -265
- package/templates/skills/ekkOS_Memory_First/Skill.md +0 -206
- package/templates/skills/ekkOS_Plan_Assist/Skill.md +0 -302
- package/templates/skills/ekkOS_Preferences/Skill.md +0 -247
- package/templates/skills/ekkOS_Reflect/Skill.md +0 -257
- package/templates/skills/ekkOS_Safety/Skill.md +0 -265
- package/templates/skills/ekkOS_Schema/Skill.md +0 -251
- package/templates/skills/ekkOS_Summary/Skill.md +0 -257
- package/templates/spec-template.md +0 -159
- package/templates/windsurf-rules/ekkos-memory.md +0 -127
- package/templates/windsurf-skills/README.md +0 -58
- package/templates/windsurf-skills/ekkos-continue/SKILL.md +0 -81
- package/templates/windsurf-skills/ekkos-golden-loop/SKILL.md +0 -225
- package/templates/windsurf-skills/ekkos-insights/SKILL.md +0 -138
- package/templates/windsurf-skills/ekkos-recall/SKILL.md +0 -96
- package/templates/windsurf-skills/ekkos-safety/SKILL.md +0 -89
- package/templates/windsurf-skills/ekkos-vault/SKILL.md +0 -86
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Real-time session client for ekkOS_synk
|
|
4
|
-
* Manages Socket.IO connection and message sync with synk-server
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SessionClient = void 0;
|
|
11
|
-
const node_events_1 = require("node:events");
|
|
12
|
-
const socket_io_client_1 = require("socket.io-client");
|
|
13
|
-
const node_crypto_1 = require("node:crypto");
|
|
14
|
-
const axios_1 = __importDefault(require("axios"));
|
|
15
|
-
const types_1 = require("./types");
|
|
16
|
-
const encryption_1 = require("./encryption");
|
|
17
|
-
const config_1 = require("./config");
|
|
18
|
-
class SessionClient extends node_events_1.EventEmitter {
|
|
19
|
-
constructor(token, session) {
|
|
20
|
-
super();
|
|
21
|
-
this.pendingMessages = [];
|
|
22
|
-
this.pendingMessageCallback = null;
|
|
23
|
-
this.lastSeq = 0;
|
|
24
|
-
this.pendingOutbox = [];
|
|
25
|
-
this.flushTimer = null;
|
|
26
|
-
this.token = token;
|
|
27
|
-
this.sessionId = session.id;
|
|
28
|
-
this.metadata = session.metadata;
|
|
29
|
-
this.metadataVersion = session.metadataVersion;
|
|
30
|
-
this.agentState = session.agentState;
|
|
31
|
-
this.agentStateVersion = session.agentStateVersion;
|
|
32
|
-
this.encryptionKey = session.encryptionKey;
|
|
33
|
-
this.encryptionVariant = session.encryptionVariant;
|
|
34
|
-
this.socket = (0, socket_io_client_1.io)(config_1.synkConfig.serverUrl, {
|
|
35
|
-
auth: {
|
|
36
|
-
token: this.token,
|
|
37
|
-
clientType: 'session-scoped',
|
|
38
|
-
sessionId: this.sessionId,
|
|
39
|
-
},
|
|
40
|
-
path: '/v1/updates',
|
|
41
|
-
reconnection: true,
|
|
42
|
-
reconnectionAttempts: Infinity,
|
|
43
|
-
reconnectionDelay: 1000,
|
|
44
|
-
reconnectionDelayMax: 5000,
|
|
45
|
-
transports: ['websocket'],
|
|
46
|
-
withCredentials: true,
|
|
47
|
-
autoConnect: false,
|
|
48
|
-
});
|
|
49
|
-
this.socket.on('connect', () => {
|
|
50
|
-
this.emit('connected');
|
|
51
|
-
this.fetchMessages().catch(() => { });
|
|
52
|
-
});
|
|
53
|
-
this.socket.on('disconnect', (reason) => {
|
|
54
|
-
this.emit('disconnected', reason);
|
|
55
|
-
});
|
|
56
|
-
this.socket.on('connect_error', (error) => {
|
|
57
|
-
this.emit('error', error);
|
|
58
|
-
});
|
|
59
|
-
this.socket.on('update', (data) => {
|
|
60
|
-
try {
|
|
61
|
-
if (!data.body)
|
|
62
|
-
return;
|
|
63
|
-
if (data.body.t === 'new-message') {
|
|
64
|
-
const messageSeq = data.body.message?.seq;
|
|
65
|
-
if (this.lastSeq === 0 || typeof messageSeq !== 'number' || messageSeq !== this.lastSeq + 1 || data.body.message.content.t !== 'encrypted') {
|
|
66
|
-
this.fetchMessages().catch(() => { });
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const body = (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(data.body.message.content.c));
|
|
70
|
-
this.routeIncomingMessage(body);
|
|
71
|
-
this.lastSeq = messageSeq;
|
|
72
|
-
}
|
|
73
|
-
else if (data.body.t === 'update-session') {
|
|
74
|
-
if (data.body.metadata && data.body.metadata.version > this.metadataVersion) {
|
|
75
|
-
this.metadata = (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(data.body.metadata.value));
|
|
76
|
-
this.metadataVersion = data.body.metadata.version;
|
|
77
|
-
}
|
|
78
|
-
if (data.body.agentState && data.body.agentState.version > this.agentStateVersion) {
|
|
79
|
-
this.agentState = data.body.agentState.value
|
|
80
|
-
? (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(data.body.agentState.value))
|
|
81
|
-
: null;
|
|
82
|
-
this.agentStateVersion = data.body.agentState.version;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.emit('message', data.body);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
this.emit('error', error);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
this.socket.on('rpc-request', async (data, callback) => {
|
|
94
|
-
this.emit('rpc-request', data, callback);
|
|
95
|
-
});
|
|
96
|
-
this.socket.connect();
|
|
97
|
-
}
|
|
98
|
-
onUserMessage(callback) {
|
|
99
|
-
this.pendingMessageCallback = callback;
|
|
100
|
-
while (this.pendingMessages.length > 0) {
|
|
101
|
-
callback(this.pendingMessages.shift());
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
routeIncomingMessage(message) {
|
|
105
|
-
const userResult = types_1.UserMessageSchema.safeParse(message);
|
|
106
|
-
if (userResult.success) {
|
|
107
|
-
if (this.pendingMessageCallback) {
|
|
108
|
-
this.pendingMessageCallback(userResult.data);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.pendingMessages.push(userResult.data);
|
|
112
|
-
}
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
this.emit('message', message);
|
|
116
|
-
}
|
|
117
|
-
async fetchMessages() {
|
|
118
|
-
let afterSeq = this.lastSeq;
|
|
119
|
-
while (true) {
|
|
120
|
-
const response = await axios_1.default.get(`${config_1.synkConfig.serverUrl}/v3/sessions/${encodeURIComponent(this.sessionId)}/messages`, {
|
|
121
|
-
params: { after_seq: afterSeq, limit: 100 },
|
|
122
|
-
headers: { 'Authorization': `Bearer ${this.token}`, 'Content-Type': 'application/json' },
|
|
123
|
-
timeout: 60000,
|
|
124
|
-
});
|
|
125
|
-
const messages = Array.isArray(response.data.messages) ? response.data.messages : [];
|
|
126
|
-
let maxSeq = afterSeq;
|
|
127
|
-
for (const message of messages) {
|
|
128
|
-
if (message.seq > maxSeq)
|
|
129
|
-
maxSeq = message.seq;
|
|
130
|
-
if (message.content?.t !== 'encrypted')
|
|
131
|
-
continue;
|
|
132
|
-
try {
|
|
133
|
-
const body = (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(message.content.c));
|
|
134
|
-
this.routeIncomingMessage(body);
|
|
135
|
-
}
|
|
136
|
-
catch { }
|
|
137
|
-
}
|
|
138
|
-
this.lastSeq = Math.max(this.lastSeq, maxSeq);
|
|
139
|
-
if (!response.data.hasMore || maxSeq === afterSeq)
|
|
140
|
-
break;
|
|
141
|
-
afterSeq = maxSeq;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
scheduleFlush() {
|
|
145
|
-
if (this.flushTimer)
|
|
146
|
-
return;
|
|
147
|
-
this.flushTimer = setTimeout(async () => {
|
|
148
|
-
this.flushTimer = null;
|
|
149
|
-
await this.flushOutbox().catch(() => { });
|
|
150
|
-
}, 50);
|
|
151
|
-
}
|
|
152
|
-
async flushOutbox() {
|
|
153
|
-
if (this.pendingOutbox.length === 0)
|
|
154
|
-
return;
|
|
155
|
-
const batch = this.pendingOutbox.slice();
|
|
156
|
-
try {
|
|
157
|
-
const response = await axios_1.default.post(`${config_1.synkConfig.serverUrl}/v3/sessions/${encodeURIComponent(this.sessionId)}/messages`, { messages: batch }, {
|
|
158
|
-
headers: { 'Authorization': `Bearer ${this.token}`, 'Content-Type': 'application/json' },
|
|
159
|
-
timeout: 60000,
|
|
160
|
-
});
|
|
161
|
-
this.pendingOutbox.splice(0, batch.length);
|
|
162
|
-
const messages = Array.isArray(response.data.messages) ? response.data.messages : [];
|
|
163
|
-
const maxSeq = messages.reduce((acc, m) => (m.seq > acc ? m.seq : acc), this.lastSeq);
|
|
164
|
-
this.lastSeq = maxSeq;
|
|
165
|
-
}
|
|
166
|
-
catch { }
|
|
167
|
-
}
|
|
168
|
-
/** Send encrypted message to session */
|
|
169
|
-
sendMessage(content) {
|
|
170
|
-
const encrypted = (0, encryption_1.encodeBase64)((0, encryption_1.encrypt)(this.encryptionKey, this.encryptionVariant, content));
|
|
171
|
-
this.pendingOutbox.push({ content: encrypted, localId: (0, node_crypto_1.randomUUID)() });
|
|
172
|
-
this.scheduleFlush();
|
|
173
|
-
}
|
|
174
|
-
/** Send agent output message */
|
|
175
|
-
sendAgentMessage(data) {
|
|
176
|
-
this.sendMessage({
|
|
177
|
-
role: 'agent',
|
|
178
|
-
content: { type: 'output', data },
|
|
179
|
-
meta: { sentFrom: 'cli' },
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/** Send session event */
|
|
183
|
-
sendSessionEvent(event) {
|
|
184
|
-
this.sendMessage({
|
|
185
|
-
role: 'agent',
|
|
186
|
-
content: { id: (0, node_crypto_1.randomUUID)(), type: 'event', data: event },
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/** Send keepalive ping */
|
|
190
|
-
keepAlive(thinking, mode) {
|
|
191
|
-
this.socket.volatile.emit('session-alive', {
|
|
192
|
-
sid: this.sessionId,
|
|
193
|
-
time: Date.now(),
|
|
194
|
-
thinking,
|
|
195
|
-
mode,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
/** Notify server of session end */
|
|
199
|
-
sendSessionDeath() {
|
|
200
|
-
this.socket.emit('session-end', { sid: this.sessionId, time: Date.now() });
|
|
201
|
-
}
|
|
202
|
-
/** Update session metadata on server */
|
|
203
|
-
updateMetadata(handler) {
|
|
204
|
-
if (!this.metadata)
|
|
205
|
-
return;
|
|
206
|
-
const updated = handler(this.metadata);
|
|
207
|
-
this.socket.emit('update-metadata', {
|
|
208
|
-
sid: this.sessionId,
|
|
209
|
-
expectedVersion: this.metadataVersion,
|
|
210
|
-
metadata: (0, encryption_1.encodeBase64)((0, encryption_1.encrypt)(this.encryptionKey, this.encryptionVariant, updated)),
|
|
211
|
-
}, (answer) => {
|
|
212
|
-
if (answer.result === 'success') {
|
|
213
|
-
this.metadata = (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(answer.metadata));
|
|
214
|
-
this.metadataVersion = answer.version;
|
|
215
|
-
}
|
|
216
|
-
else if (answer.result === 'version-mismatch' && answer.version > this.metadataVersion) {
|
|
217
|
-
this.metadataVersion = answer.version;
|
|
218
|
-
this.metadata = (0, encryption_1.decrypt)(this.encryptionKey, this.encryptionVariant, (0, encryption_1.decodeBase64)(answer.metadata));
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
/** Wait for pending messages to flush */
|
|
223
|
-
async flush() {
|
|
224
|
-
await this.flushOutbox();
|
|
225
|
-
if (!this.socket.connected)
|
|
226
|
-
return;
|
|
227
|
-
return new Promise((resolve) => {
|
|
228
|
-
this.socket.emit('ping', () => resolve());
|
|
229
|
-
setTimeout(() => resolve(), 10000);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
async close() {
|
|
233
|
-
if (this.flushTimer) {
|
|
234
|
-
clearTimeout(this.flushTimer);
|
|
235
|
-
this.flushTimer = null;
|
|
236
|
-
}
|
|
237
|
-
this.socket.close();
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
exports.SessionClient = SessionClient;
|