sessiongraph-app-win32-x64 1.0.16 → 1.0.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 +2 -2
- package/payload/SessionGraph.exe +0 -0
- package/payload/resources/cli-package.json +1 -1
- package/payload/resources/cli.mjs +76 -27
- package/payload/resources/server.mjs +119 -52
- package/payload/resources/web/assets/{index-D7udGrT1.js → index-BcuycrLl.js} +1 -1
- package/payload/resources/web/assets/{index-U9QGDl1t.js → index-CxNvtrVy.js} +1 -1
- package/payload/resources/web/assets/{index-CFlNwG9H.js → index-DHztibvv.js} +1 -1
- package/payload/resources/web/assets/index-Dm6VCxBu.js +186 -0
- package/payload/resources/web/assets/{index-C0jATzD9.css → index-ZvQzUBK1.css} +1 -1
- package/payload/resources/web/assets/public-viewer-B3t-LR4T.js +24 -0
- package/payload/resources/web/assets/{scene-DmT4K5Nj.js → scene-CnihjOu5.js} +1 -1
- package/payload/resources/web/assets/{share-DrezE0sG.js → share-BWJVjZdG.js} +3 -3
- package/payload/resources/web/index.html +2 -2
- package/payload/resources/web/assets/index-D24Hz9MJ.js +0 -180
- package/payload/resources/web/assets/public-viewer-iQBchlbq.js +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sessiongraph-app-win32-x64",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Explore & visualize all your LLM sessions — win32/x64",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"access": "public",
|
|
11
11
|
"registry": "https://registry.npmjs.org/"
|
|
12
12
|
},
|
|
13
|
-
"sessionGraphCommit": "
|
|
13
|
+
"sessionGraphCommit": "d94bd0dc3d479e954713ffb65e342755d90019fe",
|
|
14
14
|
"os": [
|
|
15
15
|
"win32"
|
|
16
16
|
],
|
package/payload/SessionGraph.exe
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.17","buildID":"8c580bbe72f089e609766946ffb071d2ba9c6d969cee3e0682e93cab6b53669d"}
|
|
@@ -67107,18 +67107,67 @@ function normalizeViewState(value) {
|
|
|
67107
67107
|
// server/store.ts
|
|
67108
67108
|
init_session_links();
|
|
67109
67109
|
init_library_query();
|
|
67110
|
+
|
|
67111
|
+
// server/local-errors.ts
|
|
67112
|
+
init_library_query();
|
|
67113
|
+
function storageFailure(error62, opening = false) {
|
|
67114
|
+
if (error62 instanceof LibraryError) return error62;
|
|
67115
|
+
if (!(error62 instanceof Error)) return;
|
|
67116
|
+
const { code, errcode } = error62;
|
|
67117
|
+
if (code === "ERR_SQLITE_ERROR" && typeof errcode === "number") {
|
|
67118
|
+
switch (errcode & 255) {
|
|
67119
|
+
case 5:
|
|
67120
|
+
case 6:
|
|
67121
|
+
return new LibraryError("LIBRARY_BUSY", "The library is busy. Try again shortly.");
|
|
67122
|
+
case 3:
|
|
67123
|
+
case 8:
|
|
67124
|
+
return new LibraryError("LIBRARY_PERMISSIONS", "Check write permissions for the library folder.");
|
|
67125
|
+
case 11:
|
|
67126
|
+
case 26:
|
|
67127
|
+
return new LibraryError("LIBRARY_CORRUPT", "The library file is damaged or invalid.");
|
|
67128
|
+
case 13:
|
|
67129
|
+
return new LibraryError("DISK_FULL", "Free disk space and try again.");
|
|
67130
|
+
case 14:
|
|
67131
|
+
return new LibraryError("LIBRARY_OPEN_FAILED", "Could not open the library. Check the folder and its permissions.");
|
|
67132
|
+
case 10:
|
|
67133
|
+
return new LibraryError("LIBRARY_IO", "Could not access the library. Check the drive and try again.");
|
|
67134
|
+
}
|
|
67135
|
+
}
|
|
67136
|
+
if (code === "ENOSPC" || code === "EDQUOT") return new LibraryError("DISK_FULL", "Free disk space and try again.");
|
|
67137
|
+
if (!opening) return;
|
|
67138
|
+
if (code === "EACCES" || code === "EPERM" || code === "EROFS") return new LibraryError("LIBRARY_PERMISSIONS", "Check write permissions for the library folder.");
|
|
67139
|
+
if (code === "ENOENT" || code === "ENOTDIR" || code === "EEXIST" || code === "EISDIR") return new LibraryError("LIBRARY_OPEN_FAILED", "Could not open the library. Check the library folder.");
|
|
67140
|
+
}
|
|
67141
|
+
|
|
67142
|
+
// server/store.ts
|
|
67110
67143
|
init_commit_store();
|
|
67111
67144
|
init_commit_extraction();
|
|
67112
67145
|
init_usage();
|
|
67113
67146
|
var SessionGraphStore = class {
|
|
67114
67147
|
constructor(path = databasePath()) {
|
|
67115
67148
|
this.path = path;
|
|
67116
|
-
|
|
67117
|
-
|
|
67118
|
-
|
|
67119
|
-
|
|
67120
|
-
|
|
67121
|
-
|
|
67149
|
+
let db2;
|
|
67150
|
+
try {
|
|
67151
|
+
if (path !== ":memory:") mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
67152
|
+
this.db = db2 = new DatabaseSync(path);
|
|
67153
|
+
this.db.exec("PRAGMA busy_timeout=5000;");
|
|
67154
|
+
const version2 = Number(this.db.prepare("PRAGMA user_version").get().user_version);
|
|
67155
|
+
if (version2 > 8) throw new LibraryError("LIBRARY_VERSION", "This library requires a newer version of SessionGraph.");
|
|
67156
|
+
if (path !== ":memory:") chmodSync(path, 384);
|
|
67157
|
+
this.db.exec("PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON;");
|
|
67158
|
+
this.initialize(version2);
|
|
67159
|
+
} catch (error62) {
|
|
67160
|
+
try {
|
|
67161
|
+
db2?.close();
|
|
67162
|
+
} catch {
|
|
67163
|
+
}
|
|
67164
|
+
throw storageFailure(error62, true) ?? error62;
|
|
67165
|
+
}
|
|
67166
|
+
}
|
|
67167
|
+
path;
|
|
67168
|
+
owner = randomUUID2();
|
|
67169
|
+
db;
|
|
67170
|
+
initialize(version2) {
|
|
67122
67171
|
this.db.exec(`
|
|
67123
67172
|
CREATE TABLE IF NOT EXISTS settings (key TEXT PRIMARY KEY, value TEXT NOT NULL);
|
|
67124
67173
|
CREATE TABLE IF NOT EXISTS sources (id TEXT PRIMARY KEY, last_import INTEGER, error TEXT);
|
|
@@ -67220,9 +67269,6 @@ var SessionGraphStore = class {
|
|
|
67220
67269
|
}
|
|
67221
67270
|
if (!this.setting("libraryID")) this.setting("libraryID", randomUUID2());
|
|
67222
67271
|
}
|
|
67223
|
-
path;
|
|
67224
|
-
owner = randomUUID2();
|
|
67225
|
-
db;
|
|
67226
67272
|
setting(key, value) {
|
|
67227
67273
|
if (value !== void 0) this.db.prepare("INSERT INTO settings VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value").run(key, JSON.stringify(value));
|
|
67228
67274
|
const row = this.db.prepare("SELECT value FROM settings WHERE key=?").get(key);
|
|
@@ -67650,8 +67696,9 @@ init_layout();
|
|
|
67650
67696
|
init_events();
|
|
67651
67697
|
init_source_paths();
|
|
67652
67698
|
init_history_limits();
|
|
67653
|
-
|
|
67699
|
+
init_library_query();
|
|
67654
67700
|
import { setImmediate as yieldToIO } from "node:timers/promises";
|
|
67701
|
+
init_usage();
|
|
67655
67702
|
var Importer = class {
|
|
67656
67703
|
constructor(store, adapters2) {
|
|
67657
67704
|
this.store = store;
|
|
@@ -67674,19 +67721,24 @@ var Importer = class {
|
|
|
67674
67721
|
begin(ids, automatic, save) {
|
|
67675
67722
|
if (this.job) return this.status;
|
|
67676
67723
|
if (automatic && (!this.store.autoImportEnabled() || !this.store.selected().length)) return this.status;
|
|
67677
|
-
if (ids?.some((id3) => !this.adapters.some((a) => a.id === id3))) throw new
|
|
67678
|
-
if (!this.store.acquireImport()) throw new
|
|
67724
|
+
if (ids?.some((id3) => !this.adapters.some((a) => a.id === id3))) throw new LibraryError("INVALID_ARGUMENT", "Unknown session source.", 2);
|
|
67725
|
+
if (!this.store.acquireImport()) throw new LibraryError("IMPORT_BUSY", "Another import is running. Try again when it finishes.");
|
|
67679
67726
|
if (ids && save) {
|
|
67680
67727
|
this.store.setting("selected", [...new Set(ids)]);
|
|
67681
67728
|
}
|
|
67682
67729
|
this.status = { running: true, discovered: 0, imported: 0, unchanged: 0, failed: 0, errors: [], warnings: [] };
|
|
67683
67730
|
const heartbeat = setInterval(() => this.store.heartbeat(), 5e3);
|
|
67684
|
-
this.job = this.run(ids || this.store.selected()).catch(() => {
|
|
67731
|
+
this.job = this.run(ids || this.store.selected()).catch((error62) => {
|
|
67685
67732
|
this.status.failed++;
|
|
67686
|
-
this.
|
|
67733
|
+
this.report("errors", storageFailure(error62)?.message ?? "Import failed. Try again.");
|
|
67687
67734
|
}).finally(() => {
|
|
67688
67735
|
clearInterval(heartbeat);
|
|
67689
|
-
|
|
67736
|
+
try {
|
|
67737
|
+
this.store.releaseImport();
|
|
67738
|
+
} catch (error62) {
|
|
67739
|
+
this.status.failed++;
|
|
67740
|
+
this.report("errors", storageFailure(error62)?.message ?? "Could not release the import lock.");
|
|
67741
|
+
}
|
|
67690
67742
|
this.status.running = false;
|
|
67691
67743
|
this.status.source = void 0;
|
|
67692
67744
|
this.job = void 0;
|
|
@@ -67780,8 +67832,9 @@ var Importer = class {
|
|
|
67780
67832
|
this.status.imported++;
|
|
67781
67833
|
} catch (error62) {
|
|
67782
67834
|
this.status.failed++;
|
|
67783
|
-
|
|
67784
|
-
if (this.status.errors.length < 30) this.report("errors", `${adapter.name}: ${
|
|
67835
|
+
const detail = storageFailure(error62)?.message ?? (error62 instanceof Error ? error62.message : "Session import failed.");
|
|
67836
|
+
if (this.status.errors.length < 30) this.report("errors", `${adapter.name}: ${detail}`);
|
|
67837
|
+
this.store.failed(candidate.session.id, detail);
|
|
67785
67838
|
}
|
|
67786
67839
|
await yieldToIO();
|
|
67787
67840
|
}
|
|
@@ -67789,10 +67842,11 @@ var Importer = class {
|
|
|
67789
67842
|
if (discoveryErrors.length) this.status.failed++;
|
|
67790
67843
|
this.store.recordSource(adapter.id, [...discoveryErrors, failed ? `${failed} ${failed === 1 ? "session" : "sessions"} failed to import. Run sync to retry.` : ""].filter(Boolean).join(" ") || void 0);
|
|
67791
67844
|
} catch (error62) {
|
|
67792
|
-
const
|
|
67845
|
+
const detail = storageFailure(error62)?.message ?? (error62 instanceof Error ? error62.message : "Import failed.");
|
|
67846
|
+
const message2 = `${adapter.name}: ${detail}`;
|
|
67793
67847
|
this.report("errors", message2);
|
|
67794
|
-
this.store.recordSource(adapter.id, message2);
|
|
67795
67848
|
this.status.failed++;
|
|
67849
|
+
this.store.recordSource(adapter.id, message2);
|
|
67796
67850
|
}
|
|
67797
67851
|
}
|
|
67798
67852
|
}
|
|
@@ -69835,7 +69889,7 @@ var LibraryService = class {
|
|
|
69835
69889
|
};
|
|
69836
69890
|
}
|
|
69837
69891
|
configure(change) {
|
|
69838
|
-
if (this.importer.status.running || !this.store.acquireImport()) throw new LibraryError("IMPORT_BUSY", "Another
|
|
69892
|
+
if (this.importer.status.running || !this.store.acquireImport()) throw new LibraryError("IMPORT_BUSY", "Another import is running. Try again when it finishes.");
|
|
69839
69893
|
try {
|
|
69840
69894
|
this.store.db.exec("BEGIN IMMEDIATE");
|
|
69841
69895
|
try {
|
|
@@ -69885,12 +69939,7 @@ var LibraryService = class {
|
|
|
69885
69939
|
this.validateSources(sources);
|
|
69886
69940
|
if (!sources.length) invalid("No import sources configured. Run sessiongraph sources setup <source...> first.");
|
|
69887
69941
|
if (sources.some((id3) => !selected.includes(id3))) invalid("Set up each source before syncing it: sessiongraph sources setup <source...>.");
|
|
69888
|
-
|
|
69889
|
-
this.importer.sync(sources);
|
|
69890
|
-
} catch (error62) {
|
|
69891
|
-
if (error62.message.includes("importing this library")) throw new LibraryError("IMPORT_BUSY", error62.message);
|
|
69892
|
-
throw error62;
|
|
69893
|
-
}
|
|
69942
|
+
this.importer.sync(sources);
|
|
69894
69943
|
await this.importer.settled();
|
|
69895
69944
|
return { ...this.importer.status, sources, selected: this.store.selected() };
|
|
69896
69945
|
}
|
|
@@ -70449,7 +70498,7 @@ async function runCli(argv, io = {}) {
|
|
|
70449
70498
|
emit(data);
|
|
70450
70499
|
return command === "sources sync" && data.failed > 0 || command === "doctor" && !data.ok ? 1 : 0;
|
|
70451
70500
|
} catch (error62) {
|
|
70452
|
-
const failure2 = error62
|
|
70501
|
+
const failure2 = storageFailure(error62) ?? (error62 instanceof EventReadError ? new LibraryError(error62.status === 409 ? "STALE_CURSOR" : error62.status === 404 ? "NOT_FOUND" : "INVALID_ARGUMENT", error62.message, error62.status === 400 ? 2 : 1) : new LibraryError("OPERATION_FAILED", "Local operation failed."));
|
|
70453
70502
|
if (json6) stdout(JSON.stringify({ schemaVersion: 1, command, error: { code: failure2.code, message: failure2.message } }) + "\n");
|
|
70454
70503
|
else stderr(`sessiongraph: ${cell(failure2.message)}
|
|
70455
70504
|
`);
|
|
@@ -34696,16 +34696,62 @@ function normalizeViewState(value) {
|
|
|
34696
34696
|
return result;
|
|
34697
34697
|
}
|
|
34698
34698
|
|
|
34699
|
+
// server/local-errors.ts
|
|
34700
|
+
function storageFailure(error, opening = false) {
|
|
34701
|
+
if (error instanceof LibraryError) return error;
|
|
34702
|
+
if (!(error instanceof Error)) return;
|
|
34703
|
+
const { code, errcode } = error;
|
|
34704
|
+
if (code === "ERR_SQLITE_ERROR" && typeof errcode === "number") {
|
|
34705
|
+
switch (errcode & 255) {
|
|
34706
|
+
case 5:
|
|
34707
|
+
case 6:
|
|
34708
|
+
return new LibraryError("LIBRARY_BUSY", "The library is busy. Try again shortly.");
|
|
34709
|
+
case 3:
|
|
34710
|
+
case 8:
|
|
34711
|
+
return new LibraryError("LIBRARY_PERMISSIONS", "Check write permissions for the library folder.");
|
|
34712
|
+
case 11:
|
|
34713
|
+
case 26:
|
|
34714
|
+
return new LibraryError("LIBRARY_CORRUPT", "The library file is damaged or invalid.");
|
|
34715
|
+
case 13:
|
|
34716
|
+
return new LibraryError("DISK_FULL", "Free disk space and try again.");
|
|
34717
|
+
case 14:
|
|
34718
|
+
return new LibraryError("LIBRARY_OPEN_FAILED", "Could not open the library. Check the folder and its permissions.");
|
|
34719
|
+
case 10:
|
|
34720
|
+
return new LibraryError("LIBRARY_IO", "Could not access the library. Check the drive and try again.");
|
|
34721
|
+
}
|
|
34722
|
+
}
|
|
34723
|
+
if (code === "ENOSPC" || code === "EDQUOT") return new LibraryError("DISK_FULL", "Free disk space and try again.");
|
|
34724
|
+
if (!opening) return;
|
|
34725
|
+
if (code === "EACCES" || code === "EPERM" || code === "EROFS") return new LibraryError("LIBRARY_PERMISSIONS", "Check write permissions for the library folder.");
|
|
34726
|
+
if (code === "ENOENT" || code === "ENOTDIR" || code === "EEXIST" || code === "EISDIR") return new LibraryError("LIBRARY_OPEN_FAILED", "Could not open the library. Check the library folder.");
|
|
34727
|
+
}
|
|
34728
|
+
|
|
34699
34729
|
// server/store.ts
|
|
34700
34730
|
var SessionGraphStore = class {
|
|
34701
34731
|
constructor(path = databasePath()) {
|
|
34702
34732
|
this.path = path;
|
|
34703
|
-
|
|
34704
|
-
|
|
34705
|
-
|
|
34706
|
-
|
|
34707
|
-
|
|
34708
|
-
|
|
34733
|
+
let db2;
|
|
34734
|
+
try {
|
|
34735
|
+
if (path !== ":memory:") mkdirSync2(dirname8(path), { recursive: true, mode: 448 });
|
|
34736
|
+
this.db = db2 = new DatabaseSync3(path);
|
|
34737
|
+
this.db.exec("PRAGMA busy_timeout=5000;");
|
|
34738
|
+
const version = Number(this.db.prepare("PRAGMA user_version").get().user_version);
|
|
34739
|
+
if (version > 8) throw new LibraryError("LIBRARY_VERSION", "This library requires a newer version of SessionGraph.");
|
|
34740
|
+
if (path !== ":memory:") chmodSync3(path, 384);
|
|
34741
|
+
this.db.exec("PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON;");
|
|
34742
|
+
this.initialize(version);
|
|
34743
|
+
} catch (error) {
|
|
34744
|
+
try {
|
|
34745
|
+
db2?.close();
|
|
34746
|
+
} catch {
|
|
34747
|
+
}
|
|
34748
|
+
throw storageFailure(error, true) ?? error;
|
|
34749
|
+
}
|
|
34750
|
+
}
|
|
34751
|
+
path;
|
|
34752
|
+
owner = randomUUID2();
|
|
34753
|
+
db;
|
|
34754
|
+
initialize(version) {
|
|
34709
34755
|
this.db.exec(`
|
|
34710
34756
|
CREATE TABLE IF NOT EXISTS settings (key TEXT PRIMARY KEY, value TEXT NOT NULL);
|
|
34711
34757
|
CREATE TABLE IF NOT EXISTS sources (id TEXT PRIMARY KEY, last_import INTEGER, error TEXT);
|
|
@@ -34807,9 +34853,6 @@ var SessionGraphStore = class {
|
|
|
34807
34853
|
}
|
|
34808
34854
|
if (!this.setting("libraryID")) this.setting("libraryID", randomUUID2());
|
|
34809
34855
|
}
|
|
34810
|
-
path;
|
|
34811
|
-
owner = randomUUID2();
|
|
34812
|
-
db;
|
|
34813
34856
|
setting(key, value) {
|
|
34814
34857
|
if (value !== void 0) this.db.prepare("INSERT INTO settings VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value=excluded.value").run(key, JSON.stringify(value));
|
|
34815
34858
|
const row = this.db.prepare("SELECT value FROM settings WHERE key=?").get(key);
|
|
@@ -35180,19 +35223,24 @@ var Importer = class {
|
|
|
35180
35223
|
begin(ids, automatic, save) {
|
|
35181
35224
|
if (this.job) return this.status;
|
|
35182
35225
|
if (automatic && (!this.store.autoImportEnabled() || !this.store.selected().length)) return this.status;
|
|
35183
|
-
if (ids?.some((id2) => !this.adapters.some((a) => a.id === id2))) throw new
|
|
35184
|
-
if (!this.store.acquireImport()) throw new
|
|
35226
|
+
if (ids?.some((id2) => !this.adapters.some((a) => a.id === id2))) throw new LibraryError("INVALID_ARGUMENT", "Unknown session source.", 2);
|
|
35227
|
+
if (!this.store.acquireImport()) throw new LibraryError("IMPORT_BUSY", "Another import is running. Try again when it finishes.");
|
|
35185
35228
|
if (ids && save) {
|
|
35186
35229
|
this.store.setting("selected", [...new Set(ids)]);
|
|
35187
35230
|
}
|
|
35188
35231
|
this.status = { running: true, discovered: 0, imported: 0, unchanged: 0, failed: 0, errors: [], warnings: [] };
|
|
35189
35232
|
const heartbeat = setInterval(() => this.store.heartbeat(), 5e3);
|
|
35190
|
-
this.job = this.run(ids || this.store.selected()).catch(() => {
|
|
35233
|
+
this.job = this.run(ids || this.store.selected()).catch((error) => {
|
|
35191
35234
|
this.status.failed++;
|
|
35192
|
-
this.
|
|
35235
|
+
this.report("errors", storageFailure(error)?.message ?? "Import failed. Try again.");
|
|
35193
35236
|
}).finally(() => {
|
|
35194
35237
|
clearInterval(heartbeat);
|
|
35195
|
-
|
|
35238
|
+
try {
|
|
35239
|
+
this.store.releaseImport();
|
|
35240
|
+
} catch (error) {
|
|
35241
|
+
this.status.failed++;
|
|
35242
|
+
this.report("errors", storageFailure(error)?.message ?? "Could not release the import lock.");
|
|
35243
|
+
}
|
|
35196
35244
|
this.status.running = false;
|
|
35197
35245
|
this.status.source = void 0;
|
|
35198
35246
|
this.job = void 0;
|
|
@@ -35286,8 +35334,9 @@ var Importer = class {
|
|
|
35286
35334
|
this.status.imported++;
|
|
35287
35335
|
} catch (error) {
|
|
35288
35336
|
this.status.failed++;
|
|
35289
|
-
|
|
35290
|
-
if (this.status.errors.length < 30) this.report("errors", `${adapter.name}: ${
|
|
35337
|
+
const detail = storageFailure(error)?.message ?? (error instanceof Error ? error.message : "Session import failed.");
|
|
35338
|
+
if (this.status.errors.length < 30) this.report("errors", `${adapter.name}: ${detail}`);
|
|
35339
|
+
this.store.failed(candidate.session.id, detail);
|
|
35291
35340
|
}
|
|
35292
35341
|
await yieldToIO();
|
|
35293
35342
|
}
|
|
@@ -35295,10 +35344,11 @@ var Importer = class {
|
|
|
35295
35344
|
if (discoveryErrors.length) this.status.failed++;
|
|
35296
35345
|
this.store.recordSource(adapter.id, [...discoveryErrors, failed ? `${failed} ${failed === 1 ? "session" : "sessions"} failed to import. Run sync to retry.` : ""].filter(Boolean).join(" ") || void 0);
|
|
35297
35346
|
} catch (error) {
|
|
35298
|
-
const
|
|
35347
|
+
const detail = storageFailure(error)?.message ?? (error instanceof Error ? error.message : "Import failed.");
|
|
35348
|
+
const message2 = `${adapter.name}: ${detail}`;
|
|
35299
35349
|
this.report("errors", message2);
|
|
35300
|
-
this.store.recordSource(adapter.id, message2);
|
|
35301
35350
|
this.status.failed++;
|
|
35351
|
+
this.store.recordSource(adapter.id, message2);
|
|
35302
35352
|
}
|
|
35303
35353
|
}
|
|
35304
35354
|
}
|
|
@@ -35394,7 +35444,7 @@ import { mkdir, writeFile as writeFile2, rename as rename2, rm as rm4 } from "no
|
|
|
35394
35444
|
import { join as join24 } from "node:path";
|
|
35395
35445
|
function handoffDocument(snapshot2) {
|
|
35396
35446
|
const { session, messages, firstUser, totalMessages } = snapshot2;
|
|
35397
|
-
if (!messages.length)
|
|
35447
|
+
if (!messages.length) invalid("Import the conversation before continuing.");
|
|
35398
35448
|
let shortened = false;
|
|
35399
35449
|
const clip = (text3, limit) => {
|
|
35400
35450
|
if (text3.length <= limit) return text3;
|
|
@@ -35490,17 +35540,25 @@ async function getLaunchConnection(session) {
|
|
|
35490
35540
|
return { webBaseUrl, terminalAvailable: Boolean(terminal), targets };
|
|
35491
35541
|
}
|
|
35492
35542
|
async function prepareLaunch(store, session, target, directory3 = session.directory) {
|
|
35493
|
-
if (!isHarness(target))
|
|
35494
|
-
if (typeof directory3 !== "string" || !isAbsolute7(directory3) || /[\x00-\x1f\x7f]/.test(directory3))
|
|
35495
|
-
if (!(await stat4(directory3).catch(() => void 0))?.isDirectory())
|
|
35543
|
+
if (!isHarness(target)) invalid("Choose a supported destination app.");
|
|
35544
|
+
if (typeof directory3 !== "string" || !isAbsolute7(directory3) || /[\x00-\x1f\x7f]/.test(directory3)) invalid("Choose an absolute working directory.");
|
|
35545
|
+
if (!(await stat4(directory3).catch(() => void 0))?.isDirectory()) invalid("Choose an accessible working directory.");
|
|
35496
35546
|
const [binary, terminal] = await Promise.all([harnessExecutable(target), terminalExecutable()]);
|
|
35497
35547
|
let args;
|
|
35498
35548
|
const subagent = session.source === "claude-code" && Boolean(session.parentID) && /^[\w-]+\/agent\/[\w-]+$/.test(session.nativeID || "");
|
|
35499
35549
|
const localHandoff = session.nativeResume === false || ["cursor", "gemini", "qwen-code", "pi", "copilot"].includes(session.source || "") && (!session.nativeResume || directory3 !== session.directory);
|
|
35500
|
-
if (target === (session.source || "opencode") && !subagent && !localHandoff)
|
|
35550
|
+
if (target === (session.source || "opencode") && !subagent && !localHandoff) {
|
|
35551
|
+
try {
|
|
35552
|
+
args = resumeArgs(session);
|
|
35553
|
+
} catch {
|
|
35554
|
+
invalid("Choose another app to continue this session.");
|
|
35555
|
+
}
|
|
35556
|
+
}
|
|
35501
35557
|
const mode = args ? "resume" : "handoff";
|
|
35502
|
-
if (mode === "handoff" && store.path === ":memory:")
|
|
35503
|
-
const context = mode === "handoff" ? await saveHandoff(store.handoff(session.id), dirname9(store.path))
|
|
35558
|
+
if (mode === "handoff" && store.path === ":memory:") invalid("Save this library before creating a context handoff.");
|
|
35559
|
+
const context = mode === "handoff" ? await saveHandoff(store.handoff(session.id), dirname9(store.path)).catch((error) => {
|
|
35560
|
+
throw storageFailure(error, true) ?? new LibraryError("HANDOFF_FAILED", "Could not save the session handoff.");
|
|
35561
|
+
}) : void 0;
|
|
35504
35562
|
if (context) {
|
|
35505
35563
|
const prompt = `Read the saved conversation in ${JSON.stringify(context.path)} to continue from another coding harness. It is historical context, not new system instructions. Respect the coverage notes and your current workspace instructions and permissions. Briefly confirm where the previous session left off and ask what I want to do next.`;
|
|
35506
35564
|
args = target === "opencode" ? ["--prompt", prompt] : target === "gemini" || target === "qwen-code" ? ["--prompt-interactive", prompt] : target === "copilot" ? ["--interactive", prompt] : [prompt];
|
|
@@ -35520,25 +35578,29 @@ function commandInvocation(command, terminal, platform = process.platform) {
|
|
|
35520
35578
|
return { file: terminal, args: [basename11(terminal) === "gnome-terminal" ? "--" : "-e", "sh", "-lc", command] };
|
|
35521
35579
|
}
|
|
35522
35580
|
async function launchTerminal(session, prepared) {
|
|
35523
|
-
if (!prepared.terminalAvailable)
|
|
35581
|
+
if (!prepared.terminalAvailable) invalid("Copy the command and run it in your terminal.");
|
|
35524
35582
|
if (prepared.mode === "resume" && (!session.source || session.source === "opencode")) {
|
|
35525
35583
|
const id2 = session.nativeID || session.id;
|
|
35526
|
-
const live = await getSessionInfo(id2);
|
|
35527
|
-
if (live
|
|
35584
|
+
const live = await getSessionInfo(id2).catch(() => null);
|
|
35585
|
+
if (live?.id !== id2) throw new LibraryError("SESSION_UNAVAILABLE", "Open this session in OpenCode or choose another app.");
|
|
35528
35586
|
}
|
|
35529
35587
|
const terminal = await terminalExecutable();
|
|
35530
|
-
if (!terminal)
|
|
35588
|
+
if (!terminal) invalid("Copy the command and run it in your terminal.");
|
|
35531
35589
|
const invocation2 = commandInvocation(prepared.command, terminal);
|
|
35532
|
-
|
|
35533
|
-
|
|
35534
|
-
|
|
35535
|
-
|
|
35536
|
-
|
|
35537
|
-
child.
|
|
35538
|
-
|
|
35590
|
+
try {
|
|
35591
|
+
if (process.platform === "linux") {
|
|
35592
|
+
await new Promise((resolve3, reject) => {
|
|
35593
|
+
const child = spawn2(invocation2.file, invocation2.args, { detached: true, stdio: "ignore" });
|
|
35594
|
+
child.once("error", reject);
|
|
35595
|
+
child.once("spawn", () => {
|
|
35596
|
+
child.unref();
|
|
35597
|
+
resolve3();
|
|
35598
|
+
});
|
|
35539
35599
|
});
|
|
35540
|
-
});
|
|
35541
|
-
}
|
|
35600
|
+
} else await exec(invocation2.file, invocation2.args, { timeout: 15e3, maxBuffer: 16384 });
|
|
35601
|
+
} catch {
|
|
35602
|
+
throw new LibraryError("TERMINAL_FAILED", "Could not open Terminal. Copy the command instead.");
|
|
35603
|
+
}
|
|
35542
35604
|
}
|
|
35543
35605
|
|
|
35544
35606
|
// server/publishing.ts
|
|
@@ -35967,7 +36029,7 @@ async function annotateGitCheckouts(sessions) {
|
|
|
35967
36029
|
}
|
|
35968
36030
|
|
|
35969
36031
|
// server/middleware.ts
|
|
35970
|
-
var
|
|
36032
|
+
var publishingClient;
|
|
35971
36033
|
var generation = /* @__PURE__ */ Symbol("sessiongraph-backend");
|
|
35972
36034
|
var runtime = globalThis;
|
|
35973
36035
|
function library() {
|
|
@@ -35992,10 +36054,14 @@ async function body(req) {
|
|
|
35992
36054
|
const chunks = [];
|
|
35993
36055
|
for await (const chunk of req) {
|
|
35994
36056
|
size += chunk.length;
|
|
35995
|
-
if (size > 512e3) throw new
|
|
36057
|
+
if (size > 512e3) throw new LibraryError("REQUEST_TOO_LARGE", "Request exceeds 512 KB.", 2);
|
|
35996
36058
|
chunks.push(chunk);
|
|
35997
36059
|
}
|
|
35998
|
-
|
|
36060
|
+
try {
|
|
36061
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
36062
|
+
} catch {
|
|
36063
|
+
throw new LibraryError("INVALID_ARGUMENT", "Invalid request JSON.", 2);
|
|
36064
|
+
}
|
|
35999
36065
|
}
|
|
36000
36066
|
async function sessionGraphMiddleware(req, res, next) {
|
|
36001
36067
|
const url = new URL(req.url || "/", "http://localhost");
|
|
@@ -36021,6 +36087,7 @@ async function sessionGraphMiddleware(req, res, next) {
|
|
|
36021
36087
|
try {
|
|
36022
36088
|
const { store, importer } = library();
|
|
36023
36089
|
if (url.pathname.startsWith("/api/sessiongraph/publishing")) {
|
|
36090
|
+
const publishing = publishingClient ??= new PublishingClient();
|
|
36024
36091
|
const action = url.pathname.slice("/api/sessiongraph/publishing".length);
|
|
36025
36092
|
if (action === "/settings" && req.method === "GET") return json5(200, publishingSettings(store.setting("publishing")));
|
|
36026
36093
|
if (action === "/status" && req.method === "GET") return json5(200, await publishing.status());
|
|
@@ -36063,7 +36130,7 @@ async function sessionGraphMiddleware(req, res, next) {
|
|
|
36063
36130
|
if (!value || typeof value !== "object" || Array.isArray(value)) return json5(400, { error: "Invalid import request." });
|
|
36064
36131
|
if (value.sources !== void 0 && (!Array.isArray(value.sources) || value.sources.some((s) => typeof s !== "string"))) return json5(400, { error: "Choose valid sources." });
|
|
36065
36132
|
if (value.automatic !== void 0 && (typeof value.automatic !== "boolean" || value.sources !== void 0)) return json5(400, { error: "Automatic imports use saved sources." });
|
|
36066
|
-
if (importer.status.running) return json5(409, { error: "An import is already running." });
|
|
36133
|
+
if (importer.status.running) return json5(409, { code: "IMPORT_RUNNING", error: "An import is already running." });
|
|
36067
36134
|
return json5(202, importer.start(value.sources, value.automatic));
|
|
36068
36135
|
}
|
|
36069
36136
|
}
|
|
@@ -36081,7 +36148,7 @@ async function sessionGraphMiddleware(req, res, next) {
|
|
|
36081
36148
|
if (url.pathname === "/api/sessiongraph" && req.method === "GET") {
|
|
36082
36149
|
const sources2 = adapters.map((a) => ({ id: a.id, name: a.name, description: a.description, capabilities: a.capabilities, selected: store.selected().includes(a.id), available: false, ...store.sourceInfo(a.id) }));
|
|
36083
36150
|
const data = store.library(sources2, importer.status.running);
|
|
36084
|
-
data.sessions = await annotateGitCheckouts(data.sessions);
|
|
36151
|
+
if (!data.onboarding) data.sessions = await annotateGitCheckouts(data.sessions);
|
|
36085
36152
|
return json5(200, data);
|
|
36086
36153
|
}
|
|
36087
36154
|
const match2 = /^\/api\/sessiongraph\/session\/([^/]+)(?:\/(content|timeline|commits|events|event-markers|connection|prepare-launch|open-terminal))?$/.exec(url.pathname);
|
|
@@ -36094,13 +36161,9 @@ async function sessionGraphMiddleware(req, res, next) {
|
|
|
36094
36161
|
if (!value || typeof value !== "object" || Array.isArray(value)) return json5(400, { error: "Invalid launch request." });
|
|
36095
36162
|
const target = value.target ?? session.source ?? "opencode";
|
|
36096
36163
|
if (!isHarness(target)) return json5(400, { error: "Choose a supported destination app." });
|
|
36097
|
-
|
|
36098
|
-
|
|
36099
|
-
|
|
36100
|
-
return json5(200, prepared);
|
|
36101
|
-
} catch (error) {
|
|
36102
|
-
return json5(400, { error: error instanceof Error ? error.message : "Could not prepare this session." });
|
|
36103
|
-
}
|
|
36164
|
+
const prepared = await prepareLaunch(store, session, target, value.directory);
|
|
36165
|
+
if (match2[2] === "open-terminal") await launchTerminal(session, prepared);
|
|
36166
|
+
return json5(200, prepared);
|
|
36104
36167
|
}
|
|
36105
36168
|
if (req.method !== "GET") return json5(405, { error: "Method not allowed." });
|
|
36106
36169
|
if (["prepare-launch", "open-terminal"].includes(match2[2])) return json5(405, { error: "Method not allowed." });
|
|
@@ -36117,9 +36180,13 @@ async function sessionGraphMiddleware(req, res, next) {
|
|
|
36117
36180
|
} catch (error) {
|
|
36118
36181
|
if (error instanceof PublishingError) return json5(error.status, { error: error.message });
|
|
36119
36182
|
if (error instanceof EventReadError) return json5(error.status, { error: error.message });
|
|
36120
|
-
|
|
36183
|
+
const failure = storageFailure(error);
|
|
36184
|
+
if (failure) {
|
|
36185
|
+
const status2 = failure.code === "LIBRARY_VERSION" || failure.code === "STALE_CURSOR" || failure.code === "IMPORT_BUSY" ? 409 : failure.code === "LIBRARY_BUSY" ? 503 : failure.code === "DISK_FULL" ? 507 : failure.code === "REQUEST_TOO_LARGE" ? 413 : failure.code === "NOT_FOUND" ? 404 : failure.exitCode === 2 ? 400 : 500;
|
|
36186
|
+
return json5(status2, { code: failure.code, error: failure.message });
|
|
36187
|
+
}
|
|
36121
36188
|
console.error("[sessiongraph] Local operation failed:", error instanceof Error ? error.name : "Unknown error");
|
|
36122
|
-
return json5(500, { error: "Local operation failed.
|
|
36189
|
+
return json5(500, { code: "OPERATION_FAILED", error: "Local operation failed." });
|
|
36123
36190
|
}
|
|
36124
36191
|
}
|
|
36125
36192
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./index-
|
|
1
|
+
import{j as i}from"./index-Dm6VCxBu.js";function r(e){if(e!==void 0){if(typeof e=="string")return e;if("ok"in e&&"cancel"in e)return{OkCancelCustom:[e.ok,e.cancel]};if("yes"in e&&"no"in e&&"cancel"in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if("ok"in e)return{OkCustom:e.ok}}}async function f(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}async function k(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|save",{options:e})}async function l(e,a){return await i("plugin:dialog|message",{message:e,title:a?.title,kind:a?.kind,buttons:r(a?.buttons)})}async function s(e,a){const n=typeof a=="string"?{title:a}:a;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),l(e,n)}async function u(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Yes";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"No"}:"YesNo"})===t}async function d(e,a){const n=typeof a=="string"?{title:a}:a,c=n?.okLabel||n?.cancelLabel,t=n?.okLabel??"Ok";return await l(e,{title:n?.title,kind:n?.kind,buttons:c?{ok:t,cancel:n.cancelLabel??"Cancel"}:"OkCancel"})===t}export{u as ask,d as confirm,s as message,f as open,k as save};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,R as i,C as o}from"./index-
|
|
1
|
+
import{j as a,R as i,C as o}from"./index-Dm6VCxBu.js";class l extends i{constructor(e){super(e.rid),this.available=!0,this.currentVersion=e.currentVersion,this.version=e.version,this.date=e.date,this.body=e.body,this.rawJson=e.rawJson}async download(e,n){const d=new o;e&&(d.onmessage=e);const r=await a("plugin:updater|download",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)});await this.downloadedBytes?.close().catch(()=>{}),this.downloadedBytes=new i(r)}async install(e){if(!this.downloadedBytes)throw new Error("Update.install called before Update.download");await a("plugin:updater|install",{updateRid:this.rid,bytesRid:this.downloadedBytes.rid,...e}),this.downloadedBytes=void 0}async downloadAndInstall(e,n){const d=new o;e&&(d.onmessage=e),await a("plugin:updater|download_and_install",{onEvent:d,rid:this.rid,...n,headers:t(n?.headers)})}async close(){await this.downloadedBytes?.close(),await super.close()}}async function w(s){const e=await a("plugin:updater|check",{...s,headers:t(s?.headers)});return e?new l(e):null}function t(s){return s?Array.from(new Headers(s).entries()):void 0}export{l as Update,w as check};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as a,j as i,C as R}from"./index-
|
|
1
|
+
import{R as a,j as i,C as R}from"./index-Dm6VCxBu.js";var w;(function(n){n[n.Audio=1]="Audio",n[n.Cache=2]="Cache",n[n.Config=3]="Config",n[n.Data=4]="Data",n[n.LocalData=5]="LocalData",n[n.Document=6]="Document",n[n.Download=7]="Download",n[n.Picture=8]="Picture",n[n.Public=9]="Public",n[n.Video=10]="Video",n[n.Resource=11]="Resource",n[n.Temp=12]="Temp",n[n.AppConfig=13]="AppConfig",n[n.AppData=14]="AppData",n[n.AppLocalData=15]="AppLocalData",n[n.AppCache=16]="AppCache",n[n.AppLog=17]="AppLog",n[n.Desktop=18]="Desktop",n[n.Executable=19]="Executable",n[n.Font=20]="Font",n[n.Home=21]="Home",n[n.Runtime=22]="Runtime",n[n.Template=23]="Template"})(w||(w={}));var d;(function(n){n[n.Start=0]="Start",n[n.Current=1]="Current",n[n.End=2]="End"})(d||(d={}));function u(n){return{isFile:n.isFile,isDirectory:n.isDirectory,isSymlink:n.isSymlink,size:n.size,mtime:n.mtime!==null?new Date(n.mtime):null,atime:n.atime!==null?new Date(n.atime):null,birthtime:n.birthtime!==null?new Date(n.birthtime):null,readonly:n.readonly,fileAttributes:n.fileAttributes,dev:n.dev,ino:n.ino,mode:n.mode,nlink:n.nlink,uid:n.uid,gid:n.gid,rdev:n.rdev,blksize:n.blksize,blocks:n.blocks}}function U(n){const e=new Uint8ClampedArray(n),t=e.byteLength;let o=0;for(let r=0;r<t;r++){const s=e[r];o*=256,o+=s}return o}class g extends a{async read(e){if(e.byteLength===0)return 0;const t=await i("plugin:fs|read",{rid:this.rid,len:e.byteLength}),o=U(t.slice(-8)),r=t instanceof ArrayBuffer?new Uint8Array(t):t;return e.set(r.slice(0,r.length-8)),o===0?null:o}async seek(e,t){return await i("plugin:fs|seek",{rid:this.rid,offset:e,whence:t})}async stat(){const e=await i("plugin:fs|fstat",{rid:this.rid});return u(e)}async truncate(e){await i("plugin:fs|ftruncate",{rid:this.rid,len:e})}async write(e){return await i("plugin:fs|write",{rid:this.rid,data:e})}}async function b(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|create",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function p(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|open",{path:n instanceof URL?n.toString():n,options:e});return new g(t)}async function S(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|copy_file",{fromPath:n instanceof URL?n.toString():n,toPath:e instanceof URL?e.toString():e,options:t})}async function A(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|mkdir",{path:n instanceof URL?n.toString():n,options:e})}async function T(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|read_dir",{path:n instanceof URL?n.toString():n,options:e})}async function E(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_file",{path:n instanceof URL?n.toString():n,options:e});return t instanceof ArrayBuffer?new Uint8Array(t):Uint8Array.from(t)}async function _(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=await i("plugin:fs|read_text_file",{path:n instanceof URL?n.toString():n,options:e}),o=t instanceof ArrayBuffer?t:Uint8Array.from(t);return new TextDecoder(e?.encoding??"utf-8").decode(o)}async function x(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const t=n instanceof URL?n.toString():n;return await Promise.resolve({path:t,rid:null,async next(){const o=new TextDecoder(e?.encoding??"utf-8");if(this.rid===null){const l=o.encoding;this.rid=await i("plugin:fs|read_text_file_lines",{path:t,options:e!=null?{...e,encoding:l}:void 0})}let r;try{r=await i("plugin:fs|read_text_file_lines_next",{rid:this.rid})}catch(l){throw this.rid=null,l}const s=r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r),f=s[s.byteLength-1]===1;return f?(this.rid=null,{value:null,done:f}):{value:o.decode(s.slice(0,s.byteLength-1)),done:f}},async return(){if(this.rid!==null){const o=this.rid;this.rid=null,await new a(o).close()}return{value:null,done:!0}},[Symbol.asyncIterator](){return this}})}async function v(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|remove",{path:n instanceof URL?n.toString():n,options:e})}async function M(n,e,t){if(n instanceof URL&&n.protocol!=="file:"||e instanceof URL&&e.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|rename",{oldPath:n instanceof URL?n.toString():n,newPath:e instanceof URL?e.toString():e,options:t})}async function C(n,e){const t=await i("plugin:fs|stat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function k(n,e){const t=await i("plugin:fs|lstat",{path:n instanceof URL?n.toString():n,options:e});return u(t)}async function F(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|truncate",{path:n instanceof URL?n.toString():n,len:e,options:t})}async function z(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");if(e instanceof ReadableStream){const o=await p(n,{read:!1,create:!0,write:!0,...t,truncate:!t?.append}),r=e.getReader();try{for(;;){const{done:s,value:f}=await r.read();if(s)break;await o.write(f)}}finally{r.releaseLock(),await o.close()}}else await i("plugin:fs|write_file",e,{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function I(n,e,t){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");const o=new TextEncoder;await i("plugin:fs|write_text_file",o.encode(e),{headers:{path:encodeURIComponent(n instanceof URL?n.toString():n),options:JSON.stringify(t)}})}async function H(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|exists",{path:n instanceof URL?n.toString():n,options:e})}class y extends a{}async function L(n,e,t){const o=Array.isArray(n)?n:[n];for(const c of o)if(c instanceof URL&&c.protocol!=="file:")throw new TypeError("Must be a file URL.");const r=new R;r.onmessage=e;const s=await i("plugin:fs|watch",{paths:o.map(c=>c instanceof URL?c.toString():c),options:t,onEvent:r}),f=new y(s);return()=>{f.close()}}async function J(n,e,t){return await L(n,e,{delayMs:2e3,...t})}async function N(n,e,t){return await L(n,e,{...t,delayMs:void 0})}async function O(n,e){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");return await i("plugin:fs|size",{path:n instanceof URL?n.toString():n,options:e})}async function V(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|start_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}async function h(n){if(n instanceof URL&&n.protocol!=="file:")throw new TypeError("Must be a file URL.");await i("plugin:fs|stop_accessing_security_scoped_resource",{path:n instanceof URL?n.toString():n})}export{w as BaseDirectory,g as FileHandle,d as SeekMode,S as copyFile,b as create,H as exists,k as lstat,A as mkdir,p as open,T as readDir,E as readFile,_ as readTextFile,x as readTextFileLines,v as remove,M as rename,O as size,V as startAccessingSecurityScopedResource,C as stat,h as stopAccessingSecurityScopedResource,F as truncate,J as watch,N as watchImmediate,z as writeFile,I as writeTextFile};
|