@@ -257,6 +257,7 @@ import {
257257 createArtifactRoutes ,
258258 createTemplateLibraryDbStore ,
259259 createTemplateLibraryRoutes ,
260+ createTemplateLibrarySeeder ,
260261 createUnavailableArtifactRoutes ,
261262 createUnavailableTemplateLibraryRoutes ,
262263 createUnavailableWorkflowArtifactRoutes ,
@@ -333,7 +334,6 @@ import {
333334} from "./config" ;
334335import type { SidecarProvisioner } from "@intx/hub-sessions" ;
335336import { scheduleEnvProviderCredentialPlant } from "./env-credential-plant" ;
336- import { scheduleTemplateLibrarySeed } from "./template-library-seed" ;
337337import { createHubRoutineLauncher } from "./routine-launcher" ;
338338import { withTurnPartWriteDefaults } from "./turn-part-content-default" ;
339339import { createHubRunSummaryResolver } from "./routine-run-summary" ;
@@ -3307,15 +3307,23 @@ export async function createHub(config: HubConfig) {
33073307
33083308 // The bench library's template shelf (CL-6344): what the
33093309 // new-workbench picker instantiates from — seeded rows, never a
3310- // hardcoded import.
3310+ // hardcoded import. Reading the shelf is what seeds it (CL-6458), so
3311+ // a bench created at any point after boot carries the shipped
3312+ // manifests the first time its picker opens.
33113313 app . route (
33123314 `${ TENANT_PREFIX } /library/templates` ,
33133315 createTemplateLibraryRoutes ( {
33143316 store : createTemplateLibraryDbStore ( artifactsHandle . db ) ,
3317+ seeder : createTemplateLibrarySeeder ( {
3318+ db : artifactsHandle . db ,
3319+ entries : workbenchTemplateLibraryEntries ( ) ,
3320+ log : ( line ) => log . info `${ line } ` ,
3321+ } ) ,
33153322 requireGrant : createRequireGrant ( {
33163323 grantStore : chatGrantStore ,
33173324 conditionRegistry : chatConditionRegistry ,
33183325 } ) ,
3326+ log : ( line ) => log . error `${ line } ` ,
33193327 } ) ,
33203328 ) ;
33213329
@@ -3456,23 +3464,6 @@ export async function createHub(config: HubConfig) {
34563464 fetch : ( request ) => Promise . resolve ( guardedApp . fetch ( request ) ) ,
34573465 } ) ;
34583466
3459- // Bench-library template seed (CL-6344): the hub, as system, plants
3460- // the shipped workbench template manifests and their tool tarballs
3461- // into the operator bench's library at boot — idempotently, so a
3462- // second boot leaves exactly one entry per template. Skipped in
3463- // degraded (no-artifacts) mode: with no library to seed into there is
3464- // nothing honest to do. See ./template-library-seed.ts.
3465- const templateLibrarySeed =
3466- artifactsHandle !== undefined
3467- ? scheduleTemplateLibrarySeed ( {
3468- baseUrl : config . baseUrl ,
3469- admin : config . envCredentialPlantAdmin ,
3470- fetch : ( request ) => Promise . resolve ( guardedApp . fetch ( request ) ) ,
3471- artifactsDb : artifactsHandle . db ,
3472- entries : workbenchTemplateLibraryEntries ( ) ,
3473- } )
3474- : { stop : ( ) : void => { } } ;
3475-
34763467 return {
34773468 app : guardedApp ,
34783469 db,
@@ -3482,7 +3473,6 @@ export async function createHub(config: HubConfig) {
34823473 clearTimeout ( sidecarAllocationReconciliationTimer ) ;
34833474 }
34843475 envCredentialPlant . stop ( ) ;
3485- templateLibrarySeed . stop ( ) ;
34863476 chatOrchestrator . dispose ( ) ;
34873477 taskOrchestrator . dispose ( ) ;
34883478 taskLifecycle . stop ( ) ;
0 commit comments