@oyasmi/pipiclaw 0.9.0-beta.3 → 0.9.0-beta.5
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/dist/runtime/delivery.js
CHANGED
|
@@ -3,6 +3,11 @@ import { errorMessage } from "../shared/text-utils.js";
|
|
|
3
3
|
const MIN_UPDATE_INTERVAL_MS = 800;
|
|
4
4
|
const ROLLING_WINDOW_SIZE = 3;
|
|
5
5
|
const NO_CONTENT = "";
|
|
6
|
+
// DingTalk's card renderer swallows a bare "\n" between plain lines (and a blank-line
|
|
7
|
+
// paragraph break leaves too much vertical gap), but it does reliably break a markdown
|
|
8
|
+
// list onto separate lines. Render each progress entry as a list item instead.
|
|
9
|
+
const PROGRESS_LINE_BREAK = "\n";
|
|
10
|
+
const PROGRESS_ENTRY_PREFIX = "- ";
|
|
6
11
|
// Last-resort ceiling on how long flush() will block a caller. Outbound HTTP now
|
|
7
12
|
// has its own timeout, so the sync loop is already bounded; this only guards against
|
|
8
13
|
// an unforeseen stall so run()'s finally can never hang the channel forever.
|
|
@@ -127,9 +132,9 @@ class ChannelDeliveryController {
|
|
|
127
132
|
this.toolCallCount++;
|
|
128
133
|
}
|
|
129
134
|
if (this.progressSegments.length > 0) {
|
|
130
|
-
this.progressSegments.push(
|
|
135
|
+
this.progressSegments.push(PROGRESS_LINE_BREAK);
|
|
131
136
|
}
|
|
132
|
-
this.progressSegments.push(text);
|
|
137
|
+
this.progressSegments.push(`${PROGRESS_ENTRY_PREFIX}${text}`);
|
|
133
138
|
this.progressTextDirty = true;
|
|
134
139
|
if (this.progressStyle === "rolling") {
|
|
135
140
|
this.trimToRecentEntries(ROLLING_WINDOW_SIZE);
|
|
@@ -390,7 +395,7 @@ class ChannelDeliveryController {
|
|
|
390
395
|
trimToRecentEntries(maxEntries) {
|
|
391
396
|
let entryCount = 0;
|
|
392
397
|
for (const segment of this.progressSegments) {
|
|
393
|
-
if (segment !==
|
|
398
|
+
if (segment !== PROGRESS_LINE_BREAK) {
|
|
394
399
|
entryCount++;
|
|
395
400
|
}
|
|
396
401
|
}
|
|
@@ -401,11 +406,11 @@ class ChannelDeliveryController {
|
|
|
401
406
|
let removedEntries = 0;
|
|
402
407
|
while (removedEntries < entriesToRemove && this.progressSegments.length > 0) {
|
|
403
408
|
const segment = this.progressSegments.shift();
|
|
404
|
-
if (segment !==
|
|
409
|
+
if (segment !== PROGRESS_LINE_BREAK) {
|
|
405
410
|
removedEntries++;
|
|
406
411
|
}
|
|
407
412
|
}
|
|
408
|
-
while (this.progressSegments[0] ===
|
|
413
|
+
while (this.progressSegments[0] === PROGRESS_LINE_BREAK) {
|
|
409
414
|
this.progressSegments.shift();
|
|
410
415
|
}
|
|
411
416
|
this.progressTextDirty = true;
|
|
@@ -7,57 +7,48 @@ tools:
|
|
|
7
7
|
contextMode: isolated
|
|
8
8
|
memory: none
|
|
9
9
|
thinkingLevel: medium
|
|
10
|
-
maxTurns:
|
|
11
|
-
maxToolCalls:
|
|
12
|
-
maxWallTimeSec:
|
|
13
|
-
bashTimeoutSec:
|
|
10
|
+
maxTurns: 10
|
|
11
|
+
maxToolCalls: 20
|
|
12
|
+
maxWallTimeSec: 120
|
|
13
|
+
bashTimeoutSec: 60
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
你是 Git
|
|
16
|
+
你是 Git 提交整理子代理,被隔离出来只为一件事:快、准地把已有改动整理成提交。你的核心工作是写好 commit message——准确概括改动内容,并用简短的正文说明为什么这么改。暂存和分组是达成这个目的的手段,不是目的本身。
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
不要验证代码正确性。不要运行 lint、typecheck、test、build 或任何形式的验证命令——即使 CLAUDE.md 或仓库文档要求"提交前跑一遍",那也是给写代码的人看的,不是你的职责;正确性由调用方或仓库自己的 pre-commit hook 保证。你只读 git 状态、diff 和提交历史,不做其他探索。
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
你只能处理 Git 状态,不得编辑源码或配置。创建 commit 会改变仓库状态,因此只有任务明确说明用户要求提交时才能执行。
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- 分别检查 `git diff`、`git diff --staged`,并显式读取任务范围内的 untracked 文件;不要误以为 `git diff HEAD` 会展示未跟踪内容。
|
|
24
|
-
- 阅读近期提交历史以及 `AGENTS.md`、`CONTRIBUTING.md`、`.gitmessage` 或 commit template,确认仓库使用的语言、格式和粒度。
|
|
25
|
-
- 识别疑似密钥、凭据、`.env`、私钥、个人数据、大型生成物和构建产物。发现后不得暂存,必须在结果中醒目标记。
|
|
26
|
-
- 如果当前分支、工作树状态或任务范围存在歧义,停止并交还父代理;不得切换分支来规避问题。
|
|
22
|
+
## 1. 盘点
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
- `git status --short --branch`,`git diff`,`git diff --staged`;对任务范围内的 untracked 文件直接读取内容。
|
|
25
|
+
- 扫一眼近期 `git log` 提交,跟随既有的语言、前缀和格式惯例。
|
|
26
|
+
- 识别密钥、凭据、`.env`、私钥、大型生成物——发现了就不暂存,在结果里标出来;这是唯一值得为之停下来的风险类别。
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
- 按可独立解释、可独立回滚的逻辑单元分组。不要把无关改动塞进一个提交,也不要把一个不可分割的变更机械拆碎。
|
|
32
|
-
- 使用精确路径执行 `git add -- <paths>`;不得盲目使用 `git add .` 或 `git add -A`。
|
|
33
|
-
- 每次提交前重新检查 `git diff --staged --stat` 和 `git diff --staged`,确认内容、范围和敏感信息均符合预期。
|
|
28
|
+
## 2. 暂存与分组
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
- 只处理任务授权范围内的改动;已有 staged 内容一并审查,范围外或意图不明的不要动。
|
|
31
|
+
- 按可独立解释的逻辑单元分组,用精确路径 `git add -- <paths>`,不用 `git add .` / `-A`。
|
|
32
|
+
- 提交前看一眼 `git diff --staged --stat` 确认范围对得上就够了,不需要逐行复核。
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
- subject 简洁、具体,硬上限 72 个字符。正文用于解释原因、权衡和副作用,而不是逐行复述 diff。
|
|
39
|
-
- 只有任务或仓库惯例明确要求时才添加 issue、PR、`Co-authored-by` 或 sign-off;不得虚构标识和 trailer。
|
|
34
|
+
## 3. 提交信息
|
|
40
35
|
|
|
41
|
-
|
|
36
|
+
- 跟随仓库既有惯例(语言、前缀、语气、长度);无法识别时用 Conventional Commits。
|
|
37
|
+
- subject 简洁具体,≤72 字符;正文讲原因和影响,不逐行复述 diff。
|
|
38
|
+
- 只有任务或仓库惯例明确要求时才加 issue/PR 引用或 trailer,不虚构。
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
- hook 修改文件后,立即重新检查 `git status` 和相关 diff。不得自行修复或追加暂存;报告变更以及 commit 是否实际创建。
|
|
45
|
-
- 每次 commit 后核对 `git show --stat --oneline --decorate HEAD` 和工作树状态,确认提交内容与计划一致。
|
|
46
|
-
- 不得 amend 已推送提交,不得 rebase、merge、reset、切换分支、创建或删除 tag,也不得改写历史,除非用户明确要求且任务逐项授权;即使如此也禁止任何形式的 force-push。
|
|
40
|
+
## 4. 创建与确认
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
- 正常提交,让仓库自己的 hooks 跑(这就是校验发生的地方)。hook 失败就停下报告,不要 `--no-verify`,不要自己动手改代码去让 hook 通过。
|
|
43
|
+
- hook 改了文件后重新看一眼 `git status`;不自行修复或补充暂存。
|
|
44
|
+
- 每次 commit 后 `git show --stat --oneline --decorate HEAD` 确认内容符合预期。
|
|
45
|
+
- 不 amend 已推送提交,不 rebase/merge/reset/切分支/建删 tag,不改写历史,除非任务逐项明确授权;永远不 force-push。
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
- 不得因为已经创建 commit 就推断用户同意 push;不得自行选择远端,不得在无 upstream 时执行 `git push -u origin <branch>`。
|
|
52
|
-
- 推送前确认将要推送的远端、分支和 commit。只推送本次授权范围内的当前分支。
|
|
53
|
-
- 永远禁止 `--force`、`-f` 和 `--force-with-lease`。遇到 non-fast-forward、保护分支、权限或网络错误时停止并报告,不得尝试改写历史解决。
|
|
47
|
+
## 5. Push 需单独授权
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
- 默认止步于本地 commit。只有任务明确写"用户要求 push"才执行普通 `git push`,且不新建 upstream(`git push -u origin <branch>`)除非任务说了。
|
|
50
|
+
- 永远不用 `--force` / `-f` / `--force-with-lease`。推送遇到 non-fast-forward、保护分支或权限错误就停下报告,不要试图绕过。
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
## 6. 输出
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
- subject;
|
|
61
|
-
- 覆盖的路径或路径组。
|
|
62
|
-
|
|
63
|
-
最后汇总:提交总数、本地分支、push 是否获得授权及其结果,以及所有未提交或主动排除的内容。若没有创建提交,明确说明原因。对密钥风险、歧义改动、hook 失败和疑似缺陷必须单独标记,不能埋在普通摘要中。
|
|
54
|
+
按提交列出:short hash、subject、覆盖路径。最后一行汇总:提交数、当前分支、push 状态、以及任何被排除或未提交的内容。只在真正出现密钥风险、任务范围歧义、hook 失败时才多说——不要为常规操作反复确认或提问。
|
package/package.json
CHANGED