@fitlab-ai/agent-infra 0.9.3 → 0.9.4
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/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/bin/cli.ts +12 -0
- package/dist/bin/cli.js +14 -0
- package/dist/bin/internal-cli.js +134 -123
- package/dist/lib/agent-clients/adapter.js +92 -2
- package/dist/lib/{sandbox/credentials.js → agent-clients/adapters/claude-code-credentials.js} +4 -14
- package/dist/lib/agent-clients/adapters/claude-code-refresh.js +85 -0
- package/dist/lib/agent-clients/adapters/claude-code-sandbox.js +247 -0
- package/dist/lib/agent-clients/adapters/claude-code.js +17 -3
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +108 -0
- package/dist/lib/agent-clients/adapters/opencode.js +15 -3
- package/dist/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/dist/lib/agent-clients/registry.js +9 -1
- package/dist/lib/internal/sandbox-control.js +24 -0
- package/dist/lib/internal/task-activity.js +45 -13
- package/dist/lib/internal/task-ledger.js +12 -3
- package/dist/lib/internal/task-lifecycle.js +19 -1
- package/dist/lib/internal/task-orchestration.js +122 -18
- package/dist/lib/platform/github-client.js +19 -2
- package/dist/lib/platform/pr-checks.js +1 -1
- package/dist/lib/platform/pull-requests.js +47 -1
- package/dist/lib/platform/releases.js +13 -5
- package/dist/lib/process-data/index.js +239 -0
- package/dist/lib/process-data/normalize.js +198 -0
- package/dist/lib/process-data/privacy.js +33 -0
- package/dist/lib/process-data/reconcile.js +95 -0
- package/dist/lib/process-data/repair.js +58 -0
- package/dist/lib/process-data/sources.js +345 -0
- package/dist/lib/process-data/store.js +282 -0
- package/dist/lib/process-data/types.js +2 -0
- package/dist/lib/run/index.js +4 -3
- package/dist/lib/run/tui.js +7 -8
- package/dist/lib/sandbox/agent-client-reconciler.js +26 -2
- package/dist/lib/sandbox/capture.js +7 -2
- package/dist/lib/sandbox/commands/create.js +109 -228
- package/dist/lib/sandbox/commands/enter.js +15 -47
- package/dist/lib/sandbox/commands/list-running.js +16 -6
- package/dist/lib/sandbox/commands/ls.js +10 -6
- package/dist/lib/sandbox/commands/rebuild.js +4 -3
- package/dist/lib/sandbox/commands/refresh.js +4 -84
- package/dist/lib/sandbox/commands/rm.js +24 -3
- package/dist/lib/sandbox/commands/show.js +12 -3
- package/dist/lib/sandbox/commands/start.js +7 -4
- package/dist/lib/sandbox/config.js +2 -0
- package/dist/lib/sandbox/constants.js +6 -0
- package/dist/lib/sandbox/control/client.js +44 -0
- package/dist/lib/sandbox/control/protocol.js +35 -0
- package/dist/lib/sandbox/control/server.js +109 -0
- package/dist/lib/sandbox/dockerfile.js +36 -13
- package/dist/lib/sandbox/mounts.js +17 -4
- package/dist/lib/sandbox/recovery.js +128 -5
- package/dist/lib/sandbox/redaction.js +12 -0
- package/dist/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/dist/lib/sandbox/workspace-identity.js +95 -0
- package/dist/lib/sandbox/workspace-view.js +103 -0
- package/dist/lib/task/activity-intent.js +257 -51
- package/dist/lib/task/commit-finalization.js +267 -0
- package/dist/lib/task/commit-intent.js +165 -0
- package/dist/lib/task/decision-intents.js +31 -17
- package/dist/lib/task/delegation-receipts.js +2 -2
- package/dist/lib/task/implementation-inputs.js +54 -7
- package/dist/lib/task/ledger-intents.js +35 -1
- package/dist/lib/task/orchestration.js +363 -28
- package/dist/lib/task/resolve-ref.js +41 -1
- package/lib/agent-clients/adapter.ts +126 -2
- package/lib/{sandbox/credentials.ts → agent-clients/adapters/claude-code-credentials.ts} +3 -18
- package/lib/agent-clients/adapters/claude-code-refresh.ts +128 -0
- package/lib/agent-clients/adapters/claude-code-sandbox.ts +295 -0
- package/lib/agent-clients/adapters/claude-code.ts +21 -3
- package/lib/agent-clients/adapters/opencode-sandbox.ts +136 -0
- package/lib/agent-clients/adapters/opencode.ts +18 -3
- package/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
- package/lib/agent-clients/registry.ts +9 -1
- package/lib/internal/sandbox-control.ts +24 -0
- package/lib/internal/task-activity.ts +50 -14
- package/lib/internal/task-ledger.ts +12 -3
- package/lib/internal/task-lifecycle.ts +22 -1
- package/lib/internal/task-orchestration.ts +81 -11
- package/lib/platform/github-client.ts +20 -2
- package/lib/platform/pr-checks.ts +1 -1
- package/lib/platform/pull-requests.ts +49 -1
- package/lib/platform/releases.ts +16 -4
- package/lib/process-data/index.ts +224 -0
- package/lib/process-data/normalize.ts +202 -0
- package/lib/process-data/privacy.ts +41 -0
- package/lib/process-data/reconcile.ts +110 -0
- package/lib/process-data/repair.ts +64 -0
- package/lib/process-data/sources.ts +354 -0
- package/lib/process-data/store.ts +315 -0
- package/lib/process-data/types.ts +135 -0
- package/lib/run/index.ts +5 -3
- package/lib/run/tui.ts +11 -8
- package/lib/sandbox/agent-client-reconciler.ts +44 -2
- package/lib/sandbox/capture.ts +9 -2
- package/lib/sandbox/commands/create.ts +126 -260
- package/lib/sandbox/commands/enter.ts +13 -59
- package/lib/sandbox/commands/list-running.ts +23 -6
- package/lib/sandbox/commands/ls.ts +22 -6
- package/lib/sandbox/commands/rebuild.ts +4 -3
- package/lib/sandbox/commands/refresh.ts +4 -126
- package/lib/sandbox/commands/rm.ts +24 -3
- package/lib/sandbox/commands/show.ts +29 -3
- package/lib/sandbox/commands/start.ts +6 -4
- package/lib/sandbox/config.ts +4 -0
- package/lib/sandbox/constants.ts +8 -0
- package/lib/sandbox/control/client.ts +55 -0
- package/lib/sandbox/control/protocol.ts +75 -0
- package/lib/sandbox/control/server.ts +117 -0
- package/lib/sandbox/dockerfile.ts +66 -13
- package/lib/sandbox/mounts.ts +24 -4
- package/lib/sandbox/recovery.ts +163 -6
- package/lib/sandbox/redaction.ts +14 -0
- package/lib/sandbox/runtimes/base.dockerfile +24 -74
- package/lib/sandbox/tool-types.ts +16 -0
- package/lib/sandbox/workspace-identity.ts +123 -0
- package/lib/sandbox/workspace-view.ts +143 -0
- package/lib/task/activity-intent.ts +350 -61
- package/lib/task/commit-finalization.ts +356 -0
- package/lib/task/commit-intent.ts +230 -0
- package/lib/task/decision-intents.ts +32 -12
- package/lib/task/delegation-receipts.ts +2 -2
- package/lib/task/implementation-inputs.ts +62 -8
- package/lib/task/ledger-intents.ts +43 -3
- package/lib/task/orchestration.ts +501 -33
- package/lib/task/resolve-ref.ts +46 -1
- package/package.json +1 -1
- package/templates/.agents/rules/README.en.md +1 -1
- package/templates/.agents/rules/README.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +11 -2
- package/templates/.agents/rules/human-decision-context.zh-CN.md +11 -2
- package/templates/.agents/rules/pr-checks-commands.en.md +1 -1
- package/templates/.agents/rules/pr-checks-commands.github.en.md +1 -1
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/task-management.en.md +2 -0
- package/templates/.agents/rules/task-management.zh-CN.md +2 -0
- package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/SKILL.en.md +21 -11
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +27 -11
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +49 -0
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +55 -0
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +4 -4
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +4 -4
- package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/create-task/reference/context-capture.en.md +34 -0
- package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +34 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
- package/templates/.agents/skills/review-pr/SKILL.en.md +36 -8
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +36 -8
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +1 -1
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +67 -50
- package/templates/.agents/skills/watch-pr/SKILL.en.md +4 -4
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.claude/rules/tool-preferences.en.md +20 -0
- package/templates/.claude/rules/tool-preferences.zh-CN.md +20 -0
- package/templates/.opencode/commands/watch-pr.en.md +1 -1
- package/templates/.opencode/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.gemini/commands/_project_/review-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +0 -10
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: watch-pr
|
|
3
3
|
description: >
|
|
4
|
-
Watch PR readiness and self-heal
|
|
4
|
+
Watch PR readiness and self-heal any check failure or merge conflict.
|
|
5
5
|
Use when a PR must be monitored until checks pass and it is explicitly mergeable.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Watch Pull Request
|
|
9
9
|
|
|
10
|
-
After `create-pr`, continuously watch
|
|
10
|
+
After `create-pr`, continuously watch all checks and mergeability for the same PR head. Only all passed checks plus explicit mergeability may reach success; check failures use the existing repair path, conflicts use constrained rebase healing, and unknown or unsafe states fail closed.
|
|
11
11
|
|
|
12
12
|
## Behavior Boundaries / Key Rules
|
|
13
13
|
|
|
14
|
-
- Only self-heal the current PR's
|
|
14
|
+
- Only self-heal the current PR's full check set and text merge conflicts; do not add approval or repository-rule readiness dimensions.
|
|
15
15
|
- Self-heal publishes through Git workflow intents, but **affected tests must pass first**; the attempt cap and code-layer authorization remain unchanged.
|
|
16
16
|
- The help exit is "produce-then-stop": end this round, output the blocker explanation, and wait for the user to trigger the next step — **never** ask mid-flow.
|
|
17
17
|
- Bare numbers / `NN` / `TASK-id` arguments are always resolved as task short ids (see `.agents/rules/task-short-id.md`); a PR number is passed only via `--pr <number>` / a PR URL / omission (current branch), never reusing the bare-number syntax.
|
|
@@ -104,7 +104,7 @@ Keep the gate output in your reply as the verification evidence. Without current
|
|
|
104
104
|
> Before rendering next steps, read `.agents/rules/next-step-output.md`, invoke the shared helper only for the selected scenario, and insert its stdout at `{next-step-commands}`.
|
|
105
105
|
|
|
106
106
|
Output per scenario:
|
|
107
|
-
- `ready` + task-anchored: state that
|
|
107
|
+
- `ready` + task-anchored: state that all checks passed and the current head is explicitly mergeable, then render exactly one exit based on whether this run created repair commits (`{task-ref}` becomes the short id):
|
|
108
108
|
|
|
109
109
|
`repairCommits.length == 0`:
|
|
110
110
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: watch-pr
|
|
3
3
|
description: >
|
|
4
|
-
监控 PR readiness
|
|
4
|
+
监控 PR readiness,并在任一 check 失败或合并冲突时自愈。
|
|
5
5
|
当需要持续监控 PR 直到门禁通过且明确可合入时使用。
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 监控 Pull Request
|
|
9
9
|
|
|
10
|
-
在 `create-pr` 之后持续监控同一 PR head
|
|
10
|
+
在 `create-pr` 之后持续监控同一 PR head 的全部 checks 与 mergeability。只有全部 checks 通过且平台明确可合入才进入成功出口;check 失败走既有修复,合并冲突走受限 rebase 自愈,未知或无法安全闭环时 fail-closed。
|
|
11
11
|
|
|
12
12
|
## 行为边界 / 关键规则
|
|
13
13
|
|
|
14
|
-
- 仅监控 + 自愈当前 PR
|
|
14
|
+
- 仅监控 + 自愈当前 PR 的全部 checks 与文本合并冲突;不扩展到审批或其他仓库规则。
|
|
15
15
|
- 自愈通过 Git workflow intent 发布修复,但**发布前必须本地跑通相关测试**;修复上限与代码层分类授权不变。
|
|
16
16
|
- 求助出口是「产出后停止」语义:停止本轮、输出阻塞说明、等待用户主动触发,**不**中途提问。
|
|
17
17
|
- 裸数字 / `NN` / `TASK-id` 入参一律按任务短号解析(见 `.agents/rules/task-short-id.md`);PR 号只走 `--pr <number>` / PR URL / 省略(当前分支),不复用裸数字语法。
|
|
@@ -104,7 +104,7 @@ agent-infra-internal task-verify {task-id} watch-pr.completed --format text
|
|
|
104
104
|
> 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
|
|
105
105
|
|
|
106
106
|
按场景输出:
|
|
107
|
-
- `ready` +
|
|
107
|
+
- `ready` + 任务锚定:说明全部 checks 已通过且当前 head 明确可合入,并只按本轮是否产生修复 commit 渲染一个出口(`{task-ref}` 替换为短号):
|
|
108
108
|
|
|
109
109
|
`repairCommits.length == 0`:
|
|
110
110
|
|
|
@@ -6,8 +6,8 @@ Platform-agnostic decision logic for `watch-pr` steps 2/3/4. The concrete platfo
|
|
|
6
6
|
|
|
7
7
|
After the watch command, route by structured `readiness.state`:
|
|
8
8
|
|
|
9
|
-
- `ready`:
|
|
10
|
-
- `checks-failed`: a
|
|
9
|
+
- `ready`: all checks passed and the same head is explicitly mergeable → SKILL step 7.
|
|
10
|
+
- `checks-failed`: a check failed or was cancelled → CI healing in SKILL step 3.
|
|
11
11
|
- `conflicting`: the platform explicitly reports a head/base conflict → rebase healing in SKILL step 3.
|
|
12
12
|
- `pending|timed-out|cancelled`: no reliable success fact exists → SKILL step 4.
|
|
13
13
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
按 `.agents/rules/pr-checks-commands.md` 的监控命令执行后,依其退出码归为三类:
|
|
8
8
|
|
|
9
|
-
- `ready`:同一 head
|
|
10
|
-
- `checks-failed`:至少一个
|
|
9
|
+
- `ready`:同一 head 的全部 checks 通过且平台明确可合入 → SKILL 步骤 7。
|
|
10
|
+
- `checks-failed`:至少一个 check 失败或取消 → SKILL 步骤 3 的 CI 自愈。
|
|
11
11
|
- `conflicting`:平台明确当前 head 与 base 冲突 → SKILL 步骤 3 的 rebase 自愈。
|
|
12
12
|
- `pending|timed-out|cancelled`:mergeability/checks 未形成可靠成功事实 → SKILL 步骤 4。
|
|
13
13
|
|
|
@@ -80,7 +80,7 @@ pr_status: pending # PR status: pending (default) | created (PR crea
|
|
|
80
80
|
|
|
81
81
|
## Human Rulings
|
|
82
82
|
|
|
83
|
-
<!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; code
|
|
83
|
+
<!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; upstream AI predeclares implementation intent for new code decisions, while the explicit option remains for legacy tasks or consistency checks. -->
|
|
84
84
|
|
|
85
85
|
## Implementation Inputs
|
|
86
86
|
|
|
@@ -80,7 +80,7 @@ pr_status: pending # PR 状态:pending(默认)| created(已
|
|
|
80
80
|
|
|
81
81
|
## 人工裁决
|
|
82
82
|
|
|
83
|
-
<!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision
|
|
83
|
+
<!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;新建 code 裁决的实现意图由上游 AI 预先声明,显式参数仅用于历史任务兼容或一致性复核。 -->
|
|
84
84
|
|
|
85
85
|
## 实现输入
|
|
86
86
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Claude Code - Tool Preferences
|
|
2
|
+
|
|
3
|
+
## Preferred tools
|
|
4
|
+
|
|
5
|
+
| Operation | Prefer | Avoid |
|
|
6
|
+
|-----------|--------|-------|
|
|
7
|
+
| Find files | `Glob` | `find`, `ls` |
|
|
8
|
+
| Search content | `Grep` | `grep`, `rg` |
|
|
9
|
+
| Read files | `Read` | `cat`, `head`, `tail` |
|
|
10
|
+
| Edit files | `Edit` | `sed`, `awk` |
|
|
11
|
+
| Create files | `Write` | `echo >`, `cat <<EOF` |
|
|
12
|
+
|
|
13
|
+
Use **Bash only** for Git operations, builds/tests, and system information.
|
|
14
|
+
|
|
15
|
+
## Slash Commands
|
|
16
|
+
|
|
17
|
+
Commands are discovered automatically from `.claude/commands/`. Type `/` at the prompt to view the complete list and descriptions.
|
|
18
|
+
|
|
19
|
+
A typical task workflow is:
|
|
20
|
+
`/create-task` -> `/analyze-task` -> `/plan-task` -> `/code-task` -> `/review-code` -> `/complete-task`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Claude Code - 工具偏好
|
|
2
|
+
|
|
3
|
+
## 工具使用偏好
|
|
4
|
+
|
|
5
|
+
| 操作 | 推荐 | 不推荐 |
|
|
6
|
+
|------|------|--------|
|
|
7
|
+
| 文件搜索 | `Glob` | `find`、`ls` |
|
|
8
|
+
| 内容搜索 | `Grep` | `grep`、`rg` |
|
|
9
|
+
| 读取文件 | `Read` | `cat`、`head`、`tail` |
|
|
10
|
+
| 编辑文件 | `Edit` | `sed`、`awk` |
|
|
11
|
+
| 创建文件 | `Write` | `echo >`、`cat <<EOF` |
|
|
12
|
+
|
|
13
|
+
**Bash 仅用于**:Git 操作、构建/测试、系统信息查询
|
|
14
|
+
|
|
15
|
+
## Slash Commands
|
|
16
|
+
|
|
17
|
+
可用命令从 `.claude/commands/` 自动发现。在提示符中输入 `/` 查看完整列表和描述。
|
|
18
|
+
|
|
19
|
+
任务工作流的典型顺序:
|
|
20
|
+
`/create-task` -> `/analyze-task` -> `/plan-task` -> `/code-task` -> `/review-code` -> `/complete-task`
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
description = "Review a pull request by evidence grade and publish a formal review"
|
|
2
|
-
prompt = """
|
|
3
|
-
Review pull request {{args}}.
|
|
4
|
-
|
|
5
|
-
The PR number may be given with `--pr <number>`, via a PR URL, or by reverse lookup from the current branch when omitted.
|
|
6
|
-
|
|
7
|
-
Read and execute the review-pr skill from `.agents/skills/review-pr/SKILL.md`.
|
|
8
|
-
|
|
9
|
-
Follow all steps defined in the skill exactly.
|
|
10
|
-
"""
|