cueme 0.1.10 → 0.1.12
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/package.json +1 -1
- package/src/cli.js +26 -29
- package/src/db.js +1 -1
- package/src/handler.js +30 -2
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -103,6 +103,7 @@ async function main() {
|
|
|
103
103
|
' cueme proto ls',
|
|
104
104
|
' cueme proto path <agent>',
|
|
105
105
|
' cueme fix <issue>',
|
|
106
|
+
' cueme migrate',
|
|
106
107
|
' cueme join <agent_runtime>',
|
|
107
108
|
' cueme cue <agent_id> -',
|
|
108
109
|
' cueme pause <agent_id> [prompt|-]',
|
|
@@ -159,6 +160,7 @@ async function main() {
|
|
|
159
160
|
const { execSync } = require('child_process');
|
|
160
161
|
const os = require('os');
|
|
161
162
|
const path = require('path');
|
|
163
|
+
const fs = require('fs');
|
|
162
164
|
|
|
163
165
|
try {
|
|
164
166
|
// Get PowerShell profile path
|
|
@@ -176,36 +178,31 @@ async function main() {
|
|
|
176
178
|
'$OutputEncoding = $utf8NoBom',
|
|
177
179
|
].join('\n');
|
|
178
180
|
|
|
179
|
-
//
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
'
|
|
190
|
-
''
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
''
|
|
196
|
-
|
|
197
|
-
'if ($content -notlike "*utf8NoBom*") {',
|
|
198
|
-
' Add-Content -Path $profilePath -Value "`n$encodingConfig"',
|
|
199
|
-
' Write-Host "Added UTF-8 encoding to PowerShell profile"',
|
|
200
|
-
' Write-Host "Please restart PowerShell for changes to take effect"',
|
|
201
|
-
'} else {',
|
|
202
|
-
' Write-Host "UTF-8 encoding already configured"',
|
|
203
|
-
'}',
|
|
204
|
-
].join('; ');
|
|
181
|
+
// Ensure profile directory exists
|
|
182
|
+
const profileDir = path.dirname(profilePath);
|
|
183
|
+
if (!fs.existsSync(profileDir)) {
|
|
184
|
+
fs.mkdirSync(profileDir, { recursive: true });
|
|
185
|
+
process.stdout.write('Created PowerShell profile directory\n');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Check if profile exists and if encoding is already configured
|
|
189
|
+
let needsUpdate = true;
|
|
190
|
+
if (fs.existsSync(profilePath)) {
|
|
191
|
+
const content = fs.readFileSync(profilePath, 'utf8');
|
|
192
|
+
if (content.includes('utf8NoBom')) {
|
|
193
|
+
process.stdout.write('UTF-8 encoding already configured\n');
|
|
194
|
+
needsUpdate = false;
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
process.stdout.write('Created PowerShell profile\n');
|
|
198
|
+
}
|
|
205
199
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
200
|
+
// Add encoding configuration if needed
|
|
201
|
+
if (needsUpdate) {
|
|
202
|
+
fs.appendFileSync(profilePath, '\n' + encodingConfig + '\n');
|
|
203
|
+
process.stdout.write('Added UTF-8 encoding to PowerShell profile\n');
|
|
204
|
+
process.stdout.write('Please restart PowerShell for changes to take effect\n');
|
|
205
|
+
}
|
|
209
206
|
|
|
210
207
|
} catch (err) {
|
|
211
208
|
process.stderr.write(`Failed to fix PowerShell encoding: ${err.message}\n`);
|
package/src/db.js
CHANGED
|
@@ -112,7 +112,7 @@ async function initSchema(db) {
|
|
|
112
112
|
const reqCount = reqCountRow ? Number(reqCountRow.n) : 0;
|
|
113
113
|
const respCount = respCountRow ? Number(respCountRow.n) : 0;
|
|
114
114
|
if (reqCount === 0 && respCount === 0) {
|
|
115
|
-
await run(db, 'INSERT INTO schema_meta (key, value) VALUES (?, ?)', ['schema_version', '
|
|
115
|
+
await run(db, 'INSERT INTO schema_meta (key, value) VALUES (?, ?)', ['schema_version', '3']);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
package/src/handler.js
CHANGED
|
@@ -336,13 +336,41 @@ async function handlePause(db, { agent_id, prompt }) {
|
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
async function handleMigrate(db) {
|
|
340
|
+
await initSchema(db);
|
|
341
|
+
|
|
342
|
+
await run(
|
|
343
|
+
db,
|
|
344
|
+
[
|
|
345
|
+
'CREATE TABLE IF NOT EXISTS conversation_pins (',
|
|
346
|
+
' conv_type TEXT NOT NULL,',
|
|
347
|
+
' conv_id TEXT NOT NULL,',
|
|
348
|
+
' view TEXT NOT NULL,',
|
|
349
|
+
' pin_order INTEGER PRIMARY KEY AUTOINCREMENT,',
|
|
350
|
+
' pinned_at DATETIME DEFAULT CURRENT_TIMESTAMP,',
|
|
351
|
+
' UNIQUE(conv_type, conv_id, view)',
|
|
352
|
+
')',
|
|
353
|
+
].join('\n')
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
await run(db, 'UPDATE schema_meta SET value = ? WHERE key = ?', ['3', 'schema_version']);
|
|
357
|
+
await run(db, 'INSERT OR IGNORE INTO schema_meta (key, value) VALUES (?, ?)', [
|
|
358
|
+
'schema_version',
|
|
359
|
+
'3',
|
|
360
|
+
]);
|
|
361
|
+
|
|
362
|
+
return { ok: true, data: { message: 'migrated schema_version to 3' } };
|
|
363
|
+
}
|
|
364
|
+
|
|
339
365
|
async function handleCommand({ subcommand, args }) {
|
|
340
366
|
const { db, dbPath } = openDb();
|
|
341
367
|
try {
|
|
342
|
-
await initSchema(db);
|
|
343
|
-
|
|
344
368
|
if (subcommand === 'join') return await handleJoin(db, args.agent_runtime);
|
|
345
369
|
|
|
370
|
+
if (subcommand === 'migrate') return await handleMigrate(db);
|
|
371
|
+
|
|
372
|
+
await initSchema(db);
|
|
373
|
+
|
|
346
374
|
if (subcommand === 'cue') {
|
|
347
375
|
const agent_id = (args.agent_id ?? '').toString();
|
|
348
376
|
const prompt = (args.prompt ?? '').toString();
|