@app-vitals/agent-admin 1.106.1 → 1.107.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/openapi.json +0 -280
- package/openapi.platform.json +0 -280
- package/package.json +2 -2
- package/prisma/client/browser.ts +0 -10
- package/prisma/client/client.ts +0 -10
- package/prisma/client/internal/class.ts +4 -24
- package/prisma/client/internal/prismaNamespace.ts +1 -181
- package/prisma/client/internal/prismaNamespaceBrowser.ts +0 -30
- package/prisma/client/models.ts +0 -2
- package/prisma/migrations/20261129000000_drop_cron_run_transcripts/migration.sql +9 -0
- package/prisma/schema/schema.prisma +0 -34
- package/src/account-member-removal.integration.test.ts +190 -0
- package/src/account-members.ts +7 -1
- package/src/admin-boot.ts +0 -11
- package/src/admin-ui-account-pages.ts +15 -2
- package/src/admin-ui-account-pages.unit.test.ts +4 -0
- package/src/admin-ui-accounts-pages.ts +14 -2
- package/src/admin-ui-accounts-pages.unit.test.ts +1 -0
- package/src/admin-ui.smoke.test.ts +163 -1
- package/src/admin-ui.ts +35 -1
- package/src/agents-api.ts +0 -13
- package/src/api.smoke.test.ts +6 -73
- package/src/api.ts +0 -17
- package/src/cron-run-now.integration.test.ts +163 -0
- package/src/cron-run-transcripts-removed.smoke.test.ts +82 -0
- package/src/drop-cron-run-transcripts-migration.integration.test.ts +114 -0
- package/src/member-id-stamp.ts +26 -0
- package/src/openapi-schemas.ts +0 -55
- package/src/push-service.integration.test.ts +12 -0
- package/src/push-service.ts +7 -4
- package/src/push-service.unit.test.ts +24 -0
- package/src/push-toggle.ts +10 -0
- package/src/repo-access-config.ts +1 -1
- package/prisma/client/models/AgentCronRunTranscript.ts +0 -1339
- package/prisma/client/models/AgentTranscriptRead.ts +0 -1177
- package/src/cron-run-transcripts.integration.test.ts +0 -220
- package/src/cron-run-transcripts.smoke.test.ts +0 -286
- package/src/cron-run-transcripts.ts +0 -314
- package/src/transcript-config.ts +0 -30
- package/src/transcript-config.unit.test.ts +0 -50
|
@@ -421,8 +421,6 @@ export const ModelName = {
|
|
|
421
421
|
AgentChatTokenUsageDailyByModel: 'AgentChatTokenUsageDailyByModel',
|
|
422
422
|
AgentAsk: 'AgentAsk',
|
|
423
423
|
AgentCronRunRequest: 'AgentCronRunRequest',
|
|
424
|
-
AgentCronRunTranscript: 'AgentCronRunTranscript',
|
|
425
|
-
AgentTranscriptRead: 'AgentTranscriptRead',
|
|
426
424
|
AgentGitHubInstallationsSnapshot: 'AgentGitHubInstallationsSnapshot',
|
|
427
425
|
PushSubscription: 'PushSubscription',
|
|
428
426
|
ChatThreadWatch: 'ChatThreadWatch',
|
|
@@ -447,7 +445,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|
|
447
445
|
omit: GlobalOmitOptions
|
|
448
446
|
}
|
|
449
447
|
meta: {
|
|
450
|
-
modelProps: "agentWorkQueueSnapshot" | "agentPhaseMethodology" | "sessionFollow" | "sessionAlertState" | "agent" | "agentEnv" | "gitHubEnterpriseApp" | "agentCronJob" | "agentTool" | "agentToken" | "agentPlugin" | "agentMember" | "account" | "agentTemplate" | "agentTemplateItem" | "slackConfigToken" | "accountMember" | "accountInvite" | "agentCronRun" | "agentCronRunSkillUsage" | "agentCronRunModelBreakdown" | "agentChatTokenUsageDailyByModel" | "agentAsk" | "agentCronRunRequest" | "
|
|
448
|
+
modelProps: "agentWorkQueueSnapshot" | "agentPhaseMethodology" | "sessionFollow" | "sessionAlertState" | "agent" | "agentEnv" | "gitHubEnterpriseApp" | "agentCronJob" | "agentTool" | "agentToken" | "agentPlugin" | "agentMember" | "account" | "agentTemplate" | "agentTemplateItem" | "slackConfigToken" | "accountMember" | "accountInvite" | "agentCronRun" | "agentCronRunSkillUsage" | "agentCronRunModelBreakdown" | "agentChatTokenUsageDailyByModel" | "agentAsk" | "agentCronRunRequest" | "agentGitHubInstallationsSnapshot" | "pushSubscription" | "chatThreadWatch" | "userNotificationPrefs" | "agentMarketplace" | "gitHubReconcileAudit" | "gitHubRepoSnapshot" | "gitHubCachedRepo" | "gitHubRepoAccess"
|
|
451
449
|
txIsolationLevel: TransactionIsolationLevel
|
|
452
450
|
}
|
|
453
451
|
model: {
|
|
@@ -2227,154 +2225,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|
|
2227
2225
|
}
|
|
2228
2226
|
}
|
|
2229
2227
|
}
|
|
2230
|
-
AgentCronRunTranscript: {
|
|
2231
|
-
payload: Prisma.$AgentCronRunTranscriptPayload<ExtArgs>
|
|
2232
|
-
fields: Prisma.AgentCronRunTranscriptFieldRefs
|
|
2233
|
-
operations: {
|
|
2234
|
-
findUnique: {
|
|
2235
|
-
args: Prisma.AgentCronRunTranscriptFindUniqueArgs<ExtArgs>
|
|
2236
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload> | null
|
|
2237
|
-
}
|
|
2238
|
-
findUniqueOrThrow: {
|
|
2239
|
-
args: Prisma.AgentCronRunTranscriptFindUniqueOrThrowArgs<ExtArgs>
|
|
2240
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2241
|
-
}
|
|
2242
|
-
findFirst: {
|
|
2243
|
-
args: Prisma.AgentCronRunTranscriptFindFirstArgs<ExtArgs>
|
|
2244
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload> | null
|
|
2245
|
-
}
|
|
2246
|
-
findFirstOrThrow: {
|
|
2247
|
-
args: Prisma.AgentCronRunTranscriptFindFirstOrThrowArgs<ExtArgs>
|
|
2248
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2249
|
-
}
|
|
2250
|
-
findMany: {
|
|
2251
|
-
args: Prisma.AgentCronRunTranscriptFindManyArgs<ExtArgs>
|
|
2252
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>[]
|
|
2253
|
-
}
|
|
2254
|
-
create: {
|
|
2255
|
-
args: Prisma.AgentCronRunTranscriptCreateArgs<ExtArgs>
|
|
2256
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2257
|
-
}
|
|
2258
|
-
createMany: {
|
|
2259
|
-
args: Prisma.AgentCronRunTranscriptCreateManyArgs<ExtArgs>
|
|
2260
|
-
result: BatchPayload
|
|
2261
|
-
}
|
|
2262
|
-
createManyAndReturn: {
|
|
2263
|
-
args: Prisma.AgentCronRunTranscriptCreateManyAndReturnArgs<ExtArgs>
|
|
2264
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>[]
|
|
2265
|
-
}
|
|
2266
|
-
delete: {
|
|
2267
|
-
args: Prisma.AgentCronRunTranscriptDeleteArgs<ExtArgs>
|
|
2268
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2269
|
-
}
|
|
2270
|
-
update: {
|
|
2271
|
-
args: Prisma.AgentCronRunTranscriptUpdateArgs<ExtArgs>
|
|
2272
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2273
|
-
}
|
|
2274
|
-
deleteMany: {
|
|
2275
|
-
args: Prisma.AgentCronRunTranscriptDeleteManyArgs<ExtArgs>
|
|
2276
|
-
result: BatchPayload
|
|
2277
|
-
}
|
|
2278
|
-
updateMany: {
|
|
2279
|
-
args: Prisma.AgentCronRunTranscriptUpdateManyArgs<ExtArgs>
|
|
2280
|
-
result: BatchPayload
|
|
2281
|
-
}
|
|
2282
|
-
updateManyAndReturn: {
|
|
2283
|
-
args: Prisma.AgentCronRunTranscriptUpdateManyAndReturnArgs<ExtArgs>
|
|
2284
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>[]
|
|
2285
|
-
}
|
|
2286
|
-
upsert: {
|
|
2287
|
-
args: Prisma.AgentCronRunTranscriptUpsertArgs<ExtArgs>
|
|
2288
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentCronRunTranscriptPayload>
|
|
2289
|
-
}
|
|
2290
|
-
aggregate: {
|
|
2291
|
-
args: Prisma.AgentCronRunTranscriptAggregateArgs<ExtArgs>
|
|
2292
|
-
result: runtime.Types.Utils.Optional<Prisma.AggregateAgentCronRunTranscript>
|
|
2293
|
-
}
|
|
2294
|
-
groupBy: {
|
|
2295
|
-
args: Prisma.AgentCronRunTranscriptGroupByArgs<ExtArgs>
|
|
2296
|
-
result: runtime.Types.Utils.Optional<Prisma.AgentCronRunTranscriptGroupByOutputType>[]
|
|
2297
|
-
}
|
|
2298
|
-
count: {
|
|
2299
|
-
args: Prisma.AgentCronRunTranscriptCountArgs<ExtArgs>
|
|
2300
|
-
result: runtime.Types.Utils.Optional<Prisma.AgentCronRunTranscriptCountAggregateOutputType> | number
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
AgentTranscriptRead: {
|
|
2305
|
-
payload: Prisma.$AgentTranscriptReadPayload<ExtArgs>
|
|
2306
|
-
fields: Prisma.AgentTranscriptReadFieldRefs
|
|
2307
|
-
operations: {
|
|
2308
|
-
findUnique: {
|
|
2309
|
-
args: Prisma.AgentTranscriptReadFindUniqueArgs<ExtArgs>
|
|
2310
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload> | null
|
|
2311
|
-
}
|
|
2312
|
-
findUniqueOrThrow: {
|
|
2313
|
-
args: Prisma.AgentTranscriptReadFindUniqueOrThrowArgs<ExtArgs>
|
|
2314
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2315
|
-
}
|
|
2316
|
-
findFirst: {
|
|
2317
|
-
args: Prisma.AgentTranscriptReadFindFirstArgs<ExtArgs>
|
|
2318
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload> | null
|
|
2319
|
-
}
|
|
2320
|
-
findFirstOrThrow: {
|
|
2321
|
-
args: Prisma.AgentTranscriptReadFindFirstOrThrowArgs<ExtArgs>
|
|
2322
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2323
|
-
}
|
|
2324
|
-
findMany: {
|
|
2325
|
-
args: Prisma.AgentTranscriptReadFindManyArgs<ExtArgs>
|
|
2326
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>[]
|
|
2327
|
-
}
|
|
2328
|
-
create: {
|
|
2329
|
-
args: Prisma.AgentTranscriptReadCreateArgs<ExtArgs>
|
|
2330
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2331
|
-
}
|
|
2332
|
-
createMany: {
|
|
2333
|
-
args: Prisma.AgentTranscriptReadCreateManyArgs<ExtArgs>
|
|
2334
|
-
result: BatchPayload
|
|
2335
|
-
}
|
|
2336
|
-
createManyAndReturn: {
|
|
2337
|
-
args: Prisma.AgentTranscriptReadCreateManyAndReturnArgs<ExtArgs>
|
|
2338
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>[]
|
|
2339
|
-
}
|
|
2340
|
-
delete: {
|
|
2341
|
-
args: Prisma.AgentTranscriptReadDeleteArgs<ExtArgs>
|
|
2342
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2343
|
-
}
|
|
2344
|
-
update: {
|
|
2345
|
-
args: Prisma.AgentTranscriptReadUpdateArgs<ExtArgs>
|
|
2346
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2347
|
-
}
|
|
2348
|
-
deleteMany: {
|
|
2349
|
-
args: Prisma.AgentTranscriptReadDeleteManyArgs<ExtArgs>
|
|
2350
|
-
result: BatchPayload
|
|
2351
|
-
}
|
|
2352
|
-
updateMany: {
|
|
2353
|
-
args: Prisma.AgentTranscriptReadUpdateManyArgs<ExtArgs>
|
|
2354
|
-
result: BatchPayload
|
|
2355
|
-
}
|
|
2356
|
-
updateManyAndReturn: {
|
|
2357
|
-
args: Prisma.AgentTranscriptReadUpdateManyAndReturnArgs<ExtArgs>
|
|
2358
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>[]
|
|
2359
|
-
}
|
|
2360
|
-
upsert: {
|
|
2361
|
-
args: Prisma.AgentTranscriptReadUpsertArgs<ExtArgs>
|
|
2362
|
-
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentTranscriptReadPayload>
|
|
2363
|
-
}
|
|
2364
|
-
aggregate: {
|
|
2365
|
-
args: Prisma.AgentTranscriptReadAggregateArgs<ExtArgs>
|
|
2366
|
-
result: runtime.Types.Utils.Optional<Prisma.AggregateAgentTranscriptRead>
|
|
2367
|
-
}
|
|
2368
|
-
groupBy: {
|
|
2369
|
-
args: Prisma.AgentTranscriptReadGroupByArgs<ExtArgs>
|
|
2370
|
-
result: runtime.Types.Utils.Optional<Prisma.AgentTranscriptReadGroupByOutputType>[]
|
|
2371
|
-
}
|
|
2372
|
-
count: {
|
|
2373
|
-
args: Prisma.AgentTranscriptReadCountArgs<ExtArgs>
|
|
2374
|
-
result: runtime.Types.Utils.Optional<Prisma.AgentTranscriptReadCountAggregateOutputType> | number
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
2228
|
AgentGitHubInstallationsSnapshot: {
|
|
2379
2229
|
payload: Prisma.$AgentGitHubInstallationsSnapshotPayload<ExtArgs>
|
|
2380
2230
|
fields: Prisma.AgentGitHubInstallationsSnapshotFieldRefs
|
|
@@ -3462,34 +3312,6 @@ export const AgentCronRunRequestScalarFieldEnum = {
|
|
|
3462
3312
|
export type AgentCronRunRequestScalarFieldEnum = (typeof AgentCronRunRequestScalarFieldEnum)[keyof typeof AgentCronRunRequestScalarFieldEnum]
|
|
3463
3313
|
|
|
3464
3314
|
|
|
3465
|
-
export const AgentCronRunTranscriptScalarFieldEnum = {
|
|
3466
|
-
id: 'id',
|
|
3467
|
-
runId: 'runId',
|
|
3468
|
-
agentId: 'agentId',
|
|
3469
|
-
cronId: 'cronId',
|
|
3470
|
-
sessionId: 'sessionId',
|
|
3471
|
-
bytes: 'bytes',
|
|
3472
|
-
truncated: 'truncated',
|
|
3473
|
-
redactions: 'redactions',
|
|
3474
|
-
body: 'body',
|
|
3475
|
-
createdAt: 'createdAt'
|
|
3476
|
-
} as const
|
|
3477
|
-
|
|
3478
|
-
export type AgentCronRunTranscriptScalarFieldEnum = (typeof AgentCronRunTranscriptScalarFieldEnum)[keyof typeof AgentCronRunTranscriptScalarFieldEnum]
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
export const AgentTranscriptReadScalarFieldEnum = {
|
|
3482
|
-
id: 'id',
|
|
3483
|
-
runId: 'runId',
|
|
3484
|
-
agentId: 'agentId',
|
|
3485
|
-
reader: 'reader',
|
|
3486
|
-
scopeKind: 'scopeKind',
|
|
3487
|
-
at: 'at'
|
|
3488
|
-
} as const
|
|
3489
|
-
|
|
3490
|
-
export type AgentTranscriptReadScalarFieldEnum = (typeof AgentTranscriptReadScalarFieldEnum)[keyof typeof AgentTranscriptReadScalarFieldEnum]
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
3315
|
export const AgentGitHubInstallationsSnapshotScalarFieldEnum = {
|
|
3494
3316
|
id: 'id',
|
|
3495
3317
|
agentId: 'agentId',
|
|
@@ -3945,8 +3767,6 @@ export type GlobalOmitConfig = {
|
|
|
3945
3767
|
agentChatTokenUsageDailyByModel?: Prisma.AgentChatTokenUsageDailyByModelOmit
|
|
3946
3768
|
agentAsk?: Prisma.AgentAskOmit
|
|
3947
3769
|
agentCronRunRequest?: Prisma.AgentCronRunRequestOmit
|
|
3948
|
-
agentCronRunTranscript?: Prisma.AgentCronRunTranscriptOmit
|
|
3949
|
-
agentTranscriptRead?: Prisma.AgentTranscriptReadOmit
|
|
3950
3770
|
agentGitHubInstallationsSnapshot?: Prisma.AgentGitHubInstallationsSnapshotOmit
|
|
3951
3771
|
pushSubscription?: Prisma.PushSubscriptionOmit
|
|
3952
3772
|
chatThreadWatch?: Prisma.ChatThreadWatchOmit
|
|
@@ -75,8 +75,6 @@ export const ModelName = {
|
|
|
75
75
|
AgentChatTokenUsageDailyByModel: 'AgentChatTokenUsageDailyByModel',
|
|
76
76
|
AgentAsk: 'AgentAsk',
|
|
77
77
|
AgentCronRunRequest: 'AgentCronRunRequest',
|
|
78
|
-
AgentCronRunTranscript: 'AgentCronRunTranscript',
|
|
79
|
-
AgentTranscriptRead: 'AgentTranscriptRead',
|
|
80
78
|
AgentGitHubInstallationsSnapshot: 'AgentGitHubInstallationsSnapshot',
|
|
81
79
|
PushSubscription: 'PushSubscription',
|
|
82
80
|
ChatThreadWatch: 'ChatThreadWatch',
|
|
@@ -486,34 +484,6 @@ export const AgentCronRunRequestScalarFieldEnum = {
|
|
|
486
484
|
export type AgentCronRunRequestScalarFieldEnum = (typeof AgentCronRunRequestScalarFieldEnum)[keyof typeof AgentCronRunRequestScalarFieldEnum]
|
|
487
485
|
|
|
488
486
|
|
|
489
|
-
export const AgentCronRunTranscriptScalarFieldEnum = {
|
|
490
|
-
id: 'id',
|
|
491
|
-
runId: 'runId',
|
|
492
|
-
agentId: 'agentId',
|
|
493
|
-
cronId: 'cronId',
|
|
494
|
-
sessionId: 'sessionId',
|
|
495
|
-
bytes: 'bytes',
|
|
496
|
-
truncated: 'truncated',
|
|
497
|
-
redactions: 'redactions',
|
|
498
|
-
body: 'body',
|
|
499
|
-
createdAt: 'createdAt'
|
|
500
|
-
} as const
|
|
501
|
-
|
|
502
|
-
export type AgentCronRunTranscriptScalarFieldEnum = (typeof AgentCronRunTranscriptScalarFieldEnum)[keyof typeof AgentCronRunTranscriptScalarFieldEnum]
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
export const AgentTranscriptReadScalarFieldEnum = {
|
|
506
|
-
id: 'id',
|
|
507
|
-
runId: 'runId',
|
|
508
|
-
agentId: 'agentId',
|
|
509
|
-
reader: 'reader',
|
|
510
|
-
scopeKind: 'scopeKind',
|
|
511
|
-
at: 'at'
|
|
512
|
-
} as const
|
|
513
|
-
|
|
514
|
-
export type AgentTranscriptReadScalarFieldEnum = (typeof AgentTranscriptReadScalarFieldEnum)[keyof typeof AgentTranscriptReadScalarFieldEnum]
|
|
515
|
-
|
|
516
|
-
|
|
517
487
|
export const AgentGitHubInstallationsSnapshotScalarFieldEnum = {
|
|
518
488
|
id: 'id',
|
|
519
489
|
agentId: 'agentId',
|
package/prisma/client/models.ts
CHANGED
|
@@ -32,8 +32,6 @@ export type * from './models/AgentCronRunModelBreakdown.ts'
|
|
|
32
32
|
export type * from './models/AgentChatTokenUsageDailyByModel.ts'
|
|
33
33
|
export type * from './models/AgentAsk.ts'
|
|
34
34
|
export type * from './models/AgentCronRunRequest.ts'
|
|
35
|
-
export type * from './models/AgentCronRunTranscript.ts'
|
|
36
|
-
export type * from './models/AgentTranscriptRead.ts'
|
|
37
35
|
export type * from './models/AgentGitHubInstallationsSnapshot.ts'
|
|
38
36
|
export type * from './models/PushSubscription.ts'
|
|
39
37
|
export type * from './models/ChatThreadWatch.ts'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- prompt-audit-removal 2.3: the cron-run transcript API is removed. Drop the
|
|
2
|
+
-- redacted transcript store and its per-read audit table (stored transcripts
|
|
3
|
+
-- are deleted; approved). Neither table has FKs in or out. IF EXISTS keeps
|
|
4
|
+
-- the drop idempotent. Dropping a table drops its indexes.
|
|
5
|
+
-- DropTable
|
|
6
|
+
DROP TABLE IF EXISTS "AgentCronRunTranscript";
|
|
7
|
+
|
|
8
|
+
-- DropTable
|
|
9
|
+
DROP TABLE IF EXISTS "AgentTranscriptRead";
|
|
@@ -590,40 +590,6 @@ model AgentCronRunRequest {
|
|
|
590
590
|
@@index([agentId, requestedAt])
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
// ─── Cron-run transcripts (COS-43.1) ────────────────────────────────────────
|
|
594
|
-
// One redacted session transcript per cron run, uploaded by the agent runtime
|
|
595
|
-
// (already redacted + tail-truncated to 1 MiB) and served only to admin /
|
|
596
|
-
// platform callers behind SHIPWRIGHT_TRANSCRIPT_API_ENABLED. No FK on runId:
|
|
597
|
-
// the retention sweep (newest 200 per agent) is the only lifecycle. The body
|
|
598
|
-
// is never logged. AgentTranscriptRead is the audit row written before every
|
|
599
|
-
// transcript read.
|
|
600
|
-
|
|
601
|
-
model AgentCronRunTranscript {
|
|
602
|
-
id String @id @default(cuid())
|
|
603
|
-
runId String @unique
|
|
604
|
-
agentId String
|
|
605
|
-
cronId String
|
|
606
|
-
sessionId String?
|
|
607
|
-
bytes Int
|
|
608
|
-
truncated Boolean
|
|
609
|
-
redactions Int
|
|
610
|
-
body String @db.Text
|
|
611
|
-
createdAt DateTime @default(now())
|
|
612
|
-
|
|
613
|
-
@@index([agentId, createdAt])
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
model AgentTranscriptRead {
|
|
617
|
-
id String @id @default(cuid())
|
|
618
|
-
runId String
|
|
619
|
-
agentId String
|
|
620
|
-
reader String
|
|
621
|
-
scopeKind String
|
|
622
|
-
at DateTime @default(now())
|
|
623
|
-
|
|
624
|
-
@@index([agentId, at])
|
|
625
|
-
}
|
|
626
|
-
|
|
627
593
|
// ─── Agent GitHub Installations Snapshot ────────────────────────────────────
|
|
628
594
|
// One row per agent holding the agent's most recently reported GitHub App
|
|
629
595
|
// installations (owner, installation id, state, sanitized lastError). PUT
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* admin/src/account-member-removal.integration.test.ts
|
|
3
|
+
* AccountMemberService.remove deletes the removed person's access and
|
|
4
|
+
* notification rows (AgentMember, ChatThreadWatch, PushSubscription,
|
|
5
|
+
* UserNotificationPrefs), atomically with the removal. Real Postgres.
|
|
6
|
+
*
|
|
7
|
+
* Requires DATABASE_URL_ADMIN_TEST; skips otherwise.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
11
|
+
import type { PrismaClient } from "../prisma/client/client.ts";
|
|
12
|
+
import {
|
|
13
|
+
AccountMemberNotFoundError,
|
|
14
|
+
AccountMemberService,
|
|
15
|
+
LastOwnerError,
|
|
16
|
+
} from "./account-members.ts";
|
|
17
|
+
import { AgentMemberService } from "./agent-members.ts";
|
|
18
|
+
import { createAdminPrismaClient } from "./prisma-client.ts";
|
|
19
|
+
|
|
20
|
+
const TEST_DB = process.env.DATABASE_URL_ADMIN_TEST;
|
|
21
|
+
const describeOrSkip = TEST_DB ? describe : describe.skip;
|
|
22
|
+
|
|
23
|
+
describeOrSkip("AccountMemberService.remove cleanup (integration)", () => {
|
|
24
|
+
let prisma: PrismaClient;
|
|
25
|
+
let service: AccountMemberService;
|
|
26
|
+
let acme: string;
|
|
27
|
+
let agentId: string;
|
|
28
|
+
|
|
29
|
+
async function seedRows(email: string, memberId: string | null) {
|
|
30
|
+
await prisma.agentMember.create({ data: { agentId, email, memberId } });
|
|
31
|
+
await prisma.chatThreadWatch.create({
|
|
32
|
+
data: { userEmail: email, threadId: `t-${email}`, agentId, memberId },
|
|
33
|
+
});
|
|
34
|
+
await prisma.pushSubscription.create({
|
|
35
|
+
data: {
|
|
36
|
+
userEmail: email,
|
|
37
|
+
endpoint: `ep-${email}`,
|
|
38
|
+
p256dh: "p",
|
|
39
|
+
auth: "a",
|
|
40
|
+
memberId,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
await prisma.userNotificationPrefs.create({
|
|
44
|
+
data: { userEmail: email, memberId },
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function rowCounts(email: string) {
|
|
49
|
+
return Promise.all([
|
|
50
|
+
prisma.agentMember.count({ where: { email } }),
|
|
51
|
+
prisma.chatThreadWatch.count({ where: { userEmail: email } }),
|
|
52
|
+
prisma.pushSubscription.count({ where: { userEmail: email } }),
|
|
53
|
+
prisma.userNotificationPrefs.count({ where: { userEmail: email } }),
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function addMember(email: string, role: "owner" | "member") {
|
|
58
|
+
return prisma.accountMember.create({
|
|
59
|
+
data: { accountId: acme, email, role },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
beforeEach(async () => {
|
|
64
|
+
prisma = createAdminPrismaClient(TEST_DB as string);
|
|
65
|
+
service = new AccountMemberService(prisma);
|
|
66
|
+
await prisma.userNotificationPrefs.deleteMany();
|
|
67
|
+
await prisma.chatThreadWatch.deleteMany();
|
|
68
|
+
await prisma.pushSubscription.deleteMany();
|
|
69
|
+
await prisma.agentMember.deleteMany();
|
|
70
|
+
await prisma.accountInvite.deleteMany();
|
|
71
|
+
await prisma.accountMember.deleteMany();
|
|
72
|
+
await prisma.agent.deleteMany();
|
|
73
|
+
await prisma.account.deleteMany();
|
|
74
|
+
acme = (await prisma.account.create({ data: { name: "Acme" } })).id;
|
|
75
|
+
agentId = (
|
|
76
|
+
await prisma.agent.create({
|
|
77
|
+
data: { id: "rm-agent", name: "rm-agent", accountId: acme },
|
|
78
|
+
})
|
|
79
|
+
).id;
|
|
80
|
+
await addMember("owner@acme.com", "owner");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
afterEach(async () => {
|
|
84
|
+
await prisma.$disconnect();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("deletes the person's rows by memberId and by email where memberId is null, and no one else's", async () => {
|
|
88
|
+
const bob = await addMember("bob@acme.com", "member");
|
|
89
|
+
const carol = await addMember("carol@acme.com", "member");
|
|
90
|
+
await seedRows("bob@acme.com", bob.id);
|
|
91
|
+
await seedRows("carol@acme.com", carol.id);
|
|
92
|
+
await service.remove(acme, "bob@acme.com");
|
|
93
|
+
|
|
94
|
+
expect(await rowCounts("bob@acme.com")).toEqual([0, 0, 0, 0]);
|
|
95
|
+
expect(await rowCounts("carol@acme.com")).toEqual([1, 1, 1, 1]);
|
|
96
|
+
expect(await prisma.accountMember.count({ where: { id: bob.id } })).toBe(0);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("deletes null-memberId rows matched by email (case-insensitive)", async () => {
|
|
100
|
+
await addMember("dee@acme.com", "member");
|
|
101
|
+
await seedRows("Dee@Acme.com", null);
|
|
102
|
+
await service.remove(acme, "dee@acme.com");
|
|
103
|
+
expect(await rowCounts("Dee@Acme.com")).toEqual([0, 0, 0, 0]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("deletes rows stamped with the member's id even if the stored email differs", async () => {
|
|
107
|
+
const eve = await addMember("eve@acme.com", "member");
|
|
108
|
+
await seedRows("eve-old@acme.com", eve.id);
|
|
109
|
+
await service.remove(acme, "eve@acme.com");
|
|
110
|
+
expect(await rowCounts("eve-old@acme.com")).toEqual([0, 0, 0, 0]);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it("deletes nothing when the last owner is refused", async () => {
|
|
114
|
+
const owner = await prisma.accountMember.findUniqueOrThrow({
|
|
115
|
+
where: { email: "owner@acme.com" },
|
|
116
|
+
});
|
|
117
|
+
await seedRows("owner@acme.com", owner.id);
|
|
118
|
+
await expect(service.remove(acme, "owner@acme.com")).rejects.toBeInstanceOf(
|
|
119
|
+
LastOwnerError,
|
|
120
|
+
);
|
|
121
|
+
expect(await rowCounts("owner@acme.com")).toEqual([1, 1, 1, 1]);
|
|
122
|
+
expect(await prisma.accountMember.count()).toBe(1);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("deletes nothing when the member is unknown", async () => {
|
|
126
|
+
await seedRows("ghost@acme.com", null);
|
|
127
|
+
await expect(service.remove(acme, "ghost@acme.com")).rejects.toBeInstanceOf(
|
|
128
|
+
AccountMemberNotFoundError,
|
|
129
|
+
);
|
|
130
|
+
expect(await rowCounts("ghost@acme.com")).toEqual([1, 1, 1, 1]);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("rolls back the removal and the deletes when a step fails partway", async () => {
|
|
134
|
+
const fay = await addMember("fay@acme.com", "member");
|
|
135
|
+
await seedRows("fay@acme.com", fay.id);
|
|
136
|
+
// Fail the final AccountMember delete after the row deletes have run.
|
|
137
|
+
const failing = new Proxy(prisma, {
|
|
138
|
+
get(target, prop, receiver) {
|
|
139
|
+
if (prop !== "$transaction") return Reflect.get(target, prop, receiver);
|
|
140
|
+
return (fn: (tx: unknown) => Promise<unknown>) =>
|
|
141
|
+
target.$transaction(async (tx) =>
|
|
142
|
+
fn(
|
|
143
|
+
new Proxy(tx, {
|
|
144
|
+
get(t, p, r) {
|
|
145
|
+
if (p !== "accountMember") return Reflect.get(t, p, r);
|
|
146
|
+
return new Proxy(t.accountMember, {
|
|
147
|
+
get(m, mp, mr) {
|
|
148
|
+
if (mp === "delete") {
|
|
149
|
+
return async () => {
|
|
150
|
+
throw new Error("boom");
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return Reflect.get(m, mp, mr);
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
}) as PrismaClient;
|
|
162
|
+
|
|
163
|
+
await expect(
|
|
164
|
+
new AccountMemberService(failing).remove(acme, "fay@acme.com"),
|
|
165
|
+
).rejects.toThrow("boom");
|
|
166
|
+
expect(await rowCounts("fay@acme.com")).toEqual([1, 1, 1, 1]);
|
|
167
|
+
expect(await prisma.accountMember.count({ where: { id: fay.id } })).toBe(1);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("after re-adding, the person can be added to the same agent again with no earlier settings", async () => {
|
|
171
|
+
const gus = await addMember("gus@acme.com", "member");
|
|
172
|
+
await seedRows("gus@acme.com", gus.id);
|
|
173
|
+
await service.remove(acme, "gus@acme.com");
|
|
174
|
+
|
|
175
|
+
const readded = await service.add(acme, "gus@acme.com");
|
|
176
|
+
expect(readded.id).not.toBe(gus.id);
|
|
177
|
+
|
|
178
|
+
const agentMembers = new AgentMemberService(prisma);
|
|
179
|
+
await agentMembers.add(agentId, "gus@acme.com");
|
|
180
|
+
expect(await agentMembers.exists(agentId, "gus@acme.com")).toBe(true);
|
|
181
|
+
const rows = await prisma.agentMember.findMany({
|
|
182
|
+
where: { email: "gus@acme.com" },
|
|
183
|
+
});
|
|
184
|
+
expect(rows).toHaveLength(1);
|
|
185
|
+
expect(rows[0]?.id).not.toBe(undefined);
|
|
186
|
+
expect(await prisma.chatThreadWatch.count()).toBe(0);
|
|
187
|
+
expect(await prisma.pushSubscription.count()).toBe(0);
|
|
188
|
+
expect(await prisma.userNotificationPrefs.count()).toBe(0);
|
|
189
|
+
});
|
|
190
|
+
});
|
package/src/account-members.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { AccountMember, PrismaClient } from "../prisma/client/client.ts";
|
|
10
10
|
import { normalizeEmail } from "./account-email.ts";
|
|
11
|
-
import { stampMemberId } from "./member-id-stamp.ts";
|
|
11
|
+
import { deleteMemberRows, stampMemberId } from "./member-id-stamp.ts";
|
|
12
12
|
import type { PrismaTransactionClient } from "./prisma-tx.ts";
|
|
13
13
|
|
|
14
14
|
export type { AccountMember };
|
|
@@ -74,8 +74,14 @@ export class AccountMemberService {
|
|
|
74
74
|
: run(client);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Remove a member and their access and notification rows (AgentMember,
|
|
79
|
+
* ChatThreadWatch, PushSubscription, UserNotificationPrefs), matched by
|
|
80
|
+
* memberId and by email where memberId is null, in one transaction.
|
|
81
|
+
*/
|
|
77
82
|
async remove(accountId: string, email: string): Promise<void> {
|
|
78
83
|
await this.guardedChange(accountId, email, async (tx, member) => {
|
|
84
|
+
await deleteMemberRows(tx, member.email, member.id);
|
|
79
85
|
await tx.accountMember.delete({ where: { id: member.id } });
|
|
80
86
|
});
|
|
81
87
|
}
|
package/src/admin-boot.ts
CHANGED
|
@@ -104,7 +104,6 @@ import {
|
|
|
104
104
|
} from "./installation-ports.ts";
|
|
105
105
|
import { CronRunNowService } from "./cron-run-now.ts";
|
|
106
106
|
import { parseCronRunNowConfig } from "./cron-run-now-config.ts";
|
|
107
|
-
import { CronRunTranscriptService } from "./cron-run-transcripts.ts";
|
|
108
107
|
import { isDevAuthAllowed } from "./dev-auth-guard.ts";
|
|
109
108
|
import { HttpGithubAppProvisioningClient } from "./github-app-provisioning-client.ts";
|
|
110
109
|
import {
|
|
@@ -140,7 +139,6 @@ import { SpecialtyTypes } from "./specialty-types.ts";
|
|
|
140
139
|
import { runStartupPolicyReconcile } from "./startup-policy-reconcile.ts";
|
|
141
140
|
import { runTemplateSeed } from "./template-seed.ts";
|
|
142
141
|
import { makeStrictTokenCrypto, makeTokenCrypto } from "./token-crypto.ts";
|
|
143
|
-
import { parseTranscriptConfig } from "./transcript-config.ts";
|
|
144
142
|
import {
|
|
145
143
|
resolveTrialExpirySweepIntervalMs,
|
|
146
144
|
TrialExpirySweeper,
|
|
@@ -372,9 +370,6 @@ export async function startAdmin(
|
|
|
372
370
|
// Cron run-now (COS-42.1).
|
|
373
371
|
const cronRunNowConfig = parseCronRunNowConfig(process.env);
|
|
374
372
|
|
|
375
|
-
// Cron-run transcript API (COS-43.1): flag off by default.
|
|
376
|
-
const transcriptConfig = parseTranscriptConfig(process.env);
|
|
377
|
-
|
|
378
373
|
// Per-repo GitHub access check (COS-44.1): flag off by default.
|
|
379
374
|
const repoAccessConfig = parseRepoAccessConfig(process.env);
|
|
380
375
|
|
|
@@ -546,8 +541,6 @@ export async function startAdmin(
|
|
|
546
541
|
adminApiKeys,
|
|
547
542
|
agentTokenService,
|
|
548
543
|
anthropicFederationEnabled,
|
|
549
|
-
transcriptUploadEnabled: transcriptConfig.enabled,
|
|
550
|
-
loopTranscriptAgentIds: transcriptConfig.loopAgentIds,
|
|
551
544
|
repoAccessCheckEnabled: repoAccessConfig.enabled,
|
|
552
545
|
},
|
|
553
546
|
adminApi: {
|
|
@@ -601,10 +594,6 @@ export async function startAdmin(
|
|
|
601
594
|
store: new CronRunNowService(prisma),
|
|
602
595
|
},
|
|
603
596
|
...(chatClient ? { chatClient } : {}),
|
|
604
|
-
transcripts: {
|
|
605
|
-
config: transcriptConfig,
|
|
606
|
-
store: new CronRunTranscriptService(prisma),
|
|
607
|
-
},
|
|
608
597
|
...resolvedExtensions.apiDeps,
|
|
609
598
|
},
|
|
610
599
|
doc: {
|
|
@@ -32,13 +32,20 @@ interface AccountPageOpts {
|
|
|
32
32
|
isAdmin?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export const REMOVE_MEMBER_CONFIRM =
|
|
36
|
+
"Remove this member? Their agent access and notification settings are removed too.";
|
|
37
|
+
|
|
35
38
|
function emailForm(
|
|
36
39
|
action: string,
|
|
37
40
|
email: string,
|
|
38
41
|
label: string,
|
|
39
42
|
danger = false,
|
|
43
|
+
confirmText?: string,
|
|
40
44
|
): string {
|
|
41
|
-
|
|
45
|
+
const onsubmit = confirmText
|
|
46
|
+
? ` onsubmit="return confirm('${confirmText}')"`
|
|
47
|
+
: "";
|
|
48
|
+
return `<form method="POST" action="${ACCOUNT_PATH}/${action}"${onsubmit} style="display:inline;margin:0">
|
|
42
49
|
<input type="hidden" name="email" value="${escapeHtml(email)}" />
|
|
43
50
|
<button type="submit" class="btn ${danger ? "btn-danger" : "btn-secondary"}" style="font-size:12px;padding:4px 10px">${label}</button>
|
|
44
51
|
</form>`;
|
|
@@ -50,7 +57,13 @@ function renderMemberRow(m: AccountMember, isOwner: boolean): string {
|
|
|
50
57
|
m.role === "owner"
|
|
51
58
|
? emailForm("members/demote", m.email, "Demote")
|
|
52
59
|
: emailForm("members/promote", m.email, "Make owner"),
|
|
53
|
-
emailForm(
|
|
60
|
+
emailForm(
|
|
61
|
+
"members/remove",
|
|
62
|
+
m.email,
|
|
63
|
+
"Remove",
|
|
64
|
+
true,
|
|
65
|
+
REMOVE_MEMBER_CONFIRM,
|
|
66
|
+
),
|
|
54
67
|
].join(" ")
|
|
55
68
|
: "";
|
|
56
69
|
return `<tr>
|
|
@@ -72,6 +72,10 @@ describe("renderAccountPage", () => {
|
|
|
72
72
|
expect(html).toContain('action="/admin/account/rename"');
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
test("remove form confirms that access and notification settings are removed", () => {
|
|
76
|
+
expect(render(true)).toContain("notification settings are removed");
|
|
77
|
+
});
|
|
78
|
+
|
|
75
79
|
test("member sees read-only page", () => {
|
|
76
80
|
const html = render(false);
|
|
77
81
|
expect(html).not.toContain('action="/admin/account/');
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { AccountInvite } from "./account-invites.ts";
|
|
8
8
|
import type { AccountMember } from "./account-members.ts";
|
|
9
9
|
import type { AccountWithCounts } from "./accounts.ts";
|
|
10
|
+
import { REMOVE_MEMBER_CONFIRM } from "./admin-ui-account-pages.ts";
|
|
10
11
|
import { renderAdminPage } from "./admin-ui-layout.ts";
|
|
11
12
|
import {
|
|
12
13
|
buildSettingsNav,
|
|
@@ -101,14 +102,18 @@ function postForm(
|
|
|
101
102
|
fields: Record<string, string>,
|
|
102
103
|
label: string,
|
|
103
104
|
danger = false,
|
|
105
|
+
confirmText?: string,
|
|
104
106
|
): string {
|
|
107
|
+
const onsubmit = confirmText
|
|
108
|
+
? ` onsubmit="return confirm('${confirmText}')"`
|
|
109
|
+
: "";
|
|
105
110
|
const hidden = Object.entries(fields)
|
|
106
111
|
.map(
|
|
107
112
|
([k, v]) =>
|
|
108
113
|
`<input type="hidden" name="${escapeHtml(k)}" value="${escapeHtml(v)}" />`,
|
|
109
114
|
)
|
|
110
115
|
.join("");
|
|
111
|
-
return `<form method="POST" action="${ADMIN_ACCOUNTS_PATH}/${escapeHtml(accountId)}/${action}" style="display:inline;margin:0">${hidden}
|
|
116
|
+
return `<form method="POST" action="${ADMIN_ACCOUNTS_PATH}/${escapeHtml(accountId)}/${action}"${onsubmit} style="display:inline;margin:0">${hidden}
|
|
112
117
|
<button type="submit" class="btn ${danger ? "btn-danger" : "btn-secondary"}" style="font-size:12px;padding:4px 10px">${label}</button>
|
|
113
118
|
</form>`;
|
|
114
119
|
}
|
|
@@ -139,7 +144,14 @@ export function renderAccountDetailPage(opts: AccountDetailPageOpts): string {
|
|
|
139
144
|
m.role === "owner"
|
|
140
145
|
? postForm(id, "members/demote", { email: m.email }, "Demote")
|
|
141
146
|
: postForm(id, "members/promote", { email: m.email }, "Make owner"),
|
|
142
|
-
postForm(
|
|
147
|
+
postForm(
|
|
148
|
+
id,
|
|
149
|
+
"members/remove",
|
|
150
|
+
{ email: m.email },
|
|
151
|
+
"Remove",
|
|
152
|
+
true,
|
|
153
|
+
REMOVE_MEMBER_CONFIRM,
|
|
154
|
+
),
|
|
143
155
|
].join(" ")}</td>
|
|
144
156
|
</tr>`,
|
|
145
157
|
)
|