pikiloom 0.4.63 → 0.4.64

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pikiloom",
3
- "version": "0.4.63",
3
+ "version": "0.4.64",
4
4
  "description": "Put the world's smartest AI agents in your pocket. Command local Claude & Gemini via IM. | 让最好用的 IM 变成你电脑上的顶级 Agent 控制台",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,7 @@ export declare function claudeBgAgentHoldCapMs(): number;
24
24
  export declare function claudeTurnHasAgentBackground(s: any): boolean;
25
25
  export declare function claudeBgHoldRecheckMs(): number;
26
26
  export declare function claudeBgSettleQuietMs(): number;
27
- export declare function claudeModelStallMs(): number;
27
+ export declare function claudeModelStallMs(effort?: string | null): number;
28
28
  export declare const CLAUDE_TRUNCATED_RECOVERY_PROMPT: string;
29
29
  export declare function claudeTruncatedRecoveryEnabled(): boolean;
30
30
  export declare function isClaudeSyntheticResumeNoise(text: string): boolean;
@@ -193,7 +193,7 @@ export class ClaudeDriver {
193
193
  return;
194
194
  }
195
195
  settleResult({ stopReason: 'stalled', kill: false, ok: false });
196
- }, claudeModelStallMs());
196
+ }, claudeModelStallMs(input.effort));
197
197
  unref(modelStallTimer);
198
198
  };
199
199
  try {
@@ -801,15 +801,22 @@ export function claudeBgSettleQuietMs() {
801
801
  return Number.isFinite(raw) && raw > 0 ? raw : CLAUDE_BG_SETTLE_QUIET_DEFAULT_MS;
802
802
  }
803
803
  // How long the model may stay COMPLETELY silent after a tool_result (control handed back to it,
804
- // no background pending) before the driver gives up and settles the turn as 'stalled'. Deliberately
805
- // generous: legitimate silent extended-thinking (subscription accounts stream no thinking text) and
806
- // slow providers must not trip it, and a still-running tool never trips it (it has no tool_result
807
- // yet). This is the backstop for a turn that would otherwise hang forever with the answer never
808
- // delivered. Override with PIKILOOM_CLAUDE_MODEL_STALL_MS.
809
- const CLAUDE_MODEL_STALL_DEFAULT_MS = 120_000;
810
- export function claudeModelStallMs() {
804
+ // no background pending) before the driver gives up and settles the turn as 'stalled'. Must be
805
+ // generous: subscription accounts stream NO events during extended thinking, and at the reasoning
806
+ // rungs a legitimate silent think regularly exceeds two minutes the original 120s default
807
+ // misfired on exactly that (settling a LIVE turn as 'stalled' and then killing its still-running
808
+ // tool via the leak-guard; mirasim#111). A too-long window only means a truly hung turn shows its
809
+ // dead spinner longer, so the costs are asymmetric — err long. Effort-laddered: the deep-reasoning
810
+ // rungs (high and up) think the longest. A still-running tool never trips this (it has no
811
+ // tool_result yet). Override with PIKILOOM_CLAUDE_MODEL_STALL_MS (wins over the ladder).
812
+ const CLAUDE_MODEL_STALL_DEFAULT_MS = 300_000;
813
+ const CLAUDE_MODEL_STALL_DEEP_MS = 600_000;
814
+ const CLAUDE_DEEP_REASONING_EFFORTS = new Set(['high', 'xhigh', 'max', 'ultra']);
815
+ export function claudeModelStallMs(effort) {
811
816
  const raw = Number(process.env.PIKILOOM_CLAUDE_MODEL_STALL_MS);
812
- return Number.isFinite(raw) && raw > 0 ? raw : CLAUDE_MODEL_STALL_DEFAULT_MS;
817
+ if (Number.isFinite(raw) && raw > 0)
818
+ return raw;
819
+ return effort && CLAUDE_DEEP_REASONING_EFFORTS.has(effort) ? CLAUDE_MODEL_STALL_DEEP_MS : CLAUDE_MODEL_STALL_DEFAULT_MS;
813
820
  }
814
821
  // In-process self-heal for a truncated turn: when a clean result lands while the tool loop is
815
822
  // still dangling (the model's closing round came back empty), the stdin is still open — inject