claude-task-worker 0.135.0 → 0.136.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/dist/{chunk-5O66VYMR.js → chunk-NWYH24MB.js} +31 -18
- package/dist/claude-args.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/lib.js +1 -1
- package/package.json +1 -1
|
@@ -1103,6 +1103,7 @@ import { mkdirSync, renameSync, writeFileSync as writeFileSync2 } from "node:fs"
|
|
|
1103
1103
|
import os from "node:os";
|
|
1104
1104
|
import path from "node:path";
|
|
1105
1105
|
var CLOUD_REPORT_HEADING = "## claude-task-worker \u5B9F\u884C\u7D50\u679C";
|
|
1106
|
+
var ORPHANED_CLOUD_SESSION_HEADING = "## \u5B64\u7ACB\u30AF\u30E9\u30A6\u30C9\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u53EF\u80FD\u6027";
|
|
1106
1107
|
var DISALLOWED_TOOLS = [
|
|
1107
1108
|
// 遅延 / yield: 後続ウェイクアップ前提。print モードではウェイクアップが発火せず、
|
|
1108
1109
|
// 呼ぶと処理未完のままプロセスが終了する。
|
|
@@ -1270,13 +1271,18 @@ function buildClaudeArgs({
|
|
|
1270
1271
|
function buildCloudCreateArgs(commonArgs, prompt) {
|
|
1271
1272
|
return ["--cloud", prompt, ...commonArgs];
|
|
1272
1273
|
}
|
|
1273
|
-
function appendCloudDoneInstruction(prompt, target, debug = false) {
|
|
1274
|
+
function appendCloudDoneInstruction(prompt, target, debug = false, startedAt) {
|
|
1274
1275
|
const targetLabel = target.type === "issue" ? `Issue #${target.number}` : `PR #${target.number}`;
|
|
1275
1276
|
const checkoutInstruction = buildCloudCheckoutInstruction(target);
|
|
1276
1277
|
const worktreeInstruction = buildCloudWorktreeInstruction(prompt);
|
|
1277
1278
|
const reportInstruction = debug ? `\`${CLOUD_DONE_LABEL}\` \u30E9\u30D9\u30EB\u3092\u4ED8\u3051\u308B\u76F4\u524D\u306B\u3001${targetLabel} \u3078 \`${CLOUD_REPORT_HEADING}\` \u3092\u898B\u51FA\u3057\u3068\u3059\u308B\u30B3\u30E1\u30F3\u30C8\u30921\u4EF6\u6295\u7A3F\u3057\u3001\u672C\u6587\u306B\u6700\u7D42\u5831\u544A\uFF08\u5B8C\u4E86\u30FB\u4E2D\u65AD\u306B\u304B\u304B\u308F\u3089\u305A\uFF09\u3092\u66F8\u304F\u3053\u3068\u3002GitHub MCP\uFF08\`add_issue_comment\`\uFF09\u3092\u512A\u5148\u3057\u3001\u5931\u6557\u3057\u305F\u5834\u5408\u306E\u307F \`gh ${target.type} comment ${target.number} --body-file -\` \u3078\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u3059\u308B\u3053\u3068\uFF08\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306F1\u56DE\u307E\u3067\uFF09\u3002\u30EF\u30FC\u30AB\u30FC\u306F\u3053\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u6700\u7D42\u30EC\u30DD\u30FC\u30C8\u3068\u3057\u3066\u56DE\u53CE\u3057 Slack \u901A\u77E5\u306B\u8F09\u305B\u308B\u3002` : "";
|
|
1278
1279
|
const labelInstruction = `${debug ? "\u4E0A\u8A18\u30B3\u30E1\u30F3\u30C8\u306E\u6295\u7A3F\u5F8C\u3001" : ""}\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6700\u5F8C\u306E\u64CD\u4F5C\u3068\u3057\u3066 ${targetLabel} \u306B \`${CLOUD_DONE_LABEL}\` \u30E9\u30D9\u30EB\u3092\u4ED8\u4E0E\u3059\u308B\u3053\u3068\u3002\u4ED8\u4E0E\u306F \`bash \${CLAUDE_PLUGIN_ROOT}/scripts/gh-compat.sh add-label ${target.number} ${CLOUD_DONE_LABEL}\` \u3067\u884C\u3044\u3001\u5931\u6557\u3057\u305F\u5834\u5408\u306E\u307F \`gh api -X POST repos/{owner}/{repo}/issues/${target.number}/labels -f "labels[]=${CLOUD_DONE_LABEL}"\` \u3078\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u3059\u308B\u3053\u3068\uFF08\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u306F1\u56DE\u307E\u3067\uFF09\u3002**GitHub MCP \u306E \`issue_write\` / \`pull_request_write\`\uFF08method: \`update\`\uFF09\u306F\u4F7F\u308F\u306A\u3044\u3053\u3068** \u2014 \u540C\u30C4\u30FC\u30EB\u306E \`labels\` \u306F\u5168\u7F6E\u63DB\u3067\u3001\`${CLOUD_DONE_LABEL}\` \u3092\u8DB3\u3059\u3064\u3082\u308A\u306E\u547C\u3073\u51FA\u3057\u304C\u65E2\u5B58\u30E9\u30D9\u30EB\uFF08\`cc-triage-scope\` / \`cc-in-progress\` \u7B49\uFF09\u3092\u5DFB\u304D\u6DFB\u3048\u3067\u6D88\u3057\u3001\u305D\u306E Issue/PR \u304C\u30EF\u30FC\u30AB\u30FC\u306E\u30DD\u30FC\u30EA\u30F3\u30B0\u5BFE\u8C61\u304B\u3089\u5916\u308C\u308B\u3002\u30EF\u30FC\u30AB\u30FC\u306F\u3053\u306E\u30E9\u30D9\u30EB\u3067\u30BF\u30B9\u30AF\u306E\u7D42\u4E86\u3092\u691C\u77E5\u3057\u3066\u304A\u308A\u3001\u4ED8\u4E0E\u3055\u308C\u306A\u3044\u3068\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u307E\u3067\u5B8C\u4E86\u6271\u3044\u306B\u306A\u3089\u306A\u3044\u3002`;
|
|
1279
|
-
|
|
1280
|
+
const orphanInstruction = startedAt ? buildCloudOrphanCleanupInstruction(target, startedAt) : "";
|
|
1281
|
+
return [prompt, checkoutInstruction, worktreeInstruction, reportInstruction, orphanInstruction, labelInstruction].filter((part) => part !== "").join("\n\n");
|
|
1282
|
+
}
|
|
1283
|
+
function buildCloudOrphanCleanupInstruction(target, startedAt) {
|
|
1284
|
+
const targetLabel = target.type === "issue" ? `Issue #${target.number}` : `PR #${target.number}`;
|
|
1285
|
+
return `\`${CLOUD_DONE_LABEL}\` \u3092\u4ED8\u3051\u308B\u76F4\u524D\u306B\u3001${targetLabel} \u306B \`cc-need-human-check\` \u30E9\u30D9\u30EB\u304C\u4ED8\u3044\u3066\u3044\u308B\u304B\u3092\u78BA\u8A8D\u3059\u308B\u3053\u3068\u3002\u4ED8\u3044\u3066\u3044\u3066\u3001\u304B\u3064 ${startedAt.toISOString()} \u3088\u308A\u5F8C\u306B \`${ORPHANED_CLOUD_SESSION_HEADING}\` \u3092\u898B\u51FA\u3057\u3068\u3059\u308B\u30B3\u30E1\u30F3\u30C8\u304C\u6295\u7A3F\u3055\u308C\u3066\u3044\u308B\u5834\u5408\u306F\u3001\u30EF\u30FC\u30AB\u30FC\u304C\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u5B8C\u4E86\u3092\u5F85\u305F\u305A\u306B\u505C\u6B62\u3057\u305F\u3053\u3068\u3092\u793A\u3059\u306E\u3067\u3001\`bash \${CLAUDE_PLUGIN_ROOT}/scripts/gh-compat.sh remove-label ${target.number} cc-need-human-check\` \u3067\u5916\u3059\u3053\u3068\uFF08MCP \u306E \`issue_write\` / \`pull_request_write\` \u306F\u4F7F\u308F\u306A\u3044\uFF09\u3002\u305F\u3060\u3057\u3001\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u81EA\u8EAB\u304C\u30B9\u30AD\u30EB\u306E\u624B\u9806\u3068\u3057\u3066 \`cc-need-human-check\` \u3092\u4ED8\u3051\u305F\u5834\u5408\u3001\u304A\u3088\u3073\u30BF\u30B9\u30AF\u3092\u5B8C\u9042\u3067\u304D\u306A\u304B\u3063\u305F\u5834\u5408\u306F\u5916\u3055\u306A\u3044\u3053\u3068\u3002`;
|
|
1280
1286
|
}
|
|
1281
1287
|
var CLOUD_WORKTREE_EXEMPT_SKILLS = ["exec-issue", "fix-review-point", "create-ui-design"];
|
|
1282
1288
|
function buildCloudWorktreeInstruction(prompt) {
|
|
@@ -1294,7 +1300,7 @@ function buildCloudGitHubAccessInstruction() {
|
|
|
1294
1300
|
function buildCloudToolRestriction() {
|
|
1295
1301
|
return `\u30AF\u30E9\u30A6\u30C9\u5B9F\u884C\u3067\u306F \`--disallowedTools\` \u30D5\u30E9\u30B0\u306B\u3088\u308B\u30C4\u30FC\u30EB\u5236\u9650\u304C\u53CD\u6620\u3055\u308C\u306A\u3044\u305F\u3081\u3001\u4EE5\u4E0B\u306E\u30C4\u30FC\u30EB\u3092\u4F7F\u308F\u306A\u3044\u3053\u3068: ${DISALLOWED_TOOLS.join(", ")}`;
|
|
1296
1302
|
}
|
|
1297
|
-
function buildCloudPrompt(prompt, model, target, debug = false) {
|
|
1303
|
+
function buildCloudPrompt(prompt, model, target, debug = false, startedAt) {
|
|
1298
1304
|
const principles = `\u4EE5\u4E0B\u306F\u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u5B9F\u884C\u539F\u5247\u3067\u3042\u308B\u3002\u30AF\u30E9\u30A6\u30C9\u5B9F\u884C\u3067\u306F\u30B7\u30B9\u30C6\u30E0\u30D7\u30ED\u30F3\u30D7\u30C8\u306B\u3088\u308B\u6CE8\u5165\u304C\u53CD\u6620\u3055\u308C\u306A\u3044\u305F\u3081\u3001\u30D7\u30ED\u30F3\u30D7\u30C8\u672C\u6587\u3068\u3057\u3066\u6E21\u3057\u3066\u3044\u308B\u3002
|
|
1299
1305
|
|
|
1300
1306
|
${systemPromptFor(model)}
|
|
@@ -1305,7 +1311,7 @@ ${buildCloudGitHubAccessInstruction()}`;
|
|
|
1305
1311
|
const withPrinciples = `${prompt}
|
|
1306
1312
|
|
|
1307
1313
|
${principles}`;
|
|
1308
|
-
return target ? appendCloudDoneInstruction(withPrinciples, target, debug) : withPrinciples;
|
|
1314
|
+
return target ? appendCloudDoneInstruction(withPrinciples, target, debug, startedAt) : withPrinciples;
|
|
1309
1315
|
}
|
|
1310
1316
|
function shellQuote(value) {
|
|
1311
1317
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
@@ -1590,24 +1596,31 @@ function ensureCloudPollLoop() {
|
|
|
1590
1596
|
}
|
|
1591
1597
|
})();
|
|
1592
1598
|
}
|
|
1599
|
+
async function fetchCloudDoneNumbers() {
|
|
1600
|
+
const pendingTypes = /* @__PURE__ */ new Set();
|
|
1601
|
+
for (const waiter of cloudWaiters.values()) pendingTypes.add(waiter.type);
|
|
1602
|
+
const doneKeys = /* @__PURE__ */ new Map();
|
|
1603
|
+
for (const type of pendingTypes) {
|
|
1604
|
+
try {
|
|
1605
|
+
const numbers = await listNumbersWithLabel(type, CLOUD_DONE_LABEL);
|
|
1606
|
+
doneKeys.set(type, new Set(numbers));
|
|
1607
|
+
} catch (err) {
|
|
1608
|
+
console.error(`[worker] failed to poll ${CLOUD_DONE_LABEL} for ${type}: ${err}`);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
return doneKeys;
|
|
1612
|
+
}
|
|
1593
1613
|
async function pollCloudWaiters() {
|
|
1594
1614
|
while (cloudWaiters.size > 0) {
|
|
1595
1615
|
if (herdrAbortSignal.aborted) {
|
|
1596
|
-
|
|
1616
|
+
const doneKeys2 = await fetchCloudDoneNumbers();
|
|
1617
|
+
for (const waiter of cloudWaiters.values()) {
|
|
1618
|
+
waiter.settle(doneKeys2.get(waiter.type)?.has(waiter.number) ? "completed" : "aborted");
|
|
1619
|
+
}
|
|
1597
1620
|
cloudWaiters.clear();
|
|
1598
1621
|
break;
|
|
1599
1622
|
}
|
|
1600
|
-
const
|
|
1601
|
-
for (const waiter of cloudWaiters.values()) pendingTypes.add(waiter.type);
|
|
1602
|
-
const doneKeys = /* @__PURE__ */ new Map();
|
|
1603
|
-
for (const type of pendingTypes) {
|
|
1604
|
-
try {
|
|
1605
|
-
const numbers = await listNumbersWithLabel(type, CLOUD_DONE_LABEL);
|
|
1606
|
-
doneKeys.set(type, new Set(numbers));
|
|
1607
|
-
} catch (err) {
|
|
1608
|
-
console.error(`[worker] failed to poll ${CLOUD_DONE_LABEL} for ${type}: ${err}`);
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1623
|
+
const doneKeys = await fetchCloudDoneNumbers();
|
|
1611
1624
|
const now = Date.now();
|
|
1612
1625
|
for (const [key, waiter] of [...cloudWaiters.entries()]) {
|
|
1613
1626
|
const done = doneKeys.get(waiter.type);
|
|
@@ -1644,7 +1657,7 @@ async function flagOrphanedCloudSession(target, reason, cloudSessionId) {
|
|
|
1644
1657
|
});
|
|
1645
1658
|
const causeLine = reason === "session-id" ? "\u30BB\u30C3\u30B7\u30E7\u30F3ID\u306E\u62BD\u51FA\u306B\u5931\u6557\u3057\u3066\u5F85\u6A5F\u3092\u6253\u3061\u5207\u308A\u307E\u3057\u305F\u3002\u30D7\u30ED\u30F3\u30D7\u30C8\u306F\u6295\u5165\u6E08\u307F\u3067\u3001\u30AF\u30E9\u30A6\u30C9\u30BB\u30C3\u30B7\u30E7\u30F3\u306F\u72EC\u7ACB\u3057\u3066\u7A3C\u50CD\u3057\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002" : "\u30EF\u30FC\u30AB\u30FC\u306E\u30B7\u30E3\u30C3\u30C8\u30C0\u30A6\u30F3\u3067\u5F85\u6A5F\u3092\u6253\u3061\u5207\u308A\u307E\u3057\u305F\u3002\u30AF\u30E9\u30A6\u30C9\u30BB\u30C3\u30B7\u30E7\u30F3\u306F\u7D99\u7D9A\u3057\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u9AD8\u3044\u3067\u3059\u3002";
|
|
1646
1659
|
const sessionLine = cloudSessionId ? `https://claude.ai/code/${cloudSessionId}` : "\u30BB\u30C3\u30B7\u30E7\u30F3URL\u4E0D\u660E\uFF08ID\u62BD\u51FA\u306B\u5931\u6557\uFF09";
|
|
1647
|
-
const body =
|
|
1660
|
+
const body = `${ORPHANED_CLOUD_SESSION_HEADING}
|
|
1648
1661
|
|
|
1649
1662
|
**\u539F\u56E0**: ${causeLine}
|
|
1650
1663
|
|
|
@@ -1706,7 +1719,7 @@ async function createCloudSession(args, initialPrompt, cwd, env) {
|
|
|
1706
1719
|
async function runViaCloud(args, prompt, id, onComplete, cwd, env, cloudTarget, model) {
|
|
1707
1720
|
herdrTasks.set(id, { paneId: "", tabId: "" });
|
|
1708
1721
|
const debug = hasDebugFlag();
|
|
1709
|
-
const initialPrompt = buildCloudPrompt(prompt, model ?? "", cloudTarget, debug);
|
|
1722
|
+
const initialPrompt = buildCloudPrompt(prompt, model ?? "", cloudTarget, debug, tasks.get(id)?.startedAt);
|
|
1710
1723
|
let result;
|
|
1711
1724
|
let cloudSessionId;
|
|
1712
1725
|
try {
|
package/dist/claude-args.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PermissionMode, type RunMode } from "./user-config";
|
|
2
2
|
export declare const CLOUD_REPORT_HEADING = "## claude-task-worker \u5B9F\u884C\u7D50\u679C";
|
|
3
|
+
export declare const ORPHANED_CLOUD_SESSION_HEADING = "## \u5B64\u7ACB\u30AF\u30E9\u30A6\u30C9\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u53EF\u80FD\u6027";
|
|
3
4
|
export declare const DISALLOWED_TOOLS: readonly ["Monitor", "ScheduleWakeup", "AskUserQuestion", "EnterPlanMode", "CronCreate", "CronDelete", "CronList", "RemoteTrigger", "EnterWorktree"];
|
|
4
5
|
export declare const DISALLOWED_TOOLS_ARG: string;
|
|
5
6
|
export declare const CLAUDE_SPAWN_ENV: {
|
|
@@ -34,12 +35,13 @@ export interface CloudPromptTarget {
|
|
|
34
35
|
number: number;
|
|
35
36
|
onBranch?: boolean;
|
|
36
37
|
}
|
|
37
|
-
export declare function appendCloudDoneInstruction(prompt: string, target: CloudPromptTarget, debug?: boolean): string;
|
|
38
|
+
export declare function appendCloudDoneInstruction(prompt: string, target: CloudPromptTarget, debug?: boolean, startedAt?: Date): string;
|
|
39
|
+
export declare function buildCloudOrphanCleanupInstruction(target: CloudPromptTarget, startedAt: Date): string;
|
|
38
40
|
export declare function buildCloudWorktreeInstruction(prompt: string): string;
|
|
39
41
|
export declare function buildCloudCheckoutInstruction(target: CloudPromptTarget): string;
|
|
40
42
|
export declare function buildCloudGitHubAccessInstruction(): string;
|
|
41
43
|
export declare function buildCloudToolRestriction(): string;
|
|
42
|
-
export declare function buildCloudPrompt(prompt: string, model: string, target?: CloudPromptTarget, debug?: boolean): string;
|
|
44
|
+
export declare function buildCloudPrompt(prompt: string, model: string, target?: CloudPromptTarget, debug?: boolean, startedAt?: Date): string;
|
|
43
45
|
export declare function shellQuote(value: string): string;
|
|
44
46
|
export declare function buildScriptCommand(command: string, args: string[], platform?: string): {
|
|
45
47
|
command: string;
|
package/dist/index.js
CHANGED
package/dist/lib.js
CHANGED