typeclaw 0.48.4 → 0.48.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.
- package/package.json +1 -1
- package/src/agent/index.ts +6 -1
- package/src/agent/live-subagents.ts +15 -0
- package/src/agent/plugin-tools.ts +1 -1
- package/src/agent/session-origin.ts +104 -16
- package/src/agent/subagent-completion-reminder.ts +1 -1
- package/src/agent/subagent-drain.ts +11 -1
- package/src/agent/subagents.ts +52 -7
- package/src/agent/tools/post-github-review.ts +101 -1
- package/src/agent/tools/spawn-subagent.ts +88 -7
- package/src/agent/tools/subagent-cancel.ts +1 -0
- package/src/agent/tools/subagent-output.ts +7 -2
- package/src/agent/tools/webfetch/adaptive-html.ts +319 -0
- package/src/agent/tools/webfetch/html-lexical.ts +841 -0
- package/src/agent/tools/webfetch/inline-style-visibility.ts +281 -0
- package/src/agent/tools/webfetch/strategies/readability.ts +306 -5
- package/src/agent/tools/webfetch/tool.ts +45 -2
- package/src/agent/tools/webfetch/types.ts +7 -0
- package/src/agent/turn-runner.ts +7 -3
- package/src/bundled-plugins/github-cli-auth/gh-command.ts +187 -8
- package/src/bundled-plugins/memory/dreaming.ts +3 -2
- package/src/bundled-plugins/reviewer/reviewer.ts +32 -5
- package/src/bundled-plugins/reviewer/skills/code-review.ts +5 -3
- package/src/bundled-plugins/reviewer/skills/doc-review.ts +1 -1
- package/src/bundled-plugins/reviewer/skills/plan-review.ts +1 -1
- package/src/channels/github-review-verdict-coordinator.ts +23 -5
- package/src/channels/router.ts +15 -5
- package/src/cli/inspect.ts +2 -2
- package/src/container/start.ts +16 -0
- package/src/git/resolve-identity.ts +66 -0
- package/src/git/run.ts +2 -0
- package/src/git/system-commit.ts +2 -2
- package/src/inspect/item-list.ts +2 -11
- package/src/inspect/session-list.ts +29 -15
- package/src/plugin/types.ts +0 -10
- package/src/run/channel-session-factory.ts +3 -1
- package/src/run/index.ts +29 -29
- package/src/run/subagent-coalescing.ts +24 -0
- package/src/sandbox/env-exposure.ts +20 -7
- package/src/server/index.ts +4 -1
- package/src/skills/typeclaw-channel-github/SKILL.md +10 -10
- package/src/skills/typeclaw-channel-instagram/SKILL.md +1 -1
- package/src/skills/typeclaw-channel-kakaotalk/SKILL.md +1 -1
- package/src/skills/typeclaw-channel-line/SKILL.md +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typeclaw-channel-github
|
|
3
|
-
description: Use this skill
|
|
3
|
+
description: Use this skill ALWAYS for PR review requests in any phrasing, including "requested your review on PR #N", "requested a review from team @… on PR #N", "@bot review this", "can you take a look at #123", "이 PR 리뷰해줘", and "리뷰 반영"; delegate reviews of other people's PRs to the `reviewer` subagent and post line-anchored findings with `post_github_review`. ALWAYS settle PR authorship first (triage #0): on a PR you opened, act as the CONTRIBUTOR/author, never review your own PR, and use host-stage operator checkout/push help to address feedback. Also use this skill to resolve threads you authored with `resolve_review_thread`, create issues with model-driven `gh issue create`, or prepare host-stage PR creation, checkout, and push actions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
GitHub renders normal Markdown in issues, PRs, discussions, and review comments. Use headings, lists, tables, fenced code blocks, links, and inline code when they improve clarity.
|
|
@@ -115,12 +115,12 @@ The `reviewer` subagent is the analyst; you are the integration layer between it
|
|
|
115
115
|
|
|
116
116
|
**The reviewer's `<review>` block is the only source of the verdict and the findings.** You do not review the PR yourself. Between spawning the reviewer and reading its result you do **no analysis of this PR** — do not run `gh pr diff`, do not read the changed files to form an opinion, do not draft a verdict. The reviewer runs on the `deep` model precisely so this judgment is not yours to make on the parent model. If you analyze the diff and post your own assessment while the reviewer is still running, you will post one verdict now and the reviewer's (often different) verdict when it completes — **two contradictory reviews on the same PR**, the exact failure this flow exists to prevent. Wait for the reviewer; post what it returns; nothing before that.
|
|
117
117
|
|
|
118
|
-
**HARD RULE — a review with actionable findings is a formal review, never a flat comment.** If the reviewer returns **one or more** actionable findings (`blocker`/`concern`/`nit`), the ONLY acceptable way to deliver them is a formal review via `POST /pulls/<N>/reviews` (step 4) — `REQUEST_CHANGES`, `COMMENT`, or `APPROVE` per the verdict, with the line-anchored findings in `comments[]`. You may **never** flatten those findings into a `channel_reply` or a top-level issue comment, **even when** the `gh api` call fails. A 422 means an anchor is wrong (almost always a `line` not in the diff): re-anchor it or move that one finding into the top-level review `body`, then resubmit the formal review — do **not** abandon the formal review and post prose instead. A flat "## Review … two blockers" comment is a bug, not a fallback: it strands the findings without line anchors and is the exact failure this rule exists to prevent. The flat/issue-comment path is reserved for the **zero-actionable-findings** branch only (see below). If you genuinely cannot land a formal review after fixing anchors, say so plainly and post nothing that claims a review happened — silence beats a false receipt.
|
|
118
|
+
**HARD RULE — a review with actionable findings is a formal review, never a flat comment.** If the reviewer returns **one or more** actionable findings (`blocker`/`concern`/`nit`), the ONLY acceptable way to deliver them is a formal review via `POST /pulls/<N>/reviews` (step 4) — `REQUEST_CHANGES`, `COMMENT`, or `APPROVE` per the verdict, with the line-anchored findings in `comments[]`. You may **never** flatten those findings into a `channel_reply` or a top-level issue comment, **even when** the `gh api` call fails. A 422 means an anchor is wrong (almost always a `line` not in the diff): re-anchor it or move that one finding into the top-level review `body`, then resubmit the formal review — do **not** abandon the formal review and post prose instead. A flat "## Review … two blockers" comment is a bug, not a fallback: it strands the findings without line anchors and is the exact failure this rule exists to prevent. The flat/issue-comment path is reserved for the **zero-actionable-findings** branch only (see below). **Narrow exception:** when `post_github_review` finds that this bot's identical `CHANGES_REQUESTED` verdict is already effective, the tool itself converts the redundant submission into one substantive root PR comment while the existing formal block remains authoritative. This is a successful tool-managed fallback, not permission to replace a failed or invalid formal review manually. If you genuinely cannot land a formal review after fixing anchors, say so plainly and post nothing that claims a review happened — silence beats a false receipt.
|
|
119
119
|
|
|
120
|
-
1. **
|
|
120
|
+
1. **Minimal intake, then delegate immediately.** Capture only the repo, PR number, current head SHA, exact base OID, authorship, and the prior blocking context needed to identify a re-review. Do not inspect the diff or changed files. Batch the independent metadata/history reads where the tool interface permits.
|
|
121
121
|
|
|
122
122
|
```sh
|
|
123
|
-
gh pr view <N> --repo owner/repo --json
|
|
123
|
+
gh pr view <N> --repo owner/repo --json author,headRefOid,baseRefOid
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Then check for an **unresolved blocking obligation of yours** — this is what makes the current request a _re-review_ (the author pushed fixes after you previously blocked the PR). As in triage #1, a block can live in **two** places, and you must check both:
|
|
@@ -138,13 +138,13 @@ The `reviewer` subagent is the analyst; you are the integration layer between it
|
|
|
138
138
|
- **Filter to _decision_ states, not the latest review row.** GitHub's sticky block is cleared only by a later `APPROVED` (or a dismissal) from the same reviewer — a later `COMMENTED` review does **not** clear it. So a history of `CHANGES_REQUESTED` → `COMMENTED` is _still blocked_, even though the latest row is `COMMENTED`. Selecting `last` over the raw review list would misread that as "not a re-review". Filtering to `{CHANGES_REQUESTED, APPROVED}` first, then taking `last`, asks the right question: "what is my latest _blocking decision_, ignoring non-deciding comments?" (Dismissed reviews surface as `state: "DISMISSED"`, so they're correctly excluded from the decision set too.)
|
|
139
139
|
- **`--paginate --slurp` is mandatory.** GitHub returns reviews 30 per page; a bot on a long-lived PR can have its blocking `CHANGES_REQUESTED` past the first page. Without paginating, that review is invisible and a genuine re-review silently falls back to the plain-comment path. `--slurp` collects every page into one array of arrays; the `add` concatenates them before filtering.
|
|
140
140
|
|
|
141
|
-
2. **Spawn the `reviewer` subagent with the PR target.** The reviewer runs on the deep profile, so it always runs in the background — you stay responsive while it works. Pass the PR
|
|
141
|
+
2. **Spawn the `reviewer` subagent with the PR target immediately after minimal intake.** The reviewer runs on the deep profile, so it always runs in the background — you stay responsive while it works. Pass the repo, PR number, captured head SHA, captured base OID, any re-review context, and any requester focus. Also pass the exact typed identity from step 1 as `review_identity: { repo: "owner/repo", pull_request: N, head_sha: "<40-char headRefOid>", base_sha: "<40-char baseRefOid>", review_kind: "review" }`; use `review_kind: "re-review"` when step 1 found an unresolved blocking obligation. This is runtime coalescing metadata, not prose: identical repo/PR/head/base/kind jobs within this parent session share one in-flight analysis, while a new head, different base, different kind, or different parent session stays independent. Never guess or parse these fields from the request text — source both `headRefOid` and `baseRefOid` from the values returned by `gh pr view`. Do not use a base branch name as identity. Do not run `gh pr diff`, read changed files, or otherwise pre-analyze first. The reviewer acquires its own context, loads the `code-review` skill, and returns a `<review>` block whose code findings carry `location="path:line"`.
|
|
142
142
|
|
|
143
143
|
**If step 1 found an unresolved blocking obligation — a formal `CHANGES_REQUESTED` _or_ an unretracted flat-comment blocker — say so in the spawn payload** — e.g. _"This is a re-review: you previously blocked this PR (the prior blockers were …; the block was a formal `CHANGES_REQUESTED` / a flat PR comment). Verify they are resolved and return `approve` or `request-changes` — a re-review must re-decide the blocking state, not return `comment`."_ The reviewer's `code-review` skill enforces the same rule, but telling it the prior blockers (and which form they took) is what lets it apply that rule; a fresh reviewer session has no memory of your earlier block. The flat-comment case especially must be passed through — the reviewer cannot recover it from review state, so omitting it would silently drop the re-review context the moment the flow starts.
|
|
144
144
|
|
|
145
145
|
Do **not** post an "on it" acknowledgement comment before spawning the reviewer — the runtime already adds an :eyes: reaction to the PR the moment it engages, so a "looking into this" comment is redundant noise. Just spawn the reviewer (it runs in the background); the formal review is your reply. If you want to acknowledge explicitly, use `channel_react({ emoji: "eyes" })`, which reacts without posting a comment.
|
|
146
146
|
|
|
147
|
-
After spawning, **end your turn** — the background reviewer wakes you with a completion `<system-reminder>` (step 3). "Stay responsive" means you remain free to handle _other_ chats meanwhile; it does **not** license you to keep working _this_ PR. Do not poll `subagent_output`
|
|
147
|
+
After spawning, **end your turn** — the background reviewer wakes you with a completion `<system-reminder>` (step 3). "Stay responsive" means you remain free to handle _other_ chats meanwhile; it does **not** license you to keep working _this_ PR. Do not poll `subagent_output` at all before completion, and do not fill the wait by reviewing the diff yourself. Only after that reminder may you fetch the result.
|
|
148
148
|
|
|
149
149
|
3. **On the completion `<system-reminder>`, first check you have not already posted — then** call `subagent_output({ task_id })` to read the reviewer's final assistant message.
|
|
150
150
|
|
|
@@ -171,7 +171,7 @@ The `reviewer` subagent is the analyst; you are the integration layer between it
|
|
|
171
171
|
- **Re-spawn the reviewer once** (step 2) with the same target — a fresh `deep` context usually completes; if it now returns a real `<review>` block, post it normally.
|
|
172
172
|
- **If the re-spawn is still incomplete**, post a brief, honest `channel_reply` on the PR — e.g. _"리뷰를 자동 완료하지 못했어요 (reviewer returned no verdict). 다시 시도하거나 직접 확인이 필요합니다."_ — and remove your in-review label. An honest "couldn't complete the review" comment is the correct fallback; silence after you engaged, or a fabricated formal verdict, is not.
|
|
173
173
|
|
|
174
|
-
4. **
|
|
174
|
+
4. **Validate anchors proportionally, then translate into a `post_github_review` call.** Validate only the cited anchors needed for posting: confirm each actionable `path:line` belongs to the captured head/diff and that the cited text supports the finding. Batch independent anchor checks. Do not re-review the diff, inspect unrelated files, or second-guess the verdict; parent verification is proportional to the findings returned. Each `<finding>` with `severity` of `blocker`, `concern`, or `nit` and a valid `location="path:line"` becomes one entry in `comments[]`. Compose the inline `body` from the reviewer's `<issue>` + `<evidence>` + `<suggestion>` verbatim (modulo markdown). Findings whose `location` is `general` go into the top-level review `body`. **Skip `praise` findings when building `comments[]`**.
|
|
175
175
|
|
|
176
176
|
**The verdict and the inline comments are independent. The verdict sets only the `event` field; it never decides whether you post `comments[]`.** Whenever there is at least one actionable finding (`blocker`/`concern`/`nit`) with a `location="path:line"`, you MUST submit a formal review via `POST /pulls/<N>/reviews` carrying those findings in `comments[]` — including when the verdict is `approve`. An `approve` with three nits is still a formal `APPROVE` review with three inline comments, **not** a plain approval and **not** a flattened summary. Collapsing inline findings into a single `channel_reply` or issue comment loses the line anchors the reviewer worked to produce.
|
|
177
177
|
|
|
@@ -185,7 +185,7 @@ The `reviewer` subagent is the analyst; you are the integration layer between it
|
|
|
185
185
|
|
|
186
186
|
**Operator approval policy.** If the inbound carries a note that PR approval is disabled (`channels.github.review.approve: false` — the adapter appends "Operator policy: PR approval is disabled for this agent" to the message), you must **not** submit an `APPROVE`. Map an `approve` verdict to `COMMENT` instead: post the same `<summary>` and all inline `comments[]` as a `COMMENT` review, just without the formal approval. `request-changes` and `comment` verdicts are unaffected (they never approve). Absent that note, approval is enabled and the table above applies unchanged.
|
|
187
187
|
|
|
188
|
-
**Re-review.** If step 1 established this is a re-review (an unresolved blocking obligation of yours — a formal `CHANGES_REQUESTED` **or** an unretracted flat-comment blocker), the result MUST clear or re-assert that block
|
|
188
|
+
**Re-review.** If step 1 established this is a re-review (an unresolved blocking obligation of yours — a formal `CHANGES_REQUESTED` **or** an unretracted flat-comment blocker), the result MUST clear or re-assert that block. The only top-level-comment exception is the tool-managed duplicate fallback described above: the existing identical `CHANGES_REQUESTED` already re-asserts the formal block, so the new summary/findings may be added as one root comment without posting another blocking review. The clearing mechanics depend on which form the prior block took:
|
|
189
189
|
- **Prior block was a formal `CHANGES_REQUESTED`.** It is sticky: **only** a fresh `APPROVE` from you, or a dismissal of your prior review, clears it. A plain issue comment does **not** clear it, and — critically — **neither does a `COMMENT` review.**
|
|
190
190
|
- **Prior block was a flat comment** (no formal `CHANGES_REQUESTED` exists). There is no sticky GitHub state to clear, but the obligation is still yours to discharge as a **formal** review so the verdict finally lands as review state: submit `APPROVE` (resolved, approval enabled) or `REQUEST_CHANGES` (not resolved). Do not discharge a flat-comment block with another flat comment — that re-strands the verdict, the original bug.
|
|
191
191
|
|
|
@@ -218,11 +218,11 @@ The `reviewer` subagent is the analyst; you are the integration layer between it
|
|
|
218
218
|
})
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
Anchor mechanics: `line` is a line number **in the file**, not a position in the diff. `side: RIGHT` is the new revision (default for additions); `side: LEFT` is the old revision (use for comments on removed lines). For multi-line comments, also set `start_line` and `start_side` (same semantics). The tool resolves the head SHA, validates anchors against the complete PR diff, moves out-of-diff findings into the top-level body, enforces approval policy, and verifies the exact returned review id/state. Its successful receipt is proof that the
|
|
221
|
+
Anchor mechanics: `line` is a line number **in the file**, not a position in the diff. `side: RIGHT` is the new revision (default for additions); `side: LEFT` is the old revision (use for comments on removed lines). For multi-line comments, also set `start_line` and `start_side` (same semantics). The tool resolves the head SHA, validates anchors against the complete PR diff, moves out-of-diff findings into the top-level body, enforces approval policy, and verifies the exact returned review id/state. Its successful receipt is proof that the output landed. A receipt with `details.fallback === "comment"` means the prior `CHANGES_REQUESTED` remains live and the new review content landed as one root PR comment; treat that as complete and do not add a `channel_reply`. On failure, fix the payload or policy issue and retry; never post a flat comment claiming the review succeeded.
|
|
222
222
|
|
|
223
223
|
5. **The decoy reviewer is dropped for you — no action needed.** Under **GitHub App** auth, the adapter automatically removes the decoy reviewer from the PR's requested-reviewers list the moment your formal review lands (it reacts to your own `pull_request_review.submitted` webhook). Why this matters: GitHub auto-adds **you** (the App account) to the PR's reviewers when your review posts, but the **decoy** account would otherwise stay pinned as a perpetual "review requested", as if the review never happened. You do **not** need to issue a `DELETE /requested_reviewers` yourself — and you should not, since it would race the adapter's own cleanup. The removal is self-loop-safe: the adapter's `DELETE` is authenticated as the App, so the `review_request_removed` webhook carries your bot actor (`slug[bot]`) as `sender`, which the classifier drops (see "Self-loop safety" below). This is a no-op under **PAT** auth (no decoy) and for **plain-language**/**team** requests (no decoy user was placed). See [GitHub decoy reviewer](/docs/internals/github-decoy-reviewer).
|
|
224
224
|
|
|
225
|
-
6. **End the turn with `skip_response`, not a trace reply.** The formal review from step 4 already landed _in this PR_ — it carries the summary,
|
|
225
|
+
6. **End the turn with `skip_response`, not a trace reply.** The formal review or tool-managed duplicate fallback from step 4 already landed _in this PR_ — it carries the summary, verdict context, and findings. A `channel_reply` here does **not** go to a separate operator channel; on GitHub it posts another public comment on the same PR. A one-line "Posted review on PR #N: …" narrated into the PR thread is meta-commentary addressed to a phantom operator, and it reads absurdly next to the output it claims to point at. So once `post_github_review` confirms success, call `skip_response({ reason: "review posted via post_github_review" })` to close the turn silently. Only fall back to `channel_reply` when there was **no** review output to post — the zero-actionable-findings branch below uses `channel_reply` as the substantive reply.
|
|
226
226
|
|
|
227
227
|
### Zero actionable findings
|
|
228
228
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typeclaw-channel-instagram
|
|
3
|
-
description: Use this skill
|
|
3
|
+
description: Use this skill for Instagram inbound media being metadata-only, workspace types and engagement rules, transport fallback, or operator-side 2FA/checkpoint handling.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# typeclaw-channel-instagram
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typeclaw-channel-kakaotalk
|
|
3
|
-
description: Use this skill
|
|
3
|
+
description: Use this skill for KakaoTalk inbound attachment/emoticon handling with `channel_fetch_attachment` or `look_at_channel_attachment`, outbound attachment/gallery MIME routing, engagement/stickiness and group-chat permission questions, mark-read behavior, or self-loop troubleshooting.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# typeclaw-channel-kakaotalk
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typeclaw-channel-line
|
|
3
|
-
description: Use this skill
|
|
3
|
+
description: Use this skill for LINE inbound non-text content being unfetchable, workspace bucket semantics, or engagement behavior.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# typeclaw-channel-line
|