@walkhi/code-relax 0.1.0-beta.101 → 0.1.0-beta.105

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.
@@ -274,7 +274,14 @@ async function main() {
274
274
  const desktopNeedsRestart = !hadInstalledService && desktopBeforeSetup.running && !preserveCodex;
275
275
  const previous = hadInstalledService ? await service.status() : { processRunning: false };
276
276
  const legacyRelaySession = readRecord(path.join(stateRoot, 'self-relay-session.json'));
277
- const previousRelay = legacyRelaySession ? await controlRequest(legacyRelaySession) : await selfRelay('relay-status', stateRoot);
277
+ let previousRelay;
278
+ try {
279
+ previousRelay = legacyRelaySession ? await controlRequest(legacyRelaySession) : await selfRelay('relay-status', stateRoot);
280
+ } catch (error) {
281
+ if (error.code !== 'ECONNREFUSED') throw error;
282
+ // A saved session can outlive its listener after an interrupted installation.
283
+ previousRelay = { running: false };
284
+ }
278
285
  const resumeAfterUpdate = previous.processRunning || previousRelay.running;
279
286
  const executable = currentNodeExecutable();
280
287
  const startInstalled = async () => {
@@ -284,7 +291,7 @@ async function main() {
284
291
  child.stderr.on('data', chunk => { errors += chunk; });
285
292
  const code = await new Promise((resolve, reject) => { child.once('error', reject); child.once('exit', resolve); });
286
293
  try {
287
- if (code !== 0) throw new Error(errors.trim().replace(/^(?:Code Relax:)+/u, '') || '桌面服务启动失败');
294
+ if (code !== 0) throw new Error(`启动固定目录的工作站服务失败:${errors.trim().replace(/^(?:Code Relax:)+/u, '') || `退出码 ${code}`}`);
288
295
  if (previousRelay.deviceId) {
289
296
  const restoredRelay = await selfRelay('relay-status', stateRoot);
290
297
  if (restoredRelay.deviceId !== previousRelay.deviceId ||
@@ -1 +1 @@
1
- {"layout":"npm-platform-packages","version":"0.1.0-beta.101"}
1
+ {"layout":"npm-platform-packages","version":"0.1.0-beta.105"}
@@ -8,7 +8,8 @@ const bridgeRoot = fileURLToPath(new URL('../../../', import.meta.url));
8
8
 
9
9
  export async function lanNetworks() {
10
10
  const executable = path.join(process.env.SystemRoot, 'System32/WindowsPowerShell/v1.0/powershell.exe');
11
- const { stdout } = await exec(executable, ['-NoProfile', '-NonInteractive', '-File', path.join(bridgeRoot, 'get-lan-networks.ps1')],
11
+ const { stdout } = await exec(executable, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass',
12
+ '-File', path.join(bridgeRoot, 'get-lan-networks.ps1')],
12
13
  { windowsHide: true, encoding: 'utf8' });
13
14
  const records = JSON.parse(stdout.trim() || '[]');
14
15
  if (!Array.isArray(records) || records.length > 8) throw new Error('Windows 返回了无效的局域网信息');
@@ -12,8 +12,8 @@ const exec = promisify(execFile);
12
12
  const bridgeRoot = fileURLToPath(new URL('../../../', import.meta.url));
13
13
  async function detect(script, args = []) {
14
14
  const executable = path.join(process.env.SystemRoot, 'System32/WindowsPowerShell/v1.0/powershell.exe');
15
- const { stdout } = await exec(executable, ['-NoProfile', '-NonInteractive', '-File',
16
- path.join(bridgeRoot, script), ...args], { windowsHide: true, encoding: 'utf8' });
15
+ const { stdout } = await exec(executable, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass',
16
+ '-File', path.join(bridgeRoot, script), ...args], { windowsHide: true, encoding: 'utf8' });
17
17
  return stdout.trim();
18
18
  }
19
19
 
@@ -794,6 +794,11 @@ async function handleRequest(request, response) {
794
794
  if (request.method === 'GET' && createStatusMatch) {
795
795
  const creationScope = ['project', decodeURIComponent(createStatusMatch[1])], clientId = createStatusMatch[2];
796
796
  let status = messageReceipts.status(creationScope, clientId);
797
+ if (!messageReceipts.entries.has(messageReceipts.key(creationScope, clientId))) {
798
+ // Fence an admission that never arrived before allowing a replacement.
799
+ // Existing unknown submissions must retain their late creation receipt.
800
+ status = await messageReceipts.reconcile(creationScope, clientId, async () => null);
801
+ }
797
802
  if (status.state === 'unknown' && status.createdThreadId) {
798
803
  const threadId = status.createdThreadId;
799
804
  status = await messageReceipts.reconcile(creationScope, clientId, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walkhi/code-relax",
3
- "version": "0.1.0-beta.101",
3
+ "version": "0.1.0-beta.105",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "tag": "beta"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@walkhi/code-relax-native-win32-x64": "0.1.0-beta.100",
44
+ "@walkhi/code-relax-native-win32-x64": "0.1.0-beta.104",
45
45
  "@walkhi/code-relax-native-darwin-arm64": "0.1.0-beta.82",
46
46
  "@walkhi/code-relax-native-darwin-x64": "0.1.0-beta.82"
47
47
  }