@adhdev/daemon-standalone 0.8.50 → 0.8.51

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/dist/index.js CHANGED
@@ -39298,6 +39298,12 @@ ${effect.notification.body || ""}`.trim();
39298
39298
  }
39299
39299
  };
39300
39300
  init_logger();
39301
+ function shouldRestoreHostedRuntime(record2, managerTag) {
39302
+ if (!managerTag) return true;
39303
+ const managedBy = typeof record2.managedBy === "string" ? record2.managedBy.trim() : "";
39304
+ if (!managedBy) return true;
39305
+ return managedBy === managerTag;
39306
+ }
39301
39307
  var chalkModule = import_chalk.default;
39302
39308
  var chalkApi = typeof chalkModule.yellow === "function" ? chalkModule : chalkModule.default || null;
39303
39309
  function colorize(color, text) {
@@ -39793,8 +39799,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
39793
39799
  const sessions = records || await this.deps.listHostedCliRuntimes?.() || [];
39794
39800
  let restored = 0;
39795
39801
  const restoredBindings = /* @__PURE__ */ new Set();
39802
+ const managerTag = this.deps.hostedRuntimeManagerTag;
39796
39803
  for (const record2 of sessions) {
39797
39804
  if (!record2?.runtimeId || !record2?.cliType || !record2?.workspace) continue;
39805
+ if (!shouldRestoreHostedRuntime(record2, managerTag)) {
39806
+ LOG2.info(
39807
+ "CLI",
39808
+ `\u21B7 Skipping hosted runtime restore owned by ${record2.managedBy}: ${record2.runtimeKey || record2.runtimeId}`
39809
+ );
39810
+ continue;
39811
+ }
39798
39812
  if (this.adapters.has(record2.runtimeId) || instanceManager.getInstance(record2.runtimeId)) continue;
39799
39813
  const normalizedType = this.providerLoader.resolveAlias(record2.cliType);
39800
39814
  const providerMeta = this.providerLoader.getMeta(normalizedType);
@@ -49681,7 +49695,8 @@ data: ${JSON.stringify(msg.data)}
49681
49695
  cliType: record2.providerType,
49682
49696
  workspace: record2.workspace,
49683
49697
  cliArgs: Array.isArray(record2.meta?.cliArgs) ? record2.meta.cliArgs : [],
49684
- providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0
49698
+ providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0,
49699
+ managedBy: typeof record2.meta?.managedBy === "string" ? String(record2.meta.managedBy) : void 0
49685
49700
  }));
49686
49701
  } finally {
49687
49702
  await client.close().catch(() => {
@@ -50844,6 +50859,7 @@ var StandaloneServer = class {
50844
50859
  onStatusChange: () => this.scheduleBroadcastStatus(),
50845
50860
  removeAgentTracking: () => {
50846
50861
  },
50862
+ hostedRuntimeManagerTag: "adhdev-standalone",
50847
50863
  createPtyTransportFactory: ({ runtimeId, providerType, workspace, cliArgs, providerSessionId, attachExisting }) => new import_daemon_core2.SessionHostPtyTransportFactory({
50848
50864
  endpoint: sessionHostEndpoint,
50849
50865
  ensureReady: async () => {