@kairyou/agent-tools 0.21.0 → 0.22.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.
@@ -4,9 +4,6 @@ Advanced guide for [provider usage](../../README.md#provider-usage): write your
4
4
  usage probe for relays the built-in presets cannot reach (e.g. cookie-authenticated
5
5
  gateways) without modifying package code.
6
6
 
7
- Built-in presets, including `commandcode`, are documented in the main
8
- [provider usage](../../README.md#provider-usage) section.
9
-
10
7
  ## Declare a route
11
8
 
12
9
  Write a route module and list it in `providerUsage.routes` (paths resolve against
@@ -6,8 +6,6 @@
6
6
 
7
7
  编写路由模块, 并在 `providerUsage.routes` 里声明(相对 `~/.agent-tools` 解析). 声明的路由优先探测; `"preset"` 填路由 id 可直接选中.
8
8
 
9
- 包括 `commandcode` 在内的内置 preset 见主文档的[Provider usage](../../README.zh-CN.md#provider-usage)章节.
10
-
11
9
  ```jsonc
12
10
  {
13
11
  "providerUsage": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kairyou/agent-tools",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Reusable Agent Skills, plus runtime capabilities (statusline, provider usage, vision) for Codex, Claude Code, and opencode.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -232,6 +232,15 @@ function safeRemoteMessage(body, secrets) {
232
232
  return redactString(message.slice(0, 500), secrets);
233
233
  }
234
234
 
235
+ // ZenTao 经典 action 写操作可能返回 `<html>...</script>\n{...json...}`, 取最后一个 </script> 后的 JSON 重试解析.
236
+ function unwrapHtmlWrappedJson(body) {
237
+ const marker = "</script>";
238
+ if (!body.includes(marker)) return body;
239
+ const idx = body.lastIndexOf(marker);
240
+ const candidate = body.slice(idx + marker.length).trim();
241
+ return candidate || body;
242
+ }
243
+
235
244
  class ZenTaoClient {
236
245
  constructor(config) {
237
246
  this.config = config;
@@ -308,6 +317,14 @@ class ZenTaoClient {
308
317
  try {
309
318
  return JSON.parse(body);
310
319
  } catch {
320
+ const unwrapped = unwrapHtmlWrappedJson(body);
321
+ if (unwrapped !== body) {
322
+ try {
323
+ return JSON.parse(unwrapped);
324
+ } catch {
325
+ // 剥掉包装后仍无效, 走下方统一报错
326
+ }
327
+ }
311
328
  throw new CliError("response_error", "ZenTao returned invalid JSON");
312
329
  }
313
330
  }
@@ -57,7 +57,7 @@ Read `git diff --staged` and generate a Conventional Commits title that explains
57
57
  - **description**: one concise verb-object phrase in the selected natural language. Avoid filler equivalent to "update files", "this commit", "misc changes", or "several changes". Preserve identifiers, function names, file names, package names, commands, and APIs as written.
58
58
  - **single line only**: commit messages always contain only the title line. Do not write a body or footer. Compress necessary WHY into the title.
59
59
  - **breaking changes**: mark with `type(scope)!: description`, still as one line. Do not use a `BREAKING CHANGE` footer.
60
- - **punctuation**: use ASCII punctuation.
60
+ - **punctuation**: use ASCII punctuation throughout the title, including in non-English descriptions. Non-ASCII characters are allowed only in words and identifiers. Normalize localized punctuation before showing or committing the title.
61
61
 
62
62
  ## Generation Strategy
63
63