feat(identity): seed a narrow agent identity and run shipped workflows as it
This commit is contained in:
11 files changed
+42
-7
No files matched your search
@@ -42,6 +42,21 @@ func (q *Queries) EnsureDefaultWorkspace(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const ensureOrgAgentIdentity = `-- name: EnsureOrgAgentIdentity :execrows
|
||||
INSERT INTO identities (id, kind, display_name, lifecycle, version, created_at, updated_at)
|
||||
VALUES ($1, 'bot', 'Agent', 'active', 1, now(), now())
|
||||
ON CONFLICT (id) DO NOTHING
|
||||
`
|
||||
|
||||
// The bot identity the shipped workflows run as.
|
||||
func (q *Queries) EnsureOrgAgentIdentity(ctx context.Context, id string) (int64, error) {
|
||||
result, err := q.db.Exec(ctx, ensureOrgAgentIdentity, id)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return result.RowsAffected(), nil
|
||||
}
|
||||
|
||||
const ensureOrgOperatorIdentity = `-- name: EnsureOrgOperatorIdentity :execrows
|
||||
|
||||
INSERT INTO identities (id, kind, display_name, lifecycle, version, created_at, updated_at)
|
||||
|
||||
Reference in new issue
Block a user