feat(moa): 新增 Mixture of Agents 支持(多模型参考 fan-out + 聚合) - #45
Open
guantoubaozi wants to merge 552 commits into
Open
feat(moa): 新增 Mixture of Agents 支持(多模型参考 fan-out + 聚合)#45guantoubaozi wants to merge 552 commits into
guantoubaozi wants to merge 552 commits into
Conversation
…nked llm entry in ai_message Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
install.sh writes a cz-agent wrapper (#!/bin/sh, exec cz-cli agent "$@") into the install dir (already on PATH), so it works in any shell and in scripts. cz-cli update re-runs install.sh, recreating it on upgrade.
Replace cz-cli agent <run/llm/session/export> command invocations with the cz-agent shortcut in the cz-cli skill and its profile-setup reference; prose mentioning "the cz-cli agent" is left unchanged.
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Adds a built-in opencode tool that forwards job performance analysis to the central-region ClickZetta MCP server (Streamable-HTTP), with service-URL->central-region MCP endpoint derivation, PAT/username-password auth headers, and unit tests. Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
…r, curl via install script) Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
…fails Co-Authored-By: cz-cli <noreply@clickzetta.com>
…tas, fix debug truncation Co-Authored-By: cz-cli <noreply@clickzetta.com>
… full routing/status Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
…tion Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
Two bugs prevented the conversation from continuing after key rotation: 1. config.invalidate() triggered Instance.disposeAll() asynchronously, which raced with the retry and re-invalidated the freshly rebuilt provider state, causing the SDK to miss the new API key. Add config.invalidateCache() that only clears the global config cache and Config InstanceState without disposing instances. 2. No guard against repeated rotation — if the retry still failed (e.g. due to the race in bug 1), recoverRotation would loop infinitely creating new keys. Add a per-stream flag that limits rotation to one attempt. Co-Authored-By: cz-cli <noreply@clickzetta.com>
Co-Authored-By: cz-cli <noreply@clickzetta.com>
…efix fix: handle /api/ path prefix in JDBC URL parsing
- Add `task integration setup/show/edit`: build the Studio integration JSON deterministically for single-table / multi-table / whole-db offline sync (single auto-creates sink table + field mapping; whole-db emits dbMirror/dynamicFlag/nameRule). - Single-table supports --write-mode (OVERWRITE|APPEND|UPSERT), --partitions and --param-value-list, mirroring studio-agent integration_task_pre_action / edit_integration_sync. - Remove the agent-driven offline quartet (create-offline-sync, offline-sync-schema, save-offline-sync, create-batch-sync) in favor of the deterministic path; keep realtime CDC / Kafka commands. - Fix instanceName (was sc.workspaceName -> sc.instanceName) in kept sync cmds; redirect deploy/execute hints to task integration. - Register task integration in inner-agent prompt (cz-cli-inner.txt) and document the offline workflow in the cz-cli skill.
Co-Authored-By: cz-cli <noreply@clickzetta.com>
…release-dep fix(release): pin ghostty-web git dependency
…Server support (clickzetta#14) * refactor: remove redundant code — extract shared helpers, deduplicate logic CDC prereq check: - Extract checkCdcPrereqs() as exported function in datasource.ts - Delete duplicate 95-line implementation from task.ts - check-cdc command now delegates to shared helper Duplicate task name check: - Extract checkDuplicateTaskName() helper in task.ts - Replace 6 identical 5-line inline blocks with single helper call Other cleanup: - Remove redundant targetDsType=1 reassignment in create/save-realtime-sync (was already initialized to 1) - Fix splitPkExclude: remove TINYINT/SMALLINT which were never in splitPkTypes - Replace 6 inline new Date().toISOString()... with formatIsoStartOfDay(undefined) Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com> * fix: integration test fixes, bug fixes, and help text improvements Bug fixes: - formatIsoStartOfDay(undefined) caused infinite recursion — now returns today's date - flow instances --instance conflicted with global --instance — renamed to --flow-instance - flow submit published:false — poll condition updated to accept deployStatus=3 (deployed with pending changes) - save-cron DDL guard: detect CREATE/DROP/ALTER TABLE in task content and block scheduling - cron-preview next_runs always empty (API returns []) — local fallback via cronNextRuns() - schedule-info on draft task gave cryptic error — now returns friendly TASK_NOT_DEPLOYED message - task search treated positional name as subcommand — changed to positional [name] - save-schedule hanging — caused by formatIsoStartOfDay infinite recursion (same root cause) - delete-folder non-empty error now lists contained tasks by name - task create validates name characters before calling API Help text improvements: - task flow: describe composite task concept (DAG of nodes) and typical workflow - All flow subcommands: add context, usage order, and cross-references - node-save --content/--file: add missing describe fields - task create --type: fix trailing quote, add FLOW explanation - task create --folder: mark as demandOption, improve description - All <task> positionals (24 instances): add "Task name or ID" describe - create-offline-sync/save-offline-sync: remove agent/MCP jargon - offline-sync-schema: remove "Agent uses output" phrasing - create-realtime-sync/create-batch-sync: remove internal type names - task start --startup-mode: translate Chinese to English - task start --config: translate Chinese values to English - task start --engine-type/--blacklist-strategy: replace circular descriptions - save-schedule --retry-unit/--timeout-unit: clarify m=minutes s=seconds - task list/list-folders --page/--page-size: add describe fields - flow node-save-config --cron/--vc/--schema: add describe fields - Confirmations unified to "Requires -y to proceed." Chinese aiMessage → English: - task execute: translate completion message - task list: translate pagination hint - task list-folders: translate pagination hint - task search: remove Chinese truncation suffix New feature (cron-adapter.ts): - cronNextRuns(): local Quartz cron calculator supporting named days/months, ranges, steps — used as fallback when API returns empty next_runs Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com> * fix: flow bind verify persistence after async write The bind API returns success before the edge is durably written to DB. Add post-bind verification: re-query DAG up to 3 times (800ms apart). If edge is missing, retry the bind call automatically. If still not confirmed after 3 attempts, return a warning instead of false success. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com> * fix: Oracle not supported for CDC sync; add dsType whitelist to create/save-realtime-sync checkCdcPrereqs: Oracle (dsType=25) now returns ok:false with a clear "not supported" message instead of silently passing through. create-realtime-sync / save-realtime-sync: validate source dsType against the supported CDC set before proceeding. Supported sources: MySQL/TiDB/MariaDB (5,17,18,19,39), PostgreSQL/Greenplum (7,22,40,46,48), SQL Server (8), DM (26). Unsupported types (including Oracle) are rejected with UNSUPPORTED_DATASOURCE (exit code 2). Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com> * fix: Oracle/SQL Server datasource support — check-cdc, type validation, collectType datasource check-cdc: - SQL Server: replace sys.databases/sys.dm_server_services queries (inaccessible via getSampleData API) with INFORMATION_SCHEMA.TABLES filtered client-side for TABLE_SCHEMA='cdc'. If cdc schema tables exist, CDC is enabled and Agent is inferred running. - Oracle (dsType=25): now returns ok:false with explicit "not supported" message instead of silently passing through. create-realtime-sync / save-realtime-sync: - Added CDC_SUPPORTED_TYPES whitelist. Supported: MySQL/TiDB/MariaDB, PostgreSQL/Greenplum, SQL Server, DM. Oracle and others rejected with UNSUPPORTED_DATASOURCE (exit code 2). save-offline-sync: - INTEGRATION tasks now use collectType:1 (was 0 from saveTaskContent). collectType:0 caused Studio UI to treat the task as a script task, leaving field mapping switches in wrong initial state. - SQL Server: added FlinkX unsupported type check before saving. Blocked types: sql_variant, image, binary, varbinary, timestamp. text/ntext are supported (map to STRING). Error includes fix hint. offline-sync-schema: - SQL Server note updated: lists unsupported types and clarifies text/ntext map to STRING. Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com> * fix: task list/downstream/folders display bugs, cron-preview local fallback - convertTaskFields: pass through already-snake-case fields (task_id, task_name, task_type, task_edit_state, path, location, etc.) - list-folders: map dataFolderName → name, parentFolderId → parent_id - downstream: map API fields (scheduleTaskId → task_id, cycleTaskName → task_name, cycleTaskType → task_type) - cron-preview: fall back to local cronNextRuns() when API returns empty Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: resolveNodeId — accept names via --node-id, warn on duplicates, list available nodes - resolveNodeArg: new helper that accepts number, numeric string, or node name, resolving names through resolveNodeId(). Fixes the case where --node-id 'extract' was silently dropped by yargs type:'number'. - --node-id type changed from 'number' to 'string' in all 4 flow commands (node-detail, node-save, node-save-config, remove-node). - resolveNodeId: filter all matches instead of find() first match. When multiple nodes share a name, warns on stderr with --node-id hint. When no match, lists all available node names + IDs. - All call sites simplified from if/else resolveNodeId patterns to a single resolveNodeArg() call. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: schedule-info — normalize camelCase API fields to snake_case - Add SCHEDULE_INFO_FIELDS mapping with 40+ field conversions - convertScheduleInfoFields(): transform getDetail API response - Result: cron_expression, task_name, vc_code, etc. now match the convention used by task content/save-config commands Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: improve flow param, schedule-info help text clarity - flow node-save --param: note that re-save replaces ALL params - flow node-save --flow-param: explain ref=2 inheritance from parent - schedule-info: note flow tasks use 'task flow instances' instead - flow submit: mention param persistence and flow run usage - flow run --param: clarify override targets manual params (ref=0), flow-shared params (ref=2) receive flow execution value Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: add workflow guidance and cross-references to help texts High-impact improvements to reduce call retries and improve task efficiency: task create: document create→save-content→save-config→deploy workflow task flow: document full workflow: create FLOW→create-node→node-save→ node-save-config→bind→submit task deploy: note prerequisites (must have content + config) task undeploy: clarify relation to delete (must undeploy before delete) task delete: clarify draft vs published procedure task start/stop: cross-reference each other and 'task status' task list: explain state codes (10=draft, 20=published, 100=offline) task save-cron: document 7-field cron format with example datasource list: cross-reference 'datasource test' for connectivity check datasource test: explain return format and recommend before sync task creation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: improve create-setup help — explain one-step value, add cron examples, clarify params - Title: explain it combines create+save-content+save-cron+save-config - Cross-reference 'create-realtime-sync' for CDC tasks - --type: list concrete values (SQL/PYTHON/SHELL/JDBC/FLOW) - --folder: tell user how to find IDs ('task folder-tree') - --content/--file: explain mutual exclusivity, file workflow for multi-line - --cron: full 7-field format with two examples (daily 09:30, every 5 min) - --vc: suggest using global --vcluster flag - --params: explain literal vs system param auto-detection Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: improve create-setup help + fix TS type errors - create-setup: explain one-step value, add cron format examples, clarify --content/--file/--folder/--params/--vc descriptions - Fix 5 fileDescription TS2322 type errors (unknown → string | undefined) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs: fix create-setup --type description — remove FLOW (UI-only, not supported) UI_ONLY_TYPES: FLOW=500, INTEGRATION=1, REALTIME=14, DT=16, STREAMING=17, FULL_INCREMENTAL=280, MULTI_REALTIME=281, MULTI_DI=291 — none support one-step create-setup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test: add e2e regression tests for PR clickzetta#14 (display fixes, CDC, help) 29 tests covering: - task list: verify task_id/task_name/task_type/task_edit_state populated - task list-folders: verify name field not null - cron-preview: local fallback returns non-empty next_runs - datasource check-cdc: MySQL (3 checks), PG (wal check), Oracle (cdc_support=false), SQL Server (cdc+agent), Kafka (ready=true) - create-realtime-sync dsType whitelist: Kafka → UNSUPPORTED_DATASOURCE, Oracle → error - task status: edit_state in {draft, published, offline} - task content: task_id/task_name/schedule_config/studio_url all present - task search: task_id/task_name/path populated - task folder-tree: id/name defined - task stats: tasks.total + run_instances - task downstream: task_id/task_name mapped from API fields - schedule-info: snake_case field mapping verified - flow dag: returns array for FLOW tasks - help texts: workflow/prerequisites/state codes/cron examples in 10 commands Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: cron-preview — correct API field name + default time window generateInstanceTimeList expects "cron" (not "cronExpress") and requires scheduleStartTime + scheduleEndTime. The SDK was sending cronExpress without the time window, causing the API to return empty next_runs. Changed: - Field name: cronExpress → cron - Always send scheduleStartTime (default 00:00) and scheduleEndTime (default 23:59) instead of conditionally omitting them Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
…y guard (clickzetta#36) * fix: add missing --description option to task create-setup create-setup handler already uses argv.description when saving the task, but the yargs option was never declared — invisible in --help and inconsistent with 'task create' which documents --description. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> * fix: schedule-info friendly error + REALTIME deploy guard (issues 2 & 4) Issue 2 — schedule-info external call exception: - FLOW tasks (fileType=500): detected before API call, return friendly note pointing to "task flow instances" - SQL/other tasks deployed without cron: API throws IDE-SYSTEM_EXCEPTION, now caught and returns friendly "no active schedule entry" message instead of raw TASK_ERROR Issue 4 — bare REALTIME task deploy fails with "文件参数不匹配": - fileType=14 (REALTIME) with no content configured now returns NO_SYNC_CONFIG error with clear guidance to use "create-stream-sync" - Configured REALTIME tasks (via create-stream-sync) still deploy normally Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> * test: add regression tests for schedule-info errors + REALTIME deploy guard New tests (describe 15 + 16): describe "schedule-info friendly errors": - deployed task without cron → exitCode=0 + friendly note (was: TASK_ERROR) - FLOW task → exitCode=0 + "use task flow instances" note (was: TASK_ERROR) - deployed task with cron → still returns full schedule data (no regression) describe "REALTIME deploy guard": - bare REALTIME task → NO_SYNC_CONFIG at CLI layer (not backend 文件参数不匹配) - create-stream-sync configured task → deploys successfully (no regression) Also fix json() helper to skip leading Warning: lines in output. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> * fix: replace magic length<10 with explicit empty-content check The length < 10 threshold was checking whether INTEGRATION/REALTIME fileContent is an empty/placeholder value. Replace with explicit check for empty string, "null", "[]", "{}". Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
…lag passthrough Make the CLI self-correcting and machine-friendly for AI agents and scripts, and let the interactive /sql prompt command accept flags. CLI error handling and output (packages/cz-cli): - Add "did you mean" suggestions for mistyped top-level commands, subcommands, and flags, using a length-normalized Damerau-Levenshtein matcher (suggest.ts), surfaced in a structured error.did_you_mean field plus the human/ai_message channels. - Run the profile/LLM gate as post-validation yargs middleware so syntax errors (unknown command/option, missing argument) surface before NO_PROFILE instead of being masked by it. - Force English yargs locale so built-in messages no longer localize to the shell LANG, keeping message/ai_message stable for agents. - Split the commandGroup fail handler so a mistyped flag is matched against flag names (not subcommand names), and route its output through renderOutput so --format/--field are honored like the top-level path. - Reset inherited global --format choices for agent session list/status so --help no longer advertises unsupported formats. - Honor --format/--field in sql --batch mode instead of always raw JSON. - Emit a structured result envelope from update when machine-bound (explicit --format or non-TTY), keeping interactive output human-only. - Add next-step ai_message guidance to async commands that return an id (job status/cancel, runs stop/rerun, task flow run, analytics-agent session create) so agents know how to poll or continue. - Add suggest and robustness test suites; wire them into test:unit/test:all. Interactive TUI (packages/opencode): - Support flag passthrough in the /sql prompt command.
…bcommand errors Review fixes on top of the agent-robustness work: - command-group: resolve --format/--field from the invocation args (stashed on the yargs instance by createCli) instead of process.argv. On the same-process execute() path, process.argv belongs to the host (TUI/MCP), so usage errors in subcommand groups previously ignored the caller's --format/--field. Adds a same-process regression test that fails against the old behavior. - job status: when a job is still RUNNING, point agents at the synchronous `job result` (which blocks until completion) and clarify that status is a point-in-time snapshot, instead of instructing them to hand-roll a status poll loop. - task downstream: fix ai_message referencing the non-existent `cz-cli task upstream`; the command for a task's upstream dependencies is `cz-cli task deps`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The --instance option on `task flow instances` collided with a profile field. Rename it to --run_id to avoid the conflict. Co-authored-by: hang.su <hang.su@clickzetta.com> Co-authored-by: cz-cli <noreply@clickzetta.com>
* fix: support weekly selected-day task schedules Add Studio task contract enums, first-class CONDITION task handling, and weekly selected-day schedule payload support for standalone tasks and flow nodes. Co-Authored-By: cz-cli <noreply@clickzetta.com> * feat: add workspace parameter commands * [to #CZECO-322] feat: support flow node input/output parameter chains - SDK saveFlowNodeContent: expose inputParamValueList/outputParamValueList (previously hardcoded null) via SaveFlowNodeContentParams - task flow node-save: add --output-param (declares $[output] producer) and --input-param key=upstreamNodeName (resolves upstream node name to dependencyId via flow DAG, builds ref=0 $[output] consumer entry) - add flow-params SDK tests covering both param chains Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat: support merge task workflow Add MERGE task contracts, save-merge command, deploy guard, SDK payload fields, specs, tests, and agent docs. Co-Authored-By: cz-cli <noreply@clickzetta.com> --------- Co-authored-by: lin.zhang <lin.zhang@clickzetta.com> Co-authored-by: cz-cli <noreply@clickzetta.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: lin.zhang <lin.zhang@clickzetta.com> Co-authored-by: cz-cli <noreply@clickzetta.com>
- 新增metric命令组支持metric的增删改查、启用停用和验证 - 新增answer-builder命令组支持answer-builder的增删改查、启用停用和验证 - 新增domain joins子命令组支持join关系发现、结果查询和应用 - 实现parseJoinFlag函数解析join关系字符串格式 - 添加parseStringList函数支持JSON数组或逗号分隔字符串解析 - 补充domain joins功能的单元测试覆盖 - 更新e2e测试用例包含新增命令的profile门控验证
Design for porting hermes-agent's Mixture of Agents into cz-cli as a virtual `moa` provider (approach A2): preset selection through the normal model system, reference fan-out + tool-aware context injection in llm.ts, aggregator as the acting model. Classic MoA / variant 1 scope. Co-Authored-By: Claude <noreply@anthropic.com>
The test asserted project config.model overrides the default_llm bridge, but 8fa9e5a made model exclusively owned by profiles.toml. Update the test to reflect current design: profiles.toml model wins. Co-Authored-By: Claude <noreply@anthropic.com>
The model selection dialog built its option list solely from llm_entries (profiles.toml [llm.*]), so the synthesized virtual `moa` provider — though correctly registered on the backend — never appeared in /model. Append the moa provider's presets to the picker options so MoA presets are selectable like any other model. Co-Authored-By: cz-cli <noreply@clickzetta.com>
…i.json Parse a top-level [moa] section from profiles.toml so MoA presets live in the same file as the [llm.*] entries they reference. czcli.json's moa field is now ignored (deleted on load, like model). Downstream provider synthesis and llm-loop consumers are unchanged; they read cfg.moa regardless of source. Co-Authored-By: cz-cli <noreply@clickzetta.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
为 cz-cli 引入 Mixture of Agents(MoA):多个「参考模型」并行给出建议,再由一个「聚合模型」综合这些建议,作为正常的 acting model 执行工具并产出最终答案。MoA 注册成一个虚拟
moaprovider,每个 preset 就是/model里一个可选的 model——不新增命令,不改动交互流程。profiles.toml的顶层[moa]段,与 preset 引用的[llm.*]entry 同文件。配置示例
改动内容
session/moa.ts— 纯函数:preset 归一化、slot 解析、参考 fan-out、上下文注入/合成provider.ts— 合成虚拟moaprovider(每个 preset 一个 model)session/llm.ts— 在 LLM 循环里做参考 fan-out + 上下文注入config.ts/profiles-llm.ts— MoA 配置从 profiles.toml 的[moa]读取openspec/specs/moa-config/spec.md;设计文档见docs/superpowers/specs/测试计划
test/session/moa.test.ts、moa-integration.test.ts)test/provider/moa-provider.test.ts)test/session/llm.test.ts)test/config/profiles-llm.test.ts)bun typecheck通过moa/glmpreset(deepseek + qwen 参考 + glm-5.2 聚合)通过真实二进制端到端跑通