@cnwenf/occ 2.1.255 → 2.1.257

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.
Files changed (2) hide show
  1. package/dist/cli.js +100 -58
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -57636,14 +57636,10 @@ var init_env = __esm(() => {
57636
57636
  init_which();
57637
57637
  getGlobalClaudeFile = memoize_default(() => {
57638
57638
  if (getFsImplementation().existsSync(join16(getClaudeConfigHomeDir(), ".config.json"))) {
57639
- process.stderr.write(`[DIAGCFG] getGlobalClaudeFile -> legacy .config.json at ${join16(getClaudeConfigHomeDir(), ".config.json")}
57640
- `);
57641
57639
  return join16(getClaudeConfigHomeDir(), ".config.json");
57642
57640
  }
57643
57641
  const filename = `.claude${fileSuffixForOauthConfig()}.json`;
57644
57642
  const p = join16(process.env.CLAUDE_CONFIG_DIR || homedir7(), filename);
57645
- process.stderr.write(`[DIAGCFG] getGlobalClaudeFile -> ${p} (homedir=${homedir7()} CLAUDE_CONFIG_DIR=${process.env.CLAUDE_CONFIG_DIR ?? "unset"})
57646
- `);
57647
57643
  return p;
57648
57644
  });
57649
57645
  hasInternetAccess = memoize_default(async () => {
@@ -271279,6 +271275,19 @@ var init_sdkEventQueue = __esm(() => {
271279
271275
  });
271280
271276
 
271281
271277
  // src/utils/task/framework.ts
271278
+ var exports_framework = {};
271279
+ __export(exports_framework, {
271280
+ updateTaskState: () => updateTaskState,
271281
+ registerTask: () => registerTask,
271282
+ pollTasks: () => pollTasks,
271283
+ getRunningTasks: () => getRunningTasks,
271284
+ generateTaskAttachments: () => generateTaskAttachments,
271285
+ evictTerminalTask: () => evictTerminalTask,
271286
+ applyTaskOffsetsAndEvictions: () => applyTaskOffsetsAndEvictions,
271287
+ STOPPED_DISPLAY_MS: () => STOPPED_DISPLAY_MS,
271288
+ POLL_INTERVAL_MS: () => POLL_INTERVAL_MS2,
271289
+ PANEL_GRACE_MS: () => PANEL_GRACE_MS
271290
+ });
271282
271291
  function updateTaskState(taskId, setAppState, updater) {
271283
271292
  setAppState((prev) => {
271284
271293
  const task = prev.tasks?.[taskId];
@@ -271403,7 +271412,43 @@ function applyTaskOffsetsAndEvictions(setAppState, updatedTaskOffsets, evictedTa
271403
271412
  return changed ? { ...prev, tasks: newTasks } : prev;
271404
271413
  });
271405
271414
  }
271406
- var STOPPED_DISPLAY_MS = 3000, PANEL_GRACE_MS = 30000;
271415
+ async function pollTasks(getAppState, setAppState) {
271416
+ const state3 = getAppState();
271417
+ const { attachments, updatedTaskOffsets, evictedTaskIds } = await generateTaskAttachments(state3);
271418
+ applyTaskOffsetsAndEvictions(setAppState, updatedTaskOffsets, evictedTaskIds);
271419
+ for (const attachment of attachments) {
271420
+ enqueueTaskNotification(attachment);
271421
+ }
271422
+ }
271423
+ function enqueueTaskNotification(attachment) {
271424
+ const statusText = getStatusText(attachment.status);
271425
+ const outputPath = getTaskOutputPath(attachment.taskId);
271426
+ const toolUseIdLine = attachment.toolUseId ? `
271427
+ <${TOOL_USE_ID_TAG}>${attachment.toolUseId}</${TOOL_USE_ID_TAG}>` : "";
271428
+ const message = `<${TASK_NOTIFICATION_TAG}>
271429
+ <${TASK_ID_TAG}>${attachment.taskId}</${TASK_ID_TAG}>${toolUseIdLine}
271430
+ <${TASK_TYPE_TAG}>${attachment.taskType}</${TASK_TYPE_TAG}>
271431
+ <${OUTPUT_FILE_TAG}>${outputPath}</${OUTPUT_FILE_TAG}>
271432
+ <${STATUS_TAG}>${attachment.status}</${STATUS_TAG}>
271433
+ <${SUMMARY_TAG}>Task "${attachment.description}" ${statusText}</${SUMMARY_TAG}>
271434
+ </${TASK_NOTIFICATION_TAG}>`;
271435
+ enqueuePendingNotification({ value: message, mode: "task-notification" });
271436
+ }
271437
+ function getStatusText(status) {
271438
+ switch (status) {
271439
+ case "completed":
271440
+ return "completed successfully";
271441
+ case "failed":
271442
+ return "failed";
271443
+ case "killed":
271444
+ return "was stopped";
271445
+ case "running":
271446
+ return "is running";
271447
+ case "pending":
271448
+ return "is pending";
271449
+ }
271450
+ }
271451
+ var POLL_INTERVAL_MS2 = 1000, STOPPED_DISPLAY_MS = 3000, PANEL_GRACE_MS = 30000;
271407
271452
  var init_framework = __esm(() => {
271408
271453
  init_xml();
271409
271454
  init_Task();
@@ -396192,7 +396237,7 @@ function AgentProgressLine(t0) {
396192
396237
  } else {
396193
396238
  t32 = $3[4];
396194
396239
  }
396195
- const getStatusText = t32;
396240
+ const getStatusText2 = t32;
396196
396241
  let t4;
396197
396242
  if ($3[5] !== treeChar) {
396198
396243
  t4 = /* @__PURE__ */ jsx_dev_runtime52.jsxDEV(ThemedText, {
@@ -396311,7 +396356,7 @@ function AgentProgressLine(t0) {
396311
396356
  t9 = $3[24];
396312
396357
  }
396313
396358
  let t10;
396314
- if ($3[25] !== getStatusText || $3[26] !== isBackgrounded || $3[27] !== isLast) {
396359
+ if ($3[25] !== getStatusText2 || $3[26] !== isBackgrounded || $3[27] !== isLast) {
396315
396360
  t10 = !isBackgrounded && /* @__PURE__ */ jsx_dev_runtime52.jsxDEV(ThemedBox_default, {
396316
396361
  paddingLeft: 3,
396317
396362
  flexDirection: "row",
@@ -396322,11 +396367,11 @@ function AgentProgressLine(t0) {
396322
396367
  }, undefined, false, undefined, this),
396323
396368
  /* @__PURE__ */ jsx_dev_runtime52.jsxDEV(ThemedText, {
396324
396369
  dimColor: true,
396325
- children: getStatusText()
396370
+ children: getStatusText2()
396326
396371
  }, undefined, false, undefined, this)
396327
396372
  ]
396328
396373
  }, undefined, true, undefined, this);
396329
- $3[25] = getStatusText;
396374
+ $3[25] = getStatusText2;
396330
396375
  $3[26] = isBackgrounded;
396331
396376
  $3[27] = isLast;
396332
396377
  $3[28] = t10;
@@ -459192,7 +459237,7 @@ async function tryClaimNextTask(taskListId, agentName) {
459192
459237
  }
459193
459238
  }
459194
459239
  async function waitForNextPromptOrShutdown(identity8, abortController, taskId, getAppState, setAppState, taskListId) {
459195
- const POLL_INTERVAL_MS2 = 500;
459240
+ const POLL_INTERVAL_MS3 = 500;
459196
459241
  logForDebugging(`[inProcessRunner] ${identity8.agentName} starting poll loop (abort=${abortController.signal.aborted})`);
459197
459242
  let pollCount = 0;
459198
459243
  while (!abortController.signal.aborted) {
@@ -459224,7 +459269,7 @@ async function waitForNextPromptOrShutdown(identity8, abortController, taskId, g
459224
459269
  };
459225
459270
  }
459226
459271
  if (pollCount > 0) {
459227
- await sleep3(POLL_INTERVAL_MS2);
459272
+ await sleep3(POLL_INTERVAL_MS3);
459228
459273
  }
459229
459274
  pollCount++;
459230
459275
  if (abortController.signal.aborted) {
@@ -475593,6 +475638,7 @@ async function* runAgent({
475593
475638
  override,
475594
475639
  model,
475595
475640
  maxTurns,
475641
+ subagentDepth,
475596
475642
  preserveToolUseResults,
475597
475643
  availableTools,
475598
475644
  allowedTools,
@@ -479942,7 +479988,7 @@ async function restoreRemoteAgentTasksImpl(context6) {
479942
479988
  }
479943
479989
  function startRemoteSessionPolling(taskId, context6) {
479944
479990
  let isRunning = true;
479945
- const POLL_INTERVAL_MS2 = 1000;
479991
+ const POLL_INTERVAL_MS3 = 1000;
479946
479992
  const REMOTE_REVIEW_TIMEOUT_MS = 30 * 60 * 1000;
479947
479993
  const STABLE_IDLE_POLLS = 5;
479948
479994
  let consecutiveIdlePolls = 0;
@@ -480107,7 +480153,7 @@ function startRemoteSessionPolling(taskId, context6) {
480107
480153
  } catch {}
480108
480154
  }
480109
480155
  if (isRunning) {
480110
- setTimeout(poll, POLL_INTERVAL_MS2);
480156
+ setTimeout(poll, POLL_INTERVAL_MS3);
480111
480157
  }
480112
480158
  };
480113
480159
  poll();
@@ -481627,10 +481673,10 @@ var init_AgentTool = __esm(() => {
481627
481673
  let currentAppState = appState;
481628
481674
  if (hasPendingRequiredServers) {
481629
481675
  const MAX_WAIT_MS = 30000;
481630
- const POLL_INTERVAL_MS2 = 500;
481676
+ const POLL_INTERVAL_MS3 = 500;
481631
481677
  const deadline = Date.now() + MAX_WAIT_MS;
481632
481678
  while (Date.now() < deadline) {
481633
- await sleep3(POLL_INTERVAL_MS2);
481679
+ await sleep3(POLL_INTERVAL_MS3);
481634
481680
  currentAppState = toolUseContext.getAppState();
481635
481681
  const hasFailedRequiredServer = currentAppState.mcp.clients.some((c9) => c9.type === "failed" && requiredMcpServers.some((pattern) => c9.name.toLowerCase().includes(pattern.toLowerCase())));
481636
481682
  if (hasFailedRequiredServer)
@@ -512427,6 +512473,7 @@ You MUST call the ${SYNTHETIC_OUTPUT_TOOL_NAME} tool exactly once at the end of
512427
512473
  canShowPermissionPrompts: false,
512428
512474
  querySource: "workflow",
512429
512475
  model: opts.model,
512476
+ subagentDepth: (ctx.toolUseContext.subagentDepth ?? 0) + 1,
512430
512477
  maxTurns: opts.schema ? 30 : undefined,
512431
512478
  availableTools: ctx.availableTools,
512432
512479
  worktreePath,
@@ -615207,7 +615254,7 @@ async function pollForApprovedExitPlanMode(sessionId, timeoutMs, onPhaseChange,
615207
615254
  if (!transient || ++failures >= MAX_CONSECUTIVE_FAILURES) {
615208
615255
  throw new UltraplanPollError(e4 instanceof Error ? e4.message : String(e4), "network_or_unknown", scanner.rejectCount, { cause: e4 });
615209
615256
  }
615210
- await sleep3(POLL_INTERVAL_MS2);
615257
+ await sleep3(POLL_INTERVAL_MS3);
615211
615258
  continue;
615212
615259
  }
615213
615260
  let result;
@@ -615240,7 +615287,7 @@ async function pollForApprovedExitPlanMode(sessionId, timeoutMs, onPhaseChange,
615240
615287
  lastPhase = phase;
615241
615288
  onPhaseChange?.(phase);
615242
615289
  }
615243
- await sleep3(POLL_INTERVAL_MS2);
615290
+ await sleep3(POLL_INTERVAL_MS3);
615244
615291
  }
615245
615292
  throw new UltraplanPollError(scanner.everSeenPending ? `no approval after ${timeoutMs / 1000}s` : `ExitPlanMode never reached after ${timeoutMs / 1000}s (the remote container failed to start, or session ID mismatch?)`, scanner.everSeenPending ? "timeout_pending" : "timeout_no_plan", scanner.rejectCount);
615246
615293
  }
@@ -615272,7 +615319,7 @@ function extractApprovedPlan(content) {
615272
615319
  }
615273
615320
  throw new Error(`ExitPlanMode approved but tool_result has no "## Approved Plan:" marker \u2014 remote may have hit the empty-plan or isAgent branch. Content preview: ${text2.slice(0, 200)}`);
615274
615321
  }
615275
- var POLL_INTERVAL_MS2 = 3000, MAX_CONSECUTIVE_FAILURES = 5, UltraplanPollError, ULTRAPLAN_TELEPORT_SENTINEL = "__ULTRAPLAN_TELEPORT_LOCAL__";
615322
+ var POLL_INTERVAL_MS3 = 3000, MAX_CONSECUTIVE_FAILURES = 5, UltraplanPollError, ULTRAPLAN_TELEPORT_SENTINEL = "__ULTRAPLAN_TELEPORT_LOCAL__";
615276
615323
  var init_ccrSession = __esm(() => {
615277
615324
  init_debug();
615278
615325
  init_api2();
@@ -690179,14 +690226,14 @@ function usePrStatus(isLoading, enabled2 = true) {
690179
690226
  return;
690180
690227
  }
690181
690228
  if (!cancelled) {
690182
- timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS3);
690229
+ timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS4);
690183
690230
  }
690184
690231
  }
690185
690232
  const elapsed = Date.now() - lastFetchRef.current;
690186
- if (elapsed >= POLL_INTERVAL_MS3) {
690233
+ if (elapsed >= POLL_INTERVAL_MS4) {
690187
690234
  poll();
690188
690235
  } else {
690189
- timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS3 - elapsed);
690236
+ timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS4 - elapsed);
690190
690237
  }
690191
690238
  return () => {
690192
690239
  cancelled = true;
@@ -690198,7 +690245,7 @@ function usePrStatus(isLoading, enabled2 = true) {
690198
690245
  }, [isLoading, enabled2]);
690199
690246
  return prStatus;
690200
690247
  }
690201
- var import_react248, POLL_INTERVAL_MS3 = 60000, SLOW_GH_THRESHOLD_MS = 4000, IDLE_STOP_MS, INITIAL_STATE4;
690248
+ var import_react248, POLL_INTERVAL_MS4 = 60000, SLOW_GH_THRESHOLD_MS = 4000, IDLE_STOP_MS, INITIAL_STATE4;
690202
690249
  var init_usePrStatus = __esm(() => {
690203
690250
  init_state();
690204
690251
  init_ghPrStatus();
@@ -717771,9 +717818,25 @@ function FleetViewScreen(props) {
717771
717818
  const id = setInterval(() => setNow(Date.now()), 1000);
717772
717819
  return () => clearInterval(id);
717773
717820
  }, []);
717821
+ React150.useEffect(() => {
717822
+ const id = setInterval(() => {
717823
+ for (const task of Object.values(tasks2)) {
717824
+ if (task.status === "running" && task.pid) {
717825
+ try {
717826
+ const { writeFileSync: writeFileSync13 } = __require("fs");
717827
+ const { join: join173 } = __require("path");
717828
+ const heartbeatPath = join173(__require("os").tmpdir(), `.fleetview-heartbeat-${task.pid}`);
717829
+ writeFileSync13(heartbeatPath, String(Date.now()));
717830
+ } catch {}
717831
+ }
717832
+ }
717833
+ }, 5000);
717834
+ return () => clearInterval(id);
717835
+ }, [tasks2]);
717774
717836
  const [fleetActive, setFleetActive] = React150.useState(false);
717775
717837
  const [selectedIndex, setSelectedIndex] = React150.useState(0);
717776
717838
  const [showPreview, setShowPreview] = React150.useState(false);
717839
+ const [groupMode, setGroupMode] = React150.useState("state");
717777
717840
  const fleetRows = React150.useMemo(() => buildFleetRows(tasks2, now2), [tasks2, now2]);
717778
717841
  const hasJobs = fleetRows.running.length > 0 || fleetRows.done.length > 0;
717779
717842
  React150.useEffect(() => {
@@ -717828,6 +717891,19 @@ function FleetViewScreen(props) {
717828
717891
  }
717829
717892
  return;
717830
717893
  }
717894
+ if (input === "g" && key3.ctrl) {
717895
+ event.stopImmediatePropagation();
717896
+ setGroupMode((m5) => m5 === "state" ? "group" : "state");
717897
+ return;
717898
+ }
717899
+ if (input === "x" && fleetRows.running[selectedIndex]) {
717900
+ event.stopImmediatePropagation();
717901
+ const task = fleetRows.running[selectedIndex];
717902
+ try {
717903
+ (init_framework(), __toCommonJS(exports_framework)).updateTaskState(task.id, { status: "killed" });
717904
+ } catch {}
717905
+ return;
717906
+ }
717831
717907
  }, { isActive: !disabled && (hasJobs || fleetActive) });
717832
717908
  if (!isAgentsFleetEnabled())
717833
717909
  return null;
@@ -735419,7 +735495,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
735419
735495
  const teamContext = currentAppState.teamContext;
735420
735496
  if (teamContext && isTeamLead(teamContext)) {
735421
735497
  const agentName = "team-lead";
735422
- const POLL_INTERVAL_MS4 = 500;
735498
+ const POLL_INTERVAL_MS5 = 500;
735423
735499
  while (true) {
735424
735500
  const refreshedState = getAppState();
735425
735501
  const hasActiveTeammates = hasActiveInProcessTeammates(refreshedState) || refreshedState.teamContext && Object.keys(refreshedState.teamContext.teammates).length > 0;
@@ -735486,7 +735562,7 @@ ${m5.text}
735486
735562
  run();
735487
735563
  return;
735488
735564
  }
735489
- await sleep3(POLL_INTERVAL_MS4);
735565
+ await sleep3(POLL_INTERVAL_MS5);
735490
735566
  }
735491
735567
  }
735492
735568
  }
@@ -740782,54 +740858,26 @@ async function logStartupTelemetry() {
740782
740858
  });
740783
740859
  }
740784
740860
  function runMigrations() {
740785
- process.stderr.write(`[DIAG5] runMigrations entry
740786
- `);
740787
740861
  if (getGlobalConfig().migrationVersion !== CURRENT_MIGRATION_VERSION) {
740788
- process.stderr.write(`[DIAG5] before migrateAutoUpdates
740789
- `);
740790
740862
  migrateAutoUpdatesToSettings();
740791
- process.stderr.write(`[DIAG5] before migrateBypass
740792
- `);
740793
740863
  migrateBypassPermissionsAcceptedToSettings();
740794
- process.stderr.write(`[DIAG5] before migrateEnableAllMcp
740795
- `);
740796
740864
  migrateEnableAllProjectMcpServersToSettings();
740797
- process.stderr.write(`[DIAG5] before resetPro
740798
- `);
740799
740865
  resetProToOpusDefault();
740800
- process.stderr.write(`[DIAG5] before migrateSonnet1m
740801
- `);
740802
740866
  migrateSonnet1mToSonnet45();
740803
- process.stderr.write(`[DIAG5] before migrateLegacyOpus
740804
- `);
740805
740867
  migrateLegacyOpusToCurrent();
740806
- process.stderr.write(`[DIAG5] before migrateSonnet45
740807
- `);
740808
740868
  migrateSonnet45ToSonnet46();
740809
- process.stderr.write(`[DIAG5] before migrateOpus1m
740810
- `);
740811
740869
  migrateOpusToOpus1m();
740812
- process.stderr.write(`[DIAG5] before migrateReplBridge
740813
- `);
740814
740870
  migrateReplBridgeEnabledToRemoteControlAtStartup();
740815
740871
  if (feature("TRANSCRIPT_CLASSIFIER")) {
740816
740872
  resetAutoModeOptInForDefaultOffer();
740817
740873
  }
740818
740874
  if (false) {}
740819
- process.stderr.write(`[DIAG5] before saveGlobalConfig
740820
- `);
740821
740875
  saveGlobalConfig((prev) => prev.migrationVersion === CURRENT_MIGRATION_VERSION ? prev : {
740822
740876
  ...prev,
740823
740877
  migrationVersion: CURRENT_MIGRATION_VERSION
740824
740878
  });
740825
- process.stderr.write(`[DIAG5] after saveGlobalConfig
740826
- `);
740827
740879
  }
740828
- process.stderr.write(`[DIAG5] before migrateChangelog
740829
- `);
740830
740880
  migrateChangelogFromConfig().catch(() => {});
740831
- process.stderr.write(`[DIAG5] runMigrations exit
740832
- `);
740833
740881
  }
740834
740882
  function prefetchSystemContextIfSafe() {
740835
740883
  const isNonInteractiveSession = getIsNonInteractiveSession();
@@ -741213,17 +741261,11 @@ async function run() {
741213
741261
  initSinks2();
741214
741262
  profileCheckpoint("preAction_after_sinks");
741215
741263
  const pluginDir = thisCommand.getOptionValue("pluginDir");
741216
- process.stderr.write(`[DIAG4] before pluginDir check
741217
- `);
741218
741264
  if (Array.isArray(pluginDir) && pluginDir.length > 0 && pluginDir.every((p4) => typeof p4 === "string")) {
741219
741265
  setInlinePlugins(pluginDir);
741220
741266
  clearPluginCache("preAction: --plugin-dir inline plugins");
741221
741267
  }
741222
- process.stderr.write(`[DIAG4] before runMigrations
741223
- `);
741224
741268
  runMigrations();
741225
- process.stderr.write(`[DIAG4] after runMigrations
741226
- `);
741227
741269
  profileCheckpoint("preAction_after_migrations");
741228
741270
  if (getSettingsForSource("policySettings")?.forceRemoteSettingsRefresh) {
741229
741271
  const result = await forceRefreshRemoteManagedSettingsOrFailClosed();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.255",
3
+ "version": "2.1.257",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {