mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-14 19:45:08 +08:00
chore: neutralize internal references in code comments and migrations
This commit is contained in:
parent
2246df9d09
commit
bc417d00ef
4
.gitignore
vendored
4
.gitignore
vendored
@ -99,5 +99,5 @@ CLAUDE.md
|
|||||||
# Codex CLI local artifacts
|
# Codex CLI local artifacts
|
||||||
.codex/
|
.codex/
|
||||||
|
|
||||||
# QwenPaw sync state (generated each run; report is intentionally tracked)
|
# Sync tooling local state (generated each run; report is intentionally tracked)
|
||||||
scripts/.qwenpaw-sync-state.json
|
scripts/.*-sync-state.json
|
||||||
|
|||||||
@ -382,7 +382,7 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- RFC-03 Lane G2: distributed lock for the cron scheduler so a
|
<!-- ShedLock: distributed lock for the cron scheduler so a
|
||||||
multi-instance deployment doesn't fire the same job N times.
|
multi-instance deployment doesn't fire the same job N times.
|
||||||
JDBC mode reuses the existing DataSource — no Redis dependency
|
JDBC mode reuses the existing DataSource — no Redis dependency
|
||||||
on the desktop / single-node footprint. -->
|
on the desktop / single-node footprint. -->
|
||||||
|
|||||||
@ -41,9 +41,9 @@ import java.util.function.Function;
|
|||||||
* agent graph layer.
|
* agent graph layer.
|
||||||
*
|
*
|
||||||
* <p>Why not the official {@code acp} Python SDK: MateClaw runs on the
|
* <p>Why not the official {@code acp} Python SDK: MateClaw runs on the
|
||||||
* JVM. The protocol is JSON-RPC 2.0 line-delimited over stdio (per the
|
* JVM. The protocol is JSON-RPC 2.0 line-delimited over stdio; the
|
||||||
* QwenPaw reference at {@code C:/codes/QwenPaw}); the surface we need
|
* surface we need for "test connection" is small enough to implement
|
||||||
* for "test connection" is small enough to implement directly.
|
* directly.
|
||||||
*
|
*
|
||||||
* <p>Each {@link AcpStdioClient} instance owns one Process. Use
|
* <p>Each {@link AcpStdioClient} instance owns one Process. Use
|
||||||
* try-with-resources or call {@link #close()} explicitly.
|
* try-with-resources or call {@link #close()} explicitly.
|
||||||
@ -51,7 +51,7 @@ import java.util.function.Function;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class AcpStdioClient implements AutoCloseable {
|
public class AcpStdioClient implements AutoCloseable {
|
||||||
|
|
||||||
/** ACP protocol version we advertise (matches QwenPaw v1 + Zed agents). */
|
/** ACP protocol version we advertise (matches v1 ACP-compatible agents). */
|
||||||
public static final int PROTOCOL_VERSION = 1;
|
public static final int PROTOCOL_VERSION = 1;
|
||||||
|
|
||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
|
|||||||
@ -46,9 +46,9 @@ public class AcpEndpointEntity {
|
|||||||
private String envJson;
|
private String envJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* call_title | call_detail | update_detail (mirrors QwenPaw
|
* call_title | call_detail | update_detail (mirrors the ACP
|
||||||
* {@code tool_parse_mode}). Drives how the wrapper renders ACP
|
* {@code tool_parse_mode} convention). Drives how the wrapper
|
||||||
* tool-call events into MateClaw's stream protocol.
|
* renders ACP tool-call events into MateClaw's stream protocol.
|
||||||
*/
|
*/
|
||||||
private String toolParseMode;
|
private String toolParseMode;
|
||||||
|
|
||||||
|
|||||||
@ -203,7 +203,7 @@ public class AcpDelegationService {
|
|||||||
* Extract plain text from an ACP {@code content} field. The shape
|
* Extract plain text from an ACP {@code content} field. The shape
|
||||||
* varies between agents — Zed uses {@code [{type:"text",text:"..."}]},
|
* varies between agents — Zed uses {@code [{type:"text",text:"..."}]},
|
||||||
* some emit a single object, others nest in {@code resource.text}.
|
* some emit a single object, others nest in {@code resource.text}.
|
||||||
* Mirror QwenPaw's tolerant extractor.
|
* Tolerant extractor that handles all known shapes.
|
||||||
*/
|
*/
|
||||||
private String extractText(JsonNode content) {
|
private String extractText(JsonNode content) {
|
||||||
if (content == null || content.isNull()) return "";
|
if (content == null || content.isNull()) return "";
|
||||||
|
|||||||
@ -155,7 +155,7 @@ public class AgentGraphBuilder {
|
|||||||
// the agent's bound-skill requires-model. Falls back to the
|
// the agent's bound-skill requires-model. Falls back to the
|
||||||
// global default when no preferred provider satisfies, so the
|
// global default when no preferred provider satisfies, so the
|
||||||
// existing "no default model" error path stays intact.
|
// existing "no default model" error path stays intact.
|
||||||
// RFC-03 Lane G1 — honor per-Agent model override when set.
|
// Honor per-Agent model override when set.
|
||||||
// resolveModel() looks up entity.modelName in enabled-only models;
|
// resolveModel() looks up entity.modelName in enabled-only models;
|
||||||
// null / blank / unmatched silently fall back to getDefaultModel(),
|
// null / blank / unmatched silently fall back to getDefaultModel(),
|
||||||
// preserving the legacy behavior for Agents without an override.
|
// preserving the legacy behavior for Agents without an override.
|
||||||
@ -229,7 +229,7 @@ public class AgentGraphBuilder {
|
|||||||
}
|
}
|
||||||
// Default 100 if DB row leaves max_iterations null; clamp per-agent overrides
|
// Default 100 if DB row leaves max_iterations null; clamp per-agent overrides
|
||||||
// to the hard ceiling (BaseAgent.MAX_ITERATIONS_HARD_CEILING) so a misconfigured
|
// to the hard ceiling (BaseAgent.MAX_ITERATIONS_HARD_CEILING) so a misconfigured
|
||||||
// row can never push an unbounded loop. Aligned with QwenPaw's 1..100 range.
|
// row can never push an unbounded loop. Effective range: 1..100.
|
||||||
int rawMaxIter = entity.getMaxIterations() != null ? entity.getMaxIterations() : 100;
|
int rawMaxIter = entity.getMaxIterations() != null ? entity.getMaxIterations() : 100;
|
||||||
int maxIter = Math.max(1, Math.min(rawMaxIter, BaseAgent.MAX_ITERATIONS_HARD_CEILING));
|
int maxIter = Math.max(1, Math.min(rawMaxIter, BaseAgent.MAX_ITERATIONS_HARD_CEILING));
|
||||||
if (maxIter != rawMaxIter) {
|
if (maxIter != rawMaxIter) {
|
||||||
@ -1099,10 +1099,10 @@ public class AgentGraphBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane B1 overload — accepts a per-model read-timeout override
|
* Overload that accepts a per-model read-timeout override (seconds).
|
||||||
* (seconds). Threaded into both the sync RestClient and streaming
|
* Threaded into both the sync RestClient and streaming WebClient so
|
||||||
* WebClient so timeout behavior is consistent across blocking and
|
* timeout behavior is consistent across blocking and streaming chat
|
||||||
* streaming chat completions. Null falls back to the default 180s.
|
* completions. Null falls back to the default 180s.
|
||||||
*/
|
*/
|
||||||
public OpenAiApi buildOpenAiApi(ModelProviderEntity provider, Integer readTimeoutOverride) {
|
public OpenAiApi buildOpenAiApi(ModelProviderEntity provider, Integer readTimeoutOverride) {
|
||||||
if (provider == null || !modelProviderService.isProviderConfigured(provider.getProviderId())) {
|
if (provider == null || !modelProviderService.isProviderConfigured(provider.getProviderId())) {
|
||||||
@ -1489,8 +1489,8 @@ public class AgentGraphBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane B1 overload — accepts a per-model read-timeout override
|
* Overload that accepts a per-model read-timeout override (seconds).
|
||||||
* (seconds). Null falls back to the default 180s.
|
* Null falls back to the default 180s.
|
||||||
*/
|
*/
|
||||||
private RestClient.Builder applyHttpTimeouts(RestClient.Builder builder, Integer readTimeoutOverride) {
|
private RestClient.Builder applyHttpTimeouts(RestClient.Builder builder, Integer readTimeoutOverride) {
|
||||||
HttpClient httpClient = HttpClient.newBuilder()
|
HttpClient httpClient = HttpClient.newBuilder()
|
||||||
@ -1521,7 +1521,7 @@ public class AgentGraphBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane B1 overload — same per-model override semantics as
|
* Overload with the same per-model override semantics as
|
||||||
* {@link #applyHttpTimeouts(RestClient.Builder, Integer)}.
|
* {@link #applyHttpTimeouts(RestClient.Builder, Integer)}.
|
||||||
*/
|
*/
|
||||||
private WebClient.Builder applyHttpTimeoutsToWebClient(WebClient.Builder builder, Integer readTimeoutOverride) {
|
private WebClient.Builder applyHttpTimeoutsToWebClient(WebClient.Builder builder, Integer readTimeoutOverride) {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public abstract class BaseAgent {
|
|||||||
/**
|
/**
|
||||||
* Max ReAct iterations (one reasoning + action + observation step counts as one).
|
* Max ReAct iterations (one reasoning + action + observation step counts as one).
|
||||||
* Default 100, hard ceiling 100 (enforced in AgentGraphBuilder so per-agent DB
|
* Default 100, hard ceiling 100 (enforced in AgentGraphBuilder so per-agent DB
|
||||||
* overrides cannot exceed it). Aligned with QwenPaw's _MAX_MAX_ITERATIONS.
|
* overrides cannot exceed it).
|
||||||
*/
|
*/
|
||||||
public static final int MAX_ITERATIONS_HARD_CEILING = 100;
|
public static final int MAX_ITERATIONS_HARD_CEILING = 100;
|
||||||
protected int maxIterations = 100;
|
protected int maxIterations = 100;
|
||||||
|
|||||||
@ -57,10 +57,10 @@ public class ToolExecutionExecutor {
|
|||||||
* this list.
|
* this list.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane A2 — defense against runaway single-response tool floods.
|
* Defense against runaway single-response tool floods.
|
||||||
*
|
*
|
||||||
* <p>Some models (StreamLake's kat-coder-pro-v1 has been observed
|
* <p>Some models (StreamLake's kat-coder-pro-v1 has been observed
|
||||||
* emitting 50+ in one shot, see QwenPaw #2055) return huge {@code tool_calls}
|
* emitting 50+ in one shot) return huge {@code tool_calls}
|
||||||
* batches in a single response. Without a cap, every call executes, which
|
* batches in a single response. Without a cap, every call executes, which
|
||||||
* can saturate downstream provider QPS, multiply approval rows, and burn
|
* can saturate downstream provider QPS, multiply approval rows, and burn
|
||||||
* tokens. The cap is independent of {@code MAX_ITERATIONS} (which limits
|
* tokens. The cap is independent of {@code MAX_ITERATIONS} (which limits
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import java.util.Set;
|
|||||||
* checks — extension allowlist here, size cap there, no path-traversal
|
* checks — extension allowlist here, size cap there, no path-traversal
|
||||||
* guard at all. The result is 8 places to keep in sync when a new file
|
* guard at all. The result is 8 places to keep in sync when a new file
|
||||||
* type is supported (or when a new exploit needs a defensive patch).
|
* type is supported (or when a new exploit needs a defensive patch).
|
||||||
* Same gap as QwenPaw #1220.
|
|
||||||
*
|
*
|
||||||
* <p>This guard centralizes four checks that every adapter needs:
|
* <p>This guard centralizes four checks that every adapter needs:
|
||||||
* <ol>
|
* <ol>
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public record DeliveryConfig(
|
|||||||
* is still persisted, audit + token-usage all work — only the
|
* is still persisted, audit + token-usage all work — only the
|
||||||
* agent's narrative reply is suppressed from the channel.
|
* agent's narrative reply is suppressed from the channel.
|
||||||
*
|
*
|
||||||
* <p>Use cases (QwenPaw #2452): noon health-check cron that just
|
* <p>Use cases: noon health-check cron that just
|
||||||
* pokes a database and writes structured output, project-weekly
|
* pokes a database and writes structured output, project-weekly
|
||||||
* report jobs that drop a file into a knowledge base, internal
|
* report jobs that drop a file into a knowledge base, internal
|
||||||
* pipelines that don't need an IM-visible "I did the thing"
|
* pipelines that don't need an IM-visible "I did the thing"
|
||||||
|
|||||||
@ -42,12 +42,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* without manual binding.
|
* without manual binding.
|
||||||
*
|
*
|
||||||
* <p>This solves the "ACP configured as skill cannot be called"
|
* <p>This solves the "ACP configured as skill cannot be called"
|
||||||
* usability bug (matches the inspiration from QwenPaw's
|
* usability bug while keeping MateClaw's skill-card affordance for
|
||||||
* {@code delegate_external_agent} pattern, but keeps MateClaw's
|
* endpoint discovery: the user manages endpoints in Settings ▸ ACP
|
||||||
* skill-card affordance for endpoint discovery): the user manages
|
* Endpoints, and a card automatically appears on the Skills page —
|
||||||
* endpoints in Settings ▸ ACP Endpoints, and a card automatically
|
* no per-endpoint SKILL.md authoring required.
|
||||||
* appears on the Skills page — no per-endpoint SKILL.md authoring
|
|
||||||
* required.
|
|
||||||
*
|
*
|
||||||
* <p>Lifecycle:
|
* <p>Lifecycle:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|||||||
@ -132,7 +132,7 @@ public class ShellExecuteTool {
|
|||||||
* Windows: cmd.exe /D /S /C "command"
|
* Windows: cmd.exe /D /S /C "command"
|
||||||
* /D 禁用 AutoRun 注册表项,避免副作用
|
* /D 禁用 AutoRun 注册表项,避免副作用
|
||||||
* /S 保留引号原样传递给命令
|
* /S 保留引号原样传递给命令
|
||||||
* Unix: $SHELL -c command (RFC-03 Lane A1, fixes QwenPaw #3767)
|
* Unix: $SHELL -c command (honors the user's interactive shell)
|
||||||
* honors the user's interactive shell so alias resolution / PATH
|
* honors the user's interactive shell so alias resolution / PATH
|
||||||
* from the calling environment still apply; falls back to /bin/sh
|
* from the calling environment still apply; falls back to /bin/sh
|
||||||
* when $SHELL is unset or points at a non-executable path.
|
* when $SHELL is unset or points at a non-executable path.
|
||||||
@ -188,8 +188,7 @@ public class ShellExecuteTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane A1 — pick the POSIX shell binary to invoke for a non-Windows
|
* Pick the POSIX shell binary to invoke for a non-Windows tool call.
|
||||||
* tool call (fixes QwenPaw #3767).
|
|
||||||
*
|
*
|
||||||
* <p>Returns {@code userShellEnv} verbatim when:
|
* <p>Returns {@code userShellEnv} verbatim when:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class McpServerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane A3 — list the tools surfaced by an MCP server (QwenPaw #2495).
|
* List the tools surfaced by an MCP server.
|
||||||
*
|
*
|
||||||
* <p>Reads from the in-memory cache populated on connect/refresh, so the
|
* <p>Reads from the in-memory cache populated on connect/refresh, so the
|
||||||
* call is non-blocking and safe to poll from the admin UI.
|
* call is non-blocking and safe to poll from the admin UI.
|
||||||
|
|||||||
@ -162,8 +162,7 @@ public class McpServerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC-03 Lane A3 — list the tools the given MCP server has surfaced
|
* List the tools the given MCP server has surfaced to the runtime.
|
||||||
* to the runtime (fixes QwenPaw #2495).
|
|
||||||
*
|
*
|
||||||
* <p>Reads from {@link McpClientManager#getServerTools(Long)} which
|
* <p>Reads from {@link McpClientManager#getServerTools(Long)} which
|
||||||
* already caches the {@code listTools()} response on connect/refresh,
|
* already caches the {@code listTools()} response on connect/refresh,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
-- V47: Bump default agents' max_iterations to 100 (QwenPaw-style hard ceiling).
|
-- V47: Bump default agents' max_iterations to 100 (hard ceiling).
|
||||||
--
|
--
|
||||||
-- The previous defaults (25 for ReAct, 20 for plan-execute) ran the LimitExceededNode
|
-- The previous defaults (25 for ReAct, 20 for plan-execute) ran the LimitExceededNode
|
||||||
-- too eagerly on substantive multi-tool tasks (e.g. document generation with image
|
-- too eagerly on substantive multi-tool tasks (e.g. document generation with image
|
||||||
-- conversion). New default is 100, matching QwenPaw's _MAX_MAX_ITERATIONS upper bound.
|
-- conversion). New default is 100, the hard upper bound enforced at runtime.
|
||||||
-- AgentGraphBuilder still clamps any per-agent override to MAX_ITERATIONS_HARD_CEILING
|
-- AgentGraphBuilder still clamps any per-agent override to MAX_ITERATIONS_HARD_CEILING
|
||||||
-- at runtime, so a user-configured 200 will be silently capped to 100.
|
-- at runtime, so a user-configured 200 will be silently capped to 100.
|
||||||
--
|
--
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
-- User-customized rows (any value other than 25/20) were silently skipped, so the
|
-- User-customized rows (any value other than 25/20) were silently skipped, so the
|
||||||
-- StateGraph ReAct agent kept running with maxIterations=25 even after V47.
|
-- StateGraph ReAct agent kept running with maxIterations=25 even after V47.
|
||||||
-- V48 widens the condition: any seeded agent row with max_iterations < 100 gets
|
-- V48 widens the condition: any seeded agent row with max_iterations < 100 gets
|
||||||
-- bumped to 100, matching the QwenPaw-style ceiling. Custom rows above 100 still
|
-- bumped to 100, matching the hard ceiling. Custom rows above 100 still
|
||||||
-- get clamped at runtime by AgentGraphBuilder.
|
-- get clamped at runtime by AgentGraphBuilder.
|
||||||
--
|
--
|
||||||
-- 2) AGENTS.md tool guidance: the workspace's seeded AGENTS.md only mentioned
|
-- 2) AGENTS.md tool guidance: the workspace's seeded AGENTS.md only mentioned
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
-- V68: ACP (Agent Communication Protocol) endpoint registry (RFC-090 Phase 7)
|
-- V68: ACP (Agent Communication Protocol) endpoint registry (RFC-090 Phase 7)
|
||||||
-- One row per external coding agent the user can delegate to over stdio.
|
-- One row per external coding agent the user can delegate to over stdio.
|
||||||
-- The 4 default rows mirror QwenPaw's bundled set (codex / claude-code / opencode / qwen-code).
|
-- The 4 default rows cover the common stdio agents (codex / claude-code / opencode / qwen-code).
|
||||||
CREATE TABLE IF NOT EXISTS mate_acp_endpoint (
|
CREATE TABLE IF NOT EXISTS mate_acp_endpoint (
|
||||||
id BIGINT NOT NULL PRIMARY KEY,
|
id BIGINT NOT NULL PRIMARY KEY,
|
||||||
name VARCHAR(64) NOT NULL,
|
name VARCHAR(64) NOT NULL,
|
||||||
@ -11,12 +11,12 @@ CREATE TABLE IF NOT EXISTS mate_acp_endpoint (
|
|||||||
args_json TEXT,
|
args_json TEXT,
|
||||||
env_json TEXT,
|
env_json TEXT,
|
||||||
-- Bookkeeping for the per-call parser.
|
-- Bookkeeping for the per-call parser.
|
||||||
-- One of call_title | call_detail | update_detail (matches QwenPaw tool_parse_mode).
|
-- One of call_title | call_detail | update_detail (matches the ACP tool_parse_mode convention).
|
||||||
tool_parse_mode VARCHAR(32) NOT NULL DEFAULT 'call_title',
|
tool_parse_mode VARCHAR(32) NOT NULL DEFAULT 'call_title',
|
||||||
builtin BOOLEAN NOT NULL DEFAULT FALSE,
|
builtin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
trusted BOOLEAN NOT NULL DEFAULT TRUE,
|
trusted BOOLEAN NOT NULL DEFAULT TRUE,
|
||||||
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
-- Stdio buffer ceiling, default 50 MiB (mirrors QwenPaw default).
|
-- Stdio buffer ceiling, default 50 MiB.
|
||||||
stdio_buffer_limit_bytes BIGINT NOT NULL DEFAULT 52428800,
|
stdio_buffer_limit_bytes BIGINT NOT NULL DEFAULT 52428800,
|
||||||
last_status VARCHAR(32),
|
last_status VARCHAR(32),
|
||||||
last_tested_at DATETIME,
|
last_tested_at DATETIME,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
-- V47: Bump default agents' max_iterations to 100 (QwenPaw-style hard ceiling).
|
-- V47: Bump default agents' max_iterations to 100 (hard ceiling).
|
||||||
--
|
--
|
||||||
-- The previous defaults (25 for ReAct, 20 for plan-execute) ran the LimitExceededNode
|
-- The previous defaults (25 for ReAct, 20 for plan-execute) ran the LimitExceededNode
|
||||||
-- too eagerly on substantive multi-tool tasks (e.g. document generation with image
|
-- too eagerly on substantive multi-tool tasks (e.g. document generation with image
|
||||||
-- conversion). New default is 100, matching QwenPaw's _MAX_MAX_ITERATIONS upper bound.
|
-- conversion). New default is 100, the hard upper bound enforced at runtime.
|
||||||
-- AgentGraphBuilder still clamps any per-agent override to MAX_ITERATIONS_HARD_CEILING
|
-- AgentGraphBuilder still clamps any per-agent override to MAX_ITERATIONS_HARD_CEILING
|
||||||
-- at runtime, so a user-configured 200 will be silently capped to 100.
|
-- at runtime, so a user-configured 200 will be silently capped to 100.
|
||||||
--
|
--
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user