@hellolynk-ai/trae-work-mcp 0.4.100 → 0.4.102

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.
@@ -2,7 +2,7 @@
2
2
  "contract": "hellolynk-client-npm-pack-manifest-v1",
3
3
  "client": "trae-work",
4
4
  "packageName": "@hellolynk-ai/trae-work-mcp",
5
- "version": "0.4.100",
5
+ "version": "0.4.102",
6
6
  "workbench": {
7
7
  "path": "runtime/workbench/hellolynk-workbench-build.json",
8
8
  "contract": "hellolynk-shared-workbench-build-v1",
@@ -23,7 +23,7 @@
23
23
  {
24
24
  "path": "integrations/trae-work/package.json",
25
25
  "bytes": 496,
26
- "sha256": "8ad763f376491fc244c63a904d7eaa59d007213fe49c8ec6b7aabe2dcae7cf03"
26
+ "sha256": "cffb8384ee280dd92011c0ad57052ccccf2bbf7138ef0bec635ae33e8532e9ed"
27
27
  },
28
28
  {
29
29
  "path": "integrations/trae-work/runtime/neutral-host-bootstrap.mjs",
@@ -103,7 +103,7 @@
103
103
  {
104
104
  "path": "package.json",
105
105
  "bytes": 1851,
106
- "sha256": "0a22aad1348a392902ea36128b464750b667e0dcfb54d4e3f776f3586f8fd074"
106
+ "sha256": "01fbaf301446a6a11313101972885ad30ea4cb960cccd7400c0516a36c4d35ac"
107
107
  },
108
108
  {
109
109
  "path": "README.md",
@@ -117,8 +117,8 @@
117
117
  },
118
118
  {
119
119
  "path": "runtime/bootstrap/core/hellolynk-client-core.mjs",
120
- "bytes": 36628,
121
- "sha256": "5d2190c2354ede169b2053864674c7ae5b80985970dc13609d6818c5a6d16940"
120
+ "bytes": 37550,
121
+ "sha256": "186332d5dea8876cf8ca57fef35e9810df5256ed36f704f7bd3840e45c406a4a"
122
122
  },
123
123
  {
124
124
  "path": "runtime/bootstrap/core/hellolynk-client-profile.mjs",
@@ -187,8 +187,8 @@
187
187
  },
188
188
  {
189
189
  "path": "runtime/core/hellolynk-client-core.mjs",
190
- "bytes": 36628,
191
- "sha256": "5d2190c2354ede169b2053864674c7ae5b80985970dc13609d6818c5a6d16940"
190
+ "bytes": 37550,
191
+ "sha256": "186332d5dea8876cf8ca57fef35e9810df5256ed36f704f7bd3840e45c406a4a"
192
192
  },
193
193
  {
194
194
  "path": "runtime/core/hellolynk-client-profile.mjs",
@@ -372,8 +372,8 @@
372
372
  },
373
373
  {
374
374
  "path": "runtime/core/hellolynk-neutral-host-assembly.mjs",
375
- "bytes": 47236,
376
- "sha256": "8f8038559ed249d29e53e8ee0ad3db8e6319336bd3aadf49434aa7aa755bb647"
375
+ "bytes": 47470,
376
+ "sha256": "5a09b332a869c3863ac92c798a1a5df5901607987a2427a20b06154e41e17cb8"
377
377
  },
378
378
  {
379
379
  "path": "runtime/core/hellolynk-neutral-host-installation-store.mjs",
@@ -387,8 +387,8 @@
387
387
  },
388
388
  {
389
389
  "path": "runtime/core/hellolynk-neutral-host-process.mjs",
390
- "bytes": 229535,
391
- "sha256": "a2ed64720bd9772e5ac1fd93692820e1c5c58e03be114eb4707c2a7f4bd57f5e"
390
+ "bytes": 234159,
391
+ "sha256": "42d29af2f0ac96252d694996864d54b3fddda47d6ad5405020a1354e13372efa"
392
392
  },
393
393
  {
394
394
  "path": "runtime/core/hellolynk-neutral-host-store-adapters.mjs",
@@ -448,12 +448,12 @@
448
448
  {
449
449
  "path": "runtime/neutral-host-release-manifest.json",
450
450
  "bytes": 15630,
451
- "sha256": "ccbbf2cd800830e7c518988dff8d512869df8494e4200547803aca6c21430c89"
451
+ "sha256": "d2cff22cd8e4a224bf24c4a57b67d4c7a4adce9721405d81da52c7eb3c3032ab"
452
452
  },
453
453
  {
454
454
  "path": "runtime/neutral-host-release-pin.json",
455
455
  "bytes": 146,
456
- "sha256": "97c2b56976c5d4696f3544e504d3b884b2e28a6c99c8040afcc4fd70efb4bddd"
456
+ "sha256": "1a602dba63e67f62d8050cba71fde3a7c468b5acfa8568fe459b540bbfce57ad"
457
457
  },
458
458
  {
459
459
  "path": "runtime/platform/windows/configure-agent.ps1",
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "contract": "hellolynk-client-npm-pack-pin-v1",
3
- "manifestSha256": "45dde935aaa9ed7348a0e98044853f0a911e491d12103b1d026241912442d1b0"
3
+ "manifestSha256": "f1543b1479b699c126c965e05f9f0543c8d4225f54e2211166043d9f9476362f"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hellolynk-ai/trae-work-mcp",
3
- "version": "0.4.100",
3
+ "version": "0.4.102",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "TRAE Work one-click bridge for local HelloLynk Messaging.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hellolynk-ai/trae-work-mcp",
3
- "version": "0.4.100",
3
+ "version": "0.4.102",
4
4
  "description": "HelloLynk Messaging for TRAE Work: open conversations and let your AI message other people's AI assistants.",
5
5
  "homepage": "https://hellolynk.com",
6
6
  "repository": {
@@ -387,7 +387,9 @@ export async function issueDeviceRuntimeSession(options) {
387
387
  }
388
388
  return fresh;
389
389
  }
390
- throw new HelloLynkClientError(safeDeviceRuntimeErrorCode(result?.error), {
390
+ const code = response.status === 401 && result?.error === "device_credential_invalid"
391
+ && result?.reason === "device_credential_revoked" ? result.reason : safeDeviceRuntimeErrorCode(result?.error);
392
+ throw new HelloLynkClientError(code, {
391
393
  httpStatus: response.status,
392
394
  retryable: response.status === 408 || response.status === 425 || response.status === 429 || response.status >= 500,
393
395
  });
@@ -584,6 +586,7 @@ export function createDeviceRuntimeSessionManager(options = {}) {
584
586
  );
585
587
  let current = null;
586
588
  let rejectedCredential = null;
589
+ const revokedFingerprints = new Set();
587
590
  let localIssueTail = Promise.resolve();
588
591
 
589
592
  const routeMatches = (session, input) => {
@@ -668,7 +671,15 @@ export function createDeviceRuntimeSessionManager(options = {}) {
668
671
  : null;
669
672
  // The production caller holds the existing session lock, including across
670
673
  // Host processes. An authority denial may drain the current Host.
674
+ const revocationKey = fingerprint && `revoked-${fingerprint}`;
671
675
  if (fingerprint) {
676
+ // An older process may update or clear its temporary rejection for the
677
+ // profile. Keep permanent revocation under the credential's own key.
678
+ if (revokedFingerprints.has(fingerprint)
679
+ || (await credentialRejections?.load(revocationKey).catch(() => null))?.fingerprint === fingerprint) {
680
+ revokedFingerprints.add(fingerprint);
681
+ throw new HelloLynkClientError("device_credential_revoked", { httpStatus: 401 });
682
+ }
672
683
  const isCoolingDown = (rejection) => {
673
684
  if (rejection?.fingerprint !== fingerprint) return false;
674
685
  const age = now() - rejection.rejectedAtMs;
@@ -685,10 +696,14 @@ export function createDeviceRuntimeSessionManager(options = {}) {
685
696
  try {
686
697
  session = reusable(await issue(request), input);
687
698
  } catch (error) {
688
- if (fingerprint && error?.httpStatus === 401 && error.code === "device_credential_invalid") {
689
- rejectedCredential = { fingerprint, rejectedAtMs: now() };
690
- // Preserve the authority denial even if local storage is unavailable.
691
- await credentialRejections?.save(sessionKey, rejectedCredential).catch(() => {});
699
+ if (fingerprint && error?.httpStatus === 401) {
700
+ if (error.code === "device_credential_revoked") {
701
+ revokedFingerprints.add(fingerprint);
702
+ await credentialRejections?.save(revocationKey, { fingerprint, rejectedAtMs: now() }).catch(() => {});
703
+ } else if (error.code === "device_credential_invalid") {
704
+ rejectedCredential = { fingerprint, rejectedAtMs: now() };
705
+ await credentialRejections?.save(sessionKey, rejectedCredential).catch(() => {});
706
+ }
692
707
  }
693
708
  throw error;
694
709
  }
@@ -387,7 +387,9 @@ export async function issueDeviceRuntimeSession(options) {
387
387
  }
388
388
  return fresh;
389
389
  }
390
- throw new HelloLynkClientError(safeDeviceRuntimeErrorCode(result?.error), {
390
+ const code = response.status === 401 && result?.error === "device_credential_invalid"
391
+ && result?.reason === "device_credential_revoked" ? result.reason : safeDeviceRuntimeErrorCode(result?.error);
392
+ throw new HelloLynkClientError(code, {
391
393
  httpStatus: response.status,
392
394
  retryable: response.status === 408 || response.status === 425 || response.status === 429 || response.status >= 500,
393
395
  });
@@ -584,6 +586,7 @@ export function createDeviceRuntimeSessionManager(options = {}) {
584
586
  );
585
587
  let current = null;
586
588
  let rejectedCredential = null;
589
+ const revokedFingerprints = new Set();
587
590
  let localIssueTail = Promise.resolve();
588
591
 
589
592
  const routeMatches = (session, input) => {
@@ -668,7 +671,15 @@ export function createDeviceRuntimeSessionManager(options = {}) {
668
671
  : null;
669
672
  // The production caller holds the existing session lock, including across
670
673
  // Host processes. An authority denial may drain the current Host.
674
+ const revocationKey = fingerprint && `revoked-${fingerprint}`;
671
675
  if (fingerprint) {
676
+ // An older process may update or clear its temporary rejection for the
677
+ // profile. Keep permanent revocation under the credential's own key.
678
+ if (revokedFingerprints.has(fingerprint)
679
+ || (await credentialRejections?.load(revocationKey).catch(() => null))?.fingerprint === fingerprint) {
680
+ revokedFingerprints.add(fingerprint);
681
+ throw new HelloLynkClientError("device_credential_revoked", { httpStatus: 401 });
682
+ }
672
683
  const isCoolingDown = (rejection) => {
673
684
  if (rejection?.fingerprint !== fingerprint) return false;
674
685
  const age = now() - rejection.rejectedAtMs;
@@ -685,10 +696,14 @@ export function createDeviceRuntimeSessionManager(options = {}) {
685
696
  try {
686
697
  session = reusable(await issue(request), input);
687
698
  } catch (error) {
688
- if (fingerprint && error?.httpStatus === 401 && error.code === "device_credential_invalid") {
689
- rejectedCredential = { fingerprint, rejectedAtMs: now() };
690
- // Preserve the authority denial even if local storage is unavailable.
691
- await credentialRejections?.save(sessionKey, rejectedCredential).catch(() => {});
699
+ if (fingerprint && error?.httpStatus === 401) {
700
+ if (error.code === "device_credential_revoked") {
701
+ revokedFingerprints.add(fingerprint);
702
+ await credentialRejections?.save(revocationKey, { fingerprint, rejectedAtMs: now() }).catch(() => {});
703
+ } else if (error.code === "device_credential_invalid") {
704
+ rejectedCredential = { fingerprint, rejectedAtMs: now() };
705
+ await credentialRejections?.save(sessionKey, rejectedCredential).catch(() => {});
706
+ }
692
707
  }
693
708
  throw error;
694
709
  }
@@ -334,6 +334,9 @@ export async function startHelloLynkNeutralHostAssembly(options = {}, dependenci
334
334
  authorizationVersion: profile.authorizationVersion,
335
335
  identityKeyId: e2ee.identityKeyId,
336
336
  runtimeHeaders: () => runtimeHeaders(sessionProvider),
337
+ // Drops only this instance's cached runtime session, and only for a stale
338
+ // session, so the Host can verify it once more with the device credential.
339
+ clearRuntimeSession: (error) => sessionProvider.clear(error),
337
340
  e2ee,
338
341
  contactE2ee,
339
342
  }));
@@ -1,6 +1,7 @@
1
1
  import { nativeConversationId, nativeConversationQuery, nativeDirectoryResult, queryLocalNativeConversations } from "./hellolynk-native-conversations.mjs";
2
2
  import { DIRECT_TEXT_E2EE_MAX_TTL_MS } from "./hellolynk-direct-text-e2ee.mjs";
3
3
  import { runModelInbox } from "./hellolynk-model-inbox.mjs";
4
+ import { shouldInvalidateDeviceRuntimeSession } from "./hellolynk-client-core.mjs";
4
5
  import crypto from "node:crypto";
5
6
  import fs from "node:fs/promises";
6
7
  import http from "node:http";
@@ -34,7 +35,7 @@ export const HELLOLYNK_NEUTRAL_HOST_PROCESS_CONTRACT = "hellolynk-neutral-host-p
34
35
  export const HELLOLYNK_NEUTRAL_HOST_DISCOVERY_CONTRACT = "hellolynk-neutral-host-discovery-v1";
35
36
  // Raised with every release batch, together with the six client versions. A Host reports it
36
37
  // in its health; the higher release stays and the lower one makes room.
37
- export const HELLOLYNK_HOST_RELEASE_ORDINAL = 17;
38
+ export const HELLOLYNK_HOST_RELEASE_ORDINAL = 19;
38
39
 
39
40
  const INSTALLATION_LOCK_CONTRACT = "hellolynk-neutral-host-installation-lock-v2";
40
41
  const INSTALLATION_LOCK_MAX_BYTES = 4 * 1024;
@@ -97,9 +98,16 @@ const PREKEY_REFILL_RETRY_MIN_MS = 1_000;
97
98
  const PREKEY_REFILL_RETRY_MAX_MS = 60_000;
98
99
  const RELAY_RETRY_MIN_MS = 1_000;
99
100
  const RELAY_RETRY_MAX_MS = 60_000;
100
- const RELAY_AUTHORITY_DENIAL_CODES = new Set([
101
+ // Revocation of this Host or its transport credential fences the whole Host.
102
+ const HOST_AUTHORITY_DENIAL_CODES = new Set([
101
103
  "host_transport_host_revoked", "host_transport_credential_revoked", "host_transport_credential_inactive",
104
+ ]);
105
+ // A refusal of one instance's own device credential or delegate stops only that
106
+ // instance. The Host and its other instances keep receiving and sending. The
107
+ // server reports these when issuing or using that instance's runtime session.
108
+ const ENDPOINT_AUTHORITY_DENIAL_CODES = new Set([
102
109
  "device_credential_invalid", "device_credential_revoked", "delegate_revoked", "delegate_inactive",
110
+ "device_credential_identity_inactive", "device_credential_inactive", "runtime_identity_inactive",
103
111
  ]);
104
112
  const MESSAGE_LOCAL_CAPACITY_CODES = new Set(["local_message_store_too_large"]);
105
113
  const CONTACT_REQUEST_LOCAL_CAPACITY_CODES = new Set([
@@ -247,6 +255,9 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
247
255
  let receiverState = null;
248
256
  const relayAbortController = new AbortController();
249
257
  const relayProvisionedEndpoints = new Set();
258
+ // Refused instances and their refusal code. Only a later successful registration
259
+ // (the next relay connection or session rotation) readmits one.
260
+ const rejectedEndpoints = new Map();
250
261
  const relayState = { status: "connecting", failureCount: 0, nextAttemptAtMs: 0, errorCode: null };
251
262
  const rejectedInboundTimes = new WeakSet();
252
263
  let lastRejectedInbound = null;
@@ -600,6 +611,20 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
600
611
  lastRejectedInbound = { errorCode: error.code };
601
612
  continue;
602
613
  }
614
+ // The frame's own instance was refused (for example at ACK). Stop only that
615
+ // instance and skip the frame; the relay expires or redelivers it.
616
+ const refused = ENDPOINT_AUTHORITY_DENIAL_CODES.has(error?.code)
617
+ && endpoints.get(String(item.data?.recipientDelegateId || ""));
618
+ if (refused) {
619
+ rejectedEndpoints.set(refused.delegateId, error.code);
620
+ relayState.errorCode = error.code;
621
+ lastRejectedInbound = { errorCode: error.code };
622
+ continue;
623
+ }
624
+ // A stale runtime session (such as a revocation landing between persist and
625
+ // ACK) is not a local failure. Reconnect: registration verifies that instance
626
+ // again and isolates it if refused. The durable record stays; the relay redelivers.
627
+ if (shouldInvalidateDeviceRuntimeSession(error)) throw error;
603
628
  if (!isInboundLocalCapacityError(error)) {
604
629
  inboundFailed = true;
605
630
  throw error;
@@ -612,7 +637,7 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
612
637
  } catch (error) {
613
638
  if (lifecycle !== "running") return;
614
639
  // Preserve fail-closed persistence/ACK and other malformed-inbound errors.
615
- if (inboundFailed || RELAY_AUTHORITY_DENIAL_CODES.has(error?.code)) throw error;
640
+ if (inboundFailed || HOST_AUTHORITY_DENIAL_CODES.has(error?.code)) throw error;
616
641
  await stream?.close?.().catch(() => {});
617
642
  stream = null;
618
643
  scheduleRelayRetry(error);
@@ -638,31 +663,63 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
638
663
  const task = (async () => {
639
664
  let connected = null;
640
665
  try {
641
- const registrations = await Promise.allSettled([...endpoints.values()].map(async (endpoint) => {
642
- if (endpoint.e2ee?.preKeyInventoryStatus?.status === "deferred"
643
- && !relayProvisionedEndpoints.has(endpoint.delegateId)) {
644
- try {
645
- await endpoint.e2ee.ensurePreKeyInventory({ signal });
646
- } catch (error) {
647
- if (error?.code !== "e2ee_local_prekey_capacity_exceeded") throw error;
648
- const state = preKeyRefillState(endpoint.delegateId);
649
- state.failureCount = 1;
650
- state.nextAttemptAtMs = Math.max(nowMs(clock) + PREKEY_REFILL_RETRY_MIN_MS, retryAtTimestamp(error.retryAt) || 0);
651
- state.errorCode = error.code;
666
+ const attempted = [...endpoints.values()];
667
+ const registrations = await Promise.allSettled(attempted.map(async (endpoint) => {
668
+ const register = async () => {
669
+ if (endpoint.e2ee?.preKeyInventoryStatus?.status === "deferred"
670
+ && !relayProvisionedEndpoints.has(endpoint.delegateId)) {
671
+ try {
672
+ await endpoint.e2ee.ensurePreKeyInventory({ signal });
673
+ } catch (error) {
674
+ if (error?.code !== "e2ee_local_prekey_capacity_exceeded") throw error;
675
+ const state = preKeyRefillState(endpoint.delegateId);
676
+ state.failureCount = 1;
677
+ state.nextAttemptAtMs = Math.max(nowMs(clock) + PREKEY_REFILL_RETRY_MIN_MS, retryAtTimestamp(error.retryAt) || 0);
678
+ state.errorCode = error.code;
679
+ }
680
+ relayProvisionedEndpoints.add(endpoint.delegateId);
652
681
  }
653
- relayProvisionedEndpoints.add(endpoint.delegateId);
682
+ if (signal.aborted || lifecycle !== "running") return;
683
+ await options.transport.registerEndpoint({
684
+ delegateId: endpoint.delegateId, identityKeyId: endpoint.identityKeyId,
685
+ runtimeHeaders: endpoint.runtimeHeaders, signal,
686
+ });
687
+ };
688
+ try {
689
+ await register();
690
+ } catch (error) {
691
+ // Revoking an instance also drops its runtime session, so its cached session
692
+ // fails first. Clear only that stale cache and verify once more: a device
693
+ // refusal then isolates the instance; any other failure keeps the usual path.
694
+ const cleared = !shouldInvalidateDeviceRuntimeSession(error) || signal.aborted || lifecycle !== "running"
695
+ || typeof endpoint.clearRuntimeSession !== "function" ? false
696
+ : await Promise.resolve().then(() => endpoint.clearRuntimeSession(error)).catch(() => false);
697
+ if (cleared !== true) throw error;
698
+ await register();
654
699
  }
655
- if (signal.aborted || lifecycle !== "running") return;
656
- await options.transport.registerEndpoint({
657
- delegateId: endpoint.delegateId, identityKeyId: endpoint.identityKeyId,
658
- runtimeHeaders: endpoint.runtimeHeaders, signal,
659
- });
660
700
  }));
661
701
  if (signal.aborted || lifecycle !== "running") return;
662
- const failed = registrations.find((result) => result.status === "rejected"
663
- && RELAY_AUTHORITY_DENIAL_CODES.has(result.reason?.code))
664
- || registrations.find((result) => result.status === "rejected");
702
+ const hostDenial = registrations.find((result) => result.status === "rejected"
703
+ && HOST_AUTHORITY_DENIAL_CODES.has(result.reason?.code));
704
+ if (hostDenial) throw hostDenial.reason;
705
+ // A refused instance stays out of the relay while the others connect. Each
706
+ // later connection, including session rotation, registers it again.
707
+ registrations.forEach((result, index) => {
708
+ if (result.status === "fulfilled") rejectedEndpoints.delete(attempted[index].delegateId);
709
+ else if (ENDPOINT_AUTHORITY_DENIAL_CODES.has(result.reason?.code)) {
710
+ rejectedEndpoints.set(attempted[index].delegateId, result.reason.code);
711
+ }
712
+ });
713
+ // A refused instance whose re-verification fails for another reason (such as
714
+ // its dropped runtime session) stays refused and does not hold back the others.
715
+ const failed = registrations.find((result, index) => result.status === "rejected"
716
+ && !rejectedEndpoints.has(attempted[index].delegateId));
665
717
  if (failed) throw failed.reason;
718
+ // With every instance refused there is nothing to receive: keep the Host and
719
+ // retry with the usual backoff. The session manager bounds cloud rechecks.
720
+ if (rejectedEndpoints.size === endpoints.size) {
721
+ throw registrations.find((result) => result.status === "rejected").reason;
722
+ }
666
723
  connected = await openRelayStream(signal);
667
724
  if (!connected?.events || typeof connected.events[Symbol.asyncIterator] !== "function") {
668
725
  throw failure("neutral_host_transport_stream_invalid");
@@ -672,14 +729,15 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
672
729
  return;
673
730
  }
674
731
  stream = connected;
675
- Object.assign(relayState, { status: "ready", failureCount: 0, nextAttemptAtMs: 0, errorCode: null });
732
+ Object.assign(relayState, { status: "ready", failureCount: 0, nextAttemptAtMs: 0,
733
+ errorCode: rejectedEndpoints.values().next().value ?? null });
676
734
  startReceiveTask();
677
735
  } catch (error) {
678
736
  await connected?.close?.().catch(() => {});
679
737
  if (signal.aborted || lifecycle !== "running") return;
680
738
  // An explicit revocation of this Host still fences local access. A
681
739
  // timeout/expired cloud session alone is not a local revocation.
682
- if (RELAY_AUTHORITY_DENIAL_CODES.has(error?.code)) {
740
+ if (HOST_AUTHORITY_DENIAL_CODES.has(error?.code)) {
683
741
  // Failure is exposed as host.status/failureCode to the release entry.
684
742
  void beginDrain(error.code).catch(() => {});
685
743
  return;
@@ -733,6 +791,14 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
733
791
  }
734
792
  const endpoint = endpoints.get(safeId(event.recipientDelegateId, "neutral_host_inbound_delegate_invalid"));
735
793
  if (!endpoint) throw failure("neutral_host_inbound_endpoint_unknown");
794
+ if (rejectedEndpoints.has(endpoint.delegateId)) {
795
+ // A refused instance receives nothing, also not from its Host's siblings.
796
+ // Relay frames are skipped unacknowledged; a local sender sees the failure.
797
+ const refused = failure(item.localDelivery === true
798
+ ? "neutral_host_same_host_recipient_unavailable" : rejectedEndpoints.get(endpoint.delegateId));
799
+ rejectedInboundTimes.add(refused);
800
+ throw refused;
801
+ }
736
802
  const isContactRequest = item.event === "contact_request";
737
803
  if (!isContactRequest && item.event !== "message") throw failure("neutral_host_inbound_kind_invalid");
738
804
  const decryptor = isContactRequest ? endpoint.contactE2ee : endpoint.e2ee;
@@ -1015,7 +1081,14 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
1015
1081
  return inboundResumeTask;
1016
1082
  }
1017
1083
 
1084
+ // A refused instance does not send, including over local routes that skip the relay.
1085
+ function assertEndpointAccepted(delegateId) {
1086
+ const code = rejectedEndpoints.get(delegateId);
1087
+ if (code) throw hostApplicationFailure(code);
1088
+ }
1089
+
1018
1090
  async function sendOutboundOnce({ endpoint, delegateId, clientMessageId, input }) {
1091
+ assertEndpointAccepted(endpoint.delegateId);
1019
1092
  try {
1020
1093
  const result = await endpoint.outbound.send(input);
1021
1094
  if (result?.message?.lastErrorCode === "reply_target_deleted" || result?.relay?.status === "reply_target_deleted") {
@@ -1529,6 +1602,7 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
1529
1602
  async function queryPeerNativeDirectory(delegateId, authorization, request) {
1530
1603
  const sender = endpoints.get(delegateId);
1531
1604
  if (!sender?.outbound?.sendDirectory) throw hostApplicationFailure("native_directory_unavailable");
1605
+ assertEndpointAccepted(delegateId);
1532
1606
  const friend = request.kind === "friend_target_request";
1533
1607
  const unavailable = friend ? null : nativeDirectoryResult({ conversations: [], coverage: "unavailable",
1534
1608
  available: false, exactTargetSupported: false, reason: "native_directory_unavailable" });
@@ -2274,6 +2348,7 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
2274
2348
  || current.senderDelegateId !== context.delegateId) {
2275
2349
  throw hostApplicationFailure("host_app_record_not_found");
2276
2350
  }
2351
+ assertEndpointAccepted(context.delegateId);
2277
2352
  if (!MANUAL_RETRYABLE_STATUSES.has(current.status) || current.lastErrorCode === "reply_target_deleted") {
2278
2353
  throw hostApplicationFailure("host_app_state_conflict");
2279
2354
  }
@@ -3120,7 +3195,8 @@ export async function startHelloLynkNeutralHostProcess(options = {}) {
3120
3195
  return {
3121
3196
  status: inboundPaused
3122
3197
  ? "paused"
3123
- : preKeyInventory.status === "ready" && relayState.status === "ready" && !lastRejectedInbound ? "ready" : "degraded",
3198
+ : preKeyInventory.status === "ready" && relayState.status === "ready" && !lastRejectedInbound
3199
+ && rejectedEndpoints.size === 0 ? "ready" : "degraded",
3124
3200
  ...(lastRejectedInbound ? { lastRejectedInbound } : {}),
3125
3201
  preKeyInventory,
3126
3202
  relay: {
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  {
6
6
  "path": "release/integrations/trae-work/package.json",
7
- "sha256": "8ad763f376491fc244c63a904d7eaa59d007213fe49c8ec6b7aabe2dcae7cf03"
7
+ "sha256": "cffb8384ee280dd92011c0ad57052ccccf2bbf7138ef0bec635ae33e8532e9ed"
8
8
  },
9
9
  {
10
10
  "path": "connect-activate.mjs",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  {
38
38
  "path": "core/hellolynk-client-core.mjs",
39
- "sha256": "5d2190c2354ede169b2053864674c7ae5b80985970dc13609d6818c5a6d16940"
39
+ "sha256": "186332d5dea8876cf8ca57fef35e9810df5256ed36f704f7bd3840e45c406a4a"
40
40
  },
41
41
  {
42
42
  "path": "core/hellolynk-client-profile.mjs",
@@ -188,7 +188,7 @@
188
188
  },
189
189
  {
190
190
  "path": "core/hellolynk-neutral-host-assembly.mjs",
191
- "sha256": "8f8038559ed249d29e53e8ee0ad3db8e6319336bd3aadf49434aa7aa755bb647"
191
+ "sha256": "5a09b332a869c3863ac92c798a1a5df5901607987a2427a20b06154e41e17cb8"
192
192
  },
193
193
  {
194
194
  "path": "core/hellolynk-neutral-host-installation-store.mjs",
@@ -200,7 +200,7 @@
200
200
  },
201
201
  {
202
202
  "path": "core/hellolynk-neutral-host-process.mjs",
203
- "sha256": "a2ed64720bd9772e5ac1fd93692820e1c5c58e03be114eb4707c2a7f4bd57f5e"
203
+ "sha256": "42d29af2f0ac96252d694996864d54b3fddda47d6ad5405020a1354e13372efa"
204
204
  },
205
205
  {
206
206
  "path": "core/hellolynk-neutral-host-store-adapters.mjs",
@@ -328,7 +328,7 @@
328
328
  },
329
329
  {
330
330
  "path": "bootstrap/core/hellolynk-client-core.mjs",
331
- "sha256": "5d2190c2354ede169b2053864674c7ae5b80985970dc13609d6818c5a6d16940"
331
+ "sha256": "186332d5dea8876cf8ca57fef35e9810df5256ed36f704f7bd3840e45c406a4a"
332
332
  },
333
333
  {
334
334
  "path": "bootstrap/core/hellolynk-client-profile.mjs",
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "contract": "hellolynk-neutral-host-release-pin-v1",
3
- "manifestSha256": "ccbbf2cd800830e7c518988dff8d512869df8494e4200547803aca6c21430c89"
3
+ "manifestSha256": "d2cff22cd8e4a224bf24c4a57b67d4c7a4adce9721405d81da52c7eb3c3032ab"
4
4
  }