@agimon-ai/po-file-edit 0.0.0-alpha.16 → 0.0.0-alpha.18

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.
@@ -1931,20 +1931,19 @@ function createFileEditSession({ agent, host }) {
1931
1931
  const dispose = () => {
1932
1932
  if (disposal) return disposal;
1933
1933
  closed = true;
1934
- disposal = (async () => {
1935
- try {
1936
- await stopActivity();
1937
- if (lastRuntime) {
1938
- if (!environment[_agimon_ai_po_core_childProcess.SUBAGENT_CHILD_ENV]) {
1939
- await timeline.clear();
1940
- await snapshots.clear();
1941
- }
1942
- await telemetry.recordEvent("po_file_edit.timeline_finished", { outcome: "closed" });
1943
- }
1944
- } finally {
1945
- await telemetry.shutdown();
1946
- }
1947
- })();
1934
+ disposal = (0, _agimon_ai_po_core_extensionFile.runCleanups)([
1935
+ stopActivity,
1936
+ async () => {
1937
+ if (lastRuntime && !environment[_agimon_ai_po_core_childProcess.SUBAGENT_CHILD_ENV]) await timeline.clear();
1938
+ },
1939
+ async () => {
1940
+ if (lastRuntime && !environment[_agimon_ai_po_core_childProcess.SUBAGENT_CHILD_ENV]) await snapshots.clear();
1941
+ },
1942
+ async () => {
1943
+ if (lastRuntime) await telemetry.recordEvent("po_file_edit.timeline_finished", { outcome: "closed" });
1944
+ },
1945
+ () => telemetry.shutdown()
1946
+ ], "File-edit session cleanup failed.");
1948
1947
  return disposal;
1949
1948
  };
1950
1949
  return {
@@ -2072,8 +2071,7 @@ const createFileEditServerRoot = (context) => {
2072
2071
  });
2073
2072
  }] },
2074
2073
  onDispose: async (pluginContext) => {
2075
- presence?.dispose();
2076
- await runtime.onDispose?.(pluginContext);
2074
+ await (0, _agimon_ai_po_core_extensionFile.runCleanups)([() => presence?.dispose(), () => runtime.onDispose?.(pluginContext)], "File-edit root cleanup failed.");
2077
2075
  }
2078
2076
  };
2079
2077
  };