Replace starters with four graded examples seeded into new databases
The template catalog is now Example 1-4: one stage, two stages (handoff), feedback loop (runner-owned limits, retries, timeout) and human decision (type=human approve/revise/abort with notify hooks). All read-only or leave changes uncommitted; none commits, pushes or deploys. A brand-new database (schema created by this Open) gets the examples once at server start, bound to the configured default model and harness. A server_settings marker records the decision, so removed examples never come back and existing installs are marked without any pipeline being added or rewritten.
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"git.a-wan.net/alan/pipelines/internal/harness"
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/examples"
|
||||
"git.a-wan.net/alan/pipelines/internal/harness"
|
||||
"git.a-wan.net/alan/pipelines/internal/pipeline"
|
||||
)
|
||||
|
||||
func starterDefaults() (string, string) {
|
||||
@@ -13,3 +17,16 @@ func starterDefaults() (string, string) {
|
||||
}
|
||||
return model, backend
|
||||
}
|
||||
|
||||
// SeedExamples adds the bundled example pipelines to a brand-new database, bound
|
||||
// to the server's configured default model and harness exactly as the template
|
||||
// picker binds them. It is a no-op for an existing or already-seeded database
|
||||
// (see pipeline.Store.SeedExamples) and returns the number created.
|
||||
func SeedExamples(ctx context.Context, store *pipeline.Store) (int, error) {
|
||||
model, backend := starterDefaults()
|
||||
items := examples.Catalog()
|
||||
for i := range items {
|
||||
items[i].Source = pipeline.WithDefaults(items[i].Source, model, backend)
|
||||
}
|
||||
return store.SeedExamples(ctx, items)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user