cc-viewer 1.9.22 → 1.9.23

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 CHANGED
@@ -156,7 +156,7 @@ Once configured, just use the `claude` command as usual. Visit `http://localhost
156
156
 
157
157
  ### Scheduled tasks
158
158
 
159
- Open **Scheduled tasks** from the (+) menu (chat input bar or terminal toolbar) to run a prompt on a schedule: a preset (hourly / daily / weekdays / weekly), a custom 5-field cron, or a one-off time. Each task either **injects the prompt into the current live session** (queued while busy, exactly as if you typed it) or **spawns a fresh isolated headless session** (SDK mode only) with a clean context.
159
+ Open **Scheduled tasks** from the (+) menu (chat input bar or terminal toolbar) to run a prompt on a schedule: a preset (hourly / daily / weekdays / weekly), a custom 5-field cron, or a one-off time. Each task either **injects the prompt into the current live session** (queued while busy, exactly as if you typed it) or **spawns a fresh isolated headless session** (SDK mode only) with a clean context. The task prompt reuses the UltraPlan input panel: pick an expert template tab (empty template by default, no wrapper) and paste/upload attachments — the wrapper and quoted paths are assembled at fire time.
160
160
 
161
161
  Task definitions and scheduling state live in `preferences.json` (the `scheduledTasks` key) and run history (last 20 per task) in `scheduled-task-runs.json` under the cc-viewer data dir, scheduled in the server's local timezone with a small per-task jitter to avoid on-the-hour stampedes. The server ticks every 10s and claims each fire under a cross-process file lock, so parallel instances / Electron tabs never double-fire. After a restart or a sleep it catches up the single most recent missed run within 7 days (earlier misses are recorded as `missed`, never back-filled one by one).
162
162
 
package/cli.js CHANGED
@@ -314,7 +314,7 @@ async function runProxyCommand(args) {
314
314
  let npmCliEntry = null;
315
315
  if (requestedClaude) {
316
316
  const selection = assertUsableClaudeSelection(resolvePreferredClaudeSelection());
317
- if (selection?.isNpmVersion && selection.path.endsWith('.js')) {
317
+ if (selection?.isNpmVersion && (selection.path.endsWith('.js') || selection.path.endsWith('.cjs'))) {
318
318
  npmCliEntry = selection.path;
319
319
  cmd = process.execPath;
320
320
  } else if (selection?.path) {
@@ -719,6 +719,29 @@ async function runImMode(platformId) {
719
719
  // (manager 拉起的 worker 由 buildChildEnv 已剥离全部 CCV_*,此处对其为 no-op,仅覆盖手动启动路径)。
720
720
  delete process.env.CCV_DISABLE_AUTO_SYSTEM_PROMPT;
721
721
 
722
+ // CodeFuse config-dir fallback: when the worker is launched directly (not via
723
+ // the CodeFuse engine), CLAUDE_CONFIG_DIR is unset and Claude would fall back
724
+ // to ~/.claude/ — which may lack .claude.json and trigger the first-run
725
+ // onboarding/trust dialogs. Probe the known CodeFuse config dirs and pin the
726
+ // one that already has a .claude.json so the worker inherits the engine's
727
+ // pre-seeded trust state. This MUST happen before runCliMode so that
728
+ // ensureHooks() writes to the same directory the child will read.
729
+ if (!process.env.CLAUDE_CONFIG_DIR) {
730
+ const { homedir } = await import('node:os');
731
+ const { join } = await import('node:path');
732
+ const { existsSync } = await import('node:fs');
733
+ const home = homedir();
734
+ const candidates = [
735
+ process.env.CCV_CODEFUSE_ENGINE_CC,
736
+ join(home, '.codefuse', 'engine', 'cc'),
737
+ join(home, '.codefuse', 'fuse', 'engine', 'cc'),
738
+ ];
739
+ const cfEngineCc = candidates.find((p) => p && existsSync(join(p, '.claude.json')));
740
+ if (cfEngineCc) {
741
+ process.env.CLAUDE_CONFIG_DIR = cfEngineCc;
742
+ }
743
+ }
744
+
722
745
  // worker 全自动:skip-permissions + 不开浏览器,工作目录设为 IM_<id>/
723
746
  return runCliMode(['--dangerously-skip-permissions'], dir, true);
724
747
  }
@@ -926,6 +949,7 @@ async function runSdkMode(extraClaudeArgs = [], cwd, noOpen = false) {
926
949
  serverMod.setSdkGetContextUsageSnapshot(sdkManager.getContextUsageSnapshot);
927
950
  serverMod.setSdkGetMcpStatusSnapshot(sdkManager.getMcpStatusSnapshot);
928
951
  serverMod.setSdkGetSessionStateSnapshot(sdkManager.getSessionStateSnapshot);
952
+ serverMod.setSdkGetSdkTaskSnapshot(sdkManager.getSdkTaskSnapshot);
929
953
  // Busy-queue bubble actions (queue-send-now / queue-remove / queue-clear / replay).
930
954
  serverMod.setSdkSendQueuedNow(sdkManager.sendQueuedNow);
931
955
  serverMod.setSdkRemoveQueued(sdkManager.removeQueued);