@app-vitals/agent-admin 1.73.0 → 1.75.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.
Files changed (33) hide show
  1. package/openapi.platform.json +199 -0
  2. package/package.json +2 -2
  3. package/prisma/client/internal/class.ts +4 -4
  4. package/prisma/client/internal/prismaNamespace.ts +4 -0
  5. package/prisma/client/internal/prismaNamespaceBrowser.ts +4 -0
  6. package/prisma/client/models/AgentMember.ts +36 -1
  7. package/prisma/client/models/ChatThreadWatch.ts +29 -1
  8. package/prisma/client/models/PushSubscription.ts +29 -1
  9. package/prisma/client/models/UserNotificationPrefs.ts +29 -1
  10. package/prisma/migrations/20261118000000_add_member_id_columns/migration.sql +14 -0
  11. package/prisma/schema/schema.prisma +5 -0
  12. package/scripts/backfill-member-id.ts +41 -0
  13. package/src/admin-boot.ts +13 -0
  14. package/src/admin-dev-login.smoke.test.ts +1 -0
  15. package/src/admin-local-agent.smoke.test.ts +9 -1
  16. package/src/admin-spec.ts +17 -0
  17. package/src/admin-ui.fixtures.ts +1 -0
  18. package/src/admin-ui.smoke.test.ts +57 -8
  19. package/src/agent-cron-run-stats.smoke.test.ts +1 -0
  20. package/src/agent-members.unit.test.ts +6 -1
  21. package/src/agents-api.smoke.test.ts +5 -0
  22. package/src/api.smoke.test.ts +1 -0
  23. package/src/chat.smoke.test.ts +2 -0
  24. package/src/member-id-backfill.integration.test.ts +167 -0
  25. package/src/member-id-backfill.ts +180 -0
  26. package/src/member-id-backfill.unit.test.ts +12 -0
  27. package/src/openapi-schemas.ts +31 -0
  28. package/src/principal-lookup.ts +67 -0
  29. package/src/principal-lookup.unit.test.ts +104 -0
  30. package/src/principals-api.integration.test.ts +115 -0
  31. package/src/principals-api.ts +142 -0
  32. package/src/principals-api.unit.test.ts +83 -0
  33. package/src/slack-provisioning.integration.test.ts +1 -0
@@ -4490,6 +4490,72 @@
4490
4490
  "kind",
4491
4491
  "key"
4492
4492
  ]
4493
+ },
4494
+ "PrincipalLookupResponse": {
4495
+ "type": "object",
4496
+ "properties": {
4497
+ "principals": {
4498
+ "type": "array",
4499
+ "items": {
4500
+ "$ref": "#/components/schemas/Principal"
4501
+ }
4502
+ },
4503
+ "notFound": {
4504
+ "type": "array",
4505
+ "items": {
4506
+ "type": "string"
4507
+ }
4508
+ }
4509
+ },
4510
+ "required": [
4511
+ "principals",
4512
+ "notFound"
4513
+ ]
4514
+ },
4515
+ "Principal": {
4516
+ "type": "object",
4517
+ "properties": {
4518
+ "id": {
4519
+ "type": "string",
4520
+ "example": "clx1abc"
4521
+ },
4522
+ "type": {
4523
+ "type": "string",
4524
+ "enum": [
4525
+ "user",
4526
+ "agent"
4527
+ ]
4528
+ },
4529
+ "email": {
4530
+ "type": [
4531
+ "string",
4532
+ "null"
4533
+ ],
4534
+ "description": "null for agents",
4535
+ "example": "o@acme.com"
4536
+ }
4537
+ },
4538
+ "required": [
4539
+ "id",
4540
+ "type",
4541
+ "email"
4542
+ ]
4543
+ },
4544
+ "PrincipalLookupBody": {
4545
+ "type": "object",
4546
+ "properties": {
4547
+ "ids": {
4548
+ "type": "array",
4549
+ "items": {
4550
+ "type": "string",
4551
+ "minLength": 1
4552
+ },
4553
+ "maxItems": 500
4554
+ }
4555
+ },
4556
+ "required": [
4557
+ "ids"
4558
+ ]
4493
4559
  }
4494
4560
  },
4495
4561
  "parameters": {}
@@ -9125,6 +9191,139 @@
9125
9191
  }
9126
9192
  }
9127
9193
  }
9194
+ },
9195
+ "/principals/lookup": {
9196
+ "post": {
9197
+ "tags": [
9198
+ "principals"
9199
+ ],
9200
+ "summary": "Batch-resolve principal ids",
9201
+ "description": "Admin-only. Resolves AccountMember ids (type user) and Agent ids (type agent) to type and email. Agents have no email (null). Unknown ids are listed in notFound; they are not an error.",
9202
+ "requestBody": {
9203
+ "content": {
9204
+ "application/json": {
9205
+ "schema": {
9206
+ "$ref": "#/components/schemas/PrincipalLookupBody"
9207
+ }
9208
+ }
9209
+ }
9210
+ },
9211
+ "responses": {
9212
+ "200": {
9213
+ "description": "Resolved principals and unknown ids",
9214
+ "content": {
9215
+ "application/json": {
9216
+ "schema": {
9217
+ "$ref": "#/components/schemas/PrincipalLookupResponse"
9218
+ }
9219
+ }
9220
+ }
9221
+ },
9222
+ "400": {
9223
+ "description": "Bad request",
9224
+ "content": {
9225
+ "application/json": {
9226
+ "schema": {
9227
+ "$ref": "#/components/schemas/Error"
9228
+ }
9229
+ }
9230
+ }
9231
+ },
9232
+ "401": {
9233
+ "description": "Unauthorized",
9234
+ "content": {
9235
+ "application/json": {
9236
+ "schema": {
9237
+ "$ref": "#/components/schemas/Error"
9238
+ }
9239
+ }
9240
+ }
9241
+ },
9242
+ "403": {
9243
+ "description": "Forbidden (non-admin caller)",
9244
+ "content": {
9245
+ "application/json": {
9246
+ "schema": {
9247
+ "$ref": "#/components/schemas/Error"
9248
+ }
9249
+ }
9250
+ }
9251
+ }
9252
+ }
9253
+ }
9254
+ },
9255
+ "/principals/by-email": {
9256
+ "get": {
9257
+ "tags": [
9258
+ "principals"
9259
+ ],
9260
+ "summary": "Resolve an email to its principal id",
9261
+ "description": "Admin-only. Case-insensitive (emails are stored lowercased). 404 when no member has the email.",
9262
+ "parameters": [
9263
+ {
9264
+ "schema": {
9265
+ "type": "string",
9266
+ "minLength": 1,
9267
+ "example": "o@acme.com"
9268
+ },
9269
+ "required": true,
9270
+ "name": "email",
9271
+ "in": "query"
9272
+ }
9273
+ ],
9274
+ "responses": {
9275
+ "200": {
9276
+ "description": "Principal",
9277
+ "content": {
9278
+ "application/json": {
9279
+ "schema": {
9280
+ "$ref": "#/components/schemas/Principal"
9281
+ }
9282
+ }
9283
+ }
9284
+ },
9285
+ "400": {
9286
+ "description": "Bad request",
9287
+ "content": {
9288
+ "application/json": {
9289
+ "schema": {
9290
+ "$ref": "#/components/schemas/Error"
9291
+ }
9292
+ }
9293
+ }
9294
+ },
9295
+ "401": {
9296
+ "description": "Unauthorized",
9297
+ "content": {
9298
+ "application/json": {
9299
+ "schema": {
9300
+ "$ref": "#/components/schemas/Error"
9301
+ }
9302
+ }
9303
+ }
9304
+ },
9305
+ "403": {
9306
+ "description": "Forbidden (non-admin caller)",
9307
+ "content": {
9308
+ "application/json": {
9309
+ "schema": {
9310
+ "$ref": "#/components/schemas/Error"
9311
+ }
9312
+ }
9313
+ }
9314
+ },
9315
+ "404": {
9316
+ "description": "No principal with that email",
9317
+ "content": {
9318
+ "application/json": {
9319
+ "schema": {
9320
+ "$ref": "#/components/schemas/Error"
9321
+ }
9322
+ }
9323
+ }
9324
+ }
9325
+ }
9326
+ }
9128
9327
  }
9129
9328
  },
9130
9329
  "webhooks": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-admin",
3
- "version": "1.73.0",
3
+ "version": "1.75.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@anthropic-ai/sdk": "0.137.0",
46
- "@app-vitals/agent-lib": "1.73.0",
46
+ "@app-vitals/agent-lib": "1.75.0",
47
47
  "@hono/zod-openapi": "^1.0.0",
48
48
  "@prisma/adapter-pg": "^7.10.0",
49
49
  "@prisma/client": "^7.10.0",