@app-vitals/agent-admin 1.64.0 → 1.66.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 +1 -1
- package/openapi.platform.json +6 -1
- package/package.json +2 -2
- package/prisma/client/internal/class.ts +4 -4
- package/prisma/client/internal/prismaNamespace.ts +1 -0
- package/prisma/client/internal/prismaNamespaceBrowser.ts +1 -0
- package/prisma/client/models/AgentTemplateItem.ts +36 -1
- package/prisma/migrations/20261117000000_add_agent_template_item_managed_by/migration.sql +5 -0
- package/prisma/schema/schema.prisma +3 -0
- package/src/admin-boot.boot-order.unit.test.ts +13 -1
- package/src/admin-boot.ts +25 -1
- package/src/admin-ui-pages.ts +30 -6
- package/src/admin-ui-pages.unit.test.ts +36 -1
- package/src/admin-ui-slack-config-token-flows.smoke.test.ts +346 -0
- package/src/admin-ui-templates-pages.ts +15 -1
- package/src/admin-ui-templates-pages.unit.test.ts +9 -0
- package/src/admin-ui-templates.smoke.test.ts +38 -0
- package/src/admin-ui.ts +46 -2
- package/src/agent-deletion.ts +39 -5
- package/src/agent-deletion.unit.test.ts +141 -0
- package/src/agent-templates-api.ts +1 -0
- package/src/agent-templates.ts +184 -9
- package/src/agents-api.smoke.test.ts +107 -1
- package/src/agents-api.ts +12 -4
- package/src/openapi-schemas.ts +9 -2
- package/src/slack-config-token-resolve.unit.test.ts +108 -0
- package/src/slack-config-token.ts +51 -0
- package/src/slack-provisioning-service.integration.test.ts +189 -1
- package/src/slack-provisioning-service.ts +43 -9
- package/src/template-seed.integration.test.ts +408 -0
- package/src/template-seed.ts +222 -0
- package/src/template-seed.unit.test.ts +272 -0
|
@@ -29,6 +29,7 @@ export type AgentTemplateItemMinAggregateOutputType = {
|
|
|
29
29
|
templateId: string | null
|
|
30
30
|
kind: string | null
|
|
31
31
|
key: string | null
|
|
32
|
+
managedBy: string | null
|
|
32
33
|
createdAt: Date | null
|
|
33
34
|
updatedAt: Date | null
|
|
34
35
|
}
|
|
@@ -38,6 +39,7 @@ export type AgentTemplateItemMaxAggregateOutputType = {
|
|
|
38
39
|
templateId: string | null
|
|
39
40
|
kind: string | null
|
|
40
41
|
key: string | null
|
|
42
|
+
managedBy: string | null
|
|
41
43
|
createdAt: Date | null
|
|
42
44
|
updatedAt: Date | null
|
|
43
45
|
}
|
|
@@ -48,6 +50,7 @@ export type AgentTemplateItemCountAggregateOutputType = {
|
|
|
48
50
|
kind: number
|
|
49
51
|
key: number
|
|
50
52
|
payload: number
|
|
53
|
+
managedBy: number
|
|
51
54
|
createdAt: number
|
|
52
55
|
updatedAt: number
|
|
53
56
|
_all: number
|
|
@@ -59,6 +62,7 @@ export type AgentTemplateItemMinAggregateInputType = {
|
|
|
59
62
|
templateId?: true
|
|
60
63
|
kind?: true
|
|
61
64
|
key?: true
|
|
65
|
+
managedBy?: true
|
|
62
66
|
createdAt?: true
|
|
63
67
|
updatedAt?: true
|
|
64
68
|
}
|
|
@@ -68,6 +72,7 @@ export type AgentTemplateItemMaxAggregateInputType = {
|
|
|
68
72
|
templateId?: true
|
|
69
73
|
kind?: true
|
|
70
74
|
key?: true
|
|
75
|
+
managedBy?: true
|
|
71
76
|
createdAt?: true
|
|
72
77
|
updatedAt?: true
|
|
73
78
|
}
|
|
@@ -78,6 +83,7 @@ export type AgentTemplateItemCountAggregateInputType = {
|
|
|
78
83
|
kind?: true
|
|
79
84
|
key?: true
|
|
80
85
|
payload?: true
|
|
86
|
+
managedBy?: true
|
|
81
87
|
createdAt?: true
|
|
82
88
|
updatedAt?: true
|
|
83
89
|
_all?: true
|
|
@@ -161,6 +167,7 @@ export type AgentTemplateItemGroupByOutputType = {
|
|
|
161
167
|
kind: string
|
|
162
168
|
key: string
|
|
163
169
|
payload: runtime.JsonValue
|
|
170
|
+
managedBy: string | null
|
|
164
171
|
createdAt: Date
|
|
165
172
|
updatedAt: Date
|
|
166
173
|
_count: AgentTemplateItemCountAggregateOutputType | null
|
|
@@ -192,6 +199,7 @@ export type AgentTemplateItemWhereInput = {
|
|
|
192
199
|
kind?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
193
200
|
key?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
194
201
|
payload?: Prisma.JsonFilter<"AgentTemplateItem">
|
|
202
|
+
managedBy?: Prisma.StringNullableFilter<"AgentTemplateItem"> | string | null
|
|
195
203
|
createdAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
196
204
|
updatedAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
197
205
|
template?: Prisma.XOR<Prisma.AgentTemplateScalarRelationFilter, Prisma.AgentTemplateWhereInput>
|
|
@@ -203,6 +211,7 @@ export type AgentTemplateItemOrderByWithRelationInput = {
|
|
|
203
211
|
kind?: Prisma.SortOrder
|
|
204
212
|
key?: Prisma.SortOrder
|
|
205
213
|
payload?: Prisma.SortOrder
|
|
214
|
+
managedBy?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
206
215
|
createdAt?: Prisma.SortOrder
|
|
207
216
|
updatedAt?: Prisma.SortOrder
|
|
208
217
|
template?: Prisma.AgentTemplateOrderByWithRelationInput
|
|
@@ -218,6 +227,7 @@ export type AgentTemplateItemWhereUniqueInput = Prisma.AtLeast<{
|
|
|
218
227
|
kind?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
219
228
|
key?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
220
229
|
payload?: Prisma.JsonFilter<"AgentTemplateItem">
|
|
230
|
+
managedBy?: Prisma.StringNullableFilter<"AgentTemplateItem"> | string | null
|
|
221
231
|
createdAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
222
232
|
updatedAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
223
233
|
template?: Prisma.XOR<Prisma.AgentTemplateScalarRelationFilter, Prisma.AgentTemplateWhereInput>
|
|
@@ -229,6 +239,7 @@ export type AgentTemplateItemOrderByWithAggregationInput = {
|
|
|
229
239
|
kind?: Prisma.SortOrder
|
|
230
240
|
key?: Prisma.SortOrder
|
|
231
241
|
payload?: Prisma.SortOrder
|
|
242
|
+
managedBy?: Prisma.SortOrderInput | Prisma.SortOrder
|
|
232
243
|
createdAt?: Prisma.SortOrder
|
|
233
244
|
updatedAt?: Prisma.SortOrder
|
|
234
245
|
_count?: Prisma.AgentTemplateItemCountOrderByAggregateInput
|
|
@@ -245,6 +256,7 @@ export type AgentTemplateItemScalarWhereWithAggregatesInput = {
|
|
|
245
256
|
kind?: Prisma.StringWithAggregatesFilter<"AgentTemplateItem"> | string
|
|
246
257
|
key?: Prisma.StringWithAggregatesFilter<"AgentTemplateItem"> | string
|
|
247
258
|
payload?: Prisma.JsonWithAggregatesFilter<"AgentTemplateItem">
|
|
259
|
+
managedBy?: Prisma.StringNullableWithAggregatesFilter<"AgentTemplateItem"> | string | null
|
|
248
260
|
createdAt?: Prisma.DateTimeWithAggregatesFilter<"AgentTemplateItem"> | Date | string
|
|
249
261
|
updatedAt?: Prisma.DateTimeWithAggregatesFilter<"AgentTemplateItem"> | Date | string
|
|
250
262
|
}
|
|
@@ -254,6 +266,7 @@ export type AgentTemplateItemCreateInput = {
|
|
|
254
266
|
kind: string
|
|
255
267
|
key: string
|
|
256
268
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
269
|
+
managedBy?: string | null
|
|
257
270
|
createdAt?: Date | string
|
|
258
271
|
updatedAt?: Date | string
|
|
259
272
|
template: Prisma.AgentTemplateCreateNestedOneWithoutItemsInput
|
|
@@ -265,6 +278,7 @@ export type AgentTemplateItemUncheckedCreateInput = {
|
|
|
265
278
|
kind: string
|
|
266
279
|
key: string
|
|
267
280
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
281
|
+
managedBy?: string | null
|
|
268
282
|
createdAt?: Date | string
|
|
269
283
|
updatedAt?: Date | string
|
|
270
284
|
}
|
|
@@ -274,6 +288,7 @@ export type AgentTemplateItemUpdateInput = {
|
|
|
274
288
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
275
289
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
276
290
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
291
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
277
292
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
278
293
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
279
294
|
template?: Prisma.AgentTemplateUpdateOneRequiredWithoutItemsNestedInput
|
|
@@ -285,6 +300,7 @@ export type AgentTemplateItemUncheckedUpdateInput = {
|
|
|
285
300
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
286
301
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
287
302
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
303
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
288
304
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
289
305
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
290
306
|
}
|
|
@@ -295,6 +311,7 @@ export type AgentTemplateItemCreateManyInput = {
|
|
|
295
311
|
kind: string
|
|
296
312
|
key: string
|
|
297
313
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
314
|
+
managedBy?: string | null
|
|
298
315
|
createdAt?: Date | string
|
|
299
316
|
updatedAt?: Date | string
|
|
300
317
|
}
|
|
@@ -304,6 +321,7 @@ export type AgentTemplateItemUpdateManyMutationInput = {
|
|
|
304
321
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
305
322
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
306
323
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
324
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
307
325
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
308
326
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
309
327
|
}
|
|
@@ -314,6 +332,7 @@ export type AgentTemplateItemUncheckedUpdateManyInput = {
|
|
|
314
332
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
315
333
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
316
334
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
335
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
317
336
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
318
337
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
319
338
|
}
|
|
@@ -340,6 +359,7 @@ export type AgentTemplateItemCountOrderByAggregateInput = {
|
|
|
340
359
|
kind?: Prisma.SortOrder
|
|
341
360
|
key?: Prisma.SortOrder
|
|
342
361
|
payload?: Prisma.SortOrder
|
|
362
|
+
managedBy?: Prisma.SortOrder
|
|
343
363
|
createdAt?: Prisma.SortOrder
|
|
344
364
|
updatedAt?: Prisma.SortOrder
|
|
345
365
|
}
|
|
@@ -349,6 +369,7 @@ export type AgentTemplateItemMaxOrderByAggregateInput = {
|
|
|
349
369
|
templateId?: Prisma.SortOrder
|
|
350
370
|
kind?: Prisma.SortOrder
|
|
351
371
|
key?: Prisma.SortOrder
|
|
372
|
+
managedBy?: Prisma.SortOrder
|
|
352
373
|
createdAt?: Prisma.SortOrder
|
|
353
374
|
updatedAt?: Prisma.SortOrder
|
|
354
375
|
}
|
|
@@ -358,6 +379,7 @@ export type AgentTemplateItemMinOrderByAggregateInput = {
|
|
|
358
379
|
templateId?: Prisma.SortOrder
|
|
359
380
|
kind?: Prisma.SortOrder
|
|
360
381
|
key?: Prisma.SortOrder
|
|
382
|
+
managedBy?: Prisma.SortOrder
|
|
361
383
|
createdAt?: Prisma.SortOrder
|
|
362
384
|
updatedAt?: Prisma.SortOrder
|
|
363
385
|
}
|
|
@@ -409,6 +431,7 @@ export type AgentTemplateItemCreateWithoutTemplateInput = {
|
|
|
409
431
|
kind: string
|
|
410
432
|
key: string
|
|
411
433
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
434
|
+
managedBy?: string | null
|
|
412
435
|
createdAt?: Date | string
|
|
413
436
|
updatedAt?: Date | string
|
|
414
437
|
}
|
|
@@ -418,6 +441,7 @@ export type AgentTemplateItemUncheckedCreateWithoutTemplateInput = {
|
|
|
418
441
|
kind: string
|
|
419
442
|
key: string
|
|
420
443
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
444
|
+
managedBy?: string | null
|
|
421
445
|
createdAt?: Date | string
|
|
422
446
|
updatedAt?: Date | string
|
|
423
447
|
}
|
|
@@ -457,6 +481,7 @@ export type AgentTemplateItemScalarWhereInput = {
|
|
|
457
481
|
kind?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
458
482
|
key?: Prisma.StringFilter<"AgentTemplateItem"> | string
|
|
459
483
|
payload?: Prisma.JsonFilter<"AgentTemplateItem">
|
|
484
|
+
managedBy?: Prisma.StringNullableFilter<"AgentTemplateItem"> | string | null
|
|
460
485
|
createdAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
461
486
|
updatedAt?: Prisma.DateTimeFilter<"AgentTemplateItem"> | Date | string
|
|
462
487
|
}
|
|
@@ -466,6 +491,7 @@ export type AgentTemplateItemCreateManyTemplateInput = {
|
|
|
466
491
|
kind: string
|
|
467
492
|
key: string
|
|
468
493
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
494
|
+
managedBy?: string | null
|
|
469
495
|
createdAt?: Date | string
|
|
470
496
|
updatedAt?: Date | string
|
|
471
497
|
}
|
|
@@ -475,6 +501,7 @@ export type AgentTemplateItemUpdateWithoutTemplateInput = {
|
|
|
475
501
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
476
502
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
477
503
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
504
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
478
505
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
479
506
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
480
507
|
}
|
|
@@ -484,6 +511,7 @@ export type AgentTemplateItemUncheckedUpdateWithoutTemplateInput = {
|
|
|
484
511
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
485
512
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
486
513
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
514
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
487
515
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
488
516
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
489
517
|
}
|
|
@@ -493,6 +521,7 @@ export type AgentTemplateItemUncheckedUpdateManyWithoutTemplateInput = {
|
|
|
493
521
|
kind?: Prisma.StringFieldUpdateOperationsInput | string
|
|
494
522
|
key?: Prisma.StringFieldUpdateOperationsInput | string
|
|
495
523
|
payload?: Prisma.JsonNullValueInput | runtime.InputJsonValue
|
|
524
|
+
managedBy?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
496
525
|
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
497
526
|
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
498
527
|
}
|
|
@@ -505,6 +534,7 @@ export type AgentTemplateItemSelect<ExtArgs extends runtime.Types.Extensions.Int
|
|
|
505
534
|
kind?: boolean
|
|
506
535
|
key?: boolean
|
|
507
536
|
payload?: boolean
|
|
537
|
+
managedBy?: boolean
|
|
508
538
|
createdAt?: boolean
|
|
509
539
|
updatedAt?: boolean
|
|
510
540
|
template?: boolean | Prisma.AgentTemplateDefaultArgs<ExtArgs>
|
|
@@ -516,6 +546,7 @@ export type AgentTemplateItemSelectCreateManyAndReturn<ExtArgs extends runtime.T
|
|
|
516
546
|
kind?: boolean
|
|
517
547
|
key?: boolean
|
|
518
548
|
payload?: boolean
|
|
549
|
+
managedBy?: boolean
|
|
519
550
|
createdAt?: boolean
|
|
520
551
|
updatedAt?: boolean
|
|
521
552
|
template?: boolean | Prisma.AgentTemplateDefaultArgs<ExtArgs>
|
|
@@ -527,6 +558,7 @@ export type AgentTemplateItemSelectUpdateManyAndReturn<ExtArgs extends runtime.T
|
|
|
527
558
|
kind?: boolean
|
|
528
559
|
key?: boolean
|
|
529
560
|
payload?: boolean
|
|
561
|
+
managedBy?: boolean
|
|
530
562
|
createdAt?: boolean
|
|
531
563
|
updatedAt?: boolean
|
|
532
564
|
template?: boolean | Prisma.AgentTemplateDefaultArgs<ExtArgs>
|
|
@@ -538,11 +570,12 @@ export type AgentTemplateItemSelectScalar = {
|
|
|
538
570
|
kind?: boolean
|
|
539
571
|
key?: boolean
|
|
540
572
|
payload?: boolean
|
|
573
|
+
managedBy?: boolean
|
|
541
574
|
createdAt?: boolean
|
|
542
575
|
updatedAt?: boolean
|
|
543
576
|
}
|
|
544
577
|
|
|
545
|
-
export type AgentTemplateItemOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "templateId" | "kind" | "key" | "payload" | "createdAt" | "updatedAt", ExtArgs["result"]["agentTemplateItem"]>
|
|
578
|
+
export type AgentTemplateItemOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "templateId" | "kind" | "key" | "payload" | "managedBy" | "createdAt" | "updatedAt", ExtArgs["result"]["agentTemplateItem"]>
|
|
546
579
|
export type AgentTemplateItemInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
547
580
|
template?: boolean | Prisma.AgentTemplateDefaultArgs<ExtArgs>
|
|
548
581
|
}
|
|
@@ -564,6 +597,7 @@ export type $AgentTemplateItemPayload<ExtArgs extends runtime.Types.Extensions.I
|
|
|
564
597
|
kind: string
|
|
565
598
|
key: string
|
|
566
599
|
payload: runtime.JsonValue
|
|
600
|
+
managedBy: string | null
|
|
567
601
|
createdAt: Date
|
|
568
602
|
updatedAt: Date
|
|
569
603
|
}, ExtArgs["result"]["agentTemplateItem"]>
|
|
@@ -995,6 +1029,7 @@ export interface AgentTemplateItemFieldRefs {
|
|
|
995
1029
|
readonly kind: Prisma.FieldRef<"AgentTemplateItem", 'String'>
|
|
996
1030
|
readonly key: Prisma.FieldRef<"AgentTemplateItem", 'String'>
|
|
997
1031
|
readonly payload: Prisma.FieldRef<"AgentTemplateItem", 'Json'>
|
|
1032
|
+
readonly managedBy: Prisma.FieldRef<"AgentTemplateItem", 'String'>
|
|
998
1033
|
readonly createdAt: Prisma.FieldRef<"AgentTemplateItem", 'DateTime'>
|
|
999
1034
|
readonly updatedAt: Prisma.FieldRef<"AgentTemplateItem", 'DateTime'>
|
|
1000
1035
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- TMK-3.2: AgentTemplateItem.managedBy marks items owned by a deployment
|
|
2
|
+
-- config source ('helm' = SHIPWRIGHT_TEMPLATE_SEED). Additive only: existing
|
|
3
|
+
-- rows stay NULL (hand-added) and the seed never touches them.
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "AgentTemplateItem" ADD COLUMN "managedBy" TEXT;
|
|
@@ -338,6 +338,9 @@ model AgentTemplateItem {
|
|
|
338
338
|
kind String
|
|
339
339
|
key String
|
|
340
340
|
payload Json @default("{}")
|
|
341
|
+
// TMK-3.2: null = hand-added; "helm" = applied from SHIPWRIGHT_TEMPLATE_SEED
|
|
342
|
+
// (admin/src/template-seed.ts), which overwrites and prunes only its own items.
|
|
343
|
+
managedBy String?
|
|
341
344
|
createdAt DateTime @default(now())
|
|
342
345
|
updatedAt DateTime @updatedAt
|
|
343
346
|
|
|
@@ -23,7 +23,7 @@ function assertOrdered(markers: string[]): void {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
describe("admin-boot.ts boot sequence", () => {
|
|
26
|
-
it("keeps the documented boot order: DB, services, routes, sweepers, serve, startup policy reconcile", () => {
|
|
26
|
+
it("keeps the documented boot order: DB, services, routes, sweepers, serve, template seed, startup policy reconcile", () => {
|
|
27
27
|
assertOrdered([
|
|
28
28
|
'initSentry({ service: "admin" })',
|
|
29
29
|
"await runMigrations();",
|
|
@@ -46,10 +46,22 @@ describe("admin-boot.ts boot sequence", () => {
|
|
|
46
46
|
"startBackgroundPasses(resolvedExtensions.backgroundPasses)",
|
|
47
47
|
"const server = Bun.serve(",
|
|
48
48
|
"const shutdown = registerGracefulShutdown(",
|
|
49
|
+
"void runTemplateSeed(",
|
|
49
50
|
"void runStartupPolicyReconcile(",
|
|
50
51
|
]);
|
|
51
52
|
});
|
|
52
53
|
|
|
54
|
+
it("applies the template seed after migrations, through the template service, without blocking serving (TMK-3.2)", () => {
|
|
55
|
+
assertOrdered([
|
|
56
|
+
"await runMigrations();",
|
|
57
|
+
"const templateService = new AgentTemplateService(",
|
|
58
|
+
"const server = Bun.serve(",
|
|
59
|
+
"void runTemplateSeed(",
|
|
60
|
+
]);
|
|
61
|
+
expect(source).toContain("raw: process.env.SHIPWRIGHT_TEMPLATE_SEED");
|
|
62
|
+
expect(source).not.toContain("await runTemplateSeed(");
|
|
63
|
+
});
|
|
64
|
+
|
|
53
65
|
it("feeds extension service deps into the platform app factories", () => {
|
|
54
66
|
expect(source).toContain("...resolvedExtensions.apiDeps");
|
|
55
67
|
expect(source).toContain("...resolvedExtensions.uiDeps");
|
package/src/admin-boot.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* Sentry → migrations → Prisma → platform services → resolve extensions →
|
|
11
11
|
* routes (health, runtime API, admin API, accounts API, extension APIs,
|
|
12
12
|
* admin UI, extension UI) → platform sweepers → extension background
|
|
13
|
-
* passes → Bun.serve → graceful shutdown → startup policy
|
|
13
|
+
* passes → Bun.serve → graceful shutdown → template seed → startup policy
|
|
14
|
+
* reconcile.
|
|
14
15
|
*
|
|
15
16
|
* Route mount order (important — avoids shadowing):
|
|
16
17
|
* GET /health — liveness check (no auth, DB-independent)
|
|
@@ -128,6 +129,7 @@ import { SlackConfigTokenService } from "./slack-config-token.ts";
|
|
|
128
129
|
import { HttpSlackProvisioningClient } from "./slack-provisioning-client.ts";
|
|
129
130
|
import { SpecialtyTypes } from "./specialty-types.ts";
|
|
130
131
|
import { runStartupPolicyReconcile } from "./startup-policy-reconcile.ts";
|
|
132
|
+
import { runTemplateSeed } from "./template-seed.ts";
|
|
131
133
|
import { makeStrictTokenCrypto, makeTokenCrypto } from "./token-crypto.ts";
|
|
132
134
|
import { parseTranscriptConfig } from "./transcript-config.ts";
|
|
133
135
|
import {
|
|
@@ -304,6 +306,15 @@ export async function startAdmin(
|
|
|
304
306
|
? new HttpOktaAuthClient({ issuer: oktaIssuer })
|
|
305
307
|
: undefined;
|
|
306
308
|
const slackClient = new HttpSlackProvisioningClient();
|
|
309
|
+
// Stored Slack config token (SCT-4.1): strict crypto (null without
|
|
310
|
+
// SHIPWRIGHT_ENCRYPTION_KEY) and the same HTTP client as the rotate client.
|
|
311
|
+
// Shared by agent create / connect-slack / sync-manifest / delete.
|
|
312
|
+
const slackConfigTokens = new SlackConfigTokenService(
|
|
313
|
+
prisma,
|
|
314
|
+
makeStrictTokenCrypto(),
|
|
315
|
+
undefined,
|
|
316
|
+
slackClient,
|
|
317
|
+
);
|
|
307
318
|
const githubAppClient = new HttpGithubAppProvisioningClient();
|
|
308
319
|
const slackConfigTokenService = new SlackConfigTokenService(
|
|
309
320
|
prisma,
|
|
@@ -539,6 +550,7 @@ export async function startAdmin(
|
|
|
539
550
|
chatService: deletionChatService,
|
|
540
551
|
slack: slackClient,
|
|
541
552
|
decrypt: crypto.decrypt,
|
|
553
|
+
slackConfigTokens,
|
|
542
554
|
agentTemplateReconcileService: templateReconcileService,
|
|
543
555
|
sessionSecret,
|
|
544
556
|
adminApiKeys,
|
|
@@ -668,6 +680,7 @@ export async function startAdmin(
|
|
|
668
680
|
chatService: deletionChatService,
|
|
669
681
|
slack: slackClient,
|
|
670
682
|
decrypt: crypto.decrypt,
|
|
683
|
+
slackConfigTokens,
|
|
671
684
|
sessionSecret,
|
|
672
685
|
googleClientId,
|
|
673
686
|
googleClientSecret,
|
|
@@ -831,6 +844,17 @@ export async function startAdmin(
|
|
|
831
844
|
|
|
832
845
|
console.log(`[admin] admin service listening on port ${port}`);
|
|
833
846
|
|
|
847
|
+
// Template seed (TMK-3.2): apply SHIPWRIGHT_TEMPLATE_SEED (Helm
|
|
848
|
+
// admin.templateSeed) to the deployment-wide template through the template
|
|
849
|
+
// service, whose fan-out reconciles the agents. Migrations already ran
|
|
850
|
+
// above. Fire-and-forget: it never throws (an invalid seed logs one error
|
|
851
|
+
// and writes nothing) and must not delay serving.
|
|
852
|
+
void runTemplateSeed({
|
|
853
|
+
raw: process.env.SHIPWRIGHT_TEMPLATE_SEED,
|
|
854
|
+
templateService,
|
|
855
|
+
logger: console,
|
|
856
|
+
});
|
|
857
|
+
|
|
834
858
|
// Policy-only reconcile (ACP-1.3): a Claude policy change restarts admin via
|
|
835
859
|
// the chart's policy-hash env var, so rolling only the agents whose policy
|
|
836
860
|
// wiring drifted happens here. Runs even with no policy configured so agents
|
package/src/admin-ui-pages.ts
CHANGED
|
@@ -530,6 +530,8 @@ export function renderNewLocalAgentPage(
|
|
|
530
530
|
canProvision?: boolean;
|
|
531
531
|
/** WIF-2.1: hide the Claude credential fields (federation supplies auth). */
|
|
532
532
|
anthropicFederationEnabled?: boolean;
|
|
533
|
+
/** SCT-4.1: a stored Slack config token resolves; the xoxpToken field is optional. */
|
|
534
|
+
slackConfigTokenStored?: boolean;
|
|
533
535
|
/**
|
|
534
536
|
* Set for self-serve account users (SSP-4.2): shows the account's
|
|
535
537
|
* remaining agent quota and the prerequisites, and pins the type to
|
|
@@ -814,7 +816,11 @@ export function renderNewLocalAgentPage(
|
|
|
814
816
|
placeholder="xoxe.xoxp-..."
|
|
815
817
|
/>
|
|
816
818
|
<p style="font-size:12px;color:#6b7280;margin-top:4px">
|
|
817
|
-
|
|
819
|
+
${
|
|
820
|
+
opts?.slackConfigTokenStored
|
|
821
|
+
? "Optional: a stored Slack config token is configured in Settings and is used when this is left blank. A token pasted here is used instead. "
|
|
822
|
+
: ""
|
|
823
|
+
}A pasted token is used once to create the Slack app manifest. It is not stored. After
|
|
818
824
|
creating the agent you'll be redirected to authorize the Slack app.
|
|
819
825
|
</p>
|
|
820
826
|
</div>
|
|
@@ -927,6 +933,8 @@ interface ConnectActionConfig {
|
|
|
927
933
|
type: "text" | "password" | "file" | "checkbox";
|
|
928
934
|
placeholder?: string;
|
|
929
935
|
mono?: boolean;
|
|
936
|
+
/** Render without the `required` attribute. */
|
|
937
|
+
optional?: boolean;
|
|
930
938
|
/** Checkbox only: visible label text; `value` is submitted when checked. */
|
|
931
939
|
label?: string;
|
|
932
940
|
value?: string;
|
|
@@ -957,7 +965,7 @@ function renderConnectAction(
|
|
|
957
965
|
type="${input.type}"
|
|
958
966
|
class="form-input${input.mono ? " mono" : ""}"
|
|
959
967
|
${input.placeholder ? `placeholder="${escapeHtml(input.placeholder)}"` : ""}
|
|
960
|
-
required
|
|
968
|
+
${input.optional ? "" : "required"}
|
|
961
969
|
style="font-size:12px"
|
|
962
970
|
/>`,
|
|
963
971
|
)
|
|
@@ -1133,6 +1141,12 @@ export function renderAgentDetailPage(
|
|
|
1133
1141
|
* false renders the card without them.
|
|
1134
1142
|
*/
|
|
1135
1143
|
githubEnterpriseConfigured?: boolean;
|
|
1144
|
+
/**
|
|
1145
|
+
* SCT-4.1: a stored Slack config token resolves for this agent's account
|
|
1146
|
+
* (its own row, else the deployment default). The xoxpToken fields become
|
|
1147
|
+
* optional and say so.
|
|
1148
|
+
*/
|
|
1149
|
+
slackConfigTokenStored?: boolean;
|
|
1136
1150
|
/**
|
|
1137
1151
|
* IRM-1.4: every repo (owner/repo) on the agent App's installation, when it
|
|
1138
1152
|
* could be listed. Absent means unknown: no coverage warning is shown.
|
|
@@ -1232,18 +1246,24 @@ export function renderAgentDetailPage(
|
|
|
1232
1246
|
|
|
1233
1247
|
// "Connect later" actions (UAP-2.3) — each hidden once its AgentEnv key is
|
|
1234
1248
|
// already set, mirroring the "Sync Manifest" visibility pattern.
|
|
1249
|
+
const slackStored = opts?.slackConfigTokenStored === true;
|
|
1235
1250
|
const slackConnectActionConfigs: ConnectActionConfig[] = [
|
|
1236
1251
|
{
|
|
1237
1252
|
envKey: "SLACK_APP_TOKEN",
|
|
1238
1253
|
label: "Connect Slack",
|
|
1239
|
-
description:
|
|
1254
|
+
description: slackStored
|
|
1255
|
+
? `Connects this agent to a Slack app. Optional: a stored Slack config token is used unless you paste a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).`
|
|
1256
|
+
: `Connects this agent to a Slack app. Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).`,
|
|
1240
1257
|
action: `/admin/agents/${escapeHtml(agent.id)}/connect-slack`,
|
|
1241
1258
|
inputs: [
|
|
1242
1259
|
{
|
|
1243
1260
|
name: "xoxpToken",
|
|
1244
1261
|
type: "password",
|
|
1245
|
-
placeholder:
|
|
1262
|
+
placeholder: slackStored
|
|
1263
|
+
? "xoxe.xoxp-... (optional)"
|
|
1264
|
+
: "xoxe.xoxp-...",
|
|
1246
1265
|
mono: true,
|
|
1266
|
+
optional: slackStored,
|
|
1247
1267
|
},
|
|
1248
1268
|
],
|
|
1249
1269
|
},
|
|
@@ -2228,14 +2248,18 @@ export function renderAgentDetailPage(
|
|
|
2228
2248
|
<details>
|
|
2229
2249
|
<summary class="btn btn-secondary" style="cursor:pointer;font-size:12px;list-style:none">Sync Manifest</summary>
|
|
2230
2250
|
<div style="position:absolute;right:24px;margin-top:6px;background:#fff;border:1px solid #e5e7eb;border-radius:6px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.08);z-index:10;min-width:320px">
|
|
2231
|
-
<p style="font-size:12px;color:#6b7280;margin:0 0 10px">Syncs the current manifest to the provisioned Slack app.
|
|
2251
|
+
<p style="font-size:12px;color:#6b7280;margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${
|
|
2252
|
+
slackStored
|
|
2253
|
+
? 'Optional: a stored Slack config token is used unless you paste a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
2254
|
+
: 'Requires a Slack app configuration token (<span class="mono">xoxe.xoxp-</span>).'
|
|
2255
|
+
}</p>
|
|
2232
2256
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/sync-manifest" style="display:flex;flex-direction:column;gap:8px">
|
|
2233
2257
|
<input
|
|
2234
2258
|
name="xoxpToken"
|
|
2235
2259
|
type="password"
|
|
2236
2260
|
class="form-input mono"
|
|
2237
2261
|
placeholder="xoxe.xoxp-..."
|
|
2238
|
-
required
|
|
2262
|
+
${slackStored ? "" : "required"}
|
|
2239
2263
|
style="font-size:12px"
|
|
2240
2264
|
/>
|
|
2241
2265
|
<button type="submit" class="btn btn-primary" style="font-size:12px;align-self:flex-start">Confirm Sync</button>
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
type AgentDetail,
|
|
14
14
|
type AgentListItem,
|
|
15
15
|
agentSectionPath,
|
|
16
|
-
settingsRedirectSection,
|
|
17
16
|
type CronJobItem,
|
|
18
17
|
ERROR_KIND_LABELS,
|
|
19
18
|
type MemberItem,
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
renderNewLocalAgentPage,
|
|
32
31
|
renderProvisionCompletePage,
|
|
33
32
|
renderProvisionXappTokenPage,
|
|
33
|
+
settingsRedirectSection,
|
|
34
34
|
type TokenItem,
|
|
35
35
|
type ToolItem,
|
|
36
36
|
} from "./admin-ui-pages.ts";
|
|
@@ -1171,6 +1171,41 @@ describe("renderAgentDetailPage — connect-later actions", () => {
|
|
|
1171
1171
|
expect(slackForm).toMatch(/name="xoxpToken"[^>]*type="password"/);
|
|
1172
1172
|
});
|
|
1173
1173
|
|
|
1174
|
+
test("Connect Slack xoxpToken field is required without a stored token and optional (with a hint) with one", () => {
|
|
1175
|
+
const field = (html: string) =>
|
|
1176
|
+
html.match(
|
|
1177
|
+
/action="\/admin\/agents\/agent-123\/connect-slack"[\s\S]*?<\/form>/,
|
|
1178
|
+
)?.[0] as string;
|
|
1179
|
+
expect(field(render({}))).toMatch(/name="xoxpToken"[\s\S]*?required/);
|
|
1180
|
+
const stored = renderAgentDetailPage(
|
|
1181
|
+
AGENT,
|
|
1182
|
+
{},
|
|
1183
|
+
[],
|
|
1184
|
+
[],
|
|
1185
|
+
[],
|
|
1186
|
+
[],
|
|
1187
|
+
[],
|
|
1188
|
+
USER_NAME,
|
|
1189
|
+
true,
|
|
1190
|
+
{ timezone: "UTC", slackConfigTokenStored: true },
|
|
1191
|
+
);
|
|
1192
|
+
expect(field(stored)).not.toMatch(/required/);
|
|
1193
|
+
expect(stored).toContain("stored Slack config token");
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
test("new-agent form hint says the token is optional when a stored token resolves", () => {
|
|
1197
|
+
const CODING_TYPE = { name: "coding", displayName: "Coding Agent" };
|
|
1198
|
+
const withStored = renderNewLocalAgentPage(USER_NAME, [CODING_TYPE], {
|
|
1199
|
+
canProvision: true,
|
|
1200
|
+
slackConfigTokenStored: true,
|
|
1201
|
+
});
|
|
1202
|
+
expect(withStored).toContain("Optional: a stored Slack config token");
|
|
1203
|
+
const without = renderNewLocalAgentPage(USER_NAME, [CODING_TYPE], {
|
|
1204
|
+
canProvision: true,
|
|
1205
|
+
});
|
|
1206
|
+
expect(without).not.toContain("Optional: a stored Slack config token");
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1174
1209
|
test("Connect Slack action is hidden once SLACK_APP_TOKEN is set", () => {
|
|
1175
1210
|
const html = render({ SLACK_APP_TOKEN: "xoxe.xoxp-abc" });
|
|
1176
1211
|
expect(html).not.toContain("Connect Slack<");
|