@agimon-ai/po-db 0.0.0-alpha.184 → 0.0.0-alpha.186
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/{contracts-m_PYAv--.cjs → contracts-Btp6Acaa.cjs} +3 -3
- package/dist/contracts-Btp6Acaa.cjs.map +1 -0
- package/dist/{contracts-CB0CFhPN.mjs → contracts-DmnRUGBy.mjs} +3 -3
- package/dist/contracts-DmnRUGBy.mjs.map +1 -0
- package/dist/extensions/server.cjs +3 -3
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +3 -3
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +4 -4
- package/dist/contracts-CB0CFhPN.mjs.map +0 -1
- package/dist/contracts-m_PYAv--.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_poDb = require("./poDb-BSWMYd_x.cjs");
|
|
2
2
|
//#region src/schemas/contracts.ts
|
|
3
|
-
/** Bound once at the
|
|
3
|
+
/** Bound once at the host level; every workspace and session resolves the same connection. */
|
|
4
4
|
const PO_DB_CONTRACT = (0, require("@agimon-ai/po-core/extensionFile").defineServiceContract)(require_poDb.PO_DB_SERVICE, { scope: "host" });
|
|
5
|
-
/** The shared database, for a caller that injected `po/db`; throws when no
|
|
5
|
+
/** The shared database, for a caller that injected `po/db`; throws when no host root bound one. */
|
|
6
6
|
function requirePoDb(context) {
|
|
7
7
|
const db = context.get(require_poDb.PO_DB_SERVICE);
|
|
8
8
|
if (db === void 0) throw new Error("The Po database is unavailable. Install @agimon-ai/po-db at the global scope.");
|
|
@@ -22,4 +22,4 @@ Object.defineProperty(exports, "requirePoDb", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
//# sourceMappingURL=contracts-
|
|
25
|
+
//# sourceMappingURL=contracts-Btp6Acaa.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-Btp6Acaa.cjs","names":["defineServiceContract","PO_DB_SERVICE"],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PO_DB_SERVICE } from '../constants/db';\nimport type { PoDb } from '../services/poDb/type';\n\n/** Bound once at the host level; every workspace and session resolves the same connection. */\nexport const PO_DB_CONTRACT = defineServiceContract<PoDb>(PO_DB_SERVICE, { scope: 'host' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/db': PoDb;\n }\n}\n\n/** The shared database, for a caller that injected `po/db`; throws when no host root bound one. */\nexport function requirePoDb(context: Context): PoDb {\n const db = context.get(PO_DB_SERVICE) as PoDb | undefined;\n if (db === undefined)\n throw new Error('The Po database is unavailable. Install @agimon-ai/po-db at the global scope.');\n return db;\n}\n"],"mappings":";;;AAOA,MAAa,kBAAA,G,0CAAiBA,CAAAA,CAAAA,sBAAAA,CAA4BC,aAAAA,eAAe,EAAE,OAAO,OAAO,CAAC;;AAS1F,SAAgB,YAAY,SAAwB;CAClD,MAAM,KAAK,QAAQ,IAAIA,aAAAA,aAAa;CACpC,IAAI,OAAO,KAAA,GACT,MAAM,IAAI,MAAM,+EAA+E;CACjG,OAAO;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as PO_DB_SERVICE } from "./poDb-iHdPDH6l.mjs";
|
|
2
2
|
import { defineServiceContract } from "@agimon-ai/po-core/extensionFile";
|
|
3
3
|
//#region src/schemas/contracts.ts
|
|
4
|
-
/** Bound once at the
|
|
4
|
+
/** Bound once at the host level; every workspace and session resolves the same connection. */
|
|
5
5
|
const PO_DB_CONTRACT = defineServiceContract(PO_DB_SERVICE, { scope: "host" });
|
|
6
|
-
/** The shared database, for a caller that injected `po/db`; throws when no
|
|
6
|
+
/** The shared database, for a caller that injected `po/db`; throws when no host root bound one. */
|
|
7
7
|
function requirePoDb(context) {
|
|
8
8
|
const db = context.get(PO_DB_SERVICE);
|
|
9
9
|
if (db === void 0) throw new Error("The Po database is unavailable. Install @agimon-ai/po-db at the global scope.");
|
|
@@ -12,4 +12,4 @@ function requirePoDb(context) {
|
|
|
12
12
|
//#endregion
|
|
13
13
|
export { requirePoDb as n, PO_DB_CONTRACT as t };
|
|
14
14
|
|
|
15
|
-
//# sourceMappingURL=contracts-
|
|
15
|
+
//# sourceMappingURL=contracts-DmnRUGBy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts-DmnRUGBy.mjs","names":[],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PO_DB_SERVICE } from '../constants/db';\nimport type { PoDb } from '../services/poDb/type';\n\n/** Bound once at the host level; every workspace and session resolves the same connection. */\nexport const PO_DB_CONTRACT = defineServiceContract<PoDb>(PO_DB_SERVICE, { scope: 'host' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/db': PoDb;\n }\n}\n\n/** The shared database, for a caller that injected `po/db`; throws when no host root bound one. */\nexport function requirePoDb(context: Context): PoDb {\n const db = context.get(PO_DB_SERVICE) as PoDb | undefined;\n if (db === undefined)\n throw new Error('The Po database is unavailable. Install @agimon-ai/po-db at the global scope.');\n return db;\n}\n"],"mappings":";;;;AAOA,MAAa,iBAAiB,sBAA4B,eAAe,EAAE,OAAO,OAAO,CAAC;;AAS1F,SAAgB,YAAY,SAAwB;CAClD,MAAM,KAAK,QAAQ,IAAI,aAAa;CACpC,IAAI,OAAO,KAAA,GACT,MAAM,IAAI,MAAM,+EAA+E;CACjG,OAAO;AACT"}
|
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
27
|
const require_poDb = require("../poDb-BSWMYd_x.cjs");
|
|
28
|
-
const require_contracts = require("../contracts-
|
|
28
|
+
const require_contracts = require("../contracts-Btp6Acaa.cjs");
|
|
29
29
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
30
30
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
31
31
|
let node_path = require("node:path");
|
|
@@ -34,9 +34,9 @@ let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
|
|
|
34
34
|
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
35
35
|
//#region src/extensions/(backend)/_lib/root.server.ts
|
|
36
36
|
/**
|
|
37
|
-
* The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the
|
|
37
|
+
* The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the host level.
|
|
38
38
|
*
|
|
39
|
-
* Only a
|
|
39
|
+
* Only a host with a home directory opens it. Workspaces and sessions resolve the host
|
|
40
40
|
* binding through the server scope, so the process keeps a single connection: a second
|
|
41
41
|
* connection would block the event loop while it waits on the first one's write lock.
|
|
42
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["PO_SERVER_SCOPE_SERVICE","PO_FS_SERVICE","PO_SQLITE_SERVICE","path","poHomeDirectory","PO_DB_FILE","requirePoFs","BACKGROUND_CONTEXT","nodeHost","requirePoSqlite","createPoDb","requirePoServerScope","PO_DB_CONTRACT","defineRoot","defineServerPlugin","composeServerProviderOverrides","rootHost","composeRootInjects","composeRootHooks"],"sources":["../../src/extensions/(backend)/_lib/root.server.ts","../../src/extensions/(backend)/root.server.ts","../../generated/server.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { RootDeclaration } from '@agimon-ai/po-core/extensionFile';\nimport { poHomeDirectory } from '@agimon-ai/po-core/piSettings';\nimport {\n BACKGROUND_CONTEXT,\n getOrThrow,\n nodeHost,\n PO_FS_SERVICE,\n PO_SQLITE_SERVICE,\n requirePoFs,\n requirePoSqlite,\n} from '@agimon-ai/po-core/platform';\nimport {\n PO_SERVER_SCOPE_SERVICE,\n requirePoServerScope,\n type PoServerPluginContext,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport { PO_DB_DIRECTORY_MODE, PO_DB_FILE } from '../../../constants/db';\nimport { PO_DB_CONTRACT } from '../../../schemas/contracts';\nimport { createPoDb } from '../../../services/poDb';\nimport type { PoDbHandle } from '../../../services/poDb/type';\n\n/**\n * The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the
|
|
1
|
+
{"version":3,"file":"server.cjs","names":["PO_SERVER_SCOPE_SERVICE","PO_FS_SERVICE","PO_SQLITE_SERVICE","path","poHomeDirectory","PO_DB_FILE","requirePoFs","BACKGROUND_CONTEXT","nodeHost","requirePoSqlite","createPoDb","requirePoServerScope","PO_DB_CONTRACT","defineRoot","defineServerPlugin","composeServerProviderOverrides","rootHost","composeRootInjects","composeRootHooks"],"sources":["../../src/extensions/(backend)/_lib/root.server.ts","../../src/extensions/(backend)/root.server.ts","../../generated/server.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { RootDeclaration } from '@agimon-ai/po-core/extensionFile';\nimport { poHomeDirectory } from '@agimon-ai/po-core/piSettings';\nimport {\n BACKGROUND_CONTEXT,\n getOrThrow,\n nodeHost,\n PO_FS_SERVICE,\n PO_SQLITE_SERVICE,\n requirePoFs,\n requirePoSqlite,\n} from '@agimon-ai/po-core/platform';\nimport {\n PO_SERVER_SCOPE_SERVICE,\n requirePoServerScope,\n type PoServerPluginContext,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport { PO_DB_DIRECTORY_MODE, PO_DB_FILE } from '../../../constants/db';\nimport { PO_DB_CONTRACT } from '../../../schemas/contracts';\nimport { createPoDb } from '../../../services/poDb';\nimport type { PoDbHandle } from '../../../services/poDb/type';\n\n/**\n * The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the host level.\n *\n * Only a host with a home directory opens it. Workspaces and sessions resolve the host\n * binding through the server scope, so the process keeps a single connection: a second\n * connection would block the event loop while it waits on the first one's write lock.\n */\nexport async function createPoDbGlobalRoot(\n plugin: PoServerPluginContext,\n): Promise<RootDeclaration<PoDbHandle | undefined, PoServerPluginContext>> {\n const host = plugin.host;\n const homeDirectory = host.context.homeDirectory;\n if (host.scope !== 'host' || homeDirectory === undefined) return { value: undefined };\n let handle: PoDbHandle | undefined;\n const provider = plugin.context.inject(\n [PO_SERVER_SCOPE_SERVICE, PO_FS_SERVICE, PO_SQLITE_SERVICE],\n async (injected) => {\n // The handle owns its file for the life of the mount; a re-run of this fiber only publishes it again.\n if (handle === undefined) {\n const directory = path.join(poHomeDirectory(homeDirectory, host.context.environment ?? {}), PO_DB_FILE[0]);\n getOrThrow(await requirePoFs(injected).createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));\n await nodeHost.setMode(directory, PO_DB_DIRECTORY_MODE);\n const database = await requirePoSqlite(injected).open(path.join(directory, PO_DB_FILE[1]), BACKGROUND_CONTEXT);\n handle = createPoDb({ database });\n }\n return requirePoServerScope(injected).provide(PO_DB_CONTRACT, handle);\n },\n );\n await provider.await();\n return {\n value: handle,\n onDispose: async () => {\n await provider.dispose();\n await handle?.close();\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\n\nimport { createPoDbGlobalRoot } from './_lib/root.server';\n\nexport default defineRoot(createPoDbGlobalRoot);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootHost from '../src/extensions/(backend)/root.server';\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-db',\n providerOverrides: composeServerProviderOverrides(rootHost),\n injects: composeRootInjects({ host: [rootHost], workspace: [rootHost], session: [rootHost] }),\n host: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeHost.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAsB,qBACpB,QACyE;CACzE,MAAM,OAAO,OAAO;CACpB,MAAM,gBAAgB,KAAK,QAAQ;CACnC,IAAI,KAAK,UAAU,UAAU,kBAAkB,KAAA,GAAW,OAAO,EAAE,OAAO,KAAA,EAAU;CACpF,IAAI;CACJ,MAAM,WAAW,OAAO,QAAQ,OAC9B;EAACA,gCAAAA;EAAyBC,4BAAAA;EAAeC,4BAAAA;CAAiB,GAC1D,OAAO,aAAa;EAElB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,YAAYC,UAAAA,QAAK,MAAA,GAAKC,8BAAAA,gBAAAA,CAAgB,eAAe,KAAK,QAAQ,eAAe,CAAC,CAAC,GAAGC,aAAAA,WAAW,EAAE;GACzG,CAAA,GAAA,4BAAA,WAAA,CAAW,OAAA,GAAMC,4BAAAA,YAAAA,CAAY,QAAQ,CAAC,CAAC,UAAU,WAAW,EAAE,WAAW,KAAK,GAAGC,4BAAAA,kBAAkB,CAAC;GACpG,MAAMC,4BAAAA,SAAS,QAAQ,WAAA,GAA+B;GACtD,MAAM,WAAW,OAAA,GAAMC,4BAAAA,gBAAAA,CAAgB,QAAQ,CAAC,CAAC,KAAKN,UAAAA,QAAK,KAAK,WAAWE,aAAAA,WAAW,EAAE,GAAGE,4BAAAA,kBAAkB;GAC7G,SAASG,aAAAA,WAAW,EAAE,SAAS,CAAC;EAClC;EACA,QAAA,GAAOC,gCAAAA,qBAAAA,CAAqB,QAAQ,CAAC,CAAC,QAAQC,kBAAAA,gBAAgB,MAAM;CACtE,CACF;CACA,MAAM,SAAS,MAAM;CACrB,OAAO;EACL,OAAO;EACP,WAAW,YAAY;GACrB,MAAM,SAAS,QAAQ;GACvB,MAAM,QAAQ,MAAM;EACtB;CACF;AACF;;;ACxDA,IAAA,uBAAA,GAAeC,iCAAAA,WAAAA,CAAW,oBAAoB;;;ACG9C,MAAa,gBAAA,GAAeC,gCAAAA,mBAAAA,CAAmB;CAC7C,MAAM;CACN,oBAAA,GAAmBC,gCAAAA,+BAAAA,CAA+BC,mBAAQ;CAC1D,UAAA,GAASC,iCAAAA,mBAAAA,CAAmB;EAAE,MAAM,CAACD,mBAAQ;EAAG,WAAW,CAACA,mBAAQ;EAAG,SAAS,CAACA,mBAAQ;CAAE,CAAC;CAC5F,MAAM,OAAO,YAAY;EACvB,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQA,qBAAU,OAAO;EACnE,OAAO;GACL,IAAA,GAAGE,iCAAAA,iBAAAA,CAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;EAC1C;CACF;CACA,WAAW,OAAO,YAAY;EAC5B,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQF,qBAAU,OAAO;EACnE,OAAO;GACL,IAAA,GAAGE,iCAAAA,iBAAAA,CAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;EAC1C;CACF;CACA,SAAS,OAAO,YAAY;EAC1B,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQF,qBAAU,OAAO;EACnE,OAAO;GACL,IAAA,GAAGE,iCAAAA,iBAAAA,CAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;GACxC,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,UAAU,cAAc,CAAC,CAAE;GAAG;EACpG;CACF;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as PO_DB_FILE, t as createPoDb } from "../poDb-iHdPDH6l.mjs";
|
|
2
|
-
import { t as PO_DB_CONTRACT } from "../contracts-
|
|
2
|
+
import { t as PO_DB_CONTRACT } from "../contracts-DmnRUGBy.mjs";
|
|
3
3
|
import { composeRootHooks, composeRootInjects, defineRoot } from "@agimon-ai/po-core/extensionFile";
|
|
4
4
|
import { PO_SERVER_SCOPE_SERVICE, composeServerProviderOverrides, defineServerPlugin, requirePoServerScope } from "@agimon-ai/po-core/serverPlugin";
|
|
5
5
|
import path from "node:path";
|
|
@@ -7,9 +7,9 @@ import { poHomeDirectory } from "@agimon-ai/po-core/piSettings";
|
|
|
7
7
|
import { BACKGROUND_CONTEXT, PO_FS_SERVICE, PO_SQLITE_SERVICE, getOrThrow, nodeHost, requirePoFs, requirePoSqlite } from "@agimon-ai/po-core/platform";
|
|
8
8
|
//#region src/extensions/(backend)/_lib/root.server.ts
|
|
9
9
|
/**
|
|
10
|
-
* The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the
|
|
10
|
+
* The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the host level.
|
|
11
11
|
*
|
|
12
|
-
* Only a
|
|
12
|
+
* Only a host with a home directory opens it. Workspaces and sessions resolve the host
|
|
13
13
|
* binding through the server scope, so the process keeps a single connection: a second
|
|
14
14
|
* connection would block the event loop while it waits on the first one's write lock.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","names":["rootHost"],"sources":["../../src/extensions/(backend)/_lib/root.server.ts","../../src/extensions/(backend)/root.server.ts","../../generated/server.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { RootDeclaration } from '@agimon-ai/po-core/extensionFile';\nimport { poHomeDirectory } from '@agimon-ai/po-core/piSettings';\nimport {\n BACKGROUND_CONTEXT,\n getOrThrow,\n nodeHost,\n PO_FS_SERVICE,\n PO_SQLITE_SERVICE,\n requirePoFs,\n requirePoSqlite,\n} from '@agimon-ai/po-core/platform';\nimport {\n PO_SERVER_SCOPE_SERVICE,\n requirePoServerScope,\n type PoServerPluginContext,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport { PO_DB_DIRECTORY_MODE, PO_DB_FILE } from '../../../constants/db';\nimport { PO_DB_CONTRACT } from '../../../schemas/contracts';\nimport { createPoDb } from '../../../services/poDb';\nimport type { PoDbHandle } from '../../../services/poDb/type';\n\n/**\n * The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the
|
|
1
|
+
{"version":3,"file":"server.mjs","names":["rootHost"],"sources":["../../src/extensions/(backend)/_lib/root.server.ts","../../src/extensions/(backend)/root.server.ts","../../generated/server.ts"],"sourcesContent":["import path from 'node:path';\n\nimport type { RootDeclaration } from '@agimon-ai/po-core/extensionFile';\nimport { poHomeDirectory } from '@agimon-ai/po-core/piSettings';\nimport {\n BACKGROUND_CONTEXT,\n getOrThrow,\n nodeHost,\n PO_FS_SERVICE,\n PO_SQLITE_SERVICE,\n requirePoFs,\n requirePoSqlite,\n} from '@agimon-ai/po-core/platform';\nimport {\n PO_SERVER_SCOPE_SERVICE,\n requirePoServerScope,\n type PoServerPluginContext,\n} from '@agimon-ai/po-core/serverPlugin';\n\nimport { PO_DB_DIRECTORY_MODE, PO_DB_FILE } from '../../../constants/db';\nimport { PO_DB_CONTRACT } from '../../../schemas/contracts';\nimport { createPoDb } from '../../../services/poDb';\nimport type { PoDbHandle } from '../../../services/poDb/type';\n\n/**\n * The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the host level.\n *\n * Only a host with a home directory opens it. Workspaces and sessions resolve the host\n * binding through the server scope, so the process keeps a single connection: a second\n * connection would block the event loop while it waits on the first one's write lock.\n */\nexport async function createPoDbGlobalRoot(\n plugin: PoServerPluginContext,\n): Promise<RootDeclaration<PoDbHandle | undefined, PoServerPluginContext>> {\n const host = plugin.host;\n const homeDirectory = host.context.homeDirectory;\n if (host.scope !== 'host' || homeDirectory === undefined) return { value: undefined };\n let handle: PoDbHandle | undefined;\n const provider = plugin.context.inject(\n [PO_SERVER_SCOPE_SERVICE, PO_FS_SERVICE, PO_SQLITE_SERVICE],\n async (injected) => {\n // The handle owns its file for the life of the mount; a re-run of this fiber only publishes it again.\n if (handle === undefined) {\n const directory = path.join(poHomeDirectory(homeDirectory, host.context.environment ?? {}), PO_DB_FILE[0]);\n getOrThrow(await requirePoFs(injected).createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));\n await nodeHost.setMode(directory, PO_DB_DIRECTORY_MODE);\n const database = await requirePoSqlite(injected).open(path.join(directory, PO_DB_FILE[1]), BACKGROUND_CONTEXT);\n handle = createPoDb({ database });\n }\n return requirePoServerScope(injected).provide(PO_DB_CONTRACT, handle);\n },\n );\n await provider.await();\n return {\n value: handle,\n onDispose: async () => {\n await provider.dispose();\n await handle?.close();\n },\n };\n}\n","import { defineRoot } from '@agimon-ai/po-core/extensionFile';\n\nimport { createPoDbGlobalRoot } from './_lib/root.server';\n\nexport default defineRoot(createPoDbGlobalRoot);\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineServerPlugin, type PoServerSessionPlugin } from '@agimon-ai/po-core/serverPlugin';\nimport { composeServerProviderOverrides } from '@agimon-ai/po-core/serverPlugin';\nimport { composeRootHooks, composeRootInjects } from '@agimon-ai/po-core/extensionFile';\n\nimport rootHost from '../src/extensions/(backend)/root.server';\n\nexport const serverPlugin = defineServerPlugin({\n name: '@agimon-ai/po-db',\n providerOverrides: composeServerProviderOverrides(rootHost),\n injects: composeRootInjects({ host: [rootHost], workspace: [rootHost], session: [rootHost] }),\n host: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n };\n },\n workspace: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n };\n },\n session: async (context) => {\n const scopeHost = await context.scopeRoot('host', rootHost, context);\n return {\n ...composeRootHooks(scopeHost),\n services: [...(scopeHost.services ?? [])],\n get activities(): PoServerSessionPlugin['activities'] { return [...(scopeHost.activities ?? [])]; },\n };\n },\n});\n\nexport default serverPlugin;\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,eAAsB,qBACpB,QACyE;CACzE,MAAM,OAAO,OAAO;CACpB,MAAM,gBAAgB,KAAK,QAAQ;CACnC,IAAI,KAAK,UAAU,UAAU,kBAAkB,KAAA,GAAW,OAAO,EAAE,OAAO,KAAA,EAAU;CACpF,IAAI;CACJ,MAAM,WAAW,OAAO,QAAQ,OAC9B;EAAC;EAAyB;EAAe;CAAiB,GAC1D,OAAO,aAAa;EAElB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,YAAY,KAAK,KAAK,gBAAgB,eAAe,KAAK,QAAQ,eAAe,CAAC,CAAC,GAAG,WAAW,EAAE;GACzG,WAAW,MAAM,YAAY,QAAQ,CAAC,CAAC,UAAU,WAAW,EAAE,WAAW,KAAK,GAAG,kBAAkB,CAAC;GACpG,MAAM,SAAS,QAAQ,WAAA,GAA+B;GACtD,MAAM,WAAW,MAAM,gBAAgB,QAAQ,CAAC,CAAC,KAAK,KAAK,KAAK,WAAW,WAAW,EAAE,GAAG,kBAAkB;GAC7G,SAAS,WAAW,EAAE,SAAS,CAAC;EAClC;EACA,OAAO,qBAAqB,QAAQ,CAAC,CAAC,QAAQ,gBAAgB,MAAM;CACtE,CACF;CACA,MAAM,SAAS,MAAM;CACrB,OAAO;EACL,OAAO;EACP,WAAW,YAAY;GACrB,MAAM,SAAS,QAAQ;GACvB,MAAM,QAAQ,MAAM;EACtB;CACF;AACF;;;ACxDA,IAAA,sBAAe,WAAW,oBAAoB;;;ACG9C,MAAa,eAAe,mBAAmB;CAC7C,MAAM;CACN,mBAAmB,+BAA+BA,mBAAQ;CAC1D,SAAS,mBAAmB;EAAE,MAAM,CAACA,mBAAQ;EAAG,WAAW,CAACA,mBAAQ;EAAG,SAAS,CAACA,mBAAQ;CAAE,CAAC;CAC5F,MAAM,OAAO,YAAY;EACvB,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQA,qBAAU,OAAO;EACnE,OAAO;GACL,GAAG,iBAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;EAC1C;CACF;CACA,WAAW,OAAO,YAAY;EAC5B,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQA,qBAAU,OAAO;EACnE,OAAO;GACL,GAAG,iBAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;EAC1C;CACF;CACA,SAAS,OAAO,YAAY;EAC1B,MAAM,YAAY,MAAM,QAAQ,UAAU,QAAQA,qBAAU,OAAO;EACnE,OAAO;GACL,GAAG,iBAAiB,SAAS;GAC7B,UAAU,CAAC,GAAI,UAAU,YAAY,CAAC,CAAE;GACxC,IAAI,aAAkD;IAAE,OAAO,CAAC,GAAI,UAAU,cAAc,CAAC,CAAE;GAAG;EACpG;CACF;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_poDb = require("./poDb-BSWMYd_x.cjs");
|
|
3
|
-
const require_contracts = require("./contracts-
|
|
3
|
+
const require_contracts = require("./contracts-Btp6Acaa.cjs");
|
|
4
4
|
exports.PO_DB_CONTRACT = require_contracts.PO_DB_CONTRACT;
|
|
5
5
|
exports.PO_DB_FILE = require_poDb.PO_DB_FILE;
|
|
6
6
|
exports.PO_DB_SERVICE = require_poDb.PO_DB_SERVICE;
|
package/dist/index.d.mts
CHANGED
|
@@ -6,14 +6,14 @@ export declare const PO_DB_SERVICE = "po/db";
|
|
|
6
6
|
export declare const PO_DB_FILE: readonly ['db', 'po.sqlite'];
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/schemas/contracts.d.ts
|
|
9
|
-
/** Bound once at the
|
|
9
|
+
/** Bound once at the host level; every workspace and session resolves the same connection. */
|
|
10
10
|
export declare const PO_DB_CONTRACT: import("@agimon-ai/po-core/serverPlugin").PoServiceContract<PoDb>;
|
|
11
11
|
declare module '@deepseek-ai/cordis' {
|
|
12
12
|
interface Context {
|
|
13
13
|
'po/db': PoDb;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
/** The shared database, for a caller that injected `po/db`; throws when no
|
|
16
|
+
/** The shared database, for a caller that injected `po/db`; throws when no host root bound one. */
|
|
17
17
|
export declare function requirePoDb(context: Context): PoDb;
|
|
18
18
|
//#endregion
|
|
19
19
|
//#region src/services/poDb/index.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as PO_DB_FILE, r as PO_DB_SERVICE, t as createPoDb } from "./poDb-iHdPDH6l.mjs";
|
|
2
|
-
import { n as requirePoDb, t as PO_DB_CONTRACT } from "./contracts-
|
|
2
|
+
import { n as requirePoDb, t as PO_DB_CONTRACT } from "./contracts-DmnRUGBy.mjs";
|
|
3
3
|
export { PO_DB_CONTRACT, PO_DB_FILE, PO_DB_SERVICE, createPoDb, requirePoDb };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","generated/server.ts","llms.txt","package.json","src/constants/db.ts","src/exports/apiContracts.ts","src/exports/index.ts","src/exports/testing.ts","src/extensions/(backend)/_lib/root.server.ts","src/extensions/(backend)/root.server.ts","src/schemas/apiContracts.ts","src/schemas/contracts.ts","src/services/poDb/index.ts","src/services/poDb/type.ts","src/services/testPoDb/index.ts","tsdown.config.ts"],"sourceRevision":"
|
|
1
|
+
{"version":1,"platformRequirements":{},"sourceFiles":["LICENSE","README.md","generated/server.ts","llms.txt","package.json","src/constants/db.ts","src/exports/apiContracts.ts","src/exports/index.ts","src/exports/testing.ts","src/extensions/(backend)/_lib/root.server.ts","src/extensions/(backend)/root.server.ts","src/schemas/apiContracts.ts","src/schemas/contracts.ts","src/services/poDb/index.ts","src/services/poDb/type.ts","src/services/testPoDb/index.ts","tsdown.config.ts"],"sourceRevision":"125f3fb298a59d60925bba5fb9bd7ead","manifestRevision":"988c78167c8f92fd0e50c72cc09a992b","outputFiles":["LICENSE","README.md","dist/apiContracts.cjs","dist/apiContracts.mjs","dist/contracts-Btp6Acaa.cjs","dist/contracts-DmnRUGBy.mjs","dist/extensions/server.cjs","dist/extensions/server.mjs","dist/index.cjs","dist/index.mjs","dist/poDb-BSWMYd_x.cjs","dist/poDb-iHdPDH6l.mjs","dist/testing.cjs","dist/testing.mjs","llms.txt"],"outputRevision":"16ddcda2d7a3f7cb82354e8bc2ef221a"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-db",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.186",
|
|
4
4
|
"description": "One shared sqlite database for the Po packages that need one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
64
|
+
"@agimon-ai/po-core": "0.0.0-alpha.186",
|
|
65
65
|
"@deepseek-ai/cordis": "4.0.5",
|
|
66
66
|
"@earendil-works/chord": "1.5.2"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
70
|
-
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.
|
|
69
|
+
"@agimon-ai/po-build": "0.0.0-alpha.186",
|
|
70
|
+
"@agimon-ai/vibe-lint-plugin-po-extension": "0.0.0-alpha.186",
|
|
71
71
|
"@types/node": "26.6.5",
|
|
72
72
|
"@vitest/coverage-v8": "5.0.4",
|
|
73
73
|
"tsdown": "0.23.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts-CB0CFhPN.mjs","names":[],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PO_DB_SERVICE } from '../constants/db';\nimport type { PoDb } from '../services/poDb/type';\n\n/** Bound once at the global level; every workspace and session resolves the same connection. */\nexport const PO_DB_CONTRACT = defineServiceContract<PoDb>(PO_DB_SERVICE, { scope: 'host' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/db': PoDb;\n }\n}\n\n/** The shared database, for a caller that injected `po/db`; throws when no global root bound one. */\nexport function requirePoDb(context: Context): PoDb {\n const db = context.get(PO_DB_SERVICE) as PoDb | undefined;\n if (db === undefined)\n throw new Error('The Po database is unavailable. Install @agimon-ai/po-db at the global scope.');\n return db;\n}\n"],"mappings":";;;;AAOA,MAAa,iBAAiB,sBAA4B,eAAe,EAAE,OAAO,OAAO,CAAC;;AAS1F,SAAgB,YAAY,SAAwB;CAClD,MAAM,KAAK,QAAQ,IAAI,aAAa;CACpC,IAAI,OAAO,KAAA,GACT,MAAM,IAAI,MAAM,+EAA+E;CACjG,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts-m_PYAv--.cjs","names":["defineServiceContract","PO_DB_SERVICE"],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\nimport type { Context } from '@deepseek-ai/cordis';\n\nimport { PO_DB_SERVICE } from '../constants/db';\nimport type { PoDb } from '../services/poDb/type';\n\n/** Bound once at the global level; every workspace and session resolves the same connection. */\nexport const PO_DB_CONTRACT = defineServiceContract<PoDb>(PO_DB_SERVICE, { scope: 'host' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/db': PoDb;\n }\n}\n\n/** The shared database, for a caller that injected `po/db`; throws when no global root bound one. */\nexport function requirePoDb(context: Context): PoDb {\n const db = context.get(PO_DB_SERVICE) as PoDb | undefined;\n if (db === undefined)\n throw new Error('The Po database is unavailable. Install @agimon-ai/po-db at the global scope.');\n return db;\n}\n"],"mappings":";;;AAOA,MAAa,kBAAA,G,0CAAiBA,CAAAA,CAAAA,sBAAAA,CAA4BC,aAAAA,eAAe,EAAE,OAAO,OAAO,CAAC;;AAS1F,SAAgB,YAAY,SAAwB;CAClD,MAAM,KAAK,QAAQ,IAAIA,aAAAA,aAAa;CACpC,IAAI,OAAO,KAAA,GACT,MAAM,IAAI,MAAM,+EAA+E;CACjG,OAAO;AACT"}
|