From 2a491cb2cffdbdd1bbd1e0daf47c8665cc28f816 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 3 Nov 2026 16:56:49 +0000 Subject: [PATCH] refactor(addons): remove the shims for older add-on data No release carried add-ons, so nothing reads older add-on data or manifests. Delete the code that did. - Connectors: the kind and the add-on of the Telegram connectors that core once carried are gone (LegacyAddon, KindTelegram, the stored binding normalization, the platform titles). A binding needs a kind, and its add-on is the one that serves the kind. The conversion of the old agent pool lists every connector as dropped instead of making a Telegram binding, and its notes say so. - The library index reads only the id field of an entry, not addonId. - A host control that has a capability block (the network policy) is attached by that block alone, not by a tool that replaces bash. - The Office create tools no longer answer for the argument names of an earlier schema, and the identity file note about old addresses is gone. - The known debt of the provider-name guard drops the entries of the conversion and of the resource listing shim, and its ceiling goes from 13 to 5. Assisted-by: Claude:claude-sonnet-5-5 go test --- addons/office/internal/tools/create.go | 11 ++--- core/application/studio_convert.go | 9 ---- .../endpoints/localai/api_instructions.go | 2 +- core/http/endpoints/studio/conversion.go | 2 +- .../react-ui/public/locales/en/chats.json | 2 +- .../unit/provider-strings-allowlist.json | 1 - core/services/addons/apps/apps_test.go | 1 + .../addons/catalog/backend_entry_test.go | 10 ++--- core/services/addons/catalog/catalog.go | 4 +- core/services/addons/catalog/envelope.go | 4 +- core/services/addons/catalog/index.go | 26 ------------ .../addons/catalog/index_yaml_test.go | 22 +--------- core/services/addons/catalog/kind_test.go | 41 +++++++------------ core/services/addons/catalog/sources_test.go | 2 +- core/services/addons/manager_test.go | 6 --- core/services/addons/ownership.go | 3 +- .../studio/connectors/connectorstest/suite.go | 22 +--------- core/services/studio/connectors/gorm.go | 2 +- core/services/studio/connectors/json.go | 4 +- core/services/studio/connectors/seal_test.go | 18 ++++---- core/services/studio/connectors/types.go | 20 +-------- core/services/studio/connectorscope.go | 2 - core/services/studio/connectorsvc.go | 26 +++--------- .../studio/convert/convert_fixes_test.go | 1 - core/services/studio/convert/convert_test.go | 24 ++++------- core/services/studio/convert/run.go | 38 +++-------------- core/services/studio/convert/types.go | 14 ++----- .../studio/providerguard/guard_test.go | 22 +--------- .../plans/2026-10-16-addons-navigation.md | 2 +- pkg/addons/contract/connector_test.go | 2 +- pkg/addons/contract/credentials_test.go | 2 +- pkg/addons/contract/execution.go | 3 +- pkg/addons/contract/hostcontrols.go | 17 ++++---- pkg/addons/contract/hostcontrols_test.go | 17 +++++--- pkg/addons/contract/manifest.go | 5 +-- pkg/addons/contract/network_test.go | 15 +++---- pkg/addons/contract/skills.go | 3 +- pkg/addons/contract/slots.go | 2 +- 38 files changed, 104 insertions(+), 303 deletions(-) diff --git a/addons/office/internal/tools/create.go b/addons/office/internal/tools/create.go index ed8ac06a8..bfeac6549 100644 --- a/addons/office/internal/tools/create.go +++ b/addons/office/internal/tools/create.go @@ -19,7 +19,7 @@ import ( // decodeTextCreation is deliberately local to the three string creation tools. // Bound raw JSON before decoding, and never echo decoder errors or user content. -func decodeTextCreation(raw json.RawMessage, v any, field, legacy string) error { +func decodeTextCreation(raw json.RawMessage, v any, field string) error { if len(raw) > 1<<20 { return refuse("arguments exceed 1 MiB; shorten %s", field) } @@ -27,9 +27,6 @@ func decodeTextCreation(raw json.RawMessage, v any, field, legacy string) error if err := json.Unmarshal(raw, &fields); err != nil { return refuse("arguments must be a JSON object with path and %s strings", field) } - if _, ok := fields[legacy]; ok { - return refuse("%s is no longer supported; use the %s string", legacy, field) - } for _, key := range []string{"path", field, "title", "sheet"} { value, ok := fields[key] if !ok { @@ -52,7 +49,7 @@ func (w *work) createDocx(raw json.RawMessage) (any, error) { Title string `json:"title"` Markdown string `json:"markdown"` } - if err := decodeTextCreation(raw, &a, "markdown", "blocks"); err != nil { + if err := decodeTextCreation(raw, &a, "markdown"); err != nil { return nil, err } if err := checkPath(a.Path, ".docx"); err != nil { @@ -85,7 +82,7 @@ func (w *work) createXlsx(raw json.RawMessage) (any, error) { CSV string `json:"csv"` Sheet string `json:"sheet"` } - if err := decodeTextCreation(raw, &a, "csv", "sheets"); err != nil { + if err := decodeTextCreation(raw, &a, "csv"); err != nil { return nil, err } if err := checkPath(a.Path, ".xlsx"); err != nil { @@ -156,7 +153,7 @@ func (w *work) createPdf(raw json.RawMessage) (any, error) { Title string `json:"title"` Markdown string `json:"markdown"` } - if err := decodeTextCreation(raw, &a, "markdown", "blocks"); err != nil { + if err := decodeTextCreation(raw, &a, "markdown"); err != nil { return nil, err } if err := checkPath(a.Path, ".pdf"); err != nil { diff --git a/core/application/studio_convert.go b/core/application/studio_convert.go index 9091ad7a4..ff752a942 100644 --- a/core/application/studio_convert.go +++ b/core/application/studio_convert.go @@ -253,15 +253,6 @@ func (t studioTargets) DiscardChat(ctx context.Context, user, title string, crea return nil } -func (t studioTargets) CreateBinding(ctx context.Context, user string, in convert.BindingIn) error { - c := t.svc.Connectors() - if c == nil { - return errors.New("connectors are not available") - } - _, err := c.CreateConnector(ctx, user, studio.ConnectorInput{Name: in.Name, Token: in.Token, AgentID: in.AgentID, Allow: in.Allow, Enabled: false}) - return invalid(err) -} - func connectorRefs(ids []string) []string { var out []string for _, id := range ids { diff --git a/core/http/endpoints/localai/api_instructions.go b/core/http/endpoints/localai/api_instructions.go index 1387d602c..560a85b1c 100644 --- a/core/http/endpoints/localai/api_instructions.go +++ b/core/http/endpoints/localai/api_instructions.go @@ -28,7 +28,7 @@ var instructionDefs = []instructionDef{ {Name: "agent-jobs", Description: "Agent tasks and jobs: saved prompt templates run in the background, with webhooks", Tags: []string{"agent-jobs"}, Intro: "A task is a prompt template ({{.name}} parameters) run by a model or a saved agent (agent_id); a job is one run of it, a background chat of its owner with origin job. POST /api/agent/tasks creates a task {name, model, agent_id, prompt, enabled, webhooks [{url, method, headers, payload_template}]}; GET, PUT and DELETE /api/agent/tasks/{id} read, replace and delete it; header values are never returned (sent back as [hidden] they keep their value). POST /api/agent/jobs/execute {task_id, parameters, images, videos, audios, files} or POST /api/agent/tasks/{name}/execute {parameters} starts a job and answers 201 {job_id, status, url} at once; attachments are base64 data URIs, an address is never fetched. GET /api/agent/jobs/{id} gives status (pending, running, completed, failed, cancelled), result, error, traces and the webhook delivery; GET /api/agent/jobs lists newest first (task_id, status, limit); POST .../jobs/{id}/cancel stops one, POST .../jobs/{id}/rerun runs it again, DELETE removes it with its chat. cron and multimedia_sources on a task are refused: schedule a saved agent with a trigger. A webhook to a private address is refused unless an administrator allows it. Needs the mcp_jobs feature (off by default); ?all_users=true gives an administrator a read-only view of every user's tasks and jobs."}, {Name: "collections", Description: "Collections: the knowledge base of documents the chats can search, with files and followed URLs as sources", Tags: []string{"collections"}, Intro: "A collection is a set of files the server cuts into passages and embeds. GET and POST /api/collections list and create (POST {name}) the collections of the user; POST /api/collections/{name}/upload (multipart field file) adds a file; GET .../entries, .../entries/{entry} and .../entries-raw/{entry} read them; POST .../search {query, max_results} returns the best passages (a number above the passages stored returns all of them); DELETE .../entry/delete {entry} removes one; POST .../reset removes every entry and keeps the collection and its sources; GET, POST and DELETE .../sources follow a URL. Names with special characters must be URL-encoded. Each user sees only their own collections. The routes need the collections feature (off by default for a user); the service can be turned off with LOCALAI_DISABLE_COLLECTIONS. A saved agent can search a collection when it is granted in the agent's collections list. The deprecated path /api/agents/collections serves the same store with a Deprecation header."}, {Name: "workspace", Description: "A live feed of the changes to your files, whoever made them", Tags: []string{"workspace"}, Intro: "GET /api/workspace/events streams server-sent events: a change event {revision, paths, kinds} when files in your home folder change, from any client, chat, trigger, connector or frontend. Paths are inside your home, without a leading slash; kinds are the kinds of the change sets (user, agent, upload, undo). Changes close together come as one event, about once a second at most. A resync event {revision} means some changes were left out: read again what you show. The event id is the revision; send it back as Last-Event-ID or ?after= to resume, otherwise the stream starts from now. A comment line comes every 25 seconds. You see only paths you may read. At most 8 streams per user (429 after). Needs the chats feature; 409 files_off when the server has no files."}, - {Name: "chats", Description: "Chats the server keeps: steering, sub-agents and live events", Tags: []string{"chats"}, Intro: "POST /api/chats starts a chat with a model; PATCH /api/chats/{id} {title, model, settings} renames it (1 to 80 characters), moves it to another model (history stays) or sets its settings {system_prompt, temperature, top_p, top_k, reasoning_effort, context_size}, which apply from the next turn (a new title or model needs an idle chat: 409 otherwise). POST .../{id}/regenerate answers the last message again, POST .../{id}/messages/{seq}/edit {text} replaces one of your messages and runs again from it (later lines are removed), POST .../{id}/fork {from_seq, title} copies a chat up to a line into a new chat, GET /api/chats/search?q= finds chats by title or text, GET .../{id}/export?format=markdown|json returns a chat as a file and POST /api/chats/import {chat, model} stores a JSON export as a new chat. Events also carry usage {used, limit, completion, tokens_per_second, model, node, prompt_ms} after each model request, for a context meter (node only when the server exposes the node header, prompt_ms only when the backend reports timings). Sub-agents: GET /api/chats/{id}/agents lists the sub-agent runs of a chat with running, last_turn and the background limit (from the shared store), GET .../{id}/agents/{agent_id}/messages reads one run's transcript and POST .../{id}/agents/{agent_id}/stop stops it; sub_agent_started and sub_agent_done events mark them in the parent's stream. A chat that PUT .../{id}/builtins {on: [\"saved_agents\"]} switched on (off by default; needs the agents feature and the chats_saved_agents setting) also gets list_agents and the agent argument of spawn_agent (a saved agent's id or name): the sub-agent then runs with that agent's instructions, model and grants. POST .../{id}/messages sends a message: with no turn running it starts one; with a turn running it waits (started false, pending_id) and reaches the model, together with any others and in order, at the model's next request. GET .../{id} lists the waiting messages; PATCH and DELETE .../{id}/pending/{pid} edit or cancel one until it is delivered (409 after). After a stop or a failed turn the waiting messages stay; POST .../{id}/send-now starts a turn from them and POST .../{id}/stop ends a running turn. Goals: PUT .../{id}/goal {text} sets a goal for the chat (it replaces the one it had, returned as replaced) and starts a turn on it when none runs; while the goal is active every turn's prompt carries it, the model gets goal_done {summary} and goal_blocked {reason}, and when a turn ends by itself the server starts the next one, until the goal is done or blocked, you stop it (POST .../{id}/stop pauses the goal), or chats_goal_max_turns (20 by default) automatic turns or chats_goal_max_steps (400) model steps pause it. Your messages still steer it: they go first. GET .../{id}/goal reads it {text, state active|paused|done|blocked, paused_by user|turn_limit|step_limit|error|interrupted, note, turns, max_turns, steps, max_steps}, DELETE .../{id}/goal clears it and POST .../{id}/goal/resume resumes a paused or blocked one with new counts; GET .../{id} carries it as goal, a goal event says it changed, and the transcript has goal lines (role goal, goal_event set|replaced|continue|paused|resumed|done|blocked|cleared). A chat that a trigger, a connector, a job or a page started, and a sub-agent run, cannot have a goal. A turn whose tool loop reaches the step limit (the runtime setting chats_max_iterations, 40 by default, or the model's agent.max_iterations) ends with last_turn paused after a paused event {steps}: the model answered from what it had, and a new message (for example \"Continue\") goes on. GET .../{id}/messages reads the transcript (a user line has text, the words typed, and attachments [{path, name, size, mime, version, missing}], the files it carried, with path inside your home for the files API; a waiting message has the same two fields; the model still gets the paths of the files with the message) and GET .../{id}/events streams live server-sent events, so read the transcript first. A chat is named after its first message. A conversation belongs to its user; another user's id is always 404. POST /api/chats/import/browser takes the chats the old chat page kept in the browser (the value of localStorage localai_chats_data) and stores them as yours; a chat that is there already is skipped. Needs the chats feature, which is on by default. Saved agents need the agents feature, triggers the triggers feature and connectors the connectors feature; all three are off by default for a user and an administrator grants them (an administrator has them all). The server can switch the chats off (LOCALAI_DISABLE_CHATS: every /api/chats path then answers 404 chats_off), and the triggers or the connectors alone (LOCALAI_DISABLE_TRIGGERS, LOCALAI_DISABLE_CONNECTORS: their routes answer 409 triggers_off or connectors_off); GET /api/features says what runs. Your files: GET /api/chats/files?path= lists a folder of your workspace (paths are inside your home, \"/\"), GET and PUT /api/chats/files/content?path= download and upload a file (a second upload that does not name the version it started from keeps both files and reports conflict_of), POST .../files/folders and .../files/move create and rename, DELETE .../files?path= moves to the Trash, GET .../files/trash lists deletions (each with files, folders and bytes, and totals for the whole Trash) and POST .../files/undo {rev} restores one, DELETE .../files/trash empties the Trash for good and DELETE .../files/trash/{rev} deletes one entry for good (neither can be undone; they touch only your own Trash and the agent tools never do this), GET .../files/history lists changes, GET .../files/search?q= searches names, text files and the text of PDF, Word, Excel and PowerPoint files (a document hit has document, page, sheet or slide; indexing counts documents still being read), and GET .../files/preview?path= reads a .xlsx, .xlsm, .csv, .tsv, .docx or .pptx file of up to 20 MiB for a preview (kind table: sheets of at most 200 rows by 30 columns with total_rows and total_cols; kind document: headings, list items, paragraphs and tables {type table, rows}; kind slides: titles, text and notes; 415 for another type). POST .../{id}/messages also takes multipart/form-data (text and files) to attach files (with a turn running the files are saved at once and the message waits with their paths): images go to a vision model inside the message (image_url parts; other models get the path and describe_image), videos to a model that takes video, and the text of PDF, Word, Excel, PowerPoint and EPUB files is added to the message (the model reads the rest with read_document). Skills: GET /api/chats/skills?chat= lists the skills of the five layers (folder, personal, shared, addon, builtin; an addon skill names its add-on in addon and addon_title) with enabled and shadowed, POST creates one {layer personal|shared, name, description, body} (shared needs an administrator), GET PUT DELETE .../skills/{layer}/{name} read, change and delete (to the Trash), PUT /api/chats/{id}/skills {off} switches skills off for one chat. Well-known files: GET and PUT /api/chats/wellknown/{name} (persona, user, shortcuts, home, ui, or widget-data with ?path=) read and change the files of your home that set the assistant's persona, your profile, the composer shortcuts, the Home widgets and the look. A read is validated against the JSON Schema at .../wellknown/{name}/schema and falls back to the last valid version (fallback, errors); a write {values, replace} merges the keys it sends (null removes one), takes the version you read in If-Match (409 with current when the file changed) and is refused with errors when the result is invalid; POST .../wellknown/{name}/revert restores the previous valid version as a new change, or the version {rev} that GET .../wellknown/{name}/versions lists (newest first, with who wrote it and in which chat). A checkpoint line of a transcript carries rev, the change set of the turn, and lists the paths it changed. Add-ons: GET /api/chats/{id}/addons lists the add-ons whose tools you may use, each with its switch for that chat, and PUT /api/chats/{id}/addons {off: [ids]} switches the tools of add-ons off for one chat. Commands: a chat runs commands with bash, served by an add-on that runs commands (isolated) or, when no add-on serves it, by the built-in bash directly on this machine with no isolation and with its network; the add-on list says which (commands_provider, commands_isolation, commands_consent, commands_fallback). With chats_host_exec ask, each command waits: a host_exec_consent event carries {ids: [id], text: command} and POST /api/chats/{id}/host-exec/consent {id, decision: once|deny} answers it (once needs an administrator). Administrators: GET /api/chats/admin/tools lists the built-in tools an add-on may replace (Settings > Tools; change them with POST /api/settings chats_host_exec and chats_tool_providers) and GET /api/chats/admin/host-exec/events?limit= reads the audit of the commands run on this machine. Network of the isolated commands: the guest has no network device and reaches HTTP and HTTPS only through a proxy that asks the server about each connection. GET /api/chats/{id}/egress returns {preset, ceiling, effective, applies, applies_reason, addon, registries, rules, cards} (applies is false when commands run on this machine, which has the server's network; addon is the add-on that runs the commands and draws the chat's network controls), PUT .../{id}/egress {preset: off|registries|all} sets the chat's preset (400 egress_above_ceiling above the administrator's chats_egress_ceiling), DELETE .../{id}/egress/rules/{host}/{port} removes an allow or deny rule, an egress_consent event {ids: [card id], text: host:port} asks for a host the chat does not allow (the command waits up to 60 seconds) and POST .../{id}/egress/consent {id, decision: once|chat|deny} answers it (allowing a host inside your network needs an administrator), and egress_card events say that the chat's network changed. Administrators: GET /api/chats/admin/egress reads the chats_egress_* settings in force, the registries and the counts of the last 24 hours, and GET /api/chats/admin/egress/events?limit=&user=&chat=&verdict=&host= reads the audit. Saved agents: GET and POST /api/chats/agents, GET PUT DELETE .../agents/{id}: an agent is {name, description, instructions, model, mcp_servers, addons, collections, skills, network, folder}; folder {path, mode read|write} gives it one folder of your files (\"/\" is all of them; not LocalAI, Chats or a shared folder; 400 otherwise), kept by the folder itself so a rename or move is followed, shown back as {path, name, mode, state ok|missing|unset}; a write without folder keeps it and folder {path: \"\"} clears it; network (off, registries or all; off by default) is the network of the isolated commands of its trigger and connector runs, capped by chats_egress_ceiling, which never show a card; the lists are exact grants (an empty list grants nothing) and a chat gets only what you may use at that moment. POST /api/chats {agent_id} starts a chat with one (the agent's model replaces model when it has one). GET .../agents/{id}/export returns the definition as a JSON file (version 1, kind localai-agent; version 2 with folder {path, mode} for an agent with a folder, which a server that knows only version 1 refuses), POST .../agents/import takes that file (JSON body or multipart file field) and saves a new agent (a taken name gets a number, an unavailable model is dropped, a folder you do not have leaves the agent unset until you choose one; warnings say so), GET .../agents/templates lists starter agents and POST .../agents/templates/{id}/create saves one, GET .../agents/{id}/runs lists the chats that ran with the agent (yours, trigger runs, connector runs) with last_turn and counts. Inbox: GET /api/chats/notifications?unread=1 lists the notifications of your trigger runs (kind run_ended, run_failed or needs_attention) with the unread count, GET .../notifications/count counts them, POST .../notifications/read {ids} or {all: true} marks them read, DELETE .../notifications {ids} removes some, or {all: true} empties your inbox ({all: true, read_only: true} removes only the read ones; the answer has deleted and the unread count left), the list also gives total (everything kept, since limit, at most 500, can cut the list), and GET .../notifications/events streams new ones as server-sent events plus a notifications_changed event when notifications were read or deleted (from any tab or frontend), after which a client reads the list again. A user only ever reaches their own notifications. Opening a chat (GET /api/chats/{id}) marks its notifications read. Triggers: GET and POST /api/chats/triggers, GET PUT DELETE .../triggers/{id}, POST .../{id}/run (start now), .../{id}/enable and .../{id}/disable, GET .../{id}/runs, GET .../triggers/preview?when=&tz= (next times of a schedule). A trigger is {name, prompt, kind schedule|file, schedule + time_zone, or folder + quiet_seconds, daily_cap, enabled, agent_id, model, source_chat_id}: it starts a chat as you by itself, on a schedule (\"daily 08:00\", \"weekdays 09:30\", \"weekly mon,thu 09:30\", \"monthly 15 08:00\", \"once 2026-12-24 18:00\" or five cron fields) or when a file arrives in the folder; a chat it starts has origin trigger. A trigger also has plan {reads, writes, widget} (what a run reads, the file it rewrites and the Home widget that shows it), cost {estimated_tokens, average_tokens, runs, max_runs_per_day, remote} and last_done, and each run its tokens; a file trigger waits min_gap_seconds (60 by default) after a run before a file that changed again starts another. The four trigger tools (propose_trigger, list_triggers, update_trigger, delete_trigger) are the built-in tool group triggers: on in a chat a person starts, switched together with PUT .../{id}/builtins {off: [\"triggers\"]}, listed in GET .../{id}/tools and GET .../draft/tools with usable and reason (not usable in a run a trigger or connector started, for a user without the triggers feature; not listed when the server runs no triggers), and never given to a sub-agent. A model can propose a trigger in a chat (propose_trigger; a schedule from a chat runs at most once an hour); GET .../triggers/proposals?chat= lists them, PUT .../triggers/proposals/{id} edits one (it stays a proposal), POST .../triggers/proposals/{id}/confirm {time_zone} turns one into a trigger that is on, DELETE dismisses it (the answer is kept: GET .../triggers/proposals/{id} returns {state pending|accepted|declined|undone, trigger, answered_at, can_undo, undo_blocked}, POST .../undo takes an accepted one back unless the trigger ran or was edited since (409 says why) and POST .../reopen restores a declined or undone one); the chat carries a proposal as a card {kind trigger_proposal, id} on the tool line (tool_end event and transcript) and as a trigger_proposed event. A model can also ask to change a trigger of yours (list_triggers gives each a ref; update_trigger edits, pauses or resumes, delete_trigger deletes): an edit or a delete waits for you, and a pause or a resume applies at once; the chat carries it as a card {kind trigger_change, id}. GET .../triggers/changes/{id} returns {id, op update|delete|pause|resume, state pending|applied|dismissed|undone, trigger_id, before, after, fields, answered_at, stale, can_undo, undo_blocked, last_run}, POST .../changes/{id}/apply makes it (409 when the trigger changed since), DELETE dismisses it and POST .../changes/{id}/undo puts the trigger back as it was, for a day after it applied (a deleted trigger comes back with its id, without its run history). Proposed changes: a model asks to change your memory or an agent profile with propose_change {kind memory|profile, scope user|agent|channel, target, content, summary} (in the built-in tool group changes; revert_change {id} undoes an applied one). Nothing is written until you confirm. GET /api/chats/changes?status= lists the proposals (id, kind, scope, target, summary, content, source {kind, id, chat}, status pending|applied|dismissed|expired|reverted|stale, rev), GET .../changes/{id} reads one, POST .../changes/{id}/confirm writes it as one change set, or with a body {content} your own text in its place (409 when the file changed since, the proposal expired after 24 hours or it was answered), POST .../changes/{id}/dismiss answers no, POST .../changes/{id}/undo restores the file (409 when it was edited since) and GET .../changes/audit lists who proposed, confirmed or reverted what, with a hash and never the text. GET /api/chats/context-files lists the notes the host puts in the prompt (limits, and groups of {source, scope, key, max_bytes, max_lines, files}) for the Memory tab of Your settings; it only reads. At most 10 proposals wait per user and 5 are made per hour per agent. A chat that runs a saved agent cannot propose until the agent is granted it: the agent's builtins list holds memory.write, profile.write, skills.write, pages.write or dashboard.write (GET /api/chats/agents/builtin-grants lists every grant with title, description and sensitive; none is on by default). propose_change also takes kind skill (a SKILL.md; a skill with locked: true in its frontmatter is refused), page (target is the page name, files is {path: text} with an index.html) and dashboard (the full home.json, checked against its schema). Browser push: GET /api/chats/push/key returns the server's VAPID public key, POST /api/chats/push/subscribe takes a browser PushSubscription {endpoint, keys: {p256dh, auth}} (an https endpoint on a public address) and DELETE .../push/subscribe {endpoint} removes it; a notification is then pushed with its title and link only. These answer 409 push_off when the server keeps nothing across a restart. Conversion: at start the server converts the old chat page, agents, tasks, skills and Telegram connectors; GET /api/chats/conversion lists what happened to your items (kind, name, status converted|skipped|failed|dropped, reason) and gives an administrator the totals. Converted triggers and connectors are switched off. Connectors: GET /api/chats/connectors/kinds lists the platforms that an installed add-on serves (each kind comes with the add-on that serves it), GET and POST /api/chats/connectors, GET PUT DELETE .../connectors/{id}, POST .../{id}/enable, .../disable and .../test (asks the platform who the bot is), GET .../{id}/senders (who wrote to the bot) and POST .../{id}/senders/{sender}/allow. POST .../{id}/pairing makes a one-use pairing code (valid ten minutes) that you send as a direct message to the bot from an allowlisted account to pair it (a pairing lasts 90 days, at most three senders), and DELETE .../{id}/paired/{sender} ends one. A binding also has caps (the capabilities you enabled, from a closed list), grants [{role, caps}] (roles that the kind declares in roles and permissions of the kinds list; never a sensitive capability) and paired. A binding is {kind (the platform, telegram when empty; set at create only), name, token (write-only, sealed, never returned; has_token says it is stored), agent_id (required: an agent of yours that names a model), enabled, accept_any, allow [chat IDs, user IDs or @usernames], notify_chat}: a person who messages the bot talks to that agent in a conversation of their own, as you, with only the agent's grants. The allowlist is empty at first, so nobody is accepted; a sender who is not accepted is ignored and logged. accept_any lets anyone who can message the bot use the agent; the create or update that turns it on must also send confirm_accept_any: \"accept any message\" (else 400). Files and skills answer 409 with the reason when the server has no data path. Administrators: GET /api/chats/admin/agents, .../admin/triggers and .../admin/connectors list what every user has, each with its owner and never a token or instructions; GET .../admin/triggers/{id}/runs lists the runs of a trigger, POST .../admin/triggers/{id}/disable and .../admin/connectors/{id}/disable switch one off, and DELETE .../admin/agents/{id}, .../admin/triggers/{id} and .../admin/connectors/{id} remove one. No MCP tool maps to these routes: they are the user's own chat and files, not administration. GET POST /api/chats/mcp-connectors, GET PUT DELETE /api/chats/mcp-connectors/{id} and POST .../enable, .../disable, .../test manage your MCP connectors: MCP servers you define (transport http, or stdio for administrators outside distributed mode), stored per user, with token, headers and env sealed and never returned; a test answers 200 with ok and the tool names or the error. Addresses on private networks are refused at connect time unless an administrator sets mcp_connectors_allow_private. A chat with no agent gets your enabled connectors; a saved agent names one as connector: in mcp_servers. GET /api/chats/{id}/tools lists the built-in tool groups, add-ons, model MCP servers and connectors of a chat with their switches. The built-in groups are on until PUT /api/chats/{id}/builtins {off: [...]} switches them off for that chat: shell (bash, whoever serves it; commands then says switched_off), web, files (the file tools and read_document), media (describe_image and transcribe_audio), collections, subagents (spawn_agent) and triggers; load_skill and the goal and loop tools have no switch, and a sub-agent follows its parent's switches; PUT /api/chats/{id}/mcp {off: [server name or connector:]} switches MCP servers and connectors off for that chat. GET /api/chats/{id}/mcp/prompts and .../mcp/resources list the prompts and resources of the servers the chat can use now; POST .../mcp/prompts {server, name, arguments} and POST .../mcp/resources/read {server, uri} return their text (403 mcp_refused for a server the chat cannot use); POST .../{id}/messages takes context: [{server, name, arguments} or {server, uri}] to add them to a message. MCP Apps: a tool that declares an interactive page (_meta.ui.resourceUri) gives its tool_end event and its transcript line an app {server, tool, resource_uri, visibility}; the transcript line also holds the call input and result. GET /api/chats/{id}/mcp-apps/resource?server=&uri= reads the ui:// page (html, mime_type, meta with csp, permissions and prefersBorder) for a server the chat may use now and a resource a tool of that server declares, and POST /api/chats/{id}/mcp-apps/call {server, tool, arguments} runs a tool of the same server whose visibility includes app, for the page to call; both answer 403 mcp_app_refused for anything else and need the MCP feature. Loops repeat a prompt inside a chat: POST .../{id}/loops {interval, prompt} starts one (interval such as 5m, at least chats_loop_min_interval; empty for a self-paced loop whose model calls schedule_next or loop_done after each run), GET .../{id}/loops lists them (also the loops field of GET /api/chats/{id}), PUT .../{id}/loops/{loopId} {state: paused|active} pauses, resumes or confirms one (the first loop of a chat is pending until confirmed), DELETE .../{id}/loops/{loopId} or DELETE .../{id}/loops stops them; a loops event tells other tabs, and a user line a loop sent carries loop {id, run}. A loop runs in its own chat and as often as every minute; a trigger starts a new chat at most once an hour."}, + {Name: "chats", Description: "Chats the server keeps: steering, sub-agents and live events", Tags: []string{"chats"}, Intro: "POST /api/chats starts a chat with a model; PATCH /api/chats/{id} {title, model, settings} renames it (1 to 80 characters), moves it to another model (history stays) or sets its settings {system_prompt, temperature, top_p, top_k, reasoning_effort, context_size}, which apply from the next turn (a new title or model needs an idle chat: 409 otherwise). POST .../{id}/regenerate answers the last message again, POST .../{id}/messages/{seq}/edit {text} replaces one of your messages and runs again from it (later lines are removed), POST .../{id}/fork {from_seq, title} copies a chat up to a line into a new chat, GET /api/chats/search?q= finds chats by title or text, GET .../{id}/export?format=markdown|json returns a chat as a file and POST /api/chats/import {chat, model} stores a JSON export as a new chat. Events also carry usage {used, limit, completion, tokens_per_second, model, node, prompt_ms} after each model request, for a context meter (node only when the server exposes the node header, prompt_ms only when the backend reports timings). Sub-agents: GET /api/chats/{id}/agents lists the sub-agent runs of a chat with running, last_turn and the background limit (from the shared store), GET .../{id}/agents/{agent_id}/messages reads one run's transcript and POST .../{id}/agents/{agent_id}/stop stops it; sub_agent_started and sub_agent_done events mark them in the parent's stream. A chat that PUT .../{id}/builtins {on: [\"saved_agents\"]} switched on (off by default; needs the agents feature and the chats_saved_agents setting) also gets list_agents and the agent argument of spawn_agent (a saved agent's id or name): the sub-agent then runs with that agent's instructions, model and grants. POST .../{id}/messages sends a message: with no turn running it starts one; with a turn running it waits (started false, pending_id) and reaches the model, together with any others and in order, at the model's next request. GET .../{id} lists the waiting messages; PATCH and DELETE .../{id}/pending/{pid} edit or cancel one until it is delivered (409 after). After a stop or a failed turn the waiting messages stay; POST .../{id}/send-now starts a turn from them and POST .../{id}/stop ends a running turn. Goals: PUT .../{id}/goal {text} sets a goal for the chat (it replaces the one it had, returned as replaced) and starts a turn on it when none runs; while the goal is active every turn's prompt carries it, the model gets goal_done {summary} and goal_blocked {reason}, and when a turn ends by itself the server starts the next one, until the goal is done or blocked, you stop it (POST .../{id}/stop pauses the goal), or chats_goal_max_turns (20 by default) automatic turns or chats_goal_max_steps (400) model steps pause it. Your messages still steer it: they go first. GET .../{id}/goal reads it {text, state active|paused|done|blocked, paused_by user|turn_limit|step_limit|error|interrupted, note, turns, max_turns, steps, max_steps}, DELETE .../{id}/goal clears it and POST .../{id}/goal/resume resumes a paused or blocked one with new counts; GET .../{id} carries it as goal, a goal event says it changed, and the transcript has goal lines (role goal, goal_event set|replaced|continue|paused|resumed|done|blocked|cleared). A chat that a trigger, a connector, a job or a page started, and a sub-agent run, cannot have a goal. A turn whose tool loop reaches the step limit (the runtime setting chats_max_iterations, 40 by default, or the model's agent.max_iterations) ends with last_turn paused after a paused event {steps}: the model answered from what it had, and a new message (for example \"Continue\") goes on. GET .../{id}/messages reads the transcript (a user line has text, the words typed, and attachments [{path, name, size, mime, version, missing}], the files it carried, with path inside your home for the files API; a waiting message has the same two fields; the model still gets the paths of the files with the message) and GET .../{id}/events streams live server-sent events, so read the transcript first. A chat is named after its first message. A conversation belongs to its user; another user's id is always 404. POST /api/chats/import/browser takes the chats the old chat page kept in the browser (the value of localStorage localai_chats_data) and stores them as yours; a chat that is there already is skipped. Needs the chats feature, which is on by default. Saved agents need the agents feature, triggers the triggers feature and connectors the connectors feature; all three are off by default for a user and an administrator grants them (an administrator has them all). The server can switch the chats off (LOCALAI_DISABLE_CHATS: every /api/chats path then answers 404 chats_off), and the triggers or the connectors alone (LOCALAI_DISABLE_TRIGGERS, LOCALAI_DISABLE_CONNECTORS: their routes answer 409 triggers_off or connectors_off); GET /api/features says what runs. Your files: GET /api/chats/files?path= lists a folder of your workspace (paths are inside your home, \"/\"), GET and PUT /api/chats/files/content?path= download and upload a file (a second upload that does not name the version it started from keeps both files and reports conflict_of), POST .../files/folders and .../files/move create and rename, DELETE .../files?path= moves to the Trash, GET .../files/trash lists deletions (each with files, folders and bytes, and totals for the whole Trash) and POST .../files/undo {rev} restores one, DELETE .../files/trash empties the Trash for good and DELETE .../files/trash/{rev} deletes one entry for good (neither can be undone; they touch only your own Trash and the agent tools never do this), GET .../files/history lists changes, GET .../files/search?q= searches names, text files and the text of PDF, Word, Excel and PowerPoint files (a document hit has document, page, sheet or slide; indexing counts documents still being read), and GET .../files/preview?path= reads a .xlsx, .xlsm, .csv, .tsv, .docx or .pptx file of up to 20 MiB for a preview (kind table: sheets of at most 200 rows by 30 columns with total_rows and total_cols; kind document: headings, list items, paragraphs and tables {type table, rows}; kind slides: titles, text and notes; 415 for another type). POST .../{id}/messages also takes multipart/form-data (text and files) to attach files (with a turn running the files are saved at once and the message waits with their paths): images go to a vision model inside the message (image_url parts; other models get the path and describe_image), videos to a model that takes video, and the text of PDF, Word, Excel, PowerPoint and EPUB files is added to the message (the model reads the rest with read_document). Skills: GET /api/chats/skills?chat= lists the skills of the five layers (folder, personal, shared, addon, builtin; an addon skill names its add-on in addon and addon_title) with enabled and shadowed, POST creates one {layer personal|shared, name, description, body} (shared needs an administrator), GET PUT DELETE .../skills/{layer}/{name} read, change and delete (to the Trash), PUT /api/chats/{id}/skills {off} switches skills off for one chat. Well-known files: GET and PUT /api/chats/wellknown/{name} (persona, user, shortcuts, home, ui, or widget-data with ?path=) read and change the files of your home that set the assistant's persona, your profile, the composer shortcuts, the Home widgets and the look. A read is validated against the JSON Schema at .../wellknown/{name}/schema and falls back to the last valid version (fallback, errors); a write {values, replace} merges the keys it sends (null removes one), takes the version you read in If-Match (409 with current when the file changed) and is refused with errors when the result is invalid; POST .../wellknown/{name}/revert restores the previous valid version as a new change, or the version {rev} that GET .../wellknown/{name}/versions lists (newest first, with who wrote it and in which chat). A checkpoint line of a transcript carries rev, the change set of the turn, and lists the paths it changed. Add-ons: GET /api/chats/{id}/addons lists the add-ons whose tools you may use, each with its switch for that chat, and PUT /api/chats/{id}/addons {off: [ids]} switches the tools of add-ons off for one chat. Commands: a chat runs commands with bash, served by an add-on that runs commands (isolated) or, when no add-on serves it, by the built-in bash directly on this machine with no isolation and with its network; the add-on list says which (commands_provider, commands_isolation, commands_consent, commands_fallback). With chats_host_exec ask, each command waits: a host_exec_consent event carries {ids: [id], text: command} and POST /api/chats/{id}/host-exec/consent {id, decision: once|deny} answers it (once needs an administrator). Administrators: GET /api/chats/admin/tools lists the built-in tools an add-on may replace (Settings > Tools; change them with POST /api/settings chats_host_exec and chats_tool_providers) and GET /api/chats/admin/host-exec/events?limit= reads the audit of the commands run on this machine. Network of the isolated commands: the guest has no network device and reaches HTTP and HTTPS only through a proxy that asks the server about each connection. GET /api/chats/{id}/egress returns {preset, ceiling, effective, applies, applies_reason, addon, registries, rules, cards} (applies is false when commands run on this machine, which has the server's network; addon is the add-on that runs the commands and draws the chat's network controls), PUT .../{id}/egress {preset: off|registries|all} sets the chat's preset (400 egress_above_ceiling above the administrator's chats_egress_ceiling), DELETE .../{id}/egress/rules/{host}/{port} removes an allow or deny rule, an egress_consent event {ids: [card id], text: host:port} asks for a host the chat does not allow (the command waits up to 60 seconds) and POST .../{id}/egress/consent {id, decision: once|chat|deny} answers it (allowing a host inside your network needs an administrator), and egress_card events say that the chat's network changed. Administrators: GET /api/chats/admin/egress reads the chats_egress_* settings in force, the registries and the counts of the last 24 hours, and GET /api/chats/admin/egress/events?limit=&user=&chat=&verdict=&host= reads the audit. Saved agents: GET and POST /api/chats/agents, GET PUT DELETE .../agents/{id}: an agent is {name, description, instructions, model, mcp_servers, addons, collections, skills, network, folder}; folder {path, mode read|write} gives it one folder of your files (\"/\" is all of them; not LocalAI, Chats or a shared folder; 400 otherwise), kept by the folder itself so a rename or move is followed, shown back as {path, name, mode, state ok|missing|unset}; a write without folder keeps it and folder {path: \"\"} clears it; network (off, registries or all; off by default) is the network of the isolated commands of its trigger and connector runs, capped by chats_egress_ceiling, which never show a card; the lists are exact grants (an empty list grants nothing) and a chat gets only what you may use at that moment. POST /api/chats {agent_id} starts a chat with one (the agent's model replaces model when it has one). GET .../agents/{id}/export returns the definition as a JSON file (version 1, kind localai-agent; version 2 with folder {path, mode} for an agent with a folder, which a server that knows only version 1 refuses), POST .../agents/import takes that file (JSON body or multipart file field) and saves a new agent (a taken name gets a number, an unavailable model is dropped, a folder you do not have leaves the agent unset until you choose one; warnings say so), GET .../agents/templates lists starter agents and POST .../agents/templates/{id}/create saves one, GET .../agents/{id}/runs lists the chats that ran with the agent (yours, trigger runs, connector runs) with last_turn and counts. Inbox: GET /api/chats/notifications?unread=1 lists the notifications of your trigger runs (kind run_ended, run_failed or needs_attention) with the unread count, GET .../notifications/count counts them, POST .../notifications/read {ids} or {all: true} marks them read, DELETE .../notifications {ids} removes some, or {all: true} empties your inbox ({all: true, read_only: true} removes only the read ones; the answer has deleted and the unread count left), the list also gives total (everything kept, since limit, at most 500, can cut the list), and GET .../notifications/events streams new ones as server-sent events plus a notifications_changed event when notifications were read or deleted (from any tab or frontend), after which a client reads the list again. A user only ever reaches their own notifications. Opening a chat (GET /api/chats/{id}) marks its notifications read. Triggers: GET and POST /api/chats/triggers, GET PUT DELETE .../triggers/{id}, POST .../{id}/run (start now), .../{id}/enable and .../{id}/disable, GET .../{id}/runs, GET .../triggers/preview?when=&tz= (next times of a schedule). A trigger is {name, prompt, kind schedule|file, schedule + time_zone, or folder + quiet_seconds, daily_cap, enabled, agent_id, model, source_chat_id}: it starts a chat as you by itself, on a schedule (\"daily 08:00\", \"weekdays 09:30\", \"weekly mon,thu 09:30\", \"monthly 15 08:00\", \"once 2026-12-24 18:00\" or five cron fields) or when a file arrives in the folder; a chat it starts has origin trigger. A trigger also has plan {reads, writes, widget} (what a run reads, the file it rewrites and the Home widget that shows it), cost {estimated_tokens, average_tokens, runs, max_runs_per_day, remote} and last_done, and each run its tokens; a file trigger waits min_gap_seconds (60 by default) after a run before a file that changed again starts another. The four trigger tools (propose_trigger, list_triggers, update_trigger, delete_trigger) are the built-in tool group triggers: on in a chat a person starts, switched together with PUT .../{id}/builtins {off: [\"triggers\"]}, listed in GET .../{id}/tools and GET .../draft/tools with usable and reason (not usable in a run a trigger or connector started, for a user without the triggers feature; not listed when the server runs no triggers), and never given to a sub-agent. A model can propose a trigger in a chat (propose_trigger; a schedule from a chat runs at most once an hour); GET .../triggers/proposals?chat= lists them, PUT .../triggers/proposals/{id} edits one (it stays a proposal), POST .../triggers/proposals/{id}/confirm {time_zone} turns one into a trigger that is on, DELETE dismisses it (the answer is kept: GET .../triggers/proposals/{id} returns {state pending|accepted|declined|undone, trigger, answered_at, can_undo, undo_blocked}, POST .../undo takes an accepted one back unless the trigger ran or was edited since (409 says why) and POST .../reopen restores a declined or undone one); the chat carries a proposal as a card {kind trigger_proposal, id} on the tool line (tool_end event and transcript) and as a trigger_proposed event. A model can also ask to change a trigger of yours (list_triggers gives each a ref; update_trigger edits, pauses or resumes, delete_trigger deletes): an edit or a delete waits for you, and a pause or a resume applies at once; the chat carries it as a card {kind trigger_change, id}. GET .../triggers/changes/{id} returns {id, op update|delete|pause|resume, state pending|applied|dismissed|undone, trigger_id, before, after, fields, answered_at, stale, can_undo, undo_blocked, last_run}, POST .../changes/{id}/apply makes it (409 when the trigger changed since), DELETE dismisses it and POST .../changes/{id}/undo puts the trigger back as it was, for a day after it applied (a deleted trigger comes back with its id, without its run history). Proposed changes: a model asks to change your memory or an agent profile with propose_change {kind memory|profile, scope user|agent|channel, target, content, summary} (in the built-in tool group changes; revert_change {id} undoes an applied one). Nothing is written until you confirm. GET /api/chats/changes?status= lists the proposals (id, kind, scope, target, summary, content, source {kind, id, chat}, status pending|applied|dismissed|expired|reverted|stale, rev), GET .../changes/{id} reads one, POST .../changes/{id}/confirm writes it as one change set, or with a body {content} your own text in its place (409 when the file changed since, the proposal expired after 24 hours or it was answered), POST .../changes/{id}/dismiss answers no, POST .../changes/{id}/undo restores the file (409 when it was edited since) and GET .../changes/audit lists who proposed, confirmed or reverted what, with a hash and never the text. GET /api/chats/context-files lists the notes the host puts in the prompt (limits, and groups of {source, scope, key, max_bytes, max_lines, files}) for the Memory tab of Your settings; it only reads. At most 10 proposals wait per user and 5 are made per hour per agent. A chat that runs a saved agent cannot propose until the agent is granted it: the agent's builtins list holds memory.write, profile.write, skills.write, pages.write or dashboard.write (GET /api/chats/agents/builtin-grants lists every grant with title, description and sensitive; none is on by default). propose_change also takes kind skill (a SKILL.md; a skill with locked: true in its frontmatter is refused), page (target is the page name, files is {path: text} with an index.html) and dashboard (the full home.json, checked against its schema). Browser push: GET /api/chats/push/key returns the server's VAPID public key, POST /api/chats/push/subscribe takes a browser PushSubscription {endpoint, keys: {p256dh, auth}} (an https endpoint on a public address) and DELETE .../push/subscribe {endpoint} removes it; a notification is then pushed with its title and link only. These answer 409 push_off when the server keeps nothing across a restart. Conversion: at start the server converts the old chat page, agents, tasks, skills and connectors (a connector is listed as dropped; add the bot again in the Connectors page); GET /api/chats/conversion lists what happened to your items (kind, name, status converted|skipped|failed|dropped, reason) and gives an administrator the totals. Converted triggers and connectors are switched off. Connectors: GET /api/chats/connectors/kinds lists the platforms that an installed add-on serves (each kind comes with the add-on that serves it), GET and POST /api/chats/connectors, GET PUT DELETE .../connectors/{id}, POST .../{id}/enable, .../disable and .../test (asks the platform who the bot is), GET .../{id}/senders (who wrote to the bot) and POST .../{id}/senders/{sender}/allow. POST .../{id}/pairing makes a one-use pairing code (valid ten minutes) that you send as a direct message to the bot from an allowlisted account to pair it (a pairing lasts 90 days, at most three senders), and DELETE .../{id}/paired/{sender} ends one. A binding also has caps (the capabilities you enabled, from a closed list), grants [{role, caps}] (roles that the kind declares in roles and permissions of the kinds list; never a sensitive capability) and paired. A binding is {kind (the platform, telegram when empty; set at create only), name, token (write-only, sealed, never returned; has_token says it is stored), agent_id (required: an agent of yours that names a model), enabled, accept_any, allow [chat IDs, user IDs or @usernames], notify_chat}: a person who messages the bot talks to that agent in a conversation of their own, as you, with only the agent's grants. The allowlist is empty at first, so nobody is accepted; a sender who is not accepted is ignored and logged. accept_any lets anyone who can message the bot use the agent; the create or update that turns it on must also send confirm_accept_any: \"accept any message\" (else 400). Files and skills answer 409 with the reason when the server has no data path. Administrators: GET /api/chats/admin/agents, .../admin/triggers and .../admin/connectors list what every user has, each with its owner and never a token or instructions; GET .../admin/triggers/{id}/runs lists the runs of a trigger, POST .../admin/triggers/{id}/disable and .../admin/connectors/{id}/disable switch one off, and DELETE .../admin/agents/{id}, .../admin/triggers/{id} and .../admin/connectors/{id} remove one. No MCP tool maps to these routes: they are the user's own chat and files, not administration. GET POST /api/chats/mcp-connectors, GET PUT DELETE /api/chats/mcp-connectors/{id} and POST .../enable, .../disable, .../test manage your MCP connectors: MCP servers you define (transport http, or stdio for administrators outside distributed mode), stored per user, with token, headers and env sealed and never returned; a test answers 200 with ok and the tool names or the error. Addresses on private networks are refused at connect time unless an administrator sets mcp_connectors_allow_private. A chat with no agent gets your enabled connectors; a saved agent names one as connector: in mcp_servers. GET /api/chats/{id}/tools lists the built-in tool groups, add-ons, model MCP servers and connectors of a chat with their switches. The built-in groups are on until PUT /api/chats/{id}/builtins {off: [...]} switches them off for that chat: shell (bash, whoever serves it; commands then says switched_off), web, files (the file tools and read_document), media (describe_image and transcribe_audio), collections, subagents (spawn_agent) and triggers; load_skill and the goal and loop tools have no switch, and a sub-agent follows its parent's switches; PUT /api/chats/{id}/mcp {off: [server name or connector:]} switches MCP servers and connectors off for that chat. GET /api/chats/{id}/mcp/prompts and .../mcp/resources list the prompts and resources of the servers the chat can use now; POST .../mcp/prompts {server, name, arguments} and POST .../mcp/resources/read {server, uri} return their text (403 mcp_refused for a server the chat cannot use); POST .../{id}/messages takes context: [{server, name, arguments} or {server, uri}] to add them to a message. MCP Apps: a tool that declares an interactive page (_meta.ui.resourceUri) gives its tool_end event and its transcript line an app {server, tool, resource_uri, visibility}; the transcript line also holds the call input and result. GET /api/chats/{id}/mcp-apps/resource?server=&uri= reads the ui:// page (html, mime_type, meta with csp, permissions and prefersBorder) for a server the chat may use now and a resource a tool of that server declares, and POST /api/chats/{id}/mcp-apps/call {server, tool, arguments} runs a tool of the same server whose visibility includes app, for the page to call; both answer 403 mcp_app_refused for anything else and need the MCP feature. Loops repeat a prompt inside a chat: POST .../{id}/loops {interval, prompt} starts one (interval such as 5m, at least chats_loop_min_interval; empty for a self-paced loop whose model calls schedule_next or loop_done after each run), GET .../{id}/loops lists them (also the loops field of GET /api/chats/{id}), PUT .../{id}/loops/{loopId} {state: paused|active} pauses, resumes or confirms one (the first loop of a chat is pending until confirmed), DELETE .../{id}/loops/{loopId} or DELETE .../{id}/loops stops them; a loops event tells other tabs, and a user line a loop sent carries loop {id, run}. A loop runs in its own chat and as often as every minute; a trigger starts a new chat at most once an hour."}, {Name: "pages", Description: "Pages: HTML pages in your workspace that the UI shows in a sandboxed frame", Tags: []string{"pages"}, Intro: "A page is the folder pages// of your home (name ^[a-z0-9][a-z0-9-]{0,63}$) with an index.html, an optional page.json {title, icon, description, widget: {size small|medium|large, title}} and its data files; a page with a widget block can be a tile on Home (a widget {type: page, page: , folder?: } in LocalAI/home.json, at most 3), where it runs with localai.page.mode \"widget\". GET /api/chats/pages lists them (source own, author you or assistant, updated_at, updated_by); GET /api/chats/pages/{name} returns the page with its HTML (at most 1 MiB). The bridge of a page: GET /api/chats/pages/{name}/files?dir=, GET and PUT /api/chats/pages/{name}/file (text files of at most 1 MiB, paths relative to the page's folder; a page writes data files only, code and document files such as .js, .css, .html, index and page.json are refused with 403; writes are rate limited; GET .../file?path=&encoding=base64 reads an image of the folder as base64, which the UI puts into the page), and POST /api/chats/pages/{name}/chat {text, chat_id, model} to put a message in a chat after the person confirmed it. GET /api/chats/page-starters and POST /api/chats/page-starters/{id}/copy copy a starter page. Write a page with the files API or from a chat. Shared pages: GET /api/chats/shared-pages lists the pages of the folders an administrator shared with you (folder, folder_id, author_name, hash, code_files, consent none, allowed or changed; the hash covers index.html, page.json and code_files, the scripts, style sheets and modules the page names, so a change to any of them asks again; enabled false when an administrator turned shared pages off). GET /api/chats/shared-pages/{folder_id}/{name} returns one with its HTML and your consent; PUT .../consent {hash, once} allows that version (once gives a visit token), DELETE .../consent revokes it. The bridge of a shared page is .../files, .../file and .../chat as for your own pages, each with the header X-LocalAI-Page-Hash (the version that runs) and X-LocalAI-Page-Visit for a visit allowed once; without a consent it answers 403 page_not_allowed, a read of a file of code by a frame of an older version answers 409, and a read-only grant cannot write. Needs the chats and pages features (pages is off by default for users who are not administrators)."}, {Name: "addons", Description: "Owner-routed addon lifecycle and response relays", Tags: []string{"Addons"}, Intro: "POST /api/addons/dispatch submits typed lifecycle operations or reads actor-bound operation-status. POST /api/addons/relay serves status and coarse lifecycle progress on the receiving frontend. Named authentication and the addons feature are required; lifecycle operations require administration. Preserve operationId after outcome_unknown and poll status, never submit a new mutation. An add-on that refuses a request as invalid answers 400 invalid_request from every route, never an outage: nothing was applied, so correct the request instead of repeating it. Resource and output routes deny access until host admission and resolution providers are installed. Data and schema mutations are stored proposals: POST /api/addons/proposals previews and stores one (nothing is applied), GET /api/addons/proposals/{id} reads it, GET /api/addons/proposals?state=pending lists the caller's own pending proposals (newest first, at most 32; where a proposal made through the OpenAI-compatible chat route, an API client or an MCP session waits for the proposer's own browser session; the chats of /api/chats, their agents and their triggers apply a change at once because turning the add-on on for the chat is the consent, and are not proposals), POST .../cancel withdraws one and POST .../reconcile resolves an unknown outcome by receipt lookup, and when no receipt can be found POST .../resolve lets the resource owner's own browser session abandon it with a reason (same confirmation-surface rules as confirm; nothing is applied again). The owner role finds what to resolve with GET /api/addons/resources/{resourceId}/proposals?state=unresolved (same rules, X-LocalAI-Confirm equals the resource ID): it lists the proposal ID, proposer, effects, digest and age of every unresolved proposal on the resource, never its arguments. A write blocked by an unresolved outcome is denied (403) and, for the owner role only, names it as outcome_blocked with blockedBy. POST .../confirm applies exactly the stored operation once and is accepted only from the proposer's own browser session (same-origin fetch, X-LocalAI-Confirm header equal to the proposal ID, digest of what was shown); API keys, MCP sessions and tool or agent calls can propose but never confirm, and no MCP tool maps to confirm. Sharing and database deletion are never proposals. A read that returns a file result gives private artifact IDs, never addon handles: GET /api/addons/artifacts/{id} returns the transfer state, name, size and expiry, and GET /api/addons/artifacts/{id}/download streams the complete file as an attachment. Only the requesting principal can read or download an artifact, an unknown, foreign or expired ID is the same 403, access to every source resource is checked again at completion and while streaming, and a disabled addon denies downloads until it is enabled again. Only GET /backends/library/updates has an MCP tool, list_backend_library_updates; no MCP tool maps to the other routes. The Apps surface: GET /api/addons/apps lists the installed, enabled addons any caller with the addons feature may use, with title, description, icon URL, version, generation, state (running, starting, failed or stopped; an observation separate from enabled), a main page path only when the manifest declares a valid one, and a bounded tool summary; administrators also see disabled addons and per-app controls. GET /api/addons/apps/{id}/icon?generation=N serves the verified icon of a visible app. POST /api/addons/apps/{id}/start and .../stop are administrator-only, take {operationId, generation} with the generation that was listed, deny a stale generation and keep the lifecycle rules (preserve operationId after outcome_unknown). No MCP tool maps to the Apps routes. The listed ui entry of an app gives the same-origin URLs of its UI code: GET /api/addons/{id}/assets/{digest}/{path} streams one declared file (the entry module or a style sheet) of the current installed package, relayed from the owner, with Cache-Control private, max-age=31536000, immutable and nosniff. The digest is the package sha256 in lower-case hex; a file the manifest does not declare, a traversal, another addon, an older package and a disabled or uninstalled addon are all one 403, never cached. A credential in the URL is never accepted; the browser uses its same-origin session. No MCP tool maps to the asset route. Management (administrators only, through POST /api/addons/dispatch): the reads catalog-search, catalog-details, catalog-sources and addons-installed return catalog entries, one resolved entry, the configured libraries with their last fetch state and the installed addons with verified package facts, health, retained generations and storage; catalog-source-save stores or removes a library by reference only (a secret in place of a reference is denied) and catalog-source-refresh fetches one again; upgrade installs a newer release of an installed addon. Removing a library never touches installed addons. The installed view has an update object computed by the owner's update check (state, candidate version and digest, check and last-success time, reasons, redacted error class); an add-on the owner cannot answer for has none, and a failed check is never up-to-date. No MCP tool maps to these actions. UI-only resource management (never tools; no MCP tool maps to any of it): GET /api/addons/resources?addonId=tables lists the resources the caller owns or that were shared with the caller, with the caller's own role, the display name, the owner's display name for a shared one and, for the owner role only, the number of people it is shared with and the revision. POST /api/addons/resources creates one by the person's own action (operationId makes it idempotent; the arguments are the add-on's create tool arguments), POST .../{resourceId}/rename and .../delete rename and delete it (the owner role only; generation and revision must be the listed ones or the call is 409 stale; delete needs confirm equal to the display name, removes the data and every grant and never uninstalls the add-on), GET .../{resourceId}/grants, PUT/DELETE .../grants/{userId} and GET .../{resourceId}/users?q= list, set (viewer or editor, whole resource) and remove grants and search the people it can be shared with (immutable account ID and display name only; local-owner mode answers 409 sharing_disabled). All of them accept only the owner's own browser session with the X-LocalAI-Confirm header equal to the resource ID (the operation ID for a creation); API keys are refused. POST .../{resourceId}/apply changes the data or the schema by the person's own action with no card, through a write or schema tool the add-on declares ({operationId, generation, revision, tool, arguments} with the revision the caller read; editors write rows, only the owner changes the schema; 409 stale when the generation or revision moved; the same operationId with the same request is one change; reads, creations, rename, delete and undeclared tools are refused). POST .../resources/{resourceId}/changes/{changeId}/undo ({operationId, generation}) undoes one change an add-on tool made at once from a chat, an agent or a trigger, by the change set the add-on kept for it; the change ID is the one the tool result named (undoable true, changeId, undo). It is the person's own action in a browser tab and accepts only the browser session with X-LocalAI-Confirm equal to the resource ID: an API key, an MCP session or a tool call is refused, so a model can never undo work. The role is the one the change needed (editors undo data changes, only the owner role undoes a schema change or a creation). It is applied against the revision the add-on just reported: when the resource changed after the change the answer is 409 stale with the words of what changed and nothing is overwritten. The other refusals are typed: not_found (404), expired (410, after 7 days), already_undone (409) and cannot_undo (409, for example a job that finished); the same operationId with the same change is one undo. GET .../resources/{resourceId}/operations/{operationId}?kind=rename|delete|apply|undo reads the receipt of a rename, a deletion, a change or an undo after outcome_unknown, which carries the original operationId. GET/PUT/DELETE /api/addons/conversations/{conversationId}/selection/{addonId} keep the resource a conversation works on for the authenticated user; a chat tool call that names no resourceId uses it, authorized again by the owner on every call, and with none selected the tool answers an error result with code select_resource. Data recovery (administrators only, never tools; no MCP tool maps to any of it): GET /api/addons/{id}/recovery returns the recovery state of an add-on's data (ready, upgrading, restoring, needs-recovery or purging), its backups newest first with size, reason, mode and last verification result, the retention policy and the receipt of the last restore. POST /api/addons/{id}/recovery/backup makes a verified, consistent backup (the add-on is stopped while its SQLite files are copied with VACUUM INTO, admission is blocked and pending proposals are invalidated; nothing is left behind on failure; 503 insufficient_storage when it does not fit), .../verify reads one completely, .../restore restores one (the add-on must not be running, confirm is the add-on ID, mapping names the account that takes the data of a backup made in local-owner mode, the answer carries warnings and no share is given back that was removed since the backup or whose account is gone; 409 needs_recovery, addon_running, backup_corrupt, incompatible_format, identity_changed, mapping_required or downgrade_unsupported), .../delete-backup removes one (never the only verified copy, 409 sole_recovery_copy) and .../prune applies the retention policy. POST /api/addons/{id}/purge removes retained data by explicit scope (data, backups, recoveryCopies) with confirm equal to the add-on ID, for an add-on that is uninstalled or disabled; it is not a database deletion or an uninstall. Every mutation accepts only the administrator's own browser session (same-origin fetch, X-LocalAI-Confirm equal to the operationId); a repeated operationId returns the recorded result and never runs again; after outcome_unknown read the state and keep the operationId. An upgrade of an add-on that has data is backed up, migrated under exclusive ownership and published only when healthy; a failed migration that changes the data format leaves the add-on in needs-recovery with the previous package and the verified backup retained. Updates (never tools; no MCP tool maps to any of it): GET /api/addons/{id}/update reads the owner's update status of an installed add-on for every caller with the addons feature who may see it (administrators any installed add-on, others an enabled one; the same 403 otherwise). The state is unknown, up-to-date, update-available, incompatible (reasons: platform, host-version, api-version, protocol-version, sdk-version, data-format), check-failed (a redacted error class and lastSuccess, the time the library was last read; never shown as up-to-date) or integrity-error (an immutable version was listed again with another digest; never an update). A moving channel (development, a branch, latest) compares resolved digests, so a changed digest with the same version label is an update; an immutable version selects the highest compatible greater version of the same major. The library and the channel the add-on came from never change by themselves. Callers who are not administrators get the state, versions and times only. The route never uses the network. POST /api/addons/{id}/update/check (administrators, own browser session, X-LocalAI-Confirm equal to the operationId) fetches the library again and returns the status; it is rate limited and answers throttled true when it did not fetch, and it applies nothing. POST /api/addons/{id}/upgrade (administrators, own browser session) is the only request that applies an update: it carries operationId, expectedDigest (the installed package the caller saw) and candidateDigest (the candidate the check resolved), and the owner re-resolves, re-checks compatibility and refuses before it records anything with 409 stale_installed, candidate_changed, incompatible, integrity_error or upgrade_conflict (the same transition under another operationId); 503 check_failed when the library cannot be read. A failure keeps the last good generation or enters the recovery state; the previous installation is never deleted. The apps list marks an app update: update-pending from the owner's cached check only and never reaches a library."}, {Name: "library-sources", Description: "Library sources of add-ons, backends and models", Tags: []string{"library"}, Intro: "Administrators only. GET /api/library/sources lists every source of the add-on, backend and model kinds, shipped defaults and removed defaults (tombstones) included, with kind, id, name, url, mirrors, enabled, default, removed, suspended, a conflict message and the last fetch state. POST /api/library/sources adds a source of your own ({kind: addon|backend|model, url, id, name, format: library|gallery}); the same kind and URL twice is a 409. POST /api/library/sources/{id}/enable and /disable turn one on or off (enabling a removed default brings it back). PUT /api/library/sources/{id} replaces the mirrors of a model or backend source ({mirrors: [..]}); POST also takes mirrors. Each mirror is an http(s), github:, oci:// or file:// address, at most 8. DELETE /api/library/sources/{id} removes a source; a shipped default stays as a tombstone so it does not return at the next start. The routes work on the store that `local-ai library` edits. On a frontend (--addons-role=frontend) the routes forward to the add-on owner, which is the only writer; they answer 503 when the owner is not reachable or runs on another platform. `GET /backends/library/updates` and `POST /backends/library/install` forward the same way. The runtime setting official_libraries (default on) turns every shipped default off at once: they stay listed with suspended true. No MCP tool maps to these routes."}, diff --git a/core/http/endpoints/studio/conversion.go b/core/http/endpoints/studio/conversion.go index 994a8c61d..22a5015a5 100644 --- a/core/http/endpoints/studio/conversion.go +++ b/core/http/endpoints/studio/conversion.go @@ -17,7 +17,7 @@ func totalsOf(r convert.Report) schema.ChatsConversionTotals { // Conversion returns what the conversion of the old data did for the caller. // @Summary Report the conversion of your old agents, skills and chats. -// @Description At start the server converts the old chat page, agents, tasks, skills and Telegram connectors into chats, saved agents, triggers, skills and connector bindings. Triggers and connectors are made switched off. This lists the items that belong to you, with what was dropped and why; an administrator also gets the totals of all users. It never holds a token or the text of a prompt. +// @Description At start the server converts the old chat page, agents, tasks, skills and connectors into chats, saved agents, triggers and skills. Triggers are made switched off; connectors are listed as dropped and are made again in the Connectors page. This lists the items that belong to you, with what was dropped and why; an administrator also gets the totals of all users. It never holds a token or the text of a prompt. // @Tags chats // @Success 200 {object} schema.ChatsConversion "The report" // @Router /api/chats/conversion [get] diff --git a/core/http/react-ui/public/locales/en/chats.json b/core/http/react-ui/public/locales/en/chats.json index 347e3184e..62cafcafe 100644 --- a/core/http/react-ui/public/locales/en/chats.json +++ b/core/http/react-ui/public/locales/en/chats.json @@ -336,7 +336,7 @@ }, "conversionPage": { "title": "Converted from the old chat", - "intro": "The old chat, agents, tasks, skills and Telegram connectors were converted when this server started. Triggers and connectors are switched off until you turn them on. A chat keeps what was said, not what the model remembered.", + "intro": "The old chat, agents, tasks and skills were converted when this server started. Triggers are switched off until you turn them on. Connectors are not converted: add the bot again in the Connectors page. A chat keeps what was said, not what the model remembered.", "notRun": "No conversion has run on this server.", "nothing": "Nothing of yours needed converting.", "allUsers": "All users:", diff --git a/core/http/react-ui/tests/unit/provider-strings-allowlist.json b/core/http/react-ui/tests/unit/provider-strings-allowlist.json index ae7e2a67c..96ba22f16 100644 --- a/core/http/react-ui/tests/unit/provider-strings-allowlist.json +++ b/core/http/react-ui/tests/unit/provider-strings-allowlist.json @@ -6,7 +6,6 @@ "auth:login.signInWithGitHub": "GitHub as the OAuth identity service a person signs in with; the service, not the GitHub add-on", "chat:steps.verb.websearch": "the web (the internet) as a noun: the verb of a search step", "chats:connectorsPage.noAddonHint": "Telegram is named as an example of a platform a connector carries; content, not a provider", - "chats:conversionPage.intro": "names the legacy Telegram connectors that the one-time conversion migrated; content", "chats:egress.presetHint.registries": "GitHub releases as a package source the registries preset allows; the service host, not the GitHub add-on", "chats:mcpPage.family": "Telegram and Slack are examples of messaging platforms; content, not a provider", "chats:tools.builtin.web": "the name of the built-in Web tool group of the Tools menu", diff --git a/core/services/addons/apps/apps_test.go b/core/services/addons/apps/apps_test.go index 1e4446061..a53c57f9c 100644 --- a/core/services/addons/apps/apps_test.go +++ b/core/services/addons/apps/apps_test.go @@ -188,6 +188,7 @@ var _ = Describe("apps list", func() { ui.Controls = []string{contract.ControlNetworkPolicy, contract.ControlToolProviders} s := snapshot(id, true, "running", ui, "bash") s.Receipt.Manifest.Capabilities.ToolDefinitions = []contract.ToolDefinition{bash} + s.Receipt.Manifest.Capabilities.Network = &contract.NetworkCapability{Kind: contract.NetworkKindEgressCheck} s.HostOps = grants s.Receipt.Digest = "sha256:" + strings.Repeat("a", 64) return s diff --git a/core/services/addons/catalog/backend_entry_test.go b/core/services/addons/catalog/backend_entry_test.go index dab8706cc..60689541e 100644 --- a/core/services/addons/catalog/backend_entry_test.go +++ b/core/services/addons/catalog/backend_entry_test.go @@ -104,7 +104,7 @@ var _ = Describe("the backend body of a library entry", func() { " license: mit\n", " urls: [https://example.com]\n", " tags: [a]\n", " icon: https://example.com/i.png\n", " mirrors: [oci://hub.example/x:y]\n", " capabilities: {default: x}\n", " schemaVersion: 1\n", } { - _, _, err := read(oldShapeIndex + extra) + _, _, err := read(addonEntry + extra) Expect(err).To(HaveOccurred(), extra) } }) @@ -273,7 +273,7 @@ var _ = Describe("the backend body of a library entry", func() { Expect(err).To(HaveOccurred()) }) It("is accepted on an add-on without a digest, as on a backend", func() { - entry := strings.Replace(oldShapeIndex, " digest: "+yamlDigest+"\n", " mutable: true\n", 1) + entry := strings.Replace(addonEntry, " digest: "+yamlDigest+"\n", " mutable: true\n", 1) _, s, err := read(entry) Expect(err).NotTo(HaveOccurred()) r, err := Catalog{Sources: s, TargetOS: "linux", TargetArch: "amd64"}.Resolve(ctx, "lib", "tables", "1.0.0") @@ -282,11 +282,11 @@ var _ = Describe("the backend body of a library entry", func() { Expect(r.Digest).To(BeEmpty()) }) It("is refused on an add-on with a digest, without a digest unless mutable, or on an archive", func() { - _, _, err := read(oldShapeIndex + " mutable: true\n") + _, _, err := read(addonEntry + " mutable: true\n") Expect(err).To(HaveOccurred()) - _, _, err = read(strings.Replace(oldShapeIndex, " digest: "+yamlDigest+"\n", "", 1)) + _, _, err = read(strings.Replace(addonEntry, " digest: "+yamlDigest+"\n", "", 1)) Expect(err).To(HaveOccurred()) - _, _, err = read(strings.Replace(strings.Replace(oldShapeIndex, " digest: "+yamlDigest+"\n", " mutable: true\n", 1), "oci://registry.example/tables", "https://registry.example/tables.tar", 1)) + _, _, err = read(strings.Replace(strings.Replace(addonEntry, " digest: "+yamlDigest+"\n", " mutable: true\n", 1), "oci://registry.example/tables", "https://registry.example/tables.tar", 1)) Expect(err).To(HaveOccurred()) }) }) diff --git a/core/services/addons/catalog/catalog.go b/core/services/addons/catalog/catalog.go index 9742f1e75..e7298c03a 100644 --- a/core/services/addons/catalog/catalog.go +++ b/core/services/addons/catalog/catalog.go @@ -111,9 +111,7 @@ type Release struct { SourceURL string `json:"sourceUrl,omitempty"` // ID is the identifier of the entry for every kind, the same field the // shared envelope uses. For a backend it is the backend name, which is also - // its directory name. An index written before the envelope names it - // addonId; ReadIndex still reads that name (see LegacyIDField) and every - // writer emits id. + // its directory name. ID string `json:"id"` Name string `json:"name"` Description string `json:"description,omitempty"` diff --git a/core/services/addons/catalog/envelope.go b/core/services/addons/catalog/envelope.go index 02df1596f..41a8b9c83 100644 --- a/core/services/addons/catalog/envelope.go +++ b/core/services/addons/catalog/envelope.go @@ -12,9 +12,7 @@ const SchemaVersion = 1 // entries needs one reader for the header and no knowledge of the body. // // The add-on and backend index files use Release, which names the same -// identifier id (catalog.Release.ID). An index written before that still holds -// addonId; ReadIndex reads it as id for one release (LegacyIDField) and every -// writer emits id. Release has no license, urls, tags, icon or schemaVersion +// identifier id (catalog.Release.ID). Release has no license, urls, tags, icon or schemaVersion // yet; moving it to this whole header is a later step. type Envelope struct { Kind Kind `json:"kind" yaml:"kind"` diff --git a/core/services/addons/catalog/index.go b/core/services/addons/catalog/index.go index 6d257a876..de06a9aae 100644 --- a/core/services/addons/catalog/index.go +++ b/core/services/addons/catalog/index.go @@ -89,16 +89,10 @@ func ReadIndex(data []byte, known ...Kind) (IndexResult, error) { } if !slices.Contains(known, Kind(kind)) { id, _ := entry["id"].(string) - if id == "" { - id, _ = entry[LegacyIDField].(string) - } res.Skipped = append(res.Skipped, SkippedEntry{Position: i, Kind: kind, ID: id}) continue } } - if err := NormalizeLegacyID(entry); err != nil { - return IndexResult{}, err - } kept = append(kept, entry) } b, err := json.Marshal(kept) @@ -111,26 +105,6 @@ func ReadIndex(data []byte, known ...Kind) (IndexResult, error) { return res, nil } -// LegacyIDField is the name the identifier of an entry had before the shared -// envelope. A reader still accepts it for one release; every writer emits id. -const LegacyIDField = "addonId" - -// NormalizeLegacyID moves the legacy addonId of a decoded entry to id, so one -// strict decoder serves both spellings. An entry that holds both is refused -// even when they agree, because it is not the output of any writer. -func NormalizeLegacyID(entry map[string]any) error { - legacy, ok := entry[LegacyIDField] - if !ok { - return nil - } - if _, both := entry["id"]; both { - return errors.New("index entry has both id and " + LegacyIDField) - } - entry["id"] = legacy - delete(entry, LegacyIDField) - return nil -} - // EncodeIndex writes releases as a library index. It is the inverse of // DecodeIndex and exists for fixtures and tools that serve a library. func EncodeIndex(releases []Release) ([]byte, error) { diff --git a/core/services/addons/catalog/index_yaml_test.go b/core/services/addons/catalog/index_yaml_test.go index 2292472b0..1c06a12ec 100644 --- a/core/services/addons/catalog/index_yaml_test.go +++ b/core/services/addons/catalog/index_yaml_test.go @@ -45,33 +45,15 @@ var _ = Describe("library index document (YAML)", func() { Expect(got.Digest).To(Equal(yamlDigest)) Expect(got.UI.MainPage).To(Equal("tables")) }) - It("reads the legacy addonId as id, and refuses an entry that has both", func() { - legacy := strings.Replace(yamlEntry, "- id: tables", "- addonId: tables", 1) - got, err := DecodeIndex([]byte(legacy)) - Expect(err).NotTo(HaveOccurred()) - Expect(got).To(HaveLen(1)) - Expect(got[0].ID).To(Equal("tables")) - current, err := DecodeIndex([]byte(yamlEntry)) - Expect(err).NotTo(HaveOccurred()) - Expect(current).To(Equal(got)) - _, err = DecodeIndex([]byte(yamlEntry + " addonId: tables\n")) - Expect(err).To(HaveOccurred()) - // A writer emits id, never the legacy name. - out, err := EncodeIndex(got) - Expect(err).NotTo(HaveOccurred()) - Expect(string(out)).To(HavePrefix("- ")) - Expect(string(out)).NotTo(ContainSubstring("addonId")) - Expect(string(out)).To(ContainSubstring("id: tables")) - }) It("accepts an empty library written as an empty list", func() { r, e, _ := refreshBody("[]\n") Expect(e).NotTo(HaveOccurred()) Expect(r.Count).To(BeZero()) }) It("refuses a JSON index", func() { - _, e, _ := refreshBody(`[{"addonId":"tables","name":"Tables","version":"1.0.0","artifact":"oci://registry.example/tables","digest":"` + yamlDigest + `","os":"linux","arch":"amd64"}]`) + _, e, _ := refreshBody(`[{"id":"tables","name":"Tables","version":"1.0.0","artifact":"oci://registry.example/tables","digest":"` + yamlDigest + `","os":"linux","arch":"amd64"}]`) Expect(e).To(MatchError(ErrRefresh)) - _, e, _ = refreshBody("{\n \"addonId\": \"tables\"\n}") + _, e, _ = refreshBody("{\n \"id\": \"tables\"\n}") Expect(e).To(MatchError(ErrRefresh)) }) It("refuses an unknown field, at the top and inside ui", func() { diff --git a/core/services/addons/catalog/kind_test.go b/core/services/addons/catalog/kind_test.go index a976b5588..bd8d6da1e 100644 --- a/core/services/addons/catalog/kind_test.go +++ b/core/services/addons/catalog/kind_test.go @@ -11,7 +11,7 @@ import ( const kindDigest = "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" -const oldShapeIndex = `- addonId: tables +const addonEntry = `- id: tables name: Tables version: 1.0.0 artifact: oci://registry.example/tables @@ -39,39 +39,39 @@ const unknownKindEntry = `- kind: gizmo var _ = Describe("entry kinds", func() { It("reads an index written before kinds existed, and the entry is an add-on", func() { - res, err := ReadIndex([]byte(oldShapeIndex), KindAddon) + res, err := ReadIndex([]byte(addonEntry), KindAddon) Expect(err).NotTo(HaveOccurred()) Expect(res.Skipped).To(BeEmpty()) Expect(res.Releases).To(HaveLen(1)) Expect(res.Releases[0].Kind).To(BeEmpty()) Expect(res.Releases[0].EntryKind()).To(Equal(KindAddon)) - releases, err := DecodeIndex([]byte(oldShapeIndex)) + releases, err := DecodeIndex([]byte(addonEntry)) Expect(err).NotTo(HaveOccurred()) Expect(releases).To(HaveLen(1)) }) It("reads a backend entry on a reader that knows backends", func() { - res, err := ReadIndex([]byte(oldShapeIndex+backendEntry), KindAddon, KindBackend) + res, err := ReadIndex([]byte(addonEntry+backendEntry), KindAddon, KindBackend) Expect(err).NotTo(HaveOccurred()) Expect(res.Skipped).To(BeEmpty()) Expect(res.Releases).To(HaveLen(2)) Expect(res.Releases[1].EntryKind()).To(Equal(KindBackend)) Expect(res.Releases[1].Alias).To(Equal("local-store")) // The reader of this host knows backends too. - releases, err := DecodeIndex([]byte(oldShapeIndex + backendEntry)) + releases, err := DecodeIndex([]byte(addonEntry + backendEntry)) Expect(err).NotTo(HaveOccurred()) Expect(releases).To(HaveLen(2)) }) It("skips a backend entry on an add-on only reader and says so", func() { - res, err := ReadIndex([]byte(oldShapeIndex+backendEntry), KindAddon) + res, err := ReadIndex([]byte(addonEntry+backendEntry), KindAddon) Expect(err).NotTo(HaveOccurred()) Expect(res.Releases).To(HaveLen(1)) Expect(res.Skipped).To(Equal([]SkippedEntry{{Position: 1, Kind: "backend", ID: "cpu-local-store"}})) }) It("skips an unknown kind without reading its fields, and keeps the rest", func() { - res, err := ReadIndex([]byte(oldShapeIndex+unknownKindEntry+backendEntry), KindAddon, KindBackend) + res, err := ReadIndex([]byte(addonEntry+unknownKindEntry+backendEntry), KindAddon, KindBackend) Expect(err).NotTo(HaveOccurred()) Expect(res.Releases).To(HaveLen(2)) Expect(res.Skipped).To(Equal([]SkippedEntry{{Position: 1, Kind: "gizmo", ID: "widget"}})) @@ -82,33 +82,20 @@ var _ = Describe("entry kinds", func() { }) It("skips the reserved model kind in this phase", func() { - res, err := ReadIndex([]byte("- kind: model\n addonId: m\n files: []\n"), ReadableKinds...) + res, err := ReadIndex([]byte("- kind: model\n id: m\n files: []\n"), ReadableKinds...) Expect(err).NotTo(HaveOccurred()) Expect(res.Releases).To(BeEmpty()) Expect(res.SkippedKinds()).To(Equal([]string{"model"})) }) - It("reports the id of a skipped entry, written as id or as the legacy addonId", func() { - res, err := ReadIndex([]byte("- kind: model\n id: m1\n- kind: model\n addonId: m2\n"), ReadableKinds...) + It("reports the id of a skipped entry", func() { + res, err := ReadIndex([]byte("- kind: model\n id: m1\n- kind: model\n id: m2\n"), ReadableKinds...) Expect(err).NotTo(HaveOccurred()) Expect(res.Skipped).To(HaveLen(2)) Expect(res.Skipped[0].ID).To(Equal("m1")) Expect(res.Skipped[1].ID).To(Equal("m2")) }) - It("reads a backend entry that still uses the legacy addonId, and refuses one that has both", func() { - legacy := strings.Replace(backendEntry, " id: cpu-local-store", " addonId: cpu-local-store", 1) - res, err := ReadIndex([]byte(legacy), ReadableKinds...) - Expect(err).NotTo(HaveOccurred()) - Expect(res.Releases).To(HaveLen(1)) - Expect(res.Releases[0].ID).To(Equal("cpu-local-store")) - _, err = ReadIndex([]byte(backendEntry+" addonId: cpu-local-store\n"), ReadableKinds...) - Expect(err).To(HaveOccurred()) - out, err := EncodeIndex(res.Releases) - Expect(err).NotTo(HaveOccurred()) - Expect(string(out)).NotTo(ContainSubstring("addonId")) - }) - It("still refuses an unknown field on an entry of a known kind", func() { _, err := ReadIndex([]byte(backendEntry+" surprise: 1\n"), ReadableKinds...) Expect(err).To(HaveOccurred()) @@ -116,7 +103,7 @@ var _ = Describe("entry kinds", func() { It("refuses a malformed kind", func() { for _, bad := range []string{"kind: 3", "kind: \"\"", "kind: Backend", "kind: [backend]", "kind: " + strings.Repeat("a", 40)} { - _, err := ReadIndex([]byte("- "+bad+"\n addonId: x\n"), ReadableKinds...) + _, err := ReadIndex([]byte("- "+bad+"\n id: x\n"), ReadableKinds...) Expect(err).To(HaveOccurred(), bad) } }) @@ -132,7 +119,7 @@ var _ = Describe("kinds in a library", func() { } It("refreshes an index with an unknown kind and reports what it skipped", func() { - res, s, err := refresh(oldShapeIndex+unknownKindEntry+backendEntry, VerificationPolicy{}) + res, s, err := refresh(addonEntry+unknownKindEntry+backendEntry, VerificationPolicy{}) Expect(err).NotTo(HaveOccurred()) Expect(res.Count).To(Equal(2)) Expect(res.Skipped).To(Equal(1)) @@ -143,7 +130,7 @@ var _ = Describe("kinds in a library", func() { }) It("lists add-ons by default and backends on request", func() { - _, s, err := refresh(oldShapeIndex+backendEntry, VerificationPolicy{}) + _, s, err := refresh(addonEntry+backendEntry, VerificationPolicy{}) Expect(err).NotTo(HaveOccurred()) c := Catalog{Sources: s, TargetOS: "linux", TargetArch: "amd64"} page, err := c.Search(ctx, Query{}) @@ -178,7 +165,7 @@ var _ = Describe("kinds in a library", func() { "backend with a main page": backendEntry + " ui:\n mainPage: x\n", "backend name with a slash": strings.Replace(backendEntry, "id: cpu-local-store", "id: a/b", 1), "backend name with dots": strings.Replace(backendEntry, "id: cpu-local-store", "id: a..b", 1), - "add-on with an alias": oldShapeIndex + " alias: x\n", + "add-on with an alias": addonEntry + " alias: x\n", } { _, _, err := refresh(body, VerificationPolicy{}) Expect(err).To(HaveOccurred(), name) diff --git a/core/services/addons/catalog/sources_test.go b/core/services/addons/catalog/sources_test.go index d46a76505..718640106 100644 --- a/core/services/addons/catalog/sources_test.go +++ b/core/services/addons/catalog/sources_test.go @@ -53,7 +53,7 @@ var _ = Describe("source configuration", func() { It("rejects secret URLs invalid digests duplicate identities and malformed catalogs", func() { s := setup() Expect(s.Save(ctx, admin, Source{ID: "one", Name: "one", URL: "https://user:secret@example.org"})).To(HaveOccurred()) - for _, body := range []string{`[{"addonId":"tables"}]`, `[] trailing`, `{"secret":"value"}`} { + for _, body := range []string{`[{"id":"tables"}]`, `[] trailing`, `{"secret":"value"}`} { server := library(func(w http.ResponseWriter, r *http.Request) { _, _ = w.Write([]byte(body)) }) save(s, "one", server.URL) _, e := s.Refresh(ctx, "one") diff --git a/core/services/addons/manager_test.go b/core/services/addons/manager_test.go index 88a1b5d4b..bb500710e 100644 --- a/core/services/addons/manager_test.go +++ b/core/services/addons/manager_test.go @@ -505,12 +505,6 @@ var _ = Describe("owner identity file", func() { Expect(json.Unmarshal(b, &fields)).To(Succeed()) Expect(fields).To(Equal(map[string]any{"OwnerID": "owner", "StorageID": "disk-one"})) }) - It("loads a file written in the old format with an address", func() { - cfg, _, _ := fixture() - Expect(os.MkdirAll(cfg.Root, 0700)).To(Succeed()) - Expect(os.WriteFile(identityPath(cfg), []byte(`{"OwnerID":"owner","Address":"https://old.example","StorageID":"disk-one"}`), 0600)).To(Succeed()) - Expect(acquire(cfg)).To(Succeed()) - }) It("loads when only the address changed", func() { cfg, _, _ := fixture() Expect(acquire(cfg)).To(Succeed()) diff --git a/core/services/addons/ownership.go b/core/services/addons/ownership.go index 3b1aad174..b1396e7bf 100644 --- a/core/services/addons/ownership.go +++ b/core/services/addons/ownership.go @@ -73,8 +73,7 @@ func (g OwnerGuard) Acquire(ctx context.Context) (func() error, error) { return releaseErr } // The address is runtime configuration and a frontend may reach the owner at - // a new one, so identity is the owner and the storage only. An older file - // that still carries an address is read and the address is ignored. + // a new one, so identity is the owner and the storage only. identity := ownerIdentity{OwnerID: c.OwnerID, StorageID: c.StorageID} expected, _ := json.Marshal(identity) p := filepath.Join(c.Root, "identity.json") diff --git a/core/services/studio/connectors/connectorstest/suite.go b/core/services/studio/connectors/connectorstest/suite.go index b8cfe7cae..d9be2f606 100644 --- a/core/services/studio/connectors/connectorstest/suite.go +++ b/core/services/studio/connectors/connectorstest/suite.go @@ -22,7 +22,7 @@ type NewStore func() connectors.Store var t0 = time.Date(2026, 10, 27, 9, 0, 0, 0, time.UTC) func binding(id, owner, name string) connectors.Binding { - return connectors.Binding{ID: id, Owner: owner, Kind: connectors.KindTelegram, Name: name, AgentID: "ag1", Enabled: true, + return connectors.Binding{ID: id, Owner: owner, Kind: "chat", Name: name, AgentID: "ag1", Enabled: true, Allow: []string{"123", "@alice"}, NotifyChat: "456", Token: []byte("sealed-bytes-" + id), Created: t0, Updated: t0} } @@ -119,26 +119,6 @@ func Run(newStore NewStore) { Expect(err).NotTo(HaveOccurred()) Expect([]int64{got.FileReceiveMax, got.FileSendMax}).To(Equal([]int64{512 << 10, 2 << 20})) }) - It("gives an old binding the add-on of its kind", func() { - // A binding stored before connectors became add-ons has no add-on ID. - s := newStore() - _ = s.PutBinding(ctx, binding("old", "u1", "Old")) - other := binding("new", "u1", "New") - other.Kind, other.AddonID = "slack", "slack-addon" - _ = s.PutBinding(ctx, other) - got, _ := s.GetBinding(ctx, "old") - Expect(got.AddonID).To(Equal("telegram"), "old binding add-on") - list, _ := s.ListBindings(ctx, "u1") - enabled, _ := s.EnabledBindings(ctx) - for _, l := range [][]connectors.Binding{list, enabled} { - byID := map[string]string{} - for _, b := range l { - byID[b.ID] = b.AddonID - } - Expect(byID).To(HaveKeyWithValue("old", "telegram")) - Expect(byID).To(HaveKeyWithValue("new", "slack-addon")) - } - }) It("keeps the capabilities, grants and paired senders", func() { s := newStore() b := binding("b1", "u1", "Bot") diff --git a/core/services/studio/connectors/gorm.go b/core/services/studio/connectors/gorm.go index 3c2e57cb7..987a98cfc 100644 --- a/core/services/studio/connectors/gorm.go +++ b/core/services/studio/connectors/gorm.go @@ -138,7 +138,7 @@ func (r bindingRow) binding() (Binding, error) { return b, err } } - return Normalize(b), nil + return b, nil } func (s *gormStore) PutBinding(ctx context.Context, b Binding) error { diff --git a/core/services/studio/connectors/json.go b/core/services/studio/connectors/json.go index a2c02fd76..f4b9360e9 100644 --- a/core/services/studio/connectors/json.go +++ b/core/services/studio/connectors/json.go @@ -97,7 +97,7 @@ func (s *jsonStore) GetBinding(_ context.Context, id string) (Binding, error) { if !ok { return Binding{}, ErrNotFound } - return Normalize(b.clone()), nil + return b.clone(), nil } func (s *jsonStore) list(keep func(Binding) bool) []Binding { @@ -106,7 +106,7 @@ func (s *jsonStore) list(keep func(Binding) bool) []Binding { var out []Binding for _, b := range s.d.Bindings { if keep(b) { - out = append(out, Normalize(b.clone())) + out = append(out, b.clone()) } } sort.Slice(out, func(i, j int) bool { diff --git a/core/services/studio/connectors/seal_test.go b/core/services/studio/connectors/seal_test.go index eabd05ffb..1e49174f5 100644 --- a/core/services/studio/connectors/seal_test.go +++ b/core/services/studio/connectors/seal_test.go @@ -36,7 +36,7 @@ var _ = Describe("sealing and validating bindings", func() { }) It("validates a binding", func() { - ok := connectors.Binding{Name: "Bot", Kind: connectors.KindTelegram, AgentID: "a", Allow: []string{"12", "-100123", "@alice_b"}, NotifyChat: "55"} + ok := connectors.Binding{Name: "Bot", Kind: "telegram", AgentID: "a", Allow: []string{"12", "-100123", "@alice_b"}, NotifyChat: "55"} Expect(connectors.Validate(ok)).To(Succeed()) // Slack names people and channels with upper-case IDs, and its names may have dots. slack := connectors.Binding{Name: "App", Kind: "slack", AgentID: "a", Allow: []string{"U012AB3CD", "C0123456", "@ada.l-ovelace"}, NotifyChat: "U012AB3CD"} @@ -46,14 +46,14 @@ var _ = Describe("sealing and validating bindings", func() { many[i] = "1" } for name, b := range map[string]connectors.Binding{ - "no name": {Kind: connectors.KindTelegram, AgentID: "a"}, - "long name": {Name: strings.Repeat("n", 81), Kind: connectors.KindTelegram, AgentID: "a"}, + "no name": {Kind: "telegram", AgentID: "a"}, + "long name": {Name: strings.Repeat("n", 81), Kind: "telegram", AgentID: "a"}, "bad kind": {Name: "b", Kind: "Not A Kind", AgentID: "a"}, - "no agent": {Name: "b", Kind: connectors.KindTelegram}, - "bad allow": {Name: "b", Kind: connectors.KindTelegram, AgentID: "a", Allow: []string{"alice"}}, - "short name": {Name: "b", Kind: connectors.KindTelegram, AgentID: "a", Allow: []string{"@ab"}}, - "many": {Name: "b", Kind: connectors.KindTelegram, AgentID: "a", Allow: many}, - "bad notify": {Name: "b", Kind: connectors.KindTelegram, AgentID: "a", NotifyChat: "me"}, + "no agent": {Name: "b", Kind: "telegram"}, + "bad allow": {Name: "b", Kind: "telegram", AgentID: "a", Allow: []string{"alice"}}, + "short name": {Name: "b", Kind: "telegram", AgentID: "a", Allow: []string{"@ab"}}, + "many": {Name: "b", Kind: "telegram", AgentID: "a", Allow: many}, + "bad notify": {Name: "b", Kind: "telegram", AgentID: "a", NotifyChat: "me"}, "lower id": {Name: "b", Kind: "slack", AgentID: "a", Allow: []string{"u012ab"}}, "id notify": {Name: "b", Kind: "slack", AgentID: "a", NotifyChat: "@ada"}, "negative receive limit": {Name: "b", Kind: "slack", AgentID: "a", FileReceiveMax: -1}, @@ -73,7 +73,7 @@ var _ = Describe("sealing and validating bindings", func() { }) It("checks the reply and conversation modes", func() { - base := connectors.Binding{Name: "Bot", Kind: connectors.KindTelegram, AgentID: "a"} + base := connectors.Binding{Name: "Bot", Kind: "telegram", AgentID: "a"} for _, ok := range []connectors.Binding{ base, {Name: "Bot", Kind: "telegram", AgentID: "a", Reply: connectors.ReplyOff, Conversation: connectors.ConversationChat}, diff --git a/core/services/studio/connectors/types.go b/core/services/studio/connectors/types.go index 590677676..9abca0663 100644 --- a/core/services/studio/connectors/types.go +++ b/core/services/studio/connectors/types.go @@ -1,7 +1,7 @@ // Package connectors binds messaging platforms to saved agents. A person who // messages a bot talks to the agent of the binding, in a conversation of their // own, and the answer goes back to the platform. The platform's API is spoken by -// a connector add-on (the Telegram add-on first); this package keeps what is +// a connector add-on; this package keeps what is // generic: the bindings, the sealed tokens, the allowlist and the sender log. // // Two stores exist: NewJSON (files under a data directory, or memory) and @@ -23,14 +23,6 @@ import ( "github.com/mudler/LocalAI/pkg/addons/contract" ) -// LegacyAddon is the add-on that serves the kinds core carried before -// connectors became add-ons. A binding of such a kind that has no add-on ID -// belongs to it. -var LegacyAddon = map[string]string{"telegram": "telegram"} - -// KindTelegram is the kind core carried before connectors became add-ons. -const KindTelegram = "telegram" - // Reply modes: what a sender sees while a turn runs. const ( // ReplyOff shows typing only, then the answer. @@ -454,16 +446,6 @@ func (b Binding) Allows(senderID, username string) bool { return false } -// Normalize gives a binding of an old kind the add-on that serves it. Stores -// call it on every read, so a binding made before connectors became add-ons -// keeps working once its add-on is installed. -func Normalize(b Binding) Binding { - if b.AddonID == "" { - b.AddonID = LegacyAddon[b.Kind] - } - return b -} - func (b Binding) clone() Binding { b.Allow = append([]string(nil), b.Allow...) b.Token = append([]byte(nil), b.Token...) diff --git a/core/services/studio/connectorscope.go b/core/services/studio/connectorscope.go index 4f2fecd5c..3ad209170 100644 --- a/core/services/studio/connectorscope.go +++ b/core/services/studio/connectorscope.go @@ -19,7 +19,6 @@ const ( // BindingConnectorScope also covers background calls with fresh contexts. func BindingConnectorScope(b connectors.Binding) ConnectorCallScope { - b = connectors.Normalize(b) return ConnectorCallScope{Purpose: ConnectorPurposeBinding, Principal: b.Owner, BindingID: b.ID, AgentID: b.AgentID, AddonID: b.AddonID, Kind: b.Kind} } func verificationScope(b connectors.Binding) ConnectorCallScope { @@ -46,7 +45,6 @@ func (c *Connectors) AuthorizeConnector(ctx context.Context, s ConnectorCallScop if s.BindingID != "" { var err error b, err = c.o.Store.GetBinding(ctx, s.BindingID) - b = connectors.Normalize(b) if err != nil || b.Owner != s.Principal || b.AddonID != s.AddonID || b.Kind != s.Kind || b.AgentID != s.AgentID { return deny() } diff --git a/core/services/studio/connectorsvc.go b/core/services/studio/connectorsvc.go index c2f18a218..4c809e80c 100644 --- a/core/services/studio/connectorsvc.go +++ b/core/services/studio/connectorsvc.go @@ -15,8 +15,8 @@ import ( // ConnectorInput is the definition of a connector binding as its owner writes it. type ConnectorInput struct { - // Kind is the platform of the binding, such as telegram. It is fixed when the - // binding is made. Empty means telegram, for clients older than the add-ons. + // Kind is the platform of the binding, as a connector add-on declares it. It + // is required and fixed when the binding is made. Kind string Name string // Token is the bot token. It is needed to create a binding; an update @@ -145,10 +145,6 @@ func (c *Connectors) verifyToken(ctx context.Context, b connectors.Binding, toke return c.o.VerifyToken(ctx, b, token) } -// legacyTitles name the platforms core served before connectors became -// add-ons, for a binding whose add-on is not installed. -var legacyTitles = map[string]string{"telegram": "Telegram"} - // ConnectorInfo is a binding without its token. type ConnectorInfo struct { connectors.Binding @@ -178,11 +174,7 @@ func (c *Connectors) withState(ctx context.Context, i ConnectorInfo) ConnectorIn if _, ok := kindFor(kinds, i.Binding); ok { return i } - title := legacyTitles[i.Kind] - if title == "" { - title = i.AddonID - } - i.Active, i.Reason = false, "install the "+title+" add-on" + i.Active, i.Reason = false, "install the "+i.AddonID+" add-on" return i } @@ -193,9 +185,6 @@ func (c *Connectors) kindTitle(ctx context.Context, b connectors.Binding) string return k.Title } } - if t := legacyTitles[b.Kind]; t != "" { - return t - } return b.Kind } @@ -205,9 +194,7 @@ func (c *Connectors) ConnectorKinds(ctx context.Context) ([]ConnectorKind, error return c.o.Transport.Kinds(ctx) } -// resolveAddon finds the add-on that serves a kind. A kind core served before -// the add-ons keeps its add-on even when it is not installed, so the binding -// can be made now and starts when the add-on is installed. +// resolveAddon finds the add-on that serves a kind. func (c *Connectors) resolveAddon(ctx context.Context, kind string) (string, error) { kinds, err := c.o.Transport.Kinds(ctx) if err != nil { @@ -218,9 +205,6 @@ func (c *Connectors) resolveAddon(ctx context.Context, kind string) (string, err return k.AddonID, nil } } - if a := connectors.LegacyAddon[kind]; a != "" { - return a, nil - } return "", connectorBad("no installed add-on serves the kind %q", kind) } @@ -341,7 +325,7 @@ func (c *Connectors) CreateConnector(ctx context.Context, user string, in Connec owner := principal(user) kind := in.Kind if kind == "" { - kind = connectors.KindTelegram + return ConnectorInfo{}, connectorBad("a binding needs a kind") } addon, err := c.resolveAddon(ctx, kind) if err != nil { diff --git a/core/services/studio/convert/convert_fixes_test.go b/core/services/studio/convert/convert_fixes_test.go index c24bea1a6..f58f0391c 100644 --- a/core/services/studio/convert/convert_fixes_test.go +++ b/core/services/studio/convert/convert_fixes_test.go @@ -173,7 +173,6 @@ var _ = Describe("conversion fixes", func() { Expect(tg.agents[alice]).To(HaveLen(1), "agents %+v", tg.agents[alice]) Expect(tg.agents[alice][0].Name).To(Equal("Null")) Expect(tg.triggers[alice]).To(BeEmpty()) - Expect(tg.bindings[alice]).To(BeEmpty()) }) It("makes a malformed source a failed item and still runs the other steps", func() { diff --git a/core/services/studio/convert/convert_test.go b/core/services/studio/convert/convert_test.go index 007565778..cf3cd02b2 100644 --- a/core/services/studio/convert/convert_test.go +++ b/core/services/studio/convert/convert_test.go @@ -35,7 +35,6 @@ type fakeTargets struct { triggers map[string][]convert.TriggerIn skills map[string]convert.SkillRec chats map[string][]convert.ChatIn - bindings map[string][]convert.BindingIn failSave map[string]bool // agent names whose save fails colErr error // what Collections returns // invalidSave names the agents whose save is refused for good; trigErr is @@ -56,7 +55,7 @@ type fakeTargets struct { func newTargets() *fakeTargets { return &fakeTargets{users: map[string]bool{alice: true, bob: true, "": true}, cols: map[string][]string{}, agents: map[string][]convert.AgentIn{}, triggers: map[string][]convert.TriggerIn{}, skills: map[string]convert.SkillRec{}, - chats: map[string][]convert.ChatIn{}, bindings: map[string][]convert.BindingIn{}, failSave: map[string]bool{}, + chats: map[string][]convert.ChatIn{}, failSave: map[string]bool{}, invalidSave: map[string]bool{}, admins: map[string]bool{}, mcp: map[string][]convert.MCPIn{}, mcpErr: map[string]error{}} } @@ -149,12 +148,6 @@ func (f *fakeTargets) DiscardChat(_ context.Context, u, title string, created ti f.chats[u] = keep return nil } -func (f *fakeTargets) CreateBinding(_ context.Context, u string, in convert.BindingIn) error { - f.mu.Lock() - defer f.mu.Unlock() - f.bindings[u] = append(f.bindings[u], in) - return nil -} func memMarks() convert.Marks { m, err := convert.NewJSONMarks("") @@ -279,17 +272,15 @@ var _ = Describe("converting the old agents", func() { Expect(without.agents[""][0].Name).To(Equal("Legacy")) }) - It("converts only the Telegram connector and keeps its token out of the report", func() { + It("drops every connector and keeps its token out of the report", func() { dir := GinkgoT().TempDir() poolFixture(dir) tg := newTargets() r := run(convert.Sources{StateDir: dir, AuthEnabled: true}, tg, memMarks()) - bs := tg.bindings[alice] - Expect(bs).To(HaveLen(1), "bindings = %+v", bs) - Expect(bs[0].Token).To(Equal(token)) - Expect(bs[0].AgentID).To(Equal("agent-1")) - Expect(bs[0].Allow).To(Equal([]string{"@ada_l", "@bo_b"}), "want the admins that are valid usernames") - it, ok := find(r, convert.KindConnector, "Support: slack") + it, ok := find(r, convert.KindConnector, "Support: telegram") + Expect(ok).To(BeTrue(), "telegram = %+v", it) + Expect(it.Status).To(Equal(convert.StatusDropped)) + it, ok = find(r, convert.KindConnector, "Support: slack") Expect(ok).To(BeTrue(), "slack = %+v", it) Expect(it.Status).To(Equal(convert.StatusDropped)) raw, _ := json.Marshal(r) @@ -427,12 +418,11 @@ var _ = Describe("converting the old agents", func() { it, _ := find(first, convert.KindAgent, "Plain") Expect(it.Status).To(Equal(convert.StatusFailed), "failed item = %+v", it) Expect(it.Reason).To(ContainSubstring("disk full"), "failed item = %+v", it) - nAgents, nTriggers, nBindings := len(tg.agents[alice]), len(tg.triggers[alice]), len(tg.bindings[alice]) + nAgents, nTriggers := len(tg.agents[alice]), len(tg.triggers[alice]) delete(tg.failSave, "Plain") second := run(src, tg, marks) Expect(tg.agents[alice]).To(HaveLen(nAgents), "a second run converted an item again") Expect(tg.triggers[alice]).To(HaveLen(nTriggers), "a second run converted an item again") - Expect(tg.bindings[alice]).To(HaveLen(nBindings), "a second run converted an item again") Expect(tg.agents[bob]).To(HaveLen(1), "the failed agent was not tried again: %+v", tg.agents[bob]) it, _ = find(second, convert.KindAgent, "Support") Expect(it.Status).To(Equal(convert.StatusSkipped), "an item already converted is %+v", it) diff --git a/core/services/studio/convert/run.go b/core/services/studio/convert/run.go index 5214fb1df..2ec1caf00 100644 --- a/core/services/studio/convert/run.go +++ b/core/services/studio/convert/run.go @@ -8,7 +8,6 @@ import ( "io/fs" "os" "path/filepath" - "regexp" "sort" "strings" "time" @@ -266,7 +265,7 @@ func (r *run) userDirs() []string { return out } -// --- agents, periodic triggers and Telegram bindings --- +// --- agents, periodic triggers and connectors --- type oldAgent struct { user, name string @@ -529,8 +528,9 @@ func (r *run) periodicTrigger(ctx context.Context, owner string, a oldAgent) { r.add(KindTrigger, a.user, name, StatusConverted, "switched off; every "+interval+r.zoneReason()) } -var usernameShape = regexp.MustCompile(`^[A-Za-z0-9_]{3,63}$`) - +// connectors reports every connector of an old agent as dropped. A connector of +// a messaging platform is made again on the Connectors page, where the add-on +// that serves the platform asks for the token. func (r *run) connectors(ctx context.Context, owner string, a oldAgent) { list, _ := a.cfg["connectors"].([]any) for i, c := range list { @@ -541,34 +541,6 @@ func (r *run) connectors(ctx context.Context, owner string, a oldAgent) { if r.handled(ctx, key, KindConnector, a.user, name) { continue } - if typ != "telegram" { - r.drop(ctx, key, KindConnector, a.user, name, "the "+typ+" connector is not rebuilt") - continue - } - ref, ok := r.agents[a.user+"|"+a.name] - if !ok || ref.model == "" { - r.drop(ctx, key, KindConnector, a.user, name, "the agent has no model, so it cannot be bound") - continue - } - conf := map[string]any{} - _ = json.Unmarshal([]byte(str(cm, "config")), &conf) - token := str(conf, "token") - if token == "" { - r.drop(ctx, key, KindConnector, a.user, name, "the connector has no token") - continue - } - var allow []string - for u := range strings.SplitSeq(str(conf, "admins"), ",") { - u = strings.TrimPrefix(strings.TrimSpace(u), "@") - if usernameShape.MatchString(u) { - allow = append(allow, "@"+u) - } - } - if err := r.tg.CreateBinding(ctx, owner, BindingIn{Name: a.name + " Telegram", Token: token, AgentID: ref.id, Allow: allow}); err != nil { - r.refused(ctx, key, KindConnector, a.user, name, err) - continue - } - r.mark(ctx, key, "binding") - r.add(KindConnector, a.user, name, StatusConverted, fmt.Sprintf("switched off; %d allowed senders", len(allow))) + r.drop(ctx, key, KindConnector, a.user, name, "the "+typ+" connector is not rebuilt: add the bot again in the Connectors page") } } diff --git a/core/services/studio/convert/types.go b/core/services/studio/convert/types.go index eff195740..9c3b7e617 100644 --- a/core/services/studio/convert/types.go +++ b/core/services/studio/convert/types.go @@ -1,13 +1,12 @@ -// Package convert turns what the old chat, agents, tasks, skills and Telegram +// Package convert turns what the old chat, agents, tasks, skills and // connectors left on disk and in the database into the definitions of the chats: -// saved agents, triggers, personal and shared skills, chats and connector -// bindings. It reads the old data with its own structs, so it needs none of the +// saved agents, triggers, personal and shared skills and chats. It reads the old data with its own structs, so it needs none of the // code that is removed, and it never deletes or changes what it reads. // // A run is safe to repeat. Each source item that was converted is marked, and // is not converted again; one that failed is tried again at the next run, with // its error in the report. Nothing converted runs, answers or acts by itself: -// triggers and connector bindings are made switched off. +// triggers are made switched off. package convert import ( @@ -154,12 +153,6 @@ type ChatIn struct { Entries []EntryIn } -// BindingIn is a Telegram binding to make, switched off. -type BindingIn struct { - Name, Token, AgentID string - Allow []string -} - // Targets is where converted things go. The application implements it over the // services of the chats; a test implements it with fakes. user is the owner as // the old data named it: "" is the user of a server with no accounts. @@ -177,7 +170,6 @@ type Targets interface { // DiscardChat deletes the chats of the user with this title and creation // time: what an import that a crash cut short left behind. DiscardChat(ctx context.Context, user, title string, created time.Time) error - CreateBinding(ctx context.Context, user string, in BindingIn) error // IsAdmin says whether the user may have a local MCP command. A server with // no accounts has one user, who is the administrator. IsAdmin(ctx context.Context, user string) (bool, error) diff --git a/core/services/studio/providerguard/guard_test.go b/core/services/studio/providerguard/guard_test.go index c248003cb..253cd6214 100644 --- a/core/services/studio/providerguard/guard_test.go +++ b/core/services/studio/providerguard/guard_test.go @@ -158,31 +158,11 @@ var knownDebt = []debt{ "kinds of change declared by the add-ons that handle them (contract change-kind registry)"}, {entry{ui + "pages/Account.jsx", "'memory'", "the Account page has a fixed Memory tab"}, "the Memory add-on gives the memory page through its own page declaration"}, - - // Migration of the Telegram connectors core carried before connectors became add-ons. - {entry{"core/services/studio/connectors/types.go", `telegram`, "LegacyAddon and KindTelegram map the old kind to its add-on"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{"core/services/studio/connectorsvc.go", "Telegram", "the conversion names the old kind and its title"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{"core/services/studio/connectorsvc.go", `telegram`, "the conversion names the old kind"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{"core/services/studio/convert/run.go", "Telegram", "the conversion names the old kind and its title"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{"core/services/studio/convert/run.go", `telegram`, "the conversion names the old kind"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{"core/http/endpoints/localai/api_instructions.go", "Telegram connectors", "the note about the one-time conversion names the old kind"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - {entry{locales, "conversionPage.intro", "the conversion page names the old Telegram connectors"}, - "end of the support window of the Telegram connector conversion: delete the conversion, LegacyAddon and KindTelegram"}, - - // Shim for an old manifest of one add-on. - {entry{"core/services/addons/apps/legacy_resource_list.go", `tables`, "builds the resource listing for manifests of the Tables add-on that predate the list declaration"}, - "the minimum supported manifest API reaches contract.MinResourceListAPI: delete the shim"}, } // maxKnownDebt is the size of knownDebt now. Lower it when an entry goes; a // higher number is a new special case that is excused instead of fixed. -const maxKnownDebt = 13 +const maxKnownDebt = 5 var _ = Describe("the names of the shipped add-ons in core", func() { It("reads every add-on from its manifest and marks the ones with a role", func() { diff --git a/docs/superpowers/plans/2026-10-16-addons-navigation.md b/docs/superpowers/plans/2026-10-16-addons-navigation.md index 2e23b3f96..8bdaa92d6 100644 --- a/docs/superpowers/plans/2026-10-16-addons-navigation.md +++ b/docs/superpowers/plans/2026-10-16-addons-navigation.md @@ -4426,7 +4426,7 @@ Expected: a `failed` line: `Cannot find module '../build.mjs'`. "os": "linux", "arch": "amd64", "host": { "min": 1, "max": 1 }, - "api": {"min": 2, "max": 2}, + "api": { "min": 1, "max": 1 }, "protocol": { "min": 1, "max": 1 }, "dataFormat": { "min": 1, "max": 1 }, "capabilities": { diff --git a/pkg/addons/contract/connector_test.go b/pkg/addons/contract/connector_test.go index a104e927c..1eecf14fc 100644 --- a/pkg/addons/contract/connector_test.go +++ b/pkg/addons/contract/connector_test.go @@ -46,7 +46,7 @@ var _ = Describe("the connector capability", func() { kind := func() *ConnectorKind { return &m.Capabilities.Connector.Kinds[0] } BeforeEach(func() { m.API = VersionRange{Min: 2, Max: 2} }) - It("accepts a thread history with the manifest api 2", func() { + It("accepts a thread history", func() { kind().History = &ConnectorHistory{Thread: true, MaxMessages: 50} Expect(ValidateManifest(m, host())).To(Succeed()) Expect(kind().ServesThreadHistory()).To(BeTrue()) diff --git a/pkg/addons/contract/credentials_test.go b/pkg/addons/contract/credentials_test.go index ab0376c13..10edb1d77 100644 --- a/pkg/addons/contract/credentials_test.go +++ b/pkg/addons/contract/credentials_test.go @@ -36,7 +36,7 @@ var _ = Describe("The credential slot of an add-on", func() { return h } - It("is valid with API 2, a connector kind and read tools", func() { + It("is valid with a connector kind and read tools", func() { Expect(ValidateManifest(manifest(nil), host())).To(Succeed()) }) It("needs a connector kind to hold the binding", func() { diff --git a/pkg/addons/contract/execution.go b/pkg/addons/contract/execution.go index 082bce3c5..1df6e4e5d 100644 --- a/pkg/addons/contract/execution.go +++ b/pkg/addons/contract/execution.go @@ -84,8 +84,7 @@ func CommandsTool(defs []ToolDefinition) (ToolDefinition, bool) { // IsolatedSkills lists the skills of an add-on that need its own commands // provider to report isolated execution: the document-slot skills of an // add-on with a commands tool, unless its descriptor says it does not provide -// the runtime for documents. A commands tool without a descriptor (a manifest -// of API 1) counts as providing it, so such an add-on keeps the check. +// the runtime for documents. A commands tool without a descriptor counts as providing it, so such an add-on keeps the check. func IsolatedSkills(defs []ToolDefinition, skills []SkillDefinition) []string { tool, ok := CommandsTool(defs) if !ok { diff --git a/pkg/addons/contract/hostcontrols.go b/pkg/addons/contract/hostcontrols.go index 4cc16a3ff..d4f4c1ab9 100644 --- a/pkg/addons/contract/hostcontrols.go +++ b/pkg/addons/contract/hostcontrols.go @@ -39,9 +39,8 @@ type HostControl struct { // block needs no shadowed tool. Capability string // Shadows is a built-in tool the add-on must replace with a valid tool, - // AnyShadow for any, or "" for none. A control with a Capability applies - // it only to an add-on that does not declare the block: a manifest - // written before the block existed keeps its attachment. + // AnyShadow for any, or "" for none. A control with a Capability is not + // attached by a shadowed tool: the add-on must declare the block. Shadows string } @@ -59,7 +58,7 @@ func declares(c Capabilities, name string) bool { // HostControls is the closed registry of host controls. var HostControls = []HostControl{ - {ID: ControlNetworkPolicy, Grant: "egress.check", Capability: CapabilityNetwork, Shadows: "bash"}, + {ID: ControlNetworkPolicy, Grant: "egress.check", Capability: CapabilityNetwork}, {ID: ControlToolProviders, Shadows: AnyShadow}, } @@ -115,8 +114,9 @@ func grantCovers(grants []string, op string) bool { // EntitledControls returns the controls of the manifest that the host draws // for it: those declared in ui.controls whose grant is among grants (the // operation prefixes the host setting gives this add-on) and that the add-on -// attaches: it declares the control's capability block, or it replaces the -// built-in tool the control names with a valid tool. The order of the manifest is +// attaches: it declares the control's capability block, or, for a control +// without one, it replaces the built-in tool the control names with a valid +// tool. The order of the manifest is // kept. A control the add-on is not entitled to is dropped, never an error: // an administrator can remove a grant at any time. func EntitledControls(m Manifest, grants []string) []string { @@ -135,7 +135,10 @@ func EntitledControls(m Manifest, grants []string) []string { continue } switch { - case c.Capability != "" && declares(m.Capabilities, c.Capability): + case c.Capability != "": + if !declares(m.Capabilities, c.Capability) { + continue + } case c.Shadows == "": case c.Shadows == AnyShadow: if len(shadows) == 0 { diff --git a/pkg/addons/contract/hostcontrols_test.go b/pkg/addons/contract/hostcontrols_test.go index 7c6d31cdf..a29ae3765 100644 --- a/pkg/addons/contract/hostcontrols_test.go +++ b/pkg/addons/contract/hostcontrols_test.go @@ -4,6 +4,7 @@ package contract import ( "encoding/json" "os" + "slices" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -16,11 +17,16 @@ var _ = Describe("Host controls", func() { // runner is an add-on that runs commands, with the controls it asks for. // Any ID works: the host never looks at it. runner := func(id string, controls ...string) Manifest { - return Manifest{SchemaVersion: 1, ID: id, Version: "1.0.0", Executable: "bin/" + id, OS: "linux", Arch: "amd64", + m := Manifest{SchemaVersion: 1, ID: id, Version: "1.0.0", Executable: "bin/" + id, OS: "linux", Arch: "amd64", Host: VersionRange{Min: 1, Max: 1}, API: VersionRange{Min: 2, Max: 2}, Protocol: VersionRange{Min: 1, Max: 1}, DataFormat: VersionRange{Min: 1, Max: 1}, Capabilities: Capabilities{Actions: true, Tools: []string{"bash"}, ToolDefinitions: []ToolDefinition{{Name: "bash", Description: "Run a command.", Kind: ToolKindAction, InputSchema: json.RawMessage(bashSchema), Shadows: "bash"}}, UI: &UI{Entry: "ui/main.js", SDK: VersionRange{Min: 2, Max: 2}, Controls: controls}}} + if slices.Contains(controls, ControlNetworkPolicy) { + m.Capabilities.Network = &NetworkCapability{Kind: NetworkKindEgressCheck} + m.Capabilities.HostOperations = &HostOperations{Optional: []string{"egress.check"}} + } + return m } host := HostCompatibility{Host: 1, API: 2, Protocol: 1, SDK: HostSDKVersion, DataFormat: 1, OS: "linux", Arch: "amd64"} @@ -48,15 +54,15 @@ var _ = Describe("Host controls", func() { Expect(m.Capabilities.UI.Controls).To(Equal([]string{ControlToolProviders})) }) - It("draws the network policy only for an add-on granted egress that runs bash", func() { + It("draws the network policy only for an add-on granted egress that declares a network", func() { Expect(EntitledControls(runner("sandbox", ControlNetworkPolicy), []string{"workspace.", "egress."})).To(Equal([]string{ControlNetworkPolicy})) // A narrower grant that still covers the check is enough. Expect(EntitledControls(runner("sandbox", ControlNetworkPolicy), []string{"egress.check"})).To(Equal([]string{ControlNetworkPolicy})) Expect(EntitledControls(runner("sandbox", ControlNetworkPolicy), []string{"workspace."})).To(BeEmpty()) Expect(EntitledControls(runner("sandbox", ControlNetworkPolicy), nil)).To(BeEmpty()) m := runner("sandbox", ControlNetworkPolicy) - m.Capabilities.ToolDefinitions[0].Shadows = "" - Expect(EntitledControls(m, []string{"egress."})).To(BeEmpty()) + m.Capabilities.Network = nil + Expect(EntitledControls(m, []string{"egress."})).To(BeEmpty(), "a bash tool alone does not attach the control") }) It("serves a second add-on with the same controls, by its grant and not by its name", func() { @@ -69,10 +75,11 @@ var _ = Describe("Host controls", func() { It("draws the tool providers for an add-on that replaces any built-in tool", func() { web := runner("web", ControlToolProviders, ControlNetworkPolicy) web.Capabilities.Actions = false + web.Capabilities.Network, web.Capabilities.HostOperations = nil, nil web.Capabilities.Tools = []string{"fetch"} web.Capabilities.ToolDefinitions = []ToolDefinition{{Name: "fetch", Description: "Read a page.", Kind: ToolKindRead, InputSchema: json.RawMessage(fetchSchema), Shadows: "web_fetch"}} Expect(ValidateManifest(web, host)).To(Succeed()) - // The network policy needs bash, even with the grant. + // The network policy needs a declared network, even with the grant. Expect(EntitledControls(web, []string{"egress."})).To(Equal([]string{ControlToolProviders})) web.Capabilities.ToolDefinitions[0].Shadows = "" Expect(EntitledControls(web, []string{"egress."})).To(BeEmpty()) diff --git a/pkg/addons/contract/manifest.go b/pkg/addons/contract/manifest.go index 095fc3440..84da22aa9 100644 --- a/pkg/addons/contract/manifest.go +++ b/pkg/addons/contract/manifest.go @@ -128,8 +128,7 @@ type Capabilities struct { // (see network.go). It attaches the network-policy host control. Network *NetworkCapability `json:"network,omitempty"` // ContextFiles name small index files of the user's home that the host - // loads into the prompt of a chat (see contextfiles.go). They need - // manifest API 2. + // loads into the prompt of a chat (see contextfiles.go). ContextFiles []ContextFile `json:"contextFiles,omitempty"` // Credentials declare the secret that the host keeps for the person and @@ -157,7 +156,7 @@ type ResourceTools struct { // backing data. It is reachable only from the UI-only delete endpoint. Delete string `json:"delete,omitempty"` // List asks the host for a read tool that lists the resources the caller - // may use (see ResourceList). It needs manifest API 2. + // may use (see ResourceList). List *ResourceList `json:"list,omitempty"` } diff --git a/pkg/addons/contract/network_test.go b/pkg/addons/contract/network_test.go index 9fa352bc6..2fb98a57b 100644 --- a/pkg/addons/contract/network_test.go +++ b/pkg/addons/contract/network_test.go @@ -13,7 +13,7 @@ import ( var _ = Describe("The network capability", func() { const bashSchema = `{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false}` - // withNetwork is a manifest of API 2 that asks for the network-policy + // withNetwork is a manifest that asks for the network-policy // control. It runs no command tool unless shadowsBash is set, so what is // drawn can only come from the declared capability. withNetwork := func(n *NetworkCapability, shadowsBash bool) Manifest { @@ -42,7 +42,7 @@ var _ = Describe("The network capability", func() { declared := &NetworkCapability{Kind: NetworkKindEgressCheck, Title: "Runbox network", Presets: []NetworkPreset{{ID: "off", Title: "Closed"}, {ID: "all", Title: "Open"}}} - It("is valid when the manifest accepts API 2 and lists the egress check", func() { + It("is valid when the manifest lists the egress check", func() { Expect(ValidateManifest(withNetwork(declared, false), host())).To(Succeed()) }) @@ -85,10 +85,8 @@ var _ = Describe("The network capability", func() { Expect(EntitledControls(withNetwork(declared, false), []string{"workspace."})).To(BeEmpty()) Expect(EntitledControls(withNetwork(declared, true), nil)).To(BeEmpty()) }) - It("is drawn for a manifest that declares no network and replaces bash, as before", func() { - Expect(EntitledControls(withNetwork(nil, true), grants)).To(Equal([]string{ControlNetworkPolicy})) - }) - It("is not drawn for a manifest that declares no network and does not replace bash", func() { + It("is not drawn for a manifest that declares no network, whether or not it replaces bash", func() { + Expect(EntitledControls(withNetwork(nil, true), grants)).To(BeEmpty()) Expect(EntitledControls(withNetwork(nil, false), grants)).To(BeEmpty()) }) It("does not read the add-on ID", func() { @@ -120,11 +118,10 @@ var _ = Describe("The network capability", func() { Expect(m.Capabilities.Network).To(Equal(&NetworkCapability{Kind: NetworkKindEgressCheck, Title: "Sandbox"})) Expect(EntitledControls(m, []string{"egress."})).To(ContainElement(ControlNetworkPolicy)) }) - It("keeps the control through its bash tool when an older manifest declares no network", func() { + It("loses the control when it declares no network", func() { m := load() m.Capabilities.Network = nil - Expect(EntitledControls(m, []string{"egress."})).To(ContainElement(ControlNetworkPolicy)) - Expect(EntitledControls(m, nil)).NotTo(ContainElement(ControlNetworkPolicy)) + Expect(EntitledControls(m, []string{"egress."})).NotTo(ContainElement(ControlNetworkPolicy)) }) }) }) diff --git a/pkg/addons/contract/skills.go b/pkg/addons/contract/skills.go index b0d831249..a3cb89eff 100644 --- a/pkg/addons/contract/skills.go +++ b/pkg/addons/contract/skills.go @@ -32,8 +32,7 @@ type SkillDefinition struct { // add-on skill. Shadows string `json:"shadows,omitempty"` // Slot describes the slot this skill serves: the files it covers and the - // words to say about them (see SlotDefinition). It needs Shadows and - // manifest API 2. A skill that shadows a default slot may leave it out. + // words to say about them (see SlotDefinition). It needs Shadows. A skill that shadows a default slot may leave it out. Slot *SlotDefinition `json:"slot,omitempty"` } diff --git a/pkg/addons/contract/slots.go b/pkg/addons/contract/slots.go index 42d7ff5a2..7e44e8369 100644 --- a/pkg/addons/contract/slots.go +++ b/pkg/addons/contract/slots.go @@ -58,7 +58,7 @@ var defaultSlots = sync.OnceValue(func() []Slot { // DefaultSlots are the slots the host knows without any declaration, read // from data. A skill that shadows one of them and declares no slot of its own -// (a manifest of API 1) is served by these. +// is served by these. func DefaultSlots() []Slot { return slices.Clone(defaultSlots()) } // DefaultSlot returns the default slot called name.