@nowcrew/daemon 0.6.90 → 0.6.91-beta.1

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.
@@ -11,15 +11,12 @@ function registryArgs(registry) {
11
11
  function isRegistryAuthFailure(stderr) {
12
12
  return /(?:\bE401\b|\b401\b.*\bUnauthorized\b)/iu.test(stderr);
13
13
  }
14
+ // Managed eligibility guarantees an exclusive installation and native service per profile.
15
+ // Other profiles share compute capacity, but do not share the package being replaced.
14
16
  export async function prepareDaemonRestart(input) {
15
17
  const local = input.localSlots.tryAcquireExclusive();
16
18
  if (local === null)
17
19
  return { ok: false, errorCode: "runtime_busy" };
18
- const host = await input.hostCoordinator.tryAcquireExclusiveExecution();
19
- if (host === null) {
20
- local.release();
21
- return { ok: false, errorCode: "runtime_busy" };
22
- }
23
20
  let released = false;
24
21
  return {
25
22
  ok: true,
@@ -27,7 +24,6 @@ export async function prepareDaemonRestart(input) {
27
24
  if (released)
28
25
  return;
29
26
  released = true;
30
- await host.release();
31
27
  local.release();
32
28
  },
33
29
  };
@@ -74,17 +70,11 @@ export async function installExactDaemonUpdate(input) {
74
70
  const local = input.localSlots.tryAcquireExclusive();
75
71
  if (local === null)
76
72
  return { ok: false, errorCode: "runtime_busy" };
77
- const host = await input.hostCoordinator.tryAcquireExclusiveExecution();
78
- if (host === null) {
79
- local.release();
80
- return { ok: false, errorCode: "runtime_busy" };
81
- }
82
73
  let released = false;
83
74
  const release = async () => {
84
75
  if (released)
85
76
  return;
86
77
  released = true;
87
- await host.release();
88
78
  local.release();
89
79
  };
90
80
  const lockedInstallation = daemonGlobalInstallation(input.currentEntryPath ?? process.argv[1] ?? "", input.platform ?? process.platform);
@@ -2,7 +2,31 @@ import { createMarketplaceController } from "./marketplace-controller.js";
2
2
  import { prepareDaemonRestart } from "./daemon-updater.js";
3
3
  export function createServeMarketplace(config, localSlots, hostCoordinator) {
4
4
  const controller = createMarketplaceController({ agentsRoot: config.agentsRoot,
5
- acquire: async () => { const result = await prepareDaemonRestart({ localSlots, hostCoordinator }); return result.ok ? result : null; } });
5
+ acquire: async () => {
6
+ // Marketplace updates can mutate shared Codex/Claude homes across profiles.
7
+ const local = await prepareDaemonRestart({ localSlots });
8
+ if (!local.ok)
9
+ return null;
10
+ try {
11
+ const host = await hostCoordinator.tryAcquireExclusiveExecution();
12
+ if (host === null) {
13
+ await local.release();
14
+ return null;
15
+ }
16
+ let released = false;
17
+ return { release: async () => {
18
+ if (released)
19
+ return;
20
+ released = true;
21
+ await host.release();
22
+ await local.release();
23
+ } };
24
+ }
25
+ catch (error) {
26
+ await local.release();
27
+ throw error;
28
+ }
29
+ } });
6
30
  return {
7
31
  handle(raw, send) {
8
32
  if (!raw || typeof raw !== "object" || !("type" in raw) || raw.type !== "marketplace:operation")
package/dist/serve.js CHANGED
@@ -105,11 +105,9 @@ export function serve(config, opts = {}) {
105
105
  install: opts.update?.install ?? ((input) => installExactDaemonUpdate({
106
106
  ...input,
107
107
  localSlots,
108
- hostCoordinator,
109
108
  })),
110
109
  prepareRestart: opts.update?.prepareRestart ?? (() => prepareDaemonRestart({
111
110
  localSlots,
112
- hostCoordinator,
113
111
  })),
114
112
  scheduleRestart: opts.update?.scheduleRestart ?? scheduleServiceRestart,
115
113
  sendStatus: (frame) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.6.90",
3
+ "version": "0.6.91-beta.1",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",