ei-tui 0.1.16 → 0.1.17
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
CHANGED
package/src/cli/retrieval.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StorageState, Quote, Fact, Trait, Person, Topic } from "../core/types";
|
|
2
|
+
import { decodeAllEmbeddings } from "../storage/embeddings";
|
|
2
3
|
import { crossFind } from "../core/utils/index.ts";
|
|
3
4
|
import { join } from "path";
|
|
4
5
|
import { readFile } from "fs/promises";
|
|
@@ -21,7 +22,7 @@ export async function loadLatestState(): Promise<StorageState | null> {
|
|
|
21
22
|
for (const file of [STATE_FILE, BACKUP_FILE]) {
|
|
22
23
|
try {
|
|
23
24
|
const text = await readFile(join(dataPath, file), "utf-8");
|
|
24
|
-
if (text) return JSON.parse(text) as StorageState;
|
|
25
|
+
if (text) return decodeAllEmbeddings(JSON.parse(text) as StorageState);
|
|
25
26
|
} catch {
|
|
26
27
|
continue;
|
|
27
28
|
}
|
package/src/core/processor.ts
CHANGED
|
@@ -292,11 +292,14 @@ export class Processor {
|
|
|
292
292
|
const result = await remoteSync.sync(state);
|
|
293
293
|
|
|
294
294
|
if (!result.success) {
|
|
295
|
-
//
|
|
296
|
-
// Do NOT
|
|
297
|
-
//
|
|
295
|
+
// Sync failed (e.g. 429, network error, 412 etag mismatch).
|
|
296
|
+
// Do NOT stop() — leave the processor loop running so the user can
|
|
297
|
+
// keep using the TUI and retry /quit later.
|
|
298
|
+
// Do NOT moveToBackup — leave state.json intact so next boot can
|
|
299
|
+
// detect primary + remote → conflict resolution if needed.
|
|
298
300
|
console.log(`[Processor ${this.instanceId}] Remote sync failed: ${result.error}`);
|
|
299
|
-
|
|
301
|
+
// Reset the import abort controller so imports can resume normally.
|
|
302
|
+
this.importAbortController = new AbortController();
|
|
300
303
|
this.interface.onSaveAndExitFinish?.();
|
|
301
304
|
return { success: false, error: result.error };
|
|
302
305
|
}
|
|
@@ -451,10 +451,13 @@ interface EditableSettingsData {
|
|
|
451
451
|
opencode?: {
|
|
452
452
|
integration?: boolean | null;
|
|
453
453
|
polling_interval_ms?: number | null;
|
|
454
|
+
last_sync?: string | null;
|
|
455
|
+
extraction_point?: string | null;
|
|
454
456
|
};
|
|
455
457
|
claudeCode?: {
|
|
456
458
|
integration?: boolean | null;
|
|
457
459
|
polling_interval_ms?: number | null;
|
|
460
|
+
last_sync?: string | null;
|
|
458
461
|
};
|
|
459
462
|
backup?: {
|
|
460
463
|
enabled?: boolean | null;
|
|
@@ -478,10 +481,13 @@ export function settingsToYAML(settings: HumanSettings | undefined): string {
|
|
|
478
481
|
opencode: {
|
|
479
482
|
integration: settings?.opencode?.integration ?? false,
|
|
480
483
|
polling_interval_ms: settings?.opencode?.polling_interval_ms ?? 1800000,
|
|
484
|
+
last_sync: settings?.opencode?.last_sync ?? null,
|
|
485
|
+
extraction_point: settings?.opencode?.extraction_point ?? null,
|
|
481
486
|
},
|
|
482
487
|
claudeCode: {
|
|
483
488
|
integration: settings?.claudeCode?.integration ?? false,
|
|
484
489
|
polling_interval_ms: settings?.claudeCode?.polling_interval_ms ?? 1800000,
|
|
490
|
+
last_sync: settings?.claudeCode?.last_sync ?? null,
|
|
485
491
|
},
|
|
486
492
|
backup: {
|
|
487
493
|
enabled: settings?.backup?.enabled ?? false,
|
|
@@ -492,9 +498,10 @@ export function settingsToYAML(settings: HumanSettings | undefined): string {
|
|
|
492
498
|
|
|
493
499
|
return YAML.stringify(data, {
|
|
494
500
|
lineWidth: 0,
|
|
495
|
-
})
|
|
501
|
+
})
|
|
502
|
+
.replace(/^(\s+)(last_sync: .+)$/mg, '$1# [read-only] $2')
|
|
503
|
+
.replace(/^(\s+)(extraction_point: .+)$/mg, '$1# [read-only] $2');
|
|
496
504
|
}
|
|
497
|
-
|
|
498
505
|
export function settingsFromYAML(yamlContent: string, original: HumanSettings | undefined): HumanSettings {
|
|
499
506
|
const data = YAML.parse(yamlContent) as EditableSettingsData;
|
|
500
507
|
|