@app-vitals/agent-admin 1.65.0 → 1.67.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.platform.json +5 -0
- 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 +14 -1
- 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/agent-templates-api.ts +1 -0
- package/src/agent-templates.ts +184 -9
- package/src/openapi-schemas.ts +5 -0
- 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 {
|
|
@@ -842,6 +844,17 @@ export async function startAdmin(
|
|
|
842
844
|
|
|
843
845
|
console.log(`[admin] admin service listening on port ${port}`);
|
|
844
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
|
+
|
|
845
858
|
// Policy-only reconcile (ACP-1.3): a Claude policy change restarts admin via
|
|
846
859
|
// the chart's policy-hash env var, so rolling only the agents whose policy
|
|
847
860
|
// wiring drifted happens here. Runs even with no policy configured so agents
|
|
@@ -33,6 +33,20 @@ export interface TemplateItemRow {
|
|
|
33
33
|
kind: AgentTemplateItemKind;
|
|
34
34
|
key: string;
|
|
35
35
|
payload: Record<string, unknown>;
|
|
36
|
+
/** TMK-3.2: "helm" for items applied from SHIPWRIGHT_TEMPLATE_SEED. */
|
|
37
|
+
managedBy?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* TMK-3.2: the "from Helm values" badge for a seeded item ("" otherwise).
|
|
42
|
+
* Seeded items stay editable; the next admin boot overwrites the edit.
|
|
43
|
+
*/
|
|
44
|
+
export function managedByBadge(
|
|
45
|
+
item: Pick<TemplateItemRow, "managedBy">,
|
|
46
|
+
): string {
|
|
47
|
+
return item.managedBy === "helm"
|
|
48
|
+
? ` <span class="badge badge-template" title="Set by admin.templateSeed in Helm values; edits are overwritten on the next admin restart">from Helm values</span>`
|
|
49
|
+
: "";
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
export interface TemplatesPageOpts {
|
|
@@ -125,7 +139,7 @@ function kindCard(o: TemplatesPageOpts, kind: TemplateItemRow["kind"]): string {
|
|
|
125
139
|
i,
|
|
126
140
|
) => `<form method="POST" action="${BASE}/items" class="template-item" data-kind="${kind}" data-key="${escapeHtml(i.key)}" style="display:grid;gap:6px;padding:8px 0;border-bottom:1px solid #e5e7eb">
|
|
127
141
|
${scopeFields(o)}<input type="hidden" name="kind" value="${kind}" /><input type="hidden" name="key" value="${escapeHtml(i.key)}" />
|
|
128
|
-
<strong>${escapeHtml(i.key)}</strong>
|
|
142
|
+
<strong>${escapeHtml(i.key)}${managedByBadge(i)}</strong>
|
|
129
143
|
${itemFields(kind, i.payload)}
|
|
130
144
|
<div style="display:flex;gap:8px"><button type="submit" class="btn btn-primary" style="font-size:12px;padding:4px 10px">Save</button>
|
|
131
145
|
<button type="submit" formaction="${BASE}/items/delete" class="btn btn-danger" style="font-size:12px;padding:4px 10px">Remove</button></div>
|
|
@@ -5,10 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
import { describe, expect, it } from "bun:test";
|
|
7
7
|
import {
|
|
8
|
+
managedByBadge,
|
|
8
9
|
renderTemplatesPage,
|
|
9
10
|
type TemplatesPageOpts,
|
|
10
11
|
} from "./admin-ui-templates-pages.ts";
|
|
11
12
|
|
|
13
|
+
describe("managedByBadge (TMK-3.2)", () => {
|
|
14
|
+
it('renders "from Helm values" for helm-managed items only', () => {
|
|
15
|
+
expect(managedByBadge({ managedBy: "helm" })).toContain("from Helm values");
|
|
16
|
+
expect(managedByBadge({})).toBe("");
|
|
17
|
+
expect(managedByBadge({ managedBy: "other" })).toBe("");
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
12
21
|
const base: TemplatesPageOpts = {
|
|
13
22
|
userEmail: "a@x.com",
|
|
14
23
|
accountOptions: [{ value: "", label: "Deployment-wide" }],
|
|
@@ -281,6 +281,44 @@ describe("/admin/settings/templates smoke", () => {
|
|
|
281
281
|
expect((await app.request(`${BASE}?accountId=acct-2`)).status).toBe(403);
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
+
it('shows a "from Helm values" badge only on seeded items (TMK-3.2)', async () => {
|
|
285
|
+
const { app, rows } = setup();
|
|
286
|
+
rows.push({
|
|
287
|
+
id: "t-seed",
|
|
288
|
+
accountId: null,
|
|
289
|
+
specialty: null,
|
|
290
|
+
createdAt: now,
|
|
291
|
+
updatedAt: now,
|
|
292
|
+
items: [
|
|
293
|
+
{
|
|
294
|
+
kind: "plugin",
|
|
295
|
+
key: "seeded@example-plugins",
|
|
296
|
+
payload: {},
|
|
297
|
+
updatedAt: now,
|
|
298
|
+
managedBy: "helm",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
kind: "plugin",
|
|
302
|
+
key: "manual@example-plugins",
|
|
303
|
+
payload: {},
|
|
304
|
+
updatedAt: now,
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
});
|
|
308
|
+
const res = await app.request(BASE);
|
|
309
|
+
expect(res.status).toBe(200);
|
|
310
|
+
const html = await res.text();
|
|
311
|
+
expect(html.match(/from Helm values/g)).toHaveLength(1);
|
|
312
|
+
const seeded = html.slice(
|
|
313
|
+
html.indexOf('data-key="seeded@example-plugins"'),
|
|
314
|
+
html.indexOf('data-key="manual@example-plugins"'),
|
|
315
|
+
);
|
|
316
|
+
expect(seeded).toContain("from Helm values");
|
|
317
|
+
// Still editable: the seeded row keeps its Save and Remove buttons.
|
|
318
|
+
expect(seeded).toContain("Save");
|
|
319
|
+
expect(seeded).toContain("Remove");
|
|
320
|
+
});
|
|
321
|
+
|
|
284
322
|
it("403s a non-admin without an account", async () => {
|
|
285
323
|
const { app } = setup({ isAdmin: false });
|
|
286
324
|
expect((await app.request(BASE)).status).toBe(403);
|
|
@@ -175,6 +175,7 @@ function serialize(t: TemplateView) {
|
|
|
175
175
|
key: i.key,
|
|
176
176
|
payload: i.payload,
|
|
177
177
|
updatedAt: i.updatedAt.toISOString(),
|
|
178
|
+
...(i.managedBy ? { managedBy: i.managedBy } : {}),
|
|
178
179
|
})),
|
|
179
180
|
createdAt: t.createdAt.toISOString(),
|
|
180
181
|
updatedAt: t.updatedAt.toISOString(),
|