@tekmidian/pai 0.12.0 → 0.12.2
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/cli/index.mjs +2 -2
- package/dist/cli/program.mjs +2 -2
- package/dist/daemon/index.mjs +3 -3
- package/dist/{daemon-DDplhnm9.mjs → daemon-Ca7YXHUW.mjs} +17 -17
- package/dist/{daemon-DDplhnm9.mjs.map → daemon-Ca7YXHUW.mjs.map} +1 -1
- package/dist/factory-Q88X1bAN.mjs +69 -0
- package/dist/factory-Q88X1bAN.mjs.map +1 -0
- package/dist/{pick-Dt21ojcW.mjs → pick-C5sUQ5g_.mjs} +27 -11
- package/dist/pick-C5sUQ5g_.mjs.map +1 -0
- package/dist/{work-queue-worker-DHOIVVQ7.mjs → work-queue-worker-0tUMEhSS.mjs} +16 -1
- package/dist/{work-queue-worker-DHOIVVQ7.mjs.map → work-queue-worker-0tUMEhSS.mjs.map} +1 -1
- package/docs/commands/project.md +1 -0
- package/docs/commands/projects.md +1 -0
- package/package.json +1 -1
- package/dist/factory-CayQCMoN.mjs +0 -41
- package/dist/factory-CayQCMoN.mjs.map +0 -1
- package/dist/pick-Dt21ojcW.mjs.map +0 -1
package/docs/commands/project.md
CHANGED
|
@@ -310,6 +310,7 @@ List named projects (your curated shortlist)
|
|
|
310
310
|
| Option | Description | Default |
|
|
311
311
|
|--------|-------------|---------|
|
|
312
312
|
| `--json` | Output JSON for AIBroker consumption | |
|
|
313
|
+
| `--all` | Include ALL active registered projects, not just the named shortlist | |
|
|
313
314
|
|
|
314
315
|
|
|
315
316
|
### pai project config [identifier]
|
|
@@ -310,6 +310,7 @@ List named projects (your curated shortlist)
|
|
|
310
310
|
| Option | Description | Default |
|
|
311
311
|
|--------|-------------|---------|
|
|
312
312
|
| `--json` | Output JSON for AIBroker consumption | |
|
|
313
|
+
| `--all` | Include ALL active registered projects, not just the named shortlist | |
|
|
313
314
|
|
|
314
315
|
|
|
315
316
|
### pai projects config [identifier]
|
package/package.json
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//#region src/storage/factory.ts
|
|
2
|
-
/**
|
|
3
|
-
* Create and return the configured StorageBackend.
|
|
4
|
-
*
|
|
5
|
-
* Auto-fallback behaviour:
|
|
6
|
-
* - storageBackend = "sqlite" → SQLiteBackend always
|
|
7
|
-
* - storageBackend = "postgres" → PostgresBackend if reachable, else SQLiteBackend
|
|
8
|
-
*/
|
|
9
|
-
async function createStorageBackend(config) {
|
|
10
|
-
if (config.storageBackend === "postgres") return await tryPostgres(config);
|
|
11
|
-
return createSQLiteBackend();
|
|
12
|
-
}
|
|
13
|
-
async function tryPostgres(config) {
|
|
14
|
-
try {
|
|
15
|
-
const { PostgresBackend } = await import("./postgres-B451Hnkm.mjs");
|
|
16
|
-
const pgConfig = config.postgres ?? {};
|
|
17
|
-
await PostgresBackend.ensureDatabase(pgConfig);
|
|
18
|
-
const backend = new PostgresBackend(pgConfig);
|
|
19
|
-
const err = await backend.testConnection();
|
|
20
|
-
if (err) {
|
|
21
|
-
process.stderr.write(`[pai-daemon] Postgres unavailable (${err}). Falling back to SQLite.\n`);
|
|
22
|
-
await backend.close();
|
|
23
|
-
return createSQLiteBackend();
|
|
24
|
-
}
|
|
25
|
-
process.stderr.write("[pai-daemon] Connected to PostgreSQL backend.\n");
|
|
26
|
-
return backend;
|
|
27
|
-
} catch (e) {
|
|
28
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
29
|
-
process.stderr.write(`[pai-daemon] Postgres init error (${msg}). Falling back to SQLite.\n`);
|
|
30
|
-
return createSQLiteBackend();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function createSQLiteBackend() {
|
|
34
|
-
const { openFederation } = await import("./db-CmYbAVCD.mjs").then((n) => n.t);
|
|
35
|
-
const { SQLiteBackend } = await import("./sqlite-DQpY1Esi.mjs");
|
|
36
|
-
return new SQLiteBackend(openFederation());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { createStorageBackend as t };
|
|
41
|
-
//# sourceMappingURL=factory-CayQCMoN.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory-CayQCMoN.mjs","names":[],"sources":["../src/storage/factory.ts"],"sourcesContent":["/**\n * Storage backend factory.\n *\n * Reads the daemon config and returns the appropriate StorageBackend.\n * If Postgres is configured but unavailable, falls back to SQLite with\n * a warning log — the daemon never crashes due to a missing Postgres.\n */\n\nimport type { PaiDaemonConfig } from \"../daemon/config.js\";\nimport type { StorageBackend } from \"./interface.js\";\n\n/**\n * Create and return the configured StorageBackend.\n *\n * Auto-fallback behaviour:\n * - storageBackend = \"sqlite\" → SQLiteBackend always\n * - storageBackend = \"postgres\" → PostgresBackend if reachable, else SQLiteBackend\n */\nexport async function createStorageBackend(\n config: PaiDaemonConfig\n): Promise<StorageBackend> {\n if (config.storageBackend === \"postgres\") {\n return await tryPostgres(config);\n }\n\n // Default: SQLite\n return createSQLiteBackend();\n}\n\nasync function tryPostgres(config: PaiDaemonConfig): Promise<StorageBackend> {\n try {\n const { PostgresBackend } = await import(\"./postgres.js\");\n const pgConfig = config.postgres ?? {};\n\n // Ensure the per-user database exists and has the schema applied\n await PostgresBackend.ensureDatabase(pgConfig);\n\n const backend = new PostgresBackend(pgConfig);\n\n const err = await backend.testConnection();\n if (err) {\n process.stderr.write(\n `[pai-daemon] Postgres unavailable (${err}). Falling back to SQLite.\\n`\n );\n await backend.close();\n return createSQLiteBackend();\n }\n\n process.stderr.write(\"[pai-daemon] Connected to PostgreSQL backend.\\n\");\n return backend;\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(\n `[pai-daemon] Postgres init error (${msg}). Falling back to SQLite.\\n`\n );\n return createSQLiteBackend();\n }\n}\n\nasync function createSQLiteBackend(): Promise<StorageBackend> {\n const { openFederation } = await import(\"../memory/db.js\");\n const { SQLiteBackend } = await import(\"./sqlite.js\");\n const db = openFederation();\n return new SQLiteBackend(db);\n}\n"],"mappings":";;;;;;;;AAkBA,eAAsB,qBACpB,QACyB;AACzB,KAAI,OAAO,mBAAmB,WAC5B,QAAO,MAAM,YAAY,OAAO;AAIlC,QAAO,qBAAqB;;AAG9B,eAAe,YAAY,QAAkD;AAC3E,KAAI;EACF,MAAM,EAAE,oBAAoB,MAAM,OAAO;EACzC,MAAM,WAAW,OAAO,YAAY,EAAE;AAGtC,QAAM,gBAAgB,eAAe,SAAS;EAE9C,MAAM,UAAU,IAAI,gBAAgB,SAAS;EAE7C,MAAM,MAAM,MAAM,QAAQ,gBAAgB;AAC1C,MAAI,KAAK;AACP,WAAQ,OAAO,MACb,sCAAsC,IAAI,8BAC3C;AACD,SAAM,QAAQ,OAAO;AACrB,UAAO,qBAAqB;;AAG9B,UAAQ,OAAO,MAAM,kDAAkD;AACvE,SAAO;UACA,GAAG;EACV,MAAM,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,EAAE;AACtD,UAAQ,OAAO,MACb,qCAAqC,IAAI,8BAC1C;AACD,SAAO,qBAAqB;;;AAIhC,eAAe,sBAA+C;CAC5D,MAAM,EAAE,mBAAmB,MAAM,OAAO;CACxC,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,QAAO,IAAI,cADA,gBAAgB,CACC"}
|