mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-06 04:23:15 -05:00
feat(addons): GitHub settings page, registration and docs
Add the GitHub connection page (fine-grained token, repository list, read-only note, Test that checks each listed repository), let the shared connector page hide messaging settings for a kind that carries no messages, register the add-on in the package matrix and the catalog, and document the credential slot and the GitHub add-on. Assisted-by: Claude:claude-sonnet-5-5 [go node]
This commit is contained in:
19 files changed
+557
-24
No files matched your search
@@ -493,6 +493,45 @@ own record of the grants.
|
||||
- An add-on that declares no `list` gets no listing tool, whatever else it
|
||||
declares.
|
||||
|
||||
### Credentials and a resource list
|
||||
|
||||
An add-on whose tools call a service with a secret of the person, such as an
|
||||
access token, can ask the host to keep the secret and to check which resources
|
||||
a call may reach. The model never sees or sets either.
|
||||
|
||||
```json
|
||||
{
|
||||
"api": {"min": 2, "max": 2},
|
||||
"capabilities": {
|
||||
"credentials": [
|
||||
{"id": "token", "title": "Access token", "kind": "token", "resourceArgument": "repo"}
|
||||
],
|
||||
"connector": {"kinds": [{"id": "example", "title": "Example", "delivery": "pull"}]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- The secret and the list live in the person's **binding** of the add-on's
|
||||
connector kind. The host seals the secret. The list is `Binding.Resources`: at
|
||||
most 50 entries, each an external name (`owner/name` for a repository) with a
|
||||
host ID made from its hash. The person edits it where they edit the binding.
|
||||
- `resourceArgument` names a string argument that carries the external name. A
|
||||
tool that declares it must require it. Before the add-on is called, the host
|
||||
matches the argument against the lists of the caller's bindings of the add-on,
|
||||
without regard to case. A name on no list is refused with the code
|
||||
`resource_not_allowed` and the allowed names; the add-on is not called. When
|
||||
two bindings list the same name, the first in list order is used.
|
||||
- A call that passes the check carries `Request.Credential` (the secret),
|
||||
`Request.ResourceKey` (the name as the person wrote it) and `Request.ResourceID`
|
||||
(the host ID). The host drops these three fields from any request a client
|
||||
sends. A person with no binding gets the code `no_credential`.
|
||||
- A manifest with `credentials` must accept `api` 2, declare a connector kind and
|
||||
declare read tools only: a change under a credential needs a write mode, which
|
||||
this version does not have. Tools of such an add-on name no `resourceId`.
|
||||
- An add-on that is rate limited returns `contract.ErrRateLimited{RetryAfter}`.
|
||||
The runtime answers HTTP 429 with `Retry-After`; the model gets the code
|
||||
`rate_limited`, `retryAfter` in seconds and a note not to retry before then.
|
||||
|
||||
## Singleton owner and its limits
|
||||
|
||||
Addon state lives in one place. Exactly one LocalAI instance is the **owner** of an
|
||||
|
||||
@@ -7,7 +7,7 @@ url = "/features/chats-connectors/"
|
||||
|
||||
The Connectors page of the [chats](/features/chats/) (`/app/chats/connectors`, under **Agents** in the sidebar) lists the messaging bindings you made, and the MCP servers have a page of their own (**MCP connectors** in the sidebar, `/app/mcp-connectors`):
|
||||
|
||||
- A **messaging connector** binds a bot of a platform to one of your agents, so a person can talk to it from that platform. The platform comes from a **connector add-on**: the [Telegram add-on](#telegram) or the [Slack add-on](#slack). This is the first half of this page.
|
||||
- A **messaging connector** binds a bot of a platform to one of your agents, so a person can talk to it from that platform. The platform comes from a **connector add-on**: the [Telegram add-on](#telegram) or the [Slack add-on](#slack) (the [GitHub add-on](#github) holds a token for your agents instead of carrying messages). This is the first half of this page.
|
||||
- An **MCP server** gives your chats and agents more tools. See [MCP servers](#mcp-servers).
|
||||
|
||||
## Connector add-ons
|
||||
@@ -134,6 +134,20 @@ speech-to-text model is set up") and no turn starts.
|
||||
binding. `POST .../enable` and `.../disable` switch it. You can have 10 bindings.
|
||||
A binding says `active: false` and gives a `reason` while its add-on does not run.
|
||||
|
||||
## GitHub
|
||||
|
||||
The GitHub add-on lets your [saved agents](/features/chats-agents/) read repositories: search code, read files and folders, and read issues, pull requests and their diffs. It reads only. It cannot write, merge or delete anything on GitHub.
|
||||
|
||||
1. Install the **GitHub** add-on from the add-on gallery.
|
||||
2. On GitHub, make a **fine-grained personal access token** for only the repositories you want to share. Give it read access to Contents, Issues and Pull requests. Classic tokens are not accepted.
|
||||
3. On the add-on page, choose **New GitHub connection**. Pick an agent, paste the token and list the repositories, one `owner/name` per line (at most 50). Press **Test** to see whose token it is and which listed repositories it reaches.
|
||||
|
||||
The list is checked by LocalAI before the add-on is called, so an agent is refused any repository that is not on it, even if the token could reach it. The token is kept sealed and is never shown again, and no tool result contains it. With several connections, a call uses the first one that lists the repository.
|
||||
|
||||
What GitHub returns (issue text, comments, file content) is written by other people. Every result is marked as untrusted data for the model. Long files are cut at 96 KiB and long patches at 64 KiB; the result says what was cut and how to ask for the rest. When GitHub limits the rate of calls, the agent is told how long to wait.
|
||||
|
||||
This version does not listen for mentions and has no write tools.
|
||||
|
||||
## Slack
|
||||
|
||||
The Slack add-on binds a Slack app to one of your [saved agents](/features/chats-agents/).
|
||||
|
||||
Reference in new issue
Block a user