@margay/ccl-core 1.5.1-alpha.4 → 1.5.1-alpha.6

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.
@@ -22,7 +22,7 @@ export type McpSdkServerConfigWithInstance = {
22
22
  instance?: Server;
23
23
  [key: string]: unknown;
24
24
  };
25
- /** Define one in-process tool (Claude-Agent-SDK-compatible signature). */
25
+ /** Define one in-process tool (compatible agent SDK signature). */
26
26
  export declare function tool(name: string, description: string, inputSchema: ZodRawShape, handler: SdkMcpToolDefinition['handler'], extras?: Pick<SdkMcpToolDefinition, 'annotations' | 'searchHint' | 'alwaysLoad'>): SdkMcpToolDefinition;
27
27
  /**
28
28
  * Build an in-process MCP server from host-defined JS tools. Returns a config carrying the live
@@ -6,7 +6,7 @@ import { randomUUID } from 'node:crypto';
6
6
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
7
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
8
8
  import { z } from 'zod/v4';
9
- /** Define one in-process tool (Claude-Agent-SDK-compatible signature). */
9
+ /** Define one in-process tool (compatible agent SDK signature). */
10
10
  export function tool(name, description, inputSchema, handler, extras) {
11
11
  return { name, description, inputSchema, handler, ...(extras ?? {}) };
12
12
  }
package/dist/sdk/query.js CHANGED
@@ -102,7 +102,7 @@ export function buildCliArgs(options) {
102
102
  if (options.cwd)
103
103
  args.push('--cwd', options.cwd);
104
104
  // slice sdk-token-streaming (G3): opt-in token-level streaming — the CLI then emits stream_event
105
- // (Anthropic raw message stream) deltas. Default off keeps the minimal event set unchanged.
105
+ // (Messages API raw message stream) deltas. Default off keeps the minimal event set unchanged.
106
106
  if (options.includePartialMessages)
107
107
  args.push('--include-partial-messages');
108
108
  if (options.includeErrorDiagnostics)
@@ -831,7 +831,7 @@ export async function* queryWithTransport(prompt, options, transport) {
831
831
  break;
832
832
  }
833
833
  case 'stream_event': {
834
- // slice sdk-token-streaming (G3): forward one Anthropic raw message stream event
834
+ // slice sdk-token-streaming (G3): forward one Messages API raw message stream event
835
835
  // (token-level delta). Only arrives when includePartialMessages passed the flag.
836
836
  const streamEvent = message.event;
837
837
  if (streamEvent && typeof streamEvent.type === 'string') {
@@ -2,10 +2,8 @@
2
2
  * ccl-sdk public types — the embeddable SDK form of CCL (issue: CCL 改造升级,
3
3
  * 抽出可内嵌的 SDK 形态支撑 margay 内嵌 CoS 常驻运行).
4
4
  *
5
- * The interface shape deliberately mirrors the Anthropic Claude Agent SDK
6
- * (query() + canUseTool callback + session resume) so a host like margay can
7
- * keep a single call seam and swap between ccl-sdk (domestic-model customers)
8
- * and the Anthropic Agent SDK (Claude customers).
5
+ * The interface exposes query(), a canUseTool callback, and session resume
6
+ * so hosts can keep a shared calling interface across compatible runtimes.
9
7
  *
10
8
  * Wire contract: these types mirror the stream-json control protocol that
11
9
  * cli/print.ts + cli/structuredIO.ts already speak. The SDK is the HOST side
@@ -138,7 +136,7 @@ export type QueryOptions = {
138
136
  /**
139
137
  * slice sdk-token-streaming (G3): emit `stream_event` deltas as they arrive (token-level
140
138
  * streaming). Passes `--include-partial-messages` to the CLI so the subprocess streams
141
- * Anthropic raw message stream events (content_block_delta/text_delta, etc.). Default off →
139
+ * Messages API raw message stream events (content_block_delta/text_delta, etc.). Default off →
142
140
  * unchanged behavior; the full-block `assistant_text` events are still emitted alongside.
143
141
  */
144
142
  includePartialMessages?: boolean;
@@ -181,7 +179,7 @@ export type QueryOptions = {
181
179
  skillsDirs?: string[];
182
180
  /**
183
181
  * Model provider (issue P0-4). 'anthropic' maps to --base-url/--api-key
184
- * (any Anthropic-protocol endpoint). 'openai-compatible' maps to CCL's
182
+ * (any Messages API endpoint). 'openai-compatible' maps to CCL's
185
183
  * gateway channel (CCL_GATEWAY_URL/CCL_GATEWAY_KEY) — CCL reaches
186
184
  * OpenAI-compatible models through its gateway, which normalizes
187
185
  * tool-calling and rejects models without native function calling instead
@@ -446,7 +444,7 @@ type SDKEventPayload = {
446
444
  message: Record<string, unknown>;
447
445
  }
448
446
  /**
449
- * slice sdk-token-streaming (G3): one Anthropic raw message stream event (token-level delta),
447
+ * slice sdk-token-streaming (G3): one Messages API raw message stream event (token-level delta),
450
448
  * emitted only when `includePartialMessages` is set. `event.type` is one of
451
449
  * content_block_start / content_block_delta / content_block_stop / message_delta /
452
450
  * message_start / message_stop; e.g. a content_block_delta carries `delta.text` (text_delta).
package/dist/sdk/types.js CHANGED
@@ -2,10 +2,8 @@
2
2
  * ccl-sdk public types — the embeddable SDK form of CCL (issue: CCL 改造升级,
3
3
  * 抽出可内嵌的 SDK 形态支撑 margay 内嵌 CoS 常驻运行).
4
4
  *
5
- * The interface shape deliberately mirrors the Anthropic Claude Agent SDK
6
- * (query() + canUseTool callback + session resume) so a host like margay can
7
- * keep a single call seam and swap between ccl-sdk (domestic-model customers)
8
- * and the Anthropic Agent SDK (Claude customers).
5
+ * The interface exposes query(), a canUseTool callback, and session resume
6
+ * so hosts can keep a shared calling interface across compatible runtimes.
9
7
  *
10
8
  * Wire contract: these types mirror the stream-json control protocol that
11
9
  * cli/print.ts + cli/structuredIO.ts already speak. The SDK is the HOST side
@@ -133,6 +133,6 @@ WS_NO_BUFFER_UTIL=1 ~/.local/bin/ccl --ide
133
133
 
134
134
  前提是 IDE 已安装兼容扩展、打开同一项目,并与 CCL 使用同一配置目录。完整步骤、默认连接失败记录和连接范围见 [CCL 在 VS Code 中的使用说明](ccl-ide-usage.md)。此临时参数没有修复产品默认行为,也不涉及 Gateway 升级。
135
135
 
136
- `/ide` 接通编辑器能力,聊天仍在 CCL 终端。Claude Code、Codex 各自有官方原生聊天扩展;使用它们的聊天面板运行 CCL,以及迁移当前 Duo 会话,均尚未验证。专用 Duo 面板、tmux 中的完整版 RLL 和 SDK 多用户服务另行处理。
136
+ `/ide` 接通编辑器能力,聊天仍在 CCL 终端。通过其它扩展的聊天面板运行 CCL,以及迁移当前 Duo 会话,均尚未验证。专用 Duo 面板、tmux 中的完整版 RLL 和 SDK 多用户服务另行处理。
137
137
 
138
138
  普通 `/buddy` 先创建或复用 Team,再按返回的实际团队名启动 Agent;`/buddy --peer-review` 仍需固定审核模型和开发目标。两条 Buddy 路径与 Duo 的完成条件不同,详见[轻量开发审查说明](peer-development-review.md)。
@@ -1,37 +1,36 @@
1
1
  # CLI installation and upgrades
2
2
 
3
- For `1.4.5-rc.10`, use Node.js `>=22.19.0`. This matches the declared minimum of
3
+ For CCL 1.5.1, use Node.js `>=22.19.0`. This matches the declared minimum of
4
4
  the pinned `undici 8.0.2` runtime dependency; the earlier Node 20 declaration no
5
5
  longer applies. macOS Node/Bun verification does not imply Windows verification.
6
6
 
7
- Starting with `1.4.5-rc.10`, CCL declares `ccl` and `margay` as names for the same
8
- `dist/cli.js`. Both names must report the package version and provide the same
9
- options. The `1.4.5-rc.9` package declares only
10
- `margay`. Installing that existing version will not add `ccl`.
7
+ Starting with `1.5.1-alpha.6`, `@margay/ccl-core` provides only `ccl`.
8
+ Earlier releases from `1.4.5-rc.10` through `1.5.1-alpha.5` also provided a
9
+ `margay` alias. The independent `@margay/cli` package will own `margay` on the
10
+ 1.8 cleanhouse line. Upgrade an old dual-entry CCL installation first, before
11
+ installing that independent package. Scripts intended to run CCL should use `ccl`.
11
12
 
12
13
  ## Global and project installs
13
14
 
14
- For a terminal command available outside a project, install the desired released
15
- version globally:
15
+ For a terminal command available outside a project, install the released version
16
+ explicitly (the `latest` tag is not advanced by alpha releases):
16
17
 
17
18
  ```sh
18
- npm install --global @margay/ccl-core@latest
19
- margay --version
19
+ npm install --global @margay/ccl-core@1.5.1-alpha.6
20
+ ccl --version
20
21
  ```
21
22
 
22
- After installing a release with both entries, also run `ccl --version`. Both
23
- outputs must match the installed package's version. Global installation does not
24
- replace a CLI embedded in Margay Desktop or already loaded by a running process.
23
+ The expected output is `1.5.1-alpha.6 (CCL)`. Global installation does not replace
24
+ a CLI embedded in Margay Desktop or already loaded by a running process.
25
25
 
26
26
  Without `--global`, npm installs a project dependency. Run that copy explicitly:
27
27
 
28
28
  ```sh
29
- npm install @margay/ccl-core@latest
30
- ./node_modules/.bin/margay --version
29
+ npm install @margay/ccl-core@1.5.1-alpha.6
30
+ ./node_modules/.bin/ccl --version
31
31
  ```
32
32
 
33
- Releases with both entries also provide `./node_modules/.bin/ccl`. A successful
34
- project install does not upgrade commands elsewhere on the shell's PATH.
33
+ A successful project install does not upgrade commands elsewhere on the shell's PATH.
35
34
 
36
35
  ## Migrating old custom launchers (macOS/Linux)
37
36
 
@@ -56,13 +55,14 @@ There are two distinct cases:
56
55
  resolved entry. Back up the specific obsolete CCL wrapper, or update an explicit
57
56
  alias/function to use the npm entry. Ensure the npm prefix's `bin` directory is
58
57
  on PATH. Refresh the shell command cache (`rehash` in zsh, `hash -r` in bash),
59
- then verify both commands again from outside the source checkout.
58
+ then verify the intended command again from outside the source checkout.
60
59
 
61
60
  Keep each backup until the new commands work. To roll back a custom wrapper,
62
61
  restore its saved bytes at the original path after inspecting what currently
63
62
  occupies that path. For an npm-managed installation, install the previous exact
64
- version. Future npm upgrades manage both links once the custom wrappers have
65
- been migrated.
63
+ version. Future npm upgrades manage the CCL link once its custom wrapper has been
64
+ migrated. Do not reinstall a dual-entry CCL version over an independent Margay
65
+ installation; its old alias would conflict with the other product.
66
66
 
67
67
  ## Checking a release tarball
68
68
 
@@ -75,7 +75,8 @@ node tests/package-cli-install.mjs /path/to/artifacts/candidate.tgz /path/to/pre
75
75
 
76
76
  The smoke test uses isolated install prefixes, HOME/configuration and cache. It
77
77
  checks fresh global and project installs, upgrade from the previous tarball,
78
- both commands through PATH, matching executable/version/help, an unmanaged-file
78
+ the `ccl` command through PATH, matching executable/version/help, removal of the
79
+ old `margay` alias during upgrade, an unmanaged-file
79
80
  collision, backup migration and PATH shadowing. Dependency lifecycle scripts are
80
81
  disabled; this verifies CLI installation and startup, not native dependency or
81
82
  model behavior. It currently runs on POSIX; Windows `.cmd`/PowerShell launchers
@@ -86,7 +87,7 @@ require a Windows run. It cleans its temporary installations even on failure.
86
87
  Set an absolute, private configuration directory **before starting** each process:
87
88
 
88
89
  ```sh
89
- CCL_CONFIG_DIR=/absolute/path/to/isolated-config margay
90
+ CCL_CONFIG_DIR=/absolute/path/to/isolated-config ccl
90
91
  ```
91
92
 
92
93
  `CCL_CONFIG_DIR` takes precedence over the compatible `CLAUDE_CONFIG_DIR` variable.
@@ -114,7 +115,7 @@ need to authenticate separately in its own directory.
114
115
 
115
116
  This describes the local #46 source change; use a candidate/release containing
116
117
  that change before relying on the new HOME-only behavior. The Margay website
117
- account vault uses its own configuration-scoped references, and `margay auth logout`
118
+ account vault uses its own configuration-scoped references, and `ccl auth logout`
118
119
  targets that website account, not the old OAuth Keychain. These tests use an
119
120
  injected fake vault and OAuth receiver; they do not log out a real account.
120
121
 
@@ -229,9 +229,9 @@ CCL 将响应读取中断与用户取消区分处理。半截响应尚未执行
229
229
  恢复诊断包含网关 request ID、底层连接错误及恢复阶段。连续中断会停止自动恢复并返回失败,
230
230
  不会无限重试,也不声称修复了 VPN 或网关自身的连接问题。
231
231
 
232
- # 记忆提取未完成的提示
232
+ # 记忆提取未完成的诊断日志
233
233
 
234
- 以下提示适用于 `1.5.1-alpha`;正在运行的旧进程不会因为源码或安装更新而自动采用新提示,需要正常退出后重启。
234
+ 从 `1.5.1-alpha.5` 起,后台记忆提取的失败、恢复和退出等待超时只进入现有调试日志,不再写入普通会话消息或默认 CLI/SDK stderr。可通过 `--debug-file <文件>` 保存诊断;用户显式选择 `--debug-to-stderr` 时仍遵循该日志设置。日志是否启用和保留由现有设置决定,不新增默认采集。
235
235
 
236
236
  `Memory extraction did not complete (...); saving is not confirmed` 表示本次提取没有满足完整结束和工具结果确认条件,不能据此宣称这些输入已全部保存。括号里的原因来自实际分支,例如:
237
237
 
@@ -241,8 +241,10 @@ CCL 将响应读取中断与用户取消区分处理。半截响应尚未执行
241
241
  - `output_limit` / `response_not_finished`:最终响应达到输出限制,或没有完整结束。
242
242
  - `system_blocked` / `interrupted` / `runtime_error`:系统阻断、取消中断,或提取处理抛出异常。后者没有足够信息细分时不猜测是网络或权限问题。
243
243
 
244
- 同一失败期间不会重复显示相同原因,出现新的失败类别仍会提示。下一次符合提取条件的正常回合可重试原输入;这不是退出后必定重试的承诺。`Memory extraction checks have resumed` 只说明检查恢复,不说明历史所有信息都已保存;成功写入通知是另一个事件。
244
+ 同一失败期间的固定摘要不重复记录相同原因,出现新的失败类别会追加摘要,已有详细错误日志和原因事件继续保留。下一次符合提取条件的正常回合可重试原输入;这不是退出后必定重试的承诺。日志中的 `Memory extraction checks have resumed` 只说明检查恢复,不说明历史所有信息都已保存;有已确认写入时的成功保存通知保持原行为。
245
245
 
246
- 原因提示不附加任意模型/工具正文、路径或异常文本;现有本地调试日志仍可能包含详细错误,不能把整份日志默认当成可对外公开的材料。此修复不提高预算、不新增全记忆扫描、不改变按需读索引和主题文件,也不使宿主记忆成为可靠业务账本。
246
+ 固定摘要和原因事件不附加任意模型/工具正文、路径或异常文本;现有本地调试日志仍可能包含详细错误,不能把整份日志默认当成可对外公开的材料。静默展示不改变失败判定、未确认输入游标、权限或重试条件,也不提高预算、新增全记忆扫描,或使宿主记忆成为可靠业务账本。
247
+
248
+ 正在运行的旧进程不会因安装更新而自动换用新代码;需要正常退出后重新启动。旧会话中已保存的提示也不会被删除,新版本恢复历史时仍可能显示原有记录。
247
249
 
248
250
  旧 `Memory lookup is incomplete...` 属于已移除的自动发现路径,与这里的提取提示不同。看到旧文本时应区分历史记录重绘与旧进程的新消息,核对实际安装和运行版本,不能靠新源码中没有这句话就判定运行中的进程已更新。
@@ -74,7 +74,7 @@ Start `node dist/cli.js`, then use:
74
74
  | `/gateway status` | Verify saved account; show membership and credit balance |
75
75
  | `/gateway logout` | Remove the saved account locally |
76
76
  | `/gateway doctor` | Diagnose gateway configuration and environment overrides |
77
- | `/login` | Claude OAuth, a separate authentication path |
77
+ | `/login` | Margay website login/registration, the same flow as `/gateway login` |
78
78
 
79
79
  At the first-launch account step, Enter starts website login; S or Esc defers
80
80
  setup. During TUI login, Esc cancels. After an error, Enter or R retries.
@@ -227,7 +227,7 @@ before repeating work that may have side effects. SDK hosts can opt into
227
227
  ## Troubleshooting
228
228
 
229
229
  In the source candidate, headless runs with `CI=1` can authenticate using an
230
- admitted gateway configuration alone. A separate Anthropic API key is not
230
+ admitted gateway configuration alone. A separate direct API key is not
231
231
  required for that route. Missing or rejected gateway credentials still require
232
232
  a valid login or another supported credential source. This fixes a startup
233
233
  failure present in rc.9; it does not change the gateway's 401 handling.
@@ -0,0 +1,38 @@
1
+ # Gateway 视觉能力声明(CCL 1.5.1-alpha.6)
2
+
3
+ CCL `1.5.1-alpha.6` 包含本文的动态能力消费实现;Gateway #28 的契约仍待网关确认与部署联合验证。`1.5.1-alpha.5` 修复了本地图片读取路径,但不包含本文的动态能力消费。
4
+
5
+ ## 返回形式
6
+
7
+ 模型目录 `GET /v1/models` 的每个 `data[i]` 可包含:
8
+
9
+ ```json
10
+ {"id":"selected-model","capabilities":{"vision":true,"version":"catalog-v1"}}
11
+ ```
12
+
13
+ `POST /v1/capabilities/resolve` 顶层 `capabilities` 绑定 `resolved_model`;每个 `eligible_candidates[i].capabilities` 只描述该候选,不能将首候选的值复制给其它候选。`vision` 必须为 JSON 布尔值;`version` 为非空、无控制字符且不超过 256 字符的不透明字符串。可选字段缺失或畸形不使整个路由失效。顶层与首候选布尔值冲突时,当前视觉声明为未知。
14
+
15
+ 实际推理响应使用同一次实际路由的响应头:
16
+
17
+ ```http
18
+ X-Effective-Vision: true
19
+ X-Margay-Served-Model: actual-model
20
+ X-Margay-Served-Deployment: actual-deployment
21
+ X-Margay-Capability-Version: deployment-v2
22
+ ```
23
+
24
+ `X-Effective-Vision` 只接受 `true` 或 `false`;未知时省略。缺少或非法的视觉值、版本、实际模型或部署标识会使这次视觉观察成为未知。现有上下文窗口和最大输出响应头语义不变。
25
+
26
+ ## CLI 如何使用
27
+
28
+ 首请求优先使用当前路由解析声明,否则使用目录声明。实际响应会修正同一会话后续请求的视觉提示;缺失响应头会清除先前支持判断,不退回旧目录的 `true`。模型、账号、网关、路由与选模代际隔离;晚到请求不能覆盖更新的选择。没有路由 context 的旧网关按 main、视觉专员、compactor 等用途隔离声明。
29
+
30
+ 声明由固定枚举文本写入实际模型请求的 system,并进入 token 预算,不复制版本或凭据到提示中。支持声明不是图片已经送达或已经理解的证明;不支持时建议使用已有视觉专员,未知时保持不确定。这里不会自动切换主模型、移除图片或增加权限拦截。
31
+
32
+ 目录读取沿用 5 秒超时;失败后视觉查询按账号短暂退避 30 秒。旧网关无此接口或无字段时,普通对话仍可继续。视觉状态仅存在于当前进程内,不持久化旧能力判断。
33
+
34
+ ## 验证边界
35
+
36
+ `gateway-vision-capabilities` 和 `gateway-vision-contract` 用例验证解析、隔离、晚到结果、预算及双协议专员;`gateway-vision-request` 验证实际 HTTP 请求与模型覆盖;`gateway-vision-cli` 用构建后的 CLI 验证 resolve → 会话 → 请求头/提示透传、后续响应修正、切换模型和旧网关/目录超时。
37
+
38
+ 受控字段代理连接真实模型的读图试验,分别验证主模型直接读图、主模型调用视觉专员和能力未知时的行为。代理注入的声明只证明客户端消费链,不能作为网关已经按本契约返回真实部署能力的证据。联合验收应使用部署后的网关重复这些场景,再确认发布版本。
@@ -0,0 +1,35 @@
1
+ # 1.5.1-alpha.5
2
+
3
+ 本预发布版在 [1.5.1-alpha.4](1.5.1-alpha.4.md) 基础上交付 CCL 产品文案清理、并行 Skill 正文恢复,以及图片本地校验和读取说明修复。发布后可安装指定版本:
4
+
5
+ ```bash
6
+ npm install -g @margay/ccl-core@1.5.1-alpha.5
7
+ ```
8
+
9
+ 使用 `alpha` 标签分发,`latest` 保持不变。SDK/桌面宿主需升级实际嵌入的 CLI 与 SDK 依赖;全局安装不会自动替换宿主内置版本。已运行的会话和 daemon 不会因安装自动重启。
10
+
11
+ ## 产品文案与 tips
12
+
13
+ 清理界面、帮助、提示和错误信息中的上游产品推广,替换为 CCL 用语及 12 条自定义 tips。实际使用中的模型名称、兼容协议/API 标识、用户内容及法律归属按其用途保留。更新不改写既有会话文本。
14
+
15
+ ## 并行 Skill 正文恢复(#61)
16
+
17
+ 恢复会话时,保留同一并行响应中已经持久化、且关联来源有效的 Skill 方法正文,避免只恢复“加载成功”的工具结果却漏掉正文。恢复逻辑检查来源和分支范围,不把普通工具返回或无关旁支提升为技能正文。
18
+
19
+ 修复位于共享读取恢复链,适用于原生 resume/fork 消费者;宿主无需另建正文持久化器。不会改写历史、重新执行工具或重放权限,也无法恢复中断前从未持久化的内容。验证覆盖真实 writer 的不同落盘断点、并行交错、重复恢复、resume/fork 及真实模型对恢复规则的消费。
20
+
21
+ ## 图片读取与视觉分工(#62,部分交付)
22
+
23
+ Read 对支持的图片格式执行本地元数据与像素解码校验;损坏或不支持的输入在本地明确失败。成功结果保留图片内容,并附本地读取回执。读取成功不代表网关已把原图交给模型,也不代表当前主模型能够理解图片。
24
+
25
+ 移除 Read 说明中无条件宣称主模型具有视觉能力的表述,协调 `visual-ui-analysis` 的适用说明。专员成功路径不要求先出现图片错误,也不要求先将 PNG 转为 JPEG。既有网关诊断继续区分本地读取、模型/路由与适配失败;HTTP 200 不能单独作为视觉成功证据。
26
+
27
+ 验证包含真实直接附件视觉请求、专员路径与专员不可用场景,以及 CLI/SDK 的拒绝、空结果和诊断传播。先前真实模型错误归因的失败记录保留,后续成功不证明所有模型都稳定遵循只读要求或不会绕路。
28
+
29
+ 所选模型/部署的版本化视觉能力声明,以及 CCL 的能力接收、模型或路由变化后的刷新,仍待 [网关 #28](https://github.com/YW1975/margay-gateway/issues/28) 契约落地和接入。本版不宣称整体 #62 已解决;能力未知时不按模型名猜测支持情况,也不自动替换用户主模型。
30
+
31
+ ## 兼容与回退
32
+
33
+ 后台记忆提取的失败、恢复和退出等待超时改为现有调试日志,不再显示普通会话警告或写入默认 CLI/SDK stderr;可用 `--debug-file <文件>` 查看原因,显式 `--debug-to-stderr` 仍按用户设置输出。失败输入继续保留供后续符合条件的回合重试,不将未确认保存改判为成功;有确认写入时的成功保存通知保持。旧进程需正常退出后重启,历史已有提示不改写。
34
+
35
+ 本版未改变依赖声明、历史记录格式或权限契约。升级后从原宿主继续使用原会话;安装检查不等于宿主已完成升级。需要回退时可安装此前使用的确切版本,回退不会撤销已经发生的业务操作,旧版本也不包含本次恢复与图片说明修复。
@@ -0,0 +1,24 @@
1
+ # 1.5.1-alpha.6
2
+
3
+ 本预发布版在 [1.5.1-alpha.5](1.5.1-alpha.5.md) 基础上接收并使用网关视觉能力声明。使用 `alpha` 标签分发,`latest` 不变。发布后安装指定版本:
4
+
5
+ ```sh
6
+ npm install -g @margay/ccl-core@1.5.1-alpha.6
7
+ ccl --version
8
+ ```
9
+
10
+ ## 视觉能力接入(#62,客户端交付)
11
+
12
+ CCL 从模型目录和路由解析读取版本化视觉声明,再用实际推理响应头刷新后续请求。声明按网关、账号、模型、路由、用途和请求代际隔离,晚到响应不会覆盖新的选择。固定的支持、不支持或未知说明进入模型请求及 token 预算,不按模型名猜测,也不自动更换主模型。
13
+
14
+ 旧网关缺接口、字段缺失或声明非法时保持未知;普通对话继续。目录请求有 5 秒超时,视觉目录失败后退避 30 秒。首次模型校验与视觉目录查询可能分别等待,合计约 10 秒。能力支持不等于图片已送达或已被理解;本地图片校验和视觉专员延续上一版行为。
15
+
16
+ 字段及响应头的完整格式见[网关视觉契约](../gateway-vision-capabilities.md)。客户端已验证受控 HTTP 链路及连接真实模型的字段代理;网关真实部署仍须联合验收。本版不宣称网关 #28 已上线,也不据此关闭整体 #62。
17
+
18
+ ## 命令归属与兼容
19
+
20
+ 本包从此版起只提供 `ccl`,版本输出标识为 `CCL`。旧版 `margay` 别名退出本包;后续独立的 `@margay/cli` 提供 `margay`,属于 1.8 cleanhouse 产品线,不包含在本次安装中。
21
+
22
+ 已有双入口版本应先升级 CCL,再安装独立 Margay 包。不要用 `--force` 覆盖未知命令;先检查 `type -a ccl margay`,备份并调整自己创建的旧包装脚本。CCL 的原配置、凭据、会话与 SDK 包名保持不变。旧脚本调用 CCL 时应改用 `ccl`。
23
+
24
+ SDK/桌面宿主需升级实际嵌入的 CLI 与 SDK;全局安装不会替换宿主内置版本。运行中的会话和 daemon 需正常退出后重启。回退可安装此前确切版本,但旧版双入口会与独立 Margay 命令冲突;两包并存时先处理命令归属,不覆盖另一产品。回退不会撤销已发生的业务操作。
@@ -17,7 +17,7 @@ The spool is `analytics-spool-v1.json` in the same private config directory as t
17
17
 
18
18
  Only an exact authenticated durable-acceptance ACK deletes sent records. Lost ACKs preserve event ID/time/body across restart. Retry delay persists and caps at five minutes; permanent schema/auth rejections are counted and removed. Status reports pending count and expired/overflow/identity/disabled/rejected drops. The session loop sends on startup and every ten seconds, with a three-second request budget and up to one second of shutdown waiting. Full-batch immediate dispatch will be connected with the feature lifecycle registry; it is not present yet. Concurrent CLI processes share the lock, and the gateway deduplicates concurrent/replayed event IDs.
19
19
 
20
- Legacy GrowthBook/Datadog/1P and other legacy background traffic remain suppressed by `CCL_DISABLE_LEGACY_NONESSENTIAL_TRAFFIC`. The CLI no longer overwrites the user's explicit NONESSENTIAL setting. `isClientTelemetryDisabled` checks the original user privacy signals; the old privacy helpers continue suppressing old routes. Optional Anthropic preconnect and official-registry fetch now honor that boundary as well.
20
+ Legacy GrowthBook/Datadog/1P and other legacy background traffic remain suppressed by `CCL_DISABLE_LEGACY_NONESSENTIAL_TRAFFIC`. The CLI no longer overwrites the user's explicit NONESSENTIAL setting. `isClientTelemetryDisabled` checks the original user privacy signals; the old privacy helpers continue suppressing old routes. Optional direct API preconnect and upstream registry fetch now honor that boundary as well.
21
21
 
22
22
  ## Querying analytics
23
23
 
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@margay/ccl-core",
3
- "version": "1.5.1-alpha.4",
4
- "description": "Core runtime extracted from Claude Code (ccl) for Margay integration",
3
+ "version": "1.5.1-alpha.6",
4
+ "description": "CCL agent runtime for Margay integration",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",
7
7
  "bin": {
8
- "ccl": "dist/cli.js",
9
- "margay": "dist/cli.js"
8
+ "ccl": "dist/cli.js"
10
9
  },
11
10
  "files": [
12
11
  "dist/cli.js",
@@ -56,7 +55,10 @@
56
55
  "docs/releases/1.5.1-alpha.1.md",
57
56
  "docs/releases/1.5.1-alpha.2.md",
58
57
  "docs/releases/1.5.1-alpha.3.md",
59
- "docs/releases/1.5.1-alpha.4.md"
58
+ "docs/releases/1.5.1-alpha.4.md",
59
+ "docs/releases/1.5.1-alpha.5.md",
60
+ "docs/releases/1.5.1-alpha.6.md",
61
+ "docs/gateway-vision-capabilities.md"
60
62
  ],
61
63
  "engines": {
62
64
  "node": ">=22.19.0"
package/sdk/API.md CHANGED
@@ -336,7 +336,7 @@ for await (const event of result) { /* 消费实际结果 */ }
336
336
  ## 7. Provider 配置(双引擎)
337
337
 
338
338
  ```ts
339
- // Anthropic 协议端点(Claude 客户 / 任何 Anthropic-protocol 网关)
339
+ // Messages API 端点(直连服务或兼容网关)
340
340
  provider: { type: 'anthropic', baseUrl?: string, apiKey?: string }
341
341
  // → 映射 --base-url / --api-key
342
342
 
@@ -347,7 +347,7 @@ provider: { type: 'openai-compatible', baseUrl: string, apiKey?: string }
347
347
 
348
348
  - `openai-compatible` 的 `baseUrl` 指向 **CCL/margay 网关**(litellm 类,前置 OpenAI 兼容上游);网关负责 tool-calling 归一化,对不支持原生 function calling 的模型**显式报错**而非静默劣化。
349
349
  - 省略 `provider` 时继承 CLI 自身配置(`~/.ccl/gateway.json` 等)。
350
- - margay 双引擎互换:同一调用 seam 下,ccl-sdk 与 Anthropic Agent SDK 的 `query()`/`canUseTool`/resume 形状对齐,切换引擎不改业务代码结构。
350
+ - margay 双引擎互换:同一调用 seam 下,ccl-sdk 与兼容 Agent SDK 的 `query()`/`canUseTool`/resume 形状对齐,切换引擎不改业务代码结构。
351
351
 
352
352
  ---
353
353
 
@@ -475,7 +475,7 @@ for await (const ev of query('写一段', { includePartialMessages: true })) {
475
475
  }
476
476
  }
477
477
  ```
478
- - 默认关。开后收 `{ type:'stream_event', event }`(Anthropic raw:content_block_delta/text_delta 等);整块 `assistant_text` 仍并存。
478
+ - 默认关。开后收 `{ type:'stream_event', event }`(原始 Messages API 事件:content_block_delta/text_delta 等);整块 `assistant_text` 仍并存。
479
479
 
480
480
  ### 13.3 结构化输出 jsonSchema(G4)
481
481
  ```ts
package/sdk/README.md CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  Programmatic, headless, no-TTY entry to a CCL agent session, for hosts like
4
4
  margay that need a resident (7×24) agent brain with code-level tool
5
- interception. The interface shape mirrors the Anthropic Claude Agent SDK
6
- (`query()` + `canUseTool` + session resume) so a host can keep one call seam
7
- and swap engines.
5
+ interception. It exposes `query()`, `canUseTool`, and session resume for
6
+ streaming responses, host-controlled tool permissions, and continuing sessions.
8
7
 
9
8
  ## Usage
10
9
 
@@ -116,8 +115,7 @@ The SDK is the **host side** of the stream-json control protocol that
116
115
  CLI as a **managed subprocess** (`--print --input-format stream-json
117
116
  --output-format stream-json`, all-pipe stdio, no TTY), which keeps every CLI
118
117
  behavior — tools, skills, hooks, session persistence, gateway/model routing —
119
- byte-identical between CLI and SDK use. This matches how the Anthropic Agent
120
- SDK wraps Claude Code.
118
+ consistent between CLI and SDK use.
121
119
 
122
120
  Permission flow (`canUseTool` set ⇒ `--permission-prompt-tool stdio`):
123
121
 
@@ -143,7 +141,7 @@ session continues). Wire schemas live in
143
141
  | P0-2 fail-closed (throw / timeout / unrecognized ⇒ deny, tool never runs) | **done**, unit-tested |
144
142
  | P0-2 `pending` + suspend + cross-process resume | **done** — see mechanism below; `resumeWithDecision(sessionId, {behavior})` |
145
143
  | P0-3 session persistence + `resume(session_id)` | **done** — transcripts via the CLI's store (`--session-id`/`--resume`); SDK-level state (pending approvals, usage) via the pluggable `SessionStore` (file reference impl; Redis/DB implement the same 6-method interface) |
146
- | P0-4 provider layer (Anthropic + OpenAI-compatible) | **done at the SDK seam** — `provider: {type:'anthropic'}` → `--base-url`/`--api-key`; `{type:'openai-compatible'}` → CCL gateway channel (`CCL_GATEWAY_URL`/`KEY`), which normalizes tool-calling and rejects non-function-calling models explicitly. Mapping unit-tested; live two-provider round-trip belongs to the DoD slice (CoS side provides mock endpoints per the issue). |
144
+ | P0-4 provider layer (Messages API + OpenAI-compatible) | **done at the SDK seam** — `provider: {type:'anthropic'}` → `--base-url`/`--api-key`; `{type:'openai-compatible'}` → CCL gateway channel (`CCL_GATEWAY_URL`/`KEY`), which normalizes tool-calling and rejects non-function-calling models explicitly. Mapping unit-tested; live two-provider round-trip belongs to the DoD slice (CoS side provides mock endpoints per the issue). |
147
145
  | P1-5 explicit `skills_dirs` | **done** — each dir is wrapped as an ephemeral plugin (skills symlink) and loaded via `--plugin-dir`, the CLI's cwd-independent skill channel; missing dirs fail loudly |
148
146
  | P1-6 hooks (`on_tool_use`/`on_turn_end`/`on_session_end`) | **done** — observability-only contract: hook errors are swallowed, never affect control flow |
149
147
  | P1-7 usage in `result` event + per-session accumulation | **done** — provider-raw `usage` + `total_cost_usd` on every result; accumulated per session in the store, queryable via `getSessionUsage(sessionId)` |
@@ -199,7 +197,7 @@ that mode's available set; an explicit incompatible selection such as
199
197
  still apply; `--allowedTools` does not add tools to the available set.
200
198
 
201
199
  Use `extraArgs: ['--thinking', 'disabled']` to explicitly disable thinking on
202
- Anthropic Messages compatible routes. Omitting the option retains the route's
200
+ Messages API compatible routes. Omitting the option retains the route's
203
201
  default. The selection persists across requests; a query handle's
204
202
  `setMaxThinkingTokens(0)` explicitly disables it, and `null` restores the default.
205
203
  # Persistent sessions and streamed input