@linkedclaw/cli 0.1.6 → 0.1.7

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/bin.js CHANGED
@@ -5741,11 +5741,15 @@ var RequesterFlows = class {
5741
5741
  return this.client.discover({ capability, ...extra });
5742
5742
  }
5743
5743
  /**
5744
- * Open a session. HTTP create → WS handshake (SESSION_CREATE/ACCEPT) → done.
5744
+ * Open a session.
5745
5745
  *
5746
- * Default transport is /ws native providers register there
5747
- * (`SkillConfig.try_acp=False` upstream default). Set `tryAcp: true` to try
5748
- * /acp first; on opt-in, falls back to /ws when the recipient isn't on /acp.
5746
+ * Default: pure HTTP — `POST /sessions` then `POST /activate`. Cloud
5747
+ * drives the SESSION_CREATE handshake to the provider server-side. No
5748
+ * WebSocket opens on the requester side; no `agentId` registration
5749
+ * required.
5750
+ *
5751
+ * `tryAcp: true` opts into the legacy WS handshake path for OpenClaw
5752
+ * sub-agent / ACP-routed scenarios — see {@link HireParams.tryAcp}.
5749
5753
  */
5750
5754
  async hire(params) {
5751
5755
  const session = await this.client.createSession({
@@ -5755,9 +5759,9 @@ var RequesterFlows = class {
5755
5759
  ...params.referredBy !== void 0 ? { referred_by: params.referredBy } : {}
5756
5760
  });
5757
5761
  if (params.autoActivate === false) return { session, activated: false };
5758
- const relayUrl = params.relayUrl ?? DEFAULT_RELAY_URL;
5759
5762
  try {
5760
5763
  if (params.tryAcp) {
5764
+ const relayUrl = params.relayUrl ?? DEFAULT_RELAY_URL;
5761
5765
  const acpUrl = relayUrl.replace(/\/ws$/, "/acp");
5762
5766
  try {
5763
5767
  await this.attemptHandshake(acpUrl, session.session_id, params, ACP_CONNECT_TIMEOUT_MS);
@@ -5765,8 +5769,6 @@ var RequesterFlows = class {
5765
5769
  if (!(err instanceof TransportMissError)) throw err;
5766
5770
  await this.attemptHandshake(relayUrl, session.session_id, params, SESSION_ACCEPT_TIMEOUT_MS);
5767
5771
  }
5768
- } else {
5769
- await this.attemptHandshake(relayUrl, session.session_id, params, SESSION_ACCEPT_TIMEOUT_MS);
5770
5772
  }
5771
5773
  await this.client.activateSession(session.session_id);
5772
5774
  } catch (err) {
@@ -5779,7 +5781,14 @@ var RequesterFlows = class {
5779
5781
  }
5780
5782
  return { session, activated: true };
5781
5783
  }
5784
+ // tryAcp:true path only. Default `hire()` no longer calls this — see the
5785
+ // method comment on `hire`. Kept for OpenClaw sub-agent integration.
5782
5786
  async attemptHandshake(url, sessionId, params, connectTimeoutMs) {
5787
+ if (!params.agentId) {
5788
+ throw new Error(
5789
+ "attemptHandshake (tryAcp:true) requires `agentId` in HireParams \u2014 the WS IDENTIFY frame validates listing ownership. Use the default HTTP path (omit tryAcp) if you don't have a registered agent listing."
5790
+ );
5791
+ }
5783
5792
  const ws = new WebSocket2(url);
5784
5793
  try {
5785
5794
  await new Promise((resolve3, reject) => {