@cnwenf/occ 2.1.255 → 2.1.256

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 +98 -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) {
@@ -479942,7 +479987,7 @@ async function restoreRemoteAgentTasksImpl(context6) {
479942
479987
  }
479943
479988
  function startRemoteSessionPolling(taskId, context6) {
479944
479989
  let isRunning = true;
479945
- const POLL_INTERVAL_MS2 = 1000;
479990
+ const POLL_INTERVAL_MS3 = 1000;
479946
479991
  const REMOTE_REVIEW_TIMEOUT_MS = 30 * 60 * 1000;
479947
479992
  const STABLE_IDLE_POLLS = 5;
479948
479993
  let consecutiveIdlePolls = 0;
@@ -480107,7 +480152,7 @@ function startRemoteSessionPolling(taskId, context6) {
480107
480152
  } catch {}
480108
480153
  }
480109
480154
  if (isRunning) {
480110
- setTimeout(poll, POLL_INTERVAL_MS2);
480155
+ setTimeout(poll, POLL_INTERVAL_MS3);
480111
480156
  }
480112
480157
  };
480113
480158
  poll();
@@ -481627,10 +481672,10 @@ var init_AgentTool = __esm(() => {
481627
481672
  let currentAppState = appState;
481628
481673
  if (hasPendingRequiredServers) {
481629
481674
  const MAX_WAIT_MS = 30000;
481630
- const POLL_INTERVAL_MS2 = 500;
481675
+ const POLL_INTERVAL_MS3 = 500;
481631
481676
  const deadline = Date.now() + MAX_WAIT_MS;
481632
481677
  while (Date.now() < deadline) {
481633
- await sleep3(POLL_INTERVAL_MS2);
481678
+ await sleep3(POLL_INTERVAL_MS3);
481634
481679
  currentAppState = toolUseContext.getAppState();
481635
481680
  const hasFailedRequiredServer = currentAppState.mcp.clients.some((c9) => c9.type === "failed" && requiredMcpServers.some((pattern) => c9.name.toLowerCase().includes(pattern.toLowerCase())));
481636
481681
  if (hasFailedRequiredServer)
@@ -615207,7 +615252,7 @@ async function pollForApprovedExitPlanMode(sessionId, timeoutMs, onPhaseChange,
615207
615252
  if (!transient || ++failures >= MAX_CONSECUTIVE_FAILURES) {
615208
615253
  throw new UltraplanPollError(e4 instanceof Error ? e4.message : String(e4), "network_or_unknown", scanner.rejectCount, { cause: e4 });
615209
615254
  }
615210
- await sleep3(POLL_INTERVAL_MS2);
615255
+ await sleep3(POLL_INTERVAL_MS3);
615211
615256
  continue;
615212
615257
  }
615213
615258
  let result;
@@ -615240,7 +615285,7 @@ async function pollForApprovedExitPlanMode(sessionId, timeoutMs, onPhaseChange,
615240
615285
  lastPhase = phase;
615241
615286
  onPhaseChange?.(phase);
615242
615287
  }
615243
- await sleep3(POLL_INTERVAL_MS2);
615288
+ await sleep3(POLL_INTERVAL_MS3);
615244
615289
  }
615245
615290
  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
615291
  }
@@ -615272,7 +615317,7 @@ function extractApprovedPlan(content) {
615272
615317
  }
615273
615318
  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
615319
  }
615275
- var POLL_INTERVAL_MS2 = 3000, MAX_CONSECUTIVE_FAILURES = 5, UltraplanPollError, ULTRAPLAN_TELEPORT_SENTINEL = "__ULTRAPLAN_TELEPORT_LOCAL__";
615320
+ var POLL_INTERVAL_MS3 = 3000, MAX_CONSECUTIVE_FAILURES = 5, UltraplanPollError, ULTRAPLAN_TELEPORT_SENTINEL = "__ULTRAPLAN_TELEPORT_LOCAL__";
615276
615321
  var init_ccrSession = __esm(() => {
615277
615322
  init_debug();
615278
615323
  init_api2();
@@ -690179,14 +690224,14 @@ function usePrStatus(isLoading, enabled2 = true) {
690179
690224
  return;
690180
690225
  }
690181
690226
  if (!cancelled) {
690182
- timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS3);
690227
+ timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS4);
690183
690228
  }
690184
690229
  }
690185
690230
  const elapsed = Date.now() - lastFetchRef.current;
690186
- if (elapsed >= POLL_INTERVAL_MS3) {
690231
+ if (elapsed >= POLL_INTERVAL_MS4) {
690187
690232
  poll();
690188
690233
  } else {
690189
- timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS3 - elapsed);
690234
+ timeoutRef.current = setTimeout(poll, POLL_INTERVAL_MS4 - elapsed);
690190
690235
  }
690191
690236
  return () => {
690192
690237
  cancelled = true;
@@ -690198,7 +690243,7 @@ function usePrStatus(isLoading, enabled2 = true) {
690198
690243
  }, [isLoading, enabled2]);
690199
690244
  return prStatus;
690200
690245
  }
690201
- var import_react248, POLL_INTERVAL_MS3 = 60000, SLOW_GH_THRESHOLD_MS = 4000, IDLE_STOP_MS, INITIAL_STATE4;
690246
+ var import_react248, POLL_INTERVAL_MS4 = 60000, SLOW_GH_THRESHOLD_MS = 4000, IDLE_STOP_MS, INITIAL_STATE4;
690202
690247
  var init_usePrStatus = __esm(() => {
690203
690248
  init_state();
690204
690249
  init_ghPrStatus();
@@ -717771,9 +717816,25 @@ function FleetViewScreen(props) {
717771
717816
  const id = setInterval(() => setNow(Date.now()), 1000);
717772
717817
  return () => clearInterval(id);
717773
717818
  }, []);
717819
+ React150.useEffect(() => {
717820
+ const id = setInterval(() => {
717821
+ for (const task of Object.values(tasks2)) {
717822
+ if (task.status === "running" && task.pid) {
717823
+ try {
717824
+ const { writeFileSync: writeFileSync13 } = __require("fs");
717825
+ const { join: join173 } = __require("path");
717826
+ const heartbeatPath = join173(__require("os").tmpdir(), `.fleetview-heartbeat-${task.pid}`);
717827
+ writeFileSync13(heartbeatPath, String(Date.now()));
717828
+ } catch {}
717829
+ }
717830
+ }
717831
+ }, 5000);
717832
+ return () => clearInterval(id);
717833
+ }, [tasks2]);
717774
717834
  const [fleetActive, setFleetActive] = React150.useState(false);
717775
717835
  const [selectedIndex, setSelectedIndex] = React150.useState(0);
717776
717836
  const [showPreview, setShowPreview] = React150.useState(false);
717837
+ const [groupMode, setGroupMode] = React150.useState("state");
717777
717838
  const fleetRows = React150.useMemo(() => buildFleetRows(tasks2, now2), [tasks2, now2]);
717778
717839
  const hasJobs = fleetRows.running.length > 0 || fleetRows.done.length > 0;
717779
717840
  React150.useEffect(() => {
@@ -717828,6 +717889,19 @@ function FleetViewScreen(props) {
717828
717889
  }
717829
717890
  return;
717830
717891
  }
717892
+ if (input === "g" && key3.ctrl) {
717893
+ event.stopImmediatePropagation();
717894
+ setGroupMode((m5) => m5 === "state" ? "group" : "state");
717895
+ return;
717896
+ }
717897
+ if (input === "x" && fleetRows.running[selectedIndex]) {
717898
+ event.stopImmediatePropagation();
717899
+ const task = fleetRows.running[selectedIndex];
717900
+ try {
717901
+ (init_framework(), __toCommonJS(exports_framework)).updateTaskState(task.id, { status: "killed" });
717902
+ } catch {}
717903
+ return;
717904
+ }
717831
717905
  }, { isActive: !disabled && (hasJobs || fleetActive) });
717832
717906
  if (!isAgentsFleetEnabled())
717833
717907
  return null;
@@ -735419,7 +735493,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
735419
735493
  const teamContext = currentAppState.teamContext;
735420
735494
  if (teamContext && isTeamLead(teamContext)) {
735421
735495
  const agentName = "team-lead";
735422
- const POLL_INTERVAL_MS4 = 500;
735496
+ const POLL_INTERVAL_MS5 = 500;
735423
735497
  while (true) {
735424
735498
  const refreshedState = getAppState();
735425
735499
  const hasActiveTeammates = hasActiveInProcessTeammates(refreshedState) || refreshedState.teamContext && Object.keys(refreshedState.teamContext.teammates).length > 0;
@@ -735486,7 +735560,7 @@ ${m5.text}
735486
735560
  run();
735487
735561
  return;
735488
735562
  }
735489
- await sleep3(POLL_INTERVAL_MS4);
735563
+ await sleep3(POLL_INTERVAL_MS5);
735490
735564
  }
735491
735565
  }
735492
735566
  }
@@ -740782,54 +740856,26 @@ async function logStartupTelemetry() {
740782
740856
  });
740783
740857
  }
740784
740858
  function runMigrations() {
740785
- process.stderr.write(`[DIAG5] runMigrations entry
740786
- `);
740787
740859
  if (getGlobalConfig().migrationVersion !== CURRENT_MIGRATION_VERSION) {
740788
- process.stderr.write(`[DIAG5] before migrateAutoUpdates
740789
- `);
740790
740860
  migrateAutoUpdatesToSettings();
740791
- process.stderr.write(`[DIAG5] before migrateBypass
740792
- `);
740793
740861
  migrateBypassPermissionsAcceptedToSettings();
740794
- process.stderr.write(`[DIAG5] before migrateEnableAllMcp
740795
- `);
740796
740862
  migrateEnableAllProjectMcpServersToSettings();
740797
- process.stderr.write(`[DIAG5] before resetPro
740798
- `);
740799
740863
  resetProToOpusDefault();
740800
- process.stderr.write(`[DIAG5] before migrateSonnet1m
740801
- `);
740802
740864
  migrateSonnet1mToSonnet45();
740803
- process.stderr.write(`[DIAG5] before migrateLegacyOpus
740804
- `);
740805
740865
  migrateLegacyOpusToCurrent();
740806
- process.stderr.write(`[DIAG5] before migrateSonnet45
740807
- `);
740808
740866
  migrateSonnet45ToSonnet46();
740809
- process.stderr.write(`[DIAG5] before migrateOpus1m
740810
- `);
740811
740867
  migrateOpusToOpus1m();
740812
- process.stderr.write(`[DIAG5] before migrateReplBridge
740813
- `);
740814
740868
  migrateReplBridgeEnabledToRemoteControlAtStartup();
740815
740869
  if (feature("TRANSCRIPT_CLASSIFIER")) {
740816
740870
  resetAutoModeOptInForDefaultOffer();
740817
740871
  }
740818
740872
  if (false) {}
740819
- process.stderr.write(`[DIAG5] before saveGlobalConfig
740820
- `);
740821
740873
  saveGlobalConfig((prev) => prev.migrationVersion === CURRENT_MIGRATION_VERSION ? prev : {
740822
740874
  ...prev,
740823
740875
  migrationVersion: CURRENT_MIGRATION_VERSION
740824
740876
  });
740825
- process.stderr.write(`[DIAG5] after saveGlobalConfig
740826
- `);
740827
740877
  }
740828
- process.stderr.write(`[DIAG5] before migrateChangelog
740829
- `);
740830
740878
  migrateChangelogFromConfig().catch(() => {});
740831
- process.stderr.write(`[DIAG5] runMigrations exit
740832
- `);
740833
740879
  }
740834
740880
  function prefetchSystemContextIfSafe() {
740835
740881
  const isNonInteractiveSession = getIsNonInteractiveSession();
@@ -741213,17 +741259,11 @@ async function run() {
741213
741259
  initSinks2();
741214
741260
  profileCheckpoint("preAction_after_sinks");
741215
741261
  const pluginDir = thisCommand.getOptionValue("pluginDir");
741216
- process.stderr.write(`[DIAG4] before pluginDir check
741217
- `);
741218
741262
  if (Array.isArray(pluginDir) && pluginDir.length > 0 && pluginDir.every((p4) => typeof p4 === "string")) {
741219
741263
  setInlinePlugins(pluginDir);
741220
741264
  clearPluginCache("preAction: --plugin-dir inline plugins");
741221
741265
  }
741222
- process.stderr.write(`[DIAG4] before runMigrations
741223
- `);
741224
741266
  runMigrations();
741225
- process.stderr.write(`[DIAG4] after runMigrations
741226
- `);
741227
741267
  profileCheckpoint("preAction_after_migrations");
741228
741268
  if (getSettingsForSource("policySettings")?.forceRemoteSettingsRefresh) {
741229
741269
  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.256",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {