claude-task-worker 0.115.0 → 0.117.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.
- package/README.md +53 -7
- package/dist/chunk-3RY43CYR.js +41 -0
- package/dist/chunk-FAD5CNP4.js +3396 -0
- package/dist/chunk-N42YU3GJ.js +184 -0
- package/dist/claude-args.d.ts +62 -0
- package/dist/commands/cloud-setup.d.ts +14 -0
- package/dist/commands/codegraph.d.ts +39 -0
- package/dist/commands/design-md.d.ts +11 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/install.d.ts +14 -0
- package/dist/commands/pen.d.ts +15 -0
- package/dist/commands/playwright.d.ts +27 -0
- package/dist/commands/run-command.d.ts +10 -0
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/version.d.ts +4 -0
- package/dist/config.d.ts +77 -0
- package/dist/custom-workers.d.ts +16 -0
- package/dist/dispatch-args.d.ts +13 -0
- package/dist/dispatcher-JKUMXTJ2.js +410 -0
- package/dist/dispatcher.d.ts +77 -0
- package/dist/gh.d.ts +112 -0
- package/dist/git.d.ts +7 -0
- package/dist/herdr-NDLUM6JF.js +309 -0
- package/dist/herdr-runner-33D6C2KI.js +307 -0
- package/dist/herdr-runner.d.ts +136 -0
- package/dist/herdr.d.ts +85 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +855 -4984
- package/dist/last-run-pr.d.ts +16 -0
- package/dist/lib.d.ts +20 -0
- package/dist/lib.js +123 -0
- package/dist/process-manager.d.ts +38 -0
- package/dist/random-name.d.ts +2 -0
- package/dist/run-command-O2TMRPZK.js +8 -0
- package/dist/runcat.d.ts +23 -0
- package/dist/slack.d.ts +46 -0
- package/dist/table-DWVMNDS3.js +32 -0
- package/dist/table.d.ts +55 -0
- package/dist/task-result.d.ts +25 -0
- package/dist/transcript.d.ts +27 -0
- package/dist/user-config.d.ts +30 -0
- package/dist/workers/answer-issue-questions.d.ts +1 -0
- package/dist/workers/apply-ui-design.d.ts +1 -0
- package/dist/workers/check-dependabot.d.ts +1 -0
- package/dist/workers/create-issue.d.ts +1 -0
- package/dist/workers/create-ui-design.d.ts +2 -0
- package/dist/workers/epic-issue.d.ts +2 -0
- package/dist/workers/exec-issue.d.ts +15 -0
- package/dist/workers/fix-review-point.d.ts +1 -0
- package/dist/workers/issue-worker.d.ts +18 -0
- package/dist/workers/pr-worker.d.ts +18 -0
- package/dist/workers/registry.d.ts +8 -0
- package/dist/workers/resolve-conflict.d.ts +2 -0
- package/dist/workers/scheduled-worker.d.ts +8 -0
- package/dist/workers/triage-created-issue.d.ts +1 -0
- package/dist/workers/triage-pr.d.ts +5 -0
- package/dist/workers/ui-design.d.ts +14 -0
- package/dist/workers/update-coding-guidelines.d.ts +1 -0
- package/dist/workers/update-design-md.d.ts +1 -0
- package/dist/workers/update-issue.d.ts +1 -0
- package/dist/workers/update-requirement-rules.d.ts +1 -0
- package/dist/workers/worker-definition.d.ts +18 -0
- package/dist/worktree.d.ts +21 -0
- package/package.json +14 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type * as HerdrModule from "./herdr";
|
|
2
|
+
import type { AgentStatus } from "./herdr";
|
|
3
|
+
import type { TaskResult } from "./task-result";
|
|
4
|
+
export declare const AGENT_POLL_INTERVAL_MS: number;
|
|
5
|
+
export declare const PANE_OUTPUT_LINES = 300;
|
|
6
|
+
export declare function taskTabLabel(projectName: string, number: number): string;
|
|
7
|
+
export declare function toAgentName(label: string): string;
|
|
8
|
+
export interface CompletionTracker {
|
|
9
|
+
seenWorking: boolean;
|
|
10
|
+
warnedBlocked: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function createCompletionTracker(): CompletionTracker;
|
|
13
|
+
export type TrackerDecision = "running" | "completed" | "blocked-first-seen";
|
|
14
|
+
export declare function observeAgentStatus(tracker: CompletionTracker, status: AgentStatus): {
|
|
15
|
+
tracker: CompletionTracker;
|
|
16
|
+
decision: TrackerDecision;
|
|
17
|
+
};
|
|
18
|
+
export declare function extractCloudSessionId(text: string): string | undefined;
|
|
19
|
+
export declare function normalizePtyOutput(text: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* herdr モードのタスク結果を組み立てる。`claude -p` と違い exit code が無いため、
|
|
22
|
+
* 「出力が空か」だけで成否を判定する。プリアンブル失敗などでモデルが
|
|
23
|
+
* 起動しないまま idle になったセッションを空振りとして失敗扱いにする狙いは
|
|
24
|
+
* task-result.ts の buildTaskResult と同じ。
|
|
25
|
+
*
|
|
26
|
+
* 通知に載せる本文は **transcript から取った最終レポート(`report`)を最優先**する。
|
|
27
|
+
* ペインの端末内容は「会話ログ + 空行パディング + 入力ボックス + ステータスバー」で、
|
|
28
|
+
* Slack 通知が切り出す末尾1000文字はほぼ TUI の装飾しか含まないため、通知本文として
|
|
29
|
+
* 使い物にならない(transcript.ts 参照)。transcript を引けなかった場合のみ
|
|
30
|
+
* 従来どおりペイン内容へフォールバックする。
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildHerdrTaskResult(paneOutput: string, options?: {
|
|
33
|
+
report?: string;
|
|
34
|
+
}): TaskResult;
|
|
35
|
+
export interface HerdrTask {
|
|
36
|
+
paneId: string;
|
|
37
|
+
tabId: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const PANE_READY_TIMEOUT_MS: number;
|
|
40
|
+
export declare const PANE_READY_POLL_INTERVAL_MS = 200;
|
|
41
|
+
export interface StartTiming {
|
|
42
|
+
paneReadyTimeoutMs?: number;
|
|
43
|
+
paneReadyPollIntervalMs?: number;
|
|
44
|
+
agentStartReadyTimeoutMs?: number;
|
|
45
|
+
promptAcceptTimeoutMs?: number;
|
|
46
|
+
promptAcceptPollIntervalMs?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare const PROMPT_ACCEPT_TIMEOUT_MS: number;
|
|
49
|
+
export declare const PROMPT_ACCEPT_POLL_INTERVAL_MS = 500;
|
|
50
|
+
/**
|
|
51
|
+
* herdr のタスク専用タブで claude を TUI 起動する(1タスク=1タブ)。
|
|
52
|
+
*
|
|
53
|
+
* `--no-focus` でタスク専用タブを作り、その**ルートペイン(シェル)で** `herdr agent start`
|
|
54
|
+
* を使って素の claude(TUI) を起動し、起動後に `herdr agent prompt` でタスクのプロンプトを
|
|
55
|
+
* 投入する。`agent start <name> --kind claude --pane <id> -- <args>` は(name は
|
|
56
|
+
* ラベルを agent 名規則へ変換した `toAgentName(label)`)、
|
|
57
|
+
* ペインのシェルで claude を起動し、agent として検出され入力待ちになるまで同期的にブロックする
|
|
58
|
+
* (旧 send-text 方式の「起動コマンド送信 → 自動検出待ちポーリング」を1コマンドで担う)。
|
|
59
|
+
* `--kind claude` が実行ファイルを供給するため、`args` には claude のフラグだけを渡す
|
|
60
|
+
* (実行ファイル名・プロンプトは含めない)。cwd・env は tabCreate の `--cwd` / `--env` で
|
|
61
|
+
* ペインへ渡してあり、そこで起動する claude が継承する。ルートペインがそのまま claude の
|
|
62
|
+
* ペインになるので、旧実装のような余剰シェルペインの `paneClose` は不要。
|
|
63
|
+
*
|
|
64
|
+
* **プロンプトを起動引数に含めてはいけない**。含めると claude が起動と同時に作業を始め、
|
|
65
|
+
* 「入力待ちになるまでブロックする」`agent start` がタスク完了まで返らず(2分を超えると
|
|
66
|
+
* timeout エラーで作業中の claude ごとタブが閉じられる)、しかも herdr がそのターンを
|
|
67
|
+
* 追跡しないため非フォーカス完了で `done` にならず `idle` へ戻る。結果として
|
|
68
|
+
* waitForHerdrTask は `working` を一度も観測できず、完了を永久に検知できない
|
|
69
|
+
* (実測: ステータスが `running:idle` のまま張り付く)。
|
|
70
|
+
*
|
|
71
|
+
* 手順:
|
|
72
|
+
* 1. tabCreate(`--no-focus`)でユーザーの見ているタブに割り込まないタスク専用タブを作る
|
|
73
|
+
* 2. waitForPaneReady でシェルプロンプトの描画を待つ(未描画で agent start すると起動に失敗しうる)
|
|
74
|
+
* 3. agentStart で claude を起動し、検出+入力待ちになるまで待つ。検出できなければ herdr が
|
|
75
|
+
* エラーを返して agentStart が throw する(例: 起動失敗)。その場合は
|
|
76
|
+
* シェルだけのタブが残らないよう閉じてから失敗させる
|
|
77
|
+
* 4. agentPrompt でタスクのプロンプトを投入する。失敗時は 3 と同様にタブを閉じて失敗させる
|
|
78
|
+
*/
|
|
79
|
+
export declare function startHerdrTask({ label, cwd, args, prompt, env, workspaceId, herdr, timing, }: {
|
|
80
|
+
label: string;
|
|
81
|
+
cwd: string;
|
|
82
|
+
args: string[];
|
|
83
|
+
prompt: string;
|
|
84
|
+
env?: Record<string, string>;
|
|
85
|
+
workspaceId?: string;
|
|
86
|
+
herdr?: typeof HerdrModule;
|
|
87
|
+
timing?: StartTiming;
|
|
88
|
+
}): Promise<HerdrTask>;
|
|
89
|
+
export declare function waitForPaneReady(paneId: string, mod: typeof HerdrModule, options?: {
|
|
90
|
+
timeoutMs?: number;
|
|
91
|
+
pollIntervalMs?: number;
|
|
92
|
+
}): Promise<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* agent ステータスをポーリングしてタスクの完了を待ち、完了時の出力を回収する。
|
|
95
|
+
* 出力は transcript の最終レポートを優先し、引けない場合だけペイン内容を使う。
|
|
96
|
+
*
|
|
97
|
+
* - `working` → `idle` の遷移を完了とみなす
|
|
98
|
+
* - `blocked` は人の介入を待つ状態として待機を継続する(自動失敗にはしない)
|
|
99
|
+
* - ペインが消えた場合(`pane_not_found`)は claude の異常終了・タブの手動クローズとして失敗扱い
|
|
100
|
+
*
|
|
101
|
+
* タスクの実行時間に上限は設けない(default モードと同じ方針)。
|
|
102
|
+
*/
|
|
103
|
+
export declare function waitForHerdrTask(paneId: string, options?: {
|
|
104
|
+
pollIntervalMs?: number;
|
|
105
|
+
herdr?: typeof HerdrModule;
|
|
106
|
+
onBlocked?: () => void;
|
|
107
|
+
onStatus?: (status: AgentStatus) => void;
|
|
108
|
+
signal?: {
|
|
109
|
+
aborted: boolean;
|
|
110
|
+
};
|
|
111
|
+
readReport?: (sessionId: string | undefined) => string;
|
|
112
|
+
}): Promise<TaskResult>;
|
|
113
|
+
export declare const CLAUDE_EXIT_TIMEOUT_MS: number;
|
|
114
|
+
export declare const CLAUDE_EXIT_POLL_INTERVAL_MS = 200;
|
|
115
|
+
/**
|
|
116
|
+
* タスクの TUI セッションを終了してタブを閉じる。
|
|
117
|
+
*
|
|
118
|
+
* ペインの内容はタブを閉じると失われるため、必ず出力を回収した後に呼ぶこと。
|
|
119
|
+
* また claude がまだ worktree を掴んでいる状態で worktree を削除できないよう、
|
|
120
|
+
* 呼び出し側は「停止 → 完了コールバック(worktree 削除)」の順序を守る。
|
|
121
|
+
*
|
|
122
|
+
* ctrl-c は **1コマンドで連続2回** 送る。Claude Code の TUI は ctrl-c 1回では終了せず
|
|
123
|
+
* (1回目は入力のキャンセル)、間隔を空けた2回でも終了カウントがリセットされて終了しない
|
|
124
|
+
* ことを実測で確認している(`pane send-keys <pane> ctrl+c ctrl+c` なら終了する)。
|
|
125
|
+
* ここで終了させずに tabClose だけに頼ると、claude は後片付けの機会を得られないまま
|
|
126
|
+
* 強制終了される。
|
|
127
|
+
*
|
|
128
|
+
* 新モデルでは claude はタブのルートシェルペインで動くため、claude がグレースフルに
|
|
129
|
+
* 終了してもペイン(=シェル)とタブは残る。そのため tabClose は必須で、agent 検出が
|
|
130
|
+
* 外れる(=claude が終了した)のを待ってから確実にタブごと閉じる。既にタブが
|
|
131
|
+
* 消えているケース(tab_not_found)は正常系として握り潰す。
|
|
132
|
+
*/
|
|
133
|
+
export declare function stopHerdrTask(task: HerdrTask, herdr?: typeof HerdrModule, options?: {
|
|
134
|
+
exitTimeoutMs?: number;
|
|
135
|
+
exitPollIntervalMs?: number;
|
|
136
|
+
}): Promise<void>;
|
package/dist/herdr.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export interface TabInfo {
|
|
2
|
+
tabId: string;
|
|
3
|
+
label: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkspaceInfo {
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
label: string;
|
|
9
|
+
focused: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface CreatedWorkspace {
|
|
12
|
+
workspaceId: string;
|
|
13
|
+
tabId: string;
|
|
14
|
+
paneId: string;
|
|
15
|
+
}
|
|
16
|
+
export type AgentStatus = "working" | "idle" | "blocked" | "done" | "unknown";
|
|
17
|
+
export interface AgentInfo {
|
|
18
|
+
paneId: string;
|
|
19
|
+
tabId: string;
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
agentStatus: AgentStatus;
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PaneProcessInfo {
|
|
25
|
+
foregroundProcesses: {
|
|
26
|
+
name: string;
|
|
27
|
+
argv: string[];
|
|
28
|
+
cmdline: string;
|
|
29
|
+
pid: number;
|
|
30
|
+
}[];
|
|
31
|
+
}
|
|
32
|
+
export declare class HerdrUnavailableError extends Error {
|
|
33
|
+
readonly reason: "not-installed" | "server-unreachable";
|
|
34
|
+
constructor(message: string, reason: "not-installed" | "server-unreachable");
|
|
35
|
+
}
|
|
36
|
+
export declare class HerdrError extends Error {
|
|
37
|
+
readonly code: string;
|
|
38
|
+
constructor(message: string, code: string);
|
|
39
|
+
}
|
|
40
|
+
export declare const HERDR_TIMEOUT_MS: number;
|
|
41
|
+
export declare function tabCreate({ label, cwd, workspaceId, env, }: {
|
|
42
|
+
label: string;
|
|
43
|
+
cwd: string;
|
|
44
|
+
workspaceId?: string;
|
|
45
|
+
env?: Record<string, string>;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
paneId: string;
|
|
48
|
+
tabId: string;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function tabRename(tabId: string, label: string): Promise<void>;
|
|
51
|
+
export declare function paneClose(paneId: string): Promise<void>;
|
|
52
|
+
export declare function paneGet(paneId: string): Promise<{
|
|
53
|
+
paneId: string;
|
|
54
|
+
tabId: string;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function tabClose(tabId: string): Promise<void>;
|
|
57
|
+
export declare function tabList(): Promise<TabInfo[]>;
|
|
58
|
+
export declare function workspaceCreate({ label, cwd, env, }: {
|
|
59
|
+
label: string;
|
|
60
|
+
cwd: string;
|
|
61
|
+
env?: Record<string, string>;
|
|
62
|
+
}): Promise<CreatedWorkspace>;
|
|
63
|
+
export declare function workspaceList(): Promise<WorkspaceInfo[]>;
|
|
64
|
+
export declare function workspaceClose(workspaceId: string): Promise<void>;
|
|
65
|
+
export declare function workspaceFocus(workspaceId: string): Promise<void>;
|
|
66
|
+
export declare const AGENT_KIND = "claude";
|
|
67
|
+
export declare const AGENT_START_READY_TIMEOUT_MS: number;
|
|
68
|
+
export declare function agentStart(paneId: string, { name, args, kind, readyTimeoutMs, }: {
|
|
69
|
+
name: string;
|
|
70
|
+
args: string[];
|
|
71
|
+
kind?: string;
|
|
72
|
+
readyTimeoutMs?: number;
|
|
73
|
+
}): Promise<AgentInfo>;
|
|
74
|
+
export declare function agentPrompt(paneId: string, text: string): Promise<void>;
|
|
75
|
+
export declare function agentGet(target: string): Promise<AgentInfo>;
|
|
76
|
+
export declare function getCurrentWorkspaceId(): string | undefined;
|
|
77
|
+
export type PaneReadSource = "visible" | "recent" | "recent-unwrapped";
|
|
78
|
+
export declare function paneRead(paneId: string, options?: {
|
|
79
|
+
source?: PaneReadSource;
|
|
80
|
+
lines?: number;
|
|
81
|
+
}): Promise<string>;
|
|
82
|
+
export declare function paneSendText(paneId: string, text: string): Promise<void>;
|
|
83
|
+
export declare function paneSendKeys(paneId: string, ...keys: string[]): Promise<void>;
|
|
84
|
+
export declare function paneProcessInfo(paneId: string): Promise<PaneProcessInfo>;
|
|
85
|
+
export declare function checkHerdrAvailable(): Promise<void>;
|
package/dist/index.d.ts
ADDED