@yachiyo-5i/xlyra-agent 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,17 +10,17 @@
10
10
  <img src="https://img.shields.io/badge/license-AGPL--3.0-blue.svg" alt="License" />
11
11
  <img src="https://img.shields.io/badge/runtime-Node.js%2022%2B-339933.svg" alt="Runtime" />
12
12
  <img src="https://img.shields.io/badge/language-TypeScript-3178C6.svg" alt="Language" />
13
- <img src="https://img.shields.io/badge/protocols-OpenAI%20%7C%20Anthropic-6B5B95.svg" alt="Protocols" />
13
+ <img src="https://img.shields.io/badge/protocols-OpenAI%20Responses%20%7C%20Chat%20Completions%20%7C%20Anthropic-6B5B95.svg" alt="Protocols" />
14
14
  </p>
15
15
  </div>
16
16
 
17
- A streaming agent loop with OpenAI Responses and Anthropic Messages protocol adapters, sandboxed local tools, persistent sessions, and an optional REST/SSE service.
17
+ A streaming agent loop with OpenAI Responses, OpenAI Chat Completions, and Anthropic Messages protocol adapters, sandboxed local tools, persistent sessions, and an optional REST/SSE service.
18
18
 
19
19
 
20
20
  ## Features
21
21
 
22
22
  - **Streaming agent loop** — streams reasoning, text, tool calls, tool results, and terminal events through an async generator.
23
- - **Two LLM protocols** — supports OpenAI Responses and Anthropic Messages over direct HTTP with built-in SSE parsing.
23
+ - **Three LLM protocols** — supports OpenAI Responses, OpenAI Chat Completions, and Anthropic Messages over direct HTTP with built-in SSE parsing.
24
24
  - **Tool execution** — includes directory listing, file reading and search, file creation and editing, atomic writes, multi-file patches, and managed command processes.
25
25
  - **Safe concurrency** — runs consecutive read-only tools in parallel while preserving ordering barriers for writes and commands.
26
26
  - **Workspace sandbox** — blocks path traversal and symlink escapes; out-of-workspace access requires session-level approval.
@@ -148,7 +148,8 @@ Interactive configuration commands require a TTY. For automated environments, wr
148
148
  "default_model": "claude-sonnet-4-5",
149
149
  "models": {
150
150
  "claude-sonnet-4-5": {
151
- "context_window": 200000
151
+ "context_window": 200000,
152
+ "max_output_tokens": 64000
152
153
  }
153
154
  }
154
155
  },
@@ -158,6 +159,17 @@ Interactive configuration commands require a TTY. For automated environments, wr
158
159
  "base_url": "https://api.openai.com/v1",
159
160
  "api_key": "${OPENAI_API_KEY}",
160
161
  "default_model": "gpt-5"
162
+ },
163
+ {
164
+ "name": "openai-compatible",
165
+ "protocol": "openai-chat-completions",
166
+ "base_url": "https://api.example.com/v1",
167
+ "api_key": "${OPENAI_COMPATIBLE_API_KEY}",
168
+ "default_model": "o3-mini",
169
+ "chat_completions": {
170
+ "max_tokens_field": "max_completion_tokens",
171
+ "include_usage": false
172
+ }
161
173
  }
162
174
  ],
163
175
  "server": {
@@ -171,15 +183,29 @@ Interactive configuration commands require a TTY. For automated environments, wr
171
183
  "enable_command_execution": false,
172
184
  "enable_agents_md": true,
173
185
  "enable_skills": true,
174
- "skills_dirs": []
186
+ "skills_dirs": [],
187
+ "tool_profile": "full",
188
+ "compact_trigger_ratio": 0.9,
189
+ "max_steps": 200
175
190
  }
176
191
  }
177
192
  ```
178
193
 
179
194
  API keys support `${ENV_VAR}` interpolation. Configuration is validated at startup, and configuration writes use atomic replacement.
180
195
 
196
+ For OpenAI-compatible Chat Completions endpoints, `chat_completions.max_tokens_field` selects `max_tokens` (the default) or `max_completion_tokens`, and `chat_completions.include_usage` controls whether `stream_options.include_usage` is sent (the default is `true`). Set `include_usage` to `false` for older endpoints that reject `stream_options`.
197
+
181
198
  `enable_agents_md` / `enable_skills` default to enabled when omitted. Each run rescans the workdir. Opening an untrusted repository allows its `AGENTS.md` and project-level Skills to influence model instructions; command execution remains gated by `enable_command_execution` and escalation. Disable the corresponding flags if you only want user-level skills or no repository instructions.
182
199
 
200
+ `tool_profile` controls the exposed tool surface and defaults to `full`. `readonly` exposes listing, reading, searching (and `load_skill` when skills are available); `minimal` exposes only `read` and `search`. The profile is resolved for each run, so a configuration update takes effect without restarting the server.
201
+
202
+ `compact_trigger_ratio` is the automatic compaction watermark as a fraction of the model's context window (0–1, default `0.9`). The window size resolves from per-model `models.<model>.context_window`, then the global `agent.context_window`, then the built-in default of 200000 — compaction always applies once the watermark is reached, so an undersized estimate only compacts earlier rather than never. `max_output_tokens` declares the per-response output cap. Endpoint and agent configuration is re-read for each run: saving via `PUT /config` takes effect on the next run without restarting the server. A manual compaction can be triggered anytime with `POST /sessions/:id/compact-context`.
203
+
204
+ `max_steps` caps a single run's steps (one model reply plus its tool executions), default `200`, maximum `1000`. The budget is declared in the system prompt and reported at 50/80/95% milestones; when the runner detects repeated identical calls or near-identical tool outputs it injects a nudge message (and emits `stall_detected` / `budget_notice` SSE events) instead of hard-stopping the run.
205
+ Session requests accept up to four attachments, with a 16 MiB limit per attachment and 32 MiB total; the HTTP request body is capped at 36 MiB.
206
+
207
+ Network tools are registered by default. `web_search` uses DuckDuckGo out of the box; add the top-level `web_search` section only to switch providers — `brave` and `tavily` require `api_key` (supports `${ENV_VAR}`). `web_fetch` returns cleaned, bounded body text (long pages are explicitly marked as truncated) with SSRF protection; private/loopback addresses are rejected unless `agent.web_fetch_allow_private_network: true` is set. Web content is reference material only and must not be treated as instructions; both tools are marked as network capabilities in the system prompt's capability map. Network-tool settings and provider credentials take effect on the next run after `PUT /config`. The SSRF guard resolves and validates the hostname before each request, while the connection itself performs a second, independent DNS resolution — DNS rebinding is therefore a theoretical gap; the guard keeps the model from being steered to internal addresses and does not replace network-level isolation. `duckduckgo` is a free web endpoint with no stability guarantee (it may be rate-limited or change layout; the tool reports an explicit error when hit) — for production use, configure `brave` or `tavily`.
208
+
183
209
  ### Start the Server
184
210
 
185
211
  ```bash
@@ -237,6 +263,8 @@ Without a token, the service is unauthenticated and must not be exposed to untru
237
263
 
238
264
  ## Built-in Tools
239
265
 
266
+ The runtime injects a capability map into the system prompt. Every tool keeps its JSON Schema, handler, safety annotations (`readOnly`, `parallelSafe`, approval/network hints), and optional capability metadata together. Tool failures can return a stable error code, retryability, next action, and host-only metadata; only the concise error text is sent back to the model.
267
+
240
268
  | Tool | Description |
241
269
  |---|---|
242
270
  | `list` | List files and directories with recursion and glob support |
@@ -249,6 +277,8 @@ Without a token, the service is unauthenticated and must not be exposed to untru
249
277
  | `exec_command` | Execute an argv-based local command and manage long-running processes |
250
278
  | `write_stdin` | Poll a command session or write data to its standard input |
251
279
  | `load_skill` | Activate a discovered Agent Skill by name (registered only when skills exist) |
280
+ | `web_search` | Search the web and return formatted title, URL, and provider excerpts (not model summaries) |
281
+ | `web_fetch` | Fetch a page and return cleaned, bounded body text with SSRF protection by default |
252
282
 
253
283
  ## AGENTS.md and Agent Skills
254
284
 
@@ -283,7 +313,7 @@ Activated skill bodies carry retention markers so context compaction re-injects
283
313
 
284
314
  File tools are restricted to the configured workspace by default. The sandbox checks resolved paths and symlinks. Access outside the workspace can be approved for the current session.
285
315
 
286
- Command execution is declared to the model but is not pre-authorized unless `enableCommandExecution: true` or `agent.enable_command_execution: true` is configured. Commands are launched directly from argv without an implicit shell, with workspace-checked cwd, bounded output, timeout, and AbortSignal cancellation. Child processes still inherit the operating-system permissions of the current user; production deployments should additionally use containers, a dedicated OS user, or another OS-level sandbox.
316
+ Command execution is declared to the model but is not pre-authorized unless `enableCommandExecution: true` or `agent.enable_command_execution: true` is configured. Like other agent flags, this switch is re-read for each run, so changing it via `PUT /config` takes effect on the next run. Commands are launched directly from argv without an implicit shell, with workspace-checked cwd, bounded output, timeout, and AbortSignal cancellation. Child processes still inherit the operating-system permissions of the current user; production deployments should additionally use containers, a dedicated OS user, or another OS-level sandbox.
287
317
 
288
318
  ## Persistence and Recovery
289
319