@promptbook/cli 0.114.0-29 → 0.114.0-30
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/apps/agents-server/src/app/admin/about/page.tsx +1 -1
- package/apps/agents-server/src/app/page.tsx +1 -1
- package/apps/agents-server/src/constants/federatedAgentImport.ts +7 -0
- package/apps/agents-server/src/middleware/createMiddlewareRequestContext/loadRegisteredServers.ts +8 -0
- package/apps/agents-server/src/tools/$provideServer.ts +2 -1
- package/apps/agents-server/src/tools/mapRegisteredServerContexts.ts +1 -1
- package/apps/agents-server/src/utils/agentProjects/listAllAgentProjectSummaries.ts +2 -1
- package/apps/agents-server/src/utils/createWellKnownAgentUrl.ts +17 -0
- package/apps/agents-server/src/utils/currentServerRegistryContext.ts +2 -1
- package/apps/agents-server/src/utils/customDomainRouting.ts +143 -10
- package/apps/agents-server/src/utils/getFederatedServers.ts +5 -15
- package/apps/agents-server/src/utils/getWellKnownAgentUrl.ts +2 -3
- package/apps/agents-server/src/utils/parseFederatedServers.ts +14 -0
- package/apps/agents-server/src/utils/serverManagement/getManagedServerById.ts +1 -1
- package/apps/agents-server/src/utils/serverManagement/listManagedServers.ts +1 -1
- package/apps/agents-server/src/utils/serverRegistry.ts +0 -24
- package/apps/agents-server/src/utils/serverRegistryNode.ts +27 -0
- package/esm/apps/agents-server/src/constants/federatedAgentImport.d.ts +6 -0
- package/esm/index.es.js +35 -10
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/runners/openai-codex/buildCodexUsageFromOutput.d.ts +4 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +2 -0
- package/src/other/templates/getTemplatesPipelineCollection.ts +750 -853
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/apps/agents-server/src/constants/federatedAgentImport.d.ts +6 -0
- package/umd/index.umd.js +35 -10
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/runners/openai-codex/buildCodexUsageFromOutput.d.ts +4 -1
- package/umd/src/version.d.ts +1 -1
- package/esm/apps/agents-server/src/database/sqlite/$provideAgentsServerSqliteDatabase.d.ts +0 -69
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.d.ts +0 -7
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.d.ts +0 -30
- package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts +0 -76
- package/esm/apps/agents-server/src/database/sqlite/resolveAgentsServerSqliteDatabasePath.d.ts +0 -4
- package/esm/apps/agents-server/src/database/sqlite/resolveServerSqliteDatabasePath.d.ts +0 -28
- package/esm/apps/agents-server/src/database/sqlite/standaloneServerRegistryStore.d.ts +0 -110
- package/umd/apps/agents-server/src/database/sqlite/$provideAgentsServerSqliteDatabase.d.ts +0 -69
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/ensureTable.d.ts +0 -7
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteSql.d.ts +0 -30
- package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts +0 -76
- package/umd/apps/agents-server/src/database/sqlite/resolveAgentsServerSqliteDatabasePath.d.ts +0 -4
- package/umd/apps/agents-server/src/database/sqlite/resolveServerSqliteDatabasePath.d.ts +0 -28
- package/umd/apps/agents-server/src/database/sqlite/standaloneServerRegistryStore.d.ts +0 -110
|
@@ -6,5 +6,8 @@ import type { Usage } from '../../../../src/execution/Usage';
|
|
|
6
6
|
export declare const DEFAULT_CODEX_COMPLETION_SHARE = 0.1;
|
|
7
7
|
/**
|
|
8
8
|
* Builds usage stats from Codex CLI output.
|
|
9
|
+
*
|
|
10
|
+
* The `modelName` is omitted when Codex ran without a model override, in which case only Codex knows which
|
|
11
|
+
* model it picked and the price can be estimated from the fallback pricing alone.
|
|
9
12
|
*/
|
|
10
|
-
export declare function buildCodexUsageFromOutput(output: string, modelName: string): Usage;
|
|
13
|
+
export declare function buildCodexUsageFromOutput(output: string, modelName: string | undefined): Usage;
|
package/umd/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.114.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.114.0-29`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape of the `better-sqlite3` module constructor loaded at runtime.
|
|
3
|
-
*
|
|
4
|
-
* @private internal SQLite utility of Agents Server
|
|
5
|
-
*/
|
|
6
|
-
export type BetterSqliteConstructor = new (path: string) => AgentsServerSqliteDatabase;
|
|
7
|
-
/**
|
|
8
|
-
* Minimal `better-sqlite3` database surface shared by Agents Server SQLite utilities.
|
|
9
|
-
*
|
|
10
|
-
* @private internal SQLite utility of Agents Server
|
|
11
|
-
*/
|
|
12
|
-
export type AgentsServerSqliteDatabase = {
|
|
13
|
-
readonly pragma: (source: string) => unknown;
|
|
14
|
-
readonly exec: (source: string) => void;
|
|
15
|
-
readonly prepare: (source: string) => AgentsServerSqliteStatement;
|
|
16
|
-
readonly transaction: <TArguments extends ReadonlyArray<unknown>, TResult>(fn: (...args: TArguments) => TResult) => (...args: TArguments) => TResult;
|
|
17
|
-
readonly close?: () => void;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Minimal `better-sqlite3` prepared statement surface shared by Agents Server SQLite utilities.
|
|
21
|
-
*
|
|
22
|
-
* @private internal SQLite utility of Agents Server
|
|
23
|
-
*/
|
|
24
|
-
export type AgentsServerSqliteStatement = {
|
|
25
|
-
readonly reader?: boolean;
|
|
26
|
-
readonly all: (...values: ReadonlyArray<unknown>) => Array<Record<string, unknown>>;
|
|
27
|
-
readonly get: (...values: ReadonlyArray<unknown>) => Record<string, unknown> | undefined;
|
|
28
|
-
readonly run: (...values: ReadonlyArray<unknown>) => {
|
|
29
|
-
readonly changes: number;
|
|
30
|
-
readonly lastInsertRowid: number | bigint;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Opens and initializes one SQLite database file, caching the connection per path.
|
|
35
|
-
*
|
|
36
|
-
* @param databasePath - Absolute path of the SQLite database file.
|
|
37
|
-
* @returns Cached SQLite database connection.
|
|
38
|
-
*
|
|
39
|
-
* @private exported from Agents Server SQLite utilities
|
|
40
|
-
*/
|
|
41
|
-
export declare function $provideSqliteDatabaseAtPath(databasePath: string): AgentsServerSqliteDatabase;
|
|
42
|
-
/**
|
|
43
|
-
* Opens the VPS-wide SQLite registry database.
|
|
44
|
-
*
|
|
45
|
-
* This database is owned by the super-admin and holds only VPS-level data,
|
|
46
|
-
* most importantly the `_Server` table listing all servers running on this VPS.
|
|
47
|
-
* Server-scoped data (agents, projects, metadata, users, ...) lives in isolated
|
|
48
|
-
* per-server databases provided by `$provideServerSqliteDatabase`.
|
|
49
|
-
*
|
|
50
|
-
* @returns Shared VPS registry SQLite database connection.
|
|
51
|
-
*
|
|
52
|
-
* @private exported from Agents Server SQLite utilities
|
|
53
|
-
*/
|
|
54
|
-
export declare function $provideVpsRegistrySqliteDatabase(): AgentsServerSqliteDatabase;
|
|
55
|
-
/**
|
|
56
|
-
* Opens the isolated SQLite database of one server namespace.
|
|
57
|
-
*
|
|
58
|
-
* @param tablePrefix - Stable server namespace key, or an empty string for the default server.
|
|
59
|
-
* @returns Per-server SQLite database connection.
|
|
60
|
-
*
|
|
61
|
-
* @private exported from Agents Server SQLite utilities
|
|
62
|
-
*/
|
|
63
|
-
export declare function $provideServerSqliteDatabase(tablePrefix: string): AgentsServerSqliteDatabase;
|
|
64
|
-
/**
|
|
65
|
-
* Closes all cached SQLite connections and resets adapter state for isolated tests.
|
|
66
|
-
*
|
|
67
|
-
* @private exported from Agents Server SQLite utilities
|
|
68
|
-
*/
|
|
69
|
-
export declare function $resetAgentsServerSqliteDatabaseForTests(): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AgentsServerSqliteDatabase } from '../$provideAgentsServerSqliteDatabase';
|
|
2
|
-
/**
|
|
3
|
-
* Ensures a table and all required columns exist.
|
|
4
|
-
*
|
|
5
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
6
|
-
*/
|
|
7
|
-
export declare function ensureTable(database: AgentsServerSqliteDatabase, tableName: string, requiredColumns: ReadonlyArray<string>): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quotes one SQLite identifier.
|
|
3
|
-
*
|
|
4
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
5
|
-
*/
|
|
6
|
-
export declare function quoteIdentifier(identifier: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Creates a safe identifier suffix for generated index names.
|
|
9
|
-
*
|
|
10
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
11
|
-
*/
|
|
12
|
-
export declare function sanitizeSqlIdentifier(identifier: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a select expression from parsed columns.
|
|
15
|
-
*
|
|
16
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
17
|
-
*/
|
|
18
|
-
export declare function createSelectExpression(columns: ReadonlyArray<string>): string;
|
|
19
|
-
/**
|
|
20
|
-
* Parses a simple Supabase select column list.
|
|
21
|
-
*
|
|
22
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
23
|
-
*/
|
|
24
|
-
export declare function parseSelectedColumns(columns: string): Array<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Deduplicates strings while preserving order.
|
|
27
|
-
*
|
|
28
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
29
|
-
*/
|
|
30
|
-
export declare function uniqueStrings(values: ReadonlyArray<string>): Array<string>;
|
package/esm/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { LocalSqliteUpsertOptions } from './localSqliteTypes';
|
|
2
|
-
/**
|
|
3
|
-
* Read index definition for hot SQLite queries.
|
|
4
|
-
*
|
|
5
|
-
* @private type of `$provideLocalSqliteSupabase`
|
|
6
|
-
*/
|
|
7
|
-
export type LocalSqliteReadIndex = {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly columns: ReadonlyArray<string>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Resolves a table base name from the actual prefixed table name.
|
|
13
|
-
*
|
|
14
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
15
|
-
*/
|
|
16
|
-
export declare function resolveTableBaseName(tableName: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Resolves columns participating in known unique indexes.
|
|
19
|
-
*
|
|
20
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveUniqueIndexColumns(tableBaseName: string): Array<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Resolves columns participating in known read indexes.
|
|
25
|
-
*
|
|
26
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveReadIndexColumns(tableBaseName: string): Array<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Resolves upsert conflict columns.
|
|
31
|
-
*
|
|
32
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveUpsertConflictColumns(tableBaseName: string, options: LocalSqliteUpsertOptions): ReadonlyArray<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolves the unique index definitions declared for a table base name.
|
|
37
|
-
*
|
|
38
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolveUniqueIndexes(tableBaseName: string): ReadonlyArray<ReadonlyArray<string>>;
|
|
41
|
-
/**
|
|
42
|
-
* Resolves the read index definitions declared for a table base name.
|
|
43
|
-
*
|
|
44
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveReadIndexes(tableBaseName: string): ReadonlyArray<LocalSqliteReadIndex>;
|
|
47
|
-
/**
|
|
48
|
-
* Resolves whether a column is JSON for a specific table.
|
|
49
|
-
*
|
|
50
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
51
|
-
*/
|
|
52
|
-
export declare function isJsonColumn(tableName: string, column: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Resolves whether a column should be forced to a string for a specific table.
|
|
55
|
-
*
|
|
56
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
57
|
-
*/
|
|
58
|
-
export declare function isTextColumn(tableName: string, column: string): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Resolves whether a column is a boolean stored as an integer.
|
|
61
|
-
*
|
|
62
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
63
|
-
*/
|
|
64
|
-
export declare function isBooleanColumn(column: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Resolves whether a table base name uses a text primary key.
|
|
67
|
-
*
|
|
68
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
69
|
-
*/
|
|
70
|
-
export declare function isTextPrimaryKeyTable(tableBaseName: string): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Resolves SQLite column affinity for dynamically added columns.
|
|
73
|
-
*
|
|
74
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
75
|
-
*/
|
|
76
|
-
export declare function resolveSqliteColumnType(tableBaseName: string, column: string): string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database key used for requests that do not belong to any registered server,
|
|
3
|
-
* for example localhost development traffic before any server is registered.
|
|
4
|
-
*
|
|
5
|
-
* @private internal SQLite utility of Agents Server
|
|
6
|
-
*/
|
|
7
|
-
export declare const DEFAULT_SERVER_SQLITE_DATABASE_KEY = "default";
|
|
8
|
-
/**
|
|
9
|
-
* Resolves the isolated SQLite database file path for one server namespace.
|
|
10
|
-
*
|
|
11
|
-
* Each registered server has its own SQLite database file so servers on one VPS
|
|
12
|
-
* cannot leak agents, projects, metadata or any other data into each other.
|
|
13
|
-
*
|
|
14
|
-
* @param tablePrefix - Stable server namespace key such as `server_ClientA_`, or an empty string for the default server.
|
|
15
|
-
* @returns Absolute path of the per-server SQLite database file.
|
|
16
|
-
*
|
|
17
|
-
* @private internal SQLite utility of Agents Server
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveServerSqliteDatabasePath(tablePrefix: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Converts one server table prefix into a safe database file key.
|
|
22
|
-
*
|
|
23
|
-
* @param tablePrefix - Stable server namespace key, or an empty string for the default server.
|
|
24
|
-
* @returns Validated file-name-safe database key.
|
|
25
|
-
*
|
|
26
|
-
* @private internal SQLite utility of Agents Server
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveServerSqliteDatabaseKey(tablePrefix: string): string;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { type ServerEnvironment, type ServerRecord } from '../../utils/serverRegistry';
|
|
2
|
-
/**
|
|
3
|
-
* Input accepted when registering one new standalone server.
|
|
4
|
-
*/
|
|
5
|
-
export type CreateStandaloneServerInput = {
|
|
6
|
-
/**
|
|
7
|
-
* Human-facing server name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Environment group of the server.
|
|
12
|
-
*/
|
|
13
|
-
readonly environment: ServerEnvironment;
|
|
14
|
-
/**
|
|
15
|
-
* Public domain of the server.
|
|
16
|
-
*/
|
|
17
|
-
readonly domain: string;
|
|
18
|
-
/**
|
|
19
|
-
* Stable namespace key selecting the isolated per-server SQLite database.
|
|
20
|
-
*/
|
|
21
|
-
readonly tablePrefix: string;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Editable fields of one standalone server registration.
|
|
25
|
-
*/
|
|
26
|
-
export type UpdateStandaloneServerInput = {
|
|
27
|
-
/**
|
|
28
|
-
* Replacement public domain.
|
|
29
|
-
*/
|
|
30
|
-
readonly domain?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Replacement human-facing name.
|
|
33
|
-
*/
|
|
34
|
-
readonly name?: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Clears in-process registry caches so following reads hit the registry database.
|
|
38
|
-
*
|
|
39
|
-
* @private exported from the standalone server registry store
|
|
40
|
-
*/
|
|
41
|
-
export declare function invalidateStandaloneServerRegistryCache(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Lists all servers registered in the VPS registry database.
|
|
44
|
-
*
|
|
45
|
-
* Domains configured in the `SERVERS` environment variable that are not yet
|
|
46
|
-
* registered are automatically registered first, so a freshly installed VPS
|
|
47
|
-
* bootstraps its registry from the installer-provided domain list.
|
|
48
|
-
*
|
|
49
|
-
* @returns Registered servers ordered by name.
|
|
50
|
-
*
|
|
51
|
-
* @private exported from the standalone server registry store
|
|
52
|
-
*/
|
|
53
|
-
export declare function listStandaloneRegisteredServers(): Array<ServerRecord>;
|
|
54
|
-
/**
|
|
55
|
-
* Lists the table prefixes of all registered servers using the short-lived cache.
|
|
56
|
-
*
|
|
57
|
-
* Used on the hot per-query path that routes prefixed table names to isolated
|
|
58
|
-
* per-server SQLite database files. Missing `SERVERS` domains are registered
|
|
59
|
-
* first (memoized on the raw environment value), so even standalone CLI
|
|
60
|
-
* processes — for example the installer's default-agent seeding — route into
|
|
61
|
-
* the correct per-server database before the web server ever booted.
|
|
62
|
-
*
|
|
63
|
-
* @returns Known non-empty server table prefixes.
|
|
64
|
-
*
|
|
65
|
-
* @private exported from the standalone server registry store
|
|
66
|
-
*/
|
|
67
|
-
export declare function listStandaloneServerTablePrefixes(): Array<string>;
|
|
68
|
-
/**
|
|
69
|
-
* Finds one registered standalone server by its registry id.
|
|
70
|
-
*
|
|
71
|
-
* @param serverId - Registry row id.
|
|
72
|
-
* @returns Matching server or `null`.
|
|
73
|
-
*
|
|
74
|
-
* @private exported from the standalone server registry store
|
|
75
|
-
*/
|
|
76
|
-
export declare function getStandaloneServerById(serverId: number): ServerRecord | null;
|
|
77
|
-
/**
|
|
78
|
-
* Registers one new standalone server in the VPS registry database.
|
|
79
|
-
*
|
|
80
|
-
* @param input - New server registration values.
|
|
81
|
-
* @returns Created registry row.
|
|
82
|
-
*
|
|
83
|
-
* @private exported from the standalone server registry store
|
|
84
|
-
*/
|
|
85
|
-
export declare function createStandaloneServer(input: CreateStandaloneServerInput): ServerRecord;
|
|
86
|
-
/**
|
|
87
|
-
* Updates the editable fields of one registered standalone server.
|
|
88
|
-
*
|
|
89
|
-
* The server keeps its id and table prefix, so its isolated per-server database
|
|
90
|
-
* (agents, projects, metadata, users, ...) survives domain and name changes.
|
|
91
|
-
*
|
|
92
|
-
* @param serverId - Registry row id.
|
|
93
|
-
* @param input - Replacement values.
|
|
94
|
-
* @returns Updated registry row.
|
|
95
|
-
*
|
|
96
|
-
* @private exported from the standalone server registry store
|
|
97
|
-
*/
|
|
98
|
-
export declare function updateStandaloneServer(serverId: number, input: UpdateStandaloneServerInput): ServerRecord;
|
|
99
|
-
/**
|
|
100
|
-
* Removes one standalone server registration from the VPS registry database.
|
|
101
|
-
*
|
|
102
|
-
* Note: The isolated per-server SQLite database file is intentionally kept on
|
|
103
|
-
* disk so deleting a registration never silently destroys server data.
|
|
104
|
-
*
|
|
105
|
-
* @param serverId - Registry row id.
|
|
106
|
-
* @returns Removed registry row.
|
|
107
|
-
*
|
|
108
|
-
* @private exported from the standalone server registry store
|
|
109
|
-
*/
|
|
110
|
-
export declare function deleteStandaloneServer(serverId: number): ServerRecord;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape of the `better-sqlite3` module constructor loaded at runtime.
|
|
3
|
-
*
|
|
4
|
-
* @private internal SQLite utility of Agents Server
|
|
5
|
-
*/
|
|
6
|
-
export type BetterSqliteConstructor = new (path: string) => AgentsServerSqliteDatabase;
|
|
7
|
-
/**
|
|
8
|
-
* Minimal `better-sqlite3` database surface shared by Agents Server SQLite utilities.
|
|
9
|
-
*
|
|
10
|
-
* @private internal SQLite utility of Agents Server
|
|
11
|
-
*/
|
|
12
|
-
export type AgentsServerSqliteDatabase = {
|
|
13
|
-
readonly pragma: (source: string) => unknown;
|
|
14
|
-
readonly exec: (source: string) => void;
|
|
15
|
-
readonly prepare: (source: string) => AgentsServerSqliteStatement;
|
|
16
|
-
readonly transaction: <TArguments extends ReadonlyArray<unknown>, TResult>(fn: (...args: TArguments) => TResult) => (...args: TArguments) => TResult;
|
|
17
|
-
readonly close?: () => void;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Minimal `better-sqlite3` prepared statement surface shared by Agents Server SQLite utilities.
|
|
21
|
-
*
|
|
22
|
-
* @private internal SQLite utility of Agents Server
|
|
23
|
-
*/
|
|
24
|
-
export type AgentsServerSqliteStatement = {
|
|
25
|
-
readonly reader?: boolean;
|
|
26
|
-
readonly all: (...values: ReadonlyArray<unknown>) => Array<Record<string, unknown>>;
|
|
27
|
-
readonly get: (...values: ReadonlyArray<unknown>) => Record<string, unknown> | undefined;
|
|
28
|
-
readonly run: (...values: ReadonlyArray<unknown>) => {
|
|
29
|
-
readonly changes: number;
|
|
30
|
-
readonly lastInsertRowid: number | bigint;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Opens and initializes one SQLite database file, caching the connection per path.
|
|
35
|
-
*
|
|
36
|
-
* @param databasePath - Absolute path of the SQLite database file.
|
|
37
|
-
* @returns Cached SQLite database connection.
|
|
38
|
-
*
|
|
39
|
-
* @private exported from Agents Server SQLite utilities
|
|
40
|
-
*/
|
|
41
|
-
export declare function $provideSqliteDatabaseAtPath(databasePath: string): AgentsServerSqliteDatabase;
|
|
42
|
-
/**
|
|
43
|
-
* Opens the VPS-wide SQLite registry database.
|
|
44
|
-
*
|
|
45
|
-
* This database is owned by the super-admin and holds only VPS-level data,
|
|
46
|
-
* most importantly the `_Server` table listing all servers running on this VPS.
|
|
47
|
-
* Server-scoped data (agents, projects, metadata, users, ...) lives in isolated
|
|
48
|
-
* per-server databases provided by `$provideServerSqliteDatabase`.
|
|
49
|
-
*
|
|
50
|
-
* @returns Shared VPS registry SQLite database connection.
|
|
51
|
-
*
|
|
52
|
-
* @private exported from Agents Server SQLite utilities
|
|
53
|
-
*/
|
|
54
|
-
export declare function $provideVpsRegistrySqliteDatabase(): AgentsServerSqliteDatabase;
|
|
55
|
-
/**
|
|
56
|
-
* Opens the isolated SQLite database of one server namespace.
|
|
57
|
-
*
|
|
58
|
-
* @param tablePrefix - Stable server namespace key, or an empty string for the default server.
|
|
59
|
-
* @returns Per-server SQLite database connection.
|
|
60
|
-
*
|
|
61
|
-
* @private exported from Agents Server SQLite utilities
|
|
62
|
-
*/
|
|
63
|
-
export declare function $provideServerSqliteDatabase(tablePrefix: string): AgentsServerSqliteDatabase;
|
|
64
|
-
/**
|
|
65
|
-
* Closes all cached SQLite connections and resets adapter state for isolated tests.
|
|
66
|
-
*
|
|
67
|
-
* @private exported from Agents Server SQLite utilities
|
|
68
|
-
*/
|
|
69
|
-
export declare function $resetAgentsServerSqliteDatabaseForTests(): void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AgentsServerSqliteDatabase } from '../$provideAgentsServerSqliteDatabase';
|
|
2
|
-
/**
|
|
3
|
-
* Ensures a table and all required columns exist.
|
|
4
|
-
*
|
|
5
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
6
|
-
*/
|
|
7
|
-
export declare function ensureTable(database: AgentsServerSqliteDatabase, tableName: string, requiredColumns: ReadonlyArray<string>): void;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quotes one SQLite identifier.
|
|
3
|
-
*
|
|
4
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
5
|
-
*/
|
|
6
|
-
export declare function quoteIdentifier(identifier: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Creates a safe identifier suffix for generated index names.
|
|
9
|
-
*
|
|
10
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
11
|
-
*/
|
|
12
|
-
export declare function sanitizeSqlIdentifier(identifier: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a select expression from parsed columns.
|
|
15
|
-
*
|
|
16
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
17
|
-
*/
|
|
18
|
-
export declare function createSelectExpression(columns: ReadonlyArray<string>): string;
|
|
19
|
-
/**
|
|
20
|
-
* Parses a simple Supabase select column list.
|
|
21
|
-
*
|
|
22
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
23
|
-
*/
|
|
24
|
-
export declare function parseSelectedColumns(columns: string): Array<string>;
|
|
25
|
-
/**
|
|
26
|
-
* Deduplicates strings while preserving order.
|
|
27
|
-
*
|
|
28
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
29
|
-
*/
|
|
30
|
-
export declare function uniqueStrings(values: ReadonlyArray<string>): Array<string>;
|
package/umd/apps/agents-server/src/database/sqlite/localSqliteSupabase/localSqliteTableSchema.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { LocalSqliteUpsertOptions } from './localSqliteTypes';
|
|
2
|
-
/**
|
|
3
|
-
* Read index definition for hot SQLite queries.
|
|
4
|
-
*
|
|
5
|
-
* @private type of `$provideLocalSqliteSupabase`
|
|
6
|
-
*/
|
|
7
|
-
export type LocalSqliteReadIndex = {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly columns: ReadonlyArray<string>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Resolves a table base name from the actual prefixed table name.
|
|
13
|
-
*
|
|
14
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
15
|
-
*/
|
|
16
|
-
export declare function resolveTableBaseName(tableName: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Resolves columns participating in known unique indexes.
|
|
19
|
-
*
|
|
20
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveUniqueIndexColumns(tableBaseName: string): Array<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Resolves columns participating in known read indexes.
|
|
25
|
-
*
|
|
26
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveReadIndexColumns(tableBaseName: string): Array<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Resolves upsert conflict columns.
|
|
31
|
-
*
|
|
32
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveUpsertConflictColumns(tableBaseName: string, options: LocalSqliteUpsertOptions): ReadonlyArray<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolves the unique index definitions declared for a table base name.
|
|
37
|
-
*
|
|
38
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolveUniqueIndexes(tableBaseName: string): ReadonlyArray<ReadonlyArray<string>>;
|
|
41
|
-
/**
|
|
42
|
-
* Resolves the read index definitions declared for a table base name.
|
|
43
|
-
*
|
|
44
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveReadIndexes(tableBaseName: string): ReadonlyArray<LocalSqliteReadIndex>;
|
|
47
|
-
/**
|
|
48
|
-
* Resolves whether a column is JSON for a specific table.
|
|
49
|
-
*
|
|
50
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
51
|
-
*/
|
|
52
|
-
export declare function isJsonColumn(tableName: string, column: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Resolves whether a column should be forced to a string for a specific table.
|
|
55
|
-
*
|
|
56
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
57
|
-
*/
|
|
58
|
-
export declare function isTextColumn(tableName: string, column: string): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Resolves whether a column is a boolean stored as an integer.
|
|
61
|
-
*
|
|
62
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
63
|
-
*/
|
|
64
|
-
export declare function isBooleanColumn(column: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Resolves whether a table base name uses a text primary key.
|
|
67
|
-
*
|
|
68
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
69
|
-
*/
|
|
70
|
-
export declare function isTextPrimaryKeyTable(tableBaseName: string): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Resolves SQLite column affinity for dynamically added columns.
|
|
73
|
-
*
|
|
74
|
-
* @private function of `$provideLocalSqliteSupabase`
|
|
75
|
-
*/
|
|
76
|
-
export declare function resolveSqliteColumnType(tableBaseName: string, column: string): string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database key used for requests that do not belong to any registered server,
|
|
3
|
-
* for example localhost development traffic before any server is registered.
|
|
4
|
-
*
|
|
5
|
-
* @private internal SQLite utility of Agents Server
|
|
6
|
-
*/
|
|
7
|
-
export declare const DEFAULT_SERVER_SQLITE_DATABASE_KEY = "default";
|
|
8
|
-
/**
|
|
9
|
-
* Resolves the isolated SQLite database file path for one server namespace.
|
|
10
|
-
*
|
|
11
|
-
* Each registered server has its own SQLite database file so servers on one VPS
|
|
12
|
-
* cannot leak agents, projects, metadata or any other data into each other.
|
|
13
|
-
*
|
|
14
|
-
* @param tablePrefix - Stable server namespace key such as `server_ClientA_`, or an empty string for the default server.
|
|
15
|
-
* @returns Absolute path of the per-server SQLite database file.
|
|
16
|
-
*
|
|
17
|
-
* @private internal SQLite utility of Agents Server
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveServerSqliteDatabasePath(tablePrefix: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Converts one server table prefix into a safe database file key.
|
|
22
|
-
*
|
|
23
|
-
* @param tablePrefix - Stable server namespace key, or an empty string for the default server.
|
|
24
|
-
* @returns Validated file-name-safe database key.
|
|
25
|
-
*
|
|
26
|
-
* @private internal SQLite utility of Agents Server
|
|
27
|
-
*/
|
|
28
|
-
export declare function resolveServerSqliteDatabaseKey(tablePrefix: string): string;
|