Changeset 0.27.2 (#169)
This commit is contained in:
91
CHANGELOG.md
91
CHANGELOG.md
@@ -1,5 +1,96 @@
|
||||
# Changelog
|
||||
|
||||
## [0.27.2] — 2026-03-10
|
||||
|
||||
### Summary
|
||||
|
||||
Task execution — the scheduler can now actually run completions. Headless
|
||||
executor wires tasks into the full completion pipeline (provider resolution,
|
||||
tool execution, budget enforcement, notifications). Admin panel gains a Tasks
|
||||
section for CRUD, run history, kill switch, and global task configuration.
|
||||
|
||||
### Added
|
||||
|
||||
#### Core Tool Loop Extraction
|
||||
- **`CoreToolLoop` + `LoopSink` interface.** Single canonical implementation of
|
||||
multi-round LLM completion with tool execution. Replaces three duplicated
|
||||
implementations (SSE streaming, multi-model streaming, sync JSON). Budget
|
||||
enforcement built in: `MaxTokens`, `MaxToolCalls`, `MaxRounds`.
|
||||
- **`LoopResult.BudgetExceeded`** field tracks which limit was hit. Callers
|
||||
get budget status without inspecting loop internals.
|
||||
- **Four sink implementations:** `sseSink` (interactive SSE), `sseModelSink`
|
||||
(multi-model SSE), `accumSink` (sync JSON), `HeadlessSink` (scheduler).
|
||||
|
||||
#### Provider Resolution Extraction
|
||||
- **`ResolveProviderConfig()`** standalone function. Resolution chain:
|
||||
explicit config → channel config → owner's personal → global. Shared by
|
||||
completion handler and task executor.
|
||||
- **`BuildToolDefs()`** standalone function. Server-registered tools filtered
|
||||
by context predicates + browser extension tools + persona tool grant allowlist.
|
||||
- **`FilterToolDefsByGrants()`** for task-level tool grant narrowing.
|
||||
|
||||
#### Task Executor (`scheduler/executor.go`)
|
||||
- **Headless completion pipeline.** Resolves provider, builds messages + tools,
|
||||
runs `CoreToolLoop` with `Streaming: false`, persists assistant response in
|
||||
service channel, updates run record with tokens/tools/wall-clock, sends
|
||||
owner notification.
|
||||
- **Budget enforcement.** `max_tokens`, `max_tool_calls` from task definition.
|
||||
Wall clock via `context.WithTimeout`. Budget breach → `budget_exceeded`
|
||||
status + mandatory owner notification.
|
||||
- **Provider routing.** Task `provider_config_id` → channel → owner's
|
||||
personal BYOK → team → global. Full vault decryption path.
|
||||
- **Tool grants.** Persona grants + task-level grants applied as second-pass
|
||||
allowlist. No browser tools in headless mode.
|
||||
|
||||
#### Task Configuration (`taskutil/`)
|
||||
- **`LoadTaskConfig()`** reads from `global_settings` key `"tasks"`. Fields:
|
||||
`enabled`, `allow_personal`, `max_concurrent`, `default_max_tokens`,
|
||||
`default_max_tool_calls`, `default_max_wall_clock`.
|
||||
- **`ApplyDefaults()`** fills zero-value budget fields on new tasks.
|
||||
- **Full cron parsing** via `robfig/cron/v3`. Replaces hand-rolled
|
||||
`parseDailyCron`. Supports 5-field cron + descriptors (`@hourly`, `@daily`).
|
||||
- **`ValidateCron()`** pre-create validation rejects invalid expressions.
|
||||
|
||||
#### Permissions + Global Config
|
||||
- **`task.create`** permission — gates task create/update/delete/run routes.
|
||||
- **`task.admin`** permission — for future admin-level task management.
|
||||
- **Global config keys:** `tasks.enabled` (kill switch), `tasks.allow_personal`,
|
||||
`tasks.max_concurrent` (scheduler poll limit).
|
||||
|
||||
#### Admin Panel
|
||||
- **Tasks section** under Workflows category. Two tabs: task list + configuration.
|
||||
- **Task list:** all tasks across users with status, schedule, run count, next
|
||||
run time. Action buttons: run now, view history, delete.
|
||||
- **Run history:** drill-down per task showing start/end times, tokens used,
|
||||
tool calls, wall clock, status badge, error messages.
|
||||
- **Kill switch:** cancel active run from run history view.
|
||||
- **Configuration tab:** toggle tasks enabled/personal, set max concurrent and
|
||||
default budget ceilings. Writes to `global_settings` key `"tasks"`.
|
||||
|
||||
#### Routes
|
||||
- `POST /api/v1/tasks/:id/kill` — cancel active run (user + admin)
|
||||
- `POST /api/v1/admin/tasks/:id/run` — admin trigger
|
||||
- `POST /api/v1/admin/tasks/:id/kill` — admin kill
|
||||
- `DELETE /api/v1/admin/tasks/:id` — admin delete
|
||||
|
||||
### Changed
|
||||
- **`stream_loop.go`** rewritten from 559 lines to 181 — thin wrappers over
|
||||
`CoreToolLoop`. Identical behavior, zero duplication.
|
||||
- **`completion.go`** `syncCompletion` rewritten as wrapper. `resolveConfig`
|
||||
and `buildToolDefs` delegate to standalone functions. `-237 lines`.
|
||||
- **Scheduler startup** moved from early init to after hub + notification
|
||||
service initialization. Executor needs both.
|
||||
- **`scheduler.New()`** signature: `New(stores) → New(stores, executor)`.
|
||||
Executor is optional (nil = v0.27.1 behavior).
|
||||
- **Cron computation** in scheduler and task handler now uses `robfig/cron/v3`
|
||||
via `taskutil.NextRunFromSchedule`. Create and update validate schedule
|
||||
before persisting.
|
||||
|
||||
### Dependencies
|
||||
- Added `github.com/robfig/cron/v3 v3.0.1`
|
||||
|
||||
|
||||
|
||||
# Changelog Additions — v0.26.0
|
||||
|
||||
## [0.26.0] — 2026-03-10
|
||||
|
||||
Reference in New Issue
Block a user