Changeset 0.28.6 (#192)
This commit is contained in:
@@ -234,3 +234,15 @@ POST /admin/tasks/:id/run → force run
|
||||
POST /admin/tasks/:id/kill → cancel active run
|
||||
DELETE /admin/tasks/:id → delete task
|
||||
```
|
||||
|
||||
### Notifications Admin (v0.28.6)
|
||||
|
||||
```
|
||||
POST /admin/notifications/broadcast ← { "title", "message", "level?" }
|
||||
→ { "message": "broadcast sent", "count": N }
|
||||
```
|
||||
|
||||
Sends a `system.announcement` notification to all active users.
|
||||
Also emits a `system.broadcast` WebSocket event for real-time delivery.
|
||||
`level` is optional (`info` | `warning` | `critical`, default `info`).
|
||||
See [notifications.md](notifications.md#admin-broadcast-v0286) for full details.
|
||||
|
||||
@@ -91,6 +91,42 @@ POST /admin/notifications/test-email → send test email to requesting ad
|
||||
Requires admin role. Loads SMTP config from platform settings,
|
||||
sends a test message to the admin's registered email address.
|
||||
|
||||
### Admin Broadcast (v0.28.6)
|
||||
|
||||
```
|
||||
POST /admin/notifications/broadcast
|
||||
```
|
||||
|
||||
**Auth:** Admin only.
|
||||
|
||||
Sends a `system.announcement` notification to all active users via
|
||||
`NotifyMany`. Also emits a `system.broadcast` WebSocket event for
|
||||
real-time visibility.
|
||||
|
||||
**Request body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "Scheduled Maintenance",
|
||||
"message": "Servers will be down from 2-4 AM EST.",
|
||||
"level": "warning"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `title` | string | yes | Short summary shown in bell dropdown |
|
||||
| `message` | string | yes | Detail text |
|
||||
| `level` | string | no | `info` (default), `warning`, or `critical` |
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{ "message": "broadcast sent", "count": 42 }
|
||||
```
|
||||
|
||||
`count` is the number of active users notified.
|
||||
|
||||
### WebSocket Events
|
||||
|
||||
| Event | Payload | Description |
|
||||
@@ -98,6 +134,7 @@ sends a test message to the admin's registered email address.
|
||||
| `notification.new` | Full notification object | New notification created |
|
||||
| `notification.read` | `{"id": "uuid"}` | Single notification marked read |
|
||||
| `notification.read` | `{"action": "mark_all_read"}` | All notifications marked read |
|
||||
| `system.broadcast` | `{"title", "message", "level"}` | Admin announcement (v0.28.6) |
|
||||
|
||||
These are targeted via `Hub.SendToUser` — no room subscription
|
||||
required. Used for badge sync across tabs.
|
||||
@@ -106,7 +143,8 @@ required. Used for badge sync across tabs.
|
||||
|
||||
See [enums.md](enums.md#notification-types) for the canonical list.
|
||||
Types are free-form strings (`domain.action` convention) — new types
|
||||
don't require migration.
|
||||
don't require migration. Core types include `system.announcement`
|
||||
(admin broadcast, v0.28.6).
|
||||
|
||||
### Retention
|
||||
|
||||
|
||||
@@ -65,8 +65,17 @@ POST /tasks
|
||||
```
|
||||
|
||||
`task_type`: `prompt` (direct LLM execution), `workflow` (deferred —
|
||||
not yet implemented; creation is rejected at the API), or `action`
|
||||
(no LLM — relay/webhook only; requires `task.action` permission).
|
||||
not yet implemented; creation is rejected at the API), `action`
|
||||
(no LLM — relay/webhook only; requires `task.action` permission),
|
||||
or `system` (v0.28.6 — built-in Go function, admin-only).
|
||||
|
||||
System tasks require `system_function` — a registered function name
|
||||
from the platform's Go function registry. No LLM, no provider
|
||||
resolution, no channel needed. The function receives the store set
|
||||
and returns a result string. Designed for core platform ops
|
||||
(`session_cleanup`, `staleness_check`, `retention_sweep`, `health_prune`)
|
||||
that must not break from bad user code. Permanent track — not replaced
|
||||
by Starlark in v0.29.0.
|
||||
|
||||
`schedule`: cron expression, `once`, or `webhook`. Supported cron
|
||||
patterns: `@hourly`, `@daily`, `@weekly`, `*/N * * * *` (every N
|
||||
@@ -173,6 +182,26 @@ Returns `410 Gone` if the task is inactive.
|
||||
**Rate limiting:** Governed by global request rate limits. No per-task
|
||||
rate limiting in v0.28 — defer to a future version if needed.
|
||||
|
||||
### Task-to-Task Chaining (v0.28.6)
|
||||
|
||||
Tasks can trigger other tasks by setting the `webhook_url` of Task A
|
||||
to the trigger URL of Task B:
|
||||
|
||||
1. Create **Task B** with `schedule: "webhook"`. Note the trigger URL
|
||||
from the response (`/api/v1/hooks/t/{trigger_token}`).
|
||||
2. Create **Task A** with `output_mode: "webhook"` and set `webhook_url`
|
||||
to Task B's trigger URL.
|
||||
3. When Task A completes, its output is POSTed to Task B's trigger URL.
|
||||
Task B starts with Task A's output as its `trigger_payload`.
|
||||
|
||||
This enables multi-step pipelines without external orchestration:
|
||||
- Task A: "Summarize today's news" (prompt, cron: 6am)
|
||||
- Task B: "Format and post to Slack" (action, webhook-triggered)
|
||||
|
||||
The `webhook_secret` on Task A signs outbound payloads with HMAC-SHA256.
|
||||
Task B's trigger endpoint does not currently verify signatures (the
|
||||
trigger token itself is the auth mechanism).
|
||||
|
||||
## Team Tasks
|
||||
|
||||
Team-scoped tasks visible to all team members, manageable by team admins.
|
||||
@@ -240,6 +269,30 @@ DELETE /admin/tasks/:id
|
||||
|
||||
**Auth:** Platform admin.
|
||||
|
||||
### System Functions (v0.28.6)
|
||||
|
||||
```
|
||||
GET /admin/system-functions → { "data": [SystemFuncInfo, ...] }
|
||||
```
|
||||
|
||||
Returns all registered built-in system function names and descriptions.
|
||||
Used by the admin UI to populate the function dropdown when creating
|
||||
system tasks.
|
||||
|
||||
**SystemFuncInfo:**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "session_cleanup",
|
||||
"description": "Remove expired anonymous visitor sessions"
|
||||
}
|
||||
```
|
||||
|
||||
Built-in functions (v0.28.6): `session_cleanup`, `staleness_check`,
|
||||
`retention_sweep`, `health_prune`.
|
||||
|
||||
**Auth:** Platform admin.
|
||||
|
||||
## Task Object
|
||||
|
||||
```json
|
||||
@@ -250,7 +303,8 @@ DELETE /admin/tasks/:id
|
||||
"name": "Morning News Digest",
|
||||
"description": "...",
|
||||
"scope": "personal|team|global",
|
||||
"task_type": "prompt|workflow|action",
|
||||
"task_type": "prompt|workflow|action|system",
|
||||
"system_function": "session_cleanup",
|
||||
"persona_id": "uuid|null",
|
||||
"model_id": "claude-sonnet-4-20250514",
|
||||
"system_prompt": "...",
|
||||
|
||||
@@ -361,13 +361,15 @@ Independent of workspace scope — credentials are user-level.
|
||||
|
||||
```
|
||||
POST /git-credentials ← { "name", "auth_type", ... }
|
||||
POST /git-credentials/generate ← { "name", "persona_id?" }
|
||||
GET /git-credentials → { "data": [GitCredentialSummary] }
|
||||
GET /git-credentials/:id/public-key → { "public_key", "fingerprint" }
|
||||
DELETE /git-credentials/:id
|
||||
```
|
||||
|
||||
**Auth:** Authenticated user. Credentials are scoped to the requesting user.
|
||||
|
||||
**Create request:**
|
||||
**Create request (manual):**
|
||||
|
||||
`auth_type` determines which fields are required:
|
||||
|
||||
@@ -379,6 +381,37 @@ DELETE /git-credentials/:id
|
||||
|
||||
Returns `201` with the credential summary (never exposes encrypted data).
|
||||
|
||||
**Generate request (v0.28.6 — server-side SSH keygen):**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "GitHub - main",
|
||||
"persona_id": "uuid"
|
||||
}
|
||||
```
|
||||
|
||||
Generates an ED25519 SSH keypair server-side. The private key is
|
||||
vault-encrypted before storage and never leaves the server. Returns
|
||||
the credential summary including the public key (authorized_keys
|
||||
format) and SHA256 fingerprint. The user adds the public key to their
|
||||
git host (GitHub, Gitea, etc.).
|
||||
|
||||
Optional `persona_id` binds the key to a persona for commit
|
||||
attribution — git operations using this credential will set the
|
||||
commit author to the persona's name and handle.
|
||||
|
||||
Returns `201`.
|
||||
|
||||
**Get Public Key:**
|
||||
|
||||
```
|
||||
GET /git-credentials/:id/public-key
|
||||
```
|
||||
|
||||
Returns `{ "public_key": "ssh-ed25519 AAAA...", "fingerprint": "SHA256:..." }`.
|
||||
Owner-only — returns `404` for other users or credentials without
|
||||
a public key (e.g. PAT credentials).
|
||||
|
||||
**List response:**
|
||||
|
||||
```json
|
||||
@@ -388,12 +421,18 @@ Returns `201` with the credential summary (never exposes encrypted data).
|
||||
"id": "uuid",
|
||||
"name": "GitHub PAT",
|
||||
"auth_type": "https_pat",
|
||||
"public_key": "",
|
||||
"fingerprint": "",
|
||||
"persona_id": null,
|
||||
"created_at": "2025-06-15T14:30:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`public_key` and `fingerprint` are populated for `ssh_key` type
|
||||
credentials created via `/generate`. Empty for PAT/basic auth.
|
||||
|
||||
**DELETE** returns `{"deleted": true}`. Returns `404` if credential
|
||||
not found or not owned by the requesting user.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user