aKode fase 3: provider locali, chiavi per provider, modelli dal server, SearXNG

- Provider: rimossi openai, Bedrock e GCP integrati e ogni fallback a OpenAI;
  restano ollama, lmstudio e i provider personalizzati. Senza provider, exec e
  TUI mostrano come configurarlo.
- Chiave per provider: api_key = "keyring", provider_api_key_store =
  auto|keyring|file (fallback su file 0600 / ACL Windows); `codex login
  --provider <id> --with-api-key`, `logout --provider`; login status e doctor
  mostrano dove sta la chiave senza rivelarla.
- Modelli letti da GET {base_url}/models; contesto da config, poi dal server
  (/props, meta.n_ctx), poi 32768; apply_patch come tool function; niente tool
  ospitati; niente piu' avviso "metadata not found".
- Unione dei soli messaggi system/developer iniziali in un unico system;
  quelli successivi restano al loro posto come user (cache del server
  preservata: turno N prefisso esatto del turno N+1).
- Modelli ausiliari (memorie, guardian-v2) = modello di sessione se il
  preferito gpt-* non e' nel catalogo.
- Ricerca web: crate web-tools, backend SearXNG con web_search e web_fetch
  (protezione SSRF); senza backend nessuno strumento web.
- Skill: rimossa openai-docs; skill-installer punta a git.difonzo.net.
- apply_patch accetta gli header @@ -a,b +c,d @@ dei diff unificati.
- Rimossi resti: request_plugin_install, AppsInstructions, --cyber-access-program,
  URL updater/realtime predefiniti.
- Fix: importazione sessioni con provider vuoto.
- Istruzioni di sistema invariate. Test: cancellati solo quelli del codice
  rimosso, test di sicurezza adattati; restano solo fallimenti d'ambiente.
- Prova reale su imeAI + SearXNG: risposta, modifica file, web_search,
  cache riusata, connessioni solo verso .25 e .57.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 02:11:45 +01:00
parent 9e33707b8e
commit e39aae0085
545 changed files with 9742 additions and 24503 deletions

View File

@@ -452,35 +452,6 @@
},
"type": "object"
},
"AwsAuthRefreshConfig": {
"additionalProperties": false,
"description": "Command used to refresh AWS credentials for a model provider.",
"properties": {
"args": {
"default": [],
"description": "Arguments passed to the refresh command.",
"items": {
"type": "string"
},
"type": "array"
},
"command": {
"description": "Executable to invoke directly, without a shell.",
"type": "string"
},
"timeout_ms": {
"default": 300000,
"description": "Maximum time to wait for the refresh command to complete.",
"format": "uint64",
"minimum": 1.0,
"type": "integer"
}
},
"required": [
"command"
],
"type": "object"
},
"AwsSigV4Config": {
"additionalProperties": false,
"description": "AWS SigV4 action selected by an exact-host, method, and path MITM hook.",
@@ -3053,37 +3024,6 @@
],
"type": "object"
},
"ModelProviderAwsAuthInfo": {
"additionalProperties": false,
"description": "AWS SigV4 auth configuration for a model provider.",
"properties": {
"auth_refresh": {
"allOf": [
{
"$ref": "#/definitions/AwsAuthRefreshConfig"
}
],
"description": "Optional command used to reauthenticate after a refreshable AWS auth failure."
},
"credential_export": {
"allOf": [
{
"$ref": "#/definitions/CredentialExportConfig"
}
],
"description": "Optional command whose exported credentials replace the AWS SDK credential chain."
},
"profile": {
"description": "AWS profile name to use. When unset, the AWS SDK default chain decides.",
"type": "string"
},
"region": {
"description": "AWS region to use for provider-specific endpoints.",
"type": "string"
}
},
"type": "object"
},
"ModelProviderCapabilities": {
"additionalProperties": false,
"description": "Overrides for the optional API features supported by a custom provider.",
@@ -3096,6 +3036,10 @@
"description": "Whether hosted web search may access the live web.",
"type": "boolean"
},
"hosted_web_search": {
"description": "Whether the server executes the hosted `web_search` tool itself (off by default; local servers usually do not). aKode's own `[web_search]` backend is separate.",
"type": "boolean"
},
"remote_compaction": {
"allOf": [
{
@@ -3111,6 +3055,14 @@
"additionalProperties": false,
"description": "Serializable representation of a provider definition.",
"properties": {
"api_key": {
"allOf": [
{
"$ref": "#/definitions/ProviderApiKeySource"
}
],
"description": "Where to read this provider's API key from. `\"keyring\"` reads the key stored with `codex login --provider <id> --with-api-key`: in the system keyring, or in a private file in CODEX_HOME when `provider_api_key_store` selects (or falls back to) file storage."
},
"auth": {
"allOf": [
{
@@ -3119,14 +3071,6 @@
],
"description": "Command-backed bearer-token configuration for this provider."
},
"aws": {
"allOf": [
{
"$ref": "#/definitions/ModelProviderAwsAuthInfo"
}
],
"description": "AWS SigV4 auth configuration for this provider."
},
"base_url": {
"description": "Base URL for the provider's OpenAI-compatible API.",
"type": "string"
@@ -3139,10 +3083,6 @@
],
"description": "Optional API capability overrides for a custom Responses-compatible provider. Unspecified capabilities retain their existing provider defaults."
},
"credential_file": {
"description": "Absolute path to a Google ADC credential file. For GCP, overrides GOOGLE_APPLICATION_CREDENTIALS in the auth command's environment only.",
"type": "string"
},
"env_http_headers": {
"additionalProperties": {
"type": "string"
@@ -3177,12 +3117,12 @@
"description": "Additional HTTP headers to include in requests to this provider where the (key, value) pairs are the header name and value.",
"type": "object"
},
"location": {
"description": "Google Cloud location for the built-in GCP provider. Takes precedence over `GOOGLE_CLOUD_LOCATION`; defaults to `global` when neither is set.",
"type": "string"
"merge_system_messages": {
"description": "Merge the base instructions and the leading system/developer messages into one leading system block; later system/developer messages stay in place as user messages. Many local chat templates reject multiple or non-leading system messages. Defaults to true.",
"type": "boolean"
},
"model_catalog_url": {
"description": "Optional full URL for a Codex-native model catalog. When unset, OpenAI discovery uses the Codex backend unless `base_url` overrides the inference endpoint. The endpoint must serve the Codex catalog format, not the public `/v1/models` API.\n\nFor built-in OpenAI, set this under `[model_providers.openai]`; other non-default provider overrides are rejected. The URL must use HTTPS and an allowed ChatGPT host. Other hosts require a custom provider. Inference still uses `openai_base_url`.\n\nCatalog requests use the provider's credentials, including an API key or ChatGPT access token. Only configure an endpoint you trust with those credentials. Setting this URL does not grant catalog access or guarantee that the endpoint accepts a regional API key. Existing discovery gates and entitlement checks apply.",
"description": "Optional full URL for a Codex-native model catalog (Codex catalog format, not the public `/v1/models` API). When unset, models are listed from `GET {base_url}/models`.\n\nCatalog requests use the provider's credentials. Only configure an endpoint you trust with those credentials.",
"type": "string"
},
"name": {
@@ -3190,10 +3130,6 @@
"description": "Friendly display name.",
"type": "string"
},
"project_id": {
"description": "Google Cloud project ID for the built-in GCP provider. Takes precedence over `GOOGLE_CLOUD_PROJECT` when deriving the Vertex AI endpoint.",
"type": "string"
},
"query_params": {
"additionalProperties": {
"type": "string"
@@ -3209,7 +3145,7 @@
},
"requires_openai_auth": {
"default": false,
"description": "Does this provider require an OpenAI API key or ChatGPT login token? If true, the user is presented with a login screen on first run, and credentials are stored using the backend selected by `cli_auth_credentials_store`. If false (the default), the login screen is skipped, and the API key (if needed) comes from the environment variable specified by `env_key`.",
"description": "Use the API key stored with `codex login --with-api-key` (in `auth.json` or the credentials store selected by `cli_auth_credentials_store`) for this provider. `use_stored_api_key` is accepted as a clearer alias. When false (the default), the key comes from `api_key`, `env_key`, or `auth`, if any.",
"type": "boolean"
},
"stream_idle_timeout_ms": {
@@ -4034,6 +3970,18 @@
},
"type": "object"
},
"ProviderApiKeySource": {
"description": "Source of a provider API key configured through `api_key`.",
"oneOf": [
{
"description": "Read the key from the system keyring (service `aKode`, account `model-provider:<id>`).",
"enum": [
"keyring"
],
"type": "string"
}
]
},
"ProxySecretSource": {
"description": "A credential source in the trusted proxy process, never in the executor environment.",
"oneOf": [
@@ -7332,6 +7280,18 @@
],
"type": "string"
},
"WebSearchBackendKind": {
"description": "Client-side web search backends (`[web_search] backend = ...`).",
"oneOf": [
{
"description": "A SearXNG instance with the JSON output format enabled.",
"enum": [
"searxng"
],
"type": "string"
}
]
},
"WebSearchContextSize": {
"enum": [
"low",
@@ -7375,6 +7335,54 @@
],
"type": "string"
},
"WebSearchSetting": {
"anyOf": [
{
"$ref": "#/definitions/WebSearchMode"
},
{
"$ref": "#/definitions/WebSearchTable"
}
],
"description": "`web_search` accepts either a mode string or a `[web_search]` table."
},
"WebSearchTable": {
"additionalProperties": false,
"description": "`[web_search]` table form: a client-side backend plus the optional mode.",
"properties": {
"backend": {
"allOf": [
{
"$ref": "#/definitions/WebSearchBackendKind"
}
],
"description": "Client-side backend. When unset, no web tools are exposed."
},
"fetch": {
"description": "Expose the `web_fetch` tool (default true).",
"type": "boolean"
},
"max_results": {
"description": "Number of results returned by `web_search` (default 8).",
"format": "uint",
"minimum": 0.0,
"type": "integer"
},
"mode": {
"allOf": [
{
"$ref": "#/definitions/WebSearchMode"
}
],
"description": "Same values as the string form (`web_search = \"live\"`); `disabled` turns tools off."
},
"url": {
"description": "Base URL of the backend, for example `http://192.168.40.57:8080`.",
"type": "string"
}
},
"type": "object"
},
"WebSearchToolConfig": {
"additionalProperties": false,
"properties": {
@@ -8629,6 +8637,15 @@
},
"type": "object"
},
"provider_api_key_store": {
"allOf": [
{
"$ref": "#/definitions/AuthCredentialsStoreMode"
}
],
"default": null,
"description": "Where per-provider API keys (`api_key = \"keyring\"`) are stored. auto (default): the system keyring if available, otherwise `CODEX_HOME/provider_api_keys.json` (owner-only permissions). keyring: the system keyring only. file: the file only. ephemeral: memory only."
},
"realtime": {
"allOf": [
{
@@ -8748,10 +8765,10 @@
"web_search": {
"allOf": [
{
"$ref": "#/definitions/WebSearchMode"
"$ref": "#/definitions/WebSearchSetting"
}
],
"description": "Controls the web search tool mode: disabled, cached, indexed, or live."
"description": "Web search: a mode string (disabled, cached, indexed, live) or a `[web_search]` table selecting a client-side backend, e.g. `backend = \"searxng\"`, `url = \"...\"`."
},
"windows": {
"allOf": [