@bevel-software/platform-core-backend 0.19.0 → 0.20.0
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/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +22 -0
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +3 -0
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +10 -1
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/modules/audit/agent-audit.service.d.ts +54 -0
- package/dist/modules/audit/agent-audit.service.d.ts.map +1 -0
- package/dist/modules/audit/agent-audit.service.js +290 -0
- package/dist/modules/audit/agent-audit.service.js.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts +40 -0
- package/dist/modules/audit/agent-rest-audit.middleware.d.ts.map +1 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js +75 -0
- package/dist/modules/audit/agent-rest-audit.middleware.js.map +1 -0
- package/dist/modules/audit/audit.contract.d.ts +145 -0
- package/dist/modules/audit/audit.contract.d.ts.map +1 -0
- package/dist/modules/audit/audit.contract.js +35 -0
- package/dist/modules/audit/audit.contract.js.map +1 -0
- package/dist/modules/audit/audit.routes.d.ts +21 -0
- package/dist/modules/audit/audit.routes.d.ts.map +1 -0
- package/dist/modules/audit/audit.routes.js +157 -0
- package/dist/modules/audit/audit.routes.js.map +1 -0
- package/dist/modules/audit/event-classifier.d.ts +52 -0
- package/dist/modules/audit/event-classifier.d.ts.map +1 -0
- package/dist/modules/audit/event-classifier.js +123 -0
- package/dist/modules/audit/event-classifier.js.map +1 -0
- package/dist/modules/audit/index.d.ts +7 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +7 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/request-audit.d.ts +57 -0
- package/dist/modules/audit/request-audit.d.ts.map +1 -0
- package/dist/modules/audit/request-audit.js +117 -0
- package/dist/modules/audit/request-audit.js.map +1 -0
- package/dist/modules/database/core-schema.d.ts +414 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +99 -0
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/diff/diff.service.d.ts.map +1 -1
- package/dist/modules/diff/diff.service.js +6 -1
- package/dist/modules/diff/diff.service.js.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts +9 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/git-guarded-filesystem.js +16 -3
- package/dist/modules/kb-fs/git-guarded-filesystem.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts +1 -0
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +32 -0
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.routes.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.routes.js +8 -1
- package/dist/modules/mcp/mcp.routes.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +9 -1
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +48 -5
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +59 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +180 -8
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +10 -2
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +32 -6
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +21 -5
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +1 -0
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +22 -9
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.d.ts +10 -0
- package/dist/modules/tool-auth/internal-token.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.js +1 -0
- package/dist/modules/tool-auth/internal-token.service.js.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts +8 -0
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +9 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +8 -0
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +9 -0
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +49 -13
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/shared/git-internals.d.ts +7 -1
- package/dist/shared/git-internals.d.ts.map +1 -1
- package/dist/shared/git-internals.js +67 -9
- package/dist/shared/git-internals.js.map +1 -1
- package/migrations/0012_agent_audit.sql +41 -0
- package/migrations/0013_agent_identity_and_key_soft_delete.sql +29 -0
- package/migrations/meta/0012_snapshot.json +2247 -0
- package/migrations/meta/0013_snapshot.json +2259 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/src/core/create-core-server.ts +28 -0
- package/src/core/create-core-services.ts +13 -0
- package/src/modules/audit/__tests__/agent-audit.service.test.ts +370 -0
- package/src/modules/audit/__tests__/agent-rest-audit.middleware.test.ts +113 -0
- package/src/modules/audit/__tests__/audit.routes.test.ts +201 -0
- package/src/modules/audit/__tests__/event-classifier.test.ts +121 -0
- package/src/modules/audit/agent-audit.service.ts +316 -0
- package/src/modules/audit/agent-rest-audit.middleware.ts +83 -0
- package/src/modules/audit/audit.contract.ts +164 -0
- package/src/modules/audit/audit.routes.ts +168 -0
- package/src/modules/audit/event-classifier.ts +155 -0
- package/src/modules/audit/index.ts +14 -0
- package/src/modules/audit/request-audit.ts +141 -0
- package/src/modules/database/core-schema.ts +104 -0
- package/src/modules/diff/diff.service.ts +6 -1
- package/src/modules/kb-fs/git-guarded-filesystem.ts +16 -3
- package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +183 -13
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +60 -2
- package/src/modules/mcp/__tests__/mcp.routes.local-token.test.ts +24 -4
- package/src/modules/mcp/__tests__/mcp.routes.stateless.test.ts +1 -1
- package/src/modules/mcp/__tests__/mcp.service.test.ts +120 -3
- package/src/modules/mcp/mcp-auth.middleware.ts +31 -0
- package/src/modules/mcp/mcp.routes.ts +11 -1
- package/src/modules/mcp/mcp.service.ts +62 -4
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +184 -6
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +35 -0
- package/src/modules/settings/deployment-settings.service.ts +47 -8
- package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +29 -8
- package/src/modules/tool-auth/__tests__/internal-token.service.test.ts +6 -0
- package/src/modules/tool-auth/external-api-key.interface.ts +22 -5
- package/src/modules/tool-auth/external-api-key.service.ts +25 -8
- package/src/modules/tool-auth/internal-token.service.ts +11 -0
- package/src/modules/tool-auth/tool-auth.middleware.ts +17 -1
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +135 -44
- package/src/modules/workspace/workspace.service.ts +9 -0
- package/src/modules/workspace/workspace.tools.ts +47 -11
- package/src/shared/__tests__/git-internals.test.ts +41 -0
- package/src/shared/git-internals.ts +61 -6
- package/dist/modules/access/access-errors.d.ts +0 -34
- package/dist/modules/access/access-errors.d.ts.map +0 -1
- package/dist/modules/access/access-errors.js +0 -40
- package/dist/modules/access/access-errors.js.map +0 -1
- package/dist/modules/access/access-splice.d.ts +0 -140
- package/dist/modules/access/access-splice.d.ts.map +0 -1
- package/dist/modules/access/access-splice.js +0 -389
- package/dist/modules/access/access-splice.js.map +0 -1
- package/dist/modules/access/group-files.d.ts +0 -83
- package/dist/modules/access/group-files.d.ts.map +0 -1
- package/dist/modules/access/group-files.js +0 -167
- package/dist/modules/access/group-files.js.map +0 -1
- package/dist/modules/access/kb-read-filter.d.ts +0 -41
- package/dist/modules/access/kb-read-filter.d.ts.map +0 -1
- package/dist/modules/access/kb-read-filter.js +0 -60
- package/dist/modules/access/kb-read-filter.js.map +0 -1
- package/dist/modules/access/render-roles-yaml.d.ts +0 -22
- package/dist/modules/access/render-roles-yaml.d.ts.map +0 -1
- package/dist/modules/access/render-roles-yaml.js +0 -56
- package/dist/modules/access/render-roles-yaml.js.map +0 -1
- package/dist/modules/access/roles-yaml-guard.d.ts +0 -56
- package/dist/modules/access/roles-yaml-guard.d.ts.map +0 -1
- package/dist/modules/access/roles-yaml-guard.js +0 -79
- package/dist/modules/access/roles-yaml-guard.js.map +0 -1
- package/dist/modules/diff/diff-paths.d.ts +0 -2
- package/dist/modules/diff/diff-paths.d.ts.map +0 -1
- package/dist/modules/diff/diff-paths.js +0 -9
- package/dist/modules/diff/diff-paths.js.map +0 -1
- package/dist/modules/groups/group-provision.service.d.ts +0 -130
- package/dist/modules/groups/group-provision.service.d.ts.map +0 -1
- package/dist/modules/groups/group-provision.service.js +0 -288
- package/dist/modules/groups/group-provision.service.js.map +0 -1
- package/dist/modules/groups/groups.contract.d.ts +0 -106
- package/dist/modules/groups/groups.contract.d.ts.map +0 -1
- package/dist/modules/groups/groups.contract.js +0 -36
- package/dist/modules/groups/groups.contract.js.map +0 -1
- package/dist/modules/groups/groups.routes.d.ts +0 -42
- package/dist/modules/groups/groups.routes.d.ts.map +0 -1
- package/dist/modules/groups/groups.routes.js +0 -379
- package/dist/modules/groups/groups.routes.js.map +0 -1
- package/dist/modules/groups/groups.service.d.ts +0 -60
- package/dist/modules/groups/groups.service.d.ts.map +0 -1
- package/dist/modules/groups/groups.service.js +0 -172
- package/dist/modules/groups/groups.service.js.map +0 -1
- package/dist/modules/groups/index.d.ts +0 -7
- package/dist/modules/groups/index.d.ts.map +0 -1
- package/dist/modules/groups/index.js +0 -6
- package/dist/modules/groups/index.js.map +0 -1
- package/dist/modules/groups/join-proposals.d.ts +0 -53
- package/dist/modules/groups/join-proposals.d.ts.map +0 -1
- package/dist/modules/groups/join-proposals.js +0 -67
- package/dist/modules/groups/join-proposals.js.map +0 -1
- package/dist/modules/groups/join-requests.service.d.ts +0 -81
- package/dist/modules/groups/join-requests.service.d.ts.map +0 -1
- package/dist/modules/groups/join-requests.service.js +0 -135
- package/dist/modules/groups/join-requests.service.js.map +0 -1
- package/dist/modules/mcp/mcp-session-store.d.ts +0 -74
- package/dist/modules/mcp/mcp-session-store.d.ts.map +0 -1
- package/dist/modules/mcp/mcp-session-store.js +0 -131
- package/dist/modules/mcp/mcp-session-store.js.map +0 -1
- package/dist/modules/workflow/file-change-notifier.d.ts +0 -38
- package/dist/modules/workflow/file-change-notifier.d.ts.map +0 -1
- package/dist/modules/workflow/file-change-notifier.js +0 -22
- package/dist/modules/workflow/file-change-notifier.js.map +0 -1
- package/dist/modules/workflow/git/branch-name.d.ts +0 -10
- package/dist/modules/workflow/git/branch-name.d.ts.map +0 -1
- package/dist/modules/workflow/git/branch-name.js +0 -76
- package/dist/modules/workflow/git/branch-name.js.map +0 -1
- package/dist/modules/workflow/git/clone-config.d.ts +0 -61
- package/dist/modules/workflow/git/clone-config.d.ts.map +0 -1
- package/dist/modules/workflow/git/clone-config.js +0 -69
- package/dist/modules/workflow/git/clone-config.js.map +0 -1
- package/dist/modules/workflow/git/mutex.d.ts +0 -11
- package/dist/modules/workflow/git/mutex.d.ts.map +0 -1
- package/dist/modules/workflow/git/mutex.js +0 -23
- package/dist/modules/workflow/git/mutex.js.map +0 -1
- package/dist/modules/workflow/locking-filesystem.d.ts +0 -137
- package/dist/modules/workflow/locking-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/locking-filesystem.js +0 -553
- package/dist/modules/workflow/locking-filesystem.js.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.d.ts +0 -24
- package/dist/modules/workflow/read-only-filesystem.d.ts.map +0 -1
- package/dist/modules/workflow/read-only-filesystem.js +0 -39
- package/dist/modules/workflow/read-only-filesystem.js.map +0 -1
- package/dist/modules/workflow/workflow.errors.d.ts +0 -197
- package/dist/modules/workflow/workflow.errors.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.errors.js +0 -298
- package/dist/modules/workflow/workflow.errors.js.map +0 -1
- package/dist/modules/workspace/bevel-ignore.d.ts +0 -30
- package/dist/modules/workspace/bevel-ignore.d.ts.map +0 -1
- package/dist/modules/workspace/bevel-ignore.js +0 -61
- package/dist/modules/workspace/bevel-ignore.js.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.d.ts +0 -36
- package/dist/modules/workspace/kb-seed.interface.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.interface.js +0 -2
- package/dist/modules/workspace/kb-seed.interface.js.map +0 -1
- package/dist/modules/workspace/kb-seed.service.d.ts +0 -125
- package/dist/modules/workspace/kb-seed.service.d.ts.map +0 -1
- package/dist/modules/workspace/kb-seed.service.js +0 -535
- package/dist/modules/workspace/kb-seed.service.js.map +0 -1
- package/dist/modules/workspace/plugins-migration.d.ts +0 -50
- package/dist/modules/workspace/plugins-migration.d.ts.map +0 -1
- package/dist/modules/workspace/plugins-migration.js +0 -379
- package/dist/modules/workspace/plugins-migration.js.map +0 -1
- package/dist/shared/fs-errors.d.ts +0 -8
- package/dist/shared/fs-errors.d.ts.map +0 -1
- package/dist/shared/fs-errors.js +0 -11
- package/dist/shared/fs-errors.js.map +0 -1
- package/dist/shared/fs-walk.d.ts +0 -23
- package/dist/shared/fs-walk.d.ts.map +0 -1
- package/dist/shared/fs-walk.js +0 -42
- package/dist/shared/fs-walk.js.map +0 -1
- package/dist/shared/hash-email.d.ts +0 -11
- package/dist/shared/hash-email.d.ts.map +0 -1
- package/dist/shared/hash-email.js +0 -14
- package/dist/shared/hash-email.js.map +0 -1
- package/dist/shared/kb-walk.d.ts +0 -52
- package/dist/shared/kb-walk.d.ts.map +0 -1
- package/dist/shared/kb-walk.js +0 -76
- package/dist/shared/kb-walk.js.map +0 -1
|
@@ -1168,6 +1168,23 @@ export declare const externalApiKeys: import("drizzle-orm/pg-core").PgTableWithC
|
|
|
1168
1168
|
identity: undefined;
|
|
1169
1169
|
generated: undefined;
|
|
1170
1170
|
}, {}, {}>;
|
|
1171
|
+
deletedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
1172
|
+
name: "deleted_at";
|
|
1173
|
+
tableName: "api_tokens";
|
|
1174
|
+
dataType: "date";
|
|
1175
|
+
columnType: "PgTimestamp";
|
|
1176
|
+
data: Date;
|
|
1177
|
+
driverParam: string;
|
|
1178
|
+
notNull: false;
|
|
1179
|
+
hasDefault: false;
|
|
1180
|
+
isPrimaryKey: false;
|
|
1181
|
+
isAutoincrement: false;
|
|
1182
|
+
hasRuntimeDefault: false;
|
|
1183
|
+
enumValues: undefined;
|
|
1184
|
+
baseColumn: never;
|
|
1185
|
+
identity: undefined;
|
|
1186
|
+
generated: undefined;
|
|
1187
|
+
}, {}, {}>;
|
|
1171
1188
|
};
|
|
1172
1189
|
dialect: "pg";
|
|
1173
1190
|
}>;
|
|
@@ -2164,12 +2181,199 @@ export declare const oauthAuthCodes: import("drizzle-orm/pg-core").PgTableWithCo
|
|
|
2164
2181
|
};
|
|
2165
2182
|
dialect: "pg";
|
|
2166
2183
|
}>;
|
|
2184
|
+
/**
|
|
2185
|
+
* "This person connected this agent" — the durable record behind the Audit
|
|
2186
|
+
* log's agent rows. An OAuth grant cannot be that record: its token row is
|
|
2187
|
+
* replaced on every refresh (hourly) and pruned once its refresh window
|
|
2188
|
+
* closes, so nothing about it outlives a month. This row is made the first
|
|
2189
|
+
* time a token is minted for a (user, client) pair, kept across every refresh
|
|
2190
|
+
* (each new token row points at it), and REVOKED rather than deleted when the
|
|
2191
|
+
* person or an admin cuts the agent off — its events stay readable under it.
|
|
2192
|
+
*
|
|
2193
|
+
* A connection is the AGENT, per person — not the OAuth client registration.
|
|
2194
|
+
* Claude registers a fresh client on every re-authorisation (dynamic client
|
|
2195
|
+
* registration mints a new id each time), so keying by registration gave one
|
|
2196
|
+
* person five "Claude" rows for one agent. `agent_key` is what a connection is
|
|
2197
|
+
* keyed by instead: the registered client name, folded (a name-less client
|
|
2198
|
+
* falls back to its id), so every registration of "Claude" by one person
|
|
2199
|
+
* lands on the same live row; `client_id` records the registration that
|
|
2200
|
+
* first made it. `client_name` is that registration's name as shown.
|
|
2201
|
+
*
|
|
2202
|
+
* One LIVE connection per (user, agent): the partial unique index below. A
|
|
2203
|
+
* reconnect after a revoke is a new row, so the old one's history and its
|
|
2204
|
+
* "revoked by an admin" mark are never overwritten.
|
|
2205
|
+
*/
|
|
2206
|
+
export declare const agentConnections: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2207
|
+
name: "agent_connections";
|
|
2208
|
+
schema: undefined;
|
|
2209
|
+
columns: {
|
|
2210
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
2211
|
+
name: "id";
|
|
2212
|
+
tableName: "agent_connections";
|
|
2213
|
+
dataType: "string";
|
|
2214
|
+
columnType: "PgUUID";
|
|
2215
|
+
data: string;
|
|
2216
|
+
driverParam: string;
|
|
2217
|
+
notNull: true;
|
|
2218
|
+
hasDefault: true;
|
|
2219
|
+
isPrimaryKey: true;
|
|
2220
|
+
isAutoincrement: false;
|
|
2221
|
+
hasRuntimeDefault: false;
|
|
2222
|
+
enumValues: undefined;
|
|
2223
|
+
baseColumn: never;
|
|
2224
|
+
identity: undefined;
|
|
2225
|
+
generated: undefined;
|
|
2226
|
+
}, {}, {}>;
|
|
2227
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2228
|
+
name: "user_id";
|
|
2229
|
+
tableName: "agent_connections";
|
|
2230
|
+
dataType: "string";
|
|
2231
|
+
columnType: "PgUUID";
|
|
2232
|
+
data: string;
|
|
2233
|
+
driverParam: string;
|
|
2234
|
+
notNull: true;
|
|
2235
|
+
hasDefault: false;
|
|
2236
|
+
isPrimaryKey: false;
|
|
2237
|
+
isAutoincrement: false;
|
|
2238
|
+
hasRuntimeDefault: false;
|
|
2239
|
+
enumValues: undefined;
|
|
2240
|
+
baseColumn: never;
|
|
2241
|
+
identity: undefined;
|
|
2242
|
+
generated: undefined;
|
|
2243
|
+
}, {}, {}>;
|
|
2244
|
+
clientId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2245
|
+
name: "client_id";
|
|
2246
|
+
tableName: "agent_connections";
|
|
2247
|
+
dataType: "string";
|
|
2248
|
+
columnType: "PgText";
|
|
2249
|
+
data: string;
|
|
2250
|
+
driverParam: string;
|
|
2251
|
+
notNull: true;
|
|
2252
|
+
hasDefault: false;
|
|
2253
|
+
isPrimaryKey: false;
|
|
2254
|
+
isAutoincrement: false;
|
|
2255
|
+
hasRuntimeDefault: false;
|
|
2256
|
+
enumValues: [string, ...string[]];
|
|
2257
|
+
baseColumn: never;
|
|
2258
|
+
identity: undefined;
|
|
2259
|
+
generated: undefined;
|
|
2260
|
+
}, {}, {}>;
|
|
2261
|
+
clientName: import("drizzle-orm/pg-core").PgColumn<{
|
|
2262
|
+
name: "client_name";
|
|
2263
|
+
tableName: "agent_connections";
|
|
2264
|
+
dataType: "string";
|
|
2265
|
+
columnType: "PgText";
|
|
2266
|
+
data: string;
|
|
2267
|
+
driverParam: string;
|
|
2268
|
+
notNull: false;
|
|
2269
|
+
hasDefault: false;
|
|
2270
|
+
isPrimaryKey: false;
|
|
2271
|
+
isAutoincrement: false;
|
|
2272
|
+
hasRuntimeDefault: false;
|
|
2273
|
+
enumValues: [string, ...string[]];
|
|
2274
|
+
baseColumn: never;
|
|
2275
|
+
identity: undefined;
|
|
2276
|
+
generated: undefined;
|
|
2277
|
+
}, {}, {}>;
|
|
2278
|
+
agentKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
2279
|
+
name: "agent_key";
|
|
2280
|
+
tableName: "agent_connections";
|
|
2281
|
+
dataType: "string";
|
|
2282
|
+
columnType: "PgText";
|
|
2283
|
+
data: string;
|
|
2284
|
+
driverParam: string;
|
|
2285
|
+
notNull: true;
|
|
2286
|
+
hasDefault: false;
|
|
2287
|
+
isPrimaryKey: false;
|
|
2288
|
+
isAutoincrement: false;
|
|
2289
|
+
hasRuntimeDefault: false;
|
|
2290
|
+
enumValues: [string, ...string[]];
|
|
2291
|
+
baseColumn: never;
|
|
2292
|
+
identity: undefined;
|
|
2293
|
+
generated: undefined;
|
|
2294
|
+
}, {}, {}>;
|
|
2295
|
+
connectedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2296
|
+
name: "connected_at";
|
|
2297
|
+
tableName: "agent_connections";
|
|
2298
|
+
dataType: "date";
|
|
2299
|
+
columnType: "PgTimestamp";
|
|
2300
|
+
data: Date;
|
|
2301
|
+
driverParam: string;
|
|
2302
|
+
notNull: true;
|
|
2303
|
+
hasDefault: true;
|
|
2304
|
+
isPrimaryKey: false;
|
|
2305
|
+
isAutoincrement: false;
|
|
2306
|
+
hasRuntimeDefault: false;
|
|
2307
|
+
enumValues: undefined;
|
|
2308
|
+
baseColumn: never;
|
|
2309
|
+
identity: undefined;
|
|
2310
|
+
generated: undefined;
|
|
2311
|
+
}, {}, {}>;
|
|
2312
|
+
lastUsedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2313
|
+
name: "last_used_at";
|
|
2314
|
+
tableName: "agent_connections";
|
|
2315
|
+
dataType: "date";
|
|
2316
|
+
columnType: "PgTimestamp";
|
|
2317
|
+
data: Date;
|
|
2318
|
+
driverParam: string;
|
|
2319
|
+
notNull: false;
|
|
2320
|
+
hasDefault: false;
|
|
2321
|
+
isPrimaryKey: false;
|
|
2322
|
+
isAutoincrement: false;
|
|
2323
|
+
hasRuntimeDefault: false;
|
|
2324
|
+
enumValues: undefined;
|
|
2325
|
+
baseColumn: never;
|
|
2326
|
+
identity: undefined;
|
|
2327
|
+
generated: undefined;
|
|
2328
|
+
}, {}, {}>;
|
|
2329
|
+
revokedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2330
|
+
name: "revoked_at";
|
|
2331
|
+
tableName: "agent_connections";
|
|
2332
|
+
dataType: "date";
|
|
2333
|
+
columnType: "PgTimestamp";
|
|
2334
|
+
data: Date;
|
|
2335
|
+
driverParam: string;
|
|
2336
|
+
notNull: false;
|
|
2337
|
+
hasDefault: false;
|
|
2338
|
+
isPrimaryKey: false;
|
|
2339
|
+
isAutoincrement: false;
|
|
2340
|
+
hasRuntimeDefault: false;
|
|
2341
|
+
enumValues: undefined;
|
|
2342
|
+
baseColumn: never;
|
|
2343
|
+
identity: undefined;
|
|
2344
|
+
generated: undefined;
|
|
2345
|
+
}, {}, {}>;
|
|
2346
|
+
revokedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
2347
|
+
name: "revoked_by";
|
|
2348
|
+
tableName: "agent_connections";
|
|
2349
|
+
dataType: "string";
|
|
2350
|
+
columnType: "PgText";
|
|
2351
|
+
data: string;
|
|
2352
|
+
driverParam: string;
|
|
2353
|
+
notNull: false;
|
|
2354
|
+
hasDefault: false;
|
|
2355
|
+
isPrimaryKey: false;
|
|
2356
|
+
isAutoincrement: false;
|
|
2357
|
+
hasRuntimeDefault: false;
|
|
2358
|
+
enumValues: [string, ...string[]];
|
|
2359
|
+
baseColumn: never;
|
|
2360
|
+
identity: undefined;
|
|
2361
|
+
generated: undefined;
|
|
2362
|
+
}, {}, {}>;
|
|
2363
|
+
};
|
|
2364
|
+
dialect: "pg";
|
|
2365
|
+
}>;
|
|
2167
2366
|
/**
|
|
2168
2367
|
* OAuth access/refresh token pairs minted by the token endpoint. Like
|
|
2169
2368
|
* `api_tokens`: plaintext shown only in the token response, SHA-256 hashes
|
|
2170
2369
|
* stored, revoked-not-deleted so `last_used_at` keeps its audit value and a
|
|
2171
2370
|
* revoked token can't be re-issued. One row per pair; refresh rotation
|
|
2172
2371
|
* revokes the old row and inserts a new one.
|
|
2372
|
+
*
|
|
2373
|
+
* `connection_id` names the {@link agentConnections} row the pair belongs to,
|
|
2374
|
+
* so every call made with the token is attributed to that agent and revoking
|
|
2375
|
+
* the agent can revoke exactly its tokens. Null only on rows minted before
|
|
2376
|
+
* the column existed.
|
|
2173
2377
|
*/
|
|
2174
2378
|
export declare const oauthTokens: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2175
2379
|
name: "oauth_tokens";
|
|
@@ -2260,6 +2464,23 @@ export declare const oauthTokens: import("drizzle-orm/pg-core").PgTableWithColum
|
|
|
2260
2464
|
identity: undefined;
|
|
2261
2465
|
generated: undefined;
|
|
2262
2466
|
}, {}, {}>;
|
|
2467
|
+
connectionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2468
|
+
name: "connection_id";
|
|
2469
|
+
tableName: "oauth_tokens";
|
|
2470
|
+
dataType: "string";
|
|
2471
|
+
columnType: "PgUUID";
|
|
2472
|
+
data: string;
|
|
2473
|
+
driverParam: string;
|
|
2474
|
+
notNull: false;
|
|
2475
|
+
hasDefault: false;
|
|
2476
|
+
isPrimaryKey: false;
|
|
2477
|
+
isAutoincrement: false;
|
|
2478
|
+
hasRuntimeDefault: false;
|
|
2479
|
+
enumValues: undefined;
|
|
2480
|
+
baseColumn: never;
|
|
2481
|
+
identity: undefined;
|
|
2482
|
+
generated: undefined;
|
|
2483
|
+
}, {}, {}>;
|
|
2263
2484
|
scope: import("drizzle-orm/pg-core").PgColumn<{
|
|
2264
2485
|
name: "scope";
|
|
2265
2486
|
tableName: "oauth_tokens";
|
|
@@ -2382,6 +2603,199 @@ export declare const oauthTokens: import("drizzle-orm/pg-core").PgTableWithColum
|
|
|
2382
2603
|
};
|
|
2383
2604
|
dialect: "pg";
|
|
2384
2605
|
}>;
|
|
2606
|
+
/**
|
|
2607
|
+
* The Audit log's events: one row per thing an external agent called through
|
|
2608
|
+
* the platform — a hexis capability (the platform's own tools, `read_file`,
|
|
2609
|
+
* `call_tool_chain`, …), a tool from a `.tool` manual or a connected MCP
|
|
2610
|
+
* server, or a skill it read. Append-only; pruned past the deployment's
|
|
2611
|
+
* retention window (the `auditRetentionDays` setting).
|
|
2612
|
+
*
|
|
2613
|
+
* Deliberately WITHOUT arguments or results: a call's inputs can carry
|
|
2614
|
+
* secrets and personal data, and the log's question is "what was used, by
|
|
2615
|
+
* which agent, when" — not "what was said".
|
|
2616
|
+
*
|
|
2617
|
+
* Exactly one principal per row (the CHECK): the connection key or the agent
|
|
2618
|
+
* connection the call arrived through. Both cascade, so deleting a key for
|
|
2619
|
+
* good, revoking-then-erasing a person, or dropping a connection takes its
|
|
2620
|
+
* events along — the same contract the LLM-usage rows already keep.
|
|
2621
|
+
*/
|
|
2622
|
+
export declare const agentEvents: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2623
|
+
name: "agent_events";
|
|
2624
|
+
schema: undefined;
|
|
2625
|
+
columns: {
|
|
2626
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
2627
|
+
name: "id";
|
|
2628
|
+
tableName: "agent_events";
|
|
2629
|
+
dataType: "string";
|
|
2630
|
+
columnType: "PgUUID";
|
|
2631
|
+
data: string;
|
|
2632
|
+
driverParam: string;
|
|
2633
|
+
notNull: true;
|
|
2634
|
+
hasDefault: true;
|
|
2635
|
+
isPrimaryKey: true;
|
|
2636
|
+
isAutoincrement: false;
|
|
2637
|
+
hasRuntimeDefault: false;
|
|
2638
|
+
enumValues: undefined;
|
|
2639
|
+
baseColumn: never;
|
|
2640
|
+
identity: undefined;
|
|
2641
|
+
generated: undefined;
|
|
2642
|
+
}, {}, {}>;
|
|
2643
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2644
|
+
name: "user_id";
|
|
2645
|
+
tableName: "agent_events";
|
|
2646
|
+
dataType: "string";
|
|
2647
|
+
columnType: "PgUUID";
|
|
2648
|
+
data: string;
|
|
2649
|
+
driverParam: string;
|
|
2650
|
+
notNull: true;
|
|
2651
|
+
hasDefault: false;
|
|
2652
|
+
isPrimaryKey: false;
|
|
2653
|
+
isAutoincrement: false;
|
|
2654
|
+
hasRuntimeDefault: false;
|
|
2655
|
+
enumValues: undefined;
|
|
2656
|
+
baseColumn: never;
|
|
2657
|
+
identity: undefined;
|
|
2658
|
+
generated: undefined;
|
|
2659
|
+
}, {}, {}>;
|
|
2660
|
+
keyId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2661
|
+
name: "key_id";
|
|
2662
|
+
tableName: "agent_events";
|
|
2663
|
+
dataType: "string";
|
|
2664
|
+
columnType: "PgUUID";
|
|
2665
|
+
data: string;
|
|
2666
|
+
driverParam: string;
|
|
2667
|
+
notNull: false;
|
|
2668
|
+
hasDefault: false;
|
|
2669
|
+
isPrimaryKey: false;
|
|
2670
|
+
isAutoincrement: false;
|
|
2671
|
+
hasRuntimeDefault: false;
|
|
2672
|
+
enumValues: undefined;
|
|
2673
|
+
baseColumn: never;
|
|
2674
|
+
identity: undefined;
|
|
2675
|
+
generated: undefined;
|
|
2676
|
+
}, {}, {}>;
|
|
2677
|
+
connectionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2678
|
+
name: "connection_id";
|
|
2679
|
+
tableName: "agent_events";
|
|
2680
|
+
dataType: "string";
|
|
2681
|
+
columnType: "PgUUID";
|
|
2682
|
+
data: string;
|
|
2683
|
+
driverParam: string;
|
|
2684
|
+
notNull: false;
|
|
2685
|
+
hasDefault: false;
|
|
2686
|
+
isPrimaryKey: false;
|
|
2687
|
+
isAutoincrement: false;
|
|
2688
|
+
hasRuntimeDefault: false;
|
|
2689
|
+
enumValues: undefined;
|
|
2690
|
+
baseColumn: never;
|
|
2691
|
+
identity: undefined;
|
|
2692
|
+
generated: undefined;
|
|
2693
|
+
}, {}, {}>;
|
|
2694
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
2695
|
+
name: "kind";
|
|
2696
|
+
tableName: "agent_events";
|
|
2697
|
+
dataType: "string";
|
|
2698
|
+
columnType: "PgText";
|
|
2699
|
+
data: string;
|
|
2700
|
+
driverParam: string;
|
|
2701
|
+
notNull: true;
|
|
2702
|
+
hasDefault: false;
|
|
2703
|
+
isPrimaryKey: false;
|
|
2704
|
+
isAutoincrement: false;
|
|
2705
|
+
hasRuntimeDefault: false;
|
|
2706
|
+
enumValues: [string, ...string[]];
|
|
2707
|
+
baseColumn: never;
|
|
2708
|
+
identity: undefined;
|
|
2709
|
+
generated: undefined;
|
|
2710
|
+
}, {}, {}>;
|
|
2711
|
+
manual: import("drizzle-orm/pg-core").PgColumn<{
|
|
2712
|
+
name: "manual";
|
|
2713
|
+
tableName: "agent_events";
|
|
2714
|
+
dataType: "string";
|
|
2715
|
+
columnType: "PgText";
|
|
2716
|
+
data: string;
|
|
2717
|
+
driverParam: string;
|
|
2718
|
+
notNull: false;
|
|
2719
|
+
hasDefault: false;
|
|
2720
|
+
isPrimaryKey: false;
|
|
2721
|
+
isAutoincrement: false;
|
|
2722
|
+
hasRuntimeDefault: false;
|
|
2723
|
+
enumValues: [string, ...string[]];
|
|
2724
|
+
baseColumn: never;
|
|
2725
|
+
identity: undefined;
|
|
2726
|
+
generated: undefined;
|
|
2727
|
+
}, {}, {}>;
|
|
2728
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
2729
|
+
name: "name";
|
|
2730
|
+
tableName: "agent_events";
|
|
2731
|
+
dataType: "string";
|
|
2732
|
+
columnType: "PgText";
|
|
2733
|
+
data: string;
|
|
2734
|
+
driverParam: string;
|
|
2735
|
+
notNull: true;
|
|
2736
|
+
hasDefault: false;
|
|
2737
|
+
isPrimaryKey: false;
|
|
2738
|
+
isAutoincrement: false;
|
|
2739
|
+
hasRuntimeDefault: false;
|
|
2740
|
+
enumValues: [string, ...string[]];
|
|
2741
|
+
baseColumn: never;
|
|
2742
|
+
identity: undefined;
|
|
2743
|
+
generated: undefined;
|
|
2744
|
+
}, {}, {}>;
|
|
2745
|
+
outcome: import("drizzle-orm/pg-core").PgColumn<{
|
|
2746
|
+
name: "outcome";
|
|
2747
|
+
tableName: "agent_events";
|
|
2748
|
+
dataType: "string";
|
|
2749
|
+
columnType: "PgText";
|
|
2750
|
+
data: string;
|
|
2751
|
+
driverParam: string;
|
|
2752
|
+
notNull: true;
|
|
2753
|
+
hasDefault: false;
|
|
2754
|
+
isPrimaryKey: false;
|
|
2755
|
+
isAutoincrement: false;
|
|
2756
|
+
hasRuntimeDefault: false;
|
|
2757
|
+
enumValues: [string, ...string[]];
|
|
2758
|
+
baseColumn: never;
|
|
2759
|
+
identity: undefined;
|
|
2760
|
+
generated: undefined;
|
|
2761
|
+
}, {}, {}>;
|
|
2762
|
+
durationMs: import("drizzle-orm/pg-core").PgColumn<{
|
|
2763
|
+
name: "duration_ms";
|
|
2764
|
+
tableName: "agent_events";
|
|
2765
|
+
dataType: "number";
|
|
2766
|
+
columnType: "PgInteger";
|
|
2767
|
+
data: number;
|
|
2768
|
+
driverParam: string | number;
|
|
2769
|
+
notNull: false;
|
|
2770
|
+
hasDefault: false;
|
|
2771
|
+
isPrimaryKey: false;
|
|
2772
|
+
isAutoincrement: false;
|
|
2773
|
+
hasRuntimeDefault: false;
|
|
2774
|
+
enumValues: undefined;
|
|
2775
|
+
baseColumn: never;
|
|
2776
|
+
identity: undefined;
|
|
2777
|
+
generated: undefined;
|
|
2778
|
+
}, {}, {}>;
|
|
2779
|
+
at: import("drizzle-orm/pg-core").PgColumn<{
|
|
2780
|
+
name: "at";
|
|
2781
|
+
tableName: "agent_events";
|
|
2782
|
+
dataType: "date";
|
|
2783
|
+
columnType: "PgTimestamp";
|
|
2784
|
+
data: Date;
|
|
2785
|
+
driverParam: string;
|
|
2786
|
+
notNull: true;
|
|
2787
|
+
hasDefault: true;
|
|
2788
|
+
isPrimaryKey: false;
|
|
2789
|
+
isAutoincrement: false;
|
|
2790
|
+
hasRuntimeDefault: false;
|
|
2791
|
+
enumValues: undefined;
|
|
2792
|
+
baseColumn: never;
|
|
2793
|
+
identity: undefined;
|
|
2794
|
+
generated: undefined;
|
|
2795
|
+
}, {}, {}>;
|
|
2796
|
+
};
|
|
2797
|
+
dialect: "pg";
|
|
2798
|
+
}>;
|
|
2385
2799
|
export declare const sessionOntologyTouches: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2386
2800
|
name: "session_ontology_touches";
|
|
2387
2801
|
schema: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-schema.d.ts","sourceRoot":"","sources":["../../../src/modules/database/core-schema.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BhB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAczB,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAapB,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB7B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB/B,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8D5B,CAAC"}
|
|
@@ -202,6 +202,16 @@ export const externalApiKeys = pgTable('api_tokens', {
|
|
|
202
202
|
* reconnect a key that was taken from them.
|
|
203
203
|
*/
|
|
204
204
|
revokedBy: text('revoked_by'),
|
|
205
|
+
/**
|
|
206
|
+
* When the owner deleted the key "for good" from their own pages. A
|
|
207
|
+
* DELETE in name only: the row stays, because the Audit log's events hang
|
|
208
|
+
* off it and a log its subject can erase is not one. Hidden from the
|
|
209
|
+
* owner's listings, shown to admins as deleted; gone for real only when
|
|
210
|
+
* the account is erased (the cascade) or its events have long been
|
|
211
|
+
* pruned. Always set on an already-revoked row — a live key is never
|
|
212
|
+
* deleted in one step.
|
|
213
|
+
*/
|
|
214
|
+
deletedAt: timestamp('deleted_at'),
|
|
205
215
|
}, (t) => ({
|
|
206
216
|
byUser: index('api_tokens_by_user').on(t.userId),
|
|
207
217
|
}));
|
|
@@ -428,12 +438,57 @@ export const oauthAuthCodes = pgTable('oauth_auth_codes', {
|
|
|
428
438
|
// Sweep expired/spent rows without a full scan.
|
|
429
439
|
byExpiry: index('oauth_auth_codes_by_expiry').on(t.expiresAt),
|
|
430
440
|
}));
|
|
441
|
+
/**
|
|
442
|
+
* "This person connected this agent" — the durable record behind the Audit
|
|
443
|
+
* log's agent rows. An OAuth grant cannot be that record: its token row is
|
|
444
|
+
* replaced on every refresh (hourly) and pruned once its refresh window
|
|
445
|
+
* closes, so nothing about it outlives a month. This row is made the first
|
|
446
|
+
* time a token is minted for a (user, client) pair, kept across every refresh
|
|
447
|
+
* (each new token row points at it), and REVOKED rather than deleted when the
|
|
448
|
+
* person or an admin cuts the agent off — its events stay readable under it.
|
|
449
|
+
*
|
|
450
|
+
* A connection is the AGENT, per person — not the OAuth client registration.
|
|
451
|
+
* Claude registers a fresh client on every re-authorisation (dynamic client
|
|
452
|
+
* registration mints a new id each time), so keying by registration gave one
|
|
453
|
+
* person five "Claude" rows for one agent. `agent_key` is what a connection is
|
|
454
|
+
* keyed by instead: the registered client name, folded (a name-less client
|
|
455
|
+
* falls back to its id), so every registration of "Claude" by one person
|
|
456
|
+
* lands on the same live row; `client_id` records the registration that
|
|
457
|
+
* first made it. `client_name` is that registration's name as shown.
|
|
458
|
+
*
|
|
459
|
+
* One LIVE connection per (user, agent): the partial unique index below. A
|
|
460
|
+
* reconnect after a revoke is a new row, so the old one's history and its
|
|
461
|
+
* "revoked by an admin" mark are never overwritten.
|
|
462
|
+
*/
|
|
463
|
+
export const agentConnections = pgTable('agent_connections', {
|
|
464
|
+
id: uuid('id').defaultRandom().primaryKey(),
|
|
465
|
+
userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
|
|
466
|
+
clientId: text('client_id').notNull().references(() => oauthClients.clientId),
|
|
467
|
+
clientName: text('client_name'),
|
|
468
|
+
/** The folded client name, or the client id when the registration carried none. */
|
|
469
|
+
agentKey: text('agent_key').notNull(),
|
|
470
|
+
connectedAt: timestamp('connected_at').defaultNow().notNull(),
|
|
471
|
+
lastUsedAt: timestamp('last_used_at'),
|
|
472
|
+
revokedAt: timestamp('revoked_at'),
|
|
473
|
+
/** `owner` | `admin` — who ended it; null while live. Same vocabulary as `api_tokens.revoked_by`. */
|
|
474
|
+
revokedBy: text('revoked_by'),
|
|
475
|
+
}, (t) => ({
|
|
476
|
+
byUser: index('agent_connections_by_user').on(t.userId),
|
|
477
|
+
liveUnq: uniqueIndex('agent_connections_live_unq')
|
|
478
|
+
.on(t.userId, t.agentKey)
|
|
479
|
+
.where(sql `${t.revokedAt} is null`),
|
|
480
|
+
}));
|
|
431
481
|
/**
|
|
432
482
|
* OAuth access/refresh token pairs minted by the token endpoint. Like
|
|
433
483
|
* `api_tokens`: plaintext shown only in the token response, SHA-256 hashes
|
|
434
484
|
* stored, revoked-not-deleted so `last_used_at` keeps its audit value and a
|
|
435
485
|
* revoked token can't be re-issued. One row per pair; refresh rotation
|
|
436
486
|
* revokes the old row and inserts a new one.
|
|
487
|
+
*
|
|
488
|
+
* `connection_id` names the {@link agentConnections} row the pair belongs to,
|
|
489
|
+
* so every call made with the token is attributed to that agent and revoking
|
|
490
|
+
* the agent can revoke exactly its tokens. Null only on rows minted before
|
|
491
|
+
* the column existed.
|
|
437
492
|
*/
|
|
438
493
|
export const oauthTokens = pgTable('oauth_tokens', {
|
|
439
494
|
id: uuid('id').defaultRandom().primaryKey(),
|
|
@@ -441,6 +496,7 @@ export const oauthTokens = pgTable('oauth_tokens', {
|
|
|
441
496
|
refreshTokenHash: text('refresh_token_hash').unique(),
|
|
442
497
|
clientId: text('client_id').notNull().references(() => oauthClients.clientId),
|
|
443
498
|
userId: uuid('user_id').notNull().references(() => users.id),
|
|
499
|
+
connectionId: uuid('connection_id').references(() => agentConnections.id, { onDelete: 'cascade' }),
|
|
444
500
|
scope: text('scope'),
|
|
445
501
|
resource: text('resource'),
|
|
446
502
|
expiresAt: timestamp('expires_at').notNull(),
|
|
@@ -451,6 +507,49 @@ export const oauthTokens = pgTable('oauth_tokens', {
|
|
|
451
507
|
}, (t) => ({
|
|
452
508
|
byUser: index('oauth_tokens_by_user').on(t.userId),
|
|
453
509
|
byExpiry: index('oauth_tokens_by_expiry').on(t.expiresAt),
|
|
510
|
+
byConnection: index('oauth_tokens_by_connection').on(t.connectionId),
|
|
511
|
+
}));
|
|
512
|
+
/**
|
|
513
|
+
* The Audit log's events: one row per thing an external agent called through
|
|
514
|
+
* the platform — a hexis capability (the platform's own tools, `read_file`,
|
|
515
|
+
* `call_tool_chain`, …), a tool from a `.tool` manual or a connected MCP
|
|
516
|
+
* server, or a skill it read. Append-only; pruned past the deployment's
|
|
517
|
+
* retention window (the `auditRetentionDays` setting).
|
|
518
|
+
*
|
|
519
|
+
* Deliberately WITHOUT arguments or results: a call's inputs can carry
|
|
520
|
+
* secrets and personal data, and the log's question is "what was used, by
|
|
521
|
+
* which agent, when" — not "what was said".
|
|
522
|
+
*
|
|
523
|
+
* Exactly one principal per row (the CHECK): the connection key or the agent
|
|
524
|
+
* connection the call arrived through. Both cascade, so deleting a key for
|
|
525
|
+
* good, revoking-then-erasing a person, or dropping a connection takes its
|
|
526
|
+
* events along — the same contract the LLM-usage rows already keep.
|
|
527
|
+
*/
|
|
528
|
+
export const agentEvents = pgTable('agent_events', {
|
|
529
|
+
id: uuid('id').defaultRandom().primaryKey(),
|
|
530
|
+
userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
|
|
531
|
+
keyId: uuid('key_id').references(() => externalApiKeys.id, { onDelete: 'cascade' }),
|
|
532
|
+
connectionId: uuid('connection_id').references(() => agentConnections.id, { onDelete: 'cascade' }),
|
|
533
|
+
/** `capability` | `tool` | `skill`. */
|
|
534
|
+
kind: text('kind').notNull(),
|
|
535
|
+
/** The MCP server / `.tool` manual (catalog name) for a tool, the skill folder for a skill; null for a capability. */
|
|
536
|
+
manual: text('manual'),
|
|
537
|
+
/** The tool's bare name, or the skill's name. */
|
|
538
|
+
name: text('name').notNull(),
|
|
539
|
+
/** `ok` | `error` | `denied` (denied: the caller's sign-in for the tool was missing, so nothing ran). */
|
|
540
|
+
outcome: text('outcome').notNull(),
|
|
541
|
+
durationMs: integer('duration_ms'),
|
|
542
|
+
at: timestamp('at').defaultNow().notNull(),
|
|
543
|
+
}, (t) => ({
|
|
544
|
+
// The two read paths: one principal's events, newest first.
|
|
545
|
+
byKey: index('agent_events_by_key').on(t.keyId, t.at),
|
|
546
|
+
byConnection: index('agent_events_by_connection').on(t.connectionId, t.at),
|
|
547
|
+
// The retention prune, and per-user counts.
|
|
548
|
+
byAt: index('agent_events_by_at').on(t.at),
|
|
549
|
+
byUser: index('agent_events_by_user').on(t.userId),
|
|
550
|
+
kindCheck: check('agent_events_kind', sql `${t.kind} IN ('capability', 'tool', 'skill')`),
|
|
551
|
+
outcomeCheck: check('agent_events_outcome', sql `${t.outcome} IN ('ok', 'error', 'denied')`),
|
|
552
|
+
principalCheck: check('agent_events_principal', sql `(${t.keyId} IS NULL) <> (${t.connectionId} IS NULL)`),
|
|
454
553
|
}));
|
|
455
554
|
export const sessionOntologyTouches = pgTable('session_ontology_touches', {
|
|
456
555
|
sessionId: text('session_id').notNull(),
|