tâches planifiées : prompts cron persistés, outil scheduler, conversations liées aux tâches, rattrapage des exécutions manquées au redémarrage (go-cron MissedRunOnce)

This commit is contained in:
fabien committed 2026-10-06 22:15:59 +02:00
1 parent bedb6c98e7
commit 058370830f
71 files changed
+1627 -100

No files matched your search

+36 -1
View File
@@ -1,6 +1,41 @@
package domain
import "time"
import (
"context"
"time"
)
// Clés de contexte passées aux outils lors de l'exécution : identité de
// l'appelant et modèle en cours, pour les outils qui en dépendent
// (ex. scheduler crée une tâche pour l'équipe courante).
type contextKey int
const (
contextKeyUserID contextKey = iota
contextKeyTeamID
contextKeyModelID
)
func WithToolContext(ctx context.Context, userID string, teamID string, modelID string) context.Context {
ctx = context.WithValue(ctx, contextKeyUserID, userID)
ctx = context.WithValue(ctx, contextKeyTeamID, teamID)
return context.WithValue(ctx, contextKeyModelID, modelID)
}
func UserIDFromContext(ctx context.Context) (string, bool) {
v, ok := ctx.Value(contextKeyUserID).(string)
return v, ok
}
func TeamIDFromContext(ctx context.Context) (string, bool) {
v, ok := ctx.Value(contextKeyTeamID).(string)
return v, ok
}
func ModelIDFromContext(ctx context.Context) (string, bool) {
v, ok := ctx.Value(contextKeyModelID).(string)
return v, ok
}
type Tool struct {
ID string `db:"id" json:"id"`